@vived/app 2.29.1 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -94,6 +94,9 @@ export declare class Matrix {
|
|
|
94
94
|
* @returns A new matrix that is the same as the original but the scale has been changed
|
|
95
95
|
*/
|
|
96
96
|
static SetMatrixScale(original: Matrix, scale: Vector3): Matrix;
|
|
97
|
+
static FromFloat32Array(array: Float32Array): Matrix;
|
|
98
|
+
static FlipTransformMatrixHand(matrix: Matrix): Matrix;
|
|
99
|
+
static FlipProjectionMatrixHand(matrix: Matrix): Matrix;
|
|
97
100
|
/**
|
|
98
101
|
* Returns the determinate of the matrix
|
|
99
102
|
*/
|
|
@@ -325,6 +325,48 @@ class Matrix {
|
|
|
325
325
|
const translation = original.translation;
|
|
326
326
|
return Matrix.Compose(scale, rotation, translation);
|
|
327
327
|
}
|
|
328
|
+
static FromFloat32Array(array) {
|
|
329
|
+
if (array.length !== 16) {
|
|
330
|
+
console.error("[matrixFrom32] Array does not have a length of 16");
|
|
331
|
+
return Matrix.Identity();
|
|
332
|
+
}
|
|
333
|
+
const matrixArray = [
|
|
334
|
+
array[0],
|
|
335
|
+
array[1],
|
|
336
|
+
array[2],
|
|
337
|
+
array[3],
|
|
338
|
+
array[4],
|
|
339
|
+
array[5],
|
|
340
|
+
array[6],
|
|
341
|
+
array[7],
|
|
342
|
+
array[8],
|
|
343
|
+
array[9],
|
|
344
|
+
array[10],
|
|
345
|
+
array[11],
|
|
346
|
+
array[12],
|
|
347
|
+
array[13],
|
|
348
|
+
array[14],
|
|
349
|
+
array[15]
|
|
350
|
+
];
|
|
351
|
+
return new Matrix(matrixArray);
|
|
352
|
+
}
|
|
353
|
+
static FlipTransformMatrixHand(matrix) {
|
|
354
|
+
const m = matrix.m;
|
|
355
|
+
m[2] *= -1;
|
|
356
|
+
m[6] *= -1;
|
|
357
|
+
m[8] *= -1;
|
|
358
|
+
m[9] *= -1;
|
|
359
|
+
m[14] *= -1;
|
|
360
|
+
return new Matrix(m);
|
|
361
|
+
}
|
|
362
|
+
static FlipProjectionMatrixHand(matrix) {
|
|
363
|
+
const m = matrix.m;
|
|
364
|
+
m[8] *= -1;
|
|
365
|
+
m[9] *= -1;
|
|
366
|
+
m[10] *= -1;
|
|
367
|
+
m[11] *= -1;
|
|
368
|
+
return new Matrix(m);
|
|
369
|
+
}
|
|
328
370
|
/**
|
|
329
371
|
* Returns the determinate of the matrix
|
|
330
372
|
*/
|