From 330a9d91e551efc378b96f521f80a95d24c2a198 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 17 Aug 2022 21:43:44 -0400 Subject: [PATCH] Don't use height map --- NewHorizons/Builder/Body/ProxyBuilder.cs | 5 ++--- .../Builder/Body/SupernovaEffectBuilder.cs | 19 +++++-------------- NewHorizons/Handlers/PlanetCreationHandler.cs | 5 ++--- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index 4ff3c84d..49befd13 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -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 diff --git a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs index 746a976f..80d6ea31 100644 --- a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs +++ b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs @@ -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(); 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().sharedMesh = heightMap.GetComponent().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().sharedMesh = procGen.GetComponent().sharedMesh; - shockLayer.transform.localScale = Vector3.one * 1.1f; - shockLayer.transform.rotation = Quaternion.Euler(90, 0, 0); - } + shockLayer.GetComponent().sharedMesh = procGen.GetComponent().sharedMesh; + shockLayer.transform.localScale = Vector3.one * 1.1f; + shockLayer.transform.rotation = Quaternion.Euler(90, 0, 0); } return supernovaEffectController; diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 5b6f1eb1..4beee488 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -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;