UNPKG

polygonjs-engine

Version:

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

41 lines (40 loc) 1.4 kB
import {TypedSopNode} from "./_Base"; import {MergeSopOperation} from "../../../core/operations/sop/Merge"; const INPUT_NAME = "geometry to merge"; import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig"; const DEFAULT = MergeSopOperation.DEFAULT_PARAMS; class MergeSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.compact = ParamConfig.BOOLEAN(DEFAULT.compact); } } const ParamsConfig2 = new MergeSopParamsConfig(); export class MergeSopNode extends TypedSopNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; } static type() { return "merge"; } static displayedInputNames() { return [INPUT_NAME, INPUT_NAME, INPUT_NAME, INPUT_NAME]; } initializeNode() { this.io.inputs.setCount(1, 4); this.io.inputs.initInputsClonedState(MergeSopOperation.INPUT_CLONED_STATE); this.scene().dispatchController.onAddListener(() => { this.params.onParamsCreated("params_label", () => { this.params.label.init([this.p.compact], () => { return this.pv.compact ? "compact" : "separate objects"; }); }); }); } cook(input_contents) { this._operation = this._operation || new MergeSopOperation(this.scene(), this.states); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }