summaryrefslogtreecommitdiffstats
path: root/Editor
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-08-10 12:42:32 -0700
committeryum <yum.food.vr@gmail.com>2024-08-10 12:42:32 -0700
commit9035231332e55f9995618f3b65ab8b05d9b52023 (patch)
tree1bb95c46b06e314dd558462531190c9e050f4e01 /Editor
parent4e2422becccc311349325fe436f10326b7210c73 (diff)
Add sampler mode (clamp/repeat) control to PBR overlay
Also add UV channel select to PBR overlay
Diffstat (limited to 'Editor')
-rw-r--r--Editor/tooner.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index 3673e8c..252dce9 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -151,6 +151,10 @@ public class ToonerGUI : ShaderGUI {
Min,
Max
};
+ enum SamplerMode {
+ Repeat,
+ Clamp,
+ };
void DoPBROverlay() {
for (int i = 0; i < 4; i++) {
@@ -279,6 +283,21 @@ public class ToonerGUI : ShaderGUI {
EditorGUI.EndChangeCheck();
bc.floatValue = enabled ? 1.0f : 0.0f;
}
+
+ bc = FindProperty($"_PBR_Overlay{i}_UV_Select");
+ editor.RangeProperty(
+ bc,
+ "UV channel");
+
+ EditorGUI.BeginChangeCheck();
+ bc = FindProperty($"_PBR_Overlay{i}_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_OVERLAY{i}_SAMPLER_REPEAT", sampler_mode == SamplerMode.Repeat);
+ SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_CLAMP", sampler_mode == SamplerMode.Clamp);
} else {
SetKeyword($"_PBR_OVERLAY{i}_BASECOLOR_MAP", false);
SetKeyword($"_PBR_OVERLAY{i}_MIX_ALPHA_BLEND", false);
@@ -290,6 +309,8 @@ public class ToonerGUI : ShaderGUI {
SetKeyword($"_PBR_OVERLAY{i}_METALLIC_MAP", false);
SetKeyword($"_PBR_OVERLAY{i}_ROUGHNESS_MAP", false);
SetKeyword($"_PBR_OVERLAY{i}_MASK", false);
+ SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_REPEAT", false);
+ SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_CLAMP", false);
}
EditorGUI.indentLevel -= 1;
}