Skip to content

Commit

Permalink
Update for KSP 1.3.1
Browse files Browse the repository at this point in the history
Configurable particles, GUI restyle.
  • Loading branch information
RangeMachine committed Oct 6, 2017
1 parent 5a1e9f9 commit dfd6a55
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 306 deletions.
4 changes: 1 addition & 3 deletions .gitignore
@@ -1,8 +1,6 @@
Dependencies/Assembly-CSharp.dll
Dependencies/UnityEngine.dll
Sources/Clouds/obj/*
Sources/Geometry/obj/*
Sources/Utilities/obj/*
Sources/obj/*
GameData/KerbalVisualEnhancements/Plugins/*
Unity/Bundles/*
Unity/Library/*
Expand Down
8 changes: 0 additions & 8 deletions GameData/KerbalVisualEnhancements/Settings.cfg

This file was deleted.

10 changes: 1 addition & 9 deletions KerbalVisualEnhancements.sln
Expand Up @@ -3,11 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clouds", "Sources\Clouds\Clouds.csproj", "{8DF6A385-18E6-4E76-A060-4C3847CA3046}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Geometry", "Sources\Geometry\Geometry.csproj", "{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utilities", "Sources\Utilities\Utilities.csproj", "{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KerbalVisualEnhancements", "Sources\KerbalVisualEnhancements.csproj", "{8DF6A385-18E6-4E76-A060-4C3847CA3046}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,10 +12,6 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8DF6A385-18E6-4E76-A060-4C3847CA3046}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
{8DF6A385-18E6-4E76-A060-4C3847CA3046}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@

### About plugin

This is raw port of [**Environmental Visual Enhancements 7.4**](https://github.com/rbray89/EnvironmentalVisualEnhancements/releases/tag/7-4) for **Kerbal Space Program 1.2** with some modifications. Regarding source plugin here fixed white clouds on the night side and Z-figthing when your are far away from planet.
This is raw port of [**Environmental Visual Enhancements 7.4**](https://github.com/rbray89/EnvironmentalVisualEnhancements/releases/tag/7-4) for **Kerbal Space Program 1.2** with some modifications. Regarding source plugin here fixed white clouds on the night side and Z-figthing when your are far away from planet. Also now it's allowed to change particle textures and rendering distance for every layer.

It's supports all old clouds packs like [**Better Atmospheres**](http://forum.kerbalspaceprogram.com/index.php?/topic/70221-025090-better-atmospheres-v5-june-14th-2014/), [**Astronomers Visual Pack**](http://forum.kerbalspaceprogram.com/index.php?/topic/92113-025-astronomers-visual-pack-interstellar-v2/) and others.

Expand Down
63 changes: 48 additions & 15 deletions Sources/Clouds/CloudLayer.cs → Sources/CloudLayer.cs
Expand Up @@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright © 2013-2016 Ryan Bray, RangeMachine
* Copyright © 2013-2017 Ryan Bray, RangeMachine
*/

using System.Collections.Generic;
Expand Down Expand Up @@ -63,6 +63,10 @@ public static Shader CloudShader
private float altitude;
private TextureSet mainTexture;
private TextureSet detailTexture;
private string particleTopTexture;
private string particleLeftTexture;
private string particleFrontTexture;
private float particleDistance;
private ShaderFloats scaledShaderFloats;
private ShaderFloats shaderFloats;
private Overlay CloudOverlay;
Expand All @@ -72,6 +76,10 @@ public static Shader CloudShader
public ConfigNode ConfigNode { get { return node; } }
public TextureSet MainTexture { get { return mainTexture; } }
public TextureSet DetailTexture { get { return detailTexture; } }
public string ParticleTopTexture { get { return particleTopTexture; } }
public string ParticleLeftTexture { get { return particleLeftTexture; } }
public string ParticleFrontTexture { get { return particleFrontTexture; } }
public float ParticleDistance { get { return particleDistance; } }
public Color Color { get { return color; } }
public float Altitude { get { return altitude; } }
public ShaderFloats ScaledShaderFloats { get { return scaledShaderFloats; } }
Expand All @@ -82,6 +90,10 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
{
mainTexture.Clone(cloudGUI.MainTexture);
detailTexture.Clone(cloudGUI.DetailTexture);
particleTopTexture = cloudGUI.ParticleTopTexture;
particleLeftTexture = cloudGUI.ParticleLeftTexture;
particleFrontTexture = cloudGUI.ParticleFrontTexture;
particleDistance = cloudGUI.ParticleDistance.AltitudeF;
scaledShaderFloats.Clone(cloudGUI.ScaledShaderFloats);
shaderFloats.Clone(cloudGUI.ShaderFloats);
altitude = cloudGUI.Altitude.AltitudeF;
Expand All @@ -100,6 +112,8 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
volume.Destroy();
volume = null;
}

