UNPKG

@polygonjs/polygonjs

Version:

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

42 lines (41 loc) 1.48 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { BoxLinesSopOperation } from "../../operations/sop/BoxLines"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = BoxLinesSopOperation.DEFAULT_PARAMS; class BoxLinesSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param size of the box */ this.size = ParamConfig.FLOAT(DEFAULT.size, { range: [0, 2], rangeLocked: [true, false] }); /** @param sizes on each axis */ this.sizes = ParamConfig.VECTOR3(DEFAULT.sizes); /** @param divisions on each axis */ this.divisions = ParamConfig.VECTOR3(DEFAULT.divisions); /** @param center of the geometry */ this.center = ParamConfig.VECTOR3(DEFAULT.center); } } const ParamsConfig = new BoxLinesSopParamsConfig(); export class BoxLinesSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.BOX_LINES; } initializeNode() { this.io.inputs.setCount(0, 1); this.io.inputs.initInputsClonedState(BoxLinesSopOperation.INPUT_CLONED_STATE); } cook(inputCoreGroups) { this._operation = this._operation || new BoxLinesSopOperation(this._scene, this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }