本文整理汇总了TypeScript中gl-matrix.vec4类的典型用法代码示例。如果您正苦于以下问题:TypeScript vec4类的具体用法?TypeScript vec4怎么用?TypeScript vec4使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vec4类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Float32Array
// common
import { glMatrix, vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat } from "gl-matrix";
var outVal: number;
var outBool: boolean;
var outStr: string;
let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
let vec2A = vec2.fromValues(1, 2);
let vec2B = vec2.fromValues(3, 4);
let vec3A = vec3.fromValues(1, 2, 3);
let vec3B = vec3.fromValues(3, 4, 5);
let vec4A = vec4.fromValues(1, 2, 3, 4);
let vec4B = vec4.fromValues(3, 4, 5, 6);
let mat2A = mat2.fromValues(1, 2, 3, 4);
let mat2B = mat2.fromValues(1, 2, 3, 4);
let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let quatA = quat.fromValues(1, 2, 3, 4);
let quatB = quat.fromValues(5, 6, 7, 8);
let outVec2 = vec2.create();
let outVec3 = vec3.create();
let outVec4 = vec4.create();
let outMat2 = mat2.create();
let outMat2d = mat2d.create();
示例2: constructor
export type Vec4 = Float32Array;
export type Mat3 = Float32Array;
export type Mat4 = Float32Array;
export type Quat = Float32Array;
export const identityMat4 = mat4.create();
mat4.identity(identityMat4);
export const AXES_NAMES = ['x', 'y', 'z'];
export class BoundingBox {
constructor(public lower: Vec3, public upper: Vec3) {}
};
export const kAxes = [
vec4.fromValues(1, 0, 0, 0), vec4.fromValues(0, 1, 0, 0),
vec4.fromValues(0, 0, 1, 0)
];
export const kZeroVec = vec3.fromValues(0, 0, 0);
export function prod3(x: ArrayLike<number>) {
return x[0] * x[1] * x[2];
}
export function prod4(x: ArrayLike<number>) {
return x[0] * x[1] * x[2] * x[3];
}
/**
* Implements a one-to-one conversion from Vec3 to string, suitable for use a Map key.
*