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/src/vec4.ts
CHANGED
|
@@ -11,15 +11,15 @@ import { Quat } from './quat'
|
|
|
11
11
|
*/
|
|
12
12
|
export class Vec4 extends Float32Array {
|
|
13
13
|
|
|
14
|
-
static get zero() { return
|
|
15
|
-
static get Zero() { return
|
|
16
|
-
static get ZERO() { return
|
|
17
|
-
static get one() { return
|
|
18
|
-
static get One() { return
|
|
19
|
-
static get ONE() { return
|
|
14
|
+
static get zero() { return vec4(0, 0, 0, 0) }
|
|
15
|
+
static get Zero() { return vec4(0, 0, 0, 0) }
|
|
16
|
+
static get ZERO() { return vec4(0, 0, 0, 0) }
|
|
17
|
+
static get one() { return vec4(1, 1, 1, 1) }
|
|
18
|
+
static get One() { return vec4(1, 1, 1, 1) }
|
|
19
|
+
static get ONE() { return vec4(1, 1, 1, 1) }
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Creates a
|
|
22
|
+
* Creates a vec4
|
|
23
23
|
*
|
|
24
24
|
* @param {Number} x X component, defaults to 0
|
|
25
25
|
* @param {Number} y Y component, defaults to 0
|
|
@@ -50,10 +50,10 @@ export class Vec4 extends Float32Array {
|
|
|
50
50
|
* Adds two vec4's
|
|
51
51
|
*
|
|
52
52
|
* @param {Vec4 | Number} b the second operand
|
|
53
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
53
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
54
54
|
* @returns {Vec4} out
|
|
55
55
|
*/
|
|
56
|
-
plus(b: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
56
|
+
plus(b: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
57
57
|
if (typeof b === 'number') {
|
|
58
58
|
out[0] = this[0] + b
|
|
59
59
|
out[1] = this[1] + b
|
|
@@ -72,10 +72,10 @@ export class Vec4 extends Float32Array {
|
|
|
72
72
|
* Subtracts two vec4's
|
|
73
73
|
*
|
|
74
74
|
* @param {Vec4 | Number} b the second operand
|
|
75
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
75
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
76
76
|
* @returns {Vec4} out
|
|
77
77
|
*/
|
|
78
|
-
minus(b: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
78
|
+
minus(b: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
79
79
|
if (typeof b === 'number') {
|
|
80
80
|
out[0] = this[0] - b
|
|
81
81
|
out[1] = this[1] - b
|
|
@@ -94,10 +94,10 @@ export class Vec4 extends Float32Array {
|
|
|
94
94
|
* Multiplies two vec4's
|
|
95
95
|
*
|
|
96
96
|
* @param {Vec4 | Number} b the second operand
|
|
97
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
97
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
98
98
|
* @returns {Vec4} out
|
|
99
99
|
*/
|
|
100
|
-
mult(b: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
100
|
+
mult(b: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
101
101
|
if (typeof b === 'number') {
|
|
102
102
|
out[0] = this[0] * b
|
|
103
103
|
out[1] = this[1] * b
|
|
@@ -116,10 +116,10 @@ export class Vec4 extends Float32Array {
|
|
|
116
116
|
* Divides two vec4's
|
|
117
117
|
*
|
|
118
118
|
* @param {Vec4 | Number} b the second operand
|
|
119
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
119
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
120
120
|
* @returns {Vec4} out
|
|
121
121
|
*/
|
|
122
|
-
div(b: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
122
|
+
div(b: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
123
123
|
if (typeof b === 'number') {
|
|
124
124
|
out[0] = this[0] / b
|
|
125
125
|
out[1] = this[1] / b
|
|
@@ -134,7 +134,7 @@ export class Vec4 extends Float32Array {
|
|
|
134
134
|
return out
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
invDiv(b: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
137
|
+
invDiv(b: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
138
138
|
if (typeof b === 'number') {
|
|
139
139
|
out[0] = b / this[0]
|
|
140
140
|
out[1] = b / this[1]
|
|
@@ -152,17 +152,17 @@ export class Vec4 extends Float32Array {
|
|
|
152
152
|
/**
|
|
153
153
|
* Negates the components of a vec4
|
|
154
154
|
*
|
|
155
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
155
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
156
156
|
* @returns {Vec4} out
|
|
157
157
|
*/
|
|
158
|
-
negate(out = glmaths.ALWAYS_COPY ?
|
|
158
|
+
negate(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
159
159
|
out[0] = -this[0]
|
|
160
160
|
out[1] = -this[1]
|
|
161
161
|
out[2] = -this[2]
|
|
162
162
|
out[3] = -this[3]
|
|
163
163
|
return out
|
|
164
164
|
}
|
|
165
|
-
unaryPlus(out = glmaths.ALWAYS_COPY ?
|
|
165
|
+
unaryPlus(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
166
166
|
if (out != this) {
|
|
167
167
|
out[0] = this[0]
|
|
168
168
|
out[1] = this[1]
|
|
@@ -175,10 +175,30 @@ export class Vec4 extends Float32Array {
|
|
|
175
175
|
/**
|
|
176
176
|
* Normalizes a vec4
|
|
177
177
|
*
|
|
178
|
-
* @param {Vec4}
|
|
178
|
+
* @param {Vec4} v vector to normalize
|
|
179
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
179
180
|
* @returns {Vec4} out
|
|
180
181
|
*/
|
|
181
|
-
normalize(out =
|
|
182
|
+
static normalize(v: Vec4, out = vec4()) {
|
|
183
|
+
const x = v[0], y = v[1], z = v[2], w = v[3]
|
|
184
|
+
let len = x * x + y * y + z * z + w * w
|
|
185
|
+
if (len > 0) {
|
|
186
|
+
len = 1.0 / Math.sqrt(len)
|
|
187
|
+
}
|
|
188
|
+
out[0] = x * len
|
|
189
|
+
out[1] = y * len
|
|
190
|
+
out[2] = z * len
|
|
191
|
+
out[3] = w * len
|
|
192
|
+
return out
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Normalizes a vec4
|
|
197
|
+
*
|
|
198
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
199
|
+
* @returns {Vec4} out
|
|
200
|
+
*/
|
|
201
|
+
normalize(out = glmaths.ALWAYS_COPY ? vec4() : this): Vec4 {
|
|
182
202
|
const x = this[0], y = this[1], z = this[2], w = this[3]
|
|
183
203
|
let len = x * x + y * y + z * z + w * w
|
|
184
204
|
if (len > 0) {
|
|
@@ -236,10 +256,10 @@ export class Vec4 extends Float32Array {
|
|
|
236
256
|
/**
|
|
237
257
|
* Math.floor the components of a vec4
|
|
238
258
|
*
|
|
239
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
259
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
240
260
|
* @returns {Vec4} out
|
|
241
261
|
*/
|
|
242
|
-
floor(out = glmaths.ALWAYS_COPY ?
|
|
262
|
+
floor(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
243
263
|
out[0] = Math.floor(this[0])
|
|
244
264
|
out[1] = Math.floor(this[1])
|
|
245
265
|
out[2] = Math.floor(this[2])
|
|
@@ -249,10 +269,10 @@ export class Vec4 extends Float32Array {
|
|
|
249
269
|
/**
|
|
250
270
|
* Math.round the components of a vec4
|
|
251
271
|
*
|
|
252
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
272
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
253
273
|
* @returns {Vec4} out
|
|
254
274
|
*/
|
|
255
|
-
round(out = glmaths.ALWAYS_COPY ?
|
|
275
|
+
round(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
256
276
|
out[0] = Math.round(this[0])
|
|
257
277
|
out[1] = Math.round(this[1])
|
|
258
278
|
out[2] = Math.round(this[2])
|
|
@@ -262,10 +282,10 @@ export class Vec4 extends Float32Array {
|
|
|
262
282
|
/**
|
|
263
283
|
* Math.ceil the components of a vec4
|
|
264
284
|
*
|
|
265
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
285
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
266
286
|
* @returns {Vec4} out
|
|
267
287
|
*/
|
|
268
|
-
ceil(out = glmaths.ALWAYS_COPY ?
|
|
288
|
+
ceil(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
269
289
|
out[0] = Math.ceil(this[0])
|
|
270
290
|
out[1] = Math.ceil(this[1])
|
|
271
291
|
out[2] = Math.ceil(this[2])
|
|
@@ -276,10 +296,10 @@ export class Vec4 extends Float32Array {
|
|
|
276
296
|
/**
|
|
277
297
|
* Returns the inverse of the components of a vec4
|
|
278
298
|
*
|
|
279
|
-
* @param {Vec4} out the receiving vector, defaults to
|
|
299
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
280
300
|
* @returns {Vec4} out
|
|
281
301
|
*/
|
|
282
|
-
inverse(out = glmaths.ALWAYS_COPY ?
|
|
302
|
+
inverse(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
283
303
|
out[0] = 1.0 / this[0]
|
|
284
304
|
out[1] = 1.0 / this[1]
|
|
285
305
|
out[2] = 1.0 / this[2]
|
|
@@ -288,12 +308,12 @@ export class Vec4 extends Float32Array {
|
|
|
288
308
|
}
|
|
289
309
|
|
|
290
310
|
/**
|
|
291
|
-
* Creates a
|
|
311
|
+
* Creates a vec4 initialized with values from a vector
|
|
292
312
|
*
|
|
293
|
-
* @returns {Vec4} a
|
|
313
|
+
* @returns {Vec4} a vec4
|
|
294
314
|
*/
|
|
295
315
|
clone() {
|
|
296
|
-
return
|
|
316
|
+
return vec4(this[0], this[1], this[2], this[3])
|
|
297
317
|
}
|
|
298
318
|
|
|
299
319
|
/**
|
|
@@ -309,10 +329,10 @@ export class Vec4 extends Float32Array {
|
|
|
309
329
|
* Generates a random vector with the given scale
|
|
310
330
|
*
|
|
311
331
|
* @param {Number} scale length of the resulting vector, defaults to 1.0
|
|
312
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
332
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
313
333
|
* @returns {Vec4} out
|
|
314
334
|
*/
|
|
315
|
-
static random(scale = 1.0, out =
|
|
335
|
+
static random(scale = 1.0, out = vec4()) {
|
|
316
336
|
// Marsaglia, George. Choosing a Point from the Surface of a
|
|
317
337
|
// Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.
|
|
318
338
|
// http://projecteuclid.org/euclid.aoms/1177692644;
|
|
@@ -354,10 +374,10 @@ export class Vec4 extends Float32Array {
|
|
|
354
374
|
* @param {Vec4} u the first operand
|
|
355
375
|
* @param {Vec4} v the second operand
|
|
356
376
|
* @param {Vec4} w the third operand
|
|
357
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
377
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
358
378
|
* @returns {Vec4} out
|
|
359
379
|
*/
|
|
360
|
-
static cross(u: Vec4, v: Vec4, w: Vec4, out =
|
|
380
|
+
static cross(u: Vec4, v: Vec4, w: Vec4, out = vec4()): Vec4 {
|
|
361
381
|
const A = v[0] * w[1] - v[1] * w[0],
|
|
362
382
|
B = v[0] * w[2] - v[2] * w[0],
|
|
363
383
|
C = v[0] * w[3] - v[3] * w[0],
|
|
@@ -410,10 +430,10 @@ export class Vec4 extends Float32Array {
|
|
|
410
430
|
* @param {Vec4} a the first operand
|
|
411
431
|
* @param {Vec4} b the second operand
|
|
412
432
|
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
413
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
433
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
414
434
|
* @returns {Vec4} out
|
|
415
435
|
*/
|
|
416
|
-
static lerp(a: Vec4, b: Vec4, t: number, out =
|
|
436
|
+
static lerp(a: Vec4, b: Vec4, t: number, out = vec4()) {
|
|
417
437
|
const ax = a[0], ay = a[1], az = a[2], aw = a[3]
|
|
418
438
|
out[0] = ax + (b[0] - ax) * t
|
|
419
439
|
out[1] = ay + (b[1] - ay) * t
|
|
@@ -427,10 +447,10 @@ export class Vec4 extends Float32Array {
|
|
|
427
447
|
*
|
|
428
448
|
* @param {Vec4} a the first operand
|
|
429
449
|
* @param {Vec4} b the second operand
|
|
430
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
450
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
431
451
|
* @returns {Vec4} out
|
|
432
452
|
*/
|
|
433
|
-
static max(a: Vec4, b: Vec4, out =
|
|
453
|
+
static max(a: Vec4, b: Vec4, out = vec4()) {
|
|
434
454
|
out[0] = Math.max(a[0], b[0])
|
|
435
455
|
out[1] = Math.max(a[1], b[1])
|
|
436
456
|
out[2] = Math.max(a[2], b[2])
|
|
@@ -442,10 +462,10 @@ export class Vec4 extends Float32Array {
|
|
|
442
462
|
*
|
|
443
463
|
* @param {Vec4} a the first operand
|
|
444
464
|
* @param {Vec4} b the second operand
|
|
445
|
-
* @param {Vec4} out the receiving vector, defaults to new
|
|
465
|
+
* @param {Vec4} out the receiving vector, defaults to new vec4()
|
|
446
466
|
* @returns {Vec4} out
|
|
447
467
|
*/
|
|
448
|
-
static min(a: Vec4, b: Vec4, out =
|
|
468
|
+
static min(a: Vec4, b: Vec4, out = vec4()) {
|
|
449
469
|
out[0] = Math.min(a[0], b[0])
|
|
450
470
|
out[1] = Math.min(a[1], b[1])
|
|
451
471
|
out[2] = Math.min(a[2], b[2])
|
|
@@ -462,7 +482,7 @@ export class Vec4 extends Float32Array {
|
|
|
462
482
|
* @param {Vec4} out the receiving vector
|
|
463
483
|
* @returns {Vec4} out
|
|
464
484
|
*/
|
|
465
|
-
static clamp(v: Vec4, min: Vec4 | number, max: Vec4 | number, out =
|
|
485
|
+
static clamp(v: Vec4, min: Vec4 | number, max: Vec4 | number, out = vec4()) {
|
|
466
486
|
const minX = typeof min === 'number' ? min : min[0]
|
|
467
487
|
const minY = typeof min === 'number' ? min : min[1]
|
|
468
488
|
const minZ = typeof min === 'number' ? min : min[2]
|
|
@@ -487,7 +507,7 @@ export class Vec4 extends Float32Array {
|
|
|
487
507
|
* @param {Vec4} out the receiving vector
|
|
488
508
|
* @returns {Vec4} out
|
|
489
509
|
*/
|
|
490
|
-
static mix(a: Vec4, b: Vec4, t: Vec4 | number, out =
|
|
510
|
+
static mix(a: Vec4, b: Vec4, t: Vec4 | number, out = vec4()) {
|
|
491
511
|
if (typeof t === 'number') {
|
|
492
512
|
out[0] = a[0] + (b[0] - a[0]) * t
|
|
493
513
|
out[1] = a[1] + (b[1] - a[1]) * t
|
|
@@ -511,7 +531,7 @@ export class Vec4 extends Float32Array {
|
|
|
511
531
|
* @param {Vec4} out the receiving vector
|
|
512
532
|
* @returns {Vec4} out
|
|
513
533
|
*/
|
|
514
|
-
static smoothstep(edge0: Vec4 | number, edge1: Vec4 | number, v: Vec4, out =
|
|
534
|
+
static smoothstep(edge0: Vec4 | number, edge1: Vec4 | number, v: Vec4, out = vec4()) {
|
|
515
535
|
const e0x = typeof edge0 === 'number' ? edge0 : edge0[0]
|
|
516
536
|
const e0y = typeof edge0 === 'number' ? edge0 : edge0[1]
|
|
517
537
|
const e0z = typeof edge0 === 'number' ? edge0 : edge0[2]
|
|
@@ -539,7 +559,7 @@ export class Vec4 extends Float32Array {
|
|
|
539
559
|
* @param {Vec4} out the receiving vector
|
|
540
560
|
* @returns {Vec4} out
|
|
541
561
|
*/
|
|
542
|
-
scaleAndAdd(b: Vec4, scale: number, out = glmaths.ALWAYS_COPY ?
|
|
562
|
+
scaleAndAdd(b: Vec4, scale: number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
543
563
|
out[0] = this[0] + b[0] * scale
|
|
544
564
|
out[1] = this[1] + b[1] * scale
|
|
545
565
|
out[2] = this[2] + b[2] * scale
|
|
@@ -553,7 +573,7 @@ export class Vec4 extends Float32Array {
|
|
|
553
573
|
* @param {Vec4} out the receiving vector
|
|
554
574
|
* @returns {Vec4} out
|
|
555
575
|
*/
|
|
556
|
-
abs(out = glmaths.ALWAYS_COPY ?
|
|
576
|
+
abs(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
557
577
|
out[0] = Math.abs(this[0])
|
|
558
578
|
out[1] = Math.abs(this[1])
|
|
559
579
|
out[2] = Math.abs(this[2])
|
|
@@ -569,7 +589,7 @@ export class Vec4 extends Float32Array {
|
|
|
569
589
|
* @param {Vec4} out the receiving vector
|
|
570
590
|
* @returns {Vec4} out
|
|
571
591
|
*/
|
|
572
|
-
clamp(min: Vec4 | number, max: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
592
|
+
clamp(min: Vec4 | number, max: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
573
593
|
const minX = typeof min === 'number' ? min : min[0]
|
|
574
594
|
const minY = typeof min === 'number' ? min : min[1]
|
|
575
595
|
const minZ = typeof min === 'number' ? min : min[2]
|
|
@@ -593,7 +613,7 @@ export class Vec4 extends Float32Array {
|
|
|
593
613
|
* @param {Vec4} out the receiving vector
|
|
594
614
|
* @returns {Vec4} out
|
|
595
615
|
*/
|
|
596
|
-
mix(b: Vec4, t: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
616
|
+
mix(b: Vec4, t: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
597
617
|
if (typeof t === 'number') {
|
|
598
618
|
out[0] = this[0] + (b[0] - this[0]) * t
|
|
599
619
|
out[1] = this[1] + (b[1] - this[1]) * t
|
|
@@ -615,7 +635,7 @@ export class Vec4 extends Float32Array {
|
|
|
615
635
|
* @param {Vec4} out the receiving vector
|
|
616
636
|
* @returns {Vec4} out
|
|
617
637
|
*/
|
|
618
|
-
step(edge: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
638
|
+
step(edge: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
619
639
|
if (typeof edge === 'number') {
|
|
620
640
|
out[0] = this[0] < edge ? 0 : 1
|
|
621
641
|
out[1] = this[1] < edge ? 0 : 1
|
|
@@ -638,7 +658,7 @@ export class Vec4 extends Float32Array {
|
|
|
638
658
|
* @param {Vec4} out the receiving vector
|
|
639
659
|
* @returns {Vec4} out
|
|
640
660
|
*/
|
|
641
|
-
smoothstep(edge0: Vec4 | number, edge1: Vec4 | number, out = glmaths.ALWAYS_COPY ?
|
|
661
|
+
smoothstep(edge0: Vec4 | number, edge1: Vec4 | number, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
642
662
|
const e0x = typeof edge0 === 'number' ? edge0 : edge0[0]
|
|
643
663
|
const e0y = typeof edge0 === 'number' ? edge0 : edge0[1]
|
|
644
664
|
const e0z = typeof edge0 === 'number' ? edge0 : edge0[2]
|
|
@@ -664,7 +684,7 @@ export class Vec4 extends Float32Array {
|
|
|
664
684
|
* @param {Vec4} out the receiving vector
|
|
665
685
|
* @returns {Vec4} out
|
|
666
686
|
*/
|
|
667
|
-
fract(out = glmaths.ALWAYS_COPY ?
|
|
687
|
+
fract(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
668
688
|
out[0] = this[0] - Math.floor(this[0])
|
|
669
689
|
out[1] = this[1] - Math.floor(this[1])
|
|
670
690
|
out[2] = this[2] - Math.floor(this[2])
|
|
@@ -678,7 +698,7 @@ export class Vec4 extends Float32Array {
|
|
|
678
698
|
* @param {Vec4} out the receiving vector
|
|
679
699
|
* @returns {Vec4} out
|
|
680
700
|
*/
|
|
681
|
-
sign(out = glmaths.ALWAYS_COPY ?
|
|
701
|
+
sign(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
682
702
|
out[0] = this[0] > 0 ? 1 : this[0] < 0 ? -1 : 0
|
|
683
703
|
out[1] = this[1] > 0 ? 1 : this[1] < 0 ? -1 : 0
|
|
684
704
|
out[2] = this[2] > 0 ? 1 : this[2] < 0 ? -1 : 0
|
|
@@ -692,7 +712,7 @@ export class Vec4 extends Float32Array {
|
|
|
692
712
|
* @param {Vec4} out the receiving vector
|
|
693
713
|
* @returns {Vec4} out
|
|
694
714
|
*/
|
|
695
|
-
saturate(out = glmaths.ALWAYS_COPY ?
|
|
715
|
+
saturate(out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
696
716
|
out[0] = Math.min(Math.max(this[0], 0), 1)
|
|
697
717
|
out[1] = Math.min(Math.max(this[1], 0), 1)
|
|
698
718
|
out[2] = Math.min(Math.max(this[2], 0), 1)
|
|
@@ -707,7 +727,7 @@ export class Vec4 extends Float32Array {
|
|
|
707
727
|
* @param {Vec4} out the receiving vector
|
|
708
728
|
* @returns {Vec4} out
|
|
709
729
|
*/
|
|
710
|
-
transformMat4(m: Mat4, out = glmaths.ALWAYS_COPY ?
|
|
730
|
+
transformMat4(m: Mat4, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
711
731
|
const x = this[0], y = this[1], z = this[2], w = this[3]
|
|
712
732
|
out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w
|
|
713
733
|
out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w
|
|
@@ -723,7 +743,7 @@ export class Vec4 extends Float32Array {
|
|
|
723
743
|
* @param {Vec4} out the receiving vector
|
|
724
744
|
* @returns {Vec4} out
|
|
725
745
|
*/
|
|
726
|
-
transformQuat(q: Quat, out = glmaths.ALWAYS_COPY ?
|
|
746
|
+
transformQuat(q: Quat, out = glmaths.ALWAYS_COPY ? vec4() : this) {
|
|
727
747
|
const qx = q[0], qy = q[1], qz = q[2], qw = q[3]
|
|
728
748
|
const x = this[0], y = this[1], z = this[2]
|
|
729
749
|
let uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x
|
|
@@ -747,7 +767,7 @@ export class Vec4 extends Float32Array {
|
|
|
747
767
|
* @param {Vec4} out the receiving vector
|
|
748
768
|
* @returns {Vec4} out
|
|
749
769
|
*/
|
|
750
|
-
static scaleAndAdd(a: Vec4, b: Vec4, scale: number, out =
|
|
770
|
+
static scaleAndAdd(a: Vec4, b: Vec4, scale: number, out = vec4()) {
|
|
751
771
|
out[0] = a[0] + b[0] * scale
|
|
752
772
|
out[1] = a[1] + b[1] * scale
|
|
753
773
|
out[2] = a[2] + b[2] * scale
|
|
@@ -770,6 +790,7 @@ export interface Vec4 {
|
|
|
770
790
|
sqrLen: () => number
|
|
771
791
|
str: () => string
|
|
772
792
|
transformMat4x4: (m: Mat4, out?: Vec4) => Vec4
|
|
793
|
+
normalized: (out?: Vec4) => Vec4
|
|
773
794
|
|
|
774
795
|
// Auto-generated
|
|
775
796
|
x0: Vec2; x1: Vec2; xx: Vec2; xy: Vec2; y0: Vec2; y1: Vec2; yx: Vec2; yy: Vec2; x00: Vec3; x01: Vec3; x0x: Vec3; x0y: Vec3; x0z: Vec3; x10: Vec3; x11: Vec3; x1x: Vec3; x1y: Vec3; x1z: Vec3; xx0: Vec3; xx1: Vec3; xxx: Vec3; xxy: Vec3; xxz: Vec3; xy0: Vec3; xy1: Vec3; xyx: Vec3; xyy: Vec3; xyz: Vec3; xz0: Vec3; xz1: Vec3; xzx: Vec3; xzy: Vec3; xzz: Vec3; y00: Vec3; y01: Vec3; y0x: Vec3; y0y: Vec3; y0z: Vec3; y10: Vec3; y11: Vec3; y1x: Vec3; y1y: Vec3; y1z: Vec3; yx0: Vec3; yx1: Vec3; yxx: Vec3; yxy: Vec3; yxz: Vec3; yy0: Vec3; yy1: Vec3; yyx: Vec3; yyy: Vec3; yyz: Vec3; yz0: Vec3; yz1: Vec3; yzx: Vec3; yzy: Vec3; yzz: Vec3; z00: Vec3; z01: Vec3; z0x: Vec3; z0y: Vec3; z0z: Vec3; z10: Vec3; z11: Vec3; z1x: Vec3; z1y: Vec3; z1z: Vec3; zx0: Vec3; zx1: Vec3; zxx: Vec3; zxy: Vec3; zxz: Vec3; zy0: Vec3; zy1: Vec3; zyx: Vec3; zyy: Vec3; zyz: Vec3; zz0: Vec3; zz1: Vec3; zzx: Vec3; zzy: Vec3; zzz: Vec3; x000: Vec4; x001: Vec4; x00x: Vec4; x00y: Vec4; x00z: Vec4; x00w: Vec4; x010: Vec4; x011: Vec4; x01x: Vec4; x01y: Vec4; x01z: Vec4; x01w: Vec4; x0x0: Vec4; x0x1: Vec4; x0xx: Vec4; x0xy: Vec4; x0xz: Vec4; x0xw: Vec4; x0y0: Vec4; x0y1: Vec4; x0yx: Vec4; x0yy: Vec4; x0yz: Vec4; x0yw: Vec4; x0z0: Vec4; x0z1: Vec4; x0zx: Vec4; x0zy: Vec4; x0zz: Vec4; x0zw: Vec4; x0w0: Vec4; x0w1: Vec4; x0wx: Vec4; x0wy: Vec4; x0wz: Vec4; x0ww: Vec4; x100: Vec4; x101: Vec4; x10x: Vec4; x10y: Vec4; x10z: Vec4; x10w: Vec4; x110: Vec4; x111: Vec4; x11x: Vec4; x11y: Vec4; x11z: Vec4; x11w: Vec4; x1x0: Vec4; x1x1: Vec4; x1xx: Vec4; x1xy: Vec4; x1xz: Vec4; x1xw: Vec4; x1y0: Vec4; x1y1: Vec4; x1yx: Vec4; x1yy: Vec4; x1yz: Vec4; x1yw: Vec4; x1z0: Vec4; x1z1: Vec4; x1zx: Vec4; x1zy: Vec4; x1zz: Vec4; x1zw: Vec4; x1w0: Vec4; x1w1: Vec4; x1wx: Vec4; x1wy: Vec4; x1wz: Vec4; x1ww: Vec4; xx00: Vec4; xx01: Vec4; xx0x: Vec4; xx0y: Vec4; xx0z: Vec4; xx0w: Vec4; xx10: Vec4; xx11: Vec4; xx1x: Vec4; xx1y: Vec4; xx1z: Vec4; xx1w: Vec4; xxx0: Vec4; xxx1: Vec4; xxxx: Vec4; xxxy: Vec4; xxxz: Vec4; xxxw: Vec4; xxy0: Vec4; xxy1: Vec4; xxyx: Vec4; xxyy: Vec4; xxyz: Vec4; xxyw: Vec4; xxz0: Vec4; xxz1: Vec4; xxzx: Vec4; xxzy: Vec4; xxzz: Vec4; xxzw: Vec4; xxw0: Vec4; xxw1: Vec4; xxwx: Vec4; xxwy: Vec4; xxwz: Vec4; xxww: Vec4; xy00: Vec4; xy01: Vec4; xy0x: Vec4; xy0y: Vec4; xy0z: Vec4; xy0w: Vec4; xy10: Vec4; xy11: Vec4; xy1x: Vec4; xy1y: Vec4; xy1z: Vec4; xy1w: Vec4; xyx0: Vec4; xyx1: Vec4; xyxx: Vec4; xyxy: Vec4; xyxz: Vec4; xyxw: Vec4; xyy0: Vec4; xyy1: Vec4; xyyx: Vec4; xyyy: Vec4; xyyz: Vec4; xyyw: Vec4; xyz0: Vec4; xyz1: Vec4; xyzx: Vec4; xyzy: Vec4; xyzz: Vec4; xyzw: Vec4; xyw0: Vec4; xyw1: Vec4; xywx: Vec4; xywy: Vec4; xywz: Vec4; xyww: Vec4; xz00: Vec4; xz01: Vec4; xz0x: Vec4; xz0y: Vec4; xz0z: Vec4; xz0w: Vec4; xz10: Vec4; xz11: Vec4; xz1x: Vec4; xz1y: Vec4; xz1z: Vec4; xz1w: Vec4; xzx0: Vec4; xzx1: Vec4; xzxx: Vec4; xzxy: Vec4; xzxz: Vec4; xzxw: Vec4; xzy0: Vec4; xzy1: Vec4; xzyx: Vec4; xzyy: Vec4; xzyz: Vec4; xzyw: Vec4; xzz0: Vec4; xzz1: Vec4; xzzx: Vec4; xzzy: Vec4; xzzz: Vec4; xzzw: Vec4; xzw0: Vec4; xzw1: Vec4; xzwx: Vec4; xzwy: Vec4; xzwz: Vec4; xzww: Vec4; xw00: Vec4; xw01: Vec4; xw0x: Vec4; xw0y: Vec4; xw0z: Vec4; xw0w: Vec4; xw10: Vec4; xw11: Vec4; xw1x: Vec4; xw1y: Vec4; xw1z: Vec4; xw1w: Vec4; xwx0: Vec4; xwx1: Vec4; xwxx: Vec4; xwxy: Vec4; xwxz: Vec4; xwxw: Vec4; xwy0: Vec4; xwy1: Vec4; xwyx: Vec4; xwyy: Vec4; xwyz: Vec4; xwyw: Vec4; xwz0: Vec4; xwz1: Vec4; xwzx: Vec4; xwzy: Vec4; xwzz: Vec4; xwzw: Vec4; xww0: Vec4; xww1: Vec4; xwwx: Vec4; xwwy: Vec4; xwwz: Vec4; xwww: Vec4; y000: Vec4; y001: Vec4; y00x: Vec4; y00y: Vec4; y00z: Vec4; y00w: Vec4; y010: Vec4; y011: Vec4; y01x: Vec4; y01y: Vec4; y01z: Vec4; y01w: Vec4; y0x0: Vec4; y0x1: Vec4; y0xx: Vec4; y0xy: Vec4; y0xz: Vec4; y0xw: Vec4; y0y0: Vec4; y0y1: Vec4; y0yx: Vec4; y0yy: Vec4; y0yz: Vec4; y0yw: Vec4; y0z0: Vec4; y0z1: Vec4; y0zx: Vec4; y0zy: Vec4; y0zz: Vec4; y0zw: Vec4; y0w0: Vec4; y0w1: Vec4; y0wx: Vec4; y0wy: Vec4; y0wz: Vec4; y0ww: Vec4; y100: Vec4; y101: Vec4; y10x: Vec4; y10y: Vec4; y10z: Vec4; y10w: Vec4; y110: Vec4; y111: Vec4; y11x: Vec4; y11y: Vec4; y11z: Vec4; y11w: Vec4; y1x0: Vec4; y1x1: Vec4; y1xx: Vec4; y1xy: Vec4; y1xz: Vec4; y1xw: Vec4; y1y0: Vec4; y1y1: Vec4; y1yx: Vec4; y1yy: Vec4; y1yz: Vec4; y1yw: Vec4; y1z0: Vec4; y1z1: Vec4; y1zx: Vec4; y1zy: Vec4; y1zz: Vec4; y1zw: Vec4; y1w0: Vec4; y1w1: Vec4; y1wx: Vec4; y1wy: Vec4; y1wz: Vec4; y1ww: Vec4; yx00: Vec4; yx01: Vec4; yx0x: Vec4; yx0y: Vec4; yx0z: Vec4; yx0w: Vec4; yx10: Vec4; yx11: Vec4; yx1x: Vec4; yx1y: Vec4; yx1z: Vec4; yx1w: Vec4; yxx0: Vec4; yxx1: Vec4; yxxx: Vec4; yxxy: Vec4; yxxz: Vec4; yxxw: Vec4; yxy0: Vec4; yxy1: Vec4; yxyx: Vec4; yxyy: Vec4; yxyz: Vec4; yxyw: Vec4; yxz0: Vec4; yxz1: Vec4; yxzx: Vec4; yxzy: Vec4; yxzz: Vec4; yxzw: Vec4; yxw0: Vec4; yxw1: Vec4; yxwx: Vec4; yxwy: Vec4; yxwz: Vec4; yxww: Vec4; yy00: Vec4; yy01: Vec4; yy0x: Vec4; yy0y: Vec4; yy0z: Vec4; yy0w: Vec4; yy10: Vec4; yy11: Vec4; yy1x: Vec4; yy1y: Vec4; yy1z: Vec4; yy1w: Vec4; yyx0: Vec4; yyx1: Vec4; yyxx: Vec4; yyxy: Vec4; yyxz: Vec4; yyxw: Vec4; yyy0: Vec4; yyy1: Vec4; yyyx: Vec4; yyyy: Vec4; yyyz: Vec4; yyyw: Vec4; yyz0: Vec4; yyz1: Vec4; yyzx: Vec4; yyzy: Vec4; yyzz: Vec4; yyzw: Vec4; yyw0: Vec4; yyw1: Vec4; yywx: Vec4; yywy: Vec4; yywz: Vec4; yyww: Vec4; yz00: Vec4; yz01: Vec4; yz0x: Vec4; yz0y: Vec4; yz0z: Vec4; yz0w: Vec4; yz10: Vec4; yz11: Vec4; yz1x: Vec4; yz1y: Vec4; yz1z: Vec4; yz1w: Vec4; yzx0: Vec4; yzx1: Vec4; yzxx: Vec4; yzxy: Vec4; yzxz: Vec4; yzxw: Vec4; yzy0: Vec4; yzy1: Vec4; yzyx: Vec4; yzyy: Vec4; yzyz: Vec4; yzyw: Vec4; yzz0: Vec4; yzz1: Vec4; yzzx: Vec4; yzzy: Vec4; yzzz: Vec4; yzzw: Vec4; yzw0: Vec4; yzw1: Vec4; yzwx: Vec4; yzwy: Vec4; yzwz: Vec4; yzww: Vec4; yw00: Vec4; yw01: Vec4; yw0x: Vec4; yw0y: Vec4; yw0z: Vec4; yw0w: Vec4; yw10: Vec4; yw11: Vec4; yw1x: Vec4; yw1y: Vec4; yw1z: Vec4; yw1w: Vec4; ywx0: Vec4; ywx1: Vec4; ywxx: Vec4; ywxy: Vec4; ywxz: Vec4; ywxw: Vec4; ywy0: Vec4; ywy1: Vec4; ywyx: Vec4; ywyy: Vec4; ywyz: Vec4; ywyw: Vec4; ywz0: Vec4; ywz1: Vec4; ywzx: Vec4; ywzy: Vec4; ywzz: Vec4; ywzw: Vec4; yww0: Vec4; yww1: Vec4; ywwx: Vec4; ywwy: Vec4; ywwz: Vec4; ywww: Vec4; z000: Vec4; z001: Vec4; z00x: Vec4; z00y: Vec4; z00z: Vec4; z00w: Vec4; z010: Vec4; z011: Vec4; z01x: Vec4; z01y: Vec4; z01z: Vec4; z01w: Vec4; z0x0: Vec4; z0x1: Vec4; z0xx: Vec4; z0xy: Vec4; z0xz: Vec4; z0xw: Vec4; z0y0: Vec4; z0y1: Vec4; z0yx: Vec4; z0yy: Vec4; z0yz: Vec4; z0yw: Vec4; z0z0: Vec4; z0z1: Vec4; z0zx: Vec4; z0zy: Vec4; z0zz: Vec4; z0zw: Vec4; z0w0: Vec4; z0w1: Vec4; z0wx: Vec4; z0wy: Vec4; z0wz: Vec4; z0ww: Vec4; z100: Vec4; z101: Vec4; z10x: Vec4; z10y: Vec4; z10z: Vec4; z10w: Vec4; z110: Vec4; z111: Vec4; z11x: Vec4; z11y: Vec4; z11z: Vec4; z11w: Vec4; z1x0: Vec4; z1x1: Vec4; z1xx: Vec4; z1xy: Vec4; z1xz: Vec4; z1xw: Vec4; z1y0: Vec4; z1y1: Vec4; z1yx: Vec4; z1yy: Vec4; z1yz: Vec4; z1yw: Vec4; z1z0: Vec4; z1z1: Vec4; z1zx: Vec4; z1zy: Vec4; z1zz: Vec4; z1zw: Vec4; z1w0: Vec4; z1w1: Vec4; z1wx: Vec4; z1wy: Vec4; z1wz: Vec4; z1ww: Vec4; zx00: Vec4; zx01: Vec4; zx0x: Vec4; zx0y: Vec4; zx0z: Vec4; zx0w: Vec4; zx10: Vec4; zx11: Vec4; zx1x: Vec4; zx1y: Vec4; zx1z: Vec4; zx1w: Vec4; zxx0: Vec4; zxx1: Vec4; zxxx: Vec4; zxxy: Vec4; zxxz: Vec4; zxxw: Vec4; zxy0: Vec4; zxy1: Vec4; zxyx: Vec4; zxyy: Vec4; zxyz: Vec4; zxyw: Vec4; zxz0: Vec4; zxz1: Vec4; zxzx: Vec4; zxzy: Vec4; zxzz: Vec4; zxzw: Vec4; zxw0: Vec4; zxw1: Vec4; zxwx: Vec4; zxwy: Vec4; zxwz: Vec4; zxww: Vec4; zy00: Vec4; zy01: Vec4; zy0x: Vec4; zy0y: Vec4; zy0z: Vec4; zy0w: Vec4; zy10: Vec4; zy11: Vec4; zy1x: Vec4; zy1y: Vec4; zy1z: Vec4; zy1w: Vec4; zyx0: Vec4; zyx1: Vec4; zyxx: Vec4; zyxy: Vec4; zyxz: Vec4; zyxw: Vec4; zyy0: Vec4; zyy1: Vec4; zyyx: Vec4; zyyy: Vec4; zyyz: Vec4; zyyw: Vec4; zyz0: Vec4; zyz1: Vec4; zyzx: Vec4; zyzy: Vec4; zyzz: Vec4; zyzw: Vec4; zyw0: Vec4; zyw1: Vec4; zywx: Vec4; zywy: Vec4; zywz: Vec4; zyww: Vec4; zz00: Vec4; zz01: Vec4; zz0x: Vec4; zz0y: Vec4; zz0z: Vec4; zz0w: Vec4; zz10: Vec4; zz11: Vec4; zz1x: Vec4; zz1y: Vec4; zz1z: Vec4; zz1w: Vec4; zzx0: Vec4; zzx1: Vec4; zzxx: Vec4; zzxy: Vec4; zzxz: Vec4; zzxw: Vec4; zzy0: Vec4; zzy1: Vec4; zzyx: Vec4; zzyy: Vec4; zzyz: Vec4; zzyw: Vec4; zzz0: Vec4; zzz1: Vec4; zzzx: Vec4; zzzy: Vec4; zzzz: Vec4; zzzw: Vec4; zzw0: Vec4; zzw1: Vec4; zzwx: Vec4; zzwy: Vec4; zzwz: Vec4; zzww: Vec4; zw00: Vec4; zw01: Vec4; zw0x: Vec4; zw0y: Vec4; zw0z: Vec4; zw0w: Vec4; zw10: Vec4; zw11: Vec4; zw1x: Vec4; zw1y: Vec4; zw1z: Vec4; zw1w: Vec4; zwx0: Vec4; zwx1: Vec4; zwxx: Vec4; zwxy: Vec4; zwxz: Vec4; zwxw: Vec4; zwy0: Vec4; zwy1: Vec4; zwyx: Vec4; zwyy: Vec4; zwyz: Vec4; zwyw: Vec4; zwz0: Vec4; zwz1: Vec4; zwzx: Vec4; zwzy: Vec4; zwzz: Vec4; zwzw: Vec4; zww0: Vec4; zww1: Vec4; zwwx: Vec4; zwwy: Vec4; zwwz: Vec4; zwww: Vec4; w000: Vec4; w001: Vec4; w00x: Vec4; w00y: Vec4; w00z: Vec4; w00w: Vec4; w010: Vec4; w011: Vec4; w01x: Vec4; w01y: Vec4; w01z: Vec4; w01w: Vec4; w0x0: Vec4; w0x1: Vec4; w0xx: Vec4; w0xy: Vec4; w0xz: Vec4; w0xw: Vec4; w0y0: Vec4; w0y1: Vec4; w0yx: Vec4; w0yy: Vec4; w0yz: Vec4; w0yw: Vec4; w0z0: Vec4; w0z1: Vec4; w0zx: Vec4; w0zy: Vec4; w0zz: Vec4; w0zw: Vec4; w0w0: Vec4; w0w1: Vec4; w0wx: Vec4; w0wy: Vec4; w0wz: Vec4; w0ww: Vec4; w100: Vec4; w101: Vec4; w10x: Vec4; w10y: Vec4; w10z: Vec4; w10w: Vec4; w110: Vec4; w111: Vec4; w11x: Vec4; w11y: Vec4; w11z: Vec4; w11w: Vec4; w1x0: Vec4; w1x1: Vec4; w1xx: Vec4; w1xy: Vec4; w1xz: Vec4; w1xw: Vec4; w1y0: Vec4; w1y1: Vec4; w1yx: Vec4; w1yy: Vec4; w1yz: Vec4; w1yw: Vec4; w1z0: Vec4; w1z1: Vec4; w1zx: Vec4; w1zy: Vec4; w1zz: Vec4; w1zw: Vec4; w1w0: Vec4; w1w1: Vec4; w1wx: Vec4; w1wy: Vec4; w1wz: Vec4; w1ww: Vec4; wx00: Vec4; wx01: Vec4; wx0x: Vec4; wx0y: Vec4; wx0z: Vec4; wx0w: Vec4; wx10: Vec4; wx11: Vec4; wx1x: Vec4; wx1y: Vec4; wx1z: Vec4; wx1w: Vec4; wxx0: Vec4; wxx1: Vec4; wxxx: Vec4; wxxy: Vec4; wxxz: Vec4; wxxw: Vec4; wxy0: Vec4; wxy1: Vec4; wxyx: Vec4; wxyy: Vec4; wxyz: Vec4; wxyw: Vec4; wxz0: Vec4; wxz1: Vec4; wxzx: Vec4; wxzy: Vec4; wxzz: Vec4; wxzw: Vec4; wxw0: Vec4; wxw1: Vec4; wxwx: Vec4; wxwy: Vec4; wxwz: Vec4; wxww: Vec4; wy00: Vec4; wy01: Vec4; wy0x: Vec4; wy0y: Vec4; wy0z: Vec4; wy0w: Vec4; wy10: Vec4; wy11: Vec4; wy1x: Vec4; wy1y: Vec4; wy1z: Vec4; wy1w: Vec4; wyx0: Vec4; wyx1: Vec4; wyxx: Vec4; wyxy: Vec4; wyxz: Vec4; wyxw: Vec4; wyy0: Vec4; wyy1: Vec4; wyyx: Vec4; wyyy: Vec4; wyyz: Vec4; wyyw: Vec4; wyz0: Vec4; wyz1: Vec4; wyzx: Vec4; wyzy: Vec4; wyzz: Vec4; wyzw: Vec4; wyw0: Vec4; wyw1: Vec4; wywx: Vec4; wywy: Vec4; wywz: Vec4; wyww: Vec4; wz00: Vec4; wz01: Vec4; wz0x: Vec4; wz0y: Vec4; wz0z: Vec4; wz0w: Vec4; wz10: Vec4; wz11: Vec4; wz1x: Vec4; wz1y: Vec4; wz1z: Vec4; wz1w: Vec4; wzx0: Vec4; wzx1: Vec4; wzxx: Vec4; wzxy: Vec4; wzxz: Vec4; wzxw: Vec4; wzy0: Vec4; wzy1: Vec4; wzyx: Vec4; wzyy: Vec4; wzyz: Vec4; wzyw: Vec4; wzz0: Vec4; wzz1: Vec4; wzzx: Vec4; wzzy: Vec4; wzzz: Vec4; wzzw: Vec4; wzw0: Vec4; wzw1: Vec4; wzwx: Vec4; wzwy: Vec4; wzwz: Vec4; wzww: Vec4; ww00: Vec4; ww01: Vec4; ww0x: Vec4; ww0y: Vec4; ww0z: Vec4; ww0w: Vec4; ww10: Vec4; ww11: Vec4; ww1x: Vec4; ww1y: Vec4; ww1z: Vec4; ww1w: Vec4; wwx0: Vec4; wwx1: Vec4; wwxx: Vec4; wwxy: Vec4; wwxz: Vec4; wwxw: Vec4; wwy0: Vec4; wwy1: Vec4; wwyx: Vec4; wwyy: Vec4; wwyz: Vec4; wwyw: Vec4; wwz0: Vec4; wwz1: Vec4; wwzx: Vec4; wwzy: Vec4; wwzz: Vec4; wwzw: Vec4; www0: Vec4; www1: Vec4; wwwx: Vec4; wwwy: Vec4; wwwz: Vec4; wwww: Vec4;
|
|
@@ -794,6 +815,7 @@ Vec4.prototype.neg = Vec4.prototype.negate
|
|
|
794
815
|
Vec4.prototype.unaryMinus = Vec4.prototype.negate
|
|
795
816
|
Vec4.prototype.sqrLen = Vec4.prototype.squaredLength
|
|
796
817
|
Vec4.prototype.str = Vec4.prototype.toString
|
|
818
|
+
Vec4.prototype.normalized = Vec4.prototype.normalize
|
|
797
819
|
Vec4.prototype.transformMat4x4 = Vec4.prototype.transformMat4
|
|
798
820
|
|
|
799
821
|
const createVec4 = (...args: (number | Float32Array)[]): Vec4 => {
|