@voluma/vlam 0.3.0 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +2 -4
  2. package/dist/chunk-loader-DlNwggfG.js.map +1 -1
  3. package/dist/{index.d.ts → core/index.d.ts} +2 -2
  4. package/dist/{splat-budget.d.ts → core/splat-budget.d.ts} +1 -1
  5. package/dist/{splat-data.d.ts → core/splat-data.d.ts} +1 -1
  6. package/dist/{splat-mesh-types.d.ts → core/splat-mesh-types.d.ts} +5 -2
  7. package/dist/{effects.d.ts → effects/index.d.ts} +3 -3
  8. package/dist/effects.js.map +1 -1
  9. package/dist/formats/ksplat/parse-ksplat.d.ts +1 -1
  10. package/dist/formats/ksplat.js.map +1 -1
  11. package/dist/formats/lcc/collision-mesh.d.ts +2 -2
  12. package/dist/formats/lcc/collision-partition.d.ts +1 -1
  13. package/dist/formats/lcc/lcc.d.ts +3 -3
  14. package/dist/formats/lcc/lcc2.d.ts +2 -2
  15. package/dist/formats/lcc/parse-lcc.d.ts +1 -1
  16. package/dist/formats/lcc.js +276 -277
  17. package/dist/formats/lcc.js.map +1 -1
  18. package/dist/formats/ply/parse-compressed-ply.d.ts +2 -2
  19. package/dist/formats/ply/parse-splat-ply.d.ts +2 -2
  20. package/dist/formats/ply.js.map +1 -1
  21. package/dist/formats/rad/frontier-worker-protocol.d.ts +8 -1
  22. package/dist/formats/rad/index.d.ts +2 -2
  23. package/dist/formats/rad/parse-rad.d.ts +2 -2
  24. package/dist/formats/rad/rad-foveated-source.d.ts +3 -3
  25. package/dist/formats/rad/rad.d.ts +5 -5
  26. package/dist/formats/rad.js.map +1 -1
  27. package/dist/formats/sog/parse-sog.d.ts +2 -2
  28. package/dist/formats/sog.js.map +1 -1
  29. package/dist/formats/splat/parse-splat.d.ts +1 -1
  30. package/dist/formats/splat.js.map +1 -1
  31. package/dist/formats/spz/parse-spz.d.ts +1 -1
  32. package/dist/formats/spz.js.map +1 -1
  33. package/dist/half-float-Cs4FDq8Q.js.map +1 -1
  34. package/dist/index.js +3 -3
  35. package/dist/index.js.map +1 -1
  36. package/dist/{chunk-loader.d.ts → loaders/chunk-loader.d.ts} +2 -2
  37. package/dist/{load-splat-data.d.ts → loaders/load-splat-data.d.ts} +1 -1
  38. package/dist/{load-worker-protocol.d.ts → loaders/load-worker-protocol.d.ts} +2 -2
  39. package/dist/loaders.js.map +1 -1
  40. package/dist/loading-wLo8vRbA.js.map +1 -1
  41. package/dist/lod-scheduler-ChoZyEeq.js +466 -0
  42. package/dist/lod-scheduler-ChoZyEeq.js.map +1 -0
  43. package/dist/logging-BfPdd7NJ.js.map +1 -1
  44. package/dist/ply-header-B9WllbPg.js.map +1 -1
  45. package/dist/{radix-sorter-R0FCSqKu.js → radix-sorter-BrbUg_CV.js} +2 -2
  46. package/dist/radix-sorter-BrbUg_CV.js.map +1 -0
  47. package/dist/{relighting-CSQF3UcL.js → relighting-Tiwep8yd.js} +302 -294
  48. package/dist/relighting-Tiwep8yd.js.map +1 -0
  49. package/dist/{selection-volume.d.ts → selection/selection-volume.d.ts} +1 -1
  50. package/dist/{splat-partition.d.ts → selection/splat-partition.d.ts} +1 -1
  51. package/dist/selection.js.map +1 -1
  52. package/dist/sh-pack-D5wAe5gg.js.map +1 -1
  53. package/dist/splat-budget-DuVZspPQ.js.map +1 -1
  54. package/dist/splat-data-BZM5dhhx.js.map +1 -1
  55. package/dist/{splat-mesh-aQdcWA6v.js → splat-mesh-CsLOQb08.js} +3 -3
  56. package/dist/splat-mesh-CsLOQb08.js.map +1 -0
  57. package/dist/splat-mesh-types-BZIko-_9.js.map +1 -1
  58. package/dist/{static-lod-splat-mesh.d.ts → static-lod/static-lod-splat-mesh.d.ts} +2 -2
  59. package/dist/{static-lod-worker-protocol.d.ts → static-lod/static-lod-worker-protocol.d.ts} +1 -1
  60. package/dist/{static-lod.d.ts → static-lod/static-lod.d.ts} +1 -1
  61. package/dist/static-lod.js +1 -1
  62. package/dist/static-lod.js.map +1 -1
  63. package/dist/{dataset-source.d.ts → streaming/dataset-source.d.ts} +1 -1
  64. package/dist/{streaming.d.ts → streaming/index.d.ts} +3 -3
  65. package/dist/{lod-scheduler.d.ts → streaming/lod-scheduler.d.ts} +32 -0
  66. package/dist/{lod-source.d.ts → streaming/lod-source.d.ts} +19 -13
  67. package/dist/{streamed-splat-mesh-utils.d.ts → streaming/streamed-splat-mesh-utils.d.ts} +2 -2
  68. package/dist/{streamed-splat-mesh.d.ts → streaming/streamed-splat-mesh.d.ts} +83 -27
  69. package/dist/streaming.js +711 -645
  70. package/dist/streaming.js.map +1 -1
  71. package/dist/{unified-splat-mesh.d.ts → unified/unified-splat-mesh.d.ts} +13 -6
  72. package/dist/{work-buffer-gather.d.ts → unified/work-buffer-gather.d.ts} +5 -5
  73. package/dist/{work-buffer-material.d.ts → unified/work-buffer-material.d.ts} +1 -1
  74. package/dist/unified.js +280 -272
  75. package/dist/unified.js.map +1 -1
  76. package/dist/webgpu-limits-Y3CI_6_6.js.map +1 -1
  77. package/package.json +9 -9
  78. package/dist/lod-scheduler-B0a_uBlv.js +0 -383
  79. package/dist/lod-scheduler-B0a_uBlv.js.map +0 -1
  80. package/dist/radix-sorter-R0FCSqKu.js.map +0 -1
  81. package/dist/relighting-CSQF3UcL.js.map +0 -1
  82. package/dist/splat-mesh-aQdcWA6v.js.map +0 -1
  83. /package/dist/{compute-sorter.d.ts → core/compute-sorter.d.ts} +0 -0
  84. /package/dist/{create-splat-renderer.d.ts → core/create-splat-renderer.d.ts} +0 -0
  85. /package/dist/{depth-of-field.d.ts → core/depth-of-field.d.ts} +0 -0
  86. /package/dist/{half-float.d.ts → core/half-float.d.ts} +0 -0
  87. /package/dist/{logging.d.ts → core/logging.d.ts} +0 -0
  88. /package/dist/{merged-splat-mesh.d.ts → core/merged-splat-mesh.d.ts} +0 -0
  89. /package/dist/{orientation.d.ts → core/orientation.d.ts} +0 -0
  90. /package/dist/{radix-sort.d.ts → core/radix-sort.d.ts} +0 -0
  91. /package/dist/{radix-sorter.d.ts → core/radix-sorter.d.ts} +0 -0
  92. /package/dist/{relighting-pass.d.ts → core/relighting-pass.d.ts} +0 -0
  93. /package/dist/{relighting.d.ts → core/relighting.d.ts} +0 -0
  94. /package/dist/{sh-pack.d.ts → core/sh-pack.d.ts} +0 -0
  95. /package/dist/{sort-scheduler.d.ts → core/sort-scheduler.d.ts} +0 -0
  96. /package/dist/{sort-worker-protocol.d.ts → core/sort-worker-protocol.d.ts} +0 -0
  97. /package/dist/{sorter.d.ts → core/sorter.d.ts} +0 -0
  98. /package/dist/{source-transform.d.ts → core/source-transform.d.ts} +0 -0
  99. /package/dist/{splat-depth-pack.d.ts → core/splat-depth-pack.d.ts} +0 -0
  100. /package/dist/{splat-mesh-material.d.ts → core/splat-mesh-material.d.ts} +0 -0
  101. /package/dist/{splat-mesh-picking.d.ts → core/splat-mesh-picking.d.ts} +0 -0
  102. /package/dist/{splat-mesh-pool.d.ts → core/splat-mesh-pool.d.ts} +0 -0
  103. /package/dist/{splat-mesh.d.ts → core/splat-mesh.d.ts} +0 -0
  104. /package/dist/{splat-modifier-stack.d.ts → core/splat-modifier-stack.d.ts} +0 -0
  105. /package/dist/{splat-modifier.d.ts → core/splat-modifier.d.ts} +0 -0
  106. /package/dist/{splat-query.d.ts → core/splat-query.d.ts} +0 -0
  107. /package/dist/{splat-sort-bounds.d.ts → core/splat-sort-bounds.d.ts} +0 -0
  108. /package/dist/{storage-attribute-mirror.d.ts → core/storage-attribute-mirror.d.ts} +0 -0
  109. /package/dist/{webgpu-limits.d.ts → core/webgpu-limits.d.ts} +0 -0
  110. /package/dist/{worker-sorter.d.ts → core/worker-sorter.d.ts} +0 -0
  111. /package/dist/{xr-view.d.ts → core/xr-view.d.ts} +0 -0
  112. /package/dist/{loaders.d.ts → loaders/index.d.ts} +0 -0
  113. /package/dist/{loading.d.ts → loaders/loading.d.ts} +0 -0
  114. /package/dist/{ply-header.d.ts → loaders/ply-header.d.ts} +0 -0
  115. /package/dist/{selection.d.ts → selection/index.d.ts} +0 -0
  116. /package/dist/{static-lod-entry.d.ts → static-lod/index.d.ts} +0 -0
  117. /package/dist/{budget-governor.d.ts → streaming/budget-governor.d.ts} +0 -0
  118. /package/dist/{camera-budget-governor.d.ts → streaming/camera-budget-governor.d.ts} +0 -0
  119. /package/dist/{chunk-cache-budget.d.ts → streaming/chunk-cache-budget.d.ts} +0 -0
  120. /package/dist/{chunk-fetch-scheduler.d.ts → streaming/chunk-fetch-scheduler.d.ts} +0 -0
  121. /package/dist/{lod-manifest.d.ts → streaming/lod-manifest.d.ts} +0 -0
  122. /package/dist/{unified.d.ts → unified/index.d.ts} +0 -0
  123. /package/dist/{unified-work-buffer.d.ts → unified/unified-work-buffer.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
- var St = Object.defineProperty;
2
- var Tt = (s, e, t) => e in s ? St(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var l = (s, e, t) => Tt(s, typeof e != "symbol" ? e + "" : e, t);
1
+ var Tt = Object.defineProperty;
2
+ var yt = (s, e, t) => e in s ? Tt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var l = (s, e, t) => yt(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  import * as h from "three/webgpu";
5
- import { bool as yt, mat3 as Te, vec3 as S, float as v, modelViewMatrix as $e, vec4 as K, modelWorldMatrix as At, int as L, attribute as Mt, ivec2 as je, textureLoad as O, varying as he, colorSpaceToWorking as Ct, positionGeometry as _e, Fn as G, cameraProjectionMatrix as Pt, If as pe, mix as oe, vec2 as J, Discard as Ne, texture as ve, screenUV as Se, uniform as fe, uint as C, storage as ne, atomicStore as qe, instanceIndex as E, atomicAdd as rt, Loop as We, atomicLoad as it } from "three/tsl";
6
- import { w as kt } from "./logging-BfPdd7NJ.js";
7
- function Rt(s, e, t) {
5
+ import { bool as At, mat3 as ye, vec3 as S, float as w, modelViewMatrix as je, vec4 as Q, modelWorldMatrix as Mt, int as N, attribute as Ct, ivec2 as He, textureLoad as _, varying as re, colorSpaceToWorking as Pt, positionGeometry as Ne, Fn as $, cameraProjectionMatrix as kt, If as be, mix as ce, vec2 as te, Discard as qe, texture as Se, screenUV as Te, uniform as xe, uint as P, storage as ie, atomicStore as We, instanceIndex as I, atomicAdd as it, Loop as Ge, atomicLoad as ct } from "three/tsl";
6
+ import { w as Rt } from "./logging-BfPdd7NJ.js";
7
+ function Bt(s, e, t) {
8
8
  if (s.length === 0)
9
9
  return {
10
10
  color: t.color,
@@ -19,9 +19,9 @@ function Rt(s, e, t) {
19
19
  const o = e, a = {
20
20
  color: t.color,
21
21
  offset: S(0, 0, 0),
22
- scale: v(1),
23
- rotation: Te(S(1, 0, 0), S(0, 1, 0), S(0, 0, 1)),
24
- visible: yt(!0)
22
+ scale: w(1),
23
+ rotation: ye(S(1, 0, 0), S(0, 1, 0), S(0, 0, 1)),
24
+ visible: At(!0)
25
25
  }, n = { offset: !1, scale: !1, rotation: !1, visible: !1 };
26
26
  let r = null, i = null, d = null, c = null, T = null, D = null;
27
27
  const y = /* @__PURE__ */ new Map(), q = {
@@ -32,17 +32,17 @@ function Rt(s, e, t) {
32
32
  cameraLocal: o,
33
33
  baseColor: t.color,
34
34
  get worldCenter() {
35
- return c ?? (c = t.makeWorldCenter ? t.makeWorldCenter() : At.mul(K(t.localCenter, 1)).xyz);
35
+ return c ?? (c = t.makeWorldCenter ? t.makeWorldCenter() : Mt.mul(Q(t.localCenter, 1)).xyz);
36
36
  },
37
37
  get viewCenter() {
38
- return T ?? (T = t.makeViewCenter ? t.makeViewCenter() : $e.mul(K(t.localCenter, 1)).xyz);
38
+ return T ?? (T = t.makeViewCenter ? t.makeViewCenter() : je.mul(Q(t.localCenter, 1)).xyz);
39
39
  },
40
40
  get normal() {
41
41
  return D ?? (D = t.makeNormal());
42
42
  },
43
- channel(M) {
44
- let m = y.get(M);
45
- return m || (m = t.makeChannel(M), y.set(M, m)), m;
43
+ channel(C) {
44
+ let m = y.get(C);
45
+ return m || (m = t.makeChannel(C), y.set(C, m)), m;
46
46
  },
47
47
  get color() {
48
48
  return a.color;
@@ -60,8 +60,8 @@ function Rt(s, e, t) {
60
60
  return a.visible;
61
61
  }
62
62
  };
63
- for (const M of s) {
64
- const m = M(q);
63
+ for (const C of s) {
64
+ const m = C(q);
65
65
  m.color && (a.color = m.color), m.offset && (a.offset = m.offset, n.offset = !0), m.scale && (a.scale = m.scale, n.scale = !0), m.rotation && (a.rotation = m.rotation, n.rotation = !0), m.visible && (a.visible = m.visible, n.visible = !0), m.isotropicCovarianceMix !== void 0 && (r = m.isotropicCovarianceMix), m.isotropicVarianceScale !== void 0 && (i = m.isotropicVarianceScale), m.isotropicScreenRadiusPx !== void 0 && (d = m.isotropicScreenRadiusPx);
66
66
  }
67
67
  return {
@@ -75,8 +75,8 @@ function Rt(s, e, t) {
75
75
  isotropicScreenRadiusPx: d
76
76
  };
77
77
  }
78
- const De = 2048;
79
- function Bt(s, e, t) {
78
+ const Fe = 2048;
79
+ function Et(s, e, t) {
80
80
  let o = -1;
81
81
  for (let a = 0; a < s.length; a++) {
82
82
  const n = s[a];
@@ -88,7 +88,7 @@ function Bt(s, e, t) {
88
88
  return a.start += e, a.count -= e, a.count === 0 && s.splice(o, 1), n;
89
89
  }
90
90
  throw new Error(
91
- `SplatMesh capacity exceeded: no contiguous space for ${e} rows (${De} splats each) in a ${t}-row pool.`
91
+ `SplatMesh capacity exceeded: no contiguous space for ${e} rows (${Fe} splats each) in a ${t}-row pool.`
92
92
  );
93
93
  }
94
94
  function It(s, e, t) {
@@ -104,9 +104,9 @@ function It(s, e, t) {
104
104
  }
105
105
  return o;
106
106
  }
107
- class is {
107
+ class cs {
108
108
  constructor(e) {
109
- l(this, "width", De);
109
+ l(this, "width", Fe);
110
110
  l(this, "rows");
111
111
  l(this, "floatTextures");
112
112
  l(this, "packedShBands");
@@ -134,7 +134,7 @@ class is {
134
134
  l(this, "activeSlotByPoolIndex");
135
135
  l(this, "poolIndexTemplate", null);
136
136
  if (!(e.capacity > 0)) throw new Error("SplatPool capacity must be positive.");
137
- this.rows = Math.ceil(e.capacity / this.width), Dt(this.rows, e.maxTextureSize ?? 0, this.width);
137
+ this.rows = Math.ceil(e.capacity / this.width), Ft(this.rows, e.maxTextureSize ?? 0, this.width);
138
138
  const t = this.width * this.rows;
139
139
  this.floatTextures = e.floatTextures === "float16" ? "float16" : "float32", this.packedShBands = e.packedShBands ?? 0;
140
140
  const o = this.floatTextures === "float16" ? h.HalfFloatType : h.FloatType;
@@ -152,18 +152,18 @@ class is {
152
152
  )
153
153
  };
154
154
  const a = this.floatTextures === "float16" ? new Uint16Array(t * 4) : this.backing.centers, n = this.floatTextures === "float16" ? new Uint16Array(t * 4) : this.backing.covarianceA;
155
- this.centersTexture = Ee(a, this.width, this.rows, o), this.colorsTexture = Ee(
155
+ this.centersTexture = De(a, this.width, this.rows, o), this.colorsTexture = De(
156
156
  this.backing.colors,
157
157
  this.width,
158
158
  this.rows,
159
159
  h.UnsignedByteType
160
- ), this.covarianceATexture = Ee(n, this.width, this.rows, o), this.covarianceBTexture = Ee(
160
+ ), this.covarianceATexture = De(n, this.width, this.rows, o), this.covarianceBTexture = De(
161
161
  this.backing.covarianceB,
162
162
  this.width,
163
163
  this.rows,
164
164
  h.FloatType
165
165
  ), this.shPackedTextures = this.backing.shPacked.map(
166
- (r) => Et(r, this.width, this.rows)
166
+ (r) => Dt(r, this.width, this.rows)
167
167
  ), this.freeRowSpans = [{ start: 0, count: this.rows }], this.activeSlotByPoolIndex = new Uint32Array(t);
168
168
  }
169
169
  /**
@@ -202,7 +202,7 @@ class is {
202
202
  }
203
203
  /** Takes `rowCount` contiguous rows; throws when none are left (compact cue). */
204
204
  allocateRows(e) {
205
- return Bt(this.freeRowSpans, e, this.rows);
205
+ return Et(this.freeRowSpans, e, this.rows);
206
206
  }
207
207
  /** Returns rows to the free list, coalescing neighbours. */
208
208
  releaseRows(e, t) {
@@ -278,11 +278,11 @@ class is {
278
278
  this.tenants.clear();
279
279
  }
280
280
  }
281
- function Ee(s, e, t, o) {
281
+ function De(s, e, t, o) {
282
282
  const a = new h.DataTexture(s, e, t, h.RGBAFormat, o);
283
283
  return a.needsUpdate = !0, a;
284
284
  }
285
- function Et(s, e, t) {
285
+ function Dt(s, e, t) {
286
286
  const o = new h.DataTexture(
287
287
  s,
288
288
  e,
@@ -292,7 +292,7 @@ function Et(s, e, t) {
292
292
  );
293
293
  return o.magFilter = h.NearestFilter, o.minFilter = h.NearestFilter, o.generateMipmaps = !1, o.needsUpdate = !0, o;
294
294
  }
295
- function cs(s) {
295
+ function ls(s) {
296
296
  var a, n;
297
297
  const e = s.backend, t = (n = (a = e == null ? void 0 : e.device) == null ? void 0 : a.limits) == null ? void 0 : n.maxTextureDimension2D;
298
298
  if (typeof t == "number" && t > 0) return t;
@@ -303,13 +303,13 @@ function cs(s) {
303
303
  }
304
304
  return 0;
305
305
  }
306
- function Dt(s, e, t = De) {
306
+ function Ft(s, e, t = Fe) {
307
307
  if (!(!(e > 0) || s <= e))
308
308
  throw new Error(
309
309
  `SplatPool: this scene needs a ${t}×${s} data texture, but this device caps texture dimensions at ${e} (about ${(e * t).toLocaleString("en-US")} pool splats). Lower the splat budget, or raise maxTextureDimension2D in the renderer's requiredLimits if the adapter advertises more.`
310
310
  );
311
311
  }
312
- function ls(s, e, t) {
312
+ function us(s, e, t) {
313
313
  let o = e, a = e + t;
314
314
  const n = [];
315
315
  for (const r of s.updateRanges) {
@@ -323,82 +323,82 @@ function ls(s, e, t) {
323
323
  n.push({ start: o, count: a - o }), n.sort((r, i) => r.start - i.start), s.clearUpdateRanges();
324
324
  for (const r of n) s.addUpdateRange(r.start, r.count);
325
325
  }
326
- const ct = 24, dt = ct * ct;
327
- function Ft(s, e) {
326
+ const lt = 24, mt = lt * lt;
327
+ function zt(s, e) {
328
328
  const t = Math.max(0, s);
329
329
  if (t <= 0) return 0;
330
330
  const o = Math.max(1e-4, e);
331
331
  return 2 * Math.atan(0.5 * t / o);
332
332
  }
333
- function us(s) {
334
- const e = Math.max(1e-4, s.depth), t = Math.max(1e-4, s.focusDistance), o = Ft(s.aperture, t);
333
+ function ds(s) {
334
+ const e = Math.max(1e-4, s.depth), t = Math.max(1e-4, s.focusDistance), o = zt(s.aperture, t);
335
335
  if (o <= 0 || !(s.focalPx > 0)) return 0;
336
- const a = Math.abs(e - t) / e, n = s.focalPx * Math.tan(0.5 * o), r = a * n, i = r * r, d = s.maxVariance ?? dt;
336
+ const a = Math.abs(e - t) / e, n = s.focalPx * Math.tan(0.5 * o), r = a * n, i = r * r, d = s.maxVariance ?? mt;
337
337
  return Math.min(i, d);
338
338
  }
339
- function ds(s, e) {
339
+ function ms(s, e) {
340
340
  return Math.sqrt(Math.max(0, s) / Math.max(1e-9, e));
341
341
  }
342
- function ms(s, e = { focusDistance: 10, aperture: 0 }) {
342
+ function hs(s, e = { focusDistance: 10, aperture: 0 }) {
343
343
  const t = typeof s.focusDistance == "number" && Number.isFinite(s.focusDistance) ? Math.max(1e-4, s.focusDistance) : e.focusDistance, o = typeof s.aperture == "number" && Number.isFinite(s.aperture) ? Math.max(0, s.aperture) : e.aperture;
344
344
  return { focusDistance: t, aperture: o };
345
345
  }
346
- const lt = 1024, zt = 1e30, Ut = 0.35 * 0.35;
347
- function Vt(s, e, t, o) {
348
- const a = S(1, 0, 0), n = S(0, 1, 0), r = S(0, 0, 1), i = s.mul(a), d = s.mul(n), c = s.mul(r), T = i.x, D = d.y, y = c.z, q = i.cross(d), M = d.cross(c), m = c.cross(i), w = q.length(), V = M.length(), X = m.length(), xe = w.greaterThanEqual(V).and(w.greaterThanEqual(X)), ae = V.greaterThan(w).and(V.greaterThanEqual(X)), re = xe.select(q, ae.select(M, m)), u = re.div(re.length().max(1e-12)), x = u.dot(s.mul(u)), F = T.min(D).min(y).min(x).max(1e-12).mul(o), $ = Te(S(F, 0, 0), S(0, F, 0), S(0, 0, F));
349
- return s.mul(v(1).sub(t)).add($.mul(t));
346
+ const ut = 1024, Ut = 1e30, Vt = 0.35 * 0.35;
347
+ function Ot(s, e, t, o) {
348
+ const a = S(1, 0, 0), n = S(0, 1, 0), r = S(0, 0, 1), i = s.mul(a), d = s.mul(n), c = s.mul(r), T = i.x, D = d.y, y = c.z, q = i.cross(d), C = d.cross(c), m = c.cross(i), v = q.length(), L = C.length(), J = m.length(), le = v.greaterThanEqual(L).and(v.greaterThanEqual(J)), ue = L.greaterThan(v).and(L.greaterThanEqual(J)), de = le.select(q, ue.select(C, m)), u = de.div(de.length().max(1e-12)), x = u.dot(s.mul(u)), F = T.min(D).min(y).min(x).max(1e-12).mul(o), j = ye(S(F, 0, 0), S(0, F, 0), S(0, 0, F));
349
+ return s.mul(w(1).sub(t)).add(j.mul(t));
350
350
  }
351
- function Ot(s, e, t) {
351
+ function Lt(s, e, t) {
352
352
  const o = s.min(e);
353
353
  return {
354
- lambda1: oe(s, o, t),
355
- lambda2: oe(e, o, t)
354
+ lambda1: ce(s, o, t),
355
+ lambda2: ce(e, o, t)
356
356
  };
357
357
  }
358
- function Lt(s, e, t, o, a) {
359
- const n = o.div(a).pow(2), r = s.min(e).min(n), i = oe(s, r, t), d = oe(e, r, t), c = o.greaterThan(0);
358
+ function _t(s, e, t, o, a) {
359
+ const n = o.div(a).pow(2), r = s.min(e).min(n), i = ce(s, r, t), d = ce(e, r, t), c = o.greaterThan(0);
360
360
  return {
361
361
  lambda1: c.select(i, s),
362
362
  lambda2: c.select(d, e)
363
363
  };
364
364
  }
365
- function hs(s) {
365
+ function fs(s) {
366
366
  return s;
367
367
  }
368
- function fs() {
369
- return fe(new h.Vector3());
368
+ function ps() {
369
+ return xe(new h.Vector3());
370
370
  }
371
- function mt(s, e, t) {
372
- const o = e.mul(L(4)), a = s.element(o), n = s.element(o.add(L(1))), r = s.element(o.add(L(2))), i = s.element(o.add(L(3))), d = a.xyz.mul(t.x).add(n.xyz.mul(t.y)).add(r.xyz.mul(t.z)).add(i.xyz), c = Te(a.xyz, n.xyz, r.xyz);
371
+ function ht(s, e, t) {
372
+ const o = e.mul(N(4)), a = s.element(o), n = s.element(o.add(N(1))), r = s.element(o.add(N(2))), i = s.element(o.add(N(3))), d = a.xyz.mul(t.x).add(n.xyz.mul(t.y)).add(r.xyz.mul(t.z)).add(i.xyz), c = ye(a.xyz, n.xyz, r.xyz);
373
373
  return { worldCenter: d, linear: c };
374
374
  }
375
- function _t(s) {
375
+ function Nt(s) {
376
376
  return [0, 3, 8, 15][s] ?? 0;
377
377
  }
378
- function ht(s, e, t) {
378
+ function ft(s, e, t) {
379
379
  if (s.mode === "palette") {
380
- const n = O(e.covarianceBTexture, t).z.toInt(), r = n.mod(L(64)).mul(L(_t(s.bands))), i = n.div(L(64));
381
- return (d) => O(s.paletteTexture, je(r.add(L(d)), i)).xyz;
380
+ const n = _(e.covarianceBTexture, t).z.toInt(), r = n.mod(N(64)).mul(N(Nt(s.bands))), i = n.div(N(64));
381
+ return (d) => _(s.paletteTexture, He(r.add(N(d)), i)).xyz;
382
382
  }
383
383
  const o = s.textures.map(
384
- (n) => O(n, t).toVar()
384
+ (n) => _(n, t).toVar()
385
385
  ), a = s.range.max.sub(s.range.min);
386
386
  return (n) => {
387
387
  const r = o[n >> 2], i = [r.x, r.y, r.z, r.w][n & 3], d = S(
388
- i.bitAnd(C(2047)).toFloat().div(2047),
389
- i.shiftRight(C(11)).bitAnd(C(1023)).toFloat().div(1023),
390
- i.shiftRight(C(21)).bitAnd(C(2047)).toFloat().div(2047)
388
+ i.bitAnd(P(2047)).toFloat().div(2047),
389
+ i.shiftRight(P(11)).bitAnd(P(1023)).toFloat().div(1023),
390
+ i.shiftRight(P(21)).bitAnd(P(2047)).toFloat().div(2047)
391
391
  );
392
392
  return s.range.min.add(a.mul(d));
393
393
  };
394
394
  }
395
- const ge = 0.4886025119029199, H = [
395
+ const we = 0.4886025119029199, X = [
396
396
  1.0925484305920792,
397
397
  -1.0925484305920792,
398
398
  0.31539156525252005,
399
399
  -1.0925484305920792,
400
400
  0.5462742152960396
401
- ], U = [
401
+ ], O = [
402
402
  -0.5900435899266435,
403
403
  2.890611442640554,
404
404
  -0.4570457994644658,
@@ -407,189 +407,197 @@ const ge = 0.4886025119029199, H = [
407
407
  1.445305721320277,
408
408
  -0.5900435899266435
409
409
  ];
410
- function ps(s, e, t, o) {
411
- const a = o.x, n = o.y, r = o.z, i = ht(s, e, t), d = i(0).mul(n.mul(-ge)).add(i(1).mul(r.mul(ge))).add(i(2).mul(a.mul(-ge)));
410
+ function gs(s, e, t, o) {
411
+ const a = o.x, n = o.y, r = o.z, i = ft(s, e, t), d = i(0).mul(n.mul(-we)).add(i(1).mul(r.mul(we))).add(i(2).mul(a.mul(-we)));
412
412
  if (s.bands === 1) return d;
413
- const c = a.mul(a), T = n.mul(n), D = r.mul(r), y = d.add(i(3).mul(a.mul(n).mul(H[0]))).add(i(4).mul(n.mul(r).mul(H[1]))).add(i(5).mul(D.mul(2).sub(c).sub(T).mul(H[2]))).add(i(6).mul(a.mul(r).mul(H[3]))).add(i(7).mul(c.sub(T).mul(H[4])));
414
- return s.bands === 2 ? y : y.add(i(8).mul(n.mul(c.mul(3).sub(T)).mul(U[0]))).add(i(9).mul(a.mul(n).mul(r).mul(U[1]))).add(i(10).mul(n.mul(D.mul(4).sub(c).sub(T)).mul(U[2]))).add(i(11).mul(r.mul(D.mul(2).sub(c.mul(3)).sub(T.mul(3))).mul(U[3]))).add(i(12).mul(a.mul(D.mul(4).sub(c).sub(T)).mul(U[4]))).add(i(13).mul(r.mul(c.sub(T)).mul(U[5]))).add(i(14).mul(a.mul(c.sub(T.mul(3))).mul(U[6])));
413
+ const c = a.mul(a), T = n.mul(n), D = r.mul(r), y = d.add(i(3).mul(a.mul(n).mul(X[0]))).add(i(4).mul(n.mul(r).mul(X[1]))).add(i(5).mul(D.mul(2).sub(c).sub(T).mul(X[2]))).add(i(6).mul(a.mul(r).mul(X[3]))).add(i(7).mul(c.sub(T).mul(X[4])));
414
+ return s.bands === 2 ? y : y.add(i(8).mul(n.mul(c.mul(3).sub(T)).mul(O[0]))).add(i(9).mul(a.mul(n).mul(r).mul(O[1]))).add(i(10).mul(n.mul(D.mul(4).sub(c).sub(T)).mul(O[2]))).add(i(11).mul(r.mul(D.mul(2).sub(c.mul(3)).sub(T.mul(3))).mul(O[3]))).add(i(12).mul(a.mul(D.mul(4).sub(c).sub(T)).mul(O[4]))).add(i(13).mul(r.mul(c.sub(T)).mul(O[5]))).add(i(14).mul(a.mul(c.sub(T.mul(3))).mul(O[6])));
415
415
  }
416
- function gs(s, e, t) {
417
- const { textures: o, sh: a, uniforms: n, settings: r, pick: i } = t, d = L(De), c = v(lt), T = -0.5 * r.maxStdDev * r.maxStdDev, D = Mt("splatIndex", "float").toInt(), y = je(D.mod(d), D.div(d)), q = O(o.colorsTexture, y), M = O(o.centersTexture, y).xyz, m = t.sourcePlacement, w = m ? mt(
416
+ function xs(s, e, t) {
417
+ const { textures: o, sh: a, uniforms: n, settings: r, pick: i } = t, d = N(Fe), c = w(ut), T = -0.5 * r.maxStdDev * r.maxStdDev, D = Ct("splatIndex", "float").toInt(), y = He(D.mod(d), D.div(d)), q = _(o.colorsTexture, y), C = _(o.centersTexture, y).xyz, m = t.sourcePlacement, v = m ? ht(
418
418
  m.columns,
419
- O(m.sourceIdTexture, y).r.toInt(),
420
- M
421
- ) : null, V = w ? w.worldCenter : M, X = a === null ? null : (() => {
422
- const b = w ? w.linear.inverse().mul(V.sub(n.localCameraPosition)).normalize() : V.sub(n.localCameraPosition).normalize(), f = b.x, g = b.y, B = b.z, p = ht(a, o, y), z = p(0).mul(g.mul(-ge)).add(p(1).mul(B.mul(ge))).add(p(2).mul(f.mul(-ge)));
423
- if (a.bands === 1) return z;
424
- const A = f.mul(f), I = g.mul(g), P = B.mul(B), _ = z.add(p(3).mul(f.mul(g).mul(H[0]))).add(p(4).mul(g.mul(B).mul(H[1]))).add(p(5).mul(P.mul(2).sub(A).sub(I).mul(H[2]))).add(p(6).mul(f.mul(B).mul(H[3]))).add(p(7).mul(A.sub(I).mul(H[4])));
425
- return a.bands === 2 ? _ : _.add(p(8).mul(g.mul(A.mul(3).sub(I)).mul(U[0]))).add(p(9).mul(f.mul(g).mul(B).mul(U[1]))).add(p(10).mul(g.mul(P.mul(4).sub(A).sub(I)).mul(U[2]))).add(
419
+ _(m.sourceIdTexture, y).r.toInt(),
420
+ C
421
+ ) : null, L = v ? v.worldCenter : C, J = a === null ? null : (() => {
422
+ const b = v ? v.linear.inverse().mul(L.sub(n.localCameraPosition)).normalize() : L.sub(n.localCameraPosition).normalize(), f = b.x, g = b.y, B = b.z, p = ft(a, o, y), U = p(0).mul(g.mul(-we)).add(p(1).mul(B.mul(we))).add(p(2).mul(f.mul(-we)));
423
+ if (a.bands === 1) return U;
424
+ const A = f.mul(f), E = g.mul(g), M = B.mul(B), z = U.add(p(3).mul(f.mul(g).mul(X[0]))).add(p(4).mul(g.mul(B).mul(X[1]))).add(p(5).mul(M.mul(2).sub(A).sub(E).mul(X[2]))).add(p(6).mul(f.mul(B).mul(X[3]))).add(p(7).mul(A.sub(E).mul(X[4])));
425
+ return a.bands === 2 ? z : z.add(p(8).mul(g.mul(A.mul(3).sub(E)).mul(O[0]))).add(p(9).mul(f.mul(g).mul(B).mul(O[1]))).add(p(10).mul(g.mul(M.mul(4).sub(A).sub(E)).mul(O[2]))).add(
426
426
  p(11).mul(
427
- B.mul(P.mul(2).sub(A.mul(3)).sub(I.mul(3))).mul(U[3])
427
+ B.mul(M.mul(2).sub(A.mul(3)).sub(E.mul(3))).mul(O[3])
428
428
  )
429
- ).add(p(12).mul(f.mul(P.mul(4).sub(A).sub(I)).mul(U[4]))).add(p(13).mul(B.mul(A.sub(I)).mul(U[5]))).add(p(14).mul(f.mul(A.sub(I.mul(3))).mul(U[6])));
430
- })(), xe = X === null ? q : K(q.rgb.add(X).clamp(0, 1), q.a), ae = () => {
431
- const b = O(o.covarianceATexture, y), f = O(o.covarianceBTexture, y), g = Te(
429
+ ).add(p(12).mul(f.mul(M.mul(4).sub(A).sub(E)).mul(O[4]))).add(p(13).mul(B.mul(A.sub(E)).mul(O[5]))).add(p(14).mul(f.mul(A.sub(E.mul(3))).mul(O[6])));
430
+ })(), le = J === null ? q : Q(q.rgb.add(J).clamp(0, 1), q.a), ue = () => {
431
+ const b = _(o.covarianceATexture, y), f = _(o.covarianceBTexture, y), g = ye(
432
432
  S(b.x.add(1e-8), b.y, b.z),
433
433
  S(b.y, b.w.add(1e-8), f.x),
434
434
  S(b.z, f.x, f.y.add(1e-8))
435
- ), p = (w ? w.linear.mul(g).mul(w.linear.transpose()) : g).inverse(), z = n.localCameraPosition.sub(V), A = p.mul(p.mul(z)).normalize();
436
- return A.mul(A.dot(z).sign());
437
- }, re = (b) => {
435
+ ), p = (v ? v.linear.mul(g).mul(v.linear.transpose()) : g).inverse(), U = n.localCameraPosition.sub(L), A = p.mul(p.mul(U)).normalize();
436
+ return A.mul(A.dot(U).sign());
437
+ }, de = (b) => {
438
438
  const f = t.channels.get(b);
439
439
  if (!f)
440
440
  throw new Error(
441
441
  `SplatMesh: a modifier reads channel "${b}", which is not defined. Call defineChannel("${b}") before assigning the modifier.`
442
442
  );
443
- return O(f.texture, y).r;
444
- }, u = Rt(t.modifiers, n.localCameraPosition, {
443
+ return _(f.texture, y).r;
444
+ }, u = Bt(t.modifiers, n.localCameraPosition, {
445
445
  index: D,
446
- localCenter: V,
447
- sourceCenter: M,
448
- sourceToLocal: w == null ? void 0 : w.linear,
449
- color: xe,
450
- makeNormal: ae,
451
- makeChannel: re
452
- }), x = he(
453
- r.srgbOutput ? u.color : Ct(u.color, h.SRGBColorSpace)
454
- ), R = he(_e.xy), F = e === "pick" ? he(v(0), "pickViewDepth") : null, $ = he(v(1), "vOpacityCompensation"), Z = r.lodAlpha ? he(v(r.maxStdDev), "vAdjustedStdDev") : null, ie = r.lodAlpha ? he(v(1), "vAlpha2") : null;
455
- if (s.vertexNode = G(() => {
456
- const b = u.offset === null ? V : V.add(u.offset), f = $e.mul(K(b, 1)).toVar(), g = Pt.mul(f).toVar(), B = K(0, 0, 2, 1).toVar(), p = e === "pick" ? 1.2 + 2 * lt : 1.2, z = g.w.mul(p), A = g.z.greaterThan(z.negate()).and(g.x.abs().lessThan(z)).and(g.y.abs().lessThan(z)), I = u.visible === null ? A : A.and(u.visible);
457
- return pe(I, () => {
446
+ localCenter: L,
447
+ sourceCenter: C,
448
+ sourceToLocal: v == null ? void 0 : v.linear,
449
+ color: le,
450
+ makeNormal: ue,
451
+ makeChannel: de
452
+ }), x = re(
453
+ r.srgbOutput ? u.color : Pt(u.color, h.SRGBColorSpace)
454
+ ), R = re(Ne.xy), F = e === "pick" ? re(w(0), "pickViewDepth") : null, j = re(w(1), "vOpacityCompensation"), W = r.lodAlpha ? re(w(r.maxStdDev), "vAdjustedStdDev") : null, H = r.lodAlpha ? re(w(1), "vAlpha2") : null, me = r.lodAlpha ? re(w(1), "vVisualOpacity") : null;
455
+ if (s.vertexNode = $(() => {
456
+ const b = u.offset === null ? L : L.add(u.offset), f = je.mul(Q(b, 1)).toVar(), g = kt.mul(f).toVar(), B = Q(0, 0, 2, 1).toVar(), p = e === "pick" ? 1.2 + 2 * ut : 1.2, U = g.w.mul(p), A = g.z.greaterThan(U.negate()).and(g.x.abs().lessThan(U)).and(g.y.abs().lessThan(U)), E = u.visible === null ? A : A.and(u.visible);
457
+ return be(E, () => {
458
458
  F && F.assign(f.z.negate());
459
- const P = O(o.covarianceATexture, y), _ = O(o.covarianceBTexture, y), ce = Te(
460
- S(P.x, P.y, P.z),
461
- S(P.y, P.w, _.x),
462
- S(P.z, _.x, _.y)
463
- ), be = w ? w.linear.mul(ce).mul(w.linear.transpose()) : ce;
464
- let Y = u.rotation === null ? be : u.rotation.mul(be).mul(u.rotation.transpose());
459
+ const M = _(o.covarianceATexture, y), z = _(o.covarianceBTexture, y), Y = ye(
460
+ S(M.x, M.y, M.z),
461
+ S(M.y, M.w, z.x),
462
+ S(M.z, z.x, z.y)
463
+ ), se = v ? v.linear.mul(Y).mul(v.linear.transpose()) : Y;
464
+ let ne = u.rotation === null ? se : u.rotation.mul(se).mul(u.rotation.transpose());
465
465
  if (u.isotropicCovarianceMix !== null) {
466
- const k = u.isotropicVarianceScale ?? v(Ut);
467
- Y = Vt(
468
- Y,
466
+ const k = u.isotropicVarianceScale ?? w(Vt);
467
+ ne = Ot(
468
+ ne,
469
469
  S(0, 0, 1),
470
470
  u.isotropicCovarianceMix,
471
471
  k
472
472
  );
473
473
  }
474
- const le = v(1).div(f.z), ye = le.mul(le), Ae = S(
475
- n.focal.x.mul(le),
474
+ const he = w(1).div(f.z), Ae = he.mul(he), Me = S(
475
+ n.focal.x.mul(he),
476
476
  0,
477
- n.focal.x.negate().mul(f.x).mul(ye)
478
- ), Fe = S(
477
+ n.focal.x.negate().mul(f.x).mul(Ae)
478
+ ), ze = S(
479
479
  0,
480
- n.focal.y.mul(le),
481
- n.focal.y.negate().mul(f.y).mul(ye)
482
- ), Me = $e.toMat3().transpose(), ue = Me.mul(Ae), de = Me.mul(Fe), Ce = ue.dot(Y.mul(ue)), Pe = de.dot(Y.mul(de)), He = ue.dot(Y.mul(de)), ze = u.scaleSquared === null ? Ce : Ce.mul(u.scaleSquared), Ue = u.scaleSquared === null ? Pe : Pe.mul(u.scaleSquared), we = u.scaleSquared === null ? He : He.mul(u.scaleSquared), Ke = f.z.negate().max(1e-4), Xe = n.dofFocusDistance.max(1e-4), ft = n.dofAperture.max(0).mul(0.5).div(Xe).atan(), pt = Ke.sub(Xe).abs().div(Ke), gt = n.focal.x.mul(ft.tan()), Ze = pt.mul(gt), Qe = Ze.mul(Ze).min(v(dt)), ke = r.projectedFilterProfile === "lcc" ? 0.1 : 0.3, Re = ze.add(ke).add(Qe), Ve = Ue.add(ke).add(Qe), Be = we, xt = Re.mul(Ve).sub(Be.mul(Be)).max(1e-9), Je = (r.antialias || r.projectedFilterProfile === "lcc" ? ze.mul(Ue).sub(we.mul(we)).max(0) : ze.add(ke).mul(Ue.add(ke)).sub(we.mul(we)).max(1e-9)).div(xt).sqrt();
483
- $.assign(
484
- u.isotropicCovarianceMix === null ? Je : oe(Je, v(1), u.isotropicCovarianceMix)
480
+ n.focal.y.mul(he),
481
+ n.focal.y.negate().mul(f.y).mul(Ae)
482
+ ), Ce = je.toMat3().transpose(), fe = Ce.mul(Me), pe = Ce.mul(ze), Pe = fe.dot(ne.mul(fe)), ke = pe.dot(ne.mul(pe)), Ke = fe.dot(ne.mul(pe)), Ue = u.scaleSquared === null ? Pe : Pe.mul(u.scaleSquared), Ve = u.scaleSquared === null ? ke : ke.mul(u.scaleSquared), ve = u.scaleSquared === null ? Ke : Ke.mul(u.scaleSquared), Xe = f.z.negate().max(1e-4), Ze = n.dofFocusDistance.max(1e-4), pt = n.dofAperture.max(0).mul(0.5).div(Ze).atan(), gt = Xe.sub(Ze).abs().div(Xe), xt = n.focal.x.mul(pt.tan()), Qe = gt.mul(xt), Je = Qe.mul(Qe).min(w(mt)), Re = r.projectedFilterProfile === "lcc" ? 0.1 : 0.3, Be = Ue.add(Re).add(Je), Oe = Ve.add(Re).add(Je), Ee = ve, bt = Be.mul(Oe).sub(Ee.mul(Ee)).max(1e-9), Ye = (r.antialias || r.projectedFilterProfile === "lcc" ? Ue.mul(Ve).sub(ve.mul(ve)).max(0) : Ue.add(Re).mul(Ve.add(Re)).sub(ve.mul(ve)).max(1e-9)).div(bt).sqrt();
483
+ j.assign(
484
+ u.isotropicCovarianceMix === null ? Ye : ce(Ye, w(1), u.isotropicCovarianceMix)
485
485
  );
486
- const Ye = Re.add(Ve).mul(0.5), et = J(Re.sub(Ve).mul(0.5), Be).length();
487
- let Q = Ye.add(et), me = Ye.sub(et).max(0);
486
+ const et = Be.add(Oe).mul(0.5), tt = te(Be.sub(Oe).mul(0.5), Ee).length();
487
+ let ee = et.add(tt), ge = et.sub(tt).max(0);
488
488
  if (u.isotropicCovarianceMix !== null) {
489
- const k = Ot(
490
- Q,
491
- me,
489
+ const k = Lt(
490
+ ee,
491
+ ge,
492
492
  u.isotropicCovarianceMix
493
493
  );
494
- if (Q = k.lambda1, me = k.lambda2, u.isotropicScreenRadiusPx !== null) {
495
- const N = Lt(
496
- Q,
497
- me,
494
+ if (ee = k.lambda1, ge = k.lambda2, u.isotropicScreenRadiusPx !== null) {
495
+ const V = _t(
496
+ ee,
497
+ ge,
498
498
  u.isotropicCovarianceMix,
499
499
  u.isotropicScreenRadiusPx,
500
- v(r.maxStdDev)
500
+ w(r.maxStdDev)
501
501
  );
502
- Q = N.lambda1, me = N.lambda2;
502
+ ee = V.lambda1, ge = V.lambda2;
503
503
  }
504
504
  }
505
- const Oe = J(Be, Q.sub(Re)).add(J(1e-6, 0)).normalize();
506
- let Ie = v(r.maxStdDev);
507
- if (r.lodAlpha && Z && ie) {
508
- const k = u.color.a.mul(2), N = k.mul(4).sub(3).min(5);
509
- Ie = k.greaterThan(1).select(
510
- v(r.maxStdDev).add(N.sub(1).mul(0.7)),
511
- v(r.maxStdDev)
512
- ), Z.assign(Ie), ie.assign(k);
505
+ const Le = te(Ee, ee.sub(Be)).add(te(1e-6, 0)).normalize();
506
+ let Ie = w(r.maxStdDev);
507
+ if (r.lodAlpha && W && H && me) {
508
+ const k = le.a, V = k.mul(2), Z = V.mul(4).sub(3).min(5);
509
+ Ie = V.greaterThan(1).select(
510
+ w(r.maxStdDev).add(Z.sub(1).mul(0.7)),
511
+ w(r.maxStdDev)
512
+ ), W.assign(Ie), H.assign(V), me.assign(
513
+ k.greaterThan(0).select(u.color.a.div(k.max(1e-8)), w(1))
514
+ );
513
515
  }
514
- const bt = r.maxAspect && r.maxAspect > 0 ? Q.min(me.mul(r.maxAspect * r.maxAspect)) : Q, tt = v(r.minSplatSizePx ?? 0), st = Oe.mul(
515
- bt.sqrt().mul(Ie).min(c).max(tt)
516
- ), nt = J(Oe.y, Oe.x.negate()).mul(
517
- me.sqrt().mul(Ie).min(c).max(tt)
518
- ), Le = () => {
519
- const k = st.mul(_e.x).add(nt.mul(_e.y)), N = g.xy.div(g.w);
516
+ const wt = r.maxAspect && r.maxAspect > 0 ? ee.min(ge.mul(r.maxAspect * r.maxAspect)) : ee, st = w(r.minSplatSizePx ?? 0), nt = Le.mul(
517
+ wt.sqrt().mul(Ie).min(c).max(st)
518
+ ), ot = te(Le.y, Le.x.negate()).mul(
519
+ ge.sqrt().mul(Ie).min(c).max(st)
520
+ ), _e = () => {
521
+ const k = nt.mul(Ne.x).add(ot.mul(Ne.y)), V = g.xy.div(g.w);
520
522
  B.assign(
521
- K(
522
- N.add(k.mul(2).div(n.viewport)),
523
+ Q(
524
+ V.add(k.mul(2).div(n.viewport)),
523
525
  g.z.div(g.w),
524
526
  1
525
527
  )
526
528
  );
527
529
  };
528
- let ee;
530
+ let oe;
529
531
  if (r.foveationMode === "page-table")
530
- ee = null;
532
+ oe = null;
531
533
  else if (r.foveationMode === "frontier") {
532
- const k = f.z.negate(), te = P.x.add(P.w).add(_.y).max(0).mul(1 / 3).sqrt().mul(2), W = _.w, se = W.lessThan(0), ot = W.abs(), wt = ot.equal(0).select(v(zt), ot), at = n.pixelScaleLimit.mul(k), vt = se.select(v(0), te);
533
- ee = wt.greaterThan(at).and(vt.lessThanEqual(at));
534
+ const k = f.z.negate(), Z = M.x.add(M.w).add(z.y).max(0).mul(1 / 3).sqrt().mul(2), G = z.w, ae = G.lessThan(0), at = G.abs(), vt = at.equal(0).select(w(Ut), at), rt = n.pixelScaleLimit.mul(k), St = ae.select(w(0), Z);
535
+ oe = vt.greaterThan(rt).and(St.lessThanEqual(rt));
534
536
  } else {
535
- const k = r.maxScreenRadiusPx ?? 0, N = r.minScreenRadiusPx ?? 0, te = Q.sqrt().mul(r.maxStdDev);
536
- let W = null;
537
- if (k > 0 && (W = te.lessThanEqual(n.screenBandMax)), N > 0) {
538
- const se = te.greaterThan(n.screenBandMin);
539
- W = W ? W.and(se) : se;
537
+ const k = r.maxScreenRadiusPx ?? 0, V = r.minScreenRadiusPx ?? 0, Z = ee.sqrt().mul(r.maxStdDev);
538
+ let G = null;
539
+ if (k > 0 && (G = Z.lessThanEqual(n.screenBandMax)), V > 0) {
540
+ const ae = Z.greaterThan(n.screenBandMin);
541
+ G = G ? G.and(ae) : ae;
540
542
  }
541
- ee = W;
543
+ oe = G;
542
544
  }
543
545
  if (r.performanceProfile === "smooth") {
544
- const k = st.length(), N = nt.length(), te = u.color.a, W = te.greaterThanEqual(1 / 255).and(k.max(N).mul(2).greaterThanEqual(2)).and(te.mul(k).mul(N).greaterThanEqual(3)), se = u.isotropicCovarianceMix === null ? W : W.or(u.isotropicCovarianceMix.greaterThan(0));
545
- pe(ee ? se.and(ee) : se, Le);
546
- } else ee ? pe(ee, Le) : Le();
546
+ const k = nt.length(), V = ot.length(), Z = u.color.a, G = Z.greaterThanEqual(1 / 255).and(k.max(V).mul(2).greaterThanEqual(2)).and(Z.mul(k).mul(V).greaterThanEqual(3)), ae = u.isotropicCovarianceMix === null ? G : G.or(u.isotropicCovarianceMix.greaterThan(0));
547
+ be(oe ? ae.and(oe) : ae, _e);
548
+ } else oe ? be(oe, _e) : _e();
547
549
  }), B;
548
550
  })(), e === "display")
549
- s.fragmentNode = G(() => {
551
+ s.fragmentNode = $(() => {
550
552
  const b = R.dot(R);
551
- Ne(b.greaterThan(1));
553
+ qe(b.greaterThan(1));
552
554
  let f;
553
- if (r.lodAlpha && Z && ie) {
554
- const ue = b.mul(Z.mul(Z).mul(-0.5)).exp(), de = ie.mul(4).sub(3).min(5), Ce = de.mul(de).sub(1).mul(1 / Math.E).exp(), Pe = ue.oneMinus().pow(Ce).oneMinus();
555
- f = ie.greaterThan(1).select(Pe, ue.mul(ie));
555
+ if (r.lodAlpha && W && H && me) {
556
+ const fe = b.mul(W.mul(W).mul(-0.5)).exp(), pe = H.mul(4).sub(3).min(5), Pe = pe.mul(pe).sub(1).mul(1 / Math.E).exp(), ke = fe.oneMinus().pow(Pe).oneMinus();
557
+ f = H.greaterThan(1).select(ke, fe.mul(H)).mul(me);
556
558
  } else
557
559
  f = b.mul(T).exp().mul(x.a);
558
- const g = f.mul($), B = ve(n.relightMap, Se), p = n.relightSoftness.div(n.viewport.x.max(1)), z = n.relightSoftness.div(n.viewport.y.max(1)), A = B, I = ve(n.relightMap, Se.add(J(p, 0))), P = ve(n.relightMap, Se.add(J(p.negate(), 0))), _ = ve(n.relightMap, Se.add(J(0, z))), ce = ve(n.relightMap, Se.add(J(0, z.negate()))), be = A.a.add(I.a).add(P.a).add(_.a).add(ce.a).max(1e-4), Y = A.rgb.mul(A.a).add(I.rgb.mul(I.a)).add(P.rgb.mul(P.a)).add(_.rgb.mul(_.a)).add(ce.rgb.mul(ce.a)).div(be), le = be.mul(0.2), ye = K(Y, le), Ae = n.relightSoftness.greaterThan(0.5).select(ye, B), Fe = oe(
560
+ const g = f.mul(j), B = Se(n.relightMap, Te), p = n.relightSoftness.div(n.viewport.x.max(1)), U = n.relightSoftness.div(n.viewport.y.max(1)), A = B, E = Se(n.relightMap, Te.add(te(p, 0))), M = Se(n.relightMap, Te.add(te(p.negate(), 0))), z = Se(n.relightMap, Te.add(te(0, U))), Y = Se(n.relightMap, Te.add(te(0, U.negate()))), se = A.a.add(E.a).add(M.a).add(z.a).add(Y.a).max(1e-4), ne = A.rgb.mul(A.a).add(E.rgb.mul(E.a)).add(M.rgb.mul(M.a)).add(z.rgb.mul(z.a)).add(Y.rgb.mul(Y.a)).div(se), he = se.mul(0.2), Ae = Q(ne, he), Me = n.relightSoftness.greaterThan(0.5).select(Ae, B), ze = ce(
559
561
  S(n.relightBackground),
560
- Ae.rgb.mul(n.relightBrightness),
561
- Ae.a
562
- ), Me = oe(x.rgb, x.rgb.mul(Fe), n.relightBlend);
563
- return K(Me.mul(g), g);
562
+ Me.rgb.mul(n.relightBrightness),
563
+ Me.a
564
+ ), Ce = ce(x.rgb, x.rgb.mul(ze), n.relightBlend);
565
+ return Q(Ce.mul(g), g);
564
566
  })(), s.transparent = !0, s.depthTest = !0, s.depthWrite = !1, s.side = h.DoubleSide, s.blending = h.CustomBlending, s.blendSrc = h.OneFactor, s.blendDst = h.OneMinusSrcAlphaFactor, s.blendSrcAlpha = h.OneFactor, s.blendDstAlpha = h.OneMinusSrcAlphaFactor, s.toneMapped = !1;
565
567
  else {
566
568
  if (!i)
567
569
  throw new Error("applySplatMaterialGraph in 'pick' mode requires pick uniforms.");
568
- s.fragmentNode = G(() => {
570
+ s.fragmentNode = $(() => {
569
571
  const b = R.dot(R);
570
- Ne(b.greaterThan(1));
571
- const g = b.mul(T).exp().mul(x.a).mul($);
572
- Ne(g.lessThan(i.alphaThreshold));
573
- const p = F.sub(i.near).div(i.far.sub(i.near)).clamp(0, 1).mul(16777215), z = p.div(65536).floor(), A = p.mod(65536).div(256).floor(), I = p.mod(256).floor();
574
- return K(z.div(255), A.div(255), I.div(255), 1);
572
+ qe(b.greaterThan(1));
573
+ let f;
574
+ if (r.lodAlpha && W && H && me) {
575
+ const M = b.mul(W.mul(W).mul(-0.5)).exp(), z = H.mul(4).sub(3).min(5), Y = z.mul(z).sub(1).mul(1 / Math.E).exp(), se = M.oneMinus().pow(Y).oneMinus();
576
+ f = H.greaterThan(1).select(se, M.mul(H)).mul(me);
577
+ } else
578
+ f = b.mul(T).exp().mul(x.a);
579
+ const g = f.mul(j);
580
+ qe(g.lessThan(i.alphaThreshold));
581
+ const p = F.sub(i.near).div(i.far.sub(i.near)).clamp(0, 1).mul(16777215), U = p.div(65536).floor(), A = p.mod(65536).div(256).floor(), E = p.mod(256).floor();
582
+ return Q(U.div(255), A.div(255), E.div(255), 1);
575
583
  })(), s.transparent = !1, s.depthTest = !0, s.depthWrite = !0, s.side = h.DoubleSide, s.blending = h.NoBlending, s.toneMapped = !1;
576
584
  }
577
585
  }
578
- function Nt(s, e) {
586
+ function qt(s, e) {
579
587
  const t = s.elements;
580
588
  return e * Math.hypot(t[2], t[6], t[10]);
581
589
  }
582
- function qt(s, e) {
590
+ function Wt(s, e) {
583
591
  const t = s.backend;
584
592
  return !t || t.isWebGPUBackend !== !0 || typeof t.has != "function" || typeof t.get != "function" || !t.has(e) ? !1 : t.get(e).buffer !== void 0;
585
593
  }
586
- function Wt(s) {
594
+ function Gt(s) {
587
595
  const e = s.array, t = e.byteLength;
588
596
  if (t === 0) return 0;
589
597
  const o = e.constructor;
590
598
  return s.array = new o(0), t;
591
599
  }
592
- class Gt {
600
+ class $t {
593
601
  constructor(e) {
594
602
  l(this, "pending");
595
603
  /** Released attributes and the `version` they carried when released. */
@@ -623,7 +631,7 @@ class Gt {
623
631
  let t = 0;
624
632
  for (let o = this.pending.length - 1; o >= 0; o--) {
625
633
  const a = this.pending[o];
626
- qt(e, a) && (t += Wt(a), this.released.set(a, a.version), this.pending.splice(o, 1));
634
+ Wt(e, a) && (t += Gt(a), this.released.set(a, a.version), this.pending.splice(o, 1));
627
635
  }
628
636
  return this.releasedBytesValue += t, t;
629
637
  }
@@ -638,7 +646,7 @@ class Gt {
638
646
  if (!(this.warnedDrift || this.released.size === 0)) {
639
647
  for (const [e, t] of this.released)
640
648
  if (e.version !== t) {
641
- this.warnedDrift = !0, kt(
649
+ this.warnedDrift = !0, Rt(
642
650
  `StorageMirrorReleaser: storage attribute "${e.name || "unnamed"}" was written from the CPU after its mirror was released; that write will not reach the GPU. Remove it from the releaser's attribute list.`
643
651
  );
644
652
  return;
@@ -646,7 +654,7 @@ class Gt {
646
654
  }
647
655
  }
648
656
  }
649
- const j = class j {
657
+ const K = class K {
650
658
  constructor(e) {
651
659
  l(this, "kind", "counting");
652
660
  l(this, "renderer");
@@ -666,15 +674,15 @@ const j = class j {
666
674
  /** Set by {@link dispose}; makes a second dispose a no-op. */
667
675
  l(this, "disposed", !1);
668
676
  /** Row 2 of the model-view matrix; view-space z = row2 · (position, 1). */
669
- l(this, "viewRow2", fe(new h.Vector4()));
670
- l(this, "depthMin", fe(0));
671
- l(this, "depthScale", fe(0));
677
+ l(this, "viewRow2", xe(new h.Vector4()));
678
+ l(this, "depthMin", xe(0));
679
+ l(this, "depthScale", xe(0));
672
680
  /** Active splat count; a float compares exactly for counts < 2²⁴. */
673
- l(this, "activeCount", fe(0));
681
+ l(this, "activeCount", xe(0));
674
682
  /** Highest bucket index this sort uses; see {@link effectiveBucketCount}. */
675
- l(this, "bucketMax", fe(0));
683
+ l(this, "bucketMax", xe(0));
676
684
  l(this, "viewCenter", new h.Vector3());
677
- const { renderer: t, capacity: o, centersTexture: a, dataTextureWidth: n, centersBuffer: r, perSource: i } = e, { BUCKET_COUNT: d, BLOCK_SIZE: c } = j;
685
+ const { renderer: t, capacity: o, centersTexture: a, dataTextureWidth: n, centersBuffer: r, perSource: i } = e, { BUCKET_COUNT: d, BLOCK_SIZE: c } = K;
678
686
  if (!a && !r)
679
687
  throw new Error("ComputeSorter: provide centersTexture or centersBuffer.");
680
688
  if (a && n === void 0)
@@ -694,64 +702,64 @@ const j = class j {
694
702
  D,
695
703
  y,
696
704
  q
697
- ], this.mirrors = new Gt(this.workingAttributes);
698
- const M = ne(T, "uint", d).toAtomic(), m = ne(D, "uint", d / c), w = ne(
705
+ ], this.mirrors = new $t(this.workingAttributes);
706
+ const C = ie(T, "uint", d).toAtomic(), m = ie(D, "uint", d / c), v = ie(
699
707
  y,
700
708
  "uint",
701
709
  d / c / c
702
- ), V = ne(q, "uint", o), X = ne(e.sourceIndexAttribute, "uint", o), xe = ne(e.splatIndexAttribute, "float", o), ae = r ? ne(r, "vec4", o) : null;
703
- this.clearPass = G(() => {
704
- qe(M.element(E), C(0));
705
- })().compute(d, [c]), this.histogramPass = G(() => {
706
- pe(v(E).lessThan(this.activeCount), () => {
707
- const u = L(X.element(E)), x = a ? je(
708
- u.mod(L(n)),
709
- u.div(L(n))
710
- ) : null, R = ae ? ae.element(u).xyz : O(a, x).xyz, F = i ? mt(
710
+ ), L = ie(q, "uint", o), J = ie(e.sourceIndexAttribute, "uint", o), le = ie(e.splatIndexAttribute, "float", o), ue = r ? ie(r, "vec4", o) : null;
711
+ this.clearPass = $(() => {
712
+ We(C.element(I), P(0));
713
+ })().compute(d, [c]), this.histogramPass = $(() => {
714
+ be(w(I).lessThan(this.activeCount), () => {
715
+ const u = N(J.element(I)), x = a ? He(
716
+ u.mod(N(n)),
717
+ u.div(N(n))
718
+ ) : null, R = ue ? ue.element(u).xyz : _(a, x).xyz, F = i ? ht(
711
719
  i.columns,
712
- L(O(i.sourceIdTexture, x).r),
720
+ N(_(i.sourceIdTexture, x).r),
713
721
  R
714
- ).worldCenter : R, Z = this.viewRow2.xyz.dot(F).add(this.viewRow2.w).sub(this.depthMin).mul(this.depthScale).clamp(0, this.bucketMax).toUint();
715
- V.element(E).assign(Z), rt(M.element(Z), C(1));
722
+ ).worldCenter : R, W = this.viewRow2.xyz.dot(F).add(this.viewRow2.w).sub(this.depthMin).mul(this.depthScale).clamp(0, this.bucketMax).toUint();
723
+ L.element(I).assign(W), it(C.element(W), P(1));
716
724
  });
717
- })().compute(o, [c]), this.scanBlocksPass = G(() => {
718
- const u = E.mul(C(c)).toVar(), x = C(0).toVar();
719
- We(c, ({ i: R }) => {
720
- const F = M.element(u.add(C(R))), $ = it(F).toVar();
721
- qe(F, x), x.addAssign($);
722
- }), m.element(E).assign(x);
723
- })().compute(d / c, [64]), this.scanBlockSumsPass = G(() => {
724
- const u = E.mul(C(c)).toVar(), x = C(0).toVar();
725
- We(c, ({ i: R }) => {
726
- const F = m.element(u.add(C(R))), $ = F.toVar();
727
- F.assign(x), x.addAssign($);
728
- }), w.element(E).assign(x);
725
+ })().compute(o, [c]), this.scanBlocksPass = $(() => {
726
+ const u = I.mul(P(c)).toVar(), x = P(0).toVar();
727
+ Ge(c, ({ i: R }) => {
728
+ const F = C.element(u.add(P(R))), j = ct(F).toVar();
729
+ We(F, x), x.addAssign(j);
730
+ }), m.element(I).assign(x);
731
+ })().compute(d / c, [64]), this.scanBlockSumsPass = $(() => {
732
+ const u = I.mul(P(c)).toVar(), x = P(0).toVar();
733
+ Ge(c, ({ i: R }) => {
734
+ const F = m.element(u.add(P(R))), j = F.toVar();
735
+ F.assign(x), x.addAssign(j);
736
+ }), v.element(I).assign(x);
729
737
  })().compute(d / c / c, [64]);
730
- const re = G(() => {
731
- pe(E.equal(C(0)), () => {
732
- const u = C(0).toVar();
733
- We(d / c / c, ({ i: x }) => {
734
- const R = w.element(x).toVar();
735
- w.element(x).assign(u), u.addAssign(R);
738
+ const de = $(() => {
739
+ be(I.equal(P(0)), () => {
740
+ const u = P(0).toVar();
741
+ Ge(d / c / c, ({ i: x }) => {
742
+ const R = v.element(x).toVar();
743
+ v.element(x).assign(u), u.addAssign(R);
736
744
  });
737
745
  });
738
746
  })().compute(1, [64]);
739
- this.addBlockSumOffsetsPass = G(() => {
740
- m.element(E).addAssign(w.element(E.div(C(c))));
741
- })().compute(d / c, [c]), this.addOffsetsPass = G(() => {
742
- const u = M.element(E), x = m.element(E.shiftRight(C(Math.log2(c))));
743
- qe(u, it(u).add(x));
744
- })().compute(d, [c]), this.scatterPass = G(() => {
745
- pe(v(E).lessThan(this.activeCount), () => {
746
- const u = X.element(E), x = V.element(E), R = rt(M.element(x), C(1));
747
- xe.element(R).assign(v(u));
747
+ this.addBlockSumOffsetsPass = $(() => {
748
+ m.element(I).addAssign(v.element(I.div(P(c))));
749
+ })().compute(d / c, [c]), this.addOffsetsPass = $(() => {
750
+ const u = C.element(I), x = m.element(I.shiftRight(P(Math.log2(c))));
751
+ We(u, ct(u).add(x));
752
+ })().compute(d, [c]), this.scatterPass = $(() => {
753
+ be(w(I).lessThan(this.activeCount), () => {
754
+ const u = J.element(I), x = L.element(I), R = it(C.element(x), P(1));
755
+ le.element(R).assign(w(u));
748
756
  });
749
757
  })().compute(o, [c]), this.sortPasses = [
750
758
  this.clearPass,
751
759
  this.histogramPass,
752
760
  this.scanBlocksPass,
753
761
  this.scanBlockSumsPass,
754
- re,
762
+ de,
755
763
  this.addBlockSumOffsetsPass,
756
764
  this.addOffsetsPass,
757
765
  this.scatterPass
@@ -771,7 +779,7 @@ const j = class j {
771
779
  */
772
780
  effectiveBucketCount(e) {
773
781
  const o = 2 ** Math.ceil(Math.log2(Math.max(1, e)));
774
- return Math.min(Math.max(o, j.MIN_BUCKET_COUNT), j.BUCKET_COUNT);
782
+ return Math.min(Math.max(o, K.MIN_BUCKET_COUNT), K.BUCKET_COUNT);
775
783
  }
776
784
  sort(e, t, o) {
777
785
  if (t === 0) return !0;
@@ -779,42 +787,42 @@ const j = class j {
779
787
  this.viewRow2.value.set(a[2], a[6], a[10], a[14]), this.activeCount.value = t;
780
788
  const n = this.effectiveBucketCount(t);
781
789
  this.viewCenter.copy(o.center).applyMatrix4(e);
782
- const r = Nt(e, o.radius), i = this.viewCenter.z - r, d = this.viewCenter.z + r;
790
+ const r = qt(e, o.radius), i = this.viewCenter.z - r, d = this.viewCenter.z + r;
783
791
  this.depthMin.value = i, this.depthScale.value = (n - 1) / (d - i || 1), this.bucketMax.value = n - 1;
784
- const c = n / j.BLOCK_SIZE;
785
- return this.histogramPass.count = t, this.scatterPass.count = t, this.clearPass.count = n, this.scanBlocksPass.count = c, this.scanBlockSumsPass.count = c / j.BLOCK_SIZE, this.addBlockSumOffsetsPass.count = c, this.addOffsetsPass.count = n, this.renderer.compute(this.sortPasses), this.mirrors.settled || this.mirrors.release(this.renderer), !0;
792
+ const c = n / K.BLOCK_SIZE;
793
+ return this.histogramPass.count = t, this.scatterPass.count = t, this.clearPass.count = n, this.scanBlocksPass.count = c, this.scanBlockSumsPass.count = c / K.BLOCK_SIZE, this.addBlockSumOffsetsPass.count = c, this.addOffsetsPass.count = n, this.renderer.compute(this.sortPasses), this.mirrors.settled || this.mirrors.release(this.renderer), !0;
786
794
  }
787
795
  dispose() {
788
796
  if (!this.disposed) {
789
797
  this.disposed = !0;
790
798
  for (const e of this.sortPasses) e.dispose();
791
- $t(this.renderer, this.workingAttributes);
799
+ jt(this.renderer, this.workingAttributes);
792
800
  }
793
801
  }
794
802
  };
795
- l(j, "BUCKET_COUNT", 1 << 22), l(j, "BLOCK_SIZE", 256), /**
803
+ l(K, "BUCKET_COUNT", 1 << 22), l(K, "BLOCK_SIZE", 256), /**
796
804
  * Smallest bucket count a sort will dispatch. Below this the fixed passes
797
805
  * are already cheap, and the floor keeps every block-scan index exact.
798
806
  */
799
- l(j, "MIN_BUCKET_COUNT", 65536);
800
- let ut = j;
801
- function $t(s, e) {
807
+ l(K, "MIN_BUCKET_COUNT", 65536);
808
+ let dt = K;
809
+ function jt(s, e) {
802
810
  const t = s._attributes;
803
811
  if (t)
804
812
  for (const o of e) t.delete(o);
805
813
  }
806
- const jt = 2e6, Ht = 5e6, Kt = 8e6, Xt = 1e-6;
807
- function Zt(s) {
814
+ const Ht = 2e6, Kt = 5e6, Xt = 8e6, Zt = 1e-6;
815
+ function Qt(s) {
808
816
  if (s !== void 0 && (!Number.isFinite(s) || s < 0))
809
817
  throw new RangeError(
810
818
  "SplatMesh sortIntervalMs must be a finite number greater than or equal to 0."
811
819
  );
812
820
  return s;
813
821
  }
814
- function Qt(s, e = !1) {
815
- return s < jt ? e ? 33 : 0 : s < Ht ? e ? 66 : 50 : s < Kt ? e ? 133 : 100 : 1e3 / 6;
822
+ function Jt(s, e = !1) {
823
+ return s < Ht ? e ? 33 : 0 : s < Kt ? e ? 66 : 50 : s < Xt ? e ? 133 : 100 : 1e3 / 6;
816
824
  }
817
- class xs {
825
+ class bs {
818
826
  constructor(e, t = !1) {
819
827
  l(this, "sortIntervalMs");
820
828
  l(this, "isMobile");
@@ -824,7 +832,7 @@ class xs {
824
832
  l(this, "forcePending", !0);
825
833
  l(this, "lastAcceptedAt", -1 / 0);
826
834
  l(this, "acceptedCount", 0);
827
- this.sortIntervalMs = Zt(e), this.isMobile = t;
835
+ this.sortIntervalMs = Qt(e), this.isMobile = t;
828
836
  }
829
837
  /** Forces the next changed or content-invalidated pose to bypass throttling. */
830
838
  invalidate() {
@@ -868,23 +876,23 @@ class xs {
868
876
  shouldSubmitLegacy(e, t, o, a) {
869
877
  let n = !1;
870
878
  if (this.hasPreviousModelView) {
871
- const i = Jt(e, this.previousModelView) > Xt;
879
+ const i = Yt(e, this.previousModelView) > Zt;
872
880
  n = this.legacyWasMoving && !i, this.legacyWasMoving = i;
873
881
  } else
874
882
  this.hasPreviousModelView = !0;
875
883
  this.previousModelView.copy(e);
876
- const r = this.sortIntervalMs ?? Qt(o, this.isMobile);
884
+ const r = this.sortIntervalMs ?? Jt(o, this.isMobile);
877
885
  return this.forcePending ? !0 : e.equals(t) ? !1 : n ? !0 : r === 0 || a - this.lastAcceptedAt >= r;
878
886
  }
879
887
  }
880
- function Jt(s, e) {
888
+ function Yt(s, e) {
881
889
  let t = 0;
882
890
  for (let o = 0; o < 16; o++)
883
891
  t = Math.max(t, Math.abs(s.elements[o] - e.elements[o]));
884
892
  return t;
885
893
  }
886
- const Ge = new h.Vector2();
887
- function bs(s, e) {
894
+ const $e = new h.Vector2();
895
+ function ws(s, e) {
888
896
  var d;
889
897
  const t = e.xr;
890
898
  if ((t == null ? void 0 : t.isPresenting) !== !0 || typeof t.getCamera != "function") return null;
@@ -893,12 +901,12 @@ function bs(s, e) {
893
901
  if (!a) return null;
894
902
  const n = a.viewport;
895
903
  let r = (n == null ? void 0 : n.z) ?? 0, i = (n == null ? void 0 : n.w) ?? 0;
896
- return (!(r > 0) || !(i > 0)) && (e.getDrawingBufferSize(Ge), r = Ge.x, i = Ge.y), { head: o, eye: a, width: r, height: i };
904
+ return (!(r > 0) || !(i > 0)) && (e.getDrawingBufferSize($e), r = $e.x, i = $e.y), { head: o, eye: a, width: r, height: i };
897
905
  }
898
- function ws(s) {
906
+ function vs(s) {
899
907
  return s.isArrayCamera === !0;
900
908
  }
901
- function vs(s, e = {}) {
909
+ function Ss(s, e = {}) {
902
910
  const t = s.backend.isWebGPUBackend === !0, o = [...e.requiredFeatures ?? [], ...t ? ["webgpu"] : []], a = e.optionalFeatures ?? [];
903
911
  return {
904
912
  ...e,
@@ -906,12 +914,12 @@ function vs(s, e = {}) {
906
914
  ...a.length > 0 ? { optionalFeatures: a } : {}
907
915
  };
908
916
  }
909
- const Yt = 1, es = 2, ts = 1, ss = 0;
910
- function Ss(s, e = {
911
- blend: Yt,
912
- brightness: es,
913
- background: ts,
914
- softness: ss
917
+ const es = 1, ts = 2, ss = 1, ns = 0;
918
+ function Ts(s, e = {
919
+ blend: es,
920
+ brightness: ts,
921
+ background: ss,
922
+ softness: ns
915
923
  }) {
916
924
  const t = s.blend !== void 0 ? s.blend : e.blend, o = s.brightness !== void 0 ? s.brightness : e.brightness, a = s.background !== void 0 ? s.background : e.background, n = s.softness !== void 0 ? s.softness : e.softness;
917
925
  return {
@@ -921,49 +929,49 @@ function Ss(s, e = {
921
929
  softness: Number.isFinite(n) ? Math.min(8, Math.max(0, n)) : e.softness
922
930
  };
923
931
  }
924
- function Ts() {
932
+ function ys() {
925
933
  const s = new Uint8Array([255, 255, 255, 255]), e = new h.DataTexture(s, 1, 1);
926
934
  return e.needsUpdate = !0, e.magFilter = h.NearestFilter, e.minFilter = h.NearestFilter, e.generateMipmaps = !1, e;
927
935
  }
928
936
  export {
929
- gs as A,
930
- Zt as B,
931
- ut as C,
932
- ts as D,
933
- Ee as E,
934
- fs as F,
935
- Bt as G,
936
- _t as H,
937
+ xs as A,
938
+ Qt as B,
939
+ dt as C,
940
+ ss as D,
941
+ De as E,
942
+ ps as F,
943
+ Et as G,
944
+ Nt as H,
937
945
  It as I,
938
- ls as J,
939
- ct as M,
940
- Gt as S,
941
- xs as W,
942
- Yt as a,
943
- es as b,
944
- ss as c,
945
- dt as d,
946
- De as e,
947
- is as f,
948
- Ft as g,
949
- Dt as h,
950
- ms as i,
951
- Ss as j,
952
- us as k,
953
- ds as l,
954
- Ts as m,
955
- cs as n,
956
- ps as o,
957
- Rt as p,
958
- hs as q,
959
- $t as r,
960
- Ut as s,
961
- Vt as t,
962
- Ot as u,
963
- Nt as v,
964
- Lt as w,
965
- vs as x,
966
- bs as y,
967
- ws as z
946
+ us as J,
947
+ lt as M,
948
+ $t as S,
949
+ bs as W,
950
+ es as a,
951
+ ts as b,
952
+ ns as c,
953
+ mt as d,
954
+ Fe as e,
955
+ cs as f,
956
+ zt as g,
957
+ Ft as h,
958
+ hs as i,
959
+ Ts as j,
960
+ ds as k,
961
+ ms as l,
962
+ ys as m,
963
+ ls as n,
964
+ gs as o,
965
+ Bt as p,
966
+ fs as q,
967
+ jt as r,
968
+ Vt as s,
969
+ Ot as t,
970
+ Lt as u,
971
+ qt as v,
972
+ _t as w,
973
+ Ss as x,
974
+ ws as y,
975
+ vs as z
968
976
  };
969
- //# sourceMappingURL=relighting-CSQF3UcL.js.map
977
+ //# sourceMappingURL=relighting-Tiwep8yd.js.map