glmaths 0.0.2 → 0.0.4
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 +570 -552
- package/benchmark.js +2 -2
- package/dist/cjs/glmaths.d.ts +240 -198
- package/dist/cjs/glmaths.js +544 -462
- package/dist/cjs/glmaths.js.map +1 -1
- package/dist/cjs/glmaths.min.js +1 -1
- package/dist/cjs/glmaths.min.js.map +1 -1
- package/dist/esm/glmaths.d.ts +240 -198
- package/dist/esm/glmaths.js +544 -462
- package/dist/esm/glmaths.js.map +1 -1
- package/dist/esm/glmaths.min.js +1 -1
- package/dist/esm/glmaths.min.js.map +1 -1
- package/dist/glmaths.d.ts +240 -198
- package/dist/glmaths.js +544 -462
- package/dist/glmaths.js.map +1 -1
- package/dist/glmaths.min.js +1 -1
- package/dist/glmaths.min.js.map +1 -1
- package/examples/index.html +23 -0
- package/examples/main.js +134 -0
- package/examples/main.ts +159 -0
- package/package.json +1 -1
- package/src/mat2.ts +27 -27
- package/src/mat2x3.ts +37 -31
- package/src/mat3.ts +53 -54
- package/src/mat4.ts +81 -82
- package/src/quat.ts +36 -23
- package/src/quat2.ts +45 -31
- package/src/vec2.ts +90 -70
- package/src/vec3.ts +143 -121
- package/src/vec4.ts +79 -57
- package/tests/mat2.test.ts +53 -53
- package/tests/mat2x3.test.ts +46 -46
- package/tests/mat3.test.ts +59 -59
package/dist/esm/glmaths.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
19
19
|
/**
|
|
20
20
|
* Inverts a mat2x3
|
|
21
21
|
*
|
|
22
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
22
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
23
23
|
* @returns {Mat2x3} out or null if the matrix is not invertible
|
|
24
24
|
*/
|
|
25
25
|
invert(out?: Mat2x3): Mat2x3 | null;
|
|
@@ -33,7 +33,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
33
33
|
* Rotates a mat2x3 by the given angle
|
|
34
34
|
*
|
|
35
35
|
* @param {Number} rad the angle to rotate the matrix by
|
|
36
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
36
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
37
37
|
* @returns {Mat2x3} out
|
|
38
38
|
*/
|
|
39
39
|
rotate(rad: number, out?: Mat2x3): Mat2x3;
|
|
@@ -41,7 +41,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
41
41
|
* Scales a mat2x3 by the dimensions in the given Vec2
|
|
42
42
|
*
|
|
43
43
|
* @param {Vec2} v the Vec2 to scale the matrix by
|
|
44
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
44
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
45
45
|
* @returns {Mat2x3} out
|
|
46
46
|
*/
|
|
47
47
|
scale(v: Vec2, out?: Mat2x3): Mat2x3;
|
|
@@ -49,7 +49,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
49
49
|
* Translates a mat2x3 by the dimensions in the given Vec2
|
|
50
50
|
*
|
|
51
51
|
* @param {Vec2} v the Vec2 to translate the matrix by
|
|
52
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
52
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
53
53
|
* @returns {Mat2x3} out
|
|
54
54
|
*/
|
|
55
55
|
translate(v: Vec2, out?: Mat2x3): Mat2x3;
|
|
@@ -57,7 +57,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
57
57
|
* Creates a Mat2x3 from a given angle
|
|
58
58
|
*
|
|
59
59
|
* @param {Number} rad the angle to rotate the matrix by
|
|
60
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
60
|
+
* @param {Mat2x3} out the receiving matrix, defaults to mat2x3()
|
|
61
61
|
* @returns {Mat2x3} out
|
|
62
62
|
*/
|
|
63
63
|
static fromRotation(rad: number, out?: Mat2x3): Mat2x3;
|
|
@@ -65,7 +65,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
65
65
|
* Creates a Mat2x3 from a scaling vector
|
|
66
66
|
*
|
|
67
67
|
* @param {Vec2} v scaling vector
|
|
68
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
68
|
+
* @param {Mat2x3} out the receiving matrix, defaults to mat2x3()
|
|
69
69
|
* @returns {Mat2x3} out
|
|
70
70
|
*/
|
|
71
71
|
static fromScaling(v: Vec2, out?: Mat2x3): Mat2x3;
|
|
@@ -73,7 +73,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
73
73
|
* Creates a Mat2x3 from a translation vector
|
|
74
74
|
*
|
|
75
75
|
* @param {Vec2} v translation vector
|
|
76
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
76
|
+
* @param {Mat2x3} out the receiving matrix, defaults to mat2x3()
|
|
77
77
|
* @returns {Mat2x3} out
|
|
78
78
|
*/
|
|
79
79
|
static fromTranslation(v: Vec2, out?: Mat2x3): Mat2x3;
|
|
@@ -93,7 +93,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
93
93
|
* Adds two Mat2x3's
|
|
94
94
|
*
|
|
95
95
|
* @param {Mat2x3} b the second operand
|
|
96
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
96
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
97
97
|
* @returns {Mat2x3} out
|
|
98
98
|
*/
|
|
99
99
|
plus(b: Mat2x3, out?: Mat2x3): Mat2x3;
|
|
@@ -101,7 +101,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
101
101
|
* Subtracts matrix b from a mat2x3
|
|
102
102
|
*
|
|
103
103
|
* @param {Mat2x3} b the second operand
|
|
104
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
104
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
105
105
|
* @returns {Mat2x3} out
|
|
106
106
|
*/
|
|
107
107
|
minus(b: Mat2x3, out?: Mat2x3): Mat2x3;
|
|
@@ -109,7 +109,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
109
109
|
* Multiplies a mat2x3 by another Mat2x3
|
|
110
110
|
*
|
|
111
111
|
* @param {Mat2x3} b the second operand
|
|
112
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
112
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
113
113
|
* @returns {Mat2x3} out
|
|
114
114
|
*/
|
|
115
115
|
multiply(b: Vec2): Vec2;
|
|
@@ -132,7 +132,7 @@ declare class Mat2x3 extends Float32Array {
|
|
|
132
132
|
* Multiplies each element of a mat2x3 by a scalar value
|
|
133
133
|
*
|
|
134
134
|
* @param {Number} b amount to scale the matrix's elements by
|
|
135
|
-
* @param {Mat2x3} out the receiving matrix, defaults to
|
|
135
|
+
* @param {Mat2x3} out the receiving matrix, defaults to new mat2x3()
|
|
136
136
|
* @returns {Mat2x3} out
|
|
137
137
|
*/
|
|
138
138
|
scaleScalar(b: number, out?: Mat2x3): Mat2x3;
|
|
@@ -156,8 +156,9 @@ interface Mat2x3 {
|
|
|
156
156
|
multiplyScalar: (b: number, out?: Mat2x3) => Mat2x3;
|
|
157
157
|
str: () => string;
|
|
158
158
|
}
|
|
159
|
-
declare const
|
|
160
|
-
declare const
|
|
159
|
+
declare const createMat2x3: (...args: (number | Float32Array)[]) => Mat2x3;
|
|
160
|
+
declare const mat2x3: typeof createMat2x3 & typeof Mat2x3;
|
|
161
|
+
declare const mat2d: ((...args: (number | Float32Array)[]) => Mat2x3) & typeof Mat2x3;
|
|
161
162
|
|
|
162
163
|
/**
|
|
163
164
|
* 3x3 Matrix in column-major order
|
|
@@ -190,21 +191,21 @@ declare class Mat3 extends Float32Array {
|
|
|
190
191
|
/**
|
|
191
192
|
* Transposes a mat3
|
|
192
193
|
*
|
|
193
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
194
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
194
195
|
* @returns {Mat3} out
|
|
195
196
|
*/
|
|
196
197
|
transpose(out?: Mat3): Mat3;
|
|
197
198
|
/**
|
|
198
199
|
* Inverts a mat3
|
|
199
200
|
*
|
|
200
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
201
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
201
202
|
* @returns {Mat3|null} out, or null if not invertible
|
|
202
203
|
*/
|
|
203
204
|
invert(out?: Mat3): Mat3 | null;
|
|
204
205
|
/**
|
|
205
206
|
* Calculates the adjugate of a mat3
|
|
206
207
|
*
|
|
207
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
208
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
208
209
|
* @returns {Mat3} out
|
|
209
210
|
*/
|
|
210
211
|
adjoint(out?: Mat3): Mat3;
|
|
@@ -218,7 +219,7 @@ declare class Mat3 extends Float32Array {
|
|
|
218
219
|
* Multiplies two mat3's
|
|
219
220
|
*
|
|
220
221
|
* @param {Mat3} b the second operand
|
|
221
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
222
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
222
223
|
* @returns {Mat3} out
|
|
223
224
|
*/
|
|
224
225
|
multiply(b: Vec2): Vec2;
|
|
@@ -228,7 +229,7 @@ declare class Mat3 extends Float32Array {
|
|
|
228
229
|
* Translates a mat3 by the given vector
|
|
229
230
|
*
|
|
230
231
|
* @param {Vec2} v vector to translate by
|
|
231
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
232
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
232
233
|
* @returns {Mat3} out
|
|
233
234
|
*/
|
|
234
235
|
translate(v: Vec2, out?: Mat3): Mat3;
|
|
@@ -236,7 +237,7 @@ declare class Mat3 extends Float32Array {
|
|
|
236
237
|
* Rotates a mat3 by the given angle
|
|
237
238
|
*
|
|
238
239
|
* @param {Number} rad the angle to rotate the matrix by
|
|
239
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
240
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
240
241
|
* @returns {Mat3} out
|
|
241
242
|
*/
|
|
242
243
|
rotate(rad: number, out?: Mat3): Mat3;
|
|
@@ -244,7 +245,7 @@ declare class Mat3 extends Float32Array {
|
|
|
244
245
|
* Scales a mat3 by the given vector
|
|
245
246
|
*
|
|
246
247
|
* @param {Vec2} v the vector to scale by
|
|
247
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
248
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
248
249
|
* @returns {Mat3} out
|
|
249
250
|
*/
|
|
250
251
|
scale(v: Vec2, out?: Mat3): Mat3;
|
|
@@ -252,7 +253,7 @@ declare class Mat3 extends Float32Array {
|
|
|
252
253
|
* Creates a matrix from a translation vector
|
|
253
254
|
*
|
|
254
255
|
* @param {Vec2} v translation vector
|
|
255
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
256
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
256
257
|
* @returns {Mat3} out
|
|
257
258
|
*/
|
|
258
259
|
static fromTranslation(v: Vec2, out?: Mat3): Mat3;
|
|
@@ -260,7 +261,7 @@ declare class Mat3 extends Float32Array {
|
|
|
260
261
|
* Creates a matrix from a given angle
|
|
261
262
|
*
|
|
262
263
|
* @param {Number} rad the angle to rotate the matrix by
|
|
263
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
264
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
264
265
|
* @returns {Mat3} out
|
|
265
266
|
*/
|
|
266
267
|
static fromRotation(rad: number, out?: Mat3): Mat3;
|
|
@@ -268,7 +269,7 @@ declare class Mat3 extends Float32Array {
|
|
|
268
269
|
* Creates a matrix from a scaling vector
|
|
269
270
|
*
|
|
270
271
|
* @param {Vec2} v scaling vector
|
|
271
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
272
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
272
273
|
* @returns {Mat3} out
|
|
273
274
|
*/
|
|
274
275
|
static fromScaling(v: Vec2, out?: Mat3): Mat3;
|
|
@@ -276,7 +277,7 @@ declare class Mat3 extends Float32Array {
|
|
|
276
277
|
* Creates a mat3 from a Mat2x3
|
|
277
278
|
*
|
|
278
279
|
* @param {Mat2x3} a the Mat2x3 to convert
|
|
279
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
280
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
280
281
|
* @returns {Mat3} out
|
|
281
282
|
*/
|
|
282
283
|
static fromMat2x3(a: Mat2x3, out?: Mat3): Mat3;
|
|
@@ -285,7 +286,7 @@ declare class Mat3 extends Float32Array {
|
|
|
285
286
|
* Calculates a mat3 from the given quaternion
|
|
286
287
|
*
|
|
287
288
|
* @param {Quat} q quaternion to create matrix from
|
|
288
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
289
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
289
290
|
* @returns {Mat3} out
|
|
290
291
|
*/
|
|
291
292
|
static fromQuat(q: Quat, out?: Mat3): Mat3;
|
|
@@ -293,7 +294,7 @@ declare class Mat3 extends Float32Array {
|
|
|
293
294
|
* Calculates a mat3 normal matrix (transpose inverse) from a mat4
|
|
294
295
|
*
|
|
295
296
|
* @param {Mat4} a the source mat4 to derive the normal matrix from
|
|
296
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
297
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
297
298
|
* @returns {Mat3|null} out, or null if not invertible
|
|
298
299
|
*/
|
|
299
300
|
static normalFromMat4(a: Mat4, out?: Mat3): Mat3 | null;
|
|
@@ -301,7 +302,7 @@ declare class Mat3 extends Float32Array {
|
|
|
301
302
|
* Copies the upper-left 3x3 values of a mat4 into a mat3
|
|
302
303
|
*
|
|
303
304
|
* @param {Mat4} a the source mat4
|
|
304
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
305
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
305
306
|
* @returns {Mat3} out
|
|
306
307
|
*/
|
|
307
308
|
static fromMat4(a: Mat4, out?: Mat3): Mat3;
|
|
@@ -311,7 +312,7 @@ declare class Mat3 extends Float32Array {
|
|
|
311
312
|
*
|
|
312
313
|
* @param {Number} width width of the projection
|
|
313
314
|
* @param {Number} height height of the projection
|
|
314
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
315
|
+
* @param {Mat3} out the receiving matrix, defaults to mat3()
|
|
315
316
|
* @returns {Mat3} out
|
|
316
317
|
*/
|
|
317
318
|
static projection(width: number, height: number, out?: Mat3): Mat3;
|
|
@@ -325,7 +326,7 @@ declare class Mat3 extends Float32Array {
|
|
|
325
326
|
* Adds two mat3's
|
|
326
327
|
*
|
|
327
328
|
* @param {Mat3} b the second operand
|
|
328
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
329
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
329
330
|
* @returns {Mat3} out
|
|
330
331
|
*/
|
|
331
332
|
plus(b: Mat3, out?: Mat3): Mat3;
|
|
@@ -333,7 +334,7 @@ declare class Mat3 extends Float32Array {
|
|
|
333
334
|
* Subtracts matrix b from this
|
|
334
335
|
*
|
|
335
336
|
* @param {Mat3} b the second operand
|
|
336
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
337
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
337
338
|
* @returns {Mat3} out
|
|
338
339
|
*/
|
|
339
340
|
minus(b: Mat3, out?: Mat3): Mat3;
|
|
@@ -341,7 +342,7 @@ declare class Mat3 extends Float32Array {
|
|
|
341
342
|
* Multiplies each element of a mat3 by a scalar number
|
|
342
343
|
*
|
|
343
344
|
* @param {Number} b amount to scale the matrix's elements by
|
|
344
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
345
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
345
346
|
* @returns {Mat3} out
|
|
346
347
|
*/
|
|
347
348
|
scaleScalar(b: number, out?: Mat3): Mat3;
|
|
@@ -350,7 +351,7 @@ declare class Mat3 extends Float32Array {
|
|
|
350
351
|
*
|
|
351
352
|
* @param {Mat3} b the second operand
|
|
352
353
|
* @param {Number} scale the amount to scale b's elements by before adding
|
|
353
|
-
* @param {Mat3} out the receiving matrix, defaults to
|
|
354
|
+
* @param {Mat3} out the receiving matrix, defaults to new mat3()
|
|
354
355
|
* @returns {Mat3} out
|
|
355
356
|
*/
|
|
356
357
|
multiplyScalarAndAdd(b: Mat3, scale: number, out?: Mat3): Mat3;
|
|
@@ -391,7 +392,8 @@ interface Mat3 {
|
|
|
391
392
|
str: () => string;
|
|
392
393
|
multiplyScalar: (b: number, out?: Mat3) => Mat3;
|
|
393
394
|
}
|
|
394
|
-
declare const
|
|
395
|
+
declare const createMat3: (...args: (number | Float32Array)[]) => Mat3;
|
|
396
|
+
declare const mat3: typeof createMat3 & typeof Mat3;
|
|
395
397
|
declare const mat3x3: ((...args: (number | Float32Array)[]) => Mat3) & typeof Mat3;
|
|
396
398
|
|
|
397
399
|
/**
|
|
@@ -415,7 +417,7 @@ declare class Quat extends Float32Array {
|
|
|
415
417
|
* Calculates the Hamilton product of two quaternions
|
|
416
418
|
*
|
|
417
419
|
* @param {Quat} b the second operand
|
|
418
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
420
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
419
421
|
* @returns {Quat} out
|
|
420
422
|
*/
|
|
421
423
|
multiply(b: Quat | number, out?: Quat): Quat;
|
|
@@ -433,7 +435,7 @@ declare class Quat extends Float32Array {
|
|
|
433
435
|
*
|
|
434
436
|
* @param {Vec3} axis the axis around which to rotate
|
|
435
437
|
* @param {Number} rad the angle in radians
|
|
436
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
438
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
437
439
|
* @returns {Quat} out
|
|
438
440
|
*/
|
|
439
441
|
setAxisAngle(axis: Vec3, rad: number, out?: Quat): Quat;
|
|
@@ -470,7 +472,7 @@ declare class Quat extends Float32Array {
|
|
|
470
472
|
* Rotates a quaternion by the given angle about the X axis
|
|
471
473
|
*
|
|
472
474
|
* @param {Number} rad angle in radians to rotate
|
|
473
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
475
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
474
476
|
* @returns {Quat} out
|
|
475
477
|
*/
|
|
476
478
|
rotateX(rad: number, out?: Quat): Quat;
|
|
@@ -478,7 +480,7 @@ declare class Quat extends Float32Array {
|
|
|
478
480
|
* Rotates a quaternion by the given angle about the Y axis
|
|
479
481
|
*
|
|
480
482
|
* @param {Number} rad angle in radians to rotate
|
|
481
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
483
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
482
484
|
* @returns {Quat} out
|
|
483
485
|
*/
|
|
484
486
|
rotateY(rad: number, out?: Quat): Quat;
|
|
@@ -486,7 +488,7 @@ declare class Quat extends Float32Array {
|
|
|
486
488
|
* Rotates a quaternion by the given angle about the Z axis
|
|
487
489
|
*
|
|
488
490
|
* @param {Number} rad angle in radians to rotate
|
|
489
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
491
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
490
492
|
* @returns {Quat} out
|
|
491
493
|
*/
|
|
492
494
|
rotateZ(rad: number, out?: Quat): Quat;
|
|
@@ -507,7 +509,7 @@ declare class Quat extends Float32Array {
|
|
|
507
509
|
/**
|
|
508
510
|
* Calculates the exponential of the unit quaternion
|
|
509
511
|
*
|
|
510
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
512
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
511
513
|
* @returns {Quat} out
|
|
512
514
|
*/
|
|
513
515
|
exp(out?: Quat): Quat;
|
|
@@ -522,7 +524,7 @@ declare class Quat extends Float32Array {
|
|
|
522
524
|
/**
|
|
523
525
|
* Calculates the natural logarithm of the unit quaternion
|
|
524
526
|
*
|
|
525
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
527
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
526
528
|
* @returns {Quat} out
|
|
527
529
|
*/
|
|
528
530
|
ln(out?: Quat): Quat;
|
|
@@ -548,7 +550,7 @@ declare class Quat extends Float32Array {
|
|
|
548
550
|
*
|
|
549
551
|
* @param {Quat} b the second operand
|
|
550
552
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
551
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
553
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
552
554
|
* @returns {Quat} out
|
|
553
555
|
*/
|
|
554
556
|
slerp(b: Quat, t: number, out?: Quat): Quat;
|
|
@@ -570,7 +572,7 @@ declare class Quat extends Float32Array {
|
|
|
570
572
|
/**
|
|
571
573
|
* Calculates the inverse of a quaternion
|
|
572
574
|
*
|
|
573
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
575
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
574
576
|
* @returns {Quat} out
|
|
575
577
|
*/
|
|
576
578
|
invert(out?: Quat): Quat;
|
|
@@ -585,7 +587,7 @@ declare class Quat extends Float32Array {
|
|
|
585
587
|
/**
|
|
586
588
|
* Calculates the conjugate of a quaternion
|
|
587
589
|
*
|
|
588
|
-
* @param {Quat} out the receiving quaternion, defaults to
|
|
590
|
+
* @param {Quat} out the receiving quaternion, defaults to new quat()
|
|
589
591
|
* @returns {Quat} out
|
|
590
592
|
*/
|
|
591
593
|
conjugate(out?: Quat): Quat;
|
|
@@ -675,7 +677,15 @@ declare class Quat extends Float32Array {
|
|
|
675
677
|
/**
|
|
676
678
|
* Normalizes a quaternion
|
|
677
679
|
*
|
|
678
|
-
* @param {Quat}
|
|
680
|
+
* @param {Quat} q the quaternion to normalize
|
|
681
|
+
* @param {Quat} out the receiving vector, defaults to new quat()
|
|
682
|
+
* @returns {Quat} out
|
|
683
|
+
*/
|
|
684
|
+
static normalize(q: Quat, out?: Quat): Quat;
|
|
685
|
+
/**
|
|
686
|
+
* Normalizes a quaternion
|
|
687
|
+
*
|
|
688
|
+
* @param {Quat} out the receiving vector, defaults to new quat()
|
|
679
689
|
* @returns {Quat} out
|
|
680
690
|
*/
|
|
681
691
|
normalize(out?: Quat): Quat;
|
|
@@ -735,8 +745,10 @@ interface Quat {
|
|
|
735
745
|
scale: (b: Quat | number, out?: Quat) => Quat;
|
|
736
746
|
times: (b: Quat | number, out?: Quat) => Quat;
|
|
737
747
|
str: () => string;
|
|
748
|
+
normalized: (out?: Quat) => Quat;
|
|
738
749
|
}
|
|
739
|
-
declare const
|
|
750
|
+
declare const createQuat: (x?: number, y?: number, z?: number, w?: number) => Quat;
|
|
751
|
+
declare const quat: typeof createQuat & typeof Quat;
|
|
740
752
|
|
|
741
753
|
/**
|
|
742
754
|
* 4x4 Matrix in column-major order
|
|
@@ -776,21 +788,21 @@ declare class Mat4 extends Float32Array {
|
|
|
776
788
|
/**
|
|
777
789
|
* Transposes a mat4
|
|
778
790
|
*
|
|
779
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
791
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
780
792
|
* @returns {Mat4} out
|
|
781
793
|
*/
|
|
782
794
|
transpose(out?: Mat4): Mat4;
|
|
783
795
|
/**
|
|
784
796
|
* Inverts a mat4
|
|
785
797
|
*
|
|
786
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
798
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
787
799
|
* @returns {Mat4} out
|
|
788
800
|
*/
|
|
789
801
|
invert(out?: Mat4): Mat4 | null;
|
|
790
802
|
/**
|
|
791
803
|
* Calculates the adjugate of a mat4
|
|
792
804
|
*
|
|
793
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
805
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
794
806
|
* @returns {Mat4} out
|
|
795
807
|
*/
|
|
796
808
|
adjoint(out?: Mat4): Mat4;
|
|
@@ -804,7 +816,7 @@ declare class Mat4 extends Float32Array {
|
|
|
804
816
|
* Multiplies with another matrix, or transforms a vector
|
|
805
817
|
*
|
|
806
818
|
* @param {Vec2 | Vec3 | Vec4 | Mat4} b the second operand
|
|
807
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
819
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
808
820
|
* @returns {Mat4} out
|
|
809
821
|
*/
|
|
810
822
|
multiply(b: Vec2): Vec2;
|
|
@@ -815,7 +827,7 @@ declare class Mat4 extends Float32Array {
|
|
|
815
827
|
* Translates a mat4 by the given Vec3
|
|
816
828
|
*
|
|
817
829
|
* @param {Vec3} v vector to translate by
|
|
818
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
830
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
819
831
|
* @returns {Mat4} out
|
|
820
832
|
*/
|
|
821
833
|
translate(v: Vec3, out?: Mat4): Mat4;
|
|
@@ -823,7 +835,7 @@ declare class Mat4 extends Float32Array {
|
|
|
823
835
|
* Scales a mat4 by the dimensions in the given Vec3 not using vectorization
|
|
824
836
|
*
|
|
825
837
|
* @param {Vec3} v the Vec3 to scale the matrix by
|
|
826
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
838
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
827
839
|
* @returns {Mat4} out
|
|
828
840
|
*/
|
|
829
841
|
scale(v: Vec3, out?: Mat4): Mat4;
|
|
@@ -832,7 +844,7 @@ declare class Mat4 extends Float32Array {
|
|
|
832
844
|
*
|
|
833
845
|
* @param {Number} rad the angle to rotate the matrix by
|
|
834
846
|
* @param {Vec3} axis the axis to rotate around
|
|
835
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
847
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
836
848
|
* @returns {Mat4} out
|
|
837
849
|
*/
|
|
838
850
|
rotate(rad: number, axis: Vec3, out?: Mat4): Mat4 | null;
|
|
@@ -840,7 +852,7 @@ declare class Mat4 extends Float32Array {
|
|
|
840
852
|
* Rotates a mat4 by the given angle around the X axis
|
|
841
853
|
*
|
|
842
854
|
* @param {Number} rad the angle to rotate the matrix by
|
|
843
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
855
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
844
856
|
* @returns {Mat4} out
|
|
845
857
|
*/
|
|
846
858
|
rotateX(rad: number, out?: Mat4): Mat4;
|
|
@@ -848,7 +860,7 @@ declare class Mat4 extends Float32Array {
|
|
|
848
860
|
* Rotates a mat4 by the given angle around the Y axis
|
|
849
861
|
*
|
|
850
862
|
* @param {Number} rad the angle to rotate the matrix by
|
|
851
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
863
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
852
864
|
* @returns {Mat4} out
|
|
853
865
|
*/
|
|
854
866
|
rotateY(rad: number, out?: Mat4): Mat4;
|
|
@@ -856,7 +868,7 @@ declare class Mat4 extends Float32Array {
|
|
|
856
868
|
* Rotates a mat4 by the given angle around the Z axis
|
|
857
869
|
*
|
|
858
870
|
* @param {Number} rad the angle to rotate the matrix by
|
|
859
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
871
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
860
872
|
* @returns {Mat4} out
|
|
861
873
|
*/
|
|
862
874
|
rotateZ(rad: number, out?: Mat4): Mat4;
|
|
@@ -897,7 +909,7 @@ declare class Mat4 extends Float32Array {
|
|
|
897
909
|
* Creates a matrix from a vector translation
|
|
898
910
|
*
|
|
899
911
|
* @param {Vec3} v translation vector
|
|
900
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
912
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
901
913
|
* @returns {Mat4} out
|
|
902
914
|
*/
|
|
903
915
|
static fromTranslation(v: Vec3, out?: Mat4): Mat4;
|
|
@@ -905,7 +917,7 @@ declare class Mat4 extends Float32Array {
|
|
|
905
917
|
* Creates a matrix from a vector scaling
|
|
906
918
|
*
|
|
907
919
|
* @param {Vec3} v scaling vector
|
|
908
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
920
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
909
921
|
* @returns {Mat4} out
|
|
910
922
|
*/
|
|
911
923
|
static fromScaling(v: Vec3, out?: Mat4): Mat4;
|
|
@@ -914,7 +926,7 @@ declare class Mat4 extends Float32Array {
|
|
|
914
926
|
*
|
|
915
927
|
* @param {Number} rad the angle to rotate the matrix by
|
|
916
928
|
* @param {Vec3} axis the axis to rotate around
|
|
917
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
929
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
918
930
|
* @returns {Mat4} out
|
|
919
931
|
*/
|
|
920
932
|
static fromRotation(rad: number, axis: Vec3, out?: Mat4): Mat4 | null;
|
|
@@ -922,7 +934,7 @@ declare class Mat4 extends Float32Array {
|
|
|
922
934
|
* Creates a matrix from the given angle around the X axis
|
|
923
935
|
*
|
|
924
936
|
* @param {Number} rad the angle to rotate the matrix by
|
|
925
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
937
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
926
938
|
* @returns {Mat4} out
|
|
927
939
|
*/
|
|
928
940
|
static fromXRotation(rad: number, out?: Mat4): Mat4;
|
|
@@ -930,7 +942,7 @@ declare class Mat4 extends Float32Array {
|
|
|
930
942
|
* Creates a matrix from the given angle around the Y axis
|
|
931
943
|
*
|
|
932
944
|
* @param {Number} rad the angle to rotate the matrix by
|
|
933
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
945
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
934
946
|
* @returns {Mat4} out
|
|
935
947
|
*/
|
|
936
948
|
static fromYRotation(rad: number, out?: Mat4): Mat4;
|
|
@@ -938,7 +950,7 @@ declare class Mat4 extends Float32Array {
|
|
|
938
950
|
* Creates a matrix from the given angle around the Z axis
|
|
939
951
|
*
|
|
940
952
|
* @param {Number} rad the angle to rotate the matrix by
|
|
941
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
953
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
942
954
|
* @returns {Mat4} out
|
|
943
955
|
*/
|
|
944
956
|
static fromZRotation(rad: number, out?: Mat4): Mat4;
|
|
@@ -947,7 +959,7 @@ declare class Mat4 extends Float32Array {
|
|
|
947
959
|
*
|
|
948
960
|
* @param {Quat} q rotation quaternion
|
|
949
961
|
* @param {Vec3} v translation vector
|
|
950
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
962
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
951
963
|
* @returns {Mat4} out
|
|
952
964
|
*/
|
|
953
965
|
static fromRotationTranslation(q: Quat, v: Vec3, out?: Mat4): Mat4;
|
|
@@ -957,7 +969,7 @@ declare class Mat4 extends Float32Array {
|
|
|
957
969
|
* @param {Quat} q rotation quaternion
|
|
958
970
|
* @param {Vec3} v translation vector
|
|
959
971
|
* @param {Vec3} s scaling vector
|
|
960
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
972
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
961
973
|
* @returns {Mat4} out
|
|
962
974
|
*/
|
|
963
975
|
static fromRotationTranslationScale(q: Quat, v: Vec3, s: Vec3, out?: Mat4): Mat4;
|
|
@@ -968,7 +980,7 @@ declare class Mat4 extends Float32Array {
|
|
|
968
980
|
* @param {Vec3} v translation vector
|
|
969
981
|
* @param {Vec3} s scaling vector
|
|
970
982
|
* @param {Vec3} o the origin vector
|
|
971
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
983
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
972
984
|
* @returns {Mat4} out
|
|
973
985
|
*/
|
|
974
986
|
static fromRotationTranslationScaleOrigin(q: Quat, v: Vec3, s: Vec3, o: Vec3, out?: Mat4): Mat4;
|
|
@@ -976,7 +988,7 @@ declare class Mat4 extends Float32Array {
|
|
|
976
988
|
* Calculates a 4x4 matrix from the given quaternion
|
|
977
989
|
*
|
|
978
990
|
* @param {Quat} q quaternion to create matrix from
|
|
979
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
991
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
980
992
|
* @returns {Mat4} out
|
|
981
993
|
*/
|
|
982
994
|
static fromQuat(q: Quat, out?: Mat4): Mat4;
|
|
@@ -989,7 +1001,7 @@ declare class Mat4 extends Float32Array {
|
|
|
989
1001
|
* @param {Number} top top bound of the frustum
|
|
990
1002
|
* @param {Number} near near bound of the frustum
|
|
991
1003
|
* @param {Number} far far bound of the frustum
|
|
992
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1004
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
993
1005
|
* @returns {Mat4} out
|
|
994
1006
|
*/
|
|
995
1007
|
static frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, out?: Mat4): Mat4;
|
|
@@ -1002,7 +1014,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1002
1014
|
* @param {Number} aspect aspect ratio, typically viewport width / height
|
|
1003
1015
|
* @param {Number} near near bound of the frustum
|
|
1004
1016
|
* @param {Number | null} far far bound of the frustum, can be null or Infinity
|
|
1005
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1017
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1006
1018
|
* @returns {Mat4} out
|
|
1007
1019
|
*/
|
|
1008
1020
|
static perspectiveNO(fovy: number, aspect: number, near: number, far: number | null, out?: Mat4): Mat4;
|
|
@@ -1016,7 +1028,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1016
1028
|
* @param {Number} aspect aspect ratio, typically viewport width / height
|
|
1017
1029
|
* @param {Number} near near bound of the frustum
|
|
1018
1030
|
* @param {Number | null} far far bound of the frustum, can be null or Infinity
|
|
1019
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1031
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1020
1032
|
* @returns {Mat4} out
|
|
1021
1033
|
*/
|
|
1022
1034
|
static perspectiveZO(fovy: number, aspect: number, near: number, far: number | null, out?: Mat4): Mat4;
|
|
@@ -1026,7 +1038,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1026
1038
|
* @param {Object} fov object containing upDegrees, downDegrees, leftDegrees, rightDegrees
|
|
1027
1039
|
* @param {Number} near near bound of the frustum
|
|
1028
1040
|
* @param {Number} far far bound of the frustum
|
|
1029
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1041
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1030
1042
|
* @returns {Mat4} out
|
|
1031
1043
|
*/
|
|
1032
1044
|
static perspectiveFromFieldOfView(fov: {
|
|
@@ -1046,7 +1058,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1046
1058
|
* @param {Number} top top bound of the frustum
|
|
1047
1059
|
* @param {Number} near near bound of the frustum
|
|
1048
1060
|
* @param {Number} far far bound of the frustum
|
|
1049
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1061
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1050
1062
|
* @returns {Mat4} out
|
|
1051
1063
|
*/
|
|
1052
1064
|
static orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number, out?: Mat4): Mat4;
|
|
@@ -1062,7 +1074,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1062
1074
|
* @param {Number} top top bound of the frustum
|
|
1063
1075
|
* @param {Number} near near bound of the frustum
|
|
1064
1076
|
* @param {Number} far far bound of the frustum
|
|
1065
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1077
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1066
1078
|
* @returns {Mat4} out
|
|
1067
1079
|
*/
|
|
1068
1080
|
static orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number, out?: Mat4): Mat4;
|
|
@@ -1073,7 +1085,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1073
1085
|
* @param {Vec3} eye position of the viewer
|
|
1074
1086
|
* @param {Vec3} center point the viewer is looking at
|
|
1075
1087
|
* @param {Vec3} up vector pointing up
|
|
1076
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1088
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1077
1089
|
* @returns {Mat4} out
|
|
1078
1090
|
*/
|
|
1079
1091
|
static lookAt(eye: Vec3, center: Vec3, up: Vec3, out?: Mat4): Mat4;
|
|
@@ -1083,7 +1095,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1083
1095
|
* @param {Vec3} eye position of the viewer
|
|
1084
1096
|
* @param {Vec3} target point the viewer is looking at
|
|
1085
1097
|
* @param {Vec3} up vector pointing up
|
|
1086
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1098
|
+
* @param {Mat4} out the receiving matrix, defaults to mat4()
|
|
1087
1099
|
* @returns {Mat4} out
|
|
1088
1100
|
*/
|
|
1089
1101
|
static targetTo(eye: Vec3, target: Vec3, up: Vec3, out?: Mat4): Mat4;
|
|
@@ -1132,7 +1144,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1132
1144
|
* Adds two mat4's
|
|
1133
1145
|
*
|
|
1134
1146
|
* @param {Mat4} b the second operand
|
|
1135
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1147
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
1136
1148
|
* @returns {Mat4} out
|
|
1137
1149
|
*/
|
|
1138
1150
|
plus(b: Mat4, out?: Mat4): Mat4;
|
|
@@ -1140,7 +1152,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1140
1152
|
* Subtracts matrix b from a mat4
|
|
1141
1153
|
*
|
|
1142
1154
|
* @param {Mat4} b the second operand
|
|
1143
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1155
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
1144
1156
|
* @returns {Mat4} out
|
|
1145
1157
|
*/
|
|
1146
1158
|
minus(b: Mat4, out?: Mat4): Mat4;
|
|
@@ -1148,7 +1160,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1148
1160
|
* Multiplies each element of a mat4 by a scalar number
|
|
1149
1161
|
*
|
|
1150
1162
|
* @param {Number} b amount to scale the matrix's elements by
|
|
1151
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1163
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
1152
1164
|
* @returns {Mat4} out
|
|
1153
1165
|
*/
|
|
1154
1166
|
scaleScalar(b: number, out?: Mat4): Mat4;
|
|
@@ -1157,7 +1169,7 @@ declare class Mat4 extends Float32Array {
|
|
|
1157
1169
|
*
|
|
1158
1170
|
* @param {Mat4} b the second operand
|
|
1159
1171
|
* @param {Number} scale the amount to scale b's elements by before adding
|
|
1160
|
-
* @param {Mat4} out the receiving matrix, defaults to
|
|
1172
|
+
* @param {Mat4} out the receiving matrix, defaults to new mat4()
|
|
1161
1173
|
* @returns {Mat4} out
|
|
1162
1174
|
*/
|
|
1163
1175
|
multiplyScalarAndAdd(b: Mat4, scale: number, out?: Mat4): Mat4;
|
|
@@ -1201,7 +1213,8 @@ interface Mat4 {
|
|
|
1201
1213
|
str: () => string;
|
|
1202
1214
|
multiplyScalar: (b: number, out?: Mat4) => Mat4;
|
|
1203
1215
|
}
|
|
1204
|
-
declare const
|
|
1216
|
+
declare const createMat4: (...args: (number | Float32Array)[]) => Mat4;
|
|
1217
|
+
declare const mat4: typeof createMat4 & typeof Mat4;
|
|
1205
1218
|
declare const mat4x4: ((...args: (number | Float32Array)[]) => Mat4) & typeof Mat4;
|
|
1206
1219
|
|
|
1207
1220
|
/**
|
|
@@ -1216,7 +1229,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1216
1229
|
static get One(): Vec4;
|
|
1217
1230
|
static get ONE(): Vec4;
|
|
1218
1231
|
/**
|
|
1219
|
-
* Creates a
|
|
1232
|
+
* Creates a vec4
|
|
1220
1233
|
*
|
|
1221
1234
|
* @param {Number} x X component, defaults to 0
|
|
1222
1235
|
* @param {Number} y Y component, defaults to 0
|
|
@@ -1236,7 +1249,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1236
1249
|
* Adds two vec4's
|
|
1237
1250
|
*
|
|
1238
1251
|
* @param {Vec4 | Number} b the second operand
|
|
1239
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1252
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1240
1253
|
* @returns {Vec4} out
|
|
1241
1254
|
*/
|
|
1242
1255
|
plus(b: Vec4 | number, out?: Vec4): Vec4;
|
|
@@ -1244,7 +1257,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1244
1257
|
* Subtracts two vec4's
|
|
1245
1258
|
*
|
|
1246
1259
|
* @param {Vec4 | Number} b the second operand
|
|
1247
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1260
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1248
1261
|
* @returns {Vec4} out
|
|
1249
1262
|
*/
|
|
1250
1263
|
minus(b: Vec4 | number, out?: Vec4): Vec4;
|
|
@@ -1252,7 +1265,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1252
1265
|
* Multiplies two vec4's
|
|
1253
1266
|
*
|
|
1254
1267
|
* @param {Vec4 | Number} b the second operand
|
|
1255
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1268
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1256
1269
|
* @returns {Vec4} out
|
|
1257
1270
|
*/
|
|
1258
1271
|
mult(b: Vec4 | number, out?: Vec4): Vec4;
|
|
@@ -1260,7 +1273,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1260
1273
|
* Divides two vec4's
|
|
1261
1274
|
*
|
|
1262
1275
|
* @param {Vec4 | Number} b the second operand
|
|
1263
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1276
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1264
1277
|
* @returns {Vec4} out
|
|
1265
1278
|
*/
|
|
1266
1279
|
div(b: Vec4 | number, out?: Vec4): Vec4;
|
|
@@ -1268,7 +1281,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1268
1281
|
/**
|
|
1269
1282
|
* Negates the components of a vec4
|
|
1270
1283
|
*
|
|
1271
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1284
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1272
1285
|
* @returns {Vec4} out
|
|
1273
1286
|
*/
|
|
1274
1287
|
negate(out?: Vec4): Vec4;
|
|
@@ -1276,7 +1289,15 @@ declare class Vec4 extends Float32Array {
|
|
|
1276
1289
|
/**
|
|
1277
1290
|
* Normalizes a vec4
|
|
1278
1291
|
*
|
|
1279
|
-
* @param {Vec4}
|
|
1292
|
+
* @param {Vec4} v vector to normalize
|
|
1293
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1294
|
+
* @returns {Vec4} out
|
|
1295
|
+
*/
|
|
1296
|
+
static normalize(v: Vec4, out?: Vec4): Vec4;
|
|
1297
|
+
/**
|
|
1298
|
+
* Normalizes a vec4
|
|
1299
|
+
*
|
|
1300
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1280
1301
|
* @returns {Vec4} out
|
|
1281
1302
|
*/
|
|
1282
1303
|
normalize(out?: Vec4): Vec4;
|
|
@@ -1309,35 +1330,35 @@ declare class Vec4 extends Float32Array {
|
|
|
1309
1330
|
/**
|
|
1310
1331
|
* Math.floor the components of a vec4
|
|
1311
1332
|
*
|
|
1312
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1333
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1313
1334
|
* @returns {Vec4} out
|
|
1314
1335
|
*/
|
|
1315
1336
|
floor(out?: Vec4): Vec4;
|
|
1316
1337
|
/**
|
|
1317
1338
|
* Math.round the components of a vec4
|
|
1318
1339
|
*
|
|
1319
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1340
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1320
1341
|
* @returns {Vec4} out
|
|
1321
1342
|
*/
|
|
1322
1343
|
round(out?: Vec4): Vec4;
|
|
1323
1344
|
/**
|
|
1324
1345
|
* Math.ceil the components of a vec4
|
|
1325
1346
|
*
|
|
1326
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1347
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1327
1348
|
* @returns {Vec4} out
|
|
1328
1349
|
*/
|
|
1329
1350
|
ceil(out?: Vec4): Vec4;
|
|
1330
1351
|
/**
|
|
1331
1352
|
* Returns the inverse of the components of a vec4
|
|
1332
1353
|
*
|
|
1333
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
1354
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1334
1355
|
* @returns {Vec4} out
|
|
1335
1356
|
*/
|
|
1336
1357
|
inverse(out?: Vec4): Vec4;
|
|
1337
1358
|
/**
|
|
1338
|
-
* Creates a
|
|
1359
|
+
* Creates a vec4 initialized with values from a vector
|
|
1339
1360
|
*
|
|
1340
|
-
* @returns {Vec4} a
|
|
1361
|
+
* @returns {Vec4} a vec4
|
|
1341
1362
|
*/
|
|
1342
1363
|
clone(): Vec4;
|
|
1343
1364
|
/**
|
|
@@ -1350,7 +1371,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1350
1371
|
* Generates a random vector with the given scale
|
|
1351
1372
|
*
|
|
1352
1373
|
* @param {Number} scale length of the resulting vector, defaults to 1.0
|
|
1353
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
1374
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1354
1375
|
* @returns {Vec4} out
|
|
1355
1376
|
*/
|
|
1356
1377
|
static random(scale?: number, out?: Vec4): Vec4;
|
|
@@ -1368,7 +1389,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1368
1389
|
* @param {Vec4} u the first operand
|
|
1369
1390
|
* @param {Vec4} v the second operand
|
|
1370
1391
|
* @param {Vec4} w the third operand
|
|
1371
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
1392
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1372
1393
|
* @returns {Vec4} out
|
|
1373
1394
|
*/
|
|
1374
1395
|
static cross(u: Vec4, v: Vec4, w: Vec4, out?: Vec4): Vec4;
|
|
@@ -1396,7 +1417,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1396
1417
|
* @param {Vec4} a the first operand
|
|
1397
1418
|
* @param {Vec4} b the second operand
|
|
1398
1419
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
1399
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
1420
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1400
1421
|
* @returns {Vec4} out
|
|
1401
1422
|
*/
|
|
1402
1423
|
static lerp(a: Vec4, b: Vec4, t: number, out?: Vec4): Vec4;
|
|
@@ -1405,7 +1426,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1405
1426
|
*
|
|
1406
1427
|
* @param {Vec4} a the first operand
|
|
1407
1428
|
* @param {Vec4} b the second operand
|
|
1408
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
1429
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1409
1430
|
* @returns {Vec4} out
|
|
1410
1431
|
*/
|
|
1411
1432
|
static max(a: Vec4, b: Vec4, out?: Vec4): Vec4;
|
|
@@ -1414,7 +1435,7 @@ declare class Vec4 extends Float32Array {
|
|
|
1414
1435
|
*
|
|
1415
1436
|
* @param {Vec4} a the first operand
|
|
1416
1437
|
* @param {Vec4} b the second operand
|
|
1417
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
1438
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
1418
1439
|
* @returns {Vec4} out
|
|
1419
1440
|
*/
|
|
1420
1441
|
static min(a: Vec4, b: Vec4, out?: Vec4): Vec4;
|
|
@@ -1561,6 +1582,7 @@ interface Vec4 {
|
|
|
1561
1582
|
sqrLen: () => number;
|
|
1562
1583
|
str: () => string;
|
|
1563
1584
|
transformMat4x4: (m: Mat4, out?: Vec4) => Vec4;
|
|
1585
|
+
normalized: (out?: Vec4) => Vec4;
|
|
1564
1586
|
x0: Vec2;
|
|
1565
1587
|
x1: Vec2;
|
|
1566
1588
|
xx: Vec2;
|
|
@@ -4592,7 +4614,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4592
4614
|
static get unitZ(): Vec3;
|
|
4593
4615
|
static get UnitZ(): Vec3;
|
|
4594
4616
|
/**
|
|
4595
|
-
* Creates
|
|
4617
|
+
* Creates new vec3
|
|
4596
4618
|
*
|
|
4597
4619
|
* @param {Number} x X component, defaults to 0
|
|
4598
4620
|
* @param {Number} y Y component, defaults to 0
|
|
@@ -4609,7 +4631,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4609
4631
|
* Adds two vec3's
|
|
4610
4632
|
*
|
|
4611
4633
|
* @param {Number | Vec3} b the second operand
|
|
4612
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4634
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4613
4635
|
* @returns {Vec3} out
|
|
4614
4636
|
*/
|
|
4615
4637
|
plus(b: number | Vec3, out?: Vec3): Vec3;
|
|
@@ -4617,7 +4639,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4617
4639
|
* Subtracts two vec3's
|
|
4618
4640
|
*
|
|
4619
4641
|
* @param {Number | Vec3} b the second operand
|
|
4620
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4642
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4621
4643
|
* @returns {Vec3} out
|
|
4622
4644
|
*/
|
|
4623
4645
|
minus(b: number | Vec3, out?: Vec3): Vec3;
|
|
@@ -4625,7 +4647,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4625
4647
|
* Multiplies two vec3's
|
|
4626
4648
|
*
|
|
4627
4649
|
* @param {Number | Vec3} b the second operand
|
|
4628
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4650
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4629
4651
|
* @returns {Vec3} out
|
|
4630
4652
|
*/
|
|
4631
4653
|
mult(b: number | Vec3, out?: Vec3): Vec3;
|
|
@@ -4633,31 +4655,31 @@ declare class Vec3 extends Float32Array {
|
|
|
4633
4655
|
* Divides two vec3's
|
|
4634
4656
|
*
|
|
4635
4657
|
* @param {Number | Vec3} b the second operand
|
|
4636
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4658
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4637
4659
|
* @returns {Vec3} out
|
|
4638
4660
|
*/
|
|
4639
4661
|
div(b: number | Vec3, out?: Vec3): Vec3;
|
|
4640
4662
|
invDiv(b: number | Vec3, out?: Vec3): Vec3;
|
|
4641
4663
|
/**
|
|
4642
|
-
* Negates the components of
|
|
4664
|
+
* Negates the components of this vec3
|
|
4643
4665
|
*
|
|
4644
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4666
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4645
4667
|
* @returns {Vec3} out
|
|
4646
4668
|
*/
|
|
4647
4669
|
negate(out?: Vec3): Vec3;
|
|
4648
4670
|
unaryPlus(out?: Vec3): Vec3;
|
|
4649
4671
|
/**
|
|
4650
|
-
* Normalizes
|
|
4672
|
+
* Normalizes vec3
|
|
4651
4673
|
*
|
|
4652
4674
|
* @param {Vec3} v the vector to normalize
|
|
4653
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4675
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4654
4676
|
* @returns {Vec3} out
|
|
4655
4677
|
*/
|
|
4656
4678
|
static normalize(v: Vec3, out?: Vec3): Vec3;
|
|
4657
4679
|
/**
|
|
4658
|
-
* Normalizes
|
|
4680
|
+
* Normalizes this vec3
|
|
4659
4681
|
*
|
|
4660
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4682
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
4661
4683
|
* @returns {Vec3} out
|
|
4662
4684
|
*/
|
|
4663
4685
|
normalize(out?: Vec3): Vec3;
|
|
@@ -4676,73 +4698,73 @@ declare class Vec3 extends Float32Array {
|
|
|
4676
4698
|
*/
|
|
4677
4699
|
exactEquals(b: Vec3): boolean;
|
|
4678
4700
|
/**
|
|
4679
|
-
* Calculates the squared length of
|
|
4701
|
+
* Calculates the squared length of vec3
|
|
4680
4702
|
*
|
|
4681
4703
|
* @returns {Number} squared length of a vector
|
|
4682
4704
|
*/
|
|
4683
4705
|
squaredLength(): number;
|
|
4684
4706
|
/**
|
|
4685
|
-
* Calculates the length of
|
|
4707
|
+
* Calculates the length of vec3
|
|
4686
4708
|
*
|
|
4687
4709
|
* @returns {Number} length of a vector
|
|
4688
4710
|
*/
|
|
4689
4711
|
len(): number;
|
|
4690
4712
|
/**
|
|
4691
|
-
* Returns
|
|
4713
|
+
* Returns vec3 with each component floored
|
|
4692
4714
|
*
|
|
4693
4715
|
* @param {Vec3} v the vector to floor
|
|
4694
4716
|
* @returns {Vec3} a new floored vector
|
|
4695
4717
|
*/
|
|
4696
4718
|
static floor(v: Vec3, out?: Vec3): Vec3;
|
|
4697
4719
|
/**
|
|
4698
|
-
* Returns
|
|
4720
|
+
* Returns vec3 with each component rounded
|
|
4699
4721
|
*
|
|
4700
4722
|
* @param {Vec3} v the vector to round
|
|
4701
4723
|
* @returns {Vec3} a new rounded vector
|
|
4702
4724
|
*/
|
|
4703
4725
|
static round(v: Vec3, out?: Vec3): Vec3;
|
|
4704
4726
|
/**
|
|
4705
|
-
* Returns
|
|
4727
|
+
* Returns vec3 with each component ceiled
|
|
4706
4728
|
*
|
|
4707
4729
|
* @param {Vec3} v the vector to ceil
|
|
4708
4730
|
* @returns {Vec3} a new ceiled vector
|
|
4709
4731
|
*/
|
|
4710
4732
|
static ceil(v: Vec3, out?: Vec3): Vec3;
|
|
4711
4733
|
/**
|
|
4712
|
-
* Floors each component of
|
|
4734
|
+
* Floors each component of vec3
|
|
4713
4735
|
*
|
|
4714
4736
|
* @returns {Vec3} this
|
|
4715
4737
|
*/
|
|
4716
4738
|
floor(out?: Vec3): Vec3;
|
|
4717
4739
|
/**
|
|
4718
|
-
* Rounds each component of
|
|
4740
|
+
* Rounds each component of vec3
|
|
4719
4741
|
*
|
|
4720
4742
|
* @returns {Vec3} this
|
|
4721
4743
|
*/
|
|
4722
4744
|
round(out?: Vec3): Vec3;
|
|
4723
4745
|
/**
|
|
4724
|
-
* Ceils each component of
|
|
4746
|
+
* Ceils each component of vec3
|
|
4725
4747
|
*
|
|
4726
4748
|
* @returns {Vec3} this
|
|
4727
4749
|
*/
|
|
4728
4750
|
ceil(out?: Vec3): Vec3;
|
|
4729
4751
|
/**
|
|
4730
|
-
* Returns the inverse of
|
|
4752
|
+
* Returns the inverse of vec3
|
|
4731
4753
|
*
|
|
4732
4754
|
* @param {Vec3} v the source vector
|
|
4733
4755
|
* @returns {Vec3} a new inverted vector
|
|
4734
4756
|
*/
|
|
4735
4757
|
static inverse(v: Vec3, out?: Vec3): Vec3;
|
|
4736
4758
|
/**
|
|
4737
|
-
* Inverts
|
|
4759
|
+
* Inverts vec3 component-wise
|
|
4738
4760
|
*
|
|
4739
4761
|
* @returns {Vec3} this
|
|
4740
4762
|
*/
|
|
4741
4763
|
inverse(out?: Vec3): Vec3;
|
|
4742
4764
|
/**
|
|
4743
|
-
* Creates
|
|
4765
|
+
* Creates vec3 initialized with values from a vector
|
|
4744
4766
|
*
|
|
4745
|
-
* @returns {Vec3}
|
|
4767
|
+
* @returns {Vec3} vec3
|
|
4746
4768
|
*/
|
|
4747
4769
|
clone(): Vec3;
|
|
4748
4770
|
/**
|
|
@@ -4779,7 +4801,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4779
4801
|
*
|
|
4780
4802
|
* @param {Vec3} a the first operand
|
|
4781
4803
|
* @param {Vec3} b the second operand
|
|
4782
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4804
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4783
4805
|
* @returns {Vec3} out
|
|
4784
4806
|
*/
|
|
4785
4807
|
static cross(a: Vec3, b: Vec3, out?: Vec3): Vec3;
|
|
@@ -4807,7 +4829,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4807
4829
|
* @param {Vec3} a the first operand
|
|
4808
4830
|
* @param {Vec3} b the second operand
|
|
4809
4831
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
4810
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4832
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4811
4833
|
* @returns {Vec3} out
|
|
4812
4834
|
*/
|
|
4813
4835
|
static lerp(a: Vec3, b: Vec3, t: number, out?: Vec3): Vec3;
|
|
@@ -4817,7 +4839,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4817
4839
|
* @param {Vec3} a the first operand
|
|
4818
4840
|
* @param {Vec3} b the second operand
|
|
4819
4841
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
4820
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4842
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4821
4843
|
* @returns {Vec3} out
|
|
4822
4844
|
*/
|
|
4823
4845
|
static slerp(a: Vec3, b: Vec3, t: number, out?: Vec3): Vec3;
|
|
@@ -4868,40 +4890,40 @@ declare class Vec3 extends Float32Array {
|
|
|
4868
4890
|
*/
|
|
4869
4891
|
static smoothstep(edge0: Vec3 | number, edge1: Vec3 | number, v: Vec3, out?: Vec3): Vec3;
|
|
4870
4892
|
/**
|
|
4871
|
-
* Rotates
|
|
4893
|
+
* Rotates vec3 around the X axis
|
|
4872
4894
|
*
|
|
4873
4895
|
* @param {Vec3} v the vector to rotate
|
|
4874
4896
|
* @param {Number} rad the angle of rotation in radians
|
|
4875
|
-
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0)
|
|
4897
|
+
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0, 0, 0)
|
|
4876
4898
|
* @returns {Vec3} a new rotated vector
|
|
4877
4899
|
*/
|
|
4878
4900
|
static rotateX(v: Vec3, rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4879
4901
|
/**
|
|
4880
|
-
* Rotates
|
|
4902
|
+
* Rotates vec3 around the X axis
|
|
4881
4903
|
*
|
|
4882
4904
|
* @param {Number} rad the angle of rotation in radians
|
|
4883
|
-
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0)
|
|
4905
|
+
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0, 0, 0)
|
|
4884
4906
|
* @returns {Vec3} a rotated vector
|
|
4885
4907
|
*/
|
|
4886
4908
|
rotateX(rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4887
4909
|
/**
|
|
4888
|
-
* Rotates
|
|
4910
|
+
* Rotates vec3 around the Y axis
|
|
4889
4911
|
*
|
|
4890
4912
|
* @param {Vec3} v the vector to rotate
|
|
4891
4913
|
* @param {Number} rad the angle of rotation in radians
|
|
4892
|
-
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0)
|
|
4914
|
+
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0, 0, 0)
|
|
4893
4915
|
* @returns {Vec3} a rotated vector
|
|
4894
4916
|
*/
|
|
4895
4917
|
static rotateY(v: Vec3, rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4896
4918
|
/**
|
|
4897
|
-
* Rotates
|
|
4919
|
+
* Rotates vec3 around the Y axis
|
|
4898
4920
|
*
|
|
4899
4921
|
* @param {Number} rad the angle of rotation in radians
|
|
4900
|
-
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0)
|
|
4922
|
+
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0, 0, 0)
|
|
4901
4923
|
*/
|
|
4902
4924
|
rotateY(rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4903
4925
|
/**
|
|
4904
|
-
* Rotates
|
|
4926
|
+
* Rotates vec3 around the Z axis
|
|
4905
4927
|
*
|
|
4906
4928
|
* @param {Vec3} v the vector to rotate
|
|
4907
4929
|
* @param {Number} rad the angle of rotation in radians
|
|
@@ -4910,10 +4932,10 @@ declare class Vec3 extends Float32Array {
|
|
|
4910
4932
|
*/
|
|
4911
4933
|
static rotateZ(v: Vec3, rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4912
4934
|
/**
|
|
4913
|
-
* Rotates
|
|
4935
|
+
* Rotates vec3 around the Z axis
|
|
4914
4936
|
*
|
|
4915
4937
|
* @param {Number} rad the angle of rotation in radians
|
|
4916
|
-
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0)
|
|
4938
|
+
* @param {Vec3} origin the origin of the rotation, defaults to vec3(0, 0, 0)
|
|
4917
4939
|
*/
|
|
4918
4940
|
rotateZ(rad: number, origin?: Vec3, out?: Vec3): Vec3;
|
|
4919
4941
|
/**
|
|
@@ -4944,7 +4966,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4944
4966
|
* @param {Vec3} a the first operand
|
|
4945
4967
|
* @param {Vec3} b the second operand
|
|
4946
4968
|
* @param {Number} scale the amount to scale b by before adding
|
|
4947
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4969
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4948
4970
|
* @returns {Vec3} out
|
|
4949
4971
|
*/
|
|
4950
4972
|
static scaleAndAdd(a: Vec3, b: Vec3, scale: number, out?: Vec3): Vec3;
|
|
@@ -4953,7 +4975,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4953
4975
|
*
|
|
4954
4976
|
* @param {Vec3} I the incident vector
|
|
4955
4977
|
* @param {Vec3} N the surface normal
|
|
4956
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4978
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4957
4979
|
* @returns {Vec3} out
|
|
4958
4980
|
*/
|
|
4959
4981
|
static reflect(I: Vec3, N: Vec3, out?: Vec3): Vec3;
|
|
@@ -4963,7 +4985,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4963
4985
|
* @param {Vec3} I the incident vector
|
|
4964
4986
|
* @param {Vec3} N the surface normal
|
|
4965
4987
|
* @param {Number} eta the ratio of indices of refraction
|
|
4966
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4988
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4967
4989
|
* @returns {Vec3} out
|
|
4968
4990
|
*/
|
|
4969
4991
|
static refract(I: Vec3, N: Vec3, eta: number, out?: Vec3): Vec3;
|
|
@@ -4973,7 +4995,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4973
4995
|
* @param {Vec3} N the vector to orient
|
|
4974
4996
|
* @param {Vec3} I the incident vector
|
|
4975
4997
|
* @param {Vec3} Nref the reference vector
|
|
4976
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
4998
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4977
4999
|
* @returns {Vec3} out
|
|
4978
5000
|
*/
|
|
4979
5001
|
static faceforward(N: Vec3, I: Vec3, Nref: Vec3, out?: Vec3): Vec3;
|
|
@@ -4983,7 +5005,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4983
5005
|
* @param {Vec3} p1 the first vertex
|
|
4984
5006
|
* @param {Vec3} p2 the second vertex
|
|
4985
5007
|
* @param {Vec3} p3 the third vertex
|
|
4986
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5008
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4987
5009
|
* @returns {Vec3} out
|
|
4988
5010
|
*/
|
|
4989
5011
|
static triangleNormal(p1: Vec3, p2: Vec3, p3: Vec3, out?: Vec3): Vec3;
|
|
@@ -4992,7 +5014,7 @@ declare class Vec3 extends Float32Array {
|
|
|
4992
5014
|
*
|
|
4993
5015
|
* @param {Vec3} a the vector to project
|
|
4994
5016
|
* @param {Vec3} b the vector to project onto
|
|
4995
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5017
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3
|
|
4996
5018
|
* @returns {Vec3} out
|
|
4997
5019
|
*/
|
|
4998
5020
|
static project(a: Vec3, b: Vec3, out?: Vec3): Vec3;
|
|
@@ -5010,14 +5032,14 @@ declare class Vec3 extends Float32Array {
|
|
|
5010
5032
|
*
|
|
5011
5033
|
* @param {Vec3} b the second operand
|
|
5012
5034
|
* @param {Number} scale the amount to scale b by before adding
|
|
5013
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5035
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5014
5036
|
* @returns {Vec3} out
|
|
5015
5037
|
*/
|
|
5016
5038
|
scaleAndAdd(b: Vec3, scale: number, out?: Vec3): Vec3;
|
|
5017
5039
|
/**
|
|
5018
|
-
* Returns
|
|
5040
|
+
* Returns vec3 with each component set to its absolute value
|
|
5019
5041
|
*
|
|
5020
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5042
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5021
5043
|
* @returns {Vec3} out
|
|
5022
5044
|
*/
|
|
5023
5045
|
abs(out?: Vec3): Vec3;
|
|
@@ -5026,7 +5048,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5026
5048
|
*
|
|
5027
5049
|
* @param {Vec3 | number} min the lower bound (per-component or scalar)
|
|
5028
5050
|
* @param {Vec3 | number} max the upper bound (per-component or scalar)
|
|
5029
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5051
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5030
5052
|
* @returns {Vec3} out
|
|
5031
5053
|
*/
|
|
5032
5054
|
clamp(min: Vec3 | number, max: Vec3 | number, out?: Vec3): Vec3;
|
|
@@ -5035,7 +5057,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5035
5057
|
*
|
|
5036
5058
|
* @param {Vec3} b the second operand
|
|
5037
5059
|
* @param {Vec3 | number} t interpolation amount (per-component or scalar)
|
|
5038
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5060
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5039
5061
|
* @returns {Vec3} out
|
|
5040
5062
|
*/
|
|
5041
5063
|
mix(b: Vec3, t: Vec3 | number, out?: Vec3): Vec3;
|
|
@@ -5043,7 +5065,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5043
5065
|
* Generates a step function by comparing this vector to edge.
|
|
5044
5066
|
*
|
|
5045
5067
|
* @param {Vec3 | number} edge the edge value (per-component or scalar)
|
|
5046
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5068
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5047
5069
|
* @returns {Vec3} out
|
|
5048
5070
|
*/
|
|
5049
5071
|
step(edge: Vec3 | number, out?: Vec3): Vec3;
|
|
@@ -5052,28 +5074,28 @@ declare class Vec3 extends Float32Array {
|
|
|
5052
5074
|
*
|
|
5053
5075
|
* @param {Vec3 | number} edge0 the lower edge (per-component or scalar)
|
|
5054
5076
|
* @param {Vec3 | number} edge1 the upper edge (per-component or scalar)
|
|
5055
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5077
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5056
5078
|
* @returns {Vec3} out
|
|
5057
5079
|
*/
|
|
5058
5080
|
smoothstep(edge0: Vec3 | number, edge1: Vec3 | number, out?: Vec3): Vec3;
|
|
5059
5081
|
/**
|
|
5060
5082
|
* Returns the fractional part of each component.
|
|
5061
5083
|
*
|
|
5062
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5084
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5063
5085
|
* @returns {Vec3} out
|
|
5064
5086
|
*/
|
|
5065
5087
|
fract(out?: Vec3): Vec3;
|
|
5066
5088
|
/**
|
|
5067
5089
|
* Returns the sign of each component (-1, 0, or 1).
|
|
5068
5090
|
*
|
|
5069
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5091
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5070
5092
|
* @returns {Vec3} out
|
|
5071
5093
|
*/
|
|
5072
5094
|
sign(out?: Vec3): Vec3;
|
|
5073
5095
|
/**
|
|
5074
5096
|
* Clamps each component to [0, 1].
|
|
5075
5097
|
*
|
|
5076
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5098
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5077
5099
|
* @returns {Vec3} out
|
|
5078
5100
|
*/
|
|
5079
5101
|
saturate(out?: Vec3): Vec3;
|
|
@@ -5081,7 +5103,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5081
5103
|
* Transforms this vec3 with a Mat3
|
|
5082
5104
|
*
|
|
5083
5105
|
* @param {Mat3} m the 3x3 matrix to transform with
|
|
5084
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5106
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5085
5107
|
* @returns {Vec3} out
|
|
5086
5108
|
*/
|
|
5087
5109
|
transformMat3(m: Mat3, out?: Vec3): Vec3;
|
|
@@ -5089,7 +5111,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5089
5111
|
* Transforms this vec3 with a Mat4 (as a point, w=1)
|
|
5090
5112
|
*
|
|
5091
5113
|
* @param {Mat4} m the 4x4 matrix to transform with
|
|
5092
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5114
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5093
5115
|
* @returns {Vec3} out
|
|
5094
5116
|
*/
|
|
5095
5117
|
transformMat4(m: Mat4, out?: Vec3): Vec3;
|
|
@@ -5097,7 +5119,7 @@ declare class Vec3 extends Float32Array {
|
|
|
5097
5119
|
* Transforms this vec3 with a quaternion
|
|
5098
5120
|
*
|
|
5099
5121
|
* @param {Quat} q the quaternion to transform with
|
|
5100
|
-
* @param {Vec3} out the receiving vector, defaults to
|
|
5122
|
+
* @param {Vec3} out the receiving vector, defaults to new vec3()
|
|
5101
5123
|
* @returns {Vec3} out
|
|
5102
5124
|
*/
|
|
5103
5125
|
transformQuat(q: Quat, out?: Vec3): Vec3;
|
|
@@ -5117,6 +5139,7 @@ interface Vec3 {
|
|
|
5117
5139
|
str: () => string;
|
|
5118
5140
|
transformMat3x3: (m: Mat3, out?: Vec3) => Vec3;
|
|
5119
5141
|
transformMat4x4: (m: Mat4, out?: Vec3) => Vec3;
|
|
5142
|
+
normalized: (out?: Vec3) => Vec3;
|
|
5120
5143
|
x0: Vec2;
|
|
5121
5144
|
x1: Vec2;
|
|
5122
5145
|
xx: Vec2;
|
|
@@ -8155,21 +8178,21 @@ declare class Mat2 extends Float32Array {
|
|
|
8155
8178
|
/**
|
|
8156
8179
|
* Transposes a mat2
|
|
8157
8180
|
*
|
|
8158
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8181
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8159
8182
|
* @returns {Mat2} out
|
|
8160
8183
|
*/
|
|
8161
8184
|
transpose(out?: Mat2): Mat2;
|
|
8162
8185
|
/**
|
|
8163
8186
|
* Inverts a mat2
|
|
8164
8187
|
*
|
|
8165
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8188
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8166
8189
|
* @returns {Mat2} out or null if the matrix is not invertible
|
|
8167
8190
|
*/
|
|
8168
8191
|
invert(out?: Mat2): Mat2 | null;
|
|
8169
8192
|
/**
|
|
8170
8193
|
* Calculates the adjugate of a mat2
|
|
8171
8194
|
*
|
|
8172
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8195
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8173
8196
|
* @returns {Mat2} out
|
|
8174
8197
|
*/
|
|
8175
8198
|
adjoint(out?: Mat2): Mat2;
|
|
@@ -8183,7 +8206,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8183
8206
|
* Rotates a mat2 by the given angle
|
|
8184
8207
|
*
|
|
8185
8208
|
* @param {Number} rad the angle to rotate the matrix by
|
|
8186
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8209
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8187
8210
|
* @returns {Mat2} out
|
|
8188
8211
|
*/
|
|
8189
8212
|
rotate(rad: number, out?: Mat2): Mat2;
|
|
@@ -8191,7 +8214,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8191
8214
|
* Scales a mat2 by the dimensions in the given Vec2
|
|
8192
8215
|
*
|
|
8193
8216
|
* @param {Vec2} v the Vec2 to scale the matrix by
|
|
8194
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8217
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8195
8218
|
* @returns {Mat2} out
|
|
8196
8219
|
*/
|
|
8197
8220
|
scale(v: Vec2, out?: Mat2): Mat2;
|
|
@@ -8199,7 +8222,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8199
8222
|
* Creates a Mat2 from a given angle
|
|
8200
8223
|
*
|
|
8201
8224
|
* @param {Number} rad the angle to rotate the matrix by
|
|
8202
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8225
|
+
* @param {Mat2} out the receiving matrix, defaults to mat2()
|
|
8203
8226
|
* @returns {Mat2} out
|
|
8204
8227
|
*/
|
|
8205
8228
|
static fromRotation(rad: number, out?: Mat2): Mat2;
|
|
@@ -8207,7 +8230,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8207
8230
|
* Creates a Mat2 from a scaling vector
|
|
8208
8231
|
*
|
|
8209
8232
|
* @param {Vec2} v scaling vector
|
|
8210
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8233
|
+
* @param {Mat2} out the receiving matrix, defaults to mat2()
|
|
8211
8234
|
* @returns {Mat2} out
|
|
8212
8235
|
*/
|
|
8213
8236
|
static fromScaling(v: Vec2, out?: Mat2): Mat2;
|
|
@@ -8233,7 +8256,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8233
8256
|
* Adds two Mat2's
|
|
8234
8257
|
*
|
|
8235
8258
|
* @param {Mat2} b the second operand
|
|
8236
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8259
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8237
8260
|
* @returns {Mat2} out
|
|
8238
8261
|
*/
|
|
8239
8262
|
plus(b: Mat2, out?: Mat2): Mat2;
|
|
@@ -8241,7 +8264,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8241
8264
|
* Subtracts matrix b from a mat2
|
|
8242
8265
|
*
|
|
8243
8266
|
* @param {Mat2} b the second operand
|
|
8244
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8267
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8245
8268
|
* @returns {Mat2} out
|
|
8246
8269
|
*/
|
|
8247
8270
|
minus(b: Mat2, out?: Mat2): Mat2;
|
|
@@ -8249,7 +8272,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8249
8272
|
* Multiplies a mat2 by another Mat2
|
|
8250
8273
|
*
|
|
8251
8274
|
* @param {Mat2} b the second operand
|
|
8252
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8275
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8253
8276
|
* @returns {Mat2} out
|
|
8254
8277
|
*/
|
|
8255
8278
|
multiply(b: Vec2): Vec2;
|
|
@@ -8272,7 +8295,7 @@ declare class Mat2 extends Float32Array {
|
|
|
8272
8295
|
* Multiplies each element of a mat2 by a scalar value
|
|
8273
8296
|
*
|
|
8274
8297
|
* @param {Number} b amount to scale the matrix's elements by
|
|
8275
|
-
* @param {Mat2} out the receiving matrix, defaults to
|
|
8298
|
+
* @param {Mat2} out the receiving matrix, defaults to new mat2()
|
|
8276
8299
|
* @returns {Mat2} out
|
|
8277
8300
|
*/
|
|
8278
8301
|
scaleScalar(b: number, out?: Mat2): Mat2;
|
|
@@ -8320,7 +8343,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8320
8343
|
* Adds two vec2's
|
|
8321
8344
|
*
|
|
8322
8345
|
* @param {Vec2 | Number} b the second operand
|
|
8323
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8346
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8324
8347
|
* @returns {Vec2} out
|
|
8325
8348
|
*/
|
|
8326
8349
|
plus(b: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8328,7 +8351,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8328
8351
|
* Subtracts vector b from a vector
|
|
8329
8352
|
*
|
|
8330
8353
|
* @param {Vec2 | Number} b the second operand
|
|
8331
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8354
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8332
8355
|
* @returns {Vec2} out
|
|
8333
8356
|
*/
|
|
8334
8357
|
minus(b: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8336,7 +8359,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8336
8359
|
* Multiplies two vec2's component-wise
|
|
8337
8360
|
*
|
|
8338
8361
|
* @param {Vec2 | Number} b the second operand
|
|
8339
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8362
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8340
8363
|
* @returns {Vec2} out
|
|
8341
8364
|
*/
|
|
8342
8365
|
mult(b: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8344,7 +8367,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8344
8367
|
* Divides two vec2's component-wise
|
|
8345
8368
|
*
|
|
8346
8369
|
* @param {Vec2 | Number} b the second operand
|
|
8347
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8370
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8348
8371
|
* @returns {Vec2} out
|
|
8349
8372
|
*/
|
|
8350
8373
|
div(b: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8352,7 +8375,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8352
8375
|
* Divides this vector by argument
|
|
8353
8376
|
*
|
|
8354
8377
|
* @param {Vec2 | Number} a the first operand
|
|
8355
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8378
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8356
8379
|
* @returns {Vec2} out
|
|
8357
8380
|
*/
|
|
8358
8381
|
invDiv(a: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8360,21 +8383,29 @@ declare class Vec2 extends Float32Array {
|
|
|
8360
8383
|
* Remainder of this divided by argument
|
|
8361
8384
|
*
|
|
8362
8385
|
* @param {Vec2 | Number} a the first operand
|
|
8363
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8386
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8364
8387
|
* @returns {Vec2} out
|
|
8365
8388
|
*/
|
|
8366
8389
|
rem(b: Vec2 | number, out?: Vec2): Vec2;
|
|
8367
8390
|
/**
|
|
8368
8391
|
* Negates the components of a vec2
|
|
8369
8392
|
*
|
|
8370
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8393
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8371
8394
|
* @returns {Vec2} out
|
|
8372
8395
|
*/
|
|
8373
8396
|
negate(out?: Vec2): Vec2;
|
|
8374
8397
|
unaryPlus(out?: Vec2): Vec2;
|
|
8375
8398
|
/**
|
|
8376
|
-
* Normalize a vector to unit length.
|
|
8399
|
+
* Normalize a vector to unit length.
|
|
8377
8400
|
*
|
|
8401
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8402
|
+
* @returns {Vec2} this
|
|
8403
|
+
*/
|
|
8404
|
+
static normalize(v: Vec2, out?: Vec2): Vec2;
|
|
8405
|
+
/**
|
|
8406
|
+
* Normalize a vector to unit length.
|
|
8407
|
+
*
|
|
8408
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8378
8409
|
* @returns {Vec2} this
|
|
8379
8410
|
*/
|
|
8380
8411
|
normalize(out?: Vec2): Vec2;
|
|
@@ -8407,28 +8438,28 @@ declare class Vec2 extends Float32Array {
|
|
|
8407
8438
|
/**
|
|
8408
8439
|
* Math.floor the components of a vec2
|
|
8409
8440
|
*
|
|
8410
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8441
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8411
8442
|
* @returns {Vec2} out
|
|
8412
8443
|
*/
|
|
8413
8444
|
floor(out?: Vec2): Vec2;
|
|
8414
8445
|
/**
|
|
8415
8446
|
* Math.round the components of a vec2
|
|
8416
8447
|
*
|
|
8417
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8448
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8418
8449
|
* @returns {Vec2} out
|
|
8419
8450
|
*/
|
|
8420
8451
|
round(out?: Vec2): Vec2;
|
|
8421
8452
|
/**
|
|
8422
8453
|
* Math.ceil the components of a vec2
|
|
8423
8454
|
*
|
|
8424
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8455
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8425
8456
|
* @returns {Vec2} out
|
|
8426
8457
|
*/
|
|
8427
8458
|
ceil(out?: Vec2): Vec2;
|
|
8428
8459
|
/**
|
|
8429
8460
|
* Returns the inverse of the components (1/x, 1/y)
|
|
8430
8461
|
*
|
|
8431
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8462
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8432
8463
|
* @returns {Vec2} out
|
|
8433
8464
|
*/
|
|
8434
8465
|
inverse(out?: Vec2): Vec2;
|
|
@@ -8442,8 +8473,8 @@ declare class Vec2 extends Float32Array {
|
|
|
8442
8473
|
* Rotates a vec2 around an origin point
|
|
8443
8474
|
*
|
|
8444
8475
|
* @param {Number} rad the angle of rotation in radians
|
|
8445
|
-
* @param {Vec2} origin the origin of the rotation, defaults to
|
|
8446
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8476
|
+
* @param {Vec2} origin the origin of the rotation, defaults to vec2(0, 0)
|
|
8477
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8447
8478
|
* @returns {Vec2} out
|
|
8448
8479
|
*/
|
|
8449
8480
|
rotate(rad?: number, origin?: Vec2, out?: Vec2): Vec2;
|
|
@@ -8575,28 +8606,28 @@ declare class Vec2 extends Float32Array {
|
|
|
8575
8606
|
*
|
|
8576
8607
|
* @param {Vec2} b the second operand
|
|
8577
8608
|
* @param {Number} scale the amount to scale b by before adding
|
|
8578
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8609
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8579
8610
|
* @returns {Vec2} out
|
|
8580
8611
|
*/
|
|
8581
8612
|
scaleAndAdd(b: Vec2, scale: number, out?: Vec2): Vec2;
|
|
8582
8613
|
/**
|
|
8583
8614
|
* Component-wise absolute value
|
|
8584
8615
|
*
|
|
8585
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8616
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8586
8617
|
* @returns {Vec2} out
|
|
8587
8618
|
*/
|
|
8588
8619
|
abs(out?: Vec2): Vec2;
|
|
8589
8620
|
/**
|
|
8590
8621
|
* Component-wise sign
|
|
8591
8622
|
*
|
|
8592
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8623
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8593
8624
|
* @returns {Vec2} out
|
|
8594
8625
|
*/
|
|
8595
8626
|
sign(out?: Vec2): Vec2;
|
|
8596
8627
|
/**
|
|
8597
8628
|
* Component-wise fractional part (x - floor(x))
|
|
8598
8629
|
*
|
|
8599
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8630
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8600
8631
|
* @returns {Vec2} out
|
|
8601
8632
|
*/
|
|
8602
8633
|
fract(out?: Vec2): Vec2;
|
|
@@ -8605,14 +8636,14 @@ declare class Vec2 extends Float32Array {
|
|
|
8605
8636
|
*
|
|
8606
8637
|
* @param {Vec2 | Number} min the lower bound
|
|
8607
8638
|
* @param {Vec2 | Number} max the upper bound
|
|
8608
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8639
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8609
8640
|
* @returns {Vec2} out
|
|
8610
8641
|
*/
|
|
8611
8642
|
clamp(min: Vec2 | number, max: Vec2 | number, out?: Vec2): Vec2;
|
|
8612
8643
|
/**
|
|
8613
8644
|
* Clamp components to [0, 1]
|
|
8614
8645
|
*
|
|
8615
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8646
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8616
8647
|
* @returns {Vec2} out
|
|
8617
8648
|
*/
|
|
8618
8649
|
saturate(out?: Vec2): Vec2;
|
|
@@ -8621,7 +8652,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8621
8652
|
*
|
|
8622
8653
|
* @param {Vec2} b the second operand
|
|
8623
8654
|
* @param {Vec2 | Number} t interpolation factor (scalar or per-component)
|
|
8624
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8655
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8625
8656
|
* @returns {Vec2} out
|
|
8626
8657
|
*/
|
|
8627
8658
|
mix(b: Vec2, t: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8629,7 +8660,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8629
8660
|
* Component-wise step function
|
|
8630
8661
|
*
|
|
8631
8662
|
* @param {Vec2 | Number} edge the edge threshold
|
|
8632
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8663
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8633
8664
|
* @returns {Vec2} out
|
|
8634
8665
|
*/
|
|
8635
8666
|
step(edge: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8638,7 +8669,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8638
8669
|
*
|
|
8639
8670
|
* @param {Vec2 | Number} edge0 the lower edge
|
|
8640
8671
|
* @param {Vec2 | Number} edge1 the upper edge
|
|
8641
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8672
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8642
8673
|
* @returns {Vec2} out
|
|
8643
8674
|
*/
|
|
8644
8675
|
smoothstep(edge0: Vec2 | number, edge1: Vec2 | number, out?: Vec2): Vec2;
|
|
@@ -8646,7 +8677,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8646
8677
|
* Transforms the vec2 with a Mat2 (column-major 2x2)
|
|
8647
8678
|
*
|
|
8648
8679
|
* @param {Mat2} m matrix to transform with
|
|
8649
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8680
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8650
8681
|
* @returns {Vec2} out
|
|
8651
8682
|
*/
|
|
8652
8683
|
transformMat2(m: Mat2, out?: Vec2): Vec2;
|
|
@@ -8654,7 +8685,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8654
8685
|
* Transforms the vec2 with a Mat2x3 (2D affine transform)
|
|
8655
8686
|
*
|
|
8656
8687
|
* @param {Mat2x3} m matrix to transform with
|
|
8657
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8688
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8658
8689
|
* @returns {Vec2} out
|
|
8659
8690
|
*/
|
|
8660
8691
|
transformMat2x3(m: Mat2x3, out?: Vec2): Vec2;
|
|
@@ -8662,7 +8693,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8662
8693
|
* Transforms the vec2 with a Mat3 (column-major 3x3)
|
|
8663
8694
|
*
|
|
8664
8695
|
* @param {Mat3} m matrix to transform with
|
|
8665
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8696
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8666
8697
|
* @returns {Vec2} out
|
|
8667
8698
|
*/
|
|
8668
8699
|
transformMat3(m: Mat3, out?: Vec2): Vec2;
|
|
@@ -8670,7 +8701,7 @@ declare class Vec2 extends Float32Array {
|
|
|
8670
8701
|
* Transforms the vec2 with a Mat4 (column-major 4x4)
|
|
8671
8702
|
*
|
|
8672
8703
|
* @param {Mat4} m matrix to transform with
|
|
8673
|
-
* @param {Vec2} out the receiving vector, defaults to
|
|
8704
|
+
* @param {Vec2} out the receiving vector, defaults to new vec2()
|
|
8674
8705
|
* @returns {Vec2} out
|
|
8675
8706
|
*/
|
|
8676
8707
|
transformMat4(m: Mat4, out?: Vec2): Vec2;
|
|
@@ -8712,6 +8743,7 @@ interface Vec2 {
|
|
|
8712
8743
|
transformMat2d: (m: Mat2x3, out?: Vec2) => Vec2;
|
|
8713
8744
|
transformMat3x3: (m: Mat3, out?: Vec2) => Vec2;
|
|
8714
8745
|
transformMat4x4: (m: Mat4, out?: Vec2) => Vec2;
|
|
8746
|
+
normalized: (out?: Vec2) => Vec2;
|
|
8715
8747
|
x0: Vec2;
|
|
8716
8748
|
x1: Vec2;
|
|
8717
8749
|
xx: Vec2;
|
|
@@ -11825,7 +11857,7 @@ declare class Quat2 extends Float32Array {
|
|
|
11825
11857
|
* Multiply two dual quaternions
|
|
11826
11858
|
*
|
|
11827
11859
|
* @param {Quat2} b the second operand
|
|
11828
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11860
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11829
11861
|
* @returns {Quat2} out
|
|
11830
11862
|
*/
|
|
11831
11863
|
multiply: (b: Quat2, out?: Quat2) => Quat2;
|
|
@@ -11833,21 +11865,21 @@ declare class Quat2 extends Float32Array {
|
|
|
11833
11865
|
* Translate by a Vec3
|
|
11834
11866
|
*
|
|
11835
11867
|
* @param {Vec3} v the translation vector
|
|
11836
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11868
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11837
11869
|
* @returns {Quat2} out
|
|
11838
11870
|
*/
|
|
11839
11871
|
translate(v: Vec3, out?: Quat2): Quat2;
|
|
11840
11872
|
/**
|
|
11841
11873
|
* Calculates the conjugate of a dual quaternion
|
|
11842
11874
|
*
|
|
11843
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11875
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11844
11876
|
* @returns {Quat2} out
|
|
11845
11877
|
*/
|
|
11846
11878
|
conjugate(out?: Quat2): Quat2;
|
|
11847
11879
|
/**
|
|
11848
11880
|
* Calculates the inverse of a dual quaternion
|
|
11849
11881
|
*
|
|
11850
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11882
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11851
11883
|
* @returns {Quat2} out
|
|
11852
11884
|
*/
|
|
11853
11885
|
invert(out?: Quat2): Quat2;
|
|
@@ -11866,7 +11898,15 @@ declare class Quat2 extends Float32Array {
|
|
|
11866
11898
|
/**
|
|
11867
11899
|
* Normalize the dual quaternion
|
|
11868
11900
|
*
|
|
11869
|
-
* @param {Quat2}
|
|
11901
|
+
* @param {Quat2} q the quaternion to normalize
|
|
11902
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11903
|
+
* @returns {Quat2} out
|
|
11904
|
+
*/
|
|
11905
|
+
static normalize(q: Quat2, out?: Quat2): Quat2;
|
|
11906
|
+
/**
|
|
11907
|
+
* Normalize the dual quaternion
|
|
11908
|
+
*
|
|
11909
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11870
11910
|
* @returns {Quat2} out
|
|
11871
11911
|
*/
|
|
11872
11912
|
normalize(out?: Quat2): Quat2;
|
|
@@ -11892,7 +11932,7 @@ declare class Quat2 extends Float32Array {
|
|
|
11892
11932
|
* Adds two dual quaternions
|
|
11893
11933
|
*
|
|
11894
11934
|
* @param {Quat2} b the second operand
|
|
11895
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11935
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11896
11936
|
* @returns {Quat2} out
|
|
11897
11937
|
*/
|
|
11898
11938
|
plus(b: Quat2, out?: Quat2): Quat2;
|
|
@@ -11900,7 +11940,7 @@ declare class Quat2 extends Float32Array {
|
|
|
11900
11940
|
* Scales a dual quaternion by a scalar
|
|
11901
11941
|
*
|
|
11902
11942
|
* @param {Number} s the scalar to scale by
|
|
11903
|
-
* @param {Quat2} out the receiving dual quaternion, defaults to
|
|
11943
|
+
* @param {Quat2} out the receiving dual quaternion, defaults to new quat2()
|
|
11904
11944
|
* @returns {Quat2} out
|
|
11905
11945
|
*/
|
|
11906
11946
|
scale(s: number, out?: Quat2): Quat2;
|
|
@@ -11929,8 +11969,10 @@ interface Quat2 {
|
|
|
11929
11969
|
sqrLen: () => number;
|
|
11930
11970
|
str: () => string;
|
|
11931
11971
|
add: (b: Quat2, out?: Quat2) => Quat2;
|
|
11972
|
+
normalized: (out?: Quat2) => Quat2;
|
|
11932
11973
|
}
|
|
11933
|
-
declare const
|
|
11974
|
+
declare const createQuat2: (x1?: number, y1?: number, z1?: number, w1?: number, x2?: number, y2?: number, z2?: number, w2?: number) => Quat2;
|
|
11975
|
+
declare const quat2: typeof createQuat2 & typeof Quat2;
|
|
11934
11976
|
|
|
11935
11977
|
type Vec = Vec2 | Vec3 | Vec4;
|
|
11936
11978
|
type Vector = Vec;
|