@reall3d/reall3dviewer 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pkg.js +598 -595
- package/dist/pkg.umd.cjs +13 -13
- package/package.json +1 -1
package/dist/pkg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3 as
|
|
1
|
+
import { Vector3 as C, InstancedBufferGeometry as rn, BufferAttribute as He, InstancedBufferAttribute as ca, DynamicDrawUsage as la, ShaderMaterial as _n, DoubleSide as we, NormalBlending as da, DataTexture as Ee, RGBAIntegerFormat as _e, UnsignedIntType as Ie, Mesh as te, Vector4 as ve, Vector2 as j, WebGLRenderer as ts, PerspectiveCamera as ns, Object3D as In, CylinderGeometry as ti, MeshBasicMaterial as xe, PlaneGeometry as ua, Quaternion as _t, Controls as ha, MOUSE as Ae, TOUCH as Se, Spherical as ni, Ray as pa, Plane as fa, MathUtils as be, Float32BufferAttribute as ii, InstancedInterleavedBuffer as cn, InterleavedBufferAttribute as We, WireframeGeometry as ga, Box3 as Dn, Sphere as tt, ShaderLib as bt, UniformsUtils as is, UniformsLib as xt, Line3 as ma, Matrix4 as $e, CircleGeometry as De, Group as Qt, BufferGeometry as ya, Raycaster as Aa, SphereGeometry as wa, Color as Pn, FrontSide as va, CatmullRomCurve3 as si, Scene as ss, AmbientLight as as, FogExp2 as ai, DirectionalLight as Sa, EventDispatcher as ba, Clock as xa } from "three";
|
|
2
2
|
import * as oi from "@gotoeasy/three-tile";
|
|
3
3
|
let A = 1;
|
|
4
4
|
const at = A++, Ln = A++, Pe = A++, os = A++, ln = A++, dn = A++, rs = A++, Gt = A++, cs = A++, Ke = A++, V = A++, Y = A++, ls = A++, un = A++, Ce = A++, Ne = A++, Be = A++, ft = A++, ds = A++, us = A++, hs = A++, Ca = A++, ps = A++, fs = A++, Fn = A++, Ma = A++, Ta = A++, ri = A++, q = A++;
|
|
@@ -80,8 +80,8 @@ async function so(i) {
|
|
|
80
80
|
return new Uint8Array(r.buffer).set(i, 0), u(0) && (n.HashCheck = !1), n;
|
|
81
81
|
}
|
|
82
82
|
async function fe(i) {
|
|
83
|
-
const e = new Uint32Array(i.slice(0, 8).buffer), t = e[0], n = e[1], a = $n == n, o = ut == n, s = Kn == n, r = a || o || s, c = !r, u = n == 20 || r ? jn : Zn,
|
|
84
|
-
return g.set(i,
|
|
83
|
+
const e = new Uint32Array(i.slice(0, 8).buffer), t = e[0], n = e[1], a = $n == n, o = ut == n, s = Kn == n, r = a || o || s, c = !r, u = n == 20 || r ? jn : Zn, l = t * (r ? qa : R), d = WebAssembly.compile(Uint8Array.from(atob(u), (M) => M.charCodeAt(0)).buffer), h = Math.floor((l + i.byteLength) / js) + 2, f = new WebAssembly.Memory({ initial: h, maximum: h }), m = (await WebAssembly.instantiate(await d, { env: { memory: f, expf: Vt } })).exports.D, g = new Uint8Array(f.buffer);
|
|
84
|
+
return g.set(i, l), m(0, l) ? { splatCount: t, blockFormat: n, success: !1 } : { splatCount: t, blockFormat: n, success: !0, datas: g.slice(0, l), isSplat: c, isSh: r, isSh1: a, isSh2: o, isSh3: s };
|
|
85
85
|
}
|
|
86
86
|
async function bn(i, e) {
|
|
87
87
|
const t = WebAssembly.compile(Uint8Array.from(atob(jn), (u) => u.charCodeAt(0)).buffer), n = Math.floor(e * R / js) + 2, a = new WebAssembly.Memory({ initial: n, maximum: n }), s = (await WebAssembly.instantiate(await t, { env: { memory: a, expf: Vt } })).exports.s, r = new Uint8Array(a.buffer);
|
|
@@ -90,8 +90,8 @@ async function bn(i, e) {
|
|
|
90
90
|
return c ? (console.error("splat data parser failed:", c), new Uint8Array(0)) : r.slice(0, e * R);
|
|
91
91
|
}
|
|
92
92
|
async function ao(i, e, t = !0, n = !0) {
|
|
93
|
-
const a = WebAssembly.compile(Uint8Array.from(atob(Zn), (
|
|
94
|
-
return u[0] = i, t ? u[1] =
|
|
93
|
+
const a = WebAssembly.compile(Uint8Array.from(atob(Zn), (d) => d.charCodeAt(0)).buffer), o = new WebAssembly.Memory({ initial: 1, maximum: 1 }), r = (await WebAssembly.instantiate(await a, { env: { memory: o, expf: Vt } })).exports.w, c = new Uint8Array(o.buffer), u = new Float32Array(c.buffer), l = n ? -1 : 1;
|
|
94
|
+
return u[0] = i, t ? u[1] = l * e : u[2] = l * e, r(0, t ? 1 : 0), c.slice(0, R);
|
|
95
95
|
}
|
|
96
96
|
function Vt(i) {
|
|
97
97
|
return Math.exp(i);
|
|
@@ -114,11 +114,11 @@ async function oo(i) {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
i.modelSplatCount = c, i.downloadSplatCount = 0, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32), i.watermarkData = new Uint8Array(0);
|
|
117
|
-
let u = new Uint8Array(32),
|
|
117
|
+
let u = new Uint8Array(32), l = 0;
|
|
118
118
|
for (; ; ) {
|
|
119
|
-
let { done:
|
|
120
|
-
if (
|
|
121
|
-
|
|
119
|
+
let { done: d, value: h } = await s.read();
|
|
120
|
+
if (d) break;
|
|
121
|
+
l + h.byteLength < i.rowLength ? (u.set(h, l), l += h.byteLength, e += h.length, i.downloadSize = e) : (l = await t(i, l, u, h), l && u.set(h.slice(h.byteLength - l), 0)), i.downloadSplatCount >= i.fetchLimit && i.abortController.abort();
|
|
122
122
|
}
|
|
123
123
|
} catch (n) {
|
|
124
124
|
n.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(n), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
@@ -127,18 +127,18 @@ async function oo(i) {
|
|
|
127
127
|
}
|
|
128
128
|
async function t(n, a, o, s) {
|
|
129
129
|
return new Promise(async (r) => {
|
|
130
|
-
let c = (a + s.byteLength) / n.rowLength | 0, u = (a + s.byteLength) % n.rowLength,
|
|
131
|
-
a ? (
|
|
132
|
-
const
|
|
130
|
+
let c = (a + s.byteLength) / n.rowLength | 0, u = (a + s.byteLength) % n.rowLength, l;
|
|
131
|
+
a ? (l = new Uint8Array(c * n.rowLength), l.set(o.slice(0, a), 0), l.set(s.slice(0, s.byteLength - u), a)) : l = s.slice(0, c * n.rowLength), n.downloadSplatCount + c > n.fetchLimit && (c = n.fetchLimit - n.downloadSplatCount, u = 0);
|
|
132
|
+
const d = async () => {
|
|
133
133
|
if (c > Qe) {
|
|
134
|
-
const h = await bn(
|
|
135
|
-
Ti(n, h), n.downloadSplatCount += Qe, e += Qe * n.rowLength, n.downloadSize = e, c -= Qe,
|
|
134
|
+
const h = await bn(l, Qe);
|
|
135
|
+
Ti(n, h), n.downloadSplatCount += Qe, e += Qe * n.rowLength, n.downloadSize = e, c -= Qe, l = l.slice(Qe * n.rowLength), setTimeout(d);
|
|
136
136
|
} else {
|
|
137
|
-
const h = await bn(
|
|
137
|
+
const h = await bn(l, c);
|
|
138
138
|
Ti(n, h), n.downloadSplatCount += c, e += c * n.rowLength, n.downloadSize = e, r(u);
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
-
await
|
|
141
|
+
await d();
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -151,25 +151,25 @@ function Ti(i, e) {
|
|
|
151
151
|
r = a[s * 8], c = a[s * 8 + 1], u = a[s * 8 + 2], i.minX = Math.min(i.minX, r), i.maxX = Math.max(i.maxX, r), i.minY = Math.min(i.minY, c), i.maxY = Math.max(i.maxY, c), i.minZ = Math.min(i.minZ, u), i.maxZ = Math.max(i.maxZ, u);
|
|
152
152
|
i.dataSplatCount += t;
|
|
153
153
|
const o = i.header?.MinTopY || 0;
|
|
154
|
-
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new
|
|
154
|
+
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new C((i.minX + i.maxX) / 2, (i.minY + i.maxY) / 2, (i.minZ + i.maxZ) / 2);
|
|
155
155
|
}
|
|
156
156
|
function qn(i) {
|
|
157
157
|
let e = !1;
|
|
158
|
-
const t = (p,
|
|
158
|
+
const t = (p, m, g) => i.on(p, m, g), n = (p, ...m) => i.fire(p, ...m), a = !n(I).renderer;
|
|
159
159
|
t(re, () => n(I).debugMode), t(Bn, () => e = !0);
|
|
160
160
|
let o = 0;
|
|
161
161
|
(function p() {
|
|
162
162
|
o++, !e && requestAnimationFrame(p);
|
|
163
|
-
})(), t(at, (p,
|
|
164
|
-
const
|
|
165
|
-
e || (g > 0 ? !(o % g) && p(o) : p(o),
|
|
163
|
+
})(), t(at, (p, m = null, g = 0) => {
|
|
164
|
+
const y = () => {
|
|
165
|
+
e || (g > 0 ? !(o % g) && p(o) : p(o), m && m() && requestAnimationFrame(y));
|
|
166
166
|
};
|
|
167
|
-
|
|
168
|
-
}), t(Ln, (p,
|
|
169
|
-
const
|
|
170
|
-
e || (p(),
|
|
167
|
+
y();
|
|
168
|
+
}), t(Ln, (p, m = null, g = 20) => {
|
|
169
|
+
const y = () => {
|
|
170
|
+
e || (p(), m && m() && setTimeout(y, g));
|
|
171
171
|
};
|
|
172
|
-
|
|
172
|
+
y();
|
|
173
173
|
});
|
|
174
174
|
let s = !1, r = 0, c = 0;
|
|
175
175
|
t(Ms, () => {
|
|
@@ -177,48 +177,48 @@ function qn(i) {
|
|
|
177
177
|
const p = document.querySelector("#gsviewer #progressBarWrap");
|
|
178
178
|
if (p) {
|
|
179
179
|
p.style.display = "block";
|
|
180
|
-
const
|
|
181
|
-
|
|
180
|
+
const m = document.querySelector("#gsviewer #progressBar");
|
|
181
|
+
m && (m.style.width = "0%");
|
|
182
182
|
}
|
|
183
183
|
})(), (async () => document.querySelector("#gsviewer .logo")?.classList.add("loading"))()) : parent?.onProgress && parent.onProgress(1e-3, "0.001%");
|
|
184
184
|
}), t(Mt, (p) => {
|
|
185
185
|
p && (r = p), s = !1, p !== void 0 && ((async () => {
|
|
186
|
-
const
|
|
187
|
-
|
|
186
|
+
const m = document.querySelector("#gsviewer #progressBarWrap");
|
|
187
|
+
m && (m.style.display = "none");
|
|
188
188
|
})(), (async () => document.querySelector("#gsviewer .logo")?.classList.remove("loading"))(), parent?.onProgress && parent.onProgress(0, "100%", 9));
|
|
189
189
|
}), t(Ts, (p) => {
|
|
190
190
|
s = !0, n(I).debugMode ? (async () => {
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const m = document.querySelector("#gsviewer #progressBar");
|
|
192
|
+
m && (m.style.width = `${p}%`);
|
|
193
193
|
})() : parent?.onProgress && parent.onProgress(p, `${p}%`);
|
|
194
194
|
}), t(Ia, () => s), t(ks, (p) => {
|
|
195
195
|
c = p;
|
|
196
196
|
}), t(Es, () => !s && r && c >= r), t(Ue, () => {
|
|
197
|
-
const
|
|
198
|
-
return { width:
|
|
197
|
+
const m = n(Ke).parentElement.getBoundingClientRect();
|
|
198
|
+
return { width: m.width, height: m.height, left: m.left, top: m.top };
|
|
199
199
|
}), t(Le, (p) => {
|
|
200
|
-
let
|
|
201
|
-
return (
|
|
200
|
+
let m = p.x.toFixed(3).split("."), g = p.y.toFixed(3).split("."), y = p.z.toFixed(3).split(".");
|
|
201
|
+
return (m[1] === "000" || m[1] === "00000") && (m[1] = "0"), (g[1] === "000" || g[1] === "00000") && (g[1] = "0"), (y[1] === "000" || y[1] === "00000") && (y[1] = "0"), `${m.join(".")}, ${g.join(".")}, ${y.join(".")}`;
|
|
202
202
|
}), t(Ma, (p) => btoa(p)), t(Ta, (p) => atob(p));
|
|
203
203
|
const u = 1e-3;
|
|
204
|
-
let
|
|
204
|
+
let l = new C(), d = new C(), h = 0;
|
|
205
205
|
t(_a, () => {
|
|
206
|
-
const p = n(V),
|
|
207
|
-
return Math.abs(h -
|
|
206
|
+
const p = n(V), m = p.fov, g = p.position.clone(), y = p.getWorldDirection(new C());
|
|
207
|
+
return Math.abs(h - m) < u && Math.abs(g.x - l.x) < u && Math.abs(g.y - l.y) < u && Math.abs(g.z - l.z) < u && Math.abs(y.x - d.x) < u && Math.abs(y.y - d.y) < u && Math.abs(y.z - d.z) < u ? !1 : (h = m, l = g, d = y, !0);
|
|
208
208
|
}), t(ke, (p) => {
|
|
209
209
|
if (!p) return;
|
|
210
|
-
const
|
|
211
|
-
p.traverse((g) =>
|
|
212
|
-
g.dispose ? g.dispose() : (g.geometry?.dispose?.(), g.material && g.material instanceof Array ? g.material.forEach((
|
|
210
|
+
const m = [];
|
|
211
|
+
p.traverse((g) => m.push(g)), m.forEach((g) => {
|
|
212
|
+
g.dispose ? g.dispose() : (g.geometry?.dispose?.(), g.material && g.material instanceof Array ? g.material.forEach((y) => y?.dispose?.()) : g.material?.dispose?.());
|
|
213
213
|
}), p.clear();
|
|
214
214
|
}), t(
|
|
215
215
|
oe,
|
|
216
216
|
async ({
|
|
217
217
|
renderSplatCount: p,
|
|
218
|
-
visibleSplatCount:
|
|
218
|
+
visibleSplatCount: m,
|
|
219
219
|
modelSplatCount: g,
|
|
220
|
-
fps:
|
|
221
|
-
realFps:
|
|
220
|
+
fps: y,
|
|
221
|
+
realFps: M,
|
|
222
222
|
sortTime: S,
|
|
223
223
|
fov: v,
|
|
224
224
|
position: k,
|
|
@@ -232,7 +232,7 @@ function qn(i) {
|
|
|
232
232
|
shDegree: F
|
|
233
233
|
} = {}) => {
|
|
234
234
|
if (!n(re)) return;
|
|
235
|
-
F !== void 0 && f("shDegree", `${F}`), p !== void 0 && f("renderSplatCount", `${p}`),
|
|
235
|
+
F !== void 0 && f("shDegree", `${F}`), p !== void 0 && f("renderSplatCount", `${p}`), m !== void 0 && f("visibleSplatCount", `${m}`), g !== void 0 && f("modelSplatCount", `${g}`), y !== void 0 && f("fps", y), M !== void 0 && f("realFps", `raw ${M}`), S !== void 0 && f("sort", `${S} ms`), !a && n(ee) ? T !== void 0 && f("cuts", `(${T} cuts)`) : f("cuts", ""), w && f("worker", `${w}`), D && f("scene", D), v && f("fov", v), k && f("position", k), b && f("lookUp", b), x && f("lookAt", x), x && f("viewer-version", Yt);
|
|
236
236
|
let E = performance.memory || { usedJSHeapSize: 0, totalJSHeapSize: 0, jsHeapSizeLimit: 0 }, P = "", U = E.usedJSHeapSize / 1024 / 1024;
|
|
237
237
|
U > 1e3 ? P += (U / 1024).toFixed(2) + " G" : P += U.toFixed(0) + " M", P += " / ";
|
|
238
238
|
let O = E.totalJSHeapSize / 1024 / 1024;
|
|
@@ -241,9 +241,9 @@ function qn(i) {
|
|
|
241
241
|
P += " / ", W > 1e3 ? P += (W / 1024).toFixed(2) + " G" : P += W.toFixed(0) + " M", f("memory", P), _ && f("scale", _);
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
|
-
async function f(p,
|
|
244
|
+
async function f(p, m) {
|
|
245
245
|
let g = document.querySelector(`#gsviewer .debug .${p}`);
|
|
246
|
-
g && (g.innerText =
|
|
246
|
+
g && (g.innerText = m);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
function ro(i = 0) {
|
|
@@ -284,12 +284,12 @@ async function lo(i) {
|
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
i.fileSize = o;
|
|
287
|
-
let r = [], c = new Uint8Array(ze), u = new Uint8Array(R),
|
|
287
|
+
let r = [], c = new Uint8Array(ze), u = new Uint8Array(R), l = 0, d = !1, h = 0, f = 0, p, m = !1;
|
|
288
288
|
for (; ; ) {
|
|
289
|
-
let { done: g, value:
|
|
289
|
+
let { done: g, value: y } = await a.read();
|
|
290
290
|
if (g) break;
|
|
291
|
-
if (i.downloadSize +=
|
|
292
|
-
r.push(
|
|
291
|
+
if (i.downloadSize += y.byteLength, r) {
|
|
292
|
+
r.push(y);
|
|
293
293
|
let v = 0;
|
|
294
294
|
for (let x = 0; x < r.length; x++)
|
|
295
295
|
v += r[x].byteLength;
|
|
@@ -297,37 +297,37 @@ async function lo(i) {
|
|
|
297
297
|
continue;
|
|
298
298
|
let k = 0;
|
|
299
299
|
for (let x = 0; x < r.length; x++)
|
|
300
|
-
k + r[x].byteLength < ze ? (c.set(r[x], k), k += r[x].byteLength) : (c.set(r[x].slice(0, ze - k), k),
|
|
300
|
+
k + r[x].byteLength < ze ? (c.set(r[x], k), k += r[x].byteLength) : (c.set(r[x].slice(0, ze - k), k), y = new Uint8Array(r[x].slice(ze - k)));
|
|
301
301
|
const b = await so(c);
|
|
302
302
|
if (!b) {
|
|
303
303
|
i.abortController.abort(), i.status === L.Fetching && (i.status = L.Invalid), console.error("invalid spx format");
|
|
304
304
|
continue;
|
|
305
305
|
}
|
|
306
|
-
if (i.header = b, i.modelSplatCount = b.SplatCount, i.dataShDegree = b.ShDegree, i.aabbCenter = new
|
|
306
|
+
if (i.header = b, i.modelSplatCount = b.SplatCount, i.dataShDegree = b.ShDegree, i.aabbCenter = new C((b.MaxX + b.MaxX) / 2, (b.MinY + b.MaxY) / 2, (b.MinZ + b.MaxZ) / 2), r = null, c = null, !co.includes(b.ExclusiveId)) {
|
|
307
307
|
i.abortController.abort(), i.status = L.Invalid, console.error("Unrecognized format, creater id =", b.CreaterId, ", exclusive id =", b.ExclusiveId, b.Comment);
|
|
308
308
|
continue;
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
if (!
|
|
312
|
-
if (
|
|
313
|
-
u.set(
|
|
311
|
+
if (!d) {
|
|
312
|
+
if (l + y.byteLength < 4) {
|
|
313
|
+
u.set(y, l), l += y.byteLength;
|
|
314
314
|
continue;
|
|
315
315
|
}
|
|
316
|
-
const v = new Uint8Array(
|
|
317
|
-
v.set(u.slice(0,
|
|
316
|
+
const v = new Uint8Array(l + y.byteLength);
|
|
317
|
+
v.set(u.slice(0, l), 0), v.set(y, l), y = v.slice(4), l = 0, d = !0, p = [], f = 0;
|
|
318
318
|
const k = new Int32Array(v.slice(0, 4).buffer);
|
|
319
|
-
|
|
319
|
+
m = k[0] < 0, h = Math.abs(k[0]);
|
|
320
320
|
}
|
|
321
|
-
let
|
|
322
|
-
if (p.push(
|
|
323
|
-
f +=
|
|
321
|
+
let M = f + y.byteLength;
|
|
322
|
+
if (p.push(y), M < h) {
|
|
323
|
+
f += y.byteLength;
|
|
324
324
|
continue;
|
|
325
325
|
}
|
|
326
|
-
for (;
|
|
326
|
+
for (; M >= h; ) {
|
|
327
327
|
let v = new Uint8Array(h), k = 0;
|
|
328
328
|
for (let x = 0; x < p.length; x++)
|
|
329
|
-
k + p[x].byteLength < h ? (v.set(p[x], k), k += p[x].byteLength) : (v.set(p[x].slice(0, h - k), k),
|
|
330
|
-
|
|
329
|
+
k + p[x].byteLength < h ? (v.set(p[x], k), k += p[x].byteLength) : (v.set(p[x].slice(0, h - k), k), y = new Uint8Array(p[x].slice(h - k)));
|
|
330
|
+
m && (v = await qs(v));
|
|
331
331
|
const b = await fe(v);
|
|
332
332
|
if (!b.success) {
|
|
333
333
|
console.error("spx block data parser failed. block format:", b.blockFormat), i.abortController.abort(), i.status = L.Invalid;
|
|
@@ -349,12 +349,12 @@ async function lo(i) {
|
|
|
349
349
|
} else
|
|
350
350
|
i.sh12Data.push(b.datas), i.sh12Count += b.splatCount;
|
|
351
351
|
}
|
|
352
|
-
if (
|
|
353
|
-
u.set(
|
|
352
|
+
if (y.byteLength < 4) {
|
|
353
|
+
u.set(y, 0), l = y.byteLength, d = !1;
|
|
354
354
|
break;
|
|
355
355
|
} else {
|
|
356
|
-
const x = new Int32Array(
|
|
357
|
-
h = Math.abs(x[0]),
|
|
356
|
+
const x = new Int32Array(y.slice(0, 4).buffer);
|
|
357
|
+
h = Math.abs(x[0]), m = x[0] < 0, y = y.slice(4), M = y.byteLength, p = [y], f = y.byteLength;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
const S = i.fetchLimit;
|
|
@@ -373,9 +373,9 @@ function uo(i, e) {
|
|
|
373
373
|
const c = Math.min(i.fetchLimit, i.modelSplatCount);
|
|
374
374
|
if (!i.splatData && (i.splatData = new Uint8Array(c * R)), !i.watermarkData && (i.watermarkData = new Uint8Array(0)), i.dataSplatCount + n > c && (n = c - i.dataSplatCount, !n))
|
|
375
375
|
return;
|
|
376
|
-
const u = new Float32Array(e.buffer),
|
|
377
|
-
for (let h = 0, f = 0, p = 0,
|
|
378
|
-
if (f = u[h * 8], p = u[h * 8 + 1],
|
|
376
|
+
const u = new Float32Array(e.buffer), l = new Uint32Array(e.buffer);
|
|
377
|
+
for (let h = 0, f = 0, p = 0, m = 0; h < n; h++)
|
|
378
|
+
if (f = u[h * 8], p = u[h * 8 + 1], m = u[h * 8 + 2], i.minX = Math.min(i.minX, f), i.maxX = Math.max(i.maxX, f), i.minY = Math.min(i.minY, p), i.maxY = Math.max(i.maxY, p), i.minZ = Math.min(i.minZ, m), i.maxZ = Math.max(i.maxZ, m), l[h * 8 + 3] >> 16) {
|
|
379
379
|
if (i.watermarkCount * R === i.watermarkData.byteLength) {
|
|
380
380
|
const g = new Uint8Array((i.watermarkCount + a) * R);
|
|
381
381
|
g.set(i.watermarkData, 0), i.watermarkData = g;
|
|
@@ -383,36 +383,36 @@ function uo(i, e) {
|
|
|
383
383
|
i.watermarkData.set(e.slice(h * 32, h * 32 + 32), i.watermarkCount++ * R);
|
|
384
384
|
} else
|
|
385
385
|
i.splatData.set(e.slice(h * 32, h * 32 + 32), i.dataSplatCount++ * R);
|
|
386
|
-
const
|
|
387
|
-
i.currentRadius = Math.sqrt(i.maxX * i.maxX +
|
|
386
|
+
const d = i.header.MinTopY || 0;
|
|
387
|
+
i.currentRadius = Math.sqrt(i.maxX * i.maxX + d * d + i.maxZ * i.maxZ);
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
let o = Math.min(Math.max(i.meta.autoCut, 2), 50);
|
|
391
391
|
!i.watermarkData && (i.watermarkData = new Uint8Array(0));
|
|
392
392
|
const s = new Float32Array(e.buffer), r = new Uint32Array(e.buffer);
|
|
393
|
-
for (let c = 0, u = Math.floor(e.byteLength / R),
|
|
393
|
+
for (let c = 0, u = Math.floor(e.byteLength / R), l = 0, d = 0, h = 0, f = ""; c < u; c++) {
|
|
394
394
|
if (r[c * 8 + 3] >> 16) {
|
|
395
395
|
if (i.watermarkCount * R === i.watermarkData.byteLength) {
|
|
396
|
-
const
|
|
397
|
-
|
|
396
|
+
const y = new Uint8Array((i.watermarkCount + a) * R);
|
|
397
|
+
y.set(i.watermarkData, 0), i.watermarkData = y;
|
|
398
398
|
}
|
|
399
399
|
i.watermarkData.set(e.slice(c * 32, c * 32 + 32), i.watermarkCount++ * R);
|
|
400
400
|
continue;
|
|
401
401
|
}
|
|
402
|
-
|
|
403
|
-
let p = Math.min(o - 1, Math.floor(Math.max(0,
|
|
404
|
-
f = `${p}-${
|
|
402
|
+
l = s[c * 8], d = s[c * 8 + 1], h = s[c * 8 + 2];
|
|
403
|
+
let p = Math.min(o - 1, Math.floor(Math.max(0, l - i.header.MinX) / (i.header.MaxX - i.header.MinX) * o)), m = Math.min(o - 1, Math.floor(Math.max(0, h - i.header.MinZ) / (i.header.MaxZ - i.header.MinZ) * o));
|
|
404
|
+
f = `${p}-${m}`;
|
|
405
405
|
let g = i.map.get(f);
|
|
406
406
|
if (!g)
|
|
407
|
-
g = {}, g.minX =
|
|
407
|
+
g = {}, g.minX = l, g.maxX = l, g.minY = d, g.maxY = d, g.minZ = h, g.maxZ = h, g.centerX = l, g.centerY = d, g.centerZ = h, g.radius = 0, g.splatData = new Uint8Array(a * R), g.splatData.set(e.slice(c * R, c * R + R), 0), g.splatCount = 1, i.map.set(f, g);
|
|
408
408
|
else {
|
|
409
409
|
if (g.splatData.byteLength / R == g.splatCount) {
|
|
410
410
|
const v = new Uint8Array(g.splatData.byteLength + a * R);
|
|
411
411
|
v.set(g.splatData, 0), g.splatData = v;
|
|
412
412
|
}
|
|
413
|
-
g.minX = Math.min(g.minX,
|
|
414
|
-
const
|
|
415
|
-
g.radius = Math.sqrt(
|
|
413
|
+
g.minX = Math.min(g.minX, l), g.maxX = Math.max(g.maxX, l), g.minY = Math.min(g.minY, d), g.maxY = Math.max(g.maxY, d), g.minZ = Math.min(g.minZ, h), g.maxZ = Math.max(g.maxZ, h), g.centerX = (g.maxX + g.minX) / 2, g.centerY = (g.maxY + g.minY) / 2, g.centerZ = (g.maxZ + g.minZ) / 2;
|
|
414
|
+
const y = g.maxX - g.minX, M = g.maxY - g.minY, S = g.maxZ - g.minZ;
|
|
415
|
+
g.radius = Math.sqrt(y * y + M * M + S * S) / 2, g.splatData.set(e.slice(c * R, c * R + R), g.splatCount++ * R);
|
|
416
416
|
}
|
|
417
417
|
i.dataSplatCount++;
|
|
418
418
|
}
|
|
@@ -428,23 +428,23 @@ async function ho(i) {
|
|
|
428
428
|
}
|
|
429
429
|
const r = s.body.getReader(), c = parseInt(s.headers.get("content-length") || "0");
|
|
430
430
|
i.fileSize = c, i.downloadSize = 0, i.downloadSplatCount = 0, i.watermarkData = new Uint8Array(0);
|
|
431
|
-
let u = new Uint8Array(256),
|
|
431
|
+
let u = new Uint8Array(256), l = 0, d = [], h;
|
|
432
432
|
for (; ; ) {
|
|
433
433
|
let { done: f, value: p } = await r.read();
|
|
434
434
|
if (f) break;
|
|
435
|
-
if (i.downloadSize += p.byteLength,
|
|
436
|
-
if (
|
|
435
|
+
if (i.downloadSize += p.byteLength, d) {
|
|
436
|
+
if (d.push(p), i.downloadSize < 200)
|
|
437
437
|
continue;
|
|
438
|
-
const
|
|
439
|
-
for (let g = 0,
|
|
440
|
-
|
|
441
|
-
if (h = n(
|
|
442
|
-
|
|
438
|
+
const m = new Uint8Array(i.downloadSize);
|
|
439
|
+
for (let g = 0, y = 0; g < d.length; g++)
|
|
440
|
+
m.set(d[g], y), y += d[g].byteLength;
|
|
441
|
+
if (h = n(m), !h) {
|
|
442
|
+
d = [m];
|
|
443
443
|
continue;
|
|
444
444
|
}
|
|
445
|
-
|
|
445
|
+
d = null, p = m.slice(h.headerLength), i.rowLength = h.rowLength, i.dataShDegree = h.shDegree, i.modelSplatCount = h.vertexCount, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32);
|
|
446
446
|
}
|
|
447
|
-
|
|
447
|
+
l + p.byteLength < i.rowLength ? (u.set(p, l), l += p.byteLength) : (l = await e(h, i, l, u, p), l && u.set(p.slice(p.byteLength - l), 0)), i.downloadSplatCount >= i.fetchLimit && i.abortController.abort();
|
|
448
448
|
}
|
|
449
449
|
} catch (a) {
|
|
450
450
|
a.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(a), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
@@ -453,15 +453,15 @@ async function ho(i) {
|
|
|
453
453
|
}
|
|
454
454
|
async function e(a, o, s, r, c) {
|
|
455
455
|
return new Promise(async (u) => {
|
|
456
|
-
let
|
|
457
|
-
s ? (h = new Uint8Array(
|
|
456
|
+
let l = (s + c.byteLength) / o.rowLength | 0, d = (s + c.byteLength) % o.rowLength, h;
|
|
457
|
+
s ? (h = new Uint8Array(l * o.rowLength), h.set(r.slice(0, s), 0), h.set(c.slice(0, c.byteLength - d), s)) : h = c.slice(0, l * o.rowLength), o.downloadSplatCount + l > o.fetchLimit && (l = o.fetchLimit - o.downloadSplatCount, d = 0);
|
|
458
458
|
const f = async () => {
|
|
459
|
-
if (
|
|
459
|
+
if (l > je) {
|
|
460
460
|
const p = await t(a, h, je);
|
|
461
|
-
ki(o, p), o.downloadSplatCount += je,
|
|
461
|
+
ki(o, p), o.downloadSplatCount += je, l -= je, h = h.slice(je * o.rowLength), setTimeout(f);
|
|
462
462
|
} else {
|
|
463
|
-
const p = await t(a, h,
|
|
464
|
-
ki(o, p), o.downloadSplatCount +=
|
|
463
|
+
const p = await t(a, h, l);
|
|
464
|
+
ki(o, p), o.downloadSplatCount += l, u(d);
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
467
|
await f();
|
|
@@ -469,42 +469,42 @@ async function ho(i) {
|
|
|
469
469
|
}
|
|
470
470
|
async function t(a, o, s) {
|
|
471
471
|
const r = new Uint8Array(s * Za), c = new Float32Array(o.buffer), u = new Float32Array(r.buffer);
|
|
472
|
-
for (let
|
|
473
|
-
u[
|
|
472
|
+
for (let l = 0; l < s; l++)
|
|
473
|
+
u[l * 8 + 0] = c[(l * i.rowLength + a.offsets.x) / 4], u[l * 8 + 1] = c[(l * i.rowLength + a.offsets.y) / 4], u[l * 8 + 2] = c[(l * i.rowLength + a.offsets.z) / 4], u[l * 8 + 3] = Math.exp(c[(l * i.rowLength + a.offsets.scale_0) / 4]), u[l * 8 + 4] = Math.exp(c[(l * i.rowLength + a.offsets.scale_1) / 4]), u[l * 8 + 5] = Math.exp(c[(l * i.rowLength + a.offsets.scale_2) / 4]), r[l * 32 + 24] = ne((0.5 + Et * c[(l * i.rowLength + a.offsets.f_dc_0) / 4]) * 255), r[l * 32 + 25] = ne((0.5 + Et * c[(l * i.rowLength + a.offsets.f_dc_1) / 4]) * 255), r[l * 32 + 26] = ne((0.5 + Et * c[(l * i.rowLength + a.offsets.f_dc_2) / 4]) * 255), r[l * 32 + 27] = ne(1 / (1 + Math.exp(-c[(l * i.rowLength + a.offsets.opacity) / 4])) * 255), r[l * 32 + 28] = ne(c[(l * i.rowLength + a.offsets.rot_0) / 4] * 128 + 128), r[l * 32 + 29] = ne(c[(l * i.rowLength + a.offsets.rot_1) / 4] * 128 + 128), r[l * 32 + 30] = ne(c[(l * i.rowLength + a.offsets.rot_2) / 4] * 128 + 128), r[l * 32 + 31] = ne(c[(l * i.rowLength + a.offsets.rot_3) / 4] * 128 + 128);
|
|
474
474
|
if (a.shDegree == 3) {
|
|
475
|
-
const
|
|
476
|
-
f[0] = s, f[1] = ut,
|
|
475
|
+
const d = new Uint8Array(s * 24 + 8), h = new Uint8Array(s * 21 + 8), f = new Uint32Array(2);
|
|
476
|
+
f[0] = s, f[1] = ut, d.set(new Uint8Array(f.buffer), 0);
|
|
477
477
|
const p = new Uint32Array(2);
|
|
478
478
|
p[0] = s, p[1] = Kn, h.set(new Uint8Array(p.buffer), 0);
|
|
479
|
-
for (let
|
|
479
|
+
for (let y = 0, M = 0; y < s; y++)
|
|
480
480
|
for (let S = 0; S < 8; S++)
|
|
481
481
|
for (let v = 0; v < 3; v++)
|
|
482
|
-
|
|
483
|
-
for (let
|
|
482
|
+
d[8 + M++] = yt(c[(y * i.rowLength + a.offsets["f_rest_" + (S + v * 15)]) / 4]);
|
|
483
|
+
for (let y = 0, M = 0; y < s; y++)
|
|
484
484
|
for (let S = 8; S < 15; S++)
|
|
485
485
|
for (let v = 0; v < 3; v++)
|
|
486
|
-
h[8 +
|
|
487
|
-
const
|
|
488
|
-
i.sh12Data.push(
|
|
486
|
+
h[8 + M++] = yt(c[(y * i.rowLength + a.offsets["f_rest_" + (S + v * 15)]) / 4]);
|
|
487
|
+
const m = await fe(d);
|
|
488
|
+
i.sh12Data.push(m.datas);
|
|
489
489
|
const g = await fe(h);
|
|
490
490
|
i.sh3Data.push(g.datas);
|
|
491
491
|
} else if (a.shDegree == 2) {
|
|
492
|
-
const
|
|
493
|
-
h[0] = s, h[1] = ut,
|
|
494
|
-
for (let p = 0,
|
|
492
|
+
const d = new Uint8Array(s * 24 + 8), h = new Uint32Array(2);
|
|
493
|
+
h[0] = s, h[1] = ut, d.set(new Uint8Array(h.buffer), 0);
|
|
494
|
+
for (let p = 0, m = 0; p < s; p++)
|
|
495
495
|
for (let g = 0; g < 8; g++)
|
|
496
|
-
for (let
|
|
497
|
-
|
|
498
|
-
const f = await fe(
|
|
496
|
+
for (let y = 0; y < 3; y++)
|
|
497
|
+
d[8 + m++] = yt(c[(p * i.rowLength + a.offsets["f_rest_" + (g + y * 8)]) / 4]);
|
|
498
|
+
const f = await fe(d);
|
|
499
499
|
i.sh12Data.push(f.datas);
|
|
500
500
|
} else if (a.shDegree == 1) {
|
|
501
|
-
const
|
|
502
|
-
h[0] = s, h[1] = $n,
|
|
503
|
-
for (let p = 0,
|
|
501
|
+
const d = new Uint8Array(s * 9 + 8), h = new Uint32Array(2);
|
|
502
|
+
h[0] = s, h[1] = $n, d.set(new Uint8Array(h.buffer), 0);
|
|
503
|
+
for (let p = 0, m = 0; p < s; p++)
|
|
504
504
|
for (let g = 0; g < 3; g++)
|
|
505
|
-
for (let
|
|
506
|
-
|
|
507
|
-
const f = await fe(
|
|
505
|
+
for (let y = 0; y < 3; y++)
|
|
506
|
+
d[8 + m++] = yt(c[(p * i.rowLength + a.offsets["f_rest_" + (g + y * 3)]) / 4]);
|
|
507
|
+
const f = await fe(d);
|
|
508
508
|
i.sh12Data.push(f.datas);
|
|
509
509
|
}
|
|
510
510
|
return await bn(r, s);
|
|
@@ -520,7 +520,7 @@ async function ho(i) {
|
|
|
520
520
|
if (!o.startsWith("ply") || o.indexOf("format binary_little_endian 1.0") < 0)
|
|
521
521
|
throw new Error("Unknow .ply file header");
|
|
522
522
|
const c = parseInt(/element vertex (\d+)\n/.exec(o)[1]);
|
|
523
|
-
let u = 0,
|
|
523
|
+
let u = 0, l = {}, d = {};
|
|
524
524
|
const h = {
|
|
525
525
|
double: "getFloat64",
|
|
526
526
|
int: "getInt32",
|
|
@@ -530,20 +530,20 @@ async function ho(i) {
|
|
|
530
530
|
ushort: "getUint16",
|
|
531
531
|
uchar: "getUint8"
|
|
532
532
|
};
|
|
533
|
-
for (let
|
|
533
|
+
for (let m of o.slice(0, r).split(`
|
|
534
534
|
`).filter((g) => g.startsWith("property "))) {
|
|
535
|
-
const [g,
|
|
536
|
-
|
|
535
|
+
const [g, y, M] = m.split(" "), S = h[y] || "getInt8";
|
|
536
|
+
d[M] = S, l[M] = u, u += parseInt(S.replace(/[^\d]/g, "")) / 8;
|
|
537
537
|
}
|
|
538
538
|
let f = 0;
|
|
539
|
-
|
|
539
|
+
d.f_rest_44 ? f = 3 : d.f_rest_23 ? f = 2 : d.f_rest_8 && (f = 1);
|
|
540
540
|
const p = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "f_dc_0", "f_dc_1", "f_dc_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
|
|
541
|
-
for (let
|
|
542
|
-
const g = p[
|
|
543
|
-
if (!
|
|
541
|
+
for (let m = 0; m < p.length; m++) {
|
|
542
|
+
const g = p[m];
|
|
543
|
+
if (!d[g])
|
|
544
544
|
throw new Error(`Property not found: ${g}`);
|
|
545
545
|
}
|
|
546
|
-
return { headerLength: r + s.length, offsets:
|
|
546
|
+
return { headerLength: r + s.length, offsets: l, rowLength: u, vertexCount: c, shDegree: f };
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
function ki(i, e) {
|
|
@@ -555,7 +555,7 @@ function ki(i, e) {
|
|
|
555
555
|
r = a[s * 8], c = a[s * 8 + 1], u = a[s * 8 + 2], i.minX = Math.min(i.minX, r), i.maxX = Math.max(i.maxX, r), i.minY = Math.min(i.minY, c), i.maxY = Math.max(i.maxY, c), i.minZ = Math.min(i.minZ, u), i.maxZ = Math.max(i.maxZ, u);
|
|
556
556
|
i.dataSplatCount += t;
|
|
557
557
|
const o = 0;
|
|
558
|
-
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new
|
|
558
|
+
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new C((i.minX + i.maxX) / 2, (i.minY + i.maxY) / 2, (i.minZ + i.maxZ) / 2);
|
|
559
559
|
}
|
|
560
560
|
const z = le ? 20480 : 51200, Zt = 16;
|
|
561
561
|
async function po(i) {
|
|
@@ -574,22 +574,22 @@ async function po(i) {
|
|
|
574
574
|
if (h) break;
|
|
575
575
|
u.set(f, i.downloadSize), i.downloadSize += f.length;
|
|
576
576
|
}
|
|
577
|
-
const
|
|
578
|
-
if (!
|
|
577
|
+
const l = await qs(u);
|
|
578
|
+
if (!l || l.length < 16) {
|
|
579
579
|
console.error("Invalid spz format"), i.status = L.Invalid;
|
|
580
580
|
return;
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
i.modelSplatCount =
|
|
582
|
+
const d = n(l);
|
|
583
|
+
i.modelSplatCount = d.numPoints, i.dataShDegree = d.shDegree, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32), await e(d, i, l);
|
|
584
584
|
} catch (a) {
|
|
585
585
|
a.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(a), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
586
586
|
} finally {
|
|
587
587
|
i.status === L.Fetching && (i.status = L.FetchDone);
|
|
588
588
|
}
|
|
589
589
|
async function e(a, o, s) {
|
|
590
|
-
const r = a.numPoints * 9, c = a.numPoints, u = a.numPoints * 3,
|
|
590
|
+
const r = a.numPoints * 9, c = a.numPoints, u = a.numPoints * 3, l = a.numPoints * 3, d = a.numPoints * 3, h = Zt, f = h + r, p = f + c, m = p + u, g = m + l, y = g + d, M = Math.min(a.numPoints, o.fetchLimit), S = Math.ceil(M / z);
|
|
591
591
|
for (let v = 0; v < S; v++) {
|
|
592
|
-
let k = v < S - 1 ? z :
|
|
592
|
+
let k = v < S - 1 ? z : M - v * z;
|
|
593
593
|
o.dataSplatCount + k > o.fetchLimit && (k = o.fetchLimit - o.dataSplatCount);
|
|
594
594
|
const b = new Uint8Array(k * 20 + 8), x = new Uint32Array(2);
|
|
595
595
|
x[0] = k, x[1] = no, b.set(new Uint8Array(x.buffer), 0);
|
|
@@ -601,11 +601,11 @@ async function po(i) {
|
|
|
601
601
|
for (let T = 0; T < k; T++)
|
|
602
602
|
b[w++] = s[h + (v * z + T) * 9 + 6], b[w++] = s[h + (v * z + T) * 9 + 7], b[w++] = s[h + (v * z + T) * 9 + 8];
|
|
603
603
|
for (let T = 0; T < k; T++)
|
|
604
|
-
b[w++] = s[
|
|
604
|
+
b[w++] = s[m + (v * z + T) * 3];
|
|
605
605
|
for (let T = 0; T < k; T++)
|
|
606
|
-
b[w++] = s[
|
|
606
|
+
b[w++] = s[m + (v * z + T) * 3 + 1];
|
|
607
607
|
for (let T = 0; T < k; T++)
|
|
608
|
-
b[w++] = s[
|
|
608
|
+
b[w++] = s[m + (v * z + T) * 3 + 2];
|
|
609
609
|
for (let T = 0; T < k; T++)
|
|
610
610
|
b[w++] = jt(s[p + (v * z + T) * 3]);
|
|
611
611
|
for (let T = 0; T < k; T++)
|
|
@@ -628,27 +628,27 @@ async function po(i) {
|
|
|
628
628
|
const T = new Uint8Array(k * 9 + 8), F = new Uint32Array(2);
|
|
629
629
|
F[0] = k, F[1] = $n, T.set(new Uint8Array(F.buffer), 0);
|
|
630
630
|
for (let P = 0, U = 8; P < k; P++)
|
|
631
|
-
T.set(s.slice(
|
|
631
|
+
T.set(s.slice(y + (v * z + P) * 9, y + (v * z + P) * 9 + 9), U), U += 9;
|
|
632
632
|
const E = await fe(T);
|
|
633
633
|
o.sh12Data.push(E.datas);
|
|
634
634
|
} else if (a.shDegree === 2) {
|
|
635
635
|
const T = new Uint8Array(k * 24 + 8), F = new Uint32Array(2);
|
|
636
636
|
F[0] = k, F[1] = ut, T.set(new Uint8Array(F.buffer), 0);
|
|
637
637
|
for (let P = 0, U = 8; P < k; P++)
|
|
638
|
-
T.set(s.slice(
|
|
638
|
+
T.set(s.slice(y + (v * z + P) * 24, y + (v * z + P) * 24 + 24), U), U += 24;
|
|
639
639
|
const E = await fe(T);
|
|
640
640
|
o.sh12Data.push(E.datas);
|
|
641
641
|
} else if (a.shDegree === 3) {
|
|
642
642
|
const T = new Uint8Array(k * 24 + 8), F = new Uint32Array(2);
|
|
643
643
|
F[0] = k, F[1] = ut, T.set(new Uint8Array(F.buffer), 0);
|
|
644
644
|
for (let W = 0, se = 8; W < k; W++)
|
|
645
|
-
T.set(s.slice(
|
|
645
|
+
T.set(s.slice(y + (v * z + W) * 45, y + (v * z + W) * 45 + 24), se), se += 24;
|
|
646
646
|
const E = await fe(T);
|
|
647
647
|
o.sh12Data.push(E.datas);
|
|
648
648
|
const P = new Uint8Array(k * 21 + 8), U = new Uint32Array(2);
|
|
649
649
|
U[0] = k, U[1] = Kn, P.set(new Uint8Array(U.buffer), 0);
|
|
650
650
|
for (let W = 0, se = 8; W < k; W++)
|
|
651
|
-
P.set(s.slice(
|
|
651
|
+
P.set(s.slice(y + (v * z + W) * 45 + 24, y + (v * z + W) * 45 + 45), se), se += 21;
|
|
652
652
|
const O = await fe(P);
|
|
653
653
|
o.sh3Data.push(O.datas);
|
|
654
654
|
}
|
|
@@ -661,11 +661,11 @@ async function po(i) {
|
|
|
661
661
|
const c = Math.min(o.fetchLimit, a.numPoints);
|
|
662
662
|
o.dataSplatCount + r > c ? (r = c - o.dataSplatCount, o.splatData.set(s.slice(0, r * R), o.dataSplatCount * R)) : o.splatData.set(s, o.dataSplatCount * R);
|
|
663
663
|
const u = new Float32Array(s.buffer);
|
|
664
|
-
for (let
|
|
665
|
-
h = u[
|
|
664
|
+
for (let d = 0, h = 0, f = 0, p = 0; d < r; d++)
|
|
665
|
+
h = u[d * 8], f = u[d * 8 + 1], p = u[d * 8 + 2], o.minX = Math.min(o.minX, h), o.maxX = Math.max(o.maxX, h), o.minY = Math.min(o.minY, f), o.maxY = Math.max(o.maxY, f), o.minZ = Math.min(o.minZ, p), o.maxZ = Math.max(o.maxZ, p);
|
|
666
666
|
o.dataSplatCount += r, o.downloadSplatCount += r;
|
|
667
|
-
const
|
|
668
|
-
o.currentRadius = Math.sqrt(o.maxX * o.maxX +
|
|
667
|
+
const l = 0;
|
|
668
|
+
o.currentRadius = Math.sqrt(o.maxX * o.maxX + l * l + o.maxZ * o.maxZ), o.aabbCenter = new C((o.minX + o.maxX) / 2, (o.minY + o.maxY) / 2, (o.minZ + o.maxZ) / 2);
|
|
669
669
|
}
|
|
670
670
|
function n(a) {
|
|
671
671
|
const o = a.slice(0, Zt), s = new Uint32Array(o.buffer), r = {};
|
|
@@ -687,53 +687,53 @@ function fo(i, e, t) {
|
|
|
687
687
|
return [ne(s * 128 + 128), ne(n * 128 + 128), ne(a * 128 + 128), ne(o * 128 + 128)];
|
|
688
688
|
}
|
|
689
689
|
function go(i) {
|
|
690
|
-
const e = (
|
|
690
|
+
const e = (M, S, v) => i.on(M, S, v), t = (M, ...S) => i.fire(M, ...S);
|
|
691
691
|
let n, a = Date.now() + 36e5, o = null, s, r = { index: 0, version: 0 }, c = { version: 0 }, u = !1;
|
|
692
|
-
const
|
|
693
|
-
e(Ys, () => s?.aabbCenter || new
|
|
694
|
-
let
|
|
695
|
-
const h = new Promise((
|
|
692
|
+
const l = t(ee);
|
|
693
|
+
e(Ys, () => s?.aabbCenter || new C());
|
|
694
|
+
let d;
|
|
695
|
+
const h = new Promise((M) => d = M);
|
|
696
696
|
e(ot, async () => {
|
|
697
|
-
const
|
|
698
|
-
let S = le ?
|
|
699
|
-
if (!
|
|
697
|
+
const M = t(I);
|
|
698
|
+
let S = le ? M.maxRenderCountOfMobile : M.maxRenderCountOfPc;
|
|
699
|
+
if (!M.bigSceneMode) {
|
|
700
700
|
let v = await h;
|
|
701
701
|
S = Math.min(v, S) + 10240;
|
|
702
702
|
}
|
|
703
703
|
return S;
|
|
704
|
-
}), e(Je, async (
|
|
704
|
+
}), e(Je, async (M) => {
|
|
705
705
|
const S = t(I);
|
|
706
706
|
if (S.bigSceneMode) return 1;
|
|
707
707
|
let v = le ? S.maxRenderCountOfMobile : S.maxRenderCountOfPc, k = await h;
|
|
708
708
|
if (v = Math.min(k, v), !s.dataShDegree) return 1;
|
|
709
|
-
if (
|
|
709
|
+
if (M >= 3) {
|
|
710
710
|
if (s.dataShDegree < 3) return 1;
|
|
711
|
-
} else if (
|
|
711
|
+
} else if (M >= 1) {
|
|
712
712
|
if (s.dataShDegree < 1) return 1;
|
|
713
713
|
} else
|
|
714
714
|
return 1;
|
|
715
715
|
const b = 1024 * 2;
|
|
716
716
|
return Math.ceil(v / b);
|
|
717
|
-
}), e(Nn, async () => t(I).bigSceneMode ? 0 : (await h, s.dataShDegree)), e(Hn, async (
|
|
717
|
+
}), e(Nn, async () => t(I).bigSceneMode ? 0 : (await h, s.dataShDegree)), e(Hn, async (M, S = !0) => {
|
|
718
718
|
try {
|
|
719
719
|
await h;
|
|
720
720
|
const v = !!s.header?.Flag2;
|
|
721
|
-
o = await t(Rs,
|
|
721
|
+
o = await t(Rs, M, S, v), s && (s.textWatermarkVersion = Date.now());
|
|
722
722
|
} catch {
|
|
723
723
|
console.info("failed to generate watermark");
|
|
724
724
|
}
|
|
725
725
|
}), e(gn, () => {
|
|
726
|
-
if (
|
|
726
|
+
if (l) return r.version <= c.version ? r.xyz : c.xyz;
|
|
727
727
|
if (s?.status === L.FetchDone || s?.status === L.FetchAborted) {
|
|
728
728
|
if (s.activePoints && s.activePoints.length === void 0) return s.activePoints;
|
|
729
|
-
const
|
|
729
|
+
const M = {}, S = r.xyz;
|
|
730
730
|
for (let v = 0, k = S.length / 3, b = 0, x = 0, w = 0, D = ""; v < k; v++)
|
|
731
|
-
b = S[v * 3], x = S[v * 3 + 1], w = S[v * 3 + 2], D = `${Math.floor(b / 2) * 2 + 1},${Math.floor(x / 2) * 2 + 1},${Math.floor(w / 2) * 2 + 1}`, (
|
|
732
|
-
return s.activePoints =
|
|
731
|
+
b = S[v * 3], x = S[v * 3 + 1], w = S[v * 3 + 2], D = `${Math.floor(b / 2) * 2 + 1},${Math.floor(x / 2) * 2 + 1},${Math.floor(w / 2) * 2 + 1}`, (M[D] = M[D] || []).push(b, x, w);
|
|
732
|
+
return s.activePoints = M;
|
|
733
733
|
}
|
|
734
734
|
return r.xyz;
|
|
735
735
|
});
|
|
736
|
-
async function f(
|
|
736
|
+
async function f(M) {
|
|
737
737
|
if (n) return;
|
|
738
738
|
if (s && (s.status === L.Invalid || s.status === L.FetchFailed))
|
|
739
739
|
return t(I).viewerEvents?.fire(q), t(Mt, 0) || t(oe, { renderSplatCount: 0, visibleSplatCount: 0, modelSplatCount: 0 });
|
|
@@ -748,10 +748,10 @@ function go(i) {
|
|
|
748
748
|
await p(S), u = !1;
|
|
749
749
|
})));
|
|
750
750
|
}
|
|
751
|
-
async function p(
|
|
751
|
+
async function p(M) {
|
|
752
752
|
if (n) return;
|
|
753
753
|
const S = r, v = await t(ot), k = o;
|
|
754
|
-
let b = s.dataSplatCount, x =
|
|
754
|
+
let b = s.dataSplatCount, x = M ? s.watermarkCount : 0, w = s.meta.showWatermark && M ? (k?.byteLength || 0) / 32 : 0;
|
|
755
755
|
if (s.renderSplatCount = b + x + w, s.renderSplatCount >= v && (s.renderSplatCount = v, x = 0, w = 0, b > v && (b = v)), t(oe, { visibleSplatCount: s.renderSplatCount, modelSplatCount: s.modelSplatCount + w }), Date.now() - S.textureReadyTime < (le ? 600 : 300) || s.smallSceneUploadDone && s.lastTextWatermarkVersion == s.textWatermarkVersion) return;
|
|
756
756
|
if (!S.version) {
|
|
757
757
|
t(ms, (s.header?.Flag2 ? s.header.MaxTopY : s.header?.MinTopY) || 0);
|
|
@@ -765,55 +765,55 @@ function go(i) {
|
|
|
765
765
|
for (let O = 0, W = 0; O < s.renderSplatCount; O++)
|
|
766
766
|
P[O * 3] = F[O * 8], P[O * 3 + 1] = F[O * 8 + 1], P[O * 3 + 2] = F[O * 8 + 2];
|
|
767
767
|
const U = Date.now();
|
|
768
|
-
if (S.version = U, S.txdata = T, S.xyz = P, S.renderSplatCount = s.renderSplatCount, S.visibleSplatCount = s.downloadSplatCount + w, S.modelSplatCount = s.downloadSplatCount + w, S.watermarkCount = x + w, S.minX = s.minX, S.maxX = s.maxX, S.minY = s.minY, S.maxY = s.maxY, S.minZ = s.minZ, S.maxZ = s.maxZ, t(zs, S, s.currentRadius, s.currentRadius), a = U,
|
|
768
|
+
if (S.version = U, S.txdata = T, S.xyz = P, S.renderSplatCount = s.renderSplatCount, S.visibleSplatCount = s.downloadSplatCount + w, S.modelSplatCount = s.downloadSplatCount + w, S.watermarkCount = x + w, S.minX = s.minX, S.maxX = s.maxX, S.minY = s.minY, S.maxY = s.maxY, S.minZ = s.minZ, S.maxZ = s.maxZ, t(zs, S, s.currentRadius, s.currentRadius), a = U, M && !s.smallSceneUploadDone) {
|
|
769
769
|
s.smallSceneUploadDone = !0, t(Qs, s.sh12Data), t(Hs, s.sh3Data), s.sh12Data = null, s.sh3Data = null;
|
|
770
770
|
const O = t(I);
|
|
771
771
|
t(Rn, O.shDegree === void 0 ? 3 : O.shDegree), t(gn);
|
|
772
772
|
}
|
|
773
773
|
t(oe, { renderSplatCount: s.renderSplatCount });
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function m() {
|
|
776
776
|
n || (n = !0, s?.abortController?.abort(), s?.map?.clear(), s = null, o = null, r = null, c = null);
|
|
777
777
|
}
|
|
778
|
-
function g(
|
|
779
|
-
if (
|
|
780
|
-
lo(
|
|
781
|
-
else if (
|
|
782
|
-
oo(
|
|
783
|
-
else if (
|
|
784
|
-
ho(
|
|
785
|
-
else if (
|
|
786
|
-
po(
|
|
778
|
+
function g(M) {
|
|
779
|
+
if (M.opts.format === "spx")
|
|
780
|
+
lo(M);
|
|
781
|
+
else if (M.opts.format === "splat")
|
|
782
|
+
oo(M);
|
|
783
|
+
else if (M.opts.format === "ply")
|
|
784
|
+
ho(M);
|
|
785
|
+
else if (M.opts.format === "spz")
|
|
786
|
+
po(M);
|
|
787
787
|
else
|
|
788
788
|
return !1;
|
|
789
789
|
return !0;
|
|
790
790
|
}
|
|
791
|
-
async function
|
|
791
|
+
async function y(M, S) {
|
|
792
792
|
if (n) return;
|
|
793
793
|
const v = t(I), k = le ? v.maxRenderCountOfMobile : v.maxRenderCountOfPc, b = t(ee);
|
|
794
|
-
if (
|
|
794
|
+
if (M.fetchReload = ro(S.updateDate || 0), s = new $a(M, S), b && S.autoCut) {
|
|
795
795
|
const D = S.pcDownloadLimitSplatCount || eo, _ = S.mobileDownloadLimitSplatCount || Ja, T = le ? _ : D;
|
|
796
796
|
s.fetchLimit = Math.min(S.autoCut * S.autoCut * k + k, T);
|
|
797
797
|
} else
|
|
798
798
|
s.fetchLimit = k;
|
|
799
799
|
const x = Date.now(), w = () => {
|
|
800
800
|
if (!s || s.status == L.Invalid || s.status == L.FetchFailed)
|
|
801
|
-
return
|
|
801
|
+
return d(0);
|
|
802
802
|
if (s.modelSplatCount >= 0)
|
|
803
|
-
|
|
803
|
+
d(s.modelSplatCount), setTimeout(() => t(Cs), 5);
|
|
804
804
|
else {
|
|
805
805
|
if (Date.now() - x >= 3e3)
|
|
806
|
-
return
|
|
806
|
+
return d(0);
|
|
807
807
|
setTimeout(w, 10);
|
|
808
808
|
}
|
|
809
809
|
};
|
|
810
810
|
if (w(), !g(s)) {
|
|
811
|
-
console.error("Unsupported format:",
|
|
811
|
+
console.error("Unsupported format:", M.format), t(Mt, 0);
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
814
|
t(Ms);
|
|
815
815
|
}
|
|
816
|
-
e(vs, async (
|
|
816
|
+
e(vs, async (M, S) => await y(M, S)), e(Ss, (M = 1e4) => Date.now() - a < M), e(bs, () => m()), t(
|
|
817
817
|
at,
|
|
818
818
|
async () => await f(),
|
|
819
819
|
() => !n
|
|
@@ -1185,28 +1185,28 @@ const Lo = `$${Q++}`, Fo = `$${Q++}`, Ro = `$${Q++}`, Bo = `$${Q++}`, Uo = `$${Q
|
|
|
1185
1185
|
Q++;
|
|
1186
1186
|
function Ho(i) {
|
|
1187
1187
|
let e = !1;
|
|
1188
|
-
const t = (
|
|
1188
|
+
const t = (d, h, f) => i.on(d, h, f), n = (d, ...h) => i.fire(d, ...h);
|
|
1189
1189
|
let a = 0, o = 0;
|
|
1190
1190
|
const s = [];
|
|
1191
1191
|
let r = 0;
|
|
1192
1192
|
t(Ws, () => r), t(li, async () => {
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1193
|
+
const d = new rn();
|
|
1194
|
+
d.setIndex([0, 1, 2, 0, 2, 3]);
|
|
1195
1195
|
const h = new Float32Array(4 * 3), f = new He(h, 3);
|
|
1196
|
-
|
|
1197
|
-
let p = new rn().copy(
|
|
1198
|
-
const
|
|
1196
|
+
d.setAttribute("position", f), f.setXYZ(0, -2, -2, 0), f.setXYZ(1, -2, 2, 0), f.setXYZ(2, 2, 2, 0), f.setXYZ(3, 2, -2, 0), f.needsUpdate = !0;
|
|
1197
|
+
let p = new rn().copy(d);
|
|
1198
|
+
const m = await n(ot);
|
|
1199
1199
|
if (e) return;
|
|
1200
|
-
const g = new Uint32Array(
|
|
1201
|
-
return
|
|
1202
|
-
n(fi, S), g.set(
|
|
1200
|
+
const g = new Uint32Array(m), y = new ca(g, 1, !1);
|
|
1201
|
+
return y.setUsage(la), y.needsUpdate = !0, p.setAttribute(bo, y), p.instanceCount = 0, t(hi, (M, S, v, k) => {
|
|
1202
|
+
n(fi, S), g.set(M, 0), y.clearUpdateRanges(), y.addUpdateRange(0, M.length), y.needsUpdate = !0, p.instanceCount = M.length, n(N), n(oe, { sortTime: `${v} / ${Date.now() - k}` });
|
|
1203
1203
|
}), t(ka, () => p), t(mi, () => {
|
|
1204
|
-
|
|
1204
|
+
y.array = null, p.dispose();
|
|
1205
1205
|
}), p;
|
|
1206
1206
|
}), t(di, async () => {
|
|
1207
|
-
const
|
|
1207
|
+
const d = await n(ot);
|
|
1208
1208
|
if (e) return;
|
|
1209
|
-
const h = 1024 * 2, f = Math.ceil(2 *
|
|
1209
|
+
const h = 1024 * 2, f = Math.ceil(2 * d / h), p = n(I), m = new _n({
|
|
1210
1210
|
uniforms: n(ci),
|
|
1211
1211
|
vertexShader: mo(),
|
|
1212
1212
|
fragmentShader: yo(),
|
|
@@ -1219,17 +1219,17 @@ function Ho(i) {
|
|
|
1219
1219
|
// 是否将深度值写入深度缓冲区
|
|
1220
1220
|
side: we
|
|
1221
1221
|
}), g = new Uint32Array(h * f * 4);
|
|
1222
|
-
let
|
|
1223
|
-
|
|
1224
|
-
const
|
|
1225
|
-
let v = new Ee(S, h,
|
|
1226
|
-
v.internalFormat = "RGBA32UI", v.needsUpdate = !0,
|
|
1222
|
+
let y = new Ee(g, h, f, _e, Ie);
|
|
1223
|
+
y.internalFormat = "RGBA32UI", y.needsUpdate = !0, m.uniforms[en].value = y;
|
|
1224
|
+
const M = n(ee) ? f : 1, S = new Uint32Array(h * M * 4);
|
|
1225
|
+
let v = new Ee(S, h, M, _e, Ie);
|
|
1226
|
+
v.internalFormat = "RGBA32UI", v.needsUpdate = !0, m.uniforms[tn].value = v;
|
|
1227
1227
|
const k = await n(Je, 1), b = new Uint32Array(h * k * 4);
|
|
1228
1228
|
let x = new Ee(b, h, k, _e, Ie);
|
|
1229
|
-
x.internalFormat = "RGBA32UI", x.needsUpdate = !0,
|
|
1229
|
+
x.internalFormat = "RGBA32UI", x.needsUpdate = !0, m.uniforms[qt].value = x;
|
|
1230
1230
|
const w = await n(Je, 3), D = new Uint32Array(h * w * 4);
|
|
1231
1231
|
let _ = new Ee(D, h, w, _e, Ie);
|
|
1232
|
-
_.internalFormat = "RGBA32UI", _.needsUpdate = !0,
|
|
1232
|
+
_.internalFormat = "RGBA32UI", _.needsUpdate = !0, m.uniforms[Jt].value = _, m.needsUpdate = !0;
|
|
1233
1233
|
let T = !1;
|
|
1234
1234
|
t(pi, (E) => {
|
|
1235
1235
|
if (!n(ee)) {
|
|
@@ -1240,67 +1240,67 @@ function Ho(i) {
|
|
|
1240
1240
|
E.txdata = null;
|
|
1241
1241
|
const U = new Ee(P, h, f, _e, Ie);
|
|
1242
1242
|
U.onUpdate = () => {
|
|
1243
|
-
E.textureReady = !0, E.textureReadyTime = Date.now(),
|
|
1244
|
-
}, U.internalFormat = "RGBA32UI", U.needsUpdate = !0, E.index ? (
|
|
1243
|
+
E.textureReady = !0, E.textureReadyTime = Date.now(), l(E), n(ks, E.renderSplatCount);
|
|
1244
|
+
}, U.internalFormat = "RGBA32UI", U.needsUpdate = !0, E.index ? (m.uniforms[tn].value = U, v = U) : (m.uniforms[en].value = U, y = U), m.needsUpdate = !0, n(N);
|
|
1245
1245
|
}), t(Qs, async (E) => {
|
|
1246
1246
|
if (n(ee) || !E || !E.length) return;
|
|
1247
1247
|
const P = new Uint32Array(h * await n(Je, 1) * 4), U = new Uint8Array(P.buffer);
|
|
1248
1248
|
for (let W = 0, se = 0; W < E.length; W++)
|
|
1249
1249
|
U.set(E[W], se), se += E[W].byteLength;
|
|
1250
1250
|
const O = new Ee(P, h, k, _e, Ie);
|
|
1251
|
-
O.internalFormat = "RGBA32UI", O.needsUpdate = !0,
|
|
1251
|
+
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, m.uniforms[qt].value = O, m.needsUpdate = !0, n(N);
|
|
1252
1252
|
}), t(Hs, async (E) => {
|
|
1253
1253
|
if (n(ee) || !E || !E.length) return;
|
|
1254
1254
|
const P = new Uint32Array(h * await n(Je, 3) * 4), U = new Uint8Array(P.buffer);
|
|
1255
1255
|
for (let W = 0, se = 0; W < E.length; W++)
|
|
1256
1256
|
U.set(E[W], se), se += E[W].byteLength;
|
|
1257
1257
|
const O = new Ee(P, h, k, _e, Ie);
|
|
1258
|
-
O.internalFormat = "RGBA32UI", O.needsUpdate = !0,
|
|
1259
|
-
}), t(ui, () =>
|
|
1258
|
+
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, m.uniforms[Jt].value = O, m.needsUpdate = !0, n(N);
|
|
1259
|
+
}), t(ui, () => m), t(Nt, () => {
|
|
1260
1260
|
const E = n(V), { width: P, height: U } = n(Ue), O = Math.abs(E.projectionMatrix.elements[0]) * 0.5 * P, W = Math.abs(E.projectionMatrix.elements[5]) * 0.5 * U, se = n(ui);
|
|
1261
1261
|
se.uniforms[zi].value.set(O, W), se.uniformsNeedUpdate = !0, n(N);
|
|
1262
1262
|
}), t(Xt, () => {
|
|
1263
1263
|
const { width: E, height: P } = n(Ue);
|
|
1264
|
-
|
|
1264
|
+
m.uniforms[ht].value.set(E, P), m.uniformsNeedUpdate = !0, n(N);
|
|
1265
1265
|
}), t(fi, (E) => {
|
|
1266
|
-
|
|
1266
|
+
m.uniforms[Ri].value = E, m.uniformsNeedUpdate = !0, n(N);
|
|
1267
1267
|
}), t(nt, (E) => {
|
|
1268
1268
|
const P = n(I);
|
|
1269
|
-
E === void 0 && (E = !P.pointcloudMode),
|
|
1269
|
+
E === void 0 && (E = !P.pointcloudMode), m.uniforms[Bi].value = E ? 1 : 0, m.uniformsNeedUpdate = !0, P.pointcloudMode = E, n(N), P.viewerEvents && (P.viewerEvents.fire(I).pointcloudMode = E);
|
|
1270
1270
|
}), t(gi, (E) => {
|
|
1271
|
-
|
|
1271
|
+
m.uniforms[Pi].value = E ? 1 : 0, m.uniformsNeedUpdate = !0;
|
|
1272
1272
|
const P = n(I);
|
|
1273
1273
|
P.bigSceneMode = E, n(N);
|
|
1274
1274
|
}), t(rt, (E) => {
|
|
1275
|
-
|
|
1275
|
+
m.uniforms[Li].value = E, m.uniformsNeedUpdate = !0;
|
|
1276
1276
|
const P = n(I);
|
|
1277
1277
|
P.lightFactor = E, n(N);
|
|
1278
1278
|
});
|
|
1279
1279
|
let F = !1;
|
|
1280
1280
|
return t(ms, (E) => {
|
|
1281
|
-
n(ee) || F || (F = !0,
|
|
1281
|
+
n(ee) || F || (F = !0, m.uniforms[Qi].value = E, m.uniformsNeedUpdate = !0, n(N));
|
|
1282
1282
|
}), t(gt, (E) => {
|
|
1283
|
-
|
|
1283
|
+
m.uniforms[Ei].value = E, m.uniformsNeedUpdate = !0, n(N);
|
|
1284
1284
|
}), t($t, (E) => {
|
|
1285
|
-
|
|
1285
|
+
m.uniforms[_i].value = E, m.uniformsNeedUpdate = !0, n(N);
|
|
1286
1286
|
}), t(Ct, (E, P, U, O) => {
|
|
1287
|
-
|
|
1287
|
+
m.uniforms[Ui].value = [E, P, U, O ? 1 : -1], m.uniformsNeedUpdate = !0, n(N);
|
|
1288
1288
|
}), t(hn, (E = !0) => {
|
|
1289
|
-
|
|
1289
|
+
m.uniforms[Di].value = E ? 1 : 0, m.uniformsNeedUpdate = !0, n(N);
|
|
1290
1290
|
}), t(ys, (E) => {
|
|
1291
|
-
|
|
1291
|
+
m.uniforms[Ii].value = E, m.uniformsNeedUpdate = !0;
|
|
1292
1292
|
}), t(Ea, (E) => {
|
|
1293
|
-
|
|
1293
|
+
m.uniforms[Fi].value = E, m.uniformsNeedUpdate = !0;
|
|
1294
1294
|
}), t(Rn, async (E) => {
|
|
1295
1295
|
if (n(ee)) return;
|
|
1296
1296
|
const P = await n(Nn);
|
|
1297
|
-
E < 0 && (E = 0), E > P && (E = P), r = E,
|
|
1297
|
+
E < 0 && (E = 0), E > P && (E = P), r = E, m.uniforms[Oi].value = E, m.uniformsNeedUpdate = !0, n(oe, { shDegree: `${E} / max ${P}` }), n(N);
|
|
1298
1298
|
}), t(yi, () => {
|
|
1299
|
-
|
|
1300
|
-
}),
|
|
1299
|
+
m.dispose(), y && y.dispose(), v && v.dispose(), x && x.dispose(), _ && _.dispose();
|
|
1300
|
+
}), m;
|
|
1301
1301
|
}), t(gs, async () => {
|
|
1302
|
-
const
|
|
1303
|
-
return n(Nt), n(Xt), n(gi, n(ee)), n(nt, n(pn)),
|
|
1302
|
+
const d = new te(await n(li), await n(di));
|
|
1303
|
+
return n(Nt), n(Xt), n(gi, n(ee)), n(nt, n(pn)), d;
|
|
1304
1304
|
});
|
|
1305
1305
|
function c() {
|
|
1306
1306
|
n(Nt), n(Xt);
|
|
@@ -1309,21 +1309,21 @@ function Ho(i) {
|
|
|
1309
1309
|
e = !0, window.removeEventListener("resize", c), n(mi), n(yi);
|
|
1310
1310
|
}), t(Cs, async () => {
|
|
1311
1311
|
if (n(ee)) return;
|
|
1312
|
-
let
|
|
1312
|
+
let d = 0.01, h = 0.01, f = !1, p = 0;
|
|
1313
1313
|
n(gt, h), n(
|
|
1314
1314
|
at,
|
|
1315
1315
|
() => {
|
|
1316
1316
|
if (e || o <= h) return;
|
|
1317
|
-
h += (o - h) *
|
|
1318
|
-
let
|
|
1319
|
-
|
|
1317
|
+
h += (o - h) * d, n(gt, h);
|
|
1318
|
+
let m = n(Es);
|
|
1319
|
+
m && !p && (p = Date.now());
|
|
1320
1320
|
let g = h / a;
|
|
1321
|
-
|
|
1321
|
+
m && (g > 0.9 || Date.now() - p > 2500) ? (n(pn) && n(fn, !0), n(gt, 0), f = !0) : m && g > 0.7 ? d = Math.min(d * 1.2, 0.3) : m && g > 0.5 ? d = Math.min(d * 1.2, 0.2) : g > 0.4 && (d = Math.min(d * 1.05, 0.1));
|
|
1322
1322
|
},
|
|
1323
1323
|
() => !e && !f,
|
|
1324
1324
|
3
|
|
1325
1325
|
);
|
|
1326
|
-
}), t(fn, (
|
|
1326
|
+
}), t(fn, (d = !1) => {
|
|
1327
1327
|
if (n(ee)) return;
|
|
1328
1328
|
for (; s.length; ) s.pop().stop = !0;
|
|
1329
1329
|
const h = n(I), f = a * 1e-3;
|
|
@@ -1331,7 +1331,7 @@ function Ho(i) {
|
|
|
1331
1331
|
s.push(p), n(
|
|
1332
1332
|
at,
|
|
1333
1333
|
() => {
|
|
1334
|
-
e || (p.currentLightRadius += a * p.stepRate, n($t, p.currentLightRadius), p.currentLightRadius > a ? (n(nt, !p.currentPointMode), n($t, 0), p.stop = !0, s.length === 1 && s[0] === p && s.pop(),
|
|
1334
|
+
e || (p.currentLightRadius += a * p.stepRate, n($t, p.currentLightRadius), p.currentLightRadius > a ? (n(nt, !p.currentPointMode), n($t, 0), p.stop = !0, s.length === 1 && s[0] === p && s.pop(), d && n(I)?.viewerEvents?.fire(dt), n(I)?.viewerEvents?.fire(Us)) : p.currentLightRadius / a < 0.4 ? p.stepRate = Math.min(p.stepRate * 1.02, 0.03) : p.stepRate *= 1.04);
|
|
1335
1335
|
},
|
|
1336
1336
|
() => !e && !p.stop
|
|
1337
1337
|
);
|
|
@@ -1357,30 +1357,30 @@ function Ho(i) {
|
|
|
1357
1357
|
[Di]: { type: "int", value: 1 }
|
|
1358
1358
|
}));
|
|
1359
1359
|
const u = n(cs);
|
|
1360
|
-
u.onmessage = (
|
|
1361
|
-
const h =
|
|
1360
|
+
u.onmessage = (d) => {
|
|
1361
|
+
const h = d.data;
|
|
1362
1362
|
h[Hi] && n(hi, h[Hi], h[Wi], h[ko], h[To], h[Yi]);
|
|
1363
|
-
}, t(zs, (
|
|
1364
|
-
n(ee) || (o = h, a = f), n(pi,
|
|
1363
|
+
}, t(zs, (d, h, f) => {
|
|
1364
|
+
n(ee) || (o = h, a = f), n(pi, d);
|
|
1365
1365
|
});
|
|
1366
|
-
function d
|
|
1367
|
-
const h =
|
|
1366
|
+
function l(d) {
|
|
1367
|
+
const h = d.xyz.slice(0);
|
|
1368
1368
|
u.postMessage(
|
|
1369
1369
|
{
|
|
1370
1370
|
[Eo]: !0,
|
|
1371
1371
|
[Po]: h,
|
|
1372
|
-
[Qo]:
|
|
1373
|
-
[Wi]:
|
|
1374
|
-
[xo]:
|
|
1375
|
-
[Yi]:
|
|
1376
|
-
[Co]:
|
|
1377
|
-
[Mo]:
|
|
1378
|
-
[Lo]:
|
|
1379
|
-
[Fo]:
|
|
1380
|
-
[Ro]:
|
|
1381
|
-
[Bo]:
|
|
1382
|
-
[Uo]:
|
|
1383
|
-
[Oo]:
|
|
1372
|
+
[Qo]: d.watermarkCount,
|
|
1373
|
+
[Wi]: d.index,
|
|
1374
|
+
[xo]: d.version,
|
|
1375
|
+
[Yi]: d.renderSplatCount,
|
|
1376
|
+
[Co]: d.visibleSplatCount,
|
|
1377
|
+
[Mo]: d.modelSplatCount,
|
|
1378
|
+
[Lo]: d.minX,
|
|
1379
|
+
[Fo]: d.maxX,
|
|
1380
|
+
[Ro]: d.minY,
|
|
1381
|
+
[Bo]: d.maxY,
|
|
1382
|
+
[Uo]: d.minZ,
|
|
1383
|
+
[Oo]: d.maxZ
|
|
1384
1384
|
},
|
|
1385
1385
|
[h.buffer]
|
|
1386
1386
|
);
|
|
@@ -1397,30 +1397,30 @@ function Wo(i) {
|
|
|
1397
1397
|
v.push([(k[b] % 20 - 10) * 0.02, ((k[b] / 20 | 0) - 10) * 0.02]);
|
|
1398
1398
|
u.push(v);
|
|
1399
1399
|
}
|
|
1400
|
-
let
|
|
1401
|
-
for (let S = 0; S <
|
|
1402
|
-
|
|
1403
|
-
let h =
|
|
1400
|
+
let l = [], d = r.split("");
|
|
1401
|
+
for (let S = 0; S < d.length; S++)
|
|
1402
|
+
l[S] = n.has(d[S]) ? 0.22 : 0.4;
|
|
1403
|
+
let h = d.length / 2 | 0, f = l[h] / 2, p = !(d.length % 2), m = p ? 0 : -f;
|
|
1404
1404
|
for (let S = h - 1; S >= 0; S--) {
|
|
1405
|
-
|
|
1406
|
-
for (let v of u[S]) v[0] +=
|
|
1407
|
-
|
|
1405
|
+
m -= l[S] / 2;
|
|
1406
|
+
for (let v of u[S]) v[0] += m;
|
|
1407
|
+
m -= l[S] / 2;
|
|
1408
1408
|
}
|
|
1409
|
-
f =
|
|
1409
|
+
f = l[h] / 2, m = p ? 0 : f;
|
|
1410
1410
|
for (let S = u.length - h; S < u.length; S++) {
|
|
1411
|
-
|
|
1412
|
-
for (let v of u[S]) v[0] +=
|
|
1413
|
-
|
|
1411
|
+
m += l[S] / 2;
|
|
1412
|
+
for (let v of u[S]) v[0] += m;
|
|
1413
|
+
m += l[S] / 2;
|
|
1414
1414
|
}
|
|
1415
1415
|
let g = 0;
|
|
1416
1416
|
for (let S of u)
|
|
1417
1417
|
g += S.length;
|
|
1418
|
-
const
|
|
1419
|
-
let
|
|
1418
|
+
const y = new Uint8Array(g * R);
|
|
1419
|
+
let M = 0;
|
|
1420
1420
|
for (let S of u)
|
|
1421
1421
|
for (let v of S)
|
|
1422
|
-
|
|
1423
|
-
return
|
|
1422
|
+
y.set(await ao(v[0], v[1], o, s), R * M++);
|
|
1423
|
+
return y;
|
|
1424
1424
|
});
|
|
1425
1425
|
}
|
|
1426
1426
|
function Jn(i) {
|
|
@@ -1463,10 +1463,10 @@ function Yo(i) {
|
|
|
1463
1463
|
},
|
|
1464
1464
|
!0
|
|
1465
1465
|
), t(Ye, (r) => {
|
|
1466
|
-
let c = [], u = Date.now(),
|
|
1467
|
-
for (const
|
|
1468
|
-
u -
|
|
1469
|
-
return c.forEach((
|
|
1466
|
+
let c = [], u = Date.now(), l = 0;
|
|
1467
|
+
for (const d of r.keys())
|
|
1468
|
+
u - d <= 1e3 ? l++ : c.push(d);
|
|
1469
|
+
return c.forEach((d) => r.delete(d)), Math.min(l, 30);
|
|
1470
1470
|
}), window.addEventListener("beforeunload", () => n(Ht));
|
|
1471
1471
|
}
|
|
1472
1472
|
function Vo(i) {
|
|
@@ -1487,7 +1487,7 @@ function No(i) {
|
|
|
1487
1487
|
let e = i.camera;
|
|
1488
1488
|
if (!e) {
|
|
1489
1489
|
const t = i.renderer.domElement, n = t.width / t.height;
|
|
1490
|
-
let a = new
|
|
1490
|
+
let a = new C().fromArray(i.lookUp), o = new C().fromArray(i.lookAt), s = new C().fromArray(i.position);
|
|
1491
1491
|
e = new ns(i.fov, n, i.near, i.far), e.position.copy(s), e.up.copy(a).normalize(), e.lookAt(o), i.camera = e;
|
|
1492
1492
|
}
|
|
1493
1493
|
return i.camera;
|
|
@@ -1508,7 +1508,7 @@ class pe extends te {
|
|
|
1508
1508
|
constructor(e) {
|
|
1509
1509
|
super(), this.isSplatMesh = !0, this.disposed = !1;
|
|
1510
1510
|
const t = new Xn(), n = (r, c, u) => t.on(r, c, u), a = (r, ...c) => t.fire(r, ...c), o = Vo(e), s = o.controls.object;
|
|
1511
|
-
n(I, () => o), n(Ke, () => o.renderer.domElement), n(V, () => s), n(ft, () => s.fov), n(Be, (r = !1) => r ? s.position.clone() : s.position), n(Ce, (r = !1) => r ? o.controls.target.clone() : o.controls.target), n(hs, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse).multiply(this.matrix).toArray()), n(Ca, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse)), n(Qa, () => s.getWorldDirection(new
|
|
1511
|
+
n(I, () => o), n(Ke, () => o.renderer.domElement), n(V, () => s), n(ft, () => s.fov), n(Be, (r = !1) => r ? s.position.clone() : s.position), n(Ce, (r = !1) => r ? o.controls.target.clone() : o.controls.target), n(hs, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse).multiply(this.matrix).toArray()), n(Ca, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse)), n(Qa, () => s.getWorldDirection(new C()).toArray()), n(ct, () => o.renderer), n(B, () => o.scene), n(ee, () => o.bigSceneMode), n(pn, () => o.pointcloudMode), n(ye, () => this), n(N, () => o.viewerEvents?.fire(J)), qn(t), Jn(t), go(t), $o(t), Ho(t), Wo(t), this.name = `${o.name || this.id}`, this.events = t, this.opts = o, (async () => (this.copy(await t.fire(gs)), o.matrix && this.applyMatrix4(o.matrix), this.frustumCulled = !1, this.onBeforeRender = () => {
|
|
1512
1512
|
a(ps), a(ys, performance.now());
|
|
1513
1513
|
}, this.onAfterRender = () => {
|
|
1514
1514
|
a(Ss, 1e4) && a(N);
|
|
@@ -1547,16 +1547,16 @@ class pe extends te {
|
|
|
1547
1547
|
}
|
|
1548
1548
|
}
|
|
1549
1549
|
class Ko extends In {
|
|
1550
|
-
constructor(e = new
|
|
1551
|
-
super(), this._axis = new
|
|
1550
|
+
constructor(e = new C(0, 0, 1), t = new C(0, 0, 0), n = 1, a = 0.1, o = 16776960, s = n * 0.2, r = s * 0.2) {
|
|
1551
|
+
super(), this._axis = new C(), this.type = "ArrowHelper";
|
|
1552
1552
|
const c = new ti(a, a, n, 32);
|
|
1553
1553
|
c.translate(0, n / 2, 0);
|
|
1554
1554
|
const u = new ti(0, r, s, 32);
|
|
1555
1555
|
u.translate(0, n, 0), this.position.copy(t);
|
|
1556
|
-
const d = new xe({ color: o, toneMapped: !1 });
|
|
1557
|
-
d.side = we, this.line = new te(c, d), this.line.matrixAutoUpdate = !1, this.line.ignoreIntersect = !0, this.add(this.line);
|
|
1558
1556
|
const l = new xe({ color: o, toneMapped: !1 });
|
|
1559
|
-
l.side = we, this.
|
|
1557
|
+
l.side = we, this.line = new te(c, l), this.line.matrixAutoUpdate = !1, this.line.ignoreIntersect = !0, this.add(this.line);
|
|
1558
|
+
const d = new xe({ color: o, toneMapped: !1 });
|
|
1559
|
+
d.side = we, this.cone = new te(u, d), this.cone.matrixAutoUpdate = !1, this.cone.ignoreIntersect = !0, this.add(this.cone), this.setDirection(e), this.renderOrder = 99999;
|
|
1560
1560
|
}
|
|
1561
1561
|
setDirection(e) {
|
|
1562
1562
|
if (e.y > 0.99999)
|
|
@@ -1580,25 +1580,25 @@ class Ko extends In {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
1582
|
function Zo(i) {
|
|
1583
|
-
const e = (
|
|
1583
|
+
const e = (m, g, y) => i.on(m, g, y), t = (m, ...g) => i.fire(m, ...g), n = new ua(1, 1);
|
|
1584
1584
|
n.rotateX(-Math.PI / 2);
|
|
1585
1585
|
const a = new xe({ color: 16777215 });
|
|
1586
1586
|
a.transparent = !0, a.opacity = 0.6, a.depthTest = !1, a.depthWrite = !1, a.side = we;
|
|
1587
1587
|
const o = new te(n, a);
|
|
1588
1588
|
o.ignoreIntersect = !0;
|
|
1589
|
-
const s = new
|
|
1589
|
+
const s = new C(0, -1, 0);
|
|
1590
1590
|
s.normalize();
|
|
1591
|
-
const r = new
|
|
1592
|
-
p.add(o), p.add(f), p.renderOrder = 99999, o.renderOrder = 99999, p.visible = !1, t(B).add(p), e(La, () => p), e(Tt, (
|
|
1593
|
-
t(Rt, !0), p.visible =
|
|
1594
|
-
}), e(On, () => p.visible), e(Rt, (
|
|
1595
|
-
if (
|
|
1596
|
-
const g = new _t(),
|
|
1597
|
-
g.setFromUnitVectors(
|
|
1591
|
+
const r = new C(0, 0, 0), c = 0.5, u = 0.01, l = 16777062, d = 0.1, h = 0.03, f = new Ko(s, r, c, u, l, d, h), p = new In();
|
|
1592
|
+
p.add(o), p.add(f), p.renderOrder = 99999, o.renderOrder = 99999, p.visible = !1, t(B).add(p), e(La, () => p), e(Tt, (m) => {
|
|
1593
|
+
t(Rt, !0), p.visible = m === void 0 ? !p.visible : m, t(J);
|
|
1594
|
+
}), e(On, () => p.visible), e(Rt, (m = !1) => {
|
|
1595
|
+
if (m || p.visible) {
|
|
1596
|
+
const g = new _t(), y = new C(0, -1, 0);
|
|
1597
|
+
g.setFromUnitVectors(y, t(Ne)), p.position.copy(t(Ce)), p.quaternion.copy(g);
|
|
1598
1598
|
}
|
|
1599
1599
|
});
|
|
1600
1600
|
}
|
|
1601
|
-
const Gi = { type: "change" }, ei = { type: "start" }, ea = { type: "end" }, At = new pa(), Ni = new fa(), jo = Math.cos(70 * be.DEG2RAD), G = new
|
|
1601
|
+
const Gi = { type: "change" }, ei = { type: "start" }, ea = { type: "end" }, At = new pa(), Ni = new fa(), jo = Math.cos(70 * be.DEG2RAD), G = new C(), ae = 2 * Math.PI, H = {
|
|
1602
1602
|
NONE: -1,
|
|
1603
1603
|
ROTATE: 0,
|
|
1604
1604
|
DOLLY: 1,
|
|
@@ -1610,7 +1610,7 @@ const Gi = { type: "change" }, ei = { type: "start" }, ea = { type: "end" }, At
|
|
|
1610
1610
|
}, nn = 1e-6;
|
|
1611
1611
|
class ta extends ha {
|
|
1612
1612
|
constructor(e, t = null) {
|
|
1613
|
-
super(e, t), this.state = H.NONE, this.enabled = !0, this.target = new
|
|
1613
|
+
super(e, t), this.state = H.NONE, this.enabled = !0, this.target = new C(), this.cursor = new C(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ae.ROTATE, MIDDLE: Ae.DOLLY, RIGHT: Ae.PAN }, this.touches = { ONE: Se.ROTATE, TWO: Se.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new C(), this._lastQuaternion = new _t(), this._lastTargetPosition = new C(), this._quat = new _t().setFromUnitVectors(e.up, new C(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ni(), this._sphericalDelta = new ni(), this._scale = 1, this._panOffset = new C(), this._rotateStart = new j(), this._rotateEnd = new j(), this._rotateDelta = new j(), this._panStart = new j(), this._panEnd = new j(), this._panDelta = new j(), this._dollyStart = new j(), this._dollyEnd = new j(), this._dollyDelta = new j(), this._dollyDirection = new C(), this._mouse = new j(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Jo.bind(this), this._onPointerDown = qo.bind(this), this._onPointerUp = er.bind(this), this._onContextMenu = rr.bind(this), this._onMouseWheel = ir.bind(this), this._onKeyDown = sr.bind(this), this._onTouchStart = ar.bind(this), this._onTouchMove = or.bind(this), this._onMouseDown = tr.bind(this), this._onMouseMove = nr.bind(this), this._interceptControlDown = cr.bind(this), this._interceptControlUp = lr.bind(this), this.domElement !== null && this.connect(), this.update();
|
|
1614
1614
|
}
|
|
1615
1615
|
connect() {
|
|
1616
1616
|
this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -1662,11 +1662,11 @@ class ta extends ha {
|
|
|
1662
1662
|
const c = r - s;
|
|
1663
1663
|
this.object.position.addScaledVector(this._dollyDirection, c), this.object.updateMatrixWorld(), o = !!c;
|
|
1664
1664
|
} else if (this.object.isOrthographicCamera) {
|
|
1665
|
-
const r = new
|
|
1665
|
+
const r = new C(this._mouse.x, this._mouse.y, 0);
|
|
1666
1666
|
r.unproject(this.object);
|
|
1667
1667
|
const c = this.object.zoom;
|
|
1668
1668
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), o = c !== this.object.zoom;
|
|
1669
|
-
const u = new
|
|
1669
|
+
const u = new C(this._mouse.x, this._mouse.y, 0);
|
|
1670
1670
|
u.unproject(this.object), this.object.position.sub(u).add(r), this.object.updateMatrixWorld(), s = G.length();
|
|
1671
1671
|
} else
|
|
1672
1672
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
@@ -2030,7 +2030,7 @@ class dr extends ta {
|
|
|
2030
2030
|
* 更新旋转轴
|
|
2031
2031
|
*/
|
|
2032
2032
|
updateRotateAxis() {
|
|
2033
|
-
this._quat?.setFromUnitVectors?.(this.object.up, new
|
|
2033
|
+
this._quat?.setFromUnitVectors?.(this.object.up, new C(0, 1, 0)), this._quatInverse = this._quat?.clone?.()?.invert?.();
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
2036
|
class ur extends ta {
|
|
@@ -2038,7 +2038,7 @@ class ur extends ta {
|
|
|
2038
2038
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Ae.PAN, MIDDLE: Ae.DOLLY, RIGHT: Ae.ROTATE }, this.touches = { ONE: Se.PAN, TWO: Se.DOLLY_ROTATE };
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
-
const Xi = new Dn(), wt = new
|
|
2041
|
+
const Xi = new Dn(), wt = new C();
|
|
2042
2042
|
class na extends rn {
|
|
2043
2043
|
constructor() {
|
|
2044
2044
|
super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry";
|
|
@@ -2570,7 +2570,7 @@ class Xe extends _n {
|
|
|
2570
2570
|
this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
|
|
2571
2571
|
}
|
|
2572
2572
|
}
|
|
2573
|
-
const sn = new ve(), $i = new
|
|
2573
|
+
const sn = new ve(), $i = new C(), Ki = new C(), $ = new ve(), K = new ve(), de = new ve(), an = new C(), on = new $e(), Z = new ma(), Zi = new C(), vt = new Dn(), St = new tt(), ue = new ve();
|
|
2574
2574
|
let ge, Fe;
|
|
2575
2575
|
function ji(i, e, t) {
|
|
2576
2576
|
return ue.set(0, 0, -e, 1).applyMatrix4(i.projectionMatrix), ue.multiplyScalar(1 / ue.w), ue.x = Fe / t.width, ue.y = Fe / t.height, ue.applyMatrix4(i.projectionMatrixInverse), ue.multiplyScalar(1 / ue.w), Math.abs(Math.max(ue.x, ue.y));
|
|
@@ -2579,11 +2579,11 @@ function hr(i, e) {
|
|
|
2579
2579
|
const t = i.matrixWorld, n = i.geometry, a = n.attributes.instanceStart, o = n.attributes.instanceEnd, s = Math.min(n.instanceCount, a.count);
|
|
2580
2580
|
for (let r = 0, c = s; r < c; r++) {
|
|
2581
2581
|
Z.start.fromBufferAttribute(a, r), Z.end.fromBufferAttribute(o, r), Z.applyMatrix4(t);
|
|
2582
|
-
const u = new
|
|
2583
|
-
ge.distanceSqToSegment(Z.start, Z.end,
|
|
2584
|
-
point:
|
|
2582
|
+
const u = new C(), l = new C();
|
|
2583
|
+
ge.distanceSqToSegment(Z.start, Z.end, l, u), l.distanceTo(u) < Fe * 0.5 && e.push({
|
|
2584
|
+
point: l,
|
|
2585
2585
|
pointOnLine: u,
|
|
2586
|
-
distance: ge.origin.distanceTo(
|
|
2586
|
+
distance: ge.origin.distanceTo(l),
|
|
2587
2587
|
object: i,
|
|
2588
2588
|
face: null,
|
|
2589
2589
|
faceIndex: r,
|
|
@@ -2593,25 +2593,25 @@ function hr(i, e) {
|
|
|
2593
2593
|
}
|
|
2594
2594
|
}
|
|
2595
2595
|
function pr(i, e, t) {
|
|
2596
|
-
const n = e.projectionMatrix, o = i.material.resolution, s = i.matrixWorld, r = i.geometry, c = r.attributes.instanceStart, u = r.attributes.instanceEnd,
|
|
2596
|
+
const n = e.projectionMatrix, o = i.material.resolution, s = i.matrixWorld, r = i.geometry, c = r.attributes.instanceStart, u = r.attributes.instanceEnd, l = Math.min(r.instanceCount, c.count), d = -e.near;
|
|
2597
2597
|
ge.at(1, de), de.w = 1, de.applyMatrix4(e.matrixWorldInverse), de.applyMatrix4(n), de.multiplyScalar(1 / de.w), de.x *= o.x / 2, de.y *= o.y / 2, de.z = 0, an.copy(de), on.multiplyMatrices(e.matrixWorldInverse, s);
|
|
2598
|
-
for (let h = 0, f =
|
|
2599
|
-
if ($.fromBufferAttribute(c, h), K.fromBufferAttribute(u, h), $.w = 1, K.w = 1, $.applyMatrix4(on), K.applyMatrix4(on), $.z >
|
|
2598
|
+
for (let h = 0, f = l; h < f; h++) {
|
|
2599
|
+
if ($.fromBufferAttribute(c, h), K.fromBufferAttribute(u, h), $.w = 1, K.w = 1, $.applyMatrix4(on), K.applyMatrix4(on), $.z > d && K.z > d)
|
|
2600
2600
|
continue;
|
|
2601
|
-
if ($.z >
|
|
2602
|
-
const S = $.z - K.z, v = ($.z -
|
|
2601
|
+
if ($.z > d) {
|
|
2602
|
+
const S = $.z - K.z, v = ($.z - d) / S;
|
|
2603
2603
|
$.lerp(K, v);
|
|
2604
|
-
} else if (K.z >
|
|
2605
|
-
const S = K.z - $.z, v = (K.z -
|
|
2604
|
+
} else if (K.z > d) {
|
|
2605
|
+
const S = K.z - $.z, v = (K.z - d) / S;
|
|
2606
2606
|
K.lerp($, v);
|
|
2607
2607
|
}
|
|
2608
2608
|
$.applyMatrix4(n), K.applyMatrix4(n), $.multiplyScalar(1 / $.w), K.multiplyScalar(1 / K.w), $.x *= o.x / 2, $.y *= o.y / 2, K.x *= o.x / 2, K.y *= o.y / 2, Z.start.copy($), Z.start.z = 0, Z.end.copy(K), Z.end.z = 0;
|
|
2609
|
-
const
|
|
2610
|
-
Z.at(
|
|
2611
|
-
const g = be.lerp($.z, K.z,
|
|
2612
|
-
if (
|
|
2609
|
+
const m = Z.closestPointToPointParameter(an, !0);
|
|
2610
|
+
Z.at(m, Zi);
|
|
2611
|
+
const g = be.lerp($.z, K.z, m), y = g >= -1 && g <= 1, M = an.distanceTo(Zi) < Fe * 0.5;
|
|
2612
|
+
if (y && M) {
|
|
2613
2613
|
Z.start.fromBufferAttribute(c, h), Z.end.fromBufferAttribute(u, h), Z.start.applyMatrix4(s), Z.end.applyMatrix4(s);
|
|
2614
|
-
const S = new
|
|
2614
|
+
const S = new C(), v = new C();
|
|
2615
2615
|
ge.distanceSqToSegment(Z.start, Z.end, v, S), t.push({
|
|
2616
2616
|
point: v,
|
|
2617
2617
|
pointOnLine: S,
|
|
@@ -2648,20 +2648,20 @@ class fr extends te {
|
|
|
2648
2648
|
if (n)
|
|
2649
2649
|
u = Fe * 0.5;
|
|
2650
2650
|
else {
|
|
2651
|
-
const
|
|
2652
|
-
u = ji(a,
|
|
2651
|
+
const d = Math.max(a.near, St.distanceToPoint(ge.origin));
|
|
2652
|
+
u = ji(a, d, c.resolution);
|
|
2653
2653
|
}
|
|
2654
2654
|
if (St.radius += u, ge.intersectsSphere(St) === !1)
|
|
2655
2655
|
return;
|
|
2656
2656
|
r.boundingBox === null && r.computeBoundingBox(), vt.copy(r.boundingBox).applyMatrix4(s);
|
|
2657
|
-
let
|
|
2657
|
+
let l;
|
|
2658
2658
|
if (n)
|
|
2659
|
-
|
|
2659
|
+
l = Fe * 0.5;
|
|
2660
2660
|
else {
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2661
|
+
const d = Math.max(a.near, vt.distanceToPoint(ge.origin));
|
|
2662
|
+
l = ji(a, d, c.resolution);
|
|
2663
2663
|
}
|
|
2664
|
-
vt.expandByScalar(
|
|
2664
|
+
vt.expandByScalar(l), ge.intersectsBox(vt) !== !1 && (n ? hr(this, t) : pr(this, a, t));
|
|
2665
2665
|
}
|
|
2666
2666
|
onBeforeRender(e) {
|
|
2667
2667
|
const t = this.material.uniforms;
|
|
@@ -2700,7 +2700,7 @@ class Re extends fr {
|
|
|
2700
2700
|
super(e, t), this.isLine2 = !0, this.type = "Line2";
|
|
2701
2701
|
}
|
|
2702
2702
|
}
|
|
2703
|
-
const qi = new
|
|
2703
|
+
const qi = new C(), gr = new _t(), Ji = new C();
|
|
2704
2704
|
class mr extends In {
|
|
2705
2705
|
constructor(e = document.createElement("div")) {
|
|
2706
2706
|
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() {
|
|
@@ -2733,60 +2733,60 @@ class Ar {
|
|
|
2733
2733
|
c.style.overflow = "hidden", this.domElement = c;
|
|
2734
2734
|
const u = document.createElement("div");
|
|
2735
2735
|
u.style.transformOrigin = "0 0", u.style.pointerEvents = "none", c.appendChild(u);
|
|
2736
|
-
const
|
|
2737
|
-
|
|
2736
|
+
const l = document.createElement("div");
|
|
2737
|
+
l.style.transformStyle = "preserve-3d", u.appendChild(l), this.getSize = function() {
|
|
2738
2738
|
return {
|
|
2739
2739
|
width: n,
|
|
2740
2740
|
height: a
|
|
2741
2741
|
};
|
|
2742
|
-
}, this.render = function(g,
|
|
2743
|
-
const
|
|
2744
|
-
|
|
2742
|
+
}, this.render = function(g, y) {
|
|
2743
|
+
const M = y.projectionMatrix.elements[5] * s;
|
|
2744
|
+
y.view && y.view.enabled ? (u.style.transform = `translate( ${-y.view.offsetX * (n / y.view.width)}px, ${-y.view.offsetY * (a / y.view.height)}px )`, u.style.transform += `scale( ${y.view.fullWidth / y.view.width}, ${y.view.fullHeight / y.view.height} )`) : u.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), y.parent === null && y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld();
|
|
2745
2745
|
let S, v;
|
|
2746
|
-
|
|
2747
|
-
const k =
|
|
2748
|
-
r.camera.style !== w && (
|
|
2749
|
-
}, this.setSize = function(g,
|
|
2750
|
-
n = g, a =
|
|
2746
|
+
y.isOrthographicCamera && (S = -(y.right + y.left) / 2, v = (y.top + y.bottom) / 2);
|
|
2747
|
+
const k = y.view && y.view.enabled ? y.view.height / y.view.fullHeight : 1, b = y.isOrthographicCamera ? `scale( ${k} )scale(` + M + ")translate(" + d(S) + "px," + d(v) + "px)" + h(y.matrixWorldInverse) : `scale( ${k} )translateZ(` + M + "px)" + h(y.matrixWorldInverse), w = (y.isPerspectiveCamera ? "perspective(" + M + "px) " : "") + b + "translate(" + o + "px," + s + "px)";
|
|
2748
|
+
r.camera.style !== w && (l.style.transform = w, r.camera.style = w), m(g, g, y);
|
|
2749
|
+
}, this.setSize = function(g, y) {
|
|
2750
|
+
n = g, a = y, o = n / 2, s = a / 2, c.style.width = g + "px", c.style.height = y + "px", u.style.width = g + "px", u.style.height = y + "px", l.style.width = g + "px", l.style.height = y + "px";
|
|
2751
2751
|
};
|
|
2752
|
-
function
|
|
2752
|
+
function d(g) {
|
|
2753
2753
|
return Math.abs(g) < 1e-10 ? 0 : g;
|
|
2754
2754
|
}
|
|
2755
2755
|
function h(g) {
|
|
2756
|
-
const
|
|
2757
|
-
return "matrix3d(" +
|
|
2756
|
+
const y = g.elements;
|
|
2757
|
+
return "matrix3d(" + d(y[0]) + "," + d(-y[1]) + "," + d(y[2]) + "," + d(y[3]) + "," + d(y[4]) + "," + d(-y[5]) + "," + d(y[6]) + "," + d(y[7]) + "," + d(y[8]) + "," + d(-y[9]) + "," + d(y[10]) + "," + d(y[11]) + "," + d(y[12]) + "," + d(-y[13]) + "," + d(y[14]) + "," + d(y[15]) + ")";
|
|
2758
2758
|
}
|
|
2759
2759
|
function f(g) {
|
|
2760
|
-
const
|
|
2761
|
-
return "translate(-50%,-50%)" + ("matrix3d(" +
|
|
2760
|
+
const y = g.elements;
|
|
2761
|
+
return "translate(-50%,-50%)" + ("matrix3d(" + d(y[0]) + "," + d(y[1]) + "," + d(y[2]) + "," + d(y[3]) + "," + d(-y[4]) + "," + d(-y[5]) + "," + d(-y[6]) + "," + d(-y[7]) + "," + d(y[8]) + "," + d(y[9]) + "," + d(y[10]) + "," + d(y[11]) + "," + d(y[12]) + "," + d(y[13]) + "," + d(y[14]) + "," + d(y[15]) + ")");
|
|
2762
2762
|
}
|
|
2763
2763
|
function p(g) {
|
|
2764
2764
|
g.isCSS3DObject && (g.element.style.display = "none");
|
|
2765
|
-
for (let
|
|
2766
|
-
p(g.children[
|
|
2765
|
+
for (let y = 0, M = g.children.length; y < M; y++)
|
|
2766
|
+
p(g.children[y]);
|
|
2767
2767
|
}
|
|
2768
|
-
function
|
|
2768
|
+
function m(g, y, M, S) {
|
|
2769
2769
|
if (g.visible === !1) {
|
|
2770
2770
|
p(g);
|
|
2771
2771
|
return;
|
|
2772
2772
|
}
|
|
2773
2773
|
if (g.isCSS3DObject) {
|
|
2774
|
-
const v = g.layers.test(
|
|
2774
|
+
const v = g.layers.test(M.layers) === !0, k = g.element;
|
|
2775
2775
|
if (k.style.display = v === !0 ? "" : "none", v === !0) {
|
|
2776
|
-
g.onBeforeRender(t,
|
|
2776
|
+
g.onBeforeRender(t, y, M);
|
|
2777
2777
|
let b;
|
|
2778
|
-
g.isCSS3DSprite ? (he.copy(
|
|
2778
|
+
g.isCSS3DSprite ? (he.copy(M.matrixWorldInverse), he.transpose(), g.rotation2D !== 0 && he.multiply(yr.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(qi, gr, Ji), he.setPosition(qi), he.scale(Ji), he.elements[3] = 0, he.elements[7] = 0, he.elements[11] = 0, he.elements[15] = 1, b = f(he)) : b = f(g.matrixWorld);
|
|
2779
2779
|
const x = r.objects.get(g);
|
|
2780
2780
|
if (x === void 0 || x.style !== b) {
|
|
2781
2781
|
k.style.transform = b;
|
|
2782
2782
|
const w = { style: b };
|
|
2783
2783
|
r.objects.set(g, w);
|
|
2784
2784
|
}
|
|
2785
|
-
k.parentNode !==
|
|
2785
|
+
k.parentNode !== l && l.appendChild(k), g.onAfterRender(t, y, M);
|
|
2786
2786
|
}
|
|
2787
2787
|
}
|
|
2788
2788
|
for (let v = 0, k = g.children.length; v < k; v++)
|
|
2789
|
-
|
|
2789
|
+
m(g.children[v], y, M);
|
|
2790
2790
|
}
|
|
2791
2791
|
}
|
|
2792
2792
|
}
|
|
@@ -2821,10 +2821,10 @@ class Cn extends Re {
|
|
|
2821
2821
|
r.resolution.set(innerWidth, innerHeight), n.copy(new Re(s, r));
|
|
2822
2822
|
const c = new De(0.05, 32), u = new xe({ color: 16777215, side: we });
|
|
2823
2823
|
u.transparent = !0, u.opacity = 0.6;
|
|
2824
|
-
const d = new te(c, u);
|
|
2825
|
-
d.position.copy(e), d.isMark = !0;
|
|
2826
2824
|
const l = new te(c, u);
|
|
2827
2825
|
l.position.copy(e), l.isMark = !0;
|
|
2826
|
+
const d = new te(c, u);
|
|
2827
|
+
d.position.copy(e), d.isMark = !0;
|
|
2828
2828
|
const h = document.createElement("div");
|
|
2829
2829
|
h.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
2830
2830
|
<span class="${o.name}-main-tag" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
@@ -2837,8 +2837,8 @@ class Cn extends Re {
|
|
|
2837
2837
|
f.position.copy(e), f.element.style.pointerEvents = "none", f.scale.set(0.01, 0.01, 0.01), f.visible = o.mainTagVisible;
|
|
2838
2838
|
const p = document.createElement("div");
|
|
2839
2839
|
p.innerHTML = `<span class="${t}-distance-tag ${t}-distance-tag0" style="color:${o.distanceTagColor};background:${o.distanceTagBackground};opacity:${o.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`, p.classList.add("mark-wrap-line", `${t}`, "distance-warp"), p.style.position = "absolute", p.style.borderRadius = "4px", p.style.pointerEvents = "none";
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2840
|
+
const m = new ie(p);
|
|
2841
|
+
m.position.set(e.x, e.y, e.z), m.element.style.pointerEvents = "none", m.scale.set(8e-3, 8e-3, 8e-3), m.visible = !1, n.add(l, d, f, m), n.data = o, n.circleStart = l, n.circleEnd = d, n.css3dTag = m, n.css3dMainTag = f, n.events.fire(Me, n);
|
|
2842
2842
|
}
|
|
2843
2843
|
/**
|
|
2844
2844
|
* 绘制更新
|
|
@@ -2848,9 +2848,9 @@ class Cn extends Re {
|
|
|
2848
2848
|
const n = this;
|
|
2849
2849
|
if (e?.endPoint) {
|
|
2850
2850
|
t && (n.data.endPoint = [...e.endPoint]);
|
|
2851
|
-
const a = new
|
|
2851
|
+
const a = new C().fromArray(n.data.startPoint), o = new C().fromArray(e.endPoint);
|
|
2852
2852
|
n.geometry.setPositions([...n.data.startPoint, ...e.endPoint]);
|
|
2853
|
-
const s = new
|
|
2853
|
+
const s = new C((a.x + o.x) / 2, (a.y + o.y) / 2, (a.z + o.z) / 2);
|
|
2854
2854
|
n.css3dTag.position.set(s.x, s.y, s.z);
|
|
2855
2855
|
const r = o.clone().sub(a).normalize();
|
|
2856
2856
|
n.circleStart.lookAt(n.circleStart.position.clone().add(r)), n.circleEnd.lookAt(n.circleEnd.position.clone().add(r));
|
|
@@ -2865,7 +2865,7 @@ class Cn extends Re {
|
|
|
2865
2865
|
* 按米标比例尺重新计算更新渲染
|
|
2866
2866
|
*/
|
|
2867
2867
|
updateByMeterScale(e) {
|
|
2868
|
-
const t = this, n = new
|
|
2868
|
+
const t = this, n = new C().fromArray(t.data.startPoint), a = new C().fromArray(t.data.endPoint), o = (n.distanceTo(a) * e).toFixed(2) + " m";
|
|
2869
2869
|
t.css3dTag.element.childNodes[0].innerText = o;
|
|
2870
2870
|
}
|
|
2871
2871
|
/**
|
|
@@ -2875,7 +2875,7 @@ class Cn extends Re {
|
|
|
2875
2875
|
if (this.disposed) return;
|
|
2876
2876
|
const t = this;
|
|
2877
2877
|
t.data.endPoint = [...e.toArray()];
|
|
2878
|
-
const n = new
|
|
2878
|
+
const n = new C().fromArray(t.data.startPoint), a = new C().fromArray(t.data.endPoint), o = new C((n.x + a.x) / 2, (n.y + a.y) / 2, (n.z + a.z) / 2);
|
|
2879
2879
|
t.geometry.setPositions([...t.data.startPoint, ...t.data.endPoint]), t.css3dTag.position.set(o.x, o.y, o.z);
|
|
2880
2880
|
const s = a.clone().sub(n).normalize();
|
|
2881
2881
|
t.circleStart.lookAt(t.circleStart.position.clone().add(s)), t.circleEnd.lookAt(t.circleEnd.position.clone().add(s)), t.circleEnd.position.copy(a);
|
|
@@ -2883,8 +2883,8 @@ class Cn extends Re {
|
|
|
2883
2883
|
t.css3dTag.visible = !0;
|
|
2884
2884
|
const c = (r * t.events.fire(I).meterScale).toFixed(2) + " m";
|
|
2885
2885
|
t.css3dTag.element.childNodes[0].innerText = c, t.events.fire(Te);
|
|
2886
|
-
const u = parent?.onActiveMark,
|
|
2887
|
-
|
|
2886
|
+
const u = parent?.onActiveMark, l = t.getMarkData(!0);
|
|
2887
|
+
l.isNew = !0, l.meterScale = t.events.fire(I).meterScale, u?.(l);
|
|
2888
2888
|
}
|
|
2889
2889
|
/**
|
|
2890
2890
|
* 根据数据直接绘制
|
|
@@ -2907,32 +2907,32 @@ class Cn extends Re {
|
|
|
2907
2907
|
distanceTagOpacity: e.distanceTagOpacity || 0.9,
|
|
2908
2908
|
distanceTagVisible: e.distanceTagVisible === void 0 ? !0 : e.distanceTagVisible,
|
|
2909
2909
|
title: e.title || "标记距离"
|
|
2910
|
-
}, a = new
|
|
2910
|
+
}, a = new C().fromArray(n.startPoint), o = new C().fromArray(n.endPoint), s = new C((a.x + o.x) / 2, (a.y + o.y) / 2, (a.z + o.z) / 2), r = new pt();
|
|
2911
2911
|
r.setPositions([...n.startPoint, ...n.endPoint]);
|
|
2912
2912
|
const c = new Xe({ color: n.lineColor, linewidth: n.lineWidth });
|
|
2913
2913
|
c.resolution.set(innerWidth, innerHeight), t.copy(new Re(r, c));
|
|
2914
|
-
const u = new De(0.05, 32),
|
|
2915
|
-
|
|
2916
|
-
const
|
|
2917
|
-
|
|
2918
|
-
const h = new te(u,
|
|
2914
|
+
const u = new De(0.05, 32), l = new xe({ color: 16777215, side: we });
|
|
2915
|
+
l.transparent = !0, l.opacity = 0.6;
|
|
2916
|
+
const d = new te(u, l);
|
|
2917
|
+
d.position.copy(a), d.isMark = !0;
|
|
2918
|
+
const h = new te(u, l);
|
|
2919
2919
|
h.position.copy(o), h.isMark = !0;
|
|
2920
2920
|
const f = o.clone().sub(a).normalize();
|
|
2921
|
-
|
|
2922
|
-
const p = n.name,
|
|
2923
|
-
|
|
2921
|
+
d.lookAt(d.position.clone().add(f)), h.lookAt(h.position.clone().add(f));
|
|
2922
|
+
const p = n.name, m = document.createElement("div");
|
|
2923
|
+
m.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
2924
2924
|
<span class="${p}-main-tag" style="color:${n.mainTagColor};background:${n.mainTagBackground};opacity:${n.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${n.title}</span>
|
|
2925
|
-
</div>`,
|
|
2925
|
+
</div>`, m.classList.add("mark-wrap-line", `${n.name}`, "main-warp"), m.style.position = "absolute", m.style.borderRadius = "4px", m.style.cursor = "pointer", m.onclick = () => {
|
|
2926
2926
|
if (t.events.fire(I).markMode) return;
|
|
2927
2927
|
const k = parent?.onActiveMark;
|
|
2928
2928
|
k?.(t.getMarkData(!0)), t.events.fire(q);
|
|
2929
|
-
},
|
|
2930
|
-
const g = new ie(
|
|
2929
|
+
}, m.oncontextmenu = (k) => k.preventDefault();
|
|
2930
|
+
const g = new ie(m);
|
|
2931
2931
|
g.position.copy(a), g.element.style.pointerEvents = "none", g.scale.set(0.01, 0.01, 0.01), g.visible = n.mainTagVisible;
|
|
2932
|
-
const
|
|
2933
|
-
S.innerHTML = `<span class="${p}-distance-tag ${p}-distance-tag0" style="color:${n.distanceTagColor};background:${n.distanceTagBackground};opacity:${n.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${
|
|
2932
|
+
const M = (a.distanceTo(o) * t.events.fire(I).meterScale).toFixed(2) + " m", S = document.createElement("div");
|
|
2933
|
+
S.innerHTML = `<span class="${p}-distance-tag ${p}-distance-tag0" style="color:${n.distanceTagColor};background:${n.distanceTagBackground};opacity:${n.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${M}</span>`, S.classList.add("mark-wrap-line", `${p}`, "distance-warp"), S.style.position = "absolute", S.style.borderRadius = "4px", S.style.pointerEvents = "none";
|
|
2934
2934
|
const v = new ie(S);
|
|
2935
|
-
v.position.copy(s), v.element.style.pointerEvents = "none", v.scale.set(8e-3, 8e-3, 8e-3), v.visible = n.distanceTagVisible, t.add(
|
|
2935
|
+
v.position.copy(s), v.element.style.pointerEvents = "none", v.scale.set(8e-3, 8e-3, 8e-3), v.visible = n.distanceTagVisible, t.add(d, h, g, v), t.data = n, t.circleStart = d, t.circleEnd = h, t.css3dTag = v, t.css3dMainTag = g, t.events.fire(Me, t);
|
|
2936
2936
|
}
|
|
2937
2937
|
getMarkData(e = !1) {
|
|
2938
2938
|
const t = { ...this.data };
|
|
@@ -2980,13 +2980,13 @@ class Mn extends Re {
|
|
|
2980
2980
|
const o = this;
|
|
2981
2981
|
if (n)
|
|
2982
2982
|
if (a) {
|
|
2983
|
-
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new
|
|
2984
|
-
o.css3dTags[r].element.childNodes[0].innerText = h, o.css3dTags[r].position.set(
|
|
2983
|
+
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n, l = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), h = (c.distanceTo(u) * o.events.fire(I).meterScale).toFixed(2) + " m";
|
|
2984
|
+
o.css3dTags[r].element.childNodes[0].innerText = h, o.css3dTags[r].position.set(l.x, l.y, l.z), o.css3dTags[r].visible = !0, o.data.points.pop(), o.data.points.pop(), o.data.points.pop(), o.data.points = [...o.data.points, ...n.toArray(), ...n.toArray()], o.css3dTags[o.css3dTags.length - 1].visible = !0, this.draw(this.data);
|
|
2985
2985
|
} else {
|
|
2986
2986
|
const s = o.data.points.length;
|
|
2987
2987
|
o.data.points[s - 3] = n.x, o.data.points[s - 2] = n.y, o.data.points[s - 1] = n.z;
|
|
2988
|
-
const r = o.css3dTags.length - 1, c = new
|
|
2989
|
-
o.css3dTags[r].element.childNodes[0].innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(
|
|
2988
|
+
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)), l = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), d = c.distanceTo(u), h = (d * o.events.fire(I).meterScale).toFixed(2) + " m";
|
|
2989
|
+
o.css3dTags[r].element.childNodes[0].innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(l.x, l.y, l.z), o.css3dTags[r].visible = a ? !0 : d > 0.5;
|
|
2990
2990
|
}
|
|
2991
2991
|
e?.lineColor && (t && (o.data.lineColor = e.lineColor), o.material.color.set(e.lineColor)), e?.lineWidth && (t && (o.data.lineWidth = e.lineWidth), o.material.linewidth = e.lineWidth), e?.mainTagColor && (t && (o.data.mainTagColor = e.mainTagColor), document.querySelector(`.${o.data.name}-main-tag`).style.color = e.mainTagColor), e?.mainTagBackground && (t && (o.data.mainTagBackground = e.mainTagBackground), document.querySelector(`.${o.data.name}-main-tag`).style.background = e.mainTagBackground), e?.mainTagOpacity && (t && (o.data.mainTagOpacity = e.mainTagOpacity), document.querySelector(`.${o.data.name}-main-tag`).style.opacity = e.mainTagOpacity.toString()), e?.mainTagVisible !== void 0 && (t && (o.data.mainTagVisible = e.mainTagVisible), o.css3dMainTag.visible = e.mainTagVisible), e?.distanceTagColor && (t && (o.data.distanceTagColor = e.distanceTagColor), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.color = e.distanceTagColor)), e?.distanceTagBackground && (t && (o.data.distanceTagBackground = e.distanceTagBackground), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.background = e.distanceTagBackground)), e?.distanceTagOpacity && (t && (o.data.distanceTagOpacity = e.distanceTagOpacity), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.opacity = e.distanceTagOpacity.toString())), e?.distanceTagVisible !== void 0 && (t && (o.data.distanceTagVisible = e.distanceTagVisible), o.css3dTags.forEach((s) => s.visible = e.distanceTagVisible)), e?.title !== void 0 && (t && (o.data.title = e.title), this.css3dMainTag.element.querySelector(`.${o.data.name}-main-tag`).innerText = e.title), e?.note !== void 0 && t && (o.data.note = e.note), o.events.fire(J);
|
|
2992
2992
|
}
|
|
@@ -2996,7 +2996,7 @@ class Mn extends Re {
|
|
|
2996
2996
|
updateByMeterScale(e) {
|
|
2997
2997
|
const t = this, n = [];
|
|
2998
2998
|
for (let s = 0, r = t.data.points.length / 3; s < r; s++)
|
|
2999
|
-
n.push(new
|
|
2999
|
+
n.push(new C(t.data.points[s * 3], t.data.points[s * 3 + 1], t.data.points[s * 3 + 2]));
|
|
3000
3000
|
let a, o;
|
|
3001
3001
|
for (let s = 1; s < n.length; s++)
|
|
3002
3002
|
a = n[s - 1], o = n[s], t.css3dTags[s - 1].element.childNodes[0].innerText = (a.distanceTo(o) * e).toFixed(2) + " m";
|
|
@@ -3006,7 +3006,7 @@ class Mn extends Re {
|
|
|
3006
3006
|
*/
|
|
3007
3007
|
drawFinish(e) {
|
|
3008
3008
|
if (this.disposed) return;
|
|
3009
|
-
const t = this, n = t.data.points.length, a = new
|
|
3009
|
+
const t = this, n = t.data.points.length, a = new C().fromArray(t.data.points.slice(n - 6, n - 3)), o = new C().fromArray(t.data.points.slice(n - 3));
|
|
3010
3010
|
if ((!e || a.distanceTo(o) < 1e-3) && (t.data.points.pop(), t.data.points.pop(), t.data.points.pop(), t.draw(t.data)), t.events.fire(Te), t.data.points.length < 6) {
|
|
3011
3011
|
t.dispose();
|
|
3012
3012
|
return;
|
|
@@ -3047,24 +3047,24 @@ class Mn extends Re {
|
|
|
3047
3047
|
r.setPositions([...a.points]);
|
|
3048
3048
|
const c = new Xe({ color: a.lineColor, linewidth: a.lineWidth });
|
|
3049
3049
|
c.resolution.set(innerWidth, innerHeight), n.copy(new Re(r, c)), o?.dispose(), s?.dispose();
|
|
3050
|
-
const u = a.name,
|
|
3050
|
+
const u = a.name, l = a.points.length / 3 - 1;
|
|
3051
3051
|
if (!n.css3dMainTag) {
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3052
|
+
const d = document.createElement("div");
|
|
3053
|
+
d.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3054
3054
|
<span class="${u}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
|
|
3055
|
-
</div>`,
|
|
3055
|
+
</div>`, d.classList.add("mark-wrap-lines", `${a.name}`, "main-warp"), d.style.position = "absolute", d.style.borderRadius = "4px", d.style.cursor = "pointer", d.onclick = () => {
|
|
3056
3056
|
if (n.events.fire(I).markMode) return;
|
|
3057
3057
|
const f = parent?.onActiveMark, p = n.getMarkData(!0);
|
|
3058
3058
|
p.meterScale = n.events.fire(I).meterScale, f?.(p), n.events.fire(q);
|
|
3059
|
-
},
|
|
3060
|
-
const h = new ie(
|
|
3059
|
+
}, d.oncontextmenu = (f) => f.preventDefault();
|
|
3060
|
+
const h = new ie(d);
|
|
3061
3061
|
h.position.set(a.points[0], a.points[1], a.points[2]), h.element.style.pointerEvents = "none", h.scale.set(0.01, 0.01, 0.01), h.visible = a.mainTagVisible, n.group.add(h), n.css3dMainTag = h;
|
|
3062
3062
|
}
|
|
3063
|
-
for (let
|
|
3064
|
-
const h = new
|
|
3065
|
-
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3063
|
+
for (let d = n.css3dTags.length; d < l; d++) {
|
|
3064
|
+
const h = new C().fromArray(a.points.slice(d * 3, d * 3 + 3)), f = new C().fromArray(a.points.slice(d * 3 + 3, d * 3 + 6)), p = new C((h.x + f.x) / 2, (h.y + f.y) / 2, (h.z + f.z) / 2), g = (h.distanceTo(f) * n.events.fire(I).meterScale).toFixed(2) + " m", y = document.createElement("div");
|
|
3065
|
+
y.innerHTML = `<span class="${u}-distance-tag ${u}-distance-tag${d}" style="color:${a.distanceTagColor};background:${a.distanceTagBackground};opacity:${a.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${g}</span>`, y.classList.add("mark-wrap-lines", `${u}`, "distance-warp"), y.style.position = "absolute", y.style.borderRadius = "4px", y.style.display = "none";
|
|
3066
|
+
const M = new ie(y);
|
|
3067
|
+
M.position.copy(p), M.element.style.pointerEvents = "none", M.scale.set(8e-3, 8e-3, 8e-3), M.visible = a.distanceTagVisible, n.css3dTags.push(M), n.group.add(M);
|
|
3068
3068
|
}
|
|
3069
3069
|
t || (n.css3dTags[n.css3dTags.length - 1].visible = !1), n.data = a, n.events.fire(Me, n);
|
|
3070
3070
|
}
|
|
@@ -3083,7 +3083,7 @@ class ia extends Qt {
|
|
|
3083
3083
|
super(), this.isMark = !0, this.disposed = !1, this.events = e;
|
|
3084
3084
|
const a = this;
|
|
3085
3085
|
let o;
|
|
3086
|
-
if (t instanceof
|
|
3086
|
+
if (t instanceof C) {
|
|
3087
3087
|
const c = document.querySelectorAll(".mark-wrap-point").length + 1;
|
|
3088
3088
|
o = {
|
|
3089
3089
|
type: "MarkSinglePoint",
|
|
@@ -3210,13 +3210,13 @@ class Tn extends Re {
|
|
|
3210
3210
|
const o = this;
|
|
3211
3211
|
if (n)
|
|
3212
3212
|
if (a) {
|
|
3213
|
-
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new
|
|
3214
|
-
o.css3dTags[r].element.innerText = h, o.css3dTags[r].position.set(
|
|
3213
|
+
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n, l = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), h = (c.distanceTo(u) * o.events.fire(I).meterScale).toFixed(2) + " m";
|
|
3214
|
+
o.css3dTags[r].element.innerText = h, o.css3dTags[r].position.set(l.x, l.y, l.z), o.css3dTags[r].visible = !0, o.data.points.pop(), o.data.points.pop(), o.data.points.pop(), o.data.points = [...o.data.points, ...n.toArray(), ...n.toArray()], this.draw(this.data);
|
|
3215
3215
|
} else {
|
|
3216
3216
|
const s = o.data.points.length;
|
|
3217
3217
|
o.data.points[s - 3] = n.x, o.data.points[s - 2] = n.y, o.data.points[s - 1] = n.z;
|
|
3218
|
-
const r = o.css3dTags.length - 1, c = new
|
|
3219
|
-
o.css3dTags[r].element.innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(
|
|
3218
|
+
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)), l = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), d = c.distanceTo(u), h = (d * o.events.fire(I).meterScale).toFixed(2) + " m";
|
|
3219
|
+
o.css3dTags[r].element.innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(l.x, l.y, l.z), o.css3dTags[r].visible = a ? !0 : d > 0.5, o.meshPlans.geometry.setAttribute("position", new He(new Float32Array(o.data.points), 3)), o.meshPlans.geometry.attributes.position.needsUpdate = !0;
|
|
3220
3220
|
const f = o.events.fire(ln, o.data.points);
|
|
3221
3221
|
o.css3dAreaTag.position.copy(f);
|
|
3222
3222
|
const p = o.events.fire(dn, o.data.points);
|
|
@@ -3245,7 +3245,7 @@ class Tn extends Re {
|
|
|
3245
3245
|
updateByMeterScale(e) {
|
|
3246
3246
|
const t = this, n = [];
|
|
3247
3247
|
for (let r = 0, c = t.data.points.length / 3; r < c; r++)
|
|
3248
|
-
n.push(new
|
|
3248
|
+
n.push(new C(t.data.points[r * 3], t.data.points[r * 3 + 1], t.data.points[r * 3 + 2]));
|
|
3249
3249
|
let a, o;
|
|
3250
3250
|
for (let r = 1; r < n.length; r++)
|
|
3251
3251
|
a = n[r - 1], o = n[r], t.css3dTags[r - 1].element.innerText = (a.distanceTo(o) * e).toFixed(2) + " m";
|
|
@@ -3257,7 +3257,7 @@ class Tn extends Re {
|
|
|
3257
3257
|
*/
|
|
3258
3258
|
drawFinish(e) {
|
|
3259
3259
|
if (this.disposed) return;
|
|
3260
|
-
const t = this, n = t.data.points.length, a = new
|
|
3260
|
+
const t = this, n = t.data.points.length, a = new C().fromArray(t.data.points.slice(n - 6, n - 3)), o = new C().fromArray(t.data.points.slice(n - 3));
|
|
3261
3261
|
if ((!e || a.distanceTo(o) < 1e-4) && (t.data.points.pop(), t.data.points.pop(), t.data.points.pop()), t.events.fire(Te), t.data.points.length < 9) {
|
|
3262
3262
|
t.dispose();
|
|
3263
3263
|
return;
|
|
@@ -3299,32 +3299,32 @@ class Tn extends Re {
|
|
|
3299
3299
|
r.setPositions([...a.points]);
|
|
3300
3300
|
const c = new Xe({ color: a.lineColor, linewidth: a.lineWidth });
|
|
3301
3301
|
c.resolution.set(innerWidth, innerHeight), n.copy(new Re(r, c)), o?.dispose(), s?.dispose();
|
|
3302
|
-
const u = a.name,
|
|
3302
|
+
const u = a.name, l = a.points.length / 3 - 1;
|
|
3303
3303
|
if (!n.css3dMainTag) {
|
|
3304
3304
|
const f = document.createElement("div");
|
|
3305
3305
|
f.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3306
3306
|
<span class="${u}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
|
|
3307
3307
|
</div>`, f.classList.add("mark-wrap-plans", `${a.name}`, "main-warp"), f.style.position = "absolute", f.style.borderRadius = "4px", f.style.cursor = "pointer", f.onclick = () => {
|
|
3308
3308
|
if (n.events.fire(I).markMode) return;
|
|
3309
|
-
const
|
|
3310
|
-
g.meterScale = n.events.fire(I).meterScale,
|
|
3311
|
-
}, f.oncontextmenu = (
|
|
3309
|
+
const m = parent?.onActiveMark, g = n.getMarkData(!0);
|
|
3310
|
+
g.meterScale = n.events.fire(I).meterScale, m?.(g), n.events.fire(q);
|
|
3311
|
+
}, f.oncontextmenu = (m) => m.preventDefault();
|
|
3312
3312
|
const p = new ie(f);
|
|
3313
3313
|
p.position.set(a.points[0], a.points[1], a.points[2]), p.element.style.pointerEvents = "none", p.scale.set(0.01, 0.01, 0.01), p.visible = a.mainTagVisible, n.group.add(p), n.css3dMainTag = p;
|
|
3314
3314
|
}
|
|
3315
|
-
const
|
|
3315
|
+
const d = n.events.fire(dn, a.points).toFixed(2) + " m²", h = n.events.fire(ln, a.points);
|
|
3316
3316
|
if (n.css3dAreaTag)
|
|
3317
|
-
n.css3dAreaTag.position.copy(h), n.css3dAreaTag.element.childNodes[0].innerText =
|
|
3317
|
+
n.css3dAreaTag.position.copy(h), n.css3dAreaTag.element.childNodes[0].innerText = d;
|
|
3318
3318
|
else {
|
|
3319
3319
|
const f = document.createElement("div");
|
|
3320
|
-
f.innerHTML = `<span class="${u}-area-tag" style="color:${a.areaTagColor};background:${a.areaTagBackground};opacity:${a.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${
|
|
3320
|
+
f.innerHTML = `<span class="${u}-area-tag" style="color:${a.areaTagColor};background:${a.areaTagBackground};opacity:${a.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${d}</span>`, f.classList.add("mark-wrap-plans", `${a.name}`, "area-warp"), f.style.position = "absolute", f.style.borderRadius = "4px";
|
|
3321
3321
|
const p = new ie(f);
|
|
3322
3322
|
p.position.copy(h), p.element.style.pointerEvents = "none", p.scale.set(0.01, 0.01, 0.01), n.group.add(p), n.css3dAreaTag = p;
|
|
3323
3323
|
}
|
|
3324
3324
|
n.css3dAreaTag.visible = a.points.length > 6 && a.areaTagVisible;
|
|
3325
|
-
for (let f = n.css3dTags.length; f <
|
|
3326
|
-
const p = new
|
|
3327
|
-
S.innerText =
|
|
3325
|
+
for (let f = n.css3dTags.length; f < l; f++) {
|
|
3326
|
+
const p = new C().fromArray(a.points.slice(f * 3, f * 3 + 3)), m = new C().fromArray(a.points.slice(f * 3 + 3, f * 3 + 6)), g = new C((p.x + m.x) / 2, (p.y + m.y) / 2, (p.z + m.z) / 2), M = (p.distanceTo(m) * n.events.fire(I).meterScale).toFixed(2) + " m", S = document.createElement("div");
|
|
3327
|
+
S.innerText = M, S.style.color = "white", S.classList.add("mark-wrap-plans", `${u}`, "distance-warp"), S.style.position = "absolute", S.style.borderRadius = "4px", S.style.display = "none";
|
|
3328
3328
|
const v = new ie(S);
|
|
3329
3329
|
v.position.copy(g), v.element.style.pointerEvents = "none", v.scale.set(8e-3, 8e-3, 8e-3), v.visible = a.distanceTagVisible, n.css3dTags.push(v), n.group.add(v);
|
|
3330
3330
|
}
|
|
@@ -3348,7 +3348,7 @@ class Tn extends Re {
|
|
|
3348
3348
|
if (e.points.length > 6) {
|
|
3349
3349
|
t.meshPlans.geometry.setAttribute("position", new He(new Float32Array(e.points), 3)), t.meshPlans.geometry.attributes.position.needsUpdate = !0;
|
|
3350
3350
|
let n = e.points.length / 3 - 2;
|
|
3351
|
-
const a = new
|
|
3351
|
+
const a = new C().fromArray(e.points.slice(0, 3)), o = new C().fromArray(e.points.slice(-3));
|
|
3352
3352
|
a.distanceTo(o) < 1e-4 && n--;
|
|
3353
3353
|
const s = new Uint16Array(n * 3);
|
|
3354
3354
|
for (let r = 0; r < n; r++)
|
|
@@ -3395,22 +3395,22 @@ class sa extends Qt {
|
|
|
3395
3395
|
r.opacity = o.circleOpacity;
|
|
3396
3396
|
const c = new te(s, r);
|
|
3397
3397
|
c.position.copy(e), c.isMark = !0, c.renderOrder = 1;
|
|
3398
|
-
const u = new
|
|
3398
|
+
const u = new C(0, 1, 0).normalize();
|
|
3399
3399
|
c.lookAt(c.position.clone().add(u));
|
|
3400
|
-
const
|
|
3401
|
-
|
|
3400
|
+
const l = document.createElement("div");
|
|
3401
|
+
l.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3402
3402
|
<span class="${o.name}-main-tag" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
3403
|
-
</div>`,
|
|
3403
|
+
</div>`, l.classList.add("mark-wrap-circle", `${o.name}`, "main-warp"), l.style.position = "absolute", l.style.borderRadius = "4px", l.style.cursor = "pointer", l.onclick = () => {
|
|
3404
3404
|
if (n.events.fire(I).markMode) return;
|
|
3405
3405
|
const p = parent?.onActiveMark;
|
|
3406
3406
|
p?.(n.getMarkData(!0)), n.events.fire(q);
|
|
3407
|
-
},
|
|
3408
|
-
const
|
|
3409
|
-
|
|
3407
|
+
}, l.oncontextmenu = (p) => p.preventDefault();
|
|
3408
|
+
const d = new ie(l);
|
|
3409
|
+
d.position.copy(e), d.element.style.pointerEvents = "none", d.scale.set(0.01, 0.01, 0.01), d.visible = o.mainTagVisible;
|
|
3410
3410
|
const h = document.createElement("div");
|
|
3411
3411
|
h.innerHTML = `<span class="${t}-circle-tag" style="color:${o.circleTagColor};background:${o.circleTagBackground};opacity:${o.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`, h.classList.add("mark-wrap-circle", `${t}`, "circle-warp"), h.style.position = "absolute", h.style.borderRadius = "4px", h.style.pointerEvents = "none";
|
|
3412
3412
|
const f = new ie(h);
|
|
3413
|
-
f.position.set(e.x + Math.min(o.radius / 2, 0.5), e.y, e.z), f.element.style.pointerEvents = "none", f.scale.set(8e-3, 8e-3, 8e-3), f.visible = !1, n.add(c,
|
|
3413
|
+
f.position.set(e.x + Math.min(o.radius / 2, 0.5), e.y, e.z), f.element.style.pointerEvents = "none", f.scale.set(8e-3, 8e-3, 8e-3), f.visible = !1, n.add(c, d, f), n.data = o, n.circleMesh = c, n.css3dTag = f, n.css3dMainTag = d, n.events.fire(Me, n);
|
|
3414
3414
|
}
|
|
3415
3415
|
/**
|
|
3416
3416
|
* 绘制更新
|
|
@@ -3419,13 +3419,13 @@ class sa extends Qt {
|
|
|
3419
3419
|
if (this.disposed) return;
|
|
3420
3420
|
const a = this;
|
|
3421
3421
|
if (n) {
|
|
3422
|
-
const o = new
|
|
3422
|
+
const o = new C().fromArray(a.data.startPoint), s = o.distanceTo(new C(n.x, o.y, n.z));
|
|
3423
3423
|
t && (a.data.radius = s), a.circleMesh.geometry.copy(new De(s, 128)), a.css3dTag.visible = s > 0.3;
|
|
3424
3424
|
const r = s * a.events.fire(I).meterScale, c = (Math.PI * r * r).toFixed(2) + " m²";
|
|
3425
3425
|
a.css3dTag.element.childNodes[0].innerText = c, a.css3dTag.position.set(o.x + Math.min(a.data.radius / 2, 0.5), o.y, o.z);
|
|
3426
3426
|
}
|
|
3427
3427
|
if (e?.radius) {
|
|
3428
|
-
const o = new
|
|
3428
|
+
const o = new C().fromArray(a.data.startPoint), s = e?.radius;
|
|
3429
3429
|
t && (a.data.radius = s), a.circleMesh.geometry.copy(new De(s, 128)), a.css3dTag.visible = s > 0.3;
|
|
3430
3430
|
const r = s * a.events.fire(I).meterScale, c = (Math.PI * r * r).toFixed(2) + " m²";
|
|
3431
3431
|
a.css3dTag.element.childNodes[0].innerText = c, a.css3dTag.position.set(o.x + Math.min(s / 2, 0.5), o.y, o.z);
|
|
@@ -3444,7 +3444,7 @@ class sa extends Qt {
|
|
|
3444
3444
|
*/
|
|
3445
3445
|
drawFinish(e) {
|
|
3446
3446
|
if (this.disposed) return;
|
|
3447
|
-
const t = this, n = new
|
|
3447
|
+
const t = this, n = new C().fromArray(t.data.startPoint), a = n.distanceTo(new C(e.x, n.y, e.z));
|
|
3448
3448
|
t.data.radius = a, t.circleMesh.geometry.copy(new De(a, 128));
|
|
3449
3449
|
const o = t.data.radius * t.events.fire(I).meterScale, s = (Math.PI * o * o).toFixed(2) + " m²";
|
|
3450
3450
|
t.css3dTag.element.childNodes[0].innerText = s, t.events.fire(Te);
|
|
@@ -3476,7 +3476,7 @@ class sa extends Qt {
|
|
|
3476
3476
|
o.opacity = n.circleOpacity;
|
|
3477
3477
|
const s = new te(a, o);
|
|
3478
3478
|
s.position.fromArray(n.startPoint), s.isMark = !0, s.renderOrder = 1;
|
|
3479
|
-
const r = new
|
|
3479
|
+
const r = new C(0, 1, 0).normalize();
|
|
3480
3480
|
s.lookAt(s.position.clone().add(r));
|
|
3481
3481
|
const c = n.name, u = document.createElement("div");
|
|
3482
3482
|
u.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
@@ -3486,12 +3486,12 @@ class sa extends Qt {
|
|
|
3486
3486
|
const g = parent?.onActiveMark;
|
|
3487
3487
|
g?.(t.getMarkData(!0)), t.events.fire(q);
|
|
3488
3488
|
}, u.oncontextmenu = (g) => g.preventDefault();
|
|
3489
|
-
const
|
|
3490
|
-
f.position.copy(
|
|
3489
|
+
const l = new C().fromArray(n.startPoint), d = n.radius * t.events.fire(I).meterScale, h = (Math.PI * d * d).toFixed(2) + " m²", f = new ie(u);
|
|
3490
|
+
f.position.copy(l), f.element.style.pointerEvents = "none", f.scale.set(0.01, 0.01, 0.01), f.visible = n.mainTagVisible;
|
|
3491
3491
|
const p = document.createElement("div");
|
|
3492
3492
|
p.innerHTML = `<span class="${c}-distance-tag ${c}-circle-tag" style="color:${n.circleTagColor};background:${n.circleTagBackground};opacity:${n.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${h}</span>`, p.classList.add("mark-wrap-circle", `${c}`, "circle-warp"), p.style.position = "absolute", p.style.borderRadius = "4px", p.style.pointerEvents = "none";
|
|
3493
|
-
const
|
|
3494
|
-
|
|
3493
|
+
const m = new ie(p);
|
|
3494
|
+
m.position.set(l.x + Math.min(n.radius / 2, 0.5), l.y, l.z), m.element.style.pointerEvents = "none", m.scale.set(8e-3, 8e-3, 8e-3), m.visible = n.circleTagVisible, t.add(s, f, m), t.data = n, t.circleMesh = s, t.css3dTag = m, t.css3dMainTag = f, t.events.fire(Me, t);
|
|
3495
3495
|
}
|
|
3496
3496
|
getMarkData(e = !1) {
|
|
3497
3497
|
const t = { ...this.data };
|
|
@@ -3517,7 +3517,7 @@ function vr(i) {
|
|
|
3517
3517
|
t(Y).autoRotate = t(I).autoRotate = !1, w && t(zt);
|
|
3518
3518
|
}), e(Kt, (w = !0) => {
|
|
3519
3519
|
if (o) return;
|
|
3520
|
-
const D = t(Y), _ = w ? Math.PI / 128 : -(Math.PI / 128), T = new $e().makeRotationAxis(new
|
|
3520
|
+
const D = t(Y), _ = w ? Math.PI / 128 : -(Math.PI / 128), T = new $e().makeRotationAxis(new C(0, 0, -1).transformDirection(D.object.matrixWorld), _);
|
|
3521
3521
|
D.object.up.transformDirection(T), t(J);
|
|
3522
3522
|
}), e(Ai, () => {
|
|
3523
3523
|
o || i.fire(Kt, !0);
|
|
@@ -3551,7 +3551,7 @@ function vr(i) {
|
|
|
3551
3551
|
const _ = t(B), T = [];
|
|
3552
3552
|
_.traverse((E) => E instanceof pe && T.push(E));
|
|
3553
3553
|
const F = await t(Ft, w, D);
|
|
3554
|
-
return F.length ? (T.length && T[0].fire(Ct, F[0].x, F[0].y, F[0].z, !0), new
|
|
3554
|
+
return F.length ? (T.length && T[0].fire(Ct, F[0].x, F[0].y, F[0].z, !0), new C(F[0].x, F[0].y, F[0].z)) : (T.length && T[0].fire(Ct, 0, 0, 0, !1), null);
|
|
3555
3555
|
}), e(Un, async () => {
|
|
3556
3556
|
const w = t(B), D = [];
|
|
3557
3557
|
w.traverse((_) => _ instanceof pe && D.push(_));
|
|
@@ -3570,31 +3570,31 @@ function vr(i) {
|
|
|
3570
3570
|
},
|
|
3571
3571
|
!0
|
|
3572
3572
|
);
|
|
3573
|
-
const
|
|
3573
|
+
const l = () => {
|
|
3574
3574
|
a.clear();
|
|
3575
|
-
},
|
|
3575
|
+
}, d = (w) => {
|
|
3576
3576
|
parent && setTimeout(() => window.focus()), w.preventDefault(), !o && (t(q), r = Date.now());
|
|
3577
3577
|
}, h = (w) => {
|
|
3578
3578
|
w.preventDefault(), !o && (t(q), r = Date.now());
|
|
3579
3579
|
};
|
|
3580
|
-
let f, p,
|
|
3580
|
+
let f, p, m, g;
|
|
3581
3581
|
e(qe, () => {
|
|
3582
|
-
f?.dispose(), p?.dispose(),
|
|
3582
|
+
f?.dispose(), p?.dispose(), m?.dispose(), g?.dispose(), f = null, p = null, m = null, g = null, s.lastMovePoint = null, t(Te);
|
|
3583
3583
|
});
|
|
3584
|
-
const
|
|
3584
|
+
const y = async (w) => {
|
|
3585
3585
|
parent && setTimeout(() => window.focus()), w.preventDefault(), !o && (t(q), s.down = w.button === 2 ? 2 : 1, s.move = !1, s.isDbClick = Date.now() - s.downTime < 300, r = Date.now(), s.downTime = Date.now());
|
|
3586
|
-
},
|
|
3586
|
+
}, M = async (w) => {
|
|
3587
3587
|
if (w.preventDefault(), o) return;
|
|
3588
3588
|
s.down && (s.move = !0, r = Date.now());
|
|
3589
3589
|
const D = t(I);
|
|
3590
3590
|
if (D.markMode) {
|
|
3591
3591
|
const _ = await t(ce, w.clientX, w.clientY);
|
|
3592
|
-
_ && !s.down && D.markType === "distance" && f ? f.drawUpdate({ endPoint: _.toArray() }) : !s.down && D.markType === "circle" && g ? _ ? (g.drawUpdate(null, !0, _), s.lastMovePoint = _, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "lines" && p ? _ ? (p.drawUpdate(null, !0, _), s.lastMovePoint = _, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "plans" &&
|
|
3592
|
+
_ && !s.down && D.markType === "distance" && f ? f.drawUpdate({ endPoint: _.toArray() }) : !s.down && D.markType === "circle" && g ? _ ? (g.drawUpdate(null, !0, _), s.lastMovePoint = _, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "lines" && p ? _ ? (p.drawUpdate(null, !0, _), s.lastMovePoint = _, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "plans" && m && (_ ? (m.drawUpdate(null, !0, _), s.lastMovePoint = _, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0));
|
|
3593
3593
|
}
|
|
3594
3594
|
}, S = async (w) => {
|
|
3595
3595
|
if (w.preventDefault(), o) return;
|
|
3596
3596
|
const D = t(I);
|
|
3597
|
-
if (s.isDbClick && (p ? Math.abs(w.clientX - s.lastClickX) < 2 && Math.abs(w.clientY - s.lastClickY) < 2 && (p.drawFinish(s.lastClickPointTime > 0), p = null, s.lastMovePoint = null) :
|
|
3597
|
+
if (s.isDbClick && (p ? Math.abs(w.clientX - s.lastClickX) < 2 && Math.abs(w.clientY - s.lastClickY) < 2 && (p.drawFinish(s.lastClickPointTime > 0), p = null, s.lastMovePoint = null) : m && Math.abs(w.clientX - s.lastClickX) < 2 && Math.abs(w.clientY - s.lastClickY) < 2 && (m.drawFinish(s.lastClickPointTime > 0), m = null, s.lastMovePoint = null)), D.markMode && s.down === 1 && !s.move && Date.now() - s.downTime < 500) {
|
|
3598
3598
|
if (D.markType === "point") {
|
|
3599
3599
|
if (await t(ce, w.clientX, w.clientY)) {
|
|
3600
3600
|
const T = new ia(i, await t(ce, w.clientX, w.clientY));
|
|
@@ -3621,16 +3621,16 @@ function vr(i) {
|
|
|
3621
3621
|
_ && (p = new Mn(i), p.drawStart(_), t(B).add(p));
|
|
3622
3622
|
}
|
|
3623
3623
|
else if (D.markType === "plans")
|
|
3624
|
-
if (
|
|
3624
|
+
if (m)
|
|
3625
3625
|
if (s.lastMovePoint && t(mn, w.clientX, w.clientY, s.lastMovePoint) < 0.03)
|
|
3626
|
-
|
|
3626
|
+
m.drawUpdate(null, !0, s.lastMovePoint, !0), s.lastClickPointTime = Date.now();
|
|
3627
3627
|
else {
|
|
3628
3628
|
const _ = await t(ce, w.clientX, w.clientY);
|
|
3629
|
-
_ ? (
|
|
3629
|
+
_ ? (m.drawUpdate(null, !0, _, !0), s.lastClickPointTime = Date.now()) : s.lastClickPointTime = 0;
|
|
3630
3630
|
}
|
|
3631
3631
|
else {
|
|
3632
3632
|
const _ = await t(ce, w.clientX, w.clientY);
|
|
3633
|
-
_ && (
|
|
3633
|
+
_ && (m = new Tn(i), m.drawStart(_), t(B).add(m));
|
|
3634
3634
|
}
|
|
3635
3635
|
else if (D.markType === "circle")
|
|
3636
3636
|
if (g) {
|
|
@@ -3653,7 +3653,7 @@ function vr(i) {
|
|
|
3653
3653
|
function b(w) {
|
|
3654
3654
|
s.down === 1 && !s.move && t(it, s.x, s.y);
|
|
3655
3655
|
}
|
|
3656
|
-
window.addEventListener("keydown", c), window.addEventListener("keyup", u), window.addEventListener("blur",
|
|
3656
|
+
window.addEventListener("keydown", c), window.addEventListener("keyup", u), window.addEventListener("blur", l), window.addEventListener("wheel", d, { passive: !1 }), n.addEventListener("contextmenu", h), n.addEventListener("mousedown", y), n.addEventListener("mousemove", M), n.addEventListener("mouseup", S), n.addEventListener("touchstart", v, { passive: !1 }), n.addEventListener("touchmove", k, { passive: !1 }), n.addEventListener("touchend", b, { passive: !1 }), window.addEventListener("resize", x), x();
|
|
3657
3657
|
function x() {
|
|
3658
3658
|
const { width: w, height: D, top: _, left: T } = t(Ue), F = t(V);
|
|
3659
3659
|
F.aspect = w / D, F.updateProjectionMatrix();
|
|
@@ -3663,41 +3663,41 @@ function vr(i) {
|
|
|
3663
3663
|
P.setPixelRatio(Math.min(devicePixelRatio, 2)), P.setSize(w, D);
|
|
3664
3664
|
}
|
|
3665
3665
|
e(Fn, () => {
|
|
3666
|
-
o = !0, window.removeEventListener("keydown", c), window.removeEventListener("keyup", u), window.removeEventListener("blur",
|
|
3666
|
+
o = !0, window.removeEventListener("keydown", c), window.removeEventListener("keyup", u), window.removeEventListener("blur", l), window.removeEventListener("wheel", d), n.removeEventListener("contextmenu", h), n.removeEventListener("mousedown", y), n.removeEventListener("mousemove", M), n.removeEventListener("mouseup", S), n.removeEventListener("touchstart", v), n.removeEventListener("touchmove", k), n.removeEventListener("touchend", b), window.removeEventListener("resize", x);
|
|
3667
3667
|
});
|
|
3668
3668
|
}
|
|
3669
3669
|
function aa(i) {
|
|
3670
3670
|
const e = new Aa(), t = 0.02, n = (o, s, r) => i.on(o, s, r), a = (o, ...s) => i.fire(o, ...s);
|
|
3671
3671
|
n(Ft, async (o, s) => {
|
|
3672
|
-
const { width: r, height: c, left: u, top:
|
|
3673
|
-
|
|
3672
|
+
const { width: r, height: c, left: u, top: l } = a(Ue), d = new j();
|
|
3673
|
+
d.x = (o - u) / r * 2 - 1, d.y = (l - s) / c * 2 + 1;
|
|
3674
3674
|
const h = a(V);
|
|
3675
|
-
e.setFromCamera(
|
|
3676
|
-
const f = [], p = a(B),
|
|
3675
|
+
e.setFromCamera(d, h);
|
|
3676
|
+
const f = [], p = a(B), m = [], g = [];
|
|
3677
3677
|
p.traverse(function(v) {
|
|
3678
|
-
v instanceof pe ? g.push(v) : v.isMesh && !v.ignoreIntersect && !v.isMark &&
|
|
3678
|
+
v instanceof pe ? g.push(v) : v.isMesh && !v.ignoreIntersect && !v.isMark && m.push(v);
|
|
3679
3679
|
});
|
|
3680
|
-
const
|
|
3681
|
-
for (let v = 0; v <
|
|
3682
|
-
f.push(new tt(
|
|
3683
|
-
const
|
|
3680
|
+
const y = e.intersectObjects(m, !0);
|
|
3681
|
+
for (let v = 0; v < y.length; v++)
|
|
3682
|
+
f.push(new tt(y[v].point, e.ray.distanceToPoint(y[v].point)));
|
|
3683
|
+
const M = h.projectionMatrix.clone().multiply(h.matrixWorldInverse);
|
|
3684
3684
|
for (let v = 0; v < g.length; v++) {
|
|
3685
3685
|
const k = g[v].fire(gn);
|
|
3686
3686
|
if (k)
|
|
3687
3687
|
if (k.length !== void 0) {
|
|
3688
3688
|
const b = k, x = b.length / 3;
|
|
3689
3689
|
for (let w = 0; w < x; w++) {
|
|
3690
|
-
const D = new
|
|
3691
|
-
Math.sqrt((T -
|
|
3690
|
+
const D = new C(b[3 * w + 0], b[3 * w + 1], b[3 * w + 2]), _ = new ve(D.x, D.y, D.z, 1).applyMatrix4(M), T = _.x / _.w, F = _.y / _.w;
|
|
3691
|
+
Math.sqrt((T - d.x) ** 2 + (F - d.y) ** 2) <= t && f.push(new tt(D, e.ray.distanceToPoint(D)));
|
|
3692
3692
|
}
|
|
3693
3693
|
} else
|
|
3694
3694
|
for (let b of Object.keys(k)) {
|
|
3695
|
-
const x = b.split(","), w = new
|
|
3695
|
+
const x = b.split(","), w = new C(Number(x[0]), Number(x[1]), Number(x[2]));
|
|
3696
3696
|
if (e.ray.distanceToPoint(w) <= 1.4143) {
|
|
3697
3697
|
const D = k[b];
|
|
3698
3698
|
for (let _ = 0, T = D.length / 3; _ < T; _++) {
|
|
3699
|
-
const F = new
|
|
3700
|
-
Math.sqrt((P -
|
|
3699
|
+
const F = new C(D[3 * _ + 0], D[3 * _ + 1], D[3 * _ + 2]), E = new ve(F.x, F.y, F.z, 1).applyMatrix4(M), P = E.x / E.w, U = E.y / E.w;
|
|
3700
|
+
Math.sqrt((P - d.x) ** 2 + (U - d.y) ** 2) <= t && f.push(new tt(F, e.ray.distanceToPoint(F)));
|
|
3701
3701
|
}
|
|
3702
3702
|
}
|
|
3703
3703
|
}
|
|
@@ -3708,8 +3708,8 @@ function aa(i) {
|
|
|
3708
3708
|
S.push(f[v].center);
|
|
3709
3709
|
return S;
|
|
3710
3710
|
}), n(mn, (o, s, r) => {
|
|
3711
|
-
const { width: c, height: u, left:
|
|
3712
|
-
h.x = (o -
|
|
3711
|
+
const { width: c, height: u, left: l, top: d } = a(Ue), h = new j();
|
|
3712
|
+
h.x = (o - l) / c * 2 - 1, h.y = (d - s) / u * 2 + 1;
|
|
3713
3713
|
const f = a(V);
|
|
3714
3714
|
return e.setFromCamera(h, f), e.ray.distanceToPoint(r);
|
|
3715
3715
|
});
|
|
@@ -3722,23 +3722,23 @@ function Sr(i) {
|
|
|
3722
3722
|
return;
|
|
3723
3723
|
}
|
|
3724
3724
|
const u = t(Y).target.clone();
|
|
3725
|
-
let
|
|
3725
|
+
let l = 0;
|
|
3726
3726
|
t(
|
|
3727
3727
|
at,
|
|
3728
3728
|
() => {
|
|
3729
|
-
|
|
3729
|
+
l += 0.03, t(Y).target.copy(u.clone().lerp(r, l)), t(Rt);
|
|
3730
3730
|
},
|
|
3731
|
-
() =>
|
|
3731
|
+
() => l < 1
|
|
3732
3732
|
);
|
|
3733
3733
|
}), e(ls, () => {
|
|
3734
3734
|
let r = t(Be).toArray(), c = t(Ne).toArray(), u = t(Ce).toArray();
|
|
3735
3735
|
return { position: r, lookUp: c, lookAt: u };
|
|
3736
3736
|
}), e(ds, () => t(Y).update()), e(us, () => t(Y).updateRotateAxis());
|
|
3737
3737
|
const n = 0.01;
|
|
3738
|
-
let a = new
|
|
3738
|
+
let a = new C(), o = new C(), s = 0;
|
|
3739
3739
|
e(ws, () => {
|
|
3740
|
-
const r = t(Y).object, c = r.fov, u = r.position.clone(),
|
|
3741
|
-
return Math.abs(s - c) < n && Math.abs(u.x - a.x) < n && Math.abs(u.y - a.y) < n && Math.abs(u.z - a.z) < n && Math.abs(
|
|
3740
|
+
const r = t(Y).object, c = r.fov, u = r.position.clone(), l = r.getWorldDirection(new C());
|
|
3741
|
+
return Math.abs(s - c) < n && Math.abs(u.x - a.x) < n && Math.abs(u.y - a.y) < n && Math.abs(u.z - a.z) < n && Math.abs(l.x - o.x) < n && Math.abs(l.y - o.y) < n && Math.abs(l.z - o.z) < n ? !1 : (s = c, a = u, o = l, !0);
|
|
3742
3742
|
});
|
|
3743
3743
|
}
|
|
3744
3744
|
class br extends te {
|
|
@@ -3748,19 +3748,19 @@ class br extends te {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
function xr(i) {
|
|
3750
3750
|
let e = !1;
|
|
3751
|
-
const t = (r, c, u) => i.on(r, c, u), n = (r, ...c) => i.fire(r, ...c), a = [], o = new
|
|
3751
|
+
const t = (r, c, u) => i.on(r, c, u), n = (r, ...c) => i.fire(r, ...c), a = [], o = new C(), s = new $e();
|
|
3752
3752
|
t(_s, () => {
|
|
3753
3753
|
const r = new wa(0.5, 32, 32), c = Cr();
|
|
3754
3754
|
c.depthTest = !1, c.depthWrite = !1, c.transparent = !0;
|
|
3755
3755
|
const u = new br();
|
|
3756
|
-
return u.copy(new te(r, c)), t(Da, () => c), t(vi, (
|
|
3757
|
-
e || (c.uniforms[xn].value =
|
|
3758
|
-
}), t(Is, (
|
|
3756
|
+
return u.copy(new te(r, c)), t(Da, () => c), t(vi, (l) => {
|
|
3757
|
+
e || (c.uniforms[xn].value = l, l <= 0.01 ? u.visible = !1 : u.visible = !0, c.uniformsNeedUpdate = !0, n(J));
|
|
3758
|
+
}), t(Is, (l) => {
|
|
3759
3759
|
if (e) return;
|
|
3760
|
-
const
|
|
3761
|
-
s.copy(
|
|
3760
|
+
const d = n(V);
|
|
3761
|
+
s.copy(d.matrixWorld).invert(), o.copy(l).applyMatrix4(s), o.normalize().multiplyScalar(10), o.applyMatrix4(d.matrixWorld);
|
|
3762
3762
|
const { width: h, height: f } = n(Ue);
|
|
3763
|
-
c.uniforms[ht].value.set(h, f), u.position.copy(o), c.uniforms[Js].value.copy(
|
|
3763
|
+
c.uniforms[ht].value.set(h, f), u.position.copy(o), c.uniforms[Js].value.copy(l), c.uniforms[ht].value.set(h, f), c.uniforms[xn].value = 1, c.uniformsNeedUpdate = !0, n(Si), n(J);
|
|
3764
3764
|
}), t(Pa, () => {
|
|
3765
3765
|
e || (e = !0, c.dispose(), r.dispose());
|
|
3766
3766
|
}), u.renderOrder = 99999, u;
|
|
@@ -3779,7 +3779,7 @@ function xr(i) {
|
|
|
3779
3779
|
function Cr() {
|
|
3780
3780
|
const i = {
|
|
3781
3781
|
[So]: { type: "v3", value: new Pn() },
|
|
3782
|
-
[Js]: { type: "v3", value: new
|
|
3782
|
+
[Js]: { type: "v3", value: new C() },
|
|
3783
3783
|
[ht]: { type: "v2", value: new j() },
|
|
3784
3784
|
[xn]: { value: 0 }
|
|
3785
3785
|
};
|
|
@@ -3873,33 +3873,33 @@ function oa(i) {
|
|
|
3873
3873
|
}
|
|
3874
3874
|
r && (t(I).meterScale = s.meterScale), t(oe, { scale: `1 : ${c} m` });
|
|
3875
3875
|
for (const u of n.values()) {
|
|
3876
|
-
const
|
|
3877
|
-
|
|
3876
|
+
const l = u.deref();
|
|
3877
|
+
l && (l instanceof Cn || l instanceof Mn || l instanceof Tn) && l.updateByMeterScale(c);
|
|
3878
3878
|
}
|
|
3879
3879
|
}
|
|
3880
3880
|
}), e(ln, (s) => {
|
|
3881
|
-
const r = new
|
|
3881
|
+
const r = new C().fromArray(s.slice(0, 3)), c = new C().fromArray(s.slice(-6, -3)), u = new C().fromArray(s.slice(-3)), l = r.distanceTo(u) < 1e-4, d = c.distanceTo(u) < 1e-4, h = new C(), f = l || d ? s.length / 3 - 1 : s.length / 3;
|
|
3882
3882
|
for (let p = 0; p < f; p++)
|
|
3883
|
-
h.add(new
|
|
3883
|
+
h.add(new C(s[p * 3], s[p * 3 + 1], s[p * 3 + 2]));
|
|
3884
3884
|
return h.divideScalar(f), h;
|
|
3885
3885
|
}), e(dn, (s) => {
|
|
3886
3886
|
const r = [];
|
|
3887
|
-
for (let
|
|
3888
|
-
r.push(new
|
|
3887
|
+
for (let d = 0, h = s.length / 3; d < h; d++)
|
|
3888
|
+
r.push(new C(s[d * 3], s[d * 3 + 1], s[d * 3 + 2]));
|
|
3889
3889
|
const c = r[0].distanceTo(r[r.length - 1]) < 1e-4, u = r[r.length - 2].distanceTo(r[r.length - 1]) < 1e-4;
|
|
3890
3890
|
if ((c || u) && r.pop(), r.length < 3) return 0;
|
|
3891
|
-
let
|
|
3892
|
-
for (let
|
|
3893
|
-
|
|
3894
|
-
return
|
|
3891
|
+
let l = 0;
|
|
3892
|
+
for (let d = 0, h = r.length - 2; d < h; d++)
|
|
3893
|
+
l += t(Gt, r[0], r[d + 1], r[d + 2], t(I).meterScale);
|
|
3894
|
+
return l;
|
|
3895
3895
|
}), e(rs, (s, r) => {
|
|
3896
3896
|
let c = 0;
|
|
3897
|
-
for (let u = 0,
|
|
3897
|
+
for (let u = 0, l = s.length - 2; u < l; u++)
|
|
3898
3898
|
c += t(Gt, s[0], s[u + 1], s[u + 2], r);
|
|
3899
3899
|
return c;
|
|
3900
3900
|
}), e(Gt, (s, r, c, u) => {
|
|
3901
|
-
const
|
|
3902
|
-
return Math.sqrt(f * (f -
|
|
3901
|
+
const l = s.distanceTo(r) * u, d = r.distanceTo(c) * u, h = c.distanceTo(s) * u, f = (l + d + h) / 2;
|
|
3902
|
+
return Math.sqrt(f * (f - l) * (f - d) * (f - h));
|
|
3903
3903
|
});
|
|
3904
3904
|
}
|
|
3905
3905
|
function Mr(i) {
|
|
@@ -3917,10 +3917,10 @@ function Mr(i) {
|
|
|
3917
3917
|
return h;
|
|
3918
3918
|
}), t(Vn, (h) => {
|
|
3919
3919
|
for (let f = 0, p = h.length / 3 | 0; f < p; f++)
|
|
3920
|
-
n[f] = new
|
|
3920
|
+
n[f] = new C(h[f * 3 + 0], h[f * 3 + 1], h[f * 3 + 2]);
|
|
3921
3921
|
}), t(Gn, (h) => {
|
|
3922
3922
|
for (let f = 0, p = h.length / 3 | 0; f < p; f++)
|
|
3923
|
-
a[f] = new
|
|
3923
|
+
a[f] = new C(h[f * 3 + 0], h[f * 3 + 1], h[f * 3 + 2]);
|
|
3924
3924
|
}), t(Wn, () => {
|
|
3925
3925
|
const h = e(Y);
|
|
3926
3926
|
n.push(h.object.position.clone()), a.push(h.target.clone());
|
|
@@ -3930,8 +3930,8 @@ function Mr(i) {
|
|
|
3930
3930
|
const h = e(ye).meta || {};
|
|
3931
3931
|
if (n.length) {
|
|
3932
3932
|
const f = [], p = [];
|
|
3933
|
-
for (let
|
|
3934
|
-
f.push(...n[
|
|
3933
|
+
for (let m = 0, g = n.length; m < g; m++)
|
|
3934
|
+
f.push(...n[m].toArray()), p.push(...a[m].toArray());
|
|
3935
3935
|
h.flyPositions = f, h.flyTargets = p;
|
|
3936
3936
|
} else
|
|
3937
3937
|
delete h.flyPositions, delete h.flyTargets;
|
|
@@ -3941,20 +3941,20 @@ function Mr(i) {
|
|
|
3941
3941
|
});
|
|
3942
3942
|
let r = 0;
|
|
3943
3943
|
const c = 120 * 1e3;
|
|
3944
|
-
let u = 0,
|
|
3944
|
+
let u = 0, l, d;
|
|
3945
3945
|
t(Ot, (h) => {
|
|
3946
|
-
if (r = 0, u = Date.now(),
|
|
3947
|
-
const f = e(Y), p = [f.object.position.clone()],
|
|
3948
|
-
for (let
|
|
3949
|
-
g[
|
|
3950
|
-
|
|
3946
|
+
if (r = 0, u = Date.now(), l = null, d = null, !n.length || !h && !e(Y).autoRotate) return;
|
|
3947
|
+
const f = e(Y), p = [f.object.position.clone()], m = [f.target.clone()], g = e(xi) || [];
|
|
3948
|
+
for (let y = 0, M = Math.min(g.length, 100); y < M; y++)
|
|
3949
|
+
g[y] && p.push(g[y]), a[y] && m.push(a[y]);
|
|
3950
|
+
l = new si(p), l.closed = !0, d = new si(m), d.closed = !0, e(Ci), e(q, !1);
|
|
3951
3951
|
}), t(
|
|
3952
3952
|
lt,
|
|
3953
3953
|
() => {
|
|
3954
|
-
if (Date.now() - u > c && e(zt), !o || !
|
|
3954
|
+
if (Date.now() - u > c && e(zt), !o || !l || !d) return;
|
|
3955
3955
|
const h = e(Y);
|
|
3956
3956
|
r = (Date.now() - u) / c;
|
|
3957
|
-
const f =
|
|
3957
|
+
const f = l.getPoint(r), p = d.getPoint(r);
|
|
3958
3958
|
h.object.position.set(f.x, f.y, f.z), h.target.set(p.x, p.y, p.z);
|
|
3959
3959
|
},
|
|
3960
3960
|
!0
|
|
@@ -3973,18 +3973,18 @@ class Br {
|
|
|
3973
3973
|
o.updateByOptions(e);
|
|
3974
3974
|
const s = new Xn();
|
|
3975
3975
|
e.viewerEvents = s, t.events = s;
|
|
3976
|
-
const r = (
|
|
3977
|
-
r(I, () => e), r(Ke, () => n.domElement), r(ct, () => n), r(B, () => a), r(Y, () => o), r(V, () => o.object), r(ee, () => e.bigSceneMode), r(Fa, (
|
|
3976
|
+
const r = (d, h, f) => s.on(d, h, f), c = (d, ...h) => s.fire(d, ...h);
|
|
3977
|
+
r(I, () => e), r(Ke, () => n.domElement), r(ct, () => n), r(B, () => a), r(Y, () => o), r(V, () => o.object), r(ee, () => e.bigSceneMode), r(Fa, (d) => e.pointcloudMode = d);
|
|
3978
3978
|
const u = [];
|
|
3979
3979
|
r(J, () => {
|
|
3980
3980
|
for (t.needUpdate = !0; u.length; ) u.pop().stop = !0;
|
|
3981
|
-
let
|
|
3982
|
-
u.push(
|
|
3981
|
+
let d = { count: 0, stop: !1 };
|
|
3982
|
+
u.push(d), c(
|
|
3983
3983
|
Ln,
|
|
3984
3984
|
() => {
|
|
3985
|
-
!t.disposed && (t.needUpdate = !0),
|
|
3985
|
+
!t.disposed && (t.needUpdate = !0), d.count++ >= 600 && (d.stop = !0);
|
|
3986
3986
|
},
|
|
3987
|
-
() => !t.disposed && (c(On) || !
|
|
3987
|
+
() => !t.disposed && (c(On) || !d.stop),
|
|
3988
3988
|
10
|
|
3989
3989
|
);
|
|
3990
3990
|
}), qn(s), Yo(s), Jn(s), Sr(s), oa(s), vr(s), aa(s), xr(s), Mr(s), t.splatMesh = new pe(Xo(e)), r(ye, () => t.splatMesh), a.add(t.splatMesh), Zo(s), a.add(new as("#ffffff", 2)), a.add(c(_s)), n.setAnimationLoop(t.update.bind(t)), r(bi, () => {
|
|
@@ -3994,17 +3994,17 @@ class Br {
|
|
|
3994
3994
|
() => {
|
|
3995
3995
|
try {
|
|
3996
3996
|
!(t.needUpdate = !1) && n.render(a, c(V));
|
|
3997
|
-
} catch (
|
|
3998
|
-
console.warn(
|
|
3997
|
+
} catch (d) {
|
|
3998
|
+
console.warn(d.message);
|
|
3999
3999
|
}
|
|
4000
4000
|
},
|
|
4001
4001
|
!0
|
|
4002
4002
|
), r(lt, () => {
|
|
4003
4003
|
}, !0), r(Ht, () => t.dispose()), r(Os, () => console.info(JSON.stringify(c(ye).meta || {}, null, 2)));
|
|
4004
|
-
let
|
|
4005
|
-
r(mt, (
|
|
4006
|
-
|
|
4007
|
-
}), r(Ds, () =>
|
|
4004
|
+
let l = "";
|
|
4005
|
+
r(mt, (d = "") => {
|
|
4006
|
+
l = d, t.splatMesh.fire(Hn, l, !0);
|
|
4007
|
+
}), r(Ds, () => l), c(oe, { scale: `1 : ${c(I).meterScale} m` }), t.initGsApi();
|
|
4008
4008
|
}
|
|
4009
4009
|
/**
|
|
4010
4010
|
* 允许拖拽本地文件进行渲染
|
|
@@ -4142,33 +4142,33 @@ class Br {
|
|
|
4142
4142
|
* 根据需要暴露的接口
|
|
4143
4143
|
*/
|
|
4144
4144
|
initGsApi() {
|
|
4145
|
-
const e = (
|
|
4145
|
+
const e = (l, ...d) => this.events.fire(l, ...d), t = () => {
|
|
4146
4146
|
setTimeout(() => window.focus()), e(zt), e(Y).autoRotate = e(I).autoRotate = !e(I).autoRotate;
|
|
4147
|
-
}, n = (
|
|
4148
|
-
setTimeout(() => window.focus()),
|
|
4149
|
-
const
|
|
4150
|
-
|
|
4151
|
-
}, a = (
|
|
4152
|
-
setTimeout(() => window.focus()), e(dt, !!
|
|
4153
|
-
}, o = (
|
|
4147
|
+
}, n = (l = !0) => {
|
|
4148
|
+
setTimeout(() => window.focus()), l = !!l;
|
|
4149
|
+
const d = e(I);
|
|
4150
|
+
d.pointcloudMode !== l && (d.bigSceneMode ? e(Bt, l) : e(Ut));
|
|
4151
|
+
}, a = (l = !0) => {
|
|
4152
|
+
setTimeout(() => window.focus()), e(dt, !!l);
|
|
4153
|
+
}, o = (l) => {
|
|
4154
4154
|
setTimeout(() => window.focus());
|
|
4155
|
-
const
|
|
4156
|
-
if (
|
|
4157
|
-
if (
|
|
4158
|
-
|
|
4159
|
-
else if (
|
|
4160
|
-
|
|
4161
|
-
else if (
|
|
4162
|
-
|
|
4163
|
-
else if (
|
|
4164
|
-
|
|
4155
|
+
const d = e(I);
|
|
4156
|
+
if (d.markMode) return !1;
|
|
4157
|
+
if (l === 1)
|
|
4158
|
+
d.markType = "point";
|
|
4159
|
+
else if (l === 2)
|
|
4160
|
+
d.markType = "lines";
|
|
4161
|
+
else if (l === 3)
|
|
4162
|
+
d.markType = "plans";
|
|
4163
|
+
else if (l === 4)
|
|
4164
|
+
d.markType = "distance";
|
|
4165
4165
|
else
|
|
4166
4166
|
return !1;
|
|
4167
|
-
return
|
|
4168
|
-
}, s = async (
|
|
4169
|
-
setTimeout(() => window.focus()), e(hn, !!
|
|
4170
|
-
}, u = (
|
|
4171
|
-
e(mt,
|
|
4167
|
+
return d.markMode = !0, e(q), !0;
|
|
4168
|
+
}, s = async (l) => (setTimeout(() => window.focus()), l ? (e(st, l)?.dispose(), e(J), await e(kt)) : !1), r = async (l, d = !0) => (e(Ps, l, d), e(st, l?.name)?.drawUpdate?.(l, d), e(J), d ? (setTimeout(() => window.focus()), await e(kt)) : !0), c = (l = !0) => {
|
|
4169
|
+
setTimeout(() => window.focus()), e(hn, !!l);
|
|
4170
|
+
}, u = (l, d = !0) => {
|
|
4171
|
+
e(mt, l), d && e(Fs, l);
|
|
4172
4172
|
};
|
|
4173
4173
|
window.$api = { switchAutoRotate: t, changePointCloudMode: n, showMark: a, startMark: o, deleteMark: s, updateMark: r, showWaterMark: c, setWaterMark: u };
|
|
4174
4174
|
}
|
|
@@ -4187,19 +4187,19 @@ function Tr(i) {
|
|
|
4187
4187
|
const e = (s, r, c) => i.on(s, r, c), t = (s, ...r) => i.fire(s, ...r), n = le ? 1 : 20, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
4188
4188
|
e(It, () => t(re) && a.set(Date.now(), 1)), e(Dt, () => t(re) && t(Ye, a)), e(Pt, () => t(re) && o.set(Date.now(), 1)), e(Lt, () => t(re) && t(Ye, o)), e(Ye, (s) => {
|
|
4189
4189
|
let r = [], c = Date.now(), u = 0;
|
|
4190
|
-
for (const
|
|
4191
|
-
c -
|
|
4192
|
-
return r.forEach((
|
|
4190
|
+
for (const l of s.keys())
|
|
4191
|
+
c - l <= 1e3 ? u++ : r.push(l);
|
|
4192
|
+
return r.forEach((l) => s.delete(l)), Math.min(u, 30);
|
|
4193
4193
|
}), e(X, () => {
|
|
4194
4194
|
const s = t(B), r = t(V), c = [];
|
|
4195
4195
|
return s?.traverse(function(u) {
|
|
4196
4196
|
u.isWarpSplatMesh && u.splatMesh?.visible && c.push(u);
|
|
4197
|
-
}), c.sort((u,
|
|
4197
|
+
}), c.sort((u, l) => r.position.distanceTo(u.position) - r.position.distanceTo(l.position)), window.splat = c[0]?.splatMesh, c[0]?.splatMesh;
|
|
4198
4198
|
}), e(Ks, () => {
|
|
4199
4199
|
const s = t(B), r = t(V), c = [];
|
|
4200
4200
|
s?.traverse(function(u) {
|
|
4201
4201
|
u.isWarpSplatMesh && c.push(u);
|
|
4202
|
-
}), c.sort((u,
|
|
4202
|
+
}), c.sort((u, l) => r.position.distanceTo(u.position) - r.position.distanceTo(l.position));
|
|
4203
4203
|
for (let u = 0; u < c.length; u++)
|
|
4204
4204
|
c[u].active = u < n, c[u].splatMesh && (c[u].splatMesh.renderOrder = 1e3 - u);
|
|
4205
4205
|
}), e(Zs, () => {
|
|
@@ -4209,13 +4209,13 @@ function Tr(i) {
|
|
|
4209
4209
|
}), s?.clear();
|
|
4210
4210
|
}), e(wn, (s = 0.1) => {
|
|
4211
4211
|
const r = t(X);
|
|
4212
|
-
r && r.visible && r.rotateOnAxis(new
|
|
4212
|
+
r && r.visible && r.rotateOnAxis(new C(1, 0, 0), be.degToRad(s));
|
|
4213
4213
|
}), e(vn, (s = 0.1) => {
|
|
4214
4214
|
const r = t(X);
|
|
4215
|
-
r && r.visible && r.rotateOnAxis(new
|
|
4215
|
+
r && r.visible && r.rotateOnAxis(new C(0, 1, 0), be.degToRad(s));
|
|
4216
4216
|
}), e(Sn, (s = 0.1) => {
|
|
4217
4217
|
const r = t(X);
|
|
4218
|
-
r && r.visible && r.rotateOnAxis(new
|
|
4218
|
+
r && r.visible && r.rotateOnAxis(new C(0, 0, 1), be.degToRad(s));
|
|
4219
4219
|
}), e(Ha, (s = 0.01) => {
|
|
4220
4220
|
const r = t(X);
|
|
4221
4221
|
r && r.visible && (r.position.x += s);
|
|
@@ -4245,11 +4245,13 @@ function Tr(i) {
|
|
|
4245
4245
|
const s = new ss(), r = 14414079;
|
|
4246
4246
|
return s.background = new Pn(r), s.fog = new ai(r, 0), e(B, () => s), s;
|
|
4247
4247
|
}), e(Ns, () => {
|
|
4248
|
-
const r = t(V), c = t(B), u = t(I),
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4248
|
+
const r = t(V), c = t(B), u = t(I), l = new ur(t(V), u.root);
|
|
4249
|
+
l.screenSpacePanning = !1, l.minDistance = 0.1, l.maxDistance = 6e4, l.maxPolarAngle = 1.2, l.enableDamping = !0, l.dampingFactor = 0.07, l.zoomToCursor = !0;
|
|
4250
|
+
const d = new C(-2e4, 0.3, -6e4), h = new C(5e4, 6e4, 0), f = new C();
|
|
4251
|
+
return l.addEventListener("change", () => {
|
|
4252
|
+
const p = Math.max(l.getPolarAngle(), 0.1), m = Math.max(l.getDistance(), 0.1);
|
|
4253
|
+
l.zoomSpeed = Math.max(Math.log(m), 0) + 0.5, r.far = be.clamp(m / p * 8, 100, 1e5), r.near = r.far / 1e3, r.updateProjectionMatrix(), c.fog instanceof ai && (c.fog.density = p / (m + 5) * 1 * 0.25), l.maxPolarAngle = Math.min(Math.pow(1e4 / m, 4), 1.2), f.copy(l.target), l.target.clamp(d, h), f.sub(l.target), r.position.sub(f);
|
|
4254
|
+
}), e(Y, () => l), e(ft, () => r.fov), e(Be, (p = !1) => p ? r.position.clone() : r.position), e(Ce, (p = !1) => p ? l.target.clone() : l.target), e(Ne, (p = !1) => p ? r.up.clone() : r.up), l;
|
|
4253
4255
|
}), e(Xs, () => {
|
|
4254
4256
|
const s = new Sa(16777215, 1);
|
|
4255
4257
|
return s.position.set(0, 2e3, 1e3), s;
|
|
@@ -4288,7 +4290,7 @@ function Ir(i) {
|
|
|
4288
4290
|
if (!x || !x.visible) return a.clear();
|
|
4289
4291
|
if (a.has("KeyX")) {
|
|
4290
4292
|
const w = be.degToRad(0.1);
|
|
4291
|
-
x.rotateOnAxis(new
|
|
4293
|
+
x.rotateOnAxis(new C(1, 0, 0), w);
|
|
4292
4294
|
} else
|
|
4293
4295
|
x.scale.set(x.scale.x + 0.01, x.scale.y + 0.01, x.scale.z + 0.01);
|
|
4294
4296
|
} else if (a.has("Minus")) {
|
|
@@ -4296,7 +4298,7 @@ function Ir(i) {
|
|
|
4296
4298
|
if (!x || !x.visible) return a.clear();
|
|
4297
4299
|
if (a.has("KeyX")) {
|
|
4298
4300
|
const w = be.degToRad(-0.1);
|
|
4299
|
-
x.rotateOnAxis(new
|
|
4301
|
+
x.rotateOnAxis(new C(1, 0, 0), w);
|
|
4300
4302
|
} else
|
|
4301
4303
|
x.scale.set(x.scale.x - 0.01, x.scale.y - 0.01, x.scale.z - 0.01);
|
|
4302
4304
|
} else if (a.has("ArrowUp")) {
|
|
@@ -4325,20 +4327,20 @@ function Ir(i) {
|
|
|
4325
4327
|
b.target.type !== "text" && (o || a.clear());
|
|
4326
4328
|
}, u = () => {
|
|
4327
4329
|
a.clear();
|
|
4328
|
-
},
|
|
4330
|
+
}, l = (b) => {
|
|
4329
4331
|
parent && setTimeout(() => window.focus()), b.preventDefault();
|
|
4330
|
-
},
|
|
4332
|
+
}, d = async (b) => {
|
|
4331
4333
|
b.preventDefault();
|
|
4332
4334
|
};
|
|
4333
|
-
let h, f, p,
|
|
4335
|
+
let h, f, p, m;
|
|
4334
4336
|
e(qe, () => {
|
|
4335
|
-
h?.dispose(), f?.dispose(), p?.dispose(),
|
|
4337
|
+
h?.dispose(), f?.dispose(), p?.dispose(), m?.dispose(), h = null, f = null, p = null, m = null, s.lastMovePoint = null, t(Te);
|
|
4336
4338
|
});
|
|
4337
4339
|
const g = async (b) => {
|
|
4338
4340
|
parent && setTimeout(() => window.focus()), b.preventDefault(), !o && (s.down = b.button === 2 ? 2 : 1, s.move = !1, s.isDbClick = Date.now() - s.downTime < 300, s.downTime = Date.now());
|
|
4339
|
-
},
|
|
4341
|
+
}, y = async (b) => {
|
|
4340
4342
|
b.preventDefault(), !o && s.down && (s.move = !0);
|
|
4341
|
-
},
|
|
4343
|
+
}, M = async (b) => {
|
|
4342
4344
|
b.preventDefault(), !o && (s.down = 0, s.move = !1);
|
|
4343
4345
|
};
|
|
4344
4346
|
function S(b) {
|
|
@@ -4350,8 +4352,8 @@ function Ir(i) {
|
|
|
4350
4352
|
function k(b) {
|
|
4351
4353
|
s.down === 1 && !s.move && t(it, s.x, s.y);
|
|
4352
4354
|
}
|
|
4353
|
-
window.addEventListener("keydown", r), window.addEventListener("keyup", c), window.addEventListener("blur", u), window.addEventListener("wheel",
|
|
4354
|
-
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", c), window.removeEventListener("blur", u), window.removeEventListener("wheel",
|
|
4355
|
+
window.addEventListener("keydown", r), window.addEventListener("keyup", c), window.addEventListener("blur", u), window.addEventListener("wheel", l, { passive: !1 }), n.addEventListener("contextmenu", d), n.addEventListener("mousedown", g), n.addEventListener("mousemove", y), n.addEventListener("mouseup", M), n.addEventListener("touchstart", S, { passive: !1 }), n.addEventListener("touchmove", v, { passive: !1 }), n.addEventListener("touchend", k, { passive: !1 }), e(Fn, () => {
|
|
4356
|
+
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", c), window.removeEventListener("blur", u), window.removeEventListener("wheel", l), n.removeEventListener("contextmenu", d), n.removeEventListener("mousedown", g), n.removeEventListener("mousemove", y), n.removeEventListener("mouseup", M), n.removeEventListener("touchstart", S), n.removeEventListener("touchmove", v), n.removeEventListener("touchend", k);
|
|
4355
4357
|
}), e(it, async (b, x) => await t(Ft, b, x));
|
|
4356
4358
|
}
|
|
4357
4359
|
var Ge = Object.freeze({
|
|
@@ -4607,38 +4609,38 @@ var Ge = Object.freeze({
|
|
|
4607
4609
|
return this.start(e, !0);
|
|
4608
4610
|
}, i.prototype._setupProperties = function(e, t, n, a, o) {
|
|
4609
4611
|
for (var s in n) {
|
|
4610
|
-
var r = e[s], c = Array.isArray(r), u = c ? "array" : typeof r,
|
|
4612
|
+
var r = e[s], c = Array.isArray(r), u = c ? "array" : typeof r, l = !c && Array.isArray(n[s]);
|
|
4611
4613
|
if (!(u === "undefined" || u === "function")) {
|
|
4612
|
-
if (
|
|
4613
|
-
var
|
|
4614
|
-
if (
|
|
4614
|
+
if (l) {
|
|
4615
|
+
var d = n[s];
|
|
4616
|
+
if (d.length === 0)
|
|
4615
4617
|
continue;
|
|
4616
|
-
for (var h = [r], f = 0, p =
|
|
4617
|
-
var
|
|
4618
|
-
if (isNaN(
|
|
4619
|
-
|
|
4618
|
+
for (var h = [r], f = 0, p = d.length; f < p; f += 1) {
|
|
4619
|
+
var m = this._handleRelativeValue(r, d[f]);
|
|
4620
|
+
if (isNaN(m)) {
|
|
4621
|
+
l = !1, console.warn("Found invalid interpolation list. Skipping.");
|
|
4620
4622
|
break;
|
|
4621
4623
|
}
|
|
4622
|
-
h.push(
|
|
4624
|
+
h.push(m);
|
|
4623
4625
|
}
|
|
4624
|
-
|
|
4626
|
+
l && (n[s] = h);
|
|
4625
4627
|
}
|
|
4626
|
-
if ((u === "object" || c) && r && !
|
|
4628
|
+
if ((u === "object" || c) && r && !l) {
|
|
4627
4629
|
t[s] = c ? [] : {};
|
|
4628
4630
|
var g = r;
|
|
4629
|
-
for (var
|
|
4630
|
-
t[s][
|
|
4631
|
+
for (var y in g)
|
|
4632
|
+
t[s][y] = g[y];
|
|
4631
4633
|
a[s] = c ? [] : {};
|
|
4632
|
-
var
|
|
4634
|
+
var d = n[s];
|
|
4633
4635
|
if (!this._isDynamic) {
|
|
4634
|
-
var
|
|
4635
|
-
for (var
|
|
4636
|
-
|
|
4637
|
-
n[s] =
|
|
4636
|
+
var M = {};
|
|
4637
|
+
for (var y in d)
|
|
4638
|
+
M[y] = d[y];
|
|
4639
|
+
n[s] = d = M;
|
|
4638
4640
|
}
|
|
4639
|
-
this._setupProperties(g, t[s],
|
|
4641
|
+
this._setupProperties(g, t[s], d, a[s], o);
|
|
4640
4642
|
} else
|
|
4641
|
-
(typeof t[s] > "u" || o) && (t[s] = r), c || (t[s] *= 1),
|
|
4643
|
+
(typeof t[s] > "u" || o) && (t[s] = r), c || (t[s] *= 1), l ? a[s] = n[s].slice().reverse() : a[s] = t[s] || 0;
|
|
4642
4644
|
}
|
|
4643
4645
|
}
|
|
4644
4646
|
}, i.prototype.stop = function() {
|
|
@@ -4702,10 +4704,10 @@ var Ge = Object.freeze({
|
|
|
4702
4704
|
var s = e - this._startTime, r = this._duration + ((a = this._repeatDelayTime) !== null && a !== void 0 ? a : this._delayTime), c = this._duration + this._repeat * r, u = function() {
|
|
4703
4705
|
if (n._duration === 0 || s > c)
|
|
4704
4706
|
return 1;
|
|
4705
|
-
var
|
|
4706
|
-
return
|
|
4707
|
-
},
|
|
4708
|
-
if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd,
|
|
4707
|
+
var m = Math.trunc(s / r), g = s - m * r, y = Math.min(g / n._duration, 1);
|
|
4708
|
+
return y === 0 && s === n._duration ? 1 : y;
|
|
4709
|
+
}, l = u(), d = this._easingFunction(l);
|
|
4710
|
+
if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd, d), this._onUpdateCallback && this._onUpdateCallback(this._object, l), this._duration === 0 || s >= this._duration)
|
|
4709
4711
|
if (this._repeat > 0) {
|
|
4710
4712
|
var h = Math.min(Math.trunc((s - this._duration) / r) + 1, this._repeat);
|
|
4711
4713
|
isFinite(this._repeat) && (this._repeat -= h);
|
|
@@ -4724,8 +4726,8 @@ var Ge = Object.freeze({
|
|
|
4724
4726
|
}, i.prototype._updateProperties = function(e, t, n, a) {
|
|
4725
4727
|
for (var o in n)
|
|
4726
4728
|
if (t[o] !== void 0) {
|
|
4727
|
-
var s = t[o] || 0, r = n[o], c = Array.isArray(e[o]), u = Array.isArray(r),
|
|
4728
|
-
|
|
4729
|
+
var s = t[o] || 0, r = n[o], c = Array.isArray(e[o]), u = Array.isArray(r), l = !c && u;
|
|
4730
|
+
l ? e[o] = this._interpolationFunction(r, a) : typeof r == "object" && r ? this._updateProperties(e[o], s, r, a) : (r = this._handleRelativeValue(s, r), typeof r == "number" && (e[o] = s + (r - s) * a));
|
|
4729
4731
|
}
|
|
4730
4732
|
}, i.prototype._handleRelativeValue = function(e, t) {
|
|
4731
4733
|
return typeof t != "string" ? t : t.charAt(0) === "+" || t.charAt(0) === "-" ? e + parseFloat(t) : parseFloat(t);
|
|
@@ -4754,11 +4756,11 @@ class Lr extends te {
|
|
|
4754
4756
|
if (r.transform)
|
|
4755
4757
|
c.fromArray(r.transform);
|
|
4756
4758
|
else if (r.WGS84) {
|
|
4757
|
-
const p = s.geo2world(new
|
|
4759
|
+
const p = s.geo2world(new C().fromArray(r.WGS84));
|
|
4758
4760
|
c.makeTranslation(p.x, p.y, p.z);
|
|
4759
4761
|
}
|
|
4760
4762
|
r.autoCut && (r.autoCut = Math.min(Math.max(r.autoCut, 1), 50));
|
|
4761
|
-
const u = r.autoCut && r.autoCut > 1,
|
|
4763
|
+
const u = r.autoCut && r.autoCut > 1, l = !1, d = !1, h = r.showWatermark !== !1, f = { renderer: n, scene: a, controls: o, pointcloudMode: l, bigSceneMode: u, matrix: c, showWatermark: h, depthTest: d };
|
|
4762
4764
|
f.maxRenderCountOfMobile ?? (f.maxRenderCountOfMobile = f.bigSceneMode ? 128 * 10240 : 400 * 1e4), f.maxRenderCountOfPc ?? (f.maxRenderCountOfPc = f.bigSceneMode ? 320 * 1e4 : 400 * 1e4), f.debugMode = this.mapViewer.events.fire(I).debugMode, t.opts = f, t.meta = r, a.add(t), t.initCSS3DSprite(f), t.applyMatrix4(c);
|
|
4763
4765
|
}).catch((r) => {
|
|
4764
4766
|
console.error(r.message);
|
|
@@ -4772,38 +4774,39 @@ class Lr extends te {
|
|
|
4772
4774
|
let a = null;
|
|
4773
4775
|
n.onclick = () => {
|
|
4774
4776
|
if (a) return;
|
|
4775
|
-
const
|
|
4776
|
-
a = new Pr(
|
|
4777
|
-
|
|
4778
|
-
r.object.position.set(h.x, p, h.z), r.target.set(h.tx, h.ty, h.tz);
|
|
4777
|
+
const r = e.controls, c = r.target.clone(), u = r.object.position.clone(), l = t.position.clone(), d = es ? 6 : 2, f = c.clone().sub(u).normalize().clone(), p = l.clone().sub(f.multiplyScalar(d)), m = { x: u.x, y: u.y, z: u.z, tx: c.x, ty: c.y, tz: c.z }, g = { x: p.x, y: p.y, z: p.z, tx: l.x, ty: l.y, tz: l.z };
|
|
4778
|
+
a = new Pr(m).to(g, 3e3), a.easing(Ge.Sinusoidal.InOut).start().onUpdate(() => {
|
|
4779
|
+
r.object.position.set(m.x, m.y, m.z), r.target.set(m.tx, m.ty, m.tz);
|
|
4779
4780
|
}).onComplete(() => {
|
|
4780
4781
|
a = null;
|
|
4781
4782
|
});
|
|
4782
|
-
}, n.oncontextmenu = (
|
|
4783
|
+
}, n.oncontextmenu = (r) => r.preventDefault();
|
|
4783
4784
|
const o = new ie(n);
|
|
4784
|
-
o.element.style.pointerEvents = "none", o.visible = !1, o.applyMatrix4(e.matrix), t.css3dTag = o, e.scene.add(o)
|
|
4785
|
+
o.element.style.pointerEvents = "none", o.visible = !1, o.applyMatrix4(e.matrix), t.css3dTag = o, e.scene.add(o);
|
|
4786
|
+
const s = (r) => this.mapViewer.controls._onMouseWheel(r);
|
|
4787
|
+
n.addEventListener("wheel", s, { passive: !1 }), o.dispose = () => n.removeEventListener("wheel", s), t.onBeforeRender = () => {
|
|
4785
4788
|
a?.update();
|
|
4786
|
-
const
|
|
4787
|
-
if (
|
|
4789
|
+
const r = es ? 50 : 30, c = t.position.distanceTo(t.mapViewer.controls.object.position);
|
|
4790
|
+
if (c > r) {
|
|
4788
4791
|
t.css3dTag.visible = t.opts.controls.object.position.y > 2;
|
|
4789
|
-
let
|
|
4790
|
-
o.scale.set(
|
|
4792
|
+
let u = 2e-3 * c;
|
|
4793
|
+
o.scale.set(u, u, u), t.css3dTag.visible = !0, t.splatMesh && (t.splatMesh.visible = !1);
|
|
4791
4794
|
} else {
|
|
4792
4795
|
if (!t.active) {
|
|
4793
4796
|
t.splatMesh && (t.splatMesh.visible = !1);
|
|
4794
|
-
let
|
|
4795
|
-
o.scale.set(
|
|
4797
|
+
let u = 2e-3 * c;
|
|
4798
|
+
o.scale.set(u, u, u), t.css3dTag.visible = !0;
|
|
4796
4799
|
return;
|
|
4797
4800
|
}
|
|
4798
4801
|
if (t.lastActiveTime = Date.now(), t.css3dTag.visible = !1, t.splatMesh)
|
|
4799
4802
|
t.splatMesh.visible = !0;
|
|
4800
4803
|
else {
|
|
4801
|
-
const
|
|
4802
|
-
|
|
4803
|
-
const d = new pe(
|
|
4804
|
-
t.splatMesh = d, t.opts.scene.add(d), d.applyMatrix4(t.opts.matrix), d.meta =
|
|
4805
|
-
const
|
|
4806
|
-
|
|
4804
|
+
const u = t.meta, l = { ...t.opts };
|
|
4805
|
+
u.autoCut && (l.bigSceneMode = !0);
|
|
4806
|
+
const d = new pe(l);
|
|
4807
|
+
t.splatMesh = d, t.opts.scene.add(d), d.applyMatrix4(t.opts.matrix), d.meta = u;
|
|
4808
|
+
const h = u.watermark || u.name || "";
|
|
4809
|
+
u.showWatermark = u.showWatermark !== !1, d.fire(Hn, h, !0, !1), d.addModel({ url: t.meta.url }, t.meta);
|
|
4807
4810
|
}
|
|
4808
4811
|
}
|
|
4809
4812
|
}, t.onAfterRender = () => {
|
|
@@ -4867,7 +4870,7 @@ class Ur extends ba {
|
|
|
4867
4870
|
addScenes(e) {
|
|
4868
4871
|
const t = this;
|
|
4869
4872
|
fetch(e, { mode: "cors", credentials: "omit", cache: "reload" }).then((n) => n.ok ? n.json() : {}).then((n) => {
|
|
4870
|
-
const a = new
|
|
4873
|
+
const a = new C().fromArray(n.position || [17e3, 3e4, -35e3]), o = new C().fromArray(n.lookAt || [17e3, 0, -35e3]);
|
|
4871
4874
|
t.controls.object.position.copy(a), t.controls.target.copy(o), t.dirLight.target.position.copy(o);
|
|
4872
4875
|
const s = /* @__PURE__ */ new Set();
|
|
4873
4876
|
for (let r of n.scenes)
|