UNPKG

@polygonjs/polygonjs

Version:

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

41 lines (40 loc) 1.41 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { MirrorSopOperation } from "../../operations/sop/Mirror"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = MirrorSopOperation.DEFAULT_PARAMS; class MirrorSopParamConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param group to assign the material to */ this.group = ParamConfig.STRING(DEFAULT.group, { objectMask: true }); /** @param axis */ this.axis = ParamConfig.VECTOR3(DEFAULT.axis); /** @param center */ this.center = ParamConfig.VECTOR3(DEFAULT.center); /** @param preserve input */ this.preserveInput = ParamConfig.BOOLEAN(DEFAULT.preserveInput); } } const ParamsConfig = new MirrorSopParamConfig(); export class MirrorSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.MIRROR; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(MirrorSopOperation.INPUT_CLONED_STATE); } cook(inputCoreGroups) { this._operation = this._operation || new MirrorSopOperation(this.scene(), this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }