Skip to content

Commit

Permalink
Fix the display of milky way texture
Browse files Browse the repository at this point in the history
  • Loading branch information
DJBen committed Jul 3, 2023
1 parent 4ba50f8 commit aebcbe3
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 52 deletions.
9 changes: 4 additions & 5 deletions Graviton/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="MsG-vN-XK9">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="MsG-vN-XK9">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down
2 changes: 1 addition & 1 deletion Graviton/Common/Nodes/SphereInteriorNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SphereInteriorNode: SCNNode {
init(radius: Double, textureLongitudeOffset: Double = 0) {
super.init()
let sphere = SCNSphere(radius: CGFloat(radius))
sphere.firstMaterial!.cullMode = .back
sphere.firstMaterial!.cullMode = .front
sphere.firstMaterial!.locksAmbientWithDiffuse = true
geometry = sphere
var mtx = SCNMatrix4MakeRotation(Float(-Double.pi / 2), 1, 0, 0)
Expand Down
6 changes: 3 additions & 3 deletions Graviton/Observer/Resources/Textures.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "debug_sphere_directions_transparency.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "milkyway.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "mounain_panorama.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
10 changes: 5 additions & 5 deletions Graviton/Observer/Scenes/ObserverScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ObserverScene: SCNScene, CameraResponsive, FocusingSupport {

private lazy var milkyWayNode: SCNNode = {
let node = SphereInteriorNode(radius: milkywayLayerRadius, textureLongitudeOffset: -Double.pi / 2)
node.sphere.firstMaterial!.diffuse.contents = #imageLiteral(resourceName: "milkyway.png")
node.sphere.firstMaterial!.diffuse.contents = UIImage(named: "milkyway")
node.sphere.firstMaterial!.locksAmbientWithDiffuse = true
node.opacity = 0.3
node.categoryBitMask = VisibilityCategory.nonMoon.rawValue
Expand All @@ -124,7 +124,7 @@ class ObserverScene: SCNScene, CameraResponsive, FocusingSupport {
lazy var panoramaNode: SCNNode = {
let node = SphereInteriorNode(radius: landscapeLayerRadius)
node.sphere.firstMaterial!.diffuse.contents = UIColor.white
node.sphere.firstMaterial!.transparent.contents = #imageLiteral(resourceName: "debug_sphere_directions_transparency")
node.sphere.firstMaterial!.transparent.contents = UIImage(named: "debug_sphere_directions_transparency")
node.sphere.firstMaterial!.transparent.contentsTransform = flipTextureContentsTransform
node.sphere.firstMaterial!.isDoubleSided = true
node.sphere.firstMaterial!.locksAmbientWithDiffuse = true
Expand Down Expand Up @@ -719,15 +719,15 @@ private extension ObserverScene {
switch key {
case "citySilhoulette":
material?.transparencyMode = .aOne
material?.transparent.contents = #imageLiteral(resourceName: "panorama_city_silhoulette")
material?.transparent.contents = UIImage(named: "panorama_city_silhoulette")
material?.diffuse.contents = UIColor.lightGray.withAlphaComponent(0.3)
case "debugNode":
material?.transparencyMode = .aOne
material?.transparent.contents = #imageLiteral(resourceName: "debug_sphere_directions_transparency")
material?.transparent.contents = UIImage(named: "debug_sphere_directions_transparency")
material?.diffuse.contents = UIColor.white
case "silverMountain":
material?.transparencyMode = .aOne
material?.transparent.contents = #imageLiteral(resourceName: "mounain_panorama")
material?.transparent.contents = UIImage(named: "mountain_panorama")
material?.diffuse.contents = UIColor.white
case "none":
break
Expand Down

0 comments on commit aebcbe3

Please sign in to comment.