@luma.gl/gltf 9.0.12 → 9.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -261,7 +261,7 @@ var __exports__ = (() => {
261
261
  }
262
262
 
263
263
  // ../../node_modules/@loaders.gl/images/dist/lib/utils/version.js
264
- var VERSION = true ? "4.2.0" : "latest";
264
+ var VERSION = true ? "4.2.0-beta.2" : "latest";
265
265
 
266
266
  // ../../node_modules/@loaders.gl/images/dist/lib/category-api/image-type.js
267
267
  var parseImageNode = globalThis.loaders?.parseImageNode;
@@ -833,11 +833,17 @@ var __exports__ = (() => {
833
833
  printRowMajor: true,
834
834
  _cartographicRadians: false
835
835
  };
836
- globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
836
+ globalThis.mathgl = globalThis.mathgl || {
837
+ config: {
838
+ ...DEFAULT_CONFIG
839
+ }
840
+ };
837
841
  var config = globalThis.mathgl.config;
838
- function formatValue(value, { precision = config.precision } = {}) {
842
+ function formatValue(value, {
843
+ precision = config.precision
844
+ } = {}) {
839
845
  value = round(value);
840
- return `${parseFloat(value.toPrecision(precision))}`;
846
+ return "".concat(parseFloat(value.toPrecision(precision)));
841
847
  }
842
848
  function isArray(value) {
843
849
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
@@ -881,12 +887,28 @@ var __exports__ = (() => {
881
887
  }
882
888
 
883
889
  // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
884
- var MathArray = class extends Array {
885
- // Common methods
886
- /**
887
- * Clone the current object
888
- * @returns a new copy of this object
889
- */
890
+ function _extendableBuiltin(cls) {
891
+ function ExtendableBuiltin() {
892
+ var instance = Reflect.construct(cls, Array.from(arguments));
893
+ Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
894
+ return instance;
895
+ }
896
+ ExtendableBuiltin.prototype = Object.create(cls.prototype, {
897
+ constructor: {
898
+ value: cls,
899
+ enumerable: false,
900
+ writable: true,
901
+ configurable: true
902
+ }
903
+ });
904
+ if (Object.setPrototypeOf) {
905
+ Object.setPrototypeOf(ExtendableBuiltin, cls);
906
+ } else {
907
+ ExtendableBuiltin.__proto__ = cls;
908
+ }
909
+ return ExtendableBuiltin;
910
+ }
911
+ var MathArray = class extends _extendableBuiltin(Array) {
890
912
  clone() {
891
913
  return new this.constructor().copy(this);
892
914
  }
@@ -906,10 +928,7 @@ var __exports__ = (() => {
906
928
  return targetObject;
907
929
  }
908
930
  from(arrayOrObject) {
909
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
910
- // @ts-ignore
911
- this.fromObject(arrayOrObject)
912
- );
931
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
913
932
  }
914
933
  to(arrayOrObject) {
915
934
  if (arrayOrObject === this) {
@@ -920,20 +939,18 @@ var __exports__ = (() => {
920
939
  toTarget(target) {
921
940
  return target ? this.to(target) : this;
922
941
  }
923
- /** @deprecated */
924
942
  toFloat32Array() {
925
943
  return new Float32Array(this);
926
944
  }
927
945
  toString() {
928
946
  return this.formatString(config);
929
947
  }
930
- /** Formats string according to options */
931
948
  formatString(opts) {
932
949
  let string = "";
933
950
  for (let i = 0; i < this.ELEMENTS; ++i) {
934
951
  string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
935
952
  }
936
- return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
953
+ return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
937
954
  }
938
955
  equals(array) {
939
956
  if (!array || this.length !== array.length) {
@@ -957,8 +974,6 @@ var __exports__ = (() => {
957
974
  }
958
975
  return true;
959
976
  }
960
- // Modifiers
961
- /** Negates all values in this object */
962
977
  negate() {
963
978
  for (let i = 0; i < this.ELEMENTS; ++i) {
964
979
  this[i] = -this[i];
@@ -976,14 +991,12 @@ var __exports__ = (() => {
976
991
  }
977
992
  return this.check();
978
993
  }
979
- /** Minimal */
980
994
  min(vector) {
981
995
  for (let i = 0; i < this.ELEMENTS; ++i) {
982
996
  this[i] = Math.min(vector[i], this[i]);
983
997
  }
984
998
  return this.check();
985
999
  }
986
- /** Maximal */
987
1000
  max(vector) {
988
1001
  for (let i = 0; i < this.ELEMENTS; ++i) {
989
1002
  this[i] = Math.max(vector[i], this[i]);
@@ -1024,25 +1037,18 @@ var __exports__ = (() => {
1024
1037
  }
1025
1038
  return this.check();
1026
1039
  }
1027
- /**
1028
- * Multiplies all elements by `scale`
1029
- * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
1030
- */
1031
1040
  multiplyByScalar(scalar) {
1032
1041
  for (let i = 0; i < this.ELEMENTS; ++i) {
1033
1042
  this[i] *= scalar;
1034
1043
  }
1035
1044
  return this.check();
1036
1045
  }
1037
- // Debug checks
1038
- /** Throws an error if array length is incorrect or contains illegal values */
1039
1046
  check() {
1040
1047
  if (config.debug && !this.validate()) {
1041
- throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
1048
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
1042
1049
  }
1043
1050
  return this;
1044
1051
  }
1045
- /** Returns false if the array length is incorrect or contains illegal values */
1046
1052
  validate() {
1047
1053
  let valid = this.length === this.ELEMENTS;
1048
1054
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -1050,48 +1056,39 @@ var __exports__ = (() => {
1050
1056
  }
1051
1057
  return valid;
1052
1058
  }
1053
- // three.js compatibility
1054
- /** @deprecated */
1055
1059
  sub(a) {
1056
1060
  return this.subtract(a);
1057
1061
  }
1058
- /** @deprecated */
1059
1062
  setScalar(a) {
1060
1063
  for (let i = 0; i < this.ELEMENTS; ++i) {
1061
1064
  this[i] = a;
1062
1065
  }
1063
1066
  return this.check();
1064
1067
  }
1065
- /** @deprecated */
1066
1068
  addScalar(a) {
1067
1069
  for (let i = 0; i < this.ELEMENTS; ++i) {
1068
1070
  this[i] += a;
1069
1071
  }
1070
1072
  return this.check();
1071
1073
  }
1072
- /** @deprecated */
1073
1074
  subScalar(a) {
1074
1075
  return this.addScalar(-a);
1075
1076
  }
1076
- /** @deprecated */
1077
1077
  multiplyScalar(scalar) {
1078
1078
  for (let i = 0; i < this.ELEMENTS; ++i) {
1079
1079
  this[i] *= scalar;
1080
1080
  }
1081
1081
  return this.check();
1082
1082
  }
1083
- /** @deprecated */
1084
1083
  divideScalar(a) {
1085
1084
  return this.multiplyByScalar(1 / a);
1086
1085
  }
1087
- /** @deprecated */
1088
1086
  clampScalar(min, max) {
1089
1087
  for (let i = 0; i < this.ELEMENTS; ++i) {
1090
1088
  this[i] = Math.min(Math.max(this[i], min), max);
1091
1089
  }
1092
1090
  return this.check();
1093
1091
  }
1094
- /** @deprecated */
1095
1092
  get elements() {
1096
1093
  return this;
1097
1094
  }
@@ -1111,13 +1108,13 @@ var __exports__ = (() => {
1111
1108
  }
1112
1109
  function checkNumber(value) {
1113
1110
  if (!Number.isFinite(value)) {
1114
- throw new Error(`Invalid number ${JSON.stringify(value)}`);
1111
+ throw new Error("Invalid number ".concat(JSON.stringify(value)));
1115
1112
  }
1116
1113
  return value;
1117
1114
  }
1118
1115
  function checkVector(v, length4, callerName = "") {
1119
1116
  if (config.debug && !validateVector(v, length4)) {
1120
- throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
1117
+ throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
1121
1118
  }
1122
1119
  return v;
1123
1120
  }
@@ -1125,13 +1122,12 @@ var __exports__ = (() => {
1125
1122
  // ../../node_modules/@math.gl/core/dist/lib/assert.js
1126
1123
  function assert2(condition, message) {
1127
1124
  if (!condition) {
1128
- throw new Error(`math.gl assertion ${message}`);
1125
+ throw new Error("math.gl assertion ".concat(message));
1129
1126
  }
1130
1127
  }
1131
1128
 
1132
1129
  // ../../node_modules/@math.gl/core/dist/classes/base/vector.js
1133
1130
  var Vector = class extends MathArray {
1134
- // ACCESSORS
1135
1131
  get x() {
1136
1132
  return this[0];
1137
1133
  }
@@ -1144,24 +1140,12 @@ var __exports__ = (() => {
1144
1140
  set y(value) {
1145
1141
  this[1] = checkNumber(value);
1146
1142
  }
1147
- /**
1148
- * Returns the length of the vector from the origin to the point described by this vector
1149
- *
1150
- * @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
1151
- * Instead we provide `len` and `magnitude`
1152
- */
1153
1143
  len() {
1154
1144
  return Math.sqrt(this.lengthSquared());
1155
1145
  }
1156
- /**
1157
- * Returns the length of the vector from the origin to the point described by this vector
1158
- */
1159
1146
  magnitude() {
1160
1147
  return this.len();
1161
1148
  }
1162
- /**
1163
- * Returns the squared length of the vector from the origin to the point described by this vector
1164
- */
1165
1149
  lengthSquared() {
1166
1150
  let length4 = 0;
1167
1151
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -1169,9 +1153,6 @@ var __exports__ = (() => {
1169
1153
  }
1170
1154
  return length4;
1171
1155
  }
1172
- /**
1173
- * Returns the squared length of the vector from the origin to the point described by this vector
1174
- */
1175
1156
  magnitudeSquared() {
1176
1157
  return this.lengthSquared();
1177
1158
  }
@@ -1193,7 +1174,6 @@ var __exports__ = (() => {
1193
1174
  }
1194
1175
  return checkNumber(product);
1195
1176
  }
1196
- // MODIFIERS
1197
1177
  normalize() {
1198
1178
  const length4 = this.magnitude();
1199
1179
  if (length4 !== 0) {
@@ -1219,7 +1199,6 @@ var __exports__ = (() => {
1219
1199
  }
1220
1200
  return this.check();
1221
1201
  }
1222
- // THREE.js compatibility
1223
1202
  lengthSq() {
1224
1203
  return this.lengthSquared();
1225
1204
  }
@@ -1518,8 +1497,6 @@ var __exports__ = (() => {
1518
1497
  object.w = this[3];
1519
1498
  return object;
1520
1499
  }
1521
- // Getters/setters
1522
- /* eslint-disable no-multi-spaces, brace-style, no-return-assign */
1523
1500
  get ELEMENTS() {
1524
1501
  return 4;
1525
1502
  }
@@ -1551,7 +1528,6 @@ var __exports__ = (() => {
1551
1528
  transformQuat(this, this, quaternion2);
1552
1529
  return this.check();
1553
1530
  }
1554
- // three.js compatibility
1555
1531
  applyMatrix4(m) {
1556
1532
  m.transform(this, this);
1557
1533
  return this;
@@ -1560,29 +1536,19 @@ var __exports__ = (() => {
1560
1536
 
1561
1537
  // ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
1562
1538
  var Matrix = class extends MathArray {
1563
- // fromObject(object) {
1564
- // const array = object.elements;
1565
- // return this.fromRowMajor(array);
1566
- // }
1567
- // toObject(object) {
1568
- // const array = object.elements;
1569
- // this.toRowMajor(array);
1570
- // return object;
1571
- // }
1572
- // TODO better override formatString?
1573
1539
  toString() {
1574
1540
  let string = "[";
1575
1541
  if (config.printRowMajor) {
1576
1542
  string += "row-major:";
1577
1543
  for (let row = 0; row < this.RANK; ++row) {
1578
1544
  for (let col = 0; col < this.RANK; ++col) {
1579
- string += ` ${this[col * this.RANK + row]}`;
1545
+ string += " ".concat(this[col * this.RANK + row]);
1580
1546
  }
1581
1547
  }
1582
1548
  } else {
1583
1549
  string += "column-major:";
1584
1550
  for (let i = 0; i < this.ELEMENTS; ++i) {
1585
- string += ` ${this[i]}`;
1551
+ string += " ".concat(this[i]);
1586
1552
  }
1587
1553
  }
1588
1554
  string += "]";
@@ -1591,11 +1557,9 @@ var __exports__ = (() => {
1591
1557
  getElementIndex(row, col) {
1592
1558
  return col * this.RANK + row;
1593
1559
  }
1594
- // By default assumes row major indices
1595
1560
  getElement(row, col) {
1596
1561
  return this[col * this.RANK + row];
1597
1562
  }
1598
- // By default assumes row major indices
1599
1563
  setElement(row, col, value) {
1600
1564
  this[col * this.RANK + row] = checkNumber(value);
1601
1565
  return this;
@@ -2453,7 +2417,6 @@ var __exports__ = (() => {
2453
2417
  this[15] = array[15];
2454
2418
  return this.check();
2455
2419
  }
2456
- // eslint-disable-next-line max-params
2457
2420
  set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
2458
2421
  this[0] = m00;
2459
2422
  this[1] = m10;
@@ -2473,8 +2436,6 @@ var __exports__ = (() => {
2473
2436
  this[15] = m33;
2474
2437
  return this.check();
2475
2438
  }
2476
- // accepts row major order, stores as column major
2477
- // eslint-disable-next-line max-params
2478
2439
  setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
2479
2440
  this[0] = m00;
2480
2441
  this[1] = m10;
@@ -2513,41 +2474,25 @@ var __exports__ = (() => {
2513
2474
  result[15] = this[15];
2514
2475
  return result;
2515
2476
  }
2516
- // Constructors
2517
- /** Set to identity matrix */
2518
2477
  identity() {
2519
2478
  return this.copy(IDENTITY_MATRIX);
2520
2479
  }
2521
- /**
2522
- *
2523
- * @param object
2524
- * @returns self
2525
- */
2526
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2527
2480
  fromObject(object) {
2528
2481
  return this.check();
2529
2482
  }
2530
- /**
2531
- * Calculates a 4x4 matrix from the given quaternion
2532
- * @param quaternion Quaternion to create matrix from
2533
- * @returns self
2534
- */
2535
2483
  fromQuaternion(quaternion2) {
2536
2484
  fromQuat(this, quaternion2);
2537
2485
  return this.check();
2538
2486
  }
2539
- /**
2540
- * Generates a frustum matrix with the given bounds
2541
- * @param view.left - Left bound of the frustum
2542
- * @param view.right - Right bound of the frustum
2543
- * @param view.bottom - Bottom bound of the frustum
2544
- * @param view.top - Top bound of the frustum
2545
- * @param view.near - Near bound of the frustum
2546
- * @param view.far - Far bound of the frustum. Can be set to Infinity.
2547
- * @returns self
2548
- */
2549
2487
  frustum(view) {
2550
- const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
2488
+ const {
2489
+ left,
2490
+ right,
2491
+ bottom,
2492
+ top,
2493
+ near = DEFAULT_NEAR,
2494
+ far = DEFAULT_FAR
2495
+ } = view;
2551
2496
  if (far === Infinity) {
2552
2497
  computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
2553
2498
  } else {
@@ -2555,47 +2500,35 @@ var __exports__ = (() => {
2555
2500
  }
2556
2501
  return this.check();
2557
2502
  }
2558
- /**
2559
- * Generates a look-at matrix with the given eye position, focal point,
2560
- * and up axis
2561
- * @param view.eye - (vector) Position of the viewer
2562
- * @param view.center - (vector) Point the viewer is looking at
2563
- * @param view.up - (vector) Up axis
2564
- * @returns self
2565
- */
2566
2503
  lookAt(view) {
2567
- const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
2504
+ const {
2505
+ eye,
2506
+ center = [0, 0, 0],
2507
+ up = [0, 1, 0]
2508
+ } = view;
2568
2509
  lookAt(this, eye, center, up);
2569
2510
  return this.check();
2570
2511
  }
2571
- /**
2572
- * Generates a orthogonal projection matrix with the given bounds
2573
- * from "traditional" view space parameters
2574
- * @param view.left - Left bound of the frustum
2575
- * @param view.right number Right bound of the frustum
2576
- * @param view.bottom - Bottom bound of the frustum
2577
- * @param view.top number Top bound of the frustum
2578
- * @param view.near - Near bound of the frustum
2579
- * @param view.far number Far bound of the frustum
2580
- * @returns self
2581
- */
2582
2512
  ortho(view) {
2583
- const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
2513
+ const {
2514
+ left,
2515
+ right,
2516
+ bottom,
2517
+ top,
2518
+ near = DEFAULT_NEAR,
2519
+ far = DEFAULT_FAR
2520
+ } = view;
2584
2521
  ortho(this, left, right, bottom, top, near, far);
2585
2522
  return this.check();
2586
2523
  }
2587
- /**
2588
- * Generates an orthogonal projection matrix with the same parameters
2589
- * as a perspective matrix (plus focalDistance)
2590
- * @param view.fovy Vertical field of view in radians
2591
- * @param view.aspect Aspect ratio. Typically viewport width / viewport height
2592
- * @param view.focalDistance Distance in the view frustum used for extent calculations
2593
- * @param view.near Near bound of the frustum
2594
- * @param view.far Far bound of the frustum
2595
- * @returns self
2596
- */
2597
2524
  orthographic(view) {
2598
- const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
2525
+ const {
2526
+ fovy = DEFAULT_FOVY,
2527
+ aspect = DEFAULT_ASPECT,
2528
+ focalDistance = 1,
2529
+ near = DEFAULT_NEAR,
2530
+ far = DEFAULT_FAR
2531
+ } = view;
2599
2532
  checkRadians(fovy);
2600
2533
  const halfY = fovy / 2;
2601
2534
  const top = focalDistance * Math.tan(halfY);
@@ -2609,53 +2542,32 @@ var __exports__ = (() => {
2609
2542
  far
2610
2543
  });
2611
2544
  }
2612
- /**
2613
- * Generates a perspective projection matrix with the given bounds
2614
- * @param view.fovy Vertical field of view in radians
2615
- * @param view.aspect Aspect ratio. typically viewport width/height
2616
- * @param view.near Near bound of the frustum
2617
- * @param view.far Far bound of the frustum
2618
- * @returns self
2619
- */
2620
2545
  perspective(view) {
2621
- const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
2546
+ const {
2547
+ fovy = 45 * Math.PI / 180,
2548
+ aspect = 1,
2549
+ near = 0.1,
2550
+ far = 500
2551
+ } = view;
2622
2552
  checkRadians(fovy);
2623
2553
  perspective(this, fovy, aspect, near, far);
2624
2554
  return this.check();
2625
2555
  }
2626
- // Accessors
2627
2556
  determinant() {
2628
2557
  return determinant(this);
2629
2558
  }
2630
- /**
2631
- * Extracts the non-uniform scale assuming the matrix is an affine transformation.
2632
- * The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
2633
- * @param result
2634
- * @returns self
2635
- */
2636
2559
  getScale(result = [-0, -0, -0]) {
2637
2560
  result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
2638
2561
  result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
2639
2562
  result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
2640
2563
  return result;
2641
2564
  }
2642
- /**
2643
- * Gets the translation portion, assuming the matrix is a affine transformation matrix.
2644
- * @param result
2645
- * @returns self
2646
- */
2647
2565
  getTranslation(result = [-0, -0, -0]) {
2648
2566
  result[0] = this[12];
2649
2567
  result[1] = this[13];
2650
2568
  result[2] = this[14];
2651
2569
  return result;
2652
2570
  }
2653
- /**
2654
- * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
2655
- * @param result
2656
- * @param scaleResult
2657
- * @returns self
2658
- */
2659
2571
  getRotation(result, scaleResult) {
2660
2572
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
2661
2573
  scaleResult = scaleResult || [-0, -0, -0];
@@ -2681,12 +2593,6 @@ var __exports__ = (() => {
2681
2593
  result[15] = 1;
2682
2594
  return result;
2683
2595
  }
2684
- /**
2685
- *
2686
- * @param result
2687
- * @param scaleResult
2688
- * @returns self
2689
- */
2690
2596
  getRotationMatrix3(result, scaleResult) {
2691
2597
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
2692
2598
  scaleResult = scaleResult || [-0, -0, -0];
@@ -2705,7 +2611,6 @@ var __exports__ = (() => {
2705
2611
  result[8] = this[10] * inverseScale2;
2706
2612
  return result;
2707
2613
  }
2708
- // Modifiers
2709
2614
  transpose() {
2710
2615
  transpose(this, this);
2711
2616
  return this.check();
@@ -2714,7 +2619,6 @@ var __exports__ = (() => {
2714
2619
  invert(this, this);
2715
2620
  return this.check();
2716
2621
  }
2717
- // Operations
2718
2622
  multiplyLeft(a) {
2719
2623
  multiply(this, a, this);
2720
2624
  return this.check();
@@ -2723,68 +2627,33 @@ var __exports__ = (() => {
2723
2627
  multiply(this, this, a);
2724
2628
  return this.check();
2725
2629
  }
2726
- // Rotates a matrix by the given angle around the X axis
2727
2630
  rotateX(radians) {
2728
2631
  rotateX(this, this, radians);
2729
2632
  return this.check();
2730
2633
  }
2731
- // Rotates a matrix by the given angle around the Y axis.
2732
2634
  rotateY(radians) {
2733
2635
  rotateY(this, this, radians);
2734
2636
  return this.check();
2735
2637
  }
2736
- /**
2737
- * Rotates a matrix by the given angle around the Z axis.
2738
- * @param radians
2739
- * @returns self
2740
- */
2741
2638
  rotateZ(radians) {
2742
2639
  rotateZ(this, this, radians);
2743
2640
  return this.check();
2744
2641
  }
2745
- /**
2746
- *
2747
- * @param param0
2748
- * @returns self
2749
- */
2750
2642
  rotateXYZ(angleXYZ) {
2751
2643
  return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
2752
2644
  }
2753
- /**
2754
- *
2755
- * @param radians
2756
- * @param axis
2757
- * @returns self
2758
- */
2759
2645
  rotateAxis(radians, axis) {
2760
2646
  rotate(this, this, radians, axis);
2761
2647
  return this.check();
2762
2648
  }
2763
- /**
2764
- *
2765
- * @param factor
2766
- * @returns self
2767
- */
2768
2649
  scale(factor) {
2769
2650
  scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
2770
2651
  return this.check();
2771
2652
  }
2772
- /**
2773
- *
2774
- * @param vec
2775
- * @returns self
2776
- */
2777
2653
  translate(vector) {
2778
2654
  translate(this, this, vector);
2779
2655
  return this.check();
2780
2656
  }
2781
- // Transforms
2782
- /**
2783
- * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
2784
- * @param vector
2785
- * @param result
2786
- * @returns self
2787
- */
2788
2657
  transform(vector, result) {
2789
2658
  if (vector.length === 4) {
2790
2659
  result = transformMat43(result || [-0, -0, -0, -0], vector, this);
@@ -2793,14 +2662,10 @@ var __exports__ = (() => {
2793
2662
  }
2794
2663
  return this.transformAsPoint(vector, result);
2795
2664
  }
2796
- /**
2797
- * Transforms any 2 or 3 element array as point (w implicitly 1)
2798
- * @param vector
2799
- * @param result
2800
- * @returns self
2801
- */
2802
2665
  transformAsPoint(vector, result) {
2803
- const { length: length4 } = vector;
2666
+ const {
2667
+ length: length4
2668
+ } = vector;
2804
2669
  let out;
2805
2670
  switch (length4) {
2806
2671
  case 2:
@@ -2815,12 +2680,6 @@ var __exports__ = (() => {
2815
2680
  checkVector(out, vector.length);
2816
2681
  return out;
2817
2682
  }
2818
- /**
2819
- * Transforms any 2 or 3 element array as vector (w implicitly 0)
2820
- * @param vector
2821
- * @param result
2822
- * @returns self
2823
- */
2824
2683
  transformAsVector(vector, result) {
2825
2684
  let out;
2826
2685
  switch (vector.length) {
@@ -2836,19 +2695,15 @@ var __exports__ = (() => {
2836
2695
  checkVector(out, vector.length);
2837
2696
  return out;
2838
2697
  }
2839
- /** @deprecated */
2840
2698
  transformPoint(vector, result) {
2841
2699
  return this.transformAsPoint(vector, result);
2842
2700
  }
2843
- /** @deprecated */
2844
2701
  transformVector(vector, result) {
2845
2702
  return this.transformAsPoint(vector, result);
2846
2703
  }
2847
- /** @deprecated */
2848
2704
  transformDirection(vector, result) {
2849
2705
  return this.transformAsVector(vector, result);
2850
2706
  }
2851
- // three.js math API compatibility
2852
2707
  makeRotationX(radians) {
2853
2708
  return this.identity().rotateX(radians);
2854
2709
  }
@@ -3175,13 +3030,6 @@ var __exports__ = (() => {
3175
3030
  this[3] = object.w;
3176
3031
  return this.check();
3177
3032
  }
3178
- /**
3179
- * Creates a quaternion from the given 3x3 rotation matrix.
3180
- * NOTE: The resultant quaternion is not normalized, so you should
3181
- * be sure to renormalize the quaternion yourself where necessary.
3182
- * @param m
3183
- * @returns
3184
- */
3185
3033
  fromMatrix3(m) {
3186
3034
  fromMat3(this, m);
3187
3035
  return this.check();
@@ -3190,21 +3038,13 @@ var __exports__ = (() => {
3190
3038
  setAxisAngle(this, axis, rad);
3191
3039
  return this.check();
3192
3040
  }
3193
- /** Set a quat to the identity quaternion */
3194
3041
  identity() {
3195
3042
  identity2(this);
3196
3043
  return this.check();
3197
3044
  }
3198
- // Set the components of a quat to the given values
3199
- // set(i, j, k, l) {
3200
- // quat_set(this, i, j, k, l);
3201
- // return this.check();
3202
- // }
3203
- // Sets a quat from the given angle and rotation axis, then returns it.
3204
3045
  setAxisAngle(axis, rad) {
3205
3046
  return this.fromAxisRotation(axis, rad);
3206
3047
  }
3207
- // Getters/setters
3208
3048
  get ELEMENTS() {
3209
3049
  return 4;
3210
3050
  }
@@ -3232,72 +3072,35 @@ var __exports__ = (() => {
3232
3072
  set w(value) {
3233
3073
  this[3] = checkNumber(value);
3234
3074
  }
3235
- // Calculates the length of a quat
3236
3075
  len() {
3237
3076
  return length3(this);
3238
3077
  }
3239
- // Calculates the squared length of a quat
3240
3078
  lengthSquared() {
3241
3079
  return squaredLength2(this);
3242
3080
  }
3243
- // Calculates the dot product of two quat's
3244
- // @return {Number}
3245
3081
  dot(a) {
3246
3082
  return dot3(this, a);
3247
3083
  }
3248
- // Gets the rotation axis and angle for a given quaternion.
3249
- // If a quaternion is created with setAxisAngle, this method will
3250
- // return the same values as providied in the original parameter
3251
- // list OR functionally equivalent values.
3252
- // Example: The quaternion formed by axis [0, 0, 1] and angle -90
3253
- // is the same as the quaternion formed by [0, 0, 1] and 270.
3254
- // This method favors the latter.
3255
- // @return {{[x,y,z], Number}}
3256
- // getAxisAngle() {
3257
- // const axis = [];
3258
- // // const angle = quat_getAxisAngle(axis, this);
3259
- // return {axis, angle};
3260
- // }
3261
- // MODIFIERS
3262
- // Sets a quaternion to represent the shortest rotation from one vector
3263
- // to another. Both vectors are assumed to be unit length.
3264
3084
  rotationTo(vectorA, vectorB) {
3265
3085
  rotationTo(this, vectorA, vectorB);
3266
3086
  return this.check();
3267
3087
  }
3268
- // Sets the specified quaternion with values corresponding to the given axes.
3269
- // Each axis is a vec3 and is expected to be unit length and perpendicular
3270
- // to all other specified axes.
3271
- // setAxes() {
3272
- // Number
3273
- // }
3274
- // Performs a spherical linear interpolation with two control points
3275
- // sqlerp() {
3276
- // Number;
3277
- // }
3278
- // Adds two quat's
3279
3088
  add(a) {
3280
3089
  add2(this, this, a);
3281
3090
  return this.check();
3282
3091
  }
3283
- // Calculates the W component of a quat from the X, Y, and Z components.
3284
- // Any existing W component will be ignored.
3285
3092
  calculateW() {
3286
3093
  calculateW(this, this);
3287
3094
  return this.check();
3288
3095
  }
3289
- // Calculates the conjugate of a quat If the quaternion is normalized,
3290
- // this function is faster than quat_invert and produces the same result.
3291
3096
  conjugate() {
3292
3097
  conjugate(this, this);
3293
3098
  return this.check();
3294
3099
  }
3295
- // Calculates the inverse of a quat
3296
3100
  invert() {
3297
3101
  invert2(this, this);
3298
3102
  return this.check();
3299
3103
  }
3300
- // Performs a linear interpolation between two quat's
3301
3104
  lerp(a, b, t) {
3302
3105
  if (t === void 0) {
3303
3106
  return this.lerp(this, a, b);
@@ -3305,7 +3108,6 @@ var __exports__ = (() => {
3305
3108
  lerp2(this, a, b, t);
3306
3109
  return this.check();
3307
3110
  }
3308
- // Multiplies two quat's
3309
3111
  multiplyRight(a) {
3310
3112
  multiply2(this, this, a);
3311
3113
  return this.check();
@@ -3314,7 +3116,6 @@ var __exports__ = (() => {
3314
3116
  multiply2(this, a, this);
3315
3117
  return this.check();
3316
3118
  }
3317
- // Normalize a quat
3318
3119
  normalize() {
3319
3120
  const length4 = this.len();
3320
3121
  const l = length4 > 0 ? 1 / length4 : 0;
@@ -3327,27 +3128,22 @@ var __exports__ = (() => {
3327
3128
  }
3328
3129
  return this.check();
3329
3130
  }
3330
- // Rotates a quaternion by the given angle about the X axis
3331
3131
  rotateX(rad) {
3332
3132
  rotateX2(this, this, rad);
3333
3133
  return this.check();
3334
3134
  }
3335
- // Rotates a quaternion by the given angle about the Y axis
3336
3135
  rotateY(rad) {
3337
3136
  rotateY2(this, this, rad);
3338
3137
  return this.check();
3339
3138
  }
3340
- // Rotates a quaternion by the given angle about the Z axis
3341
3139
  rotateZ(rad) {
3342
3140
  rotateZ2(this, this, rad);
3343
3141
  return this.check();
3344
3142
  }
3345
- // Scales a quat by a scalar number
3346
3143
  scale(b) {
3347
3144
  scale3(this, this, b);
3348
3145
  return this.check();
3349
3146
  }
3350
- // Performs a spherical linear interpolation between two quat
3351
3147
  slerp(arg0, arg1, arg2) {
3352
3148
  let start;
3353
3149
  let target;
@@ -3377,7 +3173,6 @@ var __exports__ = (() => {
3377
3173
  transformQuat2(result, vector, this);
3378
3174
  return checkVector(result, 4);
3379
3175
  }
3380
- // THREE.js Math API compatibility
3381
3176
  lengthSq() {
3382
3177
  return this.lengthSquared();
3383
3178
  }
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- var __exports__=(()=>{var Ln=Object.create;var ot=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var vn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wn=(e,t)=>{for(var n in t)ot(e,n,{get:t[n],enumerable:!0})},it=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of In(t))!Nn.call(e,s)&&s!==n&&ot(e,s,{get:()=>t[s],enumerable:!(r=Rn(t,s))||r.enumerable});return e},ct=(e,t,n)=>(it(e,t,"default"),n&&it(n,t,"default")),D=(e,t,n)=>(n=e!=null?Ln(vn(e)):{},it(t||!e||!e.__esModule?ot(n,"default",{value:e,enumerable:!0}):n,e)),bn=e=>it(ot({},"__esModule",{value:!0}),e);var j=Kt((Kr,Qt)=>{Qt.exports=globalThis.luma});var Pt=Kt((Js,ge)=>{ge.exports=globalThis.luma});var st={};wn(st,{GLTFAnimator:()=>W,createScenegraphsFromGLTF:()=>Tn,loadPBREnvironment:()=>xe,parsePBRMaterial:()=>at});ct(st,D(j(),1));var Zt=D(j(),1),C;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(C||(C={}));function at(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&On(e,t,s),s}function On(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Pn(e,t.pbrMetallicRoughness,n),t.normalTexture){K(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){K(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(K(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Zt.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=C.FUNC_ADD,n.glParameters.blendFunc=[C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA];break}}function Pn(e,t,n){t.baseColorTexture&&K(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&K(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function K(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,c,a={};o.compressed?(c=o,a={[C.TEXTURE_MIN_FILTER]:o.data.length>1?C.LINEAR_MIPMAP_NEAREST:C.LINEAR}):c={data:o};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...a},pixelStore:{[C.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var B={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Cn=B.self||B.window||B.global||{},Bn=B.window||B.self||B.global||{},zn=B.global||B.self||B.window||{},kn=B.document||{};var Tt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Jt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Fn=Jt&&parseFloat(Jt[1])||0;var Un="",te={};function Lt(e){for(let t in te)if(e.startsWith(t)){let n=te[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Un}${e}`),e}var ee="4.2.0";var Vn=globalThis.loaders?.parseImageNode,Rt=typeof Image<"u",It=typeof ImageBitmap<"u",qn=Boolean(Vn),vt=Tt?!0:qn;function ne(e){switch(e){case"auto":return It||Rt||vt;case"imagebitmap":return It;case"image":return Rt;case"data":return vt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function re(){if(It)return"imagebitmap";if(Rt)return"image";if(vt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function se(e){let t=Dn(e);if(!t)throw new Error("Not an image");return t}function Nt(e){return ft(e)}function ft(e){switch(se(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Dn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Yn=/^data:image\/svg\+xml/,Hn=/\.svg((\?|#).*)?$/;function lt(e){return e&&(Yn.test(e)||Hn.test(e))}function ie(e,t){if(lt(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return wt(e,t)}function wt(e,t){if(lt(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ht(e,t,n){let r=ie(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await Gn(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function Gn(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var Wn={},oe=!0;async function ce(e,t,n){let r;lt(n)?r=await ht(e,t,n):r=wt(e,n);let s=t&&t.imagebitmap;return await $n(r,s)}async function $n(e,t=null){if((Xn(t)||!oe)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),oe=!1}return await createImageBitmap(e)}function Xn(e){for(let t in e||Wn)return!1;return!0}function ae(e){return!Zn(e,"ftyp",4)||!(e[8]&96)?null:jn(e)}function jn(e){switch(Kn(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Kn(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Qn(e){return[...e].map(t=>t.charCodeAt(0))}function Zn(e,t,n=0){let r=Qn(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var z=!1,Q=!0;function pt(e){let t=Z(e);return tr(t)||rr(t)||er(t)||nr(t)||Jn(t)}function Jn(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=ae(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function tr(e){let t=Z(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function er(e){let t=Z(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Q),height:t.getUint16(8,Q)}:null}function nr(e){let t=Z(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,Q)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Q),height:t.getUint32(22,Q)}:null}function rr(e){let t=Z(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=sr(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,z);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,z),width:t.getUint16(i+7,z)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,z)}return null}function sr(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Z(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function fe(e,t){let{mimeType:n}=pt(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function le(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=ir(s),c;switch(o){case"imagebitmap":c=await ce(e,t,i);break;case"image":c=await ht(e,t,i);break;case"data":c=await fe(e,t);break;default:q(!1)}return s==="data"&&(c=ft(c)),c}function ir(e){switch(e){case"auto":case"data":return re();default:return ne(e),e}}var or=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],cr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ar={image:{type:"auto",decode:!0}},mt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:ee,mimeTypes:cr,extensions:or,parse:le,tests:[e=>Boolean(pt(new DataView(e)))],options:ar};function xt(e,t,n){let r=typeof e=="function"?e({...t,...n}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),Lt(r)}var fr=e=>e&&typeof e=="object";async function he(e,t,n={}){return await bt(e,t,n)}async function bt(e,t,n){return Array.isArray(e)?await hr(e,t,n):fr(e)?await lr(e,t,n):await t(e,n)}async function lr(e,t,n){let r=[],s={};for(let i in e){let o=e[i],c=bt(o,t,n).then(a=>{s[i]=a});r.push(c)}return await Promise.all(r),s}async function hr(e,t,n={}){let r=e.map(s=>bt(s,t,n));return await Promise.all(r)}async function pe(e,t,n){return await he(e,r=>Ot(r,t,n))}async function Ot(e,t,n){let s=await(await fetch(e,n.fetch)).arrayBuffer();return await t(s,n)}async function J(e,t={}){let n=await pr(e,t);return await pe(n,mt.parse,t)}async function pr(e,t,n={}){let r=t&&t.image&&t.image.mipLevels||0;return r!==0?await mr(e,r,t,n):xt(e,t,n)}async function mr(e,t,n,r){let s=[];if(t==="auto"){let i=xt(e,n,{...r,lod:0}),o=await Ot(i,mt.parse,n),{width:c,height:a}=Nt(o);t=xr({width:c,height:a}),s.push(i)}q(t>0);for(let i=s.length;i<t;++i){let o=xt(e,n,{...r,lod:i});s.push(o)}return s}function xr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}function xe(e,t){let n=e.createTexture({id:"brdfLUT",sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"},data:J(t.brdfLutUrl)}),r=me(e,{id:"DiffuseEnvSampler",getTextureForFace:i=>J(t.getTexUrl("diffuse",i,0)),sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}}),s=me(e,{id:"SpecularEnvSampler",getTextureForFace:i=>{let o=[];for(let c=0;c<=t.specularMipLevels-1;c++)o.push(J(t.getTexUrl("specular",i,c)));return o},sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:r,specularEnvSampler:s}}var gr=[0,1,2,3,4,5];function me(e,{id:t,getTextureForFace:n,sampler:r}){let s={};return gr.forEach(i=>{s[String(i)]=n(i)}),e.createTexture({id:t,dimension:"cube",mipmaps:!1,sampler:r,data:s})}var $=D(Pt(),1);var ti=1/Math.PI*180,ei=1/180*Math.PI,dr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...dr}};var L=globalThis.mathgl.config;function de(e,{precision:t=L.precision}={}){return e=Mr(e),`${parseFloat(e.toPrecision(t))}`}function Y(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ct(e,t,n){let r=L.EPSILON;n&&(L.EPSILON=n);try{if(e===t)return!0;if(Y(e)&&Y(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Ct(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=L.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{L.EPSILON=r}}function Mr(e){return Math.round(e/L.EPSILON)*L.EPSILON}var V=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Y(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(L)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+de(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Ct(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(L.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function ur(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function y(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function H(e,t,n=""){if(L.debug&&!ur(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Bt(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var gt=class extends V{get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),y(this[t])}setComponent(t,n){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var R=typeof Float32Array<"u"?Float32Array:Array;var pi=Math.PI/180;function _r(){let e=new R(2);return R!=Float32Array&&(e[0]=0,e[1]=0),e}function _e(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var mi=function(){let e=_r();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function Ae(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function Se(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Ee(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ye(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function zt(){let e=new R(3);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ar(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function kt(e,t,n){let r=new R(3);return r[0]=e,r[1]=t,r[2]=n,r}function Te(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Le(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function dt(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Mt(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Re(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],f=t[2],l=s*f-i*a,h=i*c-r*f,p=r*a-s*c,m=s*p-i*h,x=i*l-r*p,g=r*h-s*l,d=o*2;return l*=d,h*=d,p*=d,m*=2,x*=2,g*=2,e[0]=c+l+m,e[1]=a+h+x,e[2]=f+p+g,e}var Ie=Ar;var di=function(){let e=zt();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var ut,G=class extends gt{static get ZERO(){return ut||(ut=new G(0,0,0,0),Object.freeze(ut)),ut}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Y(t)&&arguments.length===1?this.copy(t):(L.debug&&(y(t),y(n),y(r),y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return L.debug&&(y(t.x),y(t.y),y(t.z),y(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}transform(t){return Mt(this,this,t),this.check()}transformByMatrix3(t){return ye(this,this,t),this.check()}transformByMatrix2(t){return Ee(this,this,t),this.check()}transformByQuaternion(t){return Re(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var _t=class extends V{toString(){let t="[";if(L.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function ve(){let e=new R(9);return R!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function yr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ne(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function we(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=t[9],p=t[10],m=t[11],x=t[12],g=t[13],d=t[14],S=t[15],T=n*c-r*o,M=n*a-s*o,u=n*f-i*o,_=r*a-s*c,A=r*f-i*c,I=s*f-i*a,v=l*g-h*x,N=l*d-p*x,w=l*S-m*x,b=h*d-p*g,O=h*S-m*g,P=p*S-m*d,E=T*P-M*O+u*b+_*w-A*N+I*v;return E?(E=1/E,e[0]=(c*P-a*O+f*b)*E,e[1]=(s*O-r*P-i*b)*E,e[2]=(g*I-d*A+S*_)*E,e[3]=(p*A-h*I-m*_)*E,e[4]=(a*w-o*P-f*N)*E,e[5]=(n*P-s*w+i*N)*E,e[6]=(d*u-x*I-S*M)*E,e[7]=(l*I-p*u+m*M)*E,e[8]=(o*O-c*w+f*v)*E,e[9]=(r*w-n*O-i*v)*E,e[10]=(x*A-g*u+S*T)*E,e[11]=(h*u-l*A-m*T)*E,e[12]=(c*N-o*b-a*v)*E,e[13]=(n*b-r*N+s*v)*E,e[14]=(g*M-x*_-d*T)*E,e[15]=(l*_-h*M+p*T)*E,e):null}function be(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],f=e[8],l=e[9],h=e[10],p=e[11],m=e[12],x=e[13],g=e[14],d=e[15],S=t*o-n*i,T=t*c-r*i,M=n*c-r*o,u=f*x-l*m,_=f*g-h*m,A=l*g-h*x,I=t*A-n*_+r*u,v=i*A-o*_+c*u,N=f*M-l*T+h*S,w=m*M-x*T+g*S;return a*I-s*v+d*N-p*w}function Ft(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],p=t[9],m=t[10],x=t[11],g=t[12],d=t[13],S=t[14],T=t[15],M=n[0],u=n[1],_=n[2],A=n[3];return e[0]=M*r+u*c+_*h+A*g,e[1]=M*s+u*a+_*p+A*d,e[2]=M*i+u*f+_*m+A*S,e[3]=M*o+u*l+_*x+A*T,M=n[4],u=n[5],_=n[6],A=n[7],e[4]=M*r+u*c+_*h+A*g,e[5]=M*s+u*a+_*p+A*d,e[6]=M*i+u*f+_*m+A*S,e[7]=M*o+u*l+_*x+A*T,M=n[8],u=n[9],_=n[10],A=n[11],e[8]=M*r+u*c+_*h+A*g,e[9]=M*s+u*a+_*p+A*d,e[10]=M*i+u*f+_*m+A*S,e[11]=M*o+u*l+_*x+A*T,M=n[12],u=n[13],_=n[14],A=n[15],e[12]=M*r+u*c+_*h+A*g,e[13]=M*s+u*a+_*p+A*d,e[14]=M*i+u*f+_*m+A*S,e[15]=M*o+u*l+_*x+A*T,e}function Oe(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,f,l,h,p,m,x,g,d,S;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],f=t[3],l=t[4],h=t[5],p=t[6],m=t[7],x=t[8],g=t[9],d=t[10],S=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=f,e[4]=l,e[5]=h,e[6]=p,e[7]=m,e[8]=x,e[9]=g,e[10]=d,e[11]=S,e[12]=o*r+l*s+x*i+t[12],e[13]=c*r+h*s+g*i+t[13],e[14]=a*r+p*s+d*i+t[14],e[15]=f*r+m*s+S*i+t[15]),e}function Pe(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ce(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,f,l,h,p,m,x,g,d,S,T,M,u,_,A,I,v,N,w,b,O,P,E,X;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,f=Math.sin(n),a=Math.cos(n),l=1-a,h=t[0],p=t[1],m=t[2],x=t[3],g=t[4],d=t[5],S=t[6],T=t[7],M=t[8],u=t[9],_=t[10],A=t[11],I=s*s*l+a,v=i*s*l+o*f,N=o*s*l-i*f,w=s*i*l-o*f,b=i*i*l+a,O=o*i*l+s*f,P=s*o*l+i*f,E=i*o*l-s*f,X=o*o*l+a,e[0]=h*I+g*v+M*N,e[1]=p*I+d*v+u*N,e[2]=m*I+S*v+_*N,e[3]=x*I+T*v+A*N,e[4]=h*w+g*b+M*O,e[5]=p*w+d*b+u*O,e[6]=m*w+S*b+_*O,e[7]=x*w+T*b+A*O,e[8]=h*P+g*E+M*X,e[9]=p*P+d*E+u*X,e[10]=m*P+S*E+_*X,e[11]=x*P+T*E+A*X,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Be(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+f*r,e[5]=o*s+l*r,e[6]=c*s+h*r,e[7]=a*s+p*r,e[8]=f*s-i*r,e[9]=l*s-o*r,e[10]=h*s-c*r,e[11]=p*s-a*r,e}function ze(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-f*r,e[1]=o*s-l*r,e[2]=c*s-h*r,e[3]=a*s-p*r,e[8]=i*r+f*s,e[9]=o*r+l*s,e[10]=c*r+h*s,e[11]=a*r+p*s,e}function ke(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],f=t[4],l=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+f*r,e[1]=o*s+l*r,e[2]=c*s+h*r,e[3]=a*s+p*r,e[4]=f*s-i*r,e[5]=l*s-o*r,e[6]=h*s-c*r,e[7]=p*s-a*r,e}function Fe(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,f=n*o,l=r*o,h=r*c,p=s*o,m=s*c,x=s*a,g=i*o,d=i*c,S=i*a;return e[0]=1-h-x,e[1]=l+S,e[2]=p-d,e[3]=0,e[4]=l-S,e[5]=1-f-x,e[6]=m+g,e[7]=0,e[8]=p+d,e[9]=m-g,e[10]=1-f-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ue(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),f=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*f,e[15]=0,e}function Tr(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Ve=Tr;function Lr(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),f=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*f,e[15]=1,e}var qe=Lr;function De(e,t,n,r){let s,i,o,c,a,f,l,h,p,m,x=t[0],g=t[1],d=t[2],S=r[0],T=r[1],M=r[2],u=n[0],_=n[1],A=n[2];return Math.abs(x-u)<1e-6&&Math.abs(g-_)<1e-6&&Math.abs(d-A)<1e-6?yr(e):(h=x-u,p=g-_,m=d-A,s=1/Math.sqrt(h*h+p*p+m*m),h*=s,p*=s,m*=s,i=T*m-M*p,o=M*h-S*m,c=S*p-T*h,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-m*o,f=m*i-h*c,l=h*o-p*i,s=Math.sqrt(a*a+f*f+l*l),s?(s=1/s,a*=s,f*=s,l*=s):(a=0,f=0,l=0),e[0]=i,e[1]=a,e[2]=h,e[3]=0,e[4]=o,e[5]=f,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=m,e[11]=0,e[12]=-(i*x+o*g+c*d),e[13]=-(a*x+f*g+l*d),e[14]=-(h*x+p*g+m*d),e[15]=1,e)}function Rr(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Ye(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function He(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Ge(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function We(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function $e(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Xe(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function je(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Ke(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Qe(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*i-a*s,h=f*s+a*r-o*i,p=f*i+o*s-c*r,m=-o*r-c*s-a*i;return e[0]=l*f+m*-o+h*-a-p*-c,e[1]=h*f+m*-c+p*-o-l*-a,e[2]=p*f+m*-a+l*-c-h*-o,e[3]=t[3],e}var vi=function(){let e=Rr();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var qt;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(qt||(qt={}));var vr=45*Math.PI/180,Nr=1,Ut=.1,Vt=500,wr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),F=class extends _t{static get IDENTITY(){return Or()}static get ZERO(){return br()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return qt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=f,this[9]=l,this[10]=h,this[11]=p,this[12]=m,this[13]=x,this[14]=g,this[15]=d,this.check()}setRowMajor(t,n,r,s,i,o,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=i,this[2]=f,this[3]=m,this[4]=n,this[5]=o,this[6]=l,this[7]=x,this[8]=r,this[9]=c,this[10]=h,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(wr)}fromObject(t){return this.check()}fromQuaternion(t){return Fe(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=Ut,far:c=Vt}=t;return c===1/0?Pr(this,n,r,s,i,o):Ue(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return De(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=Ut,far:c=Vt}=t;return qe(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=vr,aspect:r=Nr,focalDistance:s=1,near:i=Ut,far:o=Vt}=t;Ze(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Ze(n),Ve(this,n,r,s,i),this.check()}determinant(){return be(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Ne(this,this),this.check()}invert(){return we(this,this),this.check()}multiplyLeft(t){return Ft(this,t,this),this.check()}multiplyRight(t){return Ft(this,this,t),this.check()}rotateX(t){return Be(this,this,t),this.check()}rotateY(t){return ze(this,this,t),this.check()}rotateZ(t){return ke(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Ce(this,this,t,n),this.check()}scale(t){return Pe(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Oe(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Ke(n||[-0,-0,-0,-0],t,this),H(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=_e(n||[-0,-0],t,this);break;case 3:s=Mt(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Ae(n||[-0,-0],t,this);break;case 3:r=Se(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},At,St;function br(){return At||(At=new F([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(At)),At}function Or(){return St||(St=new F,Object.freeze(St)),St}function Ze(e){if(e>Math.PI*2)throw Error("expected radians")}function Pr(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),l=-1,h=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=l,e[11]=h,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Je(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function tn(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Dt(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Yt(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],f=n[2],l=n[3];return e[0]=r*l+o*c+s*f-i*a,e[1]=s*l+o*a+i*c-r*f,e[2]=i*l+o*f+r*a-s*c,e[3]=o*l-r*c-s*a-i*f,e}function en(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function nn(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function rn(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function sn(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function et(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],f=n[1],l=n[2],h=n[3],p,m,x,g,d;return p=s*a+i*f+o*l+c*h,p<0&&(p=-p,a=-a,f=-f,l=-l,h=-h),1-p>1e-6?(m=Math.acos(p),d=Math.sin(m),x=Math.sin((1-r)*m)/d,g=Math.sin(r*m)/d):(x=1-r,g=r),e[0]=x*s+g*a,e[1]=x*i+g*f,e[2]=x*o+g*l,e[3]=x*c+g*h,e}function on(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function cn(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ht(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var an=Ye;var fn=He,ln=Xe,hn=je,pn=Ge;var mn=We;var xn=$e;var gn=function(){let e=zt(),t=kt(1,0,0),n=kt(0,1,0);return function(r,s,i){let o=Le(s,i);return o<-.999999?(dt(e,t,s),Ie(e)<1e-6&&dt(e,n,s),Te(e,e),Dt(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(dt(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,xn(r,r))}}(),Di=function(){let e=Je(),t=Je();return function(n,r,s,i,o,c){return et(e,r,o,c),et(t,s,i,c),et(n,e,t,2*c*(1-c)),n}}(),Yi=function(){let e=ve();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],xn(t,Ht(t,e))}}();var Cr=[0,0,0,1],nt=class extends V{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ht(this,t),this.check()}fromAxisRotation(t,n){return Dt(this,t,n),this.check()}identity(){return tn(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}len(){return pn(this)}lengthSquared(){return mn(this)}dot(t){return ln(this,t)}rotationTo(t,n){return gn(this,t,n),this.check()}add(t){return an(this,this,t),this.check()}calculateW(){return sn(this,this),this.check()}conjugate(){return cn(this,this),this.check()}invert(){return on(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(hn(this,t,n,r),this.check())}multiplyRight(t){return Yt(this,this,t),this.check()}multiplyLeft(t){return Yt(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return en(this,this,t),this.check()}rotateY(t){return nn(this,this,t),this.check()}rotateZ(t){return rn(this,this,t),this.check()}scale(t){return fn(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=Cr,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return et(this,s,i,o),this.check()}transformVector4(t,n=new G){return Qe(n,t,this),H(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var rt=D(j(),1);var Br={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wt=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:i,path:o})=>{Dr(r,s,i,o),Fr(i,i._node)})}},W=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,i=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:dn(t.accessors[c]),interpolation:a,output:dn(t.accessors[f])})),o=n.channels.map(({sampler:c,target:a})=>({sampler:i[c],target:t.nodes[a.node],path:a.path}));return new Wt({name:s,channels:o})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function dn(e){if(!e._animation){let t=zr[e.componentType],n=Br[e.type],r=n*e.count,{buffer:s,byteOffset:i}=e.bufferView.data,o=new t(s,i+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(o);else{let c=[];for(let a=0;a<o.length;a+=n)c.push(Array.from(o.slice(a,a+n)));e._animation=c}}return e._animation}var kr=new F;function Fr(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=kr.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var Gt=new nt;function Ur(e,t,n,r,s){if(t==="rotation"){Gt.slerp({start:n,target:r,ratio:s});for(let i=0;i<Gt.length;i++)e[t][i]=Gt[i]}else for(let i=0;i<n.length;i++)e[t][i]=s*r[i]+(1-s)*n[i]}function Vr(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:i,tDiff:o,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*o,l=s[a]*o;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*i[a]+(Math.pow(c,3)-Math.pow(c,2))*l}}function qr(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function Dr(e,{input:t,interpolation:n,output:r},s,i){let o=t[t.length-1],c=e%o,a=t.findIndex(p=>p>=c),f=Math.max(0,a-1);if(!Array.isArray(s[i]))switch(i){case"translation":s[i]=[0,0,0];break;case"rotation":s[i]=[0,0,0,1];break;case"scale":s[i]=[1,1,1];break;default:rt.log.warn(`Bad animation path ${i}`)()}(0,rt.assert)(s[i].length===r[f].length);let l=t[f],h=t[a];switch(n){case"STEP":qr(s,i,r[f]);break;case"LINEAR":if(h>l){let p=(c-l)/(h-l);Ur(s,i,r[f],r[a],p)}break;case"CUBICSPLINE":if(h>l){let p=(c-l)/(h-l),m=h-l,x=r[3*f+1],g=r[3*f+2],d=r[3*a+0],S=r[3*a+1];Vr(s,i,{p0:x,outTangent0:g,inTangent1:d,p1:S,tDiff:m,ratio:p})}break;default:rt.log.warn(`Interpolation ${n} not supported`)();break}}var En=D(j(),1);var $t=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
7
+ var __exports__=(()=>{var Ln=Object.create;var it=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var vn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),bn=(e,t)=>{for(var n in t)it(e,n,{get:t[n],enumerable:!0})},ot=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of In(t))!Nn.call(e,s)&&s!==n&&it(e,s,{get:()=>t[s],enumerable:!(r=Rn(t,s))||r.enumerable});return e},ct=(e,t,n)=>(ot(e,t,"default"),n&&ot(n,t,"default")),D=(e,t,n)=>(n=e!=null?Ln(vn(e)):{},ot(t||!e||!e.__esModule?it(n,"default",{value:e,enumerable:!0}):n,e)),On=e=>ot(it({},"__esModule",{value:!0}),e);var $=Kt((Qr,Qt)=>{Qt.exports=globalThis.luma});var Pt=Kt((to,ge)=>{ge.exports=globalThis.luma});var st={};bn(st,{GLTFAnimator:()=>W,createScenegraphsFromGLTF:()=>Tn,loadPBREnvironment:()=>xe,parsePBRMaterial:()=>at});ct(st,D($(),1));var Zt=D($(),1),C;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(C||(C={}));function at(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=r;return o&&(s.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=o.specularEnvSampler,s.bindings.u_brdfLUT=o.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&wn(e,t,s),s}function wn(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Pn(e,t.pbrMetallicRoughness,n),t.normalTexture){K(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){K(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(K(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Zt.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=C.FUNC_ADD,n.glParameters.blendFunc=[C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA];break}}function Pn(e,t,n){t.baseColorTexture&&K(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&K(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function K(e,t,n,r=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,c,a={};i.compressed?(c=i,a={[C.TEXTURE_MIN_FILTER]:i.data.length>1?C.LINEAR_MIPMAP_NEAREST:C.LINEAR}):c={data:i};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...a},pixelStore:{[C.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var B={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Cn=B.self||B.window||B.global||{},Bn=B.window||B.self||B.global||{},zn=B.global||B.self||B.window||{},kn=B.document||{};var Tt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Jt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Fn=Jt&&parseFloat(Jt[1])||0;var Un="",te={};function Lt(e){for(let t in te)if(e.startsWith(t)){let n=te[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Un}${e}`),e}var ee="4.2.0-beta.2";var Vn=globalThis.loaders?.parseImageNode,Rt=typeof Image<"u",It=typeof ImageBitmap<"u",qn=Boolean(Vn),vt=Tt?!0:qn;function ne(e){switch(e){case"auto":return It||Rt||vt;case"imagebitmap":return It;case"image":return Rt;case"data":return vt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function re(){if(It)return"imagebitmap";if(Rt)return"image";if(vt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function se(e){let t=Dn(e);if(!t)throw new Error("Not an image");return t}function Nt(e){return ft(e)}function ft(e){switch(se(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Dn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Yn=/^data:image\/svg\+xml/,Hn=/\.svg((\?|#).*)?$/;function lt(e){return e&&(Yn.test(e)||Hn.test(e))}function oe(e,t){if(lt(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return bt(e,t)}function bt(e,t){if(lt(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ht(e,t,n){let r=oe(e,n),s=self.URL||self.webkitURL,o=typeof r!="string"&&s.createObjectURL(r);try{return await Gn(o||r,t)}finally{o&&s.revokeObjectURL(o)}}async function Gn(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Wn={},ie=!0;async function ce(e,t,n){let r;lt(n)?r=await ht(e,t,n):r=bt(e,n);let s=t&&t.imagebitmap;return await Xn(r,s)}async function Xn(e,t=null){if((jn(t)||!ie)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),ie=!1}return await createImageBitmap(e)}function jn(e){for(let t in e||Wn)return!1;return!0}function ae(e){return!Zn(e,"ftyp",4)||!(e[8]&96)?null:$n(e)}function $n(e){switch(Kn(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Kn(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Qn(e){return[...e].map(t=>t.charCodeAt(0))}function Zn(e,t,n=0){let r=Qn(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var z=!1,Q=!0;function pt(e){let t=Z(e);return tr(t)||rr(t)||er(t)||nr(t)||Jn(t)}function Jn(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=ae(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function tr(e){let t=Z(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function er(e){let t=Z(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Q),height:t.getUint16(8,Q)}:null}function nr(e){let t=Z(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,Q)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Q),height:t.getUint32(22,Q)}:null}function rr(e){let t=Z(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=sr(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,z);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,z),width:t.getUint16(o+7,z)};if(!r.has(i))return null;o+=2,o+=t.getUint16(o,z)}return null}function sr(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Z(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function fe(e,t){let{mimeType:n}=pt(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function le(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=n||{},i=or(s),c;switch(i){case"imagebitmap":c=await ce(e,t,o);break;case"image":c=await ht(e,t,o);break;case"data":c=await fe(e,t);break;default:q(!1)}return s==="data"&&(c=ft(c)),c}function or(e){switch(e){case"auto":case"data":return re();default:return ne(e),e}}var ir=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],cr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ar={image:{type:"auto",decode:!0}},mt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:ee,mimeTypes:cr,extensions:ir,parse:le,tests:[e=>Boolean(pt(new DataView(e)))],options:ar};function xt(e,t,n){let r=typeof e=="function"?e({...t,...n}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),Lt(r)}var fr=e=>e&&typeof e=="object";async function he(e,t,n={}){return await Ot(e,t,n)}async function Ot(e,t,n){return Array.isArray(e)?await hr(e,t,n):fr(e)?await lr(e,t,n):await t(e,n)}async function lr(e,t,n){let r=[],s={};for(let o in e){let i=e[o],c=Ot(i,t,n).then(a=>{s[o]=a});r.push(c)}return await Promise.all(r),s}async function hr(e,t,n={}){let r=e.map(s=>Ot(s,t,n));return await Promise.all(r)}async function pe(e,t,n){return await he(e,r=>wt(r,t,n))}async function wt(e,t,n){let s=await(await fetch(e,n.fetch)).arrayBuffer();return await t(s,n)}async function J(e,t={}){let n=await pr(e,t);return await pe(n,mt.parse,t)}async function pr(e,t,n={}){let r=t&&t.image&&t.image.mipLevels||0;return r!==0?await mr(e,r,t,n):xt(e,t,n)}async function mr(e,t,n,r){let s=[];if(t==="auto"){let o=xt(e,n,{...r,lod:0}),i=await wt(o,mt.parse,n),{width:c,height:a}=Nt(i);t=xr({width:c,height:a}),s.push(o)}q(t>0);for(let o=s.length;o<t;++o){let i=xt(e,n,{...r,lod:o});s.push(i)}return s}function xr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}function xe(e,t){let n=e.createTexture({id:"brdfLUT",sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"},data:J(t.brdfLutUrl)}),r=me(e,{id:"DiffuseEnvSampler",getTextureForFace:o=>J(t.getTexUrl("diffuse",o,0)),sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}}),s=me(e,{id:"SpecularEnvSampler",getTextureForFace:o=>{let i=[];for(let c=0;c<=t.specularMipLevels-1;c++)i.push(J(t.getTexUrl("specular",o,c)));return i},sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:r,specularEnvSampler:s}}var gr=[0,1,2,3,4,5];function me(e,{id:t,getTextureForFace:n,sampler:r}){let s={};return gr.forEach(o=>{s[String(o)]=n(o)}),e.createTexture({id:t,dimension:"cube",mipmaps:!1,sampler:r,data:s})}var X=D(Pt(),1);var eo=1/Math.PI*180,no=1/180*Math.PI,dr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...dr}};var L=globalThis.mathgl.config;function de(e,{precision:t=L.precision}={}){return e=Mr(e),"".concat(parseFloat(e.toPrecision(t)))}function Y(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ct(e,t,n){let r=L.EPSILON;n&&(L.EPSILON=n);try{if(e===t)return!0;if(Y(e)&&Y(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Ct(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=L.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{L.EPSILON=r}}function Mr(e){return Math.round(e/L.EPSILON)*L.EPSILON}function ur(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var V=class extends ur(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Y(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(L)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+de(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Ct(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof n=="number"?n:n[s];this[s]=o+r*(i-o)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(L.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function _r(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function y(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function H(e,t,n=""){if(L.debug&&!_r(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function Bt(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var gt=class extends V{get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),y(this[t])}setComponent(t,n){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var R=typeof Float32Array<"u"?Float32Array:Array;var mo=Math.PI/180;function Ar(){let e=new R(2);return R!=Float32Array&&(e[0]=0,e[1]=0),e}function _e(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var xo=function(){let e=Ar();return function(t,n,r,s,o,i){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],o(e,e,i),t[c]=e[0],t[c+1]=e[1];return t}}();function Ae(e,t,n){let r=t[0],s=t[1],o=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/o,e[1]=(n[1]*r+n[5]*s)/o,e}function Se(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o||1;return e[0]=(n[0]*r+n[4]*s+n[8]*o)/i,e[1]=(n[1]*r+n[5]*s+n[9]*o)/i,e[2]=(n[2]*r+n[6]*s+n[10]*o)/i,e}function Ee(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ye(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*o,e[1]=n[1]*r+n[4]*s+n[7]*o,e[2]=n[2]*r+n[5]*s+n[8]*o,e[3]=t[3],e}function zt(){let e=new R(3);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sr(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function kt(e,t,n){let r=new R(3);return r[0]=e,r[1]=t,r[2]=n,r}function Te(e,t){let n=t[0],r=t[1],s=t[2],o=n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Le(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function dt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2];return e[0]=s*a-o*c,e[1]=o*i-r*a,e[2]=r*c-s*i,e}function Mt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,e[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,e[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,e}function Re(e,t,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=t[0],a=t[1],f=t[2],l=s*f-o*a,h=o*c-r*f,p=r*a-s*c,m=s*p-o*h,x=o*l-r*p,g=r*h-s*l,d=i*2;return l*=d,h*=d,p*=d,m*=2,x*=2,g*=2,e[0]=c+l+m,e[1]=a+h+x,e[2]=f+p+g,e}var Ie=Sr;var uo=function(){let e=zt();return function(t,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var ut,G=class extends gt{static get ZERO(){return ut||(ut=new G(0,0,0,0),Object.freeze(ut)),ut}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Y(t)&&arguments.length===1?this.copy(t):(L.debug&&(y(t),y(n),y(r),y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return L.debug&&(y(t.x),y(t.y),y(t.z),y(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}transform(t){return Mt(this,this,t),this.check()}transformByMatrix3(t){return ye(this,this,t),this.check()}transformByMatrix2(t){return Ee(this,this,t),this.check()}transformByQuaternion(t){return Re(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var _t=class extends V{toString(){let t="[";if(L.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(this[n])}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function ve(){let e=new R(9);return R!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Tr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ne(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],o=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function be(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=t[9],p=t[10],m=t[11],x=t[12],g=t[13],d=t[14],S=t[15],T=n*c-r*i,M=n*a-s*i,u=n*f-o*i,_=r*a-s*c,A=r*f-o*c,I=s*f-o*a,v=l*g-h*x,N=l*d-p*x,b=l*S-m*x,O=h*d-p*g,w=h*S-m*g,P=p*S-m*d,E=T*P-M*w+u*O+_*b-A*N+I*v;return E?(E=1/E,e[0]=(c*P-a*w+f*O)*E,e[1]=(s*w-r*P-o*O)*E,e[2]=(g*I-d*A+S*_)*E,e[3]=(p*A-h*I-m*_)*E,e[4]=(a*b-i*P-f*N)*E,e[5]=(n*P-s*b+o*N)*E,e[6]=(d*u-x*I-S*M)*E,e[7]=(l*I-p*u+m*M)*E,e[8]=(i*w-c*b+f*v)*E,e[9]=(r*b-n*w-o*v)*E,e[10]=(x*A-g*u+S*T)*E,e[11]=(h*u-l*A-m*T)*E,e[12]=(c*N-i*O-a*v)*E,e[13]=(n*O-r*N+s*v)*E,e[14]=(g*M-x*_-d*T)*E,e[15]=(l*_-h*M+p*T)*E,e):null}function Oe(e){let t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],i=e[5],c=e[6],a=e[7],f=e[8],l=e[9],h=e[10],p=e[11],m=e[12],x=e[13],g=e[14],d=e[15],S=t*i-n*o,T=t*c-r*o,M=n*c-r*i,u=f*x-l*m,_=f*g-h*m,A=l*g-h*x,I=t*A-n*_+r*u,v=o*A-i*_+c*u,N=f*M-l*T+h*S,b=m*M-x*T+g*S;return a*I-s*v+d*N-p*b}function Ft(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],p=t[9],m=t[10],x=t[11],g=t[12],d=t[13],S=t[14],T=t[15],M=n[0],u=n[1],_=n[2],A=n[3];return e[0]=M*r+u*c+_*h+A*g,e[1]=M*s+u*a+_*p+A*d,e[2]=M*o+u*f+_*m+A*S,e[3]=M*i+u*l+_*x+A*T,M=n[4],u=n[5],_=n[6],A=n[7],e[4]=M*r+u*c+_*h+A*g,e[5]=M*s+u*a+_*p+A*d,e[6]=M*o+u*f+_*m+A*S,e[7]=M*i+u*l+_*x+A*T,M=n[8],u=n[9],_=n[10],A=n[11],e[8]=M*r+u*c+_*h+A*g,e[9]=M*s+u*a+_*p+A*d,e[10]=M*o+u*f+_*m+A*S,e[11]=M*i+u*l+_*x+A*T,M=n[12],u=n[13],_=n[14],A=n[15],e[12]=M*r+u*c+_*h+A*g,e[13]=M*s+u*a+_*p+A*d,e[14]=M*o+u*f+_*m+A*S,e[15]=M*i+u*l+_*x+A*T,e}function we(e,t,n){let r=n[0],s=n[1],o=n[2],i,c,a,f,l,h,p,m,x,g,d,S;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*o+t[12],e[13]=t[1]*r+t[5]*s+t[9]*o+t[13],e[14]=t[2]*r+t[6]*s+t[10]*o+t[14],e[15]=t[3]*r+t[7]*s+t[11]*o+t[15]):(i=t[0],c=t[1],a=t[2],f=t[3],l=t[4],h=t[5],p=t[6],m=t[7],x=t[8],g=t[9],d=t[10],S=t[11],e[0]=i,e[1]=c,e[2]=a,e[3]=f,e[4]=l,e[5]=h,e[6]=p,e[7]=m,e[8]=x,e[9]=g,e[10]=d,e[11]=S,e[12]=i*r+l*s+x*o+t[12],e[13]=c*r+h*s+g*o+t[13],e[14]=a*r+p*s+d*o+t[14],e[15]=f*r+m*s+S*o+t[15]),e}function Pe(e,t,n){let r=n[0],s=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ce(e,t,n,r){let s=r[0],o=r[1],i=r[2],c=Math.sqrt(s*s+o*o+i*i),a,f,l,h,p,m,x,g,d,S,T,M,u,_,A,I,v,N,b,O,w,P,E,j;return c<1e-6?null:(c=1/c,s*=c,o*=c,i*=c,f=Math.sin(n),a=Math.cos(n),l=1-a,h=t[0],p=t[1],m=t[2],x=t[3],g=t[4],d=t[5],S=t[6],T=t[7],M=t[8],u=t[9],_=t[10],A=t[11],I=s*s*l+a,v=o*s*l+i*f,N=i*s*l-o*f,b=s*o*l-i*f,O=o*o*l+a,w=i*o*l+s*f,P=s*i*l+o*f,E=o*i*l-s*f,j=i*i*l+a,e[0]=h*I+g*v+M*N,e[1]=p*I+d*v+u*N,e[2]=m*I+S*v+_*N,e[3]=x*I+T*v+A*N,e[4]=h*b+g*O+M*w,e[5]=p*b+d*O+u*w,e[6]=m*b+S*O+_*w,e[7]=x*b+T*O+A*w,e[8]=h*P+g*E+M*j,e[9]=p*P+d*E+u*j,e[10]=m*P+S*E+_*j,e[11]=x*P+T*E+A*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Be(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[4],i=t[5],c=t[6],a=t[7],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+f*r,e[5]=i*s+l*r,e[6]=c*s+h*r,e[7]=a*s+p*r,e[8]=f*s-o*r,e[9]=l*s-i*r,e[10]=h*s-c*r,e[11]=p*s-a*r,e}function ze(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-f*r,e[1]=i*s-l*r,e[2]=c*s-h*r,e[3]=a*s-p*r,e[8]=o*r+f*s,e[9]=i*r+l*s,e[10]=c*r+h*s,e[11]=a*r+p*s,e}function ke(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[4],l=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+f*r,e[1]=i*s+l*r,e[2]=c*s+h*r,e[3]=a*s+p*r,e[4]=f*s-o*r,e[5]=l*s-i*r,e[6]=h*s-c*r,e[7]=p*s-a*r,e}function Fe(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,h=r*c,p=s*i,m=s*c,x=s*a,g=o*i,d=o*c,S=o*a;return e[0]=1-h-x,e[1]=l+S,e[2]=p-d,e[3]=0,e[4]=l-S,e[5]=1-f-x,e[6]=m+g,e[7]=0,e[8]=p+d,e[9]=m-g,e[10]=1-f-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ue(e,t,n,r,s,o,i){let c=1/(n-t),a=1/(s-r),f=1/(o-i);return e[0]=o*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(i+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*f,e[15]=0,e}function Lr(e,t,n,r,s){let o=1/Math.tan(t/2);if(e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let i=1/(r-s);e[10]=(s+r)*i,e[14]=2*s*r*i}else e[10]=-1,e[14]=-2*r;return e}var Ve=Lr;function Rr(e,t,n,r,s,o,i){let c=1/(t-n),a=1/(r-s),f=1/(o-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(i+o)*f,e[15]=1,e}var qe=Rr;function De(e,t,n,r){let s,o,i,c,a,f,l,h,p,m,x=t[0],g=t[1],d=t[2],S=r[0],T=r[1],M=r[2],u=n[0],_=n[1],A=n[2];return Math.abs(x-u)<1e-6&&Math.abs(g-_)<1e-6&&Math.abs(d-A)<1e-6?Tr(e):(h=x-u,p=g-_,m=d-A,s=1/Math.sqrt(h*h+p*p+m*m),h*=s,p*=s,m*=s,o=T*m-M*p,i=M*h-S*m,c=S*p-T*h,s=Math.sqrt(o*o+i*i+c*c),s?(s=1/s,o*=s,i*=s,c*=s):(o=0,i=0,c=0),a=p*c-m*i,f=m*o-h*c,l=h*i-p*o,s=Math.sqrt(a*a+f*f+l*l),s?(s=1/s,a*=s,f*=s,l*=s):(a=0,f=0,l=0),e[0]=o,e[1]=a,e[2]=h,e[3]=0,e[4]=i,e[5]=f,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=m,e[11]=0,e[12]=-(o*x+i*g+c*d),e[13]=-(a*x+f*g+l*d),e[14]=-(h*x+p*g+m*d),e[15]=1,e)}function Ir(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Ye(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function He(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Ge(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function We(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Xe(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=s*i,e[3]=o*i,e}function je(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function $e(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=o+r*(n[1]-o),e[2]=i+r*(n[2]-i),e[3]=c+r*(n[3]-c),e}function Ke(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*o+n[12]*i,e[1]=n[1]*r+n[5]*s+n[9]*o+n[13]*i,e[2]=n[2]*r+n[6]*s+n[10]*o+n[14]*i,e[3]=n[3]*r+n[7]*s+n[11]*o+n[15]*i,e}function Qe(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*o-a*s,h=f*s+a*r-i*o,p=f*o+i*s-c*r,m=-i*r-c*s-a*o;return e[0]=l*f+m*-i+h*-a-p*-c,e[1]=h*f+m*-c+p*-i-l*-a,e[2]=p*f+m*-a+l*-c-h*-i,e[3]=t[3],e}var bo=function(){let e=Ir();return function(t,n,r,s,o,i){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var qt;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(qt||(qt={}));var Nr=45*Math.PI/180,br=1,Ut=.1,Vt=500,Or=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),F=class extends _t{static get IDENTITY(){return Pr()}static get ZERO(){return wr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return qt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=o,this[5]=i,this[6]=c,this[7]=a,this[8]=f,this[9]=l,this[10]=h,this[11]=p,this[12]=m,this[13]=x,this[14]=g,this[15]=d,this.check()}setRowMajor(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=o,this[2]=f,this[3]=m,this[4]=n,this[5]=i,this[6]=l,this[7]=x,this[8]=r,this[9]=c,this[10]=h,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Or)}fromObject(t){return this.check()}fromQuaternion(t){return Fe(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return c===1/0?Cr(this,n,r,s,o,i):Ue(this,n,r,s,o,i,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return De(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return qe(this,n,r,s,o,i,c),this.check()}orthographic(t){let{fovy:n=Nr,aspect:r=br,focalDistance:s=1,near:o=Ut,far:i=Vt}=t;Ze(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:i})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:o=500}=t;return Ze(n),Ve(this,n,r,s,o),this.check()}determinant(){return Oe(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return Ne(this,this),this.check()}invert(){return be(this,this),this.check()}multiplyLeft(t){return Ft(this,t,this),this.check()}multiplyRight(t){return Ft(this,this,t),this.check()}rotateX(t){return Be(this,this,t),this.check()}rotateY(t){return ze(this,this,t),this.check()}rotateZ(t){return ke(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Ce(this,this,t,n),this.check()}scale(t){return Pe(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return we(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Ke(n||[-0,-0,-0,-0],t,this),H(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=_e(n||[-0,-0],t,this);break;case 3:s=Mt(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Ae(n||[-0,-0],t,this);break;case 3:r=Se(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},At,St;function wr(){return At||(At=new F([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(At)),At}function Pr(){return St||(St=new F,Object.freeze(St)),St}function Ze(e){if(e>Math.PI*2)throw Error("expected radians")}function Cr(e,t,n,r,s,o){let i=2*o/(n-t),c=2*o/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),l=-1,h=-1,p=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=l,e[11]=h,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Je(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function tn(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Dt(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Yt(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=n[0],a=n[1],f=n[2],l=n[3];return e[0]=r*l+i*c+s*f-o*a,e[1]=s*l+i*a+o*c-r*f,e[2]=o*l+i*f+r*a-s*c,e[3]=i*l-r*c-s*a-o*f,e}function en(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=o*a-s*c,e[3]=i*a-r*c,e}function nn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-o*c,e[1]=s*a+i*c,e[2]=o*a+r*c,e[3]=i*a-s*c,e}function rn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=o*a+i*c,e[3]=i*a-o*c,e}function sn(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function et(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3],a=n[0],f=n[1],l=n[2],h=n[3],p,m,x,g,d;return p=s*a+o*f+i*l+c*h,p<0&&(p=-p,a=-a,f=-f,l=-l,h=-h),1-p>1e-6?(m=Math.acos(p),d=Math.sin(m),x=Math.sin((1-r)*m)/d,g=Math.sin(r*m)/d):(x=1-r,g=r),e[0]=x*s+g*a,e[1]=x*o+g*f,e[2]=x*i+g*l,e[3]=x*c+g*h,e}function on(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o,c=i?1/i:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=o*c,e}function cn(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ht(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*r,r=.5/r,e[3]=(t[o*3+i]-t[i*3+o])*r,e[o]=(t[o*3+s]+t[s*3+o])*r,e[i]=(t[i*3+s]+t[s*3+i])*r}return e}var an=Ye;var fn=He,ln=je,hn=$e,pn=Ge;var mn=We;var xn=Xe;var gn=function(){let e=zt(),t=kt(1,0,0),n=kt(0,1,0);return function(r,s,o){let i=Le(s,o);return i<-.999999?(dt(e,t,s),Ie(e)<1e-6&&dt(e,n,s),Te(e,e),Dt(r,e,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(dt(e,s,o),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+i,xn(r,r))}}(),Ho=function(){let e=Je(),t=Je();return function(n,r,s,o,i,c){return et(e,r,i,c),et(t,s,o,c),et(n,e,t,2*c*(1-c)),n}}(),Go=function(){let e=ve();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],xn(t,Ht(t,e))}}();var Br=[0,0,0,1],nt=class extends V{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ht(this,t),this.check()}fromAxisRotation(t,n){return Dt(this,t,n),this.check()}identity(){return tn(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}len(){return pn(this)}lengthSquared(){return mn(this)}dot(t){return ln(this,t)}rotationTo(t,n){return gn(this,t,n),this.check()}add(t){return an(this,this,t),this.check()}calculateW(){return sn(this,this),this.check()}conjugate(){return cn(this,this),this.check()}invert(){return on(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(hn(this,t,n,r),this.check())}multiplyRight(t){return Yt(this,this,t),this.check()}multiplyLeft(t){return Yt(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return en(this,this,t),this.check()}rotateY(t){return nn(this,this,t),this.check()}rotateZ(t){return rn(this,this,t),this.check()}scale(t){return fn(this,this,t),this.check()}slerp(t,n,r){let s,o,i;switch(arguments.length){case 1:({start:s=Br,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=n;break;default:s=t,o=n,i=r}return et(this,s,o,i),this.check()}transformVector4(t,n=new G){return Qe(n,t,this),H(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var rt=D($(),1);var zr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},kr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wt=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:o,path:i})=>{Yr(r,s,o,i),Ur(o,o._node)})}},W=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,o=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:dn(t.accessors[c]),interpolation:a,output:dn(t.accessors[f])})),i=n.channels.map(({sampler:c,target:a})=>({sampler:o[c],target:t.nodes[a.node],path:a.path}));return new Wt({name:s,channels:i})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function dn(e){if(!e._animation){let t=kr[e.componentType],n=zr[e.type],r=n*e.count,{buffer:s,byteOffset:o}=e.bufferView.data,i=new t(s,o+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(i);else{let c=[];for(let a=0;a<i.length;a+=n)c.push(Array.from(i.slice(a,a+n)));e._animation=c}}return e._animation}var Fr=new F;function Ur(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=Fr.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var Gt=new nt;function Vr(e,t,n,r,s){if(t==="rotation"){Gt.slerp({start:n,target:r,ratio:s});for(let o=0;o<Gt.length;o++)e[t][o]=Gt[o]}else for(let o=0;o<n.length;o++)e[t][o]=s*r[o]+(1-s)*n[o]}function qr(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:o,tDiff:i,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*i,l=s[a]*i;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*o[a]+(Math.pow(c,3)-Math.pow(c,2))*l}}function Dr(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function Yr(e,{input:t,interpolation:n,output:r},s,o){let i=t[t.length-1],c=e%i,a=t.findIndex(p=>p>=c),f=Math.max(0,a-1);if(!Array.isArray(s[o]))switch(o){case"translation":s[o]=[0,0,0];break;case"rotation":s[o]=[0,0,0,1];break;case"scale":s[o]=[1,1,1];break;default:rt.log.warn(`Bad animation path ${o}`)()}(0,rt.assert)(s[o].length===r[f].length);let l=t[f],h=t[a];switch(n){case"STEP":Dr(s,o,r[f]);break;case"LINEAR":if(h>l){let p=(c-l)/(h-l);Vr(s,o,r[f],r[a],p)}break;case"CUBICSPLINE":if(h>l){let p=(c-l)/(h-l),m=h-l,x=r[3*f+1],g=r[3*f+2],d=r[3*a+0],S=r[3*a+1];qr(s,o,{p0:x,outTangent0:g,inTangent1:d,p1:S,tDiff:m,ratio:p})}break;default:rt.log.warn(`Interpolation ${n} not supported`)();break}}var En=D($(),1);var Xt=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
8
8
  struct AmbientLight {
9
9
  vec3 color;
10
10
  };
@@ -29,7 +29,7 @@ return pointLight.attenuation.x
29
29
  + pointLight.attenuation.z * distance * distance;
30
30
  }
31
31
  #endif
32
- `;var Yr={lightSources:{}};function Xt(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function Hr({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=Xt(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,i)=>{r[`lighting_uPointLight[${i}].color`]=Xt(s),r[`lighting_uPointLight[${i}].position`]=s.position,r[`lighting_uPointLight[${i}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,i)=>{r[`lighting_uDirectionalLight[${i}].color`]=Xt(s),r[`lighting_uDirectionalLight[${i}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Mn(e=Yr){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},Hr({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return Mn({lightSources:t})}return{}}var un={name:"lights",vs:$t,fs:$t,getUniforms:Mn,defines:{MAX_LIGHTS:3}};var _n=`uniform mat4 u_MVPMatrix;
32
+ `;var Hr={lightSources:{}};function jt(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function Gr({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=jt(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,o)=>{r[`lighting_uPointLight[${o}].color`]=jt(s),r[`lighting_uPointLight[${o}].position`]=s.position,r[`lighting_uPointLight[${o}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,o)=>{r[`lighting_uDirectionalLight[${o}].color`]=jt(s),r[`lighting_uDirectionalLight[${o}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Mn(e=Hr){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},Gr({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return Mn({lightSources:t})}return{}}var un={name:"lights",vs:Xt,fs:Xt,getUniforms:Mn,defines:{MAX_LIGHTS:3}};var _n=`uniform mat4 u_MVPMatrix;
33
33
  uniform mat4 u_ModelMatrix;
34
34
  uniform mat4 u_NormalMatrix;
35
35
  out vec3 pbr_vPosition;
@@ -330,7 +330,7 @@ color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
330
330
  }
331
331
  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
332
332
  }
333
- `;var jt={name:"pbr",vs:_n,fs:An,defines:{LIGHTING_FRAGMENT:1},dependencies:[un]};var Et=D(Pt(),1);var Gr=`
333
+ `;var $t={name:"pbr",vs:_n,fs:An,defines:{LIGHTING_FRAGMENT:1},dependencies:[un]};var Et=D(Pt(),1);var Wr=`
334
334
  #pragma vscode_glsllint_stage: vert
335
335
  #if (__VERSION__ < 300)
336
336
  #define _attr attribute
@@ -375,7 +375,7 @@ return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
375
375
  pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
376
376
  gl_Position = u_MVPMatrix * positions;
377
377
  }
378
- `,Wr=`
378
+ `,Xr=`
379
379
  #pragma vscode_glsllint_stage: frag
380
380
  #if (__VERSION__ < 300)
381
381
  #define fragmentColor gl_FragColor
@@ -387,7 +387,7 @@ return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
387
387
  vec3 pos = pbr_vPosition;
388
388
  fragmentColor = pbr_filterColor(vec4(1.0));
389
389
  }
390
- `;function yn(e,t){let{id:n,geometry:r,material:s,vertexCount:i,materialOptions:o,modelOptions:c}=t,a=at(e,s,r.attributes,o);En.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],l={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},h={id:n,geometry:r,topology:r.topology,vertexCount:i,modules:[jt],vs:Sn(e,Gr),fs:Sn(e,Wr),...c,bindings:{...a.bindings,...c.bindings},defines:{...a.defines,...c.defines},parameters:{...l,...a.parameters,...c.parameters},uniforms:{...a.uniforms,...c.uniforms}},p=new Et.Model(e,h);return new Et.ModelNode({managedResources:f,model:p})}function Sn(e,t){return`#version 300 es
391
- ${t}`}var $r={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},yt=class{device;options;gltf;constructor(t,n={}){this.device=t,this.options={...$r,...n}}instantiate(t){return this.gltf=t,(t.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new W(this.gltf):null}createScene(t){let r=(t.nodes||[]).map(i=>this.createNode(i));return new $.GroupNode({id:t.name||t.id,children:r})}createNode(t){if(!t._node){let r=(t.children||[]).map(i=>this.createNode(i));t.mesh&&r.push(this.createMesh(t.mesh));let s=new $.GroupNode({id:t.name||t.id,children:r});if(t.matrix)s.setMatrix(t.matrix);else{if(s.matrix.identity(),t.translation&&s.matrix.translate(t.translation),t.rotation){let i=new F().fromQuaternion(t.rotation);s.matrix.multiplyRight(i)}t.scale&&s.matrix.scale(t.scale)}t._node=s}return t._node}createMesh(t){if(!t._mesh){let r=(t.primitives||[]).map((i,o)=>this.createPrimitive(i,o,t)),s=new $.GroupNode({id:t.name||t.id,children:r});t._mesh=s}return t._mesh}createPrimitive(t,n,r){let s=t.name||`${r.name||r.id}-primitive-${n}`,i=Xr(t.mode||4),o=t.indices?t.indices.count:this.getVertexCount(t.attributes),c=yn(this.device,{id:s,geometry:this.createGeometry(s,t,i),material:t.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:o});return c.bounds=[t.attributes.POSITION.min,t.attributes.POSITION.max],c}getVertexCount(t){throw new Error("getVertexCount not implemented")}createGeometry(t,n,r){let s={};for(let[i,o]of Object.entries(n.attributes)){let{components:c,size:a,value:f}=o;s[i]={size:a??c,value:f}}return new $.Geometry({id:t,topology:r,indices:n.indices.value,attributes:s})}createBuffer(t,n){t.bufferView||(t.bufferView={});let{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||t.value})),r.lumaBuffers[n]}createSampler(t){return t}needsPOT(){return!1}},U;(function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(U||(U={}));function Xr(e){switch(e){case U.POINTS:return"point-list";case U.LINES:return"line-list";case U.LINE_STRIP:return"line-strip";case U.LINE_LOOP:return"line-loop-webgl";case U.TRIANGLES:return"triangle-list";case U.TRIANGLE_STRIP:return"triangle-strip";case U.TRIANGLE_FAN:return"triangle-fan-webgl";default:throw new Error(e)}}function Tn(e,t,n){let r=new yt(e,n),s=r.instantiate(t),i=r.createAnimator();return{scenes:s,animator:i}}return bn(st);})();
390
+ `;function yn(e,t){let{id:n,geometry:r,material:s,vertexCount:o,materialOptions:i,modelOptions:c}=t,a=at(e,s,r.attributes,i);En.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],l={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},h={id:n,geometry:r,topology:r.topology,vertexCount:o,modules:[$t],vs:Sn(e,Wr),fs:Sn(e,Xr),...c,bindings:{...a.bindings,...c.bindings},defines:{...a.defines,...c.defines},parameters:{...l,...a.parameters,...c.parameters},uniforms:{...a.uniforms,...c.uniforms}},p=new Et.Model(e,h);return new Et.ModelNode({managedResources:f,model:p})}function Sn(e,t){return`#version 300 es
391
+ ${t}`}var jr={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},yt=class{device;options;gltf;constructor(t,n={}){this.device=t,this.options={...jr,...n}}instantiate(t){return this.gltf=t,(t.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new W(this.gltf):null}createScene(t){let r=(t.nodes||[]).map(o=>this.createNode(o));return new X.GroupNode({id:t.name||t.id,children:r})}createNode(t){if(!t._node){let r=(t.children||[]).map(o=>this.createNode(o));t.mesh&&r.push(this.createMesh(t.mesh));let s=new X.GroupNode({id:t.name||t.id,children:r});if(t.matrix)s.setMatrix(t.matrix);else{if(s.matrix.identity(),t.translation&&s.matrix.translate(t.translation),t.rotation){let o=new F().fromQuaternion(t.rotation);s.matrix.multiplyRight(o)}t.scale&&s.matrix.scale(t.scale)}t._node=s}return t._node}createMesh(t){if(!t._mesh){let r=(t.primitives||[]).map((o,i)=>this.createPrimitive(o,i,t)),s=new X.GroupNode({id:t.name||t.id,children:r});t._mesh=s}return t._mesh}createPrimitive(t,n,r){let s=t.name||`${r.name||r.id}-primitive-${n}`,o=$r(t.mode||4),i=t.indices?t.indices.count:this.getVertexCount(t.attributes),c=yn(this.device,{id:s,geometry:this.createGeometry(s,t,o),material:t.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:i});return c.bounds=[t.attributes.POSITION.min,t.attributes.POSITION.max],c}getVertexCount(t){throw new Error("getVertexCount not implemented")}createGeometry(t,n,r){let s={};for(let[o,i]of Object.entries(n.attributes)){let{components:c,size:a,value:f}=i;s[o]={size:a??c,value:f}}return new X.Geometry({id:t,topology:r,indices:n.indices.value,attributes:s})}createBuffer(t,n){t.bufferView||(t.bufferView={});let{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||t.value})),r.lumaBuffers[n]}createSampler(t){return t}needsPOT(){return!1}},U;(function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(U||(U={}));function $r(e){switch(e){case U.POINTS:return"point-list";case U.LINES:return"line-list";case U.LINE_STRIP:return"line-strip";case U.LINE_LOOP:return"line-loop-webgl";case U.TRIANGLES:return"triangle-list";case U.TRIANGLE_STRIP:return"triangle-strip";case U.TRIANGLE_FAN:return"triangle-fan-webgl";default:throw new Error(e)}}function Tn(e,t,n){let r=new yt(e,n),s=r.instantiate(t),o=r.createAnimator();return{scenes:s,animator:o}}return On(st);})();
392
392
  return __exports__;
393
393
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/gltf",
3
- "version": "9.0.12",
3
+ "version": "9.0.14",
4
4
  "description": "glTF support for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@loaders.gl/textures": "^4.2.0",
48
- "@luma.gl/shadertools": "9.0.12",
48
+ "@luma.gl/shadertools": "9.0.14",
49
49
  "@math.gl/core": "^4.0.0"
50
50
  },
51
- "gitHead": "961c52ac4696ffebb4a35aa94b664af143981b54"
51
+ "gitHead": "0b466762e8255ed11b00c6bc518049d3b54c4009"
52
52
  }
package/dist.min.js DELETED
@@ -1,67 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if (typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if (typeof define === 'function' && define.amd) define([], factory);
5
- else if (typeof exports === 'object') exports['luma'] = factory();
6
- else root['luma'] = factory();})(globalThis, function () {
7
- var __exports__=(()=>{var Tn=Object.create;var et=Object.defineProperty;var En=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var Sn=Object.getPrototypeOf,wn=Object.prototype.hasOwnProperty;var Tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),On=(e,t)=>{for(var n in t)et(e,n,{get:t[n],enumerable:!0})},Wt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of An(t))!wn.call(e,s)&&s!==n&&et(e,s,{get:()=>t[s],enumerable:!(r=En(t,s))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?Tn(Sn(e)):{},Wt(t||!e||!e.__esModule?et(n,"default",{value:e,enumerable:!0}):n,e)),un=e=>Wt(et({},"__esModule",{value:!0}),e);var nt=Tt((Yr,jt)=>{jt.exports=globalThis.luma});var It=Tt((Ks,he)=>{he.exports=globalThis.luma});var mn=Tt((Ji,pn)=>{pn.exports=globalThis.luma});var Ur={};On(Ur,{GLTFAnimator:()=>G,createScenegraphsFromGLTF:()=>yn,loadPBREnvironment:()=>fe,parsePBRMaterial:()=>rt});var Ht=C(nt(),1);function rt(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&Ln(e,t,s),s}function Ln(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Rn(e,t.pbrMetallicRoughness,n),t.normalTexture){j(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){j(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(j(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Ht.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=32774,n.glParameters.blendFunc=[770,771,1,771];break}}function Rn(e,t,n){t.baseColorTexture&&j(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&j(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function j(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,c,a={};o.compressed?(c=o,a={[10241]:o.data.length>1?9985:9729}):c={data:o};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...a},pixelStore:{[37440]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}function Et(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Pn="",Xt={};function At(e){for(let t in Xt)if(e.startsWith(t)){let n=Xt[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Pn}${e}`),e}var $t="4.1.3";function H(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var B={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_n=B.self||B.window||B.global||{},Nn=B.window||B.self||B.global||{},In=B.global||B.self||B.window||{},vn=B.document||{};var St=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Kt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),bn=Kt&&parseFloat(Kt[1])||0;var wt,Bn=(wt=globalThis.loaders)===null||wt===void 0?void 0:wt.parseImageNode,Ot=typeof Image<"u",ut=typeof ImageBitmap<"u",kn=Boolean(Bn),Lt=St?!0:kn;function Qt(e){switch(e){case"auto":return ut||Ot||Lt;case"imagebitmap":return ut;case"image":return Ot;case"data":return Lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Zt(){if(ut)return"imagebitmap";if(Ot)return"image";if(Lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Jt(e){let t=Fn(e);if(!t)throw new Error("Not an image");return t}function Rt(e){return st(e)}function st(e){switch(Jt(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Fn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var zn=/^data:image\/svg\+xml/,qn=/\.svg((\?|#).*)?$/;function it(e){return e&&(zn.test(e)||qn.test(e))}function te(e,t){if(it(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return Pt(e,t)}function Pt(e,t){if(it(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ot(e,t,n){let r=te(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await Cn(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function Cn(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var Dn={},ee=!0;async function ne(e,t,n){let r;it(n)?r=await ot(e,t,n):r=Pt(e,n);let s=t&&t.imagebitmap;return await Vn(r,s)}async function Vn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Un(t)||!ee)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),ee=!1}return await createImageBitmap(e)}function Un(e){for(let t in e||Dn)return!1;return!0}function re(e){return!jn(e,"ftyp",4)||!(e[8]&96)?null:Gn(e)}function Gn(e){switch(Yn(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Yn(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Wn(e){return[...e].map(t=>t.charCodeAt(0))}function jn(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=Wn(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var k=!1,X=!0;function ct(e){let t=$(e);return Xn(t)||Qn(t)||$n(t)||Kn(t)||Hn(t)}function Hn(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=re(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Xn(e){let t=$(e);return t.byteLength>=24&&t.getUint32(0,k)===2303741511?{mimeType:"image/png",width:t.getUint32(16,k),height:t.getUint32(20,k)}:null}function $n(e){let t=$(e);return t.byteLength>=10&&t.getUint32(0,k)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,X),height:t.getUint16(8,X)}:null}function Kn(e){let t=$(e);return t.byteLength>=14&&t.getUint16(0,k)===16973&&t.getUint32(2,X)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,X),height:t.getUint32(22,X)}:null}function Qn(e){let t=$(e);if(!(t.byteLength>=3&&t.getUint16(0,k)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=Zn(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,k);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,k),width:t.getUint16(i+7,k)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,k)}return null}function Zn(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function $(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function se(e,t){var n;let{mimeType:r}=ct(e)||{},s=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return H(s),await s(e,r)}async function ie(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=Jn(s),c;switch(o){case"imagebitmap":c=await ne(e,t,i);break;case"image":c=await ot(e,t,i);break;case"data":c=await se(e,t);break;default:H(!1)}return s==="data"&&(c=st(c)),c}function Jn(e){switch(e){case"auto":case"data":return Zt();default:return Qt(e),e}}var tr=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],er=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],nr={image:{type:"auto",decode:!0}},at={id:"image",module:"images",name:"Images",version:$t,mimeTypes:er,extensions:tr,parse:ie,tests:[e=>Boolean(ct(new DataView(e)))],options:nr};function ft(e,t,n){let r=typeof e=="function"?e({...t,...n}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),At(r)}var rr=e=>e&&typeof e=="object";async function oe(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return await _t(e,t,n)}async function _t(e,t,n){return Array.isArray(e)?await ir(e,t,n):rr(e)?await sr(e,t,n):await t(e,n)}async function sr(e,t,n){let r=[],s={};for(let i in e){let o=e[i],c=_t(o,t,n).then(a=>{s[i]=a});r.push(c)}return await Promise.all(r),s}async function ir(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=e.map(s=>_t(s,t,n));return await Promise.all(r)}async function ce(e,t,n){return await oe(e,r=>Nt(r,t,n))}async function Nt(e,t,n){let s=await(await fetch(e,n.fetch)).arrayBuffer();return await t(s,n)}async function K(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=await or(e,t);return await ce(n,at.parse,t)}async function or(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=t&&t.image&&t.image.mipLevels||0;return r!==0?await cr(e,r,t,n):ft(e,t,n)}async function cr(e,t,n,r){let s=[];if(t==="auto"){let i=ft(e,n,{...r,lod:0}),o=await Nt(i,at.parse,n),{width:c,height:a}=Rt(o);t=ar({width:c,height:a}),s.push(i)}Et(t>0);for(let i=s.length;i<t;++i){let o=ft(e,n,{...r,lod:i});s.push(o)}return s}function ar(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}function fe(e,t){let n=e.createTexture({id:"brdfLUT",sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"},data:K(t.brdfLutUrl)}),r=ae(e,{id:"DiffuseEnvSampler",getTextureForFace:i=>K(t.getTexUrl("diffuse",i,0)),sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}}),s=ae(e,{id:"SpecularEnvSampler",getTextureForFace:i=>{let o=[];for(let c=0;c<=t.specularMipLevels-1;c++)o.push(K(t.getTexUrl("specular",i,c)));return o},sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:r,specularEnvSampler:s}}var fr=[0,1,2,3,4,5];function ae(e,{id:t,getTextureForFace:n,sampler:r}){let s={};return fr.forEach(i=>{s[String(i)]=n(i)}),e.createTexture({id:t,dimension:"cube",mipmaps:!1,sampler:r,data:s})}var Y=C(It(),1);var Qs=1/Math.PI*180,Zs=1/180*Math.PI,hr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...hr}};var u=globalThis.mathgl.config;function le(e,{precision:t=u.precision}={}){return e=lr(e),"".concat(parseFloat(e.toPrecision(t)))}function D(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vt(e,t,n){let r=u.EPSILON;n&&(u.EPSILON=n);try{if(e===t)return!0;if(D(e)&&D(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!vt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=u.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{u.EPSILON=r}}function lr(e){return Math.round(e/u.EPSILON)*u.EPSILON}function pr(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var q=class extends pr(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:D(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(u)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+le(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!vt(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(u.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function mr(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function w(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function V(e,t,n=""){if(u.debug&&!mr(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function bt(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var ht=class extends q{get x(){return this[0]}set x(t){this[0]=w(t)}get y(){return this[1]}set y(t){this[1]=w(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return w(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return w(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return bt(t>=0&&t<this.ELEMENTS,"index is out of range"),w(this[t])}setComponent(t,n){return bt(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var L=typeof Float32Array<"u"?Float32Array:Array;var fi=Math.PI/180;function xr(){let e=new L(2);return L!=Float32Array&&(e[0]=0,e[1]=0),e}function xe(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var hi=function(){let e=xr();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function de(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function ge(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Me(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ye(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Bt(){let e=new L(3);return L!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function dr(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function kt(e,t,n){let r=new L(3);return r[0]=e,r[1]=t,r[2]=n,r}function Te(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Ee(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function lt(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function pt(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Ae(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],f=t[2],h=s*f-i*a,l=i*c-r*f,p=r*a-s*c,m=s*p-i*l,x=i*h-r*p,d=r*l-s*h,g=o*2;return h*=g,l*=g,p*=g,m*=2,x*=2,d*=2,e[0]=c+h+m,e[1]=a+l+x,e[2]=f+p+d,e}var Se=dr;var mi=function(){let e=Bt();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var mt,U=class extends ht{static get ZERO(){return mt||(mt=new U(0,0,0,0),Object.freeze(mt)),mt}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),D(t)&&arguments.length===1?this.copy(t):(u.debug&&(w(t),w(n),w(r),w(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return u.debug&&(w(t.x),w(t.y),w(t.z),w(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=w(t)}get w(){return this[3]}set w(t){this[3]=w(t)}transform(t){return pt(this,this,t),this.check()}transformByMatrix3(t){return ye(this,this,t),this.check()}transformByMatrix2(t){return Me(this,this,t),this.check()}transformByQuaternion(t){return Ae(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var xt=class extends q{toString(){let t="[";if(u.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(this[n])}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=w(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function we(){let e=new L(9);return L!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function yr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Oe(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function ue(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],f=t[7],h=t[8],l=t[9],p=t[10],m=t[11],x=t[12],d=t[13],g=t[14],A=t[15],O=n*c-r*o,M=n*a-s*o,y=n*f-i*o,T=r*a-s*c,E=r*f-i*c,R=s*f-i*a,P=h*d-l*x,_=h*g-p*x,N=h*A-m*x,I=l*g-p*d,v=l*A-m*d,b=p*A-m*g,S=O*b-M*v+y*I+T*N-E*_+R*P;return S?(S=1/S,e[0]=(c*b-a*v+f*I)*S,e[1]=(s*v-r*b-i*I)*S,e[2]=(d*R-g*E+A*T)*S,e[3]=(p*E-l*R-m*T)*S,e[4]=(a*N-o*b-f*_)*S,e[5]=(n*b-s*N+i*_)*S,e[6]=(g*y-x*R-A*M)*S,e[7]=(h*R-p*y+m*M)*S,e[8]=(o*v-c*N+f*P)*S,e[9]=(r*N-n*v-i*P)*S,e[10]=(x*E-d*y+A*O)*S,e[11]=(l*y-h*E-m*O)*S,e[12]=(c*_-o*I-a*P)*S,e[13]=(n*I-r*_+s*P)*S,e[14]=(d*M-x*T-g*O)*S,e[15]=(h*T-l*M+p*O)*S,e):null}function Le(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],f=e[8],h=e[9],l=e[10],p=e[11],m=e[12],x=e[13],d=e[14],g=e[15],A=t*o-n*i,O=t*c-r*i,M=n*c-r*o,y=f*x-h*m,T=f*d-l*m,E=h*d-l*x,R=t*E-n*T+r*y,P=i*E-o*T+c*y,_=f*M-h*O+l*A,N=m*M-x*O+d*A;return a*R-s*P+g*_-p*N}function Ft(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],f=t[6],h=t[7],l=t[8],p=t[9],m=t[10],x=t[11],d=t[12],g=t[13],A=t[14],O=t[15],M=n[0],y=n[1],T=n[2],E=n[3];return e[0]=M*r+y*c+T*l+E*d,e[1]=M*s+y*a+T*p+E*g,e[2]=M*i+y*f+T*m+E*A,e[3]=M*o+y*h+T*x+E*O,M=n[4],y=n[5],T=n[6],E=n[7],e[4]=M*r+y*c+T*l+E*d,e[5]=M*s+y*a+T*p+E*g,e[6]=M*i+y*f+T*m+E*A,e[7]=M*o+y*h+T*x+E*O,M=n[8],y=n[9],T=n[10],E=n[11],e[8]=M*r+y*c+T*l+E*d,e[9]=M*s+y*a+T*p+E*g,e[10]=M*i+y*f+T*m+E*A,e[11]=M*o+y*h+T*x+E*O,M=n[12],y=n[13],T=n[14],E=n[15],e[12]=M*r+y*c+T*l+E*d,e[13]=M*s+y*a+T*p+E*g,e[14]=M*i+y*f+T*m+E*A,e[15]=M*o+y*h+T*x+E*O,e}function Re(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,f,h,l,p,m,x,d,g,A;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],f=t[3],h=t[4],l=t[5],p=t[6],m=t[7],x=t[8],d=t[9],g=t[10],A=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=f,e[4]=h,e[5]=l,e[6]=p,e[7]=m,e[8]=x,e[9]=d,e[10]=g,e[11]=A,e[12]=o*r+h*s+x*i+t[12],e[13]=c*r+l*s+d*i+t[13],e[14]=a*r+p*s+g*i+t[14],e[15]=f*r+m*s+A*i+t[15]),e}function Pe(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _e(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,f,h,l,p,m,x,d,g,A,O,M,y,T,E,R,P,_,N,I,v,b,S,W;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,f=Math.sin(n),a=Math.cos(n),h=1-a,l=t[0],p=t[1],m=t[2],x=t[3],d=t[4],g=t[5],A=t[6],O=t[7],M=t[8],y=t[9],T=t[10],E=t[11],R=s*s*h+a,P=i*s*h+o*f,_=o*s*h-i*f,N=s*i*h-o*f,I=i*i*h+a,v=o*i*h+s*f,b=s*o*h+i*f,S=i*o*h-s*f,W=o*o*h+a,e[0]=l*R+d*P+M*_,e[1]=p*R+g*P+y*_,e[2]=m*R+A*P+T*_,e[3]=x*R+O*P+E*_,e[4]=l*N+d*I+M*v,e[5]=p*N+g*I+y*v,e[6]=m*N+A*I+T*v,e[7]=x*N+O*I+E*v,e[8]=l*b+d*S+M*W,e[9]=p*b+g*S+y*W,e[10]=m*b+A*S+T*W,e[11]=x*b+O*S+E*W,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Ne(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],f=t[8],h=t[9],l=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+f*r,e[5]=o*s+h*r,e[6]=c*s+l*r,e[7]=a*s+p*r,e[8]=f*s-i*r,e[9]=h*s-o*r,e[10]=l*s-c*r,e[11]=p*s-a*r,e}function Ie(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],f=t[8],h=t[9],l=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-f*r,e[1]=o*s-h*r,e[2]=c*s-l*r,e[3]=a*s-p*r,e[8]=i*r+f*s,e[9]=o*r+h*s,e[10]=c*r+l*s,e[11]=a*r+p*s,e}function ve(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],f=t[4],h=t[5],l=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+f*r,e[1]=o*s+h*r,e[2]=c*s+l*r,e[3]=a*s+p*r,e[4]=f*s-i*r,e[5]=h*s-o*r,e[6]=l*s-c*r,e[7]=p*s-a*r,e}function be(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,f=n*o,h=r*o,l=r*c,p=s*o,m=s*c,x=s*a,d=i*o,g=i*c,A=i*a;return e[0]=1-l-x,e[1]=h+A,e[2]=p-g,e[3]=0,e[4]=h-A,e[5]=1-f-x,e[6]=m+d,e[7]=0,e[8]=p+g,e[9]=m-d,e[10]=1-f-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Be(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),f=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*f,e[15]=0,e}function Tr(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var ke=Tr;function Er(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),f=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*f,e[15]=1,e}var Fe=Er;function ze(e,t,n,r){let s,i,o,c,a,f,h,l,p,m,x=t[0],d=t[1],g=t[2],A=r[0],O=r[1],M=r[2],y=n[0],T=n[1],E=n[2];return Math.abs(x-y)<1e-6&&Math.abs(d-T)<1e-6&&Math.abs(g-E)<1e-6?yr(e):(l=x-y,p=d-T,m=g-E,s=1/Math.sqrt(l*l+p*p+m*m),l*=s,p*=s,m*=s,i=O*m-M*p,o=M*l-A*m,c=A*p-O*l,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-m*o,f=m*i-l*c,h=l*o-p*i,s=Math.sqrt(a*a+f*f+h*h),s?(s=1/s,a*=s,f*=s,h*=s):(a=0,f=0,h=0),e[0]=i,e[1]=a,e[2]=l,e[3]=0,e[4]=o,e[5]=f,e[6]=p,e[7]=0,e[8]=c,e[9]=h,e[10]=m,e[11]=0,e[12]=-(i*x+o*d+c*g),e[13]=-(a*x+f*d+h*g),e[14]=-(l*x+p*d+m*g),e[15]=1,e)}function Ar(){let e=new L(4);return L!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function qe(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Ce(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function De(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Ve(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Ue(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Ge(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ye(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function We(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function je(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],f=n[3],h=f*r+c*i-a*s,l=f*s+a*r-o*i,p=f*i+o*s-c*r,m=-o*r-c*s-a*i;return e[0]=h*f+m*-o+l*-a-p*-c,e[1]=l*f+m*-c+p*-o-h*-a,e[2]=p*f+m*-a+h*-c-l*-o,e[3]=t[3],e}var ui=function(){let e=Ar();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Ct;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Ct||(Ct={}));var wr=45*Math.PI/180,Or=1,zt=.1,qt=500,ur=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),z=class extends xt{static get IDENTITY(){return Rr()}static get ZERO(){return Lr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ct}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,f,h,l,p,m,x,d,g){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=f,this[9]=h,this[10]=l,this[11]=p,this[12]=m,this[13]=x,this[14]=d,this[15]=g,this.check()}setRowMajor(t,n,r,s,i,o,c,a,f,h,l,p,m,x,d,g){return this[0]=t,this[1]=i,this[2]=f,this[3]=m,this[4]=n,this[5]=o,this[6]=h,this[7]=x,this[8]=r,this[9]=c,this[10]=l,this[11]=d,this[12]=s,this[13]=a,this[14]=p,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(ur)}fromObject(t){return this.check()}fromQuaternion(t){return be(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=zt,far:c=qt}=t;return c===1/0?Pr(this,n,r,s,i,o):Be(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return ze(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=zt,far:c=qt}=t;return Fe(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=wr,aspect:r=Or,focalDistance:s=1,near:i=zt,far:o=qt}=t;He(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return He(n),ke(this,n,r,s,i),this.check()}determinant(){return Le(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Oe(this,this),this.check()}invert(){return ue(this,this),this.check()}multiplyLeft(t){return Ft(this,t,this),this.check()}multiplyRight(t){return Ft(this,this,t),this.check()}rotateX(t){return Ne(this,this,t),this.check()}rotateY(t){return Ie(this,this,t),this.check()}rotateZ(t){return ve(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return _e(this,this,t,n),this.check()}scale(t){return Pe(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Re(this,this,t),this.check()}transform(t,n){return t.length===4?(n=We(n||[-0,-0,-0,-0],t,this),V(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=xe(n||[-0,-0],t,this);break;case 3:s=pt(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return V(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=de(n||[-0,-0],t,this);break;case 3:r=ge(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return V(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},dt,gt;function Lr(){return dt||(dt=new z([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(dt)),dt}function Rr(){return gt||(gt=new z,Object.freeze(gt)),gt}function He(e){if(e>Math.PI*2)throw Error("expected radians")}function Pr(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),h=-1,l=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=h,e[11]=l,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Xe(){let e=new L(4);return L!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function $e(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Dt(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Vt(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],f=n[2],h=n[3];return e[0]=r*h+o*c+s*f-i*a,e[1]=s*h+o*a+i*c-r*f,e[2]=i*h+o*f+r*a-s*c,e[3]=o*h-r*c-s*a-i*f,e}function Ke(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Qe(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Ze(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function Je(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Z(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],f=n[1],h=n[2],l=n[3],p,m,x,d,g;return p=s*a+i*f+o*h+c*l,p<0&&(p=-p,a=-a,f=-f,h=-h,l=-l),1-p>1e-6?(m=Math.acos(p),g=Math.sin(m),x=Math.sin((1-r)*m)/g,d=Math.sin(r*m)/g):(x=1-r,d=r),e[0]=x*s+d*a,e[1]=x*i+d*f,e[2]=x*o+d*h,e[3]=x*c+d*l,e}function tn(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function en(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ut(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var nn=qe;var rn=Ce,sn=Ge,on=Ye,cn=De;var an=Ve;var fn=Ue;var hn=function(){let e=Bt(),t=kt(1,0,0),n=kt(0,1,0);return function(r,s,i){let o=Ee(s,i);return o<-.999999?(lt(e,t,s),Se(e)<1e-6&&lt(e,n,s),Te(e,e),Dt(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(lt(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,fn(r,r))}}(),Ci=function(){let e=Xe(),t=Xe();return function(n,r,s,i,o,c){return Z(e,r,o,c),Z(t,s,i,c),Z(n,e,t,2*c*(1-c)),n}}(),Di=function(){let e=we();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],fn(t,Ut(t,e))}}();var _r=[0,0,0,1],J=class extends q{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ut(this,t),this.check()}fromAxisRotation(t,n){return Dt(this,t,n),this.check()}identity(){return $e(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=w(t)}get y(){return this[1]}set y(t){this[1]=w(t)}get z(){return this[2]}set z(t){this[2]=w(t)}get w(){return this[3]}set w(t){this[3]=w(t)}len(){return cn(this)}lengthSquared(){return an(this)}dot(t){return sn(this,t)}rotationTo(t,n){return hn(this,t,n),this.check()}add(t){return nn(this,this,t),this.check()}calculateW(){return Je(this,this),this.check()}conjugate(){return en(this,this),this.check()}invert(){return tn(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(on(this,t,n,r),this.check())}multiplyRight(t){return Vt(this,this,t),this.check()}multiplyLeft(t){return Vt(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Ke(this,this,t),this.check()}rotateY(t){return Qe(this,this,t),this.check()}rotateZ(t){return Ze(this,this,t),this.check()}scale(t){return rn(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=_r,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Z(this,s,i,o),this.check()}transformVector4(t,n=new U){return je(n,t,this),V(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var tt=C(nt(),1);var Nr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ir={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Yt=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:i,path:o})=>{zr(r,s,i,o),br(i,i._node)})}},G=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,i=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:ln(t.accessors[c]),interpolation:a,output:ln(t.accessors[f])})),o=n.channels.map(({sampler:c,target:a})=>({sampler:i[c],target:t.nodes[a.node],path:a.path}));return new Yt({name:s,channels:o})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function ln(e){if(!e._animation){let t=Ir[e.componentType],n=Nr[e.type],r=n*e.count,{buffer:s,byteOffset:i}=e.bufferView.data,o=new t(s,i+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(o);else{let c=[];for(let a=0;a<o.length;a+=n)c.push(Array.from(o.slice(a,a+n)));e._animation=c}}return e._animation}var vr=new z;function br(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=vr.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var Gt=new J;function Br(e,t,n,r,s){if(t==="rotation"){Gt.slerp({start:n,target:r,ratio:s});for(let i=0;i<Gt.length;i++)e[t][i]=Gt[i]}else for(let i=0;i<n.length;i++)e[t][i]=s*r[i]+(1-s)*n[i]}function kr(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:i,tDiff:o,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*o,h=s[a]*o;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*i[a]+(Math.pow(c,3)-Math.pow(c,2))*h}}function Fr(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function zr(e,{input:t,interpolation:n,output:r},s,i){let o=t[t.length-1],c=e%o,a=t.findIndex(p=>p>=c),f=Math.max(0,a-1);if(!Array.isArray(s[i]))switch(i){case"translation":s[i]=[0,0,0];break;case"rotation":s[i]=[0,0,0,1];break;case"scale":s[i]=[1,1,1];break;default:tt.log.warn(`Bad animation path ${i}`)()}(0,tt.assert)(s[i].length===r[f].length);let h=t[f],l=t[a];switch(n){case"STEP":Fr(s,i,r[f]);break;case"LINEAR":if(l>h){let p=(c-h)/(l-h);Br(s,i,r[f],r[a],p)}break;case"CUBICSPLINE":if(l>h){let p=(c-h)/(l-h),m=l-h,x=r[3*f+1],d=r[3*f+2],g=r[3*a+0],A=r[3*a+1];kr(s,i,{p0:x,outTangent0:d,inTangent1:g,p1:A,tDiff:m,ratio:p})}break;default:tt.log.warn(`Interpolation ${n} not supported`)();break}}var dn=C(nt(),1),gn=C(mn(),1),Mt=C(It(),1);var qr=`
8
- #pragma vscode_glsllint_stage: vert
9
- #if (__VERSION__ < 300)
10
- #define _attr attribute
11
- #else
12
- #define _attr in
13
- #endif
14
-
15
- // _attr vec4 POSITION;
16
- _attr vec4 positions;
17
-
18
- #ifdef HAS_NORMALS
19
- // _attr vec4 NORMAL;
20
- _attr vec4 normals;
21
- #endif
22
-
23
- #ifdef HAS_TANGENTS
24
- _attr vec4 TANGENT;
25
- #endif
26
-
27
- #ifdef HAS_UV
28
- // _attr vec2 TEXCOORD_0;
29
- _attr vec2 texCoords;
30
- #endif
31
-
32
- void main(void) {
33
- vec4 _NORMAL = vec4(0.);
34
- vec4 _TANGENT = vec4(0.);
35
- vec2 _TEXCOORD_0 = vec2(0.);
36
-
37
- #ifdef HAS_NORMALS
38
- _NORMAL = normals;
39
- #endif
40
-
41
- #ifdef HAS_TANGENTS
42
- _TANGENT = TANGENT;
43
- #endif
44
-
45
- #ifdef HAS_UV
46
- _TEXCOORD_0 = texCoords;
47
- #endif
48
-
49
- pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
50
- gl_Position = u_MVPMatrix * positions;
51
- }
52
- `,Cr=`
53
- #pragma vscode_glsllint_stage: frag
54
- #if (__VERSION__ < 300)
55
- #define fragmentColor gl_FragColor
56
- #else
57
- out vec4 fragmentColor;
58
- #endif
59
-
60
- void main(void) {
61
- vec3 pos = pbr_vPosition;
62
- fragmentColor = pbr_filterColor(vec4(1.0));
63
- }
64
- `;function Mn(e,t){let{id:n,geometry:r,material:s,vertexCount:i,materialOptions:o,modelOptions:c}=t,a=rt(e,s,r.attributes,o);dn.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],h={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},l={id:n,geometry:r,topology:r.topology,vertexCount:i,modules:[gn.pbr],vs:xn(e,qr),fs:xn(e,Cr),...c,bindings:{...a.bindings,...c.bindings},defines:{...a.defines,...c.defines},parameters:{...h,...a.parameters,...c.parameters},uniforms:{...a.uniforms,...c.uniforms}},p=new Mt.Model(e,l);return new Mt.ModelNode({managedResources:f,model:p})}function xn(e,t){return`#version 300 es
65
- ${t}`}var Dr={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},yt=class{device;options;gltf;constructor(t,n={}){this.device=t,this.options={...Dr,...n}}instantiate(t){return this.gltf=t,(t.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new G(this.gltf):null}createScene(t){let r=(t.nodes||[]).map(i=>this.createNode(i));return new Y.GroupNode({id:t.name||t.id,children:r})}createNode(t){if(!t._node){let r=(t.children||[]).map(i=>this.createNode(i));t.mesh&&r.push(this.createMesh(t.mesh));let s=new Y.GroupNode({id:t.name||t.id,children:r});if(t.matrix)s.setMatrix(t.matrix);else{if(s.matrix.identity(),t.translation&&s.matrix.translate(t.translation),t.rotation){let i=new z().fromQuaternion(t.rotation);s.matrix.multiplyRight(i)}t.scale&&s.matrix.scale(t.scale)}t._node=s}return t._node}createMesh(t){if(!t._mesh){let r=(t.primitives||[]).map((i,o)=>this.createPrimitive(i,o,t)),s=new Y.GroupNode({id:t.name||t.id,children:r});t._mesh=s}return t._mesh}createPrimitive(t,n,r){let s=t.name||`${r.name||r.id}-primitive-${n}`,i=Vr(t.mode||4),o=t.indices?t.indices.count:this.getVertexCount(t.attributes),c=Mn(this.device,{id:s,geometry:this.createGeometry(s,t,i),material:t.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:o});return c.bounds=[t.attributes.POSITION.min,t.attributes.POSITION.max],c}getVertexCount(t){throw new Error("getVertexCount not implemented")}createGeometry(t,n,r){let s={};for(let[i,o]of Object.entries(n.attributes)){let{components:c,size:a,value:f}=o;s[i]={size:a??c,value:f}}return new Y.Geometry({id:t,topology:r,indices:n.indices.value,attributes:s})}createBuffer(t,n){t.bufferView||(t.bufferView={});let{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||t.value})),r.lumaBuffers[n]}createSampler(t){return t}needsPOT(){return!1}};function Vr(e){switch(e){case 0:return"point-list";case 1:return"line-list";case 3:return"line-strip";case 2:return"line-loop-webgl";case 4:return"triangle-list";case 5:return"triangle-strip";case 6:return"triangle-fan-webgl";default:throw new Error(e)}}function yn(e,t,n){let r=new yt(e,n),s=r.instantiate(t),i=r.createAnimator();return{scenes:s,animator:i}}return un(Ur);})();
66
- return __exports__;
67
- });