UNPKG

@polygonjs/polygonjs

Version:

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

37 lines (36 loc) 1.34 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { JitterSopOperation } from "../../operations/sop/Jitter"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = JitterSopOperation.DEFAULT_PARAMS; class JitterSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param amount of jitter */ this.amount = ParamConfig.FLOAT(DEFAULT.amount); /** @param mult of each axis */ this.mult = ParamConfig.VECTOR3(DEFAULT.mult); /** @param seed used to set the direction each point is moved to */ this.seed = ParamConfig.INTEGER(DEFAULT.seed, { range: [0, 100] }); } } const ParamsConfig = new JitterSopParamsConfig(); export class JitterSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.JITTER; } 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, this); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }