@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
51 lines (50 loc) • 2.2 kB
JavaScript
;
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 { Poly } from "../../Poly";
const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF;
export var Box3IntersectsBox3InputName = /* @__PURE__ */ ((Box3IntersectsBox3InputName2) => {
Box3IntersectsBox3InputName2["BOX3a"] = "Box3a";
Box3IntersectsBox3InputName2["BOX3b"] = "Box3b";
return Box3IntersectsBox3InputName2;
})(Box3IntersectsBox3InputName || {});
export var Box3IntersectsBox3OutputName = /* @__PURE__ */ ((Box3IntersectsBox3OutputName2) => {
Box3IntersectsBox3OutputName2["INTERSECTS"] = "intersects";
return Box3IntersectsBox3OutputName2;
})(Box3IntersectsBox3OutputName || {});
class Box3IntersectsBox3JsParamsConfig extends NodeParamsConfig {
}
const ParamsConfig = new Box3IntersectsBox3JsParamsConfig();
export class Box3IntersectsBox3JsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "box3IntersectsBox3";
}
initializeNode() {
this.io.inputs.setNamedInputConnectionPoints([
new JsConnectionPoint("Box3a" /* BOX3a */, JsConnectionPointType.BOX3, CONNECTION_OPTIONS),
new JsConnectionPoint("Box3b" /* BOX3b */, JsConnectionPointType.BOX3, CONNECTION_OPTIONS)
]);
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(
"intersects" /* INTERSECTS */,
JsConnectionPointType.BOOLEAN,
CONNECTION_OPTIONS
)
]);
}
setLines(linesController) {
const box3a = this.variableForInput(linesController, "Box3a" /* BOX3a */);
const box3b = this.variableForInput(linesController, "Box3b" /* BOX3b */);
const out = this.jsVarName("intersects" /* INTERSECTS */);
const func = Poly.namedFunctionsRegister.getFunction("box3IntersectsBox3", this, linesController);
const bodyLine = func.asString(box3a, box3b);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.PLANE, varName: out, value: bodyLine }
]);
}
}