@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
53 lines (52 loc) • 1.81 kB
JavaScript
;
import { BaseNodeGlMathFunctionArg2GlNode } from "./_BaseMathFunction";
import Quaternion from "./gl/quaternion.glsl";
import { GlConnectionPointType } from "../utils/io/connections/Gl";
import { FunctionGLDefinition } from "./utils/GLDefinition";
var QuatFromAxisAngleGlNodeInputName = /* @__PURE__ */ ((QuatFromAxisAngleGlNodeInputName2) => {
QuatFromAxisAngleGlNodeInputName2["AXIS"] = "axis";
QuatFromAxisAngleGlNodeInputName2["ANGLE"] = "angle";
return QuatFromAxisAngleGlNodeInputName2;
})(QuatFromAxisAngleGlNodeInputName || {});
const InputNames = [
"axis" /* AXIS */,
"angle" /* ANGLE */
];
const DEFAULT_AXIS = [0, 0, 1];
const DEFAULT_ANGLE = 0;
const DefaultValues = {
["axis" /* AXIS */]: DEFAULT_AXIS,
["angle" /* ANGLE */]: DEFAULT_ANGLE
};
export class QuatFromAxisAngleGlNode extends BaseNodeGlMathFunctionArg2GlNode {
static type() {
return "quatFromAxisAngle";
}
initializeNode() {
super.initializeNode();
this.io.connection_points.set_input_name_function((index) => InputNames[index]);
this.io.connection_points.set_expected_input_types_function(() => [
GlConnectionPointType.VEC3,
GlConnectionPointType.FLOAT
]);
this.io.connection_points.set_expected_output_types_function(() => [GlConnectionPointType.VEC4]);
}
// protected _gl_input_name(index: number) {
// return InputNames[index];
// }
paramDefaultValue(name) {
return DefaultValues[name];
}
gl_method_name() {
return "quatFromAxisAngle";
}
// protected _expected_input_types() {
// return [ConnectionPointType.VEC3, ConnectionPointType.FLOAT];
// }
// protected expected_output_types() {
// return [ConnectionPointType.VEC4];
// }
gl_function_definitions() {
return [new FunctionGLDefinition(this, Quaternion)];
}
}