Added ShadowScope;
Renamed PBRScope to SurfaceInputsScope;
This commit is contained in:
57
Editor/MeterialEditor/UIScopes/ShadowScope.cs
Normal file
57
Editor/MeterialEditor/UIScopes/ShadowScope.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user