import {Material as Material2} from "three/src/materials/Material";
import {TypedMatNode} from "../_Base";
import {
  BaseTextureMapController,
  BooleanParamOptions,
  OperatorPathOptions
} from "./_BaseTextureController";
import {NodeParamsConfig, ParamConfig} from "../../utils/params/ParamsConfig";
import {NODE_PATH_DEFAULT} from "../../../../core/Walker";
export function TextureEnvMapParamConfig(Base2) {
  return class Mixin extends Base2 {
    constructor() {
      super(...arguments);
      this.useEnvMap = ParamConfig.BOOLEAN(0, BooleanParamOptions(TextureEnvMapController));
      this.envMap = ParamConfig.OPERATOR_PATH(NODE_PATH_DEFAULT.NODE.ENV_MAP, OperatorPathOptions(TextureEnvMapController, "useEnvMap"));
      this.envMapIntensity = ParamConfig.FLOAT(1, {visibleIf: {useEnvMap: 1}});
    }
  };
}
class TextureEnvMaterial extends Material2 {
}
class TextureEnvMapParamsConfig extends TextureEnvMapParamConfig(NodeParamsConfig) {
}
class TextureEnvMapMatNode extends TypedMatNode {
}
export class TextureEnvMapController extends BaseTextureMapController {
  constructor(node, _update_options) {
    super(node, _update_options);
    this.node = node;
  }
  initializeNode() {
    this.add_hooks(this.node.p.useEnvMap, this.node.p.envMap);
  }
  async update() {
    this._update(this.node.material, "envMap", this.node.p.useEnvMap, this.node.p.envMap);
  }
  static async update(node) {
    node.texture_env_map_controller.update();
  }
}
