Commit 0b163eb74c
Unsigned
Layout: unified · split
App/Sources/GlobeView.swift +15
| @@ -65,6 +65,13 @@ struct GlobeView: View { | |||
| 65 | .navigationBarTitleDisplayMode(.inline) | 65 | .navigationBarTitleDisplayMode(.inline) |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | private static var isiOSAppOnVision: Bool { | ||
| 69 | #if os(iOS) | ||
| 70 | if #available(iOS 26.1, *) { return ProcessInfo.processInfo.isiOSAppOnVision } | ||
| 71 | #endif | ||
| 72 | return false | ||
| 73 | } | ||
| 74 | |||
| 68 | @MainActor | 75 | @MainActor |
| 69 | static func makeGlobe(_ page: LibraryPage) async -> Entity { | 76 | static func makeGlobe(_ page: LibraryPage) async -> Entity { |
| 70 | var material = PhysicallyBasedMaterial() | 77 | var material = PhysicallyBasedMaterial() |
| @@ -75,6 +82,14 @@ struct GlobeView: View { | |||
| 75 | } else { | 82 | } else { |
| 76 | material.baseColor = .init(tint: UIColor(Color(hex: page.drawing?.color ?? "") ?? .gray)) | 83 | material.baseColor = .init(tint: UIColor(Color(hex: page.drawing?.color ?? "") ?? .gray)) |
| 77 | } | 84 | } |
| 85 | // The iPhone app on Vision Pro draws the lit material black, so the globe is unlit there. | ||
| 86 | if page.id != "sun" && isiOSAppOnVision { | ||
| 87 | var unlit = UnlitMaterial() | ||
| 88 | unlit.color = .init(tint: material.baseColor.tint, texture: material.baseColor.texture) | ||
| 89 | let globe = ModelEntity(mesh: .generateSphere(radius: 0.5), materials: [unlit]) | ||
| 90 | globe.name = "globe" | ||
| 91 | return globe | ||
| 92 | } | ||
| 78 | if page.id == "sun" { | 93 | if page.id == "sun" { |
| 79 | var glow = UnlitMaterial(color: UIColor(Color(hex: page.drawing?.color ?? "") ?? .yellow)) | 94 | var glow = UnlitMaterial(color: UIColor(Color(hex: page.drawing?.color ?? "") ?? .yellow)) |
| 80 | if let url = mapURL(page.id), let texture = try? await TextureResource(contentsOf: url) { glow.color = .init(texture: .init(texture)) } | 95 | if let url = mapURL(page.id), let texture = try? await TextureResource(contentsOf: url) { glow.color = .init(texture: .init(texture)) } |