Changed the outline layer and hair shadow caster layer from LayerMask to RenderingLayerMask;
This commit is contained in:
63
Runtime/HDRP/Models/UTSRenderPassSettings.cs
Normal file
63
Runtime/HDRP/Models/UTSRenderPassSettings.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.Toonshader
|
||||
{
|
||||
[Serializable]
|
||||
public struct UTSOutlineSetting
|
||||
{
|
||||
public bool enable;
|
||||
public RenderingLayerMask renderingLayer;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct UtsHairShadowSetting
|
||||
{
|
||||
public bool enable;
|
||||
public RenderingLayerMask CasterRenderingLayer;
|
||||
}
|
||||
|
||||
[CreateAssetMenu(fileName = "UTSRenderSetting", menuName = "UTS/RenderSetting")]
|
||||
public class UTSRenderPassSettings : ScriptableObject
|
||||
{
|
||||
public const string UTS_RENDERING_SETTINGS_NAME = "UTSRenderingSettings";
|
||||
private const string UTS_Rendering_Settings_Path = "Packages/com.misaki.hdrp-toon/Runtime/HDRP/Resources/UTSRenderSettings.asset";
|
||||
|
||||
public UTSOutlineSetting outlineSetting;
|
||||
public UtsHairShadowSetting hairShadowSetting;
|
||||
|
||||
internal static UTSRenderPassSettings GetOrCreateSettings()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (EditorBuildSettings.TryGetConfigObject<UTSRenderPassSettings>(UTS_RENDERING_SETTINGS_NAME, out var settings))
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
|
||||
UTSRenderPassSettings renderingSettings = null;
|
||||
if (File.Exists(UTS_Rendering_Settings_Path))
|
||||
{
|
||||
renderingSettings = AssetDatabase.LoadAssetAtPath<UTSRenderPassSettings>(UTS_Rendering_Settings_Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderingSettings = CreateInstance<UTSRenderPassSettings>();
|
||||
AssetDatabase.CreateAsset(renderingSettings, UTS_Rendering_Settings_Path);
|
||||
}
|
||||
|
||||
EditorBuildSettings.AddConfigObject(UTS_RENDERING_SETTINGS_NAME, renderingSettings, false);
|
||||
|
||||
return renderingSettings;
|
||||
#else
|
||||
return Resources.Load<UTSRenderPassSettings>(Path.GetFileNameWithoutExtension(UTS_Rendering_Settings_Path));
|
||||
#endif
|
||||
}
|
||||
|
||||
public static SerializedObject GetSerializedSettings()
|
||||
{
|
||||
return new(GetOrCreateSettings());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user