UNPKG

@polygonjs/polygonjs

Version:

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

38 lines (37 loc) 1.27 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { PlaneHelperSopOperation } from "../../operations/sop/PlaneHelper"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; const DEFAULT = PlaneHelperSopOperation.DEFAULT_PARAMS; class PlaneHelperSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param size of the plane */ this.size = ParamConfig.FLOAT(DEFAULT.size, { range: [1, 10], rangeLocked: [true, false] }); /** @param colorCenterLine */ this.colorCenterLine = ParamConfig.COLOR(DEFAULT.colorCenterLine.toArray()); /** @param colorGrid */ this.colorGrid = ParamConfig.COLOR(DEFAULT.colorGrid.toArray()); } } const ParamsConfig = new PlaneHelperSopParamsConfig(); export class PlaneHelperSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "planeHelper"; } initializeNode() { this.io.inputs.setCount(0); } cook(input_contents) { this._operation = this._operation || new PlaneHelperSopOperation(this.scene(), this.states, this); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }