PropertyUtil.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using UnityEngine;
  3. using UnityEditor.ShaderGraph.Internal;
  4. namespace UnityEditor.ShaderGraph
  5. {
  6. static class PropertyUtil
  7. {
  8. public static ConcreteSlotValueType ToConcreteShaderValueType(this PropertyType propertyType)
  9. {
  10. switch (propertyType)
  11. {
  12. case PropertyType.SamplerState:
  13. return ConcreteSlotValueType.SamplerState;
  14. case PropertyType.Matrix4:
  15. return ConcreteSlotValueType.Matrix4;
  16. case PropertyType.Matrix3:
  17. return ConcreteSlotValueType.Matrix3;
  18. case PropertyType.Matrix2:
  19. return ConcreteSlotValueType.Matrix2;
  20. case PropertyType.Texture2D:
  21. return ConcreteSlotValueType.Texture2D;
  22. case PropertyType.Texture2DArray:
  23. return ConcreteSlotValueType.Texture2DArray;
  24. case PropertyType.Texture3D:
  25. return ConcreteSlotValueType.Texture3D;
  26. case PropertyType.Cubemap:
  27. return ConcreteSlotValueType.Cubemap;
  28. case PropertyType.Gradient:
  29. return ConcreteSlotValueType.Gradient;
  30. case PropertyType.Vector4:
  31. return ConcreteSlotValueType.Vector4;
  32. case PropertyType.Vector3:
  33. return ConcreteSlotValueType.Vector3;
  34. case PropertyType.Vector2:
  35. return ConcreteSlotValueType.Vector2;
  36. case PropertyType.Vector1:
  37. return ConcreteSlotValueType.Vector1;
  38. case PropertyType.Boolean:
  39. return ConcreteSlotValueType.Boolean;
  40. case PropertyType.Color:
  41. return ConcreteSlotValueType.Vector4;
  42. default:
  43. throw new ArgumentOutOfRangeException();
  44. }
  45. }
  46. }
  47. }