Files
com.misaki.hdrp-toon/Editor/MeterialEditor/Helpers/MaterialHelpers.cs
Misaki 886432db7b Updated OutlineScope;
Reorgnize shader code;
2025-02-03 13:46:31 +09:00

40 lines
1.1 KiB
C#

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;
}
}
}