@math.gl/core 5.0.0-alpha.1 → 5.0.0-alpha.10

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.
Files changed (111) hide show
  1. package/dist/classes/base/math-array.d.ts +0 -18
  2. package/dist/classes/base/math-array.d.ts.map +1 -1
  3. package/dist/classes/base/math-array.js +0 -51
  4. package/dist/classes/base/math-array.js.map +1 -1
  5. package/dist/classes/base/vector.d.ts.map +1 -1
  6. package/dist/classes/base/vector.js +4 -2
  7. package/dist/classes/base/vector.js.map +1 -1
  8. package/dist/classes/euler-types.d.ts +10 -0
  9. package/dist/classes/euler-types.d.ts.map +1 -0
  10. package/dist/classes/euler-types.js +5 -0
  11. package/dist/classes/euler-types.js.map +1 -0
  12. package/dist/classes/euler.d.ts +4 -36
  13. package/dist/classes/euler.d.ts.map +1 -1
  14. package/dist/classes/euler.js +8 -102
  15. package/dist/classes/euler.js.map +1 -1
  16. package/dist/classes/matrix3.d.ts +2 -8
  17. package/dist/classes/matrix3.d.ts.map +1 -1
  18. package/dist/classes/matrix3.js +5 -16
  19. package/dist/classes/matrix3.js.map +1 -1
  20. package/dist/classes/matrix4.d.ts +7 -6
  21. package/dist/classes/matrix4.d.ts.map +1 -1
  22. package/dist/classes/matrix4.js +8 -12
  23. package/dist/classes/matrix4.js.map +1 -1
  24. package/dist/classes/quaternion.d.ts +7 -6
  25. package/dist/classes/quaternion.d.ts.map +1 -1
  26. package/dist/classes/quaternion.js +25 -17
  27. package/dist/classes/quaternion.js.map +1 -1
  28. package/dist/classes/spherical-coordinates.d.ts +3 -4
  29. package/dist/classes/spherical-coordinates.d.ts.map +1 -1
  30. package/dist/classes/spherical-coordinates.js +10 -8
  31. package/dist/classes/spherical-coordinates.js.map +1 -1
  32. package/dist/gl-matrix/quat.js +3 -3
  33. package/dist/gl-matrix/quat.js.map +1 -1
  34. package/dist/gl-matrix/vec2.js +1 -1
  35. package/dist/gl-matrix/vec2.js.map +1 -1
  36. package/dist/gl-matrix/vec3.js +1 -1
  37. package/dist/gl-matrix/vec3.js.map +1 -1
  38. package/dist/gl-matrix/vec4.js +1 -1
  39. package/dist/gl-matrix/vec4.js.map +1 -1
  40. package/dist/index.cjs +223 -2554
  41. package/dist/index.cjs.map +3 -3
  42. package/dist/index.d.ts +2 -17
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +1 -17
  45. package/dist/index.js.map +1 -1
  46. package/dist/lib/common.d.ts +0 -30
  47. package/dist/lib/common.d.ts.map +1 -1
  48. package/dist/lib/common.js +0 -42
  49. package/dist/lib/common.js.map +1 -1
  50. package/dist/lib/validators.d.ts +0 -1
  51. package/dist/lib/validators.d.ts.map +1 -1
  52. package/dist/lib/validators.js +0 -8
  53. package/dist/lib/validators.js.map +1 -1
  54. package/dist/mat3.cjs +543 -0
  55. package/dist/mat3.cjs.map +6 -0
  56. package/dist/mat3.d.ts +2 -0
  57. package/dist/mat3.d.ts.map +1 -0
  58. package/dist/mat3.js +5 -0
  59. package/dist/mat3.js.map +1 -0
  60. package/dist/mat4.cjs +1497 -0
  61. package/dist/mat4.cjs.map +6 -0
  62. package/dist/mat4.d.ts +2 -0
  63. package/dist/mat4.d.ts.map +1 -0
  64. package/dist/mat4.js +5 -0
  65. package/dist/mat4.js.map +1 -0
  66. package/dist/quat.cjs +532 -0
  67. package/dist/quat.cjs.map +6 -0
  68. package/dist/quat.d.ts +2 -0
  69. package/dist/quat.d.ts.map +1 -0
  70. package/dist/quat.js +5 -0
  71. package/dist/quat.js.map +1 -0
  72. package/dist/vec2.cjs +328 -0
  73. package/dist/vec2.cjs.map +6 -0
  74. package/dist/vec2.d.ts +2 -0
  75. package/dist/vec2.d.ts.map +1 -0
  76. package/dist/vec2.js +5 -0
  77. package/dist/vec2.js.map +1 -0
  78. package/dist/vec3.cjs +459 -0
  79. package/dist/vec3.cjs.map +6 -0
  80. package/dist/vec3.d.ts +2 -0
  81. package/dist/vec3.d.ts.map +1 -0
  82. package/dist/vec3.js +5 -0
  83. package/dist/vec3.js.map +1 -0
  84. package/dist/vec4.cjs +398 -0
  85. package/dist/vec4.cjs.map +6 -0
  86. package/dist/vec4.d.ts +2 -0
  87. package/dist/vec4.d.ts.map +1 -0
  88. package/dist/vec4.js +5 -0
  89. package/dist/vec4.js.map +1 -0
  90. package/package.json +33 -3
  91. package/src/classes/base/math-array.ts +0 -61
  92. package/src/classes/base/vector.ts +4 -2
  93. package/src/classes/euler-types.ts +14 -0
  94. package/src/classes/euler.ts +13 -108
  95. package/src/classes/matrix3.ts +16 -22
  96. package/src/classes/matrix4.ts +27 -15
  97. package/src/classes/quaternion.ts +28 -44
  98. package/src/classes/spherical-coordinates.ts +12 -10
  99. package/src/gl-matrix/quat.ts +3 -3
  100. package/src/gl-matrix/vec2.ts +1 -1
  101. package/src/gl-matrix/vec3.ts +1 -1
  102. package/src/gl-matrix/vec4.ts +1 -1
  103. package/src/index.ts +1 -25
  104. package/src/lib/common.ts +0 -48
  105. package/src/lib/validators.ts +0 -12
  106. package/src/mat3.ts +5 -0
  107. package/src/mat4.ts +5 -0
  108. package/src/quat.ts +5 -0
  109. package/src/vec2.ts +5 -0
  110. package/src/vec3.ts +5 -0
  111. package/src/vec4.ts +5 -0
package/dist/index.cjs CHANGED
@@ -28,41 +28,26 @@ __export(index_exports, {
28
28
  Vector2: () => Vector2,
29
29
  Vector3: () => Vector3,
30
30
  Vector4: () => Vector4,
31
- _Euler: () => Euler,
32
31
  _MathArray: () => MathArray,
33
32
  _MathUtils: () => math_utils_exports,
34
33
  _Matrix: () => Matrix,
35
- _Pose: () => Pose,
36
- _SphericalCoordinates: () => SphericalCoordinates,
37
34
  _Vector: () => Vector,
38
- acos: () => acos,
39
- asin: () => asin,
40
35
  assert: () => assert,
41
- atan: () => atan,
42
36
  clamp: () => clamp,
43
37
  clone: () => clone,
44
38
  config: () => config,
45
39
  configure: () => configure,
46
- cos: () => cos,
47
40
  degrees: () => degrees,
48
41
  equals: () => equals,
49
42
  exactEquals: () => exactEquals,
50
43
  formatValue: () => formatValue,
51
44
  isArray: () => isArray,
52
45
  lerp: () => lerp,
53
- mat3: () => mat3_exports,
54
- mat4: () => mat4_exports,
55
46
  normalizeAngle: () => normalizeAngle,
56
- quat: () => quat_exports,
57
47
  radians: () => radians,
58
48
  safeMod: () => safeMod,
59
- sin: () => sin,
60
- tan: () => tan,
61
49
  toDegrees: () => toDegrees,
62
50
  toRadians: () => toRadians,
63
- vec2: () => vec2_exports,
64
- vec3: () => vec3_exports,
65
- vec4: () => vec4_exports,
66
51
  withEpsilon: () => withEpsilon
67
52
  });
68
53
  module.exports = __toCommonJS(index_exports);
@@ -168,52 +153,34 @@ function safeMod(m, n) {
168
153
  }
169
154
  return (m % n + n) % n;
170
155
  }
