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.
 
 
 
 

35 lines
1.1 KiB

using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "Geometry", "Vertex ID")]
class VertexIDNode : AbstractMaterialNode, IMayRequireVertexID
{
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Out";
public override bool hasPreview { get { return false; } }
public VertexIDNode()
{
name = "Vertex ID";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector1MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, (int)0, ShaderStageCapability.Vertex));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return string.Format("IN.{0}", ShaderGeneratorNames.VertexID);
}
public bool RequiresVertexID(ShaderStageCapability stageCapability)
{
return true;
}
}
}