bg2e-js 2.2.6 → 2.2.8

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/bg2e-js.js CHANGED
@@ -18,41 +18,41 @@ var ct = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.X = 1] = "X", t[t.
18
18
  }
19
19
  t.name = e;
20
20
  })(ct || (ct = {}));
21
- const $r = 3.141592653589793, ei = 0.01745329251994, ti = 57.29577951308233, qn = 1.5707963267948966, _n = 0.785398163397448, $n = 0.392699081698724, es = 6.283185307179586, gt = 1e-7, Le = Float32Array, ts = Float64Array, rs = 3402823e32, Ge = (t, e) => t.length >= e;
21
+ const _r = 3.141592653589793, $r = 0.01745329251994, ei = 57.29577951308233, Jn = 1.5707963267948966, Zn = 0.785398163397448, qn = 0.392699081698724, _n = 6.283185307179586, gt = 1e-7, Le = Float32Array, $n = Float64Array, es = 3402823e32, Ge = (t, e) => t.length >= e;
22
22
  let Ft = Date.now();
23
- const is = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, fe = (t) => t > -gt && t < gt ? 0 : t, b = (t) => fe(t) === 0, E = (t, e) => Math.abs(t - e) < gt, We = (t) => Math.fround(fe(t * ei)), ri = (t) => Math.fround(fe(t * ti)), ns = (t) => Math.fround(fe(Math.sin(t))), ss = (t) => Math.fround(fe(Math.cos(t))), ii = (t) => Math.fround(fe(Math.tan(t))), os = (t) => Math.fround(fe(1 / ii(t))), as = (t) => Math.fround(fe(Math.atan(t))), hs = (t, e) => Math.fround(fe(Math.atan2(t, e))), As = () => Math.random(), fs = () => (Ft = (Ft * 9301 + 49297) % 233280, 0 + Ft / 233280 * 1), ls = (t, e) => Math.fround(Math.max(t, e)), cs = (t, e) => Math.fround(Math.min(t, e)), gs = (t) => Math.fround(Math.abs(t)), us = (t) => Math.fround(Math.sqrt(t)), J = (t, e, r) => (r = r > 1 ? 1 : r, Math.fround((1 - r) * t + r * e)), ds = (t) => Math.fround(t * t), Z = (t, e, r) => Math.fround(Math.max(e, Math.min(t, r))), ws = {
23
+ const ts = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, fe = (t) => t > -gt && t < gt ? 0 : t, b = (t) => fe(t) === 0, E = (t, e) => Math.abs(t - e) < gt, We = (t) => Math.fround(fe(t * $r)), ti = (t) => Math.fround(fe(t * ei)), rs = (t) => Math.fround(fe(Math.sin(t))), is = (t) => Math.fround(fe(Math.cos(t))), ri = (t) => Math.fround(fe(Math.tan(t))), ns = (t) => Math.fround(fe(1 / ri(t))), ss = (t) => Math.fround(fe(Math.atan(t))), os = (t, e) => Math.fround(fe(Math.atan2(t, e))), as = () => Math.random(), hs = () => (Ft = (Ft * 9301 + 49297) % 233280, 0 + Ft / 233280 * 1), As = (t, e) => Math.fround(Math.max(t, e)), fs = (t, e) => Math.fround(Math.min(t, e)), ls = (t) => Math.fround(Math.abs(t)), cs = (t) => Math.fround(Math.sqrt(t)), J = (t, e, r) => (r = r > 1 ? 1 : r, Math.fround((1 - r) * t + r * e)), gs = (t) => Math.fround(t * t), Z = (t, e, r) => Math.fround(Math.max(e, Math.min(t, r))), us = {
24
24
  Axis: ct,
25
- PI: $r,
26
- DEG_TO_RAD: ei,
27
- RAD_TO_DEG: ti,
28
- PI_2: qn,
29
- PI_4: _n,
30
- PI_8: $n,
31
- TWO_PI: es,
25
+ PI: _r,
26
+ DEG_TO_RAD: $r,
27
+ RAD_TO_DEG: ei,
28
+ PI_2: Jn,
29
+ PI_4: Zn,
30
+ PI_8: qn,
31
+ TWO_PI: _n,
32
32
  EPSILON: gt,
33
33
  NumericArray: Le,
34
- NumericArrayHighP: ts,
35
- FLOAT_MAX: rs,
36
- checkPowerOfTwo: is,
34
+ NumericArrayHighP: $n,
35
+ FLOAT_MAX: es,
36
+ checkPowerOfTwo: ts,
37
37
  checkZero: fe,
38
38
  isZero: b,
39
39
  equals: E,
40
40
  degreesToRadians: We,
41
- radiansToDegrees: ri,
42
- sin: ns,
43
- cos: ss,
44
- tan: ii,
45
- cotan: os,
46
- atan: as,
47
- atan2: hs,
48
- random: As,
49
- seededRandom: fs,
50
- max: ls,
51
- min: cs,
52
- abs: gs,
53
- sqrt: us,
41
+ radiansToDegrees: ti,
42
+ sin: rs,
43
+ cos: is,
44
+ tan: ri,
45
+ cotan: ns,
46
+ atan: ss,
47
+ atan2: os,
48
+ random: as,
49
+ seededRandom: hs,
50
+ max: As,
51
+ min: fs,
52
+ abs: ls,
53
+ sqrt: cs,
54
54
  lerp: J,
55
- square: ds
55
+ square: gs
56
56
  }, ce = (t, e) => {
57
57
  if (t.length != e.length) throw new Error("Invalid vector length in operation");
58
58
  };
@@ -798,7 +798,7 @@ class w extends Le {
798
798
  return this[0] = 0, this[1] = 0, this[2] = 0, this[3] = 0, this[4] = 0, this[5] = 0, this[6] = 0, this[7] = 0, this[8] = 0, this[9] = 0, this[10] = 0, this[11] = 0, this[12] = 0, this[13] = 0, this[14] = 0, this[15] = 0, this;
799
799
  }
800
800
  perspective(e, r, i, n) {
801
- let s = Math.tan(e * $r / 360) * i, o = s * r;
801
+ let s = Math.tan(e * _r / 360) * i, o = s * r;
802
802
  return this.frustum(-o, o, -s, s, i, n), this;
803
803
  }
804
804
  frustum(e, r, i, n, s, o) {
@@ -1206,7 +1206,7 @@ class w extends Le {
1206
1206
  return E(e[0], 1) && E(e[1], 0) && E(e[2], 0) && E(e[3], 0) && E(e[4], 0) && E(e[5], 1) && E(e[6], 0) && E(e[7], 0) && E(e[8], 0) && E(e[9], 0) && E(e[10], 1) && E(e[11], 0) && E(e[12], 0) && E(e[13], 0) && E(e[14], 0) && E(e[15], 1);
1207
1207
  }
1208
1208
  }
1209
- class vs extends h {
1209
+ class ds extends h {
1210
1210
  constructor(e, r, i, n) {
1211
1211
  if (super(0, 0, 0, 0), e === void 0)
1212
1212
  this.setValue(0, 0, 0, 0);
@@ -1236,7 +1236,7 @@ class vs extends h {
1236
1236
  return this[0] = r * Math.sin(e / 2), this[1] = i * Math.sin(e / 2), this[2] = n * Math.sin(e / 2), this[3] = Math.cos(e / 2), this;
1237
1237
  }
1238
1238
  }
1239
- class ni {
1239
+ class ii {
1240
1240
  constructor(e = null) {
1241
1241
  if (e !== null && !(e instanceof w))
1242
1242
  throw Error("MatrixStrategy: invalid target object. Target object must be of type bg.math.Mat4");
@@ -1302,20 +1302,20 @@ class ni {
1302
1302
  }
1303
1303
  C[0] = 128, C[1] = 32768, C[2] = 8388608, C[3] = -2147483648, D[0] = 0, D[1] = 8, D[2] = 16, D[3] = 24, t.md5 = t.md5 || n;
1304
1304
  })(typeof global > "u" ? window : global);
1305
- const si = (t) => md5(t), Pt = () => {
1305
+ const ni = (t) => md5(t), Pt = () => {
1306
1306
  let t = (/* @__PURE__ */ new Date()).getTime();
1307
1307
  return typeof performance < "u" && typeof performance.now == "function" && (t += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
1308
1308
  var r = (t + Math.random() * 16) % 16 | 0;
1309
1309
  return t = Math.floor(t / 16), (e === "x" ? r : r & 3 | 8).toString(16);
1310
1310
  });
1311
- }, ms = () => {
1311
+ }, ws = () => {
1312
1312
  const t = new Uint32Array(1);
1313
1313
  return t[0] = 255, t[3] === 255;
1314
- }, Ps = () => {
1314
+ }, vs = () => {
1315
1315
  const t = new Uint32Array(1);
1316
1316
  return t[0] = 255, t[0] === 255;
1317
1317
  };
1318
- class Bs {
1318
+ class ms {
1319
1319
  constructor(e) {
1320
1320
  this.system = {
1321
1321
  OSX: !1,
@@ -1433,8 +1433,8 @@ class Bs {
1433
1433
  return navigator.userAgent;
1434
1434
  }
1435
1435
  }
1436
- var oi = /* @__PURE__ */ ((t) => (t[t.BROWSER = 0] = "BROWSER", t[t.NODE = 1] = "NODE", t))(oi || {}), ai = /* @__PURE__ */ ((t) => (t.BROWSER = "Browser", t.NODE = "Node", t))(ai || {});
1437
- const Cs = (t) => {
1436
+ var si = /* @__PURE__ */ ((t) => (t[t.BROWSER = 0] = "BROWSER", t[t.NODE = 1] = "NODE", t))(si || {}), oi = /* @__PURE__ */ ((t) => (t.BROWSER = "Browser", t.NODE = "Node", t))(oi || {});
1437
+ const Ps = (t) => {
1438
1438
  switch (t) {
1439
1439
  case 0:
1440
1440
  return "Browser";
@@ -1443,11 +1443,7 @@ const Cs = (t) => {
1443
1443
  default:
1444
1444
  return "Browser";
1445
1445
  }
1446
- }, ar = () => typeof process < "u" && process.release.name === "node" ? 1 : 0, hr = () => ar() === 0, hi = () => ar() === 1, ps = async (t) => {
1447
- if (hr() || hi())
1448
- return new Uint8Array(atob(t).split("").map((e) => e.charCodeAt(0)));
1449
- throw new Error("base64ToArrayBuffer: Unsupported platform. Valid platforms are NodeJS or Browser");
1450
- };
1446
+ }, ar = () => 0, Bs = () => ar() === 0, Cs = () => ar() === 1, ps = async (t) => new Uint8Array(atob(t).split("").map((e) => e.charCodeAt(0)));
1451
1447
  class Ze {
1452
1448
  set writeStrategy(e) {
1453
1449
  this._writeStrategy = e;
@@ -1464,9 +1460,7 @@ class Ze {
1464
1460
  case 0:
1465
1461
  return this.writeStrategy.writeBytes(e, r);
1466
1462
  case 1:
1467
- if (hr())
1468
- return this.writeStrategy.writeImage(e, r);
1469
- throw new Error("ResourceProvider.write() unsupported data format: Image data format is supported only on browsers or electron renderer process.");
1463
+ return this.writeStrategy.writeImage(e, r);
1470
1464
  case 2:
1471
1465
  const n = await ps(r);
1472
1466
  return this.writeStrategy.writeBytes(e, n);
@@ -1497,7 +1491,7 @@ const Gt = (t) => {
1497
1491
  Gt(s.target), i(new Error(`Image load aborted '${t}'.`));
1498
1492
  }), n.src = t + (e ? `?${Pt()}` : "");
1499
1493
  });
1500
- class Ai extends Ze {
1494
+ class ai extends Ze {
1501
1495
  async load(e) {
1502
1496
  return await Ds(e, !1);
1503
1497
  }
@@ -1516,7 +1510,7 @@ const Ut = (t) => {
1516
1510
  Ut(n.target), r(new Error(`Video load aborted '${t}'`));
1517
1511
  }), i.src = t;
1518
1512
  });
1519
- class fi extends Ze {
1513
+ class hi extends Ze {
1520
1514
  async load(e) {
1521
1515
  return await bs(e);
1522
1516
  }
@@ -1524,7 +1518,7 @@ class fi extends Ze {
1524
1518
  throw new Error("VideoResourceProvider.write(): not supported");
1525
1519
  }
1526
1520
  }
1527
- class li extends Ze {
1521
+ class Ai extends Ze {
1528
1522
  async load(e) {
1529
1523
  const r = await fetch(e);
1530
1524
  if (r.ok)
@@ -1532,7 +1526,7 @@ class li extends Ze {
1532
1526
  throw new Error(`Resource not found at '${e}'`);
1533
1527
  }
1534
1528
  }
1535
- class ci extends Ze {
1529
+ class fi extends Ze {
1536
1530
  async load(e) {
1537
1531
  const r = await fetch(e);
1538
1532
  if (r.ok) {
@@ -1553,37 +1547,37 @@ var M = /* @__PURE__ */ ((t) => (t.PolyList = "PolyList", t.Drawable = "Drawable
1553
1547
  const Es = (t) => {
1554
1548
  const e = /\.([a-z0-9]+)$/i.exec(t);
1555
1549
  return e ? e[1] : "";
1556
- }, Ar = (t) => {
1550
+ }, hr = (t) => {
1557
1551
  const e = /(.+)\/(.+)$/.exec(t);
1558
1552
  return e ? e[2] : t;
1559
- }, fr = (t) => {
1553
+ }, Ar = (t) => {
1560
1554
  const e = /(.+)\.(.+)$/.exec(t);
1561
1555
  return e ? e[1] : t;
1562
- }, gi = (t) => {
1556
+ }, li = (t) => {
1563
1557
  const e = t.lastIndexOf("/");
1564
1558
  return e != -1 ? t.substring(0, e + 1) : t;
1565
- }, xs = (t) => /^http|^\//i.test(t), ui = (t, e) => t[t.length - 1] !== "/" && e[0] !== "/" ? `${t}/${e}` : t[t.length - 1] === "/" && e[0] !== "/" || t[t.length - 1] !== "/" && e[0] === "/" ? `${t}${e}` : `${t}${e.slice(1)}`, Bt = (t, e) => e.some((r) => new RegExp(`.${r}`, "i").test(t)), Ct = (t, e) => {
1559
+ }, xs = (t) => /^http|^\//i.test(t), ci = (t, e) => t[t.length - 1] !== "/" && e[0] !== "/" ? `${t}/${e}` : t[t.length - 1] === "/" && e[0] !== "/" || t[t.length - 1] !== "/" && e[0] === "/" ? `${t}${e}` : `${t}${e.slice(1)}`, Bt = (t, e) => e.some((r) => new RegExp(`.${r}`, "i").test(t)), Ct = (t, e) => {
1566
1560
  Array.isArray(t) || (t = [t]), t.forEach((r) => {
1567
1561
  e.indexOf(r) === -1 && e.push(r);
1568
1562
  });
1569
- }, lr = [
1563
+ }, fr = [
1570
1564
  "jpg",
1571
1565
  "jpeg",
1572
1566
  "gif",
1573
1567
  "png"
1574
- ], di = (t) => Bt(t, lr), Qs = (t) => {
1575
- Ct(t, lr);
1576
- }, Ts = () => lr, cr = [
1568
+ ], gi = (t) => Bt(t, fr), Qs = (t) => {
1569
+ Ct(t, fr);
1570
+ }, Ts = () => fr, lr = [
1577
1571
  "mp4",
1578
1572
  "m4v"
1579
- ], wi = (t) => Bt(t, cr), ys = (t) => {
1580
- Ct(t, cr);
1581
- }, Ms = () => cr, gr = [
1573
+ ], ui = (t) => Bt(t, lr), ys = (t) => {
1574
+ Ct(t, lr);
1575
+ }, Ms = () => lr, cr = [
1582
1576
  "vwglb",
1583
1577
  "bg2"
1584
- ], vi = (t) => Bt(t, gr), Ns = (t) => {
1585
- Ct(t, gr);
1586
- }, Hs = () => gr;
1578
+ ], di = (t) => Bt(t, cr), Ns = (t) => {
1579
+ Ct(t, cr);
1580
+ }, Hs = () => cr;
1587
1581
  class qe {
1588
1582
  constructor({
1589
1583
  imageProvider: e = null,
@@ -1592,7 +1586,7 @@ class qe {
1592
1586
  textProvider: n = null,
1593
1587
  writeStrategy: s = void 0
1594
1588
  } = {}) {
1595
- this._imageProvider = e || new Ai(), this._videoProvider = r || new fi(), this._binaryProvider = i || new li(), this._textProvider = n || new ci(), s && (this.writeStrategy = s);
1589
+ this._imageProvider = e || new ai(), this._videoProvider = r || new hi(), this._binaryProvider = i || new Ai(), this._textProvider = n || new fi(), s && (this.writeStrategy = s);
1596
1590
  }
1597
1591
  set writeStrategy(e) {
1598
1592
  this._writeStrategy = e, e && (this._imageProvider.writeStrategy = e, this._videoProvider.writeStrategy = e, this._binaryProvider.writeStrategy = e, this._textProvider.writeStrategy = e);
@@ -1602,11 +1596,11 @@ class qe {
1602
1596
  }
1603
1597
  getProvider(e) {
1604
1598
  switch (!0) {
1605
- case di(e):
1599
+ case gi(e):
1606
1600
  return this._imageProvider;
1607
- case wi(e):
1601
+ case ui(e):
1608
1602
  return this._videoProvider;
1609
- case vi(e):
1603
+ case di(e):
1610
1604
  return this._binaryProvider;
1611
1605
  default:
1612
1606
  return this._textProvider;
@@ -1621,33 +1615,33 @@ class qe {
1621
1615
  }
1622
1616
  const zs = {
1623
1617
  generateUUID: Pt,
1624
- generateMD5: si,
1625
- isBigEndian: ms,
1626
- isLittleEndian: Ps,
1627
- UserAgent: Bs,
1618
+ generateMD5: ni,
1619
+ isBigEndian: ws,
1620
+ isLittleEndian: vs,
1621
+ UserAgent: ms,
1628
1622
  Resource: qe,
1629
1623
  isFormat: Bt,
1630
1624
  addFormats: Ct,
1631
- isValidImage: di,
1625
+ isValidImage: gi,
1632
1626
  addImageFormats: Qs,
1633
1627
  getValidImageFormats: Ts,
1634
- isValidVideo: wi,
1628
+ isValidVideo: ui,
1635
1629
  addVideoFormats: ys,
1636
1630
  getValidVideoFormats: Ms,
1637
- isValidBinary: vi,
1631
+ isValidBinary: di,
1638
1632
  addBinaryFormats: Ns,
1639
1633
  getValidBinaryFormats: Hs,
1640
1634
  ResourceProvider: Ze,
1641
- ImageResourceProvider: Ai,
1642
- VideoResourceProvider: fi,
1643
- BinaryResourceProvider: li,
1644
- TextResourceProvider: ci,
1645
- ProcessType: oi,
1646
- ProcessTypeName: ai,
1635
+ ImageResourceProvider: ai,
1636
+ VideoResourceProvider: hi,
1637
+ BinaryResourceProvider: Ai,
1638
+ TextResourceProvider: fi,
1639
+ ProcessType: si,
1640
+ ProcessTypeName: oi,
1647
1641
  getProcessType: ar,
1648
- getProcessTypeName: Cs,
1649
- isBrowser: hr,
1650
- isNode: hi
1642
+ getProcessTypeName: Ps,
1643
+ isBrowser: Bs,
1644
+ isNode: Cs
1651
1645
  };
1652
1646
  class pt {
1653
1647
  // Returns an array of valid file extensions for this plugin
@@ -1805,10 +1799,10 @@ class p extends h {
1805
1799
  return Te(e), new p([e[0] / r, e[1] / r, e[2] / r, e[3] / r]);
1806
1800
  }
1807
1801
  }
1808
- var mi = /* @__PURE__ */ ((t) => (t[t.VERTEX = 1] = "VERTEX", t[t.NORMAL = 2] = "NORMAL", t[t.TEX_COORD_0 = 4] = "TEX_COORD_0", t[t.TEX_COORD_1 = 8] = "TEX_COORD_1", t[t.TEX_COORD_2 = 16] = "TEX_COORD_2", t[t.COLOR = 32] = "COLOR", t[t.TANGENT = 64] = "TANGENT", t[t.INDEX = 128] = "INDEX", t))(mi || {}), ae = /* @__PURE__ */ ((t) => (t[t.POINTS = 0] = "POINTS", t[t.TRIANGLES = 1] = "TRIANGLES", t[t.TRIANGLE_FAN = 2] = "TRIANGLE_FAN", t[t.TRIANGLE_STRIP = 3] = "TRIANGLE_STRIP", t[t.LINES = 4] = "LINES", t[t.LINE_STRIP = 5] = "LINE_STRIP", t))(ae || {}), k = /* @__PURE__ */ ((t) => (t[t.LAYER_0 = 1] = "LAYER_0", t[t.OPAQUE_DEFAULT = 1] = "OPAQUE_DEFAULT", t[t.LAYER_1 = 2] = "LAYER_1", t[t.LAYER_2 = 4] = "LAYER_2", t[t.LAYER_3 = 8] = "LAYER_3", t[t.LAYER_4 = 16] = "LAYER_4", t[t.LAYER_5 = 32] = "LAYER_5", t[t.LAYER_6 = 64] = "LAYER_6", t[t.LAYER_7 = 128] = "LAYER_7", t[t.LAYER_8 = 256] = "LAYER_8", t[t.LAYER_9 = 512] = "LAYER_9", t[t.LAYER_10 = 1024] = "LAYER_10", t[t.LAYER_11 = 2048] = "LAYER_11", t[t.LAYER_12 = 4096] = "LAYER_12", t[t.LAYER_13 = 8192] = "LAYER_13", t[t.LAYER_14 = 16384] = "LAYER_14", t[t.LAYER_15 = 32768] = "LAYER_15", t[t.TRANSPARENT_DEFAULT = 32768] = "TRANSPARENT_DEFAULT", t[t.LAYER_16 = 65536] = "LAYER_16", t[t.LAYER_17 = 131072] = "LAYER_17", t[t.LAYER_18 = 262144] = "LAYER_18", t[t.LAYER_19 = 524288] = "LAYER_19", t[t.LAYER_20 = 1048576] = "LAYER_20", t[t.LAYER_21 = 2097152] = "LAYER_21", t[t.LAYER_22 = 4194304] = "LAYER_22", t[t.LAYER_23 = 8388608] = "LAYER_23", t[t.LAYER_24 = 16777216] = "LAYER_24", t[t.LAYER_25 = 33554432] = "LAYER_25", t[t.LAYER_26 = 67108864] = "LAYER_26", t[t.LAYER_27 = 134217728] = "LAYER_27", t[t.LAYER_28 = 268435456] = "LAYER_28", t[t.LAYER_29 = 536870912] = "LAYER_29", t[t.LAYER_30 = 1073741824] = "LAYER_30", t[t.LAYER_31 = -2147483648] = "LAYER_31", t[t.SELECTION_DEFAULT = -2147483648] = "SELECTION_DEFAULT", t[t.ALL = 4294967295] = "ALL", t[t.AUTO = 0] = "AUTO", t))(k || {});
1809
- const Pi = (t, e) => t.renderLayers === 0 ? (e.isTransparent ? 32768 : 1) | -2147483648 : t.renderLayers;
1802
+ var wi = /* @__PURE__ */ ((t) => (t[t.VERTEX = 1] = "VERTEX", t[t.NORMAL = 2] = "NORMAL", t[t.TEX_COORD_0 = 4] = "TEX_COORD_0", t[t.TEX_COORD_1 = 8] = "TEX_COORD_1", t[t.TEX_COORD_2 = 16] = "TEX_COORD_2", t[t.COLOR = 32] = "COLOR", t[t.TANGENT = 64] = "TANGENT", t[t.INDEX = 128] = "INDEX", t))(wi || {}), ae = /* @__PURE__ */ ((t) => (t[t.POINTS = 0] = "POINTS", t[t.TRIANGLES = 1] = "TRIANGLES", t[t.TRIANGLE_FAN = 2] = "TRIANGLE_FAN", t[t.TRIANGLE_STRIP = 3] = "TRIANGLE_STRIP", t[t.LINES = 4] = "LINES", t[t.LINE_STRIP = 5] = "LINE_STRIP", t))(ae || {}), k = /* @__PURE__ */ ((t) => (t[t.LAYER_0 = 1] = "LAYER_0", t[t.OPAQUE_DEFAULT = 1] = "OPAQUE_DEFAULT", t[t.LAYER_1 = 2] = "LAYER_1", t[t.LAYER_2 = 4] = "LAYER_2", t[t.LAYER_3 = 8] = "LAYER_3", t[t.LAYER_4 = 16] = "LAYER_4", t[t.LAYER_5 = 32] = "LAYER_5", t[t.LAYER_6 = 64] = "LAYER_6", t[t.LAYER_7 = 128] = "LAYER_7", t[t.LAYER_8 = 256] = "LAYER_8", t[t.LAYER_9 = 512] = "LAYER_9", t[t.LAYER_10 = 1024] = "LAYER_10", t[t.LAYER_11 = 2048] = "LAYER_11", t[t.LAYER_12 = 4096] = "LAYER_12", t[t.LAYER_13 = 8192] = "LAYER_13", t[t.LAYER_14 = 16384] = "LAYER_14", t[t.LAYER_15 = 32768] = "LAYER_15", t[t.TRANSPARENT_DEFAULT = 32768] = "TRANSPARENT_DEFAULT", t[t.LAYER_16 = 65536] = "LAYER_16", t[t.LAYER_17 = 131072] = "LAYER_17", t[t.LAYER_18 = 262144] = "LAYER_18", t[t.LAYER_19 = 524288] = "LAYER_19", t[t.LAYER_20 = 1048576] = "LAYER_20", t[t.LAYER_21 = 2097152] = "LAYER_21", t[t.LAYER_22 = 4194304] = "LAYER_22", t[t.LAYER_23 = 8388608] = "LAYER_23", t[t.LAYER_24 = 16777216] = "LAYER_24", t[t.LAYER_25 = 33554432] = "LAYER_25", t[t.LAYER_26 = 67108864] = "LAYER_26", t[t.LAYER_27 = 134217728] = "LAYER_27", t[t.LAYER_28 = 268435456] = "LAYER_28", t[t.LAYER_29 = 536870912] = "LAYER_29", t[t.LAYER_30 = 1073741824] = "LAYER_30", t[t.LAYER_31 = -2147483648] = "LAYER_31", t[t.SELECTION_DEFAULT = -2147483648] = "SELECTION_DEFAULT", t[t.ALL = 4294967295] = "ALL", t[t.AUTO = 0] = "AUTO", t))(k || {});
1803
+ const vi = (t, e) => t.renderLayers === 0 ? (e.isTransparent ? 32768 : 1) | -2147483648 : t.renderLayers;
1810
1804
  var ut = /* @__PURE__ */ ((t) => (t[t.CW = 0] = "CW", t[t.CCW = 1] = "CCW", t))(ut || {}), De = /* @__PURE__ */ ((t) => (t[t.FRONT = 0] = "FRONT", t[t.BACK = 1] = "BACK", t[t.FRONT_AND_BACK = 2] = "FRONT_AND_BACK", t))(De || {});
1811
- function Mr(t) {
1805
+ function yr(t) {
1812
1806
  const e = [], r = (s) => ({
1813
1807
  pos: new h(t.vertex[s] * 3, t.vertex[s + 1] * 3, t.vertex[s + 2] * 3),
1814
1808
  uv: new h(t.texCoord0[s] * 2, t.texCoord0[s + 1] * 2)
@@ -1975,10 +1969,10 @@ class de {
1975
1969
  return this._renderer;
1976
1970
  }
1977
1971
  rebuildTangents() {
1978
- Mr(this);
1972
+ yr(this);
1979
1973
  }
1980
1974
  get tangent() {
1981
- return this.validTangents || Mr(this), this._tangent;
1975
+ return this.validTangents || yr(this), this._tangent;
1982
1976
  }
1983
1977
  get validTangents() {
1984
1978
  return this._tangent !== void 0 && this._tangent.length === this._vertex.length && this._tangent.length / 3 === this._texCoord0.length / 2;
@@ -2004,16 +1998,16 @@ const Ls = (t, e = "image/jpeg") => {
2004
1998
  if (r.height = t.naturalHeight, r.width = t.naturalWidth, i === null)
2005
1999
  throw new Error("Could not get canvas 2D context");
2006
2000
  return i.drawImage(t, 0, 0), r.toDataURL(e);
2007
- }, Bi = (t) => {
2001
+ }, mi = (t) => {
2008
2002
  const e = Ls(t);
2009
- return si(e);
2010
- }, Ci = (t, e) => {
2003
+ return ni(e);
2004
+ }, Pi = (t, e) => {
2011
2005
  const r = e.domElement.getBoundingClientRect();
2012
2006
  return {
2013
2007
  x: t.clientX - r.left,
2014
2008
  y: t.clientY - r.top
2015
2009
  };
2016
- }, pi = (t, e) => {
2010
+ }, Bi = (t, e) => {
2017
2011
  const r = e.domElement.getBoundingClientRect();
2018
2012
  return Array.from(t.touches).map((n) => ({
2019
2013
  identifier: n.identifier,
@@ -2075,7 +2069,7 @@ class _e {
2075
2069
  }
2076
2070
  }
2077
2071
  var Qe = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.IMAGE = 1] = "IMAGE", t[t.IMAGE_DATA = 2] = "IMAGE_DATA", t[t.CUBEMAP = 3] = "CUBEMAP", t[t.CUBEMAP_DATA = 4] = "CUBEMAP_DATA", t[t.VIDEO = 5] = "VIDEO", t[t.PROCEDURAL = 6] = "PROCEDURAL", t[t.RENDER_TARGET = 7] = "RENDER_TARGET", t))(Qe || {}), U = /* @__PURE__ */ ((t) => (t[t.REPEAT = 0] = "REPEAT", t[t.CLAMP = 1] = "CLAMP", t[t.MIRRORED_REPEAT = 2] = "MIRRORED_REPEAT", t))(U || {}), q = /* @__PURE__ */ ((t) => (t[t.NEAREST_MIPMAP_NEAREST = 0] = "NEAREST_MIPMAP_NEAREST", t[t.LINEAR_MIPMAP_NEAREST = 1] = "LINEAR_MIPMAP_NEAREST", t[t.NEAREST_MIPMAP_LINEAR = 2] = "NEAREST_MIPMAP_LINEAR", t[t.LINEAR_MIPMAP_LINEAR = 3] = "LINEAR_MIPMAP_LINEAR", t[t.NEAREST = 4] = "NEAREST", t[t.LINEAR = 5] = "LINEAR", t))(q || {}), $ = /* @__PURE__ */ ((t) => (t[t.TEXTURE_2D = 0] = "TEXTURE_2D", t[t.CUBE_MAP = 1] = "CUBE_MAP", t))($ || {}), Pe = /* @__PURE__ */ ((t) => (t[t.PLAIN_COLOR = 0] = "PLAIN_COLOR", t[t.RANDOM_NOISE = 1] = "RANDOM_NOISE", t[t.DYNAMIC_CUBEMAP = 2] = "DYNAMIC_CUBEMAP", t[t.FROM_BASE64 = 3] = "FROM_BASE64", t[t.CANVAS_2D = 4] = "CANVAS_2D", t))(Pe || {}), Y = /* @__PURE__ */ ((t) => (t[t.COLOR_ATTACHMENT_0 = 0] = "COLOR_ATTACHMENT_0", t[t.COLOR_ATTACHMENT_1 = 1] = "COLOR_ATTACHMENT_1", t[t.COLOR_ATTACHMENT_2 = 2] = "COLOR_ATTACHMENT_2", t[t.COLOR_ATTACHMENT_3 = 3] = "COLOR_ATTACHMENT_3", t[t.COLOR_ATTACHMENT_4 = 4] = "COLOR_ATTACHMENT_4", t[t.COLOR_ATTACHMENT_5 = 5] = "COLOR_ATTACHMENT_5", t[t.COLOR_ATTACHMENT_6 = 6] = "COLOR_ATTACHMENT_6", t[t.COLOR_ATTACHMENT_7 = 7] = "COLOR_ATTACHMENT_7", t[t.COLOR_ATTACHMENT_8 = 8] = "COLOR_ATTACHMENT_8", t[t.COLOR_ATTACHMENT_9 = 9] = "COLOR_ATTACHMENT_9", t[t.COLOR_ATTACHMENT_10 = 10] = "COLOR_ATTACHMENT_10", t[t.COLOR_ATTACHMENT_11 = 11] = "COLOR_ATTACHMENT_11", t[t.COLOR_ATTACHMENT_12 = 12] = "COLOR_ATTACHMENT_12", t[t.COLOR_ATTACHMENT_13 = 13] = "COLOR_ATTACHMENT_13", t[t.COLOR_ATTACHMENT_14 = 14] = "COLOR_ATTACHMENT_14", t[t.COLOR_ATTACHMENT_15 = 15] = "COLOR_ATTACHMENT_15", t[t.DEPTH_ATTACHMENT = 100] = "DEPTH_ATTACHMENT", t[t.STENCIL_ATTACHMENT = 200] = "STENCIL_ATTACHMENT", t))(Y || {}), ie = /* @__PURE__ */ ((t) => (t[t.UNSIGNED_BYTE = 0] = "UNSIGNED_BYTE", t[t.FLOAT32 = 1] = "FLOAT32", t))(ie || {}), y = /* @__PURE__ */ ((t) => (t[t.R = 1] = "R", t[t.G = 2] = "G", t[t.B = 3] = "B", t[t.A = 4] = "A", t))(y || {});
2078
- const Di = Object.freeze({
2072
+ const Ci = Object.freeze({
2079
2073
  0: "NONE",
2080
2074
  1: "IMAGE",
2081
2075
  2: "IMAGE_DATA",
@@ -2084,11 +2078,11 @@ const Di = Object.freeze({
2084
2078
  5: "VIDEO",
2085
2079
  6: "PROCEDURAL",
2086
2080
  7: "RENDER_TARGET"
2087
- }), bi = Object.freeze({
2081
+ }), pi = Object.freeze({
2088
2082
  0: "REPEAT",
2089
2083
  1: "CLAMP",
2090
2084
  2: "MIRRORED_REPEAT"
2091
- }), Ei = Object.freeze({
2085
+ }), Di = Object.freeze({
2092
2086
  0: "NEAREST_MIPMAP_NEAREST",
2093
2087
  1: "LINEAR_MIPMAP_NEAREST",
2094
2088
  2: "NEAREST_MIPMAP_LINEAR",
@@ -2098,7 +2092,7 @@ const Di = Object.freeze({
2098
2092
  }), Be = Object.freeze({
2099
2093
  0: "TEXTURE_2D",
2100
2094
  1: "CUBE_MAP"
2101
- }), xi = Object.freeze({
2095
+ }), bi = Object.freeze({
2102
2096
  0: "PLAIN_COLOR",
2103
2097
  1: "RANDOM_NOISE",
2104
2098
  2: "DYNAMIC_CUBEMAP",
@@ -2123,10 +2117,10 @@ const Di = Object.freeze({
2123
2117
  15: "COLOR_ATTACHMENT_15",
2124
2118
  100: "DEPTH_ATTACHMENT",
2125
2119
  200: "STENCIL_ATTACHMENT"
2126
- }), Qi = Object.freeze({
2120
+ }), Ei = Object.freeze({
2127
2121
  0: "UNSIGNED_BYTE",
2128
2122
  1: "FLOAT32"
2129
- }), Ti = Object.freeze({
2123
+ }), xi = Object.freeze({
2130
2124
  1: "R",
2131
2125
  2: "G",
2132
2126
  3: "B",
@@ -2141,10 +2135,10 @@ const kt = {}, Is = async (t) => (Xt || (Xt = new qe()), kt[t] ? console.log(`Im
2141
2135
  const o = new Image();
2142
2136
  await new Promise((f) => {
2143
2137
  o.onload = () => {
2144
- o._hash = Bi(o), f();
2138
+ o._hash = mi(o), f();
2145
2139
  }, o.src = n.toDataURL();
2146
2140
  }), e(o);
2147
- })), kt[t]), Nr = async (t) => {
2141
+ })), kt[t]), Mr = async (t) => {
2148
2142
  const r = await new Promise((a) => {
2149
2143
  const f = new Image();
2150
2144
  f.onload = () => {
@@ -2157,33 +2151,33 @@ const kt = {}, Is = async (t) => (Xt || (Xt = new qe()), kt[t] ? console.log(`Im
2157
2151
  const s = new Image();
2158
2152
  return await new Promise((a) => {
2159
2153
  s.onload = () => {
2160
- s._hash = Bi(s), a();
2154
+ s._hash = mi(s), a();
2161
2155
  }, s.src = i.toDataURL("image/png");
2162
2156
  }), s;
2163
2157
  };
2164
- function yi(t) {
2165
- return bi[t] || "UNKNOWN";
2158
+ function Qi(t) {
2159
+ return pi[t] || "UNKNOWN";
2166
2160
  }
2167
2161
  function Ss(t) {
2168
- return Di[t] || "UNKNOWN";
2162
+ return Ci[t] || "UNKNOWN";
2169
2163
  }
2170
- function Mi(t) {
2171
- return Ei[t] || "UNKNOWN";
2164
+ function Ti(t) {
2165
+ return Di[t] || "UNKNOWN";
2172
2166
  }
2173
2167
  function Rs(t) {
2174
2168
  return Be[t] || "UNKNOWN";
2175
2169
  }
2176
2170
  function Os(t) {
2177
- return xi[t] || "UNKNOWN";
2171
+ return bi[t] || "UNKNOWN";
2178
2172
  }
2179
2173
  function Fs(t) {
2180
2174
  return je[t] || "UNKNOWN";
2181
2175
  }
2182
2176
  function Gs(t) {
2183
- return Qi[t] || "UNKNOWN";
2177
+ return Ei[t] || "UNKNOWN";
2184
2178
  }
2185
2179
  function Us(t) {
2186
- return Ti[t] || "UNKNOWN";
2180
+ return xi[t] || "UNKNOWN";
2187
2181
  }
2188
2182
  class x {
2189
2183
  constructor(e = null) {
@@ -2353,7 +2347,7 @@ class x {
2353
2347
  return;
2354
2348
  if (!/;base64/i.test(this.proceduralParameters?.imageData))
2355
2349
  throw new Error("Error generating procedural texture from base64 string. Invalid base64 image");
2356
- this._imageData = await Nr(this.proceduralParameters.imageData), this._size = new h(this._imageData.width, this._imageData.height), this._dirty = !0;
2350
+ this._imageData = await Mr(this.proceduralParameters.imageData), this._size = new h(this._imageData.width, this._imageData.height), this._dirty = !0;
2357
2351
  } else if (this.proceduralFunction == 4) {
2358
2352
  if (this._imageData && e === !1)
2359
2353
  return;
@@ -2361,7 +2355,7 @@ class x {
2361
2355
  if (!/canvas/i.test(r?.tagName))
2362
2356
  throw new Error("Error generating procedural texture from HTML canvas. Invalid 'canvas' parameter.");
2363
2357
  const i = r.toDataURL();
2364
- this._imageData = await Nr(i), this._size = new h(this._imageData.width, this._imageData.height), this._dirty = !0;
2358
+ this._imageData = await Mr(i), this._size = new h(this._imageData.width, this._imageData.height), this._dirty = !0;
2365
2359
  } else
2366
2360
  throw new Error("Texture: loadImageData(): not implemented");
2367
2361
  }
@@ -2813,10 +2807,10 @@ class V {
2813
2807
  const Ye = {
2814
2808
  VERTEX: 0,
2815
2809
  FRAGMENT: 1
2816
- }, Hr = /* @__PURE__ */ new WeakMap();
2810
+ }, Nr = /* @__PURE__ */ new WeakMap();
2817
2811
  function Xs(t) {
2818
- let e = Hr.get(t);
2819
- return e || (e = /* @__PURE__ */ Symbol(), Hr.set(t, e)), e;
2812
+ let e = Nr.get(t);
2813
+ return e || (e = /* @__PURE__ */ Symbol(), Nr.set(t, e)), e;
2820
2814
  }
2821
2815
  class T {
2822
2816
  destroy() {
@@ -3040,7 +3034,7 @@ ${e.getProgramInfoLog(this._program)}`);
3040
3034
  ${e.getProgramInfoLog(this._program)}`);
3041
3035
  }
3042
3036
  }
3043
- const zr = {
3037
+ const Hr = {
3044
3038
  webgl: {
3045
3039
  vertex: `precision mediump float;
3046
3040
 
@@ -3089,14 +3083,14 @@ const zr = {
3089
3083
  }`
3090
3084
  }
3091
3085
  };
3092
- class Ni extends V {
3086
+ class yi extends V {
3093
3087
  constructor(e) {
3094
3088
  if (super(e), this._program = null, e.typeId !== "WebGL")
3095
3089
  throw Error("IrradianceMapCubeShader is only compatible with WebGL renderer");
3096
3090
  }
3097
3091
  async load() {
3098
3092
  const { gl: e } = this.renderer;
3099
- this._program = new T(e, "IrradianceMapCubeShader"), this._program.attachVertexSource(zr.webgl.vertex), this._program.attachFragmentSource(zr.webgl.fragment(0.1)), this._program.link();
3093
+ this._program = new T(e, "IrradianceMapCubeShader"), this._program.attachVertexSource(Hr.webgl.vertex), this._program.attachFragmentSource(Hr.webgl.fragment(0.1)), this._program.link();
3100
3094
  }
3101
3095
  setup(e, r, i, n, s) {
3102
3096
  if (!this._program)
@@ -3112,7 +3106,7 @@ class Ni extends V {
3112
3106
  this._program && (T.Delete(this._program), this._program = null);
3113
3107
  }
3114
3108
  }
3115
- const Lr = {
3109
+ const zr = {
3116
3110
  webgl: {
3117
3111
  vertex: `precision mediump float;
3118
3112
 
@@ -3204,7 +3198,7 @@ const Lr = {
3204
3198
  }`
3205
3199
  }
3206
3200
  };
3207
- class Hi extends V {
3201
+ class Mi extends V {
3208
3202
  constructor(e) {
3209
3203
  if (super(e), this._roughness = 0.4, this._program = null, e.typeId !== "WebGL")
3210
3204
  throw Error("SpecularMapCubeShader is only compatible with WebGL renderer");
@@ -3214,7 +3208,7 @@ class Hi extends V {
3214
3208
  }
3215
3209
  async load() {
3216
3210
  const { gl: e } = this.renderer;
3217
- this._roughness = 0.4, this._program = new T(e, "SpecularMapCubeShader"), this._program.attachVertexSource(Lr.webgl.vertex), this._program.attachFragmentSource(Lr.webgl.fragment(128, this._roughness)), this._program.link();
3211
+ this._roughness = 0.4, this._program = new T(e, "SpecularMapCubeShader"), this._program.attachVertexSource(zr.webgl.vertex), this._program.attachFragmentSource(zr.webgl.fragment(128, this._roughness)), this._program.link();
3218
3212
  }
3219
3213
  setup(e, r, i, n, s) {
3220
3214
  if (!this._program)
@@ -4640,15 +4634,15 @@ function oo(t, e = 0.3, r = new h(0, 0, 1), i = new h(0, 1, 0)) {
4640
4634
  5
4641
4635
  ], n;
4642
4636
  }
4643
- const zi = _s, ur = eo, ao = ro, ho = no, Ao = so, Li = oo, fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4637
+ const Ni = _s, gr = eo, ao = ro, ho = no, Ao = so, Hi = oo, fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4644
4638
  __proto__: null,
4645
- createArrow: Li,
4639
+ createArrow: Hi,
4646
4640
  createCone: ho,
4647
- createCube: zi,
4641
+ createCube: Ni,
4648
4642
  createCylinder: ao,
4649
4643
  createPlane: Ao,
4650
- createSphere: ur
4651
- }, Symbol.toStringTag, { value: "Module" })), Ir = {
4644
+ createSphere: gr
4645
+ }, Symbol.toStringTag, { value: "Module" })), Lr = {
4652
4646
  webgl: {
4653
4647
  vertex: `precision mediump float;
4654
4648
 
@@ -4676,14 +4670,14 @@ const zi = _s, ur = eo, ao = ro, ho = no, Ao = so, Li = oo, fo = /* @__PURE__ */
4676
4670
  }`
4677
4671
  }
4678
4672
  };
4679
- class Ii extends V {
4673
+ class zi extends V {
4680
4674
  constructor(e) {
4681
4675
  if (super(e), this._program = null, e.typeId !== "WebGL")
4682
4676
  throw Error("SkySphereShader is only compatible with WebGL renderer");
4683
4677
  }
4684
4678
  async load() {
4685
4679
  const { gl: e } = this.renderer;
4686
- this._program = new T(e, "SkySphereShader"), this._program.attachVertexSource(Ir.webgl.vertex), this._program.attachFragmentSource(Ir.webgl.fragment), this._program.link();
4680
+ this._program = new T(e, "SkySphereShader"), this._program.attachVertexSource(Lr.webgl.vertex), this._program.attachFragmentSource(Lr.webgl.fragment), this._program.link();
4687
4681
  }
4688
4682
  setup(e, r, i, n, s) {
4689
4683
  if (!this._program)
@@ -4779,7 +4773,7 @@ class Dt {
4779
4773
  ), this.polyListRenderer.draw(), this.renderer?.debugMode && console.log(`======= End render polyList "${this.polyListRenderer.polyList.name}" ==============`);
4780
4774
  }
4781
4775
  }
4782
- class dr {
4776
+ class ur {
4783
4777
  constructor(e) {
4784
4778
  this._renderer = e, this._texture = null, this._material = null, this._shader = null, this._plistRenderer = null, this._renderState = null;
4785
4779
  }
@@ -4787,7 +4781,7 @@ class dr {
4787
4781
  return this._renderer;
4788
4782
  }
4789
4783
  async load(e, r = null) {
4790
- this._texture = new x(), e ? this._texture.fileName = e : (this._texture.magFilter = q.NEAREST, this._texture.minFilter = q.NEAREST, this._texture.wrapModeXY = U.REPEAT, this._texture.proceduralFunction = Pe.PLAIN_COLOR, this._texture.proceduralParameters = p.Black(), this._texture.size = [2, 2]), await this._texture.loadImageData(), this._material = new ne(), this._material.albedoTexture = this._texture, this._shader = r ? new r(this.renderer) : new Ii(this.renderer), await this._shader?.load();
4784
+ this._texture = new x(), e ? this._texture.fileName = e : (this._texture.magFilter = q.NEAREST, this._texture.minFilter = q.NEAREST, this._texture.wrapModeXY = U.REPEAT, this._texture.proceduralFunction = Pe.PLAIN_COLOR, this._texture.proceduralParameters = p.Black(), this._texture.size = [2, 2]), await this._texture.loadImageData(), this._material = new ne(), this._material.albedoTexture = this._texture, this._shader = r ? new r(this.renderer) : new zi(this.renderer), await this._shader?.load();
4791
4785
  }
4792
4786
  async setTexture(e) {
4793
4787
  if (!this._texture || !this._material)
@@ -4811,7 +4805,7 @@ class dr {
4811
4805
  }
4812
4806
  get polyListRenderer() {
4813
4807
  if (!this._plistRenderer) {
4814
- const e = ur(3.5);
4808
+ const e = gr(3.5);
4815
4809
  e.cullFace = De.FRONT, this._plistRenderer = this.renderer.factory.polyList(e);
4816
4810
  }
4817
4811
  return this._plistRenderer;
@@ -4836,7 +4830,7 @@ const Kt = async (t, e) => {
4836
4830
  }), r?.draw();
4837
4831
  });
4838
4832
  };
4839
- let Si = class {
4833
+ let Li = class {
4840
4834
  constructor(e) {
4841
4835
  this._updated = !1, this._environmentMapResources = null, this._specularMapResources = null, this._irradianceMapResources = null, this._envMapSize = [512, 512], this._specMapSize = [128, 128], this._irrMapSize = [32, 32], this._renderer = e;
4842
4836
  }
@@ -4865,9 +4859,9 @@ let Si = class {
4865
4859
  const s = this.renderer.factory.skySphere();
4866
4860
  await s.load(e || null), this._environmentMapResources.skyShape = s, this._specularMapResources = await Kt(this.renderer, i);
4867
4861
  const o = this.renderer.factory.skyCube();
4868
- o.load(this._environmentMapResources.texture, Hi, [0.5]), this._specularMapResources.skyShape = o, this._irradianceMapResources = await Kt(this.renderer, n);
4862
+ o.load(this._environmentMapResources.texture, Mi, [0.5]), this._specularMapResources.skyShape = o, this._irradianceMapResources = await Kt(this.renderer, n);
4869
4863
  const a = this.renderer.factory.skyCube();
4870
- await a.load(this._environmentMapResources.texture, Ni), this._irradianceMapResources.skyShape = a, this._updated = !1;
4864
+ await a.load(this._environmentMapResources.texture, yi), this._irradianceMapResources.skyShape = a, this._updated = !1;
4871
4865
  }
4872
4866
  destroy() {
4873
4867
  this._environmentMapResources && Wt(this._environmentMapResources), this._specularMapResources && Wt(this._specularMapResources), this._irradianceMapResources && Wt(this._irradianceMapResources), this._updated = !1;
@@ -4876,10 +4870,10 @@ let Si = class {
4876
4870
  this._environmentMapResources && Jt(this._environmentMapResources), this._specularMapResources && Jt(this._specularMapResources), this._irradianceMapResources && Jt(this._irradianceMapResources), this._updated = !0;
4877
4871
  }
4878
4872
  async reloadImage(e) {
4879
- this._environmentMapResources && (this._environmentMapResources.skyShape instanceof dr && await this._environmentMapResources.skyShape.setTexture(e), this._updated = !1);
4873
+ this._environmentMapResources && (this._environmentMapResources.skyShape instanceof ur && await this._environmentMapResources.skyShape.setTexture(e), this._updated = !1);
4880
4874
  }
4881
4875
  };
4882
- const Sr = {
4876
+ const Ir = {
4883
4877
  webgl: {
4884
4878
  vertex: `precision mediump float;
4885
4879
 
@@ -4944,7 +4938,7 @@ class bt extends V {
4944
4938
  }
4945
4939
  async load() {
4946
4940
  const { gl: e } = this.renderer;
4947
- this._program = new T(e, "DefaultTextureMergerShader"), this._program.attachVertexSource(Sr.webgl.vertex), this._program.attachFragmentSource(Sr.webgl.fragment), this._program.link();
4941
+ this._program = new T(e, "DefaultTextureMergerShader"), this._program.attachVertexSource(Ir.webgl.vertex), this._program.attachFragmentSource(Ir.webgl.fragment), this._program.link();
4948
4942
  }
4949
4943
  setTexture(e, r, i = y.R) {
4950
4944
  if (r < y.R || r > y.A)
@@ -4972,7 +4966,7 @@ class bt extends V {
4972
4966
  this._program.bindTexture("uTextureR", a, 0), this._program.bindTexture("uTextureG", f, 1), this._program.bindTexture("uTextureB", c, 2), this._program.bindTexture("uTextureA", d, 3), this._program.uniform1i("uRChannel", this._textureChannels[y.R] || 0), this._program.uniform1i("uGChannel", this._textureChannels[y.G] || 1), this._program.uniform1i("uBChannel", this._textureChannels[y.B] || 2), this._program.uniform1i("uAChannel", this._textureChannels[y.A] || 3), this._program.positionAttribPointer(e.positionAttribParams("position")), this._program.texCoordAttribPointer(e.texCoord0AttribParams("texCoord"));
4973
4967
  }
4974
4968
  }
4975
- class Ri {
4969
+ class Ii {
4976
4970
  constructor(e) {
4977
4971
  this._renderer = e, this._shader = bt.GetUnique(this.renderer), this._dirty = !0, this._mergedTexture = new x(), this._mergedTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._mergedTexture.componentFormat = ie.UNSIGNED_BYTE, this._mergedTexture.wrapModeXY = U.REPEAT, this._renderBuffer = this.renderer.factory.renderBuffer(), this._renderBuffer.attachTexture(this._mergedTexture), this._shader.load();
4978
4972
  }
@@ -5002,7 +4996,7 @@ class Ri {
5002
4996
  }), this._dirty = !1);
5003
4997
  }
5004
4998
  }
5005
- const Rr = {
4999
+ const Sr = {
5006
5000
  webgl: {
5007
5001
  vertex: `precision mediump float;
5008
5002
 
@@ -5027,14 +5021,14 @@ const Rr = {
5027
5021
  }`
5028
5022
  }
5029
5023
  };
5030
- class Oi extends V {
5024
+ class Si extends V {
5031
5025
  constructor(e) {
5032
5026
  if (super(e), this._program = null, e.typeId !== "WebGL")
5033
5027
  throw Error("PresentTextureShader is only compatible with WebGL renderer");
5034
5028
  }
5035
5029
  async load() {
5036
5030
  const { gl: e } = this.renderer;
5037
- this._program = new T(e, "DefaultPresentTextureShader"), this._program.attachVertexSource(Rr.webgl.vertex), this._program.attachFragmentSource(Rr.webgl.fragment), this._program.link();
5031
+ this._program = new T(e, "DefaultPresentTextureShader"), this._program.attachVertexSource(Sr.webgl.vertex), this._program.attachFragmentSource(Sr.webgl.fragment), this._program.link();
5038
5032
  }
5039
5033
  setup(e, r, i, n, s) {
5040
5034
  if (!this._program)
@@ -5116,7 +5110,7 @@ class Et {
5116
5110
  return this._presentTextureSurface;
5117
5111
  }
5118
5112
  async initPresentTextureShader() {
5119
- return this._presentTextureShader || (this._presentTextureShader = new Oi(this), this._presentTextureShader.load()), this._presentTextureShader;
5113
+ return this._presentTextureShader || (this._presentTextureShader = new Si(this), this._presentTextureShader.load()), this._presentTextureShader;
5120
5114
  }
5121
5115
  get presentTextureShader() {
5122
5116
  return this._presentTextureShader;
@@ -5147,10 +5141,10 @@ class Et {
5147
5141
  throw new Error("Calling base implementation of Renderer.skyCubeFactory()");
5148
5142
  }
5149
5143
  environmentFactory() {
5150
- return new Si(this);
5144
+ return new Li(this);
5151
5145
  }
5152
5146
  textureMergerFactory() {
5153
- return new Ri(this);
5147
+ return new Ii(this);
5154
5148
  }
5155
5149
  pipelineFactory() {
5156
5150
  throw new Error("Calling base implementation of Renderer.pipelineFactory()");
@@ -5222,10 +5216,10 @@ class Et {
5222
5216
  return 1;
5223
5217
  }
5224
5218
  }
5225
- const Fi = {}, ee = (t, e) => {
5226
- Fi[t] = e;
5219
+ const Ri = {}, ee = (t, e) => {
5220
+ Ri[t] = e;
5227
5221
  }, lo = (t) => {
5228
- const e = Fi[t];
5222
+ const e = Ri[t];
5229
5223
  if (e)
5230
5224
  try {
5231
5225
  return new e();
@@ -5236,7 +5230,7 @@ const Fi = {}, ee = (t, e) => {
5236
5230
  else
5237
5231
  return console.debug(`Ignoring component with type id='${t}'. If this is not expected, check if the component is registered in the component factory.`), null;
5238
5232
  return null;
5239
- }, Gi = async (t, e) => {
5233
+ }, Oi = async (t, e) => {
5240
5234
  const r = lo(t.type);
5241
5235
  return r ? (await r.deserialize(t, e), r) : null;
5242
5236
  };
@@ -5340,7 +5334,7 @@ class se {
5340
5334
  touchEnd(e) {
5341
5335
  }
5342
5336
  }
5343
- class wr {
5337
+ class dr {
5344
5338
  syncArray() {
5345
5339
  this._array = [];
5346
5340
  for (const e in this._obj) {
@@ -5388,7 +5382,7 @@ class wr {
5388
5382
  return this._array.filter(e);
5389
5383
  }
5390
5384
  clone(e) {
5391
- const r = new wr(e);
5385
+ const r = new dr(e);
5392
5386
  return r.assign(this), r;
5393
5387
  }
5394
5388
  // Note: this function clones the components from 'other'
@@ -5403,7 +5397,7 @@ class wr {
5403
5397
  this.syncArray();
5404
5398
  }
5405
5399
  }
5406
- function Ui(t, e) {
5400
+ function Fi(t, e) {
5407
5401
  t._bindedRenderer = e, t.components.forEach((r) => {
5408
5402
  r.bindRenderer(e);
5409
5403
  });
@@ -5417,7 +5411,7 @@ async function co(t) {
5417
5411
  }
5418
5412
  class Ae {
5419
5413
  constructor(e = "") {
5420
- this._sceneChanged = !1, this._name = e, this._enabled = !0, this._steady = !1, this._components = new wr(this), this._parent = null, this._children = [];
5414
+ this._sceneChanged = !1, this._name = e, this._enabled = !0, this._steady = !1, this._components = new dr(this), this._parent = null, this._children = [];
5421
5415
  }
5422
5416
  get name() {
5423
5417
  return this._name;
@@ -5486,7 +5480,7 @@ class Ae {
5486
5480
  this._sceneChanged = !0, this._parent && this._parent.setSceneChanged();
5487
5481
  }
5488
5482
  addChild(e) {
5489
- e._parent && e._parent.removeChild(e), e._parent = this, this._children.push(e), e.addedToNode(this), this._bindedRenderer && Ui(e, this._bindedRenderer), this.setSceneChanged();
5483
+ e._parent && e._parent.removeChild(e), e._parent = this, this._children.push(e), e.addedToNode(this), this._bindedRenderer && Fi(e, this._bindedRenderer), this.setSceneChanged();
5490
5484
  }
5491
5485
  removeChild(e) {
5492
5486
  if (e._parent === this) {
@@ -5597,36 +5591,36 @@ class Ae {
5597
5591
  });
5598
5592
  }
5599
5593
  }
5600
- const Xi = async (t, e) => {
5594
+ const Gi = async (t, e) => {
5601
5595
  t.children = t.children || [], t.components = t.components || [];
5602
5596
  const r = new Ae(t.name);
5603
5597
  r.enabled = t.enabled !== void 0 ? t.enabled : !0, r.steady = t.steady !== void 0 ? t.steady : !1;
5604
5598
  for (const i of t.components)
5605
5599
  try {
5606
- const n = await Gi(i, e);
5600
+ const n = await Oi(i, e);
5607
5601
  n && r.addComponent(n);
5608
5602
  } catch (n) {
5609
5603
  console.warn(`Deserialization of node with name "${r.name}": ${n.message}`);
5610
5604
  }
5611
5605
  for (const i of t.children) {
5612
- const n = await Xi(i, e);
5606
+ const n = await Gi(i, e);
5613
5607
  r.addChild(n);
5614
5608
  }
5615
5609
  return r;
5616
- }, vr = {
5610
+ }, wr = {
5617
5611
  BG2: "bg2"
5618
5612
  };
5619
- let Or = vr.BG2;
5620
- class ki extends pt {
5613
+ let Rr = wr.BG2;
5614
+ class Ui extends pt {
5621
5615
  static PreferredDrawableFormat() {
5622
- return Or;
5616
+ return Rr;
5623
5617
  }
5624
5618
  constructor({
5625
5619
  bg2ioPath: e,
5626
- preferedDrawableFormat: r = vr.BG2,
5620
+ preferedDrawableFormat: r = wr.BG2,
5627
5621
  materialImportCallback: i
5628
5622
  } = { bg2ioPath: null }) {
5629
- super(), this._bg2ioPath = e, Or = r, this._materialImportCallback = i;
5623
+ super(), this._bg2ioPath = e, Rr = r, this._materialImportCallback = i;
5630
5624
  }
5631
5625
  get supportedExtensions() {
5632
5626
  return ["vitscnj"];
@@ -5640,16 +5634,16 @@ class ki extends pt {
5640
5634
  if (r !== M.Node)
5641
5635
  throw new Error(`VitscnjLoaderPlugin.load() unexpected resource type received: ${r}`);
5642
5636
  const n = i.currentPath;
5643
- i.currentPath = gi(e);
5637
+ i.currentPath = li(e);
5644
5638
  const s = new qe(), o = new Ae("Scene Root"), { scene: a } = await s.load(e);
5645
5639
  for (const f of a) {
5646
- const c = await Xi(f, i);
5640
+ const c = await Gi(f, i);
5647
5641
  o.addChild(c);
5648
5642
  }
5649
5643
  return i.currentPath = n, o;
5650
5644
  }
5651
5645
  get dependencies() {
5652
- return [new Vi({
5646
+ return [new Yi({
5653
5647
  bg2ioPath: this._bg2ioPath,
5654
5648
  materialImportCallback: this._materialImportCallback
5655
5649
  })];
@@ -5711,7 +5705,7 @@ class Oe extends se {
5711
5705
  } catch (a) {
5712
5706
  return /not found/i.test(a.message) || console.error(a), null;
5713
5707
  }
5714
- }, s = ki.PreferredDrawableFormat() === vr.BG2 ? await i(e.name + ".bg2") || await i(e.name + ".vwglb") : await i(e.name + ".vwglb") || await i(e.name + ".bg2");
5708
+ }, s = Ui.PreferredDrawableFormat() === wr.BG2 ? await i(e.name + ".bg2") || await i(e.name + ".vwglb") : await i(e.name + ".vwglb") || await i(e.name + ".bg2");
5715
5709
  if (!s)
5716
5710
  throw new Error(`Drawable.deserialize(): could not load drawable with name ${e.name}`);
5717
5711
  s.items.forEach(({ polyList: o, material: a, transform: f }) => this.addPolyList(o, a, f)), this.name = s.name;
@@ -5903,29 +5897,29 @@ const vo = async (t) => {
5903
5897
  if (ht === null && (ht = await wo(t ? { wasmPath: t } : {}), !ht))
5904
5898
  throw new Error("Bg2LoaderPlugin: unable to initialize bg2io library");
5905
5899
  return ht;
5906
- }, Yi = (t, e) => t.polyLists.map((i) => {
5900
+ }, Xi = (t, e) => t.polyLists.map((i) => {
5907
5901
  const n = new de(), s = t.materials.find((o) => o.name === i.matName);
5908
5902
  return n.name = i.name, n.visible = i.visible, s && (n.groupName = s.groupName || "", n.enableCullFace = s.cullFace), n.vertex = i.vertex, n.normal = i.normal, n.texCoord0 = i.texCoord0, n.texCoord1 = i.texCoord1, n.texCoord2 = i.texCoord2, n.index = i.index, { plist: n, materialData: s };
5909
- }), ji = async (t, e, r) => {
5910
- const i = fr(Ar(e)), n = gi(e), s = new Oe(i);
5911
- for (const o of Yi(t)) {
5903
+ }), ki = async (t, e, r) => {
5904
+ const i = Ar(hr(e)), n = li(e), s = new Oe(i);
5905
+ for (const o of Xi(t)) {
5912
5906
  const a = new ne(r.canvas);
5913
5907
  await a.deserialize(o.materialData, n), s.addPolyList(o.plist, a);
5914
5908
  }
5915
5909
  return s;
5916
5910
  }, mo = async (t, e, r) => {
5917
- const i = fr(Ar(e)), n = await ji(t, e, r), s = new Ae(i);
5911
+ const i = Ar(hr(e)), n = await ki(t, e, r), s = new Ae(i);
5918
5912
  s.addComponent(n);
5919
5913
  for (const o of t.components)
5920
5914
  try {
5921
- const a = await Gi(o, r);
5915
+ const a = await Oi(o, r);
5922
5916
  a && s.addComponent(a);
5923
5917
  } catch (a) {
5924
5918
  console.warn(a.message);
5925
5919
  }
5926
5920
  return console.log(t), s;
5927
5921
  };
5928
- class Vi extends pt {
5922
+ class Yi extends pt {
5929
5923
  constructor({
5930
5924
  bg2ioPath: e = null,
5931
5925
  materialImportCallback: r
@@ -5948,9 +5942,9 @@ class Vi extends pt {
5948
5942
  a.type || (a.type = a.class, delete a.class);
5949
5943
  }), this._materialImportCallback && (o.materials = o.materials.map((a) => this._materialImportCallback(a))), r) {
5950
5944
  case M.PolyList:
5951
- return Yi(o).map((a) => a.plist);
5945
+ return Xi(o).map((a) => a.plist);
5952
5946
  case M.Drawable:
5953
- return ji(o, e, i);
5947
+ return ki(o, e, i);
5954
5948
  case M.Node:
5955
5949
  return await mo(o, e, i);
5956
5950
  default:
@@ -5958,17 +5952,17 @@ class Vi extends pt {
5958
5952
  }
5959
5953
  }
5960
5954
  }
5961
- const mr = {
5955
+ const vr = {
5962
5956
  Read: "read",
5963
5957
  Write: "write"
5964
- }, Pr = (t) => ({
5958
+ }, mr = (t) => ({
5965
5959
  operationType: t,
5966
5960
  plugins: {}
5967
5961
  }), wt = (t, e) => {
5968
5962
  t.resourceTypes.forEach((r) => {
5969
5963
  e.plugins[r] = e.plugins[r] || [], e.plugins[r].push(t);
5970
5964
  });
5971
- }, Br = function(t, e, r) {
5965
+ }, Pr = function(t, e, r) {
5972
5966
  const i = Es(t), n = new RegExp(i, "i"), s = `Could not find a plugin to ${r.operationType} file '${t}' of type '${e}'.`, o = r.plugins[e];
5973
5967
  if (o) {
5974
5968
  for (const a of o)
@@ -5977,9 +5971,9 @@ const mr = {
5977
5971
  throw new Error(s);
5978
5972
  } else
5979
5973
  throw new Error(s);
5980
- }, ir = Pr(mr.Read), Po = (t) => {
5974
+ }, ir = mr(vr.Read), Po = (t) => {
5981
5975
  t.dependencies.forEach((e) => wt(e, ir)), wt(t, ir);
5982
- }, nr = (t, e) => Br(t, e, ir), Fr = () => ({
5976
+ }, nr = (t, e) => Pr(t, e, ir), Or = () => ({
5983
5977
  [M.PolyList]: {},
5984
5978
  [M.Drawable]: {},
5985
5979
  [M.Node]: {},
@@ -5988,7 +5982,7 @@ const mr = {
5988
5982
  });
5989
5983
  class Bo {
5990
5984
  constructor(e) {
5991
- this._canvas = e || _e.FirstCanvas(), this._cache = Fr(), this._currentPath = "";
5985
+ this._canvas = e || _e.FirstCanvas(), this._cache = Or(), this._currentPath = "";
5992
5986
  }
5993
5987
  get canvas() {
5994
5988
  return this._canvas;
@@ -6000,13 +5994,13 @@ class Bo {
6000
5994
  this._currentPath = e;
6001
5995
  }
6002
5996
  clearCache() {
6003
- this._cache = Fr();
5997
+ this._cache = Or();
6004
5998
  }
6005
5999
  findCache(e, r) {
6006
6000
  return this._cache[r] && this._cache[r][e];
6007
6001
  }
6008
6002
  async loadResource(e, r) {
6009
- !xs(e) && this.currentPath !== "" && (e = ui(this.currentPath, e));
6003
+ !xs(e) && this.currentPath !== "" && (e = ci(this.currentPath, e));
6010
6004
  let i = this.findCache(e, r);
6011
6005
  return i || (i = await nr(e, r).load(e, r, this)), i;
6012
6006
  }
@@ -6037,7 +6031,7 @@ class Co {
6037
6031
  }
6038
6032
  }
6039
6033
  const po = (t, e, r) => {
6040
- const i = fr(Ar(r)), n = new Oe(i);
6034
+ const i = Ar(hr(r)), n = new Oe(i);
6041
6035
  return t.forEach((s) => {
6042
6036
  const o = new ne();
6043
6037
  n.addPolyList(s, o);
@@ -6068,7 +6062,7 @@ class Do extends pt {
6068
6062
  }
6069
6063
  }
6070
6064
  }
6071
- class Ki {
6065
+ class ji {
6072
6066
  // Returns an array of valid file extensions for this plugin
6073
6067
  // example: ['obj','dae']
6074
6068
  get supportedExtensions() {
@@ -6085,7 +6079,7 @@ class Ki {
6085
6079
  throw new Error("WriterPlugin.write(): method not implemented");
6086
6080
  }
6087
6081
  }
6088
- class bo extends Ki {
6082
+ class bo extends ji {
6089
6083
  get supportedExtensions() {
6090
6084
  return ["obj"];
6091
6085
  }
@@ -6096,14 +6090,14 @@ class bo extends Ki {
6096
6090
  console.log(e), console.log(r), console.log(i);
6097
6091
  }
6098
6092
  }
6099
- const Wi = Pr(mr.Write), Eo = (t) => {
6100
- wt(t, Wi);
6101
- }, Ji = (t, e) => Br(t, e, Wi);
6093
+ const Vi = mr(vr.Write), Eo = (t) => {
6094
+ wt(t, Vi);
6095
+ }, Ki = (t, e) => Pr(t, e, Vi);
6102
6096
  class xo {
6103
6097
  constructor() {
6104
6098
  }
6105
6099
  async writeResource(e, r, i) {
6106
- return await Ji(e, i).write(e, r, i, this);
6100
+ return await Ki(e, i).write(e, r, i, this);
6107
6101
  }
6108
6102
  async writePolyList(e, r) {
6109
6103
  return await this.writeResource(e, r, M.PolyList);
@@ -6122,11 +6116,11 @@ class xo {
6122
6116
  }
6123
6117
  }
6124
6118
  const Qo = {
6125
- Bg2LoaderPlugin: Vi,
6126
- PluginOperationType: mr,
6127
- createPluginDatabase: Pr,
6119
+ Bg2LoaderPlugin: Yi,
6120
+ PluginOperationType: vr,
6121
+ createPluginDatabase: mr,
6128
6122
  registerPluginInDatabase: wt,
6129
- getPluginFromDatabase: Br,
6123
+ getPluginFromDatabase: Pr,
6130
6124
  Loader: Bo,
6131
6125
  registerLoaderPlugin: Po,
6132
6126
  getLoaderPlugin: nr,
@@ -6135,13 +6129,13 @@ const Qo = {
6135
6129
  ObjLoaderPlugin: Do,
6136
6130
  ObjParser: Re,
6137
6131
  ObjWriterPlugin: bo,
6138
- VitscnjLoaderPlugin: ki,
6132
+ VitscnjLoaderPlugin: Ui,
6139
6133
  Writer: xo,
6140
6134
  registerWriterPlugin: Eo,
6141
- getWriterPlugin: Ji,
6142
- WriterPlugin: Ki
6135
+ getWriterPlugin: Ki,
6136
+ WriterPlugin: ji
6143
6137
  };
6144
- class Cr {
6138
+ class Br {
6145
6139
  constructor() {
6146
6140
  this._equirectangularTexture = null, this._irradianceIntensity = 1, this._showSkybox = !0, this._cubemapSize = 512, this._irradianceMapSize = 32, this._specularMapSize = 32, this._specularMapL2Size = 32, this._dirty = !0;
6147
6141
  }
@@ -6217,7 +6211,7 @@ class Cr {
6217
6211
  * Creates a deep copy of this environment
6218
6212
  */
6219
6213
  clone() {
6220
- const e = new Cr();
6214
+ const e = new Br();
6221
6215
  return e.assign(this), e;
6222
6216
  }
6223
6217
  /**
@@ -6379,15 +6373,15 @@ class xt {
6379
6373
  }
6380
6374
  const To = {
6381
6375
  Color: p,
6382
- Environment: Cr,
6376
+ Environment: Br,
6383
6377
  Light: xt,
6384
6378
  LightType: be,
6385
6379
  Material: ne,
6386
6380
  PolyList: de,
6387
- BufferType: mi,
6381
+ BufferType: wi,
6388
6382
  DrawMode: ae,
6389
6383
  RenderLayer: k,
6390
- getLayers: Pi,
6384
+ getLayers: vi,
6391
6385
  PolyListFrontFace: ut,
6392
6386
  PolyListCullFace: De,
6393
6387
  Texture: x,
@@ -6399,17 +6393,17 @@ const To = {
6399
6393
  TextureRenderTargetAttachment: Y,
6400
6394
  TextureComponentFormat: ie,
6401
6395
  TextureChannel: y,
6402
- TextureDataTypeName: Di,
6403
- TextureWrapName: bi,
6404
- TextureFilterName: Ei,
6396
+ TextureDataTypeName: Ci,
6397
+ TextureWrapName: pi,
6398
+ TextureFilterName: Di,
6405
6399
  TextureTargetName: Be,
6406
- ProceduralTextureFunctionName: xi,
6400
+ ProceduralTextureFunctionName: bi,
6407
6401
  TextureRenderTargetAttachmentNames: je,
6408
- TextureComponentFormatNames: Qi,
6409
- TextureChannelNames: Ti,
6410
- textureWrapString: yi,
6402
+ TextureComponentFormatNames: Ei,
6403
+ TextureChannelNames: xi,
6404
+ textureWrapString: Qi,
6411
6405
  textureDataTypeString: Ss,
6412
- textureFilterString: Mi,
6406
+ textureFilterString: Ti,
6413
6407
  textureTargetString: Rs,
6414
6408
  proceduralTextureFunctionString: Os,
6415
6409
  textureRenderTargetAttachmentString: Fs,
@@ -6498,7 +6492,7 @@ class Qt extends se {
6498
6492
  await super.serialize(e, r);
6499
6493
  }
6500
6494
  }
6501
- class Zi {
6495
+ class Wi {
6502
6496
  static Factory(e) {
6503
6497
  if (!e || !e.type)
6504
6498
  return null;
@@ -6525,7 +6519,7 @@ const ze = {
6525
6519
  TRANSLATE_ROTATE: 1,
6526
6520
  ROTATE_TRANSLATE: 0
6527
6521
  };
6528
- class Je extends Zi {
6522
+ class Je extends Wi {
6529
6523
  constructor() {
6530
6524
  super(), this._offset = new h(0, 0, 0), this._eulerRotation = new h(0, 0, 0), this._transformOrder = ze.TRANSLATE_ROTATE;
6531
6525
  }
@@ -6603,7 +6597,7 @@ class Je extends Zi {
6603
6597
  e.type = "LinkJoint", e.offset = Array.from(this._offset), e.yaw = this.yaw, e.pitch = this.pitch, e.roll = this.roll, e.order = this.transformOrder;
6604
6598
  }
6605
6599
  }
6606
- class qi extends se {
6600
+ class Ji extends se {
6607
6601
  constructor(e) {
6608
6602
  super(e), this._joint = new Je();
6609
6603
  }
@@ -6617,14 +6611,14 @@ class qi extends se {
6617
6611
  this.joint.assign(e.joint);
6618
6612
  }
6619
6613
  async deserialize(e, r) {
6620
- const i = Zi.Factory(e.joint);
6614
+ const i = Wi.Factory(e.joint);
6621
6615
  i && i instanceof Je && (this.joint = i);
6622
6616
  }
6623
6617
  async serialize(e, r) {
6624
6618
  await super.serialize(e, r), e.joint = {}, this.joint.serialize(e.joint);
6625
6619
  }
6626
6620
  }
6627
- class Tt extends qi {
6621
+ class Tt extends Ji {
6628
6622
  constructor() {
6629
6623
  super("InputChainJoint"), this.joint.transformOrder = ze.ROTATE_TRANSLATE;
6630
6624
  }
@@ -6633,7 +6627,7 @@ class Tt extends qi {
6633
6627
  return e.assign(this), e;
6634
6628
  }
6635
6629
  }
6636
- class yt extends qi {
6630
+ class yt extends Ji {
6637
6631
  constructor() {
6638
6632
  super("OutputChainJoint"), this.joint.transformOrder = ze.TRANSLATE_ROTATE;
6639
6633
  }
@@ -6642,7 +6636,7 @@ class yt extends qi {
6642
6636
  return e.assign(this), e;
6643
6637
  }
6644
6638
  }
6645
- class pr extends le {
6639
+ class Cr extends le {
6646
6640
  constructor() {
6647
6641
  super(), this._name = void 0, this._result = [], this._hasComponents = [];
6648
6642
  }
@@ -6670,7 +6664,7 @@ class ge extends se {
6670
6664
  static GetLights(e) {
6671
6665
  if (e.sceneChanged || !e.__lights) {
6672
6666
  e.__lights = [];
6673
- let r = new pr();
6667
+ let r = new Cr();
6674
6668
  r.hasComponents(["Light"]), e.accept(r), e.__lights = r.result.map((i) => i.lightComponent);
6675
6669
  }
6676
6670
  return e.__lights;
@@ -6737,7 +6731,7 @@ class ge extends se {
6737
6731
  e.addLight(this.light, r);
6738
6732
  }
6739
6733
  }
6740
- class $e extends ni {
6734
+ class $e extends ii {
6741
6735
  static Factory(e) {
6742
6736
  if (!e)
6743
6737
  return null;
@@ -6844,7 +6838,7 @@ class Nt extends $e {
6844
6838
  }
6845
6839
  apply() {
6846
6840
  if (this.target) {
6847
- const e = ri(this.fov);
6841
+ const e = ti(this.fov);
6848
6842
  this.target.perspective(e, this.viewport.aspectRatio, this.near, this.far);
6849
6843
  }
6850
6844
  }
@@ -7003,7 +6997,7 @@ class Ht {
7003
6997
  }
7004
6998
  }
7005
6999
  var re = /* @__PURE__ */ ((t) => (t.BACKSPACE = "Backspace", t.TAB = "Tab", t.ENTER = "Enter", t.SHIFT = "Shift", t.SHIFT_LEFT = "ShiftLeft", t.SHIFT_RIGHT = "ShiftRight", t.CTRL = "Control", t.CTRL_LEFT = "ControlLeft", t.CTRL_RIGHT = "ControlRight", t.ALT = "Alt", t.ALT_LEFT = "AltLeft", t.ALT_RIGHT = "AltRight", t.PAUSE = "Pause", t.CAPS_LOCK = "CapsLock", t.ESCAPE = "Escape", t.PAGE_UP = "PageUp", t.PAGEDOWN = "PageDown", t.END = "End", t.HOME = "Home", t.LEFT_ARROW = "ArrowLeft", t.UP_ARROW = "ArrowUp", t.RIGHT_ARROW = "ArrowRight", t.DOWN_ARROW = "ArrowDown", t.INSERT = "Insert", t.DELETE = "Delete", t.SPACE = "Space", t))(re || {});
7006
- const _i = (t) => {
7000
+ const Zi = (t) => {
7007
7001
  const e = re[t.code] != null ? t.keyCode : t.code;
7008
7002
  return new zt(e, t);
7009
7003
  };
@@ -7020,14 +7014,14 @@ class zt extends Ht {
7020
7014
  }
7021
7015
  var Fe = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.UP = 1] = "UP", t[t.DOWN = 2] = "DOWN", t))(Fe || {});
7022
7016
  const et = (t, e, r) => {
7023
- if (e.mouseStatus.pos = Ci(t, e.canvas), r !== 0) {
7017
+ if (e.mouseStatus.pos = Pi(t, e.canvas), r !== 0) {
7024
7018
  const i = r === 2;
7025
7019
  t.button === 0 ? e.mouseStatus.leftButton = i : t.button === 1 ? e.mouseStatus.middleButton = i : t.button === 2 && (e.mouseStatus.rightButton = i);
7026
7020
  }
7027
- return new en(t.button, e.mouseStatus.pos.x, e.mouseStatus.pos.y, 0, t);
7021
+ return new _i(t.button, e.mouseStatus.pos.x, e.mouseStatus.pos.y, 0, t);
7028
7022
  }, ue = [!1, !1, !1], Ho = () => ue[0], zo = () => ue[1], Lo = () => ue[2], Io = () => {
7029
7023
  ue[0] = !1, ue[1] = !1, ue[2] = !1;
7030
- }, $i = (t, e) => {
7024
+ }, qi = (t, e) => {
7031
7025
  switch (t.button) {
7032
7026
  case 0:
7033
7027
  ue[0] = e;
@@ -7040,7 +7034,7 @@ const et = (t, e, r) => {
7040
7034
  break;
7041
7035
  }
7042
7036
  };
7043
- class en extends Ht {
7037
+ class _i extends Ht {
7044
7038
  constructor(e = -1, r = -1, i = -1, n = 0, s = null) {
7045
7039
  super(), this.button = e, this.x = r, this.y = i, this.delta = n, this.event = s;
7046
7040
  }
@@ -7366,7 +7360,7 @@ class It extends se {
7366
7360
  this.equirectangularTexture = e.equirectangularTexture, this.irradianceIntensity = e.irradianceIntensity, this.showSkybox = e.showSkybox, this.cubemapSize = e.cubemapSize, this.irradianceMapSize = e.irradianceMapSize, this.specularMapSize = e.specularMapSize, this.specularMapL2Size = e.specularMapL2Size;
7367
7361
  }
7368
7362
  async deserialize(e, r) {
7369
- super.deserialize(e, r), r.currentPath && e.equirectangularTexture && (this.equirectangularTexture = ui(r.currentPath, e.equirectangularTexture)), this.irradianceIntensity = e.irradianceIntensity || this.irradianceIntensity, this.showSkybox = e.showSkybox ?? this.showSkybox, this.cubemapSize = e.cubemapSize || this.cubemapSize, this.irradianceMapSize = e.irradianceMapSize || this.irradianceMapSize, this.specularMapSize = e.specularMapSize || this.specularMapSize, this.specularMapL2Size = e.specularMapL2Size || this.specularMapL2Size;
7363
+ super.deserialize(e, r), r.currentPath && e.equirectangularTexture && (this.equirectangularTexture = ci(r.currentPath, e.equirectangularTexture)), this.irradianceIntensity = e.irradianceIntensity || this.irradianceIntensity, this.showSkybox = e.showSkybox ?? this.showSkybox, this.cubemapSize = e.cubemapSize || this.cubemapSize, this.irradianceMapSize = e.irradianceMapSize || this.irradianceMapSize, this.specularMapSize = e.specularMapSize || this.specularMapSize, this.specularMapL2Size = e.specularMapL2Size || this.specularMapL2Size;
7370
7364
  }
7371
7365
  async serialize(e, r) {
7372
7366
  throw await super.serialize(e, r), Error("EnvironmentComponent.serialize(): not implemented");
@@ -7383,7 +7377,7 @@ class It extends se {
7383
7377
  });
7384
7378
  }
7385
7379
  }
7386
- const tn = () => {
7380
+ const $i = () => {
7387
7381
  ee("Drawable", Oe), ee("Transform", oe), ee("Light", ge), ee("Chain", Qt), ee("InputChainJoint", Tt), ee("OutputChainJoint", yt), ee("Camera", j), ee("OrbitCameraController", tt), ee("SmoothOrbitCameraController", Lt), ee("Environment", It);
7388
7382
  }, Ro = {
7389
7383
  Component: se,
@@ -7400,13 +7394,13 @@ const tn = () => {
7400
7394
  OrbitCameraControllerComponent: tt,
7401
7395
  SmoothOrbitCameraControllerComponent: Lt,
7402
7396
  EnvironmentComponent: It,
7403
- registerComponents: tn,
7397
+ registerComponents: $i,
7404
7398
  registerComponent: ee,
7405
7399
  Node: Ae,
7406
7400
  NodeVisitor: le,
7407
- FindNodeVisitor: pr
7401
+ FindNodeVisitor: Cr
7408
7402
  };
7409
- class rn {
7403
+ class en {
7410
7404
  constructor() {
7411
7405
  this._mainLoop = null;
7412
7406
  }
@@ -7458,22 +7452,22 @@ class rn {
7458
7452
  touchEnd(e) {
7459
7453
  }
7460
7454
  }
7461
- const Dr = (t, e) => {
7462
- const r = pi(t, e.canvas);
7463
- return new nn(r, t);
7455
+ const pr = (t, e) => {
7456
+ const r = Bi(t, e.canvas);
7457
+ return new tn(r, t);
7464
7458
  };
7465
- class nn extends Ht {
7459
+ class tn extends Ht {
7466
7460
  constructor(e, r) {
7467
7461
  super(), this.touches = e, this.event = r;
7468
7462
  }
7469
7463
  }
7470
- var sn = /* @__PURE__ */ ((t) => (t[t.AUTO = 0] = "AUTO", t[t.MANUAL = 1] = "MANUAL", t))(sn || {});
7464
+ var rn = /* @__PURE__ */ ((t) => (t[t.AUTO = 0] = "AUTO", t[t.MANUAL = 1] = "MANUAL", t))(rn || {});
7471
7465
  const me = {
7472
7466
  lastTime: 0,
7473
7467
  mainLoop: []
7474
7468
  };
7475
- async function on(t) {
7476
- t = t || 0, requestAnimationFrame(on);
7469
+ async function nn(t) {
7470
+ t = t || 0, requestAnimationFrame(nn);
7477
7471
  const e = t - me.lastTime;
7478
7472
  me.lastTime = t;
7479
7473
  for (const r of me.mainLoop)
@@ -7513,7 +7507,7 @@ class Fo {
7513
7507
  return this._redisplayFrames > 0;
7514
7508
  }
7515
7509
  async run() {
7516
- await this.canvas.init(), await this.appController.init(), Go(this), me.mainLoop.push(this), on();
7510
+ await this.canvas.init(), await this.appController.init(), Go(this), me.mainLoop.push(this), nn();
7517
7511
  }
7518
7512
  exit() {
7519
7513
  this.appController.destroy();
@@ -7530,7 +7524,7 @@ class Fo {
7530
7524
  function Go(t) {
7531
7525
  sr(t);
7532
7526
  const e = (n, s) => n.isEventPropagationStopped ? (s.stopPropagation(), s.preventDefault(), !1) : !0, r = t.canvas.domElement;
7533
- r.__mainLoop = t, r.addEventListener("mousedown", (n) => e(Xo(n, n.target.__mainLoop), n)), r.addEventListener("mousemove", (n) => e(an(n, n.target.__mainLoop), n)), r.addEventListener("mouseout", (n) => e(ko(n, n.target.__mainLoop), n)), r.addEventListener("mouseover", (n) => e(Yo(n, n.target.__mainLoop), n)), r.addEventListener("mouseup", (n) => e(jo(n, n.target.__mainLoop), n)), r.addEventListener("touchstart", (n) => e(Ko(n, n.target.__mainLoop), n)), r.addEventListener("touchmove", (n) => e(Wo(n, n.target.__mainLoop), n)), r.addEventListener("touchend", (n) => e(Jo(n, n.target.__mainLoop), n));
7527
+ r.__mainLoop = t, r.addEventListener("mousedown", (n) => e(Xo(n, n.target.__mainLoop), n)), r.addEventListener("mousemove", (n) => e(sn(n, n.target.__mainLoop), n)), r.addEventListener("mouseout", (n) => e(ko(n, n.target.__mainLoop), n)), r.addEventListener("mouseover", (n) => e(Yo(n, n.target.__mainLoop), n)), r.addEventListener("mouseup", (n) => e(jo(n, n.target.__mainLoop), n)), r.addEventListener("touchstart", (n) => e(Ko(n, n.target.__mainLoop), n)), r.addEventListener("touchmove", (n) => e(Wo(n, n.target.__mainLoop), n)), r.addEventListener("touchend", (n) => e(Jo(n, n.target.__mainLoop), n));
7534
7528
  const i = /Firefox/i.test(navigator.userAgent) ? "DOMMouseScroll" : "mousewheel";
7535
7529
  r.addEventListener(i, (n) => e(Vo(n, n.target.__mainLoop), n)), window.addEventListener("keydown", (n) => {
7536
7530
  me.mainLoop.forEach((s) => Zo(n, s));
@@ -7549,9 +7543,9 @@ async function Uo(t, e) {
7549
7543
  }
7550
7544
  function Xo(t, e) {
7551
7545
  const r = et(t, e, Fe.DOWN);
7552
- return $i(r, !0), e.appController.mouseDown(r), r;
7546
+ return qi(r, !0), e.appController.mouseDown(r), r;
7553
7547
  }
7554
- function an(t, e) {
7548
+ function sn(t, e) {
7555
7549
  const r = et(t, e, Fe.NONE);
7556
7550
  return e.appController.mouseMove(r), e.mouseStatus.anyButton && e.appController.mouseDrag(r), r;
7557
7551
  }
@@ -7560,49 +7554,49 @@ function ko(t, e) {
7560
7554
  return Io(), e.appController.mouseOut(r), r;
7561
7555
  }
7562
7556
  function Yo(t, e) {
7563
- return an(t, e);
7557
+ return sn(t, e);
7564
7558
  }
7565
7559
  function jo(t, e) {
7566
7560
  const r = et(t, e, Fe.UP);
7567
- return $i(r, !1), e.appController.mouseUp(r), r;
7561
+ return qi(r, !1), e.appController.mouseUp(r), r;
7568
7562
  }
7569
7563
  function Vo(t, e) {
7570
7564
  const r = et(t, e, Fe.NONE);
7571
7565
  return r.delta = t.wheelDelta ? t.wheelDelta * -1 : t.detail * 10, e.appController.mouseWheel(r), r;
7572
7566
  }
7573
7567
  function Ko(t, e) {
7574
- const r = Dr(t, e);
7568
+ const r = pr(t, e);
7575
7569
  return e.appController.touchStart(r), r;
7576
7570
  }
7577
7571
  function Wo(t, e) {
7578
- const r = Dr(t, e);
7572
+ const r = pr(t, e);
7579
7573
  return e.appController.touchMove(r), r;
7580
7574
  }
7581
7575
  function Jo(t, e) {
7582
- const r = Dr(t, e);
7576
+ const r = pr(t, e);
7583
7577
  return e.appController.touchEnd(r), r;
7584
7578
  }
7585
7579
  function Zo(t, e) {
7586
- const r = _i(t);
7580
+ const r = Zi(t);
7587
7581
  return e.appController.keyDown(r), r;
7588
7582
  }
7589
7583
  function qo(t, e) {
7590
- const r = _i(t);
7584
+ const r = Zi(t);
7591
7585
  return e.appController.keyUp(r), r;
7592
7586
  }
7593
7587
  const _o = {
7594
- AppController: rn,
7595
- FrameUpdate: sn,
7588
+ AppController: en,
7589
+ FrameUpdate: rn,
7596
7590
  Canvas: _e,
7597
- getMouseEventOffset: Ci,
7598
- getEventTouches: pi,
7591
+ getMouseEventOffset: Pi,
7592
+ getEventTouches: Bi,
7599
7593
  EventBase: Ht,
7600
7594
  Bg2KeyboardEvent: zt,
7601
7595
  MainLoop: Fo,
7602
- Bg2MouseEvent: en,
7603
- Bg2TouchEvent: nn
7596
+ Bg2MouseEvent: _i,
7597
+ Bg2TouchEvent: tn
7604
7598
  };
7605
- class hn {
7599
+ class on {
7606
7600
  constructor(e) {
7607
7601
  this._renderer = e;
7608
7602
  }
@@ -7622,7 +7616,7 @@ class hn {
7622
7616
  throw new Error("FrameBuffer: calling base implementation of clear()");
7623
7617
  }
7624
7618
  }
7625
- class An {
7619
+ class an {
7626
7620
  constructor(e, r) {
7627
7621
  this._renderer = e, this._material = r;
7628
7622
  }
@@ -7638,7 +7632,7 @@ class An {
7638
7632
  }
7639
7633
  }
7640
7634
  var Ke = /* @__PURE__ */ ((t) => (t[t.ADD = 1] = "ADD", t[t.SUBTRACT = 2] = "SUBTRACT", t[t.REVERSE_SUBTRACT = 3] = "REVERSE_SUBTRACT", t))(Ke || {}), R = /* @__PURE__ */ ((t) => (t[t.NULL = 0] = "NULL", t[t.ZERO = 1] = "ZERO", t[t.ONE = 2] = "ONE", t[t.SRC_COLOR = 3] = "SRC_COLOR", t[t.ONE_MINUS_SRC_COLOR = 4] = "ONE_MINUS_SRC_COLOR", t[t.DST_COLOR = 5] = "DST_COLOR", t[t.ONE_MINUS_DST_COLOR = 6] = "ONE_MINUS_DST_COLOR", t[t.SRC_ALPHA = 7] = "SRC_ALPHA", t[t.ONE_MINUS_SRC_ALPHA = 8] = "ONE_MINUS_SRC_ALPHA", t[t.DST_ALPHA = 9] = "DST_ALPHA", t[t.ONE_MINUS_DST_ALPHA = 10] = "ONE_MINUS_DST_ALPHA", t))(R || {});
7641
- class fn {
7635
+ class hn {
7642
7636
  constructor(e) {
7643
7637
  this._blendState = {
7644
7638
  enabled: !1,
@@ -7693,7 +7687,7 @@ class fn {
7693
7687
  throw new Error("Pipeline.activate(): calling base class method.");
7694
7688
  }
7695
7689
  }
7696
- class ln {
7690
+ class An {
7697
7691
  constructor(e, r) {
7698
7692
  if (r.renderer)
7699
7693
  throw new Error("Invalid initialization of polyList renderer: the polyList is already controlled by another polyList renderer.");
@@ -7720,22 +7714,22 @@ class ln {
7720
7714
  }
7721
7715
  }
7722
7716
  var ve = /* @__PURE__ */ ((t) => (t[t.UNINITIALIZED = 0] = "UNINITIALIZED", t[t.TEXTURE = 1] = "TEXTURE", t[t.CUBE_MAP = 2] = "CUBE_MAP", t))(ve || {});
7723
- const cn = {
7717
+ const fn = {
7724
7718
  0: "UNINITIALIZED",
7725
7719
  1: "TEXTURE",
7726
7720
  2: "CUBE_MAP"
7727
7721
  };
7728
7722
  var vt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.POSITIVE_X = 1] = "POSITIVE_X", t[t.NEGATIVE_X = 2] = "NEGATIVE_X", t[t.POSITIVE_Y = 3] = "POSITIVE_Y", t[t.NEGATIVE_Y = 4] = "NEGATIVE_Y", t[t.POSITIVE_Z = 5] = "POSITIVE_Z", t[t.NEGATIVE_Z = 6] = "NEGATIVE_Z", t))(vt || {});
7729
- function Gr(t) {
7723
+ function Fr(t) {
7730
7724
  if (t.target === $.TEXTURE_2D)
7731
7725
  return 1;
7732
7726
  if (t.target === $.CUBE_MAP)
7733
7727
  return 2;
7734
7728
  }
7735
- function Ur(t) {
7736
- return cn[t];
7729
+ function Gr(t) {
7730
+ return fn[t];
7737
7731
  }
7738
- class gn {
7732
+ class ln {
7739
7733
  constructor(e, r = new h([512, 512])) {
7740
7734
  this._renderer = e, this._attachments = {}, this._size = r, this._dirty = !0, this._type = 0;
7741
7735
  }
@@ -7776,14 +7770,14 @@ class gn {
7776
7770
  if (this._attachments[e.renderTargetAttachment])
7777
7771
  throw new Error(`RenderBuffer.attachTexture(): The attachment is occupied by another texture ${je[e.renderTargetAttachment]}`);
7778
7772
  if (this.type !== 0) {
7779
- const i = Gr(e);
7773
+ const i = Fr(e);
7780
7774
  if (this.type !== i)
7781
- throw new Error(`Invalid texture attachment. RenderBuffer is ${Ur(this.type)}, but the new attachment is ${Ur(
7775
+ throw new Error(`Invalid texture attachment. RenderBuffer is ${Gr(this.type)}, but the new attachment is ${Gr(
7782
7776
  i || 0
7783
7777
  /* UNINITIALIZED */
7784
7778
  )}`);
7785
7779
  } else
7786
- this._type = Gr(e) || 0;
7780
+ this._type = Fr(e) || 0;
7787
7781
  e.dataType = Qe.RENDER_TARGET, e.size = this.size, await e.loadImageData();
7788
7782
  const r = this.renderer.factory.texture(e);
7789
7783
  this._attachments[e.renderTargetAttachment] = r;
@@ -7916,7 +7910,7 @@ class St {
7916
7910
  this._queues.forEach((e) => e.queue = []), this._lights = [];
7917
7911
  }
7918
7912
  addPolyList(e, r, i) {
7919
- const n = Pi(e.polyList, r.material);
7913
+ const n = vi(e.polyList, r.material);
7920
7914
  this._queues.forEach(({ layer: s, shader: o, queue: a, pipelines: f }) => {
7921
7915
  if (n & s) {
7922
7916
  const { polyList: c } = e;
@@ -7963,15 +7957,15 @@ class Rt extends le {
7963
7957
  this._modelMatrix = this._matrixStack[this._matrixStack.length - 1] || w.MakeIdentity(), this._matrixStack.pop();
7964
7958
  }
7965
7959
  }
7966
- class un extends le {
7960
+ class cn extends le {
7967
7961
  constructor(e) {
7968
7962
  super(), this._renderer = e;
7969
7963
  }
7970
7964
  visit(e) {
7971
- Ui(e, this._renderer);
7965
+ Fi(e, this._renderer);
7972
7966
  }
7973
7967
  }
7974
- class dn extends le {
7968
+ class gn extends le {
7975
7969
  constructor() {
7976
7970
  super();
7977
7971
  }
@@ -7993,7 +7987,7 @@ class _ extends le {
7993
7987
  e[this._callbackName](this._event);
7994
7988
  }
7995
7989
  }
7996
- class wn {
7990
+ class un {
7997
7991
  constructor(e) {
7998
7992
  this._shadowMapSize = null, this._mainDirectionalLight = null, this._opaquePipeline = null, this._transparentPipeline = null, this._renderQueue = null, this._initVisitor = null, this._frameVisitor = null, this._skyCube = null, this._shadowRenderer = null, this._environment = null, this._defaultViewMatrix = w.MakeIdentity(), this._defaultProjectionMatrix = w.MakeIdentity(), this._sceneRoot = null, this._renderer = e, this._keyDownVisitor = new _("keyDown"), this._keyUpVisitor = new _("keyUp"), this._mouseUpVisitor = new _("mouseUp"), this._mouseDownVisitor = new _("mouseDown"), this._mouseMoveVisitor = new _("mouseMove"), this._mouseOutVisitor = new _("mouseOut"), this._mouseDragVisitor = new _("mouseDrag"), this._mouseWheelVisitor = new _("mouseWheel"), this._touchStartVisitor = new _("touchStart"), this._touchMoveVisitor = new _("touchMove"), this._touchEndVisitor = new _("touchEnd"), this._sceneEnvironment = null;
7999
7993
  }
@@ -8021,7 +8015,7 @@ class wn {
8021
8015
  blendFuncDst: R.ONE_MINUS_SRC_ALPHA,
8022
8016
  blendFuncSrcAlpha: R.ONE,
8023
8017
  blendFuncDstAlpha: R.ONE_MINUS_SRC_ALPHA
8024
- }), this._transparentPipeline?.create(), this._renderQueue = new St(this.renderer), this._initVisitor = new dn(), this._frameVisitor = new Rt(this._renderQueue), this._skyCube = this.renderer.factory.skyCube(), this._shadowRenderer = this.renderer.factory.shadowRenderer(), await this._shadowRenderer?.create(this._shadowMapSize);
8018
+ }), this._transparentPipeline?.create(), this._renderQueue = new St(this.renderer), this._initVisitor = new gn(), this._frameVisitor = new Rt(this._renderQueue), this._skyCube = this.renderer.factory.skyCube(), this._shadowRenderer = this.renderer.factory.shadowRenderer(), await this._shadowRenderer?.create(this._shadowMapSize);
8025
8019
  }
8026
8020
  async setEnvironment(e) {
8027
8021
  this._environment = e, this._environment?.environmentMap && this._skyCube?.load(this._environment?.environmentMap);
@@ -8042,9 +8036,9 @@ class wn {
8042
8036
  this._defaultProjectionMatrix = e;
8043
8037
  }
8044
8038
  async bindRenderer(e) {
8045
- const r = new un(this.renderer);
8039
+ const r = new cn(this.renderer);
8046
8040
  e.accept(r), await e.asyncAccept(this._initVisitor);
8047
- const i = new pr();
8041
+ const i = new Cr();
8048
8042
  if (i.hasComponents("Environment"), e.accept(i), i.result.length) {
8049
8043
  const n = i.result[0].component("Environment");
8050
8044
  n && this.setEnvironment(n.environment), this._sceneEnvironment = n;
@@ -8112,7 +8106,7 @@ class wn {
8112
8106
  this._touchEndVisitor.event = r, e.accept(this._touchEndVisitor);
8113
8107
  }
8114
8108
  }
8115
- const Xr = {
8109
+ const Ur = {
8116
8110
  webgl: {
8117
8111
  vertex: `precision mediump float;
8118
8112
 
@@ -8140,14 +8134,14 @@ const Xr = {
8140
8134
  }`
8141
8135
  }
8142
8136
  };
8143
- class br extends V {
8137
+ class Dr extends V {
8144
8138
  constructor(e) {
8145
8139
  if (super(e), this._program = null, this._forceDraw = !1, e.typeId !== "WebGL")
8146
8140
  throw Error("PickSelectionShader is only compatible with WebGL renderer");
8147
8141
  }
8148
8142
  async load() {
8149
8143
  const { gl: e } = this.renderer;
8150
- this._program = new T(e, "PickSelectionShader"), this._program.attachVertexSource(Xr.webgl.vertex), this._program.attachFragmentSource(Xr.webgl.fragment), this._program.link(), this._forceDraw = !0;
8144
+ this._program = new T(e, "PickSelectionShader"), this._program.attachVertexSource(Ur.webgl.vertex), this._program.attachFragmentSource(Ur.webgl.fragment), this._program.link(), this._forceDraw = !0;
8151
8145
  }
8152
8146
  set forceDraw(e) {
8153
8147
  this._forceDraw = e;
@@ -8167,13 +8161,13 @@ class br extends V {
8167
8161
  this._program && (T.Delete(this._program), this._program = null);
8168
8162
  }
8169
8163
  }
8170
- const vn = (t, e = []) => {
8164
+ const dn = (t, e = []) => {
8171
8165
  t.dependencies.filter((r) => typeof r != "string").forEach((r) => {
8172
- vn(r, e), e.push(r);
8166
+ dn(r, e), e.push(r);
8173
8167
  }), e.push(t);
8174
8168
  }, $o = (t) => {
8175
8169
  const e = [];
8176
- vn(t, e);
8170
+ dn(t, e);
8177
8171
  const r = [];
8178
8172
  return e.filter((i) => {
8179
8173
  if (r.indexOf(i.name) === -1)
@@ -8313,11 +8307,11 @@ function s0(t) {
8313
8307
  ${n}
8314
8308
  }`);
8315
8309
  }
8316
- const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8310
+ const br = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8317
8311
  return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
8318
- }`), xr = new Q("vec3", "fresnelSchlickRoughness", "float cosTheta, vec3 F0, float roughness", `{
8312
+ }`), Er = new Q("vec3", "fresnelSchlickRoughness", "float cosTheta, vec3 F0, float roughness", `{
8319
8313
  return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
8320
- }`), Qr = new Q("float", "distributionGGX", "vec3 N, vec3 H, float roughness", `{
8314
+ }`), xr = new Q("float", "distributionGGX", "vec3 N, vec3 H, float roughness", `{
8321
8315
  float a = roughness * roughness;
8322
8316
  float a2 = a * a;
8323
8317
  float NdotH = max(dot(N, H), 0.0);
@@ -8328,7 +8322,7 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8328
8322
  denom = ${Math.PI} * denom * denom;
8329
8323
 
8330
8324
  return num / denom;
8331
- }`), mn = new Q("float", "geometrySchlickGGX", "float NdotV, float roughness", `{
8325
+ }`), wn = new Q("float", "geometrySchlickGGX", "float NdotV, float roughness", `{
8332
8326
  float r = (roughness + 1.0);
8333
8327
  float k = (r * r) / 8.0;
8334
8328
 
@@ -8336,14 +8330,14 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8336
8330
  float denom = NdotV * (1.0 - k) + k;
8337
8331
 
8338
8332
  return num / denom;
8339
- }`), Tr = new Q("float", "geometrySmith", "vec3 N, vec3 V, vec3 L, float roughness", `{
8333
+ }`), Qr = new Q("float", "geometrySmith", "vec3 N, vec3 V, vec3 L, float roughness", `{
8340
8334
  float NdotV = max(dot(N,V), 0.0);
8341
8335
  float NdotL = max(dot(N,L), 0.0);
8342
8336
  float ggx2 = geometrySchlickGGX(NdotV, roughness);
8343
8337
  float ggx1 = geometrySchlickGGX(NdotL, roughness);
8344
8338
 
8345
8339
  return ggx1 * ggx2;
8346
- }`, [mn]), Pn = new Q(
8340
+ }`, [wn]), vn = new Q(
8347
8341
  "vec3",
8348
8342
  "pbrPointLight",
8349
8343
  "vec3 lightPos, vec3 lightColor, vec3 fragPos, vec3 fragNorm, vec3 viewPos, vec3 albedo, float roughness, float metallic, vec3 fresnel",
@@ -8375,8 +8369,8 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8375
8369
  float NdotL = max(dot(fragNorm,L), 0.0);
8376
8370
  return (kD * albedo / ${Math.PI} + specular) * radiance * NdotL;
8377
8371
  }`,
8378
- [Er, Qr, Tr]
8379
- ), Bn = new Q(
8372
+ [br, xr, Qr]
8373
+ ), mn = new Q(
8380
8374
  "vec3",
8381
8375
  "pbrDirectionalLight",
8382
8376
  "vec3 lightDir, vec3 lightColor, vec3 fragPos, vec3 fragNorm, vec3 viewPos, vec3 albedo, float roughness, float metallic, vec3 fresnel, vec3 shadowColor",
@@ -8404,8 +8398,8 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8404
8398
  float NdotL = max(dot(fragNorm,L), 0.0);
8405
8399
  return (kD * albedo / ${Math.PI} + specular * fresnel * shadowColor) * lightColor * shadowColor * NdotL;
8406
8400
  }`,
8407
- [Er, Qr, Tr, xr]
8408
- ), Cn = new Q(
8401
+ [br, xr, Qr, Er]
8402
+ ), Pn = new Q(
8409
8403
  "vec3",
8410
8404
  "getPrefilteredColor",
8411
8405
  "float roughness, vec3 refVec, samplerCube irrMap, samplerCube specMap, samplerCube envMap",
@@ -8442,8 +8436,8 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8442
8436
 
8443
8437
  return kD * diffuse + indirectSpecular;
8444
8438
  }`,
8445
- [xr, Cn]
8446
- ), pn = new Q(
8439
+ [Er, Pn]
8440
+ ), Bn = new Q(
8447
8441
  "vec4",
8448
8442
  "applyConvolution",
8449
8443
  "sampler2D texture, vec2 texCoord, vec2 texSize, float[9] convMatrix, float radius",
@@ -8525,20 +8519,20 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8525
8519
  }`, []), l0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8526
8520
  __proto__: null,
8527
8521
  SRGB2Lineal: A0,
8528
- applyConvolution: pn,
8522
+ applyConvolution: Bn,
8529
8523
  brightnessContrast: f0,
8530
- distributionGGX: Qr,
8531
- fresnelSchlick: Er,
8532
- fresnelSchlickRoughness: xr,
8533
- geometrySchlickGGX: mn,
8534
- geometrySmith: Tr,
8535
- getPrefilteredColor: Cn,
8524
+ distributionGGX: xr,
8525
+ fresnelSchlick: br,
8526
+ fresnelSchlickRoughness: Er,
8527
+ geometrySchlickGGX: wn,
8528
+ geometrySmith: Qr,
8529
+ getPrefilteredColor: Pn,
8536
8530
  getShadowColor: a0,
8537
8531
  lineal2SRGB: h0,
8538
8532
  pbrAmbientLight: o0,
8539
- pbrDirectionalLight: Bn,
8540
- pbrPointLight: Pn
8541
- }, Symbol.toStringTag, { value: "Module" })), kr = {
8533
+ pbrDirectionalLight: mn,
8534
+ pbrPointLight: vn
8535
+ }, Symbol.toStringTag, { value: "Module" })), Xr = {
8542
8536
  webgl: {
8543
8537
  vertex: `precision mediump float;
8544
8538
 
@@ -8570,19 +8564,19 @@ const Er = new Q("vec3", "fresnelSchlick", "float cosTheta, vec3 F0", `{
8570
8564
  else {
8571
8565
  discard;
8572
8566
  }
8573
- }`, [pn])
8567
+ }`, [Bn])
8574
8568
  ]
8575
8569
  )
8576
8570
  }
8577
8571
  };
8578
- class Dn extends V {
8572
+ class Cn extends V {
8579
8573
  constructor(e) {
8580
8574
  if (super(e), this._program = null, e.typeId !== "WebGL")
8581
8575
  throw Error("SelectionHighlightShader is only compatible with WebGL renderer");
8582
8576
  }
8583
8577
  async load() {
8584
8578
  const { gl: e } = this.renderer;
8585
- this._program = new T(e, "SelectionHighlightShader"), this._program.attachVertexSource(kr.webgl.vertex), this._program.attachFragmentSource(kr.webgl.fragment), this._program.link(), this._borderWidth = 3, this._borderColor = new h([0, 0.7, 1, 1]), this._convMatrix = [
8579
+ this._program = new T(e, "SelectionHighlightShader"), this._program.attachVertexSource(Xr.webgl.vertex), this._program.attachFragmentSource(Xr.webgl.fragment), this._program.link(), this._borderWidth = 3, this._borderColor = new h([0, 0.7, 1, 1]), this._convMatrix = [
8586
8580
  0,
8587
8581
  1,
8588
8582
  0,
@@ -8617,7 +8611,7 @@ class c0 {
8617
8611
  }
8618
8612
  async init() {
8619
8613
  const e = this._renderer;
8620
- this._targetTexture = new x(), this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture), this._shader = new br(e), await this._shader.load(), this._shader.forceDraw = !1, this._renderQueue = new St(e), this._renderQueue.enableQueue(k.SELECTION_DEFAULT, this._shader), this._frameVisitor = new Rt(this._renderQueue), this._selectionDrawShader = new Dn(e), await this._selectionDrawShader.load();
8614
+ this._targetTexture = new x(), this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture), this._shader = new Dr(e), await this._shader.load(), this._shader.forceDraw = !1, this._renderQueue = new St(e), this._renderQueue.enableQueue(k.SELECTION_DEFAULT, this._shader), this._frameVisitor = new Rt(this._renderQueue), this._selectionDrawShader = new Cn(e), await this._selectionDrawShader.load();
8621
8615
  }
8622
8616
  setViewportSize(e, r) {
8623
8617
  this._renderBuffer.size = new h(e, r);
@@ -8642,7 +8636,7 @@ class g0 {
8642
8636
  }
8643
8637
  async init() {
8644
8638
  const e = this._renderer;
8645
- this._targetTexture = new x(), this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture), this._shader = new br(e), await this._shader.load(), this._renderQueue = new St(e), this._renderQueue.enableQueue(k.SELECTION_DEFAULT, this._shader), this._frameVisitor = new Rt(this._renderQueue);
8639
+ this._targetTexture = new x(), this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture), this._shader = new Dr(e), await this._shader.load(), this._renderQueue = new St(e), this._renderQueue.enableQueue(k.SELECTION_DEFAULT, this._shader), this._frameVisitor = new Rt(this._renderQueue);
8646
8640
  }
8647
8641
  reshape(e, r) {
8648
8642
  this._renderBuffer && (this._renderBuffer.size = new h(e, r));
@@ -8786,7 +8780,7 @@ class d0 {
8786
8780
  this._selectionBuffer?.destroy();
8787
8781
  }
8788
8782
  }
8789
- const Yr = {
8783
+ const kr = {
8790
8784
  webgl: {
8791
8785
  vertex: `precision mediump float;
8792
8786
 
@@ -8819,14 +8813,14 @@ const Yr = {
8819
8813
  )
8820
8814
  }
8821
8815
  };
8822
- class bn extends V {
8816
+ class pn extends V {
8823
8817
  constructor(e) {
8824
8818
  if (super(e), this._program = null, e.typeId !== "WebGL")
8825
8819
  throw Error("DebugRenderShader is only compatible with WebGL renderer");
8826
8820
  }
8827
8821
  async load() {
8828
8822
  const { gl: e } = this.renderer;
8829
- this._program = new T(e, "DebugRenderShader"), this._program.attachVertexSource(Yr.webgl.vertex), this._program.attachFragmentSource(Yr.webgl.fragment), this._program.link();
8823
+ this._program = new T(e, "DebugRenderShader"), this._program.attachVertexSource(kr.webgl.vertex), this._program.attachFragmentSource(kr.webgl.fragment), this._program.link();
8830
8824
  }
8831
8825
  setup(e, r, i, n, s) {
8832
8826
  if (!this._program)
@@ -8838,7 +8832,7 @@ class bn extends V {
8838
8832
  this._program && (T.Delete(this._program), this._program = null);
8839
8833
  }
8840
8834
  }
8841
- const jr = {
8835
+ const Yr = {
8842
8836
  webgl: {
8843
8837
  vertex: `precision mediump float;
8844
8838
 
@@ -8871,14 +8865,14 @@ const jr = {
8871
8865
  )
8872
8866
  }
8873
8867
  };
8874
- class En extends V {
8868
+ class Dn extends V {
8875
8869
  constructor(e) {
8876
8870
  if (super(e), this._program = null, e.typeId !== "WebGL")
8877
8871
  throw Error("PresentDebugFramebufferShader is only compatible with WebGL renderer");
8878
8872
  }
8879
8873
  async load() {
8880
8874
  const { gl: e } = this.renderer;
8881
- this._program = new T(e, "PresentDebugFramebufferShader"), this._program.attachVertexSource(jr.webgl.vertex), this._program.attachFragmentSource(jr.webgl.fragment), this._program.link(), this._borderWidth = 3, this._borderColor = new h([0, 0.7, 1, 1]), this._convMatrix = [
8875
+ this._program = new T(e, "PresentDebugFramebufferShader"), this._program.attachVertexSource(Yr.webgl.vertex), this._program.attachFragmentSource(Yr.webgl.fragment), this._program.link(), this._borderWidth = 3, this._borderColor = new h([0, 0.7, 1, 1]), this._convMatrix = [
8882
8876
  0,
8883
8877
  1,
8884
8878
  0,
@@ -8907,26 +8901,26 @@ class En extends V {
8907
8901
  this._program && (T.Delete(this._program), this._program = null);
8908
8902
  }
8909
8903
  }
8910
- const qt = {}, Vr = (t, e) => (!t && e ? t = w.MakeTranslation(e) : t || (t = w.MakeIdentity()), t);
8904
+ const qt = {}, jr = (t, e) => (!t && e ? t = w.MakeTranslation(e) : t || (t = w.MakeIdentity()), t);
8911
8905
  class xe {
8912
8906
  static Get(e) {
8913
8907
  return qt[e.uniqueId] || (qt[e.uniqueId] = new xe(e)), qt[e.uniqueId];
8914
8908
  }
8915
8909
  constructor(e) {
8916
- this._renderer = e, this._objects = [], this._sphere = ur(1), this._sphereRenderer = this.renderer.factory.polyList(this._sphere), this._arrow = Li(1, 0.3), this._arrow.lineWidth = 3, this._arrowRenderer = this.renderer.factory.polyList(this._arrow), this._baseMaterial = new ne(), this._materialRenderer = this.renderer.factory.material(this._baseMaterial);
8910
+ this._renderer = e, this._objects = [], this._sphere = gr(1), this._sphereRenderer = this.renderer.factory.polyList(this._sphere), this._arrow = Hi(1, 0.3), this._arrow.lineWidth = 3, this._arrowRenderer = this.renderer.factory.polyList(this._arrow), this._baseMaterial = new ne(), this._materialRenderer = this.renderer.factory.material(this._baseMaterial);
8917
8911
  }
8918
8912
  get renderer() {
8919
8913
  return this._renderer;
8920
8914
  }
8921
8915
  async init() {
8922
8916
  const e = this._renderer;
8923
- this._shader = new bn(e), await this._shader.load(), this._presentShader = new En(e), await this._presentShader.load(), this._targetTexture = new x(), this._targetTexture.name = "DebugRendererTargetTexture", this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture);
8917
+ this._shader = new pn(e), await this._shader.load(), this._presentShader = new Dn(e), await this._presentShader.load(), this._targetTexture = new x(), this._targetTexture.name = "DebugRendererTargetTexture", this._targetTexture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._targetTexture.componentFormat = ie.UNSIGNED_BYTE, this._targetTexture.wrapModeXY = U.CLAMP, this._renderBuffer = e.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._targetTexture);
8924
8918
  }
8925
8919
  beginFrame() {
8926
8920
  this._objects = [];
8927
8921
  }
8928
8922
  drawSphere({ radius: e = 1, color: r = p.White(), transformMatrix: i = null, position: n = null } = {}) {
8929
- i = Vr(i, n), this._objects.push({
8923
+ i = jr(i, n), this._objects.push({
8930
8924
  renderer: this._sphereRenderer,
8931
8925
  scale: e,
8932
8926
  color: r,
@@ -8934,7 +8928,7 @@ class xe {
8934
8928
  });
8935
8929
  }
8936
8930
  drawArrow({ length: e = 1, color: r = p.White(), transformMatrix: i = null, position: n = null } = {}) {
8937
- i = Vr(i, n), this._objects.push({
8931
+ i = jr(i, n), this._objects.push({
8938
8932
  renderer: this._arrowRenderer,
8939
8933
  scale: e,
8940
8934
  color: r,
@@ -8965,9 +8959,9 @@ class xe {
8965
8959
  this._renderBuffer.destroy(), this._targetTexture.destroy(), this._renderBuffer = null, this._targetTexture = null;
8966
8960
  }
8967
8961
  }
8968
- class w0 extends rn {
8962
+ class w0 extends en {
8969
8963
  constructor() {
8970
- super(...arguments), this._sceneRoot = null, this._sceneRenderer = null, this._environment = null, this._selectionManager = null, this._selectionHighlight = null, this._debugRenderer = null;
8964
+ super(...arguments), this._sceneRoot = null, this._sceneRenderer = null, this._environment = null, this._selectionManager = null, this._selectionHighlight = null, this._debugRenderer = null, this._updateInputEventsFrameCount = 60;
8971
8965
  }
8972
8966
  get sceneRoot() {
8973
8967
  return this._sceneRoot;
@@ -8996,6 +8990,12 @@ class w0 extends rn {
8996
8990
  set updateOnInputEvents(e) {
8997
8991
  this._updateOnInputEvents = e;
8998
8992
  }
8993
+ get updateInputEventsFrameCount() {
8994
+ return this._updateInputEventsFrameCount;
8995
+ }
8996
+ set updateInputEventsFrameCount(e) {
8997
+ this._updateInputEventsFrameCount = e;
8998
+ }
8999
8999
  async loadScene() {
9000
9000
  return new Ae("Scene Root");
9001
9001
  }
@@ -9007,7 +9007,7 @@ class w0 extends rn {
9007
9007
  async loadDone() {
9008
9008
  }
9009
9009
  async init() {
9010
- if (tn(), await this.registerLoaders(), this._sceneRoot = await this.loadScene(), !this._sceneRoot)
9010
+ if ($i(), await this.registerLoaders(), this._sceneRoot = await this.loadScene(), !this._sceneRoot)
9011
9011
  throw new Error("SceneAppController.init: Failed to load scene.");
9012
9012
  this._environment = await this.loadEnvironment(), this._environment || (this._environment = this.renderer.factory.environment(), await this._environment?.load()), this._sceneRenderer = this.renderer.factory.scene(), await this.sceneRenderer?.init({ shadowMapSize: new h(4096, 4096) }), this.environment && await this.sceneRenderer?.setEnvironment(this.environment), await this.sceneRenderer?.bindRenderer(this.sceneRoot), this.selectionManagerEnabled && (this._selectionManager = new d0(this.renderer), await this._selectionManager.init(), this._selectionManager.sceneRoot = this.sceneRoot), this.selectionHighlightEnabled && (this._selectionHighlight = new c0(this.renderer), await this._selectionHighlight.init()), this._debugRenderer = xe.Get(this.renderer), await this._debugRenderer?.init(), await this.loadDone();
9013
9013
  }
@@ -9028,40 +9028,40 @@ class w0 extends rn {
9028
9028
  this.sceneRenderer?.destroy(), this.selectionManagerEnabled && this.selectionManager?.destroy();
9029
9029
  }
9030
9030
  keyDown(e) {
9031
- this.sceneRoot && this.sceneRenderer?.keyDown(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9031
+ this.sceneRoot && this.sceneRenderer?.keyDown(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9032
9032
  }
9033
9033
  keyUp(e) {
9034
- this.sceneRoot && this.sceneRenderer?.keyUp(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9034
+ this.sceneRoot && this.sceneRenderer?.keyUp(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9035
9035
  }
9036
9036
  mouseUp(e) {
9037
- this.sceneRoot && this.sceneRenderer?.mouseUp(this.sceneRoot, e), this.selectionManager?.mouseUp(e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9037
+ this.sceneRoot && this.sceneRenderer?.mouseUp(this.sceneRoot, e), this.selectionManager?.mouseUp(e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9038
9038
  }
9039
9039
  mouseDown(e) {
9040
- this.sceneRoot && this.sceneRenderer?.mouseDown(this.sceneRoot, e), this.selectionManager?.mouseDown(e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9040
+ this.sceneRoot && this.sceneRenderer?.mouseDown(this.sceneRoot, e), this.selectionManager?.mouseDown(e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9041
9041
  }
9042
9042
  mouseMove(e) {
9043
- this.sceneRoot && this.sceneRenderer?.mouseMove(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9043
+ this.sceneRoot && this.sceneRenderer?.mouseMove(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9044
9044
  }
9045
9045
  mouseOut(e) {
9046
- this.sceneRoot && this.sceneRenderer?.mouseOut(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9046
+ this.sceneRoot && this.sceneRenderer?.mouseOut(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9047
9047
  }
9048
9048
  mouseDrag(e) {
9049
- this.sceneRoot && this.sceneRenderer?.mouseDrag(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9049
+ this.sceneRoot && this.sceneRenderer?.mouseDrag(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9050
9050
  }
9051
9051
  mouseWheel(e) {
9052
- this.sceneRoot && this.sceneRenderer?.mouseWheel(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9052
+ this.sceneRoot && this.sceneRenderer?.mouseWheel(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9053
9053
  }
9054
9054
  touchStart(e) {
9055
- this.sceneRoot && this.sceneRenderer?.touchStart(this.sceneRoot, e), this.selectionManager?.touchStart(e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9055
+ this.sceneRoot && this.sceneRenderer?.touchStart(this.sceneRoot, e), this.selectionManager?.touchStart(e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9056
9056
  }
9057
9057
  touchMove(e) {
9058
- this.sceneRoot && this.sceneRenderer?.touchMove(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9058
+ this.sceneRoot && this.sceneRenderer?.touchMove(this.sceneRoot, e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9059
9059
  }
9060
9060
  touchEnd(e) {
9061
- this.sceneRoot && this.sceneRenderer?.touchEnd(this.sceneRoot, e), this.selectionManager?.touchEnd(e), this.updateOnInputEvents && this.mainLoop.postRedisplay();
9061
+ this.sceneRoot && this.sceneRenderer?.touchEnd(this.sceneRoot, e), this.selectionManager?.touchEnd(e), this.updateOnInputEvents && this.mainLoop.postRedisplay({ frames: this._updateInputEventsFrameCount });
9062
9062
  }
9063
9063
  }
9064
- const Kr = {
9064
+ const Vr = {
9065
9065
  webgl: {
9066
9066
  vertex: `precision mediump float;
9067
9067
  attribute vec3 position;
@@ -9091,14 +9091,14 @@ const Kr = {
9091
9091
  )
9092
9092
  }
9093
9093
  };
9094
- class xn extends V {
9094
+ class bn extends V {
9095
9095
  constructor(e) {
9096
9096
  if (super(e), this._program = null, e.typeId !== "WebGL")
9097
9097
  throw Error("DepthRenderShader is only compatible with WebGL renderer");
9098
9098
  }
9099
9099
  async load() {
9100
9100
  const { gl: e } = this.renderer;
9101
- this._program = new T(e, "DepthRenderShader"), this._program.attachVertexSource(Kr.webgl.vertex), this._program.attachFragmentSource(Kr.webgl.fragment), this._program.link();
9101
+ this._program = new T(e, "DepthRenderShader"), this._program.attachVertexSource(Vr.webgl.vertex), this._program.attachFragmentSource(Vr.webgl.fragment), this._program.link();
9102
9102
  }
9103
9103
  setup(e, r, i, n, s) {
9104
9104
  if (!this._program)
@@ -9110,7 +9110,7 @@ class xn extends V {
9110
9110
  this._program && (T.Delete(this._program), this._program = null);
9111
9111
  }
9112
9112
  }
9113
- class Qn {
9113
+ class En {
9114
9114
  constructor(e) {
9115
9115
  this._size = null, this._texture = null, this._renderBuffer = null, this._depthTexture = null, this._shader = null, this._renderer = e, this._shadowMapRenderDistance = 100, this._debug = !1;
9116
9116
  }
@@ -9137,7 +9137,7 @@ class Qn {
9137
9137
  return this._depthTexture;
9138
9138
  }
9139
9139
  async create(e = new h(1024, 1024)) {
9140
- this._size = e, this._texture = new x(), this._texture.name = `ShadowMap_${e.width}x${e.height}`, this._texture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._texture.componentFormat = ie.UNSIGNED_BYTE, this._texture.wrapModeXY = U.CLAMP, this._renderBuffer = this.renderer.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._texture), this._depthTexture = new x(), this._depthTexture.name = `ShadowMapDepth_${e.width}x${e.height}`, this._depthTexture.renderTargetAttachment = Y.DEPTH_ATTACHMENT, this._depthTexture.componentFormat = ie.UNSIGNED_BYTE, this._depthTexture.wrapModeXY = U.CLAMP, await this._renderBuffer.attachTexture(this._depthTexture), this._renderBuffer.size = this._size, this._shader = new xn(this.renderer), await this._shader.load();
9140
+ this._size = e, this._texture = new x(), this._texture.name = `ShadowMap_${e.width}x${e.height}`, this._texture.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, this._texture.componentFormat = ie.UNSIGNED_BYTE, this._texture.wrapModeXY = U.CLAMP, this._renderBuffer = this.renderer.factory.renderBuffer(), await this._renderBuffer.attachTexture(this._texture), this._depthTexture = new x(), this._depthTexture.name = `ShadowMapDepth_${e.width}x${e.height}`, this._depthTexture.renderTargetAttachment = Y.DEPTH_ATTACHMENT, this._depthTexture.componentFormat = ie.UNSIGNED_BYTE, this._depthTexture.wrapModeXY = U.CLAMP, await this._renderBuffer.attachTexture(this._depthTexture), this._renderBuffer.size = this._size, this._shader = new bn(this.renderer), await this._shader.load();
9141
9141
  }
9142
9142
  getLightTransform(e, r) {
9143
9143
  let i = null, n = null, s = null;
@@ -9166,7 +9166,7 @@ class Qn {
9166
9166
  }), r.depthTexture = this._depthTexture, r.viewMatrix = n;
9167
9167
  }
9168
9168
  }
9169
- const Wr = {
9169
+ const Kr = {
9170
9170
  webgl: {
9171
9171
  vertex: `precision mediump float;
9172
9172
 
@@ -9195,14 +9195,14 @@ const Wr = {
9195
9195
  }`
9196
9196
  }
9197
9197
  };
9198
- class Tn extends V {
9198
+ class xn extends V {
9199
9199
  constructor(e) {
9200
9200
  if (super(e), this._program = null, e.typeId !== "WebGL")
9201
9201
  throw Error("SkyCubeShader is only compatible with WebGL renderer");
9202
9202
  }
9203
9203
  async load() {
9204
9204
  const { gl: e } = this.renderer;
9205
- this._program = new T(e, "SkyCubeShader"), this._program.attachVertexSource(Wr.webgl.vertex), this._program.attachFragmentSource(Wr.webgl.fragment), this._program.link();
9205
+ this._program = new T(e, "SkyCubeShader"), this._program.attachVertexSource(Kr.webgl.vertex), this._program.attachFragmentSource(Kr.webgl.fragment), this._program.link();
9206
9206
  }
9207
9207
  setup(e, r, i, n, s) {
9208
9208
  if (!this._program)
@@ -9218,7 +9218,7 @@ class Tn extends V {
9218
9218
  this._program && (T.Delete(this._program), this._program = null);
9219
9219
  }
9220
9220
  }
9221
- class yn {
9221
+ class Qn {
9222
9222
  constructor(e) {
9223
9223
  this._renderer = e, this._texture = null, this._material = null, this._shader = null, this._plistRenderer = null, this._renderState = null;
9224
9224
  }
@@ -9233,7 +9233,7 @@ class yn {
9233
9233
  this._texture = e, this._material.albedoTexture = this._texture;
9234
9234
  }
9235
9235
  async load(e, r = null, i = []) {
9236
- this._texture = e, this._material = new ne(), this._material.albedoTexture = this._texture, this._shader = r ? new r(this.renderer) : new Tn(this.renderer), await this._shader?.load();
9236
+ this._texture = e, this._material = new ne(), this._material.albedoTexture = this._texture, this._shader = r ? new r(this.renderer) : new xn(this.renderer), await this._shader?.load();
9237
9237
  }
9238
9238
  updateRenderState({ viewMatrix: e, projectionMatrix: r = null }) {
9239
9239
  const i = w.GetRotation(e);
@@ -9257,7 +9257,7 @@ class yn {
9257
9257
  }
9258
9258
  get polyListRenderer() {
9259
9259
  if (!this._plistRenderer) {
9260
- const e = zi(1, 1, 1);
9260
+ const e = Ni(1, 1, 1);
9261
9261
  e.cullFace = De.FRONT, this._plistRenderer = this.renderer.factory.polyList(e);
9262
9262
  }
9263
9263
  return this._plistRenderer;
@@ -9266,7 +9266,7 @@ class yn {
9266
9266
  this._shader?.destroy(), this._texture?.destroy(), this._plistRenderer?.destroy(), this._material?.destroy(), this._shader = null, this._texture = null, this._material = null, this._plistRenderer = null, this._renderState = null;
9267
9267
  }
9268
9268
  }
9269
- class Mn {
9269
+ class Tn {
9270
9270
  constructor(e, r) {
9271
9271
  if (r.renderer)
9272
9272
  throw new Error("Invalid initialization of texture renderer: The texture object is already controlled by another texture renderer.");
@@ -9285,7 +9285,7 @@ class Mn {
9285
9285
  throw new Error("TextureRenderer: destroy() invalid usage of generic implementation of TextureRenderer");
9286
9286
  }
9287
9287
  }
9288
- class Nn extends hn {
9288
+ class yn extends on {
9289
9289
  clear({ color: e = !0, depth: r = !0, stencil: i = !1 } = {}) {
9290
9290
  const { state: n } = this.renderer;
9291
9291
  n.clear({ color: e, depth: r, stencil: i });
@@ -9296,18 +9296,18 @@ const v0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIAEAIAAAArip/uAA
9296
9296
  blackTexture: {},
9297
9297
  normalTexture: {},
9298
9298
  brdfIntegrationTexture: {}
9299
- }, yr = async (t, e = "") => {
9299
+ }, Tr = async (t, e = "") => {
9300
9300
  const r = new x();
9301
9301
  return r.magFilter = q.NEAREST, r.minFilter = q.NEAREST, r.wrapModeXY = U.REPEAT, r.proceduralFunction = Pe.PLAIN_COLOR, r.proceduralParameters = t, r.size = [2, 2], e = e || `ColorTexture_${t.r}_${t.g}_${t.b}_${t.a}`, r.name = `${e}_${r.size.width}_${r.size.height}`, await r.loadImageData(), r;
9302
- }, m0 = async (t) => (F.whiteTexture[t.uniqueId] || (F.whiteTexture[t.uniqueId] = await yr(p.White(), "WhiteTexture")), F.whiteTexture[t.uniqueId]), P0 = (t) => {
9302
+ }, m0 = async (t) => (F.whiteTexture[t.uniqueId] || (F.whiteTexture[t.uniqueId] = await Tr(p.White(), "WhiteTexture")), F.whiteTexture[t.uniqueId]), P0 = (t) => {
9303
9303
  if (!F.whiteTexture[t.uniqueId])
9304
9304
  throw new Error("TextureResourceDatabase: whiteTexture is not initialize. Call 'createWhiteTexture' before use 'whiteTexture' function");
9305
9305
  return F.whiteTexture[t.uniqueId];
9306
- }, B0 = async (t) => (F.blackTexture[t.uniqueId] || (F.blackTexture[t.uniqueId] = await yr(p.Black(), "BlackTexture")), F.blackTexture[t.uniqueId]), C0 = (t) => {
9306
+ }, B0 = async (t) => (F.blackTexture[t.uniqueId] || (F.blackTexture[t.uniqueId] = await Tr(p.Black(), "BlackTexture")), F.blackTexture[t.uniqueId]), C0 = (t) => {
9307
9307
  if (!F.blackTexture[t.uniqueId])
9308
9308
  throw new Error("TextureResourceDatabase: blackTexture is not initialize. Call 'createBlackTexture' before use 'blackTexture' function");
9309
9309
  return F.blackTexture[t.uniqueId];
9310
- }, Hn = async (t) => (F.normalTexture[t.uniqueId] || (F.normalTexture[t.uniqueId] = await yr(new p([0.5, 0.5, 1, 1]), "NormalMapTexture")), F.normalTexture[t.uniqueId]), zn = (t) => {
9310
+ }, Mn = async (t) => (F.normalTexture[t.uniqueId] || (F.normalTexture[t.uniqueId] = await Tr(new p([0.5, 0.5, 1, 1]), "NormalMapTexture")), F.normalTexture[t.uniqueId]), Nn = (t) => {
9311
9311
  if (!F.normalTexture[t.uniqueId])
9312
9312
  throw new Error("TextureResourceDatabase: normalTexture is not initialized. Call 'createNormalTexture' before use 'normalTexture' function");
9313
9313
  return F.normalTexture[t.uniqueId];
@@ -9320,7 +9320,7 @@ const v0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIAEAIAAAArip/uAA
9320
9320
  }
9321
9321
  return F.brdfIntegrationTexture[t.uniqueId];
9322
9322
  };
9323
- class or extends An {
9323
+ class or extends an {
9324
9324
  static async InitResources(e) {
9325
9325
  await m0(e), await B0(e);
9326
9326
  }
@@ -9406,7 +9406,7 @@ const D0 = (t, e) => {
9406
9406
  }
9407
9407
  throw new Error(`Invalid blend function specified in WebGLPipeline: ${e}`);
9408
9408
  };
9409
- class Ln extends fn {
9409
+ class Hn extends hn {
9410
9410
  create() {
9411
9411
  const { gl: e } = this.renderer;
9412
9412
  if (this._blendEquation = D0(e, this.blendState.blendEquation), this._blendFuncSrcColor = ft(e, this.blendState.blendFuncSrc), this._blendFuncSrcAlpha = ft(e, this.blendState.blendFuncSrcAlpha), this._blendFuncDstColor = ft(e, this.blendState.blendFuncDst), this._blendFuncDstAlpha = ft(e, this.blendState.blendFuncDstAlpha), this._blendFuncDstAlpha === null && this._blendFuncSrcAlpha !== null || this._blendFuncDstAlpha !== null && this._blendFuncSrcAlpha === null)
@@ -9423,9 +9423,9 @@ class Ln extends fn {
9423
9423
  ), r.depthTestEnabled = this.depthTest, this.cullFace ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE);
9424
9424
  }
9425
9425
  }
9426
- var Se = /* @__PURE__ */ ((t) => (t[t.ARRAY_BUFFER = 0] = "ARRAY_BUFFER", t[t.ELEMENT_ARRAY_BUFFER = 1] = "ELEMENT_ARRAY_BUFFER", t[t.COPY_READ_BUFFER = 2] = "COPY_READ_BUFFER", t[t.COPY_WRITE_BUFFER = 3] = "COPY_WRITE_BUFFER", t[t.TRANSFORM_FEEDBACK_BUFFER = 4] = "TRANSFORM_FEEDBACK_BUFFER", t[t.UNIFORM_BUFFER = 5] = "UNIFORM_BUFFER", t[t.PIXEL_PACK_BUFFER = 6] = "PIXEL_PACK_BUFFER", t[t.PIXEL_UNPACK_BUFFER = 7] = "PIXEL_UNPACK_BUFFER", t))(Se || {}), In = /* @__PURE__ */ ((t) => (t[t.STATIC_DRAW = 0] = "STATIC_DRAW", t[t.DYNAMIC_DRAW = 1] = "DYNAMIC_DRAW", t[t.STREAM_DRAW = 2] = "STREAM_DRAW", t[t.STATIC_READ = 3] = "STATIC_READ", t[t.DYNAMIC_READ = 4] = "DYNAMIC_READ", t[t.STREAM_READ = 5] = "STREAM_READ", t[t.STATIC_COPY = 6] = "STATIC_COPY", t[t.DYNAMIC_COPY = 7] = "DYNAMIC_COPY", t[t.STREAM_COPY = 8] = "STREAM_COPY", t))(In || {});
9426
+ var Se = /* @__PURE__ */ ((t) => (t[t.ARRAY_BUFFER = 0] = "ARRAY_BUFFER", t[t.ELEMENT_ARRAY_BUFFER = 1] = "ELEMENT_ARRAY_BUFFER", t[t.COPY_READ_BUFFER = 2] = "COPY_READ_BUFFER", t[t.COPY_WRITE_BUFFER = 3] = "COPY_WRITE_BUFFER", t[t.TRANSFORM_FEEDBACK_BUFFER = 4] = "TRANSFORM_FEEDBACK_BUFFER", t[t.UNIFORM_BUFFER = 5] = "UNIFORM_BUFFER", t[t.PIXEL_PACK_BUFFER = 6] = "PIXEL_PACK_BUFFER", t[t.PIXEL_UNPACK_BUFFER = 7] = "PIXEL_UNPACK_BUFFER", t))(Se || {}), zn = /* @__PURE__ */ ((t) => (t[t.STATIC_DRAW = 0] = "STATIC_DRAW", t[t.DYNAMIC_DRAW = 1] = "DYNAMIC_DRAW", t[t.STREAM_DRAW = 2] = "STREAM_DRAW", t[t.STATIC_READ = 3] = "STATIC_READ", t[t.DYNAMIC_READ = 4] = "DYNAMIC_READ", t[t.STREAM_READ = 5] = "STREAM_READ", t[t.STATIC_COPY = 6] = "STATIC_COPY", t[t.DYNAMIC_COPY = 7] = "DYNAMIC_COPY", t[t.STREAM_COPY = 8] = "STREAM_COPY", t))(zn || {});
9427
9427
  const Xe = [], ke = [], we = {};
9428
- let Jr = 0;
9428
+ let Wr = 0;
9429
9429
  class he {
9430
9430
  static Delete(e) {
9431
9431
  if (!e._buffer || !e._gl) return;
@@ -9463,7 +9463,7 @@ class he {
9463
9463
  return this._buffer?._bg2e_id_;
9464
9464
  }
9465
9465
  constructor(e) {
9466
- this._gl = e, this._buffer = e.createBuffer(), e._bg2_id_ = e._bg2_id_ ?? ++Jr, this._buffer._bg2e_id_ = ++Jr;
9466
+ this._gl = e, this._buffer = e.createBuffer(), e._bg2_id_ = e._bg2_id_ ?? ++Wr, this._buffer._bg2e_id_ = ++Wr;
9467
9467
  const r = e._bg2_id_;
9468
9468
  we[r] = we[r] || {}, we[r][this._buffer._bg2e_id_] = this, Xe.length === 0 && (Xe.push(e.ARRAY_BUFFER), Xe.push(e.ELEMENT_ARRAY_BUFFER)), ke.length === 0 && (ke.push(e.STATIC_DRAW), ke.push(e.DYNAMIC_DRAW), ke.push(e.STREAM_DRAW));
9469
9469
  }
@@ -9481,7 +9481,7 @@ class he {
9481
9481
  );
9482
9482
  }
9483
9483
  }
9484
- class Sn extends ln {
9484
+ class Ln extends An {
9485
9485
  constructor(e, r) {
9486
9486
  super(e, r), this._vertexBuffer = null, this._indexBuffer = null, this._indexArrayFormat = null, this._stride = 0, this._offsets = { vertex: 0, normal: 0, texCoord0: 0, texCoord1: 0, texCoord2: 0, color: 0, tangent: 0 };
9487
9487
  }
@@ -9623,7 +9623,7 @@ function E0(t, e) {
9623
9623
  function x0(t, e) {
9624
9624
  return t[Be[e.target]];
9625
9625
  }
9626
- class Rn extends gn {
9626
+ class In extends ln {
9627
9627
  constructor(e) {
9628
9628
  super(e);
9629
9629
  }
@@ -9711,7 +9711,7 @@ class Rn extends gn {
9711
9711
  e.bindFramebuffer(e.FRAMEBUFFER, null), this.renderer.state.viewport = this._screenViewport;
9712
9712
  }
9713
9713
  }
9714
- const On = `#ifndef COLOR_CORRECTION_GLSL
9714
+ const Sn = `#ifndef COLOR_CORRECTION_GLSL
9715
9715
  #define COLOR_CORRECTION_GLSL
9716
9716
 
9717
9717
  // Convert lineal color to SRGB for shader output
@@ -9764,7 +9764,7 @@ vec4 brightnessContrast(vec4 color, float brightness, float contrast)
9764
9764
  #define LIGHT_TYPE_DIRECTIONAL 4
9765
9765
  #define LIGHT_TYPE_SPOT 1
9766
9766
  #define LIGHT_TYPE_DISABLED 10
9767
- `, Fn = `
9767
+ `, Rn = `
9768
9768
  mat3 TBNMatrix(mat4 model, vec3 normal, vec3 tangent)
9769
9769
  {
9770
9770
  vec3 T = normalize(vec3(model * vec4(tangent, 0.0)));
@@ -9773,7 +9773,7 @@ mat3 TBNMatrix(mat4 model, vec3 normal, vec3 tangent)
9773
9773
  return mat3(T, B, N);
9774
9774
  }
9775
9775
 
9776
- `, Gn = `
9776
+ `, On = `
9777
9777
  #include "lib/constants.glsl"
9778
9778
 
9779
9779
  vec3 fresnelSchlick(float cosTheta, vec3 F0)
@@ -9946,7 +9946,7 @@ vec3 getShadowColor(vec4 positionFromLightPov, sampler2D shadowMap, float shadow
9946
9946
  }
9947
9947
  return vec3(1.0);
9948
9948
  }
9949
- `, Un = `
9949
+ `, Fn = `
9950
9950
  struct PBRMaterialData
9951
9951
  {
9952
9952
  vec4 albedo;
@@ -10042,27 +10042,27 @@ let _t = null;
10042
10042
  function T0() {
10043
10043
  return _t || (_t = [
10044
10044
  ...Ue(Q0),
10045
+ ...Ue(Sn),
10046
+ ...Ue(Rn),
10045
10047
  ...Ue(On),
10046
- ...Ue(Fn),
10047
- ...Ue(Gn),
10048
- ...Ue(Un)
10048
+ ...Ue(Fn)
10049
10049
  ]), _t;
10050
10050
  }
10051
10051
  let $t = null;
10052
10052
  function y0() {
10053
- return $t || ($t = Ot(On)), $t;
10053
+ return $t || ($t = Ot(Sn)), $t;
10054
10054
  }
10055
10055
  let er = null;
10056
- function Zr() {
10057
- return er || (er = Ot(Fn)), er;
10056
+ function Jr() {
10057
+ return er || (er = Ot(Rn)), er;
10058
10058
  }
10059
10059
  let tr = null;
10060
10060
  function M0() {
10061
- return tr || (tr = Ot(Gn)), tr;
10061
+ return tr || (tr = Ot(On)), tr;
10062
10062
  }
10063
10063
  let rr = null;
10064
10064
  function N0() {
10065
- return rr || (rr = Ot(Un)), rr;
10065
+ return rr || (rr = Ot(Fn)), rr;
10066
10066
  }
10067
10067
  function H0(t) {
10068
10068
  const e = T0();
@@ -10123,12 +10123,12 @@ function z0(t, e) {
10123
10123
  gl_Position = uProj * uView * uWorld * vec4(inPosition,1.0);
10124
10124
  fragTBN = TBNMatrix(uWorld, inNormal, inTangent);
10125
10125
  }`, [
10126
- ...Zr()
10126
+ ...Jr()
10127
10127
  ])
10128
10128
  ]
10129
10129
  ), n = [
10130
10130
  ...y0(),
10131
- ...Zr(),
10131
+ ...Jr(),
10132
10132
  ...N0(),
10133
10133
  ...M0()
10134
10134
  ], s = H0(Q.GetShaderCode(
@@ -10274,14 +10274,14 @@ function z0(t, e) {
10274
10274
  ));
10275
10275
  return this._programs[e] = T.Create(r.gl, "PBRLightIBL", i, s), this._programs[e];
10276
10276
  }
10277
- class Xn extends V {
10277
+ class Gn extends V {
10278
10278
  constructor(e) {
10279
10279
  if (super(e), this._lightTypes = [], this._lightPositions = [], this._lightDirections = [], this._lightColors = [], this._lightIntensities = [], this._brdfIntegrationTexture = null, this._environment = null, this._program = null, this._lights = [], this._lightTransforms = [], this._brightness = 0.2, this._contrast = 1.1, this._cameraPosition = new h(0, 0, 0), e.typeId !== "WebGL")
10280
10280
  throw Error("PresentTextureShader is only compatible with WebGL renderer");
10281
10281
  this._programs = {};
10282
10282
  }
10283
10283
  async load() {
10284
- await Hn(this.renderer), this._brdfIntegrationTexture = await p0(this.renderer);
10284
+ await Mn(this.renderer), this._brdfIntegrationTexture = await p0(this.renderer);
10285
10285
  }
10286
10286
  get brightness() {
10287
10287
  return this._brightness;
@@ -10343,7 +10343,7 @@ class Xn extends V {
10343
10343
  const a = r.material;
10344
10344
  r.mergeTextures(), o.state.shaderProgram = this._program;
10345
10345
  const f = w.GetNormalMatrix(i);
10346
- if (this._program.bindMatrix("uNormMatrix", f), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uViewInverse", w.GetInverted(n)), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, zn(this.renderer)), r.bindMetalnessRoughnessHeightAOTexture(this._program, "uMetallicRoughnessHeightAOTexture", 2), this._program.uniform1f("uAlphaTresshold", a.alphaCutoff), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), r.bindValue(this._program, "lightEmission", "uLightEmission", 0), this._program.uniform1i("uAlbedoMap", a.albedoUV), this._program.uniform1i("uNormalMap", a.normalUV), this._program.uniform1i("uAOMap", a.ambientOcclussionUV), this._program.uniform1i("uMetallicMap", a.metalnessChannel), this._program.uniform1i("uRoughnessMap", a.roughnessChannel), this._program.uniform1i("uLightemissionMap", a.lightEmissionChannel), this._program.bindVector("uAlbedoScale", a.albedoScale), this._program.bindVector("uNormalScale", a.normalScale), this._program.bindVector("uMetallicScale", a.metalnessScale), this._program.bindVector("uRoughnessScale", a.roughnessScale), this._program.bindVector("uLightEmissionScale", a.lightEmissionScale), this._program.bindVector("uFresnelTint", a.fresnelTint), this._program.bindVector("uSheenColor", a.sheenColor), this._program.uniform1f("uSheenIntensity", a.sheenIntensity), !this.irradianceMap || !this.specularMap || !this.environmentMap || !this._brdfIntegrationTexture)
10346
+ if (this._program.bindMatrix("uNormMatrix", f), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uViewInverse", w.GetInverted(n)), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, Nn(this.renderer)), r.bindMetalnessRoughnessHeightAOTexture(this._program, "uMetallicRoughnessHeightAOTexture", 2), this._program.uniform1f("uAlphaTresshold", a.alphaCutoff), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), r.bindValue(this._program, "lightEmission", "uLightEmission", 0), this._program.uniform1i("uAlbedoMap", a.albedoUV), this._program.uniform1i("uNormalMap", a.normalUV), this._program.uniform1i("uAOMap", a.ambientOcclussionUV), this._program.uniform1i("uMetallicMap", a.metalnessChannel), this._program.uniform1i("uRoughnessMap", a.roughnessChannel), this._program.uniform1i("uLightemissionMap", a.lightEmissionChannel), this._program.bindVector("uAlbedoScale", a.albedoScale), this._program.bindVector("uNormalScale", a.normalScale), this._program.bindVector("uMetallicScale", a.metalnessScale), this._program.bindVector("uRoughnessScale", a.roughnessScale), this._program.bindVector("uLightEmissionScale", a.lightEmissionScale), this._program.bindVector("uFresnelTint", a.fresnelTint), this._program.bindVector("uSheenColor", a.sheenColor), this._program.uniform1f("uSheenIntensity", a.sheenIntensity), !this.irradianceMap || !this.specularMap || !this.environmentMap || !this._brdfIntegrationTexture)
10347
10347
  throw new Error("PBRLightIBLShader: Environment maps not set.");
10348
10348
  const c = this.renderer.factory.texture(this.irradianceMap), d = this.renderer.factory.texture(this.specularMap), P = this.renderer.factory.texture(this.environmentMap), C = this.renderer.factory.texture(this._brdfIntegrationTexture);
10349
10349
  this._program.bindTexture("uIrradianceMap", c, 3), this._program.bindTexture("uSpecularMap", d, 4), this._program.bindTexture("uEnvMap", P, 5), this._program.bindTexture("uBRDFIntegrationMap", C, 6), this._program.uniform1f("uBrightness", this._brightness), this._program.uniform1f("uContrast", this._contrast), this._program.uniform1f("uAmbientIntensity", 1);
@@ -10368,9 +10368,9 @@ class Xn extends V {
10368
10368
  this._program && T.Delete(this._program);
10369
10369
  }
10370
10370
  }
10371
- class kn extends wn {
10371
+ class Un extends un {
10372
10372
  constructor(e) {
10373
- super(e), this._shader = new Xn(this.renderer);
10373
+ super(e), this._shader = new Gn(this.renderer);
10374
10374
  }
10375
10375
  get shader() {
10376
10376
  return this._shader;
@@ -10403,9 +10403,9 @@ class kn extends wn {
10403
10403
  this.shader.cameraPosition = s;
10404
10404
  }
10405
10405
  }
10406
- class Yn extends Qn {
10406
+ class Xn extends En {
10407
10407
  }
10408
- class jn extends yn {
10408
+ class kn extends Qn {
10409
10409
  draw() {
10410
10410
  const { state: e } = this.renderer;
10411
10411
  if (!this._renderState)
@@ -10414,7 +10414,7 @@ class jn extends yn {
10414
10414
  e.depthMask = !1, this._renderState.draw(), e.depthMask = r;
10415
10415
  }
10416
10416
  }
10417
- class Vn extends dr {
10417
+ class Yn extends ur {
10418
10418
  draw() {
10419
10419
  const e = this.renderer;
10420
10420
  if (!this._renderState)
@@ -10423,7 +10423,7 @@ class Vn extends dr {
10423
10423
  e.state.depthMask = !1, this._renderState.draw(), e.state.depthMask = r;
10424
10424
  }
10425
10425
  }
10426
- class Kn {
10426
+ class jn {
10427
10427
  get CW() {
10428
10428
  return this.gl.CW;
10429
10429
  }
@@ -10543,11 +10543,11 @@ const L0 = (t, e) => {
10543
10543
  if (e === 1)
10544
10544
  return t.CLAMP_TO_EDGE;
10545
10545
  {
10546
- const r = yi(e);
10546
+ const r = Qi(e);
10547
10547
  return t[r];
10548
10548
  }
10549
- }, qr = (t, e) => {
10550
- const r = Mi(e);
10549
+ }, Zr = (t, e) => {
10550
+ const r = Ti(e);
10551
10551
  return t[r];
10552
10552
  }, I0 = (t, e) => {
10553
10553
  switch (e.componentFormat) {
@@ -10562,12 +10562,12 @@ const L0 = (t, e) => {
10562
10562
  e._apiObject = t.createTexture(), e._apiObject._bg2_uuid = Pt(), t._bg2_textures = t._bg2_textures || {};
10563
10563
  let r = e.name || e._apiObject._bg2_uuid;
10564
10564
  t._bg2_textures[r] && t._bg2_textures[r] !== e && (r = e.name + "_" + e._apiObject._bg2_uuid), t._bg2_textures[r] = e;
10565
- }, Wn = (t, e) => {
10565
+ }, Vn = (t, e) => {
10566
10566
  e._apiObject && (t.deleteTexture(e._apiObject), delete t._bg2_textures[e._apiObject._bg2_uuid], e._apiObject = null, e.setUpdated(!1));
10567
10567
  }, R0 = (t, e) => {
10568
10568
  if (!e.imageData)
10569
10569
  throw new Error("Error loading WebGL texture: image data not loaded");
10570
- Wn(t, e), S0(t, e);
10570
+ Vn(t, e), S0(t, e);
10571
10571
  const r = L0(t, e), i = I0(t, e);
10572
10572
  if (t.bindTexture(r, e._apiObject), e.dataType === Qe.RENDER_TARGET) {
10573
10573
  const { width: n, height: s } = e.size, o = e.renderTargetAttachment === Y.DEPTH_ATTACHMENT, a = o ? t.DEPTH_COMPONENT : t.RGBA;
@@ -10580,9 +10580,9 @@ const L0 = (t, e) => {
10580
10580
  t.texImage2D(r, 0, a, n, s, 0, f, c, null);
10581
10581
  e.imageData.currentSize = new h(e.size);
10582
10582
  } else
10583
- t.texImage2D(r, 0, t.RGBA, t.RGBA, i, e._imageData), t.texParameteri(r, t.TEXTURE_WRAP_S, lt(t, e.wrapModeX)), t.texParameteri(r, t.TEXTURE_WRAP_T, lt(t, e.wrapModeY)), t.texParameteri(r, t.TEXTURE_MAG_FILTER, qr(t, e.magFilter)), t.texParameteri(r, t.TEXTURE_MIN_FILTER, qr(t, e.minFilter)), e.mipmapRequired && t.generateMipmap(r);
10583
+ t.texImage2D(r, 0, t.RGBA, t.RGBA, i, e._imageData), t.texParameteri(r, t.TEXTURE_WRAP_S, lt(t, e.wrapModeX)), t.texParameteri(r, t.TEXTURE_WRAP_T, lt(t, e.wrapModeY)), t.texParameteri(r, t.TEXTURE_MAG_FILTER, Zr(t, e.magFilter)), t.texParameteri(r, t.TEXTURE_MIN_FILTER, Zr(t, e.minFilter)), e.mipmapRequired && t.generateMipmap(r);
10584
10584
  };
10585
- class Jn extends Mn {
10585
+ class Kn extends Tn {
10586
10586
  static ListTextures(e) {
10587
10587
  return e instanceof Et && (e = e.gl), e._bg2_textures || {};
10588
10588
  }
@@ -10597,7 +10597,7 @@ class Jn extends Mn {
10597
10597
  }
10598
10598
  destroy() {
10599
10599
  const { gl: e } = this.renderer;
10600
- Wn(e, this.texture);
10600
+ Vn(e, this.texture);
10601
10601
  }
10602
10602
  ///// webgl specific functions
10603
10603
  // Returns the webgl target (TEXTURE_2D, TEXTURE_3D...)
@@ -10613,22 +10613,22 @@ class Jn extends Mn {
10613
10613
  }
10614
10614
  }
10615
10615
  const O0 = {
10616
- FrameBuffer: Nn,
10616
+ FrameBuffer: yn,
10617
10617
  MaterialRenderer: or,
10618
- Pipeline: Ln,
10619
- PolyListRenderer: Sn,
10620
- RenderBuffer: Rn,
10621
- SceneRenderer: kn,
10618
+ Pipeline: Hn,
10619
+ PolyListRenderer: Ln,
10620
+ RenderBuffer: In,
10621
+ SceneRenderer: Un,
10622
10622
  ShaderProgram: T,
10623
10623
  ShaderType: Ye,
10624
- ShadowRenderer: Yn,
10625
- SkyCube: jn,
10626
- SkySphere: Vn,
10627
- State: Kn,
10628
- TextureRenderer: Jn,
10624
+ ShadowRenderer: Xn,
10625
+ SkyCube: kn,
10626
+ SkySphere: Yn,
10627
+ State: jn,
10628
+ TextureRenderer: Kn,
10629
10629
  VertexBuffer: he,
10630
10630
  BufferTarget: Se,
10631
- BufferUsage: In
10631
+ BufferUsage: zn
10632
10632
  };
10633
10633
  function F0(t) {
10634
10634
  t.getSupportedExtensions()?.forEach((e) => {
@@ -10636,7 +10636,7 @@ function F0(t) {
10636
10636
  });
10637
10637
  }
10638
10638
  let G0 = 0;
10639
- class Zn extends Et {
10639
+ class Wn extends Et {
10640
10640
  constructor() {
10641
10641
  super("webgl"), this._debugMode = !1, this._uuid = G0++;
10642
10642
  }
@@ -10647,7 +10647,7 @@ class Zn extends Et {
10647
10647
  return "WebGL";
10648
10648
  }
10649
10649
  get frameBuffer() {
10650
- return this._frameBuffer || (this._frameBuffer = new Nn(this)), this._frameBuffer;
10650
+ return this._frameBuffer || (this._frameBuffer = new yn(this)), this._frameBuffer;
10651
10651
  }
10652
10652
  set viewport(e) {
10653
10653
  this.state.viewport = e;
@@ -10678,7 +10678,7 @@ class Zn extends Et {
10678
10678
  };
10679
10679
  this._gl = window.WebGLDebugUtils.makeDebugContext(this._gl, i, n);
10680
10680
  }
10681
- this._state = new Kn(this), F0.apply(this, [this.gl]), await this.initPresentTextureShader(), await or.InitResources(this);
10681
+ this._state = new jn(this), F0.apply(this, [this.gl]), await this.initPresentTextureShader(), await or.InitResources(this);
10682
10682
  }
10683
10683
  get gl() {
10684
10684
  return this._gl;
@@ -10700,7 +10700,7 @@ class Zn extends Et {
10700
10700
  if (e.renderer)
10701
10701
  return e.renderer;
10702
10702
  {
10703
- const r = new Sn(this, e);
10703
+ const r = new Ln(this, e);
10704
10704
  return r.init(), r.refresh(), r;
10705
10705
  }
10706
10706
  }
@@ -10708,25 +10708,25 @@ class Zn extends Et {
10708
10708
  return e.renderer ? e.renderer : new or(this, e);
10709
10709
  }
10710
10710
  textureFactory(e) {
10711
- return e.renderer ? e.renderer : new Jn(this, e);
10711
+ return e.renderer ? e.renderer : new Kn(this, e);
10712
10712
  }
10713
10713
  renderBufferFactory() {
10714
- return new Rn(this);
10714
+ return new In(this);
10715
10715
  }
10716
10716
  skySphereFactory() {
10717
- return new Vn(this);
10717
+ return new Yn(this);
10718
10718
  }
10719
10719
  skyCubeFactory() {
10720
- return new jn(this);
10720
+ return new kn(this);
10721
10721
  }
10722
10722
  pipelineFactory() {
10723
- return new Ln(this);
10723
+ return new Hn(this);
10724
10724
  }
10725
10725
  sceneRendererFactory() {
10726
- return new kn(this);
10726
+ return new Un(this);
10727
10727
  }
10728
10728
  shadowRendererFactory() {
10729
- return new Yn(this);
10729
+ return new Xn(this);
10730
10730
  }
10731
10731
  get clearColor() {
10732
10732
  return this.state.clearColor;
@@ -10749,36 +10749,36 @@ class Zn extends Et {
10749
10749
  }
10750
10750
  }
10751
10751
  const U0 = {
10752
- Environment: Si,
10753
- FrameBuffer: hn,
10754
- MaterialRenderer: An,
10755
- Pipeline: fn,
10752
+ Environment: Li,
10753
+ FrameBuffer: on,
10754
+ MaterialRenderer: an,
10755
+ Pipeline: hn,
10756
10756
  BlendEquation: Ke,
10757
10757
  BlendFunction: R,
10758
- PolyListRenderer: ln,
10759
- RenderBuffer: gn,
10758
+ PolyListRenderer: An,
10759
+ RenderBuffer: ln,
10760
10760
  RenderBufferType: ve,
10761
- RenderBufferTypeName: cn,
10761
+ RenderBufferTypeName: fn,
10762
10762
  CubeMapFace: vt,
10763
10763
  Renderer: Et,
10764
10764
  EngineFeatures: Ve,
10765
10765
  RenderQueue: St,
10766
10766
  RenderState: Dt,
10767
10767
  SceneAppController: w0,
10768
- SceneRenderer: wn,
10768
+ SceneRenderer: un,
10769
10769
  FrameVisitor: Rt,
10770
- BindRendererVisitor: un,
10771
- InitVisitor: dn,
10770
+ BindRendererVisitor: cn,
10771
+ InitVisitor: gn,
10772
10772
  EventCallbackVisitor: _,
10773
10773
  Shader: V,
10774
- ShadowRenderer: Qn,
10775
- SkyCube: yn,
10776
- SkySphere: dr,
10777
- TextureMergerRenderer: Ri,
10778
- TextureRenderer: Mn,
10774
+ ShadowRenderer: En,
10775
+ SkyCube: Qn,
10776
+ SkySphere: ur,
10777
+ TextureMergerRenderer: Ii,
10778
+ TextureRenderer: Tn,
10779
10779
  webgl: O0,
10780
- WebGLRenderer: Zn
10781
- }, _r = {
10780
+ WebGLRenderer: Wn
10781
+ }, qr = {
10782
10782
  webgl: {
10783
10783
  vertex: `precision mediump float;
10784
10784
 
@@ -10816,7 +10816,7 @@ class X0 extends V {
10816
10816
  }
10817
10817
  async load() {
10818
10818
  const { gl: e } = this.renderer;
10819
- this._program = new T(e, "BasicDiffuseColorShader"), this._program.attachVertexSource(_r.webgl.vertex), this._program.attachFragmentSource(_r.webgl.fragment), this._program.link(), this._whiteTexture = new x(), this._whiteTexture.proceduralFunction = Pe.PLAIN_COLOR, this._whiteTexture.proceduralParameters = [1, 1, 1, 1], this._whiteTexture.size = new h(4, 4), await this._whiteTexture.loadImageData(), this._whiteTextureRenderer = this.renderer.factory.texture(this._whiteTexture);
10819
+ this._program = new T(e, "BasicDiffuseColorShader"), this._program.attachVertexSource(qr.webgl.vertex), this._program.attachFragmentSource(qr.webgl.fragment), this._program.link(), this._whiteTexture = new x(), this._whiteTexture.proceduralFunction = Pe.PLAIN_COLOR, this._whiteTexture.proceduralParameters = [1, 1, 1, 1], this._whiteTexture.size = new h(4, 4), await this._whiteTexture.loadImageData(), this._whiteTextureRenderer = this.renderer.factory.texture(this._whiteTexture);
10820
10820
  }
10821
10821
  setup(e, r, i, n, s) {
10822
10822
  if (!this._program)
@@ -10931,7 +10931,7 @@ function k0(t, e) {
10931
10931
  color = pow(color, vec3(1.0/2.2));
10932
10932
 
10933
10933
  gl_FragColor = vec4(color,1.0);
10934
- }`, [Pn, Bn])
10934
+ }`, [vn, mn])
10935
10935
  ]
10936
10936
  );
10937
10937
  return this._programs[e] = T.Create(r.gl, "PBRBasicLight", i, n), this._programs[e];
@@ -10943,7 +10943,7 @@ class Y0 extends V {
10943
10943
  this._programs = {};
10944
10944
  }
10945
10945
  async load() {
10946
- await Hn(this.renderer);
10946
+ await Mn(this.renderer);
10947
10947
  }
10948
10948
  set cameraPosition(e) {
10949
10949
  this._cameraPosition = e;
@@ -10972,7 +10972,7 @@ class Y0 extends V {
10972
10972
  const o = r.material, a = this.renderer;
10973
10973
  a.state.shaderProgram = this._program;
10974
10974
  const f = w.GetNormalMatrix(i);
10975
- this._program.bindMatrix("uNormMatrix", f), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, zn(this.renderer)), r.bindTexture(this._program, "metalnessTexture", "uMetallicTexture", 2), r.bindTexture(this._program, "roughnessTexture", "uRoughnessTexture", 3), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), this._program.bindVector("uAlbedoScale", o.albedoScale), this._program.bindVector("uNormalScale", o.normalScale), this._program.bindVector("uMetallicScale", o.metalnessScale), this._program.bindVector("uRoughnessScale", o.roughnessScale), this._lights.forEach((c, d) => {
10975
+ this._program.bindMatrix("uNormMatrix", f), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, Nn(this.renderer)), r.bindTexture(this._program, "metalnessTexture", "uMetallicTexture", 2), r.bindTexture(this._program, "roughnessTexture", "uRoughnessTexture", 3), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), this._program.bindVector("uAlbedoScale", o.albedoScale), this._program.bindVector("uNormalScale", o.normalScale), this._program.bindVector("uMetallicScale", o.metalnessScale), this._program.bindVector("uRoughnessScale", o.roughnessScale), this._lights.forEach((c, d) => {
10976
10976
  this._program?.uniform1i(`uLightTypes[${d}]`, this._lightTypes[d]), this._program?.bindVector(`uLightPositions[${d}]`, this._lightPositions[d]), this._program?.bindVector(`uLightDirections[${d}]`, this._lightDirections[d]), this._program?.bindVector(`uLightColors[${d}]`, this._lightColors[d].rgb), this._program?.uniform1f(`uLightIntensities[${d}]`, this._lightIntensities[d]);
10977
10977
  }), this._program.bindAttribs(e, {
10978
10978
  position: "inPosition",
@@ -10988,18 +10988,18 @@ class Y0 extends V {
10988
10988
  const j0 = {
10989
10989
  BasicDiffuseColorShader: X0,
10990
10990
  BasicPBRLightShader: Y0,
10991
- DebugRenderShader: bn,
10992
- DepthRenderShader: xn,
10993
- IrradianceMapCubeShader: Ni,
10994
- PBRLightIBLShader: Xn,
10995
- PickSelectionShader: br,
10996
- PresentDebugFramebufferShader: En,
10997
- PresentTextureShader: Oi,
10998
- SelectionHighlightShader: Dn,
10991
+ DebugRenderShader: pn,
10992
+ DepthRenderShader: bn,
10993
+ IrradianceMapCubeShader: yi,
10994
+ PBRLightIBLShader: Gn,
10995
+ PickSelectionShader: Dr,
10996
+ PresentDebugFramebufferShader: Dn,
10997
+ PresentTextureShader: Si,
10998
+ SelectionHighlightShader: Cn,
10999
10999
  ShaderFunction: Q,
11000
- SkyCubeShader: Tn,
11001
- SkySphereShader: Ii,
11002
- SpecularMapCubeShader: Hi,
11000
+ SkyCubeShader: xn,
11001
+ SkySphereShader: zi,
11002
+ SpecularMapCubeShader: Mi,
11003
11003
  TextureMergerShader: bt,
11004
11004
  shaderLib: {
11005
11005
  webgl: l0
@@ -11007,7 +11007,7 @@ const j0 = {
11007
11007
  };
11008
11008
  class V0 {
11009
11009
  constructor(e) {
11010
- if (!(e instanceof Zn))
11010
+ if (!(e instanceof Wn))
11011
11011
  throw new Error("WebGLTextureViewer works only with WebGL Renderer");
11012
11012
  this._renderer = e, this._size = [512, 512], this._canvas = document.createElement("canvas"), this._canvas.width = this._size[0], this._canvas.height = this._size[1], this._context = this._canvas.getContext("2d");
11013
11013
  }
@@ -11041,12 +11041,12 @@ const K0 = {
11041
11041
  DebugRenderer: xe,
11042
11042
  WebGLTextureViewer: V0
11043
11043
  }, J0 = _o, Z0 = To, q0 = Qo, _0 = K0, $0 = {
11044
- ...ws,
11044
+ ...us,
11045
11045
  Mat3: te,
11046
11046
  Mat4: w,
11047
11047
  Vec: h,
11048
- Quat: vs,
11049
- MatrixStrategy: ni
11048
+ Quat: ds,
11049
+ MatrixStrategy: ii
11050
11050
  }, ea = U0, ta = Ro, ra = zs, ia = fo, na = j0;
11051
11051
  export {
11052
11052
  J0 as app,