171
- function normalizeAngle(angle3, range) {
156
+ function normalizeAngle(angle2, range) {
172
157
  switch (range) {
173
158
  case "negative-pi-to-pi":
174
- return negativePiToPi(angle3);
159
+ return negativePiToPi(angle2);
175
160
  case "zero-to-two-pi":
176
- return zeroToTwoPi(angle3);
161
+ return zeroToTwoPi(angle2);
177
162
  default:
178
- return angle3;
163
+ return angle2;
179
164
  }
180
165
  }
181
- function zeroToTwoPi(angle3) {
182
- if (angle3 >= 0 && angle3 <= TWO_PI) {
183
- return angle3;
166
+ function zeroToTwoPi(angle2) {
167
+ if (angle2 >= 0 && angle2 <= TWO_PI) {
168
+ return angle2;
184
169
  }
185
- const remainder = safeMod(angle3, TWO_PI);
186
- if (Math.abs(remainder) < EPSILON14 && Math.abs(angle3) > EPSILON14) {
170
+ const remainder = safeMod(angle2, TWO_PI);
171
+ if (Math.abs(remainder) < EPSILON14 && Math.abs(angle2) > EPSILON14) {
187
172
  return TWO_PI;
188
173
  }
189
174
  return remainder;
190
175
  }
191
- function negativePiToPi(angle3) {
192
- if (angle3 >= -PI && angle3 <= PI) {
193
- return angle3;
176
+ function negativePiToPi(angle2) {
177
+ if (angle2 >= -PI && angle2 <= PI) {
178
+ return angle2;
194
179
  }
195
- return zeroToTwoPi(angle3 + PI) - PI;
180
+ return zeroToTwoPi(angle2 + PI) - PI;
196
181
  }
197
- function sin(radians2, result) {
198
- return map(radians2, (angle3) => Math.sin(angle3), result);
199
- }
200
- function cos(radians2, result) {
201
- return map(radians2, (angle3) => Math.cos(angle3), result);
202
- }
203
- function tan(radians2, result) {
204
- return map(radians2, (angle3) => Math.tan(angle3), result);
205
- }
206
- function asin(radians2, result) {
207
- return map(radians2, (angle3) => Math.asin(angle3), result);
208
- }
209
- function acos(radians2, result) {
210
- return map(radians2, (angle3) => Math.acos(angle3), result);
211
- }
212
- function atan(radians2, result) {
213
- return map(radians2, (angle3) => Math.atan(angle3), result);
214
- }
215
- function clamp(value, min4, max4) {
216
- return map(value, (value2) => Math.max(min4, Math.min(max4, value2)));
182
+ function clamp(value, min, max) {
183
+ return map(value, (value2) => Math.max(min, Math.min(max, value2)));
217
184
  }
218
185
  function lerp(a, b, t) {
219
186
  if (isArray(a)) {
@@ -350,10 +317,6 @@ var MathArray = class extends Array {
350
317
  toTarget(target) {
351
318
  return target ? this.to(target) : this;
352
319
  }
353
- /** @deprecated */
354
- toFloat32Array() {
355
- return new Float32Array(this);
356
- }
357
320
  toString() {
358
321
  return this.formatString(config);
359
322
  }
@@ -442,14 +405,14 @@ var MathArray = class extends Array {
442
405
  }
443
406
  return this.check();
444
407
  }
445
- scale(scale7) {
446
- if (typeof scale7 === "number") {
408
+ scale(scale5) {
409
+ if (typeof scale5 === "number") {
447
410
  for (let i = 0; i < this.ELEMENTS; ++i) {
448
- this[i] *= scale7;
411
+ this[i] *= scale5;
449
412
  }
450
413
  } else {
451
- for (let i = 0; i < this.ELEMENTS && i < scale7.length; ++i) {
452
- this[i] *= scale7[i];
414
+ for (let i = 0; i < this.ELEMENTS && i < scale5.length; ++i) {
415
+ this[i] *= scale5[i];
453
416
  }
454
417
  }
455
418
  return this.check();
@@ -480,56 +443,11 @@ var MathArray = class extends Array {
480
443
  }
481
444
  return valid;
482
445
  }
483
- // three.js compatibility
484
- /** @deprecated */
485
- sub(a) {
486
- return this.subtract(a);
487
- }
488
- /** @deprecated */
489
- setScalar(a) {
490
- for (let i = 0; i < this.ELEMENTS; ++i) {
491
- this[i] = a;
492
- }
493
- return this.check();
494
- }
495
- /** @deprecated */
496
- addScalar(a) {
497
- for (let i = 0; i < this.ELEMENTS; ++i) {
498
- this[i] += a;
499
- }
500
- return this.check();
501
- }
502
- /** @deprecated */
503
- subScalar(a) {
504
- return this.addScalar(-a);
505
- }
506
- /** @deprecated */
507
- multiplyScalar(scalar) {
508
- for (let i = 0; i < this.ELEMENTS; ++i) {
509
- this[i] *= scalar;
510
- }
511
- return this.check();
512
- }
513
- /** @deprecated */
514
- divideScalar(a) {
515
- return this.multiplyByScalar(1 / a);
516
- }
517
- /** @deprecated */
518
- clampScalar(min4, max4) {
519
- for (let i = 0; i < this.ELEMENTS; ++i) {
520
- this[i] = Math.min(Math.max(this[i], min4), max4);
521
- }
522
- return this.check();
523
- }
524
- /** @deprecated */
525
- get elements() {
526
- return this;
527
- }
528
446
  };
529
447
 
530
448
  // dist/lib/validators.js
531
- function validateVector(v, length5) {
532
- if (v.length !== length5) {
449
+ function validateVector(v, length4) {
450
+ if (v.length !== length4) {
533
451
  return false;
534
452
  }
535
453
  for (let i = 0; i < v.length; ++i) {
@@ -545,8 +463,8 @@ function checkNumber(value) {
545
463
  }
546
464
  return value;
547
465
  }
548
- function checkVector(v, length5, callerName = "") {
549
- if (config.debug && !validateVector(v, length5)) {
466
+ function checkVector(v, length4, callerName = "") {
467
+ if (config.debug && !validateVector(v, length4)) {
550
468
  throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
551
469
  }
552
470
  return v;
@@ -651,11 +569,11 @@ var Vector = class extends MathArray {
651
569
  * Returns the squared length of the vector from the origin to the point described by this vector
652
570
  */
653
571
  lengthSquared() {
654
- let length5 = 0;
572
+ let length4 = 0;
655
573
  for (let i = 0; i < this.ELEMENTS; ++i) {
656
- length5 += this[i] * this[i];
574
+ length4 += this[i] * this[i];
657
575
  }
658
- return length5;
576
+ return length4;
659
577
  }
660
578
  /**
661
579
  * Returns the squared length of the vector from the origin to the point described by this vector
@@ -667,12 +585,12 @@ var Vector = class extends MathArray {
667
585
  return Math.sqrt(this.distanceSquared(mathArray));
668
586
  }
669
587
  distanceSquared(mathArray) {
670
- let length5 = 0;
588
+ let length4 = 0;
671
589
  for (let i = 0; i < this.ELEMENTS; ++i) {
672
- const dist4 = this[i] - mathArray[i];
673
- length5 += dist4 * dist4;
590
+ const dist = this[i] - mathArray[i];
591
+ length4 += dist * dist;
674
592
  }
675
- return checkNumber(length5);
593
+ return checkNumber(length4);
676
594
  }
677
595
  dot(mathArray) {
678
596
  let product = 0;
@@ -683,10 +601,10 @@ var Vector = class extends MathArray {
683
601
  }
684
602
  // MODIFIERS
685
603
  normalize() {
686
- const length5 = this.magnitude();
687
- if (length5 !== 0) {
604
+ const length4 = this.magnitude();
605
+ if (length4 !== 0) {
688
606
  for (let i = 0; i < this.ELEMENTS; ++i) {
689
- this[i] /= length5;
607
+ this[i] /= length4;
690
608
  }
691
609
  }
692
610
  return this.check();
@@ -736,221 +654,19 @@ var Vector = class extends MathArray {
736
654
  return this.copy(a).multiply(b);
737
655
  }
738
656
  addScaledVector(a, b) {
739
- return this.add(new this.constructor(a).multiplyScalar(b));
657
+ for (let i = 0; i < this.ELEMENTS; ++i) {
658
+ this[i] += a[i] * b;
659
+ }
660
+ return this.check();
740
661
  }
741
662
  };
742
663
 
743
- // dist/gl-matrix/vec2.js
744
- var vec2_exports = {};
745
- __export(vec2_exports, {
746
- add: () => add,
747
- angle: () => angle,
748
- ceil: () => ceil,
749
- clone: () => clone2,
750
- copy: () => copy,
751
- create: () => create,
752
- cross: () => cross,
753
- dist: () => dist,
754
- distance: () => distance,
755
- div: () => div,
756
- divide: () => divide,
757
- dot: () => dot,
758
- equals: () => equals2,
759
- exactEquals: () => exactEquals2,
760
- floor: () => floor,
761
- forEach: () => forEach,
762
- fromValues: () => fromValues,
763
- inverse: () => inverse,
764
- len: () => len,
765
- length: () => length,
766
- lerp: () => lerp2,
767
- max: () => max,
768
- min: () => min,
769
- mul: () => mul,
770
- multiply: () => multiply,
771
- negate: () => negate,
772
- normalize: () => normalize,
773
- random: () => random,
774
- rotate: () => rotate,
775
- round: () => round3,
776
- scale: () => scale,
777
- scaleAndAdd: () => scaleAndAdd,
778
- set: () => set,
779
- sqrDist: () => sqrDist,
780
- sqrLen: () => sqrLen,
781
- squaredDistance: () => squaredDistance,
782
- squaredLength: () => squaredLength,
783
- str: () => str,
784
- sub: () => sub,
785
- subtract: () => subtract,
786
- transformMat2: () => transformMat2,
787
- transformMat2d: () => transformMat2d,
788
- transformMat3: () => transformMat3,
789
- transformMat4: () => transformMat4,
790
- zero: () => zero
791
- });
792
-
793
664
  // dist/gl-matrix/common.js
794
665
  var EPSILON = 1e-6;
795
666
  var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
796
- var RANDOM = Math.random;
797
- function round2(a) {
798
- if (a >= 0)
799
- return Math.round(a);
800
- return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
801
- }
802
667
  var degree = Math.PI / 180;
803
668
 
804
669
  // dist/gl-matrix/vec2.js
805
- function create() {
806
- const out = new ARRAY_TYPE(2);
807
- if (ARRAY_TYPE !== Float32Array) {
808
- out[0] = 0;
809
- out[1] = 0;
810
- }
811
- return out;
812
- }
813
- function clone2(a) {
814
- const out = new ARRAY_TYPE(2);
815
- out[0] = a[0];
816
- out[1] = a[1];
817
- return out;
818
- }
819
- function fromValues(x, y) {
820
- const out = new ARRAY_TYPE(2);
821
- out[0] = x;
822
- out[1] = y;
823
- return out;
824
- }
825
- function copy(out, a) {
826
- out[0] = a[0];
827
- out[1] = a[1];
828
- return out;
829
- }
830
- function set(out, x, y) {
831
- out[0] = x;
832
- out[1] = y;
833
- return out;
834
- }
835
- function add(out, a, b) {
836
- out[0] = a[0] + b[0];
837
- out[1] = a[1] + b[1];
838
- return out;
839
- }
840
- function subtract(out, a, b) {
841
- out[0] = a[0] - b[0];
842
- out[1] = a[1] - b[1];
843
- return out;
844
- }
845
- function multiply(out, a, b) {
846
- out[0] = a[0] * b[0];
847
- out[1] = a[1] * b[1];
848
- return out;
849
- }
850
- function divide(out, a, b) {
851
- out[0] = a[0] / b[0];
852
- out[1] = a[1] / b[1];
853
- return out;
854
- }
855
- function ceil(out, a) {
856
- out[0] = Math.ceil(a[0]);
857
- out[1] = Math.ceil(a[1]);
858
- return out;
859
- }
860
- function floor(out, a) {
861
- out[0] = Math.floor(a[0]);
862
- out[1] = Math.floor(a[1]);
863
- return out;
864
- }
865
- function min(out, a, b) {
866
- out[0] = Math.min(a[0], b[0]);
867
- out[1] = Math.min(a[1], b[1]);
868
- return out;
869
- }
870
- function max(out, a, b) {
871
- out[0] = Math.max(a[0], b[0]);
872
- out[1] = Math.max(a[1], b[1]);
873
- return out;
874
- }
875
- function round3(out, a) {
876
- out[0] = round2(a[0]);
877
- out[1] = round2(a[1]);
878
- return out;
879
- }
880
- function scale(out, a, b) {
881
- out[0] = a[0] * b;
882
- out[1] = a[1] * b;
883
- return out;
884
- }
885
- function scaleAndAdd(out, a, b, scale7) {
886
- out[0] = a[0] + b[0] * scale7;
887
- out[1] = a[1] + b[1] * scale7;
888
- return out;
889
- }
890
- function distance(a, b) {
891
- const x = b[0] - a[0];
892
- const y = b[1] - a[1];
893
- return Math.sqrt(x * x + y * y);
894
- }
895
- function squaredDistance(a, b) {
896
- const x = b[0] - a[0];
897
- const y = b[1] - a[1];
898
- return x * x + y * y;
899
- }
900
- function length(a) {
901
- const x = a[0];
902
- const y = a[1];
903
- return Math.sqrt(x * x + y * y);
904
- }
905
- function squaredLength(a) {
906
- const x = a[0];
907
- const y = a[1];
908
- return x * x + y * y;
909
- }
910
- function negate(out, a) {
911
- out[0] = -a[0];
912
- out[1] = -a[1];
913
- return out;
914
- }
915
- function inverse(out, a) {
916
- out[0] = 1 / a[0];
917
- out[1] = 1 / a[1];
918
- return out;
919
- }
920
- function normalize(out, a) {
921
- const x = a[0];
922
- const y = a[1];
923
- let len5 = x * x + y * y;
924
- if (len5 > 0) {
925
- len5 = 1 / Math.sqrt(len5);
926
- }
927
- out[0] = a[0] * len5;
928
- out[1] = a[1] * len5;
929
- return out;
930
- }
931
- function dot(a, b) {
932
- return a[0] * b[0] + a[1] * b[1];
933
- }
934
- function cross(out, a, b) {
935
- const z = a[0] * b[1] - a[1] * b[0];
936
- out[0] = out[1] = 0;
937
- out[2] = z;
938
- return out;
939
- }
940
- function lerp2(out, a, b, t) {
941
- const ax = a[0];
942
- const ay = a[1];
943
- out[0] = ax + t * (b[0] - ax);
944
- out[1] = ay + t * (b[1] - ay);
945
- return out;
946
- }
947
- function random(out, scale7) {
948
- scale7 = scale7 === void 0 ? 1 : scale7;
949
- const r = RANDOM() * 2 * Math.PI;
950
- out[0] = Math.cos(r) * scale7;
951
- out[1] = Math.sin(r) * scale7;
952
- return out;
953
- }
954
670
  function transformMat2(out, a, m) {
955
671
  const x = a[0];
956
672
  const y = a[1];
@@ -979,75 +695,6 @@ function transformMat4(out, a, m) {
979
695
  out[1] = m[1] * x + m[5] * y + m[13];
980
696
  return out;
981
697
  }
982
- function rotate(out, a, b, rad) {
983
- const p0 = a[0] - b[0];
984
- const p1 = a[1] - b[1];
985
- const sinC = Math.sin(rad);
986
- const cosC = Math.cos(rad);
987
- out[0] = p0 * cosC - p1 * sinC + b[0];
988
- out[1] = p0 * sinC + p1 * cosC + b[1];
989
- return out;
990
- }
991
- function angle(a, b) {
992
- const x1 = a[0];
993
- const y1 = a[1];
994
- const x2 = b[0];
995
- const y2 = b[1];
996
- const mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));
997
- const cosine = mag && (x1 * x2 + y1 * y2) / mag;
998
- return Math.acos(Math.min(Math.max(cosine, -1), 1));
999
- }
1000
- function zero(out) {
1001
- out[0] = 0;
1002
- out[1] = 0;
1003
- return out;
1004
- }
1005
- function str(a) {
1006
- return `vec2(${a[0]}, ${a[1]})`;
1007
- }
1008
- function exactEquals2(a, b) {
1009
- return a[0] === b[0] && a[1] === b[1];
1010
- }
1011
- function equals2(a, b) {
1012
- const a0 = a[0];
1013
- const a1 = a[1];
1014
- const b0 = b[0];
1015
- const b1 = b[1];
1016
- return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1));
1017
- }
1018
- var len = length;
1019
- var sub = subtract;
1020
- var mul = multiply;
1021
- var div = divide;
1022
- var dist = distance;
1023
- var sqrDist = squaredDistance;
1024
- var sqrLen = squaredLength;
1025
- var forEach = (function() {
1026
- const vec = create();
1027
- return function(a, stride, offset, count, fn, arg) {
1028
- let i;
1029
- let l;
1030
- if (!stride) {
1031
- stride = 2;
1032
- }
1033
- if (!offset) {
1034
- offset = 0;
1035
- }
1036
- if (count) {
1037
- l = Math.min(count * stride + offset, a.length);
1038
- } else {
1039
- l = a.length;
1040
- }
1041
- for (i = offset; i < l; i += stride) {
1042
- vec[0] = a[i];
1043
- vec[1] = a[i + 1];
1044
- fn(vec, vec, arg);
1045
- a[i] = vec[0];
1046
- a[i + 1] = vec[1];
1047
- }
1048
- return a;
1049
- };
1050
- })();
1051
698
 
1052
699
  // dist/lib/gl-matrix-extras.js
1053
700
  function vec2_transformMat4AsVector(out, a, m) {
@@ -1196,59 +843,7 @@ var Vector2 = class extends Vector {
1196
843
  };
1197
844
 
1198
845
  // dist/gl-matrix/vec3.js
1199
- var vec3_exports = {};
1200
- __export(vec3_exports, {
1201
- add: () => add2,
1202
- angle: () => angle2,
1203
- bezier: () => bezier,
1204
- ceil: () => ceil2,
1205
- clone: () => clone3,
1206
- copy: () => copy2,
1207
- create: () => create2,
1208
- cross: () => cross2,
1209
- dist: () => dist2,
1210
- distance: () => distance2,
1211
- div: () => div2,
1212
- divide: () => divide2,
1213
- dot: () => dot2,
1214
- equals: () => equals3,
1215
- exactEquals: () => exactEquals3,
1216
- floor: () => floor2,
1217
- forEach: () => forEach2,
1218
- fromValues: () => fromValues2,
1219
- hermite: () => hermite,
1220
- inverse: () => inverse2,
1221
- len: () => len2,
1222
- length: () => length2,
1223
- lerp: () => lerp3,
1224
- max: () => max2,
1225
- min: () => min2,
1226
- mul: () => mul2,
1227
- multiply: () => multiply2,
1228
- negate: () => negate2,
1229
- normalize: () => normalize2,
1230
- random: () => random2,
1231
- rotateX: () => rotateX,
1232
- rotateY: () => rotateY,
1233
- rotateZ: () => rotateZ,
1234
- round: () => round4,
1235
- scale: () => scale2,
1236
- scaleAndAdd: () => scaleAndAdd2,
1237
- set: () => set2,
1238
- slerp: () => slerp,
1239
- sqrDist: () => sqrDist2,
1240
- sqrLen: () => sqrLen2,
1241
- squaredDistance: () => squaredDistance2,
1242
- squaredLength: () => squaredLength2,
1243
- str: () => str2,
1244
- sub: () => sub2,
1245
- subtract: () => subtract2,
1246
- transformMat3: () => transformMat32,
1247
- transformMat4: () => transformMat42,
1248
- transformQuat: () => transformQuat,
1249
- zero: () => zero2
1250
- });
1251
- function create2() {
846
+ function create() {
1252
847
  const out = new ARRAY_TYPE(3);
1253
848
  if (ARRAY_TYPE !== Float32Array) {
1254
849
  out[0] = 0;
@@ -1257,151 +852,36 @@ function create2() {
1257
852
  }
1258
853
  return out;
1259
854
  }
1260
- function clone3(a) {
1261
- const out = new ARRAY_TYPE(3);
1262
- out[0] = a[0];
1263
- out[1] = a[1];
1264
- out[2] = a[2];
1265
- return out;
1266
- }
1267
- function length2(a) {
855
+ function length(a) {
1268
856
  const x = a[0];
1269
857
  const y = a[1];
1270
858
  const z = a[2];
1271
859
  return Math.sqrt(x * x + y * y + z * z);
1272
860
  }
1273
- function fromValues2(x, y, z) {
861
+ function fromValues(x, y, z) {
1274
862
  const out = new ARRAY_TYPE(3);
1275
863
  out[0] = x;
1276
864
  out[1] = y;
1277
865
  out[2] = z;
1278
866
  return out;
1279
867
  }
1280
- function copy2(out, a) {
1281
- out[0] = a[0];
1282
- out[1] = a[1];
1283
- out[2] = a[2];
1284
- return out;
1285
- }
1286
- function set2(out, x, y, z) {
1287
- out[0] = x;
1288
- out[1] = y;
1289
- out[2] = z;
1290
- return out;
1291
- }
1292
- function add2(out, a, b) {
1293
- out[0] = a[0] + b[0];
1294
- out[1] = a[1] + b[1];
1295
- out[2] = a[2] + b[2];
1296
- return out;
1297
- }
1298
- function subtract2(out, a, b) {
1299
- out[0] = a[0] - b[0];
1300
- out[1] = a[1] - b[1];
1301
- out[2] = a[2] - b[2];
1302
- return out;
1303
- }
1304
- function multiply2(out, a, b) {
1305
- out[0] = a[0] * b[0];
1306
- out[1] = a[1] * b[1];
1307
- out[2] = a[2] * b[2];
1308
- return out;
1309
- }
1310
- function divide2(out, a, b) {
1311
- out[0] = a[0] / b[0];
1312
- out[1] = a[1] / b[1];
1313
- out[2] = a[2] / b[2];
1314
- return out;
1315
- }
1316
- function ceil2(out, a) {
1317
- out[0] = Math.ceil(a[0]);
1318
- out[1] = Math.ceil(a[1]);
1319
- out[2] = Math.ceil(a[2]);
1320
- return out;
1321
- }
1322
- function floor2(out, a) {
1323
- out[0] = Math.floor(a[0]);
1324
- out[1] = Math.floor(a[1]);
1325
- out[2] = Math.floor(a[2]);
1326
- return out;
1327
- }
1328
- function min2(out, a, b) {
1329
- out[0] = Math.min(a[0], b[0]);
1330
- out[1] = Math.min(a[1], b[1]);
1331
- out[2] = Math.min(a[2], b[2]);
1332
- return out;
1333
- }
1334
- function max2(out, a, b) {
1335
- out[0] = Math.max(a[0], b[0]);
1336
- out[1] = Math.max(a[1], b[1]);
1337
- out[2] = Math.max(a[2], b[2]);
1338
- return out;
1339
- }
1340
- function round4(out, a) {
1341
- out[0] = round2(a[0]);
1342
- out[1] = round2(a[1]);
1343
- out[2] = round2(a[2]);
1344
- return out;
1345
- }
1346
- function scale2(out, a, b) {
1347
- out[0] = a[0] * b;
1348
- out[1] = a[1] * b;
1349
- out[2] = a[2] * b;
1350
- return out;
1351
- }
1352
- function scaleAndAdd2(out, a, b, scale7) {
1353
- out[0] = a[0] + b[0] * scale7;
1354
- out[1] = a[1] + b[1] * scale7;
1355
- out[2] = a[2] + b[2] * scale7;
1356
- return out;
1357
- }
1358
- function distance2(a, b) {
1359
- const x = b[0] - a[0];
1360
- const y = b[1] - a[1];
1361
- const z = b[2] - a[2];
1362
- return Math.sqrt(x * x + y * y + z * z);
1363
- }
1364
- function squaredDistance2(a, b) {
1365
- const x = b[0] - a[0];
1366
- const y = b[1] - a[1];
1367
- const z = b[2] - a[2];
1368
- return x * x + y * y + z * z;
1369
- }
1370
- function squaredLength2(a) {
1371
- const x = a[0];
1372
- const y = a[1];
1373
- const z = a[2];
1374
- return x * x + y * y + z * z;
1375
- }
1376
- function negate2(out, a) {
1377
- out[0] = -a[0];
1378
- out[1] = -a[1];
1379
- out[2] = -a[2];
1380
- return out;
1381
- }
1382
- function inverse2(out, a) {
1383
- out[0] = 1 / a[0];
1384
- out[1] = 1 / a[1];
1385
- out[2] = 1 / a[2];
1386
- return out;
1387
- }
1388
- function normalize2(out, a) {
868
+ function normalize(out, a) {
1389
869
  const x = a[0];
1390
870
  const y = a[1];
1391
871
  const z = a[2];
1392
- let len5 = x * x + y * y + z * z;
1393
- if (len5 > 0) {
1394
- len5 = 1 / Math.sqrt(len5);
872
+ let len2 = x * x + y * y + z * z;
873
+ if (len2 > 0) {
874
+ len2 = 1 / Math.sqrt(len2);
1395
875
  }
1396
- out[0] = a[0] * len5;
1397
- out[1] = a[1] * len5;
1398
- out[2] = a[2] * len5;
876
+ out[0] = a[0] * len2;
877
+ out[1] = a[1] * len2;
878
+ out[2] = a[2] * len2;
1399
879
  return out;
1400
880
  }
1401
- function dot2(a, b) {
881
+ function dot(a, b) {
1402
882
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
1403
883
  }
1404
- function cross2(out, a, b) {
884
+ function cross(out, a, b) {
1405
885
  const ax = a[0];
1406
886
  const ay = a[1];
1407
887
  const az = a[2];
@@ -1413,59 +893,6 @@ function cross2(out, a, b) {
1413
893
  out[2] = ax * by - ay * bx;
1414
894
  return out;
1415
895
  }
1416
- function lerp3(out, a, b, t) {
1417
- const ax = a[0];
1418
- const ay = a[1];
1419
- const az = a[2];
1420
- out[0] = ax + t * (b[0] - ax);
1421
- out[1] = ay + t * (b[1] - ay);
1422
- out[2] = az + t * (b[2] - az);
1423
- return out;
1424
- }
1425
- function slerp(out, a, b, t) {
1426
- const angle3 = Math.acos(Math.min(Math.max(dot2(a, b), -1), 1));
1427
- const sinTotal = Math.sin(angle3);
1428
- const ratioA = Math.sin((1 - t) * angle3) / sinTotal;
1429
- const ratioB = Math.sin(t * angle3) / sinTotal;
1430
- out[0] = ratioA * a[0] + ratioB * b[0];
1431
- out[1] = ratioA * a[1] + ratioB * b[1];
1432
- out[2] = ratioA * a[2] + ratioB * b[2];
1433
- return out;
1434
- }
1435
- function hermite(out, a, b, c, d, t) {
1436
- const factorTimes2 = t * t;
1437
- const factor1 = factorTimes2 * (2 * t - 3) + 1;
1438
- const factor2 = factorTimes2 * (t - 2) + t;
1439
- const factor3 = factorTimes2 * (t - 1);
1440
- const factor4 = factorTimes2 * (3 - 2 * t);
1441
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
1442
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
1443
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
1444
- return out;
1445
- }
1446
- function bezier(out, a, b, c, d, t) {
1447
- const inverseFactor = 1 - t;
1448
- const inverseFactorTimesTwo = inverseFactor * inverseFactor;
1449
- const factorTimes2 = t * t;
1450
- const factor1 = inverseFactorTimesTwo * inverseFactor;
1451
- const factor2 = 3 * t * inverseFactorTimesTwo;
1452
- const factor3 = 3 * factorTimes2 * inverseFactor;
1453
- const factor4 = factorTimes2 * t;
1454
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
1455
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
1456
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
1457
- return out;
1458
- }
1459
- function random2(out, scale7) {
1460
- scale7 = scale7 === void 0 ? 1 : scale7;
1461
- const r = RANDOM() * 2 * Math.PI;
1462
- const z = RANDOM() * 2 - 1;
1463
- const zScale = Math.sqrt(1 - z * z) * scale7;
1464
- out[0] = Math.cos(r) * zScale;
1465
- out[1] = Math.sin(r) * zScale;
1466
- out[2] = z * scale7;
1467
- return out;
1468
- }
1469
896
  function transformMat42(out, a, m) {
1470
897
  const x = a[0];
1471
898
  const y = a[1];
@@ -1554,7 +981,7 @@ function rotateZ(out, a, b, rad) {
1554
981
  out[2] = r[2] + b[2];
1555
982
  return out;
1556
983
  }
1557
- function angle2(a, b) {
984
+ function angle(a, b) {
1558
985
  const ax = a[0];
1559
986
  const ay = a[1];
1560
987
  const az = a[2];
@@ -1562,65 +989,10 @@ function angle2(a, b) {
1562
989
  const by = b[1];
1563
990
  const bz = b[2];
1564
991
  const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));
1565
- const cosine = mag && dot2(a, b) / mag;
992
+ const cosine = mag && dot(a, b) / mag;
1566
993
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
1567
994
  }
1568
- function zero2(out) {
1569
- out[0] = 0;
1570
- out[1] = 0;
1571
- out[2] = 0;
1572
- return out;
1573
- }
1574
- function str2(a) {
1575
- return `vec3(${a[0]}, ${a[1]}, ${a[2]})`;
1576
- }
1577
- function exactEquals3(a, b) {
1578
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
1579
- }
1580
- function equals3(a, b) {
1581
- const a0 = a[0];
1582
- const a1 = a[1];
1583
- const a2 = a[2];
1584
- const b0 = b[0];
1585
- const b1 = b[1];
1586
- const b2 = b[2];
1587
- return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2));
1588
- }
1589
- var sub2 = subtract2;
1590
- var mul2 = multiply2;
1591
- var div2 = divide2;
1592
- var dist2 = distance2;
1593
- var sqrDist2 = squaredDistance2;
1594
- var len2 = length2;
1595
- var sqrLen2 = squaredLength2;
1596
- var forEach2 = (function() {
1597
- const vec = create2();
1598
- return function(a, stride, offset, count, fn, arg) {
1599
- let i;
1600
- let l;
1601
- if (!stride) {
1602
- stride = 3;
1603
- }
1604
- if (!offset) {
1605
- offset = 0;
1606
- }
1607
- if (count) {
1608
- l = Math.min(count * stride + offset, a.length);
1609
- } else {
1610
- l = a.length;
1611
- }
1612
- for (i = offset; i < l; i += stride) {
1613
- vec[0] = a[i];
1614
- vec[1] = a[i + 1];
1615
- vec[2] = a[i + 2];
1616
- fn(vec, vec, arg);
1617
- a[i] = vec[0];
1618
- a[i + 1] = vec[1];
1619
- a[i + 2] = vec[2];
1620
- }
1621
- return a;
1622
- };
1623
- })();
995
+ var len = length;
1624
996
 
1625
997
  // dist/classes/vector3.js
1626
998
  var ORIGIN = [0, 0, 0];
@@ -1695,11 +1067,11 @@ var Vector3 = class _Vector3 extends Vector {
1695
1067
  }
1696
1068
  // ACCESSORS
1697
1069
  angle(vector) {
1698
- return angle2(this, vector);
1070
+ return angle(this, vector);
1699
1071
  }
1700
1072
  // MODIFIERS
1701
1073
  cross(vector) {
1702
- cross2(this, this, vector);
1074
+ cross(this, this, vector);
1703
1075
  return this.check();
1704
1076
  }
1705
1077
  rotateX({ radians: radians2, origin = ORIGIN }) {
@@ -1845,130 +1217,6 @@ var Vector4 = class _Vector4 extends Vector {
1845
1217
  };
1846
1218
 
1847
1219
  // dist/gl-matrix/mat3.js
1848
- var mat3_exports = {};
1849
- __export(mat3_exports, {
1850
- add: () => add3,
1851
- adjoint: () => adjoint,
1852
- clone: () => clone4,
1853
- copy: () => copy3,
1854
- create: () => create3,
1855
- determinant: () => determinant,
1856
- equals: () => equals4,
1857
- exactEquals: () => exactEquals4,
1858
- frob: () => frob,
1859
- fromMat2d: () => fromMat2d,
1860
- fromMat4: () => fromMat4,
1861
- fromQuat: () => fromQuat,
1862
- fromRotation: () => fromRotation,
1863
- fromScaling: () => fromScaling,
1864
- fromTranslation: () => fromTranslation,
1865
- fromValues: () => fromValues3,
1866
- identity: () => identity,
1867
- invert: () => invert,
1868
- mul: () => mul3,
1869
- multiply: () => multiply3,
1870
- multiplyScalar: () => multiplyScalar,
1871
- multiplyScalarAndAdd: () => multiplyScalarAndAdd,
1872
- normalFromMat4: () => normalFromMat4,
1873
- projection: () => projection,
1874
- rotate: () => rotate2,
1875
- scale: () => scale3,
1876
- set: () => set3,
1877
- str: () => str3,
1878
- sub: () => sub3,
1879
- subtract: () => subtract3,
1880
- translate: () => translate,
1881
- transpose: () => transpose
1882
- });
1883
- function create3() {
1884
- const out = new ARRAY_TYPE(9);
1885
- if (ARRAY_TYPE !== Float32Array) {
1886
- out[1] = 0;
1887
- out[2] = 0;
1888
- out[3] = 0;
1889
- out[5] = 0;
1890
- out[6] = 0;
1891
- out[7] = 0;
1892
- }
1893
- out[0] = 1;
1894
- out[4] = 1;
1895
- out[8] = 1;
1896
- return out;
1897
- }
1898
- function fromMat4(out, a) {
1899
- out[0] = a[0];
1900
- out[1] = a[1];
1901
- out[2] = a[2];
1902
- out[3] = a[4];
1903
- out[4] = a[5];
1904
- out[5] = a[6];
1905
- out[6] = a[8];
1906
- out[7] = a[9];
1907
- out[8] = a[10];
1908
- return out;
1909
- }
1910
- function clone4(a) {
1911
- const out = new ARRAY_TYPE(9);
1912
- out[0] = a[0];
1913
- out[1] = a[1];
1914
- out[2] = a[2];
1915
- out[3] = a[3];
1916
- out[4] = a[4];
1917
- out[5] = a[5];
1918
- out[6] = a[6];
1919
- out[7] = a[7];
1920
- out[8] = a[8];
1921
- return out;
1922
- }
1923
- function copy3(out, a) {
1924
- out[0] = a[0];
1925
- out[1] = a[1];
1926
- out[2] = a[2];
1927
- out[3] = a[3];
1928
- out[4] = a[4];
1929
- out[5] = a[5];
1930
- out[6] = a[6];
1931
- out[7] = a[7];
1932
- out[8] = a[8];
1933
- return out;
1934
- }
1935
- function fromValues3(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
1936
- const out = new ARRAY_TYPE(9);
1937
- out[0] = m00;
1938
- out[1] = m01;
1939
- out[2] = m02;
1940
- out[3] = m10;
1941
- out[4] = m11;
1942
- out[5] = m12;
1943
- out[6] = m20;
1944
- out[7] = m21;
1945
- out[8] = m22;
1946
- return out;
1947
- }
1948
- function set3(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
1949
- out[0] = m00;
1950
- out[1] = m01;
1951
- out[2] = m02;
1952
- out[3] = m10;
1953
- out[4] = m11;
1954
- out[5] = m12;
1955
- out[6] = m20;
1956
- out[7] = m21;
1957
- out[8] = m22;
1958
- return out;
1959
- }
1960
- function identity(out) {
1961
- out[0] = 1;
1962
- out[1] = 0;
1963
- out[2] = 0;
1964
- out[3] = 0;
1965
- out[4] = 1;
1966
- out[5] = 0;
1967
- out[6] = 0;
1968
- out[7] = 0;
1969
- out[8] = 1;
1970
- return out;
1971
- }
1972
1220
  function transpose(out, a) {
1973
1221
  if (out === a) {
1974
1222
  const a01 = a[1];
@@ -2022,27 +1270,6 @@ function invert(out, a) {
2022
1270
  out[8] = (a11 * a00 - a01 * a10) * det;
2023
1271
  return out;
2024
1272
  }
2025
- function adjoint(out, a) {
2026
- const a00 = a[0];
2027
- const a01 = a[1];
2028
- const a02 = a[2];
2029
- const a10 = a[3];
2030
- const a11 = a[4];
2031
- const a12 = a[5];
2032
- const a20 = a[6];
2033
- const a21 = a[7];
2034
- const a22 = a[8];
2035
- out[0] = a11 * a22 - a12 * a21;
2036
- out[1] = a02 * a21 - a01 * a22;
2037
- out[2] = a01 * a12 - a02 * a11;
2038
- out[3] = a12 * a20 - a10 * a22;
2039
- out[4] = a00 * a22 - a02 * a20;
2040
- out[5] = a02 * a10 - a00 * a12;
2041
- out[6] = a10 * a21 - a11 * a20;
2042
- out[7] = a01 * a20 - a00 * a21;
2043
- out[8] = a00 * a11 - a01 * a10;
2044
- return out;
2045
- }
2046
1273
  function determinant(a) {
2047
1274
  const a00 = a[0];
2048
1275
  const a01 = a[1];
@@ -2055,7 +1282,7 @@ function determinant(a) {
2055
1282
  const a22 = a[8];
2056
1283
  return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
2057
1284
  }
2058
- function multiply3(out, a, b) {
1285
+ function multiply(out, a, b) {
2059
1286
  const a00 = a[0];
2060
1287
  const a01 = a[1];
2061
1288
  const a02 = a[2];
@@ -2108,7 +1335,7 @@ function translate(out, a, v) {
2108
1335
  out[8] = x * a02 + y * a12 + a22;
2109
1336
  return out;
2110
1337
  }
2111
- function rotate2(out, a, rad) {
1338
+ function rotate(out, a, rad) {
2112
1339
  const a00 = a[0];
2113
1340
  const a01 = a[1];
2114
1341
  const a02 = a[2];
@@ -2131,7 +1358,7 @@ function rotate2(out, a, rad) {
2131
1358
  out[8] = a22;
2132
1359
  return out;
2133
1360
  }
2134
- function scale3(out, a, v) {
1361
+ function scale(out, a, v) {
2135
1362
  const x = v[0];
2136
1363
  const y = v[1];
2137
1364
  out[0] = x * a[0];
@@ -2145,56 +1372,6 @@ function scale3(out, a, v) {
2145
1372
  out[8] = a[8];
2146
1373
  return out;
2147
1374
  }
2148
- function fromTranslation(out, v) {
2149
- out[0] = 1;
2150
- out[1] = 0;
2151
- out[2] = 0;
2152
- out[3] = 0;
2153
- out[4] = 1;
2154
- out[5] = 0;
2155
- out[6] = v[0];
2156
- out[7] = v[1];
2157
- out[8] = 1;
2158
- return out;
2159
- }
2160
- function fromRotation(out, rad) {
2161
- const s = Math.sin(rad);
2162
- const c = Math.cos(rad);
2163
- out[0] = c;
2164
- out[1] = s;
2165
- out[2] = 0;
2166
- out[3] = -s;
2167
- out[4] = c;
2168
- out[5] = 0;
2169
- out[6] = 0;
2170
- out[7] = 0;
2171
- out[8] = 1;
2172
- return out;
2173
- }
2174
- function fromScaling(out, v) {
2175
- out[0] = v[0];
2176
- out[1] = 0;
2177
- out[2] = 0;
2178
- out[3] = 0;
2179
- out[4] = v[1];
2180
- out[5] = 0;
2181
- out[6] = 0;
2182
- out[7] = 0;
2183
- out[8] = 1;
2184
- return out;
2185
- }
2186
- function fromMat2d(out, a) {
2187
- out[0] = a[0];
2188
- out[1] = a[1];
2189
- out[2] = 0;
2190
- out[3] = a[2];
2191
- out[4] = a[3];
2192
- out[5] = 0;
2193
- out[6] = a[4];
2194
- out[7] = a[5];
2195
- out[8] = 1;
2196
- return out;
2197
- }
2198
1375
  function fromQuat(out, q) {
2199
1376
  const x = q[0];
2200
1377
  const y = q[1];
@@ -2223,143 +1400,6 @@ function fromQuat(out, q) {
2223
1400
  out[8] = 1 - xx - yy;
2224
1401
  return out;
2225
1402
  }
2226
- function normalFromMat4(out, a) {
2227
- const a00 = a[0];
2228
- const a01 = a[1];
2229
- const a02 = a[2];
2230
- const a03 = a[3];
2231
- const a10 = a[4];
2232
- const a11 = a[5];
2233
- const a12 = a[6];
2234
- const a13 = a[7];
2235
- const a20 = a[8];
2236
- const a21 = a[9];
2237
- const a22 = a[10];
2238
- const a23 = a[11];
2239
- const a30 = a[12];
2240
- const a31 = a[13];
2241
- const a32 = a[14];
2242
- const a33 = a[15];
2243
- const b00 = a00 * a11 - a01 * a10;
2244
- const b01 = a00 * a12 - a02 * a10;
2245
- const b02 = a00 * a13 - a03 * a10;
2246
- const b03 = a01 * a12 - a02 * a11;
2247
- const b04 = a01 * a13 - a03 * a11;
2248
- const b05 = a02 * a13 - a03 * a12;
2249
- const b06 = a20 * a31 - a21 * a30;
2250
- const b07 = a20 * a32 - a22 * a30;
2251
- const b08 = a20 * a33 - a23 * a30;
2252
- const b09 = a21 * a32 - a22 * a31;
2253
- const b10 = a21 * a33 - a23 * a31;
2254
- const b11 = a22 * a33 - a23 * a32;
2255
- let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
2256
- if (!det) {
2257
- return null;
2258
- }
2259
- det = 1 / det;
2260
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
2261
- out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
2262
- out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
2263
- out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
2264
- out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
2265
- out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
2266
- out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
2267
- out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
2268
- out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
2269
- return out;
2270
- }
2271
- function projection(out, width, height) {
2272
- out[0] = 2 / width;
2273
- out[1] = 0;
2274
- out[2] = 0;
2275
- out[3] = 0;
2276
- out[4] = -2 / height;
2277
- out[5] = 0;
2278
- out[6] = -1;
2279
- out[7] = 1;
2280
- out[8] = 1;
2281
- return out;
2282
- }
2283
- function str3(a) {
2284
- return `mat3(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]})`;
2285
- }
2286
- function frob(a) {
2287
- return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]);
2288
- }
2289
- function add3(out, a, b) {
2290
- out[0] = a[0] + b[0];
2291
- out[1] = a[1] + b[1];
2292
- out[2] = a[2] + b[2];
2293
- out[3] = a[3] + b[3];
2294
- out[4] = a[4] + b[4];
2295
- out[5] = a[5] + b[5];
2296
- out[6] = a[6] + b[6];
2297
- out[7] = a[7] + b[7];
2298
- out[8] = a[8] + b[8];
2299
- return out;
2300
- }
2301
- function subtract3(out, a, b) {
2302
- out[0] = a[0] - b[0];
2303
- out[1] = a[1] - b[1];
2304
- out[2] = a[2] - b[2];
2305
- out[3] = a[3] - b[3];
2306
- out[4] = a[4] - b[4];
2307
- out[5] = a[5] - b[5];
2308
- out[6] = a[6] - b[6];
2309
- out[7] = a[7] - b[7];
2310
- out[8] = a[8] - b[8];
2311
- return out;
2312
- }
2313
- function multiplyScalar(out, a, b) {
2314
- out[0] = a[0] * b;
2315
- out[1] = a[1] * b;
2316
- out[2] = a[2] * b;
2317
- out[3] = a[3] * b;
2318
- out[4] = a[4] * b;
2319
- out[5] = a[5] * b;
2320
- out[6] = a[6] * b;
2321
- out[7] = a[7] * b;
2322
- out[8] = a[8] * b;
2323
- return out;
2324
- }
2325
- function multiplyScalarAndAdd(out, a, b, scale7) {
2326
- out[0] = a[0] + b[0] * scale7;
2327
- out[1] = a[1] + b[1] * scale7;
2328
- out[2] = a[2] + b[2] * scale7;
2329
- out[3] = a[3] + b[3] * scale7;
2330
- out[4] = a[4] + b[4] * scale7;
2331
- out[5] = a[5] + b[5] * scale7;
2332
- out[6] = a[6] + b[6] * scale7;
2333
- out[7] = a[7] + b[7] * scale7;
2334
- out[8] = a[8] + b[8] * scale7;
2335
- return out;
2336
- }
2337
- function exactEquals4(a, b) {
2338
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];
2339
- }
2340
- function equals4(a, b) {
2341
- const a0 = a[0];
2342
- const a1 = a[1];
2343
- const a2 = a[2];
2344
- const a3 = a[3];
2345
- const a4 = a[4];
2346
- const a5 = a[5];
2347
- const a6 = a[6];
2348
- const a7 = a[7];
2349
- const a8 = a[8];
2350
- const b0 = b[0];
2351
- const b1 = b[1];
2352
- const b2 = b[2];
2353
- const b3 = b[3];
2354
- const b4 = b[4];
2355
- const b5 = b[5];
2356
- const b6 = b[6];
2357
- const b7 = b[7];
2358
- const b8 = b[8];
2359
- return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8));
2360
- }
2361
- var mul3 = multiply3;
2362
- var sub3 = subtract3;
2363
1403
 
2364
1404
  // dist/classes/matrix3.js
2365
1405
  var INDICES;
@@ -2391,12 +1431,10 @@ var Matrix3 = class extends Matrix {
2391
1431
  get INDICES() {
2392
1432
  return INDICES;
2393
1433
  }
2394
- constructor(array, ...args) {
1434
+ constructor(array) {
2395
1435
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
2396
1436
  if (arguments.length === 1 && Array.isArray(array)) {
2397
1437
  this.copy(array);
2398
- } else if (args.length > 0) {
2399
- this.copy([array, ...args]);
2400
1438
  } else {
2401
1439
  this.identity();
2402
1440
  }
@@ -2433,6 +1471,10 @@ var Matrix3 = class extends Matrix {
2433
1471
  fromQuat(this, q);
2434
1472
  return this.check();
2435
1473
  }
1474
+ /** Sets this matrix from the upper-left 3x3 elements of a 4x4 matrix. */
1475
+ fromMatrix4(matrix4) {
1476
+ return this.set(matrix4[0], matrix4[1], matrix4[2], matrix4[4], matrix4[5], matrix4[6], matrix4[8], matrix4[9], matrix4[10]);
1477
+ }
2436
1478
  /**
2437
1479
  * accepts column major order, stores in column major order
2438
1480
  */
@@ -2481,22 +1523,22 @@ var Matrix3 = class extends Matrix {
2481
1523
  }
2482
1524
  // Operations
2483
1525
  multiplyLeft(a) {
2484
- multiply3(this, a, this);
1526
+ multiply(this, a, this);
2485
1527
  return this.check();
2486
1528
  }
2487
1529
  multiplyRight(a) {
2488
- multiply3(this, this, a);
1530
+ multiply(this, this, a);
2489
1531
  return this.check();
2490
1532
  }
2491
1533
  rotate(radians2) {
2492
- rotate2(this, this, radians2);
1534
+ rotate(this, this, radians2);
2493
1535
  return this.check();
2494
1536
  }
2495
1537
  scale(factor) {
2496
1538
  if (Array.isArray(factor)) {
2497
- scale3(this, this, factor);
1539
+ scale(this, this, factor);
2498
1540
  } else {
2499
- scale3(this, this, [factor, factor]);
1541
+ scale(this, this, [factor, factor]);
2500
1542
  }
2501
1543
  return this.check();
2502
1544
  }
@@ -2523,18 +1565,6 @@ var Matrix3 = class extends Matrix {
2523
1565
  checkVector(out, vector.length);
2524
1566
  return out;
2525
1567
  }
2526
- /** @deprecated */
2527
- transformVector(vector, result) {
2528
- return this.transform(vector, result);
2529
- }
2530
- /** @deprecated */
2531
- transformVector2(vector, result) {
2532
- return this.transform(vector, result);
2533
- }
2534
- /** @deprecated */
2535
- transformVector3(vector, result) {
2536
- return this.transform(vector, result);
2537
- }
2538
1568
  };
2539
1569
  var ZERO_MATRIX3;
2540
1570
  var IDENTITY_MATRIX3 = null;
@@ -2554,162 +1584,7 @@ function getIdentityMatrix() {
2554
1584
  }
2555
1585
 
2556
1586
  // dist/gl-matrix/mat4.js
2557
- var mat4_exports = {};
2558
- __export(mat4_exports, {
2559
- add: () => add4,
2560
- adjoint: () => adjoint2,
2561
- clone: () => clone5,
2562
- copy: () => copy4,
2563
- create: () => create4,
2564
- decompose: () => decompose,
2565
- determinant: () => determinant2,
2566
- equals: () => equals5,
2567
- exactEquals: () => exactEquals5,
2568
- frob: () => frob2,
2569
- fromQuat: () => fromQuat3,
2570
- fromQuat2: () => fromQuat2,
2571
- fromRotation: () => fromRotation2,
2572
- fromRotationTranslation: () => fromRotationTranslation,
2573
- fromRotationTranslationScale: () => fromRotationTranslationScale,
2574
- fromRotationTranslationScaleOrigin: () => fromRotationTranslationScaleOrigin,
2575
- fromScaling: () => fromScaling2,
2576
- fromTranslation: () => fromTranslation2,
2577
- fromValues: () => fromValues4,
2578
- fromXRotation: () => fromXRotation,
2579
- fromYRotation: () => fromYRotation,
2580
- fromZRotation: () => fromZRotation,
2581
- frustum: () => frustum,
2582
- getRotation: () => getRotation,
2583
- getScaling: () => getScaling,
2584
- getTranslation: () => getTranslation,
2585
- identity: () => identity2,
2586
- invert: () => invert2,
2587
- lookAt: () => lookAt,
2588
- mul: () => mul4,
2589
- multiply: () => multiply4,
2590
- multiplyScalar: () => multiplyScalar2,
2591
- multiplyScalarAndAdd: () => multiplyScalarAndAdd2,
2592
- ortho: () => ortho,
2593
- orthoNO: () => orthoNO,
2594
- orthoZO: () => orthoZO,
2595
- perspective: () => perspective,
2596
- perspectiveFromFieldOfView: () => perspectiveFromFieldOfView,
2597
- perspectiveNO: () => perspectiveNO,
2598
- perspectiveZO: () => perspectiveZO,
2599
- rotate: () => rotate3,
2600
- rotateX: () => rotateX2,
2601
- rotateY: () => rotateY2,
2602
- rotateZ: () => rotateZ2,
2603
- scale: () => scale4,
2604
- set: () => set4,
2605
- str: () => str4,
2606
- sub: () => sub4,
2607
- subtract: () => subtract4,
2608
- targetTo: () => targetTo,
2609
- translate: () => translate2,
2610
- transpose: () => transpose2
2611
- });
2612
- function create4() {
2613
- const out = new ARRAY_TYPE(16);
2614
- if (ARRAY_TYPE !== Float32Array) {
2615
- out[1] = 0;
2616
- out[2] = 0;
2617
- out[3] = 0;
2618
- out[4] = 0;
2619
- out[6] = 0;
2620
- out[7] = 0;
2621
- out[8] = 0;
2622
- out[9] = 0;
2623
- out[11] = 0;
2624
- out[12] = 0;
2625
- out[13] = 0;
2626
- out[14] = 0;
2627
- }
2628
- out[0] = 1;
2629
- out[5] = 1;
2630
- out[10] = 1;
2631
- out[15] = 1;
2632
- return out;
2633
- }
2634
- function clone5(a) {
2635
- const out = new ARRAY_TYPE(16);
2636
- out[0] = a[0];
2637
- out[1] = a[1];
2638
- out[2] = a[2];
2639
- out[3] = a[3];
2640
- out[4] = a[4];
2641
- out[5] = a[5];
2642
- out[6] = a[6];
2643
- out[7] = a[7];
2644
- out[8] = a[8];
2645
- out[9] = a[9];
2646
- out[10] = a[10];
2647
- out[11] = a[11];
2648
- out[12] = a[12];
2649
- out[13] = a[13];
2650
- out[14] = a[14];
2651
- out[15] = a[15];
2652
- return out;
2653
- }
2654
- function copy4(out, a) {
2655
- out[0] = a[0];
2656
- out[1] = a[1];
2657
- out[2] = a[2];
2658
- out[3] = a[3];
2659
- out[4] = a[4];
2660
- out[5] = a[5];
2661
- out[6] = a[6];
2662
- out[7] = a[7];
2663
- out[8] = a[8];
2664
- out[9] = a[9];
2665
- out[10] = a[10];
2666
- out[11] = a[11];
2667
- out[12] = a[12];
2668
- out[13] = a[13];
2669
- out[14] = a[14];
2670
- out[15] = a[15];
2671
- return out;
2672
- }
2673
- function fromValues4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
2674
- const out = new ARRAY_TYPE(16);
2675
- out[0] = m00;
2676
- out[1] = m01;
2677
- out[2] = m02;
2678
- out[3] = m03;
2679
- out[4] = m10;
2680
- out[5] = m11;
2681
- out[6] = m12;
2682
- out[7] = m13;
2683
- out[8] = m20;
2684
- out[9] = m21;
2685
- out[10] = m22;
2686
- out[11] = m23;
2687
- out[12] = m30;
2688
- out[13] = m31;
2689
- out[14] = m32;
2690
- out[15] = m33;
2691
- return out;
2692
- }
2693
- function set4(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
2694
- out[0] = m00;
2695
- out[1] = m01;
2696
- out[2] = m02;
2697
- out[3] = m03;
2698
- out[4] = m10;
2699
- out[5] = m11;
2700
- out[6] = m12;
2701
- out[7] = m13;
2702
- out[8] = m20;
2703
- out[9] = m21;
2704
- out[10] = m22;
2705
- out[11] = m23;
2706
- out[12] = m30;
2707
- out[13] = m31;
2708
- out[14] = m32;
2709
- out[15] = m33;
2710
- return out;
2711
- }
2712
- function identity2(out) {
1587
+ function identity(out) {
2713
1588
  out[0] = 1;
2714
1589
  out[1] = 0;
2715
1590
  out[2] = 0;
@@ -2820,53 +1695,6 @@ function invert2(out, a) {
2820
1695
  out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
2821
1696
  return out;
2822
1697
  }
2823
- function adjoint2(out, a) {
2824
- const a00 = a[0];
2825
- const a01 = a[1];
2826
- const a02 = a[2];
2827
- const a03 = a[3];
2828
- const a10 = a[4];
2829
- const a11 = a[5];
2830
- const a12 = a[6];
2831
- const a13 = a[7];
2832
- const a20 = a[8];
2833
- const a21 = a[9];
2834
- const a22 = a[10];
2835
- const a23 = a[11];
2836
- const a30 = a[12];
2837
- const a31 = a[13];
2838
- const a32 = a[14];
2839
- const a33 = a[15];
2840
- const b00 = a00 * a11 - a01 * a10;
2841
- const b01 = a00 * a12 - a02 * a10;
2842
- const b02 = a00 * a13 - a03 * a10;
2843
- const b03 = a01 * a12 - a02 * a11;
2844
- const b04 = a01 * a13 - a03 * a11;
2845
- const b05 = a02 * a13 - a03 * a12;
2846
- const b06 = a20 * a31 - a21 * a30;
2847
- const b07 = a20 * a32 - a22 * a30;
2848
- const b08 = a20 * a33 - a23 * a30;
2849
- const b09 = a21 * a32 - a22 * a31;
2850
- const b10 = a21 * a33 - a23 * a31;
2851
- const b11 = a22 * a33 - a23 * a32;
2852
- out[0] = a11 * b11 - a12 * b10 + a13 * b09;
2853
- out[1] = a02 * b10 - a01 * b11 - a03 * b09;
2854
- out[2] = a31 * b05 - a32 * b04 + a33 * b03;
2855
- out[3] = a22 * b04 - a21 * b05 - a23 * b03;
2856
- out[4] = a12 * b08 - a10 * b11 - a13 * b07;
2857
- out[5] = a00 * b11 - a02 * b08 + a03 * b07;
2858
- out[6] = a32 * b02 - a30 * b05 - a33 * b01;
2859
- out[7] = a20 * b05 - a22 * b02 + a23 * b01;
2860
- out[8] = a10 * b10 - a11 * b08 + a13 * b06;
2861
- out[9] = a01 * b08 - a00 * b10 - a03 * b06;
2862
- out[10] = a30 * b04 - a31 * b02 + a33 * b00;
2863
- out[11] = a21 * b02 - a20 * b04 - a23 * b00;
2864
- out[12] = a11 * b07 - a10 * b09 - a12 * b06;
2865
- out[13] = a00 * b09 - a01 * b07 + a02 * b06;
2866
- out[14] = a31 * b01 - a30 * b03 - a32 * b00;
2867
- out[15] = a20 * b03 - a21 * b01 + a22 * b00;
2868
- return out;
2869
- }
2870
1698
  function determinant2(a) {
2871
1699
  const a00 = a[0];
2872
1700
  const a01 = a[1];
@@ -2896,7 +1724,7 @@ function determinant2(a) {
2896
1724
  const b9 = a30 * b2 - a31 * b1 + a32 * b0;
2897
1725
  return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;
2898
1726
  }
2899
- function multiply4(out, a, b) {
1727
+ function multiply2(out, a, b) {
2900
1728
  const a00 = a[0];
2901
1729
  const a01 = a[1];
2902
1730
  const a02 = a[2];
@@ -3000,7 +1828,7 @@ function translate2(out, a, v) {
3000
1828
  }
3001
1829
  return out;
3002
1830
  }
3003
- function scale4(out, a, v) {
1831
+ function scale2(out, a, v) {
3004
1832
  const x = v[0];
3005
1833
  const y = v[1];
3006
1834
  const z = v[2];
@@ -3022,11 +1850,11 @@ function scale4(out, a, v) {
3022
1850
  out[15] = a[15];
3023
1851
  return out;
3024
1852
  }
3025
- function rotate3(out, a, rad, axis) {
1853
+ function rotate2(out, a, rad, axis) {
3026
1854
  let x = axis[0];
3027
1855
  let y = axis[1];
3028
1856
  let z = axis[2];
3029
- let len5 = Math.sqrt(x * x + y * y + z * z);
1857
+ let len2 = Math.sqrt(x * x + y * y + z * z);
3030
1858
  let c;
3031
1859
  let s;
3032
1860
  let t;
@@ -3051,13 +1879,13 @@ function rotate3(out, a, rad, axis) {
3051
1879
  let b20;
3052
1880
  let b21;
3053
1881
  let b22;
3054
- if (len5 < EPSILON) {
1882
+ if (len2 < EPSILON) {
3055
1883
  return null;
3056
1884
  }
3057
- len5 = 1 / len5;
3058
- x *= len5;
3059
- y *= len5;
3060
- z *= len5;
1885
+ len2 = 1 / len2;
1886
+ x *= len2;
1887
+ y *= len2;
1888
+ z *= len2;
3061
1889
  s = Math.sin(rad);
3062
1890
  c = Math.cos(rad);
3063
1891
  t = 1 - c;
@@ -3195,412 +2023,7 @@ function rotateZ2(out, a, rad) {
3195
2023
  out[7] = a13 * c - a03 * s;
3196
2024
  return out;
3197
2025
  }
3198
- function fromTranslation2(out, v) {
3199
- out[0] = 1;
3200
- out[1] = 0;
3201
- out[2] = 0;
3202
- out[3] = 0;
3203
- out[4] = 0;
3204
- out[5] = 1;
3205
- out[6] = 0;
3206
- out[7] = 0;
3207
- out[8] = 0;
3208
- out[9] = 0;
3209
- out[10] = 1;
3210
- out[11] = 0;
3211
- out[12] = v[0];
3212
- out[13] = v[1];
3213
- out[14] = v[2];
3214
- out[15] = 1;
3215
- return out;
3216
- }
3217
- function fromScaling2(out, v) {
3218
- out[0] = v[0];
3219
- out[1] = 0;
3220
- out[2] = 0;
3221
- out[3] = 0;
3222
- out[4] = 0;
3223
- out[5] = v[1];
3224
- out[6] = 0;
3225
- out[7] = 0;
3226
- out[8] = 0;
3227
- out[9] = 0;
3228
- out[10] = v[2];
3229
- out[11] = 0;
3230
- out[12] = 0;
3231
- out[13] = 0;
3232
- out[14] = 0;
3233
- out[15] = 1;
3234
- return out;
3235
- }
3236
- function fromRotation2(out, rad, axis) {
3237
- let x = axis[0];
3238
- let y = axis[1];
3239
- let z = axis[2];
3240
- let len5 = Math.sqrt(x * x + y * y + z * z);
3241
- let c;
3242
- let s;
3243
- let t;
3244
- if (len5 < EPSILON) {
3245
- return null;
3246
- }
3247
- len5 = 1 / len5;
3248
- x *= len5;
3249
- y *= len5;
3250
- z *= len5;
3251
- s = Math.sin(rad);
3252
- c = Math.cos(rad);
3253
- t = 1 - c;
3254
- out[0] = x * x * t + c;
3255
- out[1] = y * x * t + z * s;
3256
- out[2] = z * x * t - y * s;
3257
- out[3] = 0;
3258
- out[4] = x * y * t - z * s;
3259
- out[5] = y * y * t + c;
3260
- out[6] = z * y * t + x * s;
3261
- out[7] = 0;
3262
- out[8] = x * z * t + y * s;
3263
- out[9] = y * z * t - x * s;
3264
- out[10] = z * z * t + c;
3265
- out[11] = 0;
3266
- out[12] = 0;
3267
- out[13] = 0;
3268
- out[14] = 0;
3269
- out[15] = 1;
3270
- return out;
3271
- }
3272
- function fromXRotation(out, rad) {
3273
- const s = Math.sin(rad);
3274
- const c = Math.cos(rad);
3275
- out[0] = 1;
3276
- out[1] = 0;
3277
- out[2] = 0;
3278
- out[3] = 0;
3279
- out[4] = 0;
3280
- out[5] = c;
3281
- out[6] = s;
3282
- out[7] = 0;
3283
- out[8] = 0;
3284
- out[9] = -s;
3285
- out[10] = c;
3286
- out[11] = 0;
3287
- out[12] = 0;
3288
- out[13] = 0;
3289
- out[14] = 0;
3290
- out[15] = 1;
3291
- return out;
3292
- }
3293
- function fromYRotation(out, rad) {
3294
- const s = Math.sin(rad);
3295
- const c = Math.cos(rad);
3296
- out[0] = c;
3297
- out[1] = 0;
3298
- out[2] = -s;
3299
- out[3] = 0;
3300
- out[4] = 0;
3301
- out[5] = 1;
3302
- out[6] = 0;
3303
- out[7] = 0;
3304
- out[8] = s;
3305
- out[9] = 0;
3306
- out[10] = c;
3307
- out[11] = 0;
3308
- out[12] = 0;
3309
- out[13] = 0;
3310
- out[14] = 0;
3311
- out[15] = 1;
3312
- return out;
3313
- }
3314
- function fromZRotation(out, rad) {
3315
- const s = Math.sin(rad);
3316
- const c = Math.cos(rad);
3317
- out[0] = c;
3318
- out[1] = s;
3319
- out[2] = 0;
3320
- out[3] = 0;
3321
- out[4] = -s;
3322
- out[5] = c;
3323
- out[6] = 0;
3324
- out[7] = 0;
3325
- out[8] = 0;
3326
- out[9] = 0;
3327
- out[10] = 1;
3328
- out[11] = 0;
3329
- out[12] = 0;
3330
- out[13] = 0;
3331
- out[14] = 0;
3332
- out[15] = 1;
3333
- return out;
3334
- }
3335
- function fromRotationTranslation(out, q, v) {
3336
- const x = q[0];
3337
- const y = q[1];
3338
- const z = q[2];
3339
- const w = q[3];
3340
- const x2 = x + x;
3341
- const y2 = y + y;
3342
- const z2 = z + z;
3343
- const xx = x * x2;
3344
- const xy = x * y2;
3345
- const xz = x * z2;
3346
- const yy = y * y2;
3347
- const yz = y * z2;
3348
- const zz = z * z2;
3349
- const wx = w * x2;
3350
- const wy = w * y2;
3351
- const wz = w * z2;
3352
- out[0] = 1 - (yy + zz);
3353
- out[1] = xy + wz;
3354
- out[2] = xz - wy;
3355
- out[3] = 0;
3356
- out[4] = xy - wz;
3357
- out[5] = 1 - (xx + zz);
3358
- out[6] = yz + wx;
3359
- out[7] = 0;
3360
- out[8] = xz + wy;
3361
- out[9] = yz - wx;
3362
- out[10] = 1 - (xx + yy);
3363
- out[11] = 0;
3364
- out[12] = v[0];
3365
- out[13] = v[1];
3366
- out[14] = v[2];
3367
- out[15] = 1;
3368
- return out;
3369
- }
3370
- function fromQuat2(out, a) {
3371
- const translation = new ARRAY_TYPE(3);
3372
- const bx = -a[0];
3373
- const by = -a[1];
3374
- const bz = -a[2];
3375
- const bw = a[3];
3376
- const ax = a[4];
3377
- const ay = a[5];
3378
- const az = a[6];
3379
- const aw = a[7];
3380
- const magnitude = bx * bx + by * by + bz * bz + bw * bw;
3381
- if (magnitude > 0) {
3382
- translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;
3383
- translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;
3384
- translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;
3385
- } else {
3386
- translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
3387
- translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
3388
- translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
3389
- }
3390
- fromRotationTranslation(out, a, translation);
3391
- return out;
3392
- }
3393
- function getTranslation(out, mat) {
3394
- out[0] = mat[12];
3395
- out[1] = mat[13];
3396
- out[2] = mat[14];
3397
- return out;
3398
- }
3399
- function getScaling(out, mat) {
3400
- const m11 = mat[0];
3401
- const m12 = mat[1];
3402
- const m13 = mat[2];
3403
- const m21 = mat[4];
3404
- const m22 = mat[5];
3405
- const m23 = mat[6];
3406
- const m31 = mat[8];
3407
- const m32 = mat[9];
3408
- const m33 = mat[10];
3409
- out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
3410
- out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
3411
- out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
3412
- return out;
3413
- }
3414
- function getRotation(out, mat) {
3415
- const scaling = new ARRAY_TYPE(3);
3416
- getScaling(scaling, mat);
3417
- const is1 = 1 / scaling[0];
3418
- const is2 = 1 / scaling[1];
3419
- const is3 = 1 / scaling[2];
3420
- const sm11 = mat[0] * is1;
3421
- const sm12 = mat[1] * is2;
3422
- const sm13 = mat[2] * is3;
3423
- const sm21 = mat[4] * is1;
3424
- const sm22 = mat[5] * is2;
3425
- const sm23 = mat[6] * is3;
3426
- const sm31 = mat[8] * is1;
3427
- const sm32 = mat[9] * is2;
3428
- const sm33 = mat[10] * is3;
3429
- const trace = sm11 + sm22 + sm33;
3430
- let S = 0;
3431
- if (trace > 0) {
3432
- S = Math.sqrt(trace + 1) * 2;
3433
- out[3] = 0.25 * S;
3434
- out[0] = (sm23 - sm32) / S;
3435
- out[1] = (sm31 - sm13) / S;
3436
- out[2] = (sm12 - sm21) / S;
3437
- } else if (sm11 > sm22 && sm11 > sm33) {
3438
- S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;
3439
- out[3] = (sm23 - sm32) / S;
3440
- out[0] = 0.25 * S;
3441
- out[1] = (sm12 + sm21) / S;
3442
- out[2] = (sm31 + sm13) / S;
3443
- } else if (sm22 > sm33) {
3444
- S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;
3445
- out[3] = (sm31 - sm13) / S;
3446
- out[0] = (sm12 + sm21) / S;
3447
- out[1] = 0.25 * S;
3448
- out[2] = (sm23 + sm32) / S;
3449
- } else {
3450
- S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;
3451
- out[3] = (sm12 - sm21) / S;
3452
- out[0] = (sm31 + sm13) / S;
3453
- out[1] = (sm23 + sm32) / S;
3454
- out[2] = 0.25 * S;
3455
- }
3456
- return out;
3457
- }
3458
- function decompose(out_r, out_t, out_s, mat) {
3459
- out_t[0] = mat[12];
3460
- out_t[1] = mat[13];
3461
- out_t[2] = mat[14];
3462
- const m11 = mat[0];
3463
- const m12 = mat[1];
3464
- const m13 = mat[2];
3465
- const m21 = mat[4];
3466
- const m22 = mat[5];
3467
- const m23 = mat[6];
3468
- const m31 = mat[8];
3469
- const m32 = mat[9];
3470
- const m33 = mat[10];
3471
- out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
3472
- out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
3473
- out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
3474
- const is1 = 1 / out_s[0];
3475
- const is2 = 1 / out_s[1];
3476
- const is3 = 1 / out_s[2];
3477
- const sm11 = m11 * is1;
3478
- const sm12 = m12 * is2;
3479
- const sm13 = m13 * is3;
3480
- const sm21 = m21 * is1;
3481
- const sm22 = m22 * is2;
3482
- const sm23 = m23 * is3;
3483
- const sm31 = m31 * is1;
3484
- const sm32 = m32 * is2;
3485
- const sm33 = m33 * is3;
3486
- const trace = sm11 + sm22 + sm33;
3487
- let S = 0;
3488
- if (trace > 0) {
3489
- S = Math.sqrt(trace + 1) * 2;
3490
- out_r[3] = 0.25 * S;
3491
- out_r[0] = (sm23 - sm32) / S;
3492
- out_r[1] = (sm31 - sm13) / S;
3493
- out_r[2] = (sm12 - sm21) / S;
3494
- } else if (sm11 > sm22 && sm11 > sm33) {
3495
- S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;
3496
- out_r[3] = (sm23 - sm32) / S;
3497
- out_r[0] = 0.25 * S;
3498
- out_r[1] = (sm12 + sm21) / S;
3499
- out_r[2] = (sm31 + sm13) / S;
3500
- } else if (sm22 > sm33) {
3501
- S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;
3502
- out_r[3] = (sm31 - sm13) / S;
3503
- out_r[0] = (sm12 + sm21) / S;
3504
- out_r[1] = 0.25 * S;
3505
- out_r[2] = (sm23 + sm32) / S;
3506
- } else {
3507
- S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;
3508
- out_r[3] = (sm12 - sm21) / S;
3509
- out_r[0] = (sm31 + sm13) / S;
3510
- out_r[1] = (sm23 + sm32) / S;
3511
- out_r[2] = 0.25 * S;
3512
- }
3513
- return out_r;
3514
- }
3515
- function fromRotationTranslationScale(out, q, v, s) {
3516
- const x = q[0];
3517
- const y = q[1];
3518
- const z = q[2];
3519
- const w = q[3];
3520
- const x2 = x + x;
3521
- const y2 = y + y;
3522
- const z2 = z + z;
3523
- const xx = x * x2;
3524
- const xy = x * y2;
3525
- const xz = x * z2;
3526
- const yy = y * y2;
3527
- const yz = y * z2;
3528
- const zz = z * z2;
3529
- const wx = w * x2;
3530
- const wy = w * y2;
3531
- const wz = w * z2;
3532
- const sx = s[0];
3533
- const sy = s[1];
3534
- const sz = s[2];
3535
- out[0] = (1 - (yy + zz)) * sx;
3536
- out[1] = (xy + wz) * sx;
3537
- out[2] = (xz - wy) * sx;
3538
- out[3] = 0;
3539
- out[4] = (xy - wz) * sy;
3540
- out[5] = (1 - (xx + zz)) * sy;
3541
- out[6] = (yz + wx) * sy;
3542
- out[7] = 0;
3543
- out[8] = (xz + wy) * sz;
3544
- out[9] = (yz - wx) * sz;
3545
- out[10] = (1 - (xx + yy)) * sz;
3546
- out[11] = 0;
3547
- out[12] = v[0];
3548
- out[13] = v[1];
3549
- out[14] = v[2];
3550
- out[15] = 1;
3551
- return out;
3552
- }
3553
- function fromRotationTranslationScaleOrigin(out, q, v, s, o) {
3554
- const x = q[0];
3555
- const y = q[1];
3556
- const z = q[2];
3557
- const w = q[3];
3558
- const x2 = x + x;
3559
- const y2 = y + y;
3560
- const z2 = z + z;
3561
- const xx = x * x2;
3562
- const xy = x * y2;
3563
- const xz = x * z2;
3564
- const yy = y * y2;
3565
- const yz = y * z2;
3566
- const zz = z * z2;
3567
- const wx = w * x2;
3568
- const wy = w * y2;
3569
- const wz = w * z2;
3570
- const sx = s[0];
3571
- const sy = s[1];
3572
- const sz = s[2];
3573
- const ox = o[0];
3574
- const oy = o[1];
3575
- const oz = o[2];
3576
- const out0 = (1 - (yy + zz)) * sx;
3577
- const out1 = (xy + wz) * sx;
3578
- const out2 = (xz - wy) * sx;
3579
- const out4 = (xy - wz) * sy;
3580
- const out5 = (1 - (xx + zz)) * sy;
3581
- const out6 = (yz + wx) * sy;
3582
- const out8 = (xz + wy) * sz;
3583
- const out9 = (yz - wx) * sz;
3584
- const out10 = (1 - (xx + yy)) * sz;
3585
- out[0] = out0;
3586
- out[1] = out1;
3587
- out[2] = out2;
3588
- out[3] = 0;
3589
- out[4] = out4;
3590
- out[5] = out5;
3591
- out[6] = out6;
3592
- out[7] = 0;
3593
- out[8] = out8;
3594
- out[9] = out9;
3595
- out[10] = out10;
3596
- out[11] = 0;
3597
- out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);
3598
- out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);
3599
- out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);
3600
- out[15] = 1;
3601
- return out;
3602
- }
3603
- function fromQuat3(out, q) {
2026
+ function fromQuat2(out, q) {
3604
2027
  const x = q[0];
3605
2028
  const y = q[1];
3606
2029
  const z = q[2];
@@ -3652,39 +2075,12 @@ function frustum(out, left, right, bottom, top, near, far) {
3652
2075
  out[10] = (far + near) * nf;
3653
2076
  out[11] = -1;
3654
2077
  out[12] = 0;
3655
- out[13] = 0;
3656
- out[14] = far * near * 2 * nf;
3657
- out[15] = 0;
3658
- return out;
3659
- }
3660
- function perspectiveNO(out, fovy, aspect, near, far) {
3661
- const f = 1 / Math.tan(fovy / 2);
3662
- out[0] = f / aspect;
3663
- out[1] = 0;
3664
- out[2] = 0;
3665
- out[3] = 0;
3666
- out[4] = 0;
3667
- out[5] = f;
3668
- out[6] = 0;
3669
- out[7] = 0;
3670
- out[8] = 0;
3671
- out[9] = 0;
3672
- out[11] = -1;
3673
- out[12] = 0;
3674
- out[13] = 0;
3675
- out[15] = 0;
3676
- if (far != null && far !== Infinity) {
3677
- const nf = 1 / (near - far);
3678
- out[10] = (far + near) * nf;
3679
- out[14] = 2 * far * near * nf;
3680
- } else {
3681
- out[10] = -1;
3682
- out[14] = -2 * near;
3683
- }
2078
+ out[13] = 0;
2079
+ out[14] = far * near * 2 * nf;
2080
+ out[15] = 0;
3684
2081
  return out;
3685
2082
  }
3686
- var perspective = perspectiveNO;
3687
- function perspectiveZO(out, fovy, aspect, near, far) {
2083
+ function perspectiveNO(out, fovy, aspect, near, far) {
3688
2084
  const f = 1 / Math.tan(fovy / 2);
3689
2085
  out[0] = f / aspect;
3690
2086
  out[1] = 0;
@@ -3702,39 +2098,15 @@ function perspectiveZO(out, fovy, aspect, near, far) {
3702
2098
  out[15] = 0;
3703
2099
  if (far != null && far !== Infinity) {
3704
2100
  const nf = 1 / (near - far);
3705
- out[10] = far * nf;
3706
- out[14] = far * near * nf;
2101
+ out[10] = (far + near) * nf;
2102
+ out[14] = 2 * far * near * nf;
3707
2103
  } else {
3708
2104
  out[10] = -1;
3709
- out[14] = -near;
2105
+ out[14] = -2 * near;
3710
2106
  }
3711
2107
  return out;
3712
2108
  }
3713
- function perspectiveFromFieldOfView(out, fov, near, far) {
3714
- const upTan = Math.tan(fov.upDegrees * Math.PI / 180);
3715
- const downTan = Math.tan(fov.downDegrees * Math.PI / 180);
3716
- const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180);
3717
- const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180);
3718
- const xScale = 2 / (leftTan + rightTan);
3719
- const yScale = 2 / (upTan + downTan);
3720
- out[0] = xScale;
3721
- out[1] = 0;
3722
- out[2] = 0;
3723
- out[3] = 0;
3724
- out[4] = 0;
3725
- out[5] = yScale;
3726
- out[6] = 0;
3727
- out[7] = 0;
3728
- out[8] = -((leftTan - rightTan) * xScale * 0.5);
3729
- out[9] = (upTan - downTan) * yScale * 0.5;
3730
- out[10] = far / (near - far);
3731
- out[11] = -1;
3732
- out[12] = 0;
3733
- out[13] = 0;
3734
- out[14] = far * near / (near - far);
3735
- out[15] = 0;
3736
- return out;
3737
- }
2109
+ var perspective = perspectiveNO;
3738
2110
  function orthoNO(out, left, right, bottom, top, near, far) {
3739
2111
  const lr = 1 / (left - right);
3740
2112
  const bt = 1 / (bottom - top);
@@ -3758,30 +2130,8 @@ function orthoNO(out, left, right, bottom, top, near, far) {
3758
2130
  return out;
3759
2131
  }
3760
2132
  var ortho = orthoNO;
3761
- function orthoZO(out, left, right, bottom, top, near, far) {
3762
- const lr = 1 / (left - right);
3763
- const bt = 1 / (bottom - top);
3764
- const nf = 1 / (near - far);
3765
- out[0] = -2 * lr;
3766
- out[1] = 0;
3767
- out[2] = 0;
3768
- out[3] = 0;
3769
- out[4] = 0;
3770
- out[5] = -2 * bt;
3771
- out[6] = 0;
3772
- out[7] = 0;
3773
- out[8] = 0;
3774
- out[9] = 0;
3775
- out[10] = nf;
3776
- out[11] = 0;
3777
- out[12] = (left + right) * lr;
3778
- out[13] = (top + bottom) * bt;
3779
- out[14] = near * nf;
3780
- out[15] = 1;
3781
- return out;
3782
- }
3783
2133
  function lookAt(out, eye, center, up) {
3784
- let len5;
2134
+ let len2;
3785
2135
  let x0;
3786
2136
  let x1;
3787
2137
  let x2;
@@ -3801,42 +2151,42 @@ function lookAt(out, eye, center, up) {
3801
2151
  const centery = center[1];
3802
2152
  const centerz = center[2];
3803
2153
  if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) {
3804
- return identity2(out);
2154
+ return identity(out);
3805
2155
  }
3806
2156
  z0 = eyex - centerx;
3807
2157
  z1 = eyey - centery;
3808
2158
  z2 = eyez - centerz;
3809
- len5 = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
3810
- z0 *= len5;
3811
- z1 *= len5;
3812
- z2 *= len5;
2159
+ len2 = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
2160
+ z0 *= len2;
2161
+ z1 *= len2;
2162
+ z2 *= len2;
3813
2163
  x0 = upy * z2 - upz * z1;
3814
2164
  x1 = upz * z0 - upx * z2;
3815
2165
  x2 = upx * z1 - upy * z0;
3816
- len5 = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
3817
- if (!len5) {
2166
+ len2 = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
2167
+ if (!len2) {
3818
2168
  x0 = 0;
3819
2169
  x1 = 0;
3820
2170
  x2 = 0;
3821
2171
  } else {
3822
- len5 = 1 / len5;
3823
- x0 *= len5;
3824
- x1 *= len5;
3825
- x2 *= len5;
2172
+ len2 = 1 / len2;
2173
+ x0 *= len2;
2174
+ x1 *= len2;
2175
+ x2 *= len2;
3826
2176
  }
3827
2177
  y0 = z1 * x2 - z2 * x1;
3828
2178
  y1 = z2 * x0 - z0 * x2;
3829
2179
  y2 = z0 * x1 - z1 * x0;
3830
- len5 = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
3831
- if (!len5) {
2180
+ len2 = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
2181
+ if (!len2) {
3832
2182
  y0 = 0;
3833
2183
  y1 = 0;
3834
2184
  y2 = 0;
3835
2185
  } else {
3836
- len5 = 1 / len5;
3837
- y0 *= len5;
3838
- y1 *= len5;
3839
- y2 *= len5;
2186
+ len2 = 1 / len2;
2187
+ y0 *= len2;
2188
+ y1 *= len2;
2189
+ y2 *= len2;
3840
2190
  }
3841
2191
  out[0] = x0;
3842
2192
  out[1] = y0;
@@ -3856,414 +2206,55 @@ function lookAt(out, eye, center, up) {
3856
2206
  out[15] = 1;
3857
2207
  return out;
3858
2208
  }
3859
- function targetTo(out, eye, target, up) {
3860
- const eyex = eye[0];
3861
- const eyey = eye[1];
3862
- const eyez = eye[2];
3863
- const upx = up[0];
3864
- const upy = up[1];
3865
- const upz = up[2];
3866
- let z0 = eyex - target[0];
3867
- let z1 = eyey - target[1];
3868
- let z2 = eyez - target[2];
3869
- let len5 = z0 * z0 + z1 * z1 + z2 * z2;
3870
- if (len5 > 0) {
3871
- len5 = 1 / Math.sqrt(len5);
3872
- z0 *= len5;
3873
- z1 *= len5;
3874
- z2 *= len5;
3875
- }
3876
- let x0 = upy * z2 - upz * z1;
3877
- let x1 = upz * z0 - upx * z2;
3878
- let x2 = upx * z1 - upy * z0;
3879
- len5 = x0 * x0 + x1 * x1 + x2 * x2;
3880
- if (len5 > 0) {
3881
- len5 = 1 / Math.sqrt(len5);
3882
- x0 *= len5;
3883
- x1 *= len5;
3884
- x2 *= len5;
3885
- }
3886
- out[0] = x0;
3887
- out[1] = x1;
3888
- out[2] = x2;
3889
- out[3] = 0;
3890
- out[4] = z1 * x2 - z2 * x1;
3891
- out[5] = z2 * x0 - z0 * x2;
3892
- out[6] = z0 * x1 - z1 * x0;
3893
- out[7] = 0;
3894
- out[8] = z0;
3895
- out[9] = z1;
3896
- out[10] = z2;
3897
- out[11] = 0;
3898
- out[12] = eyex;
3899
- out[13] = eyey;
3900
- out[14] = eyez;
3901
- out[15] = 1;
3902
- return out;
3903
- }
3904
- function str4(a) {
3905
- return `mat4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]}, ${a[9]}, ${a[10]}, ${a[11]}, ${a[12]}, ${a[13]}, ${a[14]}, ${a[15]})`;
3906
- }
3907
- function frob2(a) {
3908
- return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]);
3909
- }
3910
- function add4(out, a, b) {
3911
- out[0] = a[0] + b[0];
3912
- out[1] = a[1] + b[1];
3913
- out[2] = a[2] + b[2];
3914
- out[3] = a[3] + b[3];
3915
- out[4] = a[4] + b[4];
3916
- out[5] = a[5] + b[5];
3917
- out[6] = a[6] + b[6];
3918
- out[7] = a[7] + b[7];
3919
- out[8] = a[8] + b[8];
3920
- out[9] = a[9] + b[9];
3921
- out[10] = a[10] + b[10];
3922
- out[11] = a[11] + b[11];
3923
- out[12] = a[12] + b[12];
3924
- out[13] = a[13] + b[13];
3925
- out[14] = a[14] + b[14];
3926
- out[15] = a[15] + b[15];
3927
- return out;
3928
- }
3929
- function subtract4(out, a, b) {
3930
- out[0] = a[0] - b[0];
3931
- out[1] = a[1] - b[1];
3932
- out[2] = a[2] - b[2];
3933
- out[3] = a[3] - b[3];
3934
- out[4] = a[4] - b[4];
3935
- out[5] = a[5] - b[5];
3936
- out[6] = a[6] - b[6];
3937
- out[7] = a[7] - b[7];
3938
- out[8] = a[8] - b[8];
3939
- out[9] = a[9] - b[9];
3940
- out[10] = a[10] - b[10];
3941
- out[11] = a[11] - b[11];
3942
- out[12] = a[12] - b[12];
3943
- out[13] = a[13] - b[13];
3944
- out[14] = a[14] - b[14];
3945
- out[15] = a[15] - b[15];
3946
- return out;
3947
- }
3948
- function multiplyScalar2(out, a, b) {
3949
- out[0] = a[0] * b;
3950
- out[1] = a[1] * b;
3951
- out[2] = a[2] * b;
3952
- out[3] = a[3] * b;
3953
- out[4] = a[4] * b;
3954
- out[5] = a[5] * b;
3955
- out[6] = a[6] * b;
3956
- out[7] = a[7] * b;
3957
- out[8] = a[8] * b;
3958
- out[9] = a[9] * b;
3959
- out[10] = a[10] * b;
3960
- out[11] = a[11] * b;
3961
- out[12] = a[12] * b;
3962
- out[13] = a[13] * b;
3963
- out[14] = a[14] * b;
3964
- out[15] = a[15] * b;
3965
- return out;
3966
- }
3967
- function multiplyScalarAndAdd2(out, a, b, scale7) {
3968
- out[0] = a[0] + b[0] * scale7;
3969
- out[1] = a[1] + b[1] * scale7;
3970
- out[2] = a[2] + b[2] * scale7;
3971
- out[3] = a[3] + b[3] * scale7;
3972
- out[4] = a[4] + b[4] * scale7;
3973
- out[5] = a[5] + b[5] * scale7;
3974
- out[6] = a[6] + b[6] * scale7;
3975
- out[7] = a[7] + b[7] * scale7;
3976
- out[8] = a[8] + b[8] * scale7;
3977
- out[9] = a[9] + b[9] * scale7;
3978
- out[10] = a[10] + b[10] * scale7;
3979
- out[11] = a[11] + b[11] * scale7;
3980
- out[12] = a[12] + b[12] * scale7;
3981
- out[13] = a[13] + b[13] * scale7;
3982
- out[14] = a[14] + b[14] * scale7;
3983
- out[15] = a[15] + b[15] * scale7;
3984
- return out;
3985
- }
3986
- function exactEquals5(a, b) {
3987
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];
3988
- }
3989
- function equals5(a, b) {
3990
- const a0 = a[0];
3991
- const a1 = a[1];
3992
- const a2 = a[2];
3993
- const a3 = a[3];
3994
- const a4 = a[4];
3995
- const a5 = a[5];
3996
- const a6 = a[6];
3997
- const a7 = a[7];
3998
- const a8 = a[8];
3999
- const a9 = a[9];
4000
- const a10 = a[10];
4001
- const a11 = a[11];
4002
- const a12 = a[12];
4003
- const a13 = a[13];
4004
- const a14 = a[14];
4005
- const a15 = a[15];
4006
- const b0 = b[0];
4007
- const b1 = b[1];
4008
- const b2 = b[2];
4009
- const b3 = b[3];
4010
- const b4 = b[4];
4011
- const b5 = b[5];
4012
- const b6 = b[6];
4013
- const b7 = b[7];
4014
- const b8 = b[8];
4015
- const b9 = b[9];
4016
- const b10 = b[10];
4017
- const b11 = b[11];
4018
- const b12 = b[12];
4019
- const b13 = b[13];
4020
- const b14 = b[14];
4021
- const b15 = b[15];
4022
- return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15));
4023
- }
4024
- var mul4 = multiply4;
4025
- var sub4 = subtract4;
4026
2209
 
4027
2210
  // dist/gl-matrix/vec4.js
4028
- var vec4_exports = {};
4029
- __export(vec4_exports, {
4030
- add: () => add5,
4031
- ceil: () => ceil3,
4032
- clone: () => clone6,
4033
- copy: () => copy5,
4034
- create: () => create5,
4035
- cross: () => cross3,
4036
- dist: () => dist3,
4037
- distance: () => distance3,
4038
- div: () => div3,
4039
- divide: () => divide3,
4040
- dot: () => dot3,
4041
- equals: () => equals6,
4042
- exactEquals: () => exactEquals6,
4043
- floor: () => floor3,
4044
- forEach: () => forEach3,
4045
- fromValues: () => fromValues5,
4046
- inverse: () => inverse3,
4047
- len: () => len3,
4048
- length: () => length3,
4049
- lerp: () => lerp4,
4050
- max: () => max3,
4051
- min: () => min3,
4052
- mul: () => mul5,
4053
- multiply: () => multiply5,
4054
- negate: () => negate3,
4055
- normalize: () => normalize3,
4056
- random: () => random3,
4057
- round: () => round5,
4058
- scale: () => scale5,
4059
- scaleAndAdd: () => scaleAndAdd3,
4060
- set: () => set5,
4061
- sqrDist: () => sqrDist3,
4062
- sqrLen: () => sqrLen3,
4063
- squaredDistance: () => squaredDistance3,
4064
- squaredLength: () => squaredLength3,
4065
- str: () => str5,
4066
- sub: () => sub5,
4067
- subtract: () => subtract5,
4068
- transformMat4: () => transformMat43,
4069
- transformQuat: () => transformQuat2,
4070
- zero: () => zero3
4071
- });
4072
- function create5() {
4073
- const out = new ARRAY_TYPE(4);
4074
- if (ARRAY_TYPE !== Float32Array) {
4075
- out[0] = 0;
4076
- out[1] = 0;
4077
- out[2] = 0;
4078
- out[3] = 0;
4079
- }
4080
- return out;
4081
- }
4082
- function clone6(a) {
4083
- const out = new ARRAY_TYPE(4);
4084
- out[0] = a[0];
4085
- out[1] = a[1];
4086
- out[2] = a[2];
4087
- out[3] = a[3];
4088
- return out;
4089
- }
4090
- function fromValues5(x, y, z, w) {
4091
- const out = new ARRAY_TYPE(4);
4092
- out[0] = x;
4093
- out[1] = y;
4094
- out[2] = z;
4095
- out[3] = w;
4096
- return out;
4097
- }
4098
- function copy5(out, a) {
4099
- out[0] = a[0];
4100
- out[1] = a[1];
4101
- out[2] = a[2];
4102
- out[3] = a[3];
4103
- return out;
4104
- }
4105
- function set5(out, x, y, z, w) {
4106
- out[0] = x;
4107
- out[1] = y;
4108
- out[2] = z;
4109
- out[3] = w;
4110
- return out;
4111
- }
4112
- function add5(out, a, b) {
2211
+ function add(out, a, b) {
4113
2212
  out[0] = a[0] + b[0];
4114
2213
  out[1] = a[1] + b[1];
4115
2214
  out[2] = a[2] + b[2];
4116
2215
  out[3] = a[3] + b[3];
4117
2216
  return out;
4118
2217
  }
4119
- function subtract5(out, a, b) {
4120
- out[0] = a[0] - b[0];
4121
- out[1] = a[1] - b[1];
4122
- out[2] = a[2] - b[2];
4123
- out[3] = a[3] - b[3];
4124
- return out;
4125
- }
4126
- function multiply5(out, a, b) {
4127
- out[0] = a[0] * b[0];
4128
- out[1] = a[1] * b[1];
4129
- out[2] = a[2] * b[2];
4130
- out[3] = a[3] * b[3];
4131
- return out;
4132
- }
4133
- function divide3(out, a, b) {
4134
- out[0] = a[0] / b[0];
4135
- out[1] = a[1] / b[1];
4136
- out[2] = a[2] / b[2];
4137
- out[3] = a[3] / b[3];
4138
- return out;
4139
- }
4140
- function ceil3(out, a) {
4141
- out[0] = Math.ceil(a[0]);
4142
- out[1] = Math.ceil(a[1]);
4143
- out[2] = Math.ceil(a[2]);
4144
- out[3] = Math.ceil(a[3]);
4145
- return out;
4146
- }
4147
- function floor3(out, a) {
4148
- out[0] = Math.floor(a[0]);
4149
- out[1] = Math.floor(a[1]);
4150
- out[2] = Math.floor(a[2]);
4151
- out[3] = Math.floor(a[3]);
4152
- return out;
4153
- }
4154
- function min3(out, a, b) {
4155
- out[0] = Math.min(a[0], b[0]);
4156
- out[1] = Math.min(a[1], b[1]);
4157
- out[2] = Math.min(a[2], b[2]);
4158
- out[3] = Math.min(a[3], b[3]);
4159
- return out;
4160
- }
4161
- function max3(out, a, b) {
4162
- out[0] = Math.max(a[0], b[0]);
4163
- out[1] = Math.max(a[1], b[1]);
4164
- out[2] = Math.max(a[2], b[2]);
4165
- out[3] = Math.max(a[3], b[3]);
4166
- return out;
4167
- }
4168
- function round5(out, a) {
4169
- out[0] = round2(a[0]);
4170
- out[1] = round2(a[1]);
4171
- out[2] = round2(a[2]);
4172
- out[3] = round2(a[3]);
4173
- return out;
4174
- }
4175
- function scale5(out, a, b) {
2218
+ function scale3(out, a, b) {
4176
2219
  out[0] = a[0] * b;
4177
2220
  out[1] = a[1] * b;
4178
2221
  out[2] = a[2] * b;
4179
2222
  out[3] = a[3] * b;
4180
2223
  return out;
4181
2224
  }
4182
- function scaleAndAdd3(out, a, b, scale7) {
4183
- out[0] = a[0] + b[0] * scale7;
4184
- out[1] = a[1] + b[1] * scale7;
4185
- out[2] = a[2] + b[2] * scale7;
4186
- out[3] = a[3] + b[3] * scale7;
4187
- return out;
4188
- }
4189
- function distance3(a, b) {
4190
- const x = b[0] - a[0];
4191
- const y = b[1] - a[1];
4192
- const z = b[2] - a[2];
4193
- const w = b[3] - a[3];
4194
- return Math.sqrt(x * x + y * y + z * z + w * w);
4195
- }
4196
- function squaredDistance3(a, b) {
4197
- const x = b[0] - a[0];
4198
- const y = b[1] - a[1];
4199
- const z = b[2] - a[2];
4200
- const w = b[3] - a[3];
4201
- return x * x + y * y + z * z + w * w;
4202
- }
4203
- function length3(a) {
2225
+ function length2(a) {
4204
2226
  const x = a[0];
4205
2227
  const y = a[1];
4206
2228
  const z = a[2];
4207
2229
  const w = a[3];
4208
2230
  return Math.sqrt(x * x + y * y + z * z + w * w);
4209
2231
  }
4210
- function squaredLength3(a) {
2232
+ function squaredLength(a) {
4211
2233
  const x = a[0];
4212
2234
  const y = a[1];
4213
2235
  const z = a[2];
4214
2236
  const w = a[3];
4215
2237
  return x * x + y * y + z * z + w * w;
4216
2238
  }
4217
- function negate3(out, a) {
4218
- out[0] = -a[0];
4219
- out[1] = -a[1];
4220
- out[2] = -a[2];
4221
- out[3] = -a[3];
4222
- return out;
4223
- }
4224
- function inverse3(out, a) {
4225
- out[0] = 1 / a[0];
4226
- out[1] = 1 / a[1];
4227
- out[2] = 1 / a[2];
4228
- out[3] = 1 / a[3];
4229
- return out;
4230
- }
4231
- function normalize3(out, a) {
2239
+ function normalize2(out, a) {
4232
2240
  const x = a[0];
4233
2241
  const y = a[1];
4234
2242
  const z = a[2];
4235
2243
  const w = a[3];
4236
- let len5 = x * x + y * y + z * z + w * w;
4237
- if (len5 > 0) {
4238
- len5 = 1 / Math.sqrt(len5);
4239
- }
4240
- out[0] = x * len5;
4241
- out[1] = y * len5;
4242
- out[2] = z * len5;
4243
- out[3] = w * len5;
2244
+ let len2 = x * x + y * y + z * z + w * w;
2245
+ if (len2 > 0) {
2246
+ len2 = 1 / Math.sqrt(len2);
2247
+ }
2248
+ out[0] = x * len2;
2249
+ out[1] = y * len2;
2250
+ out[2] = z * len2;
2251
+ out[3] = w * len2;
4244
2252
  return out;
4245
2253
  }
4246
- function dot3(a, b) {
2254
+ function dot2(a, b) {
4247
2255
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
4248
2256
  }
4249
- function cross3(out, u, v, w) {
4250
- const A = v[0] * w[1] - v[1] * w[0];
4251
- const B = v[0] * w[2] - v[2] * w[0];
4252
- const C = v[0] * w[3] - v[3] * w[0];
4253
- const D = v[1] * w[2] - v[2] * w[1];
4254
- const E = v[1] * w[3] - v[3] * w[1];
4255
- const F = v[2] * w[3] - v[3] * w[2];
4256
- const G = u[0];
4257
- const H = u[1];
4258
- const I = u[2];
4259
- const J = u[3];
4260
- out[0] = H * F - I * E + J * D;
4261
- out[1] = -(G * F) + I * C - J * B;
4262
- out[2] = G * E - H * C + J * A;
4263
- out[3] = -(G * D) + H * B - I * A;
4264
- return out;
4265
- }
4266
- function lerp4(out, a, b, t) {
2257
+ function lerp2(out, a, b, t) {
4267
2258
  const ax = a[0];
4268
2259
  const ay = a[1];
4269
2260
  const az = a[2];
@@ -4274,31 +2265,6 @@ function lerp4(out, a, b, t) {
4274
2265
  out[3] = aw + t * (b[3] - aw);
4275
2266
  return out;
4276
2267
  }
4277
- function random3(out, scale7) {
4278
- scale7 = scale7 === void 0 ? 1 : scale7;
4279
- let v1;
4280
- let v2;
4281
- let v3;
4282
- let v4;
4283
- let s1;
4284
- let s2;
4285
- do {
4286
- v1 = RANDOM() * 2 - 1;
4287
- v2 = RANDOM() * 2 - 1;
4288
- s1 = v1 * v1 + v2 * v2;
4289
- } while (s1 >= 1);
4290
- do {
4291
- v3 = RANDOM() * 2 - 1;
4292
- v4 = RANDOM() * 2 - 1;
4293
- s2 = v3 * v3 + v4 * v4;
4294
- } while (s2 >= 1);
4295
- const d = Math.sqrt((1 - s1) / s2);
4296
- out[0] = scale7 * v1;
4297
- out[1] = scale7 * v2;
4298
- out[2] = scale7 * v3 * d;
4299
- out[3] = scale7 * v4 * d;
4300
- return out;
4301
- }
4302
2268
  function transformMat43(out, a, m) {
4303
2269
  const x = a[0];
4304
2270
  const y = a[1];
@@ -4310,85 +2276,6 @@ function transformMat43(out, a, m) {
4310
2276
  out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
4311
2277
  return out;
4312
2278
  }
4313
- function transformQuat2(out, a, q) {
4314
- const x = a[0];
4315
- const y = a[1];
4316
- const z = a[2];
4317
- const qx = q[0];
4318
- const qy = q[1];
4319
- const qz = q[2];
4320
- const qw = q[3];
4321
- const ix = qw * x + qy * z - qz * y;
4322
- const iy = qw * y + qz * x - qx * z;
4323
- const iz = qw * z + qx * y - qy * x;
4324
- const iw = -qx * x - qy * y - qz * z;
4325
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
4326
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
4327
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
4328
- out[3] = a[3];
4329
- return out;
4330
- }
4331
- function zero3(out) {
4332
- out[0] = 0;
4333
- out[1] = 0;
4334
- out[2] = 0;
4335
- out[3] = 0;
4336
- return out;
4337
- }
4338
- function str5(a) {
4339
- return `vec4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;
4340
- }
4341
- function exactEquals6(a, b) {
4342
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
4343
- }
4344
- function equals6(a, b) {
4345
- const a0 = a[0];
4346
- const a1 = a[1];
4347
- const a2 = a[2];
4348
- const a3 = a[3];
4349
- const b0 = b[0];
4350
- const b1 = b[1];
4351
- const b2 = b[2];
4352
- const b3 = b[3];
4353
- return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));
4354
- }
4355
- var sub5 = subtract5;
4356
- var mul5 = multiply5;
4357
- var div3 = divide3;
4358
- var dist3 = distance3;
4359
- var sqrDist3 = squaredDistance3;
4360
- var len3 = length3;
4361
- var sqrLen3 = squaredLength3;
4362
- var forEach3 = (function() {
4363
- const vec = create5();
4364
- return function(a, stride, offset, count, fn, arg) {
4365
- let i;
4366
- let l;
4367
- if (!stride) {
4368
- stride = 4;
4369
- }
4370
- if (!offset) {
4371
- offset = 0;
4372
- }
4373
- if (count) {
4374
- l = Math.min(count * stride + offset, a.length);
4375
- } else {
4376
- l = a.length;
4377
- }
4378
- for (i = offset; i < l; i += stride) {
4379
- vec[0] = a[i];
4380
- vec[1] = a[i + 1];
4381
- vec[2] = a[i + 2];
4382
- vec[3] = a[i + 3];
4383
- fn(vec, vec, arg);
4384
- a[i] = vec[0];
4385
- a[i + 1] = vec[1];
4386
- a[i + 2] = vec[2];
4387
- a[i + 3] = vec[3];
4388
- }
4389
- return a;
4390
- };
4391
- })();
4392
2279
 
4393
2280
  // dist/classes/matrix4.js
4394
2281
  var INDICES2;
@@ -4538,9 +2425,17 @@ var Matrix4 = class extends Matrix {
4538
2425
  * @returns self
4539
2426
  */
4540
2427
  fromQuaternion(quaternion) {
4541
- fromQuat3(this, quaternion);
2428
+ fromQuat2(this, quaternion);
4542
2429
  return this.check();
4543
2430
  }
2431
+ /**
2432
+ * Sets this matrix from a 3x3 matrix, with zero translation.
2433
+ * @param matrix3 - 3x3 matrix in column-major order.
2434
+ * @returns This matrix.
2435
+ */
2436
+ fromMatrix3(matrix3) {
2437
+ return this.set(matrix3[0], matrix3[1], matrix3[2], 0, matrix3[3], matrix3[4], matrix3[5], 0, matrix3[6], matrix3[7], matrix3[8], 0, 0, 0, 0, 1);
2438
+ }
4544
2439
  /**
4545
2440
  * Generates a frustum matrix with the given bounds
4546
2441
  * @param view.left - Left bound of the frustum
@@ -4664,10 +2559,10 @@ var Matrix4 = class extends Matrix {
4664
2559
  getRotation(result, scaleResult) {
4665
2560
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
4666
2561
  scaleResult = scaleResult || [-0, -0, -0];
4667
- const scale7 = this.getScale(scaleResult);
4668
- const inverseScale0 = 1 / scale7[0];
4669
- const inverseScale1 = 1 / scale7[1];
4670
- const inverseScale2 = 1 / scale7[2];
2562
+ const scale5 = this.getScale(scaleResult);
2563
+ const inverseScale0 = 1 / scale5[0];
2564
+ const inverseScale1 = 1 / scale5[1];
2565
+ const inverseScale2 = 1 / scale5[2];
4671
2566
  result[0] = this[0] * inverseScale0;
4672
2567
  result[1] = this[1] * inverseScale1;
4673
2568
  result[2] = this[2] * inverseScale2;
@@ -4695,10 +2590,10 @@ var Matrix4 = class extends Matrix {
4695
2590
  getRotationMatrix3(result, scaleResult) {
4696
2591
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4697
2592
  scaleResult = scaleResult || [-0, -0, -0];
4698
- const scale7 = this.getScale(scaleResult);
4699
- const inverseScale0 = 1 / scale7[0];
4700
- const inverseScale1 = 1 / scale7[1];
4701
- const inverseScale2 = 1 / scale7[2];
2593
+ const scale5 = this.getScale(scaleResult);
2594
+ const inverseScale0 = 1 / scale5[0];
2595
+ const inverseScale1 = 1 / scale5[1];
2596
+ const inverseScale2 = 1 / scale5[2];
4702
2597
  result[0] = this[0] * inverseScale0;
4703
2598
  result[1] = this[1] * inverseScale1;
4704
2599
  result[2] = this[2] * inverseScale2;
@@ -4721,11 +2616,11 @@ var Matrix4 = class extends Matrix {
4721
2616
  }
4722
2617
  // Operations
4723
2618
  multiplyLeft(a) {
4724
- multiply4(this, a, this);
2619
+ multiply2(this, a, this);
4725
2620
  return this.check();
4726
2621
  }
4727
2622
  multiplyRight(a) {
4728
- multiply4(this, this, a);
2623
+ multiply2(this, this, a);
4729
2624
  return this.check();
4730
2625
  }
4731
2626
  // Rotates a matrix by the given angle around the X axis
@@ -4762,7 +2657,7 @@ var Matrix4 = class extends Matrix {
4762
2657
  * @returns self
4763
2658
  */
4764
2659
  rotateAxis(radians2, axis) {
4765
- rotate3(this, this, radians2, axis);
2660
+ rotate2(this, this, radians2, axis);
4766
2661
  return this.check();
4767
2662
  }
4768
2663
  /**
@@ -4771,7 +2666,7 @@ var Matrix4 = class extends Matrix {
4771
2666
  * @returns self
4772
2667
  */
4773
2668
  scale(factor) {
4774
- scale4(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
2669
+ scale2(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
4775
2670
  return this.check();
4776
2671
  }
4777
2672
  /**
@@ -4805,9 +2700,9 @@ var Matrix4 = class extends Matrix {
4805
2700
  * @returns self
4806
2701
  */
4807
2702
  transformAsPoint(vector, result) {
4808
- const { length: length5 } = vector;
2703
+ const { length: length4 } = vector;
4809
2704
  let out;
4810
- switch (length5) {
2705
+ switch (length4) {
4811
2706
  case 2:
4812
2707
  out = transformMat4(result || [-0, -0], vector, this);
4813
2708
  break;
@@ -4841,18 +2736,6 @@ var Matrix4 = class extends Matrix {
4841
2736
  checkVector(out, vector.length);
4842
2737
  return out;
4843
2738
  }
4844
- /** @deprecated */
4845
- transformPoint(vector, result) {
4846
- return this.transformAsPoint(vector, result);
4847
- }
4848
- /** @deprecated */
4849
- transformVector(vector, result) {
4850
- return this.transformAsPoint(vector, result);
4851
- }
4852
- /** @deprecated */
4853
- transformDirection(vector, result) {
4854
- return this.transformAsVector(vector, result);
4855
- }
4856
2739
  // three.js math API compatibility
4857
2740
  makeRotationX(radians2) {
4858
2741
  return this.identity().rotateX(radians2);
@@ -4910,57 +2793,7 @@ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, n
4910
2793
  }
4911
2794
 
4912
2795
  // dist/gl-matrix/quat.js
4913
- var quat_exports = {};
4914
- __export(quat_exports, {
4915
- add: () => add6,
4916
- calculateW: () => calculateW,
4917
- clone: () => clone7,
4918
- conjugate: () => conjugate,
4919
- copy: () => copy6,
4920
- create: () => create6,
4921
- dot: () => dot4,
4922
- equals: () => equals7,
4923
- exactEquals: () => exactEquals7,
4924
- exp: () => exp,
4925
- fromMat3: () => fromMat3,
4926
- fromValues: () => fromValues6,
4927
- getAngle: () => getAngle,
4928
- getAxisAngle: () => getAxisAngle,
4929
- identity: () => identity3,
4930
- invert: () => invert3,
4931
- len: () => len4,
4932
- length: () => length4,
4933
- lerp: () => lerp5,
4934
- ln: () => ln,
4935
- mul: () => mul6,
4936
- multiply: () => multiply6,
4937
- normalize: () => normalize4,
4938
- pow: () => pow,
4939
- rotateX: () => rotateX3,
4940
- rotateY: () => rotateY3,
4941
- rotateZ: () => rotateZ3,
4942
- rotationTo: () => rotationTo,
4943
- scale: () => scale6,
4944
- set: () => set6,
4945
- setAxes: () => setAxes,
4946
- setAxisAngle: () => setAxisAngle,
4947
- slerp: () => slerp2,
4948
- sqlerp: () => sqlerp,
4949
- sqrLen: () => sqrLen4,
4950
- squaredLength: () => squaredLength4,
4951
- str: () => str6
4952
- });
4953
- function create6() {
4954
- const out = new ARRAY_TYPE(4);
4955
- if (ARRAY_TYPE !== Float32Array) {
4956
- out[0] = 0;
4957
- out[1] = 0;
4958
- out[2] = 0;
4959
- }
4960
- out[3] = 1;
4961
- return out;
4962
- }
4963
- function identity3(out) {
2796
+ function identity2(out) {
4964
2797
  out[0] = 0;
4965
2798
  out[1] = 0;
4966
2799
  out[2] = 0;
@@ -4976,25 +2809,7 @@ function setAxisAngle(out, axis, rad) {
4976
2809
  out[3] = Math.cos(rad);
4977
2810
  return out;
4978
2811
  }
4979
- function getAxisAngle(out_axis, q) {
4980
- const rad = Math.acos(q[3]) * 2;
4981
- const s = Math.sin(rad / 2);
4982
- if (s > EPSILON) {
4983
- out_axis[0] = q[0] / s;
4984
- out_axis[1] = q[1] / s;
4985
- out_axis[2] = q[2] / s;
4986
- } else {
4987
- out_axis[0] = 1;
4988
- out_axis[1] = 0;
4989
- out_axis[2] = 0;
4990
- }
4991
- return rad;
4992
- }
4993
- function getAngle(a, b) {
4994
- const dotproduct = dot4(a, b);
4995
- return Math.acos(2 * dotproduct * dotproduct - 1);
4996
- }
4997
- function multiply6(out, a, b) {
2812
+ function multiply3(out, a, b) {
4998
2813
  const ax = a[0];
4999
2814
  const ay = a[1];
5000
2815
  const az = a[2];
@@ -5061,40 +2876,7 @@ function calculateW(out, a) {
5061
2876
  out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z));
5062
2877
  return out;
5063
2878
  }
5064
- function exp(out, a) {
5065
- const x = a[0];
5066
- const y = a[1];
5067
- const z = a[2];
5068
- const w = a[3];
5069
- const r = Math.sqrt(x * x + y * y + z * z);
5070
- const et = Math.exp(w);
5071
- const s = r > 0 ? et * Math.sin(r) / r : 0;
5072
- out[0] = x * s;
5073
- out[1] = y * s;
5074
- out[2] = z * s;
5075
- out[3] = et * Math.cos(r);
5076
- return out;
5077
- }
5078
- function ln(out, a) {
5079
- const x = a[0];
5080
- const y = a[1];
5081
- const z = a[2];
5082
- const w = a[3];
5083
- const r = Math.sqrt(x * x + y * y + z * z);
5084
- const t = r > 0 ? Math.atan2(r, w) / r : 0;
5085
- out[0] = x * t;
5086
- out[1] = y * t;
5087
- out[2] = z * t;
5088
- out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);
5089
- return out;
5090
- }
5091
- function pow(out, a, b) {
5092
- ln(out, a);
5093
- scale6(out, out, b);
5094
- exp(out, out);
5095
- return out;
5096
- }
5097
- function slerp2(out, a, b, t) {
2879
+ function slerp(out, a, b, t) {
5098
2880
  const ax = a[0];
5099
2881
  const ay = a[1];
5100
2882
  const az = a[2];
@@ -5136,8 +2918,8 @@ function invert3(out, a) {
5136
2918
  const a1 = a[1];
5137
2919
  const a2 = a[2];
5138
2920
  const a3 = a[3];
5139
- const dot5 = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;
5140
- const invDot = dot5 ? 1 / dot5 : 0;
2921
+ const dot4 = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;
2922
+ const invDot = dot4 ? 1 / dot4 : 0;
5141
2923
  out[0] = -a0 * invDot;
5142
2924
  out[1] = -a1 * invDot;
5143
2925
  out[2] = -a2 * invDot;
@@ -5178,83 +2960,43 @@ function fromMat3(out, m) {
5178
2960
  }
5179
2961
  return out;
5180
2962
  }
5181
- function str6(a) {
5182
- return `quat(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;
5183
- }
5184
- var clone7 = clone6;
5185
- var fromValues6 = fromValues5;
5186
- var copy6 = copy5;
5187
- var set6 = set5;
5188
- var add6 = add5;
5189
- var mul6 = multiply6;
5190
- var scale6 = scale5;
5191
- var dot4 = dot3;
5192
- var lerp5 = lerp4;
5193
- var length4 = length3;
5194
- var len4 = length4;
5195
- var squaredLength4 = squaredLength3;
5196
- var sqrLen4 = squaredLength4;
5197
- var normalize4 = normalize3;
5198
- var exactEquals7 = exactEquals6;
5199
- function equals7(a, b) {
5200
- return Math.abs(dot3(a, b)) >= 1 - EPSILON;
5201
- }
5202
- var rotationTo = (function() {
5203
- const tmpvec3 = create2();
5204
- const xUnitVec3 = fromValues2(1, 0, 0);
5205
- const yUnitVec3 = fromValues2(0, 1, 0);
2963
+ var add2 = add;
2964
+ var scale4 = scale3;
2965
+ var dot3 = dot2;
2966
+ var lerp3 = lerp2;
2967
+ var length3 = length2;
2968
+ var squaredLength2 = squaredLength;
2969
+ var normalize3 = normalize2;
2970
+ var rotationTo = /* @__PURE__ */ (function() {
2971
+ const tmpvec3 = create();
2972
+ const xUnitVec3 = fromValues(1, 0, 0);
2973
+ const yUnitVec3 = fromValues(0, 1, 0);
5206
2974
  return function(out, a, b) {
5207
- const dot5 = dot2(a, b);
5208
- if (dot5 < -0.999999) {
5209
- cross2(tmpvec3, xUnitVec3, a);
5210
- if (len2(tmpvec3) < 1e-6)
5211
- cross2(tmpvec3, yUnitVec3, a);
5212
- normalize2(tmpvec3, tmpvec3);
2975
+ const dot4 = dot(a, b);
2976
+ if (dot4 < -0.999999) {
2977
+ cross(tmpvec3, xUnitVec3, a);
2978
+ if (len(tmpvec3) < 1e-6)
2979
+ cross(tmpvec3, yUnitVec3, a);
2980
+ normalize(tmpvec3, tmpvec3);
5213
2981
  setAxisAngle(out, tmpvec3, Math.PI);
5214
2982
  return out;
5215
- } else if (dot5 > 0.999999) {
2983
+ } else if (dot4 > 0.999999) {
5216
2984
  out[0] = 0;
5217
2985
  out[1] = 0;
5218
2986
  out[2] = 0;
5219
2987
  out[3] = 1;
5220
2988
  return out;
5221
2989
  }
5222
- cross2(tmpvec3, a, b);
2990
+ cross(tmpvec3, a, b);
5223
2991
  out[0] = tmpvec3[0];
5224
2992
  out[1] = tmpvec3[1];
5225
2993
  out[2] = tmpvec3[2];
5226
- out[3] = 1 + dot5;
5227
- return normalize4(out, out);
5228
- };
5229
- })();
5230
- var sqlerp = (function() {
5231
- const temp1 = create6();
5232
- const temp2 = create6();
5233
- return function(out, a, b, c, d, t) {
5234
- slerp2(temp1, a, d, t);
5235
- slerp2(temp2, b, c, t);
5236
- slerp2(out, temp1, temp2, 2 * t * (1 - t));
5237
- return out;
5238
- };
5239
- })();
5240
- var setAxes = (function() {
5241
- const matr = create3();
5242
- return function(out, view, right, up) {
5243
- matr[0] = right[0];
5244
- matr[3] = right[1];
5245
- matr[6] = right[2];
5246
- matr[1] = up[0];
5247
- matr[4] = up[1];
5248
- matr[7] = up[2];
5249
- matr[2] = -view[0];
5250
- matr[5] = -view[1];
5251
- matr[8] = -view[2];
5252
- return normalize4(out, fromMat3(out, matr));
2994
+ out[3] = 1 + dot4;
2995
+ return normalize3(out, out);
5253
2996
  };
5254
2997
  })();
5255
2998
 
5256
2999
  // dist/classes/quaternion.js
5257
- var IDENTITY_QUATERNION = [0, 0, 0, 1];
5258
3000
  var Quaternion = class extends MathArray {
5259
3001
  constructor(x = 0, y = 0, z = 0, w = 1) {
5260
3002
  super(-0, -0, -0, -0);
@@ -5296,13 +3038,37 @@ var Quaternion = class extends MathArray {
5296
3038
  fromMat3(this, m);
5297
3039
  return this.check();
5298
3040
  }
3041
+ /**
3042
+ * Sets this quaternion from Euler angles.
3043
+ * @param euler - Euler angles and rotation order.
3044
+ * @returns This quaternion.
3045
+ */
3046
+ fromEuler(euler) {
3047
+ this.identity();
3048
+ switch (euler.order) {
3049
+ case "xyz":
3050
+ return this.rotateX(euler.x).rotateY(euler.y).rotateZ(euler.z);
3051
+ case "yxz":
3052
+ return this.rotateY(euler.y).rotateX(euler.x).rotateZ(euler.z);
3053
+ case "zxy":
3054
+ return this.rotateZ(euler.z).rotateX(euler.x).rotateY(euler.y);
3055
+ case "zyx":
3056
+ return this.rotateZ(euler.z).rotateY(euler.y).rotateX(euler.x);
3057
+ case "yzx":
3058
+ return this.rotateY(euler.y).rotateZ(euler.z).rotateX(euler.x);
3059
+ case "xzy":
3060
+ return this.rotateX(euler.x).rotateZ(euler.z).rotateY(euler.y);
3061
+ default:
3062
+ throw new Error("Unknown Euler angle order");
3063
+ }
3064
+ }
5299
3065
  fromAxisRotation(axis, rad) {
5300
3066
  setAxisAngle(this, axis, rad);
5301
3067
  return this.check();
5302
3068
  }
5303
3069
  /** Set a quat to the identity quaternion */
5304
3070
  identity() {
5305
- identity3(this);
3071
+ identity2(this);
5306
3072
  return this.check();
5307
3073
  }
5308
3074
  // Set the components of a quat to the given values
@@ -5344,16 +3110,16 @@ var Quaternion = class extends MathArray {
5344
3110
  }
5345
3111
  // Calculates the length of a quat
5346
3112
  len() {
5347
- return length4(this);
3113
+ return length3(this);
5348
3114
  }
5349
3115
  // Calculates the squared length of a quat
5350
3116
  lengthSquared() {
5351
- return squaredLength4(this);
3117
+ return squaredLength2(this);
5352
3118
  }
5353
3119
  // Calculates the dot product of two quat's
5354
3120
  // @return {Number}
5355
3121
  dot(a) {
5356
- return dot4(this, a);
3122
+ return dot3(this, a);
5357
3123
  }
5358
3124
  // Gets the rotation axis and angle for a given quaternion.
5359
3125
  // If a quaternion is created with setAxisAngle, this method will
@@ -5387,7 +3153,7 @@ var Quaternion = class extends MathArray {
5387
3153
  // }
5388
3154
  // Adds two quat's
5389
3155
  add(a) {
5390
- add6(this, this, a);
3156
+ add2(this, this, a);
5391
3157
  return this.check();
5392
3158
  }
5393
3159
  // Calculates the W component of a quat from the X, Y, and Z components.
@@ -5412,27 +3178,27 @@ var Quaternion = class extends MathArray {
5412
3178
  if (t === void 0) {
5413
3179
  return this.lerp(this, a, b);
5414
3180
  }
5415
- lerp5(this, a, b, t);
3181
+ lerp3(this, a, b, t);
5416
3182
  return this.check();
5417
3183
  }
5418
3184
  // Multiplies two quat's
5419
3185
  multiplyRight(a) {
5420
- multiply6(this, this, a);
3186
+ multiply3(this, this, a);
5421
3187
  return this.check();
5422
3188
  }
5423
3189
  multiplyLeft(a) {
5424
- multiply6(this, a, this);
3190
+ multiply3(this, a, this);
5425
3191
  return this.check();
5426
3192
  }
5427
3193
  // Normalize a quat
5428
3194
  normalize() {
5429
- const length5 = this.len();
5430
- const l = length5 > 0 ? 1 / length5 : 0;
3195
+ const length4 = this.len();
3196
+ const l = length4 > 0 ? 1 / length4 : 0;
5431
3197
  this[0] = this[0] * l;
5432
3198
  this[1] = this[1] * l;
5433
3199
  this[2] = this[2] * l;
5434
3200
  this[3] = this[3] * l;
5435
- if (length5 === 0) {
3201
+ if (length4 === 0) {
5436
3202
  this[3] = 1;
5437
3203
  }
5438
3204
  return this.check();
@@ -5454,7 +3220,7 @@ var Quaternion = class extends MathArray {
5454
3220
  }
5455
3221
  // Scales a quat by a scalar number
5456
3222
  scale(b) {
5457
- scale6(this, this, b);
3223
+ scale4(this, this, b);
5458
3224
  return this.check();
5459
3225
  }
5460
3226
  // Performs a spherical linear interpolation between two quat
@@ -5463,13 +3229,6 @@ var Quaternion = class extends MathArray {
5463
3229
  let target;
5464
3230
  let ratio;
5465
3231
  switch (arguments.length) {
5466
- case 1:
5467
- ({
5468
- start = IDENTITY_QUATERNION,
5469
- target,
5470
- ratio
5471
- } = arg0);
5472
- break;
5473
3232
  case 2:
5474
3233
  start = this;
5475
3234
  target = arg0;
@@ -5480,13 +3239,9 @@ var Quaternion = class extends MathArray {
5480
3239
  target = arg1;
5481
3240
  ratio = arg2;
5482
3241
  }
5483
- slerp2(this, start, target, ratio);
3242
+ slerp(this, start, target, ratio);
5484
3243
  return this.check();
5485
3244
  }
5486
- transformVector4(vector, result = new Vector4()) {
5487
- transformQuat2(result, vector, this);
5488
- return checkVector(result, 4);
5489
- }
5490
3245
  // THREE.js Math API compatibility
5491
3246
  lengthSq() {
5492
3247
  return this.lengthSquared();
@@ -5609,15 +3364,22 @@ var SphericalCoordinates = class _SphericalCoordinates {
5609
3364
  return this.check();
5610
3365
  }
5611
3366
  fromVector3(v) {
5612
- this.radius = length2(v);
3367
+ this.radius = Math.hypot(v[0], v[1], v[2]);
5613
3368
  if (this.radius > 0) {
5614
3369
  this.theta = Math.atan2(v[0], v[1]);
5615
3370
  this.phi = Math.acos(clamp(v[2] / this.radius, -1, 1));
5616
3371
  }
5617
3372
  return this.check();
5618
3373
  }
5619
- toVector3() {
5620
- return new Vector3(0, 0, this.radius).rotateX({ radians: this.theta }).rotateZ({ radians: this.phi });
3374
+ toVector3(result = [-0, -0, -0]) {
3375
+ const sinTheta = Math.sin(this.theta);
3376
+ const cosTheta = Math.cos(this.theta);
3377
+ const sinPhi = Math.sin(this.phi);
3378
+ const cosPhi = Math.cos(this.phi);
3379
+ result[0] = this.radius * sinTheta * sinPhi;
3380
+ result[1] = -this.radius * sinTheta * cosPhi;
3381
+ result[2] = this.radius * cosTheta;
3382
+ return result;
5621
3383
  }
5622
3384
  // restrict phi to be betwee EPS and PI-EPS
5623
3385
  makeSafe() {
@@ -5652,56 +3414,7 @@ var ROTATION_ORDER_INDICES = {
5652
3414
  yzx: RotationOrderIndex.YZX,
5653
3415
  xyz: RotationOrderIndex.XYZ
5654
3416
  };
5655
- var ROTATION_ORDERS = {
5656
- ZYX: "zyx",
5657
- YXZ: "yxz",
5658
- XZY: "xzy",
5659
- ZXY: "zxy",
5660
- YZX: "yzx",
5661
- XYZ: "xyz"
5662
- };
5663
3417
  var Euler = class extends MathArray {
5664
- // Constants
5665
- /** @deprecated Pass the string `'zyx'` directly. */
5666
- static get ZYX() {
5667
- return "zyx";
5668
- }
5669
- /** @deprecated Pass the string `'yxz'` directly. */
5670
- static get YXZ() {
5671
- return "yxz";
5672
- }
5673
- /** @deprecated Pass the string `'xzy'` directly. */
5674
- static get XZY() {
5675
- return "xzy";
5676
- }
5677
- /** @deprecated Pass the string `'zxy'` directly. */
5678
- static get ZXY() {
5679
- return "zxy";
5680
- }
5681
- /** @deprecated Pass the string `'yzx'` directly. */
5682
- static get YZX() {
5683
- return "yzx";
5684
- }
5685
- /** @deprecated Pass the string `'xyz'` directly. */
5686
- static get XYZ() {
5687
- return "xyz";
5688
- }
5689
- /** @deprecated Pass the string `'zyx'` directly. */
5690
- static get RollPitchYaw() {
5691
- return "zyx";
5692
- }
5693
- /** @deprecated Pass the string `'zyx'` directly. */
5694
- static get DefaultOrder() {
5695
- return "zyx";
5696
- }
5697
- /** @deprecated Pass an {@link EulerRotationOrder} string directly. */
5698
- static get RotationOrders() {
5699
- return ROTATION_ORDERS;
5700
- }
5701
- /** @deprecated Euler rotation orders are already represented as strings. */
5702
- static rotationOrder(order) {
5703
- return order;
5704
- }
5705
3418
  get ELEMENTS() {
5706
3419
  return 4;
5707
3420
  }
@@ -5720,20 +3433,9 @@ var Euler = class extends MathArray {
5720
3433
  this.set(x, y, z, order);
5721
3434
  }
5722
3435
  }
5723
- fromQuaternion(quaternion) {
5724
- const [x, y, z, w] = quaternion;
5725
- const ysqr = y * y;
5726
- const t0 = -2 * (ysqr + z * z) + 1;
5727
- const t1 = 2 * (x * y + w * z);
5728
- let t2 = -2 * (x * z - w * y);
5729
- const t3 = 2 * (y * z + w * x);
5730
- const t4 = -2 * (x * x + ysqr) + 1;
5731
- t2 = t2 > 1 ? 1 : t2;
5732
- t2 = t2 < -1 ? -1 : t2;
5733
- const roll = Math.atan2(t3, t4);
5734
- const pitch = Math.asin(t2);
5735
- const yaw = Math.atan2(t1, t0);
5736
- return this.set(roll, pitch, yaw, "zyx");
3436
+ fromQuaternion(quaternion, order = this.order) {
3437
+ const matrix = fromQuat2(new Array(16), quaternion);
3438
+ return this.fromRotationMatrix(matrix, order);
5737
3439
  }
5738
3440
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
5739
3441
  fromObject(object) {
@@ -5888,33 +3590,13 @@ var Euler = class extends MathArray {
5888
3590
  fromRollPitchYaw(roll, pitch, yaw) {
5889
3591
  return this.set(roll, pitch, yaw, "zyx");
5890
3592
  }
5891
- fromRotationMatrix(m, order = "zyx") {
3593
+ fromRotationMatrix(m, order = this.order) {
5892
3594
  this._fromRotationMatrix(m, order);
5893
3595
  return this.check();
5894
3596
  }
5895
3597
  // ACCESSORS
5896
- getRotationMatrix(m) {
5897
- return this._getRotationMatrix(m);
5898
- }
5899
- // TODO - move to Quaternion
5900
- getQuaternion() {
5901
- const q = new Quaternion();
5902
- switch (this[3]) {
5903
- case RotationOrderIndex.XYZ:
5904
- return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
5905
- case RotationOrderIndex.YXZ:
5906
- return q.rotateY(this[1]).rotateX(this[0]).rotateZ(this[2]);
5907
- case RotationOrderIndex.ZXY:
5908
- return q.rotateZ(this[2]).rotateX(this[0]).rotateY(this[1]);
5909
- case RotationOrderIndex.ZYX:
5910
- return q.rotateZ(this[2]).rotateY(this[1]).rotateX(this[0]);
5911
- case RotationOrderIndex.YZX:
5912
- return q.rotateY(this[1]).rotateZ(this[2]).rotateX(this[0]);
5913
- case RotationOrderIndex.XZY:
5914
- return q.rotateX(this[0]).rotateZ(this[2]).rotateY(this[1]);
5915
- default:
5916
- throw new Error(ERR_UNKNOWN_ORDER);
5917
- }
3598
+ getRotationMatrix(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0]) {
3599
+ return this._getRotationMatrix(result);
5918
3600
  }
5919
3601
  // INTERNAL METHODS
5920
3602
  // Conversion from Euler to rotation matrix and from matrix to Euler
@@ -5924,7 +3606,7 @@ var Euler = class extends MathArray {
5924
3606
  // const q = new Quaternion().setFromEuler(this);
5925
3607
  // return this.setFromQuaternion(q, newOrder);
5926
3608
  /* eslint-disable complexity, max-statements, one-var */
5927
- _fromRotationMatrix(m, order = "zyx") {
3609
+ _fromRotationMatrix(m, order = this.order) {
5928
3610
  const m11 = m[0], m12 = m[4], m13 = m[8];
5929
3611
  const m21 = m[1], m22 = m[5], m23 = m[9];
5930
3612
  const m31 = m[2], m32 = m[6], m33 = m[10];
@@ -6096,19 +3778,6 @@ var Euler = class extends MathArray {
6096
3778
  te[15] = 1;
6097
3779
  return te;
6098
3780
  }
6099
- toQuaternion() {
6100
- const cy = Math.cos(this.yaw * 0.5);
6101
- const sy = Math.sin(this.yaw * 0.5);
6102
- const cr = Math.cos(this.roll * 0.5);
6103
- const sr = Math.sin(this.roll * 0.5);
6104
- const cp = Math.cos(this.pitch * 0.5);
6105
- const sp = Math.sin(this.pitch * 0.5);
6106
- const w = cy * cr * cp + sy * sr * sp;
6107
- const x = cy * sr * cp - sy * cr * sp;
6108
- const y = cy * cr * sp + sy * sr * cp;
6109
- const z = sy * cr * cp - cy * sr * sp;
6110
- return new Quaternion(x, y, z, w);
6111
- }
6112
3781
  };
6113
3782
  function validateOrder(value) {
6114
3783
  return value >= 0 && value < 6;