diff --git a/ContentEVE/GameData/EnvironmentalVisualEnhancements/EnvironmentalVisualEnhancements.version b/ContentEVE/GameData/EnvironmentalVisualEnhancements/EnvironmentalVisualEnhancements.version index 5a438787..3a68cd3a 100644 --- a/ContentEVE/GameData/EnvironmentalVisualEnhancements/EnvironmentalVisualEnhancements.version +++ b/ContentEVE/GameData/EnvironmentalVisualEnhancements/EnvironmentalVisualEnhancements.version @@ -10,7 +10,7 @@ "VERSION": { "MAJOR": 1, "MINOR": 11, - "PATCH": 2, + "PATCH": 3, "BUILD": 1 }, "KSP_VERSION": { diff --git a/ContentEVE/GameData/EnvironmentalVisualEnhancements/License.txt b/ContentEVE/GameData/EnvironmentalVisualEnhancements/License.txt index 37282e8d..e312384e 100644 --- a/ContentEVE/GameData/EnvironmentalVisualEnhancements/License.txt +++ b/ContentEVE/GameData/EnvironmentalVisualEnhancements/License.txt @@ -9,6 +9,7 @@ The MIT License (MIT) Copyright (c) 2013 Ryan Bray Copyright (c) 2018 Warwick Allison +Copyright (c) 2021 Ghassen Lahmar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/Utils/MaterialPQS.cs b/Utils/MaterialPQS.cs index 360370d6..66039177 100644 --- a/Utils/MaterialPQS.cs +++ b/Utils/MaterialPQS.cs @@ -340,22 +340,53 @@ private void PQSLoaded(CelestialBody body, String s) } } - private void AddMaterial(Renderer r) + private void AddMaterial(MeshRenderer meshRenderer) { - DeferredRenderer.Add(r.gameObject, material, isOcean, body); + if (this.sphere.useSharedMaterial) + { + List materials = new List(meshRenderer.sharedMaterials); + + if (!materials.Exists(mat => mat.shader.name.Contains(material.shader.name))) + { + materials.Add(material); + meshRenderer.sharedMaterials = materials.ToArray(); + } + } + else + { + List materials = new List(meshRenderer.materials); + + if (!materials.Exists(mat => mat.shader.name.Contains(material.shader.name))) + { + materials.Add(material); + meshRenderer.materials = materials.ToArray(); + } + } } - private void RemoveMaterial(Renderer r) + private void RemoveMaterial(MeshRenderer mr) { - DeferredRenderer.Remove(r.gameObject, material); + if (this.sphere.useSharedMaterial) + { + List materials = new List(mr.sharedMaterials); + materials.Remove(materials.Find(mat => mat.shader.name.Contains(material.shader.name))); + + mr.sharedMaterials = materials.ToArray(); + } + else + { + List materials = new List(mr.materials); + materials.Remove(materials.Find(mat => mat.shader.name.Contains(material.shader.name))); + mr.materials = materials.ToArray(); + } } private void ApplyToQuadMaterials(PQ pq) { - Renderer[] renderers = pq.GetComponentsInChildren(); - foreach (Renderer r in renderers) + MeshRenderer[] renderers = pq.GetComponentsInChildren(); + foreach (MeshRenderer mr in renderers) { - AddMaterial(r); + AddMaterial(mr); } } diff --git a/_BuildManager/Properties/AssemblyVersionInfo.cs b/_BuildManager/Properties/AssemblyVersionInfo.cs index 9164381c..d5b669d8 100644 --- a/_BuildManager/Properties/AssemblyVersionInfo.cs +++ b/_BuildManager/Properties/AssemblyVersionInfo.cs @@ -13,4 +13,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.11.2.1")] // KSP version with EVE release number appended; see also CKAN version file. +[assembly: AssemblyVersion("1.11.3.1")] // KSP version with EVE release number appended; see also CKAN version file.