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

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

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

    [ Export( PropertyHint.Range, "0,360") ]
    public float hue = 35;

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

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

    RG_ScreenColorTexure screenColorTexture;
    RG_Sepia sepia;    

    void Initialize()
    { 
      screenColorTexture = new RG_ScreenColorTexure( graph );
      sepia = new RG_Sepia( graph );


      graph.InitializeNodes();      

      
      sepia.SetTextureSlotInputs( screenColorTexture, screenColorTexture ); 


      graph.SetProcessOrder( 
        screenColorTexture, 
        sepia 
      );
    }
   

    protected override void ForAllViews()
    {
      sepia.constants.Set(
        amount, 
        hue / 360f,
        saturation,
        saturationAmount
      );
    }

   
  }
}