From b7d3cb5d759feab1e44f4cdb01a0c8922bf4f1cb Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 3 Nov 2024 15:25:08 -0800 Subject: Misc * Add third HSV slot * Add ZTest enum * Fix bug where SSR mask keyword can be set when SSR is disabled --- Editor/tooner.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Editor') diff --git a/Editor/tooner.cs b/Editor/tooner.cs index fdd81b0..f6f3da8 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -1082,7 +1082,7 @@ public class ToonerGUI : ShaderGUI { MaterialProperty bc; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 3; i++) { bc = FindProperty($"_HSV{i}_Enabled"); bool enabled = bc.floatValue > 1E-6; EditorGUI.BeginChangeCheck(); @@ -2347,6 +2347,8 @@ public class ToonerGUI : ShaderGUI { SetKeyword("SSR_MASK", bc.textureValue); EditorGUI.indentLevel -= 1; + } else { + SetKeyword("SSR_MASK", false); } EditorGUI.indentLevel -= 1; @@ -2366,6 +2368,21 @@ public class ToonerGUI : ShaderGUI { Stochastic } + // unity is made by fucking morons and they don't expose this so i'm + // reimplementing it + // ref: https://docs.unity3d.com/6000.0/Documentation/Manual/SL-ZTest.html + enum ZTestMode { + Disabled, + Never, + Less, + Equal, + LEqual, + Greater, + NotEqual, + GEqual, + Always + } + void DoRendering() { show_ui.Add(AddCollapsibleMenu("Rendering", "_Rendering")); EditorGUI.indentLevel += 1; @@ -2479,6 +2496,14 @@ public class ToonerGUI : ShaderGUI { bc.floatValue = (float) cull_mode; } + EditorGUI.BeginChangeCheck(); + bc = FindProperty("_ZTest"); + ZTestMode zmode = (ZTestMode) Math.Round(bc.floatValue); + zmode = (ZTestMode) EnumPopup( + MakeLabel("ZTest"), zmode); + EditorGUI.EndChangeCheck(); + bc.floatValue = (float) zmode; + bc = FindProperty("_Discard_Enable_Static"); bool enabled = bc.floatValue > 1E-6; EditorGUI.BeginChangeCheck(); -- cgit v1.2.3