switch to simpler rotation shader

This commit is contained in:
JohnCorby 2023-04-23 16:14:48 -07:00
parent 62f7f6d61a
commit 9616a1aca4
3 changed files with 5 additions and 15 deletions

View File

@ -1,6 +1,5 @@
using NewHorizons.Builder.Body.Geometry;
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.OWML;
using OWML.Common;
@ -60,7 +59,7 @@ namespace NewHorizons.Builder.Body
var cubeSphere = new GameObject("CubeSphere");
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");
@ -99,10 +98,6 @@ namespace NewHorizons.Builder.Body
var superGroup = planetGO.GetComponent<ProxyShadowCasterSuperGroup>();
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);
// 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)
{
var LODCubeSphere = new GameObject("LODCubeSphere");
LODCubeSphere.transform.SetParent(cubeSphere.transform, false);
LODCubeSphere.AddComponent<MeshFilter>().mesh = CubeSphere.Build(resolution, heightMap, module.minHeight, module.maxHeight, stretch);
@ -141,9 +137,6 @@ namespace NewHorizons.Builder.Body
alphaTile.TryApplyTile(material);
}
LODCubeSphere.transform.parent = cubeSphere.transform;
LODCubeSphere.transform.localPosition = Vector3.zero;
return cubeSphereMR;
}
}

View File

@ -118,9 +118,6 @@ namespace NewHorizons.Builder.Props
i--;
continue;
}
// rotate in the same way heightmaps are rotated
point = Quaternion.Euler(0, -90, 0) * point;
}
var prop = scatterPrefab.InstantiateInactive();

View File

@ -10,9 +10,9 @@ namespace NewHorizons.Utility.Geometry
float x, y, z;
if (useShaderCoords)
{
// shader does some jank stuff to match standard shader
x = -v.z;
y = v.x;
// Y is DOWN is the shader
x = v.x;
y = v.z;
z = -v.y;
}
else