123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using UnityEngine;
- using UnityEditor.Graphing;
- using UnityEditor.ShaderGraph.Internal;
- namespace UnityEditor.ShaderGraph
- {
- [FormerName("UnityEngine.MaterialGraph.ViewDirectionNode")]
- [Title("Input", "Geometry", "View Direction")]
- class ViewDirectionNode : GeometryNode, IMayRequireViewDirection
- {
- private const int kOutputSlotId = 0;
- public const string kOutputSlotName = "Out";
- public ViewDirectionNode()
- {
- name = "View Direction";
- UpdateNodeAfterDeserialization();
- }
- public sealed override void UpdateNodeAfterDeserialization()
- {
- AddSlot(new Vector3MaterialSlot(
- kOutputSlotId,
- kOutputSlotName,
- kOutputSlotName,
- SlotType.Output,
- Vector4.zero));
- RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
- }
- public override string GetVariableNameForSlot(int slotId)
- {
- return string.Format("IN.{0}", space.ToVariableName(InterpolatorType.ViewDirection));
- }
- public NeededCoordinateSpace RequiresViewDirection(ShaderStageCapability stageCapability)
- {
- return space.ToNeededCoordinateSpace();
- }
- }
- }
|