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.

35 lines
1.4 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. //
  4. // Custom Node Compare (A != B)
  5. // Donated by The Four Headed Cat - @fourheadedcat
  6. using UnityEngine;
  7. using System;
  8. namespace AmplifyShaderEditor
  9. {
  10. [Serializable]
  11. [NodeAttributes("Compare (A \u2260 B)", "Logical Operators", "Check if A is not equal to B. If true return value of True else return value of False", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )]
  12. public sealed class TFHCCompareNotEqual : TFHCStub
  13. {
  14. protected override void CommonInit( int uniqueId )
  15. {
  16. base.CommonInit( uniqueId );
  17. m_inputPorts[ 0 ].Name = "A";
  18. m_inputPorts[ 1 ].Name = "B";
  19. AddInputPort( WirePortDataType.FLOAT, false, "True" );
  20. AddInputPort( WirePortDataType.FLOAT, false, "False" );
  21. m_textLabelWidth = 100;
  22. m_useInternalPortData = true;
  23. m_previewShaderGUID = "75f433376eef1ad4a881d99124e08008";
  24. }
  25. public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
  26. {
  27. GetInputData( ref dataCollector, ignoreLocalvar );
  28. string strout = "(( " + m_inputDataPort0 + " != " + m_inputDataPort1 + " ) ? " + m_inputDataPort2 + " : " + m_inputDataPort3 + " )";
  29. return CreateOutputLocalVariable( 0, strout, ref dataCollector );
  30. }
  31. }
  32. }