UNPKG

@polygonjs/polygonjs

Version:

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

37 lines (36 loc) 1.51 kB
"use strict"; import { TypedJsNode } from "./_Base"; import { NodeParamsConfig } from "../utils/params/ParamsConfig"; import { JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF } from "../utils/io/connections/Js"; import { inputObject3D } from "./_BaseObject3D"; import { Poly } from "../../Poly"; const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF; class GetParentJsParamsConfig extends NodeParamsConfig { } const ParamsConfig = new GetParentJsParamsConfig(); export class GetParentJsNode extends TypedJsNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "getParent"; } initializeNode() { this.io.inputs.setNamedInputConnectionPoints([ new JsConnectionPoint(JsConnectionPointType.OBJECT_3D, JsConnectionPointType.OBJECT_3D, CONNECTION_OPTIONS) ]); this.io.outputs.setNamedOutputConnectionPoints([ new JsConnectionPoint(JsConnectionPointType.OBJECT_3D, JsConnectionPointType.OBJECT_3D) ]); } setLines(shadersCollectionController) { const object3D = inputObject3D(this, shadersCollectionController); const out = this.jsVarName(JsConnectionPointType.OBJECT_3D); const func = Poly.namedFunctionsRegister.getFunction("getParent", this, shadersCollectionController); const bodyLine = func.asString(object3D); shadersCollectionController.addBodyOrComputed(this, [ { dataType: JsConnectionPointType.PLANE, varName: out, value: bodyLine } ]); } }