UNPKG

@polygonjs/polygonjs

Version:

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

44 lines (43 loc) 1.62 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { LatticeSopOperation } from "../../operations/sop/Lattice"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = LatticeSopOperation.DEFAULT_PARAMS; class LatticeSopParamConfig extends NodeParamsConfig { constructor() { super(...arguments); this.group = ParamConfig.STRING(DEFAULT.group, { objectMask: true }); this.p0 = ParamConfig.VECTOR3(DEFAULT.p0); this.p1 = ParamConfig.VECTOR3(DEFAULT.p1); this.p2 = ParamConfig.VECTOR3(DEFAULT.p2); this.p3 = ParamConfig.VECTOR3(DEFAULT.p3); this.p4 = ParamConfig.VECTOR3(DEFAULT.p4); this.p5 = ParamConfig.VECTOR3(DEFAULT.p5); this.p6 = ParamConfig.VECTOR3(DEFAULT.p6); this.p7 = ParamConfig.VECTOR3(DEFAULT.p7); this.offset = ParamConfig.VECTOR3(DEFAULT.offset); this.moveObjectPosition = ParamConfig.BOOLEAN(DEFAULT.moveObjectPosition); } } const ParamsConfig = new LatticeSopParamConfig(); export class LatticeSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.LATTICE; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(LatticeSopOperation.INPUT_CLONED_STATE); } cook(inputCoreGroups) { this._operation = this._operation || new LatticeSopOperation(this.scene(), this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }