atmosphere sun intensity override

This commit is contained in:
JohnCorby 2022-07-25 12:42:10 -07:00
parent a77dbd161a
commit 42a21d8b13
2 changed files with 20 additions and 1 deletions

View File

@ -9,6 +9,7 @@ namespace NewHorizons.Builder.Atmosphere
private static readonly int InnerRadius = Shader.PropertyToID("_InnerRadius"); private static readonly int InnerRadius = Shader.PropertyToID("_InnerRadius");
private static readonly int OuterRadius = Shader.PropertyToID("_OuterRadius"); private static readonly int OuterRadius = Shader.PropertyToID("_OuterRadius");
private static readonly int SkyColor = Shader.PropertyToID("_SkyColor"); private static readonly int SkyColor = Shader.PropertyToID("_SkyColor");
private static readonly int SunIntensity = Shader.PropertyToID("_SunIntensity");
public static readonly List<(GameObject, Material)> Skys = new(); public static readonly List<(GameObject, Material)> Skys = new();
@ -41,8 +42,17 @@ namespace NewHorizons.Builder.Atmosphere
atmo.SetActive(true); atmo.SetActive(true);
if (atmosphereModule.atmosphereSunIntensity == 0)
{
// do it based on distance
Skys.Add((planetGO, material)); Skys.Add((planetGO, material));
} }
else
{
// use the override instead
material.SetFloat(SunIntensity, atmosphereModule.atmosphereSunIntensity);
}
}
atmoGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero); atmoGO.transform.position = planetGO.transform.TransformPoint(Vector3.zero);
atmoGO.SetActive(true); atmoGO.SetActive(true);

View File

@ -40,6 +40,15 @@ namespace NewHorizons.External.Modules
/// </summary> /// </summary>
public MColor atmosphereTint; public MColor atmosphereTint;
/// <summary>
/// How intense should the sun appear in the sky.
/// Also affects general atmosphere brightness.
/// Default value of 1 matches Timber Hearth.
/// If not set, this will be determined based off the distance to the sun.
/// </summary>
[Range(0f, double.MaxValue)]
public float atmosphereSunIntensity;
/// <summary> /// <summary>
/// Describes the clouds in the atmosphere /// Describes the clouds in the atmosphere
/// </summary> /// </summary>