@reall3d/reall3dviewer 2.2.0 → 2.2.1
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/pkg.js +631 -624
- package/dist/pkg.umd.cjs +28 -21
- package/package.json +1 -1
package/dist/pkg.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Mr = Object.defineProperty;
|
|
2
2
|
var vr = (n, e, t) => e in n ? Mr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var An = (n, e, t) => vr(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Matrix4 as Fe, Frustum as Dr, Vector3 as v, ShaderChunk as kr, Vector4 as ze, InstancedBufferGeometry as Ms, BufferAttribute as wt, InstancedBufferAttribute as Tr, DynamicDrawUsage as Lr, ShaderMaterial as no, DoubleSide as $e, NormalBlending as Rr, DataTexture as Ve, RGBAIntegerFormat as Je, UnsignedIntType as lt, UnsignedByteType as Mi, Mesh as fe, Vector2 as ge, Loader as Fr, FileLoader as Pr, Color as ii, SRGBColorSpace as Ur, Group as tn, BufferGeometry as vn, Float32BufferAttribute as
|
|
4
|
+
import { Matrix4 as Fe, Frustum as Dr, Vector3 as v, ShaderChunk as kr, Vector4 as ze, InstancedBufferGeometry as Ms, BufferAttribute as wt, InstancedBufferAttribute as Tr, DynamicDrawUsage as Lr, ShaderMaterial as no, DoubleSide as $e, NormalBlending as Rr, DataTexture as Ve, RGBAIntegerFormat as Je, UnsignedIntType as lt, UnsignedByteType as Mi, Mesh as fe, Vector2 as ge, Loader as Fr, FileLoader as Pr, Color as ii, SRGBColorSpace as Ur, Group as tn, BufferGeometry as vn, Float32BufferAttribute as Ke, LineBasicMaterial as wn, Material as vi, PointsMaterial as cn, MeshPhongMaterial as _r, LineSegments as vs, Points as ts, WebGLRenderer as so, PerspectiveCamera as io, Object3D as zn, AudioLoader as ao, Audio as oo, AudioListener as ro, CylinderGeometry as Di, MeshBasicMaterial as rt, PlaneGeometry as Nr, Quaternion as vt, Controls as Hr, MOUSE as je, TOUCH as it, Spherical as ki, Ray as Wr, Plane as Gr, MathUtils as at, InstancedInterleavedBuffer as Ds, InterleavedBufferAttribute as Et, WireframeGeometry as Yr, Box3 as ai, Sphere as Ao, ShaderLib as En, UniformsUtils as co, UniformsLib as bn, Line3 as zr, CircleGeometry as dt, Raycaster as Or, CatmullRomCurve3 as Ti, Scene as lo, AmbientLight as uo, FogExp2 as Li, DirectionalLight as Vr, EventDispatcher as Jr, Clock as Xr } from "three";
|
|
5
5
|
import * as Ri from "@gotoeasy/three-tile";
|
|
6
6
|
let w = 1;
|
|
7
|
-
const Dt = w++, ho = w++, Ze = w++, go = w++, ks = w++, Ts = w++, fo = w++, ns = w++, po = w++, Pt = w++, pe = w++, q = w++, mo = w++, Ls = w++, Ye = w++, kt = w++, Re = w++, nn = w++, Co = w++, Io = w++, yo = w++, wo = w++, Eo = w++, bo = w++, oi = w++,
|
|
7
|
+
const Dt = w++, ho = w++, Ze = w++, go = w++, ks = w++, Ts = w++, fo = w++, ns = w++, po = w++, Pt = w++, pe = w++, q = w++, mo = w++, Ls = w++, Ye = w++, kt = w++, Re = w++, nn = w++, Co = w++, Io = w++, yo = w++, wo = w++, Eo = w++, bo = w++, oi = w++, Kr = w++, Zr = w++, Fi = w++, he = w++;
|
|
8
8
|
w++;
|
|
9
|
-
const ae = w++, Qt = w++, xt = w++, Pi = w++, Ui = w++, _i = w++, Qo = w++, jr = w++, Ni = w++, ln = w++, un = w++, Hi = w++, Wi = w++, Gi = w++, ht = w++, Yi = w++,
|
|
9
|
+
const ae = w++, Qt = w++, xt = w++, Pi = w++, Ui = w++, _i = w++, Qo = w++, jr = w++, Ni = w++, ln = w++, un = w++, Hi = w++, Wi = w++, Gi = w++, ht = w++, Yi = w++, Kt = w++, xo = w++, _t = w++, Nt = w++, Qn = w++, Bo = w++, Rs = w++, qr = w++, Dn = w++, ss = w++, is = w++, kn = w++, Tn = w++, On = w++, Ln = w++, So = w++, ri = w++, R = w++, mt = w++, Zt = w++, O = w++, Vn = w++, Ai = w++, $r = w++, de = w++, Fs = w++, xe = w++, Mo = w++, vo = w++, Do = w++, ko = w++, Ps = w++, To = w++, gt = w++, ci = w++, li = w++, Ot = w++, eA = w++, Lo = w++, Ro = w++;
|
|
10
10
|
w++;
|
|
11
|
-
const Jn = w++, as = w++, zi = w++, Oi = w++, Us = w++, Rn = w++, _s = w++, Vt = w++,
|
|
11
|
+
const Jn = w++, as = w++, zi = w++, Oi = w++, Us = w++, Rn = w++, _s = w++, Vt = w++, Se = w++, ui = w++;
|
|
12
12
|
w++;
|
|
13
13
|
const Fo = w++, Po = w++, dn = w++, os = w++, Ns = w++, tA = w++, xn = w++, Fn = w++, di = w++, Bt = w++, Tt = w++, Pn = w++, hn = w++, Uo = w++, ee = w++, Ae = w++, nA = w++, Vi = w++, Un = w++, _n = w++, sA = w++, hi = w++, gi = w++, At = w++, Jt = w++, Ut = w++, iA = w++, _o = w++, aA = w++;
|
|
14
14
|
w++;
|
|
@@ -16,7 +16,7 @@ w++;
|
|
|
16
16
|
w++;
|
|
17
17
|
w++;
|
|
18
18
|
w++;
|
|
19
|
-
const ct = w++, jt = w++, Bn = w++, Hs = w++, No = w++, Ho = w++, Ws = w++, et = w++, Gt = w++, Wo = w++, fi = w++, Ji = w++, oA = w++, rA = w++, sn = w++, an = w++, on = w++,
|
|
19
|
+
const ct = w++, jt = w++, Bn = w++, Hs = w++, No = w++, Ho = w++, Ws = w++, et = w++, Gt = w++, Wo = w++, fi = w++, Ji = w++, oA = w++, rA = w++, sn = w++, an = w++, on = w++, Xn = w++, Kn = w++, ot = w++, Go = w++, Xi = w++, Nn = w++, be = w++, Yo = w++, Gs = w++, zo = w++, Yt = w++, Oo = w++, Vo = w++, pi = w++, Jo = w++, Xo = w++, Ki = w++, Ko = w++, mi = w++, AA = w++, cA = w++, Zo = w++, Ys = w++, lA = w++, jo = w++, Hn = w++, St = w++, Wn = w++, rs = w++, As = w++, cs = w++, zs = w++, ls = w++, Ci = w++, Zi = w++, qo = w++;
|
|
20
20
|
w++;
|
|
21
21
|
w++;
|
|
22
22
|
w++;
|
|
@@ -26,7 +26,7 @@ w++;
|
|
|
26
26
|
const nr = w++, sr = w++, re = w++, Os = w++, Vs = w++, Js = w++, dA = w++, ir = w++, hA = w++, gA = w++, fA = w++, pA = w++, mA = w++, ar = w++, or = w++;
|
|
27
27
|
w++;
|
|
28
28
|
w++;
|
|
29
|
-
const CA = w++, Ii = w++,
|
|
29
|
+
const CA = w++, Ii = w++, Xs = w++, Ks = w++, us = w++, ea = w++, IA = w++, rr = w++, Ar = w++, yi = w++, yA = w++;
|
|
30
30
|
class Zn {
|
|
31
31
|
constructor() {
|
|
32
32
|
this.map = /* @__PURE__ */ new Map();
|
|
@@ -75,8 +75,8 @@ class EA {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
var N = /* @__PURE__ */ ((n) => (n[n.FetchReady = 0] = "FetchReady", n[n.Fetching = 1] = "Fetching", n[n.FetchDone = 2] = "FetchDone", n[n.FetchAborted = 3] = "FetchAborted", n[n.FetchFailed = 4] = "FetchFailed", n[n.Invalid = 5] = "Invalid", n))(N || {});
|
|
78
|
-
const jn = "v2.2.
|
|
79
|
-
var
|
|
78
|
+
const jn = "v2.2.1", me = !navigator.userAgent.includes("cloudphone") && navigator.userAgent.includes("Mobi"), bA = "QWERTYUIOPLKJHGFDSAZXCVBNM1234567890qwertyuioplkjhgfdsazxcvbnm`~!@#$%^&*()-_=+\\|]}[{'\";::,<.>//? ", QA = me ? 600 : 300, xA = me ? 2e3 : 300, Ct = 128, Sn = 32, Y = 32, BA = 20, SA = 16, cr = 64 * 1024, MA = 1024 * 1e4, vA = 10240 * 1e4, Ne = 0.28209479177387814, DA = 0, kA = 220, TA = 8, LA = 9, RA = 20, FA = 190, PA = 10190, qt = 1, qe = 2, Lt = 3, UA = 4, _A = 3141592653;
|
|
79
|
+
var ke = /* @__PURE__ */ ((n) => (n[n.L1 = 1] = "L1", n[n.L2 = 2] = "L2", n[n.L3 = 3] = "L3", n[n.L4 = 4] = "L4", n[n.Default5 = 5] = "Default5", n[n.L6 = 6] = "L6", n[n.L7 = 7] = "L7", n[n.L8 = 8] = "L8", n[n.L9 = 9] = "L9", n))(ke || {}), Rt = /* @__PURE__ */ ((n) => (n[n.Default1 = 1] = "Default1", n[n.ZdepthFrontNearest2010 = 2010] = "ZdepthFrontNearest2010", n[n.ZdepthFront2011 = 2011] = "ZdepthFront2011", n[n.ZdepthFrontNearFar2012 = 2012] = "ZdepthFrontNearFar2012", n[n.ZdepthFullNearFar2112 = 2112] = "ZdepthFullNearFar2112", n))(Rt || {});
|
|
80
80
|
function NA(n) {
|
|
81
81
|
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
82
82
|
var e = n.default;
|
|
@@ -217,12 +217,12 @@ function zA() {
|
|
|
217
217
|
}
|
|
218
218
|
const m = class m extends A {
|
|
219
219
|
static async _getModuleInstance() {
|
|
220
|
-
const d = r.replace("data:application/wasm;base64,", ""), h = Uint8Array.from(atob(d), (y) => y.charCodeAt(0)).buffer, g = {},
|
|
221
|
-
m._moduleInstance =
|
|
220
|
+
const d = r.replace("data:application/wasm;base64,", ""), h = Uint8Array.from(atob(d), (y) => y.charCodeAt(0)).buffer, g = {}, Q = await WebAssembly.instantiate(h, g);
|
|
221
|
+
m._moduleInstance = Q.instance;
|
|
222
222
|
}
|
|
223
223
|
constructor(d) {
|
|
224
224
|
let h, g = null;
|
|
225
|
-
const
|
|
225
|
+
const Q = d.getReader();
|
|
226
226
|
super({
|
|
227
227
|
async start(y) {
|
|
228
228
|
await m._contextMutex.acquire();
|
|
@@ -236,11 +236,11 @@ function zA() {
|
|
|
236
236
|
try {
|
|
237
237
|
if (h.needsMoreInput()) {
|
|
238
238
|
if (g === null || g.byteLength === 0) {
|
|
239
|
-
const { done:
|
|
240
|
-
|
|
239
|
+
const { done: B, value: I } = await Q.read();
|
|
240
|
+
B || (g = I);
|
|
241
241
|
}
|
|
242
|
-
const
|
|
243
|
-
h.supplyInput(g.subarray(0,
|
|
242
|
+
const S = Math.min(h.bufSize, g.byteLength);
|
|
243
|
+
h.supplyInput(g.subarray(0, S)), g = g.subarray(S);
|
|
244
244
|
}
|
|
245
245
|
const M = h.getNextOutput();
|
|
246
246
|
y.enqueue(M.outChunk), h.resetOutputBuffer(), M.finished && (h.dispose(), m._contextMutex.release(), y.close());
|
|
@@ -250,7 +250,7 @@ function zA() {
|
|
|
250
250
|
},
|
|
251
251
|
cancel() {
|
|
252
252
|
try {
|
|
253
|
-
return h && h.dispose(),
|
|
253
|
+
return h && h.dispose(), Q.cancel();
|
|
254
254
|
} finally {
|
|
255
255
|
m._contextMutex.release();
|
|
256
256
|
}
|
|
@@ -265,7 +265,7 @@ function zA() {
|
|
|
265
265
|
));
|
|
266
266
|
})(Mn)), Mn.exports;
|
|
267
267
|
}
|
|
268
|
-
var OA = zA(),
|
|
268
|
+
var OA = zA(), Be = Uint8Array, bt = Uint16Array, VA = Int32Array, lr = new Be([
|
|
269
269
|
0,
|
|
270
270
|
0,
|
|
271
271
|
0,
|
|
@@ -300,7 +300,7 @@ var OA = zA(), Se = Uint8Array, bt = Uint16Array, VA = Int32Array, lr = new Se([
|
|
|
300
300
|
0,
|
|
301
301
|
/* impossible */
|
|
302
302
|
0
|
|
303
|
-
]), ur = new
|
|
303
|
+
]), ur = new Be([
|
|
304
304
|
0,
|
|
305
305
|
0,
|
|
306
306
|
0,
|
|
@@ -334,21 +334,21 @@ var OA = zA(), Se = Uint8Array, bt = Uint16Array, VA = Int32Array, lr = new Se([
|
|
|
334
334
|
/* unused */
|
|
335
335
|
0,
|
|
336
336
|
0
|
|
337
|
-
]), JA = new
|
|
337
|
+
]), JA = new Be([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), dr = function(n, e) {
|
|
338
338
|
for (var t = new bt(31), s = 0; s < 31; ++s)
|
|
339
339
|
t[s] = e += 1 << n[s - 1];
|
|
340
340
|
for (var i = new VA(t[30]), s = 1; s < 30; ++s)
|
|
341
341
|
for (var o = t[s]; o < t[s + 1]; ++o)
|
|
342
342
|
i[o] = o - t[s] << 5 | s;
|
|
343
343
|
return { b: t, r: i };
|
|
344
|
-
}, hr = dr(lr, 2), gr = hr.b,
|
|
345
|
-
gr[28] = 258,
|
|
346
|
-
var
|
|
344
|
+
}, hr = dr(lr, 2), gr = hr.b, XA = hr.r;
|
|
345
|
+
gr[28] = 258, XA[258] = 28;
|
|
346
|
+
var KA = dr(ur, 0), ZA = KA.b, Zs = new bt(32768);
|
|
347
347
|
for (var se = 0; se < 32768; ++se) {
|
|
348
348
|
var st = (se & 43690) >> 1 | (se & 21845) << 1;
|
|
349
349
|
st = (st & 52428) >> 2 | (st & 13107) << 2, st = (st & 61680) >> 4 | (st & 3855) << 4, Zs[se] = ((st & 65280) >> 8 | (st & 255) << 8) >> 1;
|
|
350
350
|
}
|
|
351
|
-
var
|
|
351
|
+
var Xt = (function(n, e, t) {
|
|
352
352
|
for (var s = n.length, i = 0, o = new bt(e); i < s; ++i)
|
|
353
353
|
n[i] && ++o[n[i] - 1];
|
|
354
354
|
var a = new bt(e);
|
|
@@ -366,7 +366,7 @@ var Kt = (function(n, e, t) {
|
|
|
366
366
|
for (r = new bt(s), i = 0; i < s; ++i)
|
|
367
367
|
n[i] && (r[i] = Zs[a[n[i] - 1]++] >> 15 - n[i]);
|
|
368
368
|
return r;
|
|
369
|
-
}), rn = new
|
|
369
|
+
}), rn = new Be(288);
|
|
370
370
|
for (var se = 0; se < 144; ++se)
|
|
371
371
|
rn[se] = 8;
|
|
372
372
|
for (var se = 144; se < 256; ++se)
|
|
@@ -375,10 +375,10 @@ for (var se = 256; se < 280; ++se)
|
|
|
375
375
|
rn[se] = 7;
|
|
376
376
|
for (var se = 280; se < 288; ++se)
|
|
377
377
|
rn[se] = 8;
|
|
378
|
-
var fr = new
|
|
378
|
+
var fr = new Be(32);
|
|
379
379
|
for (var se = 0; se < 32; ++se)
|
|
380
380
|
fr[se] = 5;
|
|
381
|
-
var jA = /* @__PURE__ */
|
|
381
|
+
var jA = /* @__PURE__ */ Xt(rn, 9, 1), qA = /* @__PURE__ */ Xt(fr, 5, 1), ds = function(n) {
|
|
382
382
|
for (var e = n[0], t = 1; t < n.length; ++t)
|
|
383
383
|
n[t] > e && (e = n[t]);
|
|
384
384
|
return e;
|
|
@@ -391,7 +391,7 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
391
391
|
}, $A = function(n) {
|
|
392
392
|
return (n + 7) / 8 | 0;
|
|
393
393
|
}, wi = function(n, e, t) {
|
|
394
|
-
return (e == null || e < 0) && (e = 0), (t == null || t > n.length) && (t = n.length), new
|
|
394
|
+
return (e == null || e < 0) && (e = 0), (t == null || t > n.length) && (t = n.length), new Be(n.subarray(e, t));
|
|
395
395
|
}, ec = [
|
|
396
396
|
"unexpected EOF",
|
|
397
397
|
"invalid block type",
|
|
@@ -408,22 +408,22 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
408
408
|
"stream finishing",
|
|
409
409
|
"invalid zip data"
|
|
410
410
|
// determined by unknown compression method
|
|
411
|
-
],
|
|
411
|
+
], ve = function(n, e, t) {
|
|
412
412
|
var s = new Error(e || ec[n]);
|
|
413
|
-
if (s.code = n, Error.captureStackTrace && Error.captureStackTrace(s,
|
|
413
|
+
if (s.code = n, Error.captureStackTrace && Error.captureStackTrace(s, ve), !t)
|
|
414
414
|
throw s;
|
|
415
415
|
return s;
|
|
416
416
|
}, tc = function(n, e, t, s) {
|
|
417
417
|
var i = n.length, o = s ? s.length : 0;
|
|
418
418
|
if (!i || e.f && !e.l)
|
|
419
|
-
return t || new
|
|
419
|
+
return t || new Be(0);
|
|
420
420
|
var a = !t, r = a || e.i != 2, A = e.i;
|
|
421
|
-
a && (t = new
|
|
421
|
+
a && (t = new Be(i * 3));
|
|
422
422
|
var u = function(V) {
|
|
423
423
|
var j = t.length;
|
|
424
424
|
if (V > j) {
|
|
425
|
-
var
|
|
426
|
-
|
|
425
|
+
var we = new Be(Math.max(j * 2, V));
|
|
426
|
+
we.set(t), t = we;
|
|
427
427
|
}
|
|
428
428
|
}, c = e.f || 0, l = e.p || 0, p = e.b || 0, f = e.l, m = e.d, C = e.m, d = e.n, h = i * 8;
|
|
429
429
|
do {
|
|
@@ -434,38 +434,38 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
434
434
|
if (g == 1)
|
|
435
435
|
f = jA, m = qA, C = 9, d = 5;
|
|
436
436
|
else if (g == 2) {
|
|
437
|
-
var
|
|
437
|
+
var S = Te(n, l, 31) + 257, B = Te(n, l + 10, 15) + 4, I = S + Te(n, l + 5, 31) + 1;
|
|
438
438
|
l += 14;
|
|
439
|
-
for (var x = new
|
|
440
|
-
|
|
441
|
-
l +=
|
|
442
|
-
for (var T = ds(
|
|
439
|
+
for (var x = new Be(I), E = new Be(19), b = 0; b < B; ++b)
|
|
440
|
+
E[JA[b]] = Te(n, l + b * 3, 7);
|
|
441
|
+
l += B * 3;
|
|
442
|
+
for (var T = ds(E), F = (1 << T) - 1, k = Xt(E, T, 1), b = 0; b < I; ) {
|
|
443
443
|
var L = k[Te(n, l, F)];
|
|
444
444
|
l += L & 15;
|
|
445
|
-
var
|
|
446
|
-
if (
|
|
447
|
-
x[
|
|
445
|
+
var Q = L >> 4;
|
|
446
|
+
if (Q < 16)
|
|
447
|
+
x[b++] = Q;
|
|
448
448
|
else {
|
|
449
449
|
var P = 0, U = 0;
|
|
450
|
-
for (
|
|
451
|
-
x[
|
|
450
|
+
for (Q == 16 ? (U = 3 + Te(n, l, 3), l += 2, P = x[b - 1]) : Q == 17 ? (U = 3 + Te(n, l, 7), l += 3) : Q == 18 && (U = 11 + Te(n, l, 127), l += 7); U--; )
|
|
451
|
+
x[b++] = P;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
var G = x.subarray(0,
|
|
455
|
-
C = ds(G), d = ds(D), f =
|
|
454
|
+
var G = x.subarray(0, S), D = x.subarray(S);
|
|
455
|
+
C = ds(G), d = ds(D), f = Xt(G, C, 1), m = Xt(D, d, 1);
|
|
456
456
|
} else
|
|
457
|
-
|
|
457
|
+
ve(1);
|
|
458
458
|
else {
|
|
459
|
-
var
|
|
459
|
+
var Q = $A(l) + 4, y = n[Q - 4] | n[Q - 3] << 8, M = Q + y;
|
|
460
460
|
if (M > i) {
|
|
461
|
-
A &&
|
|
461
|
+
A && ve(0);
|
|
462
462
|
break;
|
|
463
463
|
}
|
|
464
|
-
r && u(p + y), t.set(n.subarray(
|
|
464
|
+
r && u(p + y), t.set(n.subarray(Q, M), p), e.b = p += y, e.p = l = M * 8, e.f = c;
|
|
465
465
|
continue;
|
|
466
466
|
}
|
|
467
467
|
if (l > h) {
|
|
468
|
-
A &&
|
|
468
|
+
A && ve(0);
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
@@ -473,10 +473,10 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
473
473
|
for (var _ = (1 << C) - 1, H = (1 << d) - 1, z = l; ; z = l) {
|
|
474
474
|
var P = f[hs(n, l) & _], W = P >> 4;
|
|
475
475
|
if (l += P & 15, l > h) {
|
|
476
|
-
A &&
|
|
476
|
+
A && ve(0);
|
|
477
477
|
break;
|
|
478
478
|
}
|
|
479
|
-
if (P ||
|
|
479
|
+
if (P || ve(2), W < 256)
|
|
480
480
|
t[p++] = W;
|
|
481
481
|
else if (W == 256) {
|
|
482
482
|
z = l, f = null;
|
|
@@ -484,25 +484,25 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
484
484
|
} else {
|
|
485
485
|
var Z = W - 254;
|
|
486
486
|
if (W > 264) {
|
|
487
|
-
var
|
|
488
|
-
Z = Te(n, l, (1 << te) - 1) + gr[
|
|
487
|
+
var b = W - 257, te = lr[b];
|
|
488
|
+
Z = Te(n, l, (1 << te) - 1) + gr[b], l += te;
|
|
489
489
|
}
|
|
490
|
-
var $ = m[hs(n, l) & H],
|
|
491
|
-
$ ||
|
|
492
|
-
var D = ZA[
|
|
493
|
-
if (
|
|
494
|
-
var te = ur[
|
|
490
|
+
var $ = m[hs(n, l) & H], ye = $ >> 4;
|
|
491
|
+
$ || ve(3), l += $ & 15;
|
|
492
|
+
var D = ZA[ye];
|
|
493
|
+
if (ye > 3) {
|
|
494
|
+
var te = ur[ye];
|
|
495
495
|
D += hs(n, l) & (1 << te) - 1, l += te;
|
|
496
496
|
}
|
|
497
497
|
if (l > h) {
|
|
498
|
-
A &&
|
|
498
|
+
A && ve(0);
|
|
499
499
|
break;
|
|
500
500
|
}
|
|
501
501
|
r && u(p + 131072);
|
|
502
502
|
var Ie = p + Z;
|
|
503
503
|
if (p < D) {
|
|
504
504
|
var tt = o - D, nt = Math.min(D, Ie);
|
|
505
|
-
for (tt + p < 0 &&
|
|
505
|
+
for (tt + p < 0 && ve(3); p < nt; ++p)
|
|
506
506
|
t[p] = s[tt + p];
|
|
507
507
|
}
|
|
508
508
|
for (; p < Ie; ++p)
|
|
@@ -512,7 +512,7 @@ var jA = /* @__PURE__ */ Kt(rn, 9, 1), qA = /* @__PURE__ */ Kt(fr, 5, 1), ds = f
|
|
|
512
512
|
e.l = f, e.p = z, e.b = p, e.f = c, f && (c = 1, e.m = C, e.d = m, e.n = d);
|
|
513
513
|
} while (!c);
|
|
514
514
|
return p != t.length && a ? wi(t, 0, p) : t.subarray(0, p);
|
|
515
|
-
}, nc = /* @__PURE__ */ new
|
|
515
|
+
}, nc = /* @__PURE__ */ new Be(0), We = function(n, e) {
|
|
516
516
|
return n[e] | n[e + 1] << 8;
|
|
517
517
|
}, Le = function(n, e) {
|
|
518
518
|
return (n[e] | n[e + 1] << 8 | n[e + 2] << 16 | n[e + 3] << 24) >>> 0;
|
|
@@ -544,7 +544,7 @@ function oc(n, e) {
|
|
|
544
544
|
if (js)
|
|
545
545
|
return js.decode(n);
|
|
546
546
|
var i = ac(n), o = i.s, t = i.r;
|
|
547
|
-
return t.length &&
|
|
547
|
+
return t.length && ve(8), o;
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
var rc = function(n, e) {
|
|
@@ -559,7 +559,7 @@ var rc = function(n, e) {
|
|
|
559
559
|
};
|
|
560
560
|
function lc(n, e) {
|
|
561
561
|
for (var t = {}, s = n.length - 22; Le(n, s) != 101010256; --s)
|
|
562
|
-
(!s || n.length - s > 65558) &&
|
|
562
|
+
(!s || n.length - s > 65558) && ve(13);
|
|
563
563
|
var i = We(n, s + 8);
|
|
564
564
|
if (!i)
|
|
565
565
|
return {};
|
|
@@ -570,14 +570,14 @@ function lc(n, e) {
|
|
|
570
570
|
}
|
|
571
571
|
for (var A = 0; A < i; ++A) {
|
|
572
572
|
var u = Ac(n, o, a), c = u[0], l = u[1], p = u[2], f = u[3], m = u[4], C = u[5], d = rc(n, C);
|
|
573
|
-
o = m, c ? c == 8 ? t[f] = sc(n.subarray(d, d + l), { out: new
|
|
573
|
+
o = m, c ? c == 8 ? t[f] = sc(n.subarray(d, d + l), { out: new Be(p) }) : ve(14, "unknown compression type " + c) : t[f] = wi(n, d, d + l);
|
|
574
574
|
}
|
|
575
575
|
return t;
|
|
576
576
|
}
|
|
577
577
|
function Ei(n) {
|
|
578
578
|
let e = !1;
|
|
579
579
|
const t = (f, m, C) => n.on(f, m, C), s = (f, ...m) => n.fire(f, ...m);
|
|
580
|
-
t(
|
|
580
|
+
t(xe, () => s(R).debugMode), t(ri, () => e = !0);
|
|
581
581
|
let i = 0;
|
|
582
582
|
(function f() {
|
|
583
583
|
i++, !e && requestAnimationFrame(f);
|
|
@@ -620,7 +620,7 @@ function Ei(n) {
|
|
|
620
620
|
}), t(gt, (f) => {
|
|
621
621
|
let m = f.x.toFixed(3).split("."), C = f.y.toFixed(3).split("."), d = f.z.toFixed(3).split(".");
|
|
622
622
|
return (m[1] === "000" || m[1] === "00000") && (m[1] = "0"), (C[1] === "000" || C[1] === "00000") && (C[1] = "0"), (d[1] === "000" || d[1] === "00000") && (d[1] = "0"), `${m.join(".")}, ${C.join(".")}, ${d.join(".")}`;
|
|
623
|
-
}), t(
|
|
623
|
+
}), t(Kr, (f) => btoa(f)), t(Zr, (f) => atob(f));
|
|
624
624
|
const A = 1e-3;
|
|
625
625
|
let u = new v(), c = new v(), l = 0;
|
|
626
626
|
t($r, () => {
|
|
@@ -641,22 +641,22 @@ function Ei(n) {
|
|
|
641
641
|
fps: d,
|
|
642
642
|
realFps: h,
|
|
643
643
|
sortTime: g,
|
|
644
|
-
bucketBits:
|
|
644
|
+
bucketBits: Q,
|
|
645
645
|
sortType: y,
|
|
646
646
|
qualityLevel: M,
|
|
647
|
-
fov:
|
|
648
|
-
position:
|
|
647
|
+
fov: S,
|
|
648
|
+
position: B,
|
|
649
649
|
lookUp: I,
|
|
650
650
|
lookAt: x,
|
|
651
|
-
worker:
|
|
652
|
-
scene:
|
|
651
|
+
worker: E,
|
|
652
|
+
scene: b,
|
|
653
653
|
// updateSceneData,
|
|
654
654
|
scale: T,
|
|
655
655
|
cuts: F,
|
|
656
656
|
shDegree: k
|
|
657
657
|
} = {}) => {
|
|
658
|
-
if (!s(
|
|
659
|
-
k !== void 0 && p("shDegree", `${k}`), f !== void 0 && p("renderSplatCount", `${f}`), m !== void 0 && p("visibleSplatCount", `${m}`), C !== void 0 && p("modelSplatCount", `${C}`), d !== void 0 && p("fps", d), h !== void 0 && p("realFps", `raw ${h}`), g !== void 0 && p("sort", `${g} ms (L ${s(R).qualityLevel ||
|
|
658
|
+
if (!s(xe)) return;
|
|
659
|
+
k !== void 0 && p("shDegree", `${k}`), f !== void 0 && p("renderSplatCount", `${f}`), m !== void 0 && p("visibleSplatCount", `${m}`), C !== void 0 && p("modelSplatCount", `${C}`), d !== void 0 && p("fps", d), h !== void 0 && p("realFps", `raw ${h}`), g !== void 0 && p("sort", `${g} ms (L ${s(R).qualityLevel || ke.Default5}, ${Q} B, T ${y})`), F !== void 0 && p("cuts", F === "" ? "" : `(${F} cuts)`), E && p("worker", `${E}`), b && p("scene", b), S && p("fov", S), B && p("position", B), I && p("lookUp", I), x && p("lookAt", x), x && p("viewer-version", jn);
|
|
660
660
|
let L = performance.memory || { usedJSHeapSize: 0, totalJSHeapSize: 0, jsHeapSizeLimit: 0 }, P = "", U = L.usedJSHeapSize / 1024 / 1024;
|
|
661
661
|
U > 1e3 ? P += (U / 1024).toFixed(2) + " G" : P += U.toFixed(0) + " M", P += " / ";
|
|
662
662
|
let G = L.totalJSHeapSize / 1024 / 1024;
|
|
@@ -675,12 +675,12 @@ function uc(n = 0) {
|
|
|
675
675
|
const e = /* @__PURE__ */ new Date();
|
|
676
676
|
return e.setDate(e.getDate() - 7), n >= e.getFullYear() * 1e4 + (e.getMonth() + 1) * 100 + e.getDate();
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function K(n) {
|
|
679
679
|
return n < 0 ? 0 : n > 255 ? 255 : n | 0;
|
|
680
680
|
}
|
|
681
681
|
function gn(n) {
|
|
682
|
-
const e =
|
|
683
|
-
return
|
|
682
|
+
const e = K(Math.round(n * 128) + 128);
|
|
683
|
+
return K(Math.floor((e + 4) / 8) * 8);
|
|
684
684
|
}
|
|
685
685
|
function Gn(n, e) {
|
|
686
686
|
return ((1500 + n * 248) / e).toFixed(2) + "x";
|
|
@@ -821,11 +821,11 @@ async function fc(n, e) {
|
|
|
821
821
|
const m = new Uint32Array(n.slice(o, o + 4).buffer)[0], C = n.subarray(o + 4, o + 4 + m), { rgba: d } = await ie(C), h = new Uint8Array(8 + s * (e ? 28 : 24));
|
|
822
822
|
let g = 0;
|
|
823
823
|
h[g] = n[g++], h[g] = n[g++], h[g] = n[g++], h[g] = n[g++], h[g++] = 220, h[g++] = 0, h[g++] = 0, h[g++] = 0;
|
|
824
|
-
let
|
|
825
|
-
if (h.set(r.subarray(0, s * 12),
|
|
824
|
+
let Q = 8;
|
|
825
|
+
if (h.set(r.subarray(0, s * 12), Q), Q += s * 12, h.set(c.subarray(0, s * 4), Q), Q += s * 4, h.set(f.subarray(0, s * 4), Q), Q += s * 4, h.set(d.subarray(0, s * 4), Q), e) {
|
|
826
826
|
o += 4 + m;
|
|
827
|
-
const y = new Uint32Array(n.slice(o, o + 4).buffer)[0], M = n.subarray(o + 4, o + 4 + y), { rgba:
|
|
828
|
-
|
|
827
|
+
const y = new Uint32Array(n.slice(o, o + 4).buffer)[0], M = n.subarray(o + 4, o + 4 + y), { rgba: S } = await ie(M);
|
|
828
|
+
Q += s * 4, h.set(S.subarray(0, s * 4), Q);
|
|
829
829
|
}
|
|
830
830
|
return h;
|
|
831
831
|
}
|
|
@@ -901,7 +901,7 @@ async function Ec(n) {
|
|
|
901
901
|
const o = s.ExclusiveId ? bi : Qi, a = WebAssembly.compile(Uint8Array.from(atob(o), (p) => p.charCodeAt(0)).buffer), r = new WebAssembly.Memory({ initial: 1, maximum: 1 }), u = (await WebAssembly.instantiate(await a, { env: { memory: r, expf: qn } })).exports.H;
|
|
902
902
|
return new Uint8Array(r.buffer).set(n, 0), u(0) && (s.HashCheck = !1), s;
|
|
903
903
|
}
|
|
904
|
-
async function
|
|
904
|
+
async function De(n, e = null) {
|
|
905
905
|
let t = new Uint32Array(n.slice(0, 8).buffer);
|
|
906
906
|
const s = t[0], i = t[1];
|
|
907
907
|
if (i == TA) {
|
|
@@ -932,7 +932,7 @@ async function Ht(n, e, t, s, i) {
|
|
|
932
932
|
}
|
|
933
933
|
async function $t(n, e) {
|
|
934
934
|
const t = WebAssembly.compile(Uint8Array.from(atob(Qi), (u) => u.charCodeAt(0)).buffer), s = Math.floor(e * Y / cr) + 2, i = new WebAssembly.Memory({ initial: s, maximum: s }), a = (await WebAssembly.instantiate(await t, { env: { memory: i, expf: qn } })).exports.s, r = new Uint8Array(i.buffer);
|
|
935
|
-
r.set(n.
|
|
935
|
+
r.set(n.subarray(0, e * Y), 0);
|
|
936
936
|
const A = a(0, e);
|
|
937
937
|
return A ? (console.error("splat data parser failed:", A), new Uint8Array(0)) : r.slice(0, e * Y);
|
|
938
938
|
}
|
|
@@ -970,7 +970,7 @@ async function Qc(n) {
|
|
|
970
970
|
}
|
|
971
971
|
l = null, m = C.slice(p.headerLength), n.rowLength = p.rowLength, n.dataShDegree = p.shDegree, n.modelSplatCount = p.vertexCount, n.splatData = new Uint8Array(Math.min(n.modelSplatCount, n.fetchLimit) * 32);
|
|
972
972
|
}
|
|
973
|
-
c + m.byteLength < n.rowLength ? (u.set(m, c), c += m.byteLength) : (c = await e(p, n, c, u, m), c && u.set(m.
|
|
973
|
+
c + m.byteLength < n.rowLength ? (u.set(m, c), c += m.byteLength) : (c = await e(p, n, c, u, m), c && u.set(m.subarray(m.byteLength - c), 0)), n.downloadSplatCount >= n.fetchLimit && n.abortController.abort();
|
|
974
974
|
}
|
|
975
975
|
} catch (i) {
|
|
976
976
|
i.name === "AbortError" ? (n.opts.url, n.status === N.Fetching && (n.status = N.FetchAborted)) : (console.error(i), n.status === N.Fetching && (n.status = N.FetchFailed));
|
|
@@ -980,7 +980,7 @@ async function Qc(n) {
|
|
|
980
980
|
async function e(i, o, a, r, A) {
|
|
981
981
|
return new Promise(async (u) => {
|
|
982
982
|
let c = (a + A.byteLength) / o.rowLength | 0, l = (a + A.byteLength) % o.rowLength, p;
|
|
983
|
-
a ? (p = new Uint8Array(c * o.rowLength), p.set(r.
|
|
983
|
+
a ? (p = new Uint8Array(c * o.rowLength), p.set(r.subarray(0, a), 0), p.set(A.subarray(0, A.byteLength - l), a)) : p = A.slice(0, c * o.rowLength), o.downloadSplatCount + c > o.fetchLimit && (c = o.fetchLimit - o.downloadSplatCount, l = 0);
|
|
984
984
|
const f = async () => {
|
|
985
985
|
if (c > Wt) {
|
|
986
986
|
const m = await t(i, p, Wt);
|
|
@@ -996,23 +996,23 @@ async function Qc(n) {
|
|
|
996
996
|
async function t(i, o, a) {
|
|
997
997
|
const r = new Uint8Array(a * Sn), A = new Float32Array(o.buffer), u = new Float32Array(r.buffer);
|
|
998
998
|
for (let c = 0; c < a; c++)
|
|
999
|
-
u[c * 8 + 0] = A[(c * n.rowLength + i.offsets.x) / 4], u[c * 8 + 1] = A[(c * n.rowLength + i.offsets.y) / 4], u[c * 8 + 2] = A[(c * n.rowLength + i.offsets.z) / 4], u[c * 8 + 3] = Math.exp(A[(c * n.rowLength + i.offsets.scale_0) / 4]), u[c * 8 + 4] = Math.exp(A[(c * n.rowLength + i.offsets.scale_1) / 4]), u[c * 8 + 5] = Math.exp(A[(c * n.rowLength + i.offsets.scale_2) / 4]), r[c * 32 + 24] =
|
|
999
|
+
u[c * 8 + 0] = A[(c * n.rowLength + i.offsets.x) / 4], u[c * 8 + 1] = A[(c * n.rowLength + i.offsets.y) / 4], u[c * 8 + 2] = A[(c * n.rowLength + i.offsets.z) / 4], u[c * 8 + 3] = Math.exp(A[(c * n.rowLength + i.offsets.scale_0) / 4]), u[c * 8 + 4] = Math.exp(A[(c * n.rowLength + i.offsets.scale_1) / 4]), u[c * 8 + 5] = Math.exp(A[(c * n.rowLength + i.offsets.scale_2) / 4]), r[c * 32 + 24] = K((0.5 + Ne * A[(c * n.rowLength + i.offsets.f_dc_0) / 4]) * 255), r[c * 32 + 25] = K((0.5 + Ne * A[(c * n.rowLength + i.offsets.f_dc_1) / 4]) * 255), r[c * 32 + 26] = K((0.5 + Ne * A[(c * n.rowLength + i.offsets.f_dc_2) / 4]) * 255), r[c * 32 + 27] = K(1 / (1 + Math.exp(-A[(c * n.rowLength + i.offsets.opacity) / 4])) * 255), r[c * 32 + 28] = K(A[(c * n.rowLength + i.offsets.rot_0) / 4] * 128 + 128), r[c * 32 + 29] = K(A[(c * n.rowLength + i.offsets.rot_1) / 4] * 128 + 128), r[c * 32 + 30] = K(A[(c * n.rowLength + i.offsets.rot_2) / 4] * 128 + 128), r[c * 32 + 31] = K(A[(c * n.rowLength + i.offsets.rot_3) / 4] * 128 + 128);
|
|
1000
1000
|
if (i.shDegree == 3) {
|
|
1001
1001
|
const l = new Uint8Array(a * 24 + 8), p = new Uint8Array(a * 21 + 8), f = new Uint32Array(2);
|
|
1002
1002
|
f[0] = a, f[1] = qe, l.set(new Uint8Array(f.buffer), 0);
|
|
1003
1003
|
const m = new Uint32Array(2);
|
|
1004
1004
|
m[0] = a, m[1] = Lt, p.set(new Uint8Array(m.buffer), 0);
|
|
1005
1005
|
for (let h = 0, g = 0; h < a; h++)
|
|
1006
|
-
for (let
|
|
1006
|
+
for (let Q = 0; Q < 8; Q++)
|
|
1007
1007
|
for (let y = 0; y < 3; y++)
|
|
1008
|
-
l[8 + g++] = gn(A[(h * n.rowLength + i.offsets["f_rest_" + (
|
|
1008
|
+
l[8 + g++] = gn(A[(h * n.rowLength + i.offsets["f_rest_" + (Q + y * 15)]) / 4]);
|
|
1009
1009
|
for (let h = 0, g = 0; h < a; h++)
|
|
1010
|
-
for (let
|
|
1010
|
+
for (let Q = 8; Q < 15; Q++)
|
|
1011
1011
|
for (let y = 0; y < 3; y++)
|
|
1012
|
-
p[8 + g++] = gn(A[(h * n.rowLength + i.offsets["f_rest_" + (
|
|
1013
|
-
const C = await
|
|
1012
|
+
p[8 + g++] = gn(A[(h * n.rowLength + i.offsets["f_rest_" + (Q + y * 15)]) / 4]);
|
|
1013
|
+
const C = await De(l);
|
|
1014
1014
|
n.sh12Data.push(C.datas);
|
|
1015
|
-
const d = await
|
|
1015
|
+
const d = await De(p);
|
|
1016
1016
|
n.sh3Data.push(d.datas);
|
|
1017
1017
|
} else if (i.shDegree == 2) {
|
|
1018
1018
|
const l = new Uint8Array(a * 24 + 8), p = new Uint32Array(2);
|
|
@@ -1021,7 +1021,7 @@ async function Qc(n) {
|
|
|
1021
1021
|
for (let d = 0; d < 8; d++)
|
|
1022
1022
|
for (let h = 0; h < 3; h++)
|
|
1023
1023
|
l[8 + C++] = gn(A[(m * n.rowLength + i.offsets["f_rest_" + (d + h * 8)]) / 4]);
|
|
1024
|
-
const f = await
|
|
1024
|
+
const f = await De(l);
|
|
1025
1025
|
n.sh12Data.push(f.datas);
|
|
1026
1026
|
} else if (i.shDegree == 1) {
|
|
1027
1027
|
const l = new Uint8Array(a * 9 + 8), p = new Uint32Array(2);
|
|
@@ -1030,7 +1030,7 @@ async function Qc(n) {
|
|
|
1030
1030
|
for (let d = 0; d < 3; d++)
|
|
1031
1031
|
for (let h = 0; h < 3; h++)
|
|
1032
1032
|
l[8 + C++] = gn(A[(m * n.rowLength + i.offsets["f_rest_" + (d + h * 3)]) / 4]);
|
|
1033
|
-
const f = await
|
|
1033
|
+
const f = await De(l);
|
|
1034
1034
|
n.sh12Data.push(f.datas);
|
|
1035
1035
|
}
|
|
1036
1036
|
return await $t(r, a);
|
|
@@ -1058,8 +1058,8 @@ async function Qc(n) {
|
|
|
1058
1058
|
};
|
|
1059
1059
|
for (let C of o.slice(0, r).split(`
|
|
1060
1060
|
`).filter((d) => d.startsWith("property "))) {
|
|
1061
|
-
const [d, h, g] = C.split(" "),
|
|
1062
|
-
l[g] =
|
|
1061
|
+
const [d, h, g] = C.split(" "), Q = p[h] || "getInt8";
|
|
1062
|
+
l[g] = Q, c[g] = u, u += parseInt(Q.replace(/[^\d]/g, "")) / 8;
|
|
1063
1063
|
}
|
|
1064
1064
|
let f = 0;
|
|
1065
1065
|
l.f_rest_44 ? f = 3 : l.f_rest_23 ? f = 2 : l.f_rest_8 && (f = 1);
|
|
@@ -1075,7 +1075,7 @@ async function Qc(n) {
|
|
|
1075
1075
|
function ra(n, e) {
|
|
1076
1076
|
let t = e.byteLength / Y;
|
|
1077
1077
|
const s = Math.min(n.fetchLimit, n.modelSplatCount);
|
|
1078
|
-
n.dataSplatCount + t > s ? (t = s - n.dataSplatCount, n.splatData.set(e.
|
|
1078
|
+
n.dataSplatCount + t > s ? (t = s - n.dataSplatCount, n.splatData.set(e.subarray(0, t * Y), n.dataSplatCount * Y)) : n.splatData.set(e, n.dataSplatCount * Y);
|
|
1079
1079
|
const i = new Float32Array(e.buffer);
|
|
1080
1080
|
for (let a = 0, r = 0, A = 0, u = 0; a < t; a++)
|
|
1081
1081
|
r = i[a * 8], A = i[a * 8 + 1], u = i[a * 8 + 2], n.minX = Math.min(n.minX, r), n.maxX = Math.max(n.maxX, r), n.minY = Math.min(n.minY, A), n.maxY = Math.max(n.maxY, A), n.minZ = Math.min(n.minZ, u), n.maxZ = Math.max(n.maxZ, u);
|
|
@@ -1105,7 +1105,7 @@ async function xc(n) {
|
|
|
1105
1105
|
for (; ; ) {
|
|
1106
1106
|
let { done: l, value: p } = await a.read();
|
|
1107
1107
|
if (l) break;
|
|
1108
|
-
c + p.byteLength < n.rowLength ? (u.set(p, c), c += p.byteLength, e += p.length, n.downloadSize = e) : (c = await t(n, c, u, p), c && u.set(p.
|
|
1108
|
+
c + p.byteLength < n.rowLength ? (u.set(p, c), c += p.byteLength, e += p.length, n.downloadSize = e) : (c = await t(n, c, u, p), c && u.set(p.subarray(p.byteLength - c), 0)), n.downloadSplatCount >= n.fetchLimit && n.abortController.abort();
|
|
1109
1109
|
}
|
|
1110
1110
|
} catch (s) {
|
|
1111
1111
|
s.name === "AbortError" ? (n.opts.url, n.status === N.Fetching && (n.status = N.FetchAborted)) : (console.error(s), n.status === N.Fetching && (n.status = N.FetchFailed));
|
|
@@ -1115,7 +1115,7 @@ async function xc(n) {
|
|
|
1115
1115
|
async function t(s, i, o, a) {
|
|
1116
1116
|
return new Promise(async (r) => {
|
|
1117
1117
|
let A = (i + a.byteLength) / s.rowLength | 0, u = (i + a.byteLength) % s.rowLength, c;
|
|
1118
|
-
i ? (c = new Uint8Array(A * s.rowLength), c.set(o.
|
|
1118
|
+
i ? (c = new Uint8Array(A * s.rowLength), c.set(o.subarray(0, i), 0), c.set(a.subarray(0, a.byteLength - u), i)) : c = a.slice(0, A * s.rowLength), s.downloadSplatCount + A > s.fetchLimit && (A = s.fetchLimit - s.downloadSplatCount, u = 0);
|
|
1119
1119
|
const l = async () => {
|
|
1120
1120
|
if (A > It) {
|
|
1121
1121
|
const p = await $t(c, It);
|
|
@@ -1132,7 +1132,7 @@ async function xc(n) {
|
|
|
1132
1132
|
function Aa(n, e) {
|
|
1133
1133
|
let t = e.byteLength / Y;
|
|
1134
1134
|
const s = Math.min(n.fetchLimit, n.modelSplatCount);
|
|
1135
|
-
n.dataSplatCount + t > s ? (t = s - n.dataSplatCount, n.splatData.set(e.
|
|
1135
|
+
n.dataSplatCount + t > s ? (t = s - n.dataSplatCount, n.splatData.set(e.subarray(0, t * Y), n.dataSplatCount * Y)) : n.splatData.set(e, n.dataSplatCount * Y);
|
|
1136
1136
|
const i = new Float32Array(e.buffer);
|
|
1137
1137
|
for (let a = 0, r = 0, A = 0, u = 0; a < t; a++)
|
|
1138
1138
|
r = i[a * 8], A = i[a * 8 + 1], u = i[a * 8 + 2], n.minX = Math.min(n.minX, r), n.maxX = Math.max(n.maxX, r), n.minY = Math.min(n.minY, A), n.maxY = Math.max(n.maxY, A), n.minZ = Math.min(n.minZ, u), n.maxZ = Math.max(n.maxZ, u);
|
|
@@ -1166,20 +1166,20 @@ async function Sc(n) {
|
|
|
1166
1166
|
M += r[I].byteLength;
|
|
1167
1167
|
if (M < Ct)
|
|
1168
1168
|
continue;
|
|
1169
|
-
let
|
|
1169
|
+
let S = 0;
|
|
1170
1170
|
for (let I = 0; I < r.length; I++)
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
if (!
|
|
1171
|
+
S + r[I].byteLength < Ct ? (A.set(r[I], S), S += r[I].byteLength) : (A.set(r[I].subarray(0, Ct - S), S), g = new Uint8Array(r[I].slice(Ct - S)));
|
|
1172
|
+
const B = await Ec(A);
|
|
1173
|
+
if (!B) {
|
|
1174
1174
|
n.abortController.abort(), n.status === N.Fetching && (n.status = N.Invalid), console.error("invalid spx format");
|
|
1175
1175
|
continue;
|
|
1176
1176
|
}
|
|
1177
|
-
if (n.meta.autoCut > 1 && !vc(
|
|
1177
|
+
if (n.meta.autoCut > 1 && !vc(B)) {
|
|
1178
1178
|
n.abortController.abort(), n.status === N.Fetching && (n.status = N.Invalid), console.error("invalid LOD format");
|
|
1179
1179
|
continue;
|
|
1180
1180
|
}
|
|
1181
|
-
if (n.header =
|
|
1182
|
-
n.abortController.abort(), n.status = N.Invalid, console.error("Unrecognized format, creater id =",
|
|
1181
|
+
if (n.header = B, n.CompressionRatio = Gn(B.SplatCount, o), n.modelSplatCount = B.SplatCount, n.dataShDegree = B.ShDegree, n.aabbCenter = new v((B.MinX + B.MaxX) / 2, (B.MinY + B.MaxY) / 2, (B.MinZ + B.MaxZ) / 2), n.maxRadius = 0.5 * Math.sqrt(Math.pow(B.MaxX - B.MinX, 2) + Math.pow(B.MaxY - B.MinY, 2) + Math.pow(B.MaxZ - B.MinZ, 2)), n.metaMatrix && n.aabbCenter.applyMatrix4(n.metaMatrix), r = null, A = null, !Bc.includes(B.ExclusiveId)) {
|
|
1182
|
+
n.abortController.abort(), n.status = N.Invalid, console.error("Unrecognized format, creater id =", B.CreaterId, ", exclusive id =", B.ExclusiveId, B.Comment);
|
|
1183
1183
|
continue;
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
@@ -1189,60 +1189,60 @@ async function Sc(n) {
|
|
|
1189
1189
|
continue;
|
|
1190
1190
|
}
|
|
1191
1191
|
const M = new Uint8Array(c + g.byteLength);
|
|
1192
|
-
M.set(u.
|
|
1193
|
-
const
|
|
1194
|
-
C =
|
|
1192
|
+
M.set(u.subarray(0, c), 0), M.set(g, c), g = M.slice(4), c = 0, l = !0, m = [], f = 0;
|
|
1193
|
+
const S = new Int32Array(M.slice(0, 4).buffer)[0];
|
|
1194
|
+
C = S < 0, d = Math.abs(S) >> 28 >>> 0, p = Math.abs(S) << 4 >>> 4;
|
|
1195
1195
|
}
|
|
1196
|
-
let
|
|
1197
|
-
if (m.push(g),
|
|
1196
|
+
let Q = f + g.byteLength;
|
|
1197
|
+
if (m.push(g), Q < p) {
|
|
1198
1198
|
f += g.byteLength;
|
|
1199
1199
|
continue;
|
|
1200
1200
|
}
|
|
1201
|
-
for (;
|
|
1202
|
-
let M = new Uint8Array(p),
|
|
1201
|
+
for (; Q >= p; ) {
|
|
1202
|
+
let M = new Uint8Array(p), S = 0;
|
|
1203
1203
|
for (let I = 0; I < m.length; I++)
|
|
1204
|
-
|
|
1204
|
+
S + m[I].byteLength < p ? (M.set(m[I], S), S += m[I].byteLength) : (M.set(m[I].subarray(0, p - S), S), g = new Uint8Array(m[I].slice(p - S)));
|
|
1205
1205
|
C && (d === 0 ? M = await pr(M) : d === 1 ? M = await dc(M) : console.error("unsuported compress type:", d));
|
|
1206
|
-
const
|
|
1207
|
-
if (!
|
|
1208
|
-
console.error("spx block data parser failed. block format:",
|
|
1206
|
+
const B = await De(M, n.header);
|
|
1207
|
+
if (!B.success) {
|
|
1208
|
+
console.error("spx block data parser failed. block format:", B.blockFormat), n.abortController.abort(), n.status = N.Invalid;
|
|
1209
1209
|
break;
|
|
1210
1210
|
}
|
|
1211
|
-
if (
|
|
1212
|
-
n.downloadSplatCount +=
|
|
1213
|
-
else if (
|
|
1214
|
-
n.palettes =
|
|
1211
|
+
if (B.isSplat)
|
|
1212
|
+
n.downloadSplatCount += B.splatCount, Mc(n, B.datas);
|
|
1213
|
+
else if (B.palettes)
|
|
1214
|
+
n.palettes = B.palettes;
|
|
1215
1215
|
else {
|
|
1216
1216
|
const I = Math.min(n.fetchLimit, n.modelSplatCount);
|
|
1217
|
-
if (
|
|
1218
|
-
if (n.sh12Count +
|
|
1217
|
+
if (B.isSh23) {
|
|
1218
|
+
if (n.sh12Count + B.splatCount > I) {
|
|
1219
1219
|
const x = I - n.sh12Count;
|
|
1220
|
-
n.sh12Data.push(
|
|
1220
|
+
n.sh12Data.push(B.datas.slice(0, x * 16)), n.sh12Count += x;
|
|
1221
1221
|
} else
|
|
1222
|
-
n.sh12Data.push(
|
|
1223
|
-
if (n.sh3Count +
|
|
1222
|
+
n.sh12Data.push(B.datas), n.sh12Count += B.splatCount;
|
|
1223
|
+
if (n.sh3Count + B.splatCount > I) {
|
|
1224
1224
|
const x = I - n.sh3Count;
|
|
1225
|
-
n.sh3Data.push(
|
|
1225
|
+
n.sh3Data.push(B.dataSh3.slice(0, x * 16)), n.sh3Count += x;
|
|
1226
1226
|
} else
|
|
1227
|
-
n.sh3Data.push(
|
|
1228
|
-
} else if (
|
|
1229
|
-
if (n.sh3Count +
|
|
1227
|
+
n.sh3Data.push(B.dataSh3), n.sh3Count += B.splatCount;
|
|
1228
|
+
} else if (B.isSh3)
|
|
1229
|
+
if (n.sh3Count + B.splatCount > I) {
|
|
1230
1230
|
const x = I - n.sh3Count;
|
|
1231
|
-
n.sh3Data.push(
|
|
1231
|
+
n.sh3Data.push(B.datas.slice(0, x * 16)), n.sh3Count += x;
|
|
1232
1232
|
} else
|
|
1233
|
-
n.sh3Data.push(
|
|
1234
|
-
else if (n.sh12Count +
|
|
1233
|
+
n.sh3Data.push(B.datas), n.sh3Count += B.splatCount;
|
|
1234
|
+
else if (n.sh12Count + B.splatCount > I) {
|
|
1235
1235
|
const x = I - n.sh12Count;
|
|
1236
|
-
n.sh12Data.push(
|
|
1236
|
+
n.sh12Data.push(B.datas.slice(0, x * 16)), n.sh12Count += x;
|
|
1237
1237
|
} else
|
|
1238
|
-
n.sh12Data.push(
|
|
1238
|
+
n.sh12Data.push(B.datas), n.sh12Count += B.splatCount;
|
|
1239
1239
|
}
|
|
1240
1240
|
if (g.byteLength < 4) {
|
|
1241
1241
|
u.set(g, 0), c = g.byteLength, l = !1;
|
|
1242
1242
|
break;
|
|
1243
1243
|
} else {
|
|
1244
1244
|
const I = new Int32Array(g.slice(0, 4).buffer)[0];
|
|
1245
|
-
C = I < 0, d = Math.abs(I) >> 28 >>> 0, p = Math.abs(I) << 4 >>> 4, g = g.slice(4),
|
|
1245
|
+
C = I < 0, d = Math.abs(I) >> 28 >>> 0, p = Math.abs(I) << 4 >>> 4, g = g.slice(4), Q = g.byteLength, m = [g], f = g.byteLength;
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
1248
|
const y = n.fetchLimit;
|
|
@@ -1268,9 +1268,9 @@ function Mc(n, e) {
|
|
|
1268
1268
|
const d = new Uint8Array((n.watermarkCount + i) * Y);
|
|
1269
1269
|
d.set(n.watermarkData, 0), n.watermarkData = d;
|
|
1270
1270
|
}
|
|
1271
|
-
n.watermarkData.set(e.
|
|
1271
|
+
n.watermarkData.set(e.subarray(p * 32, p * 32 + 32), n.watermarkCount++ * Y);
|
|
1272
1272
|
} else
|
|
1273
|
-
n.splatData.set(e.
|
|
1273
|
+
n.splatData.set(e.subarray(p * 32, p * 32 + 32), n.dataSplatCount++ * Y);
|
|
1274
1274
|
const l = n.header.MinTopY || 0;
|
|
1275
1275
|
n.currentRadius = Math.sqrt(n.maxX * n.maxX + l * l + n.maxZ * n.maxZ);
|
|
1276
1276
|
return;
|
|
@@ -1299,8 +1299,8 @@ function Mc(n, e) {
|
|
|
1299
1299
|
y.set(d.splatData, 0), d.splatData = y;
|
|
1300
1300
|
}
|
|
1301
1301
|
d.minX = Math.min(d.minX, c), d.maxX = Math.max(d.maxX, c), d.minY = Math.min(d.minY, l), d.maxY = Math.max(d.maxY, l), d.minZ = Math.min(d.minZ, p), d.maxZ = Math.max(d.maxZ, p), d.center = new v((d.maxX + d.minX) / 2, (d.maxY + d.minY) / 2, (d.maxZ + d.minZ) / 2), n.metaMatrix && d.center.applyMatrix4(n.metaMatrix);
|
|
1302
|
-
const h = d.maxX - d.minX, g = d.maxY - d.minY,
|
|
1303
|
-
d.radius = Math.sqrt(h * h + g * g +
|
|
1302
|
+
const h = d.maxX - d.minX, g = d.maxY - d.minY, Q = d.maxZ - d.minZ;
|
|
1303
|
+
d.radius = Math.sqrt(h * h + g * g + Q * Q) / 2, n.metaMatrix && (d.radius *= n.metaMatrix.getMaxScaleOnAxis()), d.splatData.set(e.slice(A * Y, A * Y + Y), d.splatCount++ * Y);
|
|
1304
1304
|
}
|
|
1305
1305
|
n.dataSplatCount++;
|
|
1306
1306
|
}
|
|
@@ -1308,7 +1308,7 @@ function Mc(n, e) {
|
|
|
1308
1308
|
function vc(n) {
|
|
1309
1309
|
return ((n?.Flag1 || 0) & 1) > 0;
|
|
1310
1310
|
}
|
|
1311
|
-
const
|
|
1311
|
+
const X = me ? 20480 : 51200, fs = 16, ca = 511;
|
|
1312
1312
|
async function Dc(n) {
|
|
1313
1313
|
try {
|
|
1314
1314
|
n.status = N.Fetching;
|
|
@@ -1338,38 +1338,38 @@ async function Dc(n) {
|
|
|
1338
1338
|
n.status === N.Fetching && (n.status = N.FetchDone);
|
|
1339
1339
|
}
|
|
1340
1340
|
async function e(i, o, a) {
|
|
1341
|
-
const r = i.numPoints * 9, A = i.numPoints, u = i.numPoints * 3, c = i.numPoints * 3, l = i.numPoints * (i.version == 2 ? 3 : 4), p = fs, f = p + r, m = f + A, C = m + u, d = C + c, h = d + l, g = Math.min(i.numPoints, o.fetchLimit),
|
|
1342
|
-
for (let y = 0; y <
|
|
1343
|
-
let M = y <
|
|
1341
|
+
const r = i.numPoints * 9, A = i.numPoints, u = i.numPoints * 3, c = i.numPoints * 3, l = i.numPoints * (i.version == 2 ? 3 : 4), p = fs, f = p + r, m = f + A, C = m + u, d = C + c, h = d + l, g = Math.min(i.numPoints, o.fetchLimit), Q = Math.ceil(g / X);
|
|
1342
|
+
for (let y = 0; y < Q; y++) {
|
|
1343
|
+
let M = y < Q - 1 ? X : g - y * X;
|
|
1344
1344
|
o.dataSplatCount + M > o.fetchLimit && (M = o.fetchLimit - o.dataSplatCount);
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1345
|
+
const S = new Uint8Array(M * 20 + 8), B = new Uint32Array(2);
|
|
1346
|
+
B[0] = M, B[1] = RA, S.set(new Uint8Array(B.buffer), 0);
|
|
1347
1347
|
let I = 8;
|
|
1348
|
-
for (let
|
|
1349
|
-
|
|
1350
|
-
for (let
|
|
1351
|
-
|
|
1352
|
-
for (let
|
|
1353
|
-
|
|
1354
|
-
for (let
|
|
1355
|
-
|
|
1356
|
-
for (let
|
|
1357
|
-
|
|
1358
|
-
for (let
|
|
1359
|
-
|
|
1360
|
-
for (let
|
|
1361
|
-
|
|
1362
|
-
for (let
|
|
1363
|
-
|
|
1364
|
-
for (let
|
|
1365
|
-
|
|
1348
|
+
for (let b = 0; b < M; b++)
|
|
1349
|
+
S[I++] = a[p + (y * X + b) * 9 + 0], S[I++] = a[p + (y * X + b) * 9 + 1], S[I++] = a[p + (y * X + b) * 9 + 2];
|
|
1350
|
+
for (let b = 0; b < M; b++)
|
|
1351
|
+
S[I++] = a[p + (y * X + b) * 9 + 3], S[I++] = a[p + (y * X + b) * 9 + 4], S[I++] = a[p + (y * X + b) * 9 + 5];
|
|
1352
|
+
for (let b = 0; b < M; b++)
|
|
1353
|
+
S[I++] = a[p + (y * X + b) * 9 + 6], S[I++] = a[p + (y * X + b) * 9 + 7], S[I++] = a[p + (y * X + b) * 9 + 8];
|
|
1354
|
+
for (let b = 0; b < M; b++)
|
|
1355
|
+
S[I++] = a[C + (y * X + b) * 3];
|
|
1356
|
+
for (let b = 0; b < M; b++)
|
|
1357
|
+
S[I++] = a[C + (y * X + b) * 3 + 1];
|
|
1358
|
+
for (let b = 0; b < M; b++)
|
|
1359
|
+
S[I++] = a[C + (y * X + b) * 3 + 2];
|
|
1360
|
+
for (let b = 0; b < M; b++)
|
|
1361
|
+
S[I++] = ps(a[m + (y * X + b) * 3]);
|
|
1362
|
+
for (let b = 0; b < M; b++)
|
|
1363
|
+
S[I++] = ps(a[m + (y * X + b) * 3 + 1]);
|
|
1364
|
+
for (let b = 0; b < M; b++)
|
|
1365
|
+
S[I++] = ps(a[m + (y * X + b) * 3 + 2]);
|
|
1366
1366
|
const x = [];
|
|
1367
1367
|
if (i.version == 2)
|
|
1368
|
-
for (let
|
|
1369
|
-
|
|
1368
|
+
for (let b = 0, T = 0, F = 0, k = 0; b < M; b++)
|
|
1369
|
+
S[I++] = a[f + (y * X + b)], T = a[d + (y * X + b) * 3 + 0], F = a[d + (y * X + b) * 3 + 1], k = a[d + (y * X + b) * 3 + 2], x.push(kc(T, F, k));
|
|
1370
1370
|
else
|
|
1371
|
-
for (let
|
|
1372
|
-
|
|
1371
|
+
for (let b = 0, T = 0, F = 0, k = 0, L = 0; b < M; b++) {
|
|
1372
|
+
S[I++] = a[f + (y * X + b)], T = a[d + (y * X + b) * 4 + 0], F = a[d + (y * X + b) * 4 + 1], k = a[d + (y * X + b) * 4 + 2], L = a[d + (y * X + b) * 4 + 3];
|
|
1373
1373
|
const P = T | F << 8 | k << 16 | L << 24, U = P >>> 30;
|
|
1374
1374
|
let G = P, D = 0, _ = [];
|
|
1375
1375
|
for (let H = 3; H >= 0; H--)
|
|
@@ -1379,44 +1379,44 @@ async function Dc(n) {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
_[U] = Math.sqrt(Math.max(1 - D, 0));
|
|
1381
1381
|
for (let H = 0; H < 4; H++)
|
|
1382
|
-
_[H] =
|
|
1382
|
+
_[H] = K(_[H] * 128 + 128);
|
|
1383
1383
|
x.push(_);
|
|
1384
1384
|
}
|
|
1385
|
-
for (let
|
|
1386
|
-
|
|
1387
|
-
for (let
|
|
1388
|
-
|
|
1389
|
-
for (let
|
|
1390
|
-
|
|
1391
|
-
for (let
|
|
1392
|
-
|
|
1393
|
-
const
|
|
1394
|
-
if (t(i, o,
|
|
1395
|
-
const
|
|
1396
|
-
T[0] = M, T[1] = qt,
|
|
1385
|
+
for (let b = 0; b < M; b++)
|
|
1386
|
+
S[I++] = x[b][0];
|
|
1387
|
+
for (let b = 0; b < M; b++)
|
|
1388
|
+
S[I++] = x[b][1];
|
|
1389
|
+
for (let b = 0; b < M; b++)
|
|
1390
|
+
S[I++] = x[b][2];
|
|
1391
|
+
for (let b = 0; b < M; b++)
|
|
1392
|
+
S[I++] = x[b][3];
|
|
1393
|
+
const E = await De(S);
|
|
1394
|
+
if (t(i, o, E.datas), i.shDegree === 1) {
|
|
1395
|
+
const b = new Uint8Array(M * 9 + 8), T = new Uint32Array(2);
|
|
1396
|
+
T[0] = M, T[1] = qt, b.set(new Uint8Array(T.buffer), 0);
|
|
1397
1397
|
for (let k = 0, L = 8; k < M; k++)
|
|
1398
|
-
|
|
1399
|
-
const F = await
|
|
1398
|
+
b.set(a.subarray(h + (y * X + k) * 9, h + (y * X + k) * 9 + 9), L), L += 9;
|
|
1399
|
+
const F = await De(b);
|
|
1400
1400
|
o.sh12Data.push(F.datas);
|
|
1401
1401
|
} else if (i.shDegree === 2) {
|
|
1402
|
-
const
|
|
1403
|
-
T[0] = M, T[1] = qe,
|
|
1402
|
+
const b = new Uint8Array(M * 24 + 8), T = new Uint32Array(2);
|
|
1403
|
+
T[0] = M, T[1] = qe, b.set(new Uint8Array(T.buffer), 0);
|
|
1404
1404
|
for (let k = 0, L = 8; k < M; k++)
|
|
1405
|
-
|
|
1406
|
-
const F = await
|
|
1405
|
+
b.set(a.subarray(h + (y * X + k) * 24, h + (y * X + k) * 24 + 24), L), L += 24;
|
|
1406
|
+
const F = await De(b);
|
|
1407
1407
|
o.sh12Data.push(F.datas);
|
|
1408
1408
|
} else if (i.shDegree === 3) {
|
|
1409
|
-
const
|
|
1410
|
-
T[0] = M, T[1] = qe,
|
|
1409
|
+
const b = new Uint8Array(M * 24 + 8), T = new Uint32Array(2);
|
|
1410
|
+
T[0] = M, T[1] = qe, b.set(new Uint8Array(T.buffer), 0);
|
|
1411
1411
|
for (let U = 0, G = 8; U < M; U++)
|
|
1412
|
-
|
|
1413
|
-
const F = await
|
|
1412
|
+
b.set(a.subarray(h + (y * X + U) * 45, h + (y * X + U) * 45 + 24), G), G += 24;
|
|
1413
|
+
const F = await De(b);
|
|
1414
1414
|
o.sh12Data.push(F.datas);
|
|
1415
1415
|
const k = new Uint8Array(M * 21 + 8), L = new Uint32Array(2);
|
|
1416
1416
|
L[0] = M, L[1] = Lt, k.set(new Uint8Array(L.buffer), 0);
|
|
1417
1417
|
for (let U = 0, G = 8; U < M; U++)
|
|
1418
|
-
k.set(a.
|
|
1419
|
-
const P = await
|
|
1418
|
+
k.set(a.subarray(h + (y * X + U) * 45 + 24, h + (y * X + U) * 45 + 45), G), G += 21;
|
|
1419
|
+
const P = await De(k);
|
|
1420
1420
|
o.sh3Data.push(P.datas);
|
|
1421
1421
|
}
|
|
1422
1422
|
if (o.dataSplatCount >= o.fetchLimit)
|
|
@@ -1426,7 +1426,7 @@ async function Dc(n) {
|
|
|
1426
1426
|
function t(i, o, a) {
|
|
1427
1427
|
let r = a.byteLength / Y;
|
|
1428
1428
|
const A = Math.min(o.fetchLimit, i.numPoints);
|
|
1429
|
-
o.dataSplatCount + r > A ? (r = A - o.dataSplatCount, o.splatData.set(a.
|
|
1429
|
+
o.dataSplatCount + r > A ? (r = A - o.dataSplatCount, o.splatData.set(a.subarray(0, r * Y), o.dataSplatCount * Y)) : o.splatData.set(a, o.dataSplatCount * Y);
|
|
1430
1430
|
const u = new Float32Array(a.buffer);
|
|
1431
1431
|
for (let l = 0, p = 0, f = 0, m = 0; l < r; l++)
|
|
1432
1432
|
p = u[l * 8], f = u[l * 8 + 1], m = u[l * 8 + 2], o.minX = Math.min(o.minX, p), o.maxX = Math.max(o.maxX, p), o.minY = Math.min(o.minY, f), o.maxY = Math.max(o.maxY, f), o.minZ = Math.min(o.minZ, m), o.maxZ = Math.max(o.maxZ, m);
|
|
@@ -1448,13 +1448,13 @@ async function Dc(n) {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
function ps(n) {
|
|
1450
1450
|
const e = (n - 127.5) / 38.25;
|
|
1451
|
-
return
|
|
1451
|
+
return K((0.5 + Ne * e) * 255);
|
|
1452
1452
|
}
|
|
1453
1453
|
function kc(n, e, t) {
|
|
1454
1454
|
const s = n / 127.5 - 1, i = e / 127.5 - 1, o = t / 127.5 - 1, a = Math.sqrt(Math.max(0, 1 - (s * s + i * i + o * o)));
|
|
1455
|
-
return [
|
|
1455
|
+
return [K(a * 128 + 128), K(s * 128 + 128), K(i * 128 + 128), K(o * 128 + 128)];
|
|
1456
1456
|
}
|
|
1457
|
-
async function
|
|
1457
|
+
async function Xe(n, e) {
|
|
1458
1458
|
if (!n) return new Uint8Array(0);
|
|
1459
1459
|
const t = new AbortController(), s = t.signal;
|
|
1460
1460
|
try {
|
|
@@ -1514,18 +1514,18 @@ async function Tc(n) {
|
|
|
1514
1514
|
s[s.length - 1] = d;
|
|
1515
1515
|
const h = s.join("/"), g = t.shN ? t.shN.files[1] : "shN_labels.webp";
|
|
1516
1516
|
s[s.length - 1] = g;
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1517
|
+
const Q = s.join("/"), [y, M, S, B, I, x, E] = await Promise.all([
|
|
1518
|
+
Xe(r),
|
|
1519
|
+
Xe(u),
|
|
1520
|
+
Xe(l),
|
|
1521
|
+
Xe(f),
|
|
1522
|
+
Xe(C),
|
|
1523
|
+
Xe(t.shN ? h : ""),
|
|
1524
|
+
Xe(t.shN ? Q : "")
|
|
1525
1525
|
]);
|
|
1526
|
-
i.set(a, y), i.set(A, M), i.set(c,
|
|
1527
|
-
const
|
|
1528
|
-
n.fileSize =
|
|
1526
|
+
i.set(a, y), i.set(A, M), i.set(c, S), i.set(p, B), i.set(m, I), i.set(d, x), i.set(g, E);
|
|
1527
|
+
const b = JSON.stringify(t).length + y.length + M.length + S.length + B.length + I.length + x.length + E.length;
|
|
1528
|
+
n.fileSize = b, n.downloadSize = b, n.watermarkData = new Uint8Array(0), n.CompressionRatio = Gn(o, b), n.sogVersion = t.version ? t.version : 1, await ua(n, i, t);
|
|
1529
1529
|
}
|
|
1530
1530
|
} catch (e) {
|
|
1531
1531
|
e.name === "AbortError" ? (n.opts.url, n.status === N.Fetching && (n.status = N.FetchAborted)) : (console.error(e), n.status === N.Fetching && (n.status = N.FetchFailed));
|
|
@@ -1540,103 +1540,103 @@ async function ua(n, e, t) {
|
|
|
1540
1540
|
if (a > 0 && !s) {
|
|
1541
1541
|
const y = new Uint8Array(f.length);
|
|
1542
1542
|
for (let M = 0; M < f.length; M++)
|
|
1543
|
-
M % 4 < 3 && (y[M] =
|
|
1543
|
+
M % 4 < 3 && (y[M] = K(Math.round(t.shN.codebook[f[M]] * 128) + 128));
|
|
1544
1544
|
n.palettes = y;
|
|
1545
1545
|
}
|
|
1546
1546
|
for (; o > n.dataSplatCount; ) {
|
|
1547
|
-
const y = s ? await
|
|
1548
|
-
n.splatData.set(y.
|
|
1547
|
+
const y = s ? await Q(n.dataSplatCount) : await d(n.dataSplatCount);
|
|
1548
|
+
n.splatData.set(y.subarray(0), n.dataSplatCount * Y), h(n, y), n.dataSplatCount += y.byteLength / Y, n.downloadSplatCount = n.dataSplatCount;
|
|
1549
1549
|
}
|
|
1550
1550
|
async function d(y) {
|
|
1551
|
-
const M = Math.min(y + la, o),
|
|
1552
|
-
for (let
|
|
1553
|
-
let T = (u[
|
|
1551
|
+
const M = Math.min(y + la, o), S = M - y, B = new Uint8Array(S * Sn), I = new Float32Array(B.buffer);
|
|
1552
|
+
for (let E = y, b = 0; E < M; E++) {
|
|
1553
|
+
let T = (u[E * 4 + 0] << 8 | A[E * 4 + 0]) / 65535, F = (u[E * 4 + 1] << 8 | A[E * 4 + 1]) / 65535, k = (u[E * 4 + 2] << 8 | A[E * 4 + 2]) / 65535, L = t.means.mins[0] + (t.means.maxs[0] - t.means.mins[0]) * T, P = t.means.mins[1] + (t.means.maxs[1] - t.means.mins[1]) * F, U = t.means.mins[2] + (t.means.maxs[2] - t.means.mins[2]) * k;
|
|
1554
1554
|
L = Math.sign(L) * (Math.exp(Math.abs(L)) - 1), P = Math.sign(P) * (Math.exp(Math.abs(P)) - 1), U = Math.sign(U) * (Math.exp(Math.abs(U)) - 1);
|
|
1555
|
-
let G = Math.exp(t.scales.codebook[c[
|
|
1556
|
-
const { rw: H, rx: z, ry: W, rz: Z } = g(l[
|
|
1557
|
-
let te = t.sh0.codebook[p[
|
|
1558
|
-
I[
|
|
1555
|
+
let G = Math.exp(t.scales.codebook[c[E * 4 + 0]]), D = Math.exp(t.scales.codebook[c[E * 4 + 1]]), _ = Math.exp(t.scales.codebook[c[E * 4 + 2]]);
|
|
1556
|
+
const { rw: H, rx: z, ry: W, rz: Z } = g(l[E * 4], l[E * 4 + 1], l[E * 4 + 2], l[E * 4 + 3]);
|
|
1557
|
+
let te = t.sh0.codebook[p[E * 4 + 0]], $ = t.sh0.codebook[p[E * 4 + 1]], ye = t.sh0.codebook[p[E * 4 + 2]], Ie = p[E * 4 + 3];
|
|
1558
|
+
I[b * 8 + 0] = L, I[b * 8 + 1] = P, I[b * 8 + 2] = U, I[b * 8 + 3] = G, I[b * 8 + 4] = D, I[b * 8 + 5] = _, B[b * 32 + 24] = K((0.5 + Ne * te) * 255), B[b * 32 + 25] = K((0.5 + Ne * $) * 255), B[b * 32 + 26] = K((0.5 + Ne * ye) * 255), B[b * 32 + 27] = Ie, B[b * 32 + 28] = K(H * 128 + 128), B[b * 32 + 29] = K(z * 128 + 128), B[b * 32 + 30] = K(W * 128 + 128), B[b * 32 + 31] = K(Z * 128 + 128), b++;
|
|
1559
1559
|
}
|
|
1560
|
-
const x = await $t(
|
|
1560
|
+
const x = await $t(B, S);
|
|
1561
1561
|
if (a > 0)
|
|
1562
|
-
for (let
|
|
1563
|
-
x[
|
|
1562
|
+
for (let E = 0; E < S; E++)
|
|
1563
|
+
x[E * 32 + 12] = C[(E + y) * 4], x[E * 32 + 13] = C[(E + y) * 4 + 1];
|
|
1564
1564
|
return x;
|
|
1565
1565
|
}
|
|
1566
1566
|
function h(y, M) {
|
|
1567
|
-
const
|
|
1568
|
-
for (let x = 0,
|
|
1569
|
-
|
|
1567
|
+
const S = M.byteLength / Y, B = new Float32Array(M.buffer);
|
|
1568
|
+
for (let x = 0, E = 0, b = 0, T = 0; x < S; x++)
|
|
1569
|
+
E = B[x * 8], b = B[x * 8 + 1], T = B[x * 8 + 2], y.minX = Math.min(y.minX, E), y.maxX = Math.max(y.maxX, E), y.minY = Math.min(y.minY, b), y.maxY = Math.max(y.maxY, b), y.minZ = Math.min(y.minZ, T), y.maxZ = Math.max(y.maxZ, T);
|
|
1570
1570
|
const I = 0;
|
|
1571
1571
|
y.currentRadius = Math.sqrt(y.maxX * y.maxX + I * I + y.maxZ * y.maxZ), y.aabbCenter = new v((y.minX + y.maxX) / 2, (y.minY + y.maxY) / 2, (y.minZ + y.maxZ) / 2), y.maxRadius = 0.5 * Math.sqrt(Math.pow(y.maxX - y.minX, 2) + Math.pow(y.maxY - y.minY, 2) + Math.pow(y.maxZ - y.minZ, 2)), y.metaMatrix && y.aabbCenter.applyMatrix4(y.metaMatrix);
|
|
1572
1572
|
}
|
|
1573
|
-
function g(y, M,
|
|
1574
|
-
let I = (y / 255 - 0.5) * yt, x = (M / 255 - 0.5) * yt,
|
|
1575
|
-
return T == 0 ? (F =
|
|
1573
|
+
function g(y, M, S, B) {
|
|
1574
|
+
let I = (y / 255 - 0.5) * yt, x = (M / 255 - 0.5) * yt, E = (S / 255 - 0.5) * yt, b = Math.sqrt(Math.max(0, 1 - I * I - x * x - E * E)), T = B - 252, F, k, L, P;
|
|
1575
|
+
return T == 0 ? (F = b, k = I, L = x, P = E) : T == 1 ? (F = I, k = b, L = x, P = E) : T == 2 ? (F = I, k = x, L = b, P = E) : (F = I, k = x, L = E, P = b), { rw: F, rx: k, ry: L, rz: P };
|
|
1576
1576
|
}
|
|
1577
|
-
async function
|
|
1578
|
-
const M = Math.min(y + la, o),
|
|
1579
|
-
for (let x = y,
|
|
1580
|
-
let
|
|
1577
|
+
async function Q(y) {
|
|
1578
|
+
const M = Math.min(y + la, o), S = M - y, B = new Uint8Array(S * Sn), I = new Float32Array(B.buffer);
|
|
1579
|
+
for (let x = y, E = 0; x < M; x++) {
|
|
1580
|
+
let b = (u[x * 4 + 0] << 8 | A[x * 4 + 0]) / 65535, T = (u[x * 4 + 1] << 8 | A[x * 4 + 1]) / 65535, F = (u[x * 4 + 2] << 8 | A[x * 4 + 2]) / 65535, k = t.means.mins[0] + (t.means.maxs[0] - t.means.mins[0]) * b, L = t.means.mins[1] + (t.means.maxs[1] - t.means.mins[1]) * T, P = t.means.mins[2] + (t.means.maxs[2] - t.means.mins[2]) * F;
|
|
1581
1581
|
k = Math.sign(k) * (Math.exp(Math.abs(k)) - 1), L = Math.sign(L) * (Math.exp(Math.abs(L)) - 1), P = Math.sign(P) * (Math.exp(Math.abs(P)) - 1);
|
|
1582
1582
|
let U = c[x * 4 + 0] / 255, G = c[x * 4 + 1] / 255, D = c[x * 4 + 2] / 255;
|
|
1583
1583
|
U = Math.exp(t.scales.mins[0] + (t.scales.maxs[0] - t.scales.mins[0]) * U), G = Math.exp(t.scales.mins[1] + (t.scales.maxs[1] - t.scales.mins[1]) * G), D = Math.exp(t.scales.mins[2] + (t.scales.maxs[2] - t.scales.mins[2]) * D);
|
|
1584
|
-
let _ = (l[x * 4 + 0] / 255 - 0.5) * yt, H = (l[x * 4 + 1] / 255 - 0.5) * yt, z = (l[x * 4 + 2] / 255 - 0.5) * yt, W = Math.sqrt(Math.max(0, 1 - _ * _ - H * H - z * z)), Z = l[x * 4 + 3] - 252, te, $,
|
|
1585
|
-
Z == 0 ? (te = W, $ = _,
|
|
1584
|
+
let _ = (l[x * 4 + 0] / 255 - 0.5) * yt, H = (l[x * 4 + 1] / 255 - 0.5) * yt, z = (l[x * 4 + 2] / 255 - 0.5) * yt, W = Math.sqrt(Math.max(0, 1 - _ * _ - H * H - z * z)), Z = l[x * 4 + 3] - 252, te, $, ye, Ie;
|
|
1585
|
+
Z == 0 ? (te = W, $ = _, ye = H, Ie = z) : Z == 1 ? (te = _, $ = W, ye = H, Ie = z) : Z == 2 ? (te = _, $ = H, ye = W, Ie = z) : (te = _, $ = H, ye = z, Ie = W);
|
|
1586
1586
|
let tt = t.sh0.mins[0] + (t.sh0.maxs[0] - t.sh0.mins[0]) * (p[x * 4 + 0] / 255), nt = t.sh0.mins[1] + (t.sh0.maxs[1] - t.sh0.mins[1]) * (p[x * 4 + 1] / 255), V = t.sh0.mins[2] + (t.sh0.maxs[2] - t.sh0.mins[2]) * (p[x * 4 + 2] / 255), j = t.sh0.mins[3] + (t.sh0.maxs[3] - t.sh0.mins[3]) * (p[x * 4 + 3] / 255);
|
|
1587
|
-
I[
|
|
1587
|
+
I[E * 8 + 0] = k, I[E * 8 + 1] = L, I[E * 8 + 2] = P, I[E * 8 + 3] = U, I[E * 8 + 4] = G, I[E * 8 + 5] = D, B[E * 32 + 24] = K((0.5 + Ne * tt) * 255), B[E * 32 + 25] = K((0.5 + Ne * nt) * 255), B[E * 32 + 26] = K((0.5 + Ne * V) * 255), B[E * 32 + 27] = K(1 / (1 + Math.exp(-j)) * 255), B[E * 32 + 28] = K(te * 128 + 128), B[E * 32 + 29] = K($ * 128 + 128), B[E * 32 + 30] = K(ye * 128 + 128), B[E * 32 + 31] = K(Ie * 128 + 128), E++;
|
|
1588
1588
|
}
|
|
1589
1589
|
if (a > 0) {
|
|
1590
1590
|
const x = new Uint32Array(2);
|
|
1591
|
-
x[0] =
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
const T = new Uint8Array(8 +
|
|
1597
|
-
T.set(new Uint8Array(
|
|
1591
|
+
x[0] = S, x[1] = qe;
|
|
1592
|
+
const E = new Uint8Array(8 + S * 24);
|
|
1593
|
+
E.set(new Uint8Array(x.buffer), 0);
|
|
1594
|
+
const b = new Uint32Array(2);
|
|
1595
|
+
b[0] = S, b[1] = Lt;
|
|
1596
|
+
const T = new Uint8Array(8 + S * 21);
|
|
1597
|
+
T.set(new Uint8Array(b.buffer), 0);
|
|
1598
1598
|
for (let L = y, P = 0; L < M; L++) {
|
|
1599
1599
|
const U = C[L * 4 + 0] + (C[L * 4 + 1] << 8), G = (U & 63) * 15, _ = (U >> 6) * m + G, H = new Uint8Array(9), z = new Uint8Array(15), W = new Uint8Array(21);
|
|
1600
1600
|
let Z;
|
|
1601
1601
|
for (let te = 0; te < 3; te++) {
|
|
1602
1602
|
for (let $ = 0; $ < 3; $++)
|
|
1603
|
-
Z = (t.shN.maxs - t.shN.mins) * f[(_ + $) * 4 + te] / 255 + t.shN.mins, H[$ * 3 + te] =
|
|
1603
|
+
Z = (t.shN.maxs - t.shN.mins) * f[(_ + $) * 4 + te] / 255 + t.shN.mins, H[$ * 3 + te] = K(Math.round(Z * 128) + 128);
|
|
1604
1604
|
for (let $ = 0; $ < 5; $++)
|
|
1605
|
-
Z = (t.shN.maxs - t.shN.mins) * f[(_ + 3 + $) * 4 + te] / 255 + t.shN.mins, z[$ * 3 + te] =
|
|
1605
|
+
Z = (t.shN.maxs - t.shN.mins) * f[(_ + 3 + $) * 4 + te] / 255 + t.shN.mins, z[$ * 3 + te] = K(Math.round(Z * 128) + 128);
|
|
1606
1606
|
for (let $ = 0; $ < 7; $++)
|
|
1607
|
-
Z = (t.shN.maxs - t.shN.mins) * f[(_ + 8 + $) * 4 + te] / 255 + t.shN.mins, W[$ * 3 + te] =
|
|
1607
|
+
Z = (t.shN.maxs - t.shN.mins) * f[(_ + 8 + $) * 4 + te] / 255 + t.shN.mins, W[$ * 3 + te] = K(Math.round(Z * 128) + 128);
|
|
1608
1608
|
}
|
|
1609
|
-
|
|
1609
|
+
E.set(H, 8 + P * 24), E.set(z, 8 + P * 24 + 9), T.set(W, 8 + P * 21), P++;
|
|
1610
1610
|
}
|
|
1611
|
-
const F = await
|
|
1611
|
+
const F = await De(E);
|
|
1612
1612
|
n.sh12Data.push(F.datas);
|
|
1613
|
-
const k = await
|
|
1613
|
+
const k = await De(T);
|
|
1614
1614
|
n.sh3Data.push(k.datas);
|
|
1615
1615
|
}
|
|
1616
|
-
return await $t(
|
|
1616
|
+
return await $t(B, S);
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
function Lc(n) {
|
|
1620
|
-
const e = (x,
|
|
1620
|
+
const e = (x, E, b) => n.on(x, E, b), t = (x, ...E) => n.fire(x, ...E);
|
|
1621
1621
|
let s, i = Date.now() + 36e5, o = null, a, r = { index: 0, version: 0 }, A = { index: 1, version: 0 }, u = !1;
|
|
1622
1622
|
const c = t(de);
|
|
1623
1623
|
let l = !1, p = 0, f = !1;
|
|
1624
|
-
e(
|
|
1624
|
+
e(Xo, () => a?.aabbCenter || new v());
|
|
1625
1625
|
let m;
|
|
1626
1626
|
const C = new Promise((x) => m = x);
|
|
1627
1627
|
e(Qt, async () => {
|
|
1628
1628
|
const x = t(R);
|
|
1629
|
-
let
|
|
1629
|
+
let E = me ? x.maxRenderCountOfMobile : x.maxRenderCountOfPc;
|
|
1630
1630
|
if (!x.bigSceneMode) {
|
|
1631
|
-
let
|
|
1632
|
-
|
|
1631
|
+
let b = await C;
|
|
1632
|
+
E = Math.min(b, E) + 10240;
|
|
1633
1633
|
}
|
|
1634
|
-
return
|
|
1634
|
+
return E;
|
|
1635
1635
|
}), e(Yt, async (x) => {
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1638
|
-
let
|
|
1639
|
-
if (
|
|
1636
|
+
const E = t(R);
|
|
1637
|
+
if (E.bigSceneMode) return 1;
|
|
1638
|
+
let b = me ? E.maxRenderCountOfMobile : E.maxRenderCountOfPc, T = await C;
|
|
1639
|
+
if (b = Math.min(T, b), !a.dataShDegree) return 1;
|
|
1640
1640
|
if (x >= 3) {
|
|
1641
1641
|
if (a.dataShDegree < 3) return 1;
|
|
1642
1642
|
} else if (x >= 1) {
|
|
@@ -1644,12 +1644,12 @@ function Lc(n) {
|
|
|
1644
1644
|
} else
|
|
1645
1645
|
return 1;
|
|
1646
1646
|
const F = 1024 * 2;
|
|
1647
|
-
return Math.ceil(
|
|
1648
|
-
}), e(pi, async () => t(R).bigSceneMode ? 0 : (await C, a.dataShDegree)), e(fi, async (x,
|
|
1647
|
+
return Math.ceil(b / F);
|
|
1648
|
+
}), e(pi, async () => t(R).bigSceneMode ? 0 : (await C, a.dataShDegree)), e(fi, async (x, E = !0) => {
|
|
1649
1649
|
try {
|
|
1650
1650
|
await C;
|
|
1651
|
-
const
|
|
1652
|
-
o = await t(Wo, x, b,
|
|
1651
|
+
const b = !!a.header?.Flag2;
|
|
1652
|
+
o = await t(Wo, x, E, b, a.opts.format), a && (a.textWatermarkVersion = Date.now());
|
|
1653
1653
|
} catch {
|
|
1654
1654
|
console.info("failed to generate watermark");
|
|
1655
1655
|
}
|
|
@@ -1659,9 +1659,9 @@ function Lc(n) {
|
|
|
1659
1659
|
if (c) return r.version <= A.version ? r.xyz : A.xyz;
|
|
1660
1660
|
if (a?.status === N.FetchDone || a?.status === N.FetchAborted) {
|
|
1661
1661
|
if (a.activePoints && a.activePoints.length === void 0) return a.activePoints;
|
|
1662
|
-
const x = {},
|
|
1663
|
-
for (let
|
|
1664
|
-
F = b
|
|
1662
|
+
const x = {}, E = r.xyz;
|
|
1663
|
+
for (let b = 0, T = E.length / 3, F = 0, k = 0, L = 0, P = ""; b < T; b++)
|
|
1664
|
+
F = E[b * 3], k = E[b * 3 + 1], L = E[b * 3 + 2], P = `${Math.floor(F / 2) * 2 + 1},${Math.floor(k / 2) * 2 + 1},${Math.floor(L / 2) * 2 + 1}`, (x[P] = x[P] || []).push(F, k, L);
|
|
1665
1665
|
return a.activePoints = x;
|
|
1666
1666
|
}
|
|
1667
1667
|
return r.xyz;
|
|
@@ -1671,36 +1671,36 @@ function Lc(n) {
|
|
|
1671
1671
|
if (a && (a.status === N.Invalid || a.status === N.FetchFailed))
|
|
1672
1672
|
return t(R).viewerEvents?.fire(he), t(Ot, 0) || t(ae, { renderSplatCount: 0, visibleSplatCount: 0, modelSplatCount: 0 });
|
|
1673
1673
|
if (!a || !a.downloadSize) return;
|
|
1674
|
-
const
|
|
1675
|
-
if (M(
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1674
|
+
const E = a.status !== N.FetchReady && a.status !== N.Fetching;
|
|
1675
|
+
if (M(E), E) {
|
|
1676
|
+
const b = Math.min(a.fetchLimit, a.downloadSplatCount);
|
|
1677
|
+
b && !a.notifyFetchStopDone && (a.notifyFetchStopDone = !0) && t(Ot, b);
|
|
1678
1678
|
} else
|
|
1679
1679
|
t(li, 100 * a.downloadSize / a.fileSize);
|
|
1680
1680
|
a.dataSplatCount && (!f && a.palettes && (t($o, a.palettes), f = !0), !u && (u = !0, setTimeout(async () => {
|
|
1681
|
-
x ? await g(
|
|
1681
|
+
x ? await g(E) : await h(E), u = !1;
|
|
1682
1682
|
})));
|
|
1683
1683
|
}
|
|
1684
1684
|
async function h(x) {
|
|
1685
1685
|
if (s) return;
|
|
1686
|
-
const
|
|
1686
|
+
const E = r, b = await t(Qt), T = o;
|
|
1687
1687
|
let F = a.dataSplatCount, k = x ? a.watermarkCount : 0, L = a.meta.showWatermark && x ? (T?.byteLength || 0) / 32 : 0;
|
|
1688
|
-
if (a.renderSplatCount = F + k + L, a.renderSplatCount >=
|
|
1689
|
-
if (!
|
|
1688
|
+
if (a.renderSplatCount = F + k + L, a.renderSplatCount >= b && (a.renderSplatCount = b, k = 0, L = 0, F > b && (F = b)), t(ae, { visibleSplatCount: a.renderSplatCount, modelSplatCount: a.modelSplatCount + L }), Date.now() - E.textureReadyTime < QA || a.smallSceneUploadDone && a.lastTextWatermarkVersion == a.textWatermarkVersion) return;
|
|
1689
|
+
if (!E.version) {
|
|
1690
1690
|
t(xo, (a.header?.Flag2 ? a.header.MaxTopY : a.header?.MinTopY) || 0);
|
|
1691
1691
|
let W = a.opts.format, Z = " ";
|
|
1692
1692
|
a.opts.format == "spx" ? (W = "spx v" + a.header.Version + (a.header.ExclusiveId ? (", " + a.header.ExclusiveId).substring(0, 5) : ""), Z += a.CompressionRatio) : a.opts.format == "spz" ? (W = "spz v" + a.spzVersion, Z += a.CompressionRatio) : a.opts.format == "sog" ? (W = "sog v" + a.sogVersion, Z += a.CompressionRatio) : a.opts.format == "splat" && (Z += a.CompressionRatio);
|
|
1693
1693
|
const te = " " + (a.fileSize / 1024 / 1024).toFixed(1) + "M";
|
|
1694
1694
|
t(ae, { scene: `small (${W}) ${Z}${te}` });
|
|
1695
1695
|
}
|
|
1696
|
-
a.lastTextWatermarkVersion = a.textWatermarkVersion,
|
|
1697
|
-
const P = 1024 * 2, U = Math.ceil(2 *
|
|
1698
|
-
_.set(a.splatData.
|
|
1696
|
+
a.lastTextWatermarkVersion = a.textWatermarkVersion, E.textureReady = !1;
|
|
1697
|
+
const P = 1024 * 2, U = Math.ceil(2 * b / P), G = new Uint32Array(P * U * 4), D = new Float32Array(G.buffer), _ = new Uint8Array(G.buffer);
|
|
1698
|
+
_.set(a.splatData.subarray(0, F * 32), 0), k && _.set(a.watermarkData.subarray(0, k * 32), F * 32), L && _.set(T.subarray(0, L * 32), (F + k) * 32);
|
|
1699
1699
|
const H = new Float32Array(a.renderSplatCount * 3);
|
|
1700
1700
|
for (let W = 0, Z = 0; W < a.renderSplatCount; W++)
|
|
1701
1701
|
H[W * 3] = D[W * 8], H[W * 3 + 1] = D[W * 8 + 1], H[W * 3 + 2] = D[W * 8 + 2];
|
|
1702
1702
|
const z = Date.now();
|
|
1703
|
-
if (
|
|
1703
|
+
if (E.version = z, E.txdata = G, E.xyz = H, E.renderSplatCount = a.renderSplatCount, E.visibleSplatCount = a.downloadSplatCount + L, E.modelSplatCount = a.downloadSplatCount + L, E.watermarkCount = k + L, E.minX = a.minX, E.maxX = a.maxX, E.minY = a.minY, E.maxY = a.maxY, E.minZ = a.minZ, E.maxZ = a.maxZ, a.meta.particleMode && !p && (p = performance.now(), t(Hn, p), t(ht, !1), t(Wn, 1)), a.maxRadius && t(jo, a.maxRadius), t(Gs, E, a.currentRadius, a.currentRadius), i = z, x && !a.smallSceneUploadDone) {
|
|
1704
1704
|
a.smallSceneUploadDone = !0, t(Oo, a.sh12Data), t(Vo, a.sh3Data), a.sh12Data = null, a.sh3Data = null;
|
|
1705
1705
|
const W = t(R);
|
|
1706
1706
|
t(Dn, W.shDegree === void 0 ? 3 : W.shDegree), t(Us), a.meta.particleMode && setTimeout(() => {
|
|
@@ -1711,7 +1711,7 @@ function Lc(n) {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
async function g(x) {
|
|
1713
1713
|
if (s) return;
|
|
1714
|
-
const
|
|
1714
|
+
const E = await t(Qt), b = 1024 * 2, T = Math.ceil(2 * E / b), F = o, k = 0, L = (F?.byteLength || 0) / 32, P = E - k - L;
|
|
1715
1715
|
t(ae, { modelSplatCount: a.downloadSplatCount + L });
|
|
1716
1716
|
let U = r.version <= A.version ? r : A;
|
|
1717
1717
|
if (r.version && (!U.index && !A.active || U.index && !r.active) || Date.now() - U.activeTime < xA) return;
|
|
@@ -1722,8 +1722,8 @@ function Lc(n) {
|
|
|
1722
1722
|
if (!U.version) {
|
|
1723
1723
|
let V = a.opts.format, j = " ";
|
|
1724
1724
|
a.opts.format == "spx" && (V = "spx" + (a.header.ExclusiveId ? (" " + a.header.ExclusiveId).substring(0, 6) : ""), j += a.CompressionRatio);
|
|
1725
|
-
const
|
|
1726
|
-
t(ae, { scene: `large (${V}) ${j}${
|
|
1725
|
+
const we = " " + (a.fileSize / 1024 / 1024).toFixed(1) + "M";
|
|
1726
|
+
t(ae, { scene: `large (${V}) ${j}${we}` });
|
|
1727
1727
|
}
|
|
1728
1728
|
const G = Date.now();
|
|
1729
1729
|
U.version = G, U.active = !1;
|
|
@@ -1736,49 +1736,49 @@ function Lc(n) {
|
|
|
1736
1736
|
if (Z > 0.95)
|
|
1737
1737
|
for (const V of _) V.currentRenderCnt = V.splatCount * Z | 0;
|
|
1738
1738
|
else {
|
|
1739
|
-
_.sort((j,
|
|
1739
|
+
_.sort((j, we) => j.distance - we.distance);
|
|
1740
1740
|
for (const j of _)
|
|
1741
1741
|
j.distance < 5 ? j.distance *= 0.5 : j.distance < 4 ? j.distance *= 0.4 : j.distance < 3 ? j.distance *= 0.3 : j.distance < 2 && (j.distance *= 0.1);
|
|
1742
|
-
|
|
1742
|
+
Q(_, P);
|
|
1743
1743
|
let V = 0;
|
|
1744
1744
|
for (let j of _) V += j.currentRenderCnt;
|
|
1745
1745
|
if (V > P) {
|
|
1746
1746
|
let j = V - P;
|
|
1747
|
-
for (let
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1747
|
+
for (let we = _.length - 1; we >= 0 && !(j <= 0); we--) {
|
|
1748
|
+
const Qe = _[we];
|
|
1749
|
+
Qe.currentRenderCnt >= j ? (Qe.currentRenderCnt -= j, j = 0) : (j -= Qe.currentRenderCnt, Qe.currentRenderCnt = 0);
|
|
1750
1750
|
}
|
|
1751
1751
|
} else if (V < P) {
|
|
1752
1752
|
let j = P - V;
|
|
1753
|
-
for (let
|
|
1754
|
-
let
|
|
1755
|
-
if (
|
|
1756
|
-
if (
|
|
1757
|
-
|
|
1753
|
+
for (let we = 0; we < _.length && !(j <= 0); we++) {
|
|
1754
|
+
let Qe = _[we];
|
|
1755
|
+
if (Qe.splatCount > Qe.currentRenderCnt)
|
|
1756
|
+
if (Qe.splatCount - Qe.currentRenderCnt >= j)
|
|
1757
|
+
Qe.currentRenderCnt += j, j = 0;
|
|
1758
1758
|
else {
|
|
1759
|
-
const Si =
|
|
1760
|
-
|
|
1759
|
+
const Si = Qe.splatCount - Qe.currentRenderCnt;
|
|
1760
|
+
Qe.currentRenderCnt += Si, j -= Si;
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
}
|
|
1765
|
-
const te = new Uint32Array(
|
|
1765
|
+
const te = new Uint32Array(b * T * 4), $ = new Float32Array(te.buffer), ye = new Uint8Array(te.buffer);
|
|
1766
1766
|
let Ie = 0;
|
|
1767
1767
|
for (let V of _)
|
|
1768
|
-
|
|
1769
|
-
L &&
|
|
1768
|
+
ye.set(V.splatData.subarray(0, V.currentRenderCnt * 32), Ie * 32), Ie += V.currentRenderCnt;
|
|
1769
|
+
L && ye.set(F.subarray(0, L * 32), (Ie + k) * 32);
|
|
1770
1770
|
const tt = Ie + k + L, nt = new Float32Array(tt * 3);
|
|
1771
1771
|
for (let V = 0, j = 0; V < tt; V++)
|
|
1772
1772
|
nt[V * 3] = $[V * 8], nt[V * 3 + 1] = $[V * 8 + 1], nt[V * 3 + 2] = $[V * 8 + 2];
|
|
1773
1773
|
U.txdata = te, U.xyz = nt, U.renderSplatCount = tt, U.visibleSplatCount = D + a.watermarkCount + L, U.modelSplatCount = a.downloadSplatCount + L, U.watermarkCount = k + L, U.minX = a.header.MinX, U.maxX = a.header.MaxX, U.minY = a.header.MinY, U.maxY = a.header.MaxY, U.minZ = a.header.MinZ, U.maxZ = a.header.MaxZ, t(Gs, U), i = G, t(ae, { visibleSplatCount: U.visibleSplatCount, modelSplatCount: U.modelSplatCount });
|
|
1774
1774
|
}
|
|
1775
|
-
function
|
|
1776
|
-
const
|
|
1775
|
+
function Q(x, E) {
|
|
1776
|
+
const b = x.map((k) => 1 / (k.distance + 1e-6)), T = b.reduce((k, L) => k + L, 0);
|
|
1777
1777
|
let F = 0;
|
|
1778
1778
|
if (x.forEach((k, L) => {
|
|
1779
|
-
k.currentRenderCnt = Math.min(Math.floor(
|
|
1780
|
-
}), F <
|
|
1781
|
-
const k =
|
|
1779
|
+
k.currentRenderCnt = Math.min(Math.floor(b[L] / T * E), k.splatCount), F += k.currentRenderCnt;
|
|
1780
|
+
}), F < E) {
|
|
1781
|
+
const k = E - F, L = x.map((U, G) => U.currentRenderCnt < U.splatCount ? b[G] : 0), P = L.reduce((U, G) => U + G, 0);
|
|
1782
1782
|
x.forEach((U, G) => {
|
|
1783
1783
|
if (P > 0 && U.currentRenderCnt < U.splatCount) {
|
|
1784
1784
|
const D = Math.min(
|
|
@@ -1790,8 +1790,8 @@ function Lc(n) {
|
|
|
1790
1790
|
});
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
|
-
function y(x,
|
|
1794
|
-
if (T.distance = Math.max(T.center.distanceTo(
|
|
1793
|
+
function y(x, E, b, T) {
|
|
1794
|
+
if (T.distance = Math.max(T.center.distanceTo(E) - T.radius, 0), !T.distance || T.center.distanceTo(b) <= 2 * T.radius) return !0;
|
|
1795
1795
|
const F = new ze(T.center.x, T.center.y, T.center.z, 1).applyMatrix4(x), k = 3 * F.w;
|
|
1796
1796
|
return !(F.z < -k || F.x < -k || F.x > k || F.y < -k || F.y > k);
|
|
1797
1797
|
}
|
|
@@ -1799,19 +1799,19 @@ function Lc(n) {
|
|
|
1799
1799
|
if (!l) {
|
|
1800
1800
|
if (a.header) {
|
|
1801
1801
|
l = !0;
|
|
1802
|
-
const
|
|
1803
|
-
t(Ys,
|
|
1802
|
+
const E = new v(a.header.MinX, a.header.MinY, a.header.MinZ), b = new v(a.header.MaxX, a.header.MaxY, a.header.MaxZ);
|
|
1803
|
+
t(Ys, E.x, E.y, E.z, b.x, b.y, b.z, a.meta.showBoundBox);
|
|
1804
1804
|
} else if (x) {
|
|
1805
1805
|
l = !0;
|
|
1806
|
-
const
|
|
1807
|
-
t(Ys,
|
|
1806
|
+
const E = new v(a.minX, a.minY, a.minZ), b = new v(a.maxX, a.maxY, a.maxZ);
|
|
1807
|
+
t(Ys, E.x, E.y, E.z, b.x, b.y, b.z, a.meta.showBoundBox);
|
|
1808
1808
|
}
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function S() {
|
|
1812
1812
|
s || (s = !0, a?.abortController?.abort(), a?.map?.clear(), a = null, o = null, r = null, A = null);
|
|
1813
1813
|
}
|
|
1814
|
-
function
|
|
1814
|
+
function B(x) {
|
|
1815
1815
|
if (x.opts.format === "spx")
|
|
1816
1816
|
Sc(x);
|
|
1817
1817
|
else if (x.opts.format === "splat")
|
|
@@ -1826,12 +1826,12 @@ function Lc(n) {
|
|
|
1826
1826
|
return !1;
|
|
1827
1827
|
return !0;
|
|
1828
1828
|
}
|
|
1829
|
-
function I(x,
|
|
1829
|
+
function I(x, E) {
|
|
1830
1830
|
if (s) return;
|
|
1831
|
-
const
|
|
1832
|
-
if (x.fetchReload = uc(
|
|
1833
|
-
const L =
|
|
1834
|
-
a.fetchLimit = Math.min(
|
|
1831
|
+
const b = t(R), T = me ? b.maxRenderCountOfMobile : b.maxRenderCountOfPc, F = t(de);
|
|
1832
|
+
if (x.fetchReload = uc(E.updateDate || 0), a = new EA(x, E), F && E.autoCut) {
|
|
1833
|
+
const L = E.pcDownloadLimitSplatCount || vA, P = E.mobileDownloadLimitSplatCount || MA, U = me ? P : L;
|
|
1834
|
+
a.fetchLimit = Math.min(E.autoCut * E.autoCut * T + T, U);
|
|
1835
1835
|
} else
|
|
1836
1836
|
a.fetchLimit = T;
|
|
1837
1837
|
const k = () => {
|
|
@@ -1839,13 +1839,13 @@ function Lc(n) {
|
|
|
1839
1839
|
return m(0);
|
|
1840
1840
|
a.modelSplatCount > 0 ? (m(a.modelSplatCount), !a.meta.particleMode && a.dataSplatCount ? setTimeout(() => t(To), 5) : setTimeout(k, 10)) : setTimeout(k, 10);
|
|
1841
1841
|
};
|
|
1842
|
-
if (k(), !
|
|
1842
|
+
if (k(), !B(a)) {
|
|
1843
1843
|
console.error("Unsupported format:", x.format), t(Ot, 0);
|
|
1844
1844
|
return;
|
|
1845
1845
|
}
|
|
1846
1846
|
t(ci), t(ae, { cuts: "" });
|
|
1847
1847
|
}
|
|
1848
|
-
e(Mo, (x,
|
|
1848
|
+
e(Mo, (x, E) => I(x, E)), e(vo, (x = 1e4) => Date.now() - i < x), e(Do, () => S()), t(
|
|
1849
1849
|
Dt,
|
|
1850
1850
|
async () => await d(c),
|
|
1851
1851
|
() => !s
|
|
@@ -1867,7 +1867,7 @@ const Oc = `$${J++}`;
|
|
|
1867
1867
|
J++;
|
|
1868
1868
|
const Vc = `$${J++}`;
|
|
1869
1869
|
J++;
|
|
1870
|
-
const Jc = `$${J++}`,
|
|
1870
|
+
const Jc = `$${J++}`, Xc = `$${J++}`, Kc = `$${J++}`, Zc = `$${J++}`, jc = `$${J++}`, qc = `$${J++}`, $c = `$${J++}`, el = `$${J++}`, tl = `$${J++}`, nl = `$${J++}`, _a = `$${J++}`, sl = `$${J++}`, il = `$${J++}`, qs = `$${J++}`, Na = `$${J++}`, Ha = `$${J++}`;
|
|
1871
1871
|
var al = `precision highp float;\r
|
|
1872
1872
|
precision highp int;
|
|
1873
1873
|
|
|
@@ -2225,15 +2225,22 @@ void main() {\r
|
|
|
2225
2225
|
return;\r
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
|
-
alpha *= (useSimilarExp || vPosition.w
|
|
2228
|
+
alpha *= (useSimilarExp || vPosition.w < 0.0) ? exp2(-r2) : fnExp(-r2);\r
|
|
2229
2229
|
if (alpha <= minAlpha) {\r
|
|
2230
2230
|
gl_FragColor = vec4(0.0);\r
|
|
2231
2231
|
return;\r
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
2234
|
gl_FragColor = vec4(lightFactor * vColor.rgb, alpha);\r
|
|
2235
|
-
}`, rl = `
|
|
2235
|
+
}`, rl = `const float EXP4 = exp(-4.0);\r
|
|
2236
|
+
const float INV_EXP4 = 1.0 / (1.0 - EXP4);
|
|
2237
|
+
|
|
2238
|
+
float fnWave(float minVal, float maxVal, float time) {\r
|
|
2236
2239
|
return (sin(time * 0.005) + 1.0) * 0.5 * (maxVal - minVal) + minVal;\r
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
float fnExp(float r2) {\r
|
|
2243
|
+
return (exp(r2) - EXP4) * INV_EXP4;\r
|
|
2237
2244
|
}`, Al = `vec4 FvEffect(uvec4 uv4Cen, vec4 v4Color, uint activeFv, float time) {\r
|
|
2238
2245
|
uint fvSplat = uv4Cen.w & 65535u;\r
|
|
2239
2246
|
if (fvSplat > 0u && fvSplat == activeFv) {\r
|
|
@@ -2266,13 +2273,13 @@ function ul(n) {
|
|
|
2266
2273
|
const d = new Float32Array(12), h = new wt(d, 3);
|
|
2267
2274
|
C.setAttribute("position", h), h.setXYZ(0, -2, -2, 0), h.setXYZ(1, -2, 2, 0), h.setXYZ(2, 2, 2, 0), h.setXYZ(3, 2, -2, 0), h.needsUpdate = !0;
|
|
2268
2275
|
let g = new Ms().copy(C);
|
|
2269
|
-
const
|
|
2276
|
+
const Q = await s(Qt);
|
|
2270
2277
|
if (e) return;
|
|
2271
|
-
const y = new Uint32Array(
|
|
2272
|
-
return M.setUsage(Lr), M.needsUpdate = !0, g.setAttribute(Fc, M), g.instanceCount = 0, t(Hi, (
|
|
2273
|
-
s(Gi,
|
|
2274
|
-
s(zo,
|
|
2275
|
-
}), g.instanceCount =
|
|
2278
|
+
const y = new Uint32Array(Q), M = new Tr(y, 1, !1);
|
|
2279
|
+
return M.setUsage(Lr), M.needsUpdate = !0, g.setAttribute(Fc, M), g.instanceCount = 0, t(Hi, (S, B, I, x, E) => {
|
|
2280
|
+
s(Gi, B), y.set(S, 0), M.clearUpdateRanges(), M.addUpdateRange(0, E), M.needsUpdate = !0, M.onUpload(() => {
|
|
2281
|
+
s(zo, B), s(ae, { renderSplatCount: E });
|
|
2282
|
+
}), g.instanceCount = E, s(ee), s(ae, { sortTime: `${I} / ${Date.now() - x}`, bucketBits: r, sortType: A });
|
|
2276
2283
|
}), t(jr, () => g), t(
|
|
2277
2284
|
ss,
|
|
2278
2285
|
() => {
|
|
@@ -2283,7 +2290,7 @@ function ul(n) {
|
|
|
2283
2290
|
}), t(_i, async () => {
|
|
2284
2291
|
const C = await s(Qt);
|
|
2285
2292
|
if (e) return;
|
|
2286
|
-
const d = 1024 * 2, h = Math.ceil(2 * C / d), g = s(R),
|
|
2293
|
+
const d = 1024 * 2, h = Math.ceil(2 * C / d), g = s(R), Q = new no({
|
|
2287
2294
|
uniforms: s(Pi),
|
|
2288
2295
|
vertexShader: l(al),
|
|
2289
2296
|
fragmentShader: l(ol),
|
|
@@ -2297,20 +2304,20 @@ function ul(n) {
|
|
|
2297
2304
|
side: $e
|
|
2298
2305
|
}), y = new Uint32Array(d * h * 4);
|
|
2299
2306
|
let M = new Ve(y, d, h, Je, lt);
|
|
2300
|
-
M.internalFormat = "RGBA32UI", M.needsUpdate = !0,
|
|
2301
|
-
const
|
|
2302
|
-
let I = new Ve(
|
|
2303
|
-
I.internalFormat = "RGBA32UI", I.needsUpdate = !0,
|
|
2304
|
-
const x = await s(Yt, 1),
|
|
2305
|
-
let
|
|
2306
|
-
|
|
2307
|
+
M.internalFormat = "RGBA32UI", M.needsUpdate = !0, Q.uniforms[ys].value = M;
|
|
2308
|
+
const S = s(de) ? h : 1, B = new Uint32Array(d * S * 4);
|
|
2309
|
+
let I = new Ve(B, d, S, Je, lt);
|
|
2310
|
+
I.internalFormat = "RGBA32UI", I.needsUpdate = !0, Q.uniforms[ws].value = I;
|
|
2311
|
+
const x = await s(Yt, 1), E = new Uint32Array(d * x * 4);
|
|
2312
|
+
let b = new Ve(E, d, x, Je, lt);
|
|
2313
|
+
b.internalFormat = "RGBA32UI", b.needsUpdate = !0, Q.uniforms[ms].value = b;
|
|
2307
2314
|
const T = await s(Yt, 3), F = new Uint32Array(d * T * 4);
|
|
2308
2315
|
let k = new Ve(F, d, T, Je, lt);
|
|
2309
|
-
k.internalFormat = "RGBA32UI", k.needsUpdate = !0,
|
|
2316
|
+
k.internalFormat = "RGBA32UI", k.needsUpdate = !0, Q.uniforms[Is].value = k;
|
|
2310
2317
|
const L = new Uint8Array(u * 4);
|
|
2311
2318
|
L.fill(128);
|
|
2312
2319
|
let P = new Ve(L, u, 1, Je, Mi);
|
|
2313
|
-
P.internalFormat = "RGBA8UI", P.needsUpdate = !0,
|
|
2320
|
+
P.internalFormat = "RGBA8UI", P.needsUpdate = !0, Q.uniforms[Es].value = P, Q.needsUpdate = !0;
|
|
2314
2321
|
let U = !1;
|
|
2315
2322
|
t(Wi, (D) => {
|
|
2316
2323
|
if (!s(de)) {
|
|
@@ -2322,28 +2329,28 @@ function ul(n) {
|
|
|
2322
2329
|
const H = new Ve(_, d, h, Je, lt);
|
|
2323
2330
|
H.onUpdate = () => {
|
|
2324
2331
|
D.textureReady = !0, D.textureReadyTime = Date.now(), m(D), s(Lo, D.renderSplatCount);
|
|
2325
|
-
}, H.internalFormat = "RGBA32UI", H.needsUpdate = !0, D.index ? (
|
|
2332
|
+
}, H.internalFormat = "RGBA32UI", H.needsUpdate = !0, D.index ? (Q.uniforms[ws].value = H, I?.dispose(), I = H) : (Q.uniforms[ys].value = H, M?.dispose(), M = H), Q.needsUpdate = !0, s(ee);
|
|
2326
2333
|
}), t(Oo, async (D) => {
|
|
2327
2334
|
if (s(de) || !D || !D.length) return;
|
|
2328
2335
|
const _ = new Uint32Array(d * await s(Yt, 1) * 4), H = new Uint8Array(_.buffer);
|
|
2329
2336
|
for (let W = 0, Z = 0; W < D.length; W++)
|
|
2330
2337
|
H.set(D[W], Z), Z += D[W].byteLength;
|
|
2331
2338
|
const z = new Ve(_, d, x, Je, lt);
|
|
2332
|
-
z.internalFormat = "RGBA32UI", z.needsUpdate = !0,
|
|
2339
|
+
z.internalFormat = "RGBA32UI", z.needsUpdate = !0, Q.uniforms[ms].value = z, Q.needsUpdate = !0, b?.dispose(), b = z, s(ee);
|
|
2333
2340
|
}), t(Vo, async (D) => {
|
|
2334
2341
|
if (s(de) || !D || !D.length) return;
|
|
2335
2342
|
const _ = new Uint32Array(d * await s(Yt, 3) * 4), H = new Uint8Array(_.buffer);
|
|
2336
2343
|
for (let W = 0, Z = 0; W < D.length; W++)
|
|
2337
2344
|
H.set(D[W], Z), Z += D[W].byteLength;
|
|
2338
2345
|
const z = new Ve(_, d, x, Je, lt);
|
|
2339
|
-
z.internalFormat = "RGBA32UI", z.needsUpdate = !0,
|
|
2346
|
+
z.internalFormat = "RGBA32UI", z.needsUpdate = !0, Q.uniforms[Is].value = z, Q.needsUpdate = !0, k?.dispose(), k = z, s(ee);
|
|
2340
2347
|
}), t($o, async (D) => {
|
|
2341
2348
|
if (!D || !D.length) return;
|
|
2342
2349
|
const _ = 1024, H = new Uint8Array(u * _ * 4);
|
|
2343
2350
|
H.set(D);
|
|
2344
2351
|
const z = new Ve(H, u, _, Je, Mi);
|
|
2345
|
-
P.internalFormat = "RGBA8UI", z.onUpdate = () => s($i), z.needsUpdate = !0,
|
|
2346
|
-
}), t(Ni, () =>
|
|
2352
|
+
P.internalFormat = "RGBA8UI", z.onUpdate = () => s($i), z.needsUpdate = !0, Q.uniforms[Es].value = z, Q.needsUpdate = !0, P?.dispose(), P = z, s(ee);
|
|
2353
|
+
}), t(Ni, () => Q), t(
|
|
2347
2354
|
ln,
|
|
2348
2355
|
() => {
|
|
2349
2356
|
const D = s(pe), { width: _, height: H } = s(mt), z = Math.abs(D.projectionMatrix.elements[0]) * 0.5 * _, W = Math.abs(D.projectionMatrix.elements[5]) * 0.5 * H, Z = s(Ni);
|
|
@@ -2354,70 +2361,70 @@ function ul(n) {
|
|
|
2354
2361
|
un,
|
|
2355
2362
|
() => {
|
|
2356
2363
|
const { width: D, height: _ } = s(mt);
|
|
2357
|
-
|
|
2364
|
+
Q.uniforms[ka].value.set(D, _), Q.uniformsNeedUpdate = !0, s(ee);
|
|
2358
2365
|
},
|
|
2359
2366
|
!0
|
|
2360
2367
|
), t(Gi, (D) => {
|
|
2361
|
-
|
|
2368
|
+
Q.uniforms[xa].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2362
2369
|
}), t(Zi, (D) => {
|
|
2363
|
-
|
|
2370
|
+
Q.uniforms[ga].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2364
2371
|
}), t(ht, (D) => {
|
|
2365
2372
|
const _ = s(R);
|
|
2366
|
-
D === void 0 && (D = !_.pointcloudMode),
|
|
2373
|
+
D === void 0 && (D = !_.pointcloudMode), Q.uniforms[Ma].value = D, Q.uniformsNeedUpdate = !0, _.pointcloudMode = D, s(ee), _.viewerEvents && (_.viewerEvents.fire(R).pointcloudMode = D);
|
|
2367
2374
|
}), t(Yi, (D) => {
|
|
2368
|
-
|
|
2375
|
+
Q.uniforms[Ea].value = D, Q.uniformsNeedUpdate = !0;
|
|
2369
2376
|
const _ = s(R);
|
|
2370
2377
|
_.bigSceneMode = D, s(ee);
|
|
2371
|
-
}), t(
|
|
2372
|
-
|
|
2378
|
+
}), t(Kt, (D) => {
|
|
2379
|
+
Q.uniforms[ba].value = D, Q.uniformsNeedUpdate = !0;
|
|
2373
2380
|
const _ = s(R);
|
|
2374
2381
|
_.lightFactor = D, s(ee);
|
|
2375
2382
|
});
|
|
2376
2383
|
let G = !1;
|
|
2377
2384
|
return t(xo, (D) => {
|
|
2378
|
-
s(de) || G || (G = !0,
|
|
2385
|
+
s(de) || G || (G = !0, Q.uniforms[Ra].value = D, Q.uniformsNeedUpdate = !0, s(ee));
|
|
2379
2386
|
}), t(_t, (D) => {
|
|
2380
|
-
|
|
2387
|
+
Q.uniforms[da].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2381
2388
|
}), t(Nt, (D) => {
|
|
2382
|
-
|
|
2389
|
+
Q.uniforms[ha].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2383
2390
|
}), t(jo, (D) => {
|
|
2384
|
-
|
|
2391
|
+
Q.uniforms[Ba].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2385
2392
|
}), t(Qn, (D, _, H, z) => {
|
|
2386
|
-
|
|
2393
|
+
Q.uniforms[va].value = [D, _, H, z ? 1 : -1], Q.uniformsNeedUpdate = !0, s(ee);
|
|
2387
2394
|
}), t(Rs, (D = !0) => {
|
|
2388
|
-
|
|
2395
|
+
Q.uniforms[Ia].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2389
2396
|
}), t($i, (D = !0) => {
|
|
2390
|
-
|
|
2397
|
+
Q.uniforms[ma].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2391
2398
|
}), t(Bo, (D) => {
|
|
2392
|
-
|
|
2399
|
+
Q.uniforms[Ca].value = D, Q.uniformsNeedUpdate = !0;
|
|
2393
2400
|
}), t(Hn, (D) => {
|
|
2394
|
-
|
|
2401
|
+
Q.uniforms[fn].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2395
2402
|
}), t(rs, (D, _) => {
|
|
2396
|
-
|
|
2403
|
+
Q.uniforms[pa].value = D, Q.uniforms[fa].value = _, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2397
2404
|
}), t(As, (D) => {
|
|
2398
|
-
|
|
2405
|
+
Q.uniforms[Ta].value = Math.min(Math.max(0, D), 255) / 255, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2399
2406
|
}), t(cs, (D = !1) => {
|
|
2400
|
-
|
|
2407
|
+
Q.uniforms[ya].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2401
2408
|
}), t(Wn, (D) => {
|
|
2402
|
-
|
|
2409
|
+
Q.uniforms[wa].value = D, Q.uniformsNeedUpdate = !0, s(ee);
|
|
2403
2410
|
}), t(qr, (D) => {
|
|
2404
|
-
|
|
2411
|
+
Q.uniforms[Qa].value = D, Q.uniformsNeedUpdate = !0;
|
|
2405
2412
|
}), t(Dn, async (D) => {
|
|
2406
2413
|
if (s(de)) return;
|
|
2407
2414
|
const _ = await s(pi);
|
|
2408
|
-
D < 0 && (D = 0), D > _ && (D = _), c = D,
|
|
2415
|
+
D < 0 && (D = 0), D > _ && (D = _), c = D, Q.uniforms[Da].value = D, Q.uniformsNeedUpdate = !0, s(ae, { shDegree: `${D} / max ${_}` }), s(ee);
|
|
2409
2416
|
}), t(AA, (D = 0, _ = 0) => {
|
|
2410
|
-
|
|
2417
|
+
Q.uniforms[Sa].value = D << 16 | _, Q.uniforms[fn].value = performance.now(), Q.uniformsNeedUpdate = !0, s(ee);
|
|
2411
2418
|
}), t(cA, (D = -1) => {
|
|
2412
|
-
if (D < 0) return
|
|
2413
|
-
|
|
2419
|
+
if (D < 0) return Q.uniforms[Cs].value;
|
|
2420
|
+
Q.uniforms[Cs].value = D, Q.uniforms[fn].value = performance.now(), Q.uniformsNeedUpdate = !0, s(ee);
|
|
2414
2421
|
}), t(
|
|
2415
2422
|
is,
|
|
2416
2423
|
() => {
|
|
2417
|
-
|
|
2424
|
+
Q.dispose(), M && M.dispose(), I && I.dispose(), b && b.dispose(), k && k.dispose(), P?.dispose();
|
|
2418
2425
|
},
|
|
2419
2426
|
!0
|
|
2420
|
-
),
|
|
2427
|
+
), Q;
|
|
2421
2428
|
});
|
|
2422
2429
|
function l(C) {
|
|
2423
2430
|
return ut.cmn = rl.trim(), ut.FvEffect = (ut["custom-FvEffect"] || Al).trim(), ut.IsWatermark = (ut["custom-IsWatermark"] || cl).trim(), ut.WatermarkEffect = (ut["custom-WatermarkEffect"] || ll).trim(), `#include <cmn>
|
|
@@ -2437,28 +2444,28 @@ function ul(n) {
|
|
|
2437
2444
|
e = !0, window.removeEventListener("resize", p), s(ss), s(is);
|
|
2438
2445
|
}), t(zs, () => {
|
|
2439
2446
|
if (!s(qo)) return;
|
|
2440
|
-
const C = s(R), d = s(
|
|
2447
|
+
const C = s(R), d = s(be)?.meta || {}, h = C.qualityLevel || ke.Default5;
|
|
2441
2448
|
if (s(Dn, [0, 1, 2, 3, 3, 3, 3, 3, 3][h - 1]), me) {
|
|
2442
|
-
const
|
|
2443
|
-
s(rs,
|
|
2449
|
+
const Q = [4, 3, 3, 2, 2, 2, 1, 1, 1], y = [128, 128, 128, 256, 256, 256, 512, 512, 512], M = [7, 6, 5, 4, 4, 3, 2, 2, 2], S = d.minPixelDiameter || Q[h - 1], B = d.maxPixelDiameter || y[h - 1];
|
|
2450
|
+
s(rs, S, B), s(As, d.minAlpha || M[h - 1]), s(cs, h < ke.L4);
|
|
2444
2451
|
} else {
|
|
2445
|
-
const
|
|
2446
|
-
s(rs,
|
|
2452
|
+
const Q = [2, 2, 2, 1, 1, 1, 1, 1, 1], y = [128, 256, 256, 512, 512, 1024, 1024, 1024, 1024], M = [5, 4, 3, 2, 2, 1, 1, 1, 1], S = d.minPixelDiameter || Q[h - 1], B = d.maxPixelDiameter || y[h - 1];
|
|
2453
|
+
s(rs, S, B), s(As, d.minAlpha || M[h - 1]), s(cs, !1);
|
|
2447
2454
|
}
|
|
2448
2455
|
s(Ci);
|
|
2449
2456
|
}), t(To, async () => {
|
|
2450
2457
|
if (s(de)) return;
|
|
2451
2458
|
if (s(R).disableTransitionEffectOnLoad) return s(_t, 0);
|
|
2452
|
-
let d = 0.01, h = 0.01, g = !1,
|
|
2459
|
+
let d = 0.01, h = 0.01, g = !1, Q = 0;
|
|
2453
2460
|
s(_t, h), s(
|
|
2454
2461
|
Dt,
|
|
2455
2462
|
() => {
|
|
2456
2463
|
if (e) return;
|
|
2457
2464
|
h += (o - h) * d, s(_t, h);
|
|
2458
2465
|
let y = s(Ro);
|
|
2459
|
-
y && !
|
|
2466
|
+
y && !Q && (Q = Date.now());
|
|
2460
2467
|
let M = h / i;
|
|
2461
|
-
y && (M > 0.9 || Date.now() -
|
|
2468
|
+
y && (M > 0.9 || Date.now() - Q > 2500) ? (s(Fs) && s(Ps, !0), s(_t, 0), g = !0) : y && M > 0.7 ? d = Math.min(d * 1.2, 0.3) : y && M > 0.5 ? d = Math.min(d * 1.2, 0.2) : M > 0.4 && (d = Math.min(d * 1.05, 0.1));
|
|
2462
2469
|
},
|
|
2463
2470
|
() => !e && !g,
|
|
2464
2471
|
3
|
|
@@ -2544,8 +2551,8 @@ function ul(n) {
|
|
|
2544
2551
|
[_c]: C.visibleSplatCount,
|
|
2545
2552
|
[Nc]: C.modelSplatCount,
|
|
2546
2553
|
[Jc]: C.minX,
|
|
2547
|
-
[
|
|
2548
|
-
[
|
|
2554
|
+
[Xc]: C.maxX,
|
|
2555
|
+
[Kc]: C.minY,
|
|
2549
2556
|
[Zc]: C.maxY,
|
|
2550
2557
|
[jc]: C.minZ,
|
|
2551
2558
|
[qc]: C.maxZ
|
|
@@ -2556,39 +2563,39 @@ function ul(n) {
|
|
|
2556
2563
|
}
|
|
2557
2564
|
function dl(n) {
|
|
2558
2565
|
const e = (i, ...o) => n.fire(i, ...o), t = (i, o, a) => n.on(i, o, a), s = new Set(bA.split(""));
|
|
2559
|
-
t(Wo, async (i = "", o = !0, a = !0) => {
|
|
2560
|
-
const
|
|
2561
|
-
let
|
|
2562
|
-
for (let
|
|
2563
|
-
let
|
|
2564
|
-
for (let B = 0; B <
|
|
2565
|
-
|
|
2566
|
-
|
|
2566
|
+
t(Wo, async (i = "", o = !0, a = !0, r = "") => {
|
|
2567
|
+
const A = i.trim().substring(0, 100);
|
|
2568
|
+
let u = await e(go, A, r), c = [];
|
|
2569
|
+
for (let y = 0; y < u.length; y++) {
|
|
2570
|
+
let M = [], S = u[y];
|
|
2571
|
+
for (let B = 0; B < S.length; B++)
|
|
2572
|
+
M.push([(S[B] % 20 - 10) * 0.02, ((S[B] / 20 | 0) - 10) * 0.02]);
|
|
2573
|
+
c.push(M);
|
|
2567
2574
|
}
|
|
2568
|
-
let
|
|
2569
|
-
for (let
|
|
2570
|
-
|
|
2571
|
-
let
|
|
2572
|
-
for (let
|
|
2573
|
-
|
|
2574
|
-
for (let
|
|
2575
|
-
|
|
2575
|
+
let l = [], p = A.split("");
|
|
2576
|
+
for (let y = 0; y < p.length; y++)
|
|
2577
|
+
l[y] = s.has(p[y]) ? 0.22 : 0.4;
|
|
2578
|
+
let f = p.length / 2 | 0, m = l[f] / 2, C = !(p.length % 2), d = C ? 0 : -m;
|
|
2579
|
+
for (let y = f - 1; y >= 0; y--) {
|
|
2580
|
+
d -= l[y] / 2;
|
|
2581
|
+
for (let M of c[y]) M[0] += d;
|
|
2582
|
+
d -= l[y] / 2;
|
|
2576
2583
|
}
|
|
2577
|
-
|
|
2578
|
-
for (let
|
|
2579
|
-
|
|
2580
|
-
for (let
|
|
2581
|
-
|
|
2584
|
+
m = l[f] / 2, d = C ? 0 : m;
|
|
2585
|
+
for (let y = c.length - f; y < c.length; y++) {
|
|
2586
|
+
d += l[y] / 2;
|
|
2587
|
+
for (let M of c[y]) M[0] += d;
|
|
2588
|
+
d += l[y] / 2;
|
|
2582
2589
|
}
|
|
2583
|
-
let
|
|
2584
|
-
for (let
|
|
2585
|
-
|
|
2586
|
-
const
|
|
2587
|
-
let
|
|
2588
|
-
for (let
|
|
2589
|
-
for (let
|
|
2590
|
-
|
|
2591
|
-
return
|
|
2590
|
+
let h = 0;
|
|
2591
|
+
for (let y of c)
|
|
2592
|
+
h += y.length;
|
|
2593
|
+
const g = new Uint8Array(h * Y);
|
|
2594
|
+
let Q = 0;
|
|
2595
|
+
for (let y of c)
|
|
2596
|
+
for (let M of y)
|
|
2597
|
+
g.set(await bc(M[0], M[1], o, a), Y * Q++);
|
|
2598
|
+
return g;
|
|
2592
2599
|
});
|
|
2593
2600
|
}
|
|
2594
2601
|
function xi(n) {
|
|
@@ -2599,14 +2606,14 @@ function xi(n) {
|
|
|
2599
2606
|
delete s.url;
|
|
2600
2607
|
const i = JSON.stringify(s, null, 2);
|
|
2601
2608
|
console.info(i);
|
|
2602
|
-
}), e(go, (t = "") => {
|
|
2603
|
-
const
|
|
2604
|
-
return
|
|
2605
|
-
fetch(
|
|
2609
|
+
}), e(go, (t = "", s = "") => {
|
|
2610
|
+
const i = "https://reall3d.com/gsfont/api/getGaussianText", o = new FormData();
|
|
2611
|
+
return o.append("text", t.substring(0, 100)), o.append("fmt", s), o.append("ver", jn), o.append("tk", sessionStorage.getItem("tk-gstext") || ""), new Promise((a) => {
|
|
2612
|
+
fetch(i, { method: "POST", body: o }).then((r) => r.ok ? r.json() : {}).then((r) => r.success ? a(JSON.parse(r.data)) : a([])).catch((r) => a([]));
|
|
2606
2613
|
});
|
|
2607
2614
|
});
|
|
2608
2615
|
}
|
|
2609
|
-
const hl = /^[og]\s*(.+)?/, gl = /^mtllib /, fl = /^usemtl /, pl = /^usemap /, Wa = /\s+/, Ga = new v(), bs = new v(), Ya = new v(), za = new v(),
|
|
2616
|
+
const hl = /^[og]\s*(.+)?/, gl = /^mtllib /, fl = /^usemtl /, pl = /^usemap /, Wa = /\s+/, Ga = new v(), bs = new v(), Ya = new v(), za = new v(), Me = new v(), pn = new ii();
|
|
2610
2617
|
function ml() {
|
|
2611
2618
|
const n = {
|
|
2612
2619
|
objects: [],
|
|
@@ -2716,7 +2723,7 @@ function ml() {
|
|
|
2716
2723
|
},
|
|
2717
2724
|
addFaceNormal: function(e, t, s) {
|
|
2718
2725
|
const i = this.vertices, o = this.object.geometry.normals;
|
|
2719
|
-
Ga.fromArray(i, e), bs.fromArray(i, t), Ya.fromArray(i, s),
|
|
2726
|
+
Ga.fromArray(i, e), bs.fromArray(i, t), Ya.fromArray(i, s), Me.subVectors(Ya, bs), za.subVectors(Ga, bs), Me.cross(za), Me.normalize(), o.push(Me.x, Me.y, Me.z), o.push(Me.x, Me.y, Me.z), o.push(Me.x, Me.y, Me.z);
|
|
2720
2727
|
},
|
|
2721
2728
|
addColor: function(e, t, s) {
|
|
2722
2729
|
const i = this.colors, o = this.object.geometry.colors;
|
|
@@ -2896,25 +2903,25 @@ class Cl extends Fr {
|
|
|
2896
2903
|
let m = !1;
|
|
2897
2904
|
if (c.vertices.length === 0) continue;
|
|
2898
2905
|
const C = new vn();
|
|
2899
|
-
C.setAttribute("position", new
|
|
2906
|
+
C.setAttribute("position", new Ke(c.vertices, 3)), c.normals.length > 0 && C.setAttribute("normal", new Ke(c.normals, 3)), c.colors.length > 0 && (m = !0, C.setAttribute("color", new Ke(c.colors, 3))), c.hasUVIndices === !0 && C.setAttribute("uv", new Ke(c.uvs, 2));
|
|
2900
2907
|
const d = [];
|
|
2901
|
-
for (let g = 0,
|
|
2908
|
+
for (let g = 0, Q = l.length; g < Q; g++) {
|
|
2902
2909
|
const y = l[g], M = y.name + "_" + y.smooth + "_" + m;
|
|
2903
|
-
let
|
|
2910
|
+
let S = t.materials[M];
|
|
2904
2911
|
if (this.materials !== null) {
|
|
2905
|
-
if (
|
|
2906
|
-
const
|
|
2907
|
-
vi.prototype.copy.call(
|
|
2908
|
-
} else if (f &&
|
|
2909
|
-
const
|
|
2910
|
-
vi.prototype.copy.call(
|
|
2912
|
+
if (S = this.materials.create(y.name), p && S && !(S instanceof wn)) {
|
|
2913
|
+
const B = new wn();
|
|
2914
|
+
vi.prototype.copy.call(B, S), B.color.copy(S.color), S = B;
|
|
2915
|
+
} else if (f && S && !(S instanceof cn)) {
|
|
2916
|
+
const B = new cn({ size: 10, sizeAttenuation: !1 });
|
|
2917
|
+
vi.prototype.copy.call(B, S), B.color.copy(S.color), B.map = S.map, S = B;
|
|
2911
2918
|
}
|
|
2912
2919
|
}
|
|
2913
|
-
|
|
2920
|
+
S === void 0 && (p ? S = new wn() : f ? S = new cn({ size: 1, sizeAttenuation: !1 }) : S = new _r(), S.name = y.name, S.flatShading = !y.smooth, S.vertexColors = m, t.materials[M] = S), d.push(S);
|
|
2914
2921
|
}
|
|
2915
2922
|
let h;
|
|
2916
2923
|
if (d.length > 1) {
|
|
2917
|
-
for (let g = 0,
|
|
2924
|
+
for (let g = 0, Q = l.length; g < Q; g++) {
|
|
2918
2925
|
const y = l[g];
|
|
2919
2926
|
C.addGroup(y.groupStart, y.groupCount, g);
|
|
2920
2927
|
}
|
|
@@ -2925,7 +2932,7 @@ class Cl extends Fr {
|
|
|
2925
2932
|
}
|
|
2926
2933
|
else if (t.vertices.length > 0) {
|
|
2927
2934
|
const r = new cn({ size: 1, sizeAttenuation: !1 }), A = new vn();
|
|
2928
|
-
A.setAttribute("position", new
|
|
2935
|
+
A.setAttribute("position", new Ke(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (A.setAttribute("color", new Ke(t.colors, 3)), r.vertexColors = !0);
|
|
2929
2936
|
const u = new ts(A, r);
|
|
2930
2937
|
o.add(u);
|
|
2931
2938
|
}
|
|
@@ -2937,12 +2944,12 @@ function Il(n) {
|
|
|
2937
2944
|
const t = (r, A, u) => n.on(r, A, u), s = (r, ...A) => n.fire(r, ...A);
|
|
2938
2945
|
t(So, () => e = !0);
|
|
2939
2946
|
const i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
2940
|
-
t(kn, () => s(
|
|
2947
|
+
t(kn, () => s(xe) && i.set(Date.now(), 1)), t(Tn, () => s(xe) && s(xt, i)), t(On, () => s(xe) && o.set(Date.now(), 1)), t(Ln, () => s(xe) && s(xt, o));
|
|
2941
2948
|
let a = 0;
|
|
2942
2949
|
t(
|
|
2943
2950
|
Bt,
|
|
2944
2951
|
() => {
|
|
2945
|
-
e || (s(Co), s(
|
|
2952
|
+
e || (s(Co), s(xe) && (s(kn), !(a++ % 5) && s(ae, {
|
|
2946
2953
|
fps: s(Tn),
|
|
2947
2954
|
realFps: s(Ln),
|
|
2948
2955
|
fov: s(nn),
|
|
@@ -2957,9 +2964,9 @@ function Il(n) {
|
|
|
2957
2964
|
for (const l of r.keys())
|
|
2958
2965
|
u - l <= 1e3 ? c++ : A.push(l);
|
|
2959
2966
|
return A.forEach((l) => r.delete(l)), Math.min(c, 60);
|
|
2960
|
-
}), window.addEventListener("beforeunload", () => s(Vn)), t(
|
|
2967
|
+
}), window.addEventListener("beforeunload", () => s(Vn)), t(Ko, async (r) => {
|
|
2961
2968
|
s(ae, { scene: "small (obj)" });
|
|
2962
|
-
const A = await
|
|
2969
|
+
const A = await Xe(r, n);
|
|
2963
2970
|
if (A) {
|
|
2964
2971
|
const u = URL.createObjectURL(new Blob([A], { type: "application/octet-stream" }));
|
|
2965
2972
|
new Cl().load(u, (c) => s(O).add(c)), s(Ae, !0), s(ot, !0);
|
|
@@ -2973,7 +2980,7 @@ function yl(n) {
|
|
|
2973
2980
|
}
|
|
2974
2981
|
function Oa(n) {
|
|
2975
2982
|
const e = { ...n };
|
|
2976
|
-
return e.position = e.position ? [...e.position] : [0, -5, 15], e.lookAt = e.lookAt ? [...e.lookAt] : [0, 0, 0], e.lookUp = e.lookUp ? [...e.lookUp] : [0, -1, 0], e.fov ?? (e.fov = 45), e.near ?? (e.near = 0.1), e.far ?? (e.far = 1e3), e.enableDamping ?? (e.enableDamping = !0), e.autoRotate ?? (e.autoRotate = !0), e.enableZoom ?? (e.enableZoom = !0), e.enableRotate ?? (e.enableRotate = !0), e.enablePan ?? (e.enablePan = !0), e.enableKeyboard ?? (e.enableKeyboard = !0), e.bigSceneMode ?? (e.bigSceneMode = !1), e.pointcloudMode ?? (e.pointcloudMode = !e.bigSceneMode), e.lightFactor ?? (e.lightFactor = 1.1), e.debugMode ?? (e.debugMode = location.protocol === "http:" || /^test\./.test(location.host)), e.markMode ?? (e.markMode = !1), e.markVisible ?? (e.markVisible = !0), e.meterScale ?? (e.meterScale = 1), e.background ?? (e.background = "#000000"), e.minDistance ?? (e.minDistance = 0.1), e.maxDistance ?? (e.maxDistance = 1e3), e.qualityLevel ?? (e.qualityLevel =
|
|
2983
|
+
return e.position = e.position ? [...e.position] : [0, -5, 15], e.lookAt = e.lookAt ? [...e.lookAt] : [0, 0, 0], e.lookUp = e.lookUp ? [...e.lookUp] : [0, -1, 0], e.fov ?? (e.fov = 45), e.near ?? (e.near = 0.1), e.far ?? (e.far = 1e3), e.enableDamping ?? (e.enableDamping = !0), e.autoRotate ?? (e.autoRotate = !0), e.enableZoom ?? (e.enableZoom = !0), e.enableRotate ?? (e.enableRotate = !0), e.enablePan ?? (e.enablePan = !0), e.enableKeyboard ?? (e.enableKeyboard = !0), e.bigSceneMode ?? (e.bigSceneMode = !1), e.pointcloudMode ?? (e.pointcloudMode = !e.bigSceneMode), e.lightFactor ?? (e.lightFactor = 1.1), e.debugMode ?? (e.debugMode = location.protocol === "http:" || /^test\./.test(location.host)), e.markMode ?? (e.markMode = !1), e.markVisible ?? (e.markVisible = !0), e.meterScale ?? (e.meterScale = 1), e.background ?? (e.background = "#000000"), e.minDistance ?? (e.minDistance = 0.1), e.maxDistance ?? (e.maxDistance = 1e3), e.qualityLevel ?? (e.qualityLevel = ke.Default5), e.sortType ?? (e.sortType = Rt.Default1), e.transitionEffect ?? (e.transitionEffect = $n.ModelCenterCirccle), e;
|
|
2977
2984
|
}
|
|
2978
2985
|
function wl(n) {
|
|
2979
2986
|
let e;
|
|
@@ -2986,7 +2993,7 @@ function wl(n) {
|
|
|
2986
2993
|
premultipliedAlpha: !1,
|
|
2987
2994
|
precision: "highp",
|
|
2988
2995
|
powerPreference: "high-performance"
|
|
2989
|
-
}), t.setSize(e.clientWidth, e.clientHeight), t.setPixelRatio(Math.min(devicePixelRatio, n.qualityLevel >
|
|
2996
|
+
}), t.setSize(e.clientWidth, e.clientHeight), t.setPixelRatio(Math.min(devicePixelRatio, n.qualityLevel > ke.Default5 ? 2 : 1)), n.renderer = t), t.domElement.classList.add("gsviewer-canvas"), e.appendChild(t.domElement), t;
|
|
2990
2997
|
}
|
|
2991
2998
|
function El(n) {
|
|
2992
2999
|
let e = n.camera;
|
|
@@ -3014,19 +3021,19 @@ function Ql(n) {
|
|
|
3014
3021
|
Ci,
|
|
3015
3022
|
() => o.postMessage({
|
|
3016
3023
|
[sl]: !0,
|
|
3017
|
-
[_a]: t(
|
|
3018
|
-
[qs]: t(
|
|
3019
|
-
[Na]: t(
|
|
3020
|
-
[Ha]: t(
|
|
3024
|
+
[_a]: t(Xs),
|
|
3025
|
+
[qs]: t(Ks),
|
|
3026
|
+
[Na]: t(be)?.meta?.depthNearRate,
|
|
3027
|
+
[Ha]: t(be)?.meta?.depthNearValue
|
|
3021
3028
|
})
|
|
3022
3029
|
), (async () => o.postMessage({
|
|
3023
3030
|
[$c]: !0,
|
|
3024
3031
|
[zc]: await t(Qt),
|
|
3025
3032
|
[Yc]: t(de),
|
|
3026
|
-
[_a]: t(
|
|
3027
|
-
[qs]: t(
|
|
3028
|
-
[Na]: t(
|
|
3029
|
-
[Ha]: t(
|
|
3033
|
+
[_a]: t(Xs),
|
|
3034
|
+
[qs]: t(Ks),
|
|
3035
|
+
[Na]: t(be)?.meta?.depthNearRate,
|
|
3036
|
+
[Ha]: t(be)?.meta?.depthNearValue
|
|
3030
3037
|
}))();
|
|
3031
3038
|
}
|
|
3032
3039
|
class xl extends zn {
|
|
@@ -3056,7 +3063,7 @@ class xl extends zn {
|
|
|
3056
3063
|
], p = [];
|
|
3057
3064
|
l.forEach((f) => {
|
|
3058
3065
|
p.push(f.x, f.y, f.z), p.push(f.x + (f.x < i ? A : -A), f.y, f.z), p.push(f.x, f.y, f.z), p.push(f.x, f.y + (f.y < o ? u : -u), f.z), p.push(f.x, f.y, f.z), p.push(f.x, f.y, f.z + (f.z < a ? c : -c));
|
|
3059
|
-
}), this.boxLines.geometry.setAttribute("position", new
|
|
3066
|
+
}), this.boxLines.geometry.setAttribute("position", new Ke(p, 3)), r && (this.visible = !0);
|
|
3060
3067
|
}
|
|
3061
3068
|
dispose() {
|
|
3062
3069
|
this.boxLines = null;
|
|
@@ -3072,7 +3079,7 @@ const Yn = (() => {
|
|
|
3072
3079
|
e ? (a?.stop(), r(!1)) : r(!0);
|
|
3073
3080
|
return;
|
|
3074
3081
|
}
|
|
3075
|
-
const A = await
|
|
3082
|
+
const A = await Xe(s || "https://reall3d.com/demo-models/demo/background1.mp3"), u = URL.createObjectURL(new Blob([A], { type: "application/octet-stream" }));
|
|
3076
3083
|
new ao().load(
|
|
3077
3084
|
u,
|
|
3078
3085
|
(c) => {
|
|
@@ -3158,7 +3165,7 @@ class He extends fe {
|
|
|
3158
3165
|
const t = this, s = new Zn(), i = (l, p, f) => s.on(l, p, f), o = (l, ...p) => s.fire(l, ...p);
|
|
3159
3166
|
let a = !1;
|
|
3160
3167
|
const r = yl(e), A = r.camera || r.controls?.object;
|
|
3161
|
-
i(R, () => r), i(Pt, () => r.renderer.domElement), i(pe, () => A), i(nn, () => A.fov), i(Re, (l = !1) => l ? A.position.clone() : A.position), i(Ye, (l = !1) => r.controls ? l ? r.controls.target.clone() : r.controls.target : new v()), i(yo, () => A.projectionMatrix.clone().multiply(A.matrixWorldInverse).multiply(t.matrix).toArray()), i(wo, () => A.projectionMatrix.clone().multiply(A.matrixWorldInverse)), i(Po, () => A.getWorldDirection(new v()).toArray()), i(Zt, () => r.renderer), i(O, () => r.scene), i(de, () => r.bigSceneMode), i(Fs, () => r.pointcloudMode), i(
|
|
3168
|
+
i(R, () => r), i(Pt, () => r.renderer.domElement), i(pe, () => A), i(nn, () => A.fov), i(Re, (l = !1) => l ? A.position.clone() : A.position), i(Ye, (l = !1) => r.controls ? l ? r.controls.target.clone() : r.controls.target : new v()), i(yo, () => A.projectionMatrix.clone().multiply(A.matrixWorldInverse).multiply(t.matrix).toArray()), i(wo, () => A.projectionMatrix.clone().multiply(A.matrixWorldInverse)), i(Po, () => A.getWorldDirection(new v()).toArray()), i(Zt, () => r.renderer), i(O, () => r.scene), i(de, () => r.bigSceneMode), i(Fs, () => r.pointcloudMode), i(be, () => t), i(Xs, () => r.qualityLevel || ke.Default5), i(Ks, () => r.sortType || Rt.Default1), i(qo, () => a), i(ji, (l, p = 1) => Math.abs(A.position.distanceTo(l)) < p && yc(A, l)), i(ee, () => r.viewerEvents?.fire(Ae));
|
|
3162
3169
|
let u = !1;
|
|
3163
3170
|
i(qi, () => u), i(St, () => u = !0, !0), i(St, () => !o(de) && setTimeout(() => !t.audioText?.opts.position && t.audioText?.play(), 5e3), !0), Ei(s), xi(s), Lc(s), Ql(s), ul(s), dl(s), t.name = `${r.name || t.id}`, t.events = s, t.opts = r, (async () => (t.copy(await s.fire(Qo)), t.meta.transform && t.applyMatrix4(new Fe().fromArray(t.meta.transform)), t.frustumCulled = !1, t.onBeforeRender = () => {
|
|
3164
3171
|
o(Eo), o(Bo, performance.now()), t.audioText.opts.position && o(qi) && o(ji, new v().fromArray(t.audioText.opts.position), t.audioText.opts.distance) && t.audioText.play();
|
|
@@ -3179,7 +3186,7 @@ class He extends fe {
|
|
|
3179
3186
|
const t = this;
|
|
3180
3187
|
if (t.disposed) return;
|
|
3181
3188
|
const s = (o, ...a) => t.events.fire(o, ...a), i = t.opts;
|
|
3182
|
-
return e && (e.pointcloudMode !== void 0 && s(ht, e.pointcloudMode), e.lightFactor !== void 0 && s(
|
|
3189
|
+
return e && (e.pointcloudMode !== void 0 && s(ht, e.pointcloudMode), e.lightFactor !== void 0 && s(Kt, e.lightFactor), e.maxRenderCountOfMobile !== void 0 && (i.maxRenderCountOfMobile = e.maxRenderCountOfMobile), e.maxRenderCountOfPc !== void 0 && (i.maxRenderCountOfPc = e.maxRenderCountOfPc), e.qualityLevel !== void 0 && (i.qualityLevel = e.qualityLevel) && s(zs), !i.mapMode && e.sortType !== void 0 && (i.sortType = e.sortType) && s(Ci), s(ee)), { ...i };
|
|
3183
3190
|
}
|
|
3184
3191
|
/**
|
|
3185
3192
|
* 添加渲染指定高斯模型
|
|
@@ -3261,7 +3268,7 @@ function Ml(n) {
|
|
|
3261
3268
|
}
|
|
3262
3269
|
});
|
|
3263
3270
|
}
|
|
3264
|
-
const Va = { type: "change" }, Bi = { type: "start" }, mr = { type: "end" }, mn = new Wr(), Ja = new Gr(), vl = Math.cos(70 * at.DEG2RAD), oe = new v(),
|
|
3271
|
+
const Va = { type: "change" }, Bi = { type: "start" }, mr = { type: "end" }, mn = new Wr(), Ja = new Gr(), vl = Math.cos(70 * at.DEG2RAD), oe = new v(), Ee = 2 * Math.PI, ne = {
|
|
3265
3272
|
NONE: -1,
|
|
3266
3273
|
ROTATE: 0,
|
|
3267
3274
|
DOLLY: 1,
|
|
@@ -3309,7 +3316,7 @@ class Cr extends Hr {
|
|
|
3309
3316
|
const t = this.object.position;
|
|
3310
3317
|
oe.copy(t).sub(this.target), oe.applyQuaternion(this._quat), this._spherical.setFromVector3(oe), this.autoRotate && this.state === ne.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
3311
3318
|
let s = this.minAzimuthAngle, i = this.maxAzimuthAngle;
|
|
3312
|
-
isFinite(s) && isFinite(i) && (s < -Math.PI ? s +=
|
|
3319
|
+
isFinite(s) && isFinite(i) && (s < -Math.PI ? s += Ee : s > Math.PI && (s -= Ee), i < -Math.PI ? i += Ee : i > Math.PI && (i -= Ee), s <= i ? this._spherical.theta = Math.max(s, Math.min(i, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + i) / 2 ? Math.max(s, this._spherical.theta) : Math.min(i, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
3313
3320
|
let o = !1;
|
|
3314
3321
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
3315
3322
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
@@ -3341,7 +3348,7 @@ class Cr extends Hr {
|
|
|
3341
3348
|
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > Qs || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Qs || this._lastTargetPosition.distanceToSquared(this.target) > Qs ? (this.dispatchEvent(Va), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
3342
3349
|
}
|
|
3343
3350
|
_getAutoRotationAngle(e) {
|
|
3344
|
-
return e !== null ?
|
|
3351
|
+
return e !== null ? Ee / 60 * this.autoRotateSpeed * e : Ee / 60 / 60 * this.autoRotateSpeed;
|
|
3345
3352
|
}
|
|
3346
3353
|
_getZoomScale(e) {
|
|
3347
3354
|
const t = Math.abs(e * 0.01);
|
|
@@ -3400,7 +3407,7 @@ class Cr extends Hr {
|
|
|
3400
3407
|
_handleMouseMoveRotate(e) {
|
|
3401
3408
|
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
3402
3409
|
const t = this.domElement;
|
|
3403
|
-
this._rotateLeft(
|
|
3410
|
+
this._rotateLeft(Ee * this._rotateDelta.x / t.clientHeight), this._rotateUp(Ee * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
3404
3411
|
}
|
|
3405
3412
|
_handleMouseMoveDolly(e) {
|
|
3406
3413
|
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
@@ -3415,16 +3422,16 @@ class Cr extends Hr {
|
|
|
3415
3422
|
let t = !1;
|
|
3416
3423
|
switch (e.code) {
|
|
3417
3424
|
case this.keys.UP:
|
|
3418
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(
|
|
3425
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(Ee * this.rotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
3419
3426
|
break;
|
|
3420
3427
|
case this.keys.BOTTOM:
|
|
3421
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-
|
|
3428
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-Ee * this.rotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
3422
3429
|
break;
|
|
3423
3430
|
case this.keys.LEFT:
|
|
3424
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(
|
|
3431
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(Ee * this.rotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
3425
3432
|
break;
|
|
3426
3433
|
case this.keys.RIGHT:
|
|
3427
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-
|
|
3434
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-Ee * this.rotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
3428
3435
|
break;
|
|
3429
3436
|
}
|
|
3430
3437
|
t && (e.preventDefault(), this.update());
|
|
@@ -3464,7 +3471,7 @@ class Cr extends Hr {
|
|
|
3464
3471
|
}
|
|
3465
3472
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
3466
3473
|
const t = this.domElement;
|
|
3467
|
-
this._rotateLeft(
|
|
3474
|
+
this._rotateLeft(Ee * this._rotateDelta.x / t.clientHeight), this._rotateUp(Ee * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
3468
3475
|
}
|
|
3469
3476
|
_handleTouchMovePan(e) {
|
|
3470
3477
|
if (this._pointers.length === 1)
|
|
@@ -3702,12 +3709,12 @@ class Yl extends Cr {
|
|
|
3702
3709
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: je.PAN, MIDDLE: je.DOLLY, RIGHT: je.ROTATE }, this.touches = { ONE: it.PAN, TWO: it.DOLLY_ROTATE };
|
|
3703
3710
|
}
|
|
3704
3711
|
}
|
|
3705
|
-
const
|
|
3712
|
+
const Xa = new ai(), Cn = new v();
|
|
3706
3713
|
class Ir extends Ms {
|
|
3707
3714
|
constructor() {
|
|
3708
3715
|
super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry";
|
|
3709
3716
|
const e = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], t = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], s = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
|
3710
|
-
this.setIndex(s), this.setAttribute("position", new
|
|
3717
|
+
this.setIndex(s), this.setAttribute("position", new Ke(e, 3)), this.setAttribute("uv", new Ke(t, 2));
|
|
3711
3718
|
}
|
|
3712
3719
|
applyMatrix4(e) {
|
|
3713
3720
|
const t = this.attributes.instanceStart, s = this.attributes.instanceEnd;
|
|
@@ -3741,7 +3748,7 @@ class Ir extends Ms {
|
|
|
3741
3748
|
computeBoundingBox() {
|
|
3742
3749
|
this.boundingBox === null && (this.boundingBox = new ai());
|
|
3743
3750
|
const e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
|
|
3744
|
-
e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e),
|
|
3751
|
+
e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), Xa.setFromBufferAttribute(t), this.boundingBox.union(Xa));
|
|
3745
3752
|
}
|
|
3746
3753
|
computeBoundingSphere() {
|
|
3747
3754
|
this.boundingSphere === null && (this.boundingSphere = new Ao()), this.boundingBox === null && this.computeBoundingBox();
|
|
@@ -4234,7 +4241,7 @@ class Ft extends no {
|
|
|
4234
4241
|
this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
|
|
4235
4242
|
}
|
|
4236
4243
|
}
|
|
4237
|
-
const xs = new ze(),
|
|
4244
|
+
const xs = new ze(), Ka = new v(), Za = new v(), ce = new ze(), le = new ze(), Pe = new ze(), Bs = new v(), Ss = new Fe(), ue = new zr(), ja = new v(), In = new ai(), yn = new Ao(), Ue = new ze();
|
|
4238
4245
|
let Ge, ft;
|
|
4239
4246
|
function qa(n, e, t) {
|
|
4240
4247
|
return Ue.set(0, 0, -e, 1).applyMatrix4(n.projectionMatrix), Ue.multiplyScalar(1 / Ue.w), Ue.x = ft / t.width, Ue.y = ft / t.height, Ue.applyMatrix4(n.projectionMatrixInverse), Ue.multiplyScalar(1 / Ue.w), Math.abs(Math.max(Ue.x, Ue.y));
|
|
@@ -4263,10 +4270,10 @@ function Ol(n, e, t) {
|
|
|
4263
4270
|
if (ce.fromBufferAttribute(A, p), le.fromBufferAttribute(u, p), ce.w = 1, le.w = 1, ce.applyMatrix4(Ss), le.applyMatrix4(Ss), ce.z > l && le.z > l)
|
|
4264
4271
|
continue;
|
|
4265
4272
|
if (ce.z > l) {
|
|
4266
|
-
const
|
|
4273
|
+
const Q = ce.z - le.z, y = (ce.z - l) / Q;
|
|
4267
4274
|
ce.lerp(le, y);
|
|
4268
4275
|
} else if (le.z > l) {
|
|
4269
|
-
const
|
|
4276
|
+
const Q = le.z - ce.z, y = (le.z - l) / Q;
|
|
4270
4277
|
le.lerp(ce, y);
|
|
4271
4278
|
}
|
|
4272
4279
|
ce.applyMatrix4(s), le.applyMatrix4(s), ce.multiplyScalar(1 / ce.w), le.multiplyScalar(1 / le.w), ce.x *= o.x / 2, ce.y *= o.y / 2, le.x *= o.x / 2, le.y *= o.y / 2, ue.start.copy(ce), ue.start.z = 0, ue.end.copy(le), ue.end.z = 0;
|
|
@@ -4275,10 +4282,10 @@ function Ol(n, e, t) {
|
|
|
4275
4282
|
const d = at.lerp(ce.z, le.z, C), h = d >= -1 && d <= 1, g = Bs.distanceTo(ja) < ft * 0.5;
|
|
4276
4283
|
if (h && g) {
|
|
4277
4284
|
ue.start.fromBufferAttribute(A, p), ue.end.fromBufferAttribute(u, p), ue.start.applyMatrix4(a), ue.end.applyMatrix4(a);
|
|
4278
|
-
const
|
|
4279
|
-
Ge.distanceSqToSegment(ue.start, ue.end, y,
|
|
4285
|
+
const Q = new v(), y = new v();
|
|
4286
|
+
Ge.distanceSqToSegment(ue.start, ue.end, y, Q), t.push({
|
|
4280
4287
|
point: y,
|
|
4281
|
-
pointOnLine:
|
|
4288
|
+
pointOnLine: Q,
|
|
4282
4289
|
distance: Ge.origin.distanceTo(y),
|
|
4283
4290
|
object: n,
|
|
4284
4291
|
face: null,
|
|
@@ -4297,7 +4304,7 @@ class Vl extends fe {
|
|
|
4297
4304
|
computeLineDistances() {
|
|
4298
4305
|
const e = this.geometry, t = e.attributes.instanceStart, s = e.attributes.instanceEnd, i = new Float32Array(2 * t.count);
|
|
4299
4306
|
for (let a = 0, r = 0, A = t.count; a < A; a++, r += 2)
|
|
4300
|
-
|
|
4307
|
+
Ka.fromBufferAttribute(t, a), Za.fromBufferAttribute(s, a), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + Ka.distanceTo(Za);
|
|
4301
4308
|
const o = new Ds(i, 2, 1);
|
|
4302
4309
|
return e.setAttribute("instanceDistanceStart", new Et(o, 1, 0)), e.setAttribute("instanceDistanceEnd", new Et(o, 1, 1)), this;
|
|
4303
4310
|
}
|
|
@@ -4365,7 +4372,7 @@ class pt extends Vl {
|
|
|
4365
4372
|
}
|
|
4366
4373
|
}
|
|
4367
4374
|
const $a = new v(), Jl = new vt(), eo = new v();
|
|
4368
|
-
class
|
|
4375
|
+
class Xl extends zn {
|
|
4369
4376
|
constructor(e = document.createElement("div")) {
|
|
4370
4377
|
super(), this.isCSS3DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.pointerEvents = "auto", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
|
|
4371
4378
|
this.traverse(function(t) {
|
|
@@ -4377,7 +4384,7 @@ class Kl extends zn {
|
|
|
4377
4384
|
return super.copy(e, t), this.element = e.element.cloneNode(!0), this;
|
|
4378
4385
|
}
|
|
4379
4386
|
}
|
|
4380
|
-
class Ce extends
|
|
4387
|
+
class Ce extends Xl {
|
|
4381
4388
|
constructor(e) {
|
|
4382
4389
|
super(e), this.isCSS3DSprite = !0, this.rotation2D = 0;
|
|
4383
4390
|
}
|
|
@@ -4385,7 +4392,7 @@ class Ce extends Kl {
|
|
|
4385
4392
|
return super.copy(e, t), this.rotation2D = e.rotation2D, this;
|
|
4386
4393
|
}
|
|
4387
4394
|
}
|
|
4388
|
-
const _e = new Fe(),
|
|
4395
|
+
const _e = new Fe(), Kl = new Fe();
|
|
4389
4396
|
class Zl {
|
|
4390
4397
|
constructor(e = {}) {
|
|
4391
4398
|
const t = this;
|
|
@@ -4406,9 +4413,9 @@ class Zl {
|
|
|
4406
4413
|
}, this.render = function(d, h) {
|
|
4407
4414
|
const g = h.projectionMatrix.elements[5] * a;
|
|
4408
4415
|
h.view && h.view.enabled ? (u.style.transform = `translate( ${-h.view.offsetX * (s / h.view.width)}px, ${-h.view.offsetY * (i / h.view.height)}px )`, u.style.transform += `scale( ${h.view.fullWidth / h.view.width}, ${h.view.fullHeight / h.view.height} )`) : u.style.transform = "", d.matrixWorldAutoUpdate === !0 && d.updateMatrixWorld(), h.parent === null && h.matrixWorldAutoUpdate === !0 && h.updateMatrixWorld();
|
|
4409
|
-
let
|
|
4410
|
-
h.isOrthographicCamera && (
|
|
4411
|
-
const M = h.view && h.view.enabled ? h.view.height / h.view.fullHeight : 1,
|
|
4416
|
+
let Q, y;
|
|
4417
|
+
h.isOrthographicCamera && (Q = -(h.right + h.left) / 2, y = (h.top + h.bottom) / 2);
|
|
4418
|
+
const M = h.view && h.view.enabled ? h.view.height / h.view.fullHeight : 1, S = h.isOrthographicCamera ? `scale( ${M} )scale(` + g + ")translate(" + l(Q) + "px," + l(y) + "px)" + p(h.matrixWorldInverse) : `scale( ${M} )translateZ(` + g + "px)" + p(h.matrixWorldInverse), I = (h.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + S + "translate(" + o + "px," + a + "px)";
|
|
4412
4419
|
r.camera.style !== I && (c.style.transform = I, r.camera.style = I), C(d, d, h);
|
|
4413
4420
|
}, this.setSize = function(d, h) {
|
|
4414
4421
|
s = d, i = h, o = s / 2, a = i / 2, A.style.width = d + "px", A.style.height = h + "px", u.style.width = d + "px", u.style.height = h + "px", c.style.width = d + "px", c.style.height = h + "px";
|
|
@@ -4429,7 +4436,7 @@ class Zl {
|
|
|
4429
4436
|
for (let h = 0, g = d.children.length; h < g; h++)
|
|
4430
4437
|
m(d.children[h]);
|
|
4431
4438
|
}
|
|
4432
|
-
function C(d, h, g,
|
|
4439
|
+
function C(d, h, g, Q) {
|
|
4433
4440
|
if (d.visible === !1) {
|
|
4434
4441
|
m(d);
|
|
4435
4442
|
return;
|
|
@@ -4438,12 +4445,12 @@ class Zl {
|
|
|
4438
4445
|
const y = d.layers.test(g.layers) === !0, M = d.element;
|
|
4439
4446
|
if (M.style.display = y === !0 ? "" : "none", y === !0) {
|
|
4440
4447
|
d.onBeforeRender(t, h, g);
|
|
4441
|
-
let
|
|
4442
|
-
d.isCSS3DSprite ? (_e.copy(g.matrixWorldInverse), _e.transpose(), d.rotation2D !== 0 && _e.multiply(
|
|
4443
|
-
const
|
|
4444
|
-
if (
|
|
4445
|
-
M.style.transform =
|
|
4446
|
-
const I = { style:
|
|
4448
|
+
let S;
|
|
4449
|
+
d.isCSS3DSprite ? (_e.copy(g.matrixWorldInverse), _e.transpose(), d.rotation2D !== 0 && _e.multiply(Kl.makeRotationZ(d.rotation2D)), d.matrixWorld.decompose($a, Jl, eo), _e.setPosition($a), _e.scale(eo), _e.elements[3] = 0, _e.elements[7] = 0, _e.elements[11] = 0, _e.elements[15] = 1, S = f(_e)) : S = f(d.matrixWorld);
|
|
4450
|
+
const B = r.objects.get(d);
|
|
4451
|
+
if (B === void 0 || B.style !== S) {
|
|
4452
|
+
M.style.transform = S;
|
|
4453
|
+
const I = { style: S };
|
|
4447
4454
|
r.objects.set(d, I);
|
|
4448
4455
|
}
|
|
4449
4456
|
M.parentNode !== c && c.appendChild(M), d.onAfterRender(t, h, g);
|
|
@@ -4593,9 +4600,9 @@ class $s extends pt {
|
|
|
4593
4600
|
}, C.oncontextmenu = (M) => M.preventDefault();
|
|
4594
4601
|
const d = new Ce(C);
|
|
4595
4602
|
d.position.copy(i), d.element.style.pointerEvents = "none", d.scale.set(0.01, 0.01, 0.01), d.visible = s.mainTagVisible;
|
|
4596
|
-
const g = (i.distanceTo(o) * t.events.fire(R).meterScale).toFixed(2) + " m",
|
|
4597
|
-
|
|
4598
|
-
const y = new Ce(
|
|
4603
|
+
const g = (i.distanceTo(o) * t.events.fire(R).meterScale).toFixed(2) + " m", Q = document.createElement("div");
|
|
4604
|
+
Q.innerHTML = `<span class="${m}-distance-tag ${m}-distance-tag0" style="color:${s.distanceTagColor};background:${s.distanceTagBackground};opacity:${s.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${g}</span>`, Q.classList.add("mark-wrap-line", `${m}`, "distance-warp"), Q.style.position = "absolute", Q.style.borderRadius = "4px", Q.style.pointerEvents = "none";
|
|
4605
|
+
const y = new Ce(Q);
|
|
4599
4606
|
y.position.copy(a), y.element.style.pointerEvents = "none", y.scale.set(8e-3, 8e-3, 8e-3), y.visible = s.distanceTagVisible, t.add(l, p, d, y), t.data = s, t.circleStart = l, t.circleEnd = p, t.css3dTag = y, t.css3dMainTag = d, t.events.fire(At, t);
|
|
4600
4607
|
}
|
|
4601
4608
|
getMarkData(e = !1) {
|
|
@@ -4987,9 +4994,9 @@ class ti extends pt {
|
|
|
4987
4994
|
}
|
|
4988
4995
|
s.css3dAreaTag.visible = i.points.length > 6 && i.areaTagVisible;
|
|
4989
4996
|
for (let f = s.css3dTags.length; f < c; f++) {
|
|
4990
|
-
const m = new v().fromArray(i.points.slice(f * 3, f * 3 + 3)), C = new v().fromArray(i.points.slice(f * 3 + 3, f * 3 + 6)), d = new v((m.x + C.x) / 2, (m.y + C.y) / 2, (m.z + C.z) / 2), g = (m.distanceTo(C) * s.events.fire(R).meterScale).toFixed(2) + " m",
|
|
4991
|
-
|
|
4992
|
-
const y = new Ce(
|
|
4997
|
+
const m = new v().fromArray(i.points.slice(f * 3, f * 3 + 3)), C = new v().fromArray(i.points.slice(f * 3 + 3, f * 3 + 6)), d = new v((m.x + C.x) / 2, (m.y + C.y) / 2, (m.z + C.z) / 2), g = (m.distanceTo(C) * s.events.fire(R).meterScale).toFixed(2) + " m", Q = document.createElement("div");
|
|
4998
|
+
Q.innerText = g, Q.style.color = "white", Q.classList.add("mark-wrap-plans", `${u}`, "distance-warp"), Q.style.position = "absolute", Q.style.borderRadius = "4px", Q.style.display = "none";
|
|
4999
|
+
const y = new Ce(Q);
|
|
4993
5000
|
y.position.copy(d), y.element.style.pointerEvents = "none", y.scale.set(8e-3, 8e-3, 8e-3), y.visible = i.distanceTagVisible, s.css3dTags.push(y), s.group.add(y);
|
|
4994
5001
|
}
|
|
4995
5002
|
s.drawPlans(i), t || (s.css3dTags[s.css3dTags.length - 1].visible = !1), s.data = i, s.events.fire(At, s);
|
|
@@ -5173,7 +5180,7 @@ let jl = class {
|
|
|
5173
5180
|
}
|
|
5174
5181
|
};
|
|
5175
5182
|
function ql(n) {
|
|
5176
|
-
const e = (I, x,
|
|
5183
|
+
const e = (I, x, E) => n.on(I, x, E), t = (I, ...x) => n.fire(I, ...x), s = t(Pt);
|
|
5177
5184
|
let i = /* @__PURE__ */ new Set(), o, a = new jl(), r;
|
|
5178
5185
|
e(Fi, () => {
|
|
5179
5186
|
t(q).autoRotate = t(R).autoRotate = !0;
|
|
@@ -5181,23 +5188,23 @@ function ql(n) {
|
|
|
5181
5188
|
t(q).autoRotate = t(R).autoRotate = !1, I && t(Nn);
|
|
5182
5189
|
}), e(as, (I = !0) => {
|
|
5183
5190
|
if (o) return;
|
|
5184
|
-
const x = t(q),
|
|
5185
|
-
x.object.up.transformDirection(
|
|
5191
|
+
const x = t(q), E = I ? Math.PI / 128 : -(Math.PI / 128), b = new Fe().makeRotationAxis(new v(0, 0, -1).transformDirection(x.object.matrixWorld), E);
|
|
5192
|
+
x.object.up.transformDirection(b), t(Ae);
|
|
5186
5193
|
}), e(zi, () => {
|
|
5187
5194
|
o || n.fire(as, !0);
|
|
5188
5195
|
}), e(Oi, () => {
|
|
5189
5196
|
o || n.fire(as, !1);
|
|
5190
5197
|
}), e(Un, (I) => {
|
|
5191
5198
|
const x = t(R);
|
|
5192
|
-
I ?? (I = !x.pointcloudMode), x.pointcloudMode = I, t(O).traverse((
|
|
5199
|
+
I ?? (I = !x.pointcloudMode), x.pointcloudMode = I, t(O).traverse((b) => b instanceof He && b.fire(ht, I));
|
|
5193
5200
|
}), e(_n, () => {
|
|
5194
5201
|
t(O).traverse((x) => x instanceof He && x.fire(Ps));
|
|
5195
|
-
}), e(
|
|
5196
|
-
t(O).traverse((
|
|
5197
|
-
}), e(
|
|
5202
|
+
}), e(Kt, (I) => {
|
|
5203
|
+
t(O).traverse((E) => E instanceof He && E.fire(Kt, I));
|
|
5204
|
+
}), e(Ki, () => {
|
|
5198
5205
|
const I = t(O);
|
|
5199
5206
|
let x;
|
|
5200
|
-
I.traverse((
|
|
5207
|
+
I.traverse((E) => E instanceof He && (x = E)), x && t(Ls, x.fire(Xo));
|
|
5201
5208
|
}), e(Jn, () => {
|
|
5202
5209
|
if (!i.size) return;
|
|
5203
5210
|
const I = t(R);
|
|
@@ -5206,21 +5213,21 @@ function ql(n) {
|
|
|
5206
5213
|
t(Gt), i.clear();
|
|
5207
5214
|
return;
|
|
5208
5215
|
}
|
|
5209
|
-
i.has("Space") ? (I.bigSceneMode ? t(Un) : t(_n), i.clear()) : i.has("Escape") ? (Yn.fire(yi), i.clear()) : i.has("KeyR") ? (I.autoRotate ? t(he) : t(Fi), i.clear()) : i.has("KeyM") ? (t(jt, !I.markVisible), i.clear()) : i.has("ArrowLeft") ? (t(zi), t(xn, !0), i.clear()) : i.has("ArrowRight") ? (t(Oi), t(xn, !0), i.clear()) : i.has("KeyP") ? (t(ot, !0), i.clear()) : i.has("Equal") ? (t(sn), i.clear()) : i.has("Minus") ? (t(on), i.clear()) : i.has("KeyY") ? (t(an, !1), t(Hs), i.clear()) : i.has("KeyI") ? (t(Yo), i.clear()) : i.has("KeyF") ? (t(
|
|
5216
|
+
i.has("Space") ? (I.bigSceneMode ? t(Un) : t(_n), i.clear()) : i.has("Escape") ? (Yn.fire(yi), i.clear()) : i.has("KeyR") ? (I.autoRotate ? t(he) : t(Fi), i.clear()) : i.has("KeyM") ? (t(jt, !I.markVisible), i.clear()) : i.has("ArrowLeft") ? (t(zi), t(xn, !0), i.clear()) : i.has("ArrowRight") ? (t(Oi), t(xn, !0), i.clear()) : i.has("KeyP") ? (t(ot, !0), i.clear()) : i.has("Equal") ? (t(sn), i.clear()) : i.has("Minus") ? (t(on), i.clear()) : i.has("KeyY") ? (t(an, !1), t(Hs), i.clear()) : i.has("KeyI") ? (t(Yo), i.clear()) : i.has("KeyF") ? (t(Ki), i.clear()) : i.has("F2") ? (!I.bigSceneMode && window.open("/editor/index.html?url=" + encodeURIComponent(t(be).meta.url)), i.clear()) : i.has("KeyW") ? (tu(t(q), 0.15), i.clear()) : i.has("KeyS") ? (nu(t(q), 0.15), i.clear()) : i.has("KeyA") ? ($l(t(q), 0.15), i.clear()) : i.has("KeyD") ? (eu(t(q), 0.15), i.clear()) : i.has("KeyQ") ? (su(t(q)), i.clear()) : i.has("KeyE") ? (iu(t(q)), i.clear()) : i.has("KeyC") ? (au(t(q)), i.clear()) : i.has("KeyZ") && (ou(t(q)), i.clear());
|
|
5210
5217
|
}), e(Vt, async (I, x) => {
|
|
5211
5218
|
if (a.move) return;
|
|
5212
|
-
const
|
|
5213
|
-
|
|
5214
|
-
}), e(
|
|
5215
|
-
const
|
|
5216
|
-
|
|
5219
|
+
const E = await t(Rn, I, x);
|
|
5220
|
+
E.length && t(Ls, E[0], !0, !1);
|
|
5221
|
+
}), e(Se, async (I, x) => {
|
|
5222
|
+
const E = t(O), b = [];
|
|
5223
|
+
E.traverse((F) => F instanceof He && b.push(F));
|
|
5217
5224
|
const T = await t(Rn, I, x);
|
|
5218
|
-
return T.length ? (
|
|
5225
|
+
return T.length ? (b.length && b[0].fire(Qn, T[0].x, T[0].y, T[0].z, !0), new v(T[0].x, T[0].y, T[0].z)) : (b.length && b[0].fire(Qn, 0, 0, 0, !1), null);
|
|
5219
5226
|
}), e(ui, async () => {
|
|
5220
5227
|
const I = t(O), x = [];
|
|
5221
|
-
I.traverse((
|
|
5222
|
-
for (let
|
|
5223
|
-
x[
|
|
5228
|
+
I.traverse((E) => E instanceof He && x.push(E));
|
|
5229
|
+
for (let E = 0; E < x.length; E++)
|
|
5230
|
+
x[E].fire(Qn, 0, 0, 0, !1);
|
|
5224
5231
|
});
|
|
5225
5232
|
const A = (I) => {
|
|
5226
5233
|
I.target.type !== "text" && (o || I.code === "F5" || (I.preventDefault(), I.code !== "KeyR" && (i.add(I.code), t(he)), r = Date.now()));
|
|
@@ -5252,57 +5259,57 @@ function ql(n) {
|
|
|
5252
5259
|
a.down && (a.move = !0, r = Date.now());
|
|
5253
5260
|
const x = t(R);
|
|
5254
5261
|
if (x.markMode) {
|
|
5255
|
-
const
|
|
5256
|
-
|
|
5262
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5263
|
+
E && !a.down && x.markType === "distance" && f ? f.drawUpdate({ endPoint: E.toArray() }) : !a.down && x.markType === "circle" && d ? E ? (d.drawUpdate(null, !0, E), a.lastMovePoint = E, a.lastMovePointTime = Date.now()) : (a.lastMovePoint = null, a.lastMovePointTime = 0) : !a.down && x.markType === "lines" && m ? E ? (m.drawUpdate(null, !0, E), a.lastMovePoint = E, a.lastMovePointTime = Date.now()) : (a.lastMovePoint = null, a.lastMovePointTime = 0) : !a.down && x.markType === "plans" && C && (E ? (C.drawUpdate(null, !0, E), a.lastMovePoint = E, a.lastMovePointTime = Date.now()) : (a.lastMovePoint = null, a.lastMovePointTime = 0));
|
|
5257
5264
|
}
|
|
5258
|
-
},
|
|
5265
|
+
}, Q = async (I) => {
|
|
5259
5266
|
if (I.preventDefault(), o) return;
|
|
5260
5267
|
const x = t(R);
|
|
5261
5268
|
if (a.isDbClick && (m ? Math.abs(I.clientX - a.lastClickX) < 2 && Math.abs(I.clientY - a.lastClickY) < 2 && (m.drawFinish(a.lastClickPointTime > 0), m = null, a.lastMovePoint = null) : C && Math.abs(I.clientX - a.lastClickX) < 2 && Math.abs(I.clientY - a.lastClickY) < 2 && (C.drawFinish(a.lastClickPointTime > 0), C = null, a.lastMovePoint = null)), x.markMode && a.down === 1 && !a.move && Date.now() - a.downTime < 500) {
|
|
5262
5269
|
if (x.markType === "point") {
|
|
5263
|
-
if (await t(
|
|
5264
|
-
const
|
|
5265
|
-
t(O).add(
|
|
5270
|
+
if (await t(Se, I.clientX, I.clientY)) {
|
|
5271
|
+
const b = new yr(n, await t(Se, I.clientX, I.clientY));
|
|
5272
|
+
t(O).add(b), b.drawFinish();
|
|
5266
5273
|
}
|
|
5267
5274
|
} else if (x.markType === "distance")
|
|
5268
5275
|
if (f) {
|
|
5269
|
-
const
|
|
5270
|
-
|
|
5276
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5277
|
+
E ? (f.drawFinish(E), f = null) : a.isDbClick && t(Gt);
|
|
5271
5278
|
} else {
|
|
5272
|
-
const
|
|
5273
|
-
|
|
5279
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5280
|
+
E && (f = new $s(n), f.drawStart(E), t(O).add(f));
|
|
5274
5281
|
}
|
|
5275
5282
|
else if (x.markType === "lines")
|
|
5276
5283
|
if (m)
|
|
5277
5284
|
if (a.lastMovePoint && t(_s, I.clientX, I.clientY, a.lastMovePoint) < 0.03)
|
|
5278
5285
|
m.drawUpdate(null, !0, a.lastMovePoint, !0), a.lastClickPointTime = Date.now();
|
|
5279
5286
|
else {
|
|
5280
|
-
const
|
|
5281
|
-
|
|
5287
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5288
|
+
E ? (m.drawUpdate(null, !0, E, !0), a.lastClickPointTime = Date.now()) : a.lastClickPointTime = 0;
|
|
5282
5289
|
}
|
|
5283
5290
|
else {
|
|
5284
|
-
const
|
|
5285
|
-
|
|
5291
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5292
|
+
E && (m = new ei(n), m.drawStart(E), t(O).add(m));
|
|
5286
5293
|
}
|
|
5287
5294
|
else if (x.markType === "plans")
|
|
5288
5295
|
if (C)
|
|
5289
5296
|
if (a.lastMovePoint && t(_s, I.clientX, I.clientY, a.lastMovePoint) < 0.03)
|
|
5290
5297
|
C.drawUpdate(null, !0, a.lastMovePoint, !0), a.lastClickPointTime = Date.now();
|
|
5291
5298
|
else {
|
|
5292
|
-
const
|
|
5293
|
-
|
|
5299
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5300
|
+
E ? (C.drawUpdate(null, !0, E, !0), a.lastClickPointTime = Date.now()) : a.lastClickPointTime = 0;
|
|
5294
5301
|
}
|
|
5295
5302
|
else {
|
|
5296
|
-
const
|
|
5297
|
-
|
|
5303
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5304
|
+
E && (C = new ti(n), C.drawStart(E), t(O).add(C));
|
|
5298
5305
|
}
|
|
5299
5306
|
else if (x.markType === "circle")
|
|
5300
5307
|
if (d) {
|
|
5301
|
-
const
|
|
5302
|
-
|
|
5308
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5309
|
+
E ? (d.drawFinish(E), d = null) : a.isDbClick && t(Gt);
|
|
5303
5310
|
} else {
|
|
5304
|
-
const
|
|
5305
|
-
|
|
5311
|
+
const E = await t(Se, I.clientX, I.clientY);
|
|
5312
|
+
E && (d = new wr(n), d.drawStart(E), t(O).add(d));
|
|
5306
5313
|
}
|
|
5307
5314
|
a.lastClickX = I.clientX, a.lastClickY = I.clientY;
|
|
5308
5315
|
}
|
|
@@ -5314,20 +5321,20 @@ function ql(n) {
|
|
|
5314
5321
|
function M(I) {
|
|
5315
5322
|
I.touches.length === 1 && (a.move = !0);
|
|
5316
5323
|
}
|
|
5317
|
-
function
|
|
5324
|
+
function S(I) {
|
|
5318
5325
|
a.down === 1 && !a.move && t(Vt, a.x, a.y);
|
|
5319
5326
|
}
|
|
5320
|
-
window.addEventListener("keydown", A), window.addEventListener("keyup", u), window.addEventListener("blur", c), window.addEventListener("wheel", l, { passive: !1 }), s.addEventListener("contextmenu", p), s.addEventListener("mousedown", h), s.addEventListener("mousemove", g), s.addEventListener("mouseup",
|
|
5321
|
-
function
|
|
5322
|
-
const { width: I, height: x, top:
|
|
5327
|
+
window.addEventListener("keydown", A), window.addEventListener("keyup", u), window.addEventListener("blur", c), window.addEventListener("wheel", l, { passive: !1 }), s.addEventListener("contextmenu", p), s.addEventListener("mousedown", h), s.addEventListener("mousemove", g), s.addEventListener("mouseup", Q), s.addEventListener("touchstart", y, { passive: !1 }), s.addEventListener("touchmove", M, { passive: !1 }), s.addEventListener("touchend", S, { passive: !1 }), window.addEventListener("resize", B), B();
|
|
5328
|
+
function B() {
|
|
5329
|
+
const { width: I, height: x, top: E, left: b } = t(mt), T = t(pe);
|
|
5323
5330
|
T.aspect = I / x, T.updateProjectionMatrix();
|
|
5324
5331
|
const F = t(hi);
|
|
5325
|
-
F.setSize(I, x), F.domElement.style.position = "absolute", F.domElement.style.left = `${
|
|
5332
|
+
F.setSize(I, x), F.domElement.style.position = "absolute", F.domElement.style.left = `${b}px`, F.domElement.style.top = `${E}px`;
|
|
5326
5333
|
const k = t(Zt);
|
|
5327
|
-
k.setPixelRatio(Math.min(devicePixelRatio, t(R).qualityLevel >
|
|
5334
|
+
k.setPixelRatio(Math.min(devicePixelRatio, t(R).qualityLevel > ke.Default5 ? 2 : 1)), k.setSize(I, x);
|
|
5328
5335
|
}
|
|
5329
5336
|
e(oi, () => {
|
|
5330
|
-
o = !0, window.removeEventListener("keydown", A), window.removeEventListener("keyup", u), window.removeEventListener("blur", c), window.removeEventListener("wheel", l), s.removeEventListener("contextmenu", p), s.removeEventListener("mousedown", h), s.removeEventListener("mousemove", g), s.removeEventListener("mouseup",
|
|
5337
|
+
o = !0, window.removeEventListener("keydown", A), window.removeEventListener("keyup", u), window.removeEventListener("blur", c), window.removeEventListener("wheel", l), s.removeEventListener("contextmenu", p), s.removeEventListener("mousedown", h), s.removeEventListener("mousemove", g), s.removeEventListener("mouseup", Q), s.removeEventListener("touchstart", y), s.removeEventListener("touchmove", M), s.removeEventListener("touchend", S), window.removeEventListener("resize", B);
|
|
5331
5338
|
});
|
|
5332
5339
|
}
|
|
5333
5340
|
function es(n, e, t = 0.012) {
|
|
@@ -5388,28 +5395,28 @@ function Qr(n) {
|
|
|
5388
5395
|
const p = (l.x + 1) / 2 * r, f = (1 - l.y) / 2 * A, m = i(pe);
|
|
5389
5396
|
e.setFromCamera(l, m);
|
|
5390
5397
|
const C = [], d = i(O), h = [], g = [];
|
|
5391
|
-
d.traverse(function(
|
|
5392
|
-
|
|
5398
|
+
d.traverse(function(B) {
|
|
5399
|
+
B instanceof He ? g.push(B) : B.isMesh && !B.ignoreIntersect && !B.isMark && h.push(B);
|
|
5393
5400
|
});
|
|
5394
|
-
const
|
|
5395
|
-
for (let
|
|
5396
|
-
C.push({ point:
|
|
5401
|
+
const Q = e.intersectObjects(h, !0);
|
|
5402
|
+
for (let B = 0; B < Q.length; B++)
|
|
5403
|
+
C.push({ point: Q[B].point, d: e.ray.distanceToPoint(Q[B].point), p: 1 });
|
|
5397
5404
|
const y = i(Zo), M = m.projectionMatrix.clone().multiply(m.matrixWorldInverse);
|
|
5398
|
-
for (let
|
|
5399
|
-
const I = g[
|
|
5405
|
+
for (let B = 0; B < g.length; B++) {
|
|
5406
|
+
const I = g[B].fire(Us);
|
|
5400
5407
|
if (I)
|
|
5401
5408
|
if (I.length !== void 0) {
|
|
5402
|
-
const x = I,
|
|
5403
|
-
for (let
|
|
5404
|
-
const T = new v(x[3 *
|
|
5409
|
+
const x = I, E = x.length / 3;
|
|
5410
|
+
for (let b = 0; b < E; b++) {
|
|
5411
|
+
const T = new v(x[3 * b + 0], x[3 * b + 1], x[3 * b + 2]);
|
|
5405
5412
|
y && T.applyMatrix4(y);
|
|
5406
5413
|
const F = new ze(T.x, T.y, T.z, 1).applyMatrix4(M), k = (F.x / F.w + 1) / 2 * r, L = (1 - F.y / F.w) / 2 * A, P = Math.sqrt((k - p) ** 2 + (L - f) ** 2);
|
|
5407
5414
|
P <= t && C.push({ point: T, d: m.position.distanceTo(T), p: P });
|
|
5408
5415
|
}
|
|
5409
5416
|
} else
|
|
5410
5417
|
for (let x of Object.keys(I)) {
|
|
5411
|
-
const
|
|
5412
|
-
if (e.ray.distanceToPoint(
|
|
5418
|
+
const E = x.split(","), b = new v(Number(E[0]), Number(E[1]), Number(E[2]));
|
|
5419
|
+
if (e.ray.distanceToPoint(b) <= 1.4143) {
|
|
5413
5420
|
const T = I[x];
|
|
5414
5421
|
for (let F = 0, k = T.length / 3; F < k; F++) {
|
|
5415
5422
|
const L = new v(T[3 * F + 0], T[3 * F + 1], T[3 * F + 2]);
|
|
@@ -5421,11 +5428,11 @@ function Qr(n) {
|
|
|
5421
5428
|
}
|
|
5422
5429
|
}
|
|
5423
5430
|
if (!C.length) return [];
|
|
5424
|
-
C.sort((
|
|
5425
|
-
const
|
|
5426
|
-
for (let
|
|
5427
|
-
C[
|
|
5428
|
-
return
|
|
5431
|
+
C.sort((B, I) => B.d - I.d);
|
|
5432
|
+
const S = [];
|
|
5433
|
+
for (let B = 0, I = C[0].d, x = Math.min(C.length, 20); B < x; B++)
|
|
5434
|
+
C[B].d - I < 0.01 && S.push(C[B]);
|
|
5435
|
+
return S.sort((B, I) => B.p - I.p), [S[0].point];
|
|
5429
5436
|
}), s(_s, (o, a, r) => {
|
|
5430
5437
|
const { width: A, height: u, left: c, top: l } = i(mt), p = new ge();
|
|
5431
5438
|
p.x = (o - c) / A * 2 - 1, p.y = (l - a) / u * 2 + 1;
|
|
@@ -5523,7 +5530,7 @@ function xr(n) {
|
|
|
5523
5530
|
u && a.push(u);
|
|
5524
5531
|
}
|
|
5525
5532
|
});
|
|
5526
|
-
const r = t(
|
|
5533
|
+
const r = t(be).meta || {};
|
|
5527
5534
|
return a.length ? r.marks = a : delete r.marks, r.cameraInfo = t(mo), await t(Ze, r);
|
|
5528
5535
|
}), e(Bn, async () => {
|
|
5529
5536
|
const a = [];
|
|
@@ -5533,10 +5540,10 @@ function xr(n) {
|
|
|
5533
5540
|
u && a.push(u);
|
|
5534
5541
|
}
|
|
5535
5542
|
});
|
|
5536
|
-
const r = t(
|
|
5543
|
+
const r = t(be).meta || {};
|
|
5537
5544
|
return a.length ? r.marks = a : delete r.marks, await t(Ze, r);
|
|
5538
5545
|
}), e(No, async () => {
|
|
5539
|
-
const a = t(
|
|
5546
|
+
const a = t(be).meta || {};
|
|
5540
5547
|
delete a.marks;
|
|
5541
5548
|
const r = await t(Ze, a), A = [];
|
|
5542
5549
|
return s.forEach((u) => A.push(u)), A.forEach((u) => u.deref()?.dispose?.()), t(Ae), r;
|
|
@@ -5544,7 +5551,7 @@ function xr(n) {
|
|
|
5544
5551
|
t(O).traverse((r) => {
|
|
5545
5552
|
r.isMark && r.getMarkData?.();
|
|
5546
5553
|
});
|
|
5547
|
-
const a = t(
|
|
5554
|
+
const a = t(be).meta || {};
|
|
5548
5555
|
return a.watermark = t(Uo) || "", await t(Ze, a);
|
|
5549
5556
|
}), e(Ws, (a) => {
|
|
5550
5557
|
a.meterScale && (t(R).meterScale = a.meterScale, t(ae, { scale: `1 : ${t(R).meterScale} m` })), t(q).updateByOptions({ ...a, ...a.cameraInfo || {} }), (a.marks || []).forEach((A) => {
|
|
@@ -5564,7 +5571,7 @@ function xr(n) {
|
|
|
5564
5571
|
const u = new wr(n);
|
|
5565
5572
|
u.draw(A), u.visible = !1, t(O).add(u);
|
|
5566
5573
|
}
|
|
5567
|
-
}), t(
|
|
5574
|
+
}), t(Xn, a.flyPositions || []), t(Kn, a.flyTargets || []);
|
|
5568
5575
|
}), e(ct, () => {
|
|
5569
5576
|
const a = t(R);
|
|
5570
5577
|
a.markMode = !1, t(ui), t(Ae);
|
|
@@ -5607,23 +5614,23 @@ function xr(n) {
|
|
|
5607
5614
|
});
|
|
5608
5615
|
}
|
|
5609
5616
|
function Br(n) {
|
|
5610
|
-
const e = (h, ...g) => n.fire(h, ...g), t = (h, g,
|
|
5617
|
+
const e = (h, ...g) => n.fire(h, ...g), t = (h, g, Q) => n.on(h, g, Q), s = [], i = [];
|
|
5611
5618
|
let o = !1, a = !1, r = 125 * 1e3;
|
|
5612
|
-
t(Nn, () => o = !1), t(
|
|
5619
|
+
t(Nn, () => o = !1), t(Xi, () => o = !0), t(Ji, () => s), t(oA, () => {
|
|
5613
5620
|
const h = [];
|
|
5614
|
-
for (let g = 0,
|
|
5621
|
+
for (let g = 0, Q = s.length; g < Q; g++)
|
|
5615
5622
|
h.push(...s[g].toArray());
|
|
5616
5623
|
return h;
|
|
5617
5624
|
}), t(rA, () => {
|
|
5618
5625
|
const h = [];
|
|
5619
|
-
for (let g = 0,
|
|
5626
|
+
for (let g = 0, Q = i.length; g < Q; g++)
|
|
5620
5627
|
h.push(...i[g].toArray());
|
|
5621
5628
|
return h;
|
|
5622
|
-
}), t(Kn, (h) => {
|
|
5623
|
-
for (let g = 0, E = h.length / 3 | 0; g < E; g++)
|
|
5624
|
-
s[g] = new v(h[g * 3 + 0], h[g * 3 + 1], h[g * 3 + 2]);
|
|
5625
5629
|
}), t(Xn, (h) => {
|
|
5626
|
-
for (let g = 0,
|
|
5630
|
+
for (let g = 0, Q = h.length / 3 | 0; g < Q; g++)
|
|
5631
|
+
s[g] = new v(h[g * 3 + 0], h[g * 3 + 1], h[g * 3 + 2]);
|
|
5632
|
+
}), t(Kn, (h) => {
|
|
5633
|
+
for (let g = 0, Q = h.length / 3 | 0; g < Q; g++)
|
|
5627
5634
|
i[g] = new v(h[g * 3 + 0], h[g * 3 + 1], h[g * 3 + 2]);
|
|
5628
5635
|
}), t(Ii, (h = 125 * 1e3) => {
|
|
5629
5636
|
r = h;
|
|
@@ -5633,14 +5640,14 @@ function Br(n) {
|
|
|
5633
5640
|
}), t(on, () => {
|
|
5634
5641
|
s.length = 0, i.length = 0;
|
|
5635
5642
|
}), t(an, async (h = !0) => {
|
|
5636
|
-
const g = e(
|
|
5643
|
+
const g = e(be)?.meta || e(mi);
|
|
5637
5644
|
if (g.scenes) {
|
|
5638
5645
|
const y = g;
|
|
5639
5646
|
if (s.length) {
|
|
5640
|
-
const
|
|
5647
|
+
const S = [], B = [];
|
|
5641
5648
|
for (let I = 0, x = s.length; I < x; I++)
|
|
5642
|
-
|
|
5643
|
-
y.flyPositions =
|
|
5649
|
+
S.push(...s[I].toArray()), B.push(...i[I].toArray());
|
|
5650
|
+
y.flyPositions = S, y.flyTargets = B;
|
|
5644
5651
|
} else
|
|
5645
5652
|
delete y.flyPositions, delete y.flyTargets;
|
|
5646
5653
|
const M = e(q);
|
|
@@ -5648,33 +5655,33 @@ function Br(n) {
|
|
|
5648
5655
|
} else {
|
|
5649
5656
|
const y = g;
|
|
5650
5657
|
if (s.length) {
|
|
5651
|
-
const M = [],
|
|
5652
|
-
for (let
|
|
5653
|
-
M.push(...s[
|
|
5654
|
-
y.flyPositions = M, y.flyTargets =
|
|
5658
|
+
const M = [], S = [];
|
|
5659
|
+
for (let B = 0, I = s.length; B < I; B++)
|
|
5660
|
+
M.push(...s[B].toArray()), S.push(...i[B].toArray());
|
|
5661
|
+
y.flyPositions = M, y.flyTargets = S;
|
|
5655
5662
|
} else
|
|
5656
5663
|
delete y.flyPositions, delete y.flyTargets;
|
|
5657
5664
|
h && await e(Ze, y);
|
|
5658
5665
|
}
|
|
5659
|
-
const
|
|
5666
|
+
const Q = (g.scenes, g);
|
|
5660
5667
|
if (s.length) {
|
|
5661
5668
|
const y = [], M = [];
|
|
5662
|
-
for (let
|
|
5663
|
-
y.push(...s[
|
|
5664
|
-
|
|
5669
|
+
for (let S = 0, B = s.length; S < B; S++)
|
|
5670
|
+
y.push(...s[S].toArray()), M.push(...i[S].toArray());
|
|
5671
|
+
Q.flyPositions = y, Q.flyTargets = M;
|
|
5665
5672
|
} else
|
|
5666
|
-
delete
|
|
5667
|
-
h && await e(Ze,
|
|
5673
|
+
delete Q.flyPositions, delete Q.flyTargets;
|
|
5674
|
+
h && await e(Ze, Q);
|
|
5668
5675
|
}), t(Go, () => {
|
|
5669
5676
|
a || (a = !0) && e(ot, !0);
|
|
5670
5677
|
});
|
|
5671
5678
|
let A = 0, u = r, c = 0, l = 0, p = 0, f = 0, m = 1, C, d;
|
|
5672
5679
|
t(ot, (h) => {
|
|
5673
5680
|
if (A = 0, u = r, c = Date.now(), l = 0, p = c, f = 0, m = 1, C = null, d = null, !s.length || !h && !e(q).autoRotate) return;
|
|
5674
|
-
const g = e(q),
|
|
5675
|
-
for (let
|
|
5676
|
-
M[
|
|
5677
|
-
C = new Ti(
|
|
5681
|
+
const g = e(q), Q = [g.object.position.clone()], y = [g.target.clone()], M = e(Ji) || [];
|
|
5682
|
+
for (let S = 0, B = Math.min(M.length, 1e3); S < B; S++)
|
|
5683
|
+
M[S] && Q.push(M[S]), i[S] && y.push(i[S]);
|
|
5684
|
+
C = new Ti(Q), C.closed = !1, d = new Ti(y), d.closed = !1, e(Xi), e(he, !1);
|
|
5678
5685
|
}), t(uA, () => {
|
|
5679
5686
|
l = l || Date.now();
|
|
5680
5687
|
}), t(CA, (h, g) => {
|
|
@@ -5685,8 +5692,8 @@ function Br(n) {
|
|
|
5685
5692
|
const h = e(q);
|
|
5686
5693
|
if (l || (f += m * (Date.now() - p), p = Date.now(), (f < 0 || f > u) && e(Nn), !o || !C || !d)) return;
|
|
5687
5694
|
A = f / u;
|
|
5688
|
-
const g = C.getPoint(A),
|
|
5689
|
-
h.object.position.set(g.x, g.y, g.z), h.target.set(
|
|
5695
|
+
const g = C.getPoint(A), Q = d.getPoint(A);
|
|
5696
|
+
h.object.position.set(g.x, g.y, g.z), h.target.set(Q.x, Q.y, Q.z);
|
|
5690
5697
|
},
|
|
5691
5698
|
!0
|
|
5692
5699
|
);
|
|
@@ -5718,7 +5725,7 @@ class yu {
|
|
|
5718
5725
|
() => !t.disposed && (u(di) || !f.stop),
|
|
5719
5726
|
10
|
|
5720
5727
|
);
|
|
5721
|
-
}), Ei(r), Il(r), xi(r), ru(r), xr(r), ql(r), Qr(r), Au(r), Br(r), t.splatMesh = new He(bl(e)), A(
|
|
5728
|
+
}), Ei(r), Il(r), xi(r), ru(r), xr(r), ql(r), Qr(r), Au(r), Br(r), t.splatMesh = new He(bl(e)), A(be, () => t.splatMesh), i.add(t.splatMesh), Ml(r), A(ls, (f) => {
|
|
5722
5729
|
e.qualityLevel = f, t.splatMesh.options({ qualityLevel: f, renderer: void 0, scene: void 0 });
|
|
5723
5730
|
}), A(us, (f) => {
|
|
5724
5731
|
e.sortType = f, t.splatMesh.options({ sortType: f, renderer: void 0, scene: void 0 });
|
|
@@ -5732,13 +5739,13 @@ class yu {
|
|
|
5732
5739
|
try {
|
|
5733
5740
|
const f = performance.now();
|
|
5734
5741
|
if (!t.needUpdate || f - l < (me ? 25 : e.qualityLevel > 5 ? 1 : 18)) return;
|
|
5735
|
-
t.needUpdate = !1, l = f, s.render(i, a), u(
|
|
5742
|
+
t.needUpdate = !1, l = f, s.render(i, a), u(xe) && u(On);
|
|
5736
5743
|
} catch (f) {
|
|
5737
5744
|
console.warn(f.message);
|
|
5738
5745
|
}
|
|
5739
5746
|
},
|
|
5740
5747
|
!0
|
|
5741
|
-
), A(Vn, () => t.dispose()), A(Yo, () => console.info(JSON.stringify(u(
|
|
5748
|
+
), A(Vn, () => t.dispose()), A(Yo, () => console.info(JSON.stringify(u(be).meta || {}, null, 2)));
|
|
5742
5749
|
let p = "";
|
|
5743
5750
|
A(hn, (f = "") => {
|
|
5744
5751
|
p = f, t.splatMesh.fire(fi, p, !0);
|
|
@@ -5793,10 +5800,10 @@ class yu {
|
|
|
5793
5800
|
t && (o = i.splatMesh.fire(Jo) + t), i.splatMesh.fire(Dn, o);
|
|
5794
5801
|
})(), e === 9)
|
|
5795
5802
|
if (!t)
|
|
5796
|
-
i.events.fire(ls,
|
|
5803
|
+
i.events.fire(ls, ke.Default5);
|
|
5797
5804
|
else {
|
|
5798
5805
|
const o = i.events.fire(R).qualityLevel;
|
|
5799
|
-
i.events.fire(ls, Math.max(
|
|
5806
|
+
i.events.fire(ls, Math.max(ke.L1, Math.min(o + t, ke.L9)));
|
|
5800
5807
|
}
|
|
5801
5808
|
if (e === 10)
|
|
5802
5809
|
if (!t)
|
|
@@ -5819,7 +5826,7 @@ class yu {
|
|
|
5819
5826
|
let i;
|
|
5820
5827
|
if (s(O).traverse((r) => !i && r instanceof He && (i = r.options())), e) {
|
|
5821
5828
|
const r = s(R);
|
|
5822
|
-
e.autoRotate !== void 0 && (r.autoRotate = e.autoRotate, s(q).autoRotate = e.autoRotate), e.pointcloudMode !== void 0 && s(Un, e.pointcloudMode), e.lightFactor !== void 0 && s(
|
|
5829
|
+
e.autoRotate !== void 0 && (r.autoRotate = e.autoRotate, s(q).autoRotate = e.autoRotate), e.pointcloudMode !== void 0 && s(Un, e.pointcloudMode), e.lightFactor !== void 0 && s(Kt, e.lightFactor), e.maxRenderCountOfMobile && (r.maxRenderCountOfMobile = e.maxRenderCountOfMobile), e.maxRenderCountOfPc && (r.maxRenderCountOfPc = e.maxRenderCountOfPc), e.debugMode !== void 0 && (r.debugMode = e.debugMode), e.qualityLevel !== void 0 && (r.qualityLevel = e.qualityLevel) && this.splatMesh.options({ qualityLevel: e.qualityLevel }), e.sortType !== void 0 && (r.sortType = e.sortType) && this.splatMesh.options({ sortType: e.sortType }), e.markType !== void 0 && (r.markType = e.markType), e.markVisible !== void 0 && s(jt, e.markVisible), e.meterScale !== void 0 && (r.meterScale = e.meterScale), e.markMode !== void 0 && (r.markMode = e.markMode, !e.markMode && s(ui), s(q).autoRotate = s(R).autoRotate = !1);
|
|
5823
5830
|
}
|
|
5824
5831
|
return s(q).updateByOptions(e), s(ae, { scale: `1 : ${s(R).meterScale} m` }), Object.assign({ ...s(R) }, i);
|
|
5825
5832
|
}
|
|
@@ -5859,7 +5866,7 @@ class yu {
|
|
|
5859
5866
|
if (!i.url) return console.error("missing model file url");
|
|
5860
5867
|
if (!i.url.endsWith(".spx")) return console.error("The format is unsupported in the large scene mode", i.url);
|
|
5861
5868
|
const o = { ...i, ...i.cameraInfo || {} };
|
|
5862
|
-
i.autoCut = Math.min(Math.max(i.autoCut || 0, 0), 50), o.bigSceneMode = i.autoCut > 1, t.reset({ ...o }), !o.bigSceneMode && delete i.autoCut, t.metaMatrix = i.transform ? new Fe().fromArray(i.transform) : null, t.splatMesh.meta = i, me && (i.cameraInfo?.position || i.cameraInfo?.lookAt) && t.events.fire(q)._dollyOut(0.75), o.bigSceneMode ? (s(
|
|
5869
|
+
i.autoCut = Math.min(Math.max(i.autoCut || 0, 0), 50), o.bigSceneMode = i.autoCut > 1, t.reset({ ...o }), !o.bigSceneMode && delete i.autoCut, t.metaMatrix = i.transform ? new Fe().fromArray(i.transform) : null, t.splatMesh.meta = i, me && (i.cameraInfo?.position || i.cameraInfo?.lookAt) && t.events.fire(q)._dollyOut(0.75), o.bigSceneMode ? (s(Xn, i.flyPositions || []), s(Kn, i.flyTargets || []), s(Ii, i.flyDuration)) : s(Ws, i), await t.splatMesh.addModel({ url: i.url }, i), await s(hn, i.watermark), s(q).updateRotateAxis();
|
|
5863
5870
|
}
|
|
5864
5871
|
/**
|
|
5865
5872
|
* 添加要渲染的高斯模型(小场景模式)
|
|
@@ -5899,7 +5906,7 @@ class yu {
|
|
|
5899
5906
|
console.error("unknow format!", a.url);
|
|
5900
5907
|
return;
|
|
5901
5908
|
}
|
|
5902
|
-
A.qualityLevel = A.qualityLevel || r.qualityLevel ||
|
|
5909
|
+
A.qualityLevel = A.qualityLevel || r.qualityLevel || ke.Default5, A.sortType = A.sortType || r.sortType || Rt.Default1, s(mi, () => A), t.metaMatrix = A.transform ? new Fe().fromArray(A.transform) : null, i(Ws, A), this.options({ qualityLevel: A.qualityLevel, sortType: A.sortType }), a.format === "obj" ? (this.options({ autoRotate: !1 }), await i(Ko, a.url)) : (this.splatMesh.addModel(a, A), await i(hn, A.watermark)), me && i(q)._dollyOut?.(0.75);
|
|
5903
5910
|
}
|
|
5904
5911
|
/**
|
|
5905
5912
|
* 根据需要暴露的接口
|
|
@@ -5948,7 +5955,7 @@ class yu {
|
|
|
5948
5955
|
}
|
|
5949
5956
|
function cu(n) {
|
|
5950
5957
|
const e = (a, r, A) => n.on(a, r, A), t = (a, ...r) => n.fire(a, ...r), s = me ? 2 : 20, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
5951
|
-
e(kn, () => t(
|
|
5958
|
+
e(kn, () => t(xe) && i.set(Date.now(), 1)), e(Tn, () => t(xe) && t(xt, i)), e(On, () => t(xe) && o.set(Date.now(), 1)), e(Ln, () => t(xe) && t(xt, o)), e(xt, (a) => {
|
|
5952
5959
|
let r = [], A = Date.now(), u = 0;
|
|
5953
5960
|
for (const c of a.keys())
|
|
5954
5961
|
A - c <= 1e3 ? u++ : r.push(c);
|
|
@@ -6047,18 +6054,18 @@ class du {
|
|
|
6047
6054
|
}
|
|
6048
6055
|
}
|
|
6049
6056
|
function hu(n) {
|
|
6050
|
-
const e = (
|
|
6057
|
+
const e = (S, B, I) => n.on(S, B, I), t = (S, ...B) => n.fire(S, ...B), s = t(Pt);
|
|
6051
6058
|
let i = /* @__PURE__ */ new Set(), o, a = new du();
|
|
6052
6059
|
e(Jn, () => {
|
|
6053
6060
|
if (!i.size) return;
|
|
6054
|
-
const
|
|
6055
|
-
if (!
|
|
6056
|
-
const
|
|
6061
|
+
const S = t(R);
|
|
6062
|
+
if (!S.enableKeyboard) return i.clear();
|
|
6063
|
+
const B = S.editMode;
|
|
6057
6064
|
if (i.has("KeyH")) {
|
|
6058
6065
|
const I = t(re);
|
|
6059
6066
|
I && (I.visible = !I.visible), i.clear();
|
|
6060
6067
|
} else if (i.has("Equal"))
|
|
6061
|
-
if (
|
|
6068
|
+
if (B) {
|
|
6062
6069
|
const I = t(re);
|
|
6063
6070
|
if (!I || !I.visible) return i.clear();
|
|
6064
6071
|
if (i.has("KeyX")) {
|
|
@@ -6069,7 +6076,7 @@ function hu(n) {
|
|
|
6069
6076
|
} else
|
|
6070
6077
|
t(sn), i.clear();
|
|
6071
6078
|
else if (i.has("Minus"))
|
|
6072
|
-
if (
|
|
6079
|
+
if (B) {
|
|
6073
6080
|
const I = t(re);
|
|
6074
6081
|
if (!I || !I.visible) return i.clear();
|
|
6075
6082
|
if (i.has("KeyX")) {
|
|
@@ -6082,69 +6089,69 @@ function hu(n) {
|
|
|
6082
6089
|
else if (i.has("KeyP"))
|
|
6083
6090
|
t(ot, !0), i.clear();
|
|
6084
6091
|
else if (i.has("ArrowUp")) {
|
|
6085
|
-
if (
|
|
6092
|
+
if (B) {
|
|
6086
6093
|
const I = t(re);
|
|
6087
6094
|
I && I.visible && (I.position.z += 0.1);
|
|
6088
6095
|
}
|
|
6089
6096
|
} else if (i.has("ArrowDown")) {
|
|
6090
|
-
if (
|
|
6097
|
+
if (B) {
|
|
6091
6098
|
const I = t(re);
|
|
6092
6099
|
I && I.visible && (I.position.z -= 0.1);
|
|
6093
6100
|
}
|
|
6094
6101
|
} else if (i.has("ArrowRight")) {
|
|
6095
|
-
if (
|
|
6102
|
+
if (B) {
|
|
6096
6103
|
const I = t(re);
|
|
6097
6104
|
I && I.visible && (I.position.x += 0.1);
|
|
6098
6105
|
}
|
|
6099
6106
|
} else if (i.has("ArrowLeft")) {
|
|
6100
|
-
if (
|
|
6107
|
+
if (B) {
|
|
6101
6108
|
const I = t(re);
|
|
6102
6109
|
I && I.visible && (I.position.x -= 0.1);
|
|
6103
6110
|
}
|
|
6104
6111
|
} else if (i.has("KeyU")) {
|
|
6105
|
-
if (
|
|
6112
|
+
if (B) {
|
|
6106
6113
|
const I = t(re);
|
|
6107
6114
|
if (I) {
|
|
6108
6115
|
const x = I.meta || {};
|
|
6109
6116
|
x.transform = I.matrix.toArray();
|
|
6110
6117
|
}
|
|
6111
6118
|
}
|
|
6112
|
-
} else i.has("KeyQ") ?
|
|
6119
|
+
} else i.has("KeyQ") ? B && t(Os, 0.1) : i.has("KeyW") ? B && t(Vs, 0.1) : i.has("KeyE") ? B && t(Js, 0.1) : i.has("KeyA") ? B && t(Os, -0.1) : i.has("KeyS") ? B && t(Vs, -0.1) : i.has("KeyD") ? B && t(Js, -0.1) : i.has("KeyY") ? B ? t(ir, i.has("ShiftLeft") || i.has("ShiftRight") ? -0.1 : 0.1) : (t(an, !0), i.clear()) : i.has("KeyC") && console.info("position=", t(Re).toArray(), "lookat=", t(Ye).toArray());
|
|
6113
6120
|
});
|
|
6114
|
-
const r = (
|
|
6115
|
-
|
|
6116
|
-
}, A = (
|
|
6117
|
-
|
|
6121
|
+
const r = (S) => {
|
|
6122
|
+
S.target.type !== "text" && (o || S.code === "F5" || (S.preventDefault(), i.add(S.code)));
|
|
6123
|
+
}, A = (S) => {
|
|
6124
|
+
S.target.type !== "text" && (o || i.clear());
|
|
6118
6125
|
}, u = () => {
|
|
6119
6126
|
i.clear();
|
|
6120
|
-
}, c = (
|
|
6121
|
-
parent && setTimeout(() => window.focus()),
|
|
6122
|
-
}, l = async (
|
|
6123
|
-
|
|
6127
|
+
}, c = (S) => {
|
|
6128
|
+
parent && setTimeout(() => window.focus()), S.preventDefault();
|
|
6129
|
+
}, l = async (S) => {
|
|
6130
|
+
S.preventDefault();
|
|
6124
6131
|
};
|
|
6125
6132
|
let p, f, m, C;
|
|
6126
6133
|
e(Gt, () => {
|
|
6127
6134
|
p?.dispose(), f?.dispose(), m?.dispose(), C?.dispose(), p = null, f = null, m = null, C = null, a.lastMovePoint = null, t(ct);
|
|
6128
6135
|
});
|
|
6129
|
-
const d = async (
|
|
6130
|
-
parent && setTimeout(() => window.focus()),
|
|
6131
|
-
}, h = async (
|
|
6132
|
-
|
|
6133
|
-
}, g = async (
|
|
6134
|
-
|
|
6136
|
+
const d = async (S) => {
|
|
6137
|
+
parent && setTimeout(() => window.focus()), S.preventDefault(), !o && (a.down = S.button === 2 ? 2 : 1, a.move = !1, a.isDbClick = Date.now() - a.downTime < 300, a.downTime = Date.now());
|
|
6138
|
+
}, h = async (S) => {
|
|
6139
|
+
S.preventDefault(), !o && a.down && (a.move = !0);
|
|
6140
|
+
}, g = async (S) => {
|
|
6141
|
+
S.preventDefault(), !o && (a.down = 0, a.move = !1);
|
|
6135
6142
|
};
|
|
6136
|
-
function
|
|
6137
|
-
|
|
6143
|
+
function Q(S) {
|
|
6144
|
+
S.preventDefault(), !o && (a.down = S.touches.length, a.down === 1 && (a.move = !1, a.x = S.touches[0].clientX, a.y = S.touches[0].clientY));
|
|
6138
6145
|
}
|
|
6139
|
-
function y(
|
|
6140
|
-
|
|
6146
|
+
function y(S) {
|
|
6147
|
+
S.touches.length === 1 && (a.move = !0);
|
|
6141
6148
|
}
|
|
6142
|
-
function M(
|
|
6149
|
+
function M(S) {
|
|
6143
6150
|
a.down === 1 && !a.move && t(Vt, a.x, a.y);
|
|
6144
6151
|
}
|
|
6145
|
-
window.addEventListener("keydown", r), window.addEventListener("keyup", A), window.addEventListener("blur", u), window.addEventListener("wheel", c, { passive: !1 }), s.addEventListener("contextmenu", l), s.addEventListener("mousedown", d), s.addEventListener("mousemove", h), s.addEventListener("mouseup", g), s.addEventListener("touchstart",
|
|
6146
|
-
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", A), window.removeEventListener("blur", u), window.removeEventListener("wheel", c), s.removeEventListener("contextmenu", l), s.removeEventListener("mousedown", d), s.removeEventListener("mousemove", h), s.removeEventListener("mouseup", g), s.removeEventListener("touchstart",
|
|
6147
|
-
}), e(Vt, async (
|
|
6152
|
+
window.addEventListener("keydown", r), window.addEventListener("keyup", A), window.addEventListener("blur", u), window.addEventListener("wheel", c, { passive: !1 }), s.addEventListener("contextmenu", l), s.addEventListener("mousedown", d), s.addEventListener("mousemove", h), s.addEventListener("mouseup", g), s.addEventListener("touchstart", Q, { passive: !1 }), s.addEventListener("touchmove", y, { passive: !1 }), s.addEventListener("touchend", M, { passive: !1 }), e(oi, () => {
|
|
6153
|
+
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", A), window.removeEventListener("blur", u), window.removeEventListener("wheel", c), s.removeEventListener("contextmenu", l), s.removeEventListener("mousedown", d), s.removeEventListener("mousemove", h), s.removeEventListener("mouseup", g), s.removeEventListener("touchstart", Q), s.removeEventListener("touchmove", y), s.removeEventListener("touchend", M);
|
|
6154
|
+
}), e(Vt, async (S, B) => await t(Rn, S, B));
|
|
6148
6155
|
}
|
|
6149
6156
|
var Mt = Object.freeze({
|
|
6150
6157
|
Linear: Object.freeze({
|
|
@@ -6618,7 +6625,7 @@ class pu extends fe {
|
|
|
6618
6625
|
}
|
|
6619
6626
|
class wu extends Jr {
|
|
6620
6627
|
constructor(e = {}) {
|
|
6621
|
-
console.info("Reall3dMapViewer", jn), super(), this.clock = new
|
|
6628
|
+
console.info("Reall3dMapViewer", jn), super(), this.clock = new Xr(), this.updateTime = 0, this.disposed = !1;
|
|
6622
6629
|
const t = this, s = new Zn();
|
|
6623
6630
|
t.events = s;
|
|
6624
6631
|
const i = (r, A, u) => s.on(r, A, u), o = (r, ...A) => s.fire(r, ...A);
|
|
@@ -6644,7 +6651,7 @@ class wu extends Jr {
|
|
|
6644
6651
|
), i(
|
|
6645
6652
|
Pn,
|
|
6646
6653
|
() => {
|
|
6647
|
-
t.dispatchEvent({ type: "update", delta: t.clock.getDelta() }), t.updateTime = Date.now(), o(
|
|
6654
|
+
t.dispatchEvent({ type: "update", delta: t.clock.getDelta() }), t.updateTime = Date.now(), o(xe) && o(ae, {
|
|
6648
6655
|
fps: o(Tn),
|
|
6649
6656
|
realFps: o(Ln),
|
|
6650
6657
|
fov: o(nn),
|
|
@@ -6664,7 +6671,7 @@ class wu extends Jr {
|
|
|
6664
6671
|
const t = (o, a, r) => this.events.on(o, a, r), s = (o, ...a) => this.events.fire(o, ...a), i = this;
|
|
6665
6672
|
fetch(e, { mode: "cors", credentials: "omit", cache: "reload" }).then((o) => o.ok ? o.json() : {}).then((o) => {
|
|
6666
6673
|
const a = new v().fromArray(o.position || [17e3, 3e4, -35e3]), r = new v().fromArray(o.lookAt || [17e3, 0, -35e3]);
|
|
6667
|
-
i.controls.object.position.copy(a), i.controls.target.copy(r), i.dirLight.target.position.copy(r), t(mi, () => o), s(
|
|
6674
|
+
i.controls.object.position.copy(a), i.controls.target.copy(r), i.dirLight.target.position.copy(r), t(mi, () => o), s(Xn, o.flyPositions || []), s(Kn, o.flyTargets || []), s(Ii, o.flyDuration);
|
|
6668
6675
|
const A = /* @__PURE__ */ new Set();
|
|
6669
6676
|
for (let u of o.scenes)
|
|
6670
6677
|
A.has(u) || (new pu(u, i), A.add(u));
|