Files
com.misaki.hdrp-toon/Editor/MeterialEditor/UIScopes/ShadowScope.cs
Misaki 3273812902 Added ShadowScope;
Renamed PBRScope to SurfaceInputsScope;
2025-02-01 20:51:22 +09:00

57 lines
2.7 KiB
C#

using Misaki.ShaderGUI;
using UnityEditor;
using UnityEngine;
namespace Misaki.HdrpToon.Editor
{
internal class ShadowScope : MaterialUIScope<ShaderGUIExpandable>
{
private static class Properties
{
public static MaterialProperty receiveLightShadow;
public static MaterialProperty receiveScreenSpaceShadow;
public static MaterialProperty receiveHairShadow;
public static MaterialProperty shadowDistanceBias;
public static MaterialProperty shadowNormalBias;
}
private static class Styles
{
public static readonly GUIContent receiveLightShadowText = new("Receive Light Shadow", "Enable to receive shadow from light.");
public static readonly GUIContent receiveHairShadowText = new("Receive Hair Shadow", "Enable to receive shadow from hair shadow caster");
public static readonly GUIContent receiveScreenSpaceShadowText = new("Receive Screen Space Shadow", "Enable to receive screen space shadow.");
public static readonly GUIContent lightShadowBiasText = new("Light Shadow Bias", "Specifies the bias of the light shadow.");
public static readonly GUIContent lightShadowNormalBiasText = new("Light Shadow Normal Bias", "Specifies the normal bias of the light shadow.");
}
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Shadow;
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Shadow Settings");
public override void LoadMaterialProperties()
{
Properties.receiveLightShadow = FindProperty("_Receive_Light_Shadow");
Properties.receiveScreenSpaceShadow = FindProperty("_Receive_Screen_Space_Shadow");
Properties.receiveHairShadow = FindProperty("_Receive_Hair_Shadow");
Properties.shadowDistanceBias = FindProperty("_ShadowDistanceBias");
Properties.shadowNormalBias = FindProperty("_ShadowNormalBias");
}
protected override void DrawContent()
{
editor.ShaderProperty(Properties.receiveLightShadow, Styles.receiveLightShadowText);
if (Properties.receiveLightShadow.GetBooleanValue())
{
editor.ShaderProperty(Properties.receiveScreenSpaceShadow, Styles.receiveScreenSpaceShadowText);
}
editor.ShaderProperty(Properties.receiveHairShadow, Styles.receiveHairShadowText);
EditorGUILayout.Space();
editor.ShaderProperty(Properties.shadowDistanceBias, Styles.lightShadowBiasText);
editor.ShaderProperty(Properties.shadowNormalBias, Styles.lightShadowNormalBiasText);
}
}
}