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

namespace Rokojori
{
  [Tool]
  [GlobalClass]
	public partial class FrameSmoothing: Smoothing
	{
    [Export( PropertyHint.Range, "0,600")]
    public int frames = 10;      
    
    protected override float _ComputeInterpolationAmount( float delta )
    {
      frames = Mathf.Clamp( frames, 0, 600 );

      if ( frames <= 0 )
      {
        return 1;
      }      

      var coefficient = GetCoefficientForFrames( frames );
      return 1f - Mathf.Exp( -coefficient * delta );
    }

    public static float GetCoefficientForFrames( int frames )
    {
      return FrameSmoothingTable.Get( frames );
    }

  }
}