您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
903 B
33 行
903 B
using System.Reflection;
|
|
|
|
namespace UnityEngine.MaterialGraph
|
|
{
|
|
[Title("Procedural/Box")]
|
|
public class BoxNode : CodeFunctionNode
|
|
{
|
|
public BoxNode()
|
|
{
|
|
name = "Box";
|
|
}
|
|
|
|
protected override MethodInfo GetFunctionToConvert()
|
|
{
|
|
return GetType().GetMethod("Unity_Boxnode", BindingFlags.Static | BindingFlags.NonPublic);
|
|
}
|
|
|
|
static string Unity_Boxnode(
|
|
[Slot(0, Binding.None)] Vector2 xy,
|
|
[Slot(1, Binding.None)] Vector2 xMinAndMax,
|
|
[Slot(2, Binding.None)] Vector2 yMinAndMax,
|
|
[Slot(3, Binding.None)] out Vector1 result)
|
|
{
|
|
return
|
|
@"
|
|
{
|
|
{precision} x = step( xMinAndMax.x, xy.x ) - step( xMinAndMax.y, xy.x );
|
|
{precision} y = step( yMinAndMax.x, xy.y ) - step( yMinAndMax.y, xy.y );
|
|
result = x * y;
|
|
}";
|
|
}
|
|
}
|
|
}
|