@speridlabs/visus 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +328 -320
- package/dist/main.es.js +530 -671
- package/dist/main.umd.js +6 -6
- package/dist/react.es.js +606 -747
- package/package.json +1 -1
package/dist/react.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var me = Object.defineProperty;
|
|
2
|
-
var xe = (
|
|
3
|
-
var
|
|
4
|
-
import
|
|
2
|
+
var xe = (T, e, o) => e in T ? me(T, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : T[e] = o;
|
|
3
|
+
var h = (T, e, o) => xe(T, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import ve, { useRef as ye, useMemo as ge, useEffect as we } from "react";
|
|
5
5
|
import { useLoader as be } from "@react-three/fiber";
|
|
6
|
-
import * as
|
|
7
|
-
var se = { exports: {} },
|
|
6
|
+
import * as i from "three";
|
|
7
|
+
var se = { exports: {} }, te = {};
|
|
8
8
|
/**
|
|
9
9
|
* @license React
|
|
10
10
|
* react-jsx-runtime.production.js
|
|
@@ -16,27 +16,27 @@ var se = { exports: {} }, ee = {};
|
|
|
16
16
|
*/
|
|
17
17
|
var ue;
|
|
18
18
|
function Se() {
|
|
19
|
-
if (ue) return
|
|
19
|
+
if (ue) return te;
|
|
20
20
|
ue = 1;
|
|
21
|
-
var
|
|
22
|
-
function
|
|
21
|
+
var T = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
22
|
+
function o(t, r, n) {
|
|
23
23
|
var a = null;
|
|
24
|
-
if (n !== void 0 && (a = "" + n),
|
|
24
|
+
if (n !== void 0 && (a = "" + n), r.key !== void 0 && (a = "" + r.key), "key" in r) {
|
|
25
25
|
n = {};
|
|
26
|
-
for (var
|
|
27
|
-
|
|
28
|
-
} else n =
|
|
29
|
-
return
|
|
30
|
-
$$typeof:
|
|
31
|
-
type:
|
|
26
|
+
for (var c in r)
|
|
27
|
+
c !== "key" && (n[c] = r[c]);
|
|
28
|
+
} else n = r;
|
|
29
|
+
return r = n.ref, {
|
|
30
|
+
$$typeof: T,
|
|
31
|
+
type: t,
|
|
32
32
|
key: a,
|
|
33
|
-
ref:
|
|
33
|
+
ref: r !== void 0 ? r : null,
|
|
34
34
|
props: n
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return te.Fragment = e, te.jsx = o, te.jsxs = o, te;
|
|
38
38
|
}
|
|
39
|
-
var
|
|
39
|
+
var re = {};
|
|
40
40
|
/**
|
|
41
41
|
* @license React
|
|
42
42
|
* react-jsx-runtime.development.js
|
|
@@ -46,24 +46,24 @@ var te = {};
|
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
48
|
*/
|
|
49
|
-
var
|
|
49
|
+
var he;
|
|
50
50
|
function _e() {
|
|
51
|
-
return
|
|
52
|
-
function
|
|
51
|
+
return he || (he = 1, process.env.NODE_ENV !== "production" && function() {
|
|
52
|
+
function T(s) {
|
|
53
53
|
if (s == null) return null;
|
|
54
54
|
if (typeof s == "function")
|
|
55
|
-
return s.$$typeof ===
|
|
55
|
+
return s.$$typeof === w ? null : s.displayName || s.name || null;
|
|
56
56
|
if (typeof s == "string") return s;
|
|
57
57
|
switch (s) {
|
|
58
|
-
case
|
|
58
|
+
case _:
|
|
59
59
|
return "Fragment";
|
|
60
60
|
case q:
|
|
61
61
|
return "Profiler";
|
|
62
|
-
case
|
|
62
|
+
case B:
|
|
63
63
|
return "StrictMode";
|
|
64
|
-
case
|
|
64
|
+
case $:
|
|
65
65
|
return "Suspense";
|
|
66
|
-
case
|
|
66
|
+
case F:
|
|
67
67
|
return "SuspenseList";
|
|
68
68
|
case C:
|
|
69
69
|
return "Activity";
|
|
@@ -72,21 +72,21 @@ function _e() {
|
|
|
72
72
|
switch (typeof s.tag == "number" && console.error(
|
|
73
73
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
74
74
|
), s.$$typeof) {
|
|
75
|
-
case
|
|
75
|
+
case f:
|
|
76
76
|
return "Portal";
|
|
77
|
-
case
|
|
77
|
+
case j:
|
|
78
78
|
return (s.displayName || "Context") + ".Provider";
|
|
79
79
|
case W:
|
|
80
80
|
return (s._context.displayName || "Context") + ".Consumer";
|
|
81
|
-
case
|
|
82
|
-
var
|
|
83
|
-
return s = s.displayName, s || (s =
|
|
84
|
-
case
|
|
85
|
-
return
|
|
86
|
-
case
|
|
87
|
-
|
|
81
|
+
case H:
|
|
82
|
+
var d = s.render;
|
|
83
|
+
return s = s.displayName, s || (s = d.displayName || d.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
84
|
+
case k:
|
|
85
|
+
return d = s.displayName || null, d !== null ? d : T(s.type) || "Memo";
|
|
86
|
+
case O:
|
|
87
|
+
d = s._payload, s = s._init;
|
|
88
88
|
try {
|
|
89
|
-
return
|
|
89
|
+
return T(s(d));
|
|
90
90
|
} catch {
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -95,76 +95,76 @@ function _e() {
|
|
|
95
95
|
function e(s) {
|
|
96
96
|
return "" + s;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function o(s) {
|
|
99
99
|
try {
|
|
100
100
|
e(s);
|
|
101
|
-
var
|
|
101
|
+
var d = !1;
|
|
102
102
|
} catch {
|
|
103
|
-
|
|
103
|
+
d = !0;
|
|
104
104
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
var
|
|
108
|
-
return
|
|
109
|
-
|
|
105
|
+
if (d) {
|
|
106
|
+
d = console;
|
|
107
|
+
var A = d.error, z = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
108
|
+
return A.call(
|
|
109
|
+
d,
|
|
110
110
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
111
|
-
|
|
111
|
+
z
|
|
112
112
|
), e(s);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (s ===
|
|
117
|
-
if (typeof s == "object" && s !== null && s.$$typeof ===
|
|
115
|
+
function t(s) {
|
|
116
|
+
if (s === _) return "<>";
|
|
117
|
+
if (typeof s == "object" && s !== null && s.$$typeof === O)
|
|
118
118
|
return "<...>";
|
|
119
119
|
try {
|
|
120
|
-
var
|
|
121
|
-
return
|
|
120
|
+
var d = T(s);
|
|
121
|
+
return d ? "<" + d + ">" : "<...>";
|
|
122
122
|
} catch {
|
|
123
123
|
return "<...>";
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
var s =
|
|
126
|
+
function r() {
|
|
127
|
+
var s = M.A;
|
|
128
128
|
return s === null ? null : s.getOwner();
|
|
129
129
|
}
|
|
130
130
|
function n() {
|
|
131
131
|
return Error("react-stack-top-frame");
|
|
132
132
|
}
|
|
133
133
|
function a(s) {
|
|
134
|
-
if (
|
|
135
|
-
var
|
|
136
|
-
if (
|
|
134
|
+
if (U.call(s, "key")) {
|
|
135
|
+
var d = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
136
|
+
if (d && d.isReactWarning) return !1;
|
|
137
137
|
}
|
|
138
138
|
return s.key !== void 0;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
function
|
|
142
|
-
|
|
140
|
+
function c(s, d) {
|
|
141
|
+
function A() {
|
|
142
|
+
x || (x = !0, console.error(
|
|
143
143
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
144
|
-
|
|
144
|
+
d
|
|
145
145
|
));
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
get:
|
|
147
|
+
A.isReactWarning = !0, Object.defineProperty(s, "key", {
|
|
148
|
+
get: A,
|
|
149
149
|
configurable: !0
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
var s =
|
|
154
|
-
return
|
|
152
|
+
function v() {
|
|
153
|
+
var s = T(this.type);
|
|
154
|
+
return E[s] || (E[s] = !0, console.error(
|
|
155
155
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
156
156
|
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
157
157
|
}
|
|
158
|
-
function g(s,
|
|
159
|
-
return
|
|
160
|
-
$$typeof:
|
|
158
|
+
function g(s, d, A, z, L, u, P, D) {
|
|
159
|
+
return A = u.ref, s = {
|
|
160
|
+
$$typeof: m,
|
|
161
161
|
type: s,
|
|
162
|
-
key:
|
|
163
|
-
props:
|
|
164
|
-
_owner:
|
|
165
|
-
}, (
|
|
162
|
+
key: d,
|
|
163
|
+
props: u,
|
|
164
|
+
_owner: L
|
|
165
|
+
}, (A !== void 0 ? A : null) !== null ? Object.defineProperty(s, "ref", {
|
|
166
166
|
enumerable: !1,
|
|
167
|
-
get:
|
|
167
|
+
get: v
|
|
168
168
|
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
169
169
|
configurable: !1,
|
|
170
170
|
enumerable: !1,
|
|
@@ -179,118 +179,118 @@ function _e() {
|
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
182
|
+
value: P
|
|
183
183
|
}), Object.defineProperty(s, "_debugTask", {
|
|
184
184
|
configurable: !1,
|
|
185
185
|
enumerable: !1,
|
|
186
186
|
writable: !0,
|
|
187
|
-
value:
|
|
187
|
+
value: D
|
|
188
188
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
var
|
|
192
|
-
if (
|
|
193
|
-
if (
|
|
194
|
-
if (V(
|
|
195
|
-
for (
|
|
196
|
-
|
|
197
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
function S(s, d, A, z, L, u, P, D) {
|
|
191
|
+
var l = d.children;
|
|
192
|
+
if (l !== void 0)
|
|
193
|
+
if (z)
|
|
194
|
+
if (V(l)) {
|
|
195
|
+
for (z = 0; z < l.length; z++)
|
|
196
|
+
b(l[z]);
|
|
197
|
+
Object.freeze && Object.freeze(l);
|
|
198
198
|
} else
|
|
199
199
|
console.error(
|
|
200
200
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
201
201
|
);
|
|
202
|
-
else
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
return
|
|
202
|
+
else b(l);
|
|
203
|
+
if (U.call(d, "key")) {
|
|
204
|
+
l = T(s);
|
|
205
|
+
var I = Object.keys(d).filter(function(X) {
|
|
206
|
+
return X !== "key";
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
z = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", G[l + z] || (I = 0 < I.length ? "{" + I.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
209
209
|
`A props object containing a "key" prop is being spread into JSX:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s {...props} />
|
|
212
212
|
React keys must be passed directly to JSX without using spread:
|
|
213
213
|
let props = %s;
|
|
214
214
|
<%s key={someKey} {...props} />`,
|
|
215
|
-
D,
|
|
216
|
-
h,
|
|
217
215
|
z,
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
l,
|
|
217
|
+
I,
|
|
218
|
+
l
|
|
219
|
+
), G[l + z] = !0);
|
|
220
220
|
}
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
for (var
|
|
224
|
-
|
|
225
|
-
} else
|
|
226
|
-
return
|
|
227
|
-
|
|
221
|
+
if (l = null, A !== void 0 && (o(A), l = "" + A), a(d) && (o(d.key), l = "" + d.key), "key" in d) {
|
|
222
|
+
A = {};
|
|
223
|
+
for (var Y in d)
|
|
224
|
+
Y !== "key" && (A[Y] = d[Y]);
|
|
225
|
+
} else A = d;
|
|
226
|
+
return l && c(
|
|
227
|
+
A,
|
|
228
228
|
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
229
229
|
), g(
|
|
230
230
|
s,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
l,
|
|
232
|
+
u,
|
|
233
|
+
L,
|
|
234
|
+
r(),
|
|
235
|
+
A,
|
|
236
|
+
P,
|
|
237
|
+
D
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
typeof s == "object" && s !== null && s.$$typeof ===
|
|
240
|
+
function b(s) {
|
|
241
|
+
typeof s == "object" && s !== null && s.$$typeof === m && s._store && (s._store.validated = 1);
|
|
242
242
|
}
|
|
243
|
-
var
|
|
243
|
+
var p = ve, m = Symbol.for("react.transitional.element"), f = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), W = Symbol.for("react.consumer"), j = Symbol.for("react.context"), H = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), w = Symbol.for("react.client.reference"), M = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, V = Array.isArray, y = console.createTask ? console.createTask : function() {
|
|
244
244
|
return null;
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
p = {
|
|
247
247
|
"react-stack-bottom-frame": function(s) {
|
|
248
248
|
return s();
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
var
|
|
252
|
-
|
|
251
|
+
var x, E = {}, R = p["react-stack-bottom-frame"].bind(
|
|
252
|
+
p,
|
|
253
253
|
n
|
|
254
|
-
)(),
|
|
255
|
-
|
|
256
|
-
var
|
|
257
|
-
return
|
|
254
|
+
)(), N = y(t(n)), G = {};
|
|
255
|
+
re.Fragment = _, re.jsx = function(s, d, A, z, L) {
|
|
256
|
+
var u = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
257
|
+
return S(
|
|
258
258
|
s,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
d,
|
|
260
|
+
A,
|
|
261
261
|
!1,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
z,
|
|
263
|
+
L,
|
|
264
|
+
u ? Error("react-stack-top-frame") : R,
|
|
265
|
+
u ? y(t(s)) : N
|
|
266
266
|
);
|
|
267
|
-
},
|
|
268
|
-
var
|
|
269
|
-
return
|
|
267
|
+
}, re.jsxs = function(s, d, A, z, L) {
|
|
268
|
+
var u = 1e4 > M.recentlyCreatedOwnerStacks++;
|
|
269
|
+
return S(
|
|
270
270
|
s,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
d,
|
|
272
|
+
A,
|
|
273
273
|
!0,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
z,
|
|
275
|
+
L,
|
|
276
|
+
u ? Error("react-stack-top-frame") : R,
|
|
277
|
+
u ? y(t(s)) : N
|
|
278
278
|
);
|
|
279
279
|
};
|
|
280
|
-
}()),
|
|
280
|
+
}()), re;
|
|
281
281
|
}
|
|
282
282
|
var fe;
|
|
283
|
-
function
|
|
283
|
+
function Te() {
|
|
284
284
|
return fe || (fe = 1, process.env.NODE_ENV === "production" ? se.exports = Se() : se.exports = _e()), se.exports;
|
|
285
285
|
}
|
|
286
|
-
var
|
|
286
|
+
var Me = Te();
|
|
287
287
|
class le {
|
|
288
288
|
constructor() {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
h(this, "min", new i.Vector3(1 / 0, 1 / 0, 1 / 0));
|
|
290
|
+
h(this, "max", new i.Vector3(-1 / 0, -1 / 0, -1 / 0));
|
|
291
|
+
h(this, "center", new i.Vector3());
|
|
292
292
|
/** Half extents (size/2) */
|
|
293
|
-
|
|
293
|
+
h(this, "halfExtents", new i.Vector3());
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* Reset the bounding box to its initial state
|
|
@@ -331,7 +331,7 @@ class le {
|
|
|
331
331
|
* @returns THREE.Box3 representation
|
|
332
332
|
*/
|
|
333
333
|
toBox3() {
|
|
334
|
-
return new
|
|
334
|
+
return new i.Box3().set(this.min, this.max);
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
337
|
* Create a clone of this bounding box
|
|
@@ -342,17 +342,17 @@ class le {
|
|
|
342
342
|
return e.min.copy(this.min), e.max.copy(this.max), e.center.copy(this.center), e.halfExtents.copy(this.halfExtents), e;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
class
|
|
345
|
+
class Ae {
|
|
346
346
|
// TODO: there is no sh spherical harmonics
|
|
347
347
|
constructor(e = 0) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
348
|
+
h(this, "numSplats", 0);
|
|
349
|
+
h(this, "positions");
|
|
350
|
+
h(this, "rotations");
|
|
351
|
+
h(this, "scales");
|
|
352
|
+
h(this, "colors");
|
|
353
|
+
h(this, "opacities");
|
|
354
|
+
h(this, "centers");
|
|
355
|
+
h(this, "boundingBox", new le());
|
|
356
356
|
this.numSplats = e, this.allocateBuffers(e);
|
|
357
357
|
}
|
|
358
358
|
allocateBuffers(e) {
|
|
@@ -367,13 +367,13 @@ class Me {
|
|
|
367
367
|
* @param color Color
|
|
368
368
|
* @param opacity Opacity value
|
|
369
369
|
*/
|
|
370
|
-
setSplat(e,
|
|
370
|
+
setSplat(e, o, t, r, n, a) {
|
|
371
371
|
if (e >= this.numSplats)
|
|
372
372
|
throw new Error(
|
|
373
373
|
`Splat index out of bounds: ${e} >= ${this.numSplats}`
|
|
374
374
|
);
|
|
375
|
-
const
|
|
376
|
-
this.positions[
|
|
375
|
+
const c = e * 3, v = e * 4, g = e * 3, S = e * 3;
|
|
376
|
+
this.positions[c] = o.x, this.positions[c + 1] = o.y, this.positions[c + 2] = o.z, this.rotations[v] = t.x, this.rotations[v + 1] = t.y, this.rotations[v + 2] = t.z, this.rotations[v + 3] = t.w, this.scales[g] = r.x, this.scales[g + 1] = r.y, this.scales[g + 2] = r.z, this.colors[S] = n.r, this.colors[S + 1] = n.g, this.colors[S + 2] = n.b, this.opacities[e] = a, this.centers[c] = o.x, this.centers[c + 1] = o.y, this.centers[c + 2] = o.z;
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* Get a splat's data
|
|
@@ -385,26 +385,26 @@ class Me {
|
|
|
385
385
|
throw new Error(
|
|
386
386
|
`Splat index out of bounds: ${e} >= ${this.numSplats}`
|
|
387
387
|
);
|
|
388
|
-
const
|
|
388
|
+
const o = e * 3, t = e * 4, r = e * 3, n = e * 3;
|
|
389
389
|
return {
|
|
390
|
-
position: new
|
|
391
|
-
this.positions[
|
|
392
|
-
this.positions[
|
|
393
|
-
this.positions[
|
|
390
|
+
position: new i.Vector3(
|
|
391
|
+
this.positions[o],
|
|
392
|
+
this.positions[o + 1],
|
|
393
|
+
this.positions[o + 2]
|
|
394
394
|
),
|
|
395
|
-
rotation: new
|
|
396
|
-
this.rotations[
|
|
397
|
-
this.rotations[
|
|
398
|
-
this.rotations[
|
|
399
|
-
this.rotations[
|
|
395
|
+
rotation: new i.Quaternion(
|
|
396
|
+
this.rotations[t],
|
|
397
|
+
this.rotations[t + 1],
|
|
398
|
+
this.rotations[t + 2],
|
|
399
|
+
this.rotations[t + 3]
|
|
400
400
|
),
|
|
401
401
|
// Convert log scale back to linear scale for external use
|
|
402
|
-
scale: new
|
|
403
|
-
Math.exp(this.scales[
|
|
404
|
-
Math.exp(this.scales[
|
|
405
|
-
Math.exp(this.scales[
|
|
402
|
+
scale: new i.Vector3(
|
|
403
|
+
Math.exp(this.scales[r]),
|
|
404
|
+
Math.exp(this.scales[r + 1]),
|
|
405
|
+
Math.exp(this.scales[r + 2])
|
|
406
406
|
),
|
|
407
|
-
color: new
|
|
407
|
+
color: new i.Color(
|
|
408
408
|
this.colors[n],
|
|
409
409
|
this.colors[n + 1],
|
|
410
410
|
this.colors[n + 2]
|
|
@@ -418,13 +418,13 @@ class Me {
|
|
|
418
418
|
*/
|
|
419
419
|
calculateBoundingBox() {
|
|
420
420
|
this.boundingBox.reset();
|
|
421
|
-
const e = new
|
|
422
|
-
for (let
|
|
423
|
-
const
|
|
421
|
+
const e = new i.Vector3();
|
|
422
|
+
for (let o = 0; o < this.numSplats; o++) {
|
|
423
|
+
const t = o * 3;
|
|
424
424
|
e.set(
|
|
425
|
-
this.positions[
|
|
426
|
-
this.positions[
|
|
427
|
-
this.positions[
|
|
425
|
+
this.positions[t],
|
|
426
|
+
this.positions[t + 1],
|
|
427
|
+
this.positions[t + 2]
|
|
428
428
|
), this.boundingBox.expandByPoint(e);
|
|
429
429
|
}
|
|
430
430
|
return this.boundingBox;
|
|
@@ -434,37 +434,37 @@ class Me {
|
|
|
434
434
|
* This is for visualization/debugging purposes only, not for rendering
|
|
435
435
|
*/
|
|
436
436
|
createDebugGeometry() {
|
|
437
|
-
const e = new
|
|
437
|
+
const e = new i.BufferGeometry();
|
|
438
438
|
e.setAttribute(
|
|
439
439
|
"position",
|
|
440
|
-
new
|
|
440
|
+
new i.BufferAttribute(this.positions, 3)
|
|
441
441
|
);
|
|
442
|
-
const
|
|
442
|
+
const o = new Float32Array(this.numSplats * 3), t = new i.Quaternion(), r = new i.Euler();
|
|
443
443
|
for (let n = 0; n < this.numSplats; n++) {
|
|
444
|
-
const a = n * 4,
|
|
445
|
-
|
|
444
|
+
const a = n * 4, c = n * 3;
|
|
445
|
+
t.set(
|
|
446
446
|
this.rotations[a],
|
|
447
447
|
this.rotations[a + 1],
|
|
448
448
|
this.rotations[a + 2],
|
|
449
449
|
this.rotations[a + 3]
|
|
450
|
-
),
|
|
450
|
+
), r.setFromQuaternion(t), o[c] = r.x, o[c + 1] = r.y, o[c + 2] = r.z;
|
|
451
451
|
}
|
|
452
452
|
return e.setAttribute(
|
|
453
453
|
"rotation",
|
|
454
|
-
new
|
|
454
|
+
new i.BufferAttribute(o, 3)
|
|
455
455
|
), e.setAttribute(
|
|
456
456
|
"scale",
|
|
457
|
-
new
|
|
457
|
+
new i.BufferAttribute(this.scales, 3)
|
|
458
458
|
), e.setAttribute(
|
|
459
459
|
"color",
|
|
460
|
-
new
|
|
460
|
+
new i.BufferAttribute(this.colors, 3)
|
|
461
461
|
), e.setAttribute(
|
|
462
462
|
"opacity",
|
|
463
|
-
new
|
|
463
|
+
new i.BufferAttribute(this.opacities, 1)
|
|
464
464
|
), e;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
class
|
|
467
|
+
class Ce extends i.Loader {
|
|
468
468
|
/**
|
|
469
469
|
* Load a PLY file with Gaussian Splat data
|
|
470
470
|
* @param url URL of the PLY file
|
|
@@ -472,23 +472,22 @@ class Te extends c.Loader {
|
|
|
472
472
|
* @param onProgress Optional progress callback
|
|
473
473
|
* @param onError Optional error callback
|
|
474
474
|
*/
|
|
475
|
-
load(e,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
|
|
475
|
+
load(e, o, t, r) {
|
|
476
|
+
const n = new i.FileLoader(this.manager);
|
|
477
|
+
n.setResponseType("arraybuffer"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
479
478
|
e,
|
|
480
|
-
(
|
|
479
|
+
(a) => {
|
|
481
480
|
try {
|
|
482
|
-
if (
|
|
483
|
-
const
|
|
484
|
-
|
|
481
|
+
if (o) {
|
|
482
|
+
const c = this.parse(a);
|
|
483
|
+
o(c);
|
|
485
484
|
}
|
|
486
|
-
} catch (
|
|
487
|
-
|
|
485
|
+
} catch (c) {
|
|
486
|
+
r ? r(c) : console.error(c), this.manager.itemError(e);
|
|
488
487
|
}
|
|
489
488
|
},
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
t,
|
|
490
|
+
r
|
|
492
491
|
);
|
|
493
492
|
}
|
|
494
493
|
/**
|
|
@@ -497,22 +496,22 @@ class Te extends c.Loader {
|
|
|
497
496
|
* @param onProgress Optional progress callback
|
|
498
497
|
* @returns A Promise that resolves with the parsed SplatData
|
|
499
498
|
*/
|
|
500
|
-
loadAsync(e,
|
|
501
|
-
return new Promise((
|
|
502
|
-
const n = new
|
|
499
|
+
loadAsync(e, o) {
|
|
500
|
+
return new Promise((t, r) => {
|
|
501
|
+
const n = new i.FileLoader(this.manager);
|
|
503
502
|
n.setResponseType("arraybuffer"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
504
503
|
e,
|
|
505
504
|
(a) => {
|
|
506
505
|
try {
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
} catch (
|
|
510
|
-
|
|
506
|
+
const c = this.parse(a);
|
|
507
|
+
t(c);
|
|
508
|
+
} catch (c) {
|
|
509
|
+
r(c), this.manager.itemError(e);
|
|
511
510
|
}
|
|
512
511
|
},
|
|
513
|
-
|
|
512
|
+
o,
|
|
514
513
|
(a) => {
|
|
515
|
-
|
|
514
|
+
r(a), this.manager.itemError(e);
|
|
516
515
|
}
|
|
517
516
|
);
|
|
518
517
|
});
|
|
@@ -523,283 +522,191 @@ class Te extends c.Loader {
|
|
|
523
522
|
* @returns Parsed SplatData
|
|
524
523
|
*/
|
|
525
524
|
parse(e) {
|
|
526
|
-
const
|
|
527
|
-
r && console.debug(
|
|
528
|
-
"[2/12] LOADER PlyLoader: starting parse, buffer size:",
|
|
529
|
-
e.byteLength
|
|
530
|
-
);
|
|
531
|
-
const o = new TextDecoder(), t = new Uint8Array(e), n = [112, 108, 121, 10], a = `
|
|
525
|
+
const o = new TextDecoder(), t = new Uint8Array(e), r = [112, 108, 121, 10], n = `
|
|
532
526
|
end_header
|
|
533
527
|
`;
|
|
534
|
-
for (let
|
|
535
|
-
if (t[
|
|
528
|
+
for (let y = 0; y < r.length; y++)
|
|
529
|
+
if (t[y] !== r[y])
|
|
536
530
|
throw new Error("Invalid PLY file: Missing magic bytes");
|
|
537
|
-
|
|
538
|
-
let
|
|
539
|
-
|
|
540
|
-
let
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
m = !1;
|
|
531
|
+
let a = 0;
|
|
532
|
+
for (let y = 0; y < t.length - n.length; y++) {
|
|
533
|
+
let x = !0;
|
|
534
|
+
for (let E = 0; E < n.length; E++)
|
|
535
|
+
if (t[y + E] !== n.charCodeAt(E)) {
|
|
536
|
+
x = !1;
|
|
544
537
|
break;
|
|
545
538
|
}
|
|
546
|
-
if (
|
|
547
|
-
|
|
539
|
+
if (x) {
|
|
540
|
+
a = y + n.length;
|
|
548
541
|
break;
|
|
549
542
|
}
|
|
550
543
|
}
|
|
551
|
-
if (
|
|
544
|
+
if (a === 0)
|
|
552
545
|
throw new Error("Invalid PLY file: Could not find end of header");
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
)
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
let v = null;
|
|
562
|
-
for (let f = 1; f < g.length; f++) {
|
|
563
|
-
const m = g[f].trim();
|
|
564
|
-
if (m === "" || m === "end_header") continue;
|
|
565
|
-
const S = m.split(" ");
|
|
566
|
-
switch (S[0]) {
|
|
546
|
+
const v = o.decode(t.subarray(0, a)).split(`
|
|
547
|
+
`), g = [];
|
|
548
|
+
let S = null;
|
|
549
|
+
for (let y = 1; y < v.length; y++) {
|
|
550
|
+
const x = v[y].trim();
|
|
551
|
+
if (x === "" || x === "end_header") continue;
|
|
552
|
+
const E = x.split(" ");
|
|
553
|
+
switch (E[0]) {
|
|
567
554
|
case "format":
|
|
568
|
-
|
|
569
|
-
"[6/12] LOADER PlyLoader: format detected:",
|
|
570
|
-
v
|
|
571
|
-
);
|
|
555
|
+
S = E[1];
|
|
572
556
|
break;
|
|
573
557
|
case "element":
|
|
574
|
-
|
|
575
|
-
name:
|
|
576
|
-
count: parseInt(
|
|
558
|
+
g.push({
|
|
559
|
+
name: E[1],
|
|
560
|
+
count: parseInt(E[2], 10),
|
|
577
561
|
properties: []
|
|
578
|
-
})
|
|
579
|
-
"[6/12] LOADER PlyLoader: element found:",
|
|
580
|
-
S[1],
|
|
581
|
-
"count:",
|
|
582
|
-
S[2]
|
|
583
|
-
);
|
|
562
|
+
});
|
|
584
563
|
break;
|
|
585
564
|
case "property":
|
|
586
|
-
if (
|
|
565
|
+
if (g.length === 0)
|
|
587
566
|
throw new Error(
|
|
588
567
|
"Invalid PLY file: Property without element"
|
|
589
568
|
);
|
|
590
|
-
|
|
591
|
-
type:
|
|
592
|
-
name:
|
|
569
|
+
g[g.length - 1].properties.push({
|
|
570
|
+
type: E[1],
|
|
571
|
+
name: E[2],
|
|
593
572
|
storage: null
|
|
594
|
-
})
|
|
595
|
-
"[6/12] LOADER PlyLoader: property found:",
|
|
596
|
-
S[2],
|
|
597
|
-
"type:",
|
|
598
|
-
S[1]
|
|
599
|
-
);
|
|
573
|
+
});
|
|
600
574
|
break;
|
|
601
575
|
}
|
|
602
576
|
}
|
|
603
|
-
if (
|
|
604
|
-
throw new Error(`Unsupported PLY format: ${
|
|
605
|
-
const b =
|
|
577
|
+
if (S !== "binary_little_endian")
|
|
578
|
+
throw new Error(`Unsupported PLY format: ${S}`);
|
|
579
|
+
const b = g.find((y) => y.name === "vertex");
|
|
606
580
|
if (!b)
|
|
607
581
|
throw new Error("Invalid PLY file: No vertex element found");
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
"
|
|
615
|
-
|
|
616
|
-
"
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
A("scale_0"),
|
|
627
|
-
A("scale_1"),
|
|
628
|
-
A("scale_2")
|
|
629
|
-
], B = [
|
|
630
|
-
A("f_dc_0"),
|
|
631
|
-
A("f_dc_1"),
|
|
632
|
-
A("f_dc_2")
|
|
633
|
-
], T = A("opacity");
|
|
634
|
-
if (r && console.debug("[9/12] LOADER PlyLoader: property indices:", {
|
|
635
|
-
position: [q, W, N],
|
|
636
|
-
rotation: F,
|
|
637
|
-
scale: Y,
|
|
638
|
-
color: B,
|
|
639
|
-
opacity: T
|
|
640
|
-
}), [
|
|
582
|
+
const p = new Ae(b.count), m = new DataView(e);
|
|
583
|
+
let f = a;
|
|
584
|
+
const _ = (y) => b.properties.findIndex((x) => x.name === y), B = _("x"), q = _("y"), W = _("z"), j = [
|
|
585
|
+
_("rot_0"),
|
|
586
|
+
_("rot_1"),
|
|
587
|
+
_("rot_2"),
|
|
588
|
+
_("rot_3")
|
|
589
|
+
], H = [
|
|
590
|
+
_("scale_0"),
|
|
591
|
+
_("scale_1"),
|
|
592
|
+
_("scale_2")
|
|
593
|
+
], $ = [
|
|
594
|
+
_("f_dc_0"),
|
|
595
|
+
_("f_dc_1"),
|
|
596
|
+
_("f_dc_2")
|
|
597
|
+
], F = _("opacity");
|
|
598
|
+
if ([
|
|
599
|
+
B,
|
|
641
600
|
q,
|
|
642
601
|
W,
|
|
643
|
-
|
|
644
|
-
...
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
].some((f) => f === -1))
|
|
602
|
+
...j,
|
|
603
|
+
...H,
|
|
604
|
+
...$,
|
|
605
|
+
F
|
|
606
|
+
].some((y) => y === -1))
|
|
649
607
|
throw new Error("Invalid PLY file: Missing required properties");
|
|
650
|
-
const
|
|
651
|
-
if (
|
|
652
|
-
const
|
|
653
|
-
return
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
r && f % 1e4 === 0 && console.debug(
|
|
662
|
-
`[10/12] LOADER PlyLoader: processing splat ${f}/${b.count} (${(f / b.count * 100).toFixed(1)}%)`
|
|
663
|
-
);
|
|
664
|
-
const m = [];
|
|
665
|
-
for (let j = 0; j < b.properties.length; j++) {
|
|
666
|
-
const s = b.properties[j].type;
|
|
667
|
-
let u;
|
|
668
|
-
switch (s) {
|
|
608
|
+
const O = 0.28209479177387814, C = (y) => {
|
|
609
|
+
if (y > 0) return 1 / (1 + Math.exp(-y));
|
|
610
|
+
const x = Math.exp(y);
|
|
611
|
+
return x / (1 + x);
|
|
612
|
+
}, w = new i.Vector3(), M = new i.Quaternion(), U = new i.Vector3(), V = new i.Color();
|
|
613
|
+
for (let y = 0; y < b.count; y++) {
|
|
614
|
+
const x = [];
|
|
615
|
+
for (let R = 0; R < b.properties.length; R++) {
|
|
616
|
+
const G = b.properties[R].type;
|
|
617
|
+
let s;
|
|
618
|
+
switch (G) {
|
|
669
619
|
case "char":
|
|
670
|
-
|
|
620
|
+
s = m.getInt8(f), f += 1;
|
|
671
621
|
break;
|
|
672
622
|
case "uchar":
|
|
673
|
-
|
|
623
|
+
s = m.getUint8(f), f += 1;
|
|
674
624
|
break;
|
|
675
625
|
case "short":
|
|
676
|
-
|
|
626
|
+
s = m.getInt16(f, !0), f += 2;
|
|
677
627
|
break;
|
|
678
628
|
case "ushort":
|
|
679
|
-
|
|
629
|
+
s = m.getUint16(f, !0), f += 2;
|
|
680
630
|
break;
|
|
681
631
|
case "int":
|
|
682
|
-
|
|
632
|
+
s = m.getInt32(f, !0), f += 4;
|
|
683
633
|
break;
|
|
684
634
|
case "uint":
|
|
685
|
-
|
|
635
|
+
s = m.getUint32(f, !0), f += 4;
|
|
686
636
|
break;
|
|
687
637
|
case "float":
|
|
688
|
-
|
|
638
|
+
s = m.getFloat32(f, !0), f += 4;
|
|
689
639
|
break;
|
|
690
640
|
case "double":
|
|
691
|
-
|
|
641
|
+
s = m.getFloat64(f, !0), f += 8;
|
|
692
642
|
break;
|
|
693
643
|
default:
|
|
694
|
-
throw new Error(`Unsupported property type: ${
|
|
644
|
+
throw new Error(`Unsupported property type: ${G}`);
|
|
695
645
|
}
|
|
696
|
-
|
|
646
|
+
x.push(s);
|
|
697
647
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
),
|
|
703
|
-
|
|
648
|
+
w.set(
|
|
649
|
+
x[B],
|
|
650
|
+
x[q],
|
|
651
|
+
x[W]
|
|
652
|
+
), M.set(
|
|
653
|
+
x[j[1]],
|
|
704
654
|
// PLY stores rot 1,2,3,0 (x,y,z,w)
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
).normalize(),
|
|
709
|
-
|
|
710
|
-
{
|
|
711
|
-
original: [
|
|
712
|
-
m[F[0]],
|
|
713
|
-
m[F[1]],
|
|
714
|
-
m[F[2]],
|
|
715
|
-
m[F[3]]
|
|
716
|
-
],
|
|
717
|
-
processed: [
|
|
718
|
-
P.x,
|
|
719
|
-
P.y,
|
|
720
|
-
P.z,
|
|
721
|
-
P.w
|
|
722
|
-
]
|
|
723
|
-
}
|
|
724
|
-
), V.set(
|
|
725
|
-
m[Y[0]],
|
|
655
|
+
x[j[2]],
|
|
656
|
+
x[j[3]],
|
|
657
|
+
x[j[0]]
|
|
658
|
+
).normalize(), M.w < 0 && (M.x = -M.x, M.y = -M.y, M.z = -M.z, M.w = -M.w), U.set(
|
|
659
|
+
x[H[0]],
|
|
726
660
|
// Read directly assuming it's log scale
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
),
|
|
730
|
-
0.5 +
|
|
731
|
-
0.5 +
|
|
732
|
-
0.5 +
|
|
733
|
-
),
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
P.z,
|
|
741
|
-
P.w
|
|
742
|
-
],
|
|
743
|
-
scale: [V.x, V.y, V.z],
|
|
744
|
-
color: [k.r, k.g, k.b],
|
|
745
|
-
opacity: S
|
|
746
|
-
}), p.setSplat(
|
|
747
|
-
f,
|
|
748
|
-
I,
|
|
749
|
-
P,
|
|
750
|
-
V,
|
|
661
|
+
x[H[1]],
|
|
662
|
+
x[H[2]]
|
|
663
|
+
), V.set(
|
|
664
|
+
0.5 + x[$[0]] * O,
|
|
665
|
+
0.5 + x[$[1]] * O,
|
|
666
|
+
0.5 + x[$[2]] * O
|
|
667
|
+
), V.r = Math.max(0, Math.min(1, V.r)), V.g = Math.max(0, Math.min(1, V.g)), V.b = Math.max(0, Math.min(1, V.b));
|
|
668
|
+
const E = C(x[F]);
|
|
669
|
+
p.setSplat(
|
|
670
|
+
y,
|
|
671
|
+
w,
|
|
672
|
+
M,
|
|
673
|
+
U,
|
|
751
674
|
// Pass log scale directly
|
|
752
|
-
|
|
753
|
-
|
|
675
|
+
V,
|
|
676
|
+
E
|
|
754
677
|
);
|
|
755
678
|
}
|
|
756
|
-
return
|
|
757
|
-
"[11/12] LOADER PlyLoader: finished parsing all splats, calculating bounding box"
|
|
758
|
-
), p.calculateBoundingBox(), r && console.debug(
|
|
759
|
-
"[12/12] LOADER PlyLoader: parsing complete, bounding box:",
|
|
760
|
-
{
|
|
761
|
-
min: [
|
|
762
|
-
p.boundingBox.min.x,
|
|
763
|
-
p.boundingBox.min.y,
|
|
764
|
-
p.boundingBox.min.z
|
|
765
|
-
],
|
|
766
|
-
max: [
|
|
767
|
-
p.boundingBox.max.x,
|
|
768
|
-
p.boundingBox.max.y,
|
|
769
|
-
p.boundingBox.max.z
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
), p;
|
|
679
|
+
return p.calculateBoundingBox(), p;
|
|
773
680
|
}
|
|
774
681
|
}
|
|
775
|
-
class
|
|
682
|
+
class Ee extends i.EventDispatcher {
|
|
776
683
|
constructor() {
|
|
777
684
|
super();
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
685
|
+
h(this, "worker");
|
|
686
|
+
h(this, "centers", null);
|
|
687
|
+
h(this, "orderTexture", null);
|
|
781
688
|
/** Bounding box data for optimization */
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
const
|
|
786
|
-
this.worker = new Worker(URL.createObjectURL(
|
|
689
|
+
h(this, "chunks", null);
|
|
690
|
+
h(this, "lastCameraPosition", new i.Vector3());
|
|
691
|
+
h(this, "lastCameraDirection", new i.Vector3());
|
|
692
|
+
const o = this.createWorkerCode(), t = new Blob([o], { type: "application/javascript" });
|
|
693
|
+
this.worker = new Worker(URL.createObjectURL(t)), this.worker.onmessage = this.onWorkerMessage.bind(this);
|
|
787
694
|
}
|
|
788
695
|
/**
|
|
789
696
|
* Handles messages received from the sorting worker.
|
|
790
697
|
* @param event The message event from the worker.
|
|
791
698
|
*/
|
|
792
|
-
onWorkerMessage(
|
|
699
|
+
onWorkerMessage(o) {
|
|
793
700
|
if (!this.orderTexture || !this.orderTexture.image)
|
|
794
701
|
return console.error("SplatSorter: Order texture not initialized!");
|
|
795
|
-
const { order:
|
|
702
|
+
const { order: t, count: r } = o.data, n = this.orderTexture.image.data;
|
|
796
703
|
if (!(n instanceof Uint32Array))
|
|
797
704
|
return console.error(
|
|
798
705
|
"SplatSorter: Order texture data is not a Uint32Array!"
|
|
799
706
|
);
|
|
800
|
-
n.set(new Uint32Array(
|
|
801
|
-
const a = n.buffer.slice(0),
|
|
802
|
-
this.worker.postMessage(
|
|
707
|
+
n.set(new Uint32Array(t)), this.orderTexture.needsUpdate = !0;
|
|
708
|
+
const a = n.buffer.slice(0), c = { order: a };
|
|
709
|
+
this.worker.postMessage(c, [a]), this.dispatchEvent({ type: "updated", count: r });
|
|
803
710
|
}
|
|
804
711
|
/**
|
|
805
712
|
* Initializes the sorter with necessary data and textures.
|
|
@@ -807,82 +714,87 @@ class Ce extends c.EventDispatcher {
|
|
|
807
714
|
* @param centers A Float32Array containing the center position (x, y, z) for each splat.
|
|
808
715
|
* @param chunks Optional: A Float32Array containing bounding box chunk data [minX, minY, minZ, maxX, maxY, maxZ, ...] for optimization.
|
|
809
716
|
*/
|
|
810
|
-
init(
|
|
811
|
-
if (!
|
|
717
|
+
init(o, t, r) {
|
|
718
|
+
if (!o || !(o.image.data instanceof Uint32Array))
|
|
812
719
|
throw new Error("SplatSorter: Invalid orderTexture provided. Must be DataTexture with Uint32Array data.");
|
|
813
|
-
if (!
|
|
720
|
+
if (!t || t.length % 3 !== 0)
|
|
814
721
|
throw new Error("SplatSorter: Invalid centers array provided. Length must be multiple of 3.");
|
|
815
|
-
if (
|
|
722
|
+
if (o.image.data.length < t.length / 3)
|
|
816
723
|
throw new Error("SplatSorter: orderTexture data buffer is smaller than the number of splats.");
|
|
817
|
-
const n =
|
|
818
|
-
this.orderTexture =
|
|
724
|
+
const n = t.length / 3;
|
|
725
|
+
this.orderTexture = o, this.centers = t.slice();
|
|
819
726
|
const a = this.orderTexture.image.data;
|
|
820
|
-
for (let
|
|
727
|
+
for (let b = 0; b < n; b++) a[b] = b;
|
|
821
728
|
this.orderTexture.needsUpdate = !0;
|
|
822
|
-
const
|
|
823
|
-
order:
|
|
824
|
-
centers:
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
|
|
729
|
+
const c = a.buffer.slice(0), v = this.centers.buffer.slice(0), g = {
|
|
730
|
+
order: c,
|
|
731
|
+
centers: v
|
|
732
|
+
}, S = [
|
|
733
|
+
c,
|
|
734
|
+
v
|
|
828
735
|
];
|
|
829
|
-
if (
|
|
830
|
-
this.chunks =
|
|
831
|
-
const
|
|
832
|
-
g.chunks =
|
|
736
|
+
if (r) {
|
|
737
|
+
this.chunks = r.slice();
|
|
738
|
+
const b = this.chunks.buffer.slice(0);
|
|
739
|
+
g.chunks = b, S.push(b);
|
|
833
740
|
}
|
|
834
|
-
this.worker.postMessage(g,
|
|
741
|
+
this.worker.postMessage(g, S), queueMicrotask(() => {
|
|
742
|
+
this.dispatchEvent({
|
|
743
|
+
type: "updated",
|
|
744
|
+
count: n
|
|
745
|
+
});
|
|
746
|
+
});
|
|
835
747
|
}
|
|
836
748
|
/**
|
|
837
749
|
* Applies an optional mapping to filter or reorder splats before sorting.
|
|
838
750
|
* The sorter will only consider splats whose original indices are present in the mapping.
|
|
839
751
|
* @param mapping A Uint32Array where each element is the *original* index of a splat to include, or null to reset mapping.
|
|
840
752
|
*/
|
|
841
|
-
setMapping(
|
|
753
|
+
setMapping(o) {
|
|
842
754
|
if (!this.centers)
|
|
843
755
|
return console.warn(
|
|
844
756
|
"SplatSorter: Cannot set mapping before initialization."
|
|
845
757
|
);
|
|
846
|
-
let
|
|
847
|
-
const
|
|
848
|
-
if (!
|
|
849
|
-
const
|
|
850
|
-
return
|
|
851
|
-
centers:
|
|
758
|
+
let t;
|
|
759
|
+
const r = [];
|
|
760
|
+
if (!o) {
|
|
761
|
+
const v = this.centers.buffer.slice(0);
|
|
762
|
+
return t = {
|
|
763
|
+
centers: v,
|
|
852
764
|
mapping: null
|
|
853
|
-
},
|
|
765
|
+
}, r.push(v), this.worker.postMessage(t, r);
|
|
854
766
|
}
|
|
855
|
-
const n = new Float32Array(
|
|
856
|
-
for (let
|
|
857
|
-
const g =
|
|
767
|
+
const n = new Float32Array(o.length * 3);
|
|
768
|
+
for (let v = 0; v < o.length; v++) {
|
|
769
|
+
const g = o[v];
|
|
858
770
|
if (g * 3 + 2 >= this.centers.length) {
|
|
859
771
|
console.warn(
|
|
860
772
|
`SplatSorter: Mapping index ${g} out of bounds.`
|
|
861
773
|
);
|
|
862
774
|
continue;
|
|
863
775
|
}
|
|
864
|
-
const
|
|
865
|
-
n[
|
|
776
|
+
const S = g * 3, b = v * 3;
|
|
777
|
+
n[b + 0] = this.centers[S + 0], n[b + 1] = this.centers[S + 1], n[b + 2] = this.centers[S + 2];
|
|
866
778
|
}
|
|
867
|
-
const a = n.buffer.slice(0),
|
|
868
|
-
|
|
779
|
+
const a = n.buffer.slice(0), c = o.buffer.slice(0);
|
|
780
|
+
t = {
|
|
869
781
|
centers: a,
|
|
870
|
-
mapping:
|
|
871
|
-
},
|
|
782
|
+
mapping: c
|
|
783
|
+
}, r.push(a, c), this.worker.postMessage(t, r);
|
|
872
784
|
}
|
|
873
785
|
/**
|
|
874
786
|
* Updates the camera parameters used for sorting.
|
|
875
787
|
* @param position The camera's position in the sorter's local coordinate space.
|
|
876
788
|
* @param direction The camera's forward direction in the sorter's local coordinate space.
|
|
877
789
|
*/
|
|
878
|
-
setCamera(
|
|
879
|
-
const
|
|
880
|
-
if (!
|
|
790
|
+
setCamera(o, t) {
|
|
791
|
+
const r = this.lastCameraPosition.distanceToSquared(o) > 1e-7, n = this.lastCameraDirection.dot(t) < 0.9999;
|
|
792
|
+
if (!r && !n)
|
|
881
793
|
return;
|
|
882
|
-
this.lastCameraPosition.copy(
|
|
794
|
+
this.lastCameraPosition.copy(o), this.lastCameraDirection.copy(t);
|
|
883
795
|
const a = {
|
|
884
|
-
cameraPosition: { x:
|
|
885
|
-
cameraDirection: { x:
|
|
796
|
+
cameraPosition: { x: o.x, y: o.y, z: o.z },
|
|
797
|
+
cameraDirection: { x: t.x, y: t.y, z: t.z }
|
|
886
798
|
};
|
|
887
799
|
this.worker.postMessage(a);
|
|
888
800
|
}
|
|
@@ -898,165 +810,165 @@ class Ce extends c.EventDispatcher {
|
|
|
898
810
|
*/
|
|
899
811
|
createWorkerCode() {
|
|
900
812
|
return `(${(function() {
|
|
901
|
-
let
|
|
902
|
-
const
|
|
903
|
-
let
|
|
904
|
-
const
|
|
905
|
-
for (;
|
|
906
|
-
const C =
|
|
907
|
-
if (
|
|
908
|
-
else if (
|
|
813
|
+
let t = null, r = null, n = null, a = null, c = null, v = null, g = !1;
|
|
814
|
+
const S = { x: 0, y: 0, z: 0 }, b = { x: 0, y: 0, z: 0 }, p = { x: 0, y: 0, z: 0 }, m = { x: 0, y: 0, z: 0 };
|
|
815
|
+
let f = null, _ = null;
|
|
816
|
+
const B = 32, q = new Array(B).fill(0), W = new Array(B).fill(0), j = new Array(B).fill(0), H = (F, k, O) => {
|
|
817
|
+
for (; F <= k; ) {
|
|
818
|
+
const C = k + F >> 1, w = O(C);
|
|
819
|
+
if (w > 0) F = C + 1;
|
|
820
|
+
else if (w < 0) k = C - 1;
|
|
909
821
|
else return C;
|
|
910
822
|
}
|
|
911
|
-
return ~
|
|
912
|
-
},
|
|
913
|
-
if (!
|
|
823
|
+
return ~F;
|
|
824
|
+
}, $ = () => {
|
|
825
|
+
if (!t || !r || !c || !v)
|
|
914
826
|
return;
|
|
915
|
-
if (
|
|
916
|
-
const
|
|
917
|
-
order:
|
|
827
|
+
if (r.length === 0) {
|
|
828
|
+
const u = {
|
|
829
|
+
order: t.buffer,
|
|
918
830
|
count: 0
|
|
919
831
|
};
|
|
920
|
-
self.postMessage(
|
|
832
|
+
self.postMessage(u, [t.buffer]), t = null;
|
|
921
833
|
return;
|
|
922
834
|
}
|
|
923
|
-
const
|
|
924
|
-
if (!g && !V && !
|
|
835
|
+
const F = c.x, k = c.y, O = c.z, C = v.x, w = v.y, M = v.z, U = 1e-4, V = Math.abs(F - S.x) > U || Math.abs(k - S.y) > U || Math.abs(O - S.z) > U, y = Math.abs(C - b.x) > U || Math.abs(w - b.y) > U || Math.abs(M - b.z) > U;
|
|
836
|
+
if (!g && !V && !y)
|
|
925
837
|
return;
|
|
926
|
-
g = !1,
|
|
927
|
-
let
|
|
928
|
-
for (let
|
|
929
|
-
const
|
|
930
|
-
|
|
838
|
+
g = !1, S.x = F, S.y = k, S.z = O, b.x = C, b.y = w, b.z = M;
|
|
839
|
+
let x = 1 / 0, E = -1 / 0;
|
|
840
|
+
for (let u = 0; u < 8; ++u) {
|
|
841
|
+
const P = u & 1 ? p.x : m.x, D = u & 2 ? p.y : m.y, l = u & 4 ? p.z : m.z, I = P * C + D * w + l * M;
|
|
842
|
+
x = Math.min(x, I), E = Math.max(E, I);
|
|
931
843
|
}
|
|
932
|
-
const
|
|
844
|
+
const R = r.length / 3, N = E - x, s = (1 << Math.max(
|
|
933
845
|
10,
|
|
934
|
-
Math.min(20, Math.ceil(Math.log2(
|
|
846
|
+
Math.min(20, Math.ceil(Math.log2(R / 4)))
|
|
935
847
|
)) + 1;
|
|
936
|
-
if ((!
|
|
937
|
-
for (let
|
|
938
|
-
|
|
848
|
+
if ((!f || f.length !== R) && (f = new Uint32Array(R)), !_ || _.length !== s ? _ = new Uint32Array(s) : _.fill(0), N < 1e-7) {
|
|
849
|
+
for (let u = 0; u < R; ++u) f[u] = 0;
|
|
850
|
+
_[0] = R;
|
|
939
851
|
} else if (n && n.length > 0) {
|
|
940
|
-
const
|
|
852
|
+
const u = n.length / 6;
|
|
941
853
|
q.fill(0);
|
|
942
|
-
for (let
|
|
943
|
-
const
|
|
854
|
+
for (let l = 0; l < u; ++l) {
|
|
855
|
+
const I = l * 6, Y = n[I + 0], X = n[I + 1], ne = n[I + 2], Z = n[I + 3], J = Y * C + X * w + ne * M - x, oe = J - Z, ee = J + Z, ie = Math.max(
|
|
944
856
|
0,
|
|
945
|
-
Math.floor(
|
|
857
|
+
Math.floor(oe * B / N)
|
|
946
858
|
), ce = Math.min(
|
|
947
|
-
|
|
948
|
-
Math.ceil(
|
|
859
|
+
B,
|
|
860
|
+
Math.ceil(ee * B / N)
|
|
949
861
|
);
|
|
950
862
|
for (let Q = ie; Q < ce; ++Q)
|
|
951
863
|
q[Q]++;
|
|
952
864
|
}
|
|
953
|
-
let
|
|
954
|
-
for (let
|
|
955
|
-
|
|
956
|
-
for (let
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
const
|
|
960
|
-
for (let
|
|
961
|
-
const
|
|
865
|
+
let P = 0;
|
|
866
|
+
for (let l = 0; l < B; ++l) P += q[l];
|
|
867
|
+
j[0] = 0, W[0] = 0;
|
|
868
|
+
for (let l = 1; l < B; ++l)
|
|
869
|
+
j[l - 1] = q[l - 1] / P * s >>> 0, W[l] = W[l - 1] + j[l - 1];
|
|
870
|
+
j[B - 1] = q[B - 1] / P * s >>> 0;
|
|
871
|
+
const D = N / B;
|
|
872
|
+
for (let l = 0; l < R; ++l) {
|
|
873
|
+
const I = l * 3, Y = r[I + 0], X = r[I + 1], ne = r[I + 2], Z = Y * C + X * w + ne * M, oe = (E - Z) / D, ee = Math.max(
|
|
962
874
|
0,
|
|
963
875
|
Math.min(
|
|
964
|
-
|
|
965
|
-
Math.floor(
|
|
876
|
+
B - 1,
|
|
877
|
+
Math.floor(oe)
|
|
966
878
|
)
|
|
967
|
-
), ie =
|
|
968
|
-
|
|
879
|
+
), ie = oe - ee, ce = W[ee] + j[ee] * ie >>> 0, Q = Math.min(ce, s - 1);
|
|
880
|
+
f[l] = Q, _[Q]++;
|
|
969
881
|
}
|
|
970
882
|
} else {
|
|
971
|
-
const
|
|
972
|
-
for (let
|
|
973
|
-
const
|
|
974
|
-
|
|
883
|
+
const u = (s - 1) / N;
|
|
884
|
+
for (let P = 0; P < R; ++P) {
|
|
885
|
+
const D = P * 3, l = r[D + 0], I = r[D + 1], Y = r[D + 2], X = l * C + I * w + Y * M, Z = (E - X) * u >>> 0, J = Math.min(Z, s - 1);
|
|
886
|
+
f[P] = J, _[J]++;
|
|
975
887
|
}
|
|
976
888
|
}
|
|
977
|
-
for (let
|
|
978
|
-
|
|
979
|
-
for (let
|
|
980
|
-
const
|
|
981
|
-
|
|
889
|
+
for (let u = 1; u < s; u++)
|
|
890
|
+
_[u] += _[u - 1];
|
|
891
|
+
for (let u = R - 1; u >= 0; u--) {
|
|
892
|
+
const P = f[u], D = --_[P];
|
|
893
|
+
t[D] = a ? a[u] : u;
|
|
982
894
|
}
|
|
983
|
-
const
|
|
984
|
-
if (!
|
|
985
|
-
const
|
|
986
|
-
if (!
|
|
895
|
+
const d = F * C + k * w + O * M, A = (u) => {
|
|
896
|
+
if (!t) return -1 / 0;
|
|
897
|
+
const P = t[u], D = P;
|
|
898
|
+
if (!r || D * 3 + 2 >= r.length)
|
|
987
899
|
return -1 / 0;
|
|
988
|
-
const
|
|
989
|
-
return
|
|
900
|
+
const l = D * 3;
|
|
901
|
+
return r[l] * C + r[l + 1] * w + r[l + 2] * M - d;
|
|
990
902
|
};
|
|
991
|
-
let
|
|
992
|
-
if (
|
|
993
|
-
const
|
|
903
|
+
let z = R;
|
|
904
|
+
if (R > 0 && A(R - 1) < 0) {
|
|
905
|
+
const u = H(
|
|
994
906
|
0,
|
|
995
|
-
|
|
996
|
-
|
|
907
|
+
R - 1,
|
|
908
|
+
A
|
|
997
909
|
);
|
|
998
|
-
|
|
910
|
+
z = u < 0 ? ~u : u;
|
|
999
911
|
}
|
|
1000
|
-
const
|
|
1001
|
-
order:
|
|
1002
|
-
count:
|
|
912
|
+
const L = {
|
|
913
|
+
order: t.buffer,
|
|
914
|
+
count: z
|
|
1003
915
|
};
|
|
1004
|
-
self.postMessage(
|
|
916
|
+
self.postMessage(L, [t.buffer]), t = null;
|
|
1005
917
|
};
|
|
1006
|
-
self.onmessage = (
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
let
|
|
1010
|
-
if (
|
|
1011
|
-
if (n = new Float32Array(
|
|
918
|
+
self.onmessage = (F) => {
|
|
919
|
+
const k = F.data;
|
|
920
|
+
k.order && (t = new Uint32Array(k.order));
|
|
921
|
+
let O = !1;
|
|
922
|
+
if (k.centers && (r = new Float32Array(k.centers), O = !0, g = !0), Object.prototype.hasOwnProperty.call(k, "mapping") && (a = k.mapping ? new Uint32Array(k.mapping) : null, g = !0), k.chunks) {
|
|
923
|
+
if (n = new Float32Array(k.chunks), n.length > 0 && n[3] > 0)
|
|
1012
924
|
for (let C = 0; C < n.length / 6; ++C) {
|
|
1013
|
-
const
|
|
1014
|
-
n[
|
|
1015
|
-
(
|
|
925
|
+
const w = C * 6, M = n[w + 0], U = n[w + 1], V = n[w + 2], y = n[w + 3], x = n[w + 4], E = n[w + 5];
|
|
926
|
+
n[w + 0] = (M + y) * 0.5, n[w + 1] = (U + x) * 0.5, n[w + 2] = (V + E) * 0.5, n[w + 3] = Math.sqrt(
|
|
927
|
+
(y - M) ** 2 + (x - U) ** 2 + (E - V) ** 2
|
|
1016
928
|
) * 0.5;
|
|
1017
929
|
}
|
|
1018
930
|
g = !0;
|
|
1019
931
|
}
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1022
|
-
for (let C = 1; C <
|
|
1023
|
-
const
|
|
1024
|
-
|
|
932
|
+
if (O && r && r.length > 0) {
|
|
933
|
+
p.x = m.x = r[0], p.y = m.y = r[1], p.z = m.z = r[2];
|
|
934
|
+
for (let C = 1; C < r.length / 3; C++) {
|
|
935
|
+
const w = C * 3;
|
|
936
|
+
p.x = Math.min(p.x, r[w + 0]), m.x = Math.max(m.x, r[w + 0]), p.y = Math.min(p.y, r[w + 1]), m.y = Math.max(m.y, r[w + 1]), p.z = Math.min(p.z, r[w + 2]), m.z = Math.max(m.z, r[w + 2]);
|
|
1025
937
|
}
|
|
1026
|
-
} else
|
|
1027
|
-
|
|
938
|
+
} else O && r && r.length === 0 && (p.x = m.x = p.y = m.y = p.z = m.z = 0);
|
|
939
|
+
k.cameraPosition && (c = k.cameraPosition), k.cameraDirection && (v = k.cameraDirection), $();
|
|
1028
940
|
};
|
|
1029
941
|
}).toString()})();`;
|
|
1030
942
|
}
|
|
1031
943
|
}
|
|
1032
|
-
const
|
|
1033
|
-
const
|
|
1034
|
-
return
|
|
944
|
+
const ke = (T, e) => {
|
|
945
|
+
const o = de(T), t = de(e);
|
|
946
|
+
return o | t << 16;
|
|
1035
947
|
};
|
|
1036
|
-
function
|
|
1037
|
-
const e = new Float32Array([
|
|
1038
|
-
let
|
|
1039
|
-
const a =
|
|
1040
|
-
return a < 103 ?
|
|
948
|
+
function de(T) {
|
|
949
|
+
const e = new Float32Array([T]), t = new Int32Array(e.buffer)[0];
|
|
950
|
+
let r = t >> 16 & 32768, n = t >> 12 & 2047;
|
|
951
|
+
const a = t >> 23 & 255;
|
|
952
|
+
return a < 103 ? r : a > 142 ? (r |= 31744, r |= (a === 255 ? 0 : 1) && t & 8388607, r) : a < 113 ? (n |= 2048, r |= (n >> 114 - a) + (n >> 113 - a & 1), r) : (r |= a - 112 << 10 | n >> 1, r += n & 1, r);
|
|
1041
953
|
}
|
|
1042
|
-
const
|
|
1043
|
-
class
|
|
954
|
+
const Ie = new ArrayBuffer(4), pe = new DataView(Ie), Re = (T) => (pe.setUint32(0, T, !0), pe.getFloat32(0, !0));
|
|
955
|
+
class ze {
|
|
1044
956
|
/**
|
|
1045
957
|
* Create a new TextureManager for a set of splats
|
|
1046
958
|
* @param splatData The splat data to manage textures for
|
|
1047
959
|
*/
|
|
1048
960
|
constructor(e) {
|
|
1049
|
-
|
|
961
|
+
h(this, "transformA");
|
|
1050
962
|
// position xyz and rotation quaternion y,z components
|
|
1051
|
-
|
|
963
|
+
h(this, "transformB");
|
|
1052
964
|
// rotation quaternion x and scale xyz
|
|
1053
|
-
|
|
965
|
+
h(this, "colorTexture");
|
|
1054
966
|
// color an opacity
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
const
|
|
1059
|
-
this.textureWidth = Math.ceil(Math.sqrt(
|
|
967
|
+
h(this, "orderTexture");
|
|
968
|
+
h(this, "textureWidth");
|
|
969
|
+
h(this, "textureHeight");
|
|
970
|
+
const o = e.numSplats;
|
|
971
|
+
this.textureWidth = Math.ceil(Math.sqrt(o)), this.textureHeight = Math.ceil(o / this.textureWidth), this.transformA = this.createTransformATexture(e), this.transformB = this.createTransformBTexture(e), this.colorTexture = this.createColorTexture(e), this.orderTexture = this.createOrderTexture(o);
|
|
1060
972
|
}
|
|
1061
973
|
/**
|
|
1062
974
|
* Create the transform A texture (positions and quaternion w component)
|
|
@@ -1064,24 +976,24 @@ class ke {
|
|
|
1064
976
|
* @returns DataTexture containing position data
|
|
1065
977
|
*/
|
|
1066
978
|
createTransformATexture(e) {
|
|
1067
|
-
const
|
|
979
|
+
const o = e.numSplats, t = new Float32Array(
|
|
1068
980
|
this.textureWidth * this.textureHeight * 4
|
|
1069
981
|
);
|
|
1070
|
-
for (let n = 0; n <
|
|
1071
|
-
const a = n * 4,
|
|
1072
|
-
|
|
1073
|
-
const g = e.rotations[
|
|
1074
|
-
|
|
982
|
+
for (let n = 0; n < o; n++) {
|
|
983
|
+
const a = n * 4, c = n * 3, v = n * 4;
|
|
984
|
+
t[a] = e.positions[c], t[a + 1] = e.positions[c + 1], t[a + 2] = e.positions[c + 2];
|
|
985
|
+
const g = e.rotations[v + 0], S = e.rotations[v + 1], b = ke(g, S);
|
|
986
|
+
t[a + 3] = Re(b);
|
|
1075
987
|
}
|
|
1076
|
-
const
|
|
1077
|
-
|
|
988
|
+
const r = new i.DataTexture(
|
|
989
|
+
t,
|
|
1078
990
|
this.textureWidth,
|
|
1079
991
|
this.textureHeight,
|
|
1080
|
-
|
|
1081
|
-
|
|
992
|
+
i.RGBAFormat,
|
|
993
|
+
i.FloatType
|
|
1082
994
|
// Store as Float32, shader will reinterpret bits
|
|
1083
995
|
);
|
|
1084
|
-
return
|
|
996
|
+
return r.needsUpdate = !0, r.magFilter = i.NearestFilter, r.minFilter = i.NearestFilter, r;
|
|
1085
997
|
}
|
|
1086
998
|
/**
|
|
1087
999
|
* Create the transform B texture (scale and rotation xyz)
|
|
@@ -1089,21 +1001,21 @@ class ke {
|
|
|
1089
1001
|
* @returns DataTexture containing scale and rotation data
|
|
1090
1002
|
*/
|
|
1091
1003
|
createTransformBTexture(e) {
|
|
1092
|
-
const
|
|
1004
|
+
const o = e.numSplats, t = new Float32Array(
|
|
1093
1005
|
this.textureWidth * this.textureHeight * 4
|
|
1094
1006
|
);
|
|
1095
|
-
for (let n = 0; n <
|
|
1096
|
-
const a = n * 4,
|
|
1097
|
-
|
|
1007
|
+
for (let n = 0; n < o; n++) {
|
|
1008
|
+
const a = n * 4, c = n * 3, v = n * 4;
|
|
1009
|
+
t[a] = e.scales[c], t[a + 1] = e.scales[c + 1], t[a + 2] = e.scales[c + 2], t[a + 3] = e.rotations[v + 2];
|
|
1098
1010
|
}
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1011
|
+
const r = new i.DataTexture(
|
|
1012
|
+
t,
|
|
1101
1013
|
this.textureWidth,
|
|
1102
1014
|
this.textureHeight,
|
|
1103
|
-
|
|
1104
|
-
|
|
1015
|
+
i.RGBAFormat,
|
|
1016
|
+
i.FloatType
|
|
1105
1017
|
);
|
|
1106
|
-
return
|
|
1018
|
+
return r.needsUpdate = !0, r.magFilter = i.NearestFilter, r.minFilter = i.NearestFilter, r;
|
|
1107
1019
|
}
|
|
1108
1020
|
/**
|
|
1109
1021
|
* Create the color texture (RGB and opacity)
|
|
@@ -1111,21 +1023,21 @@ class ke {
|
|
|
1111
1023
|
* @returns DataTexture containing color data
|
|
1112
1024
|
*/
|
|
1113
1025
|
createColorTexture(e) {
|
|
1114
|
-
const
|
|
1026
|
+
const o = e.numSplats, t = new Float32Array(
|
|
1115
1027
|
this.textureWidth * this.textureHeight * 4
|
|
1116
1028
|
);
|
|
1117
|
-
for (let n = 0; n <
|
|
1118
|
-
const a = n * 4,
|
|
1119
|
-
|
|
1029
|
+
for (let n = 0; n < o; n++) {
|
|
1030
|
+
const a = n * 4, c = n * 3;
|
|
1031
|
+
t[a] = e.colors[c], t[a + 1] = e.colors[c + 1], t[a + 2] = e.colors[c + 2], t[a + 3] = e.opacities[n];
|
|
1120
1032
|
}
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1033
|
+
const r = new i.DataTexture(
|
|
1034
|
+
t,
|
|
1123
1035
|
this.textureWidth,
|
|
1124
1036
|
this.textureHeight,
|
|
1125
|
-
|
|
1126
|
-
|
|
1037
|
+
i.RGBAFormat,
|
|
1038
|
+
i.FloatType
|
|
1127
1039
|
);
|
|
1128
|
-
return
|
|
1040
|
+
return r.needsUpdate = !0, r;
|
|
1129
1041
|
}
|
|
1130
1042
|
/**
|
|
1131
1043
|
* Create the order texture for sorting
|
|
@@ -1133,23 +1045,23 @@ class ke {
|
|
|
1133
1045
|
* @returns DataTexture for storing order indices
|
|
1134
1046
|
*/
|
|
1135
1047
|
createOrderTexture(e) {
|
|
1136
|
-
const
|
|
1137
|
-
for (let
|
|
1138
|
-
r
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1048
|
+
const o = new Uint32Array(this.textureWidth * this.textureHeight);
|
|
1049
|
+
for (let r = 0; r < e; r++)
|
|
1050
|
+
o[r] = r;
|
|
1051
|
+
const t = new i.DataTexture(
|
|
1052
|
+
o,
|
|
1141
1053
|
this.textureWidth,
|
|
1142
1054
|
this.textureHeight,
|
|
1143
|
-
|
|
1144
|
-
|
|
1055
|
+
i.RedIntegerFormat,
|
|
1056
|
+
i.UnsignedIntType
|
|
1145
1057
|
);
|
|
1146
|
-
return
|
|
1058
|
+
return t.needsUpdate = !0, t;
|
|
1147
1059
|
}
|
|
1148
1060
|
dispose() {
|
|
1149
1061
|
this.transformA.dispose(), this.transformB.dispose(), this.colorTexture.dispose(), this.orderTexture.dispose();
|
|
1150
1062
|
}
|
|
1151
1063
|
}
|
|
1152
|
-
const
|
|
1064
|
+
const Pe = (
|
|
1153
1065
|
/* glsl */
|
|
1154
1066
|
`
|
|
1155
1067
|
precision highp float;
|
|
@@ -1407,7 +1319,7 @@ void main(void) {
|
|
|
1407
1319
|
vUv = clippedCornerOffset;
|
|
1408
1320
|
}
|
|
1409
1321
|
`
|
|
1410
|
-
),
|
|
1322
|
+
), Be = (
|
|
1411
1323
|
/* glsl */
|
|
1412
1324
|
`
|
|
1413
1325
|
precision highp float;
|
|
@@ -1441,56 +1353,56 @@ void main(void) {
|
|
|
1441
1353
|
}
|
|
1442
1354
|
`
|
|
1443
1355
|
);
|
|
1444
|
-
class Oe extends
|
|
1356
|
+
class Oe extends i.ShaderMaterial {
|
|
1445
1357
|
constructor(e = {}) {
|
|
1446
|
-
const
|
|
1358
|
+
const o = {
|
|
1447
1359
|
// Textures (values set via methods)
|
|
1448
1360
|
transformA: { value: null },
|
|
1449
1361
|
transformB: { value: null },
|
|
1450
1362
|
splatColor: { value: null },
|
|
1451
1363
|
splatOrder: { value: null },
|
|
1452
1364
|
// Other uniforms
|
|
1453
|
-
viewport: { value: new
|
|
1365
|
+
viewport: { value: new i.Vector2(1, 1) },
|
|
1454
1366
|
// Will be updated
|
|
1455
1367
|
numSplats: { value: 0 }
|
|
1456
1368
|
// Max splats to render (updated by sorter)
|
|
1457
1369
|
};
|
|
1458
1370
|
super({
|
|
1459
|
-
vertexShader:
|
|
1460
|
-
fragmentShader:
|
|
1461
|
-
uniforms:
|
|
1371
|
+
vertexShader: Pe,
|
|
1372
|
+
fragmentShader: Be,
|
|
1373
|
+
uniforms: o,
|
|
1462
1374
|
transparent: !0,
|
|
1463
|
-
blending:
|
|
1375
|
+
blending: i.CustomBlending,
|
|
1464
1376
|
// Premultiplied alpha blending:
|
|
1465
1377
|
// color = src_color * src_alpha + dst_color * (1 - src_alpha)
|
|
1466
1378
|
// alpha = src_alpha * 1 + dst_alpha * (1 - src_alpha)
|
|
1467
|
-
blendSrc:
|
|
1379
|
+
blendSrc: i.OneFactor,
|
|
1468
1380
|
// Using ONE because shader outputs premultiplied color (color * alpha)
|
|
1469
|
-
blendDst:
|
|
1470
|
-
blendSrcAlpha:
|
|
1381
|
+
blendDst: i.OneMinusSrcAlphaFactor,
|
|
1382
|
+
blendSrcAlpha: i.OneFactor,
|
|
1471
1383
|
// source alpha comes from shader
|
|
1472
|
-
blendDstAlpha:
|
|
1473
|
-
blendEquation:
|
|
1474
|
-
blendEquationAlpha:
|
|
1384
|
+
blendDstAlpha: i.OneMinusSrcAlphaFactor,
|
|
1385
|
+
blendEquation: i.AddEquation,
|
|
1386
|
+
blendEquationAlpha: i.AddEquation,
|
|
1475
1387
|
depthTest: !0,
|
|
1476
1388
|
depthWrite: !1,
|
|
1477
1389
|
// Disable depth write for transparency
|
|
1478
|
-
side:
|
|
1390
|
+
side: i.DoubleSide,
|
|
1479
1391
|
// Render both sides (or CULLFACE_NONE equivalent)
|
|
1480
1392
|
// Optional settings from constructor
|
|
1481
1393
|
alphaTest: e.alphaTest !== void 0 ? e.alphaTest : 0,
|
|
1482
1394
|
// Typically 0 for blending
|
|
1483
1395
|
toneMapped: e.toneMapped !== void 0 ? e.toneMapped : !1
|
|
1484
1396
|
// prettier-ignore
|
|
1485
|
-
}), e.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending =
|
|
1397
|
+
}), e.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending = i.NoBlending);
|
|
1486
1398
|
}
|
|
1487
1399
|
/**
|
|
1488
1400
|
* Update the viewport size
|
|
1489
1401
|
* @param width Viewport width
|
|
1490
1402
|
* @param height Viewport height
|
|
1491
1403
|
*/
|
|
1492
|
-
updateViewport(e,
|
|
1493
|
-
this.uniforms.viewport.value.set(e,
|
|
1404
|
+
updateViewport(e, o) {
|
|
1405
|
+
this.uniforms.viewport.value.set(e, o);
|
|
1494
1406
|
}
|
|
1495
1407
|
/**
|
|
1496
1408
|
* Set transform texture A (positions)
|
|
@@ -1528,59 +1440,47 @@ class Oe extends c.ShaderMaterial {
|
|
|
1528
1440
|
this.uniforms.numSplats.value = e;
|
|
1529
1441
|
}
|
|
1530
1442
|
}
|
|
1531
|
-
const
|
|
1443
|
+
const K = class K extends i.Mesh {
|
|
1532
1444
|
// Match shader constant
|
|
1533
1445
|
/**
|
|
1534
1446
|
* Create a new SplatMesh for rendering Gaussian splats
|
|
1535
1447
|
* @param splatData The splat data to render
|
|
1536
1448
|
* @param options Rendering options
|
|
1537
1449
|
*/
|
|
1538
|
-
constructor(
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
);
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1450
|
+
constructor(o, t = {}) {
|
|
1451
|
+
const r = new Oe(t), n = K.createInstancedGeometry(o.numSplats, K.INSTANCE_SIZE);
|
|
1452
|
+
super(n, r);
|
|
1453
|
+
h(this, "sorter");
|
|
1454
|
+
h(this, "splatData");
|
|
1455
|
+
h(this, "options");
|
|
1456
|
+
h(this, "textureManager");
|
|
1457
|
+
h(this, "material");
|
|
1458
|
+
h(this, "geometry");
|
|
1459
|
+
h(this, "lastCameraPositionLocal", new i.Vector3());
|
|
1460
|
+
h(this, "lastCameraDirectionLocal", new i.Vector3());
|
|
1461
|
+
h(this, "invModelMatrix", new i.Matrix4());
|
|
1462
|
+
// Cached inverse matrix
|
|
1463
|
+
h(this, "_vpW", -1);
|
|
1464
|
+
h(this, "_vpH", -1);
|
|
1465
|
+
h(this, "_size", new i.Vector2());
|
|
1466
|
+
h(this, "_camPosW", new i.Vector3());
|
|
1467
|
+
h(this, "_camDirW", new i.Vector3());
|
|
1468
|
+
h(this, "_camPosL", new i.Vector3());
|
|
1469
|
+
h(this, "_camDirL", new i.Vector3());
|
|
1470
|
+
h(this, "onSorterUpdated", (o) => {
|
|
1471
|
+
const t = o.count;
|
|
1472
|
+
this.geometry.instanceCount = Math.ceil(t / K.INSTANCE_SIZE), this.material.setNumSplats(t);
|
|
1473
|
+
});
|
|
1474
|
+
this.geometry = n, this.material = r, this.splatData = o, this.frustumCulled = !1, this.options = {
|
|
1475
|
+
autoSort: !0,
|
|
1476
|
+
...t
|
|
1477
|
+
}, this.textureManager = new ze(o), this.sorter = new Ee();
|
|
1478
|
+
let a = this.createChunks() || void 0;
|
|
1479
|
+
a === null && console.warn("Visus: Could not create sorter chunks, bounding box might be invalid."), a = void 0, this.sorter.addEventListener("updated", this.onSorterUpdated), this.sorter.init(
|
|
1567
1480
|
this.textureManager.orderTexture,
|
|
1568
1481
|
this.splatData.centers,
|
|
1569
|
-
|
|
1570
|
-
), this.
|
|
1571
|
-
"updated",
|
|
1572
|
-
(l) => {
|
|
1573
|
-
const g = l.count;
|
|
1574
|
-
t && console.debug(
|
|
1575
|
-
"[6/8] MESH SplatMesh: sorter updated, rendering",
|
|
1576
|
-
g,
|
|
1577
|
-
"splats"
|
|
1578
|
-
), this.geometry.instanceCount = Math.ceil(g / X.INSTANCE_SIZE), this.material.setNumSplats(g);
|
|
1579
|
-
}
|
|
1580
|
-
), t && console.debug("[7/8] MESH SplatMesh: setting up material textures"), this.material.setTransformA(this.textureManager.transformA), this.material.setTransformB(this.textureManager.transformB), this.material.setColorTexture(this.textureManager.colorTexture), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setNumSplats(0), this.geometry.boundingBox = r.boundingBox.toBox3(), this.geometry.boundingSphere = new c.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), t && console.debug(
|
|
1581
|
-
"[8/8] MESH SplatMesh: mesh initialization complete, bounding box:",
|
|
1582
|
-
r.boundingBox
|
|
1583
|
-
);
|
|
1482
|
+
a ?? void 0
|
|
1483
|
+
), this.material.setTransformA(this.textureManager.transformA), this.material.setTransformB(this.textureManager.transformB), this.material.setColorTexture(this.textureManager.colorTexture), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setNumSplats(0), this.geometry.boundingBox = o.boundingBox.toBox3(), this.geometry.boundingSphere = new i.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere);
|
|
1584
1484
|
}
|
|
1585
1485
|
/**
|
|
1586
1486
|
* Creates the instanced geometry for rendering splats.
|
|
@@ -1588,16 +1488,8 @@ const X = class X extends c.Mesh {
|
|
|
1588
1488
|
* @param instanceSize Number of splats per instance.
|
|
1589
1489
|
* @returns InstancedBufferGeometry
|
|
1590
1490
|
*/
|
|
1591
|
-
static createInstancedGeometry(
|
|
1592
|
-
const
|
|
1593
|
-
t && console.debug(
|
|
1594
|
-
"MESH createInstancedGeometry: creating geometry for",
|
|
1595
|
-
r,
|
|
1596
|
-
"splats,",
|
|
1597
|
-
n,
|
|
1598
|
-
"instances"
|
|
1599
|
-
);
|
|
1600
|
-
const a = new c.BufferGeometry(), i = new Float32Array([
|
|
1491
|
+
static createInstancedGeometry(o, t) {
|
|
1492
|
+
const r = Math.ceil(o / t), n = new i.BufferGeometry(), a = new Float32Array([
|
|
1601
1493
|
// x, y, splat_index_in_instance
|
|
1602
1494
|
-1,
|
|
1603
1495
|
-1,
|
|
@@ -1611,40 +1503,32 @@ const X = class X extends c.Mesh {
|
|
|
1611
1503
|
-1,
|
|
1612
1504
|
1,
|
|
1613
1505
|
0
|
|
1614
|
-
]),
|
|
1615
|
-
for (let p = 0; p <
|
|
1616
|
-
const
|
|
1617
|
-
for (let
|
|
1618
|
-
|
|
1506
|
+
]), c = new Uint16Array([0, 1, 2, 0, 2, 3]), v = new Float32Array(4 * 3 * t);
|
|
1507
|
+
for (let p = 0; p < t; p++) {
|
|
1508
|
+
const m = p * 4 * 3;
|
|
1509
|
+
for (let f = 0; f < 4; f++)
|
|
1510
|
+
v[m + f * 3 + 0] = a[f * 3 + 0], v[m + f * 3 + 1] = a[f * 3 + 1], v[m + f * 3 + 2] = p;
|
|
1619
1511
|
}
|
|
1620
|
-
const
|
|
1621
|
-
for (let p = 0; p <
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1512
|
+
const g = new Uint32Array(6 * t);
|
|
1513
|
+
for (let p = 0; p < t; p++) {
|
|
1514
|
+
const m = p * 6, f = p * 4;
|
|
1515
|
+
g[m + 0] = c[0] + f, g[m + 1] = c[1] + f, g[m + 2] = c[2] + f, g[m + 3] = c[3] + f, g[m + 4] = c[4] + f, g[m + 5] = c[5] + f;
|
|
1624
1516
|
}
|
|
1625
|
-
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
const b = new Uint32Array(
|
|
1629
|
-
for (let p = 0; p <
|
|
1630
|
-
b[p] = p *
|
|
1631
|
-
return
|
|
1632
|
-
"MESH createInstancedGeometry: geometry created with",
|
|
1633
|
-
v.attributes.position.count,
|
|
1634
|
-
"vertices"
|
|
1635
|
-
), v;
|
|
1517
|
+
n.setAttribute("position", new i.BufferAttribute(v, 3)), n.setIndex(new i.BufferAttribute(g, 1));
|
|
1518
|
+
const S = new i.InstancedBufferGeometry();
|
|
1519
|
+
S.index = n.index, S.setAttribute("position", n.getAttribute("position"));
|
|
1520
|
+
const b = new Uint32Array(r);
|
|
1521
|
+
for (let p = 0; p < r; p++)
|
|
1522
|
+
b[p] = p * t;
|
|
1523
|
+
return S.setAttribute("splatInstanceIndex", new i.InstancedBufferAttribute(b, 1, !1)), S.instanceCount = 0, S;
|
|
1636
1524
|
}
|
|
1637
1525
|
/**
|
|
1638
1526
|
* Create chunks data (bounding box min/max) for the sorter.
|
|
1639
1527
|
* @returns Float32Array containing chunk data [minX, minY, minZ, maxX, maxY, maxZ] or null.
|
|
1640
1528
|
*/
|
|
1641
1529
|
createChunks() {
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1644
|
-
return r && console.debug(
|
|
1645
|
-
"MESH createChunks: invalid bounding box, cannot create chunks"
|
|
1646
|
-
), null;
|
|
1647
|
-
const t = new Float32Array([
|
|
1530
|
+
const o = this.splatData.boundingBox;
|
|
1531
|
+
return o.min.x === 1 / 0 || o.max.x === -1 / 0 ? null : new Float32Array([
|
|
1648
1532
|
o.min.x,
|
|
1649
1533
|
o.min.y,
|
|
1650
1534
|
o.min.z,
|
|
@@ -1652,38 +1536,23 @@ const X = class X extends c.Mesh {
|
|
|
1652
1536
|
o.max.y,
|
|
1653
1537
|
o.max.z
|
|
1654
1538
|
]);
|
|
1655
|
-
return r && console.debug(
|
|
1656
|
-
"MESH createChunks: created chunks with bounding box",
|
|
1657
|
-
o
|
|
1658
|
-
), t;
|
|
1659
1539
|
}
|
|
1660
1540
|
/**
|
|
1661
1541
|
* Update the viewport size
|
|
1662
1542
|
* @param width Viewport width
|
|
1663
1543
|
* @param height Viewport height
|
|
1664
1544
|
*/
|
|
1665
|
-
updateViewport(
|
|
1666
|
-
|
|
1667
|
-
"MESH updateViewport: updating viewport to",
|
|
1668
|
-
r,
|
|
1669
|
-
"x",
|
|
1670
|
-
o
|
|
1671
|
-
), this.material.updateViewport(r, o);
|
|
1545
|
+
updateViewport(o, t) {
|
|
1546
|
+
o === this._vpW && t === this._vpH || (this._vpW = o, this._vpH = t, this.material.updateViewport(o, t));
|
|
1672
1547
|
}
|
|
1673
1548
|
/**
|
|
1674
1549
|
* Sorts splats based on camera position and direction.
|
|
1675
1550
|
* @param camera The camera to sort against.
|
|
1676
1551
|
*/
|
|
1677
|
-
sort(
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
this.options.autoSort && (l || g) && (o && console.debug(
|
|
1682
|
-
"MESH sort: camera changed, triggering sort. Position changed:",
|
|
1683
|
-
l,
|
|
1684
|
-
"Direction changed:",
|
|
1685
|
-
g
|
|
1686
|
-
), this.lastCameraPositionLocal.copy(a), this.lastCameraDirectionLocal.copy(i), this.sorter.setCamera(a, i));
|
|
1552
|
+
sort(o) {
|
|
1553
|
+
o.getWorldPosition(this._camPosW), o.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);
|
|
1554
|
+
const t = this.lastCameraPositionLocal.distanceToSquared(this._camPosL) > 1e-6, r = this.lastCameraDirectionLocal.dot(this._camDirL) < 0.999;
|
|
1555
|
+
this.options.autoSort && (t || r) && (this.lastCameraPositionLocal.copy(this._camPosL), this.lastCameraDirectionLocal.copy(this._camDirL), this.sorter.setCamera(this._camPosL, this._camDirL));
|
|
1687
1556
|
}
|
|
1688
1557
|
/**
|
|
1689
1558
|
* THREE.js hook called before rendering the object.
|
|
@@ -1694,32 +1563,22 @@ const X = class X extends c.Mesh {
|
|
|
1694
1563
|
*/
|
|
1695
1564
|
// prettier-ignore
|
|
1696
1565
|
// @ts-expect-error scene is not used
|
|
1697
|
-
onBeforeRender(
|
|
1698
|
-
this.sort(
|
|
1699
|
-
const n = r.getSize(new c.Vector2());
|
|
1700
|
-
let { width: a, height: i } = n;
|
|
1701
|
-
const l = r.xr;
|
|
1702
|
-
if (l.enabled && l.isPresenting) {
|
|
1703
|
-
const g = l.getCamera().cameras[0].view;
|
|
1704
|
-
g && (a = g.width, i = g.height);
|
|
1705
|
-
}
|
|
1706
|
-
this.updateViewport(a, i);
|
|
1566
|
+
onBeforeRender(o, t, r) {
|
|
1567
|
+
this.sort(r), o.getSize(this._size), this.updateViewport(this._size.x, this._size.y);
|
|
1707
1568
|
}
|
|
1708
1569
|
/**
|
|
1709
1570
|
* Dispose of resources
|
|
1710
1571
|
*/
|
|
1711
1572
|
dispose() {
|
|
1712
|
-
|
|
1713
|
-
r && console.debug("MESH dispose: cleaning up mesh resources"), this.sorter.dispose(), this.geometry.dispose(), this.material.dispose(), this.textureManager.dispose(), r && console.debug("MESH dispose: mesh resources cleaned up");
|
|
1573
|
+
this.sorter.removeEventListener("updated", this.onSorterUpdated), this.sorter.dispose(), this.geometry.dispose(), this.material.dispose(), this.textureManager.dispose();
|
|
1714
1574
|
}
|
|
1715
1575
|
};
|
|
1716
|
-
// Cached inverse matrix
|
|
1717
1576
|
/** Number of splats combined into a single instanced draw call. */
|
|
1718
|
-
|
|
1719
|
-
let ae =
|
|
1720
|
-
const
|
|
1577
|
+
h(K, "INSTANCE_SIZE", 128);
|
|
1578
|
+
let ae = K;
|
|
1579
|
+
const De = Symbol.for("@speridlabs/visus/SplatMesh");
|
|
1721
1580
|
try {
|
|
1722
|
-
Object.defineProperty(ae.prototype,
|
|
1581
|
+
Object.defineProperty(ae.prototype, De, {
|
|
1723
1582
|
value: !0,
|
|
1724
1583
|
configurable: !1,
|
|
1725
1584
|
enumerable: !1,
|
|
@@ -1728,23 +1587,23 @@ try {
|
|
|
1728
1587
|
} catch {
|
|
1729
1588
|
console.warn("Couldn't define Visus SplatMesh symbol");
|
|
1730
1589
|
}
|
|
1731
|
-
const
|
|
1732
|
-
plyUrl:
|
|
1590
|
+
const je = ({
|
|
1591
|
+
plyUrl: T,
|
|
1733
1592
|
debug: e = !1,
|
|
1734
|
-
splatOptions:
|
|
1735
|
-
...
|
|
1593
|
+
splatOptions: o = {},
|
|
1594
|
+
...t
|
|
1736
1595
|
}) => {
|
|
1737
|
-
typeof window < "u" && e && (window.__VISUS_SPLAT_DEBUG__ = !0), e && console.debug("SPLAT: rendering", { plyUrl:
|
|
1738
|
-
const
|
|
1739
|
-
() => new ae(n,
|
|
1740
|
-
[n,
|
|
1596
|
+
typeof window < "u" && e && (window.__VISUS_SPLAT_DEBUG__ = !0), e && console.debug("SPLAT: rendering", { plyUrl: T, splatOptions: o, meshProps: t });
|
|
1597
|
+
const r = ye(null), n = be(Ce, T), a = ge(
|
|
1598
|
+
() => new ae(n, o || {}),
|
|
1599
|
+
[n, o]
|
|
1741
1600
|
);
|
|
1742
1601
|
return we(() => () => {
|
|
1743
|
-
e && console.debug("SPLAT: disposing mesh for",
|
|
1744
|
-
}, [a]), /* @__PURE__ */
|
|
1602
|
+
e && console.debug("SPLAT: disposing mesh for", T), typeof (a == null ? void 0 : a.dispose) == "function" && a.dispose();
|
|
1603
|
+
}, [a]), /* @__PURE__ */ Me.jsx("primitive", { ref: r, object: a, ...t });
|
|
1745
1604
|
};
|
|
1746
1605
|
export {
|
|
1747
|
-
|
|
1748
|
-
|
|
1606
|
+
Ce as PlyLoader,
|
|
1607
|
+
je as Splat,
|
|
1749
1608
|
ae as SplatMesh
|
|
1750
1609
|
};
|