Skip to content

Commit dfd6a55

Browse files
committed
Update for KSP 1.3.1
Configurable particles, GUI restyle.
1 parent 5a1e9f9 commit dfd6a55

File tree

21 files changed

+214
-306
lines changed

21 files changed

+214
-306
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Dependencies/Assembly-CSharp.dll
22
Dependencies/UnityEngine.dll
3-
Sources/Clouds/obj/*
4-
Sources/Geometry/obj/*
5-
Sources/Utilities/obj/*
3+
Sources/obj/*
64
GameData/KerbalVisualEnhancements/Plugins/*
75
Unity/Bundles/*
86
Unity/Library/*

GameData/KerbalVisualEnhancements/Settings.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

KerbalVisualEnhancements.sln

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
44
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clouds", "Sources\Clouds\Clouds.csproj", "{8DF6A385-18E6-4E76-A060-4C3847CA3046}"
7-
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Geometry", "Sources\Geometry\Geometry.csproj", "{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}"
9-
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utilities", "Sources\Utilities\Utilities.csproj", "{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KerbalVisualEnhancements", "Sources\KerbalVisualEnhancements.csproj", "{8DF6A385-18E6-4E76-A060-4C3847CA3046}"
117
EndProject
128
Global
139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,10 +12,6 @@ Global
1612
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1713
{8DF6A385-18E6-4E76-A060-4C3847CA3046}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
1814
{8DF6A385-18E6-4E76-A060-4C3847CA3046}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
19-
{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
20-
{8B24314B-4B75-43F3-B31C-FFA9FC83FB70}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
21-
{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}.KerbalVisualEnhancements|Any CPU.ActiveCfg = KerbalVisualEnhancements|Any CPU
22-
{6B877DDF-EBC6-4EFD-A0F7-01F7CAD8CF87}.KerbalVisualEnhancements|Any CPU.Build.0 = KerbalVisualEnhancements|Any CPU
2315
EndGlobalSection
2416
GlobalSection(SolutionProperties) = preSolution
2517
HideSolutionNode = FALSE

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### About plugin
55

6-
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.
6+
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.
77

88
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.
99

Sources/Clouds/CloudLayer.cs renamed to Sources/CloudLayer.cs

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* You should have received a copy of the GNU General Public License
1313
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1414
*
15-
* Copyright © 2013-2016 Ryan Bray, RangeMachine
15+
* Copyright © 2013-2017 Ryan Bray, RangeMachine
1616
*/
1717

