UNPKG

polygonjs-engine

Version:

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

35 lines (34 loc) 1.19 kB
import {TypedSopNode} from "./_Base"; import {JitterSopOperation} from "../../../core/operations/sop/Jitter"; import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig"; const DEFAULT = JitterSopOperation.DEFAULT_PARAMS; class JitterSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.amount = ParamConfig.FLOAT(DEFAULT.amount); this.mult = ParamConfig.VECTOR3(DEFAULT.mult); this.seed = ParamConfig.INTEGER(DEFAULT.seed, {range: [0, 100]}); } } const ParamsConfig2 = new JitterSopParamsConfig(); export class JitterSopNode extends TypedSopNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; } static type() { return "jitter"; } static displayedInputNames() { return ["geometry to jitter points of"]; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(JitterSopOperation.INPUT_CLONED_STATE); } cook(input_contents) { this._operation = this._operation || new JitterSopOperation(this.scene(), this.states); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }