Skip to content

Commit

Permalink
Preparing for 1.4.3 and 1.3.1 backports
Browse files Browse the repository at this point in the history
  • Loading branch information
StollD committed Apr 27, 2018
1 parent 7d58794 commit fc0984c
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 2,419 deletions.
12 changes: 4 additions & 8 deletions src/Kopernicus.Components/Kopernicus.Components.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\packages\Assembly-CSharp.1.4.2\lib\net35\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\packages\Assembly-CSharp.1.4.3\lib\net35\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ModularFlightIntegrator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\packages\ModularFlightIntegrator.1.2.4.2\lib\net35\ModularFlightIntegrator.dll</HintPath>
<HintPath>..\..\packages\ModularFlightIntegrator.1.2.5.0\lib\net35\ModularFlightIntegrator.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
Expand All @@ -46,11 +46,11 @@
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\packages\UnityEngine.1.4.2\lib\net35\UnityEngine.dll</HintPath>
<HintPath>..\..\packages\UnityEngine.1.4.3\lib\net35\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\packages\UnityEngine.UI.1.4.2\lib\net35\UnityEngine.UI.dll</HintPath>
<HintPath>..\..\packages\UnityEngine.UI.1.4.3\lib\net35\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand All @@ -61,10 +61,6 @@
<Compile Include="KopernicusBuoyancy.cs" />
<Compile Include="KopernicusOrbitRendererData.cs" />
<Compile Include="KopernicusSolarPanel.cs" />
<Compile Include="KopernicusStarAFG.cs" />
<Compile Include="KopernicusStarOcclusion.cs" />
<Compile Include="KopernicusStarSkybox.cs" />
<Compile Include="KopernicusStarTimeOfDay.cs" />
<Compile Include="KSC.cs" />
<Compile Include="LightShifter.cs" />
<Compile Include="MaterialWrapper\AerialTransCutout.cs" />
Expand Down
4 changes: 4 additions & 0 deletions src/Kopernicus.Components/KopernicusOrbitRendererData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public Color nodeColor
set { _nodeColor.SetValue(this, value); }
}

#if !KSP131
public KopernicusOrbitRendererData(CelestialBody body, OrbitRendererBase renderer) : base(body)
#else
public KopernicusOrbitRendererData(CelestialBody body, OrbitRenderer renderer) : base(body)
#endif
{
orbitColor = renderer.orbitColor;
nodeColor = renderer.nodeColor;
Expand Down
28 changes: 4 additions & 24 deletions src/Kopernicus.Components/KopernicusStar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@ public class KopernicusStar : Sun
/// </summary>
public KopernicusSunFlare lensFlare;

/// <summary>
/// Determines how much of the stars surface is blocked by other bodies
/// </summary>
public KopernicusStarOcclusion occlusion;

/// <summary>
/// Returns how intense the starlight is, compared to stock
/// </summary>
public Single RelativeIntensity
{
get
{
return shifter.intensityCurve.Evaluate((Single) Vector3d.Distance(sun.position,
ScaledSpace.ScaledToLocalSpace(target.position))) / 0.9f;
}
}

/// <summary>
/// Override for <see cref="FlightIntegrator.CalculateSunBodyFlux"/>
/// </summary>
Expand Down Expand Up @@ -216,9 +199,6 @@ protected override void Awake()
Stars.Add(this);
DontDestroyOnLoad(this);
light = gameObject.GetComponent<Light>();
occlusion = new GameObject().AddComponent<KopernicusStarOcclusion>();
occlusion.Star = this;
DontDestroyOnLoad(occlusion);

// Gah
typeof(Sun).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).Last(f => f.FieldType == typeof(Light)).SetValue(this, light);
Expand Down Expand Up @@ -293,21 +273,21 @@ void LateUpdate()
{
light.color = shifter.sunlightColor;
light.intensity =
shifter.intensityCurve.Evaluate((Single) Vector3d.Distance(sun.position, localSpace)) * occlusion.VisibleArea;
shifter.intensityCurve.Evaluate((Single) Vector3d.Distance(sun.position, localSpace));
light.shadowStrength = shifter.sunlightShadowStrength;
}

// Patch the ScaledSpace light
if (scaledSunLight)
{
scaledSunLight.color = shifter.scaledSunlightColor;
scaledSunLight.intensity = shifter.scaledIntensityCurve.Evaluate((Single)Vector3d.Distance(ScaledSpace.LocalToScaledSpace(sun.position), target.position)) * occlusion.VisibleArea;
scaledSunLight.intensity = shifter.scaledIntensityCurve.Evaluate((Single)Vector3d.Distance(ScaledSpace.LocalToScaledSpace(sun.position), target.position));
}

if (HighLogic.LoadedSceneIsFlight && iva?.GetComponent<Light>())
{
iva.GetComponent<Light>().color = shifter.IVASunColor;
iva.GetComponent<Light>().intensity = shifter.ivaIntensityCurve.Evaluate((Single)Vector3d.Distance(sun.position, localSpace)) * occlusion.VisibleArea;
iva.GetComponent<Light>().intensity = shifter.ivaIntensityCurve.Evaluate((Single)Vector3d.Distance(sun.position, localSpace));
}

// Set SunFlare color
Expand All @@ -318,7 +298,7 @@ void LateUpdate()
lensFlare.brightnessCurve = shifter.brightnessCurve.Curve;
lensFlare.sun = sun;
lensFlare.target = target;
lensFlare.occlusionMultiplier = 1 * occlusion.VisibleArea;
lensFlare.occlusionMultiplier = 1;

// States
Boolean lightsOn = (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneHasPlanetarium || HighLogic.LoadedScene == GameScenes.SPACECENTER);
Expand Down
44 changes: 0 additions & 44 deletions src/Kopernicus.Components/KopernicusStarAFG.cs

This file was deleted.

161 changes: 0 additions & 161 deletions src/Kopernicus.Components/KopernicusStarOcclusion.cs

This file was deleted.

Loading

0 comments on commit fc0984c

Please sign in to comment.