TauNode.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. //
  4. // Custom Node TAU
  5. // Donated by The Four Headed Cat - @fourheadedcat
  6. using UnityEngine;
  7. using System;
  8. namespace AmplifyShaderEditor
  9. {
  10. [Serializable]
  11. [NodeAttributes( "Tau", "Constants And Properties", "Tau constant (2*PI): 6.28318530718", null, KeyCode.None, true, false, null,null, "The Four Headed Cat - @fourheadedcat" )]
  12. public sealed class TauNode : ParentNode
  13. {
  14. private readonly string Tau = ( 2.0 * Mathf.PI ).ToString();
  15. public TauNode() : base() { }
  16. public TauNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { }
  17. protected override void CommonInit( int uniqueId )
  18. {
  19. base.CommonInit( uniqueId );
  20. AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
  21. m_previewShaderGUID = "701bc295c0d75d8429eabcf45e8e008d";
  22. }
  23. public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
  24. {
  25. return dataCollector.IsSRP? "TWO_PI": Tau;
  26. }
  27. }
  28. }