Don't use height map

This commit is contained in:
Noah Pilarski 2022-08-17 21:43:44 -04:00
parent c42318542e
commit 330a9d91e5
3 changed files with 9 additions and 20 deletions

View File

@ -44,10 +44,9 @@ namespace NewHorizons.Builder.Body
// We want to take the largest size I think
var realSize = body.Config.Base.surfaceSize;
GameObject heightMap = null;
if (body.Config.HeightMap != null)
{
heightMap = HeightMapBuilder.Make(newProxy, null, body.Config.HeightMap, body.Mod, 20);
HeightMapBuilder.Make(newProxy, null, body.Config.HeightMap, body.Mod, 20);
if (realSize < body.Config.HeightMap.maxHeight) realSize = body.Config.HeightMap.maxHeight;
}
@ -158,7 +157,7 @@ namespace NewHorizons.Builder.Body
if (body.Config.Base.hasSupernovaShockEffect && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null)
{
proxyController._supernovaPlanetEffectController = SupernovaEffectBuilder.Make(newProxy, null, body.Config, heightMap, procGen, null, null, null, proxyController._atmosphere, proxyController._fog);
proxyController._supernovaPlanetEffectController = SupernovaEffectBuilder.Make(newProxy, null, body.Config, procGen, null, null, null, proxyController._atmosphere, proxyController._fog);
}
// Remove all collisions if there are any

View File

@ -9,7 +9,7 @@ namespace NewHorizons.Builder.Body
{
public static class SupernovaEffectBuilder
{
public static NHSupernovaPlanetEffectController Make(GameObject planetGO, Sector sector, PlanetConfig config, GameObject heightMap, GameObject procGen, Light ambientLight, PlanetaryFogController fog, LODGroup atmosphere, Renderer atmosphereRenderer, Renderer fogImpostor)
public static NHSupernovaPlanetEffectController Make(GameObject planetGO, Sector sector, PlanetConfig config, GameObject procGen, Light ambientLight, PlanetaryFogController fog, LODGroup atmosphere, Renderer atmosphereRenderer, Renderer fogImpostor)
{
var vanillaController = planetGO.GetComponentInChildren<SupernovaPlanetEffectController>();
if (vanillaController != null)
@ -129,20 +129,11 @@ namespace NewHorizons.Builder.Body
shockLayer.transform.position = planetGO.transform.position;
shockLayer.transform.localScale = Vector3.one * biggestSize * 1.1f;
if (!noMeshChange)
if (!noMeshChange && procGen != null)
{
if (heightMap != null)
{
shockLayer.GetComponent<MeshFilter>().sharedMesh = heightMap.GetComponent<MeshCollider>().sharedMesh;
shockLayer.transform.localScale = Vector3.one * 1.1f;
shockLayer.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));
}
else if (procGen != null)
{
shockLayer.GetComponent<MeshFilter>().sharedMesh = procGen.GetComponent<MeshFilter>().sharedMesh;
shockLayer.transform.localScale = Vector3.one * 1.1f;
shockLayer.transform.rotation = Quaternion.Euler(90, 0, 0);
}
shockLayer.GetComponent<MeshFilter>().sharedMesh = procGen.GetComponent<MeshFilter>().sharedMesh;
shockLayer.transform.localScale = Vector3.one * 1.1f;
shockLayer.transform.rotation = Quaternion.Euler(90, 0, 0);
}
return supernovaEffectController;

View File

@ -476,13 +476,12 @@ namespace NewHorizons.Handlers
GeometryBuilder.Make(go, sector, body.Config.Base.groundSize);
}
GameObject heightMap = null;
if (body.Config.HeightMap != null)
{
// resolution = tris on edge per face
// divide by 4 to account for all the way around the equator
var res = body.Config.HeightMap.resolution / 4;
heightMap = HeightMapBuilder.Make(go, sector, body.Config.HeightMap, body.Mod, res, true);
HeightMapBuilder.Make(go, sector, body.Config.HeightMap, body.Mod, res, true);
}
GameObject procGen = null;
@ -583,7 +582,7 @@ namespace NewHorizons.Handlers
if (body.Config.Base.hasSupernovaShockEffect && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null)
{
SupernovaEffectBuilder.Make(go, sector, body.Config, heightMap, procGen, ambientLight, fog, atmosphere, null, fog?._fogImpostor);
SupernovaEffectBuilder.Make(go, sector, body.Config, procGen, ambientLight, fog, atmosphere, null, fog?._fogImpostor);
}
return go;