UNPKG

polygonjs-engine

Version:

node-based webgl 3D engine https://polygonjs.com

40 lines (39 loc) 1.41 kB
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 TextureAlphaMapParamConfig(Base2) { return class Mixin extends Base2 { constructor() { super(...arguments); this.useAlphaMap = ParamConfig.BOOLEAN(0, BooleanParamOptions(TextureAlphaMapController)); this.alphaMap = ParamConfig.OPERATOR_PATH(NODE_PATH_DEFAULT.NODE.UV, OperatorPathOptions(TextureAlphaMapController, "useAlphaMap")); } }; } class TextureAlphaMaterial extends Material2 { } class TextureAlphaMapParamsConfig extends TextureAlphaMapParamConfig(NodeParamsConfig) { } class TextureAlphaMapMatNode extends TypedMatNode { } export class TextureAlphaMapController extends BaseTextureMapController { constructor(node, _update_options) { super(node, _update_options); this.node = node; } initializeNode() { this.add_hooks(this.node.p.useAlphaMap, this.node.p.alphaMap); } async update() { this._update(this.node.material, "alphaMap", this.node.p.useAlphaMap, this.node.p.alphaMap); } static async update(node) { node.texture_alpha_map_controller.update(); } }