@speridlabs/visus 2.4.3 → 2.5.0

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/main.es.js CHANGED
@@ -1,14 +1,14 @@
1
- var Nt = Object.defineProperty;
2
- var $t = (a, t, e) => t in a ? Nt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var x = (a, t, e) => $t(a, typeof t != "symbol" ? t + "" : t, e);
4
- import * as l from "three";
5
- class wt {
1
+ var Ye = Object.defineProperty;
2
+ var Ze = (a, e, t) => e in a ? Ye(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var d = (a, e, t) => Ze(a, typeof e != "symbol" ? e + "" : e, t);
4
+ import * as c from "three";
5
+ class we {
6
6
  constructor() {
7
- x(this, "min", new l.Vector3(1 / 0, 1 / 0, 1 / 0));
8
- x(this, "max", new l.Vector3(-1 / 0, -1 / 0, -1 / 0));
9
- x(this, "center", new l.Vector3());
7
+ d(this, "min", new c.Vector3(1 / 0, 1 / 0, 1 / 0));
8
+ d(this, "max", new c.Vector3(-1 / 0, -1 / 0, -1 / 0));
9
+ d(this, "center", new c.Vector3());
10
10
  /** Half extents (size/2) */
11
- x(this, "halfExtents", new l.Vector3());
11
+ d(this, "halfExtents", new c.Vector3());
12
12
  }
13
13
  /**
14
14
  * Reset the bounding box to its initial state
@@ -20,15 +20,15 @@ class wt {
20
20
  * Expand the bounding box to include the given point
21
21
  * @param point Point to include in the bounding box
22
22
  */
23
- expandByPoint(t) {
24
- this.min.x = Math.min(this.min.x, t.x), this.min.y = Math.min(this.min.y, t.y), this.min.z = Math.min(this.min.z, t.z), this.max.x = Math.max(this.max.x, t.x), this.max.y = Math.max(this.max.y, t.y), this.max.z = Math.max(this.max.z, t.z), this.updateDerived();
23
+ expandByPoint(e) {
24
+ this.min.x = Math.min(this.min.x, e.x), this.min.y = Math.min(this.min.y, e.y), this.min.z = Math.min(this.min.z, e.z), this.max.x = Math.max(this.max.x, e.x), this.max.y = Math.max(this.max.y, e.y), this.max.z = Math.max(this.max.z, e.z), this.updateDerived();
25
25
  }
26
26
  /**
27
27
  * Expand this bounding box to include another bounding box
28
28
  * @param box Bounding box to include
29
29
  */
30
- expandByBox(t) {
31
- this.min.x = Math.min(this.min.x, t.min.x), this.min.y = Math.min(this.min.y, t.min.y), this.min.z = Math.min(this.min.z, t.min.z), this.max.x = Math.max(this.max.x, t.max.x), this.max.y = Math.max(this.max.y, t.max.y), this.max.z = Math.max(this.max.z, t.max.z), this.updateDerived();
30
+ expandByBox(e) {
31
+ this.min.x = Math.min(this.min.x, e.min.x), this.min.y = Math.min(this.min.y, e.min.y), this.min.z = Math.min(this.min.z, e.min.z), this.max.x = Math.max(this.max.x, e.max.x), this.max.y = Math.max(this.max.y, e.max.y), this.max.z = Math.max(this.max.z, e.max.z), this.updateDerived();
32
32
  }
33
33
  /**
34
34
  * Update the center and half extents based on min/max
@@ -41,38 +41,38 @@ class wt {
41
41
  * @param point Point to check
42
42
  * @returns True if the point is inside the box
43
43
  */
44
- containsPoint(t) {
45
- return t.x >= this.min.x && t.x <= this.max.x && t.y >= this.min.y && t.y <= this.max.y && t.z >= this.min.z && t.z <= this.max.z;
44
+ containsPoint(e) {
45
+ return e.x >= this.min.x && e.x <= this.max.x && e.y >= this.min.y && e.y <= this.max.y && e.z >= this.min.z && e.z <= this.max.z;
46
46
  }
47
47
  /**
48
48
  * Create a Three.js Box3 from this bounding box
49
49
  * @returns THREE.Box3 representation
50
50
  */
51
51
  toBox3() {
52
- return new l.Box3().set(this.min, this.max);
52
+ return new c.Box3().set(this.min, this.max);
53
53
  }
54
54
  /**
55
55
  * Create a clone of this bounding box
56
56
  * @returns New bounding box with the same values
57
57
  */
58
58
  clone() {
59
- const t = new wt();
60
- return t.min.copy(this.min), t.max.copy(this.max), t.center.copy(this.center), t.halfExtents.copy(this.halfExtents), t;
59
+ const e = new we();
60
+ return e.min.copy(this.min), e.max.copy(this.max), e.center.copy(this.center), e.halfExtents.copy(this.halfExtents), e;
61
61
  }
62
62
  }
63
- class jt {
64
- constructor(t = 0) {
65
- x(this, "numSplats", 0);
66
- x(this, "positions");
67
- x(this, "rotations");
68
- x(this, "scales");
69
- x(this, "colors");
70
- x(this, "opacities");
71
- x(this, "boundingBox", new wt());
72
- this.numSplats = t, this.allocateBuffers(t);
73
- }
74
- allocateBuffers(t) {
75
- this.positions = new Float32Array(t * 3), this.rotations = new Float32Array(t * 4), this.scales = new Float32Array(t * 3), this.colors = new Float32Array(t * 3), this.opacities = new Float32Array(t);
63
+ class Xe {
64
+ constructor(e = 0) {
65
+ d(this, "numSplats", 0);
66
+ d(this, "positions");
67
+ d(this, "rotations");
68
+ d(this, "scales");
69
+ d(this, "colors");
70
+ d(this, "opacities");
71
+ d(this, "boundingBox", new we());
72
+ this.numSplats = e, this.allocateBuffers(e);
73
+ }
74
+ allocateBuffers(e) {
75
+ this.positions = new Float32Array(e * 3), this.rotations = new Float32Array(e * 4), this.scales = new Float32Array(e * 3), this.colors = new Float32Array(e * 3), this.opacities = new Float32Array(e);
76
76
  }
77
77
  /**
78
78
  * Set data for a specific splat
@@ -83,49 +83,49 @@ class jt {
83
83
  * @param color Color
84
84
  * @param opacity Opacity value
85
85
  */
86
- setSplat(t, e, s, n, r, o) {
87
- if (t >= this.numSplats)
86
+ setSplat(e, t, s, n, r, i) {
87
+ if (e >= this.numSplats)
88
88
  throw new Error(
89
- `Splat index out of bounds: ${t} >= ${this.numSplats}`
89
+ `Splat index out of bounds: ${e} >= ${this.numSplats}`
90
90
  );
91
- const i = t * 3, u = t * 4, y = t * 3, m = t * 3;
92
- this.positions[i] = e.x, this.positions[i + 1] = e.y, this.positions[i + 2] = e.z, this.rotations[u] = s.x, this.rotations[u + 1] = s.y, this.rotations[u + 2] = s.z, this.rotations[u + 3] = s.w, this.scales[y] = n.x, this.scales[y + 1] = n.y, this.scales[y + 2] = n.z, this.colors[m] = r.r, this.colors[m + 1] = r.g, this.colors[m + 2] = r.b, this.opacities[t] = o;
91
+ const o = e * 3, m = e * 4, y = e * 3, u = e * 3;
92
+ this.positions[o] = t.x, this.positions[o + 1] = t.y, this.positions[o + 2] = t.z, this.rotations[m] = s.x, this.rotations[m + 1] = s.y, this.rotations[m + 2] = s.z, this.rotations[m + 3] = s.w, this.scales[y] = n.x, this.scales[y + 1] = n.y, this.scales[y + 2] = n.z, this.colors[u] = r.r, this.colors[u + 1] = r.g, this.colors[u + 2] = r.b, this.opacities[e] = i;
93
93
  }
94
94
  /**
95
95
  * Get a splat's data
96
96
  * @param index Splat index
97
97
  * @returns Object containing splat data (linear scale)
98
98
  */
99
- getSplat(t) {
100
- if (t >= this.numSplats)
99
+ getSplat(e) {
100
+ if (e >= this.numSplats)
101
101
  throw new Error(
102
- `Splat index out of bounds: ${t} >= ${this.numSplats}`
102
+ `Splat index out of bounds: ${e} >= ${this.numSplats}`
103
103
  );
104
- const e = t * 3, s = t * 4, n = t * 3, r = t * 3;
104
+ const t = e * 3, s = e * 4, n = e * 3, r = e * 3;
105
105
  return {
106
- position: new l.Vector3(
107
- this.positions[e],
108
- this.positions[e + 1],
109
- this.positions[e + 2]
106
+ position: new c.Vector3(
107
+ this.positions[t],
108
+ this.positions[t + 1],
109
+ this.positions[t + 2]
110
110
  ),
111
- rotation: new l.Quaternion(
111
+ rotation: new c.Quaternion(
112
112
  this.rotations[s],
113
113
  this.rotations[s + 1],
114
114
  this.rotations[s + 2],
115
115
  this.rotations[s + 3]
116
116
  ),
117
117
  // Convert log scale back to linear scale for external use
118
- scale: new l.Vector3(
118
+ scale: new c.Vector3(
119
119
  Math.exp(this.scales[n]),
120
120
  Math.exp(this.scales[n + 1]),
121
121
  Math.exp(this.scales[n + 2])
122
122
  ),
123
- color: new l.Color(
123
+ color: new c.Color(
124
124
  this.colors[r],
125
125
  this.colors[r + 1],
126
126
  this.colors[r + 2]
127
127
  ),
128
- opacity: this.opacities[t]
128
+ opacity: this.opacities[e]
129
129
  };
130
130
  }
131
131
  /**
@@ -134,14 +134,14 @@ class jt {
134
134
  */
135
135
  calculateBoundingBox() {
136
136
  this.boundingBox.reset();
137
- const t = new l.Vector3();
138
- for (let e = 0; e < this.numSplats; e++) {
139
- const s = e * 3;
140
- t.set(
137
+ const e = new c.Vector3();
138
+ for (let t = 0; t < this.numSplats; t++) {
139
+ const s = t * 3;
140
+ e.set(
141
141
  this.positions[s],
142
142
  this.positions[s + 1],
143
143
  this.positions[s + 2]
144
- ), this.boundingBox.expandByPoint(t);
144
+ ), this.boundingBox.expandByPoint(e);
145
145
  }
146
146
  return this.boundingBox;
147
147
  }
@@ -150,134 +150,134 @@ class jt {
150
150
  * This is for visualization/debugging purposes only, not for rendering
151
151
  */
152
152
  createDebugGeometry() {
153
- const t = new l.BufferGeometry();
154
- t.setAttribute(
153
+ const e = new c.BufferGeometry();
154
+ e.setAttribute(
155
155
  "position",
156
- new l.BufferAttribute(this.positions, 3)
156
+ new c.BufferAttribute(this.positions, 3)
157
157
  );
158
- const e = new Float32Array(this.numSplats * 3), s = new l.Quaternion(), n = new l.Euler();
158
+ const t = new Float32Array(this.numSplats * 3), s = new c.Quaternion(), n = new c.Euler();
159
159
  for (let r = 0; r < this.numSplats; r++) {
160
- const o = r * 4, i = r * 3;
160
+ const i = r * 4, o = r * 3;
161
161
  s.set(
162
- this.rotations[o],
163
- this.rotations[o + 1],
164
- this.rotations[o + 2],
165
- this.rotations[o + 3]
166
- ), n.setFromQuaternion(s), e[i] = n.x, e[i + 1] = n.y, e[i + 2] = n.z;
162
+ this.rotations[i],
163
+ this.rotations[i + 1],
164
+ this.rotations[i + 2],
165
+ this.rotations[i + 3]
166
+ ), n.setFromQuaternion(s), t[o] = n.x, t[o + 1] = n.y, t[o + 2] = n.z;
167
167
  }
168
- return t.setAttribute(
168
+ return e.setAttribute(
169
169
  "rotation",
170
- new l.BufferAttribute(e, 3)
171
- ), t.setAttribute(
170
+ new c.BufferAttribute(t, 3)
171
+ ), e.setAttribute(
172
172
  "scale",
173
- new l.BufferAttribute(this.scales, 3)
174
- ), t.setAttribute(
173
+ new c.BufferAttribute(this.scales, 3)
174
+ ), e.setAttribute(
175
175
  "color",
176
- new l.BufferAttribute(this.colors, 3)
177
- ), t.setAttribute(
176
+ new c.BufferAttribute(this.colors, 3)
177
+ ), e.setAttribute(
178
178
  "opacity",
179
- new l.BufferAttribute(this.opacities, 1)
180
- ), t;
179
+ new c.BufferAttribute(this.opacities, 1)
180
+ ), e;
181
181
  }
182
182
  dispose() {
183
183
  this.numSplats = 0, this.scales = new Float32Array(0), this.colors = new Float32Array(0), this.positions = new Float32Array(0), this.rotations = new Float32Array(0), this.opacities = new Float32Array(0);
184
184
  }
185
185
  }
186
- class Ft {
186
+ class Ee {
187
187
  // Upper 8 bits of 16-bit means
188
- constructor(t, e, s) {
189
- x(this, "ranges");
190
- x(this, "version", 1);
191
- x(this, "numSplats", 0);
192
- x(this, "boundingBox", new wt());
188
+ constructor(e, t, s) {
189
+ d(this, "ranges");
190
+ d(this, "version", 1);
191
+ d(this, "numSplats", 0);
192
+ d(this, "boundingBox", new we());
193
193
  // Original SOGS textures
194
- x(this, "sh0");
194
+ d(this, "sh0");
195
195
  // SH DC coefficients + alpha
196
- x(this, "quats");
196
+ d(this, "quats");
197
197
  // Quaternion components + mode
198
- x(this, "scales");
198
+ d(this, "scales");
199
199
  // Scale values (8-bit)
200
- x(this, "means_l");
200
+ d(this, "means_l");
201
201
  // Lower 8 bits of 16-bit means
202
- x(this, "means_u");
203
- this.ranges = e, this.numSplats = t, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
202
+ d(this, "means_u");
203
+ this.ranges = t, this.numSplats = e, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
204
204
  }
205
205
  calculateBoundingBox() {
206
206
  this.boundingBox.reset();
207
- const { mins: t, maxs: e } = this.ranges.means, s = (n) => Math.sign(n) * (Math.exp(Math.abs(n)) - 1);
207
+ const { mins: e, maxs: t } = this.ranges.means, s = (n) => Math.sign(n) * (Math.exp(Math.abs(n)) - 1);
208
208
  return this.boundingBox.center.set(
209
- (s(t[0]) + s(e[0])) * 0.5,
210
- (s(t[1]) + s(e[1])) * 0.5,
211
- (s(t[2]) + s(e[2])) * 0.5
209
+ (s(e[0]) + s(t[0])) * 0.5,
210
+ (s(e[1]) + s(t[1])) * 0.5,
211
+ (s(e[2]) + s(t[2])) * 0.5
212
212
  ), this.boundingBox.halfExtents.set(
213
- (s(e[0]) - s(t[0])) * 0.5,
214
- (s(e[1]) - s(t[1])) * 0.5,
215
- (s(e[2]) - s(t[2])) * 0.5
213
+ (s(t[0]) - s(e[0])) * 0.5,
214
+ (s(t[1]) - s(e[1])) * 0.5,
215
+ (s(t[2]) - s(e[2])) * 0.5
216
216
  ), this.boundingBox;
217
217
  }
218
218
  dispose() {
219
219
  this.sh0.dispose(), this.quats.dispose(), this.scales.dispose(), this.means_l.dispose(), this.means_u.dispose();
220
220
  }
221
221
  }
222
- class Pt {
222
+ class qe {
223
223
  // Upper 8 bits of 16-bit means
224
- constructor(t, e, s) {
225
- x(this, "ranges");
226
- x(this, "version", 2);
227
- x(this, "numSplats", 0);
228
- x(this, "boundingBox", new wt());
224
+ constructor(e, t, s) {
225
+ d(this, "ranges");
226
+ d(this, "version", 2);
227
+ d(this, "numSplats", 0);
228
+ d(this, "boundingBox", new we());
229
229
  // Original SOGS textures
230
- x(this, "sh0");
230
+ d(this, "sh0");
231
231
  // SH DC coefficients + alpha
232
- x(this, "quats");
232
+ d(this, "quats");
233
233
  // Quaternion components + mode
234
- x(this, "scales");
234
+ d(this, "scales");
235
235
  // Scale values (8-bit)
236
- x(this, "means_l");
236
+ d(this, "means_l");
237
237
  // Lower 8 bits of 16-bit means
238
- x(this, "means_u");
239
- this.ranges = e, this.numSplats = t, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
238
+ d(this, "means_u");
239
+ this.ranges = t, this.numSplats = e, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
240
240
  }
241
241
  calculateBoundingBox() {
242
242
  this.boundingBox.reset();
243
- const { mins: t, maxs: e } = this.ranges.means, s = (n) => Math.sign(n) * (Math.exp(Math.abs(n)) - 1);
243
+ const { mins: e, maxs: t } = this.ranges.means, s = (n) => Math.sign(n) * (Math.exp(Math.abs(n)) - 1);
244
244
  return this.boundingBox.center.set(
245
- (s(t[0]) + s(e[0])) * 0.5,
246
- (s(t[1]) + s(e[1])) * 0.5,
247
- (s(t[2]) + s(e[2])) * 0.5
245
+ (s(e[0]) + s(t[0])) * 0.5,
246
+ (s(e[1]) + s(t[1])) * 0.5,
247
+ (s(e[2]) + s(t[2])) * 0.5
248
248
  ), this.boundingBox.halfExtents.set(
249
- (s(e[0]) - s(t[0])) * 0.5,
250
- (s(e[1]) - s(t[1])) * 0.5,
251
- (s(e[2]) - s(t[2])) * 0.5
249
+ (s(t[0]) - s(e[0])) * 0.5,
250
+ (s(t[1]) - s(e[1])) * 0.5,
251
+ (s(t[2]) - s(e[2])) * 0.5
252
252
  ), this.boundingBox;
253
253
  }
254
254
  dispose() {
255
255
  this.sh0.dispose(), this.quats.dispose(), this.scales.dispose(), this.means_l.dispose(), this.means_u.dispose();
256
256
  }
257
257
  }
258
- class At {
258
+ class Ae {
259
259
  // RGBA32UI - (Position + Rotation + Scale)
260
260
  // RGBA32UI Texture Content:
261
261
  // .r = Means Lower (RGB)
262
262
  // .g = Means Upper (RGB)
263
263
  // .b = Rotation (RGBA)
264
264
  // .a = Scale (RGB)
265
- constructor(t, e, s, n, r, o, i, u) {
265
+ constructor(e, t, s, n, r, i, o, m) {
266
266
  // Info data - cpu
267
- x(this, "numSplats");
268
- x(this, "textureWidth");
269
- x(this, "textureHeight");
270
- x(this, "ranges");
271
- x(this, "centers");
267
+ d(this, "numSplats");
268
+ d(this, "textureWidth");
269
+ d(this, "textureHeight");
270
+ d(this, "ranges");
271
+ d(this, "centers");
272
272
  // TODO: see if necesary or can be compressed somehow
273
- x(this, "boundingBox");
273
+ d(this, "boundingBox");
274
274
  // GPU Textures
275
- x(this, "packedColor");
275
+ d(this, "packedColor");
276
276
  // RGBA8 - (Color + Opacity)
277
277
  // RGBA8 Texture Content:
278
278
  // .rgb = Color, .a = Opacity
279
- x(this, "packedGeometry");
280
- this.numSplats = t, this.textureWidth = e, this.textureHeight = s, this.boundingBox = u, this.ranges = i, this.centers = n, this.packedColor = o, this.packedGeometry = r;
279
+ d(this, "packedGeometry");
280
+ this.numSplats = e, this.textureWidth = t, this.textureHeight = s, this.boundingBox = m, this.ranges = o, this.centers = n, this.packedColor = i, this.packedGeometry = r;
281
281
  }
282
282
  /**
283
283
  * Optional: Reconstruct a full JS object for a specific splat.
@@ -292,34 +292,34 @@ class At {
292
292
  // public abstract deserialize(): ISplat;
293
293
  // public abstract returnPacked(): ISplat;
294
294
  }
295
- class Yt extends l.EventDispatcher {
295
+ class Qe extends c.EventDispatcher {
296
296
  constructor() {
297
297
  super();
298
- x(this, "worker");
299
- x(this, "centers", null);
300
- x(this, "orderTexture", null);
298
+ d(this, "worker");
299
+ d(this, "centers", null);
300
+ d(this, "orderTexture", null);
301
301
  /** Bounding box data for optimization */
302
- x(this, "chunks", null);
303
- x(this, "lastCameraPosition", new l.Vector3());
304
- x(this, "lastCameraDirection", new l.Vector3());
305
- const e = this.createWorkerCode(), s = new Blob([e], { type: "application/javascript" });
302
+ d(this, "chunks", null);
303
+ d(this, "lastCameraPosition", new c.Vector3());
304
+ d(this, "lastCameraDirection", new c.Vector3());
305
+ const t = this.createWorkerCode(), s = new Blob([t], { type: "application/javascript" });
306
306
  this.worker = new Worker(URL.createObjectURL(s)), this.worker.onmessage = this.onWorkerMessage.bind(this);
307
307
  }
308
308
  /**
309
309
  * Handles messages received from the sorting worker.
310
310
  * @param event The message event from the worker.
311
311
  */
312
- onWorkerMessage(e) {
312
+ onWorkerMessage(t) {
313
313
  if (!this.orderTexture || !this.orderTexture.image)
314
314
  return console.error("SplatSorter: Order texture not initialized!");
315
- const { order: s, count: n } = e.data, r = this.orderTexture.image.data;
315
+ const { order: s, count: n } = t.data, r = this.orderTexture.image.data;
316
316
  if (!(r instanceof Uint32Array))
317
317
  return console.error(
318
318
  "SplatSorter: Order texture data is not a Uint32Array!"
319
319
  );
320
320
  r.set(new Uint32Array(s)), this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
321
- const o = r.buffer.slice(0), i = { order: o };
322
- this.worker.postMessage(i, [o]), this.dispatchEvent({ type: "updated", count: n });
321
+ const i = r.buffer.slice(0), o = { order: i };
322
+ this.worker.postMessage(o, [i]), this.dispatchEvent({ type: "updated", count: n });
323
323
  }
324
324
  /**
325
325
  * Initializes the sorter with necessary data and textures.
@@ -328,38 +328,38 @@ class Yt extends l.EventDispatcher {
328
328
  * @param chunks Optional: A Float32Array containing bounding box chunk data [minX, minY, minZ, maxX, maxY, maxZ, ...] for optimization.
329
329
  * @param transferOwnership Optional: If true, transfers ownership of centers buffer to worker (saves memory, main thread loses access). Default: false.
330
330
  */
331
- init(e, s, n, r = !1) {
332
- if (!e || !(e.image.data instanceof Uint32Array))
331
+ init(t, s, n, r = !1) {
332
+ if (!t || !(t.image.data instanceof Uint32Array))
333
333
  throw new Error("SplatSorter: Invalid orderTexture provided. Must be DataTexture with Uint32Array data.");
334
334
  if (!s || s.length % 3 !== 0)
335
335
  throw new Error("SplatSorter: Invalid centers array provided. Length must be multiple of 3.");
336
- if (e.image.data.length < s.length / 3)
336
+ if (t.image.data.length < s.length / 3)
337
337
  throw new Error("SplatSorter: orderTexture data buffer is smaller than the number of splats.");
338
338
  if (s.buffer.byteLength === 0)
339
339
  throw new Error(
340
340
  "SplatSorter: positions buffer is detached (likely React StrictMode + cached asset). "
341
341
  );
342
- const o = s.length / 3;
343
- this.orderTexture = e, r ? this.centers = null : this.centers = s.slice();
344
- const i = this.orderTexture.image.data;
345
- for (let h = 0; h < o; h++) i[h] = h;
342
+ const i = s.length / 3;
343
+ this.orderTexture = t, r ? this.centers = null : this.centers = s.slice();
344
+ const o = this.orderTexture.image.data;
345
+ for (let h = 0; h < i; h++) o[h] = h;
346
346
  this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
347
- const u = i.buffer.slice(0), y = r ? s.buffer : s.buffer.slice(0), m = {
348
- order: u,
347
+ const m = o.buffer.slice(0), y = r ? s.buffer : s.buffer.slice(0), u = {
348
+ order: m,
349
349
  centers: y
350
- }, c = [
351
- u,
350
+ }, l = [
351
+ m,
352
352
  y
353
353
  ];
354
354
  if (n) {
355
355
  this.chunks = n.slice();
356
356
  const h = this.chunks.buffer.slice(0);
357
- m.chunks = h, c.push(h);
357
+ u.chunks = h, l.push(h);
358
358
  }
359
- this.worker.postMessage(m, c), queueMicrotask(() => {
359
+ this.worker.postMessage(u, l), queueMicrotask(() => {
360
360
  this.dispatchEvent({
361
361
  type: "updated",
362
- count: o
362
+ count: i
363
363
  });
364
364
  });
365
365
  }
@@ -368,53 +368,53 @@ class Yt extends l.EventDispatcher {
368
368
  * The sorter will only consider splats whose original indices are present in the mapping.
369
369
  * @param mapping A Uint32Array where each element is the *original* index of a splat to include, or null to reset mapping.
370
370
  */
371
- setMapping(e) {
371
+ setMapping(t) {
372
372
  if (!this.centers)
373
373
  return console.warn(
374
374
  "SplatSorter: Cannot set mapping before initialization."
375
375
  );
376
376
  let s;
377
377
  const n = [];
378
- if (!e) {
379
- const u = this.centers.buffer.slice(0);
378
+ if (!t) {
379
+ const m = this.centers.buffer.slice(0);
380
380
  return s = {
381
- centers: u,
381
+ centers: m,
382
382
  mapping: null
383
- }, n.push(u), this.worker.postMessage(s, n);
383
+ }, n.push(m), this.worker.postMessage(s, n);
384
384
  }
385
- const r = new Float32Array(e.length * 3);
386
- for (let u = 0; u < e.length; u++) {
387
- const y = e[u];
385
+ const r = new Float32Array(t.length * 3);
386
+ for (let m = 0; m < t.length; m++) {
387
+ const y = t[m];
388
388
  if (y * 3 + 2 >= this.centers.length) {
389
389
  console.warn(
390
390
  `SplatSorter: Mapping index ${y} out of bounds.`
391
391
  );
392
392
  continue;
393
393
  }
394
- const m = y * 3, c = u * 3;
395
- r[c + 0] = this.centers[m + 0], r[c + 1] = this.centers[m + 1], r[c + 2] = this.centers[m + 2];
394
+ const u = y * 3, l = m * 3;
395
+ r[l + 0] = this.centers[u + 0], r[l + 1] = this.centers[u + 1], r[l + 2] = this.centers[u + 2];
396
396
  }
397
- const o = r.buffer.slice(0), i = e.buffer.slice(0);
397
+ const i = r.buffer.slice(0), o = t.buffer.slice(0);
398
398
  s = {
399
- centers: o,
400
- mapping: i
401
- }, n.push(o, i), this.worker.postMessage(s, n);
399
+ centers: i,
400
+ mapping: o
401
+ }, n.push(i, o), this.worker.postMessage(s, n);
402
402
  }
403
403
  /**
404
404
  * Updates the camera parameters used for sorting.
405
405
  * @param position The camera's position in the sorter's local coordinate space.
406
406
  * @param direction The camera's forward direction in the sorter's local coordinate space.
407
407
  */
408
- setCamera(e, s) {
409
- const n = this.lastCameraPosition.distanceToSquared(e) > 1e-7, r = this.lastCameraDirection.dot(s) < 0.9999;
408
+ setCamera(t, s) {
409
+ const n = this.lastCameraPosition.distanceToSquared(t) > 1e-7, r = this.lastCameraDirection.dot(s) < 0.9999;
410
410
  if (!n && !r)
411
411
  return;
412
- this.lastCameraPosition.copy(e), this.lastCameraDirection.copy(s);
413
- const o = {
414
- cameraPosition: { x: e.x, y: e.y, z: e.z },
412
+ this.lastCameraPosition.copy(t), this.lastCameraDirection.copy(s);
413
+ const i = {
414
+ cameraPosition: { x: t.x, y: t.y, z: t.z },
415
415
  cameraDirection: { x: s.x, y: s.y, z: s.z }
416
416
  };
417
- this.worker.postMessage(o);
417
+ this.worker.postMessage(i);
418
418
  }
419
419
  /**
420
420
  * Terminates the Web Worker and cleans up resources.
@@ -428,186 +428,336 @@ class Yt extends l.EventDispatcher {
428
428
  */
429
429
  createWorkerCode() {
430
430
  return `(${(function() {
431
- let s = null, n = null, r = null, o = null, i = null, u = null, y = !1;
432
- const m = { x: 0, y: 0, z: 0 }, c = { x: 0, y: 0, z: 0 }, h = { x: 0, y: 0, z: 0 }, d = { x: 0, y: 0, z: 0 };
431
+ let s = null, n = null, r = null, i = null, o = null, m = null, y = !1;
432
+ const u = { x: 0, y: 0, z: 0 }, l = { x: 0, y: 0, z: 0 }, h = { x: 0, y: 0, z: 0 }, f = { x: 0, y: 0, z: 0 };
433
433
  let w = null, A = null;
434
- const b = 32, z = new Array(b).fill(0), _ = new Array(b).fill(0), F = new Array(b).fill(0), O = (k, M, B) => {
435
- for (; k <= M; ) {
436
- const S = M + k >> 1, g = B(S);
437
- if (g > 0) k = S + 1;
434
+ const b = 32, B = new Array(b).fill(0), T = new Array(b).fill(0), E = new Array(b).fill(0), U = (C, M, k) => {
435
+ for (; C <= M; ) {
436
+ const S = M + C >> 1, g = k(S);
437
+ if (g > 0) C = S + 1;
438
438
  else if (g < 0) M = S - 1;
439
439
  else return S;
440
440
  }
441
- return ~k;
442
- }, V = () => {
443
- if (!s || !n || !i || !u)
441
+ return ~C;
442
+ }, R = () => {
443
+ if (!s || !n || !o || !m)
444
444
  return;
445
445
  if (n.length === 0) {
446
- const p = {
446
+ const x = {
447
447
  order: s.buffer,
448
448
  count: 0
449
449
  };
450
- self.postMessage(p, [s.buffer]), s = null;
450
+ self.postMessage(x, [s.buffer]), s = null;
451
451
  return;
452
452
  }
453
- const k = i.x, M = i.y, B = i.z, S = u.x, g = u.y, v = u.z, T = 1e-4, U = Math.abs(k - m.x) > T || Math.abs(M - m.y) > T || Math.abs(B - m.z) > T, I = Math.abs(S - c.x) > T || Math.abs(g - c.y) > T || Math.abs(v - c.z) > T;
454
- if (!y && !U && !I)
453
+ const C = o.x, M = o.y, k = o.z, S = m.x, g = m.y, v = m.z, O = 1e-4, V = Math.abs(C - u.x) > O || Math.abs(M - u.y) > O || Math.abs(k - u.z) > O, I = Math.abs(S - l.x) > O || Math.abs(g - l.y) > O || Math.abs(v - l.z) > O;
454
+ if (!y && !V && !I)
455
455
  return;
456
- y = !1, m.x = k, m.y = M, m.z = B, c.x = S, c.y = g, c.z = v;
457
- let P = 1 / 0, f = -1 / 0;
458
- for (let p = 0; p < 8; ++p) {
459
- const q = p & 1 ? h.x : d.x, L = p & 2 ? h.y : d.y, E = p & 4 ? h.z : d.z, G = q * S + L * g + E * v;
460
- P = Math.min(P, G), f = Math.max(f, G);
456
+ y = !1, u.x = C, u.y = M, u.z = k, l.x = S, l.y = g, l.z = v;
457
+ let q = 1 / 0, p = -1 / 0;
458
+ for (let x = 0; x < 8; ++x) {
459
+ const D = x & 1 ? h.x : f.x, L = x & 2 ? h.y : f.y, P = x & 4 ? h.z : f.z, G = D * S + L * g + P * v;
460
+ q = Math.min(q, G), p = Math.max(p, G);
461
461
  }
462
- const C = n.length / 3, Y = f - P, R = (1 << Math.max(
462
+ const _ = n.length / 3, H = p - q, F = (1 << Math.max(
463
463
  10,
464
- Math.min(20, Math.ceil(Math.log2(C / 4)))
464
+ Math.min(20, Math.ceil(Math.log2(_ / 4)))
465
465
  )) + 1;
466
- if ((!w || w.length !== C) && (w = new Uint32Array(C)), !A || A.length !== R ? A = new Uint32Array(R) : A.fill(0), Y < 1e-7) {
467
- for (let p = 0; p < C; ++p) w[p] = 0;
468
- A[0] = C;
466
+ if ((!w || w.length !== _) && (w = new Uint32Array(_)), !A || A.length !== F ? A = new Uint32Array(F) : A.fill(0), H < 1e-7) {
467
+ for (let x = 0; x < _; ++x) w[x] = 0;
468
+ A[0] = _;
469
469
  } else if (r && r.length > 0) {
470
- const p = r.length / 6;
471
- z.fill(0);
472
- for (let E = 0; E < p; ++E) {
473
- const G = E * 6, X = r[G + 0], j = r[G + 1], Q = r[G + 2], $ = r[G + 3], K = X * S + j * g + Q * v - P, tt = K - $, et = K + $, mt = Math.max(
470
+ const x = r.length / 6;
471
+ B.fill(0);
472
+ for (let P = 0; P < x; ++P) {
473
+ const G = P * 6, X = r[G + 0], j = r[G + 1], Q = r[G + 2], $ = r[G + 3], K = X * S + j * g + Q * v - q, ee = K - $, te = K + $, ue = Math.max(
474
474
  0,
475
- Math.floor(tt * b / Y)
476
- ), dt = Math.min(
475
+ Math.floor(ee * b / H)
476
+ ), de = Math.min(
477
477
  b,
478
- Math.ceil(et * b / Y)
478
+ Math.ceil(te * b / H)
479
479
  );
480
- for (let ot = mt; ot < dt; ++ot)
481
- z[ot]++;
480
+ for (let ie = ue; ie < de; ++ie)
481
+ B[ie]++;
482
482
  }
483
- let q = 0;
484
- for (let E = 0; E < b; ++E) q += z[E];
485
- F[0] = 0, _[0] = 0;
486
- for (let E = 1; E < b; ++E)
487
- F[E - 1] = z[E - 1] / q * R >>> 0, _[E] = _[E - 1] + F[E - 1];
488
- F[b - 1] = z[b - 1] / q * R >>> 0;
489
- const L = Y / b;
490
- for (let E = 0; E < C; ++E) {
491
- const G = E * 3, X = n[G + 0], j = n[G + 1], Q = n[G + 2], $ = X * S + j * g + Q * v, tt = (f - $) / L, et = Math.max(
483
+ let D = 0;
484
+ for (let P = 0; P < b; ++P) D += B[P];
485
+ E[0] = 0, T[0] = 0;
486
+ for (let P = 1; P < b; ++P)
487
+ E[P - 1] = B[P - 1] / D * F >>> 0, T[P] = T[P - 1] + E[P - 1];
488
+ E[b - 1] = B[b - 1] / D * F >>> 0;
489
+ const L = H / b;
490
+ for (let P = 0; P < _; ++P) {
491
+ const G = P * 3, X = n[G + 0], j = n[G + 1], Q = n[G + 2], $ = X * S + j * g + Q * v, ee = (p - $) / L, te = Math.max(
492
492
  0,
493
493
  Math.min(
494
494
  b - 1,
495
- Math.floor(tt)
495
+ Math.floor(ee)
496
496
  )
497
- ), mt = tt - et, dt = _[et] + F[et] * mt >>> 0, ot = Math.min(dt, R - 1);
498
- w[E] = ot, A[ot]++;
497
+ ), ue = ee - te, de = T[te] + E[te] * ue >>> 0, ie = Math.min(de, F - 1);
498
+ w[P] = ie, A[ie]++;
499
499
  }
500
500
  } else {
501
- const p = (R - 1) / Y;
502
- for (let q = 0; q < C; ++q) {
503
- const L = q * 3, E = n[L + 0], G = n[L + 1], X = n[L + 2], j = E * S + G * g + X * v, $ = (f - j) * p >>> 0, K = Math.min($, R - 1);
504
- w[q] = K, A[K]++;
501
+ const x = (F - 1) / H;
502
+ for (let D = 0; D < _; ++D) {
503
+ const L = D * 3, P = n[L + 0], G = n[L + 1], X = n[L + 2], j = P * S + G * g + X * v, $ = (p - j) * x >>> 0, K = Math.min($, F - 1);
504
+ w[D] = K, A[K]++;
505
505
  }
506
506
  }
507
- for (let p = 1; p < R; p++)
508
- A[p] += A[p - 1];
509
- for (let p = C - 1; p >= 0; p--) {
510
- const q = w[p], L = --A[q];
511
- s[L] = o ? o[p] : p;
507
+ for (let x = 1; x < F; x++)
508
+ A[x] += A[x - 1];
509
+ for (let x = _ - 1; x >= 0; x--) {
510
+ const D = w[x], L = --A[D];
511
+ s[L] = i ? i[x] : x;
512
512
  }
513
- const J = k * S + M * g + B * v, Z = (p) => {
513
+ const J = C * S + M * g + k * v, Z = (x) => {
514
514
  if (!s) return -1 / 0;
515
- const q = s[p], L = q;
515
+ const D = s[x], L = D;
516
516
  if (!n || L * 3 + 2 >= n.length)
517
517
  return -1 / 0;
518
- const E = L * 3;
519
- return n[E] * S + n[E + 1] * g + n[E + 2] * v - J;
518
+ const P = L * 3;
519
+ return n[P] * S + n[P + 1] * g + n[P + 2] * v - J;
520
520
  };
521
- let H = C;
522
- if (C > 0 && Z(C - 1) < 0) {
523
- const p = O(
521
+ let Y = _;
522
+ if (_ > 0 && Z(_ - 1) < 0) {
523
+ const x = U(
524
524
  0,
525
- C - 1,
525
+ _ - 1,
526
526
  Z
527
527
  );
528
- H = p < 0 ? ~p : p;
528
+ Y = x < 0 ? ~x : x;
529
529
  }
530
- const D = {
530
+ const z = {
531
531
  order: s.buffer,
532
- count: H
532
+ count: Y
533
533
  };
534
- self.postMessage(D, [s.buffer]), s = null;
534
+ self.postMessage(z, [s.buffer]), s = null;
535
535
  };
536
- self.onmessage = (k) => {
537
- const M = k.data;
536
+ self.onmessage = (C) => {
537
+ const M = C.data;
538
538
  M.order && (s = new Uint32Array(M.order));
539
- let B = !1;
540
- if (M.centers && (n = new Float32Array(M.centers), B = !0, y = !0), Object.prototype.hasOwnProperty.call(M, "mapping") && (o = M.mapping ? new Uint32Array(M.mapping) : null, y = !0), M.chunks) {
539
+ let k = !1;
540
+ if (M.centers && (n = new Float32Array(M.centers), k = !0, y = !0), Object.prototype.hasOwnProperty.call(M, "mapping") && (i = M.mapping ? new Uint32Array(M.mapping) : null, y = !0), M.chunks) {
541
541
  if (r = new Float32Array(M.chunks), r.length > 0 && r[3] > 0)
542
542
  for (let S = 0; S < r.length / 6; ++S) {
543
- const g = S * 6, v = r[g + 0], T = r[g + 1], U = r[g + 2], I = r[g + 3], P = r[g + 4], f = r[g + 5];
544
- r[g + 0] = (v + I) * 0.5, r[g + 1] = (T + P) * 0.5, r[g + 2] = (U + f) * 0.5, r[g + 3] = Math.sqrt(
545
- (I - v) ** 2 + (P - T) ** 2 + (f - U) ** 2
543
+ const g = S * 6, v = r[g + 0], O = r[g + 1], V = r[g + 2], I = r[g + 3], q = r[g + 4], p = r[g + 5];
544
+ r[g + 0] = (v + I) * 0.5, r[g + 1] = (O + q) * 0.5, r[g + 2] = (V + p) * 0.5, r[g + 3] = Math.sqrt(
545
+ (I - v) ** 2 + (q - O) ** 2 + (p - V) ** 2
546
546
  ) * 0.5;
547
547
  }
548
548
  y = !0;
549
549
  }
550
- if (B && n && n.length > 0) {
551
- h.x = d.x = n[0], h.y = d.y = n[1], h.z = d.z = n[2];
550
+ if (k && n && n.length > 0) {
551
+ h.x = f.x = n[0], h.y = f.y = n[1], h.z = f.z = n[2];
552
552
  for (let S = 1; S < n.length / 3; S++) {
553
553
  const g = S * 3;
554
- h.x = Math.min(h.x, n[g + 0]), d.x = Math.max(d.x, n[g + 0]), h.y = Math.min(h.y, n[g + 1]), d.y = Math.max(d.y, n[g + 1]), h.z = Math.min(h.z, n[g + 2]), d.z = Math.max(d.z, n[g + 2]);
554
+ h.x = Math.min(h.x, n[g + 0]), f.x = Math.max(f.x, n[g + 0]), h.y = Math.min(h.y, n[g + 1]), f.y = Math.max(f.y, n[g + 1]), h.z = Math.min(h.z, n[g + 2]), f.z = Math.max(f.z, n[g + 2]);
555
555
  }
556
- } else B && n && n.length === 0 && (h.x = d.x = h.y = d.y = h.z = d.z = 0);
557
- M.cameraPosition && (i = M.cameraPosition), M.cameraDirection && (u = M.cameraDirection), V();
556
+ } else k && n && n.length === 0 && (h.x = f.x = h.y = f.y = h.z = f.z = 0);
557
+ M.cameraPosition && (o = M.cameraPosition), M.cameraDirection && (m = M.cameraDirection), R();
558
558
  };
559
559
  }).toString()})();`;
560
560
  }
561
561
  }
562
- class Ht {
563
- constructor(t) {
564
- x(this, "packedGeometry");
562
+ const Je = {
563
+ type: "wave",
564
+ defaultDuration: 3,
565
+ shaderCode: (
566
+ /* glsl */
567
+ `
568
+ void applyAnimation(
569
+ inout vec3 position,
570
+ inout vec3 scale,
571
+ inout vec4 color,
572
+ float progress,
573
+ vec3 center
574
+ ) {
575
+ const float DIST_K = 0.3;
576
+ const float WAVE_GAIN = 1.2;
577
+ const float INV_WAVE_W = 20.0;
578
+ const vec3 GLOW = vec3(1.0, 1.0, 1.0);
579
+
580
+ float dist = length(position - center);
581
+ float normalizedDist = 1.0 - exp(-dist * DIST_K);
582
+ float waveProgress = progress * WAVE_GAIN;
583
+
584
+ float glowIntensity = clamp(1.0 - abs(normalizedDist - waveProgress) * INV_WAVE_W, 0.0, 1.0);
585
+ color.rgb = mix(color.rgb, GLOW, glowIntensity);
586
+ }
587
+ `
588
+ )
589
+ }, Ke = {
590
+ type: "spread",
591
+ defaultDuration: 3,
592
+ shaderCode: (
593
+ /* glsl */
594
+ `
595
+ void applyAnimation(
596
+ inout vec3 position,
597
+ inout vec3 scale,
598
+ inout vec4 color,
599
+ float progress,
600
+ vec3 center
601
+ ) {
602
+ const float DIST_K = 0.3;
603
+ const float WAVE_GAIN = 1.2;
604
+ const float SPHERE_LOG = -6.0;
605
+ const float INV_WAVE_W = 20.0; // 1.0 / 0.05 wave width, precomputed
606
+ const vec3 GOLD = vec3(1.0, 1.0, 1.0); // pure white
607
+
608
+ float dist = length(position - center);
609
+ float normalizedDist = 1.0 - exp(-dist * DIST_K);
610
+ float waveProgress = progress * WAVE_GAIN;
611
+
612
+ float revealed = step(normalizedDist, waveProgress);
613
+ scale = mix(vec3(SPHERE_LOG), scale, revealed);
614
+
615
+ float glowIntensity = clamp(1.0 - abs(normalizedDist - waveProgress) * INV_WAVE_W, 0.0, 1.0);
616
+ color.rgb = mix(color.rgb, GOLD, glowIntensity);
617
+ }
618
+ `
619
+ )
620
+ }, et = {
621
+ type: "none",
622
+ defaultDuration: 0,
623
+ shaderCode: (
624
+ /* glsl */
625
+ `
626
+ void applyAnimation(
627
+ inout vec3 position,
628
+ inout vec3 scale,
629
+ inout vec4 color,
630
+ float progress,
631
+ vec3 center
632
+ ) {}
633
+ `
634
+ )
635
+ }, Fe = {
636
+ spread: Ke,
637
+ wave: Je,
638
+ none: et
639
+ }, Le = (a) => Fe[a] ?? Fe.none, Te = {
640
+ linear: (a) => a,
641
+ easeInQuad: (a) => a * a,
642
+ easeOutQuad: (a) => a * (2 - a),
643
+ easeInOutQuad: (a) => a < 0.5 ? 2 * a * a : -1 + (4 - 2 * a) * a,
644
+ easeInCubic: (a) => a * a * a,
645
+ easeOutCubic: (a) => 1 - Math.pow(1 - a, 3),
646
+ easeInOutCubic: (a) => a < 0.5 ? 4 * a * a * a : 1 - Math.pow(-2 * a + 2, 3) / 2,
647
+ easeOutExpo: (a) => a === 1 ? 1 : 1 - Math.pow(2, -10 * a)
648
+ }, tt = (a) => Te[a] ?? Te.linear;
649
+ class st {
650
+ constructor(e) {
651
+ d(this, "_progress", 0);
652
+ d(this, "_isPlaying", !1);
653
+ d(this, "_isComplete", !1);
654
+ d(this, "_startTime", 0);
655
+ d(this, "_duration");
656
+ d(this, "_delay");
657
+ d(this, "_easing");
658
+ d(this, "_type");
659
+ d(this, "_autoPlay");
660
+ // Animation center (set from bounding box)
661
+ d(this, "_center", new c.Vector3());
662
+ const t = Le(e.type);
663
+ this._type = e.type, this._duration = e.duration ?? t.defaultDuration, this._delay = e.delay ?? 0, this._easing = tt(e.easing ?? "easeOutCubic"), this._autoPlay = e.autoPlay ?? !0;
664
+ }
665
+ /** Current progress 0-1 (eased) */
666
+ get progress() {
667
+ return this._progress;
668
+ }
669
+ get isPlaying() {
670
+ return this._isPlaying;
671
+ }
672
+ get isComplete() {
673
+ return this._isComplete;
674
+ }
675
+ get type() {
676
+ return this._type;
677
+ }
678
+ get center() {
679
+ return this._center;
680
+ }
681
+ /** Set the animation center point (typically bounding box center) */
682
+ setCenter(e) {
683
+ this._center.copy(e);
684
+ }
685
+ play() {
686
+ this._startTime = -1, this._isPlaying = !0, this._isComplete = !1, this._progress = 0;
687
+ }
688
+ stop() {
689
+ this._isPlaying = !1;
690
+ }
691
+ reset() {
692
+ this._progress = 0, this._isPlaying = !1, this._isComplete = !1, this._startTime = 0;
693
+ }
694
+ /** Skip to end state */
695
+ complete() {
696
+ this._progress = 1, this._isPlaying = !1, this._isComplete = !0;
697
+ }
698
+ /** Called from onBeforeRender - returns true if uniforms need update */
699
+ update(e) {
700
+ if (!this._isPlaying) return !1;
701
+ this._startTime < 0 && (this._startTime = e + this._delay);
702
+ const t = e - this._startTime;
703
+ if (t < 0) return !1;
704
+ const s = Math.min(t / this._duration, 1);
705
+ return this._progress = this._easing(s), s >= 1 && (this._isPlaying = !1, this._isComplete = !0, this._progress = 1), !0;
706
+ }
707
+ /** Should auto-play be triggered on load? */
708
+ shouldAutoPlay() {
709
+ return this._autoPlay && !this._isComplete;
710
+ }
711
+ }
712
+ class nt {
713
+ constructor(e) {
714
+ d(this, "packedGeometry");
565
715
  // RGBA32UI
566
- x(this, "packedColor");
716
+ d(this, "packedColor");
567
717
  // RGBA8
568
- x(this, "orderTexture");
718
+ d(this, "orderTexture");
569
719
  // RB32UI
570
- x(this, "width");
571
- x(this, "height");
572
- this.width = t.textureWidth, this.height = t.textureHeight, this.packedColor = this.createColorTexture(t), this.packedGeometry = this.createGeometryTexture(t), this.orderTexture = this.createOrderTexture(t.numSplats);
720
+ d(this, "width");
721
+ d(this, "height");
722
+ this.width = e.textureWidth, this.height = e.textureHeight, this.packedColor = this.createColorTexture(e), this.packedGeometry = this.createGeometryTexture(e), this.orderTexture = this.createOrderTexture(e.numSplats);
573
723
  }
574
- createGeometryTexture(t) {
575
- const e = new l.DataTexture(
576
- t.packedGeometry,
724
+ createGeometryTexture(e) {
725
+ const t = new c.DataTexture(
726
+ e.packedGeometry,
577
727
  this.width,
578
728
  this.height,
579
- l.RGBAIntegerFormat,
580
- l.UnsignedIntType
729
+ c.RGBAIntegerFormat,
730
+ c.UnsignedIntType
581
731
  );
582
- return e.internalFormat = "RGBA32UI", e.minFilter = l.NearestFilter, e.magFilter = l.NearestFilter, e.needsUpdate = !0, e;
732
+ return t.internalFormat = "RGBA32UI", t.minFilter = c.NearestFilter, t.magFilter = c.NearestFilter, t.needsUpdate = !0, t;
583
733
  }
584
- createColorTexture(t) {
585
- const e = new l.DataTexture(
586
- t.packedColor,
734
+ createColorTexture(e) {
735
+ const t = new c.DataTexture(
736
+ e.packedColor,
587
737
  this.width,
588
738
  this.height,
589
- l.RGBAFormat,
590
- l.UnsignedByteType
739
+ c.RGBAFormat,
740
+ c.UnsignedByteType
591
741
  );
592
- return e.minFilter = l.NearestFilter, e.magFilter = l.NearestFilter, e.needsUpdate = !0, e;
742
+ return t.minFilter = c.NearestFilter, t.magFilter = c.NearestFilter, t.needsUpdate = !0, t;
593
743
  }
594
- createOrderTexture(t) {
595
- const e = new Uint32Array(this.width * this.height);
596
- for (let n = 0; n < t; n++) e[n] = n;
597
- const s = new l.DataTexture(
598
- e,
744
+ createOrderTexture(e) {
745
+ const t = new Uint32Array(this.width * this.height);
746
+ for (let n = 0; n < e; n++) t[n] = n;
747
+ const s = new c.DataTexture(
748
+ t,
599
749
  this.width,
600
750
  this.height,
601
- l.RedIntegerFormat,
602
- l.UnsignedIntType
751
+ c.RedIntegerFormat,
752
+ c.UnsignedIntType
603
753
  );
604
- return s.minFilter = l.NearestFilter, s.magFilter = l.NearestFilter, s.needsUpdate = !0, s;
754
+ return s.minFilter = c.NearestFilter, s.magFilter = c.NearestFilter, s.needsUpdate = !0, s;
605
755
  }
606
756
  dispose() {
607
757
  this.packedGeometry.dispose(), this.packedColor.dispose(), this.orderTexture.dispose();
608
758
  }
609
759
  }
610
- const Zt = (
760
+ const Ve = (
611
761
  /* glsl */
612
762
  `
613
763
  precision highp float;
@@ -632,6 +782,12 @@ uniform vec3 scalesMax;
632
782
  uniform vec3 sh0Min;
633
783
  uniform vec3 sh0Max;
634
784
 
785
+ // --- Animation Uniforms ---
786
+ uniform float animationProgress; // 0 = start, 1 = complete
787
+ uniform vec3 animationCenter; // Center point for animation
788
+
789
+ /* @ANIMATION_CODE */
790
+
635
791
  // --- Attributes ---
636
792
  in uint splatInstanceIndex;
637
793
 
@@ -730,11 +886,10 @@ void main() {
730
886
  else if (mode == 2u) quat = vec4(abc.xy, d, abc.z); // stored (w,x,z)
731
887
  else quat = vec4(abc, d); // stored (w,x,y)
732
888
 
733
- // Decompress Scale
889
+ // Decompress Scale (log-space)
734
890
  uvec3 sB = unpackBytes(geom.w).xyz;
735
891
  vec3 sNorm = vec3(sB) * (1.0 / 255.0);
736
- vec3 sLerp = mix(scalesMin, scalesMax, sNorm);
737
- vec3 scale = exp(sLerp); // log scale stored
892
+ vec3 scale = mix(scalesMin, scalesMax, sNorm); // log-space scale
738
893
 
739
894
  // Decompress Color & Opacity
740
895
  vec4 clr;
@@ -742,6 +897,12 @@ void main() {
742
897
  clr.rgb = vec3(0.5) + sh * SH_C0;
743
898
  clr.a = colorRaw.a; // Opacity passed directly (linear or sigmoid handled by loader)
744
899
 
900
+ // --- Apply Animation (modifies position, scale, color in place) ---
901
+ /* @ANIMATION_CALL */
902
+
903
+ // Convert log-space scale to linear scale
904
+ scale = exp(scale);
905
+
745
906
  // --- Standard Gaussian Splat Projection ---
746
907
 
747
908
  // View Space Setup
@@ -795,9 +956,12 @@ void main() {
795
956
  float l2 = 2.0 * min(sqrt(2.0 * lambda2), vmin);
796
957
 
797
958
  // Discard tiny splats
798
- if (l1 < 2.0 && l2 < 2.0) {
799
- gl_Position = DISCARD_VERTEX;
800
- return;
959
+ // TODO: this branch might create some performance issues - check
960
+ if (animationProgress >= 1.0) {
961
+ if (l1 < 2.0 && l2 < 2.0) {
962
+ gl_Position = DISCARD_VERTEX;
963
+ return;
964
+ }
801
965
  }
802
966
 
803
967
  vec2 diagVec = normalize(vec2(offDiagonal, lambda1 - diagonal1));
@@ -832,7 +996,7 @@ void main() {
832
996
  vColor = vec4(max(clr.rgb, vec3(0.0)), clr.a);
833
997
  }
834
998
  `
835
- ), Xt = (
999
+ ), at = (
836
1000
  /* glsl */
837
1001
  `
838
1002
  precision highp float;
@@ -868,9 +1032,9 @@ void main(void) {
868
1032
  }
869
1033
  `
870
1034
  );
871
- class Qt extends l.ShaderMaterial {
1035
+ class rt extends c.ShaderMaterial {
872
1036
  constructor(t = {}) {
873
- const e = {
1037
+ const s = {
874
1038
  // Packed Textures
875
1039
  packedGeometry: { value: null },
876
1040
  // RGBA32UI: .r=MeansLow, .g=MeansHigh, .b=Quats, .a=Scales
@@ -879,36 +1043,42 @@ class Qt extends l.ShaderMaterial {
879
1043
  splatOrder: { value: null },
880
1044
  // Index map
881
1045
  // Decompression Ranges
882
- meansMin: { value: new l.Vector3() },
883
- meansMax: { value: new l.Vector3() },
884
- scalesMin: { value: new l.Vector3() },
885
- scalesMax: { value: new l.Vector3() },
886
- sh0Min: { value: new l.Vector3() },
887
- sh0Max: { value: new l.Vector3() },
1046
+ meansMin: { value: new c.Vector3() },
1047
+ meansMax: { value: new c.Vector3() },
1048
+ scalesMin: { value: new c.Vector3() },
1049
+ scalesMax: { value: new c.Vector3() },
1050
+ sh0Min: { value: new c.Vector3() },
1051
+ sh0Max: { value: new c.Vector3() },
888
1052
  // Render State
889
1053
  texWidth: { value: 0 },
890
- viewport: { value: new l.Vector2(1, 1) },
891
- numSplats: { value: 0 }
1054
+ viewport: { value: new c.Vector2(1, 1) },
1055
+ numSplats: { value: 0 },
1056
+ // Animation State
1057
+ animationProgress: { value: 1 },
1058
+ // 1 = no animation active
1059
+ animationCenter: { value: new c.Vector3() }
892
1060
  };
893
1061
  super({
894
- uniforms: e,
895
- vertexShader: Zt,
896
- fragmentShader: Xt,
1062
+ uniforms: s,
1063
+ vertexShader: Ve,
1064
+ fragmentShader: at,
897
1065
  transparent: !0,
898
- glslVersion: l.GLSL3,
899
- blendSrc: l.OneFactor,
900
- blendSrcAlpha: l.OneFactor,
901
- blending: l.CustomBlending,
902
- blendEquation: l.AddEquation,
903
- blendEquationAlpha: l.AddEquation,
904
- blendDst: l.OneMinusSrcAlphaFactor,
905
- blendDstAlpha: l.OneMinusSrcAlphaFactor,
1066
+ glslVersion: c.GLSL3,
1067
+ blendSrc: c.OneFactor,
1068
+ blendSrcAlpha: c.OneFactor,
1069
+ blending: c.CustomBlending,
1070
+ blendEquation: c.AddEquation,
1071
+ blendEquationAlpha: c.AddEquation,
1072
+ blendDst: c.OneMinusSrcAlphaFactor,
1073
+ blendDstAlpha: c.OneMinusSrcAlphaFactor,
906
1074
  depthTest: !0,
907
1075
  depthWrite: !1,
908
- side: l.DoubleSide,
1076
+ side: c.DoubleSide,
909
1077
  alphaTest: t.alphaTest ?? 0,
910
1078
  toneMapped: t.toneMapped ?? !1
911
- }), t.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending = l.NoBlending);
1079
+ });
1080
+ d(this, "_shaderTemplate");
1081
+ t.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending = c.NoBlending), this._shaderTemplate = Ve;
912
1082
  }
913
1083
  setTexWidth(t) {
914
1084
  this.uniforms.texWidth.value = t | 0;
@@ -918,8 +1088,8 @@ class Qt extends l.ShaderMaterial {
918
1088
  * @param width Viewport width
919
1089
  * @param height Viewport height
920
1090
  */
921
- updateViewport(t, e) {
922
- this.uniforms.viewport.value.set(t, e);
1091
+ updateViewport(t, s) {
1092
+ this.uniforms.viewport.value.set(t, s);
923
1093
  }
924
1094
  /**
925
1095
  * Set the main packed geometry texture (RGBA32UI)
@@ -952,41 +1122,78 @@ class Qt extends l.ShaderMaterial {
952
1122
  setNumSplats(t) {
953
1123
  this.uniforms.numSplats.value = t;
954
1124
  }
1125
+ /**
1126
+ * Configure animation effect. Rebuilds shader with effect's GLSL code.
1127
+ * @param effect - Animation effect to use (null to disable)
1128
+ */
1129
+ setAnimation(t) {
1130
+ let s = this._shaderTemplate;
1131
+ t && t.type !== "none" ? (s = s.replace(
1132
+ "/* @ANIMATION_CODE */",
1133
+ t.shaderCode
1134
+ ), s = s.replace(
1135
+ "/* @ANIMATION_CALL */",
1136
+ `if (animationProgress < 1.0) {
1137
+ applyAnimation(modelCenter, scale, clr, animationProgress, animationCenter);
1138
+ }`
1139
+ )) : (s = s.replace("/* @ANIMATION_CODE */", ""), s = s.replace("/* @ANIMATION_CALL */", "")), this.vertexShader = s, this.needsUpdate = !0;
1140
+ }
1141
+ /**
1142
+ * Set animation progress (0 = start, 1 = complete/no animation)
1143
+ */
1144
+ setAnimationProgress(t) {
1145
+ this.uniforms.animationProgress.value = t;
1146
+ }
1147
+ /**
1148
+ * Set animation center point
1149
+ */
1150
+ setAnimationCenter(t) {
1151
+ this.uniforms.animationCenter.value.copy(t);
1152
+ }
955
1153
  }
956
- const xt = class xt extends l.Mesh {
1154
+ const xe = class xe extends c.Mesh {
957
1155
  // Match shader constant
958
1156
  /**
959
1157
  * Create a new SplatMesh for rendering Gaussian splats
960
1158
  * @param splatData The splat data to render
961
1159
  * @param options Rendering options
962
1160
  */
963
- constructor(e, s = {}) {
964
- const n = new Qt(s), r = xt.createInstancedGeometry(e.numSplats, xt.INSTANCE_SIZE);
1161
+ constructor(t, s = {}) {
1162
+ const n = new rt(s), r = xe.createInstancedGeometry(t.numSplats, xe.INSTANCE_SIZE);
965
1163
  super(r, n);
966
- x(this, "sorter");
967
- x(this, "options");
968
- x(this, "splatData");
969
- x(this, "textureManager");
970
- x(this, "material");
971
- x(this, "geometry");
972
- x(this, "lastCameraPositionLocal", new l.Vector3());
973
- x(this, "lastCameraDirectionLocal", new l.Vector3());
974
- x(this, "invModelMatrix", new l.Matrix4());
1164
+ d(this, "sorter");
1165
+ d(this, "options");
1166
+ d(this, "splatData");
1167
+ d(this, "textureManager");
1168
+ /** Animation controller (null if no animation configured) */
1169
+ d(this, "animation", null);
1170
+ d(this, "material");
1171
+ d(this, "geometry");
1172
+ d(this, "lastCameraPositionLocal", new c.Vector3());
1173
+ d(this, "lastCameraDirectionLocal", new c.Vector3());
1174
+ d(this, "invModelMatrix", new c.Matrix4());
975
1175
  // Cached inverse matrix
976
- x(this, "_vpW", -1);
977
- x(this, "_vpH", -1);
978
- x(this, "_size", new l.Vector2());
979
- x(this, "_camPosW", new l.Vector3());
980
- x(this, "_camDirW", new l.Vector3());
981
- x(this, "_camPosL", new l.Vector3());
982
- x(this, "_camDirL", new l.Vector3());
983
- x(this, "onSorterUpdated", (e) => {
984
- const s = e.count;
985
- this.geometry.instanceCount = Math.ceil(s / xt.INSTANCE_SIZE), this.material.setNumSplats(s);
1176
+ d(this, "_vpW", -1);
1177
+ d(this, "_vpH", -1);
1178
+ d(this, "_size", new c.Vector2());
1179
+ d(this, "_camPosW", new c.Vector3());
1180
+ d(this, "_camDirW", new c.Vector3());
1181
+ d(this, "_camPosL", new c.Vector3());
1182
+ d(this, "_camDirL", new c.Vector3());
1183
+ d(this, "onSorterUpdated", (t) => {
1184
+ const s = t.count;
1185
+ this.geometry.instanceCount = Math.ceil(s / xe.INSTANCE_SIZE), this.material.setNumSplats(s);
986
1186
  });
987
- this.geometry = r, this.material = n, this.options = { autoSort: !0, ...s }, this.splatData = e, this.frustumCulled = !1, this.sorter = new Yt(), this.textureManager = new Ht(e);
988
- let o = this.createChunks() || void 0;
989
- o === null && console.warn("Visus: Could not create sorter chunks, bounding box might be invalid."), o = void 0, this.sorter.addEventListener("updated", this.onSorterUpdated), this.sorter.init(this.textureManager.orderTexture, this.splatData.centers, o ?? void 0, !this.options.keepSplatData), this.material.setRanges(e.ranges), this.material.setTexWidth(e.textureWidth), this.material.setPackedColor(this.textureManager.packedColor), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setPackedGeometry(this.textureManager.packedGeometry), this.material.setNumSplats(0), this.geometry.boundingBox = e.boundingBox.toBox3(), this.geometry.boundingSphere = new l.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.options.keepSplatData || (this.splatData = null);
1187
+ this.geometry = r, this.material = n, this.options = { autoSort: !0, ...s }, this.splatData = t, this.frustumCulled = !1, this.sorter = new Qe(), this.textureManager = new nt(t);
1188
+ let i = this.createChunks() || void 0;
1189
+ if (i === null && console.warn("Visus: Could not create sorter chunks, bounding box might be invalid."), i = void 0, this.sorter.addEventListener("updated", this.onSorterUpdated), this.sorter.init(this.textureManager.orderTexture, this.splatData.centers, i ?? void 0, !this.options.keepSplatData), this.material.setRanges(t.ranges), this.material.setTexWidth(t.textureWidth), this.material.setPackedColor(this.textureManager.packedColor), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setPackedGeometry(this.textureManager.packedGeometry), this.material.setNumSplats(0), s.animation && s.animation.type !== "none") {
1190
+ this.animation = new st(s.animation);
1191
+ const o = new c.Vector3();
1192
+ t.boundingBox.toBox3().getCenter(o), this.animation.setCenter(o);
1193
+ const m = Le(s.animation.type);
1194
+ this.material.setAnimation(m), this.material.setAnimationCenter(o), this.material.setAnimationProgress(0);
1195
+ }
1196
+ this.geometry.boundingBox = t.boundingBox.toBox3(), this.geometry.boundingSphere = new c.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.options.keepSplatData || (this.splatData = null);
990
1197
  }
991
1198
  /**
992
1199
  * Creates the instanced geometry for rendering splats.
@@ -994,8 +1201,8 @@ const xt = class xt extends l.Mesh {
994
1201
  * @param instanceSize Number of splats per instance.
995
1202
  * @returns InstancedBufferGeometry
996
1203
  */
997
- static createInstancedGeometry(e, s) {
998
- const n = Math.ceil(e / s), r = new l.BufferGeometry(), o = new Float32Array([
1204
+ static createInstancedGeometry(t, s) {
1205
+ const n = Math.ceil(t / s), r = new c.BufferGeometry(), i = new Float32Array([
999
1206
  // x, y, splat_index_in_instance
1000
1207
  -1,
1001
1208
  -1,
@@ -1009,24 +1216,24 @@ const xt = class xt extends l.Mesh {
1009
1216
  -1,
1010
1217
  1,
1011
1218
  0
1012
- ]), i = new Uint16Array([0, 1, 2, 0, 2, 3]), u = new Float32Array(4 * 3 * s);
1219
+ ]), o = new Uint16Array([0, 1, 2, 0, 2, 3]), m = new Float32Array(4 * 3 * s);
1013
1220
  for (let h = 0; h < s; h++) {
1014
- const d = h * 4 * 3;
1221
+ const f = h * 4 * 3;
1015
1222
  for (let w = 0; w < 4; w++)
1016
- u[d + w * 3 + 0] = o[w * 3 + 0], u[d + w * 3 + 1] = o[w * 3 + 1], u[d + w * 3 + 2] = h;
1223
+ m[f + w * 3 + 0] = i[w * 3 + 0], m[f + w * 3 + 1] = i[w * 3 + 1], m[f + w * 3 + 2] = h;
1017
1224
  }
1018
1225
  const y = new Uint32Array(6 * s);
1019
1226
  for (let h = 0; h < s; h++) {
1020
- const d = h * 6, w = h * 4;
1021
- y[d + 0] = i[0] + w, y[d + 1] = i[1] + w, y[d + 2] = i[2] + w, y[d + 3] = i[3] + w, y[d + 4] = i[4] + w, y[d + 5] = i[5] + w;
1227
+ const f = h * 6, w = h * 4;
1228
+ y[f + 0] = o[0] + w, y[f + 1] = o[1] + w, y[f + 2] = o[2] + w, y[f + 3] = o[3] + w, y[f + 4] = o[4] + w, y[f + 5] = o[5] + w;
1022
1229
  }
1023
- r.setAttribute("position", new l.BufferAttribute(u, 3)), r.setIndex(new l.BufferAttribute(y, 1));
1024
- const m = new l.InstancedBufferGeometry();
1025
- m.index = r.index, m.setAttribute("position", r.getAttribute("position"));
1026
- const c = new Uint32Array(n);
1230
+ r.setAttribute("position", new c.BufferAttribute(m, 3)), r.setIndex(new c.BufferAttribute(y, 1));
1231
+ const u = new c.InstancedBufferGeometry();
1232
+ u.index = r.index, u.setAttribute("position", r.getAttribute("position"));
1233
+ const l = new Uint32Array(n);
1027
1234
  for (let h = 0; h < n; h++)
1028
- c[h] = h * s;
1029
- return m.setAttribute("splatInstanceIndex", new l.InstancedBufferAttribute(c, 1, !1)), m.instanceCount = 0, m;
1235
+ l[h] = h * s;
1236
+ return u.setAttribute("splatInstanceIndex", new c.InstancedBufferAttribute(l, 1, !1)), u.instanceCount = 0, u;
1030
1237
  }
1031
1238
  /**
1032
1239
  * Create chunks data (bounding box min/max) for the sorter.
@@ -1035,14 +1242,14 @@ const xt = class xt extends l.Mesh {
1035
1242
  createChunks() {
1036
1243
  if (!this.splatData)
1037
1244
  return null;
1038
- const e = this.splatData.boundingBox;
1039
- return e.min.x === 1 / 0 || e.max.x === -1 / 0 ? null : new Float32Array([
1040
- e.min.x,
1041
- e.min.y,
1042
- e.min.z,
1043
- e.max.x,
1044
- e.max.y,
1045
- e.max.z
1245
+ const t = this.splatData.boundingBox;
1246
+ return t.min.x === 1 / 0 || t.max.x === -1 / 0 ? null : new Float32Array([
1247
+ t.min.x,
1248
+ t.min.y,
1249
+ t.min.z,
1250
+ t.max.x,
1251
+ t.max.y,
1252
+ t.max.z
1046
1253
  ]);
1047
1254
  }
1048
1255
  /**
@@ -1050,15 +1257,15 @@ const xt = class xt extends l.Mesh {
1050
1257
  * @param width Viewport width
1051
1258
  * @param height Viewport height
1052
1259
  */
1053
- updateViewport(e, s) {
1054
- e === this._vpW && s === this._vpH || (this._vpW = e, this._vpH = s, this.material.updateViewport(e, s));
1260
+ updateViewport(t, s) {
1261
+ t === this._vpW && s === this._vpH || (this._vpW = t, this._vpH = s, this.material.updateViewport(t, s));
1055
1262
  }
1056
1263
  /**
1057
1264
  * Sorts splats based on camera position and direction.
1058
1265
  * @param camera The camera to sort against.
1059
1266
  */
1060
- sort(e) {
1061
- e.getWorldPosition(this._camPosW), e.getWorldDirection(this._camDirW), this.invModelMatrix.copy(this.matrixWorld).invert(), this._camPosL.copy(this._camPosW).applyMatrix4(this.invModelMatrix), this._camDirL.copy(this._camDirW).transformDirection(this.invModelMatrix);
1267
+ sort(t) {
1268
+ t.getWorldPosition(this._camPosW), t.getWorldDirection(this._camDirW), this.invModelMatrix.copy(this.matrixWorld).invert(), this._camPosL.copy(this._camPosW).applyMatrix4(this.invModelMatrix), this._camDirL.copy(this._camDirW).transformDirection(this.invModelMatrix);
1062
1269
  const s = this.lastCameraPositionLocal.distanceToSquared(this._camPosL) > 1e-6, n = this.lastCameraDirectionLocal.dot(this._camDirL) < 0.999;
1063
1270
  this.options.autoSort && (s || n) && (this.lastCameraPositionLocal.copy(this._camPosL), this.lastCameraDirectionLocal.copy(this._camDirL), this.sorter.setCamera(this._camPosL, this._camDirL));
1064
1271
  }
@@ -1071,8 +1278,13 @@ const xt = class xt extends l.Mesh {
1071
1278
  */
1072
1279
  // prettier-ignore
1073
1280
  // @ts-expect-error scene is not used
1074
- onBeforeRender(e, s, n) {
1075
- this.sort(n), e.getSize(this._size), this.updateViewport(this._size.x, this._size.y);
1281
+ onBeforeRender(t, s, n) {
1282
+ if (this.sort(n), t.getSize(this._size), this.updateViewport(this._size.x, this._size.y), this.animation) {
1283
+ if (!this.animation.isPlaying && this.animation.shouldAutoPlay()) return this.animation.play();
1284
+ if (!this.animation.isPlaying || this.animation.isComplete) return;
1285
+ const r = performance.now() / 1e3;
1286
+ this.animation.update(r) && this.material.setAnimationProgress(this.animation.progress);
1287
+ }
1076
1288
  }
1077
1289
  /**
1078
1290
  * Dispose of resources
@@ -1082,33 +1294,33 @@ const xt = class xt extends l.Mesh {
1082
1294
  }
1083
1295
  };
1084
1296
  /** Number of splats combined into a single instanced draw call. */
1085
- x(xt, "INSTANCE_SIZE", 128);
1086
- let Rt = xt;
1087
- const ft = 0.28209479177387814;
1088
- class gt {
1297
+ d(xe, "INSTANCE_SIZE", 128);
1298
+ let Re = xe;
1299
+ const fe = 0.28209479177387814;
1300
+ class ge {
1089
1301
  /**
1090
1302
  * Packs PLY data (Float32) into the Unified SOGS-like Format.
1091
1303
  */
1092
1304
  // prettier-ignore
1093
- static packPly(t) {
1094
- const e = t.numSplats, s = Math.ceil(Math.sqrt(e)), n = Math.ceil(e / s), r = s * n, { ranges: o, colorScale: i } = this.calculatePlyRanges(t), u = new Uint32Array(r * 4), y = new Uint8Array(r * 4), m = new l.Quaternion();
1095
- for (let c = 0; c < e; c++) {
1096
- const h = c * 4, d = c * 3, w = c * 4, A = t.positions[d + 0], b = t.positions[d + 1], z = t.positions[d + 2], _ = this.clamp01(this.norm(A, o.means.min.x, o.means.max.x)), F = this.clamp01(this.norm(b, o.means.min.y, o.means.max.y)), O = this.clamp01(this.norm(z, o.means.min.z, o.means.max.z)), V = _ * 65535 | 0, k = F * 65535 | 0, M = O * 65535 | 0;
1097
- u[h + 0] = this.pack4Bytes(V & 255, k & 255, M & 255, 0), u[h + 1] = this.pack4Bytes(V >> 8, k >> 8, M >> 8, 0), m.set(t.rotations[w], t.rotations[w + 1], t.rotations[w + 2], t.rotations[w + 3]).normalize();
1098
- let B = m.w, S = m.x, g = m.y, v = m.z;
1099
- const T = Math.abs(B), U = Math.abs(S), I = Math.abs(g), P = Math.abs(v);
1100
- let f = 0, C = T;
1101
- U > C && (C = U, f = 1), I > C && (C = I, f = 2), P > C && (C = P, f = 3), (f === 0 ? B : f === 1 ? S : f === 2 ? g : v) < 0 && (B = -B, S = -S, g = -g, v = -v);
1102
- let W = 0, R = 0, J = 0;
1103
- f === 0 && (W = S, R = g, J = v), f === 1 && (W = B, R = g, J = v), f === 2 && (W = B, R = S, J = v), f === 3 && (W = B, R = S, J = g);
1104
- const Z = (et) => Math.min(255, Math.max(0, Math.round((0.5 + et / Math.SQRT2) * 255)));
1105
- u[h + 2] = this.pack4Bytes(Z(W), Z(R), Z(J), f);
1106
- const H = this.norm(t.scales[d + 0], o.scales.min.x, o.scales.max.x), D = this.norm(t.scales[d + 1], o.scales.min.y, o.scales.max.y), p = this.norm(t.scales[d + 2], o.scales.min.z, o.scales.max.z);
1107
- u[h + 3] = this.pack4Bytes(Math.floor(H * 255), Math.floor(D * 255), Math.floor(p * 255), 0);
1108
- const q = this.clamp01(t.colors[d + 0] * i), L = this.clamp01(t.colors[d + 1] * i), E = this.clamp01(t.colors[d + 2] * i), G = (q - 0.5) / ft, X = (L - 0.5) / ft, j = (E - 0.5) / ft, Q = this.clamp01(this.norm(G, o.sh0.min.x, o.sh0.max.x)), $ = this.clamp01(this.norm(X, o.sh0.min.y, o.sh0.max.y)), K = this.clamp01(this.norm(j, o.sh0.min.z, o.sh0.max.z)), tt = this.clamp01(t.opacities[c]);
1109
- y[h + 0] = Math.round(Q * 255), y[h + 1] = Math.round($ * 255), y[h + 2] = Math.round(K * 255), y[h + 3] = Math.round(tt * 255);
1305
+ static packPly(e) {
1306
+ const t = e.numSplats, s = Math.ceil(Math.sqrt(t)), n = Math.ceil(t / s), r = s * n, { ranges: i, colorScale: o } = this.calculatePlyRanges(e), m = new Uint32Array(r * 4), y = new Uint8Array(r * 4), u = new c.Quaternion();
1307
+ for (let l = 0; l < t; l++) {
1308
+ const h = l * 4, f = l * 3, w = l * 4, A = e.positions[f + 0], b = e.positions[f + 1], B = e.positions[f + 2], T = this.clamp01(this.norm(A, i.means.min.x, i.means.max.x)), E = this.clamp01(this.norm(b, i.means.min.y, i.means.max.y)), U = this.clamp01(this.norm(B, i.means.min.z, i.means.max.z)), R = T * 65535 | 0, C = E * 65535 | 0, M = U * 65535 | 0;
1309
+ m[h + 0] = this.pack4Bytes(R & 255, C & 255, M & 255, 0), m[h + 1] = this.pack4Bytes(R >> 8, C >> 8, M >> 8, 0), u.set(e.rotations[w], e.rotations[w + 1], e.rotations[w + 2], e.rotations[w + 3]).normalize();
1310
+ let k = u.w, S = u.x, g = u.y, v = u.z;
1311
+ const O = Math.abs(k), V = Math.abs(S), I = Math.abs(g), q = Math.abs(v);
1312
+ let p = 0, _ = O;
1313
+ V > _ && (_ = V, p = 1), I > _ && (_ = I, p = 2), q > _ && (_ = q, p = 3), (p === 0 ? k : p === 1 ? S : p === 2 ? g : v) < 0 && (k = -k, S = -S, g = -g, v = -v);
1314
+ let W = 0, F = 0, J = 0;
1315
+ p === 0 && (W = S, F = g, J = v), p === 1 && (W = k, F = g, J = v), p === 2 && (W = k, F = S, J = v), p === 3 && (W = k, F = S, J = g);
1316
+ const Z = (te) => Math.min(255, Math.max(0, Math.round((0.5 + te / Math.SQRT2) * 255)));
1317
+ m[h + 2] = this.pack4Bytes(Z(W), Z(F), Z(J), p);
1318
+ const Y = this.norm(e.scales[f + 0], i.scales.min.x, i.scales.max.x), z = this.norm(e.scales[f + 1], i.scales.min.y, i.scales.max.y), x = this.norm(e.scales[f + 2], i.scales.min.z, i.scales.max.z);
1319
+ m[h + 3] = this.pack4Bytes(Math.floor(Y * 255), Math.floor(z * 255), Math.floor(x * 255), 0);
1320
+ const D = this.clamp01(e.colors[f + 0] * o), L = this.clamp01(e.colors[f + 1] * o), P = this.clamp01(e.colors[f + 2] * o), G = (D - 0.5) / fe, X = (L - 0.5) / fe, j = (P - 0.5) / fe, Q = this.clamp01(this.norm(G, i.sh0.min.x, i.sh0.max.x)), $ = this.clamp01(this.norm(X, i.sh0.min.y, i.sh0.max.y)), K = this.clamp01(this.norm(j, i.sh0.min.z, i.sh0.max.z)), ee = this.clamp01(e.opacities[l]);
1321
+ y[h + 0] = Math.round(Q * 255), y[h + 1] = Math.round($ * 255), y[h + 2] = Math.round(K * 255), y[h + 3] = Math.round(ee * 255);
1110
1322
  }
1111
- return new At(e, s, n, t.positions, u, y, o, t.boundingBox);
1323
+ return new Ae(t, s, n, e.positions, m, y, i, e.boundingBox);
1112
1324
  }
1113
1325
  /**
1114
1326
  * Packs SOGS data.
@@ -1116,176 +1328,176 @@ class gt {
1116
1328
  * Decodes centers for sorting.
1117
1329
  */
1118
1330
  // prettier-ignore
1119
- static packSogs(t) {
1120
- var g, v, T;
1121
- const e = t.numSplats;
1122
- let s = Math.ceil(Math.sqrt(e)), n = Math.ceil(e / s);
1123
- const r = ((g = t.means_l) == null ? void 0 : g.image) ?? ((v = t.sh0) == null ? void 0 : v.image) ?? ((T = t.quats) == null ? void 0 : T.image);
1331
+ static packSogs(e) {
1332
+ var g, v, O;
1333
+ const t = e.numSplats;
1334
+ let s = Math.ceil(Math.sqrt(t)), n = Math.ceil(t / s);
1335
+ const r = ((g = e.means_l) == null ? void 0 : g.image) ?? ((v = e.sh0) == null ? void 0 : v.image) ?? ((O = e.quats) == null ? void 0 : O.image);
1124
1336
  r && typeof r.width == "number" && typeof r.height == "number" && (s = r.width, n = r.height);
1125
- const o = s * n;
1126
- if (o < e) throw new Error(`SOG v1 texture too small: ${s}x${n}=${o} < count=${e}`);
1127
- const i = this.convertSogsRanges(t.ranges), u = t.ranges.means.mins[0], y = t.ranges.means.mins[1], m = t.ranges.means.mins[2], c = t.ranges.means.maxs[0], h = t.ranges.means.maxs[1], d = t.ranges.means.maxs[2], w = (U) => Math.sign(U) * (Math.exp(Math.abs(U)) - 1), A = new l.Vector3(
1128
- w(u),
1337
+ const i = s * n;
1338
+ if (i < t) throw new Error(`SOG v1 texture too small: ${s}x${n}=${i} < count=${t}`);
1339
+ const o = this.convertSogsRanges(e.ranges), m = e.ranges.means.mins[0], y = e.ranges.means.mins[1], u = e.ranges.means.mins[2], l = e.ranges.means.maxs[0], h = e.ranges.means.maxs[1], f = e.ranges.means.maxs[2], w = (V) => Math.sign(V) * (Math.exp(Math.abs(V)) - 1), A = new c.Vector3(
1340
+ w(m),
1129
1341
  w(y),
1130
- w(m)
1131
- ), b = new l.Vector3(
1132
- w(c),
1342
+ w(u)
1343
+ ), b = new c.Vector3(
1344
+ w(l),
1133
1345
  w(h),
1134
- w(d)
1346
+ w(f)
1135
1347
  );
1136
- i.means.min.copy(A), i.means.max.copy(b);
1137
- const z = t, _ = this.getPixels(z.means_l), F = this.getPixels(z.means_u), O = this.getPixels(z.quats), V = this.getPixels(z.scales), k = this.getPixels(z.sh0), M = new Uint32Array(o * 4), B = new Uint8Array(o * 4), S = new Float32Array(e * 3);
1138
- for (let U = 0; U < e; U++) {
1139
- const I = U * 4, P = F[I + 0], f = _[I + 0], C = F[I + 1], Y = _[I + 1], W = F[I + 2], R = _[I + 2], J = (P << 8 | f) / 65535, Z = (C << 8 | Y) / 65535, H = (W << 8 | R) / 65535, D = this.sogsDecode(J, u, c), p = this.sogsDecode(Z, y, h), q = this.sogsDecode(H, m, d);
1140
- S[U * 3 + 0] = D, S[U * 3 + 1] = p, S[U * 3 + 2] = q;
1141
- const L = this.clamp01(this.norm(D, A.x, b.x)) * 65535 | 0, E = this.clamp01(this.norm(p, A.y, b.y)) * 65535 | 0, G = this.clamp01(this.norm(q, A.z, b.z)) * 65535 | 0;
1142
- M[I + 0] = this.pack4Bytes(L & 255, E & 255, G & 255, 0), M[I + 1] = this.pack4Bytes(L >> 8, E >> 8, G >> 8, 0), M[I + 3] = this.pack4Bytes(V[I], V[I + 1], V[I + 2], 0);
1143
- const j = O[I + 3] - 252;
1144
- M[I + 2] = this.pack4Bytes(O[I + 0], O[I + 1], O[I + 2], j), B[I + 0] = k[I], B[I + 1] = k[I + 1], B[I + 2] = k[I + 2];
1145
- const Q = k[I + 3] / 255, $ = t.ranges.sh0.mins[3] + (t.ranges.sh0.maxs[3] - t.ranges.sh0.mins[3]) * Q, K = 1 / (1 + Math.exp(-$));
1146
- B[I + 3] = Math.round(Math.max(0, Math.min(1, K)) * 255);
1348
+ o.means.min.copy(A), o.means.max.copy(b);
1349
+ const B = e, T = this.getPixels(B.means_l), E = this.getPixels(B.means_u), U = this.getPixels(B.quats), R = this.getPixels(B.scales), C = this.getPixels(B.sh0), M = new Uint32Array(i * 4), k = new Uint8Array(i * 4), S = new Float32Array(t * 3);
1350
+ for (let V = 0; V < t; V++) {
1351
+ const I = V * 4, q = E[I + 0], p = T[I + 0], _ = E[I + 1], H = T[I + 1], W = E[I + 2], F = T[I + 2], J = (q << 8 | p) / 65535, Z = (_ << 8 | H) / 65535, Y = (W << 8 | F) / 65535, z = this.sogsDecode(J, m, l), x = this.sogsDecode(Z, y, h), D = this.sogsDecode(Y, u, f);
1352
+ S[V * 3 + 0] = z, S[V * 3 + 1] = x, S[V * 3 + 2] = D;
1353
+ const L = this.clamp01(this.norm(z, A.x, b.x)) * 65535 | 0, P = this.clamp01(this.norm(x, A.y, b.y)) * 65535 | 0, G = this.clamp01(this.norm(D, A.z, b.z)) * 65535 | 0;
1354
+ M[I + 0] = this.pack4Bytes(L & 255, P & 255, G & 255, 0), M[I + 1] = this.pack4Bytes(L >> 8, P >> 8, G >> 8, 0), M[I + 3] = this.pack4Bytes(R[I], R[I + 1], R[I + 2], 0);
1355
+ const j = U[I + 3] - 252;
1356
+ M[I + 2] = this.pack4Bytes(U[I + 0], U[I + 1], U[I + 2], j), k[I + 0] = C[I], k[I + 1] = C[I + 1], k[I + 2] = C[I + 2];
1357
+ const Q = C[I + 3] / 255, $ = e.ranges.sh0.mins[3] + (e.ranges.sh0.maxs[3] - e.ranges.sh0.mins[3]) * Q, K = 1 / (1 + Math.exp(-$));
1358
+ k[I + 3] = Math.round(Math.max(0, Math.min(1, K)) * 255);
1147
1359
  }
1148
- return new At(e, s, n, S, M, B, i, t.boundingBox);
1360
+ return new Ae(t, s, n, S, M, k, o, e.boundingBox);
1149
1361
  }
1150
1362
  /**
1151
1363
  * Packs SOG V2 data.
1152
1364
  */
1153
- static packSog2(t) {
1154
- var T, U, I;
1155
- const e = t.numSplats;
1156
- let s = Math.ceil(Math.sqrt(e)), n = Math.ceil(e / s);
1157
- const r = ((T = t.means_l) == null ? void 0 : T.image) ?? ((U = t.sh0) == null ? void 0 : U.image) ?? ((I = t.quats) == null ? void 0 : I.image);
1365
+ static packSog2(e) {
1366
+ var O, V, I;
1367
+ const t = e.numSplats;
1368
+ let s = Math.ceil(Math.sqrt(t)), n = Math.ceil(t / s);
1369
+ const r = ((O = e.means_l) == null ? void 0 : O.image) ?? ((V = e.sh0) == null ? void 0 : V.image) ?? ((I = e.quats) == null ? void 0 : I.image);
1158
1370
  r && typeof r.width == "number" && typeof r.height == "number" && (s = r.width, n = r.height);
1159
- const o = s * n;
1160
- if (o < e) throw new Error(`SOG v2 texture too small: ${s}x${n}=${o} < count=${e}`);
1161
- const i = t.ranges.means.mins[0], u = t.ranges.means.mins[1], y = t.ranges.means.mins[2], m = t.ranges.means.maxs[0], c = t.ranges.means.maxs[1], h = t.ranges.means.maxs[2], d = (P) => Math.sign(P) * (Math.exp(Math.abs(P)) - 1), w = new l.Vector3(
1162
- d(i),
1163
- d(u),
1164
- d(y)
1165
- ), A = new l.Vector3(
1166
- d(m),
1167
- d(c),
1168
- d(h)
1169
- ), b = (P) => {
1170
- let f = 1 / 0, C = -1 / 0;
1171
- for (const R of P)
1172
- Number.isFinite(R) && (f = Math.min(f, R), C = Math.max(C, R));
1173
- (!Number.isFinite(f) || !Number.isFinite(C)) && (f = 0, C = 1);
1174
- const Y = C - f || 1, W = new Uint8Array(256);
1175
- for (let R = 0; R < 256; R++) {
1176
- const Z = ((R < P.length && Number.isFinite(P[R]) ? P[R] : f + (C - f) * (R / 255)) - f) / Y, H = Math.max(0, Math.min(255, Math.round(Z * 255)));
1177
- W[R] = H;
1371
+ const i = s * n;
1372
+ if (i < t) throw new Error(`SOG v2 texture too small: ${s}x${n}=${i} < count=${t}`);
1373
+ const o = e.ranges.means.mins[0], m = e.ranges.means.mins[1], y = e.ranges.means.mins[2], u = e.ranges.means.maxs[0], l = e.ranges.means.maxs[1], h = e.ranges.means.maxs[2], f = (q) => Math.sign(q) * (Math.exp(Math.abs(q)) - 1), w = new c.Vector3(
1374
+ f(o),
1375
+ f(m),
1376
+ f(y)
1377
+ ), A = new c.Vector3(
1378
+ f(u),
1379
+ f(l),
1380
+ f(h)
1381
+ ), b = (q) => {
1382
+ let p = 1 / 0, _ = -1 / 0;
1383
+ for (const F of q)
1384
+ Number.isFinite(F) && (p = Math.min(p, F), _ = Math.max(_, F));
1385
+ (!Number.isFinite(p) || !Number.isFinite(_)) && (p = 0, _ = 1);
1386
+ const H = _ - p || 1, W = new Uint8Array(256);
1387
+ for (let F = 0; F < 256; F++) {
1388
+ const Z = ((F < q.length && Number.isFinite(q[F]) ? q[F] : p + (_ - p) * (F / 255)) - p) / H, Y = Math.max(0, Math.min(255, Math.round(Z * 255)));
1389
+ W[F] = Y;
1178
1390
  }
1179
- return { cbMin: f, cbMax: C, lut: W };
1180
- }, z = b(t.ranges.scales.codebook), _ = b(t.ranges.sh0.codebook), F = {
1391
+ return { cbMin: p, cbMax: _, lut: W };
1392
+ }, B = b(e.ranges.scales.codebook), T = b(e.ranges.sh0.codebook), E = {
1181
1393
  means: { min: w.clone(), max: A.clone() },
1182
1394
  scales: {
1183
- min: new l.Vector3(
1184
- z.cbMin,
1185
- z.cbMin,
1186
- z.cbMin
1395
+ min: new c.Vector3(
1396
+ B.cbMin,
1397
+ B.cbMin,
1398
+ B.cbMin
1187
1399
  ),
1188
- max: new l.Vector3(
1189
- z.cbMax,
1190
- z.cbMax,
1191
- z.cbMax
1400
+ max: new c.Vector3(
1401
+ B.cbMax,
1402
+ B.cbMax,
1403
+ B.cbMax
1192
1404
  )
1193
1405
  },
1194
1406
  sh0: {
1195
- min: new l.Vector3(
1196
- _.cbMin,
1197
- _.cbMin,
1198
- _.cbMin
1407
+ min: new c.Vector3(
1408
+ T.cbMin,
1409
+ T.cbMin,
1410
+ T.cbMin
1199
1411
  ),
1200
- max: new l.Vector3(
1201
- _.cbMax,
1202
- _.cbMax,
1203
- _.cbMax
1412
+ max: new c.Vector3(
1413
+ T.cbMax,
1414
+ T.cbMax,
1415
+ T.cbMax
1204
1416
  )
1205
1417
  }
1206
- }, O = this.getPixels(t.means_l), V = this.getPixels(t.means_u), k = this.getPixels(t.quats), M = this.getPixels(t.scales), B = this.getPixels(t.sh0), S = new Uint32Array(o * 4), g = new Uint8Array(o * 4), v = new Float32Array(e * 3);
1207
- for (let P = 0; P < e; P++) {
1208
- const f = P * 4, C = V[f + 0], Y = O[f + 0], W = V[f + 1], R = O[f + 1], J = V[f + 2], Z = O[f + 2], H = (C << 8 | Y) / 65535, D = (W << 8 | R) / 65535, p = (J << 8 | Z) / 65535, q = this.sogsDecode(H, i, m), L = this.sogsDecode(D, u, c), E = this.sogsDecode(p, y, h);
1209
- v[P * 3 + 0] = q, v[P * 3 + 1] = L, v[P * 3 + 2] = E;
1210
- const G = this.clamp01(this.norm(q, w.x, A.x)) * 65535 | 0, X = this.clamp01(this.norm(L, w.y, A.y)) * 65535 | 0, j = this.clamp01(this.norm(E, w.z, A.z)) * 65535 | 0;
1211
- S[f + 0] = this.pack4Bytes(G & 255, X & 255, j & 255, 0), S[f + 1] = this.pack4Bytes(G >> 8, X >> 8, j >> 8, 0);
1212
- const $ = k[f + 3] - 252 & 3;
1213
- S[f + 2] = this.pack4Bytes(k[f + 0], k[f + 1], k[f + 2], $);
1214
- const K = z.lut[M[f + 0]], tt = z.lut[M[f + 1]], et = z.lut[M[f + 2]];
1215
- S[f + 3] = this.pack4Bytes(K, tt, et, 0), g[f + 0] = _.lut[B[f + 0]], g[f + 1] = _.lut[B[f + 1]], g[f + 2] = _.lut[B[f + 2]], g[f + 3] = B[f + 3];
1418
+ }, U = this.getPixels(e.means_l), R = this.getPixels(e.means_u), C = this.getPixels(e.quats), M = this.getPixels(e.scales), k = this.getPixels(e.sh0), S = new Uint32Array(i * 4), g = new Uint8Array(i * 4), v = new Float32Array(t * 3);
1419
+ for (let q = 0; q < t; q++) {
1420
+ const p = q * 4, _ = R[p + 0], H = U[p + 0], W = R[p + 1], F = U[p + 1], J = R[p + 2], Z = U[p + 2], Y = (_ << 8 | H) / 65535, z = (W << 8 | F) / 65535, x = (J << 8 | Z) / 65535, D = this.sogsDecode(Y, o, u), L = this.sogsDecode(z, m, l), P = this.sogsDecode(x, y, h);
1421
+ v[q * 3 + 0] = D, v[q * 3 + 1] = L, v[q * 3 + 2] = P;
1422
+ const G = this.clamp01(this.norm(D, w.x, A.x)) * 65535 | 0, X = this.clamp01(this.norm(L, w.y, A.y)) * 65535 | 0, j = this.clamp01(this.norm(P, w.z, A.z)) * 65535 | 0;
1423
+ S[p + 0] = this.pack4Bytes(G & 255, X & 255, j & 255, 0), S[p + 1] = this.pack4Bytes(G >> 8, X >> 8, j >> 8, 0);
1424
+ const $ = C[p + 3] - 252 & 3;
1425
+ S[p + 2] = this.pack4Bytes(C[p + 0], C[p + 1], C[p + 2], $);
1426
+ const K = B.lut[M[p + 0]], ee = B.lut[M[p + 1]], te = B.lut[M[p + 2]];
1427
+ S[p + 3] = this.pack4Bytes(K, ee, te, 0), g[p + 0] = T.lut[k[p + 0]], g[p + 1] = T.lut[k[p + 1]], g[p + 2] = T.lut[k[p + 2]], g[p + 3] = k[p + 3];
1216
1428
  }
1217
- return new At(e, s, n, v, S, g, F, t.boundingBox);
1429
+ return new Ae(t, s, n, v, S, g, E, e.boundingBox);
1218
1430
  }
1219
1431
  // --- Helpers ---
1220
1432
  // prettier-ignore
1221
- static pack4Bytes(t, e, s, n) {
1222
- return (t & 255) << 24 | (e & 255) << 16 | (s & 255) << 8 | n & 255;
1433
+ static pack4Bytes(e, t, s, n) {
1434
+ return (e & 255) << 24 | (t & 255) << 16 | (s & 255) << 8 | n & 255;
1223
1435
  }
1224
1436
  // prettier-ignore
1225
- static getPixels(t) {
1226
- const e = t.image, s = e.width, n = e.height;
1227
- if (e.data && (e.data instanceof Uint8Array || e.data instanceof Uint8ClampedArray)) return new Uint8Array(e.data);
1437
+ static getPixels(e) {
1438
+ const t = e.image, s = t.width, n = t.height;
1439
+ if (t.data && (t.data instanceof Uint8Array || t.data instanceof Uint8ClampedArray)) return new Uint8Array(t.data);
1228
1440
  const r = document.createElement("canvas");
1229
1441
  r.width = s, r.height = n;
1230
- const o = r.getContext("2d", { willReadFrequently: !0 });
1231
- if (!o) throw new Error("Canvas init failed");
1232
- return o.drawImage(e, 0, 0), new Uint8Array(o.getImageData(0, 0, s, n).data);
1442
+ const i = r.getContext("2d", { willReadFrequently: !0 });
1443
+ if (!i) throw new Error("Canvas init failed");
1444
+ return i.drawImage(t, 0, 0), new Uint8Array(i.getImageData(0, 0, s, n).data);
1233
1445
  }
1234
- static convertSogsRanges(t) {
1235
- const e = (s) => new l.Vector3(s[0], s[1], s[2]);
1446
+ static convertSogsRanges(e) {
1447
+ const t = (s) => new c.Vector3(s[0], s[1], s[2]);
1236
1448
  return {
1237
- sh0: { min: e(t.sh0.mins), max: e(t.sh0.maxs) },
1238
- means: { min: e(t.means.mins), max: e(t.means.maxs) },
1239
- scales: { min: e(t.scales.mins), max: e(t.scales.maxs) }
1449
+ sh0: { min: t(e.sh0.mins), max: t(e.sh0.maxs) },
1450
+ means: { min: t(e.means.mins), max: t(e.means.maxs) },
1451
+ scales: { min: t(e.scales.mins), max: t(e.scales.maxs) }
1240
1452
  };
1241
1453
  }
1242
- static calculatePlyRanges(t) {
1243
- const e = new l.Vector3(1 / 0, 1 / 0, 1 / 0), s = new l.Vector3(-1 / 0, -1 / 0, -1 / 0), n = new l.Vector3(1 / 0, 1 / 0, 1 / 0), r = new l.Vector3(-1 / 0, -1 / 0, -1 / 0), o = new l.Vector3(1 / 0, 1 / 0, 1 / 0), i = new l.Vector3(-1 / 0, -1 / 0, -1 / 0);
1244
- let u = 0;
1245
- for (let m = 0; m < t.numSplats; m++) {
1246
- const c = m * 3, h = t.positions[c + 0], d = t.positions[c + 1], w = t.positions[c + 2];
1247
- e.x = Math.min(e.x, h), s.x = Math.max(s.x, h), e.y = Math.min(e.y, d), s.y = Math.max(s.y, d), e.z = Math.min(e.z, w), s.z = Math.max(s.z, w), n.x = Math.min(n.x, t.scales[c]), r.x = Math.max(r.x, t.scales[c]), n.y = Math.min(n.y, t.scales[c + 1]), r.y = Math.max(r.y, t.scales[c + 1]), n.z = Math.min(n.z, t.scales[c + 2]), r.z = Math.max(r.z, t.scales[c + 2]), u = Math.max(
1248
- u,
1249
- t.colors[c],
1250
- t.colors[c + 1],
1251
- t.colors[c + 2]
1454
+ static calculatePlyRanges(e) {
1455
+ const t = new c.Vector3(1 / 0, 1 / 0, 1 / 0), s = new c.Vector3(-1 / 0, -1 / 0, -1 / 0), n = new c.Vector3(1 / 0, 1 / 0, 1 / 0), r = new c.Vector3(-1 / 0, -1 / 0, -1 / 0), i = new c.Vector3(1 / 0, 1 / 0, 1 / 0), o = new c.Vector3(-1 / 0, -1 / 0, -1 / 0);
1456
+ let m = 0;
1457
+ for (let u = 0; u < e.numSplats; u++) {
1458
+ const l = u * 3, h = e.positions[l + 0], f = e.positions[l + 1], w = e.positions[l + 2];
1459
+ t.x = Math.min(t.x, h), s.x = Math.max(s.x, h), t.y = Math.min(t.y, f), s.y = Math.max(s.y, f), t.z = Math.min(t.z, w), s.z = Math.max(s.z, w), n.x = Math.min(n.x, e.scales[l]), r.x = Math.max(r.x, e.scales[l]), n.y = Math.min(n.y, e.scales[l + 1]), r.y = Math.max(r.y, e.scales[l + 1]), n.z = Math.min(n.z, e.scales[l + 2]), r.z = Math.max(r.z, e.scales[l + 2]), m = Math.max(
1460
+ m,
1461
+ e.colors[l],
1462
+ e.colors[l + 1],
1463
+ e.colors[l + 2]
1252
1464
  );
1253
1465
  }
1254
- const y = u > 1.5 ? 1 / 255 : 1;
1255
- for (let m = 0; m < t.numSplats; m++) {
1256
- const c = m * 3, h = this.clamp01(t.colors[c + 0] * y), d = this.clamp01(t.colors[c + 1] * y), w = this.clamp01(t.colors[c + 2] * y), A = (h - 0.5) / ft, b = (d - 0.5) / ft, z = (w - 0.5) / ft;
1257
- o.x = Math.min(o.x, A), i.x = Math.max(i.x, A), o.y = Math.min(o.y, b), i.y = Math.max(i.y, b), o.z = Math.min(o.z, z), i.z = Math.max(i.z, z);
1466
+ const y = m > 1.5 ? 1 / 255 : 1;
1467
+ for (let u = 0; u < e.numSplats; u++) {
1468
+ const l = u * 3, h = this.clamp01(e.colors[l + 0] * y), f = this.clamp01(e.colors[l + 1] * y), w = this.clamp01(e.colors[l + 2] * y), A = (h - 0.5) / fe, b = (f - 0.5) / fe, B = (w - 0.5) / fe;
1469
+ i.x = Math.min(i.x, A), o.x = Math.max(o.x, A), i.y = Math.min(i.y, b), o.y = Math.max(o.y, b), i.z = Math.min(i.z, B), o.z = Math.max(o.z, B);
1258
1470
  }
1259
1471
  return {
1260
1472
  colorScale: y,
1261
1473
  ranges: {
1262
- sh0: { min: o, max: i },
1263
- means: { min: e, max: s },
1474
+ sh0: { min: i, max: o },
1475
+ means: { min: t, max: s },
1264
1476
  scales: { min: n, max: r }
1265
1477
  }
1266
1478
  };
1267
1479
  }
1268
- static clamp01(t) {
1269
- return Math.max(0, Math.min(1, t));
1480
+ static clamp01(e) {
1481
+ return Math.max(0, Math.min(1, e));
1270
1482
  }
1271
1483
  // prettier-ignore
1272
1484
  // private static lerp(a: number, b: number, t: number) { return a + (b - a) * t; } // prettier-ignore
1273
1485
  // private static invSogsMap(v: number) { return Math.sign(v) * Math.log(Math.abs(v) + 1) } // prettier-ignore
1274
- static norm(t, e, s) {
1275
- return (t - e) / (s - e || 1);
1486
+ static norm(e, t, s) {
1487
+ return (e - t) / (s - t || 1);
1276
1488
  }
1277
1489
  // prettier-ignore
1278
- static sogsDecode(t, e, s) {
1279
- const n = e + (s - e) * t;
1490
+ static sogsDecode(e, t, s) {
1491
+ const n = t + (s - t) * e;
1280
1492
  return Math.sign(n) * (Math.exp(Math.abs(n)) - 1);
1281
1493
  }
1282
1494
  }
1283
- class ve extends l.Loader {
1284
- constructor(e, s) {
1285
- super(e);
1286
- x(this, "requestId", 0);
1287
- x(this, "worker");
1288
- x(this, "pendingCallbacks", /* @__PURE__ */ new Map());
1495
+ class kt extends c.Loader {
1496
+ constructor(t, s) {
1497
+ super(t);
1498
+ d(this, "requestId", 0);
1499
+ d(this, "worker");
1500
+ d(this, "pendingCallbacks", /* @__PURE__ */ new Map());
1289
1501
  this.withCredentials = (s == null ? void 0 : s.withCredentials) ?? !1;
1290
1502
  const n = this.createWorkerCode(), r = new Blob([n], { type: "application/javascript" });
1291
1503
  this.worker = new Worker(URL.createObjectURL(r)), this.worker.onmessage = this.onWorkerMessage.bind(this);
@@ -1294,26 +1506,26 @@ class ve extends l.Loader {
1294
1506
  * Handles messages received from the parsing worker
1295
1507
  * @param event The message event from the worker
1296
1508
  */
1297
- onWorkerMessage(e) {
1298
- const { requestId: s, error: n, result: r } = e.data, o = this.pendingCallbacks.get(s);
1299
- if (!o) return console.warn(`PlyLoader: Received response for unknown request ${s}`);
1300
- if (this.pendingCallbacks.delete(s), n) return o.reject(new Error(n));
1301
- if (!r) return o.reject(new Error("Worker returned no result"));
1509
+ onWorkerMessage(t) {
1510
+ const { requestId: s, error: n, result: r } = t.data, i = this.pendingCallbacks.get(s);
1511
+ if (!i) return console.warn(`PlyLoader: Received response for unknown request ${s}`);
1512
+ if (this.pendingCallbacks.delete(s), n) return i.reject(new Error(n));
1513
+ if (!r) return i.reject(new Error("Worker returned no result"));
1302
1514
  try {
1303
- const i = new jt(0);
1304
- i.numSplats = r.numSplats, i.positions = new Float32Array(r.positions), i.rotations = new Float32Array(r.rotations), i.scales = new Float32Array(r.scales), i.colors = new Float32Array(r.colors), i.opacities = new Float32Array(r.opacities), i.boundingBox.min.set(
1515
+ const o = new Xe(0);
1516
+ o.numSplats = r.numSplats, o.positions = new Float32Array(r.positions), o.rotations = new Float32Array(r.rotations), o.scales = new Float32Array(r.scales), o.colors = new Float32Array(r.colors), o.opacities = new Float32Array(r.opacities), o.boundingBox.min.set(
1305
1517
  r.boundingBox.minX,
1306
1518
  r.boundingBox.minY,
1307
1519
  r.boundingBox.minZ
1308
- ), i.boundingBox.max.set(
1520
+ ), o.boundingBox.max.set(
1309
1521
  r.boundingBox.maxX,
1310
1522
  r.boundingBox.maxY,
1311
1523
  r.boundingBox.maxZ
1312
1524
  ), this.worker.terminate();
1313
- const u = gt.packPly(i);
1314
- i.dispose(), o.resolve(u);
1315
- } catch (i) {
1316
- o.reject(i);
1525
+ const m = ge.packPly(o);
1526
+ o.dispose(), i.resolve(m);
1527
+ } catch (o) {
1528
+ i.reject(o);
1317
1529
  }
1318
1530
  }
1319
1531
  /**
@@ -1323,15 +1535,15 @@ class ve extends l.Loader {
1323
1535
  * @param onProgress Optional progress callback
1324
1536
  * @param onError Optional error callback
1325
1537
  */
1326
- load(e, s, n, r) {
1327
- const o = new l.FileLoader(this.manager);
1328
- o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
1329
- e,
1330
- (i) => {
1331
- this.parseAsync(i).then((u) => {
1332
- s && s(u);
1333
- }).catch((u) => {
1334
- r ? r(u) : console.error(u), this.manager.itemError(e);
1538
+ load(t, s, n, r) {
1539
+ const i = new c.FileLoader(this.manager);
1540
+ i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
1541
+ t,
1542
+ (o) => {
1543
+ this.parseAsync(o).then((m) => {
1544
+ s && s(m);
1545
+ }).catch((m) => {
1546
+ r ? r(m) : console.error(m), this.manager.itemError(t);
1335
1547
  });
1336
1548
  },
1337
1549
  n,
@@ -1344,19 +1556,19 @@ class ve extends l.Loader {
1344
1556
  * @param onProgress Optional progress callback
1345
1557
  * @returns A Promise that resolves with the parsed SplatData
1346
1558
  */
1347
- loadAsync(e, s) {
1559
+ loadAsync(t, s) {
1348
1560
  return new Promise((n, r) => {
1349
- const o = new l.FileLoader(this.manager);
1350
- o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
1351
- e,
1352
- (i) => {
1353
- this.parseAsync(i).then(n).catch((u) => {
1354
- r(u), this.manager.itemError(e);
1561
+ const i = new c.FileLoader(this.manager);
1562
+ i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
1563
+ t,
1564
+ (o) => {
1565
+ this.parseAsync(o).then(n).catch((m) => {
1566
+ r(m), this.manager.itemError(t);
1355
1567
  });
1356
1568
  },
1357
1569
  s,
1358
- (i) => {
1359
- r(i), this.manager.itemError(e);
1570
+ (o) => {
1571
+ r(o), this.manager.itemError(t);
1360
1572
  }
1361
1573
  );
1362
1574
  });
@@ -1366,15 +1578,15 @@ class ve extends l.Loader {
1366
1578
  * @param buffer ArrayBuffer containing PLY data
1367
1579
  * @returns Promise that resolves with parsed SplatData
1368
1580
  */
1369
- parseAsync(e) {
1581
+ parseAsync(t) {
1370
1582
  return new Promise((s, n) => {
1371
1583
  const r = this.requestId++;
1372
1584
  this.pendingCallbacks.set(r, { resolve: s, reject: n });
1373
- const o = {
1585
+ const i = {
1374
1586
  requestId: r,
1375
- buffer: e
1587
+ buffer: t
1376
1588
  };
1377
- this.worker.postMessage(o, [e]);
1589
+ this.worker.postMessage(i, [t]);
1378
1590
  });
1379
1591
  }
1380
1592
  /**
@@ -1390,46 +1602,46 @@ class ve extends l.Loader {
1390
1602
  createWorkerCode() {
1391
1603
  return `(${(function() {
1392
1604
  self.onmessage = (n) => {
1393
- const { requestId: r, buffer: o } = n.data;
1605
+ const { requestId: r, buffer: i } = n.data;
1394
1606
  try {
1395
- const i = s(o), u = {
1607
+ const o = s(i), m = {
1396
1608
  requestId: r,
1397
- result: i
1609
+ result: o
1398
1610
  };
1399
- self.postMessage(u, [
1400
- i.positions,
1401
- i.rotations,
1402
- i.scales,
1403
- i.colors,
1404
- i.opacities
1611
+ self.postMessage(m, [
1612
+ o.positions,
1613
+ o.rotations,
1614
+ o.scales,
1615
+ o.colors,
1616
+ o.opacities
1405
1617
  ]);
1406
- } catch (i) {
1407
- const u = {
1618
+ } catch (o) {
1619
+ const m = {
1408
1620
  requestId: r,
1409
- error: i instanceof Error ? i.message : String(i)
1621
+ error: o instanceof Error ? o.message : String(o)
1410
1622
  };
1411
- self.postMessage(u);
1623
+ self.postMessage(m);
1412
1624
  }
1413
1625
  };
1414
1626
  function s(n) {
1415
- const r = new TextDecoder(), o = new Uint8Array(n), i = [112, 108, 121, 10], u = `
1627
+ const r = new TextDecoder(), i = new Uint8Array(n), o = [112, 108, 121, 10], m = `
1416
1628
  end_header
1417
1629
  `;
1418
- for (let D = 0; D < i.length; D++)
1419
- if (o[D] !== i[D])
1630
+ for (let z = 0; z < o.length; z++)
1631
+ if (i[z] !== o[z])
1420
1632
  throw new Error(
1421
1633
  "Invalid PLY file: Missing magic bytes"
1422
1634
  );
1423
1635
  let y = 0;
1424
- for (let D = 0; D < o.length - u.length; D++) {
1425
- let p = !0;
1426
- for (let q = 0; q < u.length; q++)
1427
- if (o[D + q] !== u.charCodeAt(q)) {
1428
- p = !1;
1636
+ for (let z = 0; z < i.length - m.length; z++) {
1637
+ let x = !0;
1638
+ for (let D = 0; D < m.length; D++)
1639
+ if (i[z + D] !== m.charCodeAt(D)) {
1640
+ x = !1;
1429
1641
  break;
1430
1642
  }
1431
- if (p) {
1432
- y = D + u.length;
1643
+ if (x) {
1644
+ y = z + m.length;
1433
1645
  break;
1434
1646
  }
1435
1647
  }
@@ -1437,23 +1649,23 @@ end_header
1437
1649
  throw new Error(
1438
1650
  "Invalid PLY file: Could not find end of header"
1439
1651
  );
1440
- const c = r.decode(
1441
- o.subarray(0, y)
1652
+ const l = r.decode(
1653
+ i.subarray(0, y)
1442
1654
  ).split(`
1443
1655
  `), h = [];
1444
- let d = null;
1445
- for (let D = 1; D < c.length; D++) {
1446
- const p = c[D].trim();
1447
- if (p === "" || p === "end_header") continue;
1448
- const q = p.split(" ");
1449
- switch (q[0]) {
1656
+ let f = null;
1657
+ for (let z = 1; z < l.length; z++) {
1658
+ const x = l[z].trim();
1659
+ if (x === "" || x === "end_header") continue;
1660
+ const D = x.split(" ");
1661
+ switch (D[0]) {
1450
1662
  case "format":
1451
- d = q[1];
1663
+ f = D[1];
1452
1664
  break;
1453
1665
  case "element":
1454
1666
  h.push({
1455
- name: q[1],
1456
- count: parseInt(q[2], 10),
1667
+ name: D[1],
1668
+ count: parseInt(D[2], 10),
1457
1669
  properties: []
1458
1670
  });
1459
1671
  break;
@@ -1463,129 +1675,129 @@ end_header
1463
1675
  "Invalid PLY file: Property without element"
1464
1676
  );
1465
1677
  h[h.length - 1].properties.push({
1466
- type: q[1],
1467
- name: q[2]
1678
+ type: D[1],
1679
+ name: D[2]
1468
1680
  });
1469
1681
  break;
1470
1682
  }
1471
1683
  }
1472
- if (d !== "binary_little_endian")
1473
- throw new Error(`Unsupported PLY format: ${d}`);
1474
- const w = h.find((D) => D.name === "vertex");
1684
+ if (f !== "binary_little_endian")
1685
+ throw new Error(`Unsupported PLY format: ${f}`);
1686
+ const w = h.find((z) => z.name === "vertex");
1475
1687
  if (!w)
1476
1688
  throw new Error(
1477
1689
  "Invalid PLY file: No vertex element found"
1478
1690
  );
1479
- const A = w.count, b = new Float32Array(A * 3), z = new Float32Array(A * 4), _ = new Float32Array(A * 3), F = new Float32Array(A * 3), O = new Float32Array(A), V = new DataView(n);
1480
- let k = y;
1481
- const M = (D) => w.properties.findIndex(
1482
- (p) => p.name === D
1483
- ), B = M("x"), S = M("y"), g = M("z"), v = [
1691
+ const A = w.count, b = new Float32Array(A * 3), B = new Float32Array(A * 4), T = new Float32Array(A * 3), E = new Float32Array(A * 3), U = new Float32Array(A), R = new DataView(n);
1692
+ let C = y;
1693
+ const M = (z) => w.properties.findIndex(
1694
+ (x) => x.name === z
1695
+ ), k = M("x"), S = M("y"), g = M("z"), v = [
1484
1696
  M("rot_0"),
1485
1697
  M("rot_1"),
1486
1698
  M("rot_2"),
1487
1699
  M("rot_3")
1488
- ], T = [
1700
+ ], O = [
1489
1701
  M("scale_0"),
1490
1702
  M("scale_1"),
1491
1703
  M("scale_2")
1492
- ], U = [
1704
+ ], V = [
1493
1705
  M("f_dc_0"),
1494
1706
  M("f_dc_1"),
1495
1707
  M("f_dc_2")
1496
1708
  ], I = M("opacity");
1497
1709
  if ([
1498
- B,
1710
+ k,
1499
1711
  S,
1500
1712
  g,
1501
1713
  ...v,
1502
- ...T,
1503
- ...U,
1714
+ ...O,
1715
+ ...V,
1504
1716
  I
1505
- ].some((D) => D === -1))
1717
+ ].some((z) => z === -1))
1506
1718
  throw new Error(
1507
1719
  "Invalid PLY file: Missing required properties"
1508
1720
  );
1509
- const f = 0.28209479177387814, C = (D) => {
1510
- if (D > 0) return 1 / (1 + Math.exp(-D));
1511
- const p = Math.exp(D);
1512
- return p / (1 + p);
1721
+ const p = 0.28209479177387814, _ = (z) => {
1722
+ if (z > 0) return 1 / (1 + Math.exp(-z));
1723
+ const x = Math.exp(z);
1724
+ return x / (1 + x);
1513
1725
  };
1514
- let Y = 1 / 0, W = 1 / 0, R = 1 / 0, J = -1 / 0, Z = -1 / 0, H = -1 / 0;
1515
- for (let D = 0; D < A; D++) {
1516
- const p = [];
1517
- for (let St = 0; St < w.properties.length; St++) {
1518
- const Et = w.properties[St].type;
1519
- let ct;
1520
- switch (Et) {
1726
+ let H = 1 / 0, W = 1 / 0, F = 1 / 0, J = -1 / 0, Z = -1 / 0, Y = -1 / 0;
1727
+ for (let z = 0; z < A; z++) {
1728
+ const x = [];
1729
+ for (let Se = 0; Se < w.properties.length; Se++) {
1730
+ const Pe = w.properties[Se].type;
1731
+ let ce;
1732
+ switch (Pe) {
1521
1733
  case "char":
1522
- ct = V.getInt8(k), k += 1;
1734
+ ce = R.getInt8(C), C += 1;
1523
1735
  break;
1524
1736
  case "uchar":
1525
- ct = V.getUint8(k), k += 1;
1737
+ ce = R.getUint8(C), C += 1;
1526
1738
  break;
1527
1739
  case "short":
1528
- ct = V.getInt16(k, !0), k += 2;
1740
+ ce = R.getInt16(C, !0), C += 2;
1529
1741
  break;
1530
1742
  case "ushort":
1531
- ct = V.getUint16(k, !0), k += 2;
1743
+ ce = R.getUint16(C, !0), C += 2;
1532
1744
  break;
1533
1745
  case "int":
1534
- ct = V.getInt32(k, !0), k += 4;
1746
+ ce = R.getInt32(C, !0), C += 4;
1535
1747
  break;
1536
1748
  case "uint":
1537
- ct = V.getUint32(k, !0), k += 4;
1749
+ ce = R.getUint32(C, !0), C += 4;
1538
1750
  break;
1539
1751
  case "float":
1540
- ct = V.getFloat32(k, !0), k += 4;
1752
+ ce = R.getFloat32(C, !0), C += 4;
1541
1753
  break;
1542
1754
  case "double":
1543
- ct = V.getFloat64(k, !0), k += 8;
1755
+ ce = R.getFloat64(C, !0), C += 8;
1544
1756
  break;
1545
1757
  default:
1546
1758
  throw new Error(
1547
- `Unsupported property type: ${Et}`
1759
+ `Unsupported property type: ${Pe}`
1548
1760
  );
1549
1761
  }
1550
- p.push(ct);
1762
+ x.push(ce);
1551
1763
  }
1552
- const q = p[B], L = p[S], E = p[g], G = D * 3;
1553
- b[G] = q, b[G + 1] = L, b[G + 2] = E, Y = Math.min(Y, q), W = Math.min(W, L), R = Math.min(R, E), J = Math.max(J, q), Z = Math.max(Z, L), H = Math.max(H, E);
1554
- let X = p[v[1]], j = p[v[2]], Q = p[v[3]], $ = p[v[0]];
1764
+ const D = x[k], L = x[S], P = x[g], G = z * 3;
1765
+ b[G] = D, b[G + 1] = L, b[G + 2] = P, H = Math.min(H, D), W = Math.min(W, L), F = Math.min(F, P), J = Math.max(J, D), Z = Math.max(Z, L), Y = Math.max(Y, P);
1766
+ let X = x[v[1]], j = x[v[2]], Q = x[v[3]], $ = x[v[0]];
1555
1767
  const K = Math.sqrt(
1556
1768
  X * X + j * j + Q * Q + $ * $
1557
1769
  );
1558
1770
  K > 0 && (X /= K, j /= K, Q /= K, $ /= K), $ < 0 && (X = -X, j = -j, Q = -Q, $ = -$);
1559
- const tt = D * 4;
1560
- z[tt] = X, z[tt + 1] = j, z[tt + 2] = Q, z[tt + 3] = $;
1561
- const et = D * 3;
1562
- _[et] = p[T[0]], _[et + 1] = p[T[1]], _[et + 2] = p[T[2]];
1563
- let mt = 0.5 + p[U[0]] * f, dt = 0.5 + p[U[1]] * f, ot = 0.5 + p[U[2]] * f;
1564
- mt = Math.max(0, Math.min(1, mt)), dt = Math.max(0, Math.min(1, dt)), ot = Math.max(0, Math.min(1, ot));
1565
- const bt = D * 3;
1566
- F[bt] = mt, F[bt + 1] = dt, F[bt + 2] = ot, O[D] = C(p[I]);
1771
+ const ee = z * 4;
1772
+ B[ee] = X, B[ee + 1] = j, B[ee + 2] = Q, B[ee + 3] = $;
1773
+ const te = z * 3;
1774
+ T[te] = x[O[0]], T[te + 1] = x[O[1]], T[te + 2] = x[O[2]];
1775
+ let ue = 0.5 + x[V[0]] * p, de = 0.5 + x[V[1]] * p, ie = 0.5 + x[V[2]] * p;
1776
+ ue = Math.max(0, Math.min(1, ue)), de = Math.max(0, Math.min(1, de)), ie = Math.max(0, Math.min(1, ie));
1777
+ const be = z * 3;
1778
+ E[be] = ue, E[be + 1] = de, E[be + 2] = ie, U[z] = _(x[I]);
1567
1779
  }
1568
1780
  return {
1569
1781
  numSplats: A,
1570
1782
  positions: b.buffer,
1571
- rotations: z.buffer,
1572
- scales: _.buffer,
1573
- colors: F.buffer,
1574
- opacities: O.buffer,
1783
+ rotations: B.buffer,
1784
+ scales: T.buffer,
1785
+ colors: E.buffer,
1786
+ opacities: U.buffer,
1575
1787
  boundingBox: {
1576
- minX: Y,
1788
+ minX: H,
1577
1789
  minY: W,
1578
- minZ: R,
1790
+ minZ: F,
1579
1791
  maxX: J,
1580
1792
  maxY: Z,
1581
- maxZ: H
1793
+ maxZ: Y
1582
1794
  }
1583
1795
  };
1584
1796
  }
1585
1797
  }).toString()})();`;
1586
1798
  }
1587
1799
  }
1588
- var st = Uint8Array, pt = Uint16Array, Jt = Int32Array, Vt = new st([
1800
+ var se = Uint8Array, pe = Uint16Array, it = Int32Array, Ge = new se([
1589
1801
  0,
1590
1802
  0,
1591
1803
  0,
@@ -1620,7 +1832,7 @@ var st = Uint8Array, pt = Uint16Array, Jt = Int32Array, Vt = new st([
1620
1832
  0,
1621
1833
  /* impossible */
1622
1834
  0
1623
- ]), Tt = new st([
1835
+ ]), We = new se([
1624
1836
  0,
1625
1837
  0,
1626
1838
  0,
@@ -1654,65 +1866,65 @@ var st = Uint8Array, pt = Uint16Array, Jt = Int32Array, Vt = new st([
1654
1866
  /* unused */
1655
1867
  0,
1656
1868
  0
1657
- ]), Kt = new st([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ot = function(a, t) {
1658
- for (var e = new pt(31), s = 0; s < 31; ++s)
1659
- e[s] = t += 1 << a[s - 1];
1660
- for (var n = new Jt(e[30]), s = 1; s < 30; ++s)
1661
- for (var r = e[s]; r < e[s + 1]; ++r)
1662
- n[r] = r - e[s] << 5 | s;
1663
- return { b: e, r: n };
1664
- }, Lt = Ot(Vt, 2), Gt = Lt.b, te = Lt.r;
1665
- Gt[28] = 258, te[258] = 28;
1666
- var ee = Ot(Tt, 0), se = ee.b, zt = new pt(32768);
1869
+ ]), ot = new se([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ne = function(a, e) {
1870
+ for (var t = new pe(31), s = 0; s < 31; ++s)
1871
+ t[s] = e += 1 << a[s - 1];
1872
+ for (var n = new it(t[30]), s = 1; s < 30; ++s)
1873
+ for (var r = t[s]; r < t[s + 1]; ++r)
1874
+ n[r] = r - t[s] << 5 | s;
1875
+ return { b: t, r: n };
1876
+ }, $e = Ne(Ge, 2), je = $e.b, ct = $e.r;
1877
+ je[28] = 258, ct[258] = 28;
1878
+ var lt = Ne(We, 0), ht = lt.b, Be = new pe(32768);
1667
1879
  for (var N = 0; N < 32768; ++N) {
1668
- var lt = (N & 43690) >> 1 | (N & 21845) << 1;
1669
- lt = (lt & 52428) >> 2 | (lt & 13107) << 2, lt = (lt & 61680) >> 4 | (lt & 3855) << 4, zt[N] = ((lt & 65280) >> 8 | (lt & 255) << 8) >> 1;
1880
+ var le = (N & 43690) >> 1 | (N & 21845) << 1;
1881
+ le = (le & 52428) >> 2 | (le & 13107) << 2, le = (le & 61680) >> 4 | (le & 3855) << 4, Be[N] = ((le & 65280) >> 8 | (le & 255) << 8) >> 1;
1670
1882
  }
1671
- var yt = function(a, t, e) {
1672
- for (var s = a.length, n = 0, r = new pt(t); n < s; ++n)
1883
+ var ye = function(a, e, t) {
1884
+ for (var s = a.length, n = 0, r = new pe(e); n < s; ++n)
1673
1885
  a[n] && ++r[a[n] - 1];
1674
- var o = new pt(t);
1675
- for (n = 1; n < t; ++n)
1676
- o[n] = o[n - 1] + r[n - 1] << 1;
1677
- var i;
1678
- if (e) {
1679
- i = new pt(1 << t);
1680
- var u = 15 - t;
1886
+ var i = new pe(e);
1887
+ for (n = 1; n < e; ++n)
1888
+ i[n] = i[n - 1] + r[n - 1] << 1;
1889
+ var o;
1890
+ if (t) {
1891
+ o = new pe(1 << e);
1892
+ var m = 15 - e;
1681
1893
  for (n = 0; n < s; ++n)
1682
1894
  if (a[n])
1683
- for (var y = n << 4 | a[n], m = t - a[n], c = o[a[n] - 1]++ << m, h = c | (1 << m) - 1; c <= h; ++c)
1684
- i[zt[c] >> u] = y;
1895
+ for (var y = n << 4 | a[n], u = e - a[n], l = i[a[n] - 1]++ << u, h = l | (1 << u) - 1; l <= h; ++l)
1896
+ o[Be[l] >> m] = y;
1685
1897
  } else
1686
- for (i = new pt(s), n = 0; n < s; ++n)
1687
- a[n] && (i[n] = zt[o[a[n] - 1]++] >> 15 - a[n]);
1688
- return i;
1689
- }, vt = new st(288);
1898
+ for (o = new pe(s), n = 0; n < s; ++n)
1899
+ a[n] && (o[n] = Be[i[a[n] - 1]++] >> 15 - a[n]);
1900
+ return o;
1901
+ }, ve = new se(288);
1690
1902
  for (var N = 0; N < 144; ++N)
1691
- vt[N] = 8;
1903
+ ve[N] = 8;
1692
1904
  for (var N = 144; N < 256; ++N)
1693
- vt[N] = 9;
1905
+ ve[N] = 9;
1694
1906
  for (var N = 256; N < 280; ++N)
1695
- vt[N] = 7;
1907
+ ve[N] = 7;
1696
1908
  for (var N = 280; N < 288; ++N)
1697
- vt[N] = 8;
1698
- var Wt = new st(32);
1909
+ ve[N] = 8;
1910
+ var He = new se(32);
1699
1911
  for (var N = 0; N < 32; ++N)
1700
- Wt[N] = 5;
1701
- var ne = /* @__PURE__ */ yt(vt, 9, 1), re = /* @__PURE__ */ yt(Wt, 5, 1), kt = function(a) {
1702
- for (var t = a[0], e = 1; e < a.length; ++e)
1703
- a[e] > t && (t = a[e]);
1704
- return t;
1705
- }, rt = function(a, t, e) {
1706
- var s = t / 8 | 0;
1707
- return (a[s] | a[s + 1] << 8) >> (t & 7) & e;
1708
- }, It = function(a, t) {
1709
- var e = t / 8 | 0;
1710
- return (a[e] | a[e + 1] << 8 | a[e + 2] << 16) >> (t & 7);
1711
- }, ae = function(a) {
1912
+ He[N] = 5;
1913
+ var mt = /* @__PURE__ */ ye(ve, 9, 1), ut = /* @__PURE__ */ ye(He, 5, 1), Ce = function(a) {
1914
+ for (var e = a[0], t = 1; t < a.length; ++t)
1915
+ a[t] > e && (e = a[t]);
1916
+ return e;
1917
+ }, ae = function(a, e, t) {
1918
+ var s = e / 8 | 0;
1919
+ return (a[s] | a[s + 1] << 8) >> (e & 7) & t;
1920
+ }, Ie = function(a, e) {
1921
+ var t = e / 8 | 0;
1922
+ return (a[t] | a[t + 1] << 8 | a[t + 2] << 16) >> (e & 7);
1923
+ }, dt = function(a) {
1712
1924
  return (a + 7) / 8 | 0;
1713
- }, qt = function(a, t, e) {
1714
- return (t == null || t < 0) && (t = 0), (e == null || e > a.length) && (e = a.length), new st(a.subarray(t, e));
1715
- }, oe = [
1925
+ }, De = function(a, e, t) {
1926
+ return (e == null || e < 0) && (e = 0), (t == null || t > a.length) && (t = a.length), new se(a.subarray(e, t));
1927
+ }, ft = [
1716
1928
  "unexpected EOF",
1717
1929
  "invalid block type",
1718
1930
  "invalid length/literal",
@@ -1728,272 +1940,272 @@ var ne = /* @__PURE__ */ yt(vt, 9, 1), re = /* @__PURE__ */ yt(Wt, 5, 1), kt = f
1728
1940
  "stream finishing",
1729
1941
  "invalid zip data"
1730
1942
  // determined by unknown compression method
1731
- ], nt = function(a, t, e) {
1732
- var s = new Error(t || oe[a]);
1733
- if (s.code = a, Error.captureStackTrace && Error.captureStackTrace(s, nt), !e)
1943
+ ], ne = function(a, e, t) {
1944
+ var s = new Error(e || ft[a]);
1945
+ if (s.code = a, Error.captureStackTrace && Error.captureStackTrace(s, ne), !t)
1734
1946
  throw s;
1735
1947
  return s;
1736
- }, ie = function(a, t, e, s) {
1948
+ }, pt = function(a, e, t, s) {
1737
1949
  var n = a.length, r = s ? s.length : 0;
1738
- if (!n || t.f && !t.l)
1739
- return e || new st(0);
1740
- var o = !e, i = o || t.i != 2, u = t.i;
1741
- o && (e = new st(n * 3));
1950
+ if (!n || e.f && !e.l)
1951
+ return t || new se(0);
1952
+ var i = !t, o = i || e.i != 2, m = e.i;
1953
+ i && (t = new se(n * 3));
1742
1954
  var y = function(j) {
1743
- var Q = e.length;
1955
+ var Q = t.length;
1744
1956
  if (j > Q) {
1745
- var $ = new st(Math.max(Q * 2, j));
1746
- $.set(e), e = $;
1957
+ var $ = new se(Math.max(Q * 2, j));
1958
+ $.set(t), t = $;
1747
1959
  }
1748
- }, m = t.f || 0, c = t.p || 0, h = t.b || 0, d = t.l, w = t.d, A = t.m, b = t.n, z = n * 8;
1960
+ }, u = e.f || 0, l = e.p || 0, h = e.b || 0, f = e.l, w = e.d, A = e.m, b = e.n, B = n * 8;
1749
1961
  do {
1750
- if (!d) {
1751
- m = rt(a, c, 1);
1752
- var _ = rt(a, c + 1, 3);
1753
- if (c += 3, _)
1754
- if (_ == 1)
1755
- d = ne, w = re, A = 9, b = 5;
1756
- else if (_ == 2) {
1757
- var k = rt(a, c, 31) + 257, M = rt(a, c + 10, 15) + 4, B = k + rt(a, c + 5, 31) + 1;
1758
- c += 14;
1759
- for (var S = new st(B), g = new st(19), v = 0; v < M; ++v)
1760
- g[Kt[v]] = rt(a, c + v * 3, 7);
1761
- c += M * 3;
1762
- for (var T = kt(g), U = (1 << T) - 1, I = yt(g, T, 1), v = 0; v < B; ) {
1763
- var P = I[rt(a, c, U)];
1764
- c += P & 15;
1765
- var F = P >> 4;
1766
- if (F < 16)
1767
- S[v++] = F;
1962
+ if (!f) {
1963
+ u = ae(a, l, 1);
1964
+ var T = ae(a, l + 1, 3);
1965
+ if (l += 3, T)
1966
+ if (T == 1)
1967
+ f = mt, w = ut, A = 9, b = 5;
1968
+ else if (T == 2) {
1969
+ var C = ae(a, l, 31) + 257, M = ae(a, l + 10, 15) + 4, k = C + ae(a, l + 5, 31) + 1;
1970
+ l += 14;
1971
+ for (var S = new se(k), g = new se(19), v = 0; v < M; ++v)
1972
+ g[ot[v]] = ae(a, l + v * 3, 7);
1973
+ l += M * 3;
1974
+ for (var O = Ce(g), V = (1 << O) - 1, I = ye(g, O, 1), v = 0; v < k; ) {
1975
+ var q = I[ae(a, l, V)];
1976
+ l += q & 15;
1977
+ var E = q >> 4;
1978
+ if (E < 16)
1979
+ S[v++] = E;
1768
1980
  else {
1769
- var f = 0, C = 0;
1770
- for (F == 16 ? (C = 3 + rt(a, c, 3), c += 2, f = S[v - 1]) : F == 17 ? (C = 3 + rt(a, c, 7), c += 3) : F == 18 && (C = 11 + rt(a, c, 127), c += 7); C--; )
1771
- S[v++] = f;
1981
+ var p = 0, _ = 0;
1982
+ for (E == 16 ? (_ = 3 + ae(a, l, 3), l += 2, p = S[v - 1]) : E == 17 ? (_ = 3 + ae(a, l, 7), l += 3) : E == 18 && (_ = 11 + ae(a, l, 127), l += 7); _--; )
1983
+ S[v++] = p;
1772
1984
  }
1773
1985
  }
1774
- var Y = S.subarray(0, k), W = S.subarray(k);
1775
- A = kt(Y), b = kt(W), d = yt(Y, A, 1), w = yt(W, b, 1);
1986
+ var H = S.subarray(0, C), W = S.subarray(C);
1987
+ A = Ce(H), b = Ce(W), f = ye(H, A, 1), w = ye(W, b, 1);
1776
1988
  } else
1777
- nt(1);
1989
+ ne(1);
1778
1990
  else {
1779
- var F = ae(c) + 4, O = a[F - 4] | a[F - 3] << 8, V = F + O;
1780
- if (V > n) {
1781
- u && nt(0);
1991
+ var E = dt(l) + 4, U = a[E - 4] | a[E - 3] << 8, R = E + U;
1992
+ if (R > n) {
1993
+ m && ne(0);
1782
1994
  break;
1783
1995
  }
1784
- i && y(h + O), e.set(a.subarray(F, V), h), t.b = h += O, t.p = c = V * 8, t.f = m;
1996
+ o && y(h + U), t.set(a.subarray(E, R), h), e.b = h += U, e.p = l = R * 8, e.f = u;
1785
1997
  continue;
1786
1998
  }
1787
- if (c > z) {
1788
- u && nt(0);
1999
+ if (l > B) {
2000
+ m && ne(0);
1789
2001
  break;
1790
2002
  }
1791
2003
  }
1792
- i && y(h + 131072);
1793
- for (var R = (1 << A) - 1, J = (1 << b) - 1, Z = c; ; Z = c) {
1794
- var f = d[It(a, c) & R], H = f >> 4;
1795
- if (c += f & 15, c > z) {
1796
- u && nt(0);
2004
+ o && y(h + 131072);
2005
+ for (var F = (1 << A) - 1, J = (1 << b) - 1, Z = l; ; Z = l) {
2006
+ var p = f[Ie(a, l) & F], Y = p >> 4;
2007
+ if (l += p & 15, l > B) {
2008
+ m && ne(0);
1797
2009
  break;
1798
2010
  }
1799
- if (f || nt(2), H < 256)
1800
- e[h++] = H;
1801
- else if (H == 256) {
1802
- Z = c, d = null;
2011
+ if (p || ne(2), Y < 256)
2012
+ t[h++] = Y;
2013
+ else if (Y == 256) {
2014
+ Z = l, f = null;
1803
2015
  break;
1804
2016
  } else {
1805
- var D = H - 254;
1806
- if (H > 264) {
1807
- var v = H - 257, p = Vt[v];
1808
- D = rt(a, c, (1 << p) - 1) + Gt[v], c += p;
2017
+ var z = Y - 254;
2018
+ if (Y > 264) {
2019
+ var v = Y - 257, x = Ge[v];
2020
+ z = ae(a, l, (1 << x) - 1) + je[v], l += x;
1809
2021
  }
1810
- var q = w[It(a, c) & J], L = q >> 4;
1811
- q || nt(3), c += q & 15;
1812
- var W = se[L];
2022
+ var D = w[Ie(a, l) & J], L = D >> 4;
2023
+ D || ne(3), l += D & 15;
2024
+ var W = ht[L];
1813
2025
  if (L > 3) {
1814
- var p = Tt[L];
1815
- W += It(a, c) & (1 << p) - 1, c += p;
2026
+ var x = We[L];
2027
+ W += Ie(a, l) & (1 << x) - 1, l += x;
1816
2028
  }
1817
- if (c > z) {
1818
- u && nt(0);
2029
+ if (l > B) {
2030
+ m && ne(0);
1819
2031
  break;
1820
2032
  }
1821
- i && y(h + 131072);
1822
- var E = h + D;
2033
+ o && y(h + 131072);
2034
+ var P = h + z;
1823
2035
  if (h < W) {
1824
- var G = r - W, X = Math.min(W, E);
1825
- for (G + h < 0 && nt(3); h < X; ++h)
1826
- e[h] = s[G + h];
2036
+ var G = r - W, X = Math.min(W, P);
2037
+ for (G + h < 0 && ne(3); h < X; ++h)
2038
+ t[h] = s[G + h];
1827
2039
  }
1828
- for (; h < E; ++h)
1829
- e[h] = e[h - W];
2040
+ for (; h < P; ++h)
2041
+ t[h] = t[h - W];
1830
2042
  }
1831
2043
  }
1832
- t.l = d, t.p = Z, t.b = h, t.f = m, d && (m = 1, t.m = A, t.d = w, t.n = b);
1833
- } while (!m);
1834
- return h != e.length && o ? qt(e, 0, h) : e.subarray(0, h);
1835
- }, ce = /* @__PURE__ */ new st(0), it = function(a, t) {
1836
- return a[t] | a[t + 1] << 8;
1837
- }, at = function(a, t) {
1838
- return (a[t] | a[t + 1] << 8 | a[t + 2] << 16 | a[t + 3] << 24) >>> 0;
1839
- }, Ct = function(a, t) {
1840
- return at(a, t) + at(a, t + 4) * 4294967296;
2044
+ e.l = f, e.p = Z, e.b = h, e.f = u, f && (u = 1, e.m = A, e.d = w, e.n = b);
2045
+ } while (!u);
2046
+ return h != t.length && i ? De(t, 0, h) : t.subarray(0, h);
2047
+ }, xt = /* @__PURE__ */ new se(0), oe = function(a, e) {
2048
+ return a[e] | a[e + 1] << 8;
2049
+ }, re = function(a, e) {
2050
+ return (a[e] | a[e + 1] << 8 | a[e + 2] << 16 | a[e + 3] << 24) >>> 0;
2051
+ }, _e = function(a, e) {
2052
+ return re(a, e) + re(a, e + 4) * 4294967296;
1841
2053
  };
1842
- function le(a, t) {
1843
- return ie(a, { i: 2 }, t && t.out, t && t.dictionary);
2054
+ function gt(a, e) {
2055
+ return pt(a, { i: 2 }, e && e.out, e && e.dictionary);
1844
2056
  }
1845
- var Dt = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), he = 0;
2057
+ var ze = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), yt = 0;
1846
2058
  try {
1847
- Dt.decode(ce, { stream: !0 }), he = 1;
2059
+ ze.decode(xt, { stream: !0 }), yt = 1;
1848
2060
  } catch {
1849
2061
  }
1850
- var ue = function(a) {
1851
- for (var t = "", e = 0; ; ) {
1852
- var s = a[e++], n = (s > 127) + (s > 223) + (s > 239);
1853
- if (e + n > a.length)
1854
- return { s: t, r: qt(a, e - 1) };
1855
- n ? n == 3 ? (s = ((s & 15) << 18 | (a[e++] & 63) << 12 | (a[e++] & 63) << 6 | a[e++] & 63) - 65536, t += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023)) : n & 1 ? t += String.fromCharCode((s & 31) << 6 | a[e++] & 63) : t += String.fromCharCode((s & 15) << 12 | (a[e++] & 63) << 6 | a[e++] & 63) : t += String.fromCharCode(s);
2062
+ var wt = function(a) {
2063
+ for (var e = "", t = 0; ; ) {
2064
+ var s = a[t++], n = (s > 127) + (s > 223) + (s > 239);
2065
+ if (t + n > a.length)
2066
+ return { s: e, r: De(a, t - 1) };
2067
+ n ? n == 3 ? (s = ((s & 15) << 18 | (a[t++] & 63) << 12 | (a[t++] & 63) << 6 | a[t++] & 63) - 65536, e += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023)) : n & 1 ? e += String.fromCharCode((s & 31) << 6 | a[t++] & 63) : e += String.fromCharCode((s & 15) << 12 | (a[t++] & 63) << 6 | a[t++] & 63) : e += String.fromCharCode(s);
1856
2068
  }
1857
2069
  };
1858
- function me(a, t) {
1859
- if (t) {
1860
- for (var e = "", s = 0; s < a.length; s += 16384)
1861
- e += String.fromCharCode.apply(null, a.subarray(s, s + 16384));
1862
- return e;
2070
+ function vt(a, e) {
2071
+ if (e) {
2072
+ for (var t = "", s = 0; s < a.length; s += 16384)
2073
+ t += String.fromCharCode.apply(null, a.subarray(s, s + 16384));
2074
+ return t;
1863
2075
  } else {
1864
- if (Dt)
1865
- return Dt.decode(a);
1866
- var n = ue(a), r = n.s, e = n.r;
1867
- return e.length && nt(8), r;
2076
+ if (ze)
2077
+ return ze.decode(a);
2078
+ var n = wt(a), r = n.s, t = n.r;
2079
+ return t.length && ne(8), r;
1868
2080
  }
1869
2081
  }
1870
- var de = function(a, t) {
1871
- return t + 30 + it(a, t + 26) + it(a, t + 28);
1872
- }, fe = function(a, t, e) {
1873
- var s = it(a, t + 28), n = me(a.subarray(t + 46, t + 46 + s), !(it(a, t + 8) & 2048)), r = t + 46 + s, o = at(a, t + 20), i = e && o == 4294967295 ? pe(a, r) : [o, at(a, t + 24), at(a, t + 42)], u = i[0], y = i[1], m = i[2];
1874
- return [it(a, t + 10), u, y, n, r + it(a, t + 30) + it(a, t + 32), m];
1875
- }, pe = function(a, t) {
1876
- for (; it(a, t) != 1; t += 4 + it(a, t + 2))
2082
+ var Mt = function(a, e) {
2083
+ return e + 30 + oe(a, e + 26) + oe(a, e + 28);
2084
+ }, bt = function(a, e, t) {
2085
+ var s = oe(a, e + 28), n = vt(a.subarray(e + 46, e + 46 + s), !(oe(a, e + 8) & 2048)), r = e + 46 + s, i = re(a, e + 20), o = t && i == 4294967295 ? St(a, r) : [i, re(a, e + 24), re(a, e + 42)], m = o[0], y = o[1], u = o[2];
2086
+ return [oe(a, e + 10), m, y, n, r + oe(a, e + 30) + oe(a, e + 32), u];
2087
+ }, St = function(a, e) {
2088
+ for (; oe(a, e) != 1; e += 4 + oe(a, e + 2))
1877
2089
  ;
1878
- return [Ct(a, t + 12), Ct(a, t + 4), Ct(a, t + 20)];
2090
+ return [_e(a, e + 12), _e(a, e + 4), _e(a, e + 20)];
1879
2091
  };
1880
- function xe(a, t) {
1881
- for (var e = {}, s = a.length - 22; at(a, s) != 101010256; --s)
1882
- (!s || a.length - s > 65558) && nt(13);
1883
- var n = it(a, s + 8);
2092
+ function At(a, e) {
2093
+ for (var t = {}, s = a.length - 22; re(a, s) != 101010256; --s)
2094
+ (!s || a.length - s > 65558) && ne(13);
2095
+ var n = oe(a, s + 8);
1884
2096
  if (!n)
1885
2097
  return {};
1886
- var r = at(a, s + 16), o = r == 4294967295 || n == 65535;
1887
- if (o) {
1888
- var i = at(a, s - 12);
1889
- o = at(a, i) == 101075792, o && (n = at(a, i + 32), r = at(a, i + 48));
2098
+ var r = re(a, s + 16), i = r == 4294967295 || n == 65535;
2099
+ if (i) {
2100
+ var o = re(a, s - 12);
2101
+ i = re(a, o) == 101075792, i && (n = re(a, o + 32), r = re(a, o + 48));
1890
2102
  }
1891
- for (var u = 0; u < n; ++u) {
1892
- var y = fe(a, r, o), m = y[0], c = y[1], h = y[2], d = y[3], w = y[4], A = y[5], b = de(a, A);
1893
- r = w, m ? m == 8 ? e[d] = le(a.subarray(b, b + c), { out: new st(h) }) : nt(14, "unknown compression type " + m) : e[d] = qt(a, b, b + c);
2103
+ for (var m = 0; m < n; ++m) {
2104
+ var y = bt(a, r, i), u = y[0], l = y[1], h = y[2], f = y[3], w = y[4], A = y[5], b = Mt(a, A);
2105
+ r = w, u ? u == 8 ? t[f] = gt(a.subarray(b, b + l), { out: new se(h) }) : ne(14, "unknown compression type " + u) : t[f] = De(a, b, b + l);
1894
2106
  }
1895
- return e;
2107
+ return t;
1896
2108
  }
1897
- const Mt = (a) => typeof a == "number" && Number.isFinite(a), ht = (a, t) => {
1898
- const e = a[t];
1899
- if (typeof e != "object" || e === null)
1900
- throw new Error(`Invalid SOG metadata section: ${t}`);
1901
- return e;
1902
- }, ut = (a, t) => {
1903
- const e = a.files;
1904
- if (!Array.isArray(e))
1905
- throw new Error(`${t}.files is not an array`);
1906
- if (!e.every((s) => typeof s == "string"))
1907
- throw new Error(`${t}.files contains non-strings`);
1908
- return e;
1909
- }, Bt = (a, t) => {
1910
- const e = a.mins, s = a.maxs;
1911
- if (!Array.isArray(e) || e.length !== 3)
1912
- throw new Error(`${t}.mins must be length-3`);
2109
+ const Me = (a) => typeof a == "number" && Number.isFinite(a), he = (a, e) => {
2110
+ const t = a[e];
2111
+ if (typeof t != "object" || t === null)
2112
+ throw new Error(`Invalid SOG metadata section: ${e}`);
2113
+ return t;
2114
+ }, me = (a, e) => {
2115
+ const t = a.files;
2116
+ if (!Array.isArray(t))
2117
+ throw new Error(`${e}.files is not an array`);
2118
+ if (!t.every((s) => typeof s == "string"))
2119
+ throw new Error(`${e}.files contains non-strings`);
2120
+ return t;
2121
+ }, ke = (a, e) => {
2122
+ const t = a.mins, s = a.maxs;
2123
+ if (!Array.isArray(t) || t.length !== 3)
2124
+ throw new Error(`${e}.mins must be length-3`);
1913
2125
  if (!Array.isArray(s) || s.length !== 3)
1914
- throw new Error(`${t}.maxs must be length-3`);
1915
- if (![...e, ...s].every(Mt))
1916
- throw new Error(`${t}.mins/maxs must be finite numbers`);
2126
+ throw new Error(`${e}.maxs must be length-3`);
2127
+ if (![...t, ...s].every(Me))
2128
+ throw new Error(`${e}.mins/maxs must be finite numbers`);
1917
2129
  return {
1918
- mins: [e[0], e[1], e[2]],
2130
+ mins: [t[0], t[1], t[2]],
1919
2131
  maxs: [s[0], s[1], s[2]]
1920
2132
  };
1921
- }, ge = (a, t) => {
1922
- const e = a.mins, s = a.maxs;
1923
- if (!Array.isArray(e) || e.length !== 4)
1924
- throw new Error(`${t}.mins must be length-4`);
2133
+ }, Ct = (a, e) => {
2134
+ const t = a.mins, s = a.maxs;
2135
+ if (!Array.isArray(t) || t.length !== 4)
2136
+ throw new Error(`${e}.mins must be length-4`);
1925
2137
  if (!Array.isArray(s) || s.length !== 4)
1926
- throw new Error(`${t}.maxs must be length-4`);
1927
- if (![...e, ...s].every(Mt))
1928
- throw new Error(`${t}.mins/maxs must be finite numbers`);
2138
+ throw new Error(`${e}.maxs must be length-4`);
2139
+ if (![...t, ...s].every(Me))
2140
+ throw new Error(`${e}.mins/maxs must be finite numbers`);
1929
2141
  return {
1930
- mins: [e[0], e[1], e[2], e[3]],
2142
+ mins: [t[0], t[1], t[2], t[3]],
1931
2143
  maxs: [s[0], s[1], s[2], s[3]]
1932
2144
  };
1933
- }, _t = (a, t) => {
1934
- const e = a.codebook;
1935
- if (!Array.isArray(e))
1936
- throw new Error(`${t}.codebook is not an array`);
1937
- if (!e.every(Mt))
1938
- throw new Error(`${t}.codebook contains non-finite numbers`);
1939
- return e;
1940
- }, Ut = (a) => {
2145
+ }, Oe = (a, e) => {
2146
+ const t = a.codebook;
2147
+ if (!Array.isArray(t))
2148
+ throw new Error(`${e}.codebook is not an array`);
2149
+ if (!t.every(Me))
2150
+ throw new Error(`${e}.codebook contains non-finite numbers`);
2151
+ return t;
2152
+ }, Ue = (a) => {
1941
2153
  if (typeof a != "object" || a === null) throw new Error("Invalid SOG metadata: not an object");
1942
- const t = a, e = t.version ?? 1;
1943
- if (e !== 1 && e !== 2) throw new Error(`Unsupported SOG version: ${String(e)}`);
1944
- if (e === 1) {
1945
- const m = ht(t, "means"), c = ht(t, "sh0"), h = ht(t, "quats"), d = ht(t, "scales"), w = typeof t.count == "number" && Number.isFinite(t.count) ? t.count : void 0, A = Array.isArray(m.shape) ? m.shape : void 0, b = A && typeof A[0] == "number" ? A[0] : void 0;
2154
+ const e = a, t = e.version ?? 1;
2155
+ if (t !== 1 && t !== 2) throw new Error(`Unsupported SOG version: ${String(t)}`);
2156
+ if (t === 1) {
2157
+ const u = he(e, "means"), l = he(e, "sh0"), h = he(e, "quats"), f = he(e, "scales"), w = typeof e.count == "number" && Number.isFinite(e.count) ? e.count : void 0, A = Array.isArray(u.shape) ? u.shape : void 0, b = A && typeof A[0] == "number" ? A[0] : void 0;
1946
2158
  if (w === void 0 && b === void 0) throw new Error("Invalid SOGS metadata: unable to determine splat count");
1947
2159
  if (w !== void 0 && b !== void 0 && w !== b) throw new Error("Inconsistent SOGS metadata: count does not match means.shape[0]");
1948
2160
  return {
1949
2161
  version: 1,
1950
2162
  numSplats: (w ?? b) | 0,
1951
2163
  files: {
1952
- sh0: ut(c, "sh0"),
1953
- means: ut(m, "means"),
1954
- quats: ut(h, "quats"),
1955
- scales: ut(d, "scales")
2164
+ sh0: me(l, "sh0"),
2165
+ means: me(u, "means"),
2166
+ quats: me(h, "quats"),
2167
+ scales: me(f, "scales")
1956
2168
  },
1957
2169
  ranges: {
1958
- sh0: ge(c, "sh0"),
1959
- means: Bt(m, "means"),
1960
- scales: Bt(d, "scales")
2170
+ sh0: Ct(l, "sh0"),
2171
+ means: ke(u, "means"),
2172
+ scales: ke(f, "scales")
1961
2173
  }
1962
2174
  };
1963
2175
  }
1964
- const s = t.count;
1965
- if (!Mt(s)) throw new Error('Invalid SOG v2 metadata: missing/invalid "count"');
1966
- const n = s | 0, r = ht(t, "means"), o = ht(t, "sh0"), i = ht(t, "quats"), u = ht(t, "scales");
2176
+ const s = e.count;
2177
+ if (!Me(s)) throw new Error('Invalid SOG v2 metadata: missing/invalid "count"');
2178
+ const n = s | 0, r = he(e, "means"), i = he(e, "sh0"), o = he(e, "quats"), m = he(e, "scales");
1967
2179
  return {
1968
2180
  version: 2,
1969
2181
  numSplats: n,
1970
2182
  files: {
1971
- sh0: ut(o, "sh0"),
1972
- means: ut(r, "means"),
1973
- quats: ut(i, "quats"),
1974
- scales: ut(u, "scales")
2183
+ sh0: me(i, "sh0"),
2184
+ means: me(r, "means"),
2185
+ quats: me(o, "quats"),
2186
+ scales: me(m, "scales")
1975
2187
  },
1976
2188
  ranges: {
1977
- means: Bt(r, "means"),
1978
- sh0: { codebook: _t(o, "sh0") },
1979
- scales: { codebook: _t(u, "scales") }
2189
+ means: ke(r, "means"),
2190
+ sh0: { codebook: Oe(i, "sh0") },
2191
+ scales: { codebook: Oe(m, "scales") }
1980
2192
  },
1981
- antialias: typeof t.antialias == "boolean" ? t.antialias : void 0
2193
+ antialias: typeof e.antialias == "boolean" ? e.antialias : void 0
1982
2194
  // prettier-ignore
1983
2195
  };
1984
2196
  };
1985
- class Me extends l.Loader {
1986
- constructor(t, e) {
1987
- super(t), this.withCredentials = (e == null ? void 0 : e.withCredentials) ?? !1;
2197
+ class Bt extends c.Loader {
2198
+ constructor(e, t) {
2199
+ super(e), this.withCredentials = (t == null ? void 0 : t.withCredentials) ?? !1;
1988
2200
  }
1989
2201
  /**
1990
2202
  * Detect if a buffer is a ZIP file by checking magic bytes
1991
2203
  * ZIP files start with signature: PK\x03\x04 (0x50 0x4B 0x03 0x04)
1992
2204
  */
1993
- isZipBuffer(t) {
1994
- if (t.byteLength < 4) return !1;
1995
- const e = new Uint8Array(t, 0, 4);
1996
- return e[0] === 80 && e[1] === 75 && e[2] === 3 && e[3] === 4;
2205
+ isZipBuffer(e) {
2206
+ if (e.byteLength < 4) return !1;
2207
+ const t = new Uint8Array(e, 0, 4);
2208
+ return t[0] === 80 && t[1] === 75 && t[2] === 3 && t[3] === 4;
1997
2209
  }
1998
2210
  /**
1999
2211
  * Load a SOGS file (meta.json + textures)
@@ -2002,15 +2214,15 @@ class Me extends l.Loader {
2002
2214
  * @param onProgress Optional progress callback
2003
2215
  * @param onError Optional error callback
2004
2216
  */
2005
- load(t, e, s, n) {
2006
- const r = new l.FileLoader(this.manager);
2217
+ load(e, t, s, n) {
2218
+ const r = new c.FileLoader(this.manager);
2007
2219
  r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
2008
- t,
2009
- (o) => {
2010
- this.parseAsync(t, o).then((i) => {
2011
- e && e(i);
2012
- }).catch((i) => {
2013
- this.manager.itemError(t), n && n(i), console.error("Error loading SOGS meta:", i);
2220
+ e,
2221
+ (i) => {
2222
+ this.parseAsync(e, i).then((o) => {
2223
+ t && t(o);
2224
+ }).catch((o) => {
2225
+ this.manager.itemError(e), n && n(o), console.error("Error loading SOGS meta:", o);
2014
2226
  });
2015
2227
  },
2016
2228
  s,
@@ -2023,52 +2235,52 @@ class Me extends l.Loader {
2023
2235
  * @param onProgress Optional progress callback
2024
2236
  * @returns A Promise that resolves with the parsed SplatData
2025
2237
  */
2026
- loadAsync(t, e) {
2238
+ loadAsync(e, t) {
2027
2239
  return new Promise((s, n) => {
2028
- const r = new l.FileLoader(this.manager);
2240
+ const r = new c.FileLoader(this.manager);
2029
2241
  r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
2030
- t,
2031
- (o) => {
2032
- this.parseAsync(t, o).then(s).catch((i) => {
2033
- n(i), this.manager.itemError(t);
2242
+ e,
2243
+ (i) => {
2244
+ this.parseAsync(e, i).then(s).catch((o) => {
2245
+ n(o), this.manager.itemError(e);
2034
2246
  });
2035
2247
  },
2036
- e,
2037
- (o) => {
2038
- n(o), this.manager.itemError(t);
2248
+ t,
2249
+ (i) => {
2250
+ n(i), this.manager.itemError(e);
2039
2251
  }
2040
2252
  );
2041
2253
  });
2042
2254
  }
2043
- async parseAsync(t, e) {
2044
- if (!(e instanceof ArrayBuffer)) throw new Error("SOGS loader: expected ArrayBuffer payload");
2045
- if (this.isZipBuffer(e)) return this.parseZipAsync(e);
2046
- const n = new TextDecoder("utf-8").decode(e), r = JSON.parse(n);
2047
- return this.parseMetaAsync(t, r);
2255
+ async parseAsync(e, t) {
2256
+ if (!(t instanceof ArrayBuffer)) throw new Error("SOGS loader: expected ArrayBuffer payload");
2257
+ if (this.isZipBuffer(t)) return this.parseZipAsync(t);
2258
+ const n = new TextDecoder("utf-8").decode(t), r = JSON.parse(n);
2259
+ return this.parseMetaAsync(e, r);
2048
2260
  }
2049
- async parseMetaAsync(t, e) {
2050
- const s = Ut(e), { numSplats: n, files: r, ranges: o, version: i } = s, u = new l.TextureLoader(this.manager);
2051
- u.setPath(this.path), u.setRequestHeader(this.requestHeader), u.setWithCredentials(this.withCredentials);
2052
- const y = (F, O) => {
2261
+ async parseMetaAsync(e, t) {
2262
+ const s = Ue(t), { numSplats: n, files: r, ranges: i, version: o } = s, m = new c.TextureLoader(this.manager);
2263
+ m.setPath(this.path), m.setRequestHeader(this.requestHeader), m.setWithCredentials(this.withCredentials);
2264
+ const y = (E, U) => {
2053
2265
  try {
2054
- return new URL(O, F).toString();
2266
+ return new URL(U, E).toString();
2055
2267
  } catch {
2056
- return F.substring(0, F.lastIndexOf("/") + 1) + O;
2268
+ return E.substring(0, E.lastIndexOf("/") + 1) + U;
2057
2269
  }
2058
- }, m = (F, O) => {
2059
- const V = y(t, F);
2060
- return new Promise((k, M) => {
2061
- u.load(
2062
- V,
2063
- (B) => {
2064
- B.generateMipmaps = !1, B.magFilter = l.NearestFilter, B.minFilter = l.NearestFilter, B.flipY = !1, k(B);
2270
+ }, u = (E, U) => {
2271
+ const R = y(e, E);
2272
+ return new Promise((C, M) => {
2273
+ m.load(
2274
+ R,
2275
+ (k) => {
2276
+ k.generateMipmaps = !1, k.magFilter = c.NearestFilter, k.minFilter = c.NearestFilter, k.flipY = !1, C(k);
2065
2277
  },
2066
2278
  void 0,
2067
- (B) => {
2068
- const S = B instanceof Error ? B.message : String(B);
2279
+ (k) => {
2280
+ const S = k instanceof Error ? k.message : String(k);
2069
2281
  M(
2070
2282
  new Error(
2071
- `SOGS loader: failed to load ${O} (${F}): ${S}`
2283
+ `SOGS loader: failed to load ${U} (${E}): ${S}`
2072
2284
  )
2073
2285
  );
2074
2286
  }
@@ -2079,88 +2291,90 @@ class Me extends l.Loader {
2079
2291
  if (!Array.isArray(r.means) || r.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
2080
2292
  if (!Array.isArray(r.quats) || r.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
2081
2293
  if (!Array.isArray(r.scales) || r.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
2082
- const [c, h, d, w, A] = await Promise.all([
2083
- m(r.means[0], "means_l"),
2084
- m(r.means[1], "means_u"),
2085
- m(r.quats[0], "quats"),
2086
- m(r.scales[0], "scales"),
2087
- m(r.sh0[0], "sh0")
2088
- ]), b = { means_l: c, means_u: h, quats: d, scales: w, sh0: A };
2089
- if (i === 1) {
2090
- const F = new Ft(n, o, b), O = gt.packSogs(F);
2091
- return F.dispose(), O;
2294
+ const [l, h, f, w, A] = await Promise.all([
2295
+ u(r.means[0], "means_l"),
2296
+ u(r.means[1], "means_u"),
2297
+ u(r.quats[0], "quats"),
2298
+ u(r.scales[0], "scales"),
2299
+ u(r.sh0[0], "sh0")
2300
+ ]), b = { means_l: l, means_u: h, quats: f, scales: w, sh0: A };
2301
+ if (o === 1) {
2302
+ const E = new Ee(n, i, b), U = ge.packSogs(E);
2303
+ return E.dispose(), U;
2092
2304
  }
2093
- const z = new Pt(n, o, b), _ = gt.packSog2(z);
2094
- return z.dispose(), _;
2305
+ const B = new qe(n, i, b), T = ge.packSog2(B);
2306
+ return B.dispose(), T;
2095
2307
  }
2096
- async parseZipAsync(t) {
2097
- const e = xe(new Uint8Array(t)), s = Object.keys(e), n = s.find((g) => g.toLowerCase().endsWith("meta.json")) ?? null;
2308
+ async parseZipAsync(e) {
2309
+ const t = At(new Uint8Array(e)), s = Object.keys(t), n = s.find((g) => g.toLowerCase().endsWith("meta.json")) ?? null;
2098
2310
  if (!n) throw new Error("SOGS loader: zip missing meta.json");
2099
- const r = n.includes("/") ? n.slice(0, n.lastIndexOf("/") + 1) : "", o = new TextDecoder(), i = JSON.parse(o.decode(e[n])), u = Ut(i), { numSplats: y, files: m, ranges: c, version: h } = u, d = (g) => g.replace(/\\/g, "/").replace(/^\.?\//, ""), w = (g) => {
2100
- const v = d(g), T = [d(r + v), v];
2101
- for (const P of T) {
2102
- const f = e[P];
2103
- if (f) return f;
2311
+ const r = n.includes("/") ? n.slice(0, n.lastIndexOf("/") + 1) : "", i = new TextDecoder(), o = JSON.parse(i.decode(t[n])), m = Ue(o), { numSplats: y, files: u, ranges: l, version: h } = m, f = (g) => g.replace(/\\/g, "/").replace(/^\.?\//, ""), w = (g) => {
2312
+ const v = f(g), O = [f(r + v), v];
2313
+ for (const q of O) {
2314
+ const p = t[q];
2315
+ if (p) return p;
2104
2316
  }
2105
- const U = v.split("/").pop(), I = s.find((P) => d(P).endsWith("/" + v)) ?? s.find((P) => d(P).endsWith("/" + U)) ?? s.find((P) => d(P) === U) ?? null;
2106
- if (I) return e[I];
2317
+ const V = v.split("/").pop(), I = s.find((q) => f(q).endsWith("/" + v)) ?? s.find((q) => f(q).endsWith("/" + V)) ?? s.find((q) => f(q) === V) ?? null;
2318
+ if (I) return t[I];
2107
2319
  throw new Error(`SOGS loader: zip missing file "${g}"`);
2108
2320
  }, A = (g) => {
2109
2321
  const v = g.toLowerCase();
2110
2322
  return v.endsWith(".png") ? "image/png" : v.endsWith(".jpg") || v.endsWith(".jpeg") ? "image/jpeg" : v.endsWith(".webp") ? "image/webp" : "application/octet-stream";
2111
- }, b = new l.TextureLoader(this.manager);
2323
+ }, b = new c.TextureLoader(this.manager);
2112
2324
  b.setRequestHeader(this.requestHeader), b.setWithCredentials(this.withCredentials);
2113
- const z = (g, v) => {
2114
- const T = w(g), U = new Blob([T], {
2325
+ const B = (g, v) => {
2326
+ const O = w(g), V = new Blob([O], {
2115
2327
  type: A(g)
2116
- }), I = URL.createObjectURL(U);
2117
- return new Promise((P, f) => {
2328
+ }), I = URL.createObjectURL(V);
2329
+ return new Promise((q, p) => {
2118
2330
  b.load(
2119
2331
  I,
2120
- (C) => {
2121
- URL.revokeObjectURL(I), C.generateMipmaps = !1, C.magFilter = l.NearestFilter, C.minFilter = l.NearestFilter, C.flipY = !1, P(C);
2332
+ (_) => {
2333
+ URL.revokeObjectURL(I), _.generateMipmaps = !1, _.magFilter = c.NearestFilter, _.minFilter = c.NearestFilter, _.flipY = !1, q(_);
2122
2334
  },
2123
2335
  void 0,
2124
- (C) => {
2336
+ (_) => {
2125
2337
  URL.revokeObjectURL(I);
2126
- const Y = C instanceof Error ? C.message : String(C);
2127
- f(
2338
+ const H = _ instanceof Error ? _.message : String(_);
2339
+ p(
2128
2340
  new Error(
2129
- `SOGS loader: failed to load ${v} from zip (${g}): ${Y}`
2341
+ `SOGS loader: failed to load ${v} from zip (${g}): ${H}`
2130
2342
  )
2131
2343
  );
2132
2344
  }
2133
2345
  );
2134
2346
  });
2135
2347
  };
2136
- if (!Array.isArray(m.sh0) || m.sh0.length < 1) throw new Error("SOGS loader: files.sh0 must have at least 1 entry (sh0)");
2137
- if (!Array.isArray(m.means) || m.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
2138
- if (!Array.isArray(m.quats) || m.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
2139
- if (!Array.isArray(m.scales) || m.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
2140
- const [_, F, O, V, k] = await Promise.all([
2141
- z(m.means[0], "means_l"),
2142
- z(m.means[1], "means_u"),
2143
- z(m.quats[0], "quats"),
2144
- z(m.scales[0], "scales"),
2145
- z(m.sh0[0], "sh0")
2146
- ]), M = { means_l: _, means_u: F, quats: O, scales: V, sh0: k };
2348
+ if (!Array.isArray(u.sh0) || u.sh0.length < 1) throw new Error("SOGS loader: files.sh0 must have at least 1 entry (sh0)");
2349
+ if (!Array.isArray(u.means) || u.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
2350
+ if (!Array.isArray(u.quats) || u.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
2351
+ if (!Array.isArray(u.scales) || u.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
2352
+ const [T, E, U, R, C] = await Promise.all([
2353
+ B(u.means[0], "means_l"),
2354
+ B(u.means[1], "means_u"),
2355
+ B(u.quats[0], "quats"),
2356
+ B(u.scales[0], "scales"),
2357
+ B(u.sh0[0], "sh0")
2358
+ ]), M = { means_l: T, means_u: E, quats: U, scales: R, sh0: C };
2147
2359
  if (h === 1) {
2148
- const g = new Ft(y, c, M), v = gt.packSogs(g);
2360
+ const g = new Ee(y, l, M), v = ge.packSogs(g);
2149
2361
  return g.dispose(), v;
2150
2362
  }
2151
- const B = new Pt(y, c, M), S = gt.packSog2(B);
2152
- return B.dispose(), S;
2363
+ const k = new qe(y, l, M), S = ge.packSog2(k);
2364
+ return k.dispose(), S;
2153
2365
  }
2154
2366
  }
2155
- const be = "0.3.0";
2367
+ const zt = "0.3.0";
2156
2368
  export {
2157
- wt as BoundingBox,
2158
- ve as PlyLoader,
2159
- Me as SogsLoader,
2160
- At as SplatData,
2161
- Qt as SplatMaterial,
2162
- Rt as SplatMesh,
2163
- Yt as SplatSorter,
2164
- Ht as TextureManager,
2165
- be as VERSION
2369
+ st as AnimationController,
2370
+ we as BoundingBox,
2371
+ kt as PlyLoader,
2372
+ Bt as SogsLoader,
2373
+ Ae as SplatData,
2374
+ rt as SplatMaterial,
2375
+ Re as SplatMesh,
2376
+ Qe as SplatSorter,
2377
+ nt as TextureManager,
2378
+ zt as VERSION,
2379
+ Le as getEffect
2166
2380
  };