您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.3 KiB
46 行
1.3 KiB
using UnityEngine;
|
|
using UnityEditor.Graphing;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[FormerName("UnityEngine.MaterialGraph.WorldPosNode")]
|
|
[Title("Input", "Geometry", "Position")]
|
|
public class PositionNode : GeometryNode, IMayRequirePosition
|
|
{
|
|
private const int kOutputSlotId = 0;
|
|
public const string kOutputSlotName = "Out";
|
|
|
|
|
|
public PositionNode()
|
|
{
|
|
name = "Position";
|
|
UpdateNodeAfterDeserialization();
|
|
}
|
|
|
|
public override string documentationURL
|
|
{
|
|
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Position-Node"; }
|
|
}
|
|
|
|
public sealed override void UpdateNodeAfterDeserialization()
|
|
{
|
|
AddSlot(new Vector3MaterialSlot(
|
|
kOutputSlotId,
|
|
kOutputSlotName,
|
|
kOutputSlotName,
|
|
SlotType.Output,
|
|
Vector3.zero));
|
|
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
|
|
}
|
|
|
|
public override string GetVariableNameForSlot(int slotId)
|
|
{
|
|
return string.Format("IN.{0}", space.ToVariableName(InterpolatorType.Position));
|
|
}
|
|
|
|
public NeededCoordinateSpace RequiresPosition()
|
|
{
|
|
return space.ToNeededCoordinateSpace();
|
|
}
|
|
}
|
|
}
|