40 lines
1.1 KiB
C#
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;
|
|
}
|
|
}
|
|
} |