DominantCallback(true);
}
else
{
Expand All @@ -116,6 +130,10 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
public CloudLayer(string url, ConfigNode node, string body, Color color, float altitude,
TextureSet mainTexture,
TextureSet detailTexture,
string particleTopTexture,
string particleLeftTexture,
string particleFrontTexture,
float volumeDistance,
ShaderFloats ScaledShaderFloats,
ShaderFloats ShaderFloats,
bool useVolume)
Expand Down Expand Up @@ -143,6 +161,10 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
this.mainTexture = mainTexture;

this.detailTexture = detailTexture;
this.particleTopTexture = particleTopTexture;
this.particleLeftTexture = particleLeftTexture;
this.particleFrontTexture = particleFrontTexture;
this.particleDistance = volumeDistance;

scaledShaderFloats = ScaledShaderFloats;
shaderFloats = ShaderFloats;
Expand Down Expand Up @@ -171,7 +193,31 @@ private void UpdateTextures()
ScaledCloudMaterial.SetTexture("_DetailTex", new Texture());
CloudMaterial.SetTexture("_DetailTex", new Texture());
}

Texture2D topTexture = GameDatabase.Instance.GetTexture(this.particleTopTexture, false);
if (topTexture != null)
{
topTexture.wrapMode = TextureWrapMode.Clamp;
CloudParticleMaterial.SetTexture("_TopTex", topTexture);
}

Texture2D leftTexture = GameDatabase.Instance.GetTexture(this.particleLeftTexture, false);
if (leftTexture != null)
{
leftTexture.wrapMode = TextureWrapMode.Clamp;
CloudParticleMaterial.SetTexture("_LeftTex", leftTexture);
}

Texture2D frontTexture = GameDatabase.Instance.GetTexture(this.particleFrontTexture, false);
if (frontTexture != null)
{
frontTexture.wrapMode = TextureWrapMode.Clamp;
CloudParticleMaterial.SetTexture("_FrontTex", frontTexture);
}

//CloudParticleMaterial.SetFloat("_DistFade", 1f / particleDistance);
CloudParticleMaterial.SetFloat("_DistFadeVert", particleDistance);

}

public void Init()
Expand All @@ -191,19 +237,6 @@ public void Init()
shaderFloats = GetDefault(false);
}

Texture2D tex1 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/1", false);
Texture2D tex2 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/2", false);
Texture2D tex3 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/3", false);

tex1.wrapMode = TextureWrapMode.Clamp;
tex2.wrapMode = TextureWrapMode.Clamp;
tex3.wrapMode = TextureWrapMode.Clamp;

CloudParticleMaterial.SetTexture("_TopTex", tex1);
CloudParticleMaterial.SetTexture("_LeftTex", tex2);
CloudParticleMaterial.SetTexture("_FrontTex", tex3);
CloudParticleMaterial.SetFloat("_DistFade", 1f / 2250f);

Log("Cloud Material initialized");
UpdateTextures();
Log("Generating Overlay...");
Expand Down Expand Up @@ -300,7 +333,7 @@ public void PerformUpdate()

public static void Log(string message)
{
UnityEngine.Debug.Log("Clouds: " + message);
UnityEngine.Debug.Log("[KerbalVisualEnhancements]: " + message);
}

public static int GetBodyLayerCount(string url, string body)
Expand Down

0 comments on commit dfd6a55

Please sign in to comment.