Skip to content

Commit

Permalink
Disable MSAA for pixel scale > 2
Browse files Browse the repository at this point in the history
  • Loading branch information
frzi committed Dec 19, 2021
1 parent 181c090 commit 4e9e7db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/frzi/GLTFSceneKit",
"state": {
"branch": null,
"revision": "8bd50d2887c4e0ccc50b9e576768c1800ae15c50",
"version": "0.3.0"
"revision": "589cac03b34a7f5103d14b3741bfcd8add417593",
"version": null
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/Model3DView/Model3DView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ public struct Model3DView: ViewRepresentable {
#endif

// Anti-aliasing.
// If the screen's pixel ratio is above 1 we disable anti-aliasing. Otherwise use MSAAx2.
// If the screen's pixel ratio is above 2 we disable anti-aliasing. Otherwise use MSAAx2.
// This may become a view modifier at some point instead.
#if os(macOS)
let screenScale = NSScreen.main?.backingScaleFactor ?? 1
#elseif os(iOS) || os(tvOS)
let screenScale = UIScreen.main.scale
#endif

view.antialiasingMode = screenScale > 1 ? .none : .multisampling2X
view.antialiasingMode = screenScale > 2 ? .none : .multisampling2X

context.coordinator.camera = context.environment.camera
context.coordinator.setView(view)
Expand Down

0 comments on commit 4e9e7db

Please sign in to comment.