UNPKG

polygonjs-engine

Version:

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

42 lines (41 loc) 1.41 kB
import {TypedSopNode} from "./_Base"; import {RoundedBoxSopOperation} from "../../../core/operations/sop/RoundedBox"; import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig"; const DEFAULT = RoundedBoxSopOperation.DEFAULT_PARAMS; class BoxSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.size = ParamConfig.FLOAT(DEFAULT.size); this.divisions = ParamConfig.INTEGER(DEFAULT.divisions, { range: [1, 10], rangeLocked: [true, false] }); this.bevel = ParamConfig.FLOAT(DEFAULT.bevel, { range: [0, 1], rangeLocked: [true, false] }); this.center = ParamConfig.VECTOR3(DEFAULT.center); } } const ParamsConfig2 = new BoxSopParamsConfig(); export class RoundedBoxSopNode extends TypedSopNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; } static type() { return "roundedBox"; } static displayedInputNames() { return ["geometry to create bounding box from (optional)"]; } initializeNode() { this.io.inputs.setCount(0, 1); this.io.inputs.initInputsClonedState(RoundedBoxSopOperation.INPUT_CLONED_STATE); } cook(input_contents) { this._operation = this._operation || new RoundedBoxSopOperation(this._scene, this.states); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }