import {MeshBasicMaterial as MeshBasicMaterial2} from "three/src/materials/MeshBasicMaterial";
import {FrontSide} from "three/src/constants";
import {TypedMatNode} from "./_Base";
import {NodeParamsConfig} from "../utils/params/ParamsConfig";
import {ColorsController as ColorsController2, ColorParamConfig} from "./utils/ColorsController";
import {SideController as SideController2, SideParamConfig} from "./utils/SideController";
import {DepthController as DepthController2, DepthParamConfig} from "./utils/DepthController";
import {SkinningController as SkinningController2, SkinningParamConfig} from "./utils/SkinningController";
import {TextureMapController as TextureMapController2, TextureMapParamConfig} from "./utils/TextureMapController";
import {TextureAlphaMapController as TextureAlphaMapController2, TextureAlphaMapParamConfig} from "./utils/TextureAlphaMapController";
import {WireframeController as WireframeController2, WireframeParamConfig} from "./utils/WireframeController";
class MeshBasicMatParamsConfig extends WireframeParamConfig(TextureAlphaMapParamConfig(TextureMapParamConfig(SkinningParamConfig(DepthParamConfig(SideParamConfig(ColorParamConfig(NodeParamsConfig))))))) {
}
const ParamsConfig2 = new MeshBasicMatParamsConfig();
export class MeshBasicMatNode extends TypedMatNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
    this.texture_map_controller = new TextureMapController2(this, {direct_params: true});
    this.texture_alpha_map_controller = new TextureAlphaMapController2(this, {
      direct_params: true
    });
    this.depth_controller = new DepthController2(this);
  }
  static type() {
    return "meshBasic";
  }
  create_material() {
    return new MeshBasicMaterial2({
      vertexColors: false,
      side: FrontSide,
      color: 16777215,
      opacity: 1
    });
  }
  initializeNode() {
    this.params.onParamsCreated("init controllers", () => {
      this.texture_map_controller.initializeNode();
      this.texture_alpha_map_controller.initializeNode();
    });
  }
  async cook() {
    ColorsController2.update(this);
    SideController2.update(this);
    SkinningController2.update(this);
    this.texture_map_controller.update();
    this.texture_alpha_map_controller.update();
    this.depth_controller.update();
    WireframeController2.update(this);
    this.set_material(this.material);
  }
}