1818
using System.Collections.Generic;
@@ -63,6 +63,10 @@ public static Shader CloudParticleShader { get {
6363
private float altitude;
6464
private TextureSet mainTexture;
6565
private TextureSet detailTexture;
66+
private string particleTopTexture;
67+
private string particleLeftTexture;
68+
private string particleFrontTexture;
69+
private float particleDistance;
6670
private ShaderFloats scaledShaderFloats;
6771
private ShaderFloats shaderFloats;
6872
private Overlay CloudOverlay;
@@ -72,6 +76,10 @@ public static Shader CloudParticleShader { get {
7276
public ConfigNode ConfigNode { get { return node; } }
7377
public TextureSet MainTexture { get { return mainTexture; } }
7478
public TextureSet DetailTexture { get { return detailTexture; } }
79+
public string ParticleTopTexture { get { return particleTopTexture; } }
80+
public string ParticleLeftTexture { get { return particleLeftTexture; } }
81+
public string ParticleFrontTexture { get { return particleFrontTexture; } }
82+
public float ParticleDistance { get { return particleDistance; } }
7583
public Color Color { get { return color; } }
7684
public float Altitude { get { return altitude; } }
7785
public ShaderFloats ScaledShaderFloats { get { return scaledShaderFloats; } }
@@ -82,6 +90,10 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
8290
{
8391
mainTexture.Clone(cloudGUI.MainTexture);
8492
detailTexture.Clone(cloudGUI.DetailTexture);
93+
particleTopTexture = cloudGUI.ParticleTopTexture;
94+
particleLeftTexture = cloudGUI.ParticleLeftTexture;
95+
particleFrontTexture = cloudGUI.ParticleFrontTexture;
96+
particleDistance = cloudGUI.ParticleDistance.AltitudeF;
8597
scaledShaderFloats.Clone(cloudGUI.ScaledShaderFloats);
8698
shaderFloats.Clone(cloudGUI.ShaderFloats);
8799
altitude = cloudGUI.Altitude.AltitudeF;
@@ -100,6 +112,8 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
100112
volume.Destroy();
101113
volume = null;
102114
}
115+
116+
DominantCallback(true);
103117
}
104118
else
105119
{
@@ -116,6 +130,10 @@ internal void ApplyGUIUpdate(CloudGUI cloudGUI)
116130
public CloudLayer(string url, ConfigNode node, string body, Color color, float altitude,
117131
TextureSet mainTexture,
118132
TextureSet detailTexture,
133+
string particleTopTexture,
134+
string particleLeftTexture,
135+
string particleFrontTexture,
136+
float volumeDistance,
119137
ShaderFloats ScaledShaderFloats,
120138
ShaderFloats ShaderFloats,
121139
bool useVolume)
@@ -143,6 +161,10 @@ public CloudLayer(string url, ConfigNode node, string body, Color color, float a
143161
this.mainTexture = mainTexture;
144162

145163
this.detailTexture = detailTexture;
164+
this.particleTopTexture = particleTopTexture;
165+
this.particleLeftTexture = particleLeftTexture;
166+
this.particleFrontTexture = particleFrontTexture;
167+
this.particleDistance = volumeDistance;
146168

147169
scaledShaderFloats = ScaledShaderFloats;
148170
shaderFloats = ShaderFloats;
@@ -171,7 +193,31 @@ private void UpdateTextures()
171193
ScaledCloudMaterial.SetTexture("_DetailTex", new Texture());
172194
CloudMaterial.SetTexture("_DetailTex", new Texture());
173195
}
196+
197+
Texture2D topTexture = GameDatabase.Instance.GetTexture(this.particleTopTexture, false);
198+
if (topTexture != null)
199+
{
200+
topTexture.wrapMode = TextureWrapMode.Clamp;
201+
CloudParticleMaterial.SetTexture("_TopTex", topTexture);
202+
}
203+
204+
Texture2D leftTexture = GameDatabase.Instance.GetTexture(this.particleLeftTexture, false);
205+
if (leftTexture != null)
206+
{
207+
leftTexture.wrapMode = TextureWrapMode.Clamp;
208+
CloudParticleMaterial.SetTexture("_LeftTex", leftTexture);
209+
}
210+
211+
Texture2D frontTexture = GameDatabase.Instance.GetTexture(this.particleFrontTexture, false);
212+
if (frontTexture != null)
213+
{
214+
frontTexture.wrapMode = TextureWrapMode.Clamp;
215+
CloudParticleMaterial.SetTexture("_FrontTex", frontTexture);
216+
}
174217

218+
//CloudParticleMaterial.SetFloat("_DistFade", 1f / particleDistance);
219+
CloudParticleMaterial.SetFloat("_DistFadeVert", particleDistance);
220+
175221
}
176222

177223
public void Init()
@@ -191,19 +237,6 @@ public void Init()
191237
shaderFloats = GetDefault(false);
192238
}
193239

194-
Texture2D tex1 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/1", false);
195-
Texture2D tex2 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/2", false);
196-
Texture2D tex3 = GameDatabase.Instance.GetTexture("BoulderCo/Clouds/Textures/particle/3", false);
197-
198-
tex1.wrapMode = TextureWrapMode.Clamp;
199-
tex2.wrapMode = TextureWrapMode.Clamp;
200-
tex3.wrapMode = TextureWrapMode.Clamp;
201-
202-
CloudParticleMaterial.SetTexture("_TopTex", tex1);
203-
CloudParticleMaterial.SetTexture("_LeftTex", tex2);
204-
CloudParticleMaterial.SetTexture("_FrontTex", tex3);
205-
CloudParticleMaterial.SetFloat("_DistFade", 1f / 2250f);
206-
207240
Log("Cloud Material initialized");
208241
UpdateTextures();
209242
Log("Generating Overlay...");
@@ -300,7 +333,7 @@ public void PerformUpdate()
300333

301334
public static void Log(string message)
302335
{
303-
UnityEngine.Debug.Log("Clouds: " + message);
336+
UnityEngine.Debug.Log("[KerbalVisualEnhancements]: " + message);
304337
}
305338

306339
public static int GetBodyLayerCount(string url, string body)

0 commit comments

Comments
 (0)