TruncateNode.cs 683 B

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