Updated OutlineScope;

Reorgnize shader code;
This commit is contained in:
2025-02-03 13:46:31 +09:00
parent 281dfbc4f0
commit 886432db7b
24 changed files with 275 additions and 293 deletions

View File

@@ -0,0 +1,40 @@
using UnityEngine;
using static Misaki.HdrpToon.UtsShaderPropertyName;
namespace Misaki.HdrpToon.Editor
{
internal static class MaterialHelpers
{
public static ShadingMode GetShadingMode(this Material material)
{
if (!material.HasProperty(SurfaceOptions.SHADING_MODE))
{
return ShadingMode.Standard;
}
return (ShadingMode)material.GetInteger(SurfaceOptions.SHADING_MODE);
}
public static PBRMode GetPBRMode(this Material material)
{
if (!material.HasProperty(SurfaceOptions.PBR_MODE))
{
return PBRMode.Off;
}
return (PBRMode)material.GetInteger(SurfaceOptions.PBR_MODE);
}
public static bool HasFeature(this Material material, SurfaceFeature feature)
{
if (!material.HasProperty(SurfaceOptions.SURFACE_FEATURE))
{
return false;
}
var value = (SurfaceFeature)material.GetInteger(SurfaceOptions.SURFACE_FEATURE);
return (value & feature) != 0;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b32ea10056de246488796e50f7160a4a

View File

@@ -12,9 +12,9 @@ namespace Misaki.HdrpToon.Editor
return (PBRMode)shaderGUI.GetUIScope<SurfaceOptionsScope>().FindProperty("_PBR_Mode").floatValue;
}
public static bool HasFeature(this UTSShaderGUI shaderGUI, SurfaceFeatureFlags feature)
public static bool HasFeature(this UTSShaderGUI shaderGUI, SurfaceFeature feature)
{
return ((SurfaceFeatureFlags)shaderGUI.GetUIScope<SurfaceOptionsScope>().FindProperty("_Surface_Features").floatValue & feature) != 0;
return ((SurfaceFeature)shaderGUI.GetUIScope<SurfaceOptionsScope>().FindProperty("_Surface_Features").floatValue & feature) != 0;
}
}
}