UNPKG

@polygonjs/polygonjs

Version:

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

45 lines (44 loc) 1.81 kB
"use strict"; import { PolyNodeParamsConfig } from "../../../utils/poly/PolyNodeParamsConfig"; import { PolyNodeController } from "../../../utils/poly/PolyNodeController"; import { AbstractTypedSubnetGlNode, TypedSubnetGlParamsConfigMixin } from "../../Subnet"; import { NodeParamsConfig } from "../../../utils/params/ParamsConfig"; import { ModuleName } from "../../../../poly/registers/modules/Common"; import { NodeContext } from "../../../../poly/NodeContext"; function createPolyGlNode(nodeType, definition, polyNodeControllerClass) { class SubnetGlParamsConfig extends TypedSubnetGlParamsConfigMixin(NodeParamsConfig) { } const ParamsConfig = PolyNodeParamsConfig.ParamsConfig(definition, SubnetGlParamsConfig); class BasePolyGlNode extends AbstractTypedSubnetGlNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; this.polyNodeController = new polyNodeControllerClass(this, definition); } static type() { return nodeType; } requiredModules() { return [ModuleName.POLY_GL]; } _expectedInputTypes() { var _a, _b; return ((_b = (_a = definition.inputs) == null ? void 0 : _a.typed) == null ? void 0 : _b.types.map((t) => t.type)) || []; } _expectedInputName(index) { var _a, _b; const names = ((_b = (_a = definition.inputs) == null ? void 0 : _a.typed) == null ? void 0 : _b.types.map((t) => t.name)) || []; return names[index]; } _expectedOutputTypes() { return this._expectedInputTypes(); } _expectedOutputName(index) { return this._expectedInputName(index); } } return BasePolyGlNode; } export function onPolyGlModuleRegister(poly) { PolyNodeController.registerCreatePolyNodeFunctionForContext(NodeContext.GL, createPolyGlNode); }