diff options
| author | yum <yum.food.vr@gmail.com> | 2024-09-02 13:04:16 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-09-02 13:04:16 -0700 |
| commit | e757ffcf2362fafaf040b8f15827c6acd0d85ab0 (patch) | |
| tree | 589e32d5645731f7e5591f49eeebabe0ac4be9bd /Editor | |
| parent | 2ea62b8fc899cab47e6e23da9168a42ecd6ddf45 (diff) | |
Add sampler mode to PBR section
Also remove normal scaling weirdness.
Diffstat (limited to 'Editor')
| -rw-r--r-- | Editor/tooner.cs | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 741bd5f..a7b0b19 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -106,6 +106,32 @@ public class ToonerGUI : ShaderGUI { SetKeyword("_ROUGHNESS_MAP", bct.textureValue); } + enum SamplerMode { + Repeat, + Clamp, + }; + void DoPBR() { + GUILayout.Label("PBR", EditorStyles.boldLabel); + EditorGUI.indentLevel += 1; + { + DoBaseColor(); + DoNormal(); + DoMetallic(); + DoRoughness(); + + EditorGUI.BeginChangeCheck(); + MaterialProperty bc = FindProperty($"_PBR_Sampler_Mode"); + SamplerMode sampler_mode = (SamplerMode) Math.Round(bc.floatValue); + sampler_mode = (SamplerMode) EditorGUILayout.EnumPopup( + MakeLabel("Sampler mode"), sampler_mode); + EditorGUI.EndChangeCheck(); + bc.floatValue = (int) sampler_mode; + SetKeyword($"_PBR_SAMPLER_REPEAT", sampler_mode == SamplerMode.Repeat); + SetKeyword($"_PBR_SAMPLER_CLAMP", sampler_mode == SamplerMode.Clamp); + } + EditorGUI.indentLevel -= 1; + } + void DoClearcoat() { MaterialProperty bc; bc = FindProperty("_Clearcoat_Enabled"); @@ -159,10 +185,6 @@ public class ToonerGUI : ShaderGUI { Min, Max }; - enum SamplerMode { - Repeat, - Clamp, - }; void DoPBROverlay() { for (int i = 0; i < 4; i++) { @@ -1758,14 +1780,7 @@ public class ToonerGUI : ShaderGUI { } void DoMain() { - GUILayout.Label("PBR", EditorStyles.boldLabel); - EditorGUI.indentLevel += 1; - DoBaseColor(); - DoNormal(); - DoMetallic(); - DoRoughness(); - EditorGUI.indentLevel -= 1; - + DoPBR(); DoPBROverlay(); GUILayout.Label("Clearcoat", EditorStyles.boldLabel); |
