PowerNode.cs 750 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Reflection;
  2. namespace UnityEditor.ShaderGraph
  3. {
  4. [Title("Math", "Basic", "Power")]
  5. class PowerNode : CodeFunctionNode
  6. {
  7. public PowerNode()
  8. {
  9. name = "Power";
  10. }
  11. protected override MethodInfo GetFunctionToConvert()
  12. {
  13. return GetType().GetMethod("Unity_Power", BindingFlags.Static | BindingFlags.NonPublic);
  14. }
  15. static string Unity_Power(
  16. [Slot(0, Binding.None, 0, 0, 0, 0)] DynamicDimensionVector A,
  17. [Slot(1, Binding.None, 2, 2, 2, 2)] DynamicDimensionVector B,
  18. [Slot(2, Binding.None)] out DynamicDimensionVector Out)
  19. {
  20. return
  21. @"
  22. {
  23. Out = pow(A, B);
  24. }
  25. ";
  26. }
  27. }
  28. }