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.
41 lines
1.2 KiB
41 lines
1.2 KiB
using System.Reflection;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[SRPFilter(typeof(HDRenderPipeline))]
|
|
[Title("Utility", "High Definition Render Pipeline", "Eye", "IrisUVLocation")]
|
|
class IrisUVLocation : CodeFunctionNode
|
|
{
|
|
public IrisUVLocation()
|
|
{
|
|
name = "Iris UV Location";
|
|
}
|
|
|
|
public override bool hasPreview
|
|
{
|
|
get { return false; }
|
|
}
|
|
|
|
protected override MethodInfo GetFunctionToConvert()
|
|
{
|
|
return GetType().GetMethod("Unity_IrisUVLocation", BindingFlags.Static | BindingFlags.NonPublic);
|
|
}
|
|
|
|
static string Unity_IrisUVLocation(
|
|
[Slot(0, Binding.None, 0, 0, 0, 0)] Vector3 PositionOS,
|
|
[Slot(1, Binding.None, 0, 0, 0, 0)] Vector1 IrisRadius,
|
|
[Slot(2, Binding.None)] out Vector2 IrisUV)
|
|
{
|
|
IrisUV = Vector3.zero;
|
|
return
|
|
@"
|
|
{
|
|
$precision2 irisUVCentered = PositionOS.xy / IrisRadius;
|
|
IrisUV = (irisUVCentered * 0.5 + $precision2(0.5, 0.5));
|
|
}
|
|
";
|
|
}
|
|
}
|
|
}
|