mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
switch to simpler rotation shader
This commit is contained in:
parent
62f7f6d61a
commit
9616a1aca4
@ -1,6 +1,5 @@
|
|||||||
using NewHorizons.Builder.Body.Geometry;
|
using NewHorizons.Builder.Body.Geometry;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
|
||||||
using NewHorizons.Utility.Files;
|
using NewHorizons.Utility.Files;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
@ -60,7 +59,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var cubeSphere = new GameObject("CubeSphere");
|
var cubeSphere = new GameObject("CubeSphere");
|
||||||
cubeSphere.SetActive(false);
|
cubeSphere.SetActive(false);
|
||||||
cubeSphere.transform.parent = sector?.transform ?? planetGO.transform;
|
cubeSphere.transform.SetParent(sector?.transform ?? planetGO.transform, false);
|
||||||
|
|
||||||
if (PlanetShader == null) PlanetShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");
|
if (PlanetShader == null) PlanetShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");
|
||||||
|
|
||||||
@ -99,10 +98,6 @@ namespace NewHorizons.Builder.Body
|
|||||||
var superGroup = planetGO.GetComponent<ProxyShadowCasterSuperGroup>();
|
var superGroup = planetGO.GetComponent<ProxyShadowCasterSuperGroup>();
|
||||||
if (superGroup != null) cubeSphere.AddComponent<ProxyShadowCaster>()._superGroup = superGroup;
|
if (superGroup != null) cubeSphere.AddComponent<ProxyShadowCaster>()._superGroup = superGroup;
|
||||||
|
|
||||||
// rotate for backwards compat :P
|
|
||||||
cubeSphere.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(0, -90, 0));
|
|
||||||
cubeSphere.transform.position = planetGO.transform.position;
|
|
||||||
|
|
||||||
cubeSphere.SetActive(true);
|
cubeSphere.SetActive(true);
|
||||||
|
|
||||||
// Now that we've made the mesh we can delete the heightmap texture
|
// Now that we've made the mesh we can delete the heightmap texture
|
||||||
@ -113,6 +108,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
MeshRenderer MakeLODTerrain(int resolution, bool useTriplanar)
|
MeshRenderer MakeLODTerrain(int resolution, bool useTriplanar)
|
||||||
{
|
{
|
||||||
var LODCubeSphere = new GameObject("LODCubeSphere");
|
var LODCubeSphere = new GameObject("LODCubeSphere");
|
||||||
|
LODCubeSphere.transform.SetParent(cubeSphere.transform, false);
|
||||||
|
|
||||||
LODCubeSphere.AddComponent<MeshFilter>().mesh = CubeSphere.Build(resolution, heightMap, module.minHeight, module.maxHeight, stretch);
|
LODCubeSphere.AddComponent<MeshFilter>().mesh = CubeSphere.Build(resolution, heightMap, module.minHeight, module.maxHeight, stretch);
|
||||||
|
|
||||||
@ -141,9 +137,6 @@ namespace NewHorizons.Builder.Body
|
|||||||
alphaTile.TryApplyTile(material);
|
alphaTile.TryApplyTile(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
LODCubeSphere.transform.parent = cubeSphere.transform;
|
|
||||||
LODCubeSphere.transform.localPosition = Vector3.zero;
|
|
||||||
|
|
||||||
return cubeSphereMR;
|
return cubeSphereMR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,9 +118,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate in the same way heightmaps are rotated
|
|
||||||
point = Quaternion.Euler(0, -90, 0) * point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var prop = scatterPrefab.InstantiateInactive();
|
var prop = scatterPrefab.InstantiateInactive();
|
||||||
|
|||||||
@ -10,9 +10,9 @@ namespace NewHorizons.Utility.Geometry
|
|||||||
float x, y, z;
|
float x, y, z;
|
||||||
if (useShaderCoords)
|
if (useShaderCoords)
|
||||||
{
|
{
|
||||||
// shader does some jank stuff to match standard shader
|
// Y is DOWN is the shader
|
||||||
x = -v.z;
|
x = v.x;
|
||||||
y = v.x;
|
y = v.z;
|
||||||
z = -v.y;
|
z = -v.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user