mathe/Library/PackageCache/com.unity.shadergraph@14.0.8/Editor/Data/Interfaces/IMayRequireScreenPosition.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2024-09-20 20:30:10 +02:00
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireScreenPosition
{
bool RequiresScreenPosition(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
interface IMayRequireNDCPosition
{
bool RequiresNDCPosition(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
interface IMayRequirePixelPosition
{
bool RequiresPixelPosition(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireScreenPositionExtensions
{
public static bool RequiresScreenPosition(this MaterialSlot slot, ShaderStageCapability stageCapability = ShaderStageCapability.All)
{
var mayRequireScreenPosition = slot as IMayRequireScreenPosition;
return mayRequireScreenPosition?.RequiresScreenPosition(stageCapability) ?? false;
}
public static bool RequiresNDCPosition(this MaterialSlot slot, ShaderStageCapability stageCapability = ShaderStageCapability.All)
{
var mayRequireNDCPosition = slot as IMayRequireNDCPosition;
return mayRequireNDCPosition?.RequiresNDCPosition(stageCapability) ?? false;
}
public static bool RequiresPixelPosition(this MaterialSlot slot, ShaderStageCapability stageCapability = ShaderStageCapability.All)
{
var mayRequirePixelPosition = slot as IMayRequirePixelPosition;
return mayRequirePixelPosition?.RequiresPixelPosition(stageCapability) ?? false;
}
}
}