UNPKG

@polygonjs/polygonjs

Version:

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

36 lines (32 loc) 839 B
/** * aligns vectors * * * * */ import {Number3, PolyDictionary} from '../../../types/GlobalTypes'; import Quaternion from './gl/quaternion.glsl'; import {MathFunctionArg3Factory} from './_Math_Arg3'; import {GlConnectionPointType} from '../utils/io/connections/Gl'; const DefaultValues: PolyDictionary<Number3> = { start: [0, 0, 1], end: [1, 0, 0], up: [0, 1, 0], }; export class VectorAlignGlNode extends MathFunctionArg3Factory('vectorAlign', { in: ['start', 'end', 'up'], method: 'vectorAlignWithUp', functions: [Quaternion], }) { protected override _expected_input_types() { const type = GlConnectionPointType.VEC3; return [type, type, type]; } protected override _expected_output_types() { return [GlConnectionPointType.VEC4]; } override paramDefaultValue(name: string) { return DefaultValues[name]; } }