You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
998 B

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. namespace AmplifyShaderEditor
  4. {
  5. [System.Serializable]
  6. [NodeAttributes( "ATan2", "Trigonometry Operators", "Arctangent of y/x" )]
  7. public sealed class ATan2OpNode : DynamicTypeNode
  8. {
  9. protected override void CommonInit( int uniqueId )
  10. {
  11. base.CommonInit( uniqueId );
  12. m_dynamicOutputType = true;
  13. m_useInternalPortData = true;
  14. m_previewShaderGUID = "02e3ff61784e38840af6313936b6a730";
  15. }
  16. public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
  17. {
  18. if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
  19. return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
  20. base.BuildResults( outputId, ref dataCollector, ignoreLocalvar );
  21. string result = "atan2( " + m_inputA + " , " + m_inputB + " )";
  22. return CreateOutputLocalVariable( 0, result, ref dataCollector );
  23. }
  24. }
  25. }