Updated OutlineScope;
Reorgnize shader code;
This commit is contained in:
40
Editor/MeterialEditor/Helpers/MaterialHelpers.cs
Normal file
40
Editor/MeterialEditor/Helpers/MaterialHelpers.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user