
using Godot;
using Godot.Collections;
using System.Collections.Generic;

namespace Rokojori
{  
  [Tool]
  [GlobalClass]
  public partial class InvertEffect:ColorEffect
  {
    public InvertEffect():base()
    {
      Initialize();
    } 

    [Export( PropertyHint.Range, "0,1") ]
    public float amount = 0.5f;

    [Export]
    public bool r = true;

    [Export]
    public bool g = true;

    [Export]
    public bool b = true;


    RG_ScreenColorTexure screenColorTexture;
    RG_Invert invert;    

    void Initialize()
    { 
      screenColorTexture = new RG_ScreenColorTexure( graph );
      invert = new RG_Invert( graph );


      graph.InitializeNodes();      

      
      invert.SetTextureSlotInputs( screenColorTexture, screenColorTexture ); 


      graph.SetProcessOrder( 
        screenColorTexture, 
        invert 
      );
    }
   

    protected override void ForAllViews()
    {
      invert.constants.Set(        
        amount,
        r ? 1.0f : 0.0f,
        g ? 1.0f : 0.0f,
        b ? 1.0f : 0.0f
      );
    }

   
  }
}