summaryrefslogtreecommitdiff
path: root/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-11-26 20:52:34 +0800
committerchai <chaifix@163.com>2020-11-26 20:52:34 +0800
commit5b158af90739dcbb89c1538a6cb8c65a875dce80 (patch)
treef0437fff6efaab91ac850152a08aef288d572aab /Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs
parentbc4d5201fc537f70cdcb576b57aaeb5d96527112 (diff)
*misc
Diffstat (limited to 'Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs')
-rw-r--r--Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs
new file mode 100644
index 00000000..91252ba1
--- /dev/null
+++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs
@@ -0,0 +1,61 @@
+//Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+public class HeightFogShaderGUI : ShaderGUI
+{
+ Material material;
+
+ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
+ {
+ base.OnGUI(materialEditor, props);
+
+ material = materialEditor.target as Material;
+
+ SetBlendProps();
+ }
+
+ void SetBlendProps()
+ {
+ if (material.HasProperty("_FogAxisMode"))
+ {
+ if (material.GetInt("_FogAxisMode") == 0)
+ {
+ material.SetVector("_FogAxisOption", new Vector4(1, 0, 0, 0));
+ }
+ else if (material.GetInt("_FogAxisMode") == 1)
+ {
+ material.SetVector("_FogAxisOption", new Vector4(0, 1, 0, 0));
+ }
+ else if (material.GetInt("_FogAxisMode") == 2)
+ {
+ material.SetVector("_FogAxisOption", new Vector4(0, 0, 1, 0));
+ }
+ }
+
+ if (material.HasProperty("_DirectionalMode"))
+ {
+ if (material.GetInt("_DirectionalMode") == 0)
+ {
+ material.SetFloat("_DirectionalModeBlend", 0.0f);
+ }
+ else if (material.GetInt("_DirectionalMode") == 1)
+ {
+ material.SetFloat("_DirectionalModeBlend", 1.0f);
+ }
+ }
+
+ if (material.HasProperty("_NoiseMode"))
+ {
+ if (material.GetInt("_NoiseMode") == 0)
+ {
+ material.SetFloat("_NoiseModeBlend", 0.0f);
+ }
+ else if (material.GetInt("_NoiseMode") == 2)
+ {
+ material.SetFloat("_NoiseModeBlend", 1.0f);
+ }
+ }
+ }
+}