UNPKG

polygonjs-engine

Version:

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

33 lines (32 loc) 1.26 kB
import {TypedSopNode} from "./_Base"; import {AttribAddMultSopOperation} from "../../../core/operations/sop/AttribAddMult"; import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig"; const DEFAULT = AttribAddMultSopOperation.DEFAULT_PARAMS; class AttribAddMultSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.name = ParamConfig.STRING(DEFAULT.name); this.preAdd = ParamConfig.FLOAT(DEFAULT.preAdd, {range: [0, 1]}); this.mult = ParamConfig.FLOAT(DEFAULT.mult, {range: [0, 1]}); this.postAdd = ParamConfig.FLOAT(DEFAULT.postAdd, {range: [0, 1]}); } } const ParamsConfig2 = new AttribAddMultSopParamsConfig(); export class AttribAddMultSopNode extends TypedSopNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; } static type() { return "attribAddMult"; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(AttribAddMultSopOperation.INPUT_CLONED_STATE); } cook(input_contents) { this._operation = this._operation || new AttribAddMultSopOperation(this.scene(), this.states); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }