Use original sun intensity

This commit is contained in:
Noah Pilarski 2022-08-18 11:27:40 -04:00
parent 59e830a1f2
commit 306f81da1a
2 changed files with 6 additions and 2 deletions

View File

@ -28,6 +28,8 @@ namespace NewHorizons.Builder.Body
if (currentController._atmosphere == null && atmosphere != null) currentController._atmosphere = atmosphere;
if (config.Atmosphere != null && config.Atmosphere.atmosphereSunIntensity != 0) currentController._atmosphereOrigSunIntensity = config.Atmosphere.atmosphereSunIntensity;
if (currentController._fog == null && fog != null) currentController._fog = fog;
return currentController;
@ -39,6 +41,7 @@ namespace NewHorizons.Builder.Body
var supernovaEffectController = supernovaController.AddComponent<NHSupernovaPlanetEffectController>();
supernovaEffectController._ambientLight = ambientLight;
supernovaEffectController._ambientLightOrigIntensity = config.Base.ambientLight;
if (config.Atmosphere != null && config.Atmosphere.atmosphereSunIntensity != 0) supernovaEffectController._atmosphereOrigSunIntensity = config.Atmosphere.atmosphereSunIntensity;
supernovaEffectController._atmosphere = atmosphere;
supernovaEffectController._atmosphereRenderer = atmosphereRenderer;
supernovaEffectController._fog = fog;

View File

@ -14,6 +14,7 @@ namespace NewHorizons.Components
public float _ambientLightOrigIntensity;
public LODGroup _atmosphere;
public Renderer _atmosphereRenderer;
public float _atmosphereOrigSunIntensity = 1;
public PlanetaryFogController _fog;
public Renderer _fogImpostor;
public Color _fogOrigTint;
@ -114,7 +115,7 @@ namespace NewHorizons.Components
if (_atmosphere != null)
{
s_matPropBlock_Atmosphere.SetFloat(s_propID_SunIntensity, 1f - collapseProgress);
s_matPropBlock_Atmosphere.SetFloat(s_propID_SunIntensity, _atmosphereOrigSunIntensity * (1f - collapseProgress));
foreach (var lod in _atmosphereLODs)
foreach (var renderer in lod.renderers)
@ -123,7 +124,7 @@ namespace NewHorizons.Components
if (_atmosphereRenderer != null)
{
s_matPropBlock_Atmosphere.SetFloat(s_propID_SunIntensity, 1f - collapseProgress);
s_matPropBlock_Atmosphere.SetFloat(s_propID_SunIntensity, _atmosphereOrigSunIntensity * (1f - collapseProgress));
_atmosphereRenderer.SetPropertyBlock(s_matPropBlock_Atmosphere);
}