DivideNode.cs 736 B

12345678910111213141516171819202122232425262728293031
  1. using System.Reflection;
  2. namespace UnityEditor.ShaderGraph
  3. {
  4. [Title("Math", "Basic", "Divide")]
  5. class DivideNode : CodeFunctionNode
  6. {
  7. public DivideNode()
  8. {
  9. name = "Divide";
  10. }
  11. protected override MethodInfo GetFunctionToConvert()
  12. {
  13. return GetType().GetMethod("Unity_Divide", BindingFlags.Static | BindingFlags.NonPublic);
  14. }
  15. static string Unity_Divide(
  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. Out = A / B;
  23. }
  24. ";
  25. }
  26. }
  27. }