This commit is contained in:
Noah Pilarski 2022-09-11 02:57:24 -04:00
parent 1182865753
commit b8c28e3734
2 changed files with 19 additions and 3 deletions

View File

@ -12,6 +12,7 @@ namespace NewHorizons.Builder.Body
private static MeshGroup _oceanMeshGroup; private static MeshGroup _oceanMeshGroup;
private static Material[] _oceanLowAltitudeMaterials; private static Material[] _oceanLowAltitudeMaterials;
private static GameObject _oceanFog; private static GameObject _oceanFog;
private static GameObject _oceanAmbientLight;
internal static void InitPrefabs() internal static void InitPrefabs()
{ {
@ -30,6 +31,7 @@ namespace NewHorizons.Builder.Body
} }
if (_oceanLowAltitudeMaterials == null) _oceanLowAltitudeMaterials = SearchUtilities.Find("Ocean_GD").GetComponent<TessellatedSphereLOD>()._lowAltitudeMaterials.MakePrefabMaterials(); if (_oceanLowAltitudeMaterials == null) _oceanLowAltitudeMaterials = SearchUtilities.Find("Ocean_GD").GetComponent<TessellatedSphereLOD>()._lowAltitudeMaterials.MakePrefabMaterials();
if (_oceanFog == null) _oceanFog = SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/OceanFog").InstantiateInactive().Rename("Prefab_GD_OceanFog").DontDestroyOnLoad(); if (_oceanFog == null) _oceanFog = SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/OceanFog").InstantiateInactive().Rename("Prefab_GD_OceanFog").DontDestroyOnLoad();
if (_oceanAmbientLight == null) _oceanAmbientLight = SearchUtilities.Find("Ocean_GD").GetComponent<OceanLODController>()._ambientLight.gameObject.InstantiateInactive().Rename("OceanAmbientLight").DontDestroyOnLoad();
} }
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module) public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module)
@ -74,7 +76,7 @@ namespace NewHorizons.Builder.Body
var OLC = waterGO.AddComponent<OceanLODController>(); var OLC = waterGO.AddComponent<OceanLODController>();
OLC._sector = sector; OLC._sector = sector;
OLC._ambientLight = null; // this needs to be set or else is black OLC._ambientLight = _oceanAmbientLight.GetComponent<Light>(); // this needs to be set or else is black
// trigger sector enter // trigger sector enter
Delay.FireOnNextUpdate(() => Delay.FireOnNextUpdate(() =>

View File

@ -447,10 +447,24 @@ namespace NewHorizons
var distantSun = eyeSector.gameObject.FindChild("DistantSun/Directional light"); var distantSun = eyeSector.gameObject.FindChild("DistantSun/Directional light");
var starController = distantSun.AddComponent<StarController>(); var starController = distantSun.AddComponent<StarController>();
starController.Light = distantSun.GetComponent<Light>(); var sunLight = distantSun.GetComponent<Light>();
starController.Light = sunLight;
var ambientLightFake = new GameObject("AmbientLightFake", typeof(Light));
ambientLightFake.transform.SetParent(distantSun.transform, false);
ambientLightFake.SetActive(false);
var ambientLight = ambientLightFake.GetComponent<Light>();
ambientLight.intensity = 0;
ambientLight.range = 0;
ambientLight.enabled = false;
starController.AmbientLight = ambientLight;
starController.Intensity = 0.2f; starController.Intensity = 0.2f;
starController.SunColor = new Color(0.3569f, 0.7843f, 1, 1); starController.SunColor = new Color(0.3569f, 0.7843f, 1, 1);
distantSun.AddComponent<StarLightController>().Awake(); var sunLightController = distantSun.AddComponent<SunLightController>();
sunLightController._sunLight = sunLight;
sunLightController._ambientLight = ambientLight;
sunLightController.Initialize();
var starLightController = distantSun.AddComponent<StarLightController>();
starLightController.Awake();
StarLightController.AddStar(starController); StarLightController.AddStar(starController);
if (IsWarpingFromShip && _ship != null) if (IsWarpingFromShip && _ship != null)