From 4a99b01bdcb9b0fa2a61f8c7a4b00b3da3085d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davorin=20U=C4=8Dakar?= Date: Mon, 4 Apr 2016 19:02:44 +0200 Subject: [PATCH] Disabled visor reflections --- README.md | 3 +- TextureReplacer/Reflections.cs | 69 +++++++++++++------------- TextureReplacer/TextureReplacer.csproj | 5 ++ 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index e31ef36..c5692c1 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,7 @@ Known Issues * Clouds from EVE are only reflected when on/near the ground or over 160 km. * Clouds from EVE Overhaul are not correctly reflected. * Cabin-specific IVA suits don't persist through scene switches while on EVA. +* Visor reflections don't work for KSP 1.1. Change Log @@ -293,7 +294,7 @@ Change Log * 2.4.13 - fixed for 1.1 thanks to RangeMachine - - visor reflections still not working + - disabled visor reflections because visor shader is broken * 2.4.12 - removed / replaced Kerbal Stuff links - possibly fixed a reflections-related crash diff --git a/TextureReplacer/Reflections.cs b/TextureReplacer/Reflections.cs index fd198ad..8d6a9b3 100644 --- a/TextureReplacer/Reflections.cs +++ b/TextureReplacer/Reflections.cs @@ -67,22 +67,22 @@ public Script(Part part, int updateInterval) transform = part.transform; isEva = part.GetComponent() != null; - if (isEva) - { - transform = transform.Find("model01"); - - SkinnedMeshRenderer visor = transform.GetComponentsInChildren(true) - .FirstOrDefault(m => m.name == "visor"); - - if (visor != null) - { - Material material = visor.material; - - material.shader = instance.visorShader; - material.SetTexture(Util.CUBE_PROPERTY, envMap); - material.SetColor(Util.REFLECT_COLOR_PROPERTY, visorReflectionColour); - } - } +// if (isEva) +// { +// transform = transform.Find("model01"); +// +// SkinnedMeshRenderer visor = transform.GetComponentsInChildren(true) +// .FirstOrDefault(m => m.name == "visor"); +// +// if (visor != null) +// { +// Material material = visor.material; +// +// material.shader = instance.visorShader; +// material.SetTexture(Util.CUBE_PROPERTY, envMap); +// material.SetColor(Util.REFLECT_COLOR_PROPERTY, visorReflectionColour); +// } +// } interval = updateInterval; counter = Util.random.Next(updateInterval); @@ -236,7 +236,7 @@ public static void updateScripts() // Print names of meshes and their shaders in parts with TRReflection module. public bool logReflectiveMeshes = false; // Reflective shader. - Shader visorShader = null; +// Shader visorShader = null; // Instance. public static Reflections instance = null; @@ -300,7 +300,8 @@ public void setReflectionType(Type type) // We apply visor shader for real reflections later, through TREvaModule since we don't // want corrupted reflections in the main menu. - material.shader = enableStatic ? visorShader : transparentSpecularShader; +// material.shader = enableStatic ? visorShader : transparentSpecularShader; + material.shader = transparentSpecularShader; material.SetTexture(Util.CUBE_PROPERTY, enableStatic ? staticEnvMap : null); material.SetColor(Util.REFLECT_COLOR_PROPERTY, visorReflectionColour); } @@ -403,22 +404,22 @@ public void load() } } - try - { - Assembly assembly = Assembly.GetExecutingAssembly(); - Stream stream = assembly.GetManifestResourceStream("TextureReplacer.Visor-compiled.shader"); - StreamReader reader = new StreamReader(stream); - - shaderMaterial = new Material(reader.ReadToEnd()); - visorShader = shaderMaterial.shader; - - Util.log("Visor shader sucessfully compiled."); - } - catch - { - isVisorReflectionEnabled = false; - Util.log("Visor shader loading failed. Visor reflections disabled."); - } +// try +// { +// Assembly assembly = Assembly.GetExecutingAssembly(); +// Stream stream = assembly.GetManifestResourceStream("TextureReplacer.Visor-compiled.shader"); +// StreamReader reader = new StreamReader(stream); +// +// shaderMaterial = new Material(reader.ReadToEnd()); +// visorShader = shaderMaterial.shader; +// +// Util.log("Visor shader sucessfully compiled."); +// } +// catch +// { +// isVisorReflectionEnabled = false; +// Util.log("Visor shader loading failed. Visor reflections disabled."); +// } for (int i = 0; i < SHADER_MAP.GetLength(0); ++i) { diff --git a/TextureReplacer/TextureReplacer.csproj b/TextureReplacer/TextureReplacer.csproj index 9df1208..864afa1 100644 --- a/TextureReplacer/TextureReplacer.csproj +++ b/TextureReplacer/TextureReplacer.csproj @@ -22,6 +22,11 @@ 4 false x86 + + + + + true