UNPKG

@polygonjs/polygonjs

Version:

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

50 lines (49 loc) 1.66 kB
"use strict"; import { BaseNodeGlMathFunctionArg2GlNode } from "./_BaseMathFunction"; import Quaternion from "./gl/quaternion.glsl"; import { GlConnectionPointType } from "../utils/io/connections/Gl"; import { FunctionGLDefinition } from "./utils/GLDefinition"; var AlignGlNodeInputName = /* @__PURE__ */ ((AlignGlNodeInputName2) => { AlignGlNodeInputName2["DIR"] = "dir"; AlignGlNodeInputName2["UP"] = "up"; return AlignGlNodeInputName2; })(AlignGlNodeInputName || {}); const InputNames = ["dir" /* DIR */, "up" /* UP */]; const DEFAULT_DIR = [0, 0, 1]; const DEFAULT_UP = [0, 1, 0]; const DefaultValues = { ["dir" /* DIR */]: DEFAULT_DIR, ["up" /* UP */]: DEFAULT_UP }; export class AlignGlNode extends BaseNodeGlMathFunctionArg2GlNode { static type() { return "align"; } 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.VEC3 ]); this.io.connection_points.set_expected_output_types_function(() => [GlConnectionPointType.VEC4]); } // gl_input_name(index: number) { // return InputNames[index]; // } paramDefaultValue(name) { return DefaultValues[name]; } gl_method_name() { return "align"; } // protected expected_input_types() { // return [ConnectionPointType.VEC3, ConnectionPointType.VEC3]; // } // protected expected_output_types() { // return [ConnectionPointType.VEC4]; // } gl_function_definitions() { return [new FunctionGLDefinition(this, Quaternion)]; } }