@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
43 lines (42 loc) • 1.76 kB
JavaScript
;
import { BaseRayObjectJsNode } from "./_BaseRayObject";
import { JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF } from "../utils/io/connections/Js";
import { Poly } from "../../Poly";
import { inputObject3D } from "./_BaseObject3D";
const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF;
const OUTPUT_NAME = "intersects";
var RayIntersectsObjectJsNodeInputName = /* @__PURE__ */ ((RayIntersectsObjectJsNodeInputName2) => {
RayIntersectsObjectJsNodeInputName2["RECURSIVE"] = "recursive";
return RayIntersectsObjectJsNodeInputName2;
})(RayIntersectsObjectJsNodeInputName || {});
export class RayIntersectsObjectJsNode extends BaseRayObjectJsNode {
static type() {
return "rayIntersectsObject";
}
initializeNode() {
super.initializeNode();
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(OUTPUT_NAME, JsConnectionPointType.BOOLEAN, CONNECTION_OPTIONS)
]);
}
_additionalInputs() {
return [
new JsConnectionPoint(
"recursive" /* RECURSIVE */,
JsConnectionPointType.BOOLEAN,
CONNECTION_OPTIONS
)
];
}
setLines(linesController) {
const object3D = inputObject3D(this, linesController);
const ray = this.variableForInput(linesController, JsConnectionPointType.RAY);
const recursive = this.variableForInput(linesController, "recursive" /* RECURSIVE */);
const out = this.jsVarName(OUTPUT_NAME);
const func = Poly.namedFunctionsRegister.getFunction("rayIntersectsObject3D", this, linesController);
const bodyLine = func.asString(ray, object3D, recursive);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.VECTOR3, varName: out, value: bodyLine }
]);
}
}