UNPKG

@polygonjs/polygonjs

Version:

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

39 lines (38 loc) 1.33 kB
"use strict"; import { JsConnectionPointType, JsConnectionPointTypeFromArrayTypeMap } from "../utils/io/connections/Js"; import { MathFunctionArg2OperationFactory, DEFAULT_ALLOWED_TYPES } from "./_Math_Arg1Operation"; var PowInput = /* @__PURE__ */ ((PowInput2) => { PowInput2["src"] = "src"; PowInput2["exp"] = "exp"; return PowInput2; })(PowInput || {}); const DefaultValues = { ["src" /* src */]: 0, ["exp" /* exp */]: 1 }; export class PowJsNode extends MathFunctionArg2OperationFactory("pow", { inputPrefix: "in", out: "pow" }) { paramDefaultValue(name) { return DefaultValues[name]; } _expectedInputName(index) { return ["src" /* src */, "exp" /* exp */][index]; } _expectedInputTypes() { let first_input_type = this.io.connection_points.first_input_connection_type(); const connectionPoints = this.io.inputs.namedInputConnectionPoints(); if (first_input_type && connectionPoints) { if (!DEFAULT_ALLOWED_TYPES.includes(first_input_type)) { const first_connection = connectionPoints[0]; if (first_connection) { first_input_type = first_connection.type(); } } } const type = first_input_type || JsConnectionPointType.FLOAT; const boundType = JsConnectionPointTypeFromArrayTypeMap[type]; return [type, boundType]; } }