using Godot;

namespace Rokojori
{  
  [Tool]
  [GlobalClass]
  public partial class EdgeFlareFading:FlareFading
  {
    [Export( PropertyHint.Range, "0,2" ) ]
    public float power = 0.8f;

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

    public override void ApplyFading( FlareLayer.Data data )
    {
      var material = data.material;

      BaseFlareShader.fadingMode.Set( material, 1 );

      BaseFlareShader.fadingPower.Set( material, Mathf.Lerp( 0.0f, power, sizeAmount ) );
      BaseFlareShader.opacityFadingPower.Set( material, power );
      BaseFlareShader.sizeXfadingPower.Set( material, Mathf.Lerp( 0.0f, power, sizeAmount ) );
      BaseFlareShader.sizeYfadingPower.Set( material, Mathf.Lerp( 0.0f, power, sizeAmount ) );
    }
  }
}