You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
using System.Reflection;
|
|
using UnityEditor.Graphing;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[SRPFilter(typeof(HDRenderPipeline))]
|
|
[Title("Utility", "High Definition Render Pipeline", "Eye", "Builtin Iris Plane Offset")]
|
|
class BuiltinIrisPlaneOffset : AbstractMaterialNode, IGeneratesBodyCode
|
|
{
|
|
public BuiltinIrisPlaneOffset()
|
|
{
|
|
name = "Builtin Iris Plane Offset";
|
|
UpdateNodeAfterDeserialization();
|
|
}
|
|
|
|
public override string documentationURL => Documentation.GetPageLink("BuiltinIrisPlaneOffset");
|
|
|
|
const int kBuiltinIrisPlaneOffsetSlotId = 0;
|
|
const string kBuiltinIrisPlaneOffsetSlotName = "BuiltinIrisPlaneOffset";
|
|
|
|
public override bool hasPreview { get { return false; } }
|
|
|
|
public sealed override void UpdateNodeAfterDeserialization()
|
|
{
|
|
// Output
|
|
AddSlot(new Vector1MaterialSlot(kBuiltinIrisPlaneOffsetSlotId, kBuiltinIrisPlaneOffsetSlotName, kBuiltinIrisPlaneOffsetSlotName, SlotType.Output, 0));
|
|
|
|
RemoveSlotsNameNotMatching(new[]
|
|
{
|
|
// Output
|
|
kBuiltinIrisPlaneOffsetSlotId,
|
|
});
|
|
}
|
|
|
|
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
|
|
{
|
|
if (generationMode == GenerationMode.ForReals)
|
|
{
|
|
sb.AppendLine("$precision {0} = BUILTIN_IRIS_PLANE_OFFSET;",
|
|
GetVariableNameForSlot(kBuiltinIrisPlaneOffsetSlotId)
|
|
);
|
|
}
|
|
else
|
|
{
|
|
sb.AppendLine("$precision {0} = 0.0;",
|
|
GetVariableNameForSlot(kBuiltinIrisPlaneOffsetSlotId)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|