import {TypedSopNode} from "./_Base";
import {TexturePropertiesSopOperation} from "../../../core/operations/sop/TextureProperties";
import {MAG_FILTER_MENU_ENTRIES, MIN_FILTER_MENU_ENTRIES} from "../../../core/cop/ConstantFilter";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
const DEFAULT = TexturePropertiesSopOperation.DEFAULT_PARAMS;
class TexturePropertiesSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.applyToChildren = ParamConfig.BOOLEAN(DEFAULT.applyToChildren);
    this.separator = ParamConfig.SEPARATOR();
    this.tanisotropy = ParamConfig.BOOLEAN(DEFAULT.tanisotropy);
    this.useRendererMaxAnisotropy = ParamConfig.BOOLEAN(DEFAULT.useRendererMaxAnisotropy, {
      visibleIf: {tanisotropy: 1}
    });
    this.anisotropy = ParamConfig.INTEGER(DEFAULT.anisotropy, {
      visibleIf: {tanisotropy: 1, useRendererMaxAnisotropy: 0},
      range: [0, 32],
      rangeLocked: [true, false]
    });
    this.tminFilter = ParamConfig.BOOLEAN(0);
    this.minFilter = ParamConfig.INTEGER(DEFAULT.minFilter, {
      visibleIf: {tminFilter: 1},
      menu: {
        entries: MIN_FILTER_MENU_ENTRIES
      }
    });
    this.tmagFilter = ParamConfig.BOOLEAN(0);
    this.magFilter = ParamConfig.INTEGER(DEFAULT.magFilter, {
      visibleIf: {tmagFilter: 1},
      menu: {
        entries: MAG_FILTER_MENU_ENTRIES
      }
    });
  }
}
const ParamsConfig2 = new TexturePropertiesSopParamsConfig();
export class TexturePropertiesSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "textureProperties";
  }
  static displayedInputNames() {
    return ["objects with textures to change properties of"];
  }
  initializeNode() {
    this.io.inputs.setCount(1);
    this.io.inputs.initInputsClonedState(TexturePropertiesSopOperation.INPUT_CLONED_STATE);
  }
  async cook(input_contents) {
    this._operation = this._operation || new TexturePropertiesSopOperation(this.scene(), this.states);
    const core_group = await this._operation.cook(input_contents, this.pv);
    this.setCoreGroup(core_group);
  }
}
