bg2e-js 2.2.9 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bg2e-js.js CHANGED
@@ -20,7 +20,7 @@ var ct = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.X = 1] = "X", t[t.
20
20
  })(ct || (ct = {}));
21
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 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 = {
23
+ const ts = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, le = (t) => t > -gt && t < gt ? 0 : t, b = (t) => le(t) === 0, E = (t, e) => Math.abs(t - e) < gt, We = (t) => Math.fround(le(t * $r)), ti = (t) => Math.fround(le(t * ei)), rs = (t) => Math.fround(le(Math.sin(t))), is = (t) => Math.fround(le(Math.cos(t))), ri = (t) => Math.fround(le(Math.tan(t))), ns = (t) => Math.fround(le(1 / ri(t))), ss = (t) => Math.fround(le(Math.atan(t))), os = (t, e) => Math.fround(le(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
25
  PI: _r,
26
26
  DEG_TO_RAD: $r,
@@ -34,7 +34,7 @@ const ts = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, fe =
34
34
  NumericArrayHighP: $n,
35
35
  FLOAT_MAX: es,
36
36
  checkPowerOfTwo: ts,
37
- checkZero: fe,
37
+ checkZero: le,
38
38
  isZero: b,
39
39
  equals: E,
40
40
  degreesToRadians: We,
@@ -53,7 +53,7 @@ const ts = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, fe =
53
53
  sqrt: cs,
54
54
  lerp: J,
55
55
  square: gs
56
- }, ce = (t, e) => {
56
+ }, ge = (t, e) => {
57
57
  if (t.length != e.length) throw new Error("Invalid vector length in operation");
58
58
  };
59
59
  class h extends Le {
@@ -94,7 +94,7 @@ class h extends Le {
94
94
  return this;
95
95
  }
96
96
  assign(e) {
97
- switch (ce(this, e), this.length) {
97
+ switch (ge(this, e), this.length) {
98
98
  case 4:
99
99
  this[3] = e[3];
100
100
  case 3:
@@ -350,10 +350,10 @@ class h extends Le {
350
350
  return Array.from(this);
351
351
  }
352
352
  static CheckEqualLength(e, r) {
353
- ce(e, r);
353
+ ge(e, r);
354
354
  }
355
355
  static Max(e, r) {
356
- switch (ce(e, r), e.length) {
356
+ switch (ge(e, r), e.length) {
357
357
  case 2:
358
358
  return new h([
359
359
  e[0] > r[0] ? e[0] : r[0],
@@ -377,7 +377,7 @@ class h extends Le {
377
377
  }
378
378
  }
379
379
  static Min(e, r) {
380
- switch (ce(e, r), e.length) {
380
+ switch (ge(e, r), e.length) {
381
381
  case 2:
382
382
  return new h([
383
383
  e[0] < r[0] ? e[0] : r[0],
@@ -401,7 +401,7 @@ class h extends Le {
401
401
  }
402
402
  }
403
403
  static Add(e, r) {
404
- switch (ce(e, r), e.length) {
404
+ switch (ge(e, r), e.length) {
405
405
  case 2:
406
406
  return new h([
407
407
  e[0] + r[0],
@@ -425,7 +425,7 @@ class h extends Le {
425
425
  }
426
426
  }
427
427
  static Sub(e, r) {
428
- switch (ce(e, r), e.length) {
428
+ switch (ge(e, r), e.length) {
429
429
  case 2:
430
430
  return new h([
431
431
  e[0] - r[0],
@@ -461,10 +461,10 @@ class h extends Le {
461
461
  }
462
462
  }
463
463
  static Distance(e, r) {
464
- return ce(e, r), h.Magnitude(h.Sub(e, r));
464
+ return ge(e, r), h.Magnitude(h.Sub(e, r));
465
465
  }
466
466
  static Dot(e, r) {
467
- switch (ce(e, r), e.length) {
467
+ switch (ge(e, r), e.length) {
468
468
  case 2:
469
469
  return e[0] * r[0] + e[1] * r[1];
470
470
  case 3:
@@ -476,7 +476,7 @@ class h extends Le {
476
476
  }
477
477
  }
478
478
  static Cross(e, r) {
479
- switch (ce(e, r), e.length) {
479
+ switch (ge(e, r), e.length) {
480
480
  case 2:
481
481
  return e[0] * r[1] - e[1] * r[0];
482
482
  case 3:
@@ -2071,7 +2071,7 @@ class _e {
2071
2071
  return r && (this.domElement.style.cssText = n, this.domElement.width = s.width, this.domElement.height = s.height, this.mainLoop.appController.reshape(s.width, s.height), this.mainLoop.appController.display()), o;
2072
2072
  }
2073
2073
  }
2074
- 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 || {});
2074
+ 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 || {}), ee = /* @__PURE__ */ ((t) => (t[t.TEXTURE_2D = 0] = "TEXTURE_2D", t[t.CUBE_MAP = 1] = "CUBE_MAP", t))(ee || {}), 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 || {});
2075
2075
  const Ci = Object.freeze({
2076
2076
  0: "NONE",
2077
2077
  1: "IMAGE",
@@ -2318,10 +2318,10 @@ class x {
2318
2318
  this.renderer && this.renderer.destroy();
2319
2319
  }
2320
2320
  async deserialize(e) {
2321
- this._dataType = e.dataType !== void 0 ? Qe[e.dataType] : 0, this._wrapModeX = e.wrapModeX !== void 0 ? U[e.wrapModeX] : 0, this._wrapModeY = e.wrapModeY !== void 0 ? U[e.wrapModeY] : 0, this._magFilter = e.magFilter !== void 0 ? q[e.magFilter] : 5, this._minFilter = e.minFilter !== void 0 ? q[e.minFilter] : 5, this._target = e.target !== void 0 ? $[e.target] : 0, this._size = e.size?.length === 2 ? new h(e.size[0], e.size[1]) : new h(64, 64), this._fileName = e.fileName !== void 0 ? e.fileName : "", this._proceduralFunction = e.proceduralFunction !== void 0 ? Pe[e.proceduralFunction] : 0, this._proceduralParameters = e.proceduralParameters !== void 0 ? e.proceduralParameters : {}, this._renderTargetAttachment = e.renderTargetAttachment !== void 0 ? e.renderTargetAttachment : 0, this._componentFormat = e.componentFormat !== void 0 ? e.componentFormat : 0, this._name = e.name !== void 0 ? e.name : this._name, this._dirty = !0;
2321
+ this._dataType = e.dataType !== void 0 ? Qe[e.dataType] : 0, this._wrapModeX = e.wrapModeX !== void 0 ? U[e.wrapModeX] : 0, this._wrapModeY = e.wrapModeY !== void 0 ? U[e.wrapModeY] : 0, this._magFilter = e.magFilter !== void 0 ? q[e.magFilter] : 5, this._minFilter = e.minFilter !== void 0 ? q[e.minFilter] : 5, this._target = e.target !== void 0 ? ee[e.target] : 0, this._size = e.size?.length === 2 ? new h(e.size[0], e.size[1]) : new h(64, 64), this._fileName = e.fileName !== void 0 ? e.fileName : "", this._proceduralFunction = e.proceduralFunction !== void 0 ? Pe[e.proceduralFunction] : 0, this._proceduralParameters = e.proceduralParameters !== void 0 ? e.proceduralParameters : {}, this._renderTargetAttachment = e.renderTargetAttachment !== void 0 ? e.renderTargetAttachment : 0, this._componentFormat = e.componentFormat !== void 0 ? e.componentFormat : 0, this._name = e.name !== void 0 ? e.name : this._name, this._dirty = !0;
2322
2322
  }
2323
2323
  async serialize(e) {
2324
- e.dataType = Qe[this.dataType], e.wrapModeX = U[this.wrapModeX], e.wrapModeY = U[this.wrapModeY], e.magFilter = q[this.magFilter], e.minFilter = q[this.minFilter], e.target = $[this.target], e.size = this.size, e.fileName = this.fileName, e.proceduralFunction = Pe[this.proceduralFunction], e.proceduralParameters = this.proceduralParameters, e.renderTargetAttachment = Y[this.renderTargetAttachment], e.componentFormat = ie[this.componentFormat], e.name = this._name;
2324
+ e.dataType = Qe[this.dataType], e.wrapModeX = U[this.wrapModeX], e.wrapModeY = U[this.wrapModeY], e.magFilter = q[this.magFilter], e.minFilter = q[this.minFilter], e.target = ee[this.target], e.size = this.size, e.fileName = this.fileName, e.proceduralFunction = Pe[this.proceduralFunction], e.proceduralParameters = this.proceduralParameters, e.renderTargetAttachment = Y[this.renderTargetAttachment], e.componentFormat = ie[this.componentFormat], e.name = this._name;
2325
2325
  }
2326
2326
  async loadImageData(e = !1) {
2327
2327
  if (this.fileName) {
@@ -3020,10 +3020,10 @@ ${e.getProgramInfoLog(this._program)}`);
3020
3020
  bindTexture(e, r, i) {
3021
3021
  const n = this._gl, s = r.getApiObject();
3022
3022
  switch (n.activeTexture(n.TEXTURE0 + i), r.texture.target) {
3023
- case $.TEXTURE_2D:
3023
+ case ee.TEXTURE_2D:
3024
3024
  n.bindTexture(n.TEXTURE_2D, s);
3025
3025
  break;
3026
- case $.CUBE_MAP:
3026
+ case ee.CUBE_MAP:
3027
3027
  n.bindTexture(n.TEXTURE_CUBE_MAP, s);
3028
3028
  break;
3029
3029
  }
@@ -4819,7 +4819,7 @@ class ur {
4819
4819
  }
4820
4820
  const Kt = async (t, e) => {
4821
4821
  const r = new x();
4822
- r.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, r.target = $.CUBE_MAP;
4822
+ r.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, r.target = ee.CUBE_MAP;
4823
4823
  const i = t.factory.renderBuffer();
4824
4824
  return await i.attachTexture(r), i.size = e, { renderer: t, texture: r, renderBuffer: i, skyShape: null };
4825
4825
  }, Wt = (t) => {
@@ -5219,7 +5219,7 @@ class Et {
5219
5219
  return 1;
5220
5220
  }
5221
5221
  }
5222
- const Ri = {}, ee = (t, e) => {
5222
+ const Ri = {}, _ = (t, e) => {
5223
5223
  Ri[t] = e;
5224
5224
  }, lo = (t) => {
5225
5225
  const e = Ri[t];
@@ -5412,7 +5412,7 @@ async function co(t) {
5412
5412
  }
5413
5413
  t._sceneChanged = !1;
5414
5414
  }
5415
- class Ae {
5415
+ class fe {
5416
5416
  constructor(e = "") {
5417
5417
  this._sceneChanged = !1, this._name = e, this._enabled = !0, this._steady = !1, this._components = new dr(this), this._parent = null, this._children = [];
5418
5418
  }
@@ -5444,7 +5444,7 @@ class Ae {
5444
5444
  return this._children;
5445
5445
  }
5446
5446
  clone(e = !1) {
5447
- const r = new Ae();
5447
+ const r = new fe();
5448
5448
  return r.assign(this, e), r;
5449
5449
  }
5450
5450
  assign(e, r = !1) {
@@ -5596,7 +5596,7 @@ class Ae {
5596
5596
  }
5597
5597
  const Gi = async (t, e) => {
5598
5598
  t.children = t.children || [], t.components = t.components || [];
5599
- const r = new Ae(t.name);
5599
+ const r = new fe(t.name);
5600
5600
  r.enabled = t.enabled !== void 0 ? t.enabled : !0, r.steady = t.steady !== void 0 ? t.steady : !1;
5601
5601
  for (const i of t.components)
5602
5602
  try {
@@ -5638,7 +5638,7 @@ class Ui extends pt {
5638
5638
  throw new Error(`VitscnjLoaderPlugin.load() unexpected resource type received: ${r}`);
5639
5639
  const n = i.currentPath;
5640
5640
  i.currentPath = li(e);
5641
- const s = new qe(), o = new Ae("Scene Root"), { scene: a } = await s.load(e);
5641
+ const s = new qe(), o = new fe("Scene Root"), { scene: a } = await s.load(e);
5642
5642
  for (const f of a) {
5643
5643
  const c = await Gi(f, i);
5644
5644
  o.addChild(c);
@@ -5911,7 +5911,7 @@ const vo = async (t) => {
5911
5911
  }
5912
5912
  return s;
5913
5913
  }, mo = async (t, e, r) => {
5914
- const i = Ar(hr(e)), n = await ki(t, e, r), s = new Ae(i);
5914
+ const i = Ar(hr(e)), n = await ki(t, e, r), s = new fe(i);
5915
5915
  s.addComponent(n);
5916
5916
  for (const o of t.components)
5917
5917
  try {
@@ -6391,7 +6391,7 @@ const To = {
6391
6391
  TextureDataType: Qe,
6392
6392
  TextureWrap: U,
6393
6393
  TextureFilter: q,
6394
- TextureTarget: $,
6394
+ TextureTarget: ee,
6395
6395
  ProceduralTextureFunction: Pe,
6396
6396
  TextureRenderTargetAttachment: Y,
6397
6397
  TextureComponentFormat: ie,
@@ -6413,7 +6413,7 @@ const To = {
6413
6413
  textureComponentFormatString: Gs,
6414
6414
  textureChannelString: Us
6415
6415
  };
6416
- class le {
6416
+ class ce {
6417
6417
  constructor() {
6418
6418
  this._ignoreDisabled = !0;
6419
6419
  }
@@ -6428,7 +6428,7 @@ class le {
6428
6428
  didVisit(e) {
6429
6429
  }
6430
6430
  }
6431
- class yo extends le {
6431
+ class yo extends ce {
6432
6432
  constructor() {
6433
6433
  super(), this._matrix = w.MakeIdentity();
6434
6434
  }
@@ -6639,7 +6639,7 @@ class yt extends Ji {
6639
6639
  return e.assign(this), e;
6640
6640
  }
6641
6641
  }
6642
- class Cr extends le {
6642
+ class Cr extends ce {
6643
6643
  constructor() {
6644
6644
  super(), this._name = void 0, this._result = [], this._hasComponents = [];
6645
6645
  }
@@ -6663,7 +6663,7 @@ class Cr extends le {
6663
6663
  typeof this._name == "string" ? r = this._name === e.name : this._name instanceof RegExp ? r = this._name.test(e.name) : r = !0, r = r && (this._hasComponents.some((i) => e.component(i)) || this._hasComponents.length == 0), r && this._result.push(e);
6664
6664
  }
6665
6665
  }
6666
- class ge extends se {
6666
+ class he extends se {
6667
6667
  static GetLights(e) {
6668
6668
  if (e.sceneChanged || !e.__lights) {
6669
6669
  e.__lights = [];
@@ -6673,10 +6673,10 @@ class ge extends se {
6673
6673
  return e.__lights;
6674
6674
  }
6675
6675
  static GetFirstShadowCastingLight(e) {
6676
- return (e.sceneChanged || !e.__mainDirectionalLight) && (e.__mainDirectionalLight = ge.GetLights(e).find((r) => r.light.type === be.DIRECTIONAL || r.light.type === be.SPOT)), e.__mainDirectionalLight;
6676
+ return (e.sceneChanged || !e.__mainDirectionalLight) && (e.__mainDirectionalLight = he.GetLights(e).find((r) => r.light.type === be.DIRECTIONAL || r.light.type === be.SPOT)), e.__mainDirectionalLight;
6677
6677
  }
6678
6678
  static GetMainDirectionalLight(e) {
6679
- return (e.sceneChanged || !e.__mainDirectionalLight) && (e.__mainDirectionalLight = ge.GetLights(e).find((r) => r.light.type === be.DIRECTIONAL)), e.__mainDirectionalLight || ge.GetFirstShadowCastingLight(e);
6679
+ return (e.sceneChanged || !e.__mainDirectionalLight) && (e.__mainDirectionalLight = he.GetLights(e).find((r) => r.light.type === be.DIRECTIONAL)), e.__mainDirectionalLight || he.GetFirstShadowCastingLight(e);
6680
6680
  }
6681
6681
  constructor(e = null) {
6682
6682
  super("Light"), this._light = e || new xt();
@@ -6700,7 +6700,7 @@ class ge extends se {
6700
6700
  return this._light.viewMatrix;
6701
6701
  }
6702
6702
  clone() {
6703
- const e = new ge();
6703
+ const e = new he();
6704
6704
  return e.assign(this), e;
6705
6705
  }
6706
6706
  assign(e) {
@@ -6882,7 +6882,7 @@ class Ie extends $e {
6882
6882
  this.viewWidth = e.viewWidth ?? this.viewWidth, super.deserialize(e);
6883
6883
  }
6884
6884
  }
6885
- class Mo extends le {
6885
+ class Mo extends ce {
6886
6886
  constructor(e) {
6887
6887
  if (super(), !e)
6888
6888
  throw Error("Set main camera: invalid parameter. The camera paremeter is null.");
@@ -6895,7 +6895,7 @@ class Mo extends le {
6895
6895
  r instanceof j && (r._isMain = r === this._mainCamera);
6896
6896
  }
6897
6897
  }
6898
- class No extends le {
6898
+ class No extends ce {
6899
6899
  constructor() {
6900
6900
  super(), this._mainCamera = null, this._firstCameraFound = null;
6901
6901
  }
@@ -6915,7 +6915,7 @@ class No extends le {
6915
6915
  }
6916
6916
  class j extends se {
6917
6917
  static SetMain(e, r) {
6918
- if (!(e instanceof Ae) || e.parent !== null)
6918
+ if (!(e instanceof fe) || e.parent !== null)
6919
6919
  throw Error("Camera.setMain(): invalid parameter. Object is not a scene root");
6920
6920
  const n = new Mo(r);
6921
6921
  e.accept(n);
@@ -7381,7 +7381,7 @@ class It extends se {
7381
7381
  }
7382
7382
  }
7383
7383
  const $i = () => {
7384
- 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);
7384
+ _("Drawable", Oe), _("Transform", oe), _("Light", he), _("LightComponent", he), _("Chain", Qt), _("InputChainJoint", Tt), _("OutputChainJoint", yt), _("Camera", j), _("OrbitCameraController", tt), _("SmoothOrbitCameraController", Lt), _("Environment", It);
7385
7385
  }, Ro = {
7386
7386
  Component: se,
7387
7387
  DrawableComponent: Oe,
@@ -7389,7 +7389,7 @@ const $i = () => {
7389
7389
  ChainComponent: Qt,
7390
7390
  InputChainJointComponent: Tt,
7391
7391
  OutputChainJointComponent: yt,
7392
- LightComponent: ge,
7392
+ LightComponent: he,
7393
7393
  CameraComponent: j,
7394
7394
  OpticalProjectionStrategy: Nt,
7395
7395
  PerspectiveProjectionStrategy: Mt,
@@ -7398,9 +7398,9 @@ const $i = () => {
7398
7398
  SmoothOrbitCameraControllerComponent: Lt,
7399
7399
  EnvironmentComponent: It,
7400
7400
  registerComponents: $i,
7401
- registerComponent: ee,
7402
- Node: Ae,
7403
- NodeVisitor: le,
7401
+ registerComponent: _,
7402
+ Node: fe,
7403
+ NodeVisitor: ce,
7404
7404
  FindNodeVisitor: Cr
7405
7405
  };
7406
7406
  class en {
@@ -7724,9 +7724,9 @@ const fn = {
7724
7724
  };
7725
7725
  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 || {});
7726
7726
  function Fr(t) {
7727
- if (t.target === $.TEXTURE_2D)
7727
+ if (t.target === ee.TEXTURE_2D)
7728
7728
  return 1;
7729
- if (t.target === $.CUBE_MAP)
7729
+ if (t.target === ee.CUBE_MAP)
7730
7730
  return 2;
7731
7731
  }
7732
7732
  function Gr(t) {
@@ -7940,7 +7940,7 @@ class St {
7940
7940
  }), typeof r.endOperation == "function" && r.endOperation(e)) : console.warn(`No render queue found for layer ${e}`);
7941
7941
  }
7942
7942
  }
7943
- class Rt extends le {
7943
+ class Rt extends ce {
7944
7944
  constructor(e) {
7945
7945
  super(), this._renderQueue = e, this._delta = 0, this._modelMatrix = w.MakeIdentity(), this._matrixStack = [];
7946
7946
  }
@@ -7960,7 +7960,7 @@ class Rt extends le {
7960
7960
  this._modelMatrix = this._matrixStack[this._matrixStack.length - 1] || w.MakeIdentity(), this._matrixStack.pop();
7961
7961
  }
7962
7962
  }
7963
- class cn extends le {
7963
+ class cn extends ce {
7964
7964
  constructor(e) {
7965
7965
  super(), this._renderer = e;
7966
7966
  }
@@ -7968,7 +7968,7 @@ class cn extends le {
7968
7968
  Fi(e, this._renderer);
7969
7969
  }
7970
7970
  }
7971
- class gn extends le {
7971
+ class gn extends ce {
7972
7972
  constructor() {
7973
7973
  super();
7974
7974
  }
@@ -7976,7 +7976,7 @@ class gn extends le {
7976
7976
  await co(e);
7977
7977
  }
7978
7978
  }
7979
- class _ extends le {
7979
+ class $ extends ce {
7980
7980
  constructor(e) {
7981
7981
  super(), this._callbackName = e, this._event = null;
7982
7982
  }
@@ -7992,7 +7992,7 @@ class _ extends le {
7992
7992
  }
7993
7993
  class un {
7994
7994
  constructor(e) {
7995
- 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;
7995
+ 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;
7996
7996
  }
7997
7997
  // Implement in subclasses
7998
7998
  get brightness() {
@@ -8066,7 +8066,7 @@ class un {
8066
8066
  draw({ clearBuffers: e = !0, drawSky: r = !0 } = {}) {
8067
8067
  if (!this._renderQueue || !this._shadowRenderer || !this._sceneRoot)
8068
8068
  throw new Error("SceneRenderer.draw(): SceneRenderer not initialized. Call SceneRenderer.init() first.");
8069
- const i = ge.GetMainDirectionalLight(this._sceneRoot), n = j.GetMain(this._sceneRoot);
8069
+ const i = he.GetMainDirectionalLight(this._sceneRoot), n = j.GetMain(this._sceneRoot);
8070
8070
  if (i && n) {
8071
8071
  const s = n.focusDistance, o = w.MakeOrtho(-s, s, -s, s, 0.1, 500);
8072
8072
  i.light.projection = o;
@@ -8660,7 +8660,7 @@ class g0 {
8660
8660
  }
8661
8661
  var mt = /* @__PURE__ */ ((t) => (t[t.OBJECT = 0] = "OBJECT", t[t.POLY_LIST = 1] = "POLY_LIST", t))(mt || {});
8662
8662
  const At = (t) => "" + t[0] + t[1] + t[2];
8663
- class u0 extends le {
8663
+ class u0 extends ce {
8664
8664
  constructor() {
8665
8665
  super(), this._r = 0, this._g = 0, this._b = 0, this._selectionMode = mt.POLY_LIST, this._elements = {};
8666
8666
  }
@@ -9000,7 +9000,7 @@ class w0 extends en {
9000
9000
  this._updateInputEventsFrameCount = e;
9001
9001
  }
9002
9002
  async loadScene() {
9003
- return new Ae("Scene Root");
9003
+ return new fe("Scene Root");
9004
9004
  }
9005
9005
  async loadEnvironment() {
9006
9006
  return null;
@@ -9144,10 +9144,10 @@ class En {
9144
9144
  }
9145
9145
  getLightTransform(e, r) {
9146
9146
  let i = null, n = null, s = null;
9147
- if (e instanceof j ? (i = e.node, n = e) : e instanceof Ae && (i = e, n = i.camera ?? null), !i || !n)
9147
+ if (e instanceof j ? (i = e.node, n = e) : e instanceof fe && (i = e, n = i.camera ?? null), !i || !n)
9148
9148
  throw Error("ShadowRenderer.getLightPosition(): invalid camera parameter. Camera must be a Node or a Camera component, and the camera must be added to the scene.");
9149
9149
  let o = null;
9150
- if (r instanceof ge ? (o = r.node, s = r) : r instanceof Ae && (o = r, s = r.lightComponent || null), !o || !s)
9150
+ if (r instanceof he ? (o = r.node, s = r) : r instanceof fe && (o = r, s = r.lightComponent || null), !o || !s)
9151
9151
  throw Error("ShadowRenderer.getLightPosition(): invalid light. Light must be a Node or a LightComponent");
9152
9152
  const a = n.focusDistance, f = oe.GetWorldMatrix(i), c = h.Add(w.GetPosition(f), h.Mult(f.forwardVector, -a)), d = oe.GetWorldMatrix(o), P = w.GetRotation(d).forwardVector;
9153
9153
  P.scale(this._shadowMapRenderDistance);
@@ -9317,7 +9317,7 @@ const v0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIAEAIAAAArip/uAA
9317
9317
  }, p0 = async (t) => {
9318
9318
  if (!F.brdfIntegrationTexture[t.uniqueId]) {
9319
9319
  const e = new x();
9320
- e.name = "BRDFIntegrationMapTexture", e.target = $.TEXTURE_2D, e.proceduralFunction = Pe.FROM_BASE64, e.proceduralParameters = {
9320
+ e.name = "BRDFIntegrationMapTexture", e.target = ee.TEXTURE_2D, e.proceduralFunction = Pe.FROM_BASE64, e.proceduralParameters = {
9321
9321
  imageData: v0
9322
9322
  }, await e.loadImageData(), F.brdfIntegrationTexture[t.uniqueId] = e;
9323
9323
  }
@@ -9429,21 +9429,21 @@ class Hn extends hn {
9429
9429
  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 || {});
9430
9430
  const Xe = [], ke = [], we = {};
9431
9431
  let Wr = 0;
9432
- class he {
9432
+ class Ae {
9433
9433
  static Delete(e) {
9434
9434
  if (!e._buffer || !e._gl) return;
9435
9435
  const r = e._gl._bg2_id_, i = e._buffer._bg2e_id_;
9436
9436
  we[r]?.[i] && delete we[r][i], e._gl.deleteBuffer(e._buffer), e._buffer = null;
9437
9437
  }
9438
9438
  static CreateArrayBuffer(e, r, i = 0) {
9439
- const n = new he(e);
9439
+ const n = new Ae(e);
9440
9440
  return n.bind(
9441
9441
  0
9442
9442
  /* ARRAY_BUFFER */
9443
9443
  ), n.bufferData(0, r, i), n;
9444
9444
  }
9445
9445
  static CreateElementArrayBuffer(e, r, i = 0) {
9446
- const n = new he(e);
9446
+ const n = new Ae(e);
9447
9447
  return n.bind(
9448
9448
  1
9449
9449
  /* ELEMENT_ARRAY_BUFFER */
@@ -9511,9 +9511,9 @@ class Ln extends An {
9511
9511
  this._stride = 3;
9512
9512
  const s = 0, o = 3;
9513
9513
  let a = 3, f = 3, c = 3, d = 3, P = 3;
9514
- this.hasNormal && (this._stride += 3, a += 3, f += 3, c += 3, d += 3, P += 3), this.hasTexCoord0 && (this._stride += 2, f += 2, c += 2, d += 2, P += 2), this.hasTexCoord1 && (this._stride += 2, c += 2, d += 2, P += 2), this.hasTexCoord2 && (this._stride += 2, d += 2, P += 2), this.hasColor && (this._stride += 4, P += 4), this.hasTangent && (this._stride += 3), this._offsets = { vertex: s, normal: o, texCoord0: a, texCoord1: f, texCoord2: c, color: d, tangent: P }, this._vertexBuffer = he.CreateArrayBuffer(e, new Float32Array(n));
9514
+ this.hasNormal && (this._stride += 3, a += 3, f += 3, c += 3, d += 3, P += 3), this.hasTexCoord0 && (this._stride += 2, f += 2, c += 2, d += 2, P += 2), this.hasTexCoord1 && (this._stride += 2, c += 2, d += 2, P += 2), this.hasTexCoord2 && (this._stride += 2, d += 2, P += 2), this.hasColor && (this._stride += 4, P += 4), this.hasTangent && (this._stride += 3), this._offsets = { vertex: s, normal: o, texCoord0: a, texCoord1: f, texCoord2: c, color: d, tangent: P }, this._vertexBuffer = Ae.CreateArrayBuffer(e, new Float32Array(n));
9515
9515
  const C = this.polyList.index.length < 65535 ? new Uint16Array(this.polyList.index) : new Uint32Array(this.polyList.index);
9516
- this._indexBuffer = he.CreateElementArrayBuffer(e, C), this._indexArrayFormat = C instanceof Uint16Array ? e.UNSIGNED_SHORT : e.UNSIGNED_INT;
9516
+ this._indexBuffer = Ae.CreateElementArrayBuffer(e, C), this._indexArrayFormat = C instanceof Uint16Array ? e.UNSIGNED_SHORT : e.UNSIGNED_INT;
9517
9517
  }
9518
9518
  get hasNormal() {
9519
9519
  return this._polyList.normal.length > 0;
@@ -9602,7 +9602,7 @@ class Ln extends An {
9602
9602
  e.lineWidth(this.polyList.lineWidth), e.drawElements(i, this.polyList.index.length, this._indexArrayFormat || 0, 0);
9603
9603
  }
9604
9604
  destroy() {
9605
- this._vertexBuffer && he.Delete(this._vertexBuffer), this._indexBuffer && he.Delete(this._indexBuffer);
9605
+ this._vertexBuffer && Ae.Delete(this._vertexBuffer), this._indexBuffer && Ae.Delete(this._indexBuffer);
9606
9606
  }
9607
9607
  }
9608
9608
  function b0(t, e) {
@@ -10535,9 +10535,9 @@ class jn {
10535
10535
  }
10536
10536
  const L0 = (t, e) => {
10537
10537
  switch (e.target) {
10538
- case $.TEXTURE_2D:
10538
+ case ee.TEXTURE_2D:
10539
10539
  return t.TEXTURE_2D;
10540
- case $.CUBE_MAP:
10540
+ case ee.CUBE_MAP:
10541
10541
  return t.TEXTURE_CUBE_MAP;
10542
10542
  default:
10543
10543
  throw new Error("Error creating WebGL Texture: invalid target");
@@ -10629,7 +10629,7 @@ const O0 = {
10629
10629
  SkySphere: Yn,
10630
10630
  State: jn,
10631
10631
  TextureRenderer: Kn,
10632
- VertexBuffer: he,
10632
+ VertexBuffer: Ae,
10633
10633
  BufferTarget: Se,
10634
10634
  BufferUsage: zn
10635
10635
  };
@@ -10669,7 +10669,7 @@ class Wn extends Et {
10669
10669
  throw window.WebGLDebugUtils.glEnumToString(a) + " was caused by call to: " + f;
10670
10670
  }, n = function(a, f) {
10671
10671
  if (console.log("gl." + a + "(" + window.WebGLDebugUtils.glFunctionArgsToString(a, f) + ")"), /drawElements/.test(a)) {
10672
- const c = he.CurrentBuffer(s, Se.ELEMENT_ARRAY_BUFFER), d = he.CurrentBuffer(s, Se.ARRAY_BUFFER);
10672
+ const c = Ae.CurrentBuffer(s, Se.ELEMENT_ARRAY_BUFFER), d = Ae.CurrentBuffer(s, Se.ARRAY_BUFFER);
10673
10673
  o(c?.id, "ELEMENT_ARRAY_BUFFER"), o(d?.id, "ARRAY_BUFFER");
10674
10674
  } else /bindBuffer/.test(a) && f[0] === s.ELEMENT_ARRAY_BUFFER ? console.log(` BufferID: ${f[1]._bg2e_id_}`) : /bindBuffer/.test(a) && f[0] === s.ARRAY_BUFFER && console.log(` BufferID: ${f[1]._bg2e_id_}`);
10675
10675
  };
@@ -10772,7 +10772,7 @@ const U0 = {
10772
10772
  FrameVisitor: Rt,
10773
10773
  BindRendererVisitor: cn,
10774
10774
  InitVisitor: gn,
10775
- EventCallbackVisitor: _,
10775
+ EventCallbackVisitor: $,
10776
10776
  Shader: V,
10777
10777
  ShadowRenderer: En,
10778
10778
  SkyCube: Qn,