Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

39 行
1.1 KiB

using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("UV", "Radial Shear")]
class RadialShearNode : CodeFunctionNode
{
public RadialShearNode()
{
name = "Radial Shear";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_RadialShear", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_RadialShear(
[Slot(0, Binding.MeshUV0)] Vector2 UV,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center,
[Slot(2, Binding.None, 10f, 10f, 10f, 10f)] Vector2 Strength,
[Slot(3, Binding.None)] Vector2 Offset,
[Slot(4, Binding.None)] out Vector2 Out)
{
Out = Vector2.zero;
return
@"
{
$precision2 delta = UV - Center;
$precision delta2 = dot(delta.xy, delta.xy);
$precision2 delta_offset = delta2 * Strength;
Out = UV + $precision2(delta.y, -delta.x) * delta_offset + Offset;
}
";
}
}
}