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.

33 lines
1.2 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. namespace AmplifyShaderEditor
  5. {
  6. [Serializable]
  7. [NodeAttributes( "Reflect", "Vector Operators", "Reflection vector given an incidence vector and a normal vector" )]
  8. public sealed class ReflectOpNode : DynamicTypeNode
  9. {
  10. protected override void CommonInit( int uniqueId )
  11. {
  12. base.CommonInit( uniqueId );
  13. m_inputPorts[ 0 ].ChangeProperties( "Incident", WirePortDataType.FLOAT4, false );
  14. m_inputPorts[ 1 ].ChangeProperties( "Normal", WirePortDataType.FLOAT4, false );
  15. m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false );
  16. m_textLabelWidth = 67;
  17. m_previewShaderGUID = "fb520f2145c0fa0409320a9e6d720758";
  18. }
  19. public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
  20. {
  21. if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
  22. return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
  23. base.BuildResults( outputId, ref dataCollector, ignoreLocalvar );
  24. string result = "reflect( " + m_inputA + " , " + m_inputB + " )";
  25. return CreateOutputLocalVariable( 0, result, ref dataCollector );
  26. }
  27. }
  28. }