@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
33 lines (32 loc) • 1.11 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { InputCloneMode } from "../../poly/InputCloneMode";
import { PeakSopOperation } from "../../operations/sop/Peak";
const DEFAULT = PeakSopOperation.DEFAULT_PARAMS;
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
class PeakSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param amount the points will be moved */
this.amount = ParamConfig.FLOAT(DEFAULT.amount, { range: [-1, 1] });
}
}
const ParamsConfig = new PeakSopParamsConfig();
export class PeakSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "peak";
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(InputCloneMode.FROM_NODE);
}
cook(input_contents) {
this._operation = this._operation || new PeakSopOperation(this.scene(), this.states, this);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}