import BaseShaderMixin from "../mixins/base-shader-mixin.mjs";

/**
 * An abstract filter which provides a framework for reusable definition
 * @extends {PIXI.Filter}
 * @mixes BaseShaderMixin
 * @abstract
 */
export default class AbstractBaseFilter extends BaseShaderMixin(PIXI.Filter) {

  /** @override */
  static create(uniforms, options) {
    const vert = this._vertexShaderCompatibility(options) ?? this._createVertexShader(options);
    const frag = this._fragmentShaderCompatibility(options) ?? this._createFragmentShader(options);
    const u = foundry.utils.mergeObject(this.defaultUniforms, uniforms, {inplace: false});
    const filter = new this(vert, frag, u);
    filter._configure(options);
    return filter;
  }
}

