Vector3ShaderProperty.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using UnityEditor.Graphing;
  3. using UnityEngine;
  4. namespace UnityEditor.ShaderGraph.Internal
  5. {
  6. [Serializable]
  7. [FormerName("UnityEditor.ShaderGraph.Vector3ShaderProperty")]
  8. public sealed class Vector3ShaderProperty : VectorShaderProperty
  9. {
  10. internal Vector3ShaderProperty()
  11. {
  12. displayName = "Vector3";
  13. }
  14. public override PropertyType propertyType => PropertyType.Vector3;
  15. internal override AbstractMaterialNode ToConcreteNode()
  16. {
  17. var node = new Vector3Node();
  18. node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotXId).value = value.x;
  19. node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotYId).value = value.y;
  20. node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotZId).value = value.z;
  21. return node;
  22. }
  23. internal override PreviewProperty GetPreviewMaterialProperty()
  24. {
  25. return new PreviewProperty(propertyType)
  26. {
  27. name = referenceName,
  28. vector4Value = value
  29. };
  30. }
  31. internal override ShaderInput Copy()
  32. {
  33. return new Vector3ShaderProperty()
  34. {
  35. displayName = displayName,
  36. hidden = hidden,
  37. value = value
  38. };
  39. }
  40. }
  41. }