Skip to content

Commit

Permalink
Fix local space intensity and IVAIntensityCurve
Browse files Browse the repository at this point in the history
  • Loading branch information
StollD committed Oct 26, 2017
1 parent 26a2a2b commit bdfc343
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Kopernicus.Components/Kopernicus.Components.csproj
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>Kopernicus.Components</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
5 changes: 2 additions & 3 deletions src/Kopernicus.Components/KopernicusStar.cs
Expand Up @@ -285,7 +285,7 @@ void LateUpdate()
if (HighLogic.LoadedSceneIsFlight && iva?.GetComponent<Light>())
{
iva.GetComponent<Light>().color = shifter.IVASunColor;
iva.GetComponent<Light>().intensity = shifter.IVASunIntensity;
iva.GetComponent<Light>().intensity = shifter.ivaIntensityCurve.Evaluate((Single)Vector3d.Distance(sun.position, target.position));
}

// Set SunFlare color
Expand All @@ -312,7 +312,6 @@ void LateUpdate()
if (FlightGlobals.currentMainBody == null || FlightGlobals.currentMainBody == sun)
{
localTime = 1f;
light.intensity = scaledSunLight.intensity;
}
else
{
Expand All @@ -325,7 +324,7 @@ void LateUpdate()
Single fadeStartAtAlt = horizonScalar + fadeStart * dayNightRatio;
Single fadeEndAtAlt = horizonScalar - fadeEnd * dayNightRatio;
localTime = Vector3.Dot(-FlightGlobals.getUpAxis(localSpace), transform.forward);
light.intensity = Mathf.Lerp(0f, scaledSunLight.intensity, Mathf.InverseLerp(fadeEndAtAlt, fadeStartAtAlt, localTime));
light.intensity = Mathf.Lerp(0f, light.intensity, Mathf.InverseLerp(fadeEndAtAlt, fadeStartAtAlt, localTime));
}
}

Expand Down

0 comments on commit bdfc343

Please sign in to comment.