
using Godot;
using System.Collections.Generic;

namespace Rokojori
{  
  [Tool]
  [GlobalClass]
  public partial class _XX_CompositorEffectGraph:RokojoriCompositorEffect
  {
    public static readonly string path = "res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph";
    public static string Path( string subPath )
    {
      return path + "/" + subPath;
    }

    protected List<CompositorEffectGraphNode> _nodes = new List<CompositorEffectGraphNode>();
    protected List<CompositorEffectGraphProcessor> _processors = new List<CompositorEffectGraphProcessor>();
    protected List<CompositorEffectGraphProcessor> _processOrder = new List<CompositorEffectGraphProcessor>();



    protected void SetProcessOrder( List<CompositorEffectGraphProcessor> order )
    {
      _processOrder.Clear();
      _processOrder.AddRange( order );
    }

    protected void SetProcessOrder( params CompositorEffectGraphProcessor[] order )
    {
      _processOrder.Clear();
      _processOrder.AddRange( order );
    }

    protected override void RenderView()
    {
      OnPreProcess();
      _processOrder.ForEach( p => p.Process() );
      OnPostProcess();
    }

    protected virtual void OnPreProcess()
    {

    }

    protected virtual void OnPostProcess()
    {

    }
  }
}