rhodonite 0.19.10 → 0.20.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.
- package/README.md +32 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esm/foundation/core/Component.d.ts +63 -3
- package/dist/esm/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esm/foundation/core/Config.d.ts +8 -7
- package/dist/esm/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esm/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esm/foundation/importer/index.d.ts +1 -0
- package/dist/esm/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esm/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esm/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esm/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esm/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esm/foundation/math/MathUtil.d.ts +55 -0
- package/dist/esm/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esm/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esm/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esm/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esm/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esm/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esm/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esm/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esm/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esm/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esm/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esm/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esm/foundation/math/Scalar.d.ts +13 -14
- package/dist/esm/foundation/math/Vector2.d.ts +38 -38
- package/dist/esm/foundation/math/Vector3.d.ts +55 -54
- package/dist/esm/foundation/math/Vector4.d.ts +54 -55
- package/dist/esm/index.js +691 -686
- package/dist/esm/types/glTF2.d.ts +7 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esmdev/foundation/core/Component.d.ts +63 -3
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esmdev/foundation/core/Config.d.ts +8 -7
- package/dist/esmdev/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esmdev/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esmdev/foundation/importer/index.d.ts +1 -0
- package/dist/esmdev/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esmdev/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esmdev/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esmdev/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esmdev/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esmdev/foundation/math/MathUtil.d.ts +55 -0
- package/dist/esmdev/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esmdev/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esmdev/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esmdev/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esmdev/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esmdev/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esmdev/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esmdev/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esmdev/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esmdev/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esmdev/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esmdev/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esmdev/foundation/math/Scalar.d.ts +13 -14
- package/dist/esmdev/foundation/math/Vector2.d.ts +38 -38
- package/dist/esmdev/foundation/math/Vector3.d.ts +55 -54
- package/dist/esmdev/foundation/math/Vector4.d.ts +54 -55
- package/dist/esmdev/index.js +4994 -2723
- package/dist/esmdev/types/glTF2.d.ts +7 -0
- package/package.json +12 -10
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Array16, ArrayType } from '../../types/CommonTypes';
|
|
1
|
+
import type { Array16, ArrayType, FloatTypedArrayConstructor, TypedArray } from '../../types/CommonTypes';
|
|
2
2
|
import { type CompositionTypeEnum } from '../definitions/CompositionType';
|
|
3
3
|
import { AbstractMatrix } from './AbstractMatrix';
|
|
4
4
|
import { IdentityMatrix44 } from './IdentityMatrix44';
|
|
5
|
-
import type { IMatrix, IMatrix33, IMatrix44 } from './IMatrix';
|
|
5
|
+
import type { IMatrix, IMatrix33, IMatrix44, IMutableMatrix44 } from './IMatrix';
|
|
6
6
|
import type { IQuaternion } from './IQuaternion';
|
|
7
7
|
import type { IVector3, IVector4 } from './IVector';
|
|
8
|
-
import type { MutableMatrix44 } from './MutableMatrix44';
|
|
9
8
|
import type { MutableVector3 } from './MutableVector3';
|
|
10
9
|
import type { MutableVector4 } from './MutableVector4';
|
|
11
10
|
import { Vector3 } from './Vector3';
|
|
@@ -22,12 +21,15 @@ import { Vector4 } from './Vector4';
|
|
|
22
21
|
* const result = Matrix44.multiply(identity, translation);
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
|
-
export declare class
|
|
24
|
+
export declare class Matrix44_<T extends FloatTypedArrayConstructor> extends AbstractMatrix implements IMatrix, IMatrix44 {
|
|
26
25
|
/**
|
|
27
|
-
* Creates a new
|
|
28
|
-
* @param m - A
|
|
26
|
+
* Creates a new Matrix44_ instance.
|
|
27
|
+
* @param m - A typed array containing 16 matrix elements in column-major order
|
|
28
|
+
* @param _options - Configuration object containing the typed array constructor
|
|
29
29
|
*/
|
|
30
|
-
constructor(m:
|
|
30
|
+
constructor(m: TypedArray, _options: {
|
|
31
|
+
type: T;
|
|
32
|
+
});
|
|
31
33
|
/**
|
|
32
34
|
* Gets the matrix element at row 0, column 0.
|
|
33
35
|
* @returns The m00 component of the matrix
|
|
@@ -152,65 +154,96 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
152
154
|
* Creates a zero matrix (all elements are 0).
|
|
153
155
|
* @returns A new Matrix44 instance with all elements set to 0
|
|
154
156
|
*/
|
|
155
|
-
static
|
|
157
|
+
static _zero(type: FloatTypedArrayConstructor): IMatrix44;
|
|
156
158
|
/**
|
|
157
159
|
* Creates a 4x4 identity matrix.
|
|
158
160
|
* @returns A new IdentityMatrix44 instance representing the identity matrix
|
|
159
161
|
*/
|
|
160
|
-
static
|
|
162
|
+
static _identity(type: FloatTypedArrayConstructor): IMatrix44;
|
|
161
163
|
/**
|
|
162
164
|
* Creates a dummy matrix with zero-length array (for placeholder purposes).
|
|
163
165
|
* @returns A new Matrix44 instance with an empty array
|
|
164
166
|
*/
|
|
165
|
-
static
|
|
167
|
+
static _dummy(type: FloatTypedArrayConstructor): IMatrix44;
|
|
166
168
|
/**
|
|
167
169
|
* Creates a transpose matrix from the given matrix.
|
|
168
170
|
* For identity matrices, returns the same matrix since transpose of identity is identity.
|
|
169
171
|
* @param mat - The matrix to transpose
|
|
170
172
|
* @returns A new Matrix44 instance representing the transposed matrix
|
|
171
173
|
*/
|
|
172
|
-
static
|
|
174
|
+
static _transpose(mat: IMatrix44, type: FloatTypedArrayConstructor): IMatrix44;
|
|
175
|
+
/**
|
|
176
|
+
* Attempts to create the inverse of the given matrix.
|
|
177
|
+
* Uses optimized computation for 4x4 matrix inversion.
|
|
178
|
+
*
|
|
179
|
+
* Returns null instead of dividing by zero when the matrix is numerically
|
|
180
|
+
* singular (see {@link MathUtil.isSingularDet}).
|
|
181
|
+
*
|
|
182
|
+
* @param mat - The matrix to invert
|
|
183
|
+
* @returns A new Matrix44 instance representing the inverted matrix,
|
|
184
|
+
* or null if the matrix is not invertible
|
|
185
|
+
*/
|
|
186
|
+
static _tryInvert(mat: IMatrix44, type: FloatTypedArrayConstructor): IMatrix44 | null;
|
|
173
187
|
/**
|
|
174
188
|
* Creates an inverse matrix from the given matrix.
|
|
175
189
|
* Uses optimized computation for 4x4 matrix inversion.
|
|
190
|
+
*
|
|
191
|
+
* If the matrix is numerically singular, an identity matrix is returned
|
|
192
|
+
* instead of dividing by zero. Use {@link Matrix44.tryInvert} when the
|
|
193
|
+
* caller needs to detect the failure.
|
|
194
|
+
*
|
|
176
195
|
* @param mat - The matrix to invert
|
|
177
|
-
* @returns A new Matrix44 instance representing the inverted matrix
|
|
178
|
-
*
|
|
196
|
+
* @returns A new Matrix44 instance representing the inverted matrix,
|
|
197
|
+
* or the identity matrix if the input is singular
|
|
179
198
|
*/
|
|
180
|
-
static
|
|
199
|
+
static _invert(mat: IMatrix44, type: FloatTypedArrayConstructor): IMatrix44;
|
|
200
|
+
/**
|
|
201
|
+
* Attempts to compute the inverse of a matrix and store the result in an output matrix.
|
|
202
|
+
* The output matrix is left untouched when the input is numerically singular,
|
|
203
|
+
* which lets callers keep the previous valid value.
|
|
204
|
+
*
|
|
205
|
+
* @param mat - The matrix to invert
|
|
206
|
+
* @param outMat - The output matrix to store the result
|
|
207
|
+
* @returns True if the inversion succeeded, false if the matrix is singular
|
|
208
|
+
*/
|
|
209
|
+
static _tryInvertTo(mat: IMatrix44, outMat: IMutableMatrix44): boolean;
|
|
181
210
|
/**
|
|
182
211
|
* Computes the inverse of a matrix and stores the result in an output matrix.
|
|
183
212
|
* This is the mutable version of the invert method for performance optimization.
|
|
213
|
+
*
|
|
214
|
+
* If the matrix is numerically singular, the output matrix is set to the
|
|
215
|
+
* identity matrix instead of being filled with `Infinity`/`NaN`.
|
|
216
|
+
* Use {@link Matrix44.tryInvertTo} when the caller needs to detect the failure.
|
|
217
|
+
*
|
|
184
218
|
* @param mat - The matrix to invert
|
|
185
219
|
* @param outMat - The output matrix to store the result
|
|
186
|
-
* @returns The output matrix containing the inverted matrix
|
|
187
|
-
* @throws Logs an error if the matrix is not invertible (determinant is 0)
|
|
220
|
+
* @returns The output matrix containing the inverted matrix, or the identity matrix if the input is singular
|
|
188
221
|
*/
|
|
189
|
-
static
|
|
222
|
+
static _invertTo(mat: IMatrix44, outMat: IMutableMatrix44): IMutableMatrix44;
|
|
190
223
|
/**
|
|
191
224
|
* Creates a translation matrix from a 3D vector.
|
|
192
225
|
* @param vec - The translation vector
|
|
193
226
|
* @returns A new Matrix44 instance representing the translation transformation
|
|
194
227
|
*/
|
|
195
|
-
static
|
|
228
|
+
static _translate(vec: IVector3, type: FloatTypedArrayConstructor): IMatrix44;
|
|
196
229
|
/**
|
|
197
230
|
* Creates a rotation matrix around the X-axis.
|
|
198
231
|
* @param radian - The rotation angle in radians
|
|
199
232
|
* @returns A new Matrix44 instance representing the X-axis rotation
|
|
200
233
|
*/
|
|
201
|
-
static
|
|
234
|
+
static _rotateX(radian: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
202
235
|
/**
|
|
203
236
|
* Creates a rotation matrix around the Y-axis.
|
|
204
237
|
* @param radian - The rotation angle in radians
|
|
205
238
|
* @returns A new Matrix44 instance representing the Y-axis rotation
|
|
206
239
|
*/
|
|
207
|
-
static
|
|
240
|
+
static _rotateY(radian: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
208
241
|
/**
|
|
209
242
|
* Creates a rotation matrix around the Z-axis.
|
|
210
243
|
* @param radian - The rotation angle in radians
|
|
211
244
|
* @returns A new Matrix44 instance representing the Z-axis rotation
|
|
212
245
|
*/
|
|
213
|
-
static
|
|
246
|
+
static _rotateZ(radian: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
214
247
|
/**
|
|
215
248
|
* Creates a rotation matrix from Euler angles (XYZ order).
|
|
216
249
|
* Applies rotations in the order: X, then Y, then Z.
|
|
@@ -219,19 +252,19 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
219
252
|
* @param z - Rotation around Z-axis in radians
|
|
220
253
|
* @returns A new Matrix44 instance representing the combined rotation
|
|
221
254
|
*/
|
|
222
|
-
static
|
|
255
|
+
static _rotateXYZ(x: number, y: number, z: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
223
256
|
/**
|
|
224
257
|
* Creates a rotation matrix from a 3D vector containing Euler angles.
|
|
225
258
|
* @param vec - A vector containing rotation angles [x, y, z] in radians
|
|
226
259
|
* @returns A new Matrix44 instance representing the rotation
|
|
227
260
|
*/
|
|
228
|
-
static
|
|
261
|
+
static _rotate(vec: IVector3, type: FloatTypedArrayConstructor): IMatrix44;
|
|
229
262
|
/**
|
|
230
263
|
* Creates a scaling matrix from a 3D vector.
|
|
231
264
|
* @param vec - The scaling factors for each axis [x, y, z]
|
|
232
265
|
* @returns A new Matrix44 instance representing the scaling transformation
|
|
233
266
|
*/
|
|
234
|
-
static
|
|
267
|
+
static _scale(vec: IVector3, type: FloatTypedArrayConstructor): IMatrix44;
|
|
235
268
|
/**
|
|
236
269
|
* Multiplies two 4x4 matrices and returns the result.
|
|
237
270
|
* Optimized to handle identity matrices efficiently.
|
|
@@ -239,7 +272,7 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
239
272
|
* @param r_mat - The right matrix in the multiplication
|
|
240
273
|
* @returns A new Matrix44 instance representing the matrix product (l_mat * r_mat)
|
|
241
274
|
*/
|
|
242
|
-
static
|
|
275
|
+
static _multiply(l_mat: IMatrix44, r_mat: IMatrix44, type: FloatTypedArrayConstructor): IMatrix44;
|
|
243
276
|
/**
|
|
244
277
|
* Multiplies two 4x4 matrices and stores the result in an output matrix.
|
|
245
278
|
* This is the mutable version of the multiply method for performance optimization.
|
|
@@ -248,7 +281,7 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
248
281
|
* @param outMat - The output matrix to store the result
|
|
249
282
|
* @returns The output matrix containing the multiplication result
|
|
250
283
|
*/
|
|
251
|
-
static
|
|
284
|
+
static _multiplyTo(l_mat: IMatrix44, r_mat: IMatrix44, outMat: IMutableMatrix44): IMutableMatrix44;
|
|
252
285
|
/**
|
|
253
286
|
* Multiplies a matrix with data from a typed array and stores the result.
|
|
254
287
|
* This method is optimized for working with raw array data.
|
|
@@ -258,14 +291,14 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
258
291
|
* @param offsetAsComposition - The offset in the array for composition data
|
|
259
292
|
* @returns The output matrix containing the multiplication result
|
|
260
293
|
*/
|
|
261
|
-
static
|
|
294
|
+
static _multiplyTypedArrayTo(l_mat: IMatrix44, r_array: ArrayType, outMat: IMutableMatrix44, offsetAsComposition: number): IMutableMatrix44;
|
|
262
295
|
/**
|
|
263
296
|
* Creates a rotation matrix from a quaternion and stores it in an output matrix.
|
|
264
297
|
* @param quat - The quaternion representing the rotation
|
|
265
298
|
* @param outMat - The output matrix to store the result
|
|
266
299
|
* @returns The output matrix containing the rotation matrix
|
|
267
300
|
*/
|
|
268
|
-
static
|
|
301
|
+
static _fromQuaternionTo(quat: IQuaternion, outMat: IMutableMatrix44): IMutableMatrix44;
|
|
269
302
|
/**
|
|
270
303
|
* Converts the matrix to a human-readable string representation.
|
|
271
304
|
* Elements are displayed in row-major order for intuitive reading.
|
|
@@ -416,7 +449,7 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
416
449
|
* @param m33 - Element at row 3, column 3
|
|
417
450
|
* @returns A new Matrix44 instance
|
|
418
451
|
*/
|
|
419
|
-
static
|
|
452
|
+
static _fromCopy16RowMajor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
420
453
|
/**
|
|
421
454
|
* Creates a matrix from 16 individual values in column-major order.
|
|
422
455
|
* This matches the internal storage format used by WebGL.
|
|
@@ -439,26 +472,26 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
439
472
|
* @param m33 - Element at row 3, column 3
|
|
440
473
|
* @returns A new Matrix44 instance
|
|
441
474
|
*/
|
|
442
|
-
static
|
|
475
|
+
static _fromCopy16ColumnMajor(m00: number, m10: number, m20: number, m30: number, m01: number, m11: number, m21: number, m31: number, m02: number, m12: number, m22: number, m32: number, m03: number, m13: number, m23: number, m33: number, type: FloatTypedArrayConstructor): IMatrix44;
|
|
443
476
|
/**
|
|
444
477
|
* Creates a new matrix by copying another Matrix44 instance.
|
|
445
478
|
* @param mat - The source matrix to copy
|
|
446
479
|
* @returns A new Matrix44 instance with copied values
|
|
447
480
|
*/
|
|
448
|
-
static
|
|
481
|
+
static _fromCopyMatrix44(mat: IMatrix44, type: FloatTypedArrayConstructor): IMatrix44;
|
|
449
482
|
/**
|
|
450
483
|
* Creates a matrix directly from a Float32Array in column-major order.
|
|
451
484
|
* The array is used directly without copying (shares the same memory).
|
|
452
485
|
* @param float32Array - A Float32Array containing 16 matrix elements
|
|
453
486
|
* @returns A new Matrix44 instance using the provided array
|
|
454
487
|
*/
|
|
455
|
-
static
|
|
488
|
+
static _fromTypedArrayColumnMajor(array: TypedArray, type: FloatTypedArrayConstructor): IMatrix44;
|
|
456
489
|
/**
|
|
457
490
|
* Creates a matrix from a Float32Array in column-major order with copying.
|
|
458
491
|
* @param float32Array - A Float32Array containing 16 matrix elements
|
|
459
492
|
* @returns A new Matrix44 instance with copied values
|
|
460
493
|
*/
|
|
461
|
-
static
|
|
494
|
+
static _fromCopyTypedArrayColumnMajor(array: TypedArray, type: FloatTypedArrayConstructor): IMatrix44;
|
|
462
495
|
/**
|
|
463
496
|
* Creates a matrix from a Float32Array in row-major order with copying.
|
|
464
497
|
* The input array is assumed to be in row-major order and will be converted
|
|
@@ -466,7 +499,7 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
466
499
|
* @param array - A Float32Array containing 16 matrix elements in row-major order
|
|
467
500
|
* @returns A new Matrix44 instance with converted values
|
|
468
501
|
*/
|
|
469
|
-
static
|
|
502
|
+
static _fromCopyTypedArrayRowMajor(array: TypedArray, type: FloatTypedArrayConstructor): IMatrix44;
|
|
470
503
|
/**
|
|
471
504
|
* Creates a 4x4 matrix from a 3x3 matrix by embedding it in the upper-left corner.
|
|
472
505
|
* The resulting matrix has the 3x3 matrix in the upper-left, with the bottom-right
|
|
@@ -474,37 +507,187 @@ export declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix
|
|
|
474
507
|
* @param mat - The 3x3 matrix to embed
|
|
475
508
|
* @returns A new Matrix44 instance
|
|
476
509
|
*/
|
|
477
|
-
static
|
|
510
|
+
static _fromCopyMatrix33(mat: IMatrix33, type: FloatTypedArrayConstructor): IMatrix44;
|
|
478
511
|
/**
|
|
479
512
|
* Creates a matrix from a fixed-size array (Array16) in column-major order.
|
|
480
513
|
* @param array - An Array16 containing exactly 16 matrix elements
|
|
481
514
|
* @returns A new Matrix44 instance with copied values
|
|
482
515
|
*/
|
|
483
|
-
static
|
|
516
|
+
static _fromCopyArray16ColumnMajor(array: Array16<number>, type: FloatTypedArrayConstructor): IMatrix44;
|
|
484
517
|
/**
|
|
485
518
|
* Creates a matrix from a variable-length array in column-major order.
|
|
486
519
|
* @param array - An array containing at least 16 matrix elements
|
|
487
520
|
* @returns A new Matrix44 instance with copied values
|
|
488
521
|
*/
|
|
489
|
-
static
|
|
522
|
+
static _fromCopyArrayColumnMajor(array: Array<number>, type: FloatTypedArrayConstructor): IMatrix44;
|
|
490
523
|
/**
|
|
491
524
|
* Creates a matrix from a fixed-size array (Array16) in row-major order.
|
|
492
525
|
* The input array is converted from row-major to column-major order.
|
|
493
526
|
* @param array - An Array16 containing exactly 16 matrix elements in row-major order
|
|
494
527
|
* @returns A new Matrix44 instance with converted values
|
|
495
528
|
*/
|
|
496
|
-
static
|
|
529
|
+
static _fromCopyArray16RowMajor(array: Array16<number>, type: FloatTypedArrayConstructor): IMatrix44;
|
|
497
530
|
/**
|
|
498
531
|
* Creates a matrix from a variable-length array in row-major order.
|
|
499
532
|
* The input array is converted from row-major to column-major order.
|
|
500
533
|
* @param array - An array containing at least 16 matrix elements in row-major order
|
|
501
534
|
* @returns A new Matrix44 instance with converted values
|
|
502
535
|
*/
|
|
503
|
-
static
|
|
536
|
+
static _fromCopyArrayRowMajor(array: Array<number>, type: FloatTypedArrayConstructor): IMatrix44;
|
|
504
537
|
/**
|
|
505
538
|
* Creates a rotation matrix from a quaternion.
|
|
506
539
|
* @param q - The quaternion representing the rotation
|
|
507
540
|
* @returns A new Matrix44 instance representing the rotation transformation
|
|
508
541
|
*/
|
|
542
|
+
static _fromCopyQuaternion(q: IQuaternion, type: FloatTypedArrayConstructor): IMatrix44;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Immutable 4x4 matrix with 32-bit float components.
|
|
546
|
+
* This is the standard precision implementation for transforms, cameras, and projections.
|
|
547
|
+
*/
|
|
548
|
+
export declare class Matrix44 extends Matrix44_<Float32ArrayConstructor> {
|
|
549
|
+
/**
|
|
550
|
+
* Creates a new Matrix44 instance.
|
|
551
|
+
* @param m - The typed array containing the matrix components
|
|
552
|
+
*/
|
|
553
|
+
constructor(m: TypedArray);
|
|
554
|
+
/** Creates a zero matrix. */
|
|
555
|
+
static zero(): Matrix44;
|
|
556
|
+
/** Creates an identity matrix (optimized IdentityMatrix44 instance). */
|
|
557
|
+
static identity(): IdentityMatrix44;
|
|
558
|
+
/** Creates a dummy matrix with an empty array. */
|
|
559
|
+
static dummy(): Matrix44;
|
|
560
|
+
/** Creates the transpose of the given matrix. */
|
|
561
|
+
static transpose(mat: IMatrix44): Matrix44;
|
|
562
|
+
/** Attempts to invert the given matrix, returning null when it is singular. */
|
|
563
|
+
static tryInvert(mat: IMatrix44): Matrix44 | null;
|
|
564
|
+
/** Creates the inverse of the given matrix (identity when singular). */
|
|
565
|
+
static invert(mat: IMatrix44): Matrix44;
|
|
566
|
+
/** Attempts to invert the given matrix into outMat. */
|
|
567
|
+
static tryInvertTo<T extends IMutableMatrix44>(mat: IMatrix44, outMat: T): boolean;
|
|
568
|
+
/** Inverts the given matrix into outMat (identity when singular). */
|
|
569
|
+
static invertTo<T extends IMutableMatrix44>(mat: IMatrix44, outMat: T): T;
|
|
570
|
+
/** Creates a translation matrix. */
|
|
571
|
+
static translate(vec: IVector3): Matrix44;
|
|
572
|
+
/** Creates a rotation matrix around the X-axis. */
|
|
573
|
+
static rotateX(radian: number): Matrix44;
|
|
574
|
+
/** Creates a rotation matrix around the Y-axis. */
|
|
575
|
+
static rotateY(radian: number): Matrix44;
|
|
576
|
+
/** Creates a rotation matrix around the Z-axis. */
|
|
577
|
+
static rotateZ(radian: number): Matrix44;
|
|
578
|
+
/** Creates a rotation matrix from Euler angles in XYZ order. */
|
|
579
|
+
static rotateXYZ(x: number, y: number, z: number): Matrix44;
|
|
580
|
+
/** Creates a rotation matrix from a vector containing Euler angles. */
|
|
581
|
+
static rotate(vec: IVector3): Matrix44;
|
|
582
|
+
/** Creates a scaling matrix. */
|
|
583
|
+
static scale(vec: IVector3): Matrix44;
|
|
584
|
+
/** Multiplies two matrices. */
|
|
585
|
+
static multiply(l_mat: IMatrix44, r_mat: IMatrix44): Matrix44;
|
|
586
|
+
/** Multiplies two matrices and stores the result in outMat. */
|
|
587
|
+
static multiplyTo<T extends IMutableMatrix44>(l_mat: IMatrix44, r_mat: IMatrix44, outMat: T): T;
|
|
588
|
+
/** Multiplies a matrix with typed array data and stores the result in outMat. */
|
|
589
|
+
static multiplyTypedArrayTo<T extends IMutableMatrix44>(l_mat: IMatrix44, r_array: ArrayType, outMat: T, offsetAsComposition: number): T;
|
|
590
|
+
/** Creates a rotation matrix from a quaternion and stores it in outMat. */
|
|
591
|
+
static fromQuaternionTo<T extends IMutableMatrix44>(quat: IQuaternion, outMat: T): T;
|
|
592
|
+
/** Creates a matrix from row-major components. */
|
|
593
|
+
static fromCopy16RowMajor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Matrix44;
|
|
594
|
+
/** Creates a matrix from column-major components. */
|
|
595
|
+
static fromCopy16ColumnMajor(m00: number, m10: number, m20: number, m30: number, m01: number, m11: number, m21: number, m31: number, m02: number, m12: number, m22: number, m32: number, m03: number, m13: number, m23: number, m33: number): Matrix44;
|
|
596
|
+
/** Creates a matrix by copying another matrix. */
|
|
597
|
+
static fromCopyMatrix44(mat: IMatrix44): Matrix44;
|
|
598
|
+
/** Creates a matrix that directly uses the given Float32Array. */
|
|
599
|
+
static fromFloat32ArrayColumnMajor(array: Float32Array): Matrix44;
|
|
600
|
+
/** Creates a matrix by copying a Float32Array in column-major order. */
|
|
601
|
+
static fromCopyFloat32ArrayColumnMajor(array: Float32Array): Matrix44;
|
|
602
|
+
/** Creates a matrix by copying a Float32Array in row-major order. */
|
|
603
|
+
static fromCopyFloat32ArrayRowMajor(array: Float32Array): Matrix44;
|
|
604
|
+
/** Creates a matrix from a 3x3 matrix embedded in the upper-left corner. */
|
|
605
|
+
static fromCopyMatrix33(mat: IMatrix33): Matrix44;
|
|
606
|
+
/** Creates a matrix from a 16-element array in column-major order. */
|
|
607
|
+
static fromCopyArray16ColumnMajor(array: Array16<number>): Matrix44;
|
|
608
|
+
/** Creates a matrix from an array in column-major order. */
|
|
609
|
+
static fromCopyArrayColumnMajor(array: Array<number>): Matrix44;
|
|
610
|
+
/** Creates a matrix from a 16-element array in row-major order. */
|
|
611
|
+
static fromCopyArray16RowMajor(array: Array16<number>): Matrix44;
|
|
612
|
+
/** Creates a matrix from an array in row-major order. */
|
|
613
|
+
static fromCopyArrayRowMajor(array: Array<number>): Matrix44;
|
|
614
|
+
/** Creates a rotation matrix from a quaternion. */
|
|
509
615
|
static fromCopyQuaternion(q: IQuaternion): Matrix44;
|
|
510
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* Immutable 4x4 matrix with 64-bit float components.
|
|
619
|
+
* Use this implementation when higher numerical precision is required.
|
|
620
|
+
*/
|
|
621
|
+
export declare class Matrix44D extends Matrix44_<Float64ArrayConstructor> {
|
|
622
|
+
/**
|
|
623
|
+
* Creates a new Matrix44D instance.
|
|
624
|
+
* @param m - The typed array containing the matrix components
|
|
625
|
+
*/
|
|
626
|
+
private constructor();
|
|
627
|
+
/** Creates a zero matrix. */
|
|
628
|
+
static zero(): Matrix44D;
|
|
629
|
+
/** Creates an identity matrix. */
|
|
630
|
+
static identity(): Matrix44D;
|
|
631
|
+
/** Creates a dummy matrix with an empty array. */
|
|
632
|
+
static dummy(): Matrix44D;
|
|
633
|
+
/** Creates the transpose of the given matrix. */
|
|
634
|
+
static transpose(mat: IMatrix44): Matrix44D;
|
|
635
|
+
/** Attempts to invert the given matrix, returning null when it is singular. */
|
|
636
|
+
static tryInvert(mat: IMatrix44): Matrix44D | null;
|
|
637
|
+
/** Creates the inverse of the given matrix (identity when singular). */
|
|
638
|
+
static invert(mat: IMatrix44): Matrix44D;
|
|
639
|
+
/** Attempts to invert the given matrix into outMat. */
|
|
640
|
+
static tryInvertTo<T extends IMutableMatrix44>(mat: IMatrix44, outMat: T): boolean;
|
|
641
|
+
/** Inverts the given matrix into outMat (identity when singular). */
|
|
642
|
+
static invertTo<T extends IMutableMatrix44>(mat: IMatrix44, outMat: T): T;
|
|
643
|
+
/** Creates a translation matrix. */
|
|
644
|
+
static translate(vec: IVector3): Matrix44D;
|
|
645
|
+
/** Creates a rotation matrix around the X-axis. */
|
|
646
|
+
static rotateX(radian: number): Matrix44D;
|
|
647
|
+
/** Creates a rotation matrix around the Y-axis. */
|
|
648
|
+
static rotateY(radian: number): Matrix44D;
|
|
649
|
+
/** Creates a rotation matrix around the Z-axis. */
|
|
650
|
+
static rotateZ(radian: number): Matrix44D;
|
|
651
|
+
/** Creates a rotation matrix from Euler angles in XYZ order. */
|
|
652
|
+
static rotateXYZ(x: number, y: number, z: number): Matrix44D;
|
|
653
|
+
/** Creates a rotation matrix from a vector containing Euler angles. */
|
|
654
|
+
static rotate(vec: IVector3): Matrix44D;
|
|
655
|
+
/** Creates a scaling matrix. */
|
|
656
|
+
static scale(vec: IVector3): Matrix44D;
|
|
657
|
+
/** Multiplies two matrices. */
|
|
658
|
+
static multiply(l_mat: IMatrix44, r_mat: IMatrix44): Matrix44D;
|
|
659
|
+
/** Multiplies two matrices and stores the result in outMat. */
|
|
660
|
+
static multiplyTo<T extends IMutableMatrix44>(l_mat: IMatrix44, r_mat: IMatrix44, outMat: T): T;
|
|
661
|
+
/** Multiplies a matrix with typed array data and stores the result in outMat. */
|
|
662
|
+
static multiplyTypedArrayTo<T extends IMutableMatrix44>(l_mat: IMatrix44, r_array: ArrayType, outMat: T, offsetAsComposition: number): T;
|
|
663
|
+
/** Creates a rotation matrix from a quaternion and stores it in outMat. */
|
|
664
|
+
static fromQuaternionTo<T extends IMutableMatrix44>(quat: IQuaternion, outMat: T): T;
|
|
665
|
+
/** Creates a matrix from row-major components. */
|
|
666
|
+
static fromCopy16RowMajor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Matrix44D;
|
|
667
|
+
/** Creates a matrix from column-major components. */
|
|
668
|
+
static fromCopy16ColumnMajor(m00: number, m10: number, m20: number, m30: number, m01: number, m11: number, m21: number, m31: number, m02: number, m12: number, m22: number, m32: number, m03: number, m13: number, m23: number, m33: number): Matrix44D;
|
|
669
|
+
/** Creates a matrix by copying another matrix. */
|
|
670
|
+
static fromCopyMatrix44(mat: IMatrix44): Matrix44D;
|
|
671
|
+
/** Creates a matrix that directly uses the given Float64Array. */
|
|
672
|
+
static fromFloat64ArrayColumnMajor(array: Float64Array): Matrix44D;
|
|
673
|
+
/** Creates a matrix by copying a Float64Array in column-major order. */
|
|
674
|
+
static fromCopyFloat64ArrayColumnMajor(array: Float64Array): Matrix44D;
|
|
675
|
+
/** Creates a matrix by copying a Float64Array in row-major order. */
|
|
676
|
+
static fromCopyFloat64ArrayRowMajor(array: Float64Array): Matrix44D;
|
|
677
|
+
/** Creates a matrix from a 3x3 matrix embedded in the upper-left corner. */
|
|
678
|
+
static fromCopyMatrix33(mat: IMatrix33): Matrix44D;
|
|
679
|
+
/** Creates a matrix from a 16-element array in column-major order. */
|
|
680
|
+
static fromCopyArray16ColumnMajor(array: Array16<number>): Matrix44D;
|
|
681
|
+
/** Creates a matrix from an array in column-major order. */
|
|
682
|
+
static fromCopyArrayColumnMajor(array: Array<number>): Matrix44D;
|
|
683
|
+
/** Creates a matrix from a 16-element array in row-major order. */
|
|
684
|
+
static fromCopyArray16RowMajor(array: Array16<number>): Matrix44D;
|
|
685
|
+
/** Creates a matrix from an array in row-major order. */
|
|
686
|
+
static fromCopyArrayRowMajor(array: Array<number>): Matrix44D;
|
|
687
|
+
/** Creates a rotation matrix from a quaternion. */
|
|
688
|
+
static fromCopyQuaternion(q: IQuaternion): Matrix44D;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Alias for the 32-bit (Float32Array) implementation, making the precision explicit.
|
|
692
|
+
*/
|
|
693
|
+
export { Matrix44 as Matrix44F };
|