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.

41 lines
973 B

  1. using System;
  2. namespace AmplifyShaderEditor
  3. {
  4. public class SignalGeneratorNode : ParentNode, ISignalGenerator
  5. {
  6. public SignalGeneratorNode() : base() { }
  7. public SignalGeneratorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { }
  8. protected override void CommonInit( int uniqueId )
  9. {
  10. base.CommonInit( uniqueId );
  11. SelfPowered = true;
  12. }
  13. public void GenerateSignalPropagation()
  14. {
  15. System.Type myType = GetType();
  16. for ( int i = 0; i < m_inputPorts.Count; i++ )
  17. {
  18. if ( m_inputPorts[ i ].IsConnected )
  19. {
  20. m_inputPorts[ i ].GetOutputNode().ActivateNode( UniqueId, i, myType );
  21. }
  22. }
  23. }
  24. public void GenerateSignalInibitor()
  25. {
  26. for ( int i = 0; i < m_inputPorts.Count; i++ )
  27. {
  28. if( m_inputPorts[ i ].IsConnected )
  29. {
  30. ParentNode node = m_inputPorts[ i ].GetOutputNode();
  31. if( node != null )
  32. node.DeactivateNode( i, false );
  33. }
  34. }
  35. }
  36. }
  37. }