UNPKG

@polygonjs/polygonjs

Version:

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

50 lines (49 loc) 2.05 kB
"use strict"; import { TypedJsNode } from "./_Base"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF } from "../utils/io/connections/Js"; import { Poly } from "../../Poly"; const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF; export var Box3ContainsPointOutputName = /* @__PURE__ */ ((Box3ContainsPointOutputName2) => { Box3ContainsPointOutputName2["CONTAINS"] = "contains"; return Box3ContainsPointOutputName2; })(Box3ContainsPointOutputName || {}); class Box3ContainsPointJsParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.position = ParamConfig.VECTOR3([0, 0, 0]); } } const ParamsConfig = new Box3ContainsPointJsParamsConfig(); export class Box3ContainsPointJsNode extends TypedJsNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "box3ContainsPoint"; } initializeNode() { this.io.inputs.setNamedInputConnectionPoints([ new JsConnectionPoint(JsConnectionPointType.BOX3, JsConnectionPointType.BOX3, CONNECTION_OPTIONS) // new JsConnectionPoint(JsConnectionPointType.VECTOR3, JsConnectionPointType.VECTOR3, CONNECTION_OPTIONS), ]); this.io.outputs.setNamedOutputConnectionPoints([ new JsConnectionPoint( "contains" /* CONTAINS */, JsConnectionPointType.BOOLEAN, CONNECTION_OPTIONS ) ]); } setLines(linesController) { const box3 = this.variableForInput(linesController, JsConnectionPointType.BOX3); const position = this.variableForInputParam(linesController, this.p.position); const out = this.jsVarName("contains" /* CONTAINS */); const func = Poly.namedFunctionsRegister.getFunction("box3ContainsPoint", this, linesController); const bodyLine = func.asString(box3, position); linesController.addBodyOrComputed(this, [ { dataType: JsConnectionPointType.PLANE, varName: out, value: bodyLine } ]); } }