Folder clean up;
Added Emissive;
This commit is contained in:
87
Runtime/Models/UTSRenderPassSettings.cs
Normal file
87
Runtime/Models/UTSRenderPassSettings.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Misaki.HdrpToon
|
||||
{
|
||||
internal enum BufferQuality
|
||||
{
|
||||
Low,
|
||||
High
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal struct UtsHairShadowSetting
|
||||
{
|
||||
public bool enable;
|
||||
public BufferQuality quality;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal struct UtsHairBlendingSetting
|
||||
{
|
||||
public bool enable;
|
||||
public BufferQuality quality;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal struct UTSOutlineSetting
|
||||
{
|
||||
public bool enable;
|
||||
}
|
||||
|
||||
[CreateAssetMenu(fileName = "UTSRenderSetting", menuName = "UTS/RenderSetting")]
|
||||
public class UTSRenderPassSettings : ScriptableObject
|
||||
{
|
||||
public const string UTS_RENDERING_SETTINGS_NAME = "UTSRenderingSettings";
|
||||
public const string UTS_RENDERING_SETTINGS_PATH = "Assets/Resources/Settings/UTSRenderSettings.asset";
|
||||
public const string UTS_RENDERING_SETTINGS_RESOURCES_PATH = "Settings/UTSRenderSettings";
|
||||
|
||||
[SerializeField]
|
||||
internal UtsHairShadowSetting hairShadowSetting;
|
||||
[SerializeField]
|
||||
internal UtsHairBlendingSetting hairBlendingSetting;
|
||||
[SerializeField]
|
||||
internal UTSOutlineSetting outlineSetting;
|
||||
|
||||
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
|
||||
{
|
||||
var directory = Path.GetDirectoryName(UTS_RENDERING_SETTINGS_PATH);
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
renderingSettings = CreateInstance<UTSRenderPassSettings>();
|
||||
AssetDatabase.CreateAsset(renderingSettings, UTS_RENDERING_SETTINGS_PATH);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
EditorBuildSettings.AddConfigObject(UTS_RENDERING_SETTINGS_NAME, renderingSettings, true);
|
||||
|
||||
return renderingSettings;
|
||||
#else
|
||||
return Resources.Load<UTSRenderPassSettings>(UTS_RENDERING_SETTINGS_RESOURCES_PATH);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static SerializedObject GetSerializedSettings()
|
||||
{
|
||||
return new(GetOrCreateSettings());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user