UNPKG

@polygonjs/polygonjs

Version:

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

40 lines (39 loc) 1.51 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { InputCloneMode } from "../../poly/InputCloneMode"; import { AdjacencySopOperation } from "../../operations/sop/Adjacency"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = AdjacencySopOperation.DEFAULT_PARAMS; class AdjacencySopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param select which objects this add adjacency attributes to */ this.group = ParamConfig.STRING("", { objectMask: true }); /** @param name of attribute with count of adjacency attributes */ this.adjacencyCountName = ParamConfig.STRING(DEFAULT.adjacencyCountName); /** @param name of adjacency attribute */ this.adjacencyBaseName = ParamConfig.STRING(DEFAULT.adjacencyBaseName); } } const ParamsConfig = new AdjacencySopParamsConfig(); export class AdjacencySopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.ADJACENCY; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState([InputCloneMode.FROM_NODE]); } cook(inputCoreGroups) { this._operation = this._operation || new AdjacencySopOperation(this.scene(), this.states, this); const coreGroup = this._operation.cook(inputCoreGroups, this.pv); this.setCoreGroup(coreGroup); } }