bg2e-js 2.2.8 → 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:
@@ -944,6 +944,9 @@ class w extends Le {
944
944
  get downVector() {
945
945
  return w.TransformDirection(this, new h(0, -1, 0));
946
946
  }
947
+ get translation() {
948
+ return new h(this[12], this[13], this[14]);
949
+ }
947
950
  row(e) {
948
951
  return new h(
949
952
  this[e * 4],
@@ -2068,7 +2071,7 @@ class _e {
2068
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;
2069
2072
  }
2070
2073
  }
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 || {});
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 || {});
2072
2075
  const Ci = Object.freeze({
2073
2076
  0: "NONE",
2074
2077
  1: "IMAGE",
@@ -2315,10 +2318,10 @@ class x {
2315
2318
  this.renderer && this.renderer.destroy();
2316
2319
  }
2317
2320
  async deserialize(e) {
2318
- 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;
2319
2322
  }
2320
2323
  async serialize(e) {
2321
- 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;
2322
2325
  }
2323
2326
  async loadImageData(e = !1) {
2324
2327
  if (this.fileName) {
@@ -3017,10 +3020,10 @@ ${e.getProgramInfoLog(this._program)}`);
3017
3020
  bindTexture(e, r, i) {
3018
3021
  const n = this._gl, s = r.getApiObject();
3019
3022
  switch (n.activeTexture(n.TEXTURE0 + i), r.texture.target) {
3020
- case $.TEXTURE_2D:
3023
+ case ee.TEXTURE_2D:
3021
3024
  n.bindTexture(n.TEXTURE_2D, s);
3022
3025
  break;
3023
- case $.CUBE_MAP:
3026
+ case ee.CUBE_MAP:
3024
3027
  n.bindTexture(n.TEXTURE_CUBE_MAP, s);
3025
3028
  break;
3026
3029
  }
@@ -4816,7 +4819,7 @@ class ur {
4816
4819
  }
4817
4820
  const Kt = async (t, e) => {
4818
4821
  const r = new x();
4819
- r.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, r.target = $.CUBE_MAP;
4822
+ r.renderTargetAttachment = Y.COLOR_ATTACHMENT_0, r.target = ee.CUBE_MAP;
4820
4823
  const i = t.factory.renderBuffer();
4821
4824
  return await i.attachTexture(r), i.size = e, { renderer: t, texture: r, renderBuffer: i, skyShape: null };
4822
4825
  }, Wt = (t) => {
@@ -5216,7 +5219,7 @@ class Et {
5216
5219
  return 1;
5217
5220
  }
5218
5221
  }
5219
- const Ri = {}, ee = (t, e) => {
5222
+ const Ri = {}, _ = (t, e) => {
5220
5223
  Ri[t] = e;
5221
5224
  }, lo = (t) => {
5222
5225
  const e = Ri[t];
@@ -5409,7 +5412,7 @@ async function co(t) {
5409
5412
  }
5410
5413
  t._sceneChanged = !1;
5411
5414
  }
5412
- class Ae {
5415
+ class fe {
5413
5416
  constructor(e = "") {
5414
5417
  this._sceneChanged = !1, this._name = e, this._enabled = !0, this._steady = !1, this._components = new dr(this), this._parent = null, this._children = [];
5415
5418
  }
@@ -5441,7 +5444,7 @@ class Ae {
5441
5444
  return this._children;
5442
5445
  }
5443
5446
  clone(e = !1) {
5444
- const r = new Ae();
5447
+ const r = new fe();
5445
5448
  return r.assign(this, e), r;
5446
5449
  }
5447
5450
  assign(e, r = !1) {
@@ -5593,7 +5596,7 @@ class Ae {
5593
5596
  }
5594
5597
  const Gi = async (t, e) => {
5595
5598
  t.children = t.children || [], t.components = t.components || [];
5596
- const r = new Ae(t.name);
5599
+ const r = new fe(t.name);
5597
5600
  r.enabled = t.enabled !== void 0 ? t.enabled : !0, r.steady = t.steady !== void 0 ? t.steady : !1;
5598
5601
  for (const i of t.components)
5599
5602
  try {
@@ -5635,7 +5638,7 @@ class Ui extends pt {
5635
5638
  throw new Error(`VitscnjLoaderPlugin.load() unexpected resource type received: ${r}`);
5636
5639
  const n = i.currentPath;
5637
5640
  i.currentPath = li(e);
5638
- 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);
5639
5642
  for (const f of a) {
5640
5643
  const c = await Gi(f, i);
5641
5644
  o.addChild(c);
@@ -5908,7 +5911,7 @@ const vo = async (t) => {
5908
5911
  }
5909
5912
  return s;
5910
5913
  }, mo = async (t, e, r) => {
5911
- 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);
5912
5915
  s.addComponent(n);
5913
5916
  for (const o of t.components)
5914
5917
  try {
@@ -6388,7 +6391,7 @@ const To = {
6388
6391
  TextureDataType: Qe,
6389
6392
  TextureWrap: U,
6390
6393
  TextureFilter: q,
6391
- TextureTarget: $,
6394
+ TextureTarget: ee,
6392
6395
  ProceduralTextureFunction: Pe,
6393
6396
  TextureRenderTargetAttachment: Y,
6394
6397
  TextureComponentFormat: ie,
@@ -6410,7 +6413,7 @@ const To = {
6410
6413
  textureComponentFormatString: Gs,
6411
6414
  textureChannelString: Us
6412
6415
  };
6413
- class le {
6416
+ class ce {
6414
6417
  constructor() {
6415
6418
  this._ignoreDisabled = !0;
6416
6419
  }
@@ -6425,7 +6428,7 @@ class le {
6425
6428
  didVisit(e) {
6426
6429
  }
6427
6430
  }
6428
- class yo extends le {
6431
+ class yo extends ce {
6429
6432
  constructor() {
6430
6433
  super(), this._matrix = w.MakeIdentity();
6431
6434
  }
@@ -6636,7 +6639,7 @@ class yt extends Ji {
6636
6639
  return e.assign(this), e;
6637
6640
  }
6638
6641
  }
6639
- class Cr extends le {
6642
+ class Cr extends ce {
6640
6643
  constructor() {
6641
6644
  super(), this._name = void 0, this._result = [], this._hasComponents = [];
6642
6645
  }
@@ -6660,7 +6663,7 @@ class Cr extends le {
6660
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);
6661
6664
  }
6662
6665
  }
6663
- class ge extends se {
6666
+ class he extends se {
6664
6667
  static GetLights(e) {
6665
6668
  if (e.sceneChanged || !e.__lights) {
6666
6669
  e.__lights = [];
@@ -6670,10 +6673,10 @@ class ge extends se {
6670
6673
  return e.__lights;
6671
6674
  }
6672
6675
  static GetFirstShadowCastingLight(e) {
6673
- 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;
6674
6677
  }
6675
6678
  static GetMainDirectionalLight(e) {
6676
- 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);
6677
6680
  }
6678
6681
  constructor(e = null) {
6679
6682
  super("Light"), this._light = e || new xt();
@@ -6697,7 +6700,7 @@ class ge extends se {
6697
6700
  return this._light.viewMatrix;
6698
6701
  }
6699
6702
  clone() {
6700
- const e = new ge();
6703
+ const e = new he();
6701
6704
  return e.assign(this), e;
6702
6705
  }
6703
6706
  assign(e) {
@@ -6879,7 +6882,7 @@ class Ie extends $e {
6879
6882
  this.viewWidth = e.viewWidth ?? this.viewWidth, super.deserialize(e);
6880
6883
  }
6881
6884
  }
6882
- class Mo extends le {
6885
+ class Mo extends ce {
6883
6886
  constructor(e) {
6884
6887
  if (super(), !e)
6885
6888
  throw Error("Set main camera: invalid parameter. The camera paremeter is null.");
@@ -6892,7 +6895,7 @@ class Mo extends le {
6892
6895
  r instanceof j && (r._isMain = r === this._mainCamera);
6893
6896
  }
6894
6897
  }
6895
- class No extends le {
6898
+ class No extends ce {
6896
6899
  constructor() {
6897
6900
  super(), this._mainCamera = null, this._firstCameraFound = null;
6898
6901
  }
@@ -6912,7 +6915,7 @@ class No extends le {
6912
6915
  }
6913
6916
  class j extends se {
6914
6917
  static SetMain(e, r) {
6915
- if (!(e instanceof Ae) || e.parent !== null)
6918
+ if (!(e instanceof fe) || e.parent !== null)
6916
6919
  throw Error("Camera.setMain(): invalid parameter. Object is not a scene root");
6917
6920
  const n = new Mo(r);
6918
6921
  e.accept(n);
@@ -7378,7 +7381,7 @@ class It extends se {
7378
7381
  }
7379
7382
  }
7380
7383
  const $i = () => {
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);
7384
+ _("Drawable", Oe), _("Transform", oe), _("Light", he), _("LightComponent", he), _("Chain", Qt), _("InputChainJoint", Tt), _("OutputChainJoint", yt), _("Camera", j), _("OrbitCameraController", tt), _("SmoothOrbitCameraController", Lt), _("Environment", It);
7382
7385
  }, Ro = {
7383
7386
  Component: se,
7384
7387
  DrawableComponent: Oe,
@@ -7386,7 +7389,7 @@ const $i = () => {
7386
7389
  ChainComponent: Qt,
7387
7390
  InputChainJointComponent: Tt,
7388
7391
  OutputChainJointComponent: yt,
7389
- LightComponent: ge,
7392
+ LightComponent: he,
7390
7393
  CameraComponent: j,
7391
7394
  OpticalProjectionStrategy: Nt,
7392
7395
  PerspectiveProjectionStrategy: Mt,
@@ -7395,9 +7398,9 @@ const $i = () => {
7395
7398
  SmoothOrbitCameraControllerComponent: Lt,
7396
7399
  EnvironmentComponent: It,
7397
7400
  registerComponents: $i,
7398
- registerComponent: ee,
7399
- Node: Ae,
7400
- NodeVisitor: le,
7401
+ registerComponent: _,
7402
+ Node: fe,
7403
+ NodeVisitor: ce,
7401
7404
  FindNodeVisitor: Cr
7402
7405
  };
7403
7406
  class en {
@@ -7721,9 +7724,9 @@ const fn = {
7721
7724
  };
7722
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 || {});
7723
7726
  function Fr(t) {
7724
- if (t.target === $.TEXTURE_2D)
7727
+ if (t.target === ee.TEXTURE_2D)
7725
7728
  return 1;
7726
- if (t.target === $.CUBE_MAP)
7729
+ if (t.target === ee.CUBE_MAP)
7727
7730
  return 2;
7728
7731
  }
7729
7732
  function Gr(t) {
@@ -7937,7 +7940,7 @@ class St {
7937
7940
  }), typeof r.endOperation == "function" && r.endOperation(e)) : console.warn(`No render queue found for layer ${e}`);
7938
7941
  }
7939
7942
  }
7940
- class Rt extends le {
7943
+ class Rt extends ce {
7941
7944
  constructor(e) {
7942
7945
  super(), this._renderQueue = e, this._delta = 0, this._modelMatrix = w.MakeIdentity(), this._matrixStack = [];
7943
7946
  }
@@ -7957,7 +7960,7 @@ class Rt extends le {
7957
7960
  this._modelMatrix = this._matrixStack[this._matrixStack.length - 1] || w.MakeIdentity(), this._matrixStack.pop();
7958
7961
  }
7959
7962
  }
7960
- class cn extends le {
7963
+ class cn extends ce {
7961
7964
  constructor(e) {
7962
7965
  super(), this._renderer = e;
7963
7966
  }
@@ -7965,7 +7968,7 @@ class cn extends le {
7965
7968
  Fi(e, this._renderer);
7966
7969
  }
7967
7970
  }
7968
- class gn extends le {
7971
+ class gn extends ce {
7969
7972
  constructor() {
7970
7973
  super();
7971
7974
  }
@@ -7973,7 +7976,7 @@ class gn extends le {
7973
7976
  await co(e);
7974
7977
  }
7975
7978
  }
7976
- class _ extends le {
7979
+ class $ extends ce {
7977
7980
  constructor(e) {
7978
7981
  super(), this._callbackName = e, this._event = null;
7979
7982
  }
@@ -7989,7 +7992,7 @@ class _ extends le {
7989
7992
  }
7990
7993
  class un {
7991
7994
  constructor(e) {
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;
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;
7993
7996
  }
7994
7997
  // Implement in subclasses
7995
7998
  get brightness() {
@@ -8063,7 +8066,7 @@ class un {
8063
8066
  draw({ clearBuffers: e = !0, drawSky: r = !0 } = {}) {
8064
8067
  if (!this._renderQueue || !this._shadowRenderer || !this._sceneRoot)
8065
8068
  throw new Error("SceneRenderer.draw(): SceneRenderer not initialized. Call SceneRenderer.init() first.");
8066
- const i = ge.GetMainDirectionalLight(this._sceneRoot), n = j.GetMain(this._sceneRoot);
8069
+ const i = he.GetMainDirectionalLight(this._sceneRoot), n = j.GetMain(this._sceneRoot);
8067
8070
  if (i && n) {
8068
8071
  const s = n.focusDistance, o = w.MakeOrtho(-s, s, -s, s, 0.1, 500);
8069
8072
  i.light.projection = o;
@@ -8657,7 +8660,7 @@ class g0 {
8657
8660
  }
8658
8661
  var mt = /* @__PURE__ */ ((t) => (t[t.OBJECT = 0] = "OBJECT", t[t.POLY_LIST = 1] = "POLY_LIST", t))(mt || {});
8659
8662
  const At = (t) => "" + t[0] + t[1] + t[2];
8660
- class u0 extends le {
8663
+ class u0 extends ce {
8661
8664
  constructor() {
8662
8665
  super(), this._r = 0, this._g = 0, this._b = 0, this._selectionMode = mt.POLY_LIST, this._elements = {};
8663
8666
  }
@@ -8997,7 +9000,7 @@ class w0 extends en {
8997
9000
  this._updateInputEventsFrameCount = e;
8998
9001
  }
8999
9002
  async loadScene() {
9000
- return new Ae("Scene Root");
9003
+ return new fe("Scene Root");
9001
9004
  }
9002
9005
  async loadEnvironment() {
9003
9006
  return null;
@@ -9141,10 +9144,10 @@ class En {
9141
9144
  }
9142
9145
  getLightTransform(e, r) {
9143
9146
  let i = null, n = null, s = null;
9144
- 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)
9145
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.");
9146
9149
  let o = null;
9147
- 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)
9148
9151
  throw Error("ShadowRenderer.getLightPosition(): invalid light. Light must be a Node or a LightComponent");
9149
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;
9150
9153
  P.scale(this._shadowMapRenderDistance);
@@ -9314,7 +9317,7 @@ const v0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIAEAIAAAArip/uAA
9314
9317
  }, p0 = async (t) => {
9315
9318
  if (!F.brdfIntegrationTexture[t.uniqueId]) {
9316
9319
  const e = new x();
9317
- 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 = {
9318
9321
  imageData: v0
9319
9322
  }, await e.loadImageData(), F.brdfIntegrationTexture[t.uniqueId] = e;
9320
9323
  }
@@ -9426,21 +9429,21 @@ class Hn extends hn {
9426
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 || {});
9427
9430
  const Xe = [], ke = [], we = {};
9428
9431
  let Wr = 0;
9429
- class he {
9432
+ class Ae {
9430
9433
  static Delete(e) {
9431
9434
  if (!e._buffer || !e._gl) return;
9432
9435
  const r = e._gl._bg2_id_, i = e._buffer._bg2e_id_;
9433
9436
  we[r]?.[i] && delete we[r][i], e._gl.deleteBuffer(e._buffer), e._buffer = null;
9434
9437
  }
9435
9438
  static CreateArrayBuffer(e, r, i = 0) {
9436
- const n = new he(e);
9439
+ const n = new Ae(e);
9437
9440
  return n.bind(
9438
9441
  0
9439
9442
  /* ARRAY_BUFFER */
9440
9443
  ), n.bufferData(0, r, i), n;
9441
9444
  }
9442
9445
  static CreateElementArrayBuffer(e, r, i = 0) {
9443
- const n = new he(e);
9446
+ const n = new Ae(e);
9444
9447
  return n.bind(
9445
9448
  1
9446
9449
  /* ELEMENT_ARRAY_BUFFER */
@@ -9508,9 +9511,9 @@ class Ln extends An {
9508
9511
  this._stride = 3;
9509
9512
  const s = 0, o = 3;
9510
9513
  let a = 3, f = 3, c = 3, d = 3, P = 3;
9511
- 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));
9512
9515
  const C = this.polyList.index.length < 65535 ? new Uint16Array(this.polyList.index) : new Uint32Array(this.polyList.index);
9513
- 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;
9514
9517
  }
9515
9518
  get hasNormal() {
9516
9519
  return this._polyList.normal.length > 0;
@@ -9599,7 +9602,7 @@ class Ln extends An {
9599
9602
  e.lineWidth(this.polyList.lineWidth), e.drawElements(i, this.polyList.index.length, this._indexArrayFormat || 0, 0);
9600
9603
  }
9601
9604
  destroy() {
9602
- 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);
9603
9606
  }
9604
9607
  }
9605
9608
  function b0(t, e) {
@@ -10532,9 +10535,9 @@ class jn {
10532
10535
  }
10533
10536
  const L0 = (t, e) => {
10534
10537
  switch (e.target) {
10535
- case $.TEXTURE_2D:
10538
+ case ee.TEXTURE_2D:
10536
10539
  return t.TEXTURE_2D;
10537
- case $.CUBE_MAP:
10540
+ case ee.CUBE_MAP:
10538
10541
  return t.TEXTURE_CUBE_MAP;
10539
10542
  default:
10540
10543
  throw new Error("Error creating WebGL Texture: invalid target");
@@ -10626,7 +10629,7 @@ const O0 = {
10626
10629
  SkySphere: Yn,
10627
10630
  State: jn,
10628
10631
  TextureRenderer: Kn,
10629
- VertexBuffer: he,
10632
+ VertexBuffer: Ae,
10630
10633
  BufferTarget: Se,
10631
10634
  BufferUsage: zn
10632
10635
  };
@@ -10666,7 +10669,7 @@ class Wn extends Et {
10666
10669
  throw window.WebGLDebugUtils.glEnumToString(a) + " was caused by call to: " + f;
10667
10670
  }, n = function(a, f) {
10668
10671
  if (console.log("gl." + a + "(" + window.WebGLDebugUtils.glFunctionArgsToString(a, f) + ")"), /drawElements/.test(a)) {
10669
- 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);
10670
10673
  o(c?.id, "ELEMENT_ARRAY_BUFFER"), o(d?.id, "ARRAY_BUFFER");
10671
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_}`);
10672
10675
  };
@@ -10769,7 +10772,7 @@ const U0 = {
10769
10772
  FrameVisitor: Rt,
10770
10773
  BindRendererVisitor: cn,
10771
10774
  InitVisitor: gn,
10772
- EventCallbackVisitor: _,
10775
+ EventCallbackVisitor: $,
10773
10776
  Shader: V,
10774
10777
  ShadowRenderer: En,
10775
10778
  SkyCube: Qn,