@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
49 lines (48 loc) • 1.98 kB
JavaScript
;
import { TypedJsNode } from "./_Base";
import { NodeParamsConfig } from "../utils/params/ParamsConfig";
import { JS_CONNECTION_POINT_IN_NODE_DEF, JsConnectionPoint, JsConnectionPointType } from "../utils/io/connections/Js";
import { Poly } from "../../Poly";
import { Matrix4 } from "three";
const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF;
export var Matrix4MultiplyInputName = /* @__PURE__ */ ((Matrix4MultiplyInputName2) => {
Matrix4MultiplyInputName2["m1"] = "m1";
Matrix4MultiplyInputName2["m2"] = "m2";
return Matrix4MultiplyInputName2;
})(Matrix4MultiplyInputName || {});
class Matrix4MultiplyJsParamsConfig extends NodeParamsConfig {
}
const ParamsConfig = new Matrix4MultiplyJsParamsConfig();
export class Matrix4MultiplyJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "matrix4Multiply";
}
initializeNode() {
super.initializeNode();
this.io.inputs.setNamedInputConnectionPoints([
new JsConnectionPoint("m1" /* m1 */, JsConnectionPointType.MATRIX4, CONNECTION_OPTIONS),
new JsConnectionPoint("m2" /* m2 */, JsConnectionPointType.MATRIX4, CONNECTION_OPTIONS)
]);
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.MATRIX4, JsConnectionPointType.MATRIX4)
]);
}
setLines(linesController) {
const m1 = this.variableForInput(linesController, "m1" /* m1 */);
const m2 = this.variableForInput(linesController, "m2" /* m2 */);
const varName = this.jsVarName(JsConnectionPointType.MATRIX4);
const tmpVarName = linesController.addVariable(this, new Matrix4());
const func = Poly.namedFunctionsRegister.getFunction("matrix4Multiply", this, linesController);
linesController.addBodyOrComputed(this, [
{
dataType: JsConnectionPointType.MATRIX4,
varName,
value: func.asString(m1, m2, tmpVarName)
}
]);
}
}