diff options
| author | yum <yum.food.vr@gmail.com> | 2024-05-27 23:08:18 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-05-27 23:08:18 -0700 |
| commit | ad79981dfddd3f787011334490d137e0a9a0ffb8 (patch) | |
| tree | f73e287f5ab940f3c70f6768cb372efa27c853be /Editor | |
| parent | 47eb460bf49d4512f52eecffa5696eb761a08f83 (diff) | |
Add controls for shadow strength & mipmap selection
Diffstat (limited to 'Editor')
| -rw-r--r-- | Editor/tooner.cs | 99 |
1 files changed, 55 insertions, 44 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index d60e543..1da2bb9 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -198,36 +198,11 @@ public class ToonerGUI : ShaderGUI { } void DoCubemap() { - MaterialProperty bc = FindProperty("_Cubemap"); - editor.TexturePropertySingleLine( - MakeLabel(bc, "Cubemap"), - bc); - SetKeyword("_CUBEMAP", bc.textureValue); } void DoBrightness() { MaterialProperty bc; - bc = FindProperty("_Min_Brightness"); - editor.RangeProperty( - bc, - "Min brightness"); - - bc = FindProperty("_Max_Brightness"); - editor.RangeProperty( - bc, - "Max brightness"); - - bc = FindProperty("_Ambient_Occlusion"); - editor.TexturePropertySingleLine( - MakeLabel(bc, "Ambient occlusion"), - bc); - SetKeyword("_AMBIENT_OCCLUSION", bc.textureValue); - - if (bc.textureValue) { - bc = FindProperty("_Ambient_Occlusion_Strength"); - editor.RangeProperty(bc, "Ambient occlusion strength"); - } } void DoEmission() { @@ -813,26 +788,68 @@ public class ToonerGUI : ShaderGUI { } } - void DoLTCGI() { -#if LTCGI_INCLUDED - GUILayout.Label($"Available: yes"); + void DoLighting() { + MaterialProperty bc; + bc = FindProperty("_Min_Brightness"); + editor.RangeProperty( + bc, + "Min brightness"); + + bc = FindProperty("_Max_Brightness"); + editor.RangeProperty( + bc, + "Max brightness"); + + bc = FindProperty("_Ambient_Occlusion"); + editor.TexturePropertySingleLine( + MakeLabel(bc, "Ambient occlusion"), + bc); + SetKeyword("_AMBIENT_OCCLUSION", bc.textureValue); + + if (bc.textureValue) { + bc = FindProperty("_Ambient_Occlusion_Strength"); + editor.RangeProperty(bc, "Ambient occlusion strength"); + } + + bc = FindProperty("_Cubemap"); + editor.TexturePropertySingleLine( + MakeLabel(bc, "Cubemap"), + bc); + SetKeyword("_CUBEMAP", bc.textureValue); + + bc = FindProperty("_Shadow_Strength"); + editor.RangeProperty( + bc, + "Shadows strength"); + + bc = FindProperty("_Mip_Multiplier"); + editor.FloatProperty( + bc, + "Mipmap multiplier"); + bc.floatValue = (float) Math.Max(1E-6, bc.floatValue); - MaterialProperty bc = FindProperty("_LTCGI_Enabled"); +#if LTCGI_INCLUDED + bc = FindProperty("_LTCGI_Enabled"); bool enabled = bc.floatValue > 1E-6; EditorGUI.BeginChangeCheck(); - enabled = EditorGUILayout.Toggle("Enable", enabled); + enabled = EditorGUILayout.Toggle("Enable LTCGI", enabled); EditorGUI.EndChangeCheck(); bc.floatValue = enabled ? 1.0f : 0.0f; SetKeyword("_LTCGI", enabled); - bc = FindProperty("_LTCGI_SpecularColor"); - editor.ColorProperty(bc, "Specular color (RGB)"); + if (enabled) { + EditorGUI.indentLevel += 1; + bc = FindProperty("_LTCGI_SpecularColor"); + editor.ColorProperty(bc, "Specular color (RGB)"); + + bc = FindProperty("_LTCGI_DiffuseColor"); + editor.ColorProperty(bc, "Diffuse color (RGB)"); + EditorGUI.indentLevel -= 1; + } +#endif + } - bc = FindProperty("_LTCGI_DiffuseColor"); - editor.ColorProperty(bc, "Diffuse color (RGB)"); -#else - GUILayout.Label($"Available: no"); -#endif // LTCGI_INCLUDED + void DoLTCGI() { } void DoMain() { @@ -848,8 +865,7 @@ public class ToonerGUI : ShaderGUI { GUILayout.Label("Lighting", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; - DoCubemap(); - DoBrightness(); + DoLighting(); EditorGUI.indentLevel -= 1; GUILayout.Label("Emission", EditorStyles.boldLabel); @@ -909,11 +925,6 @@ public class ToonerGUI : ShaderGUI { EditorGUI.indentLevel += 1; DoRendering(); EditorGUI.indentLevel -= 1; - - GUILayout.Label("LTCGI", EditorStyles.boldLabel); - EditorGUI.indentLevel += 1; - DoLTCGI(); - EditorGUI.indentLevel -= 1; } } |
