iflow-engine-base 3.12.5 → 3.12.6
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/bim-engine-sdk.es.js +8 -8
- package/dist/bim-engine-sdk.umd.js +526 -526
- package/dist/chunks/{engine-2d-Bjr3p2Wy.js → engine-2d-Cb_4-hHf.js} +3 -3
- package/dist/chunks/{engine-3d-Cap1x_4_.js → engine-3d-x-tblBYc.js} +681 -657
- package/dist/chunks/{engine-720-CfHpVklG.js → engine-720-rdpq1r1y.js} +1 -1
- package/dist/chunks/{engine-gaussian-CIruC3PT.js → engine-gaussian-Bg0mf-XZ.js} +1 -1
- package/dist/chunks/{engine-gis-CXVisOHM.js → engine-gis-B4-BdA-v.js} +2 -2
- package/dist/chunks/{sdk-assets-D5UGR827.js → sdk-assets-CfzbAX4Q.js} +1 -1
- package/dist/chunks/{sdk-runtime-83EeZHe_.js → sdk-runtime-BNBo1yPN.js} +2 -2
- package/dist/chunks/{sdk-vendor-CvevZpJO.js → sdk-vendor-DEyo-iP-.js} +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { j as F, I as W, M as H, G as fe, t as st, u as
|
|
2
|
-
import { W as he, C as
|
|
3
|
-
import { r as J, g as
|
|
4
|
-
import { a as
|
|
5
|
-
import { L as
|
|
1
|
+
import { j as F, I as W, M as H, G as fe, t as st, u as ci, v as Ge, C as de, w as gs, x as wi, D as oe, T as We, i as Ke, y as fs, z as ot, n as xi, H as ft, O as Se, a as O, V as h, p as Sn, J as ys, W as bi, K as Ms, U as Ci, X as vs, Y as Je, b as K, Q as Ie, q as En, R as me, E as Xt, Z as Pn, r as N, _ as Ai, $ as ws, f as Qt, a0 as $t, a1 as Tn, a2 as _n, a3 as zt, a4 as xs, a5 as bs, a6 as Cs, a7 as Bi, a8 as zi, a9 as As, aa as Ss, d as In, ab as Dn, ac as Si, ad as Es, ae as Ln, B as pe, af as Ps, m as yt, ag as Ts, ah as _s, ai as Is, aj as Ds, ak as Ue, al as Rt, am as Q, h as ce, an as Ls, ao as lt, ap as Ot, aq as Ft, L as qe, o as xt, ar as ks, as as kn, k as hi, at as Bs, au as nt, av as zs, aw as Rs, ax as Bn, ay as zn, F as Ht, g as di, az as Os, aA as Ri, aB as Nt, s as Mt, aC as Fs, aD as Hs, aE as Oi, aF as Ns, aG as Fi, aH as Vs, aI as Us, aJ as Gs, aK as Ws, c as Ks, aL as qs, aM as js, l as Ys, aN as Xs, aO as Qs } from "./three-vendor-BL-jpeTM.js";
|
|
2
|
+
import { W as he, C as $s, b as Vt, B as Hi, g as ke, L as Zs, E as Js, r as eo } from "./sdk-runtime-BNBo1yPN.js";
|
|
3
|
+
import { r as J, g as to } from "./sdk-assets-CfzbAX4Q.js";
|
|
4
|
+
import { a as Ut, J as ui, c as io, b as no, P as Zt, q as so, k as oo, n as Ni, E as Vi, S as ro } from "./sdk-vendor-DEyo-iP-.js";
|
|
5
|
+
import { L as ao } from "./engine-2d-Cb_4-hHf.js";
|
|
6
6
|
var se = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.ModelPlaceSelected = "model-place-selected", a.ModelCalibrationChanged = "model-calibration-changed", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.ViewportResize = "viewport-resize", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(se || {});
|
|
7
|
-
class
|
|
7
|
+
class Jt extends Error {
|
|
8
8
|
constructor() {
|
|
9
9
|
super("模型对比已取消"), this.name = "ModelComparisonCancelledError";
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class lo {
|
|
13
13
|
constructor(e) {
|
|
14
14
|
this.engine = e;
|
|
15
15
|
}
|
|
@@ -59,7 +59,7 @@ class ao {
|
|
|
59
59
|
modifiedBox: s.modifiedBoxIds.slice(0, 10)
|
|
60
60
|
}), n.changeColor && this.applyColors(s, e), this.emit("completed", s), s;
|
|
61
61
|
} catch (s) {
|
|
62
|
-
if (s instanceof
|
|
62
|
+
if (s instanceof Jt) {
|
|
63
63
|
const o = this.createProgress(i, "cancelled", 0, 0, "模型对比已取消");
|
|
64
64
|
this.emit("progress", o), this.emit("cancelled", o);
|
|
65
65
|
} else {
|
|
@@ -194,7 +194,7 @@ class ao {
|
|
|
194
194
|
const l = () => {
|
|
195
195
|
o.off(se.LoadingCompleted, d), r != null && (clearTimeout(r), r = void 0), i.cancelWaiting === c && (i.cancelWaiting = void 0);
|
|
196
196
|
}, c = () => {
|
|
197
|
-
l(), s(new
|
|
197
|
+
l(), s(new Jt());
|
|
198
198
|
}, d = () => {
|
|
199
199
|
i.cancelled ? c() : this.isEngineReady(e) && (this.log(i, "普通构件加载就绪", { role: t, statuses: this.describeLoadStatuses(e) }), l(), n());
|
|
200
200
|
}, u = () => {
|
|
@@ -429,7 +429,7 @@ class ao {
|
|
|
429
429
|
}
|
|
430
430
|
throwIfCancelled(e) {
|
|
431
431
|
if (e.cancelled)
|
|
432
|
-
throw new
|
|
432
|
+
throw new Jt();
|
|
433
433
|
}
|
|
434
434
|
/** 分批让出浏览器主线程,保证页面能够绘制最新进度。 */
|
|
435
435
|
async yieldToBrowser() {
|
|
@@ -447,7 +447,7 @@ class ao {
|
|
|
447
447
|
});
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
const
|
|
450
|
+
const Ui = "bim-material-editor-style", Qe = [
|
|
451
451
|
"map",
|
|
452
452
|
"normalMap",
|
|
453
453
|
"roughnessMap",
|
|
@@ -456,7 +456,7 @@ const Vi = "bim-material-editor-style", Qe = [
|
|
|
456
456
|
"aoMap",
|
|
457
457
|
"bumpMap",
|
|
458
458
|
"emissiveMap"
|
|
459
|
-
],
|
|
459
|
+
], pi = {
|
|
460
460
|
map: "颜色贴图",
|
|
461
461
|
normalMap: "法线贴图",
|
|
462
462
|
roughnessMap: "粗糙贴图",
|
|
@@ -465,37 +465,37 @@ const Vi = "bim-material-editor-style", Qe = [
|
|
|
465
465
|
aoMap: "AO贴图",
|
|
466
466
|
bumpMap: "凹凸贴图",
|
|
467
467
|
emissiveMap: "自发光贴图"
|
|
468
|
-
},
|
|
469
|
-
function
|
|
468
|
+
}, mi = "__isModelUrlGroup", Gt = "__modelDepthBias", Rn = 4;
|
|
469
|
+
function On(a) {
|
|
470
470
|
return a.__modelGroupMap instanceof Map || (a.__modelGroupMap = /* @__PURE__ */ new Map()), a.__modelGroupMap;
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Fn(a) {
|
|
473
473
|
return a.__modelObjectIndexMap instanceof Map || (a.__modelObjectIndexMap = /* @__PURE__ */ new Map()), a.__modelObjectIndexMap;
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
a.url = e, a.name = e, a.userData = a.userData ?? {}, a.userData[
|
|
477
|
-
}
|
|
478
|
-
function Si(a, e) {
|
|
479
|
-
return a instanceof fe ? e == null ? a.userData?.[ui] === !0 : a.userData?.[ui] === !0 && a.url === e : !1;
|
|
475
|
+
function gi(a, e) {
|
|
476
|
+
a.url = e, a.name = e, a.userData = a.userData ?? {}, a.userData[mi] = !0;
|
|
480
477
|
}
|
|
481
478
|
function Ei(a, e) {
|
|
479
|
+
return a instanceof fe ? e == null ? a.userData?.[mi] === !0 : a.userData?.[mi] === !0 && a.url === e : !1;
|
|
480
|
+
}
|
|
481
|
+
function Pi(a, e) {
|
|
482
482
|
return a?.models?.find?.((t) => t?.url === e);
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function Wt(a, e, t) {
|
|
485
485
|
if (typeof t != "string" || t.length === 0)
|
|
486
486
|
return;
|
|
487
|
-
const i =
|
|
487
|
+
const i = Pi(a, e);
|
|
488
488
|
i != null && (Array.isArray(i.urls) || (i.urls = []), i.urls.includes(t) || i.urls.push(t));
|
|
489
489
|
}
|
|
490
490
|
function $e(a, e) {
|
|
491
|
-
const t =
|
|
491
|
+
const t = On(a), i = t.get(e);
|
|
492
492
|
if (i && i.parent != null)
|
|
493
493
|
return i;
|
|
494
|
-
const n =
|
|
494
|
+
const n = Pi(a, e);
|
|
495
495
|
if (n?.group instanceof fe && n.group.parent != null)
|
|
496
|
-
return
|
|
497
|
-
const s = a?.scene?.children?.find?.((o) => o instanceof fe ?
|
|
498
|
-
return s != null ? (
|
|
496
|
+
return gi(n.group, e), t.set(e, n.group), n.group;
|
|
497
|
+
const s = a?.scene?.children?.find?.((o) => o instanceof fe ? Ei(o, e) ? !0 : o.name === e && o.url === e : !1);
|
|
498
|
+
return s != null ? (gi(s, e), t.set(e, s), n != null && (n.group = s), s) : null;
|
|
499
499
|
}
|
|
500
500
|
function He(a, e) {
|
|
501
501
|
const t = $e(a, e);
|
|
@@ -506,11 +506,11 @@ function rt(a, e) {
|
|
|
506
506
|
if (t != null)
|
|
507
507
|
return t;
|
|
508
508
|
const i = new fe();
|
|
509
|
-
|
|
510
|
-
const s =
|
|
509
|
+
gi(i, e), a.scene.add(i), On(a).set(e, i);
|
|
510
|
+
const s = Pi(a, e);
|
|
511
511
|
return s != null && (s.group = i), i;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function co(a) {
|
|
514
514
|
const e = [], t = /* @__PURE__ */ new Set();
|
|
515
515
|
return (Array.isArray(a?.models) ? a.models : []).forEach((n) => {
|
|
516
516
|
if (n?.url == null)
|
|
@@ -518,12 +518,12 @@ function lo(a) {
|
|
|
518
518
|
const s = $e(a, n.url);
|
|
519
519
|
s == null || t.has(s.uuid) || (t.add(s.uuid), e.push(s));
|
|
520
520
|
}), a?.scene?.children?.forEach?.((n) => {
|
|
521
|
-
!
|
|
521
|
+
!Ei(n) || t.has(n.uuid) || (t.add(n.uuid), e.push(n));
|
|
522
522
|
}), e;
|
|
523
523
|
}
|
|
524
524
|
function vt(a, e) {
|
|
525
525
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
526
|
-
return
|
|
526
|
+
return co(a).forEach((s) => {
|
|
527
527
|
s.traverse((o) => {
|
|
528
528
|
o === s || i.has(o.uuid) || e(o) && (i.add(o.uuid), t.push(o));
|
|
529
529
|
});
|
|
@@ -531,16 +531,16 @@ function vt(a, e) {
|
|
|
531
531
|
if (s.name == "highlightModel")
|
|
532
532
|
i.add(s.uuid), t.push(s);
|
|
533
533
|
else {
|
|
534
|
-
if (i.has(s.uuid) ||
|
|
534
|
+
if (i.has(s.uuid) || Ei(s) || s.url == null)
|
|
535
535
|
return;
|
|
536
536
|
e(s) && (i.add(s.uuid), t.push(s));
|
|
537
537
|
}
|
|
538
538
|
}), t;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Ti(a) {
|
|
541
541
|
return vt(a, (e) => e instanceof F && !(e instanceof W));
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function ho(a) {
|
|
544
544
|
if (typeof a.__modelObjectIndexSeed == "number")
|
|
545
545
|
return;
|
|
546
546
|
let e = -1;
|
|
@@ -548,55 +548,55 @@ function co(a) {
|
|
|
548
548
|
typeof t?.index == "number" && Number.isFinite(t.index) && (e = Math.max(e, t.index));
|
|
549
549
|
}), a.__modelObjectIndexSeed = e + 1;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
551
|
+
function uo(a) {
|
|
552
|
+
ho(a);
|
|
553
553
|
const e = a.__modelObjectIndexSeed;
|
|
554
554
|
return a.__modelObjectIndexSeed += 1, e;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
const i = typeof t == "number" ? t :
|
|
558
|
-
return e.index = i,
|
|
556
|
+
function _i(a, e, t) {
|
|
557
|
+
const i = typeof t == "number" ? t : uo(a);
|
|
558
|
+
return e.index = i, Fn(a).set(i, e), i;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Hn(a) {
|
|
561
561
|
return Array.isArray(a) ? a : a != null ? [a] : [];
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function po(a) {
|
|
564
564
|
return 1 + (Number.isFinite(a) ? Math.abs(Math.floor(a)) : 0) % 16 * 0.125;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
const t = typeof e == "number" ? e : a?.index, i =
|
|
568
|
-
|
|
566
|
+
function Ii(a, e) {
|
|
567
|
+
const t = typeof e == "number" ? e : a?.index, i = po(t);
|
|
568
|
+
Hn(a?.material).forEach((n) => {
|
|
569
569
|
n.userData = n.userData ?? {};
|
|
570
|
-
const s = n.userData[
|
|
571
|
-
n.userData[
|
|
570
|
+
const s = n.userData[Gt] ?? {};
|
|
571
|
+
n.userData[Gt] = {
|
|
572
572
|
...s,
|
|
573
573
|
enabled: !0,
|
|
574
574
|
factor: 1,
|
|
575
575
|
units: i
|
|
576
|
-
}, n.polygonOffset = !0, n.polygonOffsetFactor = 1, n.polygonOffsetUnits = i + (s.edgeActive ?
|
|
576
|
+
}, n.polygonOffset = !0, n.polygonOffsetFactor = 1, n.polygonOffsetUnits = i + (s.edgeActive ? Rn : 0), n.needsUpdate = !0;
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
|
|
579
|
+
function Gi(a, e) {
|
|
580
|
+
Hn(a?.material).forEach((t) => {
|
|
581
581
|
t.userData = t.userData ?? {};
|
|
582
|
-
const i = t.userData[
|
|
583
|
-
t.userData[
|
|
582
|
+
const i = t.userData[Gt] ?? {}, n = i.enabled ? i.units : t.polygonOffsetUnits ?? 0, s = i.enabled ? i.factor : t.polygonOffsetFactor ?? 1;
|
|
583
|
+
t.userData[Gt] = {
|
|
584
584
|
...i,
|
|
585
585
|
edgeActive: e
|
|
586
|
-
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ?
|
|
586
|
+
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? Rn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
function Fe(a, e) {
|
|
590
590
|
if (!Number.isFinite(e))
|
|
591
591
|
return;
|
|
592
|
-
const t =
|
|
592
|
+
const t = Fn(a), i = t.get(e);
|
|
593
593
|
if (i && i.parent != null)
|
|
594
594
|
return i;
|
|
595
595
|
i && i.parent == null && t.delete(e);
|
|
596
596
|
const n = vt(a, (s) => s.index === e)[0];
|
|
597
597
|
return n != null ? (t.set(e, n), n) : a?.scene?.children?.find?.((s) => s?.index === e);
|
|
598
598
|
}
|
|
599
|
-
class
|
|
599
|
+
class mo {
|
|
600
600
|
constructor(e) {
|
|
601
601
|
this.engine = e;
|
|
602
602
|
}
|
|
@@ -638,7 +638,7 @@ class po {
|
|
|
638
638
|
if (e.name === "highlightModel" || e.name === "translucentModel")
|
|
639
639
|
return [];
|
|
640
640
|
const t = e.material;
|
|
641
|
-
return Array.isArray(t) ? t.filter((i) => i instanceof
|
|
641
|
+
return Array.isArray(t) ? t.filter((i) => i instanceof ci && this.isEditableMaterial(i)) : t instanceof ci && this.isEditableMaterial(t) ? [t] : [];
|
|
642
642
|
}
|
|
643
643
|
isEditableMaterial(e) {
|
|
644
644
|
const t = this.engine.modelToolModule;
|
|
@@ -655,7 +655,7 @@ class po {
|
|
|
655
655
|
e.set(t.uuid, { material: t, owners: [...i] });
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Kt(a) {
|
|
659
659
|
if (!(a instanceof Ge))
|
|
660
660
|
return "";
|
|
661
661
|
const e = a.userData?.sourceUrl;
|
|
@@ -679,10 +679,10 @@ function Wt(a) {
|
|
|
679
679
|
}
|
|
680
680
|
return t?.currentSrc || t?.src || "";
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function ei(a) {
|
|
683
683
|
return a.map((e) => e.name || e.url || e.type || e.uuid).filter((e, t, i) => e.length > 0 && i.indexOf(e) === t);
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Nn(a) {
|
|
686
686
|
const e = {
|
|
687
687
|
name: a.name,
|
|
688
688
|
opacity: a.opacity,
|
|
@@ -700,9 +700,9 @@ function Hn(a) {
|
|
|
700
700
|
}), e;
|
|
701
701
|
}
|
|
702
702
|
function ut(a) {
|
|
703
|
-
return a instanceof Ge ?
|
|
703
|
+
return a instanceof Ge ? Kt(a) || a.uuid : a;
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function go(a) {
|
|
706
706
|
const e = a, t = {
|
|
707
707
|
type: a.type,
|
|
708
708
|
name: a.name || a.type,
|
|
@@ -718,8 +718,8 @@ function mo(a) {
|
|
|
718
718
|
i in e && (t[i] = ut(e[i]) ?? null);
|
|
719
719
|
}), JSON.stringify(t);
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
const t =
|
|
721
|
+
function fo(a, e) {
|
|
722
|
+
const t = Nn(a), i = {};
|
|
723
723
|
return Object.entries(e.values).forEach(([n, s]) => {
|
|
724
724
|
const o = t[n];
|
|
725
725
|
ut(s) !== ut(o) && (i[n] = {
|
|
@@ -728,7 +728,7 @@ function go(a, e) {
|
|
|
728
728
|
});
|
|
729
729
|
}), i;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function Vn(a, e, t) {
|
|
732
732
|
const i = a;
|
|
733
733
|
if ((e === "color" || e === "emissive") && i[e] instanceof de && typeof t == "string") {
|
|
734
734
|
i[e].set(t);
|
|
@@ -757,13 +757,13 @@ function St(a) {
|
|
|
757
757
|
wireframe: typeof e.wireframe == "boolean" ? e.wireframe : void 0,
|
|
758
758
|
textures: Qe.filter((t) => t in e).map((t) => ({
|
|
759
759
|
slot: t,
|
|
760
|
-
name:
|
|
761
|
-
url:
|
|
760
|
+
name: pi[t],
|
|
761
|
+
url: Kt(e[t]),
|
|
762
762
|
hasTexture: e[t] instanceof Ge
|
|
763
763
|
}))
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
|
-
class
|
|
766
|
+
class yo {
|
|
767
767
|
constructor(e, t) {
|
|
768
768
|
this.engine = e, this.host = t;
|
|
769
769
|
}
|
|
@@ -864,8 +864,8 @@ class fo {
|
|
|
864
864
|
t.appendChild(this.createElement("div", "bim-material-editor__section-title", "贴图"));
|
|
865
865
|
const i = e;
|
|
866
866
|
return Qe.filter((n) => n in i).forEach((n) => {
|
|
867
|
-
const s = this.createElement("div", "bim-material-editor__texture-row"), o = this.createElement("label", "",
|
|
868
|
-
r.type = "text", r.placeholder = "输入贴图 URL", r.value =
|
|
867
|
+
const s = this.createElement("div", "bim-material-editor__texture-row"), o = this.createElement("label", "", pi[n]), r = document.createElement("input");
|
|
868
|
+
r.type = "text", r.placeholder = "输入贴图 URL", r.value = Kt(i[n]), r.addEventListener("change", () => {
|
|
869
869
|
this.host.setTexture(e.uuid, n, r.value.trim() || null);
|
|
870
870
|
});
|
|
871
871
|
const l = document.createElement("input");
|
|
@@ -873,7 +873,7 @@ class fo {
|
|
|
873
873
|
const d = l.files?.[0];
|
|
874
874
|
d != null && this.host.setTexture(e.uuid, n, d);
|
|
875
875
|
});
|
|
876
|
-
const c = this.createButton("清除", `清除${
|
|
876
|
+
const c = this.createButton("清除", `清除${pi[n]}`, () => {
|
|
877
877
|
r.value = "", this.host.setTexture(e.uuid, n, null);
|
|
878
878
|
});
|
|
879
879
|
s.append(o, r, l, c), t.appendChild(s);
|
|
@@ -881,7 +881,7 @@ class fo {
|
|
|
881
881
|
}
|
|
882
882
|
/** 材质卡片预览优先显示贴图,没有贴图时用材质颜色兜底。 */
|
|
883
883
|
createMaterialPreview(e) {
|
|
884
|
-
const t = this.createElement("div", "bim-material-editor__material-preview"), i = e, n = i.map instanceof Ge ? i.map : Qe.map((r) => i[r]).find((r) => r instanceof Ge), s =
|
|
884
|
+
const t = this.createElement("div", "bim-material-editor__material-preview"), i = e, n = i.map instanceof Ge ? i.map : Qe.map((r) => i[r]).find((r) => r instanceof Ge), s = Kt(n);
|
|
885
885
|
if (s)
|
|
886
886
|
return t.style.backgroundImage = `url(${JSON.stringify(s)})`, t.classList.add("has-texture"), t;
|
|
887
887
|
const o = i.color instanceof de ? `#${i.color.getHexString()}` : "#c7ced8";
|
|
@@ -917,8 +917,8 @@ class fo {
|
|
|
917
917
|
createSideSelect(e, t) {
|
|
918
918
|
const i = this.createElement("div", "bim-material-editor__row"), n = document.createElement("select");
|
|
919
919
|
return [
|
|
920
|
-
{ label: "正面", value:
|
|
921
|
-
{ label: "背面", value:
|
|
920
|
+
{ label: "正面", value: gs },
|
|
921
|
+
{ label: "背面", value: wi },
|
|
922
922
|
{ label: "双面", value: oe }
|
|
923
923
|
].forEach((s) => {
|
|
924
924
|
const o = document.createElement("option");
|
|
@@ -934,10 +934,10 @@ class fo {
|
|
|
934
934
|
return t && (n.className = t), i && (n.textContent = i), n;
|
|
935
935
|
}
|
|
936
936
|
ensureStyle() {
|
|
937
|
-
if (document.getElementById(
|
|
937
|
+
if (document.getElementById(Ui) != null)
|
|
938
938
|
return;
|
|
939
939
|
const e = document.createElement("style");
|
|
940
|
-
e.id =
|
|
940
|
+
e.id = Ui, e.textContent = `
|
|
941
941
|
.bim-material-editor{position:absolute;right:0;top:0;bottom:0;z-index:1005;height:100%;max-height:100%;display:grid;grid-template-rows:auto auto auto auto minmax(0,1fr) auto;gap:8px;padding:12px;background:#f7f9fc;color:#1b2430;border-left:1px solid #d7dde8;box-shadow:-8px 0 24px rgba(20,30,45,.16);font:13px/1.4 Arial,"Microsoft YaHei",sans-serif;box-sizing:border-box;overflow:hidden}
|
|
942
942
|
.bim-material-editor *{box-sizing:border-box}
|
|
943
943
|
.bim-material-editor__header{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
@@ -970,7 +970,7 @@ class fo {
|
|
|
970
970
|
`, document.head.appendChild(e);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
class
|
|
973
|
+
class Mo {
|
|
974
974
|
constructor(e) {
|
|
975
975
|
this.collectSceneMaterials = e;
|
|
976
976
|
}
|
|
@@ -981,7 +981,7 @@ class yo {
|
|
|
981
981
|
ensure(e, t = []) {
|
|
982
982
|
const i = this.baselineSnapshots.get(e.uuid);
|
|
983
983
|
if (i != null) {
|
|
984
|
-
|
|
984
|
+
ei(t).forEach((n) => {
|
|
985
985
|
i.objectNames.includes(n) || i.objectNames.push(n);
|
|
986
986
|
});
|
|
987
987
|
return;
|
|
@@ -990,8 +990,8 @@ class yo {
|
|
|
990
990
|
id: e.uuid,
|
|
991
991
|
name: e.name,
|
|
992
992
|
type: e.type,
|
|
993
|
-
objectNames:
|
|
994
|
-
values:
|
|
993
|
+
objectNames: ei(t),
|
|
994
|
+
values: Nn(e)
|
|
995
995
|
});
|
|
996
996
|
}
|
|
997
997
|
getModifiedMaterials() {
|
|
@@ -1001,12 +1001,12 @@ class yo {
|
|
|
1001
1001
|
const i = this.baselineSnapshots.get(t.material.uuid);
|
|
1002
1002
|
if (i == null)
|
|
1003
1003
|
return;
|
|
1004
|
-
const n =
|
|
1004
|
+
const n = fo(t.material, i);
|
|
1005
1005
|
Object.keys(n).length !== 0 && e.push({
|
|
1006
1006
|
id: t.material.uuid,
|
|
1007
1007
|
name: t.material.name || i.name,
|
|
1008
1008
|
type: t.material.type,
|
|
1009
|
-
objectNames:
|
|
1009
|
+
objectNames: ei(t.owners),
|
|
1010
1010
|
changes: n
|
|
1011
1011
|
});
|
|
1012
1012
|
}), e;
|
|
@@ -1014,17 +1014,17 @@ class yo {
|
|
|
1014
1014
|
restore(e) {
|
|
1015
1015
|
const t = this.baselineSnapshots.get(e.uuid);
|
|
1016
1016
|
return t == null ? !1 : (Object.entries(t.values).forEach(([i, n]) => {
|
|
1017
|
-
|
|
1017
|
+
Vn(e, i, n);
|
|
1018
1018
|
}), e.needsUpdate = !0, !0);
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
|
-
class
|
|
1021
|
+
class vo {
|
|
1022
1022
|
constructor(e, t = {}) {
|
|
1023
1023
|
this.engine = e, this.options = {
|
|
1024
1024
|
visible: t.visible ?? !1,
|
|
1025
1025
|
title: t.title ?? "材质编辑器",
|
|
1026
1026
|
width: t.width ?? 340
|
|
1027
|
-
}, this.visible = this.options.visible, this.collector = new
|
|
1027
|
+
}, this.visible = this.options.visible, this.collector = new mo(e), this.snapshots = new Mo(() => this.collectSceneMaterials()), this.panel = new yo(e, this);
|
|
1028
1028
|
}
|
|
1029
1029
|
options;
|
|
1030
1030
|
selectedMaterials = [];
|
|
@@ -1107,7 +1107,7 @@ class Mo {
|
|
|
1107
1107
|
const i = this.findMaterialGroupById(e);
|
|
1108
1108
|
i.length !== 0 && (i.forEach((n) => {
|
|
1109
1109
|
this.snapshots.ensure(n, this.collector.findOwners(n)), Object.entries(t).forEach(([s, o]) => {
|
|
1110
|
-
|
|
1110
|
+
Vn(n, s, o);
|
|
1111
1111
|
}), n.needsUpdate = !0;
|
|
1112
1112
|
}), this.requestRender(), this.render());
|
|
1113
1113
|
}
|
|
@@ -1166,7 +1166,7 @@ class Mo {
|
|
|
1166
1166
|
dedupeMaterials(e) {
|
|
1167
1167
|
const t = /* @__PURE__ */ new Map();
|
|
1168
1168
|
return e.forEach((i) => {
|
|
1169
|
-
const n =
|
|
1169
|
+
const n = go(i.material), s = t.get(n);
|
|
1170
1170
|
if (s == null) {
|
|
1171
1171
|
t.set(n, { material: i.material, materials: [i.material], owners: [...i.owners] });
|
|
1172
1172
|
return;
|
|
@@ -1192,7 +1192,7 @@ class Mo {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
replaceTexture(e, t, i) {
|
|
1194
1194
|
const n = e, s = n[t];
|
|
1195
|
-
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? Ke :
|
|
1195
|
+
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? Ke : fs, i.wrapS = ot, i.wrapT = ot, i.needsUpdate = !0, this.ownedTextures.add(i)), n[t] = i, e.needsUpdate = !0, this.requestRender();
|
|
1196
1196
|
}
|
|
1197
1197
|
loadTexture(e) {
|
|
1198
1198
|
return new Promise((t, i) => {
|
|
@@ -1206,11 +1206,11 @@ class Mo {
|
|
|
1206
1206
|
this.ownedTextures.forEach((e) => e.dispose()), this.ownedTextures.clear();
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
|
-
class
|
|
1209
|
+
class wo {
|
|
1210
1210
|
engine;
|
|
1211
1211
|
scene;
|
|
1212
1212
|
constructor(e) {
|
|
1213
|
-
this.engine = e, this.scene = new
|
|
1213
|
+
this.engine = e, this.scene = new xi();
|
|
1214
1214
|
let t = new fe();
|
|
1215
1215
|
t.name = "groupEdge", this.scene.add(t);
|
|
1216
1216
|
}
|
|
@@ -1490,7 +1490,7 @@ class re {
|
|
|
1490
1490
|
l && (i || (i = this.getStableCameraUp(n)), l.position.copy(r), l.up.copy(i), this.engine.controls?.target && this.engine.controls.target.copy(s), typeof this.engine.controls?.setScreenUp == "function" ? this.engine.controls.setScreenUp(i) : l.lookAt(s), this.engine.controls?.update && this.engine.controls.update(), l.updateMatrix(), l.updateMatrixWorld(!0));
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
|
-
class
|
|
1493
|
+
class xo {
|
|
1494
1494
|
engine;
|
|
1495
1495
|
deviceType;
|
|
1496
1496
|
constructor(e) {
|
|
@@ -1554,17 +1554,17 @@ class wo {
|
|
|
1554
1554
|
};
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
const
|
|
1558
|
-
class
|
|
1557
|
+
const Di = 1.1;
|
|
1558
|
+
class bo {
|
|
1559
1559
|
engine;
|
|
1560
1560
|
renderer;
|
|
1561
1561
|
watermark;
|
|
1562
1562
|
constructor(e) {
|
|
1563
|
-
this.engine = e, this.renderer = null, this.watermark = new
|
|
1563
|
+
this.engine = e, this.renderer = null, this.watermark = new $s(Sn);
|
|
1564
1564
|
}
|
|
1565
1565
|
createRenderer() {
|
|
1566
1566
|
const { width: e, height: t } = this.engine.deviceModule.getContainerSize();
|
|
1567
|
-
return
|
|
1567
|
+
return ys.enabled = !0, this.renderer = new bi({
|
|
1568
1568
|
// 原生 MSAA 主要覆盖非后处理路径;后处理链路的边缘由 composer 的 samples 和 FXAA 继续处理。
|
|
1569
1569
|
antialias: this.engine.options.antialias ?? !0,
|
|
1570
1570
|
alpha: !0,
|
|
@@ -1572,7 +1572,7 @@ class xo {
|
|
|
1572
1572
|
stencil: !0,
|
|
1573
1573
|
// 移动端放大镜需要从当前画布直接取样,保留 drawing buffer 避免读到黑屏。
|
|
1574
1574
|
preserveDrawingBuffer: !0
|
|
1575
|
-
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t, !1), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%", this.renderer.domElement.style.display = "block", this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type =
|
|
1575
|
+
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t, !1), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%", this.renderer.domElement.style.display = "block", this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = Ms, this.renderer.localClippingEnabled = !0, this.renderer.outputColorSpace = Ke, this.renderer.toneMapping = Ci, this.renderer.toneMappingExposure = Di, this.engine.container.appendChild(this.renderer.domElement), this.renderer;
|
|
1576
1576
|
}
|
|
1577
1577
|
disposeRenderer() {
|
|
1578
1578
|
this.watermark.dispose(), this.renderer?.dispose();
|
|
@@ -1584,14 +1584,14 @@ class xo {
|
|
|
1584
1584
|
this.renderer && this.watermark.render(this.renderer);
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
|
-
const
|
|
1587
|
+
const Co = { type: "change" }, Wi = { type: "start" }, Ki = { type: "end" }, X = 1e-6, ti = Math.PI * 2, ae = {
|
|
1588
1588
|
NONE: -1,
|
|
1589
1589
|
ROTATE: 0,
|
|
1590
1590
|
PAN: 1,
|
|
1591
1591
|
DOLLY: 2,
|
|
1592
1592
|
TOUCH_ROTATE: 3,
|
|
1593
1593
|
TOUCH_DOLLY_PAN: 4
|
|
1594
|
-
},
|
|
1594
|
+
}, ii = new h(1, 0, 0), Ao = new h(0, 1, 0), So = new h(0, 0, 1), et = new h(), Et = new h(), xe = new h(), j = new h(), Pe = new h(), le = new h(), Te = new h(), Eo = new h(), Pt = new Ie(), ni = new Ie(), qi = /* @__PURE__ */ new Set([
|
|
1595
1595
|
"KeyW",
|
|
1596
1596
|
"KeyA",
|
|
1597
1597
|
"KeyS",
|
|
@@ -1608,7 +1608,7 @@ const bo = { type: "change" }, Gi = { type: "start" }, Wi = { type: "end" }, X =
|
|
|
1608
1608
|
function Tt(a, e, t) {
|
|
1609
1609
|
return Math.max(e, Math.min(t, a));
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1611
|
+
function ji(a) {
|
|
1612
1612
|
return {
|
|
1613
1613
|
width: Math.max(a?.clientWidth || 1, 1),
|
|
1614
1614
|
height: Math.max(a?.clientHeight || 1, 1)
|
|
@@ -1617,11 +1617,11 @@ function qi(a) {
|
|
|
1617
1617
|
function Ve(a) {
|
|
1618
1618
|
return a && typeof a.x == "number" && typeof a.y == "number" && typeof a.z == "number";
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function Yi(a) {
|
|
1621
1621
|
const e = a?.tagName?.toLowerCase?.();
|
|
1622
1622
|
return a?.isContentEditable === !0 || e === "input" || e === "textarea" || e === "select";
|
|
1623
1623
|
}
|
|
1624
|
-
class
|
|
1624
|
+
class Un extends vs {
|
|
1625
1625
|
constructor(e, t, i = null) {
|
|
1626
1626
|
super(t, i), this.engine = e, this.target = new h(), this.origin = new h(), this.cursor = new h(), this.showOriginIcon = !0, this.auto = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.enableRotate = !0, this.enablePan = !0, this.enableZoom = !0, this.enableDamping = !1, this.rotateSpeed = 0.51, this.panSpeed = 1, this.zoomSpeed = 1, this.touchZoomSpeed = 1.35, this.dampingFactor = 0.08, this.keyRotateSpeed = 1, this.keyPanSpeed = 7, this.keyMoveSpeed = 0.5, this.keyMoveBoost = 2, this.keys = {
|
|
1627
1627
|
LEFT: "ArrowLeft",
|
|
@@ -1669,7 +1669,7 @@ class Vn extends Ms {
|
|
|
1669
1669
|
const i = typeof e == "number" ? e : null, n = typeof e == "boolean" ? e : !!t, s = this._applyPendingMotion(i);
|
|
1670
1670
|
this._alignCamera();
|
|
1671
1671
|
const o = n || s || this._hasCameraStateChanged();
|
|
1672
|
-
return o && (this.dispatchEvent(
|
|
1672
|
+
return o && (this.dispatchEvent(Co), this._rememberState()), o;
|
|
1673
1673
|
}
|
|
1674
1674
|
_applyPendingMotion(e) {
|
|
1675
1675
|
let t = !1;
|
|
@@ -1682,7 +1682,7 @@ class Vn extends Ms {
|
|
|
1682
1682
|
return Math.abs(s) > X && this.enableZoom && (this._applyZoom(s), t = !0), t;
|
|
1683
1683
|
}
|
|
1684
1684
|
_applyKeyboardMove(e) {
|
|
1685
|
-
if (!this.enabled || !this.object?.isPerspectiveCamera || this._pressedKeys.size === 0 || (Te.set(0, 0, 0), (this._pressedKeys.has("KeyW") || this._pressedKeys.has("ArrowUp")) && (Te.z += 1), (this._pressedKeys.has("KeyS") || this._pressedKeys.has("ArrowDown")) && (Te.z -= 1), (this._pressedKeys.has("KeyA") || this._pressedKeys.has("ArrowLeft")) && (Te.x -= 1), (this._pressedKeys.has("KeyD") || this._pressedKeys.has("ArrowRight")) && (Te.x += 1), this._pressedKeys.has("KeyQ") && (Te.y += 1), this._pressedKeys.has("KeyE") && (Te.y -= 1), Te.lengthSq() <= X) || (Te.normalize(), j.copy(
|
|
1685
|
+
if (!this.enabled || !this.object?.isPerspectiveCamera || this._pressedKeys.size === 0 || (Te.set(0, 0, 0), (this._pressedKeys.has("KeyW") || this._pressedKeys.has("ArrowUp")) && (Te.z += 1), (this._pressedKeys.has("KeyS") || this._pressedKeys.has("ArrowDown")) && (Te.z -= 1), (this._pressedKeys.has("KeyA") || this._pressedKeys.has("ArrowLeft")) && (Te.x -= 1), (this._pressedKeys.has("KeyD") || this._pressedKeys.has("ArrowRight")) && (Te.x += 1), this._pressedKeys.has("KeyQ") && (Te.y += 1), this._pressedKeys.has("KeyE") && (Te.y -= 1), Te.lengthSq() <= X) || (Te.normalize(), j.copy(ii).applyQuaternion(this.object.quaternion).normalize(), le.set(0, 0, -1).applyQuaternion(this.object.quaternion).normalize(), Pe.copy(this._referenceUp).normalize(), Pe.lengthSq() <= X && Pe.copy(this.object.up).normalize(), xe.set(0, 0, 0), xe.addScaledVector(j, Te.x), xe.addScaledVector(le, Te.z), xe.addScaledVector(Pe, Te.y), xe.lengthSq() <= X))
|
|
1686
1686
|
return !1;
|
|
1687
1687
|
xe.normalize();
|
|
1688
1688
|
const t = Number.isFinite(e) && e > 0 ? e : 1 / 60, i = Math.max(this.object.position.distanceTo(this.target), 1), n = this._pressedKeys.has("ShiftLeft") || this._pressedKeys.has("ShiftRight") ? this.keyMoveBoost : 1, s = Math.max(i * 0.8, 1) * this.keyMoveSpeed * t * n;
|
|
@@ -1723,11 +1723,11 @@ class Vn extends Ms {
|
|
|
1723
1723
|
}
|
|
1724
1724
|
_applyRotation(e, t) {
|
|
1725
1725
|
const i = this._getRotatePivot(), n = this.object.position;
|
|
1726
|
-
et.copy(n).sub(i), et.lengthSq() < X && et.set(0, 0, Math.max(this.minDistance, 1)), Et.copy(this.target).sub(i), le.copy(this.target).sub(n).normalize(), Math.abs(e) > X && (Pt.setFromAxisAngle(this._referenceUp, -e), et.applyQuaternion(Pt), Et.applyQuaternion(Pt), le.applyQuaternion(Pt).normalize()), j.copy(this._getStableRightAxis(le)), Math.abs(t) > X && j.lengthSq() > X && (
|
|
1726
|
+
et.copy(n).sub(i), et.lengthSq() < X && et.set(0, 0, Math.max(this.minDistance, 1)), Et.copy(this.target).sub(i), le.copy(this.target).sub(n).normalize(), Math.abs(e) > X && (Pt.setFromAxisAngle(this._referenceUp, -e), et.applyQuaternion(Pt), Et.applyQuaternion(Pt), le.applyQuaternion(Pt).normalize()), j.copy(this._getStableRightAxis(le)), Math.abs(t) > X && j.lengthSq() > X && (ni.setFromAxisAngle(j, -t), et.applyQuaternion(ni), Et.applyQuaternion(ni)), n.copy(i).add(et), this.target.copy(i).add(Et);
|
|
1727
1727
|
}
|
|
1728
1728
|
_applyPan(e, t) {
|
|
1729
|
-
const { width: i, height: n } =
|
|
1730
|
-
j.copy(
|
|
1729
|
+
const { width: i, height: n } = ji(this.domElement);
|
|
1730
|
+
j.copy(ii).applyQuaternion(this.object.quaternion).normalize(), Pe.copy(Ao).applyQuaternion(this.object.quaternion).normalize();
|
|
1731
1731
|
let s = 0, o = 0;
|
|
1732
1732
|
if (this.object.isPerspectiveCamera) {
|
|
1733
1733
|
const l = 2 * Math.max(this.object.position.distanceTo(this.target), X) * Math.tan(O.degToRad(this.object.getEffectiveFOV() * 0.5)), c = l * this.object.aspect;
|
|
@@ -1753,10 +1753,10 @@ class Vn extends Ms {
|
|
|
1753
1753
|
le.copy(this.target).sub(this.object.position), !(le.lengthSq() < X) && (le.normalize(), j.copy(this._getStableRightAxis(le)), Pe.crossVectors(j, le).normalize(), Pe.lengthSq() < X && Pe.copy(this._referenceUp), this._viewRight.copy(j), this.object.up.copy(Pe), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
1754
1754
|
}
|
|
1755
1755
|
_getStableRightAxis(e) {
|
|
1756
|
-
return j.crossVectors(e, this._referenceUp), j.lengthSq() < X && (j.copy(this._viewRight), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < X && (j.copy(
|
|
1756
|
+
return j.crossVectors(e, this._referenceUp), j.lengthSq() < X && (j.copy(this._viewRight), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < X && (j.copy(ii), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < X && (j.copy(So), j.addScaledVector(e, -j.dot(e))), j.normalize(), this._viewRight.lengthSq() > X && j.dot(this._viewRight) < 0 && j.negate(), j;
|
|
1757
1757
|
}
|
|
1758
1758
|
_getRotatePivot() {
|
|
1759
|
-
return Ve(this.origin) ? this.origin.distanceToSquared(this.target) < X ? this.target :
|
|
1759
|
+
return Ve(this.origin) ? this.origin.distanceToSquared(this.target) < X ? this.target : Eo.copy(this.origin) : this.target;
|
|
1760
1760
|
}
|
|
1761
1761
|
_hasCameraStateChanged() {
|
|
1762
1762
|
const e = this.object.isOrthographicCamera && Math.abs(this.object.zoom - this._lastZoom) > X;
|
|
@@ -1766,13 +1766,13 @@ class Vn extends Ms {
|
|
|
1766
1766
|
this._lastPosition.copy(this.object.position), this._lastTarget.copy(this.target), this._lastUp.copy(this.object.up), this._lastQuaternion.copy(this.object.quaternion), this._lastZoom = this.object.zoom;
|
|
1767
1767
|
}
|
|
1768
1768
|
_getAutoRotateAngle(e) {
|
|
1769
|
-
return e != null ?
|
|
1769
|
+
return e != null ? ti / 60 * this.autoRotateSpeed * e : ti / 3600 * this.autoRotateSpeed;
|
|
1770
1770
|
}
|
|
1771
1771
|
_beginInteraction(e) {
|
|
1772
|
-
this._isInteracting || (this.dispatchEvent(
|
|
1772
|
+
this._isInteracting || (this.dispatchEvent(Wi), this._isInteracting = !0), this.state = e;
|
|
1773
1773
|
}
|
|
1774
1774
|
_endInteraction() {
|
|
1775
|
-
this._isInteracting && (this._isInteracting = !1, this.state = ae.NONE, this.dispatchEvent(
|
|
1775
|
+
this._isInteracting && (this._isInteracting = !1, this.state = ae.NONE, this.dispatchEvent(Ki));
|
|
1776
1776
|
}
|
|
1777
1777
|
_handleContextMenu(e) {
|
|
1778
1778
|
e.preventDefault();
|
|
@@ -1815,14 +1815,14 @@ class Vn extends Ms {
|
|
|
1815
1815
|
}
|
|
1816
1816
|
}
|
|
1817
1817
|
_handleWheel(e) {
|
|
1818
|
-
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(
|
|
1818
|
+
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(Wi), this._queueZoom(Math.sign(e.deltaY)), this.update(), this.dispatchEvent(Ki));
|
|
1819
1819
|
}
|
|
1820
1820
|
_handleKeyDown(e) {
|
|
1821
1821
|
if (!this.enabled)
|
|
1822
1822
|
return;
|
|
1823
1823
|
const t = e.code || e.key;
|
|
1824
|
-
if (this.object?.isPerspectiveCamera &&
|
|
1825
|
-
|
|
1824
|
+
if (this.object?.isPerspectiveCamera && qi.has(t)) {
|
|
1825
|
+
Yi(e.target) || (this._pressedKeys.add(t), this._startKeyboardMoveLoop(), e.preventDefault());
|
|
1826
1826
|
return;
|
|
1827
1827
|
}
|
|
1828
1828
|
let i = !1;
|
|
@@ -1844,7 +1844,7 @@ class Vn extends Ms {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
_handleKeyUp(e) {
|
|
1846
1846
|
const t = e.code || e.key;
|
|
1847
|
-
|
|
1847
|
+
qi.has(t) && (this._pressedKeys.delete(t), this._pressedKeys.size === 0 && this._stopKeyboardMoveLoop(), this.object?.isPerspectiveCamera && !Yi(e.target) && e.preventDefault());
|
|
1848
1848
|
}
|
|
1849
1849
|
_handleTouchStart() {
|
|
1850
1850
|
const e = Array.from(this._pointers.values());
|
|
@@ -1893,7 +1893,7 @@ class Vn extends Ms {
|
|
|
1893
1893
|
_queueRotate(e, t) {
|
|
1894
1894
|
if (!this.enableRotate || !this.domElement)
|
|
1895
1895
|
return;
|
|
1896
|
-
const { height: i } =
|
|
1896
|
+
const { height: i } = ji(this.domElement), n = ti / i;
|
|
1897
1897
|
this._rotateVelocity.x += e * n * this.rotateSpeed, this._rotateVelocity.y += t * n * this.rotateSpeed;
|
|
1898
1898
|
}
|
|
1899
1899
|
_queuePan(e, t) {
|
|
@@ -1903,9 +1903,9 @@ class Vn extends Ms {
|
|
|
1903
1903
|
this.enableZoom && (this._zoomVelocity += e);
|
|
1904
1904
|
}
|
|
1905
1905
|
}
|
|
1906
|
-
class
|
|
1906
|
+
class Xi extends En {
|
|
1907
1907
|
constructor(e, t, i, n) {
|
|
1908
|
-
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this._rayOriginOffset = new h(0, -1, 0), this._camerLocalDirection = new h(), this._tmpVector = new h(), this._lookDirection = new h(), this._rayCaster = new me(), this._fallingTime = 0, this._isMouseInElement = !1, this._euler = new
|
|
1908
|
+
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this._rayOriginOffset = new h(0, -1, 0), this._camerLocalDirection = new h(), this._tmpVector = new h(), this._lookDirection = new h(), this._rayCaster = new me(), this._fallingTime = 0, this._isMouseInElement = !1, this._euler = new Xt(0, 0, 0, "YZX"), this._prevMouseX = 0, this._prevMouseY = 0, this._pointerLookActive = !1, this._externalLookActive = !1, this._interactionActive = !1, this._sharedTargetDistance = 10, this.target = this.camera.position.clone().add(
|
|
1909
1909
|
new h(0, 0, -1).applyQuaternion(this.camera.quaternion).normalize().multiplyScalar(this._sharedTargetDistance)
|
|
1910
1910
|
), this.applyGravity = !1, this.gravityMinHeight = !0, this.applyCollision = !0, this.positionEasing = !0, this.lookflag = 1, this.lookHorizontalFlag = 1, this.lookSpeed = 3e-3, this.moveSpeed = 0.02, this.playerHeight = 1.6, this.jumpSpeed = 0.24, this.jumpGravity = 0.012, this.maxRotateX = Math.PI * 0.5 - 0.01, this.g = 9.8, this.bindmousedown = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchStart.bind(this) : this.onMouseDown.bind(this), this.bindmouseup = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchEnd.bind(this) : this.onMouseUp.bind(this), this.bindmousemove = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchMove.bind(this) : this.onMouseMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindWindowBlur = this.onWindowBlur.bind(this), this.bindVisibilityChange = this.onVisibilityChange.bind(this), this.bindMousewheel = this.onMousewheel.bind(this), this.bindMouseEnter = this.onMouseEnter.bind(this), this.bindMouseLeave = this.onMouseLeave.bind(this), this.needMousewheel = !1, this.moveWheelRun = !0, this.moveWheelStop = !1, this.wheelClock, this.keydown = !1, this.shiftDown = !1, this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = this.camera.position.y, this.gravityTestCount = 5, this.catchTestCount = 10, this.GetEngine = () => e, this.syncRotationStateFromCamera(), this.sanitizeCameraOrientation(), this.syncSharedTargetFromCamera();
|
|
1911
1911
|
}
|
|
@@ -2265,7 +2265,7 @@ class Yi extends Sn {
|
|
|
2265
2265
|
return r;
|
|
2266
2266
|
}
|
|
2267
2267
|
}
|
|
2268
|
-
const
|
|
2268
|
+
const Po = J("/assets/worker_walk.glb", import.meta.url), To = Math.PI, _o = {
|
|
2269
2269
|
16: "ShiftLeft",
|
|
2270
2270
|
37: "ArrowLeft",
|
|
2271
2271
|
38: "ArrowUp",
|
|
@@ -2289,9 +2289,9 @@ const Eo = J("/assets/worker_walk.glb", import.meta.url), Po = Math.PI, To = {
|
|
|
2289
2289
|
jump: ["Space"],
|
|
2290
2290
|
boost: ["ShiftLeft", "ShiftRight"]
|
|
2291
2291
|
};
|
|
2292
|
-
class
|
|
2292
|
+
class Qi extends En {
|
|
2293
2293
|
constructor(e, t, i, n = {}) {
|
|
2294
|
-
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new h(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookHorizontalFlag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new h(), this._moveDirection = new h(), this._rayCaster = new me(), this._cameraRayCaster = new me(), this._cameraCollisionFrame = 0, this._lastCameraSafeDistance = null, this._fallingTime = 0, this._isMouseInElement = !1, this._prevMouseX = 0, this._prevMouseY = 0, this._dragRotateThreshold = n.dragRotateThreshold ?? 2, this._pointerLookActive = !1, this._externalLookActive = !1, this._scriptedMotionActive = !1, this._interactionActive = !1, this._yaw = 0, this._pitch = n.initialPitch ?? 0, this._pressedKeys = /* @__PURE__ */ new Set(), this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = 0, this.avatarRoot = new fe(), this.avatarRoot.name = "ThirdPersonAvatarRoot", this.avatarRoot.visible = n.visible ?? !0, this.avatarMixer = null, this.avatarWalkAction = null, this._isWalkActionPlaying = !1, this._avatarAnimationClock = new
|
|
2294
|
+
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new h(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookHorizontalFlag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new h(), this._moveDirection = new h(), this._rayCaster = new me(), this._cameraRayCaster = new me(), this._cameraCollisionFrame = 0, this._lastCameraSafeDistance = null, this._fallingTime = 0, this._isMouseInElement = !1, this._prevMouseX = 0, this._prevMouseY = 0, this._dragRotateThreshold = n.dragRotateThreshold ?? 2, this._pointerLookActive = !1, this._externalLookActive = !1, this._scriptedMotionActive = !1, this._interactionActive = !1, this._yaw = 0, this._pitch = n.initialPitch ?? 0, this._pressedKeys = /* @__PURE__ */ new Set(), this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = 0, this.avatarRoot = new fe(), this.avatarRoot.name = "ThirdPersonAvatarRoot", this.avatarRoot.visible = n.visible ?? !0, this.avatarMixer = null, this.avatarWalkAction = null, this._isWalkActionPlaying = !1, this._avatarAnimationClock = new Pn(), this._avatarLoadRequestId = 0, this.defaultAvatarUrl = n.avatarUrl ?? Po, this._ownsAvatarResources = !n.avatar, this.avatar = n.avatar || this.createDefaultAvatar(), this.avatar.name = this.avatar.name || "ThirdPersonAvatar", this.avatarRoot.add(this.avatar), !n.avatar && this.defaultAvatarUrl && this.loadAvatarModel(this.defaultAvatarUrl, n.avatarOptions);
|
|
2295
2295
|
const s = this.isPcDevice();
|
|
2296
2296
|
this.bindmousedown = s ? this.onMouseDown.bind(this) : this.onTouchStart.bind(this), this.bindmouseup = s ? this.onMouseUp.bind(this) : this.onTouchEnd.bind(this), this.bindmousemove = s ? this.onMouseMove.bind(this) : this.onTouchMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindWindowBlur = this.onWindowBlur.bind(this), this.bindVisibilityChange = this.onVisibilityChange.bind(this), this.bindMouseEnter = this.onMouseEnter.bind(this), this.bindMouseLeave = this.onMouseLeave.bind(this), this.initAvatarPoseFromCamera();
|
|
2297
2297
|
}
|
|
@@ -2342,7 +2342,7 @@ class Xi extends Sn {
|
|
|
2342
2342
|
/** 默认加载第三人称工人模型,并使用模型内置第一段动画作为行走动作。 */
|
|
2343
2343
|
loadAvatarModel(e, t = {}) {
|
|
2344
2344
|
const i = ++this._avatarLoadRequestId;
|
|
2345
|
-
new
|
|
2345
|
+
new Ai().load(
|
|
2346
2346
|
e,
|
|
2347
2347
|
(s) => {
|
|
2348
2348
|
if (i !== this._avatarLoadRequestId || !s?.scene)
|
|
@@ -2352,7 +2352,7 @@ class Xi extends Sn {
|
|
|
2352
2352
|
alignToFeet: !0,
|
|
2353
2353
|
fitToPlayerHeight: !0,
|
|
2354
2354
|
ownsResources: !0,
|
|
2355
|
-
yawOffset:
|
|
2355
|
+
yawOffset: To,
|
|
2356
2356
|
...t
|
|
2357
2357
|
}), this.setupAvatarAnimation(o, s.animations || []);
|
|
2358
2358
|
},
|
|
@@ -2366,7 +2366,7 @@ class Xi extends Sn {
|
|
|
2366
2366
|
setupAvatarAnimation(e, t) {
|
|
2367
2367
|
if (!t.length)
|
|
2368
2368
|
return;
|
|
2369
|
-
this.avatarMixer = new
|
|
2369
|
+
this.avatarMixer = new ws(e);
|
|
2370
2370
|
const i = t.find((n) => /walk|run|move/i.test(n.name)) || t[0];
|
|
2371
2371
|
this.avatarWalkAction = this.avatarMixer.clipAction(i), this.avatarWalkAction.enabled = !0, this.avatarWalkAction.clampWhenFinished = !1, this.avatarWalkAction.setEffectiveWeight(1), this.avatarWalkAction.paused = !0, this.avatarWalkAction.play(), this._avatarAnimationClock.getDelta();
|
|
2372
2372
|
}
|
|
@@ -2471,7 +2471,7 @@ class Xi extends Sn {
|
|
|
2471
2471
|
}
|
|
2472
2472
|
}
|
|
2473
2473
|
getEventCode(e) {
|
|
2474
|
-
return e.code ||
|
|
2474
|
+
return e.code || _o[e.keyCode] || e.key || "";
|
|
2475
2475
|
}
|
|
2476
2476
|
hasPressed(e) {
|
|
2477
2477
|
return e.some((t) => this._pressedKeys.has(t));
|
|
@@ -2728,7 +2728,7 @@ class Xi extends Sn {
|
|
|
2728
2728
|
});
|
|
2729
2729
|
}
|
|
2730
2730
|
}
|
|
2731
|
-
class
|
|
2731
|
+
class Io {
|
|
2732
2732
|
constructor(e) {
|
|
2733
2733
|
this.engine = e;
|
|
2734
2734
|
}
|
|
@@ -2742,7 +2742,7 @@ class _o {
|
|
|
2742
2742
|
r || (r = [0, 0, []]);
|
|
2743
2743
|
const l = He(n, s), c = this.getModelSnapCache(s, o, r);
|
|
2744
2744
|
n.camera.updateMatrixWorld(!0);
|
|
2745
|
-
const d = new H().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, m = n.renderer.domElement.clientHeight, g = new K(t.offsetX, t.offsetY), f = new
|
|
2745
|
+
const d = new H().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, m = n.renderer.domElement.clientHeight, g = new K(t.offsetX, t.offsetY), f = new Qt(), v = new h(), b = new h(), p = new K(), x = new K(), C = new h();
|
|
2746
2746
|
let P = "face", I = null, D = null, R = 100;
|
|
2747
2747
|
if (i != null) {
|
|
2748
2748
|
const k = e.point.clone(), U = e.normal || (e.face ? e.face.normal : null);
|
|
@@ -2874,7 +2874,7 @@ class _o {
|
|
|
2874
2874
|
const o = O.clamp(e, 0, 1);
|
|
2875
2875
|
if (!this.engine.camera.isPerspectiveCamera)
|
|
2876
2876
|
return s.lerpVectors(t, i, o);
|
|
2877
|
-
const r = new
|
|
2877
|
+
const r = new Qt(t.x, t.y, t.z, 1).applyMatrix4(n), c = new Qt(i.x, i.y, i.z, 1).applyMatrix4(n).w * (1 - o) + o * r.w, d = Math.abs(c) > 1e-10 ? o * r.w / c : o;
|
|
2878
2878
|
return s.lerpVectors(t, i, O.clamp(d, 0, 1));
|
|
2879
2879
|
}
|
|
2880
2880
|
/**
|
|
@@ -2928,7 +2928,7 @@ class _o {
|
|
|
2928
2928
|
x.setAttribute("class", "catchFace"), x.setAttribute("points", p.map((C) => `${C.x + t.reactBoundingClientRect.left},${C.y + t.reactBoundingClientRect.top}`).join(" ")), x.setAttribute("fill", "rgba(1, 238, 255, 0.2)"), x.setAttribute("stroke", "rgb(0, 255, 247)"), x.setAttribute("stroke-width", "1"), t.catchSvg.appendChild(x);
|
|
2929
2929
|
}
|
|
2930
2930
|
}
|
|
2931
|
-
function
|
|
2931
|
+
function Li(a) {
|
|
2932
2932
|
const e = {
|
|
2933
2933
|
self: null,
|
|
2934
2934
|
// 当前激活的行为对象
|
|
@@ -2951,7 +2951,7 @@ function Di(a) {
|
|
|
2951
2951
|
touchControlsSnapshot: null,
|
|
2952
2952
|
mouseMoveFrame: null,
|
|
2953
2953
|
latestMouseMoveEvent: null
|
|
2954
|
-
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new
|
|
2954
|
+
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new Io(a);
|
|
2955
2955
|
e.handle_catch = function(y, S, z = !0, V = !0) {
|
|
2956
2956
|
const q = e.options;
|
|
2957
2957
|
e.options = {
|
|
@@ -3219,7 +3219,7 @@ function Di(a) {
|
|
|
3219
3219
|
e.lastPoint = null;
|
|
3220
3220
|
}, e;
|
|
3221
3221
|
}
|
|
3222
|
-
class
|
|
3222
|
+
class Do {
|
|
3223
3223
|
engine;
|
|
3224
3224
|
orbitControls;
|
|
3225
3225
|
firstPersonControls;
|
|
@@ -3242,10 +3242,10 @@ class Io {
|
|
|
3242
3242
|
isDown = !1;
|
|
3243
3243
|
containerOffset = { left: 0, top: 0 };
|
|
3244
3244
|
constructor(e) {
|
|
3245
|
-
this.engine = e, this.init(), this.handelBehaved =
|
|
3245
|
+
this.engine = e, this.init(), this.handelBehaved = Li(this.engine), this.handelBehaved.init(this, null), this.handelBehaved.active();
|
|
3246
3246
|
}
|
|
3247
3247
|
init() {
|
|
3248
|
-
this.orbitControls = new
|
|
3248
|
+
this.orbitControls = new Un(this.engine, this.engine.camera, this.engine.renderer.domElement), this.orbitControls.showOriginIcon = !0, this.firstPersonControls = new Xi(this.engine, this.engine.camera, this.engine.renderer.domElement), this.thirdPersonControls = new Qi(this.engine, this.engine.camera, this.engine.renderer.domElement), this.applyRoamLookDirection(this.firstPersonControls), this.applyRoamLookDirection(this.thirdPersonControls);
|
|
3249
3249
|
const e = document.createElement("div");
|
|
3250
3250
|
this.originDiv = e, e.className = "originDiv", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.width = "30px", e.style.height = "30px", e.style.borderRadius = "50%", e.style.pointerEvents = "none", e.style.backgroundImage = `url(${J("/assets/svg/rotate-orbit.svg", import.meta.url)})`, this.engine.container.appendChild(this.originDiv);
|
|
3251
3251
|
}
|
|
@@ -3307,7 +3307,7 @@ class Io {
|
|
|
3307
3307
|
}
|
|
3308
3308
|
// 切换第一人称漫游模式
|
|
3309
3309
|
switchFirstPersonMode() {
|
|
3310
|
-
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new
|
|
3310
|
+
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new Xi(
|
|
3311
3311
|
this.engine,
|
|
3312
3312
|
this.engine.camera,
|
|
3313
3313
|
this.engine.renderer.domElement,
|
|
@@ -3324,7 +3324,7 @@ class Io {
|
|
|
3324
3324
|
applyCollision: t?.applyCollision,
|
|
3325
3325
|
applyGravity: t?.applyGravity
|
|
3326
3326
|
};
|
|
3327
|
-
return t?.dispose?.(), this.thirdPersonControls = new
|
|
3327
|
+
return t?.dispose?.(), this.thirdPersonControls = new Qi(
|
|
3328
3328
|
this.engine,
|
|
3329
3329
|
this.engine.camera,
|
|
3330
3330
|
this.engine.renderer.domElement,
|
|
@@ -3541,7 +3541,7 @@ class Io {
|
|
|
3541
3541
|
this.isActive = !1, this.handelBehaved?.disActive?.(), this.orbitControls?.dispose?.(), this.firstPersonControls?.dispose?.(), this.thirdPersonControls?.dispose?.(), this.removeMobileRoamControls(), this.originDiv?.remove(), this.originDiv = null, this.orbitControls = null, this.firstPersonControls = null, this.thirdPersonControls = null, this.handelBehaved = null;
|
|
3542
3542
|
}
|
|
3543
3543
|
}
|
|
3544
|
-
const
|
|
3544
|
+
const Lo = {
|
|
3545
3545
|
uniforms: {
|
|
3546
3546
|
tDiffuse: { value: null },
|
|
3547
3547
|
saturation: { value: 1.2 },
|
|
@@ -3577,8 +3577,8 @@ const Do = {
|
|
|
3577
3577
|
gl_FragColor = color;
|
|
3578
3578
|
}
|
|
3579
3579
|
`
|
|
3580
|
-
},
|
|
3581
|
-
class
|
|
3580
|
+
}, Gn = 0.5, Wn = 1.1, Kn = 1;
|
|
3581
|
+
class ko {
|
|
3582
3582
|
engine;
|
|
3583
3583
|
composer;
|
|
3584
3584
|
saturationPass;
|
|
@@ -3653,7 +3653,7 @@ class Lo {
|
|
|
3653
3653
|
return;
|
|
3654
3654
|
const i = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1;
|
|
3655
3655
|
this.composer.setPixelRatio(i), this.composer.setSize(e, t);
|
|
3656
|
-
const n = this.composer.passes.find((s) => s instanceof
|
|
3656
|
+
const n = this.composer.passes.find((s) => s instanceof $t && s.material.uniforms.resolution);
|
|
3657
3657
|
n && (n.material.uniforms.resolution.value.x = 1 / (e * i), n.material.uniforms.resolution.value.y = 1 / (t * i)), this.syncAmbientOcclusionDepthTextures();
|
|
3658
3658
|
}
|
|
3659
3659
|
/**
|
|
@@ -3663,16 +3663,16 @@ class Lo {
|
|
|
3663
3663
|
this.composer && (this.syncAmbientOcclusionDepthTextures(), this.composer.render());
|
|
3664
3664
|
}
|
|
3665
3665
|
init() {
|
|
3666
|
-
const { width: e, height: t } = this.engine.deviceModule.getContainerSize(), i = this.engine.scene, n = this.engine.camera, s = this.engine.renderer, o = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1, r = new
|
|
3666
|
+
const { width: e, height: t } = this.engine.deviceModule.getContainerSize(), i = this.engine.scene, n = this.engine.camera, s = this.engine.renderer, o = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1, r = new Tn(e, t, {
|
|
3667
3667
|
minFilter: zt,
|
|
3668
3668
|
magFilter: zt,
|
|
3669
|
-
format:
|
|
3669
|
+
format: _n,
|
|
3670
3670
|
samples: 4
|
|
3671
3671
|
// 启用多重采样抗锯齿
|
|
3672
3672
|
});
|
|
3673
|
-
r.texture.colorSpace =
|
|
3674
|
-
const l = new
|
|
3675
|
-
this.composer.addPass(l), this.gtaoPass = new
|
|
3673
|
+
r.texture.colorSpace = xs, this.composer = new bs(s, r), this.composer.setPixelRatio(o), this.composer.setSize(e, t);
|
|
3674
|
+
const l = new Cs(i, n);
|
|
3675
|
+
this.composer.addPass(l), this.gtaoPass = new Bi(i, n, e, t), this.gtaoPass.output = Bi.OUTPUT.Default, this.gtaoPass.blendIntensity = Gn, this.gtaoPass.enabled = !1, this.gtaoPass.normalMaterial.side = oe, this.gtaoPass.normalMaterial.needsUpdate = !0, this.excludeClippingHelpersFromGtao(this.gtaoPass), this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
3676
3676
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
3677
3677
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
3678
3678
|
radius: 0.45,
|
|
@@ -3698,7 +3698,7 @@ class Lo {
|
|
|
3698
3698
|
samples: 32,
|
|
3699
3699
|
rings: 3,
|
|
3700
3700
|
radiusExponent: 2
|
|
3701
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new
|
|
3701
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new zi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = zi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new $t(Lo), this.saturationPass.uniforms.saturation.value = Wn, this.saturationPass.uniforms.contrast.value = Kn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new As(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new $t(Ss), this.fxaaPass.material.uniforms.resolution.value.x = 1 / (e * o), this.fxaaPass.material.uniforms.resolution.value.y = 1 / (t * o), this.fxaaPass.enabled = !1, this.composer.addPass(this.fxaaPass), this.syncAmbientOcclusionDepthTextures();
|
|
3702
3702
|
}
|
|
3703
3703
|
}
|
|
3704
3704
|
function wt(a) {
|
|
@@ -3708,7 +3708,7 @@ function wt(a) {
|
|
|
3708
3708
|
i = n[1];
|
|
3709
3709
|
a.name = t, a.guid = i;
|
|
3710
3710
|
}
|
|
3711
|
-
function
|
|
3711
|
+
function Bo(a, e, t, i) {
|
|
3712
3712
|
const r = a.models.find((b) => b.url == t);
|
|
3713
3713
|
if (r == null)
|
|
3714
3714
|
return;
|
|
@@ -3719,7 +3719,7 @@ function ko(a, e, t, i) {
|
|
|
3719
3719
|
}, b.rotation = { x: 0, y: 0, z: 0 }, b), v = (b, p) => {
|
|
3720
3720
|
if (!Array.isArray(p) || p.length === 0)
|
|
3721
3721
|
return;
|
|
3722
|
-
const x = p.map((P) => f(P)), C =
|
|
3722
|
+
const x = p.map((P) => f(P)), C = Ro(b, l, x, t, a);
|
|
3723
3723
|
C != null && x.forEach((P, I) => {
|
|
3724
3724
|
const D = [[C, I, 0, 0]];
|
|
3725
3725
|
P.indexes = D, P.id = Number(P.id);
|
|
@@ -3727,9 +3727,9 @@ function ko(a, e, t, i) {
|
|
|
3727
3727
|
wt(R), r.nodesMap.set(Number(P.id), R), c.push(Number(P.id));
|
|
3728
3728
|
});
|
|
3729
3729
|
};
|
|
3730
|
-
v("Circle", d), v("Rect", u), v("Ellipse", g), v("Bridge", m),
|
|
3730
|
+
v("Circle", d), v("Rect", u), v("Ellipse", g), v("Bridge", m), zo(r, c);
|
|
3731
3731
|
}
|
|
3732
|
-
function
|
|
3732
|
+
function zo(a, e) {
|
|
3733
3733
|
if (e.length === 0 || !Array.isArray(a?.lods))
|
|
3734
3734
|
return;
|
|
3735
3735
|
const i = a.lods[0]?.octreeBox;
|
|
@@ -3741,7 +3741,7 @@ function Bo(a, e) {
|
|
|
3741
3741
|
n.has(s) || (i.elements.push(s), n.add(s));
|
|
3742
3742
|
});
|
|
3743
3743
|
}
|
|
3744
|
-
function
|
|
3744
|
+
function Ro(a, e, t, i, n) {
|
|
3745
3745
|
let s;
|
|
3746
3746
|
const o = {
|
|
3747
3747
|
width: 1,
|
|
@@ -3770,8 +3770,8 @@ function zo(a, e, t, i, n) {
|
|
|
3770
3770
|
return null;
|
|
3771
3771
|
const r = new W(s.geometry, s.material, t.length);
|
|
3772
3772
|
r.url = i, e.add(r);
|
|
3773
|
-
const l =
|
|
3774
|
-
|
|
3773
|
+
const l = _i(n, r);
|
|
3774
|
+
Ii(r, l), r.geometry.getAttribute("normal") == null && r.geometry.computeVertexNormals(), r.geometry.computeBoundingBox();
|
|
3775
3775
|
const c = r.geometry.boundingBox?.clone() ?? null, d = [], u = [];
|
|
3776
3776
|
for (let g = 0; g < t.length; g++) {
|
|
3777
3777
|
const f = t[g], v = new h(f.startPoint.X, 0, -f.startPoint.Y), b = new h(f.endPoint.X, 0, -f.endPoint.Y), p = new h(f.startPoint.X, f.startPoint.Z, -f.startPoint.Y), x = new h(f.endPoint.X, f.endPoint.Z, -f.endPoint.Y);
|
|
@@ -3783,7 +3783,7 @@ function zo(a, e, t, i, n) {
|
|
|
3783
3783
|
}
|
|
3784
3784
|
} else
|
|
3785
3785
|
P = (b.clone().sub(v.clone()).cross(new h(0, 0, 1)).y > 0 ? -1 : 1) * b.clone().sub(v.clone()).angleTo(new h(0, 0, 1)), C = (f.startPoint.Z > f.endPoint.Z ? 1 : -1) * b.clone().sub(v.clone()).angleTo(x.clone().sub(p.clone()));
|
|
3786
|
-
const D = new H(), R = new
|
|
3786
|
+
const D = new H(), R = new Xt(C, P, I, "YXZ"), k = D.clone().makeRotationFromEuler(R);
|
|
3787
3787
|
let U, Y;
|
|
3788
3788
|
a === "Circle" ? (U = f.diameter, Y = f.diameter) : (U = f.width, Y = f.height);
|
|
3789
3789
|
const ie = D.clone().makeScale(U, Y, f.length);
|
|
@@ -3819,7 +3819,7 @@ function zo(a, e, t, i, n) {
|
|
|
3819
3819
|
return r.meshs = m, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, l;
|
|
3820
3820
|
}
|
|
3821
3821
|
function _t(a, e) {
|
|
3822
|
-
const t = new
|
|
3822
|
+
const t = new In();
|
|
3823
3823
|
switch (e.width = e.width * 0.3048, e.height = e.height * 0.3048, e.diameter = e.diameter * 0.3048, a) {
|
|
3824
3824
|
case "Rect":
|
|
3825
3825
|
t.moveTo(-e.width / 2, -e.height / 2), t.lineTo(-e.width / 2, e.height / 2), t.lineTo(e.width / 2, e.height / 2), t.lineTo(e.width / 2, -e.height / 2), t.lineTo(-e.width / 2, -e.height / 2);
|
|
@@ -3840,7 +3840,7 @@ function _t(a, e) {
|
|
|
3840
3840
|
};
|
|
3841
3841
|
return n(t, i, e.color, e.position, e.rotation);
|
|
3842
3842
|
function n(s, o, r, l, c) {
|
|
3843
|
-
const d = new
|
|
3843
|
+
const d = new Dn(s, o), u = new Si({
|
|
3844
3844
|
// MEP 最终颜色由 instanceColor 乘算,基础材质保持白色才能避免二次染色。
|
|
3845
3845
|
color: 16777215,
|
|
3846
3846
|
metalness: 0,
|
|
@@ -3852,68 +3852,68 @@ function _t(a, e) {
|
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
3854
3854
|
var ne = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.ModelPlaceSelected = "model-place-selected", a.ModelCalibrationChanged = "model-calibration-changed", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.MeasureClick = "measure-click", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(ne || {});
|
|
3855
|
-
const
|
|
3856
|
-
function
|
|
3855
|
+
const $i = "__bvhAccelerationInstalled", qn = "__bvhBuildFailed", Oo = "__bvhBuilt", Fo = "__bvhTriangleCount", jn = 200, Ho = 10;
|
|
3856
|
+
function No() {
|
|
3857
3857
|
const a = globalThis;
|
|
3858
|
-
a[
|
|
3858
|
+
a[$i] !== !0 && (F.prototype.raycast = Es, pe.prototype.computeBoundsTree = Ln, pe.prototype.disposeBoundsTree = Ps, a[$i] = !0);
|
|
3859
3859
|
}
|
|
3860
|
-
function
|
|
3860
|
+
function Vo(a) {
|
|
3861
3861
|
a.firstHitOnly = !0;
|
|
3862
3862
|
}
|
|
3863
|
-
function
|
|
3863
|
+
function Uo(a) {
|
|
3864
3864
|
delete a.firstHitOnly;
|
|
3865
3865
|
}
|
|
3866
|
-
function
|
|
3866
|
+
function Go(a, e = jn) {
|
|
3867
3867
|
if (a == null)
|
|
3868
3868
|
return !1;
|
|
3869
3869
|
const t = a;
|
|
3870
|
-
if (t.boundsTree != null || t.userData?.[
|
|
3870
|
+
if (t.boundsTree != null || t.userData?.[qn] === !0)
|
|
3871
3871
|
return !1;
|
|
3872
3872
|
const i = a.attributes.position?.count ?? 0;
|
|
3873
3873
|
return (a.index?.count ?? i) / 3 >= e;
|
|
3874
3874
|
}
|
|
3875
|
-
function
|
|
3875
|
+
function Wo(a) {
|
|
3876
3876
|
if (a == null)
|
|
3877
3877
|
return 0;
|
|
3878
3878
|
const e = a.attributes.position?.count ?? 0;
|
|
3879
3879
|
return (a.index?.count ?? e) / 3;
|
|
3880
3880
|
}
|
|
3881
|
-
function
|
|
3881
|
+
function Ko(a, e = {}) {
|
|
3882
3882
|
if (a == null)
|
|
3883
3883
|
return;
|
|
3884
|
-
const t = e.triangleThreshold ??
|
|
3885
|
-
if (!
|
|
3884
|
+
const t = e.triangleThreshold ?? jn;
|
|
3885
|
+
if (!Go(a, t)) {
|
|
3886
3886
|
e.setBoundingBox === !0 && a.boundingBox == null && a.computeBoundingBox(), e.setBoundingSphere === !0 && a.boundingSphere == null && a.computeBoundingSphere();
|
|
3887
3887
|
return;
|
|
3888
3888
|
}
|
|
3889
3889
|
const i = a;
|
|
3890
3890
|
try {
|
|
3891
|
-
i.userData = i.userData ?? {}, i.userData[
|
|
3892
|
-
maxLeafTris: e.maxLeafTris ??
|
|
3893
|
-
}), i.userData[
|
|
3891
|
+
i.userData = i.userData ?? {}, i.userData[Fo] = Wo(a), e.setBoundingBox === !0 && a.boundingBox == null && a.computeBoundingBox(), e.setBoundingSphere === !0 && a.boundingSphere == null && a.computeBoundingSphere(), Ln.call(i, {
|
|
3892
|
+
maxLeafTris: e.maxLeafTris ?? Ho
|
|
3893
|
+
}), i.userData[Oo] = i.boundsTree != null;
|
|
3894
3894
|
} catch (n) {
|
|
3895
|
-
i.userData = i.userData ?? {}, i.userData[
|
|
3895
|
+
i.userData = i.userData ?? {}, i.userData[qn] = !0, console.warn("[raycastAcceleration] failed to build bounds tree", n);
|
|
3896
3896
|
}
|
|
3897
3897
|
}
|
|
3898
|
-
let ct = null, ht = null,
|
|
3899
|
-
const
|
|
3900
|
-
function
|
|
3898
|
+
let ct = null, ht = null, Zi = null;
|
|
3899
|
+
const qo = 8, Yn = 24, jo = 24, Yo = 64, Xo = 240, Qo = 2, $o = 10;
|
|
3900
|
+
function Xn() {
|
|
3901
3901
|
return J("draco/", import.meta.url);
|
|
3902
3902
|
}
|
|
3903
|
-
function
|
|
3903
|
+
function Qn() {
|
|
3904
3904
|
return J("basis/", import.meta.url);
|
|
3905
3905
|
}
|
|
3906
|
-
function
|
|
3907
|
-
return ct == null && (ct = new
|
|
3908
|
-
}
|
|
3909
|
-
function Zo(a) {
|
|
3910
|
-
return ht == null && (ht = new Is(), ht.setTranscoderPath(Xn())), $i !== a && (ht.detectSupport(a), $i = a), ht;
|
|
3906
|
+
function Zo() {
|
|
3907
|
+
return ct == null && (ct = new Is(), ct.setDecoderPath(Xn()), ct.preload()), ct;
|
|
3911
3908
|
}
|
|
3912
3909
|
function Jo(a) {
|
|
3913
|
-
|
|
3914
|
-
return e.setDRACOLoader($o()), e.setMeshoptDecoder(Ts), a?.renderer?.capabilities != null && typeof a.renderer.getContext == "function" && e.setKTX2Loader(Zo(a.renderer)), e;
|
|
3910
|
+
return ht == null && (ht = new Ds(), ht.setTranscoderPath(Qn())), Zi !== a && (ht.detectSupport(a), Zi = a), ht;
|
|
3915
3911
|
}
|
|
3916
|
-
function
|
|
3912
|
+
function er(a) {
|
|
3913
|
+
const e = new Ai();
|
|
3914
|
+
return e.setDRACOLoader(Zo()), e.setMeshoptDecoder(_s), a?.renderer?.capabilities != null && typeof a.renderer.getContext == "function" && e.setKTX2Loader(Jo(a.renderer)), e;
|
|
3915
|
+
}
|
|
3916
|
+
function $n() {
|
|
3917
3917
|
return new Promise((a) => {
|
|
3918
3918
|
if (typeof requestAnimationFrame == "function") {
|
|
3919
3919
|
requestAnimationFrame(() => a());
|
|
@@ -3922,20 +3922,20 @@ function Qn() {
|
|
|
3922
3922
|
setTimeout(a, 16);
|
|
3923
3923
|
});
|
|
3924
3924
|
}
|
|
3925
|
-
function
|
|
3925
|
+
function tr() {
|
|
3926
3926
|
const a = navigator?.scheduling;
|
|
3927
3927
|
return typeof a?.isInputPending == "function" ? a.isInputPending() : !1;
|
|
3928
3928
|
}
|
|
3929
|
-
function
|
|
3930
|
-
return a?.engineStatus?.isFree === !1 ||
|
|
3929
|
+
function ir(a) {
|
|
3930
|
+
return a?.engineStatus?.isFree === !1 || tr();
|
|
3931
3931
|
}
|
|
3932
3932
|
async function je(a, e, t) {
|
|
3933
3933
|
if (e)
|
|
3934
3934
|
return t;
|
|
3935
3935
|
const i = performance.now();
|
|
3936
|
-
return
|
|
3936
|
+
return ir(a) || i - t >= qo ? (await $n(), performance.now()) : t;
|
|
3937
3937
|
}
|
|
3938
|
-
function
|
|
3938
|
+
function nr(a, e) {
|
|
3939
3939
|
return new Promise((t, i) => {
|
|
3940
3940
|
Vt(a, (n) => {
|
|
3941
3941
|
if (n == null) {
|
|
@@ -3948,76 +3948,91 @@ function ir(a, e) {
|
|
|
3948
3948
|
}, e);
|
|
3949
3949
|
});
|
|
3950
3950
|
}
|
|
3951
|
-
async function
|
|
3952
|
-
const t = await
|
|
3951
|
+
async function Zn(a, e) {
|
|
3952
|
+
const t = await Ut({
|
|
3953
3953
|
method: "get",
|
|
3954
3954
|
responseType: "arraybuffer",
|
|
3955
3955
|
url: a
|
|
3956
3956
|
});
|
|
3957
3957
|
let i = t.data;
|
|
3958
|
-
return
|
|
3958
|
+
return Hi.isEncrypted(t.data) && (i = await Hi.decryptPzEnc(t.data, e)), ui.loadAsync(i);
|
|
3959
3959
|
}
|
|
3960
|
-
function
|
|
3960
|
+
function Ji(a) {
|
|
3961
3961
|
return a.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
3962
3962
|
}
|
|
3963
|
-
function
|
|
3964
|
-
const t = new Set(e.map((i) =>
|
|
3963
|
+
function Jn(a, e) {
|
|
3964
|
+
const t = new Set(e.map((i) => Ji(i)));
|
|
3965
3965
|
for (const i of Object.keys(a.files))
|
|
3966
|
-
if (t.has(
|
|
3966
|
+
if (t.has(Ji(i)))
|
|
3967
3967
|
return a.files[i];
|
|
3968
3968
|
return null;
|
|
3969
3969
|
}
|
|
3970
|
-
function
|
|
3971
|
-
const t =
|
|
3970
|
+
function en(a, e) {
|
|
3971
|
+
const t = Jn(a, e);
|
|
3972
3972
|
return t == null || t.dir ? Promise.resolve(null) : t.async("string");
|
|
3973
3973
|
}
|
|
3974
3974
|
function sr(a) {
|
|
3975
|
+
const e = Object.values(a.files).find((t) => t != null && t.dir !== !0);
|
|
3976
|
+
return e == null ? Promise.resolve(null) : e.async("string");
|
|
3977
|
+
}
|
|
3978
|
+
function or(a) {
|
|
3975
3979
|
return a.charCodeAt(0) === 65279 ? a.slice(1) : a;
|
|
3976
3980
|
}
|
|
3977
|
-
function
|
|
3978
|
-
return JSON.parse(
|
|
3981
|
+
function qt(a) {
|
|
3982
|
+
return JSON.parse(or(a));
|
|
3983
|
+
}
|
|
3984
|
+
async function rr(a, e) {
|
|
3985
|
+
try {
|
|
3986
|
+
const t = await Zn(a, e), i = await sr(t);
|
|
3987
|
+
if (i == null)
|
|
3988
|
+
return { exists: !0, value: [] };
|
|
3989
|
+
const n = qt(i);
|
|
3990
|
+
return Array.isArray(n) ? { exists: !0, value: n } : (console.warn("[loadLightModel] quota_list is not an array", { path: a, parsed: n }), { exists: !0, value: [] });
|
|
3991
|
+
} catch (t) {
|
|
3992
|
+
return Ut.isAxiosError(t) && t.response?.status === 404 ? { exists: !1 } : (console.warn("[loadLightModel] failed to load optional quota_list", { path: a, error: t }), { exists: !1 });
|
|
3993
|
+
}
|
|
3979
3994
|
}
|
|
3980
|
-
function
|
|
3981
|
-
const t =
|
|
3995
|
+
function ar(a, e) {
|
|
3996
|
+
const t = Jn(a, e);
|
|
3982
3997
|
return t == null || t.dir ? Promise.resolve(null) : t.async("arraybuffer");
|
|
3983
3998
|
}
|
|
3984
|
-
function
|
|
3999
|
+
function lr(a, e) {
|
|
3985
4000
|
return new Promise((t, i) => {
|
|
3986
|
-
|
|
4001
|
+
er(a).parse(e, to(import.meta.url), t, i);
|
|
3987
4002
|
});
|
|
3988
4003
|
}
|
|
3989
4004
|
function at(a, e) {
|
|
3990
4005
|
const t = a.models.find((i) => i.url == e);
|
|
3991
4006
|
return t != null && t.group == null && (t.group = $e(a, e) ?? rt(a, e)), t;
|
|
3992
4007
|
}
|
|
3993
|
-
function
|
|
4008
|
+
function es(a, e) {
|
|
3994
4009
|
const t = at(a, e);
|
|
3995
4010
|
return Array.isArray(t?.lods) ? t.lods : [];
|
|
3996
4011
|
}
|
|
3997
|
-
function
|
|
3998
|
-
a.loadStatus == null && (a.loadStatus = {}), a.loadStatus.modelMep == null && (a.loadStatus.modelMep = !1), a.loadStatus.normal == null && (a.loadStatus.normal = !1);
|
|
4012
|
+
function ts(a) {
|
|
4013
|
+
a.loadStatus == null && (a.loadStatus = {}), a.loadStatus.modelMep == null && (a.loadStatus.modelMep = !1), a.loadStatus.normal == null && (a.loadStatus.normal = !1), a.loadStatus.quotaList == null && (a.loadStatus.quotaList = !1);
|
|
3999
4014
|
}
|
|
4000
|
-
function
|
|
4001
|
-
return
|
|
4015
|
+
function cr(a) {
|
|
4016
|
+
return ts(a), a.status === "loaded" && a.loadStatus.normal === !0 && a.loadStatus.modelMep === !0 && a.loadStatus.quotaList === !0;
|
|
4002
4017
|
}
|
|
4003
|
-
function
|
|
4018
|
+
function jt(a) {
|
|
4004
4019
|
const e = a?.engineStatus?.models;
|
|
4005
|
-
!Array.isArray(e) || e.length === 0 || !e.every((i) =>
|
|
4020
|
+
!Array.isArray(e) || e.length === 0 || !e.every((i) => cr(i)) || a.__loadingCompletedTriggered === !0 || (a.__loadingCompletedTriggered = !0, a.events?.trigger?.(ne.LoadingCompleted, {}));
|
|
4006
4021
|
}
|
|
4007
|
-
function
|
|
4022
|
+
function is(a) {
|
|
4008
4023
|
return a === !0 || a === "loading";
|
|
4009
4024
|
}
|
|
4010
|
-
function
|
|
4025
|
+
function tn(a) {
|
|
4011
4026
|
return a.index != null ? a.index.count : a.attributes.position?.count ?? 0;
|
|
4012
4027
|
}
|
|
4013
|
-
async function
|
|
4028
|
+
async function hr(a, e, t) {
|
|
4014
4029
|
let i = performance.now();
|
|
4015
4030
|
for (let n = 0; n < e.length; n++) {
|
|
4016
4031
|
const s = e[n];
|
|
4017
|
-
s?.geometry != null && s.geometry.computeVertexNormals, (n + 1) %
|
|
4032
|
+
s?.geometry != null && s.geometry.computeVertexNormals, (n + 1) % jo === 0 && (i = await je(a, t, i));
|
|
4018
4033
|
}
|
|
4019
4034
|
}
|
|
4020
|
-
async function
|
|
4035
|
+
async function dr(a, e, t) {
|
|
4021
4036
|
const i = [], n = [{ node: e.octreeBox, visited: !1 }];
|
|
4022
4037
|
let s = performance.now();
|
|
4023
4038
|
for (; n.length > 0; ) {
|
|
@@ -4038,11 +4053,11 @@ async function cr(a, e, t) {
|
|
|
4038
4053
|
}
|
|
4039
4054
|
return i;
|
|
4040
4055
|
}
|
|
4041
|
-
async function
|
|
4056
|
+
async function ur(a, e, t, i) {
|
|
4042
4057
|
const n = at(a, e.url);
|
|
4043
4058
|
if (n?.nodesMap == null)
|
|
4044
4059
|
return [];
|
|
4045
|
-
const s = await
|
|
4060
|
+
const s = await dr(a, t, i);
|
|
4046
4061
|
console.log("[loadLightModel] pending mesh ids", t.path, s.length);
|
|
4047
4062
|
const o = [];
|
|
4048
4063
|
let r = performance.now(), l = 0;
|
|
@@ -4057,46 +4072,46 @@ async function hr(a, e, t, i) {
|
|
|
4057
4072
|
const f = new H();
|
|
4058
4073
|
f.elements = m.matrix;
|
|
4059
4074
|
const v = g.geometry.clone();
|
|
4060
|
-
v.applyMatrix4(f), v.computeBoundingBox(), v.attributes.position.count > 2e4 &&
|
|
4075
|
+
v.applyMatrix4(f), v.computeBoundingBox(), v.attributes.position.count > 2e4 && Ko(v, {
|
|
4061
4076
|
setBoundingSphere: !0
|
|
4062
4077
|
});
|
|
4063
4078
|
const b = new F(v, g.material);
|
|
4064
|
-
m.box = v.boundingBox?.clone(), m.mesh = b, b.name = Number(c), b.glb = m.glb, b.url = e.url, v.attributes.position != null && o.push(b), l++, l %
|
|
4079
|
+
m.box = v.boundingBox?.clone(), m.mesh = b, b.name = Number(c), b.glb = m.glb, b.url = e.url, v.attributes.position != null && o.push(b), l++, l % Yn === 0 && (r = await je(a, i, r));
|
|
4065
4080
|
}
|
|
4066
4081
|
}
|
|
4067
4082
|
return o;
|
|
4068
4083
|
}
|
|
4069
|
-
function
|
|
4084
|
+
function ns(a) {
|
|
4070
4085
|
const e = a.clone();
|
|
4071
4086
|
return e.clippingPlanes = a.clippingPlanes, e;
|
|
4072
4087
|
}
|
|
4073
|
-
function
|
|
4088
|
+
function pr(a) {
|
|
4074
4089
|
a.setRGB(a.r, a.g, a.b, Ke);
|
|
4075
4090
|
}
|
|
4076
|
-
function
|
|
4091
|
+
function mr(a) {
|
|
4077
4092
|
const e = a;
|
|
4078
|
-
e.color == null || a.userData.__displayColorLinearized === !0 || (
|
|
4093
|
+
e.color == null || a.userData.__displayColorLinearized === !0 || (pr(e.color), a.userData.__displayColorLinearized = !0);
|
|
4079
4094
|
}
|
|
4080
|
-
function
|
|
4095
|
+
function gr(a, e, t, i, n) {
|
|
4081
4096
|
const s = yt(
|
|
4082
4097
|
i.map((d) => d.geometry),
|
|
4083
4098
|
!1
|
|
4084
|
-
), o =
|
|
4099
|
+
), o = ns(n), r = new F(s, o);
|
|
4085
4100
|
r.castShadow = !0, r.receiveShadow = !0, rt(e, a).add(r);
|
|
4086
|
-
const c =
|
|
4087
|
-
return
|
|
4101
|
+
const c = _i(e, r);
|
|
4102
|
+
return Ii(r, c), r.url = a, r.glb = t, r.materialClone = o, r.geometrys = i.map((d) => d.geometry), r.geometry.computeVertexNormals(), r;
|
|
4088
4103
|
}
|
|
4089
|
-
function
|
|
4104
|
+
function fr(a, e, t, i) {
|
|
4090
4105
|
return ($e(a, e)?.children ?? a.scene.children).find((o) => {
|
|
4091
4106
|
const r = o;
|
|
4092
4107
|
return o instanceof F && r.url == e && r.glb == t && r.materialClone === i;
|
|
4093
4108
|
});
|
|
4094
4109
|
}
|
|
4095
|
-
function
|
|
4110
|
+
function yr(a, e) {
|
|
4096
4111
|
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s = yt(n, !1);
|
|
4097
4112
|
a.geometry != null && a.geometry.dispose(), a.geometry = s, a.geometrys = n, a.castShadow = !0, a.receiveShadow = !0;
|
|
4098
4113
|
}
|
|
4099
|
-
async function
|
|
4114
|
+
async function Mr(a, e, t, i) {
|
|
4100
4115
|
const n = /* @__PURE__ */ new Map();
|
|
4101
4116
|
for (const r of t) {
|
|
4102
4117
|
const l = n.get(r.glb) ?? [];
|
|
@@ -4105,18 +4120,18 @@ async function fr(a, e, t, i) {
|
|
|
4105
4120
|
const s = at(e, a);
|
|
4106
4121
|
let o = performance.now();
|
|
4107
4122
|
for (const [r, l] of n.entries()) {
|
|
4108
|
-
const c = i ? l.length :
|
|
4123
|
+
const c = i ? l.length : Xo;
|
|
4109
4124
|
for (let d = 0; d < l.length; d += c) {
|
|
4110
4125
|
const u = l.slice(d, d + c);
|
|
4111
4126
|
if (u.length === 0)
|
|
4112
4127
|
continue;
|
|
4113
|
-
const m =
|
|
4114
|
-
let g =
|
|
4115
|
-
g = null, g != null ? (f = Array.isArray(g.geometrys) ? g.geometrys.length : 0, v =
|
|
4128
|
+
const m = _r(u[0].material, e);
|
|
4129
|
+
let g = fr(e, a, r, m), f = 0, v = 0;
|
|
4130
|
+
g = null, g != null ? (f = Array.isArray(g.geometrys) ? g.geometrys.length : 0, v = tn(g.geometry), yr(g, u)) : g = gr(a, e, r, u, m);
|
|
4116
4131
|
const b = /* @__PURE__ */ new Map();
|
|
4117
4132
|
let p = v;
|
|
4118
4133
|
u.forEach((x, C) => {
|
|
4119
|
-
const P = Number(x.name), I =
|
|
4134
|
+
const P = Number(x.name), I = tn(x.geometry), D = b.get(P) ?? [];
|
|
4120
4135
|
if (D.push([p, p + I]), b.set(P, D), s?.nodesMap?.has(P)) {
|
|
4121
4136
|
const R = s.nodesMap.get(P);
|
|
4122
4137
|
R.indexes == null && (R.indexes = []), R.indexes.push([g.index, f + C, p, p + I]);
|
|
@@ -4129,31 +4144,31 @@ async function fr(a, e, t, i) {
|
|
|
4129
4144
|
}
|
|
4130
4145
|
}
|
|
4131
4146
|
}
|
|
4132
|
-
function
|
|
4147
|
+
function vr(a, e) {
|
|
4133
4148
|
const t = a?.geometry;
|
|
4134
4149
|
return t instanceof pe ? (t.boundingBox == null && t.computeBoundingBox(), t.boundingBox?.clone().applyMatrix4(e) ?? null) : null;
|
|
4135
4150
|
}
|
|
4136
|
-
async function
|
|
4151
|
+
async function wr(a, e, t, i, n, s) {
|
|
4137
4152
|
if (i == null || n == null || n.length === 0)
|
|
4138
4153
|
return;
|
|
4139
4154
|
const o = at(t, a);
|
|
4140
4155
|
if (o == null)
|
|
4141
4156
|
return;
|
|
4142
4157
|
i.geometry.computeVertexNormals();
|
|
4143
|
-
const r = new W(i.geometry,
|
|
4158
|
+
const r = new W(i.geometry, ns(i.material), n.length);
|
|
4144
4159
|
rt(t, a).add(r);
|
|
4145
|
-
const c =
|
|
4146
|
-
|
|
4160
|
+
const c = _i(t, r);
|
|
4161
|
+
Ii(r, c);
|
|
4147
4162
|
const d = new Float32Array(n.length * 3);
|
|
4148
4163
|
for (let g = 0; g < n.length; g++)
|
|
4149
4164
|
d[g * 3] = 1, d[g * 3 + 1] = 1, d[g * 3 + 2] = 1;
|
|
4150
|
-
r.instanceColor = new
|
|
4165
|
+
r.instanceColor = new Ts(d, 3);
|
|
4151
4166
|
let u = performance.now();
|
|
4152
4167
|
const m = [];
|
|
4153
4168
|
for (let g = 0; g < n.length; g++) {
|
|
4154
4169
|
const f = n[g], v = new H();
|
|
4155
4170
|
v.elements = f.matrix;
|
|
4156
|
-
const b =
|
|
4171
|
+
const b = vr(i, v);
|
|
4157
4172
|
if (b != null && (f.box = b.clone()), r.setMatrixAt(g, v), r.matrixs || (r.matrixs = []), r.matrixs.push(v.clone()), m.push(v.clone()), o.nodesMap.has(f.id)) {
|
|
4158
4173
|
const p = o.nodesMap.get(f.id);
|
|
4159
4174
|
p.indexes == null && (p.indexes = []), p.indexes.push([c, g, 0, 0]), wt(p), b != null && p?.info != null && (p.info.box instanceof N ? p.info.box.union(b) : p.info.box = b.clone());
|
|
@@ -4166,11 +4181,11 @@ async function Mr(a, e, t, i, n, s) {
|
|
|
4166
4181
|
};
|
|
4167
4182
|
wt(p), o.nodesMap.set(f.id, p);
|
|
4168
4183
|
}
|
|
4169
|
-
(g + 1) %
|
|
4184
|
+
(g + 1) % Yo === 0 && (u = await je(t, s, u));
|
|
4170
4185
|
}
|
|
4171
4186
|
r.instanceMatrix.needsUpdate = !0, r.instanceColor != null && (r.instanceColor.needsUpdate = !0), r.materialClone = r.material, r.url = a, r.glb = i.glb, r.ids = n.map((g) => g.id), r.matrixsClone = m, r.meshIndex = e, t.requestComposerRender?.();
|
|
4172
4187
|
}
|
|
4173
|
-
async function
|
|
4188
|
+
async function xr(a, e, t, i) {
|
|
4174
4189
|
const n = e.instanceNodes;
|
|
4175
4190
|
if (n == null)
|
|
4176
4191
|
return;
|
|
@@ -4180,25 +4195,25 @@ async function vr(a, e, t, i) {
|
|
|
4180
4195
|
n[o].isLoaded = !0;
|
|
4181
4196
|
for (const r of n[o]) {
|
|
4182
4197
|
const l = e.glbs?.[o]?.[r.mesh];
|
|
4183
|
-
l != null && await
|
|
4198
|
+
l != null && await wr(a.url, r.mesh, t, l, r.children, i);
|
|
4184
4199
|
}
|
|
4185
4200
|
s = await je(t, i, s);
|
|
4186
4201
|
}
|
|
4187
4202
|
}
|
|
4188
|
-
async function
|
|
4203
|
+
async function br(a, e, t, i) {
|
|
4189
4204
|
if (t.status === !0 || t.meshPromise != null) {
|
|
4190
4205
|
await t.meshPromise;
|
|
4191
4206
|
return;
|
|
4192
4207
|
}
|
|
4193
4208
|
t.meshPromise = (async () => {
|
|
4194
4209
|
console.log(`[loadLightModel] start build lod meshes ${Date.now() - window.startTime}ms`);
|
|
4195
|
-
const n = await
|
|
4196
|
-
await
|
|
4210
|
+
const n = await ur(a, e, t, i);
|
|
4211
|
+
await Mr(e.url, a, n, i), await xr(e, t, a, i), t.instanceNodes = null, t.status = !0, console.log(`[loadLightModel] *****************************************************finish build lod meshes ${Date.now() - window.startTime}ms`);
|
|
4197
4212
|
})().finally(() => {
|
|
4198
4213
|
t.meshPromise = null;
|
|
4199
4214
|
}), await t.meshPromise;
|
|
4200
4215
|
}
|
|
4201
|
-
async function
|
|
4216
|
+
async function Cr(a, e, t, i) {
|
|
4202
4217
|
if (t.loadSuccess !== !0) {
|
|
4203
4218
|
if (t.preparePromise != null) {
|
|
4204
4219
|
await t.preparePromise;
|
|
@@ -4207,13 +4222,13 @@ async function xr(a, e, t, i) {
|
|
|
4207
4222
|
t.preparePromise = (async () => {
|
|
4208
4223
|
console.log("[loadLightModel] loading GLB bundle", t.path), t.glbs = t.glbs ?? {};
|
|
4209
4224
|
const n = e.url + t.path;
|
|
4210
|
-
|
|
4211
|
-
const s = await
|
|
4225
|
+
Wt(a, e.url, n), console.log(`[loadLightModel] ZIP 解压开始 ${Date.now() - window.startTime}ms`);
|
|
4226
|
+
const s = await Zn(n, e.key);
|
|
4212
4227
|
console.log(`[loadLightModel] ZIP 解压完成 ${Date.now() - window.startTime}ms`);
|
|
4213
|
-
const o = await
|
|
4228
|
+
const o = await en(s, ["/nodes.json", "nodes.json"]);
|
|
4214
4229
|
if (o == null)
|
|
4215
4230
|
return;
|
|
4216
|
-
const r =
|
|
4231
|
+
const r = qt(o), l = at(a, e.url);
|
|
4217
4232
|
if (l == null)
|
|
4218
4233
|
return;
|
|
4219
4234
|
l.nodesMap == null && (l.nodesMap = /* @__PURE__ */ new Map());
|
|
@@ -4232,11 +4247,11 @@ async function xr(a, e, t, i) {
|
|
|
4232
4247
|
continue;
|
|
4233
4248
|
C.infos.push(x), wt(C);
|
|
4234
4249
|
}
|
|
4235
|
-
(p + 1) %
|
|
4250
|
+
(p + 1) % Yn === 0 && (c = await je(a, i, c));
|
|
4236
4251
|
}
|
|
4237
4252
|
}
|
|
4238
4253
|
const u = async (v) => {
|
|
4239
|
-
let b = await
|
|
4254
|
+
let b = await ar(s, [`/${v}.glb`, `${v}.glb`, v + ".glb"]);
|
|
4240
4255
|
if (b == null) {
|
|
4241
4256
|
console.error("[loadLightModel] glb not found in zip", {
|
|
4242
4257
|
modelUrl: e.url,
|
|
@@ -4247,17 +4262,17 @@ async function xr(a, e, t, i) {
|
|
|
4247
4262
|
return;
|
|
4248
4263
|
}
|
|
4249
4264
|
try {
|
|
4250
|
-
const p = await
|
|
4265
|
+
const p = await lr(a, b);
|
|
4251
4266
|
b = null, t.glbs[v] = p.scene.children, t.glbs[v].forEach((x) => {
|
|
4252
4267
|
x.matrixWorld;
|
|
4253
|
-
}), await
|
|
4268
|
+
}), await hr(a, t.glbs[v], i);
|
|
4254
4269
|
} catch (p) {
|
|
4255
4270
|
console.error("[loadLightModel] failed to load glb", {
|
|
4256
4271
|
modelUrl: e.url,
|
|
4257
4272
|
lodPath: t.path,
|
|
4258
4273
|
glbKey: `${v}.glb`,
|
|
4259
|
-
dracoDecoderPath:
|
|
4260
|
-
basisTranscoderPath:
|
|
4274
|
+
dracoDecoderPath: Xn(),
|
|
4275
|
+
basisTranscoderPath: Qn(),
|
|
4261
4276
|
error: p
|
|
4262
4277
|
});
|
|
4263
4278
|
} finally {
|
|
@@ -4265,21 +4280,21 @@ async function xr(a, e, t, i) {
|
|
|
4265
4280
|
}
|
|
4266
4281
|
};
|
|
4267
4282
|
let m = 0;
|
|
4268
|
-
const g = Math.min(
|
|
4283
|
+
const g = Math.min(Qo, d.length);
|
|
4269
4284
|
await Promise.all(Array.from({ length: g }, async () => {
|
|
4270
4285
|
for (; m < d.length; ) {
|
|
4271
4286
|
const v = d[m++];
|
|
4272
4287
|
await u(v);
|
|
4273
4288
|
}
|
|
4274
4289
|
})), console.log(`[loadLightModel] 所有 GLB 加载完成 ${Date.now() - window.startTime}ms`);
|
|
4275
|
-
const f = await
|
|
4276
|
-
t.instanceNodes = f != null ?
|
|
4290
|
+
const f = await en(s, ["/instances.json", "instances.json"]);
|
|
4291
|
+
t.instanceNodes = f != null ? qt(f) : null, t.loadSuccess = !0;
|
|
4277
4292
|
})().finally(() => {
|
|
4278
4293
|
t.preparePromise = null;
|
|
4279
4294
|
}), await t.preparePromise;
|
|
4280
4295
|
}
|
|
4281
4296
|
}
|
|
4282
|
-
function
|
|
4297
|
+
function Ar(a, e, t) {
|
|
4283
4298
|
if (t.boundingBox || (t.boundingBox = new N(), t.boundingBox.min = new h(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new h(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
4284
4299
|
return 1e3;
|
|
4285
4300
|
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), l = new h(), c = new h(), d = new h(), u = new h();
|
|
@@ -4295,38 +4310,42 @@ function br(a, e, t) {
|
|
|
4295
4310
|
const g = u.clone().add(d.multiplyScalar(Math.max(m, r))), f = g.clone().add(l.setLength(t.maxSize)), v = new he(e, a.renderer, a.scene).worldToScreen(g), b = new he(e, a.renderer, a.scene).worldToScreen(f);
|
|
4296
4311
|
return v.distanceTo(b);
|
|
4297
4312
|
}
|
|
4298
|
-
async function
|
|
4299
|
-
t.maxSize < 1e6 && t.path != "/lod0" && (!(
|
|
4313
|
+
async function Sr(a, e, t, i) {
|
|
4314
|
+
t.maxSize < 1e6 && t.path != "/lod0" && (!(Ar(a, a.camera, t) >= $o) || t.status === !0) || (await Cr(a, e, t, i), t.loadSuccess === !0 && await br(a, e, t, i));
|
|
4300
4315
|
}
|
|
4301
|
-
function
|
|
4302
|
-
if (
|
|
4316
|
+
function Er(a, e, t) {
|
|
4317
|
+
if (is(e.loadStatus.modelMep))
|
|
4303
4318
|
return;
|
|
4304
4319
|
const i = at(a, e.url);
|
|
4305
4320
|
if (i == null)
|
|
4306
4321
|
return;
|
|
4307
4322
|
e.loadStatus.modelMep = "loading", i.modelMep == null && (i.modelMep = {}), (async () => {
|
|
4308
|
-
t || await
|
|
4323
|
+
t || await $n(), Bo(a, i.modelMep, e.url), e.loadStatus.modelMep = !0, jt(a);
|
|
4309
4324
|
})().catch((s) => {
|
|
4310
4325
|
e.loadStatus.modelMep = !1, console.error("[loadLightModel] failed to load mep model", s);
|
|
4311
4326
|
});
|
|
4312
4327
|
}
|
|
4313
|
-
function
|
|
4328
|
+
function Pr(a, e, t, i) {
|
|
4314
4329
|
const n = rt(a, e);
|
|
4315
4330
|
a.models || (a.models = []), window.startTime = Date.now();
|
|
4316
4331
|
let s = "WDDsBNtzVz6aSh/bCFh3CmjjANEDRryoXF1XCJvJjeE=";
|
|
4317
|
-
|
|
4318
|
-
const r =
|
|
4319
|
-
a.__loadingCompletedTriggered = !1
|
|
4332
|
+
nr(e + "/info", s).then((o) => {
|
|
4333
|
+
const r = qt(o), l = r?.baseInfo ?? {}, c = typeof l?.name == "string" ? l.name : "";
|
|
4334
|
+
a.__loadingCompletedTriggered = !1;
|
|
4335
|
+
const d = {
|
|
4320
4336
|
type: "light",
|
|
4321
4337
|
name: c,
|
|
4322
4338
|
status: "loading",
|
|
4323
4339
|
url: e,
|
|
4324
4340
|
loadStatus: {
|
|
4325
4341
|
modelMep: !1,
|
|
4326
|
-
normal: !1
|
|
4342
|
+
normal: !1,
|
|
4343
|
+
quotaList: "loading"
|
|
4327
4344
|
},
|
|
4328
4345
|
key: s
|
|
4329
|
-
}
|
|
4346
|
+
};
|
|
4347
|
+
a.engineStatus.models.push(d), r?.lods.forEach((m) => delete m.elements);
|
|
4348
|
+
const u = {
|
|
4330
4349
|
url: e,
|
|
4331
4350
|
urls: [e + "/info"],
|
|
4332
4351
|
group: n,
|
|
@@ -4346,37 +4365,42 @@ function Sr(a, e, t, i) {
|
|
|
4346
4365
|
min: new h(l.min.X * 0.3048, l.min.Z * 0.3048, -l.min.Y * 0.3048),
|
|
4347
4366
|
max: new h(l.max.X * 0.3048, l.max.Z * 0.3048, -l.max.Y * 0.3048)
|
|
4348
4367
|
}
|
|
4368
|
+
};
|
|
4369
|
+
a.models.push(u), rr(e + "/quota_list", s).then((m) => {
|
|
4370
|
+
m.exists && (u.quotaList = m.value ?? []), d.loadStatus.quotaList = !0, jt(a);
|
|
4371
|
+
}).catch((m) => {
|
|
4372
|
+
d.loadStatus.quotaList = !0, console.warn("[loadLightModel] unexpected quota_list load failure", { url: e, error: m }), jt(a);
|
|
4349
4373
|
}), a.models.length == i && (a.viewCube.CameraGoHome(1), setTimeout(() => {
|
|
4350
|
-
|
|
4374
|
+
ss(a, null, !1);
|
|
4351
4375
|
}, 100));
|
|
4352
4376
|
}).catch((o) => {
|
|
4353
4377
|
console.error("[loadLightModel] failed to load model info", { url: e, error: o });
|
|
4354
4378
|
});
|
|
4355
4379
|
}
|
|
4356
|
-
async function
|
|
4380
|
+
async function ss(a, e, t = !1) {
|
|
4357
4381
|
const i = a.engineStatus.models.filter((n) => e == null || n.url == e);
|
|
4358
4382
|
for (const n of i)
|
|
4359
|
-
if (
|
|
4383
|
+
if (ts(n), !(n.status !== "loading" || n.type !== "light") && (Er(a, n, t), !is(n.loadStatus.normal))) {
|
|
4360
4384
|
n.loadStatus.normal = "loading";
|
|
4361
4385
|
try {
|
|
4362
|
-
await
|
|
4386
|
+
await Tr(a, n, t);
|
|
4363
4387
|
} finally {
|
|
4364
|
-
const s =
|
|
4365
|
-
n.loadStatus.normal = o, o && (n.status = "loaded"),
|
|
4388
|
+
const s = es(a, n.url), o = s.length > 0 && s.every((r) => r.status === !0);
|
|
4389
|
+
n.loadStatus.normal = o, o && (n.status = "loaded"), jt(a);
|
|
4366
4390
|
}
|
|
4367
4391
|
}
|
|
4368
4392
|
}
|
|
4369
|
-
async function
|
|
4393
|
+
async function Tr(a, e, t = !1) {
|
|
4370
4394
|
console.log(`[loadLightModel] start loadNode ${Date.now() - window.startTime}ms`);
|
|
4371
|
-
const i =
|
|
4395
|
+
const i = es(a, e.url);
|
|
4372
4396
|
if (i.length !== 0)
|
|
4373
4397
|
for (const n of i)
|
|
4374
|
-
await
|
|
4398
|
+
await Sr(a, e, n, t);
|
|
4375
4399
|
}
|
|
4376
|
-
function
|
|
4377
|
-
return
|
|
4400
|
+
function _r(a, e) {
|
|
4401
|
+
return mr(a), a.map != null && (a.map.colorSpace = Ke, a.map.needsUpdate = !0), a.side = oe, a.shadowSide = oe, a.clipShadows = !0, e?.sectionPlane && (a.clippingPlanes = e.sectionPlane), a;
|
|
4378
4402
|
}
|
|
4379
|
-
const
|
|
4403
|
+
const Ir = "/__local_model__", Dr = /^(info|property|edge|quota_list|lod\d+)(?:\.zip)?$/i, Lr = /^(info|property|edge|quota_list|lod\d+)(?:~)?$/i;
|
|
4380
4404
|
class _e {
|
|
4381
4405
|
static localRequestMap = /* @__PURE__ */ new Map();
|
|
4382
4406
|
static localObjectUrls = /* @__PURE__ */ new Set();
|
|
@@ -4395,7 +4419,7 @@ class _e {
|
|
|
4395
4419
|
}
|
|
4396
4420
|
console.log("待加载模型", e);
|
|
4397
4421
|
for (const n of e)
|
|
4398
|
-
i(n) === "light" &&
|
|
4422
|
+
i(n) === "light" && Pr(this.engine, n, t, e.length);
|
|
4399
4423
|
function i(n) {
|
|
4400
4424
|
const s = n.split(".").pop();
|
|
4401
4425
|
return s === "glb" || s === "gltf" ? "gltf" : "light";
|
|
@@ -4411,12 +4435,12 @@ class _e {
|
|
|
4411
4435
|
for (let n = 0; n < e.length; n++) {
|
|
4412
4436
|
const s = e[n];
|
|
4413
4437
|
try {
|
|
4414
|
-
const o = await
|
|
4415
|
-
if (!await
|
|
4438
|
+
const o = await Ut.get(s, { responseType: "blob" });
|
|
4439
|
+
if (!await sn(o.data))
|
|
4416
4440
|
throw new Error("响应内容不是有效的 ZIP 文件");
|
|
4417
4441
|
i.push(new File(
|
|
4418
4442
|
[o.data],
|
|
4419
|
-
|
|
4443
|
+
kr(s, n),
|
|
4420
4444
|
{ type: o.data.type || "application/zip" }
|
|
4421
4445
|
));
|
|
4422
4446
|
} catch (o) {
|
|
@@ -4457,13 +4481,13 @@ class _e {
|
|
|
4457
4481
|
for (const l of t) {
|
|
4458
4482
|
const c = this.parseDirectPackageEntry(l.path);
|
|
4459
4483
|
if (c != null) {
|
|
4460
|
-
|
|
4484
|
+
on(i, c.modelKey).set(c.packageName, l.blob);
|
|
4461
4485
|
continue;
|
|
4462
4486
|
}
|
|
4463
4487
|
const d = this.parseExtractedPackageEntry(l.path);
|
|
4464
4488
|
if (d == null)
|
|
4465
4489
|
continue;
|
|
4466
|
-
const u =
|
|
4490
|
+
const u = on(n, d.modelKey), m = u.get(d.packageName) ?? [];
|
|
4467
4491
|
m.push({
|
|
4468
4492
|
path: d.innerPath,
|
|
4469
4493
|
blob: l.blob
|
|
@@ -4487,7 +4511,7 @@ class _e {
|
|
|
4487
4511
|
blob: await this.packEntriesAsZip(g)
|
|
4488
4512
|
});
|
|
4489
4513
|
c.some((m) => m.packageName === "info") && (r += 1, o.push({
|
|
4490
|
-
rootUrl: `${
|
|
4514
|
+
rootUrl: `${Ir}/${_e.createLocalModelId(l, r)}`,
|
|
4491
4515
|
packages: c
|
|
4492
4516
|
}));
|
|
4493
4517
|
}
|
|
@@ -4501,15 +4525,15 @@ class _e {
|
|
|
4501
4525
|
const t = [];
|
|
4502
4526
|
for (const i of e) {
|
|
4503
4527
|
const n = Le(i.webkitRelativePath || i.name), s = pt(n);
|
|
4504
|
-
if (
|
|
4528
|
+
if (nn(s)) {
|
|
4505
4529
|
t.push({ path: n, blob: i });
|
|
4506
4530
|
continue;
|
|
4507
4531
|
}
|
|
4508
|
-
if (await
|
|
4509
|
-
const o = await
|
|
4532
|
+
if (await sn(i)) {
|
|
4533
|
+
const o = await ui.loadAsync(i), r = si(n), l = Object.values(o.files);
|
|
4510
4534
|
for (const c of l)
|
|
4511
4535
|
c.dir || t.push({
|
|
4512
|
-
path:
|
|
4536
|
+
path: Br(r, Le(c.name)),
|
|
4513
4537
|
blob: await c.async("blob")
|
|
4514
4538
|
});
|
|
4515
4539
|
continue;
|
|
@@ -4522,10 +4546,10 @@ class _e {
|
|
|
4522
4546
|
* 识别已经打好的模型包文件,例如 `info`、`lod0.zip`。
|
|
4523
4547
|
*/
|
|
4524
4548
|
parseDirectPackageEntry(e) {
|
|
4525
|
-
const t =
|
|
4526
|
-
return
|
|
4549
|
+
const t = si(e), i = pt(e);
|
|
4550
|
+
return nn(i) ? {
|
|
4527
4551
|
modelKey: t,
|
|
4528
|
-
packageName:
|
|
4552
|
+
packageName: zr(i)
|
|
4529
4553
|
} : null;
|
|
4530
4554
|
}
|
|
4531
4555
|
/**
|
|
@@ -4534,7 +4558,7 @@ class _e {
|
|
|
4534
4558
|
parseExtractedPackageEntry(e) {
|
|
4535
4559
|
const t = Le(e).split("/").filter(Boolean);
|
|
4536
4560
|
for (let n = 0; n < t.length; n++) {
|
|
4537
|
-
const s =
|
|
4561
|
+
const s = Rr(t[n]);
|
|
4538
4562
|
if (s == null)
|
|
4539
4563
|
continue;
|
|
4540
4564
|
const o = t.slice(n + 1);
|
|
@@ -4546,8 +4570,8 @@ class _e {
|
|
|
4546
4570
|
};
|
|
4547
4571
|
}
|
|
4548
4572
|
const i = pt(e).toLowerCase();
|
|
4549
|
-
return i === "info.json" || i === "property.json" || i === "edge.json" ? {
|
|
4550
|
-
modelKey:
|
|
4573
|
+
return i === "info.json" || i === "property.json" || i === "edge.json" || i === "quota_list.json" ? {
|
|
4574
|
+
modelKey: si(e),
|
|
4551
4575
|
packageName: i.replace(".json", ""),
|
|
4552
4576
|
innerPath: i
|
|
4553
4577
|
} : null;
|
|
@@ -4556,7 +4580,7 @@ class _e {
|
|
|
4556
4580
|
* 把解压目录重新打包成 zip Blob,复用现有按包加载的实现。
|
|
4557
4581
|
*/
|
|
4558
4582
|
async packEntriesAsZip(e) {
|
|
4559
|
-
const t = new
|
|
4583
|
+
const t = new ui();
|
|
4560
4584
|
for (const i of e)
|
|
4561
4585
|
t.file(Le(i.path), i.blob);
|
|
4562
4586
|
return t.generateAsync({ type: "blob" });
|
|
@@ -4565,7 +4589,7 @@ class _e {
|
|
|
4565
4589
|
* 注册 axios 拦截器,把虚拟模型地址改写为对应的 Blob URL。
|
|
4566
4590
|
*/
|
|
4567
4591
|
static ensureLocalRequestInterceptor() {
|
|
4568
|
-
_e.interceptorInstalled || (
|
|
4592
|
+
_e.interceptorInstalled || (Ut.interceptors.request.use((e) => {
|
|
4569
4593
|
if (typeof e.url == "string") {
|
|
4570
4594
|
const t = _e.normalizeRequestKey(e.url), i = _e.localRequestMap.get(t);
|
|
4571
4595
|
i != null && (e.url = i);
|
|
@@ -4605,11 +4629,11 @@ function pt(a) {
|
|
|
4605
4629
|
const e = Le(a), t = e.lastIndexOf("/");
|
|
4606
4630
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
4607
4631
|
}
|
|
4608
|
-
function
|
|
4632
|
+
function si(a) {
|
|
4609
4633
|
const e = Le(a), t = e.lastIndexOf("/");
|
|
4610
4634
|
return t >= 0 ? e.slice(0, t) : "";
|
|
4611
4635
|
}
|
|
4612
|
-
function
|
|
4636
|
+
function kr(a, e) {
|
|
4613
4637
|
try {
|
|
4614
4638
|
const t = new URL(a, window.location.origin);
|
|
4615
4639
|
return decodeURIComponent(pt(t.pathname)) || `model-package-${e + 1}.zip`;
|
|
@@ -4617,28 +4641,28 @@ function Dr(a, e) {
|
|
|
4617
4641
|
return pt(a.split("?")[0].split("#")[0]) || `model-package-${e + 1}.zip`;
|
|
4618
4642
|
}
|
|
4619
4643
|
}
|
|
4620
|
-
function
|
|
4644
|
+
function Br(a, e) {
|
|
4621
4645
|
return Le(a ? e ? `${a}/${e}` : a : e);
|
|
4622
4646
|
}
|
|
4623
|
-
function
|
|
4624
|
-
return
|
|
4647
|
+
function nn(a) {
|
|
4648
|
+
return Dr.test(a);
|
|
4625
4649
|
}
|
|
4626
|
-
function
|
|
4650
|
+
function zr(a) {
|
|
4627
4651
|
return a.replace(/\.zip$/i, "").toLowerCase();
|
|
4628
4652
|
}
|
|
4629
|
-
function
|
|
4630
|
-
const e =
|
|
4653
|
+
function Rr(a) {
|
|
4654
|
+
const e = Lr.exec(a);
|
|
4631
4655
|
return e == null ? null : e[1].toLowerCase();
|
|
4632
4656
|
}
|
|
4633
|
-
async function
|
|
4657
|
+
async function sn(a) {
|
|
4634
4658
|
const e = await a.slice(0, 4).arrayBuffer(), t = new Uint8Array(e);
|
|
4635
4659
|
return t.length >= 4 && t[0] === 80 && t[1] === 75 && t[2] === 3 && t[3] === 4;
|
|
4636
4660
|
}
|
|
4637
|
-
function
|
|
4661
|
+
function on(a, e) {
|
|
4638
4662
|
let t = a.get(e);
|
|
4639
4663
|
return t == null && (t = /* @__PURE__ */ new Map(), a.set(e, t)), t;
|
|
4640
4664
|
}
|
|
4641
|
-
class
|
|
4665
|
+
class Or {
|
|
4642
4666
|
engine;
|
|
4643
4667
|
isFree;
|
|
4644
4668
|
// 是否是编辑模式
|
|
@@ -4661,7 +4685,7 @@ class zr {
|
|
|
4661
4685
|
}
|
|
4662
4686
|
init() {
|
|
4663
4687
|
this.engine.renderer?.domElement?.addEventListener("contextmenu", this.handleContextMenu, !0), this.engine.events.on(se.EngineFree, (e) => {
|
|
4664
|
-
this.updateFree(!0),
|
|
4688
|
+
this.updateFree(!0), ss(this.engine, e, !1), this.engine?.octreeBox?.requestBvhBuild?.();
|
|
4665
4689
|
}), this.engine.events.on(se.EngineBusy, () => {
|
|
4666
4690
|
this.updateFree(!1);
|
|
4667
4691
|
});
|
|
@@ -4680,7 +4704,7 @@ class zr {
|
|
|
4680
4704
|
closeAllFunction = () => {
|
|
4681
4705
|
};
|
|
4682
4706
|
}
|
|
4683
|
-
class
|
|
4707
|
+
class Fr {
|
|
4684
4708
|
// 使用字符串作为键,以确保不同来源的 EventType 枚举值能够正确匹配
|
|
4685
4709
|
listeners = /* @__PURE__ */ new Map();
|
|
4686
4710
|
// 是否启用调试模式(可以通过外部设置)
|
|
@@ -4736,8 +4760,8 @@ class Rr {
|
|
|
4736
4760
|
});
|
|
4737
4761
|
}
|
|
4738
4762
|
}
|
|
4739
|
-
const mt = 1,
|
|
4740
|
-
class
|
|
4763
|
+
const mt = 1, oi = 1, Hr = 1800, rn = 1024, Nr = 1.35, Vr = 20, Ur = 1200, ri = 0.5, Gr = 10, Wr = 0.08, ai = 500, an = 5e4, ln = 120, Kr = 5e4, cn = 0.12, qr = 8, jr = 0.75, hn = 5e-5, Yr = 15e-4, Xr = 2.5, Qr = 2.4, $r = 4.5, Zr = 0.94, Jr = 0.995, ea = 80, ta = 0.06, ia = 8, na = new h(-1, 4, 2).normalize();
|
|
4764
|
+
class sa {
|
|
4741
4765
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
4742
4766
|
engine;
|
|
4743
4767
|
// 上一次应用到阴影相机的半边长,用于跳过无意义的小幅更新。
|
|
@@ -4768,8 +4792,8 @@ class ia {
|
|
|
4768
4792
|
*/
|
|
4769
4793
|
init() {
|
|
4770
4794
|
const e = new Ue(16774630, 5);
|
|
4771
|
-
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width =
|
|
4772
|
-
const t =
|
|
4795
|
+
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width = rn, e.shadow.mapSize.height = rn, e.shadow.camera.near = ri, e.shadow.camera.far = ai, e.shadow.bias = -hn, e.shadow.normalBias = cn;
|
|
4796
|
+
const t = oi;
|
|
4773
4797
|
e.shadow.camera.left = -t, e.shadow.camera.right = t, e.shadow.camera.top = t, e.shadow.camera.bottom = -t, e.shadow.radius = 2, e.shadow.intensity = mt, e.target.name = "directionalShadowLightTarget";
|
|
4774
4798
|
const i = new Ue(16777215, 2);
|
|
4775
4799
|
i.name = "directionalFillLight", this.engine.scene.add(e), this.engine.scene.add(e.target), this.engine.scene.add(i), this.engine.scene.dirLight = i, this.engine.scene.dirLightShadow = e, this.engine.scene.dirLightShodow = e;
|
|
@@ -4800,16 +4824,16 @@ class ia {
|
|
|
4800
4824
|
}
|
|
4801
4825
|
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l), d = this.getSceneShadowHalfSize(s, c), u = O.clamp(
|
|
4802
4826
|
Math.max(
|
|
4803
|
-
c *
|
|
4827
|
+
c * Nr,
|
|
4804
4828
|
d,
|
|
4805
|
-
|
|
4829
|
+
oi
|
|
4806
4830
|
),
|
|
4807
|
-
|
|
4808
|
-
|
|
4831
|
+
oi,
|
|
4832
|
+
Hr
|
|
4809
4833
|
), m = O.clamp(
|
|
4810
|
-
Math.max(u * 2.5, o * 0.75,
|
|
4811
|
-
|
|
4812
|
-
|
|
4834
|
+
Math.max(u * 2.5, o * 0.75, ln),
|
|
4835
|
+
ln,
|
|
4836
|
+
Kr
|
|
4813
4837
|
), g = this.getLightOffsetDirection(), f = this.snapShadowTargetToTexel(
|
|
4814
4838
|
l,
|
|
4815
4839
|
g,
|
|
@@ -4842,7 +4866,7 @@ class ia {
|
|
|
4842
4866
|
return 0;
|
|
4843
4867
|
if (t <= 0)
|
|
4844
4868
|
return e * 0.75;
|
|
4845
|
-
const i = t *
|
|
4869
|
+
const i = t * Vr;
|
|
4846
4870
|
return Math.min(e * 0.75, i);
|
|
4847
4871
|
}
|
|
4848
4872
|
/**
|
|
@@ -4854,15 +4878,15 @@ class ia {
|
|
|
4854
4878
|
updateShadowBias(e, t, i) {
|
|
4855
4879
|
const n = Math.max(e.shadow.mapSize.width, 1), s = t * 2 / n, o = Math.max(i.far - i.near, 1);
|
|
4856
4880
|
e.shadow.normalBias = O.clamp(
|
|
4857
|
-
s *
|
|
4858
|
-
|
|
4859
|
-
|
|
4881
|
+
s * jr,
|
|
4882
|
+
cn,
|
|
4883
|
+
qr
|
|
4860
4884
|
);
|
|
4861
|
-
const r = s / o *
|
|
4885
|
+
const r = s / o * Xr;
|
|
4862
4886
|
e.shadow.bias = -O.clamp(
|
|
4863
4887
|
r,
|
|
4864
|
-
|
|
4865
|
-
|
|
4888
|
+
hn,
|
|
4889
|
+
Yr
|
|
4866
4890
|
);
|
|
4867
4891
|
}
|
|
4868
4892
|
/**
|
|
@@ -4885,22 +4909,22 @@ class ia {
|
|
|
4885
4909
|
}
|
|
4886
4910
|
if (Number.isFinite(c) && Number.isFinite(d)) {
|
|
4887
4911
|
const u = Math.max(
|
|
4888
|
-
(d - c) *
|
|
4889
|
-
|
|
4890
|
-
), m = Math.max(
|
|
4912
|
+
(d - c) * Wr,
|
|
4913
|
+
Gr
|
|
4914
|
+
), m = Math.max(ri, c - u), g = O.clamp(
|
|
4891
4915
|
Math.max(m + 1, d + u),
|
|
4892
4916
|
m + 1,
|
|
4893
|
-
|
|
4917
|
+
an
|
|
4894
4918
|
);
|
|
4895
4919
|
return { near: m, far: g };
|
|
4896
4920
|
}
|
|
4897
4921
|
}
|
|
4898
4922
|
const r = O.clamp(
|
|
4899
|
-
Math.max(n * 1.5, s * 4,
|
|
4900
|
-
|
|
4901
|
-
|
|
4923
|
+
Math.max(n * 1.5, s * 4, ai),
|
|
4924
|
+
ai,
|
|
4925
|
+
an
|
|
4902
4926
|
);
|
|
4903
|
-
return { near:
|
|
4927
|
+
return { near: ri, far: r };
|
|
4904
4928
|
}
|
|
4905
4929
|
/**
|
|
4906
4930
|
* 获取包围盒 8 个顶点。
|
|
@@ -5002,7 +5026,7 @@ class ia {
|
|
|
5002
5026
|
}
|
|
5003
5027
|
if (e instanceof ft) {
|
|
5004
5028
|
const i = this.resolveShadowTarget(e, t), n = Math.max(e.position.distanceTo(i), 1), s = O.degToRad(e.getEffectiveFOV() * 0.5), o = Math.max(Math.tan(s) * n, 1), r = o * Math.max(e.aspect, 1e-6);
|
|
5005
|
-
return Math.min(Math.max(r, o),
|
|
5029
|
+
return Math.min(Math.max(r, o), Ur);
|
|
5006
5030
|
}
|
|
5007
5031
|
return 0;
|
|
5008
5032
|
}
|
|
@@ -5029,7 +5053,7 @@ class ia {
|
|
|
5029
5053
|
* @returns 标准化后的世界空间光源偏移方向。
|
|
5030
5054
|
*/
|
|
5031
5055
|
getLightOffsetDirection() {
|
|
5032
|
-
return
|
|
5056
|
+
return na.clone();
|
|
5033
5057
|
}
|
|
5034
5058
|
/**
|
|
5035
5059
|
* 根据当前视角和阴影贴图密度计算最终显示强度。
|
|
@@ -5042,8 +5066,8 @@ class ia {
|
|
|
5042
5066
|
getShadowDisplayIntensity(e, t, i, n) {
|
|
5043
5067
|
const s = i * 2 / Math.max(n, 1), o = 1 - O.smoothstep(
|
|
5044
5068
|
s,
|
|
5045
|
-
|
|
5046
|
-
|
|
5069
|
+
Qr,
|
|
5070
|
+
$r
|
|
5047
5071
|
);
|
|
5048
5072
|
let r = 1;
|
|
5049
5073
|
if (e) {
|
|
@@ -5052,8 +5076,8 @@ class ia {
|
|
|
5052
5076
|
const c = Math.abs(l.dot(t.clone().normalize()));
|
|
5053
5077
|
r = 1 - O.smoothstep(
|
|
5054
5078
|
c,
|
|
5055
|
-
|
|
5056
|
-
|
|
5079
|
+
Zr,
|
|
5080
|
+
Jr
|
|
5057
5081
|
);
|
|
5058
5082
|
}
|
|
5059
5083
|
return mt * Math.min(o, r);
|
|
@@ -5098,10 +5122,10 @@ class ia {
|
|
|
5098
5122
|
if (i.isEmpty())
|
|
5099
5123
|
return;
|
|
5100
5124
|
const n = i.getSize(new h()), s = Math.max(n.x, n.z), o = Math.max(
|
|
5101
|
-
|
|
5102
|
-
s *
|
|
5125
|
+
ia,
|
|
5126
|
+
s * ta
|
|
5103
5127
|
);
|
|
5104
|
-
if (s >=
|
|
5128
|
+
if (s >= ea && n.y <= o) {
|
|
5105
5129
|
e.castShadow = !1, t.__lightModuleReceiverOnlyShadow = !0;
|
|
5106
5130
|
return;
|
|
5107
5131
|
}
|
|
@@ -5114,10 +5138,10 @@ class ia {
|
|
|
5114
5138
|
setBackSideShadowCasting(e) {
|
|
5115
5139
|
const t = Array.isArray(e) ? e : [e];
|
|
5116
5140
|
for (const i of t)
|
|
5117
|
-
i && (i.shadowSide =
|
|
5141
|
+
i && (i.shadowSide = wi);
|
|
5118
5142
|
}
|
|
5119
5143
|
}
|
|
5120
|
-
class
|
|
5144
|
+
class oa {
|
|
5121
5145
|
engine;
|
|
5122
5146
|
behavior;
|
|
5123
5147
|
isCtrlDown = !1;
|
|
@@ -5552,7 +5576,7 @@ class na {
|
|
|
5552
5576
|
return e?.nodesMap?.get(t) ?? e?.nodesMap?.get(Number(t)) ?? e?.nodesMap?.get(String(t));
|
|
5553
5577
|
}
|
|
5554
5578
|
}
|
|
5555
|
-
class
|
|
5579
|
+
class ra {
|
|
5556
5580
|
engine;
|
|
5557
5581
|
highlightMaterial;
|
|
5558
5582
|
translucentMaterial;
|
|
@@ -5765,7 +5789,7 @@ class sa {
|
|
|
5765
5789
|
const u = this.getSceneModel(d[0]);
|
|
5766
5790
|
u instanceof W ? o.has(d[0]) ? o.get(d[0])?.push(d[1]) : o.set(d[0], [d[1]]) : this.setSplitComponentState(u, d[1], 1, !0);
|
|
5767
5791
|
});
|
|
5768
|
-
}),
|
|
5792
|
+
}), aa(o, this.engine);
|
|
5769
5793
|
let r = this.engine.engineStatus.highlightModels.find((l) => l.url == t.url);
|
|
5770
5794
|
r != null ? (Array.isArray(r.guids) || (r.guids = this.getModelGuids(i, r.ids)), n.forEach((l, c) => {
|
|
5771
5795
|
const d = r.ids.indexOf(l);
|
|
@@ -5795,7 +5819,7 @@ class sa {
|
|
|
5795
5819
|
!0
|
|
5796
5820
|
);
|
|
5797
5821
|
});
|
|
5798
|
-
}),
|
|
5822
|
+
}), dn(n, this.engine, "highlightModel");
|
|
5799
5823
|
}), this.rebatchSplitModels(), this.updateMaterial(), this.syncHighlightModelEdges(this.getHighlightModelsAfterRemove(e)), this.syncExplodeVisualState();
|
|
5800
5824
|
}
|
|
5801
5825
|
// 取消所有模型高亮
|
|
@@ -5819,7 +5843,7 @@ class sa {
|
|
|
5819
5843
|
const c = this.getSceneModel(l[0]);
|
|
5820
5844
|
c instanceof W ? n.has(l[0]) ? n.get(l[0])?.push(l[1]) : n.set(l[0], [l[1]]) : this.setSplitComponentState(c, l[1], -1, !1);
|
|
5821
5845
|
});
|
|
5822
|
-
}), n.size > 0 &&
|
|
5846
|
+
}), n.size > 0 && ca(n, this.engine);
|
|
5823
5847
|
let s = this.engine.engineStatus.hideModels.find((o) => o.url == t.url);
|
|
5824
5848
|
s != null ? this.appendUniqueIds(s.ids, t.ids) : this.engine.engineStatus.hideModels.push({
|
|
5825
5849
|
url: t.url,
|
|
@@ -5845,7 +5869,7 @@ class sa {
|
|
|
5845
5869
|
!0
|
|
5846
5870
|
);
|
|
5847
5871
|
});
|
|
5848
|
-
}), s.size > 0 &&
|
|
5872
|
+
}), s.size > 0 && un(s, this.engine), t)
|
|
5849
5873
|
return;
|
|
5850
5874
|
let o = this.engine.engineStatus.hideModels.find((r) => r.url == i.url);
|
|
5851
5875
|
o && (i.ids.forEach((r) => {
|
|
@@ -6156,7 +6180,7 @@ class sa {
|
|
|
6156
6180
|
const c = this.getSceneModel(l[0]);
|
|
6157
6181
|
c instanceof W ? n.has(l[0]) ? n.get(l[0])?.push(l[1]) : n.set(l[0], [l[1]]) : this.setSplitComponentState(c, l[1], 2, !0);
|
|
6158
6182
|
});
|
|
6159
|
-
}),
|
|
6183
|
+
}), la(n, this.engine);
|
|
6160
6184
|
let s = this.engine.engineStatus.translucentModels.find((o) => o.url == t.url);
|
|
6161
6185
|
s != null ? s.ids.push(...t.ids) : this.engine.engineStatus.translucentModels.push({
|
|
6162
6186
|
url: t.url,
|
|
@@ -6182,7 +6206,7 @@ class sa {
|
|
|
6182
6206
|
!0
|
|
6183
6207
|
);
|
|
6184
6208
|
});
|
|
6185
|
-
}), n.size > 0 &&
|
|
6209
|
+
}), n.size > 0 && un(n, this.engine), dn(n, this.engine, "translucentModel");
|
|
6186
6210
|
}), this.engine.engineStatus.translucentModels = [], this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
6187
6211
|
}
|
|
6188
6212
|
// ***************************************************** 设置模型半透明 ***************************************************** //
|
|
@@ -6230,7 +6254,7 @@ class sa {
|
|
|
6230
6254
|
}
|
|
6231
6255
|
// ***************************************************** 设置模型颜色 ***************************************************** //
|
|
6232
6256
|
}
|
|
6233
|
-
function
|
|
6257
|
+
function aa(a, e) {
|
|
6234
6258
|
a.forEach((t, i) => {
|
|
6235
6259
|
const n = At(e, i);
|
|
6236
6260
|
if (!(n instanceof W))
|
|
@@ -6263,7 +6287,7 @@ function oa(a, e) {
|
|
|
6263
6287
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
6264
6288
|
});
|
|
6265
6289
|
}
|
|
6266
|
-
function
|
|
6290
|
+
function dn(a, e, t) {
|
|
6267
6291
|
a.forEach((i, n) => {
|
|
6268
6292
|
const s = At(e, n);
|
|
6269
6293
|
if (!(s instanceof W))
|
|
@@ -6281,11 +6305,11 @@ function hn(a, e, t) {
|
|
|
6281
6305
|
e.scene.traverse((r) => {
|
|
6282
6306
|
r.key == n && r.name == t && o.push(r);
|
|
6283
6307
|
}), o.forEach((r) => {
|
|
6284
|
-
|
|
6308
|
+
os(r);
|
|
6285
6309
|
});
|
|
6286
6310
|
});
|
|
6287
6311
|
}
|
|
6288
|
-
function
|
|
6312
|
+
function la(a, e) {
|
|
6289
6313
|
a.forEach((t, i) => {
|
|
6290
6314
|
const n = At(e, i);
|
|
6291
6315
|
if (!(n instanceof W))
|
|
@@ -6312,12 +6336,12 @@ function ra(a, e) {
|
|
|
6312
6336
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
6313
6337
|
});
|
|
6314
6338
|
}
|
|
6315
|
-
function
|
|
6339
|
+
function ca(a, e) {
|
|
6316
6340
|
const t = [];
|
|
6317
6341
|
e.scene.traverse((i) => {
|
|
6318
6342
|
i.name == "highlightModel" && t.push(i);
|
|
6319
6343
|
}), t.forEach((i) => {
|
|
6320
|
-
|
|
6344
|
+
os(i);
|
|
6321
6345
|
}), a.forEach((i, n) => {
|
|
6322
6346
|
const s = At(e, n);
|
|
6323
6347
|
if (!(s instanceof W))
|
|
@@ -6331,7 +6355,7 @@ function aa(a, e) {
|
|
|
6331
6355
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
6332
6356
|
});
|
|
6333
6357
|
}
|
|
6334
|
-
function
|
|
6358
|
+
function un(a, e) {
|
|
6335
6359
|
a.forEach((t, i) => {
|
|
6336
6360
|
const n = At(e, i);
|
|
6337
6361
|
n instanceof W && (t.forEach((s) => {
|
|
@@ -6352,7 +6376,7 @@ function bt(a, e, t) {
|
|
|
6352
6376
|
function Ct(a, e) {
|
|
6353
6377
|
a?.cloneModel != null && (a.cloneModel.visible = e);
|
|
6354
6378
|
}
|
|
6355
|
-
function
|
|
6379
|
+
function os(a) {
|
|
6356
6380
|
if (a == null)
|
|
6357
6381
|
return;
|
|
6358
6382
|
const e = a.parent;
|
|
@@ -6361,8 +6385,8 @@ function ss(a) {
|
|
|
6361
6385
|
function At(a, e) {
|
|
6362
6386
|
return Fe(a, e);
|
|
6363
6387
|
}
|
|
6364
|
-
const
|
|
6365
|
-
class
|
|
6388
|
+
const rs = "advanced";
|
|
6389
|
+
class ha {
|
|
6366
6390
|
engine;
|
|
6367
6391
|
currentMode = "";
|
|
6368
6392
|
// 是否为手动设置(手动设置时,自动适配不再生效)
|
|
@@ -6380,7 +6404,7 @@ class la {
|
|
|
6380
6404
|
* 初始化模块
|
|
6381
6405
|
*/
|
|
6382
6406
|
init() {
|
|
6383
|
-
this.cachePassReferences(), this.autoSwitch(
|
|
6407
|
+
this.cachePassReferences(), this.autoSwitch(rs);
|
|
6384
6408
|
}
|
|
6385
6409
|
/**
|
|
6386
6410
|
* 手动切换渲染模式(用户调用),锁定自动适配
|
|
@@ -6547,7 +6571,7 @@ class la {
|
|
|
6547
6571
|
this.gtaoPass && (this.gtaoPass.blendIntensity = e);
|
|
6548
6572
|
}
|
|
6549
6573
|
}
|
|
6550
|
-
class
|
|
6574
|
+
class Yt {
|
|
6551
6575
|
engine;
|
|
6552
6576
|
overlayMaterial;
|
|
6553
6577
|
overlayMeshes = [];
|
|
@@ -6586,7 +6610,7 @@ class Kt {
|
|
|
6586
6610
|
color: 16777215,
|
|
6587
6611
|
transparent: !0,
|
|
6588
6612
|
opacity: 0,
|
|
6589
|
-
blending:
|
|
6613
|
+
blending: Ls,
|
|
6590
6614
|
depthWrite: !1
|
|
6591
6615
|
}), this.overlayMaterial.clippingPlanes = this.engine.sectionPlane;
|
|
6592
6616
|
}
|
|
@@ -6625,10 +6649,10 @@ class Kt {
|
|
|
6625
6649
|
if (this.animState === "idle" || this.overlayMeshes.length === 0) return;
|
|
6626
6650
|
const e = performance.now() - this.animStartTime, t = this.overlayMaterial.userData.targetOpacity ?? 0.35;
|
|
6627
6651
|
if (this.animState === "fadeIn") {
|
|
6628
|
-
const i = Math.min(e /
|
|
6652
|
+
const i = Math.min(e / Yt.FADE_IN_MS, 1);
|
|
6629
6653
|
this.overlayMaterial.opacity = this.easeOutQuad(i) * t, i >= 1 && (this.animState = "idle", this.setAnimationFrameRateExempt(!1));
|
|
6630
6654
|
} else if (this.animState === "fadeOut") {
|
|
6631
|
-
const i = Math.min(e /
|
|
6655
|
+
const i = Math.min(e / Yt.FADE_OUT_MS, 1);
|
|
6632
6656
|
this.overlayMaterial.opacity = (1 - this.easeOutQuad(i)) * t, i >= 1 && (this.removeOverlayMeshes(), this.animState = "idle", this.setAnimationFrameRateExempt(!1));
|
|
6633
6657
|
}
|
|
6634
6658
|
}
|
|
@@ -6651,10 +6675,10 @@ class Kt {
|
|
|
6651
6675
|
this.setAnimationFrameRateExempt(!1), this.removeOverlayMeshes(), this.overlayMaterial.dispose(), this.tagDiv?.remove?.(), this.tagDiv = null, this.animState = "idle";
|
|
6652
6676
|
}
|
|
6653
6677
|
}
|
|
6654
|
-
function
|
|
6655
|
-
return new
|
|
6678
|
+
function da() {
|
|
6679
|
+
return new xi();
|
|
6656
6680
|
}
|
|
6657
|
-
function
|
|
6681
|
+
function ua(a, e) {
|
|
6658
6682
|
a.appendChild(e.domElement);
|
|
6659
6683
|
}
|
|
6660
6684
|
const Xe = {
|
|
@@ -6666,7 +6690,7 @@ const Xe = {
|
|
|
6666
6690
|
front: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAABp0lEQVR4nO3ZwWnDQBBA0XFwM9uA23FtbkcNqByngxCCzQb/985CzOEzaFeXmXkOWdeZmfM8d8/BBmut+do9BHsJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAoi77h7gne73+xzH8bL33W63eTweL3vff2ADxAkgTgBxAogTQNxHnwJ+8olf9H9hA8QJIE4AcQKIE0CcAOIEECeAOAHEZW8Cj+OYtdavn//Um0MbIE4AcQKIE0CcAOKyp4CZmfM8d4+wnQ0QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiLvMzNNv0aa1lg1QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxF1m5rl7CPb5Bhi1Gm3j3a/lAAAAAElFTkSuQmCC",
|
|
6667
6691
|
back: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAADuklEQVR4nO3dMUvjYADG8cfjlsxugkRBkAwuog5+gJKAk1un4iLZbAQds+nioG7FzamDH0BXN4ngKg6i0k0IuEhGbzlFvCY1veR97/I8vzURnuFPkzYBJwC8QWj9BIDb21vbO8QCz/Pww/YIsUsBkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAC5n7YHVK3T6SBJkrH/fmVlBe12GwDg+35Vs/5ZjQvgbyVJ8hFQFEUIwxDr6+uYnp62vKweugSM0Ov10Gq1cHFxYXtKLRTAN0VRhLOzM9szKqcASojjGDc3N7ZnVEoBlHR8fGx7QqXobgKH/XucLMtweXmJfr8/8htEkiQYDAaNuSnUJwAAx3Hg+z5OT08/vgIWeXx8rH+UIQrgi52dHbiua3uGMQrgC8dxsLq6anuGMQpgDDMzM7YnVEYBDPHy8pJ7zHXdxtwAAgrgD3d3dzg/P8893u12zY0xQAF8kqYp9vf3c48HQdC4B0R0vwMMk6Yprq+vEUVR7jlBEGBvb8/gKjPoAvA8r/TfhGGIra2tGtbYRxdAGWEYwvd9zM/P255SG90DFJiamsLDw4PtGbVSAAXiOEYURfA8r5GPggEF8G1xHKPT6SBNU9tTKqUASkiSBNvb28iyzPaUytDdBA57HAx8/5FwkiQ4OTlpzLcCfQL89vmR8O7ubuG5vV4Pg8HA0LJ6KYAhNjY2EARB4TlXV1eG1tRLAeRotVqFx/MuJf8bBZBjdna28Pj9/b2hJfVSADleX19tTzBCAeR4fn4uPD45OWloSb0UwBBZlqHf7xees7CwYGhNvRTAEAcHByNfD5+bmzO0pl50PwTleX8n4OjoCE9PT4Xnuq6LpaUlQ8vqRRfAOO8DfNXtduE4TgVr7NMloKSmvRamAEpo4mthdJeAcYVhiM3NzcZ89L9TACO0222sra1hcXHR9pRaKIAhDg8PAQDLy8uN+cEnzwSAt6Y82JByPM/TTSA7BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkJsA8GZ7hNjzC2Yhv7BCBMu8AAAAAElFTkSuQmCC"
|
|
6668
6692
|
};
|
|
6669
|
-
function
|
|
6693
|
+
function pa(a, e, t) {
|
|
6670
6694
|
var i = new Object();
|
|
6671
6695
|
i.visible = !0;
|
|
6672
6696
|
let n = null, s = 0, o, r, l = [];
|
|
@@ -6852,8 +6876,8 @@ function da(a, e, t) {
|
|
|
6852
6876
|
}), ze.easing(lt.Easing.Cubic.InOut), g(), ze.start(), Ye();
|
|
6853
6877
|
} else {
|
|
6854
6878
|
var M = w.min.clone().add(w.max.clone()).multiplyScalar(0.5);
|
|
6855
|
-
let
|
|
6856
|
-
var L = M.clone().add(
|
|
6879
|
+
let ms = e.camera.position.clone().sub(a.controls.target.clone()).normalize();
|
|
6880
|
+
var L = M.clone().add(ms.multiplyScalar(2 * w.max.distanceTo(w.min)));
|
|
6857
6881
|
D(e.camera.position, L, a.controls.target.clone(), M);
|
|
6858
6882
|
}
|
|
6859
6883
|
};
|
|
@@ -6966,7 +6990,7 @@ function da(a, e, t) {
|
|
|
6966
6990
|
}
|
|
6967
6991
|
}
|
|
6968
6992
|
function k() {
|
|
6969
|
-
i.sceneOrtho =
|
|
6993
|
+
i.sceneOrtho = da();
|
|
6970
6994
|
var E = t.clientWidth, B = t.clientWidth, w = E > B ? E / B : B / E, M = 300;
|
|
6971
6995
|
i.camera = new Se(
|
|
6972
6996
|
M * w / -2,
|
|
@@ -6976,12 +7000,12 @@ function da(a, e, t) {
|
|
|
6976
7000
|
0.01,
|
|
6977
7001
|
1e4
|
|
6978
7002
|
);
|
|
6979
|
-
var E = o.clientWidth, B = o.clientHeight, L = new
|
|
7003
|
+
var E = o.clientWidth, B = o.clientHeight, L = new bi({
|
|
6980
7004
|
alpha: !0
|
|
6981
7005
|
});
|
|
6982
7006
|
L.setSize(E, B), L.setClearAlpha(0), i.sceneOrtho.renderer = L;
|
|
6983
7007
|
let _ = new Rt(16777215, 0.8);
|
|
6984
|
-
i.sceneOrtho.add(_),
|
|
7008
|
+
i.sceneOrtho.add(_), ua(o, L), i.orbitControls = new Un(a, i.camera, o), i.orbitControls.enableZoom = !1, i.orbitControls.enablePan = !1, i.orbitControls.enableDamping = !0, i.orbitControls.dampingFactor = 0.1, i.orbitControls.rotateSpeed = 0.5, i.orbitControls.addEventListener("start", Y), i.orbitControls.addEventListener("change", ie), i.orbitControls.addEventListener("end", $);
|
|
6985
7009
|
}
|
|
6986
7010
|
let U = !1;
|
|
6987
7011
|
function Y() {
|
|
@@ -7286,7 +7310,7 @@ function da(a, e, t) {
|
|
|
7286
7310
|
!document.fullscreenElement && !document.webkitFullscreenElement && !document.mozFullScreenElement && !document.msFullscreenElement ? (w.requestFullscreen ? w.requestFullscreen() : w.webkitRequestFullscreen ? w.webkitRequestFullscreen() : w.mozRequestFullScreen ? w.mozRequestFullScreen() : w.msRequestFullscreen && w.msRequestFullscreen(), console.log("已进入全屏模式")) : (document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen(), console.log("已退出全屏模式"));
|
|
7287
7311
|
}, i;
|
|
7288
7312
|
}
|
|
7289
|
-
class
|
|
7313
|
+
class ma {
|
|
7290
7314
|
engine;
|
|
7291
7315
|
cubeTool;
|
|
7292
7316
|
mainViewPort;
|
|
@@ -7294,7 +7318,7 @@ class ua {
|
|
|
7294
7318
|
this.engine = e;
|
|
7295
7319
|
}
|
|
7296
7320
|
init() {
|
|
7297
|
-
this.cubeTool =
|
|
7321
|
+
this.cubeTool = pa(this.engine, this.engine.scene, this.engine.container), this.cubeTool.init();
|
|
7298
7322
|
}
|
|
7299
7323
|
// 隐藏视图立方体,供 showViewCube=false 的初始化配置调用。
|
|
7300
7324
|
hide() {
|
|
@@ -7414,7 +7438,7 @@ class ua {
|
|
|
7414
7438
|
this.cubeTool.TakeScreenshot();
|
|
7415
7439
|
}
|
|
7416
7440
|
}
|
|
7417
|
-
function
|
|
7441
|
+
function ga(a) {
|
|
7418
7442
|
let e = new Object();
|
|
7419
7443
|
return e.getBoundingBox = function() {
|
|
7420
7444
|
let t = a.models, i = new h(1e8, 1e9, 1e10), n = new h(-1e8, -1e9, -1e10);
|
|
@@ -7457,12 +7481,12 @@ function pa(a) {
|
|
|
7457
7481
|
});
|
|
7458
7482
|
});
|
|
7459
7483
|
const v = o.map((A) => R(A)).filter((A) => A instanceof F);
|
|
7460
|
-
|
|
7484
|
+
Vo(t);
|
|
7461
7485
|
const b = [
|
|
7462
7486
|
...f,
|
|
7463
7487
|
...t.intersectObjects(v, !1).map(ie)
|
|
7464
7488
|
].sort((A, T) => A.distance - T.distance);
|
|
7465
|
-
return
|
|
7489
|
+
return Uo(t), b;
|
|
7466
7490
|
function p(A, T, w, M, E) {
|
|
7467
7491
|
if (T == null)
|
|
7468
7492
|
return;
|
|
@@ -7622,7 +7646,7 @@ function pa(a) {
|
|
|
7622
7646
|
}
|
|
7623
7647
|
}, e;
|
|
7624
7648
|
}
|
|
7625
|
-
class
|
|
7649
|
+
class fa {
|
|
7626
7650
|
engine;
|
|
7627
7651
|
// 绘制状态
|
|
7628
7652
|
isDrawing = !1;
|
|
@@ -7800,11 +7824,11 @@ class ma {
|
|
|
7800
7824
|
this.disActive(), this.selectionBox?.remove(), this.selectionBox = null, this.worldToScreen = null, this.isDrawing = !1;
|
|
7801
7825
|
}
|
|
7802
7826
|
}
|
|
7803
|
-
const
|
|
7804
|
-
class
|
|
7827
|
+
const ya = O.degToRad(10), pn = 1e-3, fi = !1, Ma = [];
|
|
7828
|
+
class va {
|
|
7805
7829
|
engine;
|
|
7806
7830
|
rootGroup = null;
|
|
7807
|
-
isVisible =
|
|
7831
|
+
isVisible = fi;
|
|
7808
7832
|
axes = [];
|
|
7809
7833
|
coordinateMapper = (e) => new h(e.X, e.Z, -e.Y);
|
|
7810
7834
|
constructor(e) {
|
|
@@ -7815,7 +7839,7 @@ class ya {
|
|
|
7815
7839
|
}
|
|
7816
7840
|
setMockData() {
|
|
7817
7841
|
const e = this.engine.models?.[0]?.grids;
|
|
7818
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
7842
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : Ma);
|
|
7819
7843
|
}
|
|
7820
7844
|
show() {
|
|
7821
7845
|
this.isVisible = !0, this.rootGroup && (this.rootGroup.visible = !0);
|
|
@@ -7872,7 +7896,7 @@ class ya {
|
|
|
7872
7896
|
this._clearAxes(), this.rootGroup && (this.engine.scene && this.engine.scene.remove(this.rootGroup), this.rootGroup = null);
|
|
7873
7897
|
}
|
|
7874
7898
|
_initRoot() {
|
|
7875
|
-
this.rootGroup = new fe(), this.rootGroup.name = "GridRoot", this.rootGroup.visible =
|
|
7899
|
+
this.rootGroup = new fe(), this.rootGroup.name = "GridRoot", this.rootGroup.visible = fi, this.engine.scene && this.engine.scene.add(this.rootGroup);
|
|
7876
7900
|
}
|
|
7877
7901
|
_clearAxes() {
|
|
7878
7902
|
this.axes.forEach((e) => {
|
|
@@ -7904,7 +7928,7 @@ class ya {
|
|
|
7904
7928
|
throw new Error("Grid sprite canvas context is not available");
|
|
7905
7929
|
const o = 128 / 2, r = 128 / 2, l = 128 / 2 - 4;
|
|
7906
7930
|
s.beginPath(), s.arc(o, r, l, 0, Math.PI * 2), s.fillStyle = "white", s.fill(), s.strokeStyle = "#1890ff", s.lineWidth = 6, s.stroke(), s.fillStyle = "#1890ff", s.font = `bold ${Math.round(128 * 0.38)}px Arial`, s.textAlign = "center", s.textBaseline = "middle", s.fillText(e, o, r);
|
|
7907
|
-
const c = new
|
|
7931
|
+
const c = new ks(n), d = new kn({
|
|
7908
7932
|
map: c,
|
|
7909
7933
|
depthTest: !1,
|
|
7910
7934
|
transparent: !0
|
|
@@ -7954,7 +7978,7 @@ class ya {
|
|
|
7954
7978
|
const n = this.createProjection(i);
|
|
7955
7979
|
if (!n)
|
|
7956
7980
|
return;
|
|
7957
|
-
const s = t.find((o) => o.direction.angleTo(n.direction) <=
|
|
7981
|
+
const s = t.find((o) => o.direction.angleTo(n.direction) <= ya);
|
|
7958
7982
|
if (s) {
|
|
7959
7983
|
s.axes.push(n);
|
|
7960
7984
|
return;
|
|
@@ -7984,13 +8008,13 @@ class ya {
|
|
|
7984
8008
|
}
|
|
7985
8009
|
normalizeDirection(e) {
|
|
7986
8010
|
const t = e.clone().normalize();
|
|
7987
|
-
return (t.x < 0 || Math.abs(t.x) <=
|
|
8011
|
+
return (t.x < 0 || Math.abs(t.x) <= pn && t.y < 0) && t.multiplyScalar(-1), t;
|
|
7988
8012
|
}
|
|
7989
8013
|
/**
|
|
7990
8014
|
* 在单个轴族内优先返回点位所属的最近轴网区间,避免落在线上时出现空描述。
|
|
7991
8015
|
*/
|
|
7992
8016
|
resolveFamilyLocation(e, t) {
|
|
7993
|
-
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <=
|
|
8017
|
+
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <= pn) ?? null;
|
|
7994
8018
|
if (n) {
|
|
7995
8019
|
const c = e.axes.findIndex((u) => u.data.Id === n.data.Id), d = this.pickAxisPairAroundIndex(e.axes, c);
|
|
7996
8020
|
return {
|
|
@@ -8089,16 +8113,16 @@ class ya {
|
|
|
8089
8113
|
return e instanceof h ? e.clone() : new h(e.x, e.y, e.z);
|
|
8090
8114
|
}
|
|
8091
8115
|
}
|
|
8092
|
-
const
|
|
8093
|
-
class
|
|
8116
|
+
const as = "0", ls = 0, cs = !1;
|
|
8117
|
+
class ki {
|
|
8094
8118
|
engine;
|
|
8095
|
-
currentId =
|
|
8119
|
+
currentId = as;
|
|
8096
8120
|
groundGroup;
|
|
8097
8121
|
groundMesh = null;
|
|
8098
8122
|
/** 当前为官方 Water 水面时为 true,用于 update/dispose 分支 */
|
|
8099
8123
|
isWaterAddon = !1;
|
|
8100
8124
|
clock;
|
|
8101
|
-
groundY =
|
|
8125
|
+
groundY = ls;
|
|
8102
8126
|
/** 默认水面法线贴图路径(项目内为 public/textture/waternormals.jpg) */
|
|
8103
8127
|
static DEFAULT_WATER_NORMALS = "/texture/waternormals.jpg";
|
|
8104
8128
|
groundList = [
|
|
@@ -8120,10 +8144,10 @@ class Li {
|
|
|
8120
8144
|
{ id: "14", names: ["海面", "海面", "Sea Surface"], water: !0, waterColor: 28062, distortionScale: 3.7, size: 1 }
|
|
8121
8145
|
];
|
|
8122
8146
|
constructor(e) {
|
|
8123
|
-
this.engine = e, this.groundGroup = new fe(), this.groundGroup.name = "groundGroup", this.clock = new
|
|
8147
|
+
this.engine = e, this.groundGroup = new fe(), this.groundGroup.name = "groundGroup", this.clock = new Pn();
|
|
8124
8148
|
}
|
|
8125
8149
|
init() {
|
|
8126
|
-
this.engine.scene.add(this.groundGroup), this.groundGroup.visible =
|
|
8150
|
+
this.engine.scene.add(this.groundGroup), this.groundGroup.visible = cs;
|
|
8127
8151
|
}
|
|
8128
8152
|
/**
|
|
8129
8153
|
* 切换地面类型
|
|
@@ -8136,9 +8160,9 @@ class Li {
|
|
|
8136
8160
|
if (!i) return;
|
|
8137
8161
|
const n = t?.size ?? 3e4;
|
|
8138
8162
|
if (i.water) {
|
|
8139
|
-
const s = new
|
|
8163
|
+
const s = new hi(n, n), o = t?.waterNormalsUrl ?? J(ki.DEFAULT_WATER_NORMALS, import.meta.url), r = new We().load(o, (g) => {
|
|
8140
8164
|
g.wrapS = g.wrapT = ot;
|
|
8141
|
-
}), l = t?.sunDirection ?? new h(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, d = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, m = new
|
|
8165
|
+
}), l = t?.sunDirection ?? new h(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, d = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, m = new Bs(s, {
|
|
8142
8166
|
textureWidth: 512,
|
|
8143
8167
|
textureHeight: 512,
|
|
8144
8168
|
waterNormals: r,
|
|
@@ -8151,9 +8175,9 @@ class Li {
|
|
|
8151
8175
|
});
|
|
8152
8176
|
m.rotation.x = -Math.PI / 2, m.position.y = -0.01, m.name = "groundMesh", m.receiveShadow = !0, m.castShadow = !1, this.ensureWaterShadowUniforms(m.material), m.material.uniforms.size.value = d, this.groundMesh = m, this.isWaterAddon = !0, this.groundGroup.add(m);
|
|
8153
8177
|
} else {
|
|
8154
|
-
const s = new
|
|
8178
|
+
const s = new hi(n, n, 1, 1);
|
|
8155
8179
|
s.rotateX(-Math.PI / 2);
|
|
8156
|
-
const o = new
|
|
8180
|
+
const o = new Si({
|
|
8157
8181
|
color: i.color,
|
|
8158
8182
|
roughness: i.roughness,
|
|
8159
8183
|
metalness: i.metalness
|
|
@@ -8230,12 +8254,12 @@ class Li {
|
|
|
8230
8254
|
Array.isArray(e) ? e.forEach((t) => t.dispose()) : e.dispose(), this.groundGroup.remove(this.groundMesh), this.groundMesh = null, this.isWaterAddon = !1;
|
|
8231
8255
|
}
|
|
8232
8256
|
}
|
|
8233
|
-
const Re = "0",
|
|
8234
|
-
class
|
|
8257
|
+
const Re = "0", wa = !0, hs = 0.2, xa = 0.35;
|
|
8258
|
+
class ba {
|
|
8235
8259
|
engine;
|
|
8236
8260
|
currentHdrId = Re;
|
|
8237
|
-
isVisible =
|
|
8238
|
-
currentIntensity =
|
|
8261
|
+
isVisible = wa;
|
|
8262
|
+
currentIntensity = hs;
|
|
8239
8263
|
currentTexture = null;
|
|
8240
8264
|
currentEnvironmentTexture = null;
|
|
8241
8265
|
skybox = null;
|
|
@@ -8320,10 +8344,10 @@ class wa {
|
|
|
8320
8344
|
_loadHdr(e) {
|
|
8321
8345
|
const t = J(e, import.meta.url);
|
|
8322
8346
|
return new Promise((i, n) => {
|
|
8323
|
-
new
|
|
8347
|
+
new zs().load(
|
|
8324
8348
|
t,
|
|
8325
8349
|
(s) => {
|
|
8326
|
-
s.mapping =
|
|
8350
|
+
s.mapping = Rs, i(s);
|
|
8327
8351
|
},
|
|
8328
8352
|
void 0,
|
|
8329
8353
|
(s) => n(s)
|
|
@@ -8333,17 +8357,17 @@ class wa {
|
|
|
8333
8357
|
_applyTexture(e) {
|
|
8334
8358
|
if (this.currentTexture = e, !this.engine.scene || !this.engine.renderer) return;
|
|
8335
8359
|
this._captureSceneState(), this.currentEnvironmentTexture?.dispose();
|
|
8336
|
-
const t = new
|
|
8337
|
-
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping =
|
|
8360
|
+
const t = new Bn(this.engine.renderer), i = t.fromEquirectangular(e).texture;
|
|
8361
|
+
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping = Ci, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure : Di, this._removeSkybox(), this._createSkybox(e), this._setAmbientLightIntensity(this._getHdrAmbientLightIntensity());
|
|
8338
8362
|
}
|
|
8339
8363
|
_captureSceneState() {
|
|
8340
8364
|
this.currentHdrId !== Re || !this.engine.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousAmbientLightIntensity = this._getAmbientLightIntensity(), this.previousToneMapping = this.engine.renderer?.toneMapping ?? nt, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1);
|
|
8341
8365
|
}
|
|
8342
8366
|
_createSkybox(e) {
|
|
8343
8367
|
if (!this.engine.scene) return;
|
|
8344
|
-
const t = new
|
|
8368
|
+
const t = new zn(1e3, 64, 32), i = new ce({
|
|
8345
8369
|
map: e,
|
|
8346
|
-
side:
|
|
8370
|
+
side: wi,
|
|
8347
8371
|
depthWrite: !1,
|
|
8348
8372
|
depthTest: !1,
|
|
8349
8373
|
fog: !1,
|
|
@@ -8375,20 +8399,20 @@ class wa {
|
|
|
8375
8399
|
t && (t.intensity = e);
|
|
8376
8400
|
}
|
|
8377
8401
|
_getHdrAmbientLightIntensity() {
|
|
8378
|
-
return Math.max(this.previousAmbientLightIntensity *
|
|
8402
|
+
return Math.max(this.previousAmbientLightIntensity * xa, 0);
|
|
8379
8403
|
}
|
|
8380
8404
|
_requestRender() {
|
|
8381
8405
|
this.engine?.requestComposerRender?.();
|
|
8382
8406
|
}
|
|
8383
8407
|
}
|
|
8384
|
-
const
|
|
8408
|
+
const Ca = 1e-3, ds = !1, Aa = [
|
|
8385
8409
|
{ Id: "339", Name: "L1", Elevation: -0.32808398950131235 },
|
|
8386
8410
|
{ Id: "2787", Name: "L2", Elevation: 16.896325459317584 },
|
|
8387
8411
|
{ Id: "236633", Name: "L3", Elevation: 36.745406824146976 }
|
|
8388
8412
|
];
|
|
8389
|
-
class
|
|
8413
|
+
class Sa {
|
|
8390
8414
|
engine;
|
|
8391
|
-
isVisible =
|
|
8415
|
+
isVisible = ds;
|
|
8392
8416
|
levels = [];
|
|
8393
8417
|
svgContainer = null;
|
|
8394
8418
|
svgOverlay = null;
|
|
@@ -8406,7 +8430,7 @@ class Ca {
|
|
|
8406
8430
|
}
|
|
8407
8431
|
setMockData() {
|
|
8408
8432
|
const e = this.engine.models?.[0]?.levels, t = this.engine.models?.[0]?.boundingBox;
|
|
8409
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
8433
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : Aa, t);
|
|
8410
8434
|
}
|
|
8411
8435
|
show() {
|
|
8412
8436
|
this.isVisible = !0, this.svgContainer && (this.svgContainer.style.display = "block"), this.levels.forEach((e) => {
|
|
@@ -8439,7 +8463,7 @@ class Ca {
|
|
|
8439
8463
|
const { url: i, targetPoint: n } = this.resolvePointLookupArgs(e, t), s = this.getLevelData(i).slice().sort((g, f) => g.Elevation - f.Elevation);
|
|
8440
8464
|
if (s.length === 0)
|
|
8441
8465
|
return null;
|
|
8442
|
-
const o = (n instanceof h, n.y), r = s.find((g) => Math.abs(g.Elevation - o) <=
|
|
8466
|
+
const o = (n instanceof h, n.y), r = s.find((g) => Math.abs(g.Elevation - o) <= Ca) ?? null;
|
|
8443
8467
|
if (r)
|
|
8444
8468
|
return {
|
|
8445
8469
|
pointY: o,
|
|
@@ -8495,7 +8519,7 @@ class Ca {
|
|
|
8495
8519
|
return;
|
|
8496
8520
|
const i = new h(t.min.x, t.min.y, t.min.z), n = new h(t.max.x, t.max.y, t.max.z);
|
|
8497
8521
|
this.halfSize = n.distanceTo(i);
|
|
8498
|
-
const s = e.data.Elevation, o = new fe(), r = new
|
|
8522
|
+
const s = e.data.Elevation, o = new fe(), r = new hi(this.halfSize * 2, this.halfSize * 2);
|
|
8499
8523
|
r.rotateX(-Math.PI / 2);
|
|
8500
8524
|
const l = new ce({
|
|
8501
8525
|
color: this.COLOR,
|
|
@@ -8613,40 +8637,40 @@ class Ca {
|
|
|
8613
8637
|
};
|
|
8614
8638
|
}
|
|
8615
8639
|
}
|
|
8616
|
-
const kt = !0,
|
|
8617
|
-
function
|
|
8640
|
+
const kt = !0, yi = 0.5, Ea = 32, Pa = 0.3, us = 0.05, Ta = 0.04, _a = 0.18, Ia = 0.01;
|
|
8641
|
+
function Da(a) {
|
|
8618
8642
|
return !a?.min || !a?.max ? 0 : a.min.distanceTo(a.max);
|
|
8619
8643
|
}
|
|
8620
|
-
function
|
|
8644
|
+
function La(a, e) {
|
|
8621
8645
|
return a instanceof h ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new h();
|
|
8622
8646
|
}
|
|
8623
|
-
function
|
|
8647
|
+
function ka(a, e, t) {
|
|
8624
8648
|
if (a instanceof Se)
|
|
8625
8649
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
8626
|
-
const i = a, n =
|
|
8650
|
+
const i = a, n = La(e, t), s = i.position.distanceTo(n), o = typeof i.getEffectiveFOV == "function" ? i.getEffectiveFOV() : i.fov, r = O.degToRad(o * 0.5);
|
|
8627
8651
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
8628
8652
|
}
|
|
8629
|
-
function
|
|
8653
|
+
function Ba(a, e, t, i) {
|
|
8630
8654
|
if (a == null)
|
|
8631
8655
|
return i;
|
|
8632
|
-
const n =
|
|
8656
|
+
const n = Da(t);
|
|
8633
8657
|
if (n <= 0)
|
|
8634
8658
|
return i;
|
|
8635
|
-
const s =
|
|
8659
|
+
const s = ka(a, e, t), o = Math.max(n * Ta, 1), r = Math.max(n * _a, o + 1), l = O.clamp(
|
|
8636
8660
|
(s - o) / (r - o),
|
|
8637
8661
|
0,
|
|
8638
8662
|
1
|
|
8639
|
-
), c = Math.max(i *
|
|
8663
|
+
), c = Math.max(i * Pa, us);
|
|
8640
8664
|
return O.lerp(i, c, l);
|
|
8641
8665
|
}
|
|
8642
|
-
class
|
|
8666
|
+
class za {
|
|
8643
8667
|
engine;
|
|
8644
8668
|
isActive = kt;
|
|
8645
8669
|
groupEdge;
|
|
8646
8670
|
highlightEdgeGroup;
|
|
8647
8671
|
material;
|
|
8648
8672
|
highlightEdgeMaterial;
|
|
8649
|
-
baseOpacity =
|
|
8673
|
+
baseOpacity = yi;
|
|
8650
8674
|
modelEdgeLoaded = !1;
|
|
8651
8675
|
modelEdgeLoadingPromise = null;
|
|
8652
8676
|
indexes = /* @__PURE__ */ new Map();
|
|
@@ -8700,7 +8724,7 @@ class ka {
|
|
|
8700
8724
|
this.engine = e, this.groupEdge = this.engine.scene.getObjectByName("groupEdge"), this.highlightEdgeGroup = new fe(), this.highlightEdgeGroup.name = "highlightModelEdgeGroup", this.highlightEdgeGroup.renderOrder = 999, this.engine.scene.add(this.highlightEdgeGroup), this.material = new qe({
|
|
8701
8725
|
color: 0,
|
|
8702
8726
|
transparent: !0,
|
|
8703
|
-
opacity:
|
|
8727
|
+
opacity: yi,
|
|
8704
8728
|
depthTest: !0,
|
|
8705
8729
|
depthWrite: !1
|
|
8706
8730
|
}), this.material.clippingPlanes = this.engine.sectionPlane, this.highlightEdgeMaterial = new qe({
|
|
@@ -8715,13 +8739,13 @@ class ka {
|
|
|
8715
8739
|
// 启动
|
|
8716
8740
|
active() {
|
|
8717
8741
|
this.isActive = !0, this.groupEdge.visible = !this.explodeHidden, this.engine.scene.traverse((e) => {
|
|
8718
|
-
e.isMesh && e.material &&
|
|
8742
|
+
e.isMesh && e.material && Gi(e, !0);
|
|
8719
8743
|
}), this.update(), this.show();
|
|
8720
8744
|
}
|
|
8721
8745
|
// 关闭
|
|
8722
8746
|
disActive() {
|
|
8723
8747
|
this.isActive = !1, this.groupEdge.visible = !1, this.engine.scene.traverse((e) => {
|
|
8724
|
-
e.isMesh && e.material &&
|
|
8748
|
+
e.isMesh && e.material && Gi(e, !1);
|
|
8725
8749
|
});
|
|
8726
8750
|
}
|
|
8727
8751
|
isEnabled() {
|
|
@@ -8737,13 +8761,13 @@ class ka {
|
|
|
8737
8761
|
update() {
|
|
8738
8762
|
if (!this.isActive || !this.material)
|
|
8739
8763
|
return;
|
|
8740
|
-
const e =
|
|
8764
|
+
const e = Ba(
|
|
8741
8765
|
this.engine?.camera,
|
|
8742
8766
|
this.engine?.controls?.target,
|
|
8743
8767
|
this.engine?.octreeBox?.getBoundingBox?.(),
|
|
8744
8768
|
this.baseOpacity
|
|
8745
8769
|
);
|
|
8746
|
-
Math.abs(this.material.opacity - e) <=
|
|
8770
|
+
Math.abs(this.material.opacity - e) <= Ia || (this.material.opacity = e, this.material.needsUpdate = !0);
|
|
8747
8771
|
}
|
|
8748
8772
|
hasPendingModelEdges() {
|
|
8749
8773
|
return (this.engine?.models ?? []).some((t) => !Array.isArray(t?.modelEdge));
|
|
@@ -8771,7 +8795,7 @@ class ka {
|
|
|
8771
8795
|
return e.modelEdge;
|
|
8772
8796
|
try {
|
|
8773
8797
|
const t = this.engine.engineStatus.models.find((s) => s.url == e.url);
|
|
8774
|
-
|
|
8798
|
+
Wt(this.engine, e.url, e.url + "/edge");
|
|
8775
8799
|
const i = await this.loadZipJsonAsync(e.url + "/edge", t?.key ?? e?.key), n = JSON.parse(i);
|
|
8776
8800
|
e.modelEdge = Array.isArray(n) ? n : [];
|
|
8777
8801
|
} catch (t) {
|
|
@@ -8820,7 +8844,7 @@ class ka {
|
|
|
8820
8844
|
return;
|
|
8821
8845
|
const l = new pe();
|
|
8822
8846
|
l.setAttribute("position", new Ht(s, 3));
|
|
8823
|
-
const c = new
|
|
8847
|
+
const c = new di(l, this.material);
|
|
8824
8848
|
c.url = i, this.setLineTransform(c, He(this.engine, i)), this.groupEdge.add(c), this.highlightIndexes.set(i, o), this.releaseIndexes(i);
|
|
8825
8849
|
});
|
|
8826
8850
|
}
|
|
@@ -8860,7 +8884,7 @@ class ka {
|
|
|
8860
8884
|
if (i.ids.forEach((l) => {
|
|
8861
8885
|
const c = n?.get(Number(l)), d = typeof c == "number" ? this.getEdgePointsByIndex(i.url, c) : null;
|
|
8862
8886
|
if (Array.isArray(d)) {
|
|
8863
|
-
if (d.length >
|
|
8887
|
+
if (d.length > Ea)
|
|
8864
8888
|
return;
|
|
8865
8889
|
this.appendEdgePositions(s, d);
|
|
8866
8890
|
}
|
|
@@ -8868,7 +8892,7 @@ class ka {
|
|
|
8868
8892
|
return;
|
|
8869
8893
|
const o = new pe();
|
|
8870
8894
|
o.setAttribute("position", new Ht(s, 3));
|
|
8871
|
-
const r = new
|
|
8895
|
+
const r = new di(o, this.highlightEdgeMaterial);
|
|
8872
8896
|
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r, He(this.engine, i.url)), this.highlightEdgeGroup.add(r);
|
|
8873
8897
|
}));
|
|
8874
8898
|
}
|
|
@@ -8915,7 +8939,7 @@ class ka {
|
|
|
8915
8939
|
}
|
|
8916
8940
|
// 设置边线材质透明度
|
|
8917
8941
|
setOpacity(e) {
|
|
8918
|
-
this.baseOpacity = O.clamp(e,
|
|
8942
|
+
this.baseOpacity = O.clamp(e, us, 1), this.update();
|
|
8919
8943
|
}
|
|
8920
8944
|
// 显示边线
|
|
8921
8945
|
showModelEdge(e, t) {
|
|
@@ -8944,7 +8968,7 @@ class ka {
|
|
|
8944
8968
|
this.releaseIndexes(e);
|
|
8945
8969
|
}
|
|
8946
8970
|
}
|
|
8947
|
-
const
|
|
8971
|
+
const mn = {
|
|
8948
8972
|
turbidity: 10,
|
|
8949
8973
|
rayleigh: 3,
|
|
8950
8974
|
mieCoefficient: 5e-3,
|
|
@@ -8957,7 +8981,7 @@ const pn = {
|
|
|
8957
8981
|
cloudDensity: 0.4,
|
|
8958
8982
|
cloudElevation: 0.5,
|
|
8959
8983
|
showSunDisc: !0
|
|
8960
|
-
},
|
|
8984
|
+
}, Mi = "sunrise_clear", ps = 0.2, vi = [
|
|
8961
8985
|
{
|
|
8962
8986
|
id: "sunrise_clear",
|
|
8963
8987
|
names: ["晴朗日出", "晴朗日出", "Clear Sunrise"],
|
|
@@ -9128,17 +9152,17 @@ const pn = {
|
|
|
9128
9152
|
showSunDisc: !1
|
|
9129
9153
|
}
|
|
9130
9154
|
}
|
|
9131
|
-
],
|
|
9155
|
+
], gn = vi.reduce(
|
|
9132
9156
|
(a, e) => (a[e.id] = e, a),
|
|
9133
9157
|
{}
|
|
9134
|
-
),
|
|
9135
|
-
class
|
|
9158
|
+
), fn = 2e6;
|
|
9159
|
+
class Ra {
|
|
9136
9160
|
engine;
|
|
9137
9161
|
sky = null;
|
|
9138
9162
|
sun = new h();
|
|
9139
|
-
params = { ...
|
|
9140
|
-
currentPreset =
|
|
9141
|
-
currentIntensity =
|
|
9163
|
+
params = { ...mn, ...gn[Mi].params };
|
|
9164
|
+
currentPreset = Mi;
|
|
9165
|
+
currentIntensity = ps;
|
|
9142
9166
|
currentEnvironmentTarget = null;
|
|
9143
9167
|
skyScale = 45e4;
|
|
9144
9168
|
skyName = "bim_engine_sky";
|
|
@@ -9159,8 +9183,8 @@ class Ba {
|
|
|
9159
9183
|
this.sky.visible = !0, this._captureSceneState(), this._expandCameraFarForSky(), this._applyParamsToSky();
|
|
9160
9184
|
return;
|
|
9161
9185
|
}
|
|
9162
|
-
const e = new
|
|
9163
|
-
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping =
|
|
9186
|
+
const e = new Os();
|
|
9187
|
+
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping = Ri, this.engine.scene.background = null), this._applyParamsToSky();
|
|
9164
9188
|
}
|
|
9165
9189
|
close(e = !0) {
|
|
9166
9190
|
this.sky && (this._restoreCameraFar(), this._restoreSceneState(e), e ? (this.engine?.scene?.remove(this.sky), this.sky.material.dispose(), this.sky.geometry.dispose(), this.sky = null) : this.sky.visible = !1);
|
|
@@ -9175,17 +9199,17 @@ class Ba {
|
|
|
9175
9199
|
Object.assign(this.params, e), this._applyParamsToSky(), this.engine?.renderer && (e.exposure !== void 0 || e.orthoExposureScale !== void 0) && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure());
|
|
9176
9200
|
}
|
|
9177
9201
|
setPreset(e) {
|
|
9178
|
-
const t =
|
|
9179
|
-
t && (this.currentPreset = e, this.params = { ...
|
|
9202
|
+
const t = gn[e];
|
|
9203
|
+
t && (this.currentPreset = e, this.params = { ...mn, ...t.params }, this._applyParamsToSky(), this.engine?.renderer && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure()));
|
|
9180
9204
|
}
|
|
9181
9205
|
getCurrentPreset() {
|
|
9182
9206
|
return this.currentPreset;
|
|
9183
9207
|
}
|
|
9184
9208
|
getPresetNames() {
|
|
9185
|
-
return
|
|
9209
|
+
return vi.map((e) => e.id);
|
|
9186
9210
|
}
|
|
9187
9211
|
getPresetList() {
|
|
9188
|
-
return
|
|
9212
|
+
return vi.map((e) => ({
|
|
9189
9213
|
id: e.id,
|
|
9190
9214
|
names: [...e.names],
|
|
9191
9215
|
params: { ...e.params }
|
|
@@ -9220,7 +9244,7 @@ class Ba {
|
|
|
9220
9244
|
const e = this.engine?.camera;
|
|
9221
9245
|
if (!e || typeof e.far != "number") return;
|
|
9222
9246
|
const t = e.far;
|
|
9223
|
-
t >=
|
|
9247
|
+
t >= fn || (this.savedCameraFar == null && (this.savedCameraFar = t), e.far = fn, typeof e.updateProjectionMatrix == "function" && e.updateProjectionMatrix());
|
|
9224
9248
|
}
|
|
9225
9249
|
_restoreCameraFar() {
|
|
9226
9250
|
if (this.savedCameraFar == null || !this.engine?.camera) return;
|
|
@@ -9232,7 +9256,7 @@ class Ba {
|
|
|
9232
9256
|
const e = this.sky.material.uniforms;
|
|
9233
9257
|
this._setUniformValue(e, "turbidity", this.params.turbidity), this._setUniformValue(e, "rayleigh", this.params.rayleigh), this._setUniformValue(e, "mieCoefficient", this.params.mieCoefficient), this._setUniformValue(e, "mieDirectionalG", this.params.mieDirectionalG), this._setUniformValue(e, "cloudCoverage", this.params.cloudCoverage), this._setUniformValue(e, "cloudDensity", this.params.cloudDensity), this._setUniformValue(e, "cloudElevation", this.params.cloudElevation), this._setUniformValue(e, "showSunDisc", this.params.showSunDisc ? 1 : 0);
|
|
9234
9258
|
const t = O.degToRad(90 - this.params.elevation), i = O.degToRad(this.params.azimuth);
|
|
9235
|
-
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping =
|
|
9259
|
+
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping = Ri, this.engine.renderer.toneMappingExposure = this._getEffectiveExposure(), this.sky.visible && this._refreshEnvironmentMap());
|
|
9236
9260
|
}
|
|
9237
9261
|
_captureSceneState() {
|
|
9238
9262
|
this.hasCapturedSceneState || !this.engine?.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousToneMapping = this.engine.renderer?.toneMapping ?? nt, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1, this.hasCapturedSceneState = !0);
|
|
@@ -9243,9 +9267,9 @@ class Ba {
|
|
|
9243
9267
|
_refreshEnvironmentMap() {
|
|
9244
9268
|
if (!this.sky || !this.engine?.renderer || !this.engine?.scene) return;
|
|
9245
9269
|
this._disposeEnvironmentTarget();
|
|
9246
|
-
const e = new
|
|
9270
|
+
const e = new xi(), t = this.sky.clone();
|
|
9247
9271
|
t.material = this.sky.material.clone(), e.add(t);
|
|
9248
|
-
const i = new
|
|
9272
|
+
const i = new Bn(this.engine.renderer);
|
|
9249
9273
|
this.currentEnvironmentTarget = i.fromScene(e, 0, 0.1, this.skyScale * 2), i.dispose(), this.engine.scene.background = null, this.engine.scene.environment = this.currentEnvironmentTarget.texture, this.engine.scene.environmentIntensity = this.currentIntensity, t.material.dispose();
|
|
9250
9274
|
}
|
|
9251
9275
|
_disposeEnvironmentTarget() {
|
|
@@ -9256,7 +9280,7 @@ class Ba {
|
|
|
9256
9280
|
n && (i instanceof h && typeof n.value?.copy == "function" ? n.value.copy(i) : n.value = i);
|
|
9257
9281
|
}
|
|
9258
9282
|
}
|
|
9259
|
-
class
|
|
9283
|
+
class Oa {
|
|
9260
9284
|
/** 寮曟搸瀹炰緥寮曠敤 */
|
|
9261
9285
|
engine;
|
|
9262
9286
|
defaultSettings;
|
|
@@ -9376,7 +9400,7 @@ class za {
|
|
|
9376
9400
|
/** 鐩存帴璁剧疆鍦烘櫙涓幆澧冨厜鐨勫己搴?*/
|
|
9377
9401
|
setAmbientLightIntensity(e) {
|
|
9378
9402
|
const t = this.engine.renderer;
|
|
9379
|
-
t && (t.toneMapping =
|
|
9403
|
+
t && (t.toneMapping = Ci, t.toneMappingExposure = 2 * e);
|
|
9380
9404
|
}
|
|
9381
9405
|
// ==================== 绉佹湁鏂规硶 ====================
|
|
9382
9406
|
/** 涓€娆℃€у簲鐢ㄦ墍鏈夋覆鏌撹缃?*/
|
|
@@ -9384,32 +9408,32 @@ class za {
|
|
|
9384
9408
|
this.settings = this._readCurrentSettingsFromModules();
|
|
9385
9409
|
}
|
|
9386
9410
|
_buildDefaultSettingsFromModules() {
|
|
9387
|
-
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? Re, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ??
|
|
9411
|
+
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? Re, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? Mi, d = this.engine.skyManager?.isActive?.() === !0;
|
|
9388
9412
|
return {
|
|
9389
9413
|
render: {
|
|
9390
9414
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
9391
|
-
contrast: this._uniformToPercent(t,
|
|
9392
|
-
saturation: this._uniformToPercent(e,
|
|
9415
|
+
contrast: this._uniformToPercent(t, Kn),
|
|
9416
|
+
saturation: this._uniformToPercent(e, Wn),
|
|
9393
9417
|
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(), mt),
|
|
9394
|
-
lightIntensity: this._exposureToPercent(n,
|
|
9395
|
-
gtaoIntensity: this._unitToPercent(i,
|
|
9418
|
+
lightIntensity: this._exposureToPercent(n, Di),
|
|
9419
|
+
gtaoIntensity: this._unitToPercent(i, Gn)
|
|
9396
9420
|
},
|
|
9397
9421
|
display: {
|
|
9398
9422
|
showEdge: this.engine.modelEdge?.isEnabled?.() ?? kt,
|
|
9399
|
-
edgeOpacity: this._unitToPercent(s,
|
|
9400
|
-
showGrid: this.engine.grid?.getVisible?.() ??
|
|
9401
|
-
showLevel: this.engine.level?.getVisible?.() ??
|
|
9402
|
-
showGround: this.engine.ground?.getVisible?.() ??
|
|
9403
|
-
groundId: this.engine.ground?.getCurrentId?.() ??
|
|
9404
|
-
groundHeight: this.engine.ground?.getHeight?.() ??
|
|
9423
|
+
edgeOpacity: this._unitToPercent(s, yi),
|
|
9424
|
+
showGrid: this.engine.grid?.getVisible?.() ?? fi,
|
|
9425
|
+
showLevel: this.engine.level?.getVisible?.() ?? ds,
|
|
9426
|
+
showGround: this.engine.ground?.getVisible?.() ?? cs,
|
|
9427
|
+
groundId: this.engine.ground?.getCurrentId?.() ?? as,
|
|
9428
|
+
groundHeight: this.engine.ground?.getHeight?.() ?? ls
|
|
9405
9429
|
},
|
|
9406
9430
|
environment: {
|
|
9407
9431
|
type: d ? "sky" : o !== Re ? "hdr" : "none",
|
|
9408
9432
|
hdrId: o,
|
|
9409
|
-
hdrIntensity: this._unitToPercent(r,
|
|
9433
|
+
hdrIntensity: this._unitToPercent(r, hs),
|
|
9410
9434
|
skyPreset: c,
|
|
9411
9435
|
skyParams: {},
|
|
9412
|
-
skyIntensity: this._unitToPercent(l,
|
|
9436
|
+
skyIntensity: this._unitToPercent(l, ps)
|
|
9413
9437
|
}
|
|
9414
9438
|
};
|
|
9415
9439
|
}
|
|
@@ -9444,7 +9468,7 @@ class za {
|
|
|
9444
9468
|
};
|
|
9445
9469
|
}
|
|
9446
9470
|
_toRenderMode(e) {
|
|
9447
|
-
return e === "simple" || e === "balance" || e === "advanced" ? e :
|
|
9471
|
+
return e === "simple" || e === "balance" || e === "advanced" ? e : rs;
|
|
9448
9472
|
}
|
|
9449
9473
|
_uniformToPercent(e, t) {
|
|
9450
9474
|
const i = typeof e == "number" ? e : t;
|
|
@@ -9529,7 +9553,7 @@ class Ne {
|
|
|
9529
9553
|
handelBehaved;
|
|
9530
9554
|
setting;
|
|
9531
9555
|
constructor(e) {
|
|
9532
|
-
this.engine = e, this.handelBehaved =
|
|
9556
|
+
this.engine = e, this.handelBehaved = Li(e), this.handelBehaved.init(this, null), this.setting = {
|
|
9533
9557
|
// 单位
|
|
9534
9558
|
unit: "m",
|
|
9535
9559
|
// 保留几位小数,ui上还是显示0.001这样
|
|
@@ -9793,7 +9817,7 @@ class Ne {
|
|
|
9793
9817
|
}
|
|
9794
9818
|
}
|
|
9795
9819
|
}
|
|
9796
|
-
class
|
|
9820
|
+
class Fa {
|
|
9797
9821
|
engine;
|
|
9798
9822
|
isActive = !1;
|
|
9799
9823
|
tools;
|
|
@@ -9897,7 +9921,7 @@ class Ra {
|
|
|
9897
9921
|
}
|
|
9898
9922
|
}
|
|
9899
9923
|
}
|
|
9900
|
-
class
|
|
9924
|
+
class Ha {
|
|
9901
9925
|
engine;
|
|
9902
9926
|
tools;
|
|
9903
9927
|
isActive = !1;
|
|
@@ -9953,7 +9977,7 @@ class Oa {
|
|
|
9953
9977
|
}
|
|
9954
9978
|
// 按下esc
|
|
9955
9979
|
}
|
|
9956
|
-
class
|
|
9980
|
+
class Na {
|
|
9957
9981
|
engine;
|
|
9958
9982
|
isActive = !1;
|
|
9959
9983
|
tools;
|
|
@@ -10008,7 +10032,7 @@ class Fa {
|
|
|
10008
10032
|
t.point1 = s.point, t.point2 = n[0].point, t.text = t.point1.clone().distanceTo(t.point2.clone()), this.engine.events.trigger(ne.MeasureChanged, t);
|
|
10009
10033
|
}
|
|
10010
10034
|
}
|
|
10011
|
-
class
|
|
10035
|
+
class Va {
|
|
10012
10036
|
engine;
|
|
10013
10037
|
isActive = !1;
|
|
10014
10038
|
tools;
|
|
@@ -10053,7 +10077,7 @@ class Ha {
|
|
|
10053
10077
|
t.point = e.catch.point.clone(), t.text = e.catch.point.y, t.isSelect = !1, this.engine.events.trigger(ne.MeasureChanged, t);
|
|
10054
10078
|
}
|
|
10055
10079
|
}
|
|
10056
|
-
class
|
|
10080
|
+
class Ua {
|
|
10057
10081
|
engine;
|
|
10058
10082
|
isActive = !1;
|
|
10059
10083
|
tools;
|
|
@@ -10105,7 +10129,7 @@ class Na {
|
|
|
10105
10129
|
e != null && (e.isSelect = !1, this.engine.events.trigger(ne.MeasureChanged, e));
|
|
10106
10130
|
}
|
|
10107
10131
|
}
|
|
10108
|
-
class
|
|
10132
|
+
class Ga {
|
|
10109
10133
|
engine;
|
|
10110
10134
|
tools;
|
|
10111
10135
|
// 存储三个点:起点、顶点(中间点)、终点
|
|
@@ -10173,7 +10197,7 @@ class Va {
|
|
|
10173
10197
|
}
|
|
10174
10198
|
}
|
|
10175
10199
|
}
|
|
10176
|
-
class
|
|
10200
|
+
class Wa {
|
|
10177
10201
|
engine;
|
|
10178
10202
|
tools;
|
|
10179
10203
|
points = [];
|
|
@@ -10400,7 +10424,7 @@ class gt {
|
|
|
10400
10424
|
}
|
|
10401
10425
|
}
|
|
10402
10426
|
}
|
|
10403
|
-
class
|
|
10427
|
+
class Ka {
|
|
10404
10428
|
engine;
|
|
10405
10429
|
isActive = !1;
|
|
10406
10430
|
points = [];
|
|
@@ -10481,7 +10505,7 @@ class Ga {
|
|
|
10481
10505
|
};
|
|
10482
10506
|
}
|
|
10483
10507
|
}
|
|
10484
|
-
class
|
|
10508
|
+
class qa {
|
|
10485
10509
|
isActive = !1;
|
|
10486
10510
|
engine;
|
|
10487
10511
|
clearHeightMeasure;
|
|
@@ -10507,7 +10531,7 @@ class Wa {
|
|
|
10507
10531
|
volumeAnnotation: []
|
|
10508
10532
|
};
|
|
10509
10533
|
constructor(e) {
|
|
10510
|
-
this.engine = e, this.clearHeightMeasure = new
|
|
10534
|
+
this.engine = e, this.clearHeightMeasure = new Fa(e), this.distanceMeasure = new Ha(e), this.clearDistanceMeasure = new Na(e), this.elevationMeasure = new Va(e), this.pointMeasure = new Ua(e), this.angleMeasure = new Ga(e), this.areaMeasure = new Wa(e), this.slopeMeasure = new gt(e), this.faceDistanceMeasure = new Ka(e), this.tools = new Ne(e), this.annotationContainer = document.createElement("div"), this.annotationContainer.className = "annotation-container", e.container.appendChild(this.annotationContainer);
|
|
10511
10535
|
}
|
|
10512
10536
|
setContextMenuDisabled(e) {
|
|
10513
10537
|
this.engine?.engineStatus != null && (this.engine.engineStatus.isDisableContextMenu = e);
|
|
@@ -10555,7 +10579,7 @@ class Wa {
|
|
|
10555
10579
|
this.engine.setIdleFrameRateExempt?.("measure", !1), this.setContextMenuDisabled(!1), this.tools.disActive(), this.clearHeightMeasure.disActive(), this.distanceMeasure.disActive(), this.clearDistanceMeasure.disActive(), this.elevationMeasure.disActive(), this.pointMeasure.disActive(), this.angleMeasure.disActive(), this.areaMeasure.disActive(), this.slopeMeasure.disActive(), this.faceDistanceMeasure.disActive(), this.clearAll(), this.annotationContainer.remove(), this.isActive = !1;
|
|
10556
10580
|
}
|
|
10557
10581
|
}
|
|
10558
|
-
class
|
|
10582
|
+
class ja {
|
|
10559
10583
|
engine;
|
|
10560
10584
|
isActive = !1;
|
|
10561
10585
|
isCtrlDown = !1;
|
|
@@ -11008,7 +11032,7 @@ class Ka {
|
|
|
11008
11032
|
}
|
|
11009
11033
|
].forEach((n) => {
|
|
11010
11034
|
this.createFace(t, n.vertices, n.normal, n.name, n.isMinFace, n.planePoint);
|
|
11011
|
-
}),
|
|
11035
|
+
}), Ti(this.engine).forEach((n) => {
|
|
11012
11036
|
n.material && Array.isArray(n.material) ? n.material.forEach((s) => {
|
|
11013
11037
|
s.clippingPlanes = this.engine.sectionPlane;
|
|
11014
11038
|
}) : n.material.clippingPlanes = this.engine.sectionPlane;
|
|
@@ -11074,7 +11098,7 @@ class Ka {
|
|
|
11074
11098
|
b && b.setFromNormalAndCoplanarPoint(i.clone().setLength(-1), o);
|
|
11075
11099
|
}
|
|
11076
11100
|
}
|
|
11077
|
-
class
|
|
11101
|
+
class Ya {
|
|
11078
11102
|
engine;
|
|
11079
11103
|
isActive = !1;
|
|
11080
11104
|
isDrag = !1;
|
|
@@ -11362,7 +11386,7 @@ class qa {
|
|
|
11362
11386
|
}
|
|
11363
11387
|
applyClippingToModelMeshes() {
|
|
11364
11388
|
const e = this.engine.sectionPlane?.find?.((t) => t.name === "face");
|
|
11365
|
-
|
|
11389
|
+
Ti(this.engine).forEach((t) => {
|
|
11366
11390
|
this.applyClippingToMaterial(t.material), this.engine.clipping.clippingStencil?.addMesh(e, t);
|
|
11367
11391
|
}), this.requestShadowRefresh();
|
|
11368
11392
|
}
|
|
@@ -11629,7 +11653,7 @@ class qa {
|
|
|
11629
11653
|
}
|
|
11630
11654
|
}
|
|
11631
11655
|
}
|
|
11632
|
-
class
|
|
11656
|
+
class Xa {
|
|
11633
11657
|
engine;
|
|
11634
11658
|
callback_;
|
|
11635
11659
|
isActive;
|
|
@@ -11660,7 +11684,7 @@ class ja {
|
|
|
11660
11684
|
});
|
|
11661
11685
|
}
|
|
11662
11686
|
}
|
|
11663
|
-
class
|
|
11687
|
+
class Qa {
|
|
11664
11688
|
/** 引擎实例(包含 scene / models / engineStatus / octreeBox 等) */
|
|
11665
11689
|
engine;
|
|
11666
11690
|
/** three-bvh-csg 计算器,负责执行布尔操作 */
|
|
@@ -11682,9 +11706,9 @@ class Ya {
|
|
|
11682
11706
|
fillTextureRepeat = 60;
|
|
11683
11707
|
fillTextureRotation = 0;
|
|
11684
11708
|
constructor(e) {
|
|
11685
|
-
this.engine = e, this.evaluator = new
|
|
11709
|
+
this.engine = e, this.evaluator = new Fs();
|
|
11686
11710
|
const t = J("/texture/fill.png", import.meta.url), i = new We().load(t);
|
|
11687
|
-
i.wrapS = ot, i.wrapT = ot, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new
|
|
11711
|
+
i.wrapS = ot, i.wrapT = ot, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new Si({
|
|
11688
11712
|
color: 14079687,
|
|
11689
11713
|
map: i,
|
|
11690
11714
|
side: oe,
|
|
@@ -11748,7 +11772,7 @@ class Ya {
|
|
|
11748
11772
|
const b = this.createWorldBrushFromMesh(v);
|
|
11749
11773
|
if (b != null)
|
|
11750
11774
|
try {
|
|
11751
|
-
const x = this.evaluator.evaluate(b, c,
|
|
11775
|
+
const x = this.evaluator.evaluate(b, c, Hs)?.geometry;
|
|
11752
11776
|
if (!x)
|
|
11753
11777
|
continue;
|
|
11754
11778
|
const C = this.extractPlaneCapGeometry(x, e, l);
|
|
@@ -11891,7 +11915,7 @@ class Ya {
|
|
|
11891
11915
|
), r = new H().compose(s, o, new h(1, 1, 1));
|
|
11892
11916
|
n.applyMatrix4(r);
|
|
11893
11917
|
const l = this.toCsgReadyGeometry(n);
|
|
11894
|
-
return n.dispose(), new
|
|
11918
|
+
return n.dispose(), new Oi(l);
|
|
11895
11919
|
}
|
|
11896
11920
|
/**
|
|
11897
11921
|
* 将场景 mesh 转为世界坐标 Brush。
|
|
@@ -11904,7 +11928,7 @@ class Ya {
|
|
|
11904
11928
|
const i = t.clone();
|
|
11905
11929
|
i.applyMatrix4(e.matrixWorld);
|
|
11906
11930
|
const n = this.toCsgReadyGeometry(i);
|
|
11907
|
-
return i.dispose(), new
|
|
11931
|
+
return i.dispose(), new Oi(n);
|
|
11908
11932
|
}
|
|
11909
11933
|
/**
|
|
11910
11934
|
* 统一 CSG 输入属性,避免属性不一致报错(例如 uv 缺失)。
|
|
@@ -11976,7 +12000,7 @@ class Ya {
|
|
|
11976
12000
|
return { tangent: l, bitangent: c };
|
|
11977
12001
|
}
|
|
11978
12002
|
}
|
|
11979
|
-
class
|
|
12003
|
+
class $a {
|
|
11980
12004
|
engine;
|
|
11981
12005
|
clippingTolerance = 1e-4;
|
|
11982
12006
|
sectionBox;
|
|
@@ -11988,7 +12012,7 @@ class Xa {
|
|
|
11988
12012
|
fillCutFace = !0;
|
|
11989
12013
|
viewRangePlanes = null;
|
|
11990
12014
|
constructor(e) {
|
|
11991
|
-
this.engine = e, this.sectionCatchFace = new
|
|
12015
|
+
this.engine = e, this.sectionCatchFace = new Xa(this.engine);
|
|
11992
12016
|
let t = new Q(new h(0, 0, 1), 1e5);
|
|
11993
12017
|
t.name = "前";
|
|
11994
12018
|
let i = new Q(new h(0, 0, 1), 1e5);
|
|
@@ -12005,7 +12029,7 @@ class Xa {
|
|
|
12005
12029
|
l.name = "face", this.engine.sectionPlane = [t, i, n, s, o, r, l];
|
|
12006
12030
|
}
|
|
12007
12031
|
init() {
|
|
12008
|
-
this.sectionBox = new
|
|
12032
|
+
this.sectionBox = new ja(this.engine), this.sectionFace = new Ya(this.engine), this.clippingCSGSimple = new Qa(this.engine);
|
|
12009
12033
|
}
|
|
12010
12034
|
// 自动缩放适用的视图比例
|
|
12011
12035
|
scaleBox() {
|
|
@@ -12200,7 +12224,7 @@ class Xa {
|
|
|
12200
12224
|
t instanceof Q && (t.constant = 1e5), this.applySectionPlanesToModelMeshes(), this.clippingCSGSimple?.updataFaces?.(e.slice(0, 6));
|
|
12201
12225
|
}
|
|
12202
12226
|
applySectionPlanesToModelMeshes() {
|
|
12203
|
-
|
|
12227
|
+
Ti(this.engine).forEach((e) => {
|
|
12204
12228
|
e.material && Array.isArray(e.material) ? e.material.forEach((t) => {
|
|
12205
12229
|
t.clippingPlanes = this.engine.sectionPlane, t.clipShadows = !0;
|
|
12206
12230
|
}) : e.material && (e.material.clippingPlanes = this.engine.sectionPlane, e.material.clipShadows = !0);
|
|
@@ -12212,7 +12236,7 @@ class Xa {
|
|
|
12212
12236
|
});
|
|
12213
12237
|
}
|
|
12214
12238
|
}
|
|
12215
|
-
class
|
|
12239
|
+
class Za {
|
|
12216
12240
|
engine;
|
|
12217
12241
|
constructor(e) {
|
|
12218
12242
|
this.engine = e;
|
|
@@ -12251,7 +12275,7 @@ class Qa {
|
|
|
12251
12275
|
}), e;
|
|
12252
12276
|
}
|
|
12253
12277
|
}
|
|
12254
|
-
class
|
|
12278
|
+
class Ja {
|
|
12255
12279
|
engine;
|
|
12256
12280
|
constructor(e) {
|
|
12257
12281
|
this.engine = e;
|
|
@@ -12289,7 +12313,7 @@ class $a {
|
|
|
12289
12313
|
});
|
|
12290
12314
|
}
|
|
12291
12315
|
}
|
|
12292
|
-
class
|
|
12316
|
+
class el {
|
|
12293
12317
|
engine;
|
|
12294
12318
|
// 扩展属性
|
|
12295
12319
|
extended = /* @__PURE__ */ new Map();
|
|
@@ -12308,7 +12332,7 @@ class Za {
|
|
|
12308
12332
|
// 通过构件,属性名获取构件属性
|
|
12309
12333
|
getModelPropertiesWithName(e, t, i, n) {
|
|
12310
12334
|
let s = this.extended.get(e), o = this.engine.engineStatus.models.find((l) => l.url === e);
|
|
12311
|
-
o.properties == null ? (
|
|
12335
|
+
o.properties == null ? (Wt(this.engine, e, e + "/property"), Vt(
|
|
12312
12336
|
e + "/property",
|
|
12313
12337
|
(l) => {
|
|
12314
12338
|
let c = JSON.parse(l);
|
|
@@ -12333,7 +12357,7 @@ class Za {
|
|
|
12333
12357
|
// 查询构件属性
|
|
12334
12358
|
getModelProperties(e, t, i) {
|
|
12335
12359
|
let n = this.extended.get(e), s = this.engine.engineStatus.models.find((r) => r.url === e);
|
|
12336
|
-
s.properties == null && (
|
|
12360
|
+
s.properties == null && (Wt(this.engine, e, e + "/property"), Vt(
|
|
12337
12361
|
e + "/property",
|
|
12338
12362
|
(r) => {
|
|
12339
12363
|
let l = JSON.parse(r);
|
|
@@ -12398,8 +12422,8 @@ class Za {
|
|
|
12398
12422
|
}
|
|
12399
12423
|
}
|
|
12400
12424
|
}
|
|
12401
|
-
const
|
|
12402
|
-
class
|
|
12425
|
+
const tl = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="10.8" cy="10.8" r="6.5" stroke="currentColor" stroke-width="2"/><path d="m16 16 4.3 4.3" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';
|
|
12426
|
+
class il {
|
|
12403
12427
|
manager;
|
|
12404
12428
|
wrapper;
|
|
12405
12429
|
input;
|
|
@@ -12415,7 +12439,7 @@ class el {
|
|
|
12415
12439
|
this.manager = t, this.wrapper = document.createElement("div"), this.wrapper.className = "engine-3d-search", this.wrapper.innerHTML = `
|
|
12416
12440
|
<section class="engine-3d-search__box" role="dialog" aria-label="模型检索">
|
|
12417
12441
|
<div class="engine-3d-search__input-row">
|
|
12418
|
-
<span class="engine-3d-search__icon">${
|
|
12442
|
+
<span class="engine-3d-search__icon">${tl}</span>
|
|
12419
12443
|
<input class="engine-3d-search__input" type="search" placeholder="检索模型名称、构件 ID、房间" autocomplete="off" spellcheck="false" />
|
|
12420
12444
|
<button class="engine-3d-search__clear" type="button" aria-label="关闭检索框">×</button>
|
|
12421
12445
|
</div>
|
|
@@ -12518,13 +12542,13 @@ class el {
|
|
|
12518
12542
|
this.input.removeEventListener("input", this.onInput), this.input.removeEventListener("keydown", this.onKeyDown), this.wrapper.querySelector(".engine-3d-search__clear")?.removeEventListener("click", this.onCloseClick), this.pagination.removeEventListener("click", this.onPageClick), document.removeEventListener("mousedown", this.onDocumentMouseDown), document.removeEventListener("keydown", this.onDocumentKeyDown), this.debounceTimer !== null && clearTimeout(this.debounceTimer), this.wrapper.remove();
|
|
12519
12543
|
}
|
|
12520
12544
|
}
|
|
12521
|
-
class
|
|
12545
|
+
class nl {
|
|
12522
12546
|
engine;
|
|
12523
12547
|
searchUI = null;
|
|
12524
12548
|
constructor(e) {
|
|
12525
12549
|
this.engine = e;
|
|
12526
12550
|
const t = e?.container;
|
|
12527
|
-
t && (this.searchUI = new
|
|
12551
|
+
t && (this.searchUI = new il(t, this), this.setTheme(e?.options?.searchTheme === "light" ? "light" : "dark"));
|
|
12528
12552
|
}
|
|
12529
12553
|
/** 按名称、ID、房间名称/编号检索已加载模型。 */
|
|
12530
12554
|
search(e, t = {}) {
|
|
@@ -12662,7 +12686,7 @@ class tl {
|
|
|
12662
12686
|
return s < 0 ? null : (s === 0 ? 1e3 : 500) - s - Math.max(0, n.length - t.length) * 0.01;
|
|
12663
12687
|
}
|
|
12664
12688
|
}
|
|
12665
|
-
class
|
|
12689
|
+
class sl {
|
|
12666
12690
|
engine;
|
|
12667
12691
|
constructor(e) {
|
|
12668
12692
|
this.engine = e;
|
|
@@ -12755,7 +12779,7 @@ class il {
|
|
|
12755
12779
|
}), t && t(i), i;
|
|
12756
12780
|
}
|
|
12757
12781
|
}
|
|
12758
|
-
class
|
|
12782
|
+
class ol {
|
|
12759
12783
|
engine;
|
|
12760
12784
|
/** 点位列表 */
|
|
12761
12785
|
points = [];
|
|
@@ -12995,7 +13019,7 @@ class nl {
|
|
|
12995
13019
|
this.stop(), this.points = [], this.playOptions = {};
|
|
12996
13020
|
}
|
|
12997
13021
|
}
|
|
12998
|
-
class
|
|
13022
|
+
class rl {
|
|
12999
13023
|
engine;
|
|
13000
13024
|
miniMapCamera = null;
|
|
13001
13025
|
miniMapRenderer = null;
|
|
@@ -13073,7 +13097,7 @@ class sl {
|
|
|
13073
13097
|
}
|
|
13074
13098
|
}
|
|
13075
13099
|
init() {
|
|
13076
|
-
this.miniMapContainer = document.createElement("div"), this.miniMapContainer.style.position = "absolute", this.applyContainerPosition(), this.miniMapContainer.style.width = `${this.currentMapWidth}px`, this.miniMapContainer.style.height = `${this.currentMapHeight}px`, this.miniMapContainer.style.border = "2px solid rgba(255, 255, 255, 0.4)", this.miniMapContainer.style.borderRadius = "4px", this.miniMapContainer.style.overflow = "hidden", this.miniMapContainer.style.display = "none", this.miniMapContainer.style.pointerEvents = "auto", this.miniMapContainer.style.touchAction = "none", this.miniMapContainer.style.cursor = "crosshair", this.engine.container.appendChild(this.miniMapContainer), this.miniMapRenderer = new
|
|
13100
|
+
this.miniMapContainer = document.createElement("div"), this.miniMapContainer.style.position = "absolute", this.applyContainerPosition(), this.miniMapContainer.style.width = `${this.currentMapWidth}px`, this.miniMapContainer.style.height = `${this.currentMapHeight}px`, this.miniMapContainer.style.border = "2px solid rgba(255, 255, 255, 0.4)", this.miniMapContainer.style.borderRadius = "4px", this.miniMapContainer.style.overflow = "hidden", this.miniMapContainer.style.display = "none", this.miniMapContainer.style.pointerEvents = "auto", this.miniMapContainer.style.touchAction = "none", this.miniMapContainer.style.cursor = "crosshair", this.engine.container.appendChild(this.miniMapContainer), this.miniMapRenderer = new bi({ alpha: !0, antialias: !1 }), this.miniMapRenderer.setSize(this.currentMapWidth, this.currentMapHeight), this.miniMapRenderer.setPixelRatio(window.devicePixelRatio), this.miniMapRenderer.setClearColor(1710638, 0.85), this.miniMapContainer.appendChild(this.miniMapRenderer.domElement);
|
|
13077
13101
|
const e = window.devicePixelRatio || 1;
|
|
13078
13102
|
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new Se(
|
|
13079
13103
|
-this.currentHalfSize,
|
|
@@ -13397,7 +13421,7 @@ class sl {
|
|
|
13397
13421
|
m.rotateYaw(-c);
|
|
13398
13422
|
return;
|
|
13399
13423
|
}
|
|
13400
|
-
const g = i.getWorldDirection(new h()).multiplyScalar(d), f = new
|
|
13424
|
+
const g = i.getWorldDirection(new h()).multiplyScalar(d), f = new Ns().setFromVector3(g);
|
|
13401
13425
|
f.theta -= c, g.setFromSpherical(f), n.target?.copy(i.position).add(g), n.update?.(), this.engine.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.();
|
|
13402
13426
|
}
|
|
13403
13427
|
drawOverlay() {
|
|
@@ -13456,7 +13480,7 @@ class sl {
|
|
|
13456
13480
|
this.miniMapContainer && (this.miniMapContainer.removeEventListener("wheel", this.onWheel), this.miniMapContainer.removeEventListener("mousedown", this.onMouseDown), this.miniMapContainer.removeEventListener("mousemove", this.onMouseMove), this.miniMapContainer.removeEventListener("mouseup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointerdown", this.onMouseDown), this.miniMapContainer.removeEventListener("pointermove", this.onMouseMove), this.miniMapContainer.removeEventListener("pointerup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointercancel", this.onMouseUp), this.miniMapContainer.removeEventListener("mouseenter", this.onMouseEnter), this.miniMapContainer.removeEventListener("mouseleave", this.onMouseLeave)), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("pointermove", this.onMouseMove), window.removeEventListener("pointerup", this.onMouseUp), window.removeEventListener("pointercancel", this.onMouseUp), window.removeEventListener("resize", this.onWindowResize), this.sizeToggleButton?.removeEventListener("click", this.onSizeToggleClick), this.resizeHandle?.removeEventListener("mousedown", this.onResizeHandleMouseDown), this.resizeHandle?.removeEventListener("pointerdown", this.onResizeHandleMouseDown), this.modelSelect?.removeEventListener("change", this.onModelChange), this.levelSelect?.removeEventListener("change", this.onLevelChange), this.engine.events?.off?.(this.loadingCompletedEventName, this.onLoadingCompleted), this.miniMapRenderer && (this.miniMapRenderer.dispose(), this.miniMapRenderer = null), this.miniMapContainer && (this.miniMapContainer.remove(), this.miniMapContainer = null), this.miniMapCamera = null, this.overlayCtx = null, this.overlayCanvas = null, this.levelToolbar = null, this.sizeToggleButton = null, this.resizeHandle = null, this.modelSelect = null, this.levelSelect = null, this.levelModels = [], this.levelDataSignature = "", this.selectedModelUrl = null;
|
|
13457
13481
|
}
|
|
13458
13482
|
}
|
|
13459
|
-
class
|
|
13483
|
+
class al {
|
|
13460
13484
|
engine;
|
|
13461
13485
|
constructor(e) {
|
|
13462
13486
|
this.engine = e;
|
|
@@ -13753,26 +13777,26 @@ class ol {
|
|
|
13753
13777
|
return Math.abs(s.dot(e)) < 0.999 ? s : new h(1, 0, 0);
|
|
13754
13778
|
}
|
|
13755
13779
|
}
|
|
13756
|
-
class
|
|
13780
|
+
class ll {
|
|
13757
13781
|
engine;
|
|
13758
13782
|
constructor(e) {
|
|
13759
13783
|
}
|
|
13760
13784
|
update() {
|
|
13761
13785
|
}
|
|
13762
13786
|
}
|
|
13763
|
-
const
|
|
13764
|
-
class
|
|
13787
|
+
const yn = "bim-engine:link-element-2d3d-state", Mn = "link-element-2d3d";
|
|
13788
|
+
class cl {
|
|
13765
13789
|
engine;
|
|
13766
13790
|
constructor(e) {
|
|
13767
13791
|
this.engine = e, this.active();
|
|
13768
13792
|
}
|
|
13769
13793
|
// 激活
|
|
13770
13794
|
active() {
|
|
13771
|
-
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(
|
|
13795
|
+
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(yn, this.listenLinkStateChange);
|
|
13772
13796
|
}
|
|
13773
13797
|
// 取消
|
|
13774
13798
|
disActive() {
|
|
13775
|
-
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(
|
|
13799
|
+
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(yn, this.listenLinkStateChange), this.engine?.setIdleFrameRateExempt?.(Mn, !1);
|
|
13776
13800
|
}
|
|
13777
13801
|
dispose() {
|
|
13778
13802
|
this.disActive();
|
|
@@ -13792,10 +13816,10 @@ class al {
|
|
|
13792
13816
|
/** 二三维模型联动开启时保持 3D 引擎全帧渲染,避免等待空闲限帧间隔。 */
|
|
13793
13817
|
listenLinkStateChange = (e) => {
|
|
13794
13818
|
const t = e.detail?.enabled === !0;
|
|
13795
|
-
this.engine?.setIdleFrameRateExempt?.(
|
|
13819
|
+
this.engine?.setIdleFrameRateExempt?.(Mn, t);
|
|
13796
13820
|
};
|
|
13797
13821
|
}
|
|
13798
|
-
class
|
|
13822
|
+
class hl {
|
|
13799
13823
|
engine;
|
|
13800
13824
|
constructor(e) {
|
|
13801
13825
|
this.engine = e, this.active();
|
|
@@ -13849,7 +13873,7 @@ const tt = {
|
|
|
13849
13873
|
EncodingComplete: "encoding-complete",
|
|
13850
13874
|
EncodingError: "encoding-error"
|
|
13851
13875
|
};
|
|
13852
|
-
class
|
|
13876
|
+
class dl {
|
|
13853
13877
|
engine;
|
|
13854
13878
|
apiKey;
|
|
13855
13879
|
baseURL = "https://api.deepseek.com";
|
|
@@ -14037,7 +14061,7 @@ class cl {
|
|
|
14037
14061
|
}
|
|
14038
14062
|
}
|
|
14039
14063
|
}
|
|
14040
|
-
class
|
|
14064
|
+
class ul {
|
|
14041
14065
|
engine;
|
|
14042
14066
|
constructor(e) {
|
|
14043
14067
|
this.engine = e;
|
|
@@ -14160,12 +14184,12 @@ class hl {
|
|
|
14160
14184
|
!e || e.isEmpty?.() || this.engine.viewCube?.zoomToModel?.(e);
|
|
14161
14185
|
}
|
|
14162
14186
|
}
|
|
14163
|
-
class
|
|
14187
|
+
class pl {
|
|
14164
14188
|
engine;
|
|
14165
14189
|
sectionPlaneGroup = null;
|
|
14166
14190
|
loaderModule2d;
|
|
14167
14191
|
constructor(e) {
|
|
14168
|
-
this.engine = e, this.loaderModule2d = new
|
|
14192
|
+
this.engine = e, this.loaderModule2d = new ao(this.engine);
|
|
14169
14193
|
}
|
|
14170
14194
|
/**
|
|
14171
14195
|
* 根据剖切面原点与视线方向,生成与场景 boundingBox 同大的平面 mesh 并添加到场景(贴到剖面上)
|
|
@@ -14192,7 +14216,7 @@ class dl {
|
|
|
14192
14216
|
this.engine.scene.remove(this.engine.modelGroup);
|
|
14193
14217
|
}
|
|
14194
14218
|
getMatrix(e, t) {
|
|
14195
|
-
const i = new h(e.x, e.y, e.z), n = new
|
|
14219
|
+
const i = new h(e.x, e.y, e.z), n = new Xt(t.x, t.y, t.z), s = new h(1, 1, 1), o = new Ie();
|
|
14196
14220
|
o.setFromEuler(n);
|
|
14197
14221
|
const r = new H();
|
|
14198
14222
|
return r.compose(i, o, s), r;
|
|
@@ -14230,16 +14254,16 @@ class dl {
|
|
|
14230
14254
|
), l.setPosition(e), l;
|
|
14231
14255
|
}
|
|
14232
14256
|
}
|
|
14233
|
-
function
|
|
14257
|
+
function ml(a, e, t = "bim-snapshot.png") {
|
|
14234
14258
|
const i = a?.renderer, n = i?.domElement;
|
|
14235
14259
|
if (!i || !n || !e)
|
|
14236
14260
|
return null;
|
|
14237
14261
|
const s = n.width || n.clientWidth, o = n.height || n.clientHeight;
|
|
14238
14262
|
if (s <= 0 || o <= 0)
|
|
14239
14263
|
return null;
|
|
14240
|
-
let r =
|
|
14241
|
-
if (!
|
|
14242
|
-
const m =
|
|
14264
|
+
let r = gl(n, s, o);
|
|
14265
|
+
if (!fl(r)) {
|
|
14266
|
+
const m = yl(a, s, o);
|
|
14243
14267
|
m && (r = m);
|
|
14244
14268
|
}
|
|
14245
14269
|
const l = document.createElement("canvas");
|
|
@@ -14251,13 +14275,13 @@ function ul(a, e, t = "bim-snapshot.png") {
|
|
|
14251
14275
|
const d = l.toDataURL("image/png"), u = document.createElement("a");
|
|
14252
14276
|
return u.href = d, u.download = t.toLowerCase().endsWith(".png") ? t : `${t}.png`, u.click(), d;
|
|
14253
14277
|
}
|
|
14254
|
-
function
|
|
14278
|
+
function gl(a, e, t) {
|
|
14255
14279
|
const i = document.createElement("canvas");
|
|
14256
14280
|
i.width = e, i.height = t;
|
|
14257
14281
|
const n = i.getContext("2d");
|
|
14258
14282
|
return n && n.drawImage(a, 0, 0, e, t), i;
|
|
14259
14283
|
}
|
|
14260
|
-
function
|
|
14284
|
+
function fl(a) {
|
|
14261
14285
|
const e = a.getContext("2d");
|
|
14262
14286
|
if (!e || a.width <= 0 || a.height <= 0)
|
|
14263
14287
|
return !1;
|
|
@@ -14270,28 +14294,28 @@ function ml(a) {
|
|
|
14270
14294
|
}
|
|
14271
14295
|
return !1;
|
|
14272
14296
|
}
|
|
14273
|
-
function
|
|
14297
|
+
function yl(a, e, t) {
|
|
14274
14298
|
const i = a?.renderer, n = a?.scene, s = a?.camera;
|
|
14275
14299
|
if (!i || !n || !s)
|
|
14276
14300
|
return null;
|
|
14277
|
-
const o = new
|
|
14301
|
+
const o = new Tn(e, t, {
|
|
14278
14302
|
minFilter: zt,
|
|
14279
14303
|
magFilter: zt,
|
|
14280
|
-
format:
|
|
14304
|
+
format: _n,
|
|
14281
14305
|
depthBuffer: !0,
|
|
14282
14306
|
stencilBuffer: !0
|
|
14283
14307
|
}), r = i.getRenderTarget(), l = i.autoClear, c = i.xr?.enabled ?? !1;
|
|
14284
14308
|
try {
|
|
14285
14309
|
i.xr && (i.xr.enabled = !1), i.autoClear = !0, i.setRenderTarget(o), i.clear(!0, !0, !0), i.render(n, s);
|
|
14286
14310
|
const d = new Uint8Array(e * t * 4);
|
|
14287
|
-
return i.readRenderTargetPixels(o, 0, 0, e, t, d),
|
|
14311
|
+
return i.readRenderTargetPixels(o, 0, 0, e, t, d), Ml(d, e, t);
|
|
14288
14312
|
} catch {
|
|
14289
14313
|
return null;
|
|
14290
14314
|
} finally {
|
|
14291
14315
|
i.setRenderTarget(r), i.autoClear = l, i.xr && (i.xr.enabled = c), o.dispose();
|
|
14292
14316
|
}
|
|
14293
14317
|
}
|
|
14294
|
-
function
|
|
14318
|
+
function Ml(a, e, t) {
|
|
14295
14319
|
const i = document.createElement("canvas");
|
|
14296
14320
|
i.width = e, i.height = t;
|
|
14297
14321
|
const n = i.getContext("2d");
|
|
@@ -14305,7 +14329,7 @@ function fl(a, e, t) {
|
|
|
14305
14329
|
}
|
|
14306
14330
|
return n.putImageData(s, 0, 0), i;
|
|
14307
14331
|
}
|
|
14308
|
-
const
|
|
14332
|
+
const vl = [
|
|
14309
14333
|
"#ffffff",
|
|
14310
14334
|
"#000000",
|
|
14311
14335
|
"#ff4d4f",
|
|
@@ -14316,7 +14340,7 @@ const yl = [
|
|
|
14316
14340
|
"#1677ff",
|
|
14317
14341
|
"#722ed1",
|
|
14318
14342
|
"#eb2f96"
|
|
14319
|
-
],
|
|
14343
|
+
], wl = {
|
|
14320
14344
|
none: J("/assets/icon/选择.svg", import.meta.url),
|
|
14321
14345
|
line: J("/assets/icon/线.svg", import.meta.url),
|
|
14322
14346
|
arrow: J("/assets/icon/箭头.svg", import.meta.url),
|
|
@@ -14324,7 +14348,7 @@ const yl = [
|
|
|
14324
14348
|
circle: J("/assets/icon/圆形.svg", import.meta.url),
|
|
14325
14349
|
text: J("/assets/icon/文字.svg", import.meta.url),
|
|
14326
14350
|
cloudline: J("/assets/icon/云线.svg", import.meta.url)
|
|
14327
|
-
},
|
|
14351
|
+
}, xl = J("/assets/icon/测距.svg", import.meta.url), bl = J("/assets/icon/截图.svg", import.meta.url), Cl = J("/assets/icon/线宽.svg", import.meta.url), Al = J("/assets/icon/字号.svg", import.meta.url), Sl = `data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l4 8-4 12-4-12 4-8z" fill="#1677ff"/><circle cx="12" cy="10" r="2.5" fill="#fff"/></svg>')}`, El = [
|
|
14328
14352
|
{ type: "distance", label: "距离" },
|
|
14329
14353
|
{ type: "clearDistance", label: "净距" },
|
|
14330
14354
|
{ type: "clearHeight", label: "净高" },
|
|
@@ -14333,7 +14357,7 @@ const yl = [
|
|
|
14333
14357
|
{ type: "angle", label: "角度" },
|
|
14334
14358
|
{ type: "area", label: "面积" },
|
|
14335
14359
|
{ type: "slope", label: "坡度" }
|
|
14336
|
-
],
|
|
14360
|
+
], Pl = {
|
|
14337
14361
|
distance: J("/assets/icon/距离.svg", import.meta.url),
|
|
14338
14362
|
clearDistance: J("/assets/icon/净距.svg", import.meta.url),
|
|
14339
14363
|
clearHeight: J("/assets/icon/净高.svg", import.meta.url),
|
|
@@ -14343,7 +14367,7 @@ const yl = [
|
|
|
14343
14367
|
area: J("/assets/icon/面积.svg", import.meta.url),
|
|
14344
14368
|
slope: J("/assets/icon/坡度.svg", import.meta.url)
|
|
14345
14369
|
};
|
|
14346
|
-
class
|
|
14370
|
+
class Tl {
|
|
14347
14371
|
constructor(e, t) {
|
|
14348
14372
|
this.handlers = e, this.root = document.createElement("div"), this.root.style.position = "absolute", this.root.style.top = "8px", this.root.style.left = "50%", this.root.style.transform = "translateX(-50%)", this.root.style.display = "none", this.root.style.padding = "6px", this.root.style.background = "#ffffff", this.root.style.border = "1px solid #d9d9d9", this.root.style.borderRadius = "8px", this.root.style.pointerEvents = "auto", this.root.style.userSelect = "none", this.root.style.boxShadow = "0 4px 14px rgba(0, 0, 0, 0.12)", this.root.style.zIndex = "1300", this.root.style.overflow = "visible", this.editPanel = document.createElement("div"), this.editPanel.style.display = "flex", this.editPanel.style.flexDirection = "column", this.editPanel.style.gap = "6px", this.viewPanel = document.createElement("div"), this.viewPanel.style.display = "none", this.viewPanel.style.alignItems = "center", this.viewPanel.style.gap = "6px";
|
|
14349
14373
|
const i = document.createElement("div");
|
|
@@ -14356,7 +14380,7 @@ class El {
|
|
|
14356
14380
|
{ type: "text", label: "文字" },
|
|
14357
14381
|
{ type: "cloudline", label: "云线" }
|
|
14358
14382
|
].forEach((f) => {
|
|
14359
|
-
const v = this.createIconButton(f.label,
|
|
14383
|
+
const v = this.createIconButton(f.label, wl[f.type]);
|
|
14360
14384
|
v.onclick = () => this.handlers.onDrawTypeChange(f.type), this.drawButtons[f.type] = v, i.appendChild(v);
|
|
14361
14385
|
});
|
|
14362
14386
|
const s = document.createElement("div");
|
|
@@ -14366,23 +14390,23 @@ class El {
|
|
|
14366
14390
|
this.updateColorControl(this.colorInput.value), this.handlers.onColorChange(this.colorInput.value), this.setColorPresetVisible(!1);
|
|
14367
14391
|
}, s.appendChild(this.colorInput), this.colorPresetPanel = document.createElement("div"), this.colorPresetPanel.style.position = "absolute", this.colorPresetPanel.style.top = "30px", this.colorPresetPanel.style.left = "0", this.colorPresetPanel.style.display = "none", this.colorPresetPanel.style.padding = "8px", this.colorPresetPanel.style.background = "#ffffff", this.colorPresetPanel.style.border = "1px solid #d9d9d9", this.colorPresetPanel.style.borderRadius = "6px", this.colorPresetPanel.style.boxShadow = "0 6px 18px rgba(0, 0, 0, 0.14)", this.colorPresetPanel.style.zIndex = "20", this.colorPresetPanel.style.width = "152px";
|
|
14368
14392
|
const r = document.createElement("div");
|
|
14369
|
-
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px",
|
|
14393
|
+
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px", vl.forEach((f) => {
|
|
14370
14394
|
const v = document.createElement("button");
|
|
14371
14395
|
v.type = "button", v.title = f, v.style.width = "22px", v.style.height = "22px", v.style.padding = "0", v.style.border = "1px solid #d9d9d9", v.style.borderRadius = "4px", v.style.background = f, v.style.cursor = "pointer", v.onclick = () => {
|
|
14372
14396
|
this.updateColorControl(f), this.handlers.onColorChange(f), this.setColorPresetVisible(!1);
|
|
14373
14397
|
}, r.appendChild(v);
|
|
14374
14398
|
}), this.colorPresetPanel.appendChild(r);
|
|
14375
14399
|
const l = document.createElement("button");
|
|
14376
|
-
l.type = "button", l.textContent = "自定义", l.style.marginTop = "8px", l.style.width = "100%", l.style.height = "26px", l.style.border = "1px solid #d9d9d9", l.style.borderRadius = "4px", l.style.background = "#ffffff", l.style.color = "#333333", l.style.cursor = "pointer", l.onclick = () => this.openNativeColorPicker(), this.colorPresetPanel.appendChild(l), s.appendChild(this.colorPresetPanel), this.updateColorControl(t.stroke), i.appendChild(this.createField("", s)), this.strokeWidthInput = document.createElement("input"), this.strokeWidthInput.type = "number", this.strokeWidthInput.min = "1", this.strokeWidthInput.max = "20", this.strokeWidthInput.step = "1", this.strokeWidthInput.value = String(t.strokeWidth), this.strokeWidthInput.style.width = "46px", this.strokeWidthInput.oninput = () => this.handlers.onStrokeWidthChange(this.strokeWidthInput.value), i.appendChild(this.createField("", this.strokeWidthInput,
|
|
14377
|
-
const c = this.createIconButton("截图",
|
|
14400
|
+
l.type = "button", l.textContent = "自定义", l.style.marginTop = "8px", l.style.width = "100%", l.style.height = "26px", l.style.border = "1px solid #d9d9d9", l.style.borderRadius = "4px", l.style.background = "#ffffff", l.style.color = "#333333", l.style.cursor = "pointer", l.onclick = () => this.openNativeColorPicker(), this.colorPresetPanel.appendChild(l), s.appendChild(this.colorPresetPanel), this.updateColorControl(t.stroke), i.appendChild(this.createField("", s)), this.strokeWidthInput = document.createElement("input"), this.strokeWidthInput.type = "number", this.strokeWidthInput.min = "1", this.strokeWidthInput.max = "20", this.strokeWidthInput.step = "1", this.strokeWidthInput.value = String(t.strokeWidth), this.strokeWidthInput.style.width = "46px", this.strokeWidthInput.oninput = () => this.handlers.onStrokeWidthChange(this.strokeWidthInput.value), i.appendChild(this.createField("", this.strokeWidthInput, Cl, "线宽")), this.fontSizeInput = document.createElement("input"), this.fontSizeInput.type = "number", this.fontSizeInput.min = "10", this.fontSizeInput.max = "96", this.fontSizeInput.step = "1", this.fontSizeInput.value = String(t.fontSize), this.fontSizeInput.style.width = "46px", this.fontSizeInput.oninput = () => this.handlers.onFontSizeChange(this.fontSizeInput.value), i.appendChild(this.createField("", this.fontSizeInput, Al, "字号")), this.distanceButton = this.createIconButton("测量", xl), this.distanceButton.onclick = () => this.handlers.onMeasureToggle(), i.appendChild(this.distanceButton);
|
|
14401
|
+
const c = this.createIconButton("截图", bl);
|
|
14378
14402
|
c.onclick = () => this.handlers.onScreenshot(), i.appendChild(c);
|
|
14379
|
-
const d = this.createIconButton("捕捉点",
|
|
14403
|
+
const d = this.createIconButton("捕捉点", Sl);
|
|
14380
14404
|
d.onclick = () => this.handlers.onPickPoint(), i.appendChild(d);
|
|
14381
14405
|
const u = this.createTextButton("×", "取消");
|
|
14382
14406
|
u.onclick = () => this.handlers.onCancel(), u.style.background = "#ff4d4f", u.style.borderColor = "#ff4d4f", u.style.color = "#ffffff", i.appendChild(u);
|
|
14383
14407
|
const m = this.createTextButton("✔", "确定");
|
|
14384
|
-
m.onclick = () => this.handlers.onConfirm(), m.style.background = "#52c41a", m.style.borderColor = "#52c41a", m.style.color = "#ffffff", i.appendChild(m), this.measureSubPanel = document.createElement("div"), this.measureSubPanel.style.display = "none", this.measureSubPanel.style.alignItems = "center", this.measureSubPanel.style.gap = "6px", this.measureSubPanel.style.flexWrap = "wrap", this.measureSubPanel.style.paddingTop = "2px",
|
|
14385
|
-
const v = this.createSmallIconButton(f.label,
|
|
14408
|
+
m.onclick = () => this.handlers.onConfirm(), m.style.background = "#52c41a", m.style.borderColor = "#52c41a", m.style.color = "#ffffff", i.appendChild(m), this.measureSubPanel = document.createElement("div"), this.measureSubPanel.style.display = "none", this.measureSubPanel.style.alignItems = "center", this.measureSubPanel.style.gap = "6px", this.measureSubPanel.style.flexWrap = "wrap", this.measureSubPanel.style.paddingTop = "2px", El.forEach((f) => {
|
|
14409
|
+
const v = this.createSmallIconButton(f.label, Pl[f.type]);
|
|
14386
14410
|
v.onclick = () => this.handlers.onMeasureTypeChange(f.type), this.measureTypeButtons[f.type] = v, this.measureSubPanel.appendChild(v);
|
|
14387
14411
|
}), this.editPanel.appendChild(i), this.editPanel.appendChild(this.measureSubPanel);
|
|
14388
14412
|
const g = this.createTextButton("关闭", "关闭");
|
|
@@ -14507,7 +14531,7 @@ class El {
|
|
|
14507
14531
|
return i.type = "button", i.title = t, i.textContent = e, i.style.width = "28px", i.style.height = "28px", i.style.padding = "0 10px", i.style.border = "1px solid #d9d9d9", i.style.borderRadius = "4px", i.style.background = "#ffffff", i.style.color = "#333333", i.style.fontSize = "13px", i.style.lineHeight = "1", i.style.cursor = "pointer", i;
|
|
14508
14532
|
}
|
|
14509
14533
|
}
|
|
14510
|
-
class
|
|
14534
|
+
class _l {
|
|
14511
14535
|
engine;
|
|
14512
14536
|
wrapper;
|
|
14513
14537
|
canvasEl;
|
|
@@ -14546,7 +14570,7 @@ class Pl {
|
|
|
14546
14570
|
const t = this.engine.container;
|
|
14547
14571
|
if (!t)
|
|
14548
14572
|
throw new Error("FabricDraw: engine container not found.");
|
|
14549
|
-
this.wrapper = document.createElement("div"), this.wrapper.className = "fabric-draw-layer", this.wrapper.style.position = "absolute", this.wrapper.style.left = "0", this.wrapper.style.top = "0", this.wrapper.style.right = "0", this.wrapper.style.bottom = "0", this.wrapper.style.pointerEvents = "none", this.canvasEl = document.createElement("canvas"), this.canvasEl.style.width = "100%", this.canvasEl.style.height = "100%", this.wrapper.appendChild(this.canvasEl), this.toolbar = new
|
|
14573
|
+
this.wrapper = document.createElement("div"), this.wrapper.className = "fabric-draw-layer", this.wrapper.style.position = "absolute", this.wrapper.style.left = "0", this.wrapper.style.top = "0", this.wrapper.style.right = "0", this.wrapper.style.bottom = "0", this.wrapper.style.pointerEvents = "none", this.canvasEl = document.createElement("canvas"), this.canvasEl.style.width = "100%", this.canvasEl.style.height = "100%", this.wrapper.appendChild(this.canvasEl), this.toolbar = new Tl({
|
|
14550
14574
|
onDrawTypeChange: (n) => this.setDrawType(n),
|
|
14551
14575
|
onMeasureToggle: () => this.toggleMeasurePanel(),
|
|
14552
14576
|
onMeasureTypeChange: (n) => this.activateDistanceMeasure(n),
|
|
@@ -14572,7 +14596,7 @@ class Pl {
|
|
|
14572
14596
|
fontSize: this.drawStyle.fontSize
|
|
14573
14597
|
}), this.toolbar.mount(this.wrapper);
|
|
14574
14598
|
const i = this.engine.renderer?.domElement;
|
|
14575
|
-
i?.nextSibling ? t.insertBefore(this.wrapper, i.nextSibling) : t.appendChild(this.wrapper), this.canvas = new
|
|
14599
|
+
i?.nextSibling ? t.insertBefore(this.wrapper, i.nextSibling) : t.appendChild(this.wrapper), this.canvas = new io(this.canvasEl, {
|
|
14576
14600
|
selection: !0,
|
|
14577
14601
|
preserveObjectStacking: !0
|
|
14578
14602
|
}), this.resize(), this.canvas.on("mouse:down", this.onMouseDown), this.canvas.on("mouse:move", this.onMouseMove), this.canvas.on("mouse:up", this.onMouseUp), this.canvas.on("mouse:dblclick", this.onMouseDblClick), this.canvas.on("selection:created", this.onSelectionChanged), this.canvas.on("selection:updated", this.onSelectionChanged), this.canvas.on("selection:cleared", this.onSelectionChanged), window.addEventListener("keydown", this.onKeyDown), this.refreshToolbarState();
|
|
@@ -14658,7 +14682,7 @@ class Pl {
|
|
|
14658
14682
|
/**
|
|
14659
14683
|
* 鐩存帴缁樺埗鏂囧瓧銆? */
|
|
14660
14684
|
drawText(e, t, i) {
|
|
14661
|
-
const n = this.mergeStyle(i), s = new
|
|
14685
|
+
const n = this.mergeStyle(i), s = new no(t ?? n.text, {
|
|
14662
14686
|
left: e.x,
|
|
14663
14687
|
top: e.y,
|
|
14664
14688
|
...this.createTextStyle(n),
|
|
@@ -14695,7 +14719,7 @@ class Pl {
|
|
|
14695
14719
|
* 鎴浘淇濆瓨锛堟ā鍨?Fabric鎵规敞鍚堟垚锛夈€? */
|
|
14696
14720
|
saveScreenshot(e = "bim-snapshot.png") {
|
|
14697
14721
|
const t = this.canvas.lowerCanvasEl;
|
|
14698
|
-
return t ?
|
|
14722
|
+
return t ? ml(this.engine, t, e) : null;
|
|
14699
14723
|
}
|
|
14700
14724
|
/**
|
|
14701
14725
|
* 鍚屾鐢诲竷灏哄銆? */
|
|
@@ -14855,7 +14879,7 @@ class Pl {
|
|
|
14855
14879
|
};
|
|
14856
14880
|
}
|
|
14857
14881
|
createLineObject(e, t, i, n) {
|
|
14858
|
-
const s = new
|
|
14882
|
+
const s = new Zt([e.x, e.y, t.x, t.y], {
|
|
14859
14883
|
...this.createObjectBase(i, n),
|
|
14860
14884
|
fill: "",
|
|
14861
14885
|
strokeLineCap: "round"
|
|
@@ -14863,7 +14887,7 @@ class Pl {
|
|
|
14863
14887
|
return s.annotationType = "line", s;
|
|
14864
14888
|
}
|
|
14865
14889
|
createRectObject(e, t, i, n) {
|
|
14866
|
-
const s = this.getBoxFromPoints(e, t), o = new
|
|
14890
|
+
const s = this.getBoxFromPoints(e, t), o = new so({
|
|
14867
14891
|
...this.createObjectBase(i, n),
|
|
14868
14892
|
left: s.left,
|
|
14869
14893
|
top: s.top,
|
|
@@ -14875,7 +14899,7 @@ class Pl {
|
|
|
14875
14899
|
return o.annotationType = "rect", o;
|
|
14876
14900
|
}
|
|
14877
14901
|
createCircleObject(e, t, i, n) {
|
|
14878
|
-
const s = this.getCircleFromPoints(e, t), o = new
|
|
14902
|
+
const s = this.getCircleFromPoints(e, t), o = new oo({
|
|
14879
14903
|
...this.createObjectBase(i, n),
|
|
14880
14904
|
left: s.left,
|
|
14881
14905
|
top: s.top,
|
|
@@ -14888,34 +14912,34 @@ class Pl {
|
|
|
14888
14912
|
createArrowObject(e, t, i, n) {
|
|
14889
14913
|
const s = t.x - e.x, o = t.y - e.y, r = Math.sqrt(s * s + o * o);
|
|
14890
14914
|
if (r < 1e-6) {
|
|
14891
|
-
const k = new
|
|
14915
|
+
const k = new Zt([e.x, e.y, t.x, t.y], {
|
|
14892
14916
|
stroke: i.stroke,
|
|
14893
14917
|
strokeWidth: i.strokeWidth,
|
|
14894
14918
|
fill: "",
|
|
14895
14919
|
selectable: n,
|
|
14896
14920
|
evented: n
|
|
14897
|
-
}), U = new
|
|
14921
|
+
}), U = new Ni([k], {
|
|
14898
14922
|
selectable: n,
|
|
14899
14923
|
evented: n,
|
|
14900
14924
|
objectCaching: !1
|
|
14901
14925
|
});
|
|
14902
14926
|
return U.annotationType = "arrow", U;
|
|
14903
14927
|
}
|
|
14904
|
-
const l = s / r, c = o / r, d = -c, u = l, m = Math.max(10, i.strokeWidth * 6), g = m * 0.72, f = t.x - l * m, v = t.y - c * m, b = f + d * (g * 0.5), p = v + u * (g * 0.5), x = f - d * (g * 0.5), C = v - u * (g * 0.5), P = new
|
|
14928
|
+
const l = s / r, c = o / r, d = -c, u = l, m = Math.max(10, i.strokeWidth * 6), g = m * 0.72, f = t.x - l * m, v = t.y - c * m, b = f + d * (g * 0.5), p = v + u * (g * 0.5), x = f - d * (g * 0.5), C = v - u * (g * 0.5), P = new Zt([e.x, e.y, t.x, t.y], {
|
|
14905
14929
|
stroke: i.stroke,
|
|
14906
14930
|
strokeWidth: i.strokeWidth,
|
|
14907
14931
|
fill: "",
|
|
14908
14932
|
strokeLineCap: "round",
|
|
14909
14933
|
selectable: !1,
|
|
14910
14934
|
evented: !1
|
|
14911
|
-
}), I = `M ${t.x} ${t.y} L ${b} ${p} L ${x} ${C} Z`, D = new
|
|
14935
|
+
}), I = `M ${t.x} ${t.y} L ${b} ${p} L ${x} ${C} Z`, D = new Vi(I, {
|
|
14912
14936
|
fill: i.stroke,
|
|
14913
14937
|
stroke: i.stroke,
|
|
14914
14938
|
strokeWidth: 1,
|
|
14915
14939
|
selectable: !1,
|
|
14916
14940
|
evented: !1,
|
|
14917
14941
|
objectCaching: !1
|
|
14918
|
-
}), R = new
|
|
14942
|
+
}), R = new Ni([P, D], {
|
|
14919
14943
|
selectable: n,
|
|
14920
14944
|
evented: n,
|
|
14921
14945
|
objectCaching: !1
|
|
@@ -14926,7 +14950,7 @@ class Pl {
|
|
|
14926
14950
|
const n = this.buildCloudPath(e, t.cloudRadius);
|
|
14927
14951
|
if (!n)
|
|
14928
14952
|
return null;
|
|
14929
|
-
const s = new
|
|
14953
|
+
const s = new Vi(n, {
|
|
14930
14954
|
stroke: t.stroke,
|
|
14931
14955
|
strokeWidth: t.strokeWidth,
|
|
14932
14956
|
fill: "",
|
|
@@ -15179,7 +15203,7 @@ class Pl {
|
|
|
15179
15203
|
return JSON.parse(JSON.stringify(e));
|
|
15180
15204
|
}
|
|
15181
15205
|
}
|
|
15182
|
-
class
|
|
15206
|
+
class Il {
|
|
15183
15207
|
engine;
|
|
15184
15208
|
capturePoint = null;
|
|
15185
15209
|
labelPrefix = "drawing-pin-label-";
|
|
@@ -15629,7 +15653,7 @@ class Tl {
|
|
|
15629
15653
|
return e;
|
|
15630
15654
|
}
|
|
15631
15655
|
}
|
|
15632
|
-
const
|
|
15656
|
+
const li = "bim-engine:model-link-3d", Dl = "default-model-link-3d-group", vn = "model-link-3d", wn = {
|
|
15633
15657
|
enabled: !1,
|
|
15634
15658
|
highlight: !0,
|
|
15635
15659
|
visibility: !0,
|
|
@@ -15638,7 +15662,7 @@ const oi = "bim-engine:model-link-3d", _l = "default-model-link-3d-group", Mn =
|
|
|
15638
15662
|
cameraMode: "onStop",
|
|
15639
15663
|
cameraThrottleMs: 50
|
|
15640
15664
|
};
|
|
15641
|
-
class
|
|
15665
|
+
class Ll {
|
|
15642
15666
|
viewerGuid;
|
|
15643
15667
|
engine;
|
|
15644
15668
|
options;
|
|
@@ -15655,7 +15679,7 @@ class Il {
|
|
|
15655
15679
|
* 初始化全局事件监听、相机监听和模型工具方法包装。
|
|
15656
15680
|
*/
|
|
15657
15681
|
init() {
|
|
15658
|
-
typeof window > "u" || this.disposed || (window.addEventListener(
|
|
15682
|
+
typeof window > "u" || this.disposed || (window.addEventListener(li, this.handleWindowEvent), this.wrapModelToolMethods(), this.bindCameraEvents(), this.syncIdleFrameRateExempt());
|
|
15659
15683
|
}
|
|
15660
15684
|
/**
|
|
15661
15685
|
* 更新联动配置数据,不改变当前启停状态。
|
|
@@ -15696,20 +15720,20 @@ class Il {
|
|
|
15696
15720
|
return this.applyingLinkedEvent;
|
|
15697
15721
|
}
|
|
15698
15722
|
dispose() {
|
|
15699
|
-
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(
|
|
15723
|
+
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(li, this.handleWindowEvent), this.pendingCameraTimer != null && (window.clearTimeout(this.pendingCameraTimer), this.pendingCameraTimer = null), this.firstPersonSyncFrame != null && (window.cancelAnimationFrame(this.firstPersonSyncFrame), this.firstPersonSyncFrame = null), this.engine?.setIdleFrameRateExempt?.(vn, !1), this.unbindCameraEvents(), this.restoreModelToolMethods());
|
|
15700
15724
|
}
|
|
15701
15725
|
normalizeOptions(e) {
|
|
15702
15726
|
return {
|
|
15703
|
-
...
|
|
15727
|
+
...wn,
|
|
15704
15728
|
...e,
|
|
15705
|
-
groupId: e.groupId ?? this.engine?.options?.linkGroupId ??
|
|
15729
|
+
groupId: e.groupId ?? this.engine?.options?.linkGroupId ?? Dl,
|
|
15706
15730
|
modelId: e.modelId ?? this.engine?.options?.modelLinkId
|
|
15707
15731
|
};
|
|
15708
15732
|
}
|
|
15709
15733
|
/** 模型联动开启后需要持续响应外部视图变化,不能进入空闲限帧。 */
|
|
15710
15734
|
syncIdleFrameRateExempt() {
|
|
15711
15735
|
this.engine?.setIdleFrameRateExempt?.(
|
|
15712
|
-
|
|
15736
|
+
vn,
|
|
15713
15737
|
this.options.enabled === !0
|
|
15714
15738
|
);
|
|
15715
15739
|
}
|
|
@@ -15801,7 +15825,7 @@ class Il {
|
|
|
15801
15825
|
return this.engine?.controlModule?.firstPersonControls?.enabled === !0 && this.engine?.movefirst === !0;
|
|
15802
15826
|
}
|
|
15803
15827
|
emitCameraThrottled() {
|
|
15804
|
-
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ??
|
|
15828
|
+
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ?? wn.cameraThrottleMs) - (e - this.lastCameraEmitTime));
|
|
15805
15829
|
if (t === 0) {
|
|
15806
15830
|
this.emitCamera();
|
|
15807
15831
|
return;
|
|
@@ -15824,7 +15848,7 @@ class Il {
|
|
|
15824
15848
|
});
|
|
15825
15849
|
}
|
|
15826
15850
|
emitEvent(e) {
|
|
15827
|
-
this.shouldEmit(e.action) && window.dispatchEvent(new CustomEvent(
|
|
15851
|
+
this.shouldEmit(e.action) && window.dispatchEvent(new CustomEvent(li, {
|
|
15828
15852
|
detail: {
|
|
15829
15853
|
...e,
|
|
15830
15854
|
sourceGuid: this.viewerGuid,
|
|
@@ -15942,13 +15966,13 @@ class Il {
|
|
|
15942
15966
|
}).filter((n) => n.ids.length > 0);
|
|
15943
15967
|
}
|
|
15944
15968
|
}
|
|
15945
|
-
class
|
|
15969
|
+
class kl {
|
|
15946
15970
|
engine;
|
|
15947
15971
|
manager;
|
|
15948
15972
|
worldToScreen;
|
|
15949
15973
|
raycaster = new me();
|
|
15950
15974
|
constructor(e) {
|
|
15951
|
-
this.engine = e, this.worldToScreen = new he(e.camera, e.renderer, e.scene), this.manager = new
|
|
15975
|
+
this.engine = e, this.worldToScreen = new he(e.camera, e.renderer, e.scene), this.manager = new Zs({
|
|
15952
15976
|
container: e.container,
|
|
15953
15977
|
className: "bim-engine-label-container bim-engine-label-container-3d",
|
|
15954
15978
|
projectCoordinate: (t) => this.projectCoordinate(t),
|
|
@@ -16020,7 +16044,7 @@ function It(a) {
|
|
|
16020
16044
|
const e = new h();
|
|
16021
16045
|
return a.length === 0 ? e : (a.forEach((t) => e.add(Ae(t))), e.multiplyScalar(1 / a.length));
|
|
16022
16046
|
}
|
|
16023
|
-
function
|
|
16047
|
+
function Bl(a) {
|
|
16024
16048
|
const e = new h();
|
|
16025
16049
|
for (let t = 0; t < a.length; t += 1) {
|
|
16026
16050
|
const i = a[t], n = a[(t + 1) % a.length];
|
|
@@ -16028,9 +16052,9 @@ function Ll(a) {
|
|
|
16028
16052
|
}
|
|
16029
16053
|
return e.normalize();
|
|
16030
16054
|
}
|
|
16031
|
-
function
|
|
16055
|
+
function xn(a) {
|
|
16032
16056
|
const e = a.map((c) => Ae(c)), t = e[0].clone(), i = e.length > 1 ? e[1].clone().sub(t).normalize() : new h(1, 0, 0);
|
|
16033
|
-
let n =
|
|
16057
|
+
let n = Bl(e);
|
|
16034
16058
|
n.lengthSq() < 1e-8 && (n = new h(0, 1, 0));
|
|
16035
16059
|
const s = new h().crossVectors(n, i).normalize(), o = new h().crossVectors(s, n).normalize(), r = e.map((c) => {
|
|
16036
16060
|
const d = c.clone().sub(t);
|
|
@@ -16043,8 +16067,8 @@ function wn(a) {
|
|
|
16043
16067
|
localPoints: r
|
|
16044
16068
|
};
|
|
16045
16069
|
}
|
|
16046
|
-
function
|
|
16047
|
-
const e = new
|
|
16070
|
+
function bn(a) {
|
|
16071
|
+
const e = new In();
|
|
16048
16072
|
return a.forEach((t, i) => {
|
|
16049
16073
|
if (i === 0) {
|
|
16050
16074
|
e.moveTo(t.x, t.y);
|
|
@@ -16053,12 +16077,12 @@ function xn(a) {
|
|
|
16053
16077
|
e.lineTo(t.x, t.y);
|
|
16054
16078
|
}), e.closePath(), e;
|
|
16055
16079
|
}
|
|
16056
|
-
function
|
|
16080
|
+
function zl(a, e) {
|
|
16057
16081
|
a.traverse((t) => {
|
|
16058
16082
|
t.userData = t.userData ?? {}, t.userData.annotationId = e;
|
|
16059
16083
|
});
|
|
16060
16084
|
}
|
|
16061
|
-
function
|
|
16085
|
+
function Rl(a) {
|
|
16062
16086
|
a.traverse((e) => {
|
|
16063
16087
|
const t = e;
|
|
16064
16088
|
t.geometry?.dispose?.();
|
|
@@ -16070,13 +16094,13 @@ function Bl(a) {
|
|
|
16070
16094
|
i?.dispose?.();
|
|
16071
16095
|
});
|
|
16072
16096
|
}
|
|
16073
|
-
function
|
|
16097
|
+
function Ol(a) {
|
|
16074
16098
|
return a.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
16075
16099
|
}
|
|
16076
|
-
function
|
|
16100
|
+
function Fl(a) {
|
|
16077
16101
|
return a === "polyline" ? "center" : a === "polygon" ? "centroid" : "top";
|
|
16078
16102
|
}
|
|
16079
|
-
class
|
|
16103
|
+
class Hl {
|
|
16080
16104
|
constructor(e, t, i) {
|
|
16081
16105
|
this.engine = e, this.textureLoader = t, this.materialFactory = i;
|
|
16082
16106
|
}
|
|
@@ -16104,7 +16128,7 @@ class Ol {
|
|
|
16104
16128
|
buildPoint(e) {
|
|
16105
16129
|
const t = Ae(e.instance.points[0]), i = e.instance.style, n = e.instance.effect, s = i.point ?? {};
|
|
16106
16130
|
if (e.instance.root.position.copy(t), s.icon) {
|
|
16107
|
-
const r = new
|
|
16131
|
+
const r = new kn({
|
|
16108
16132
|
map: this.textureLoader.load(s.icon),
|
|
16109
16133
|
transparent: !0,
|
|
16110
16134
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1,
|
|
@@ -16115,7 +16139,7 @@ class Ol {
|
|
|
16115
16139
|
l.center.set(0.5, 0.1), e.instance.root.add(l), e.iconSprite = l;
|
|
16116
16140
|
}
|
|
16117
16141
|
if ((s.size ?? 0) > 0) {
|
|
16118
|
-
const r = Math.max(s.size ?? 0, 0.01), l = new
|
|
16142
|
+
const r = Math.max(s.size ?? 0, 0.01), l = new zn(r * 0.5, 20, 16), c = new ce({
|
|
16119
16143
|
color: i.color ?? "#7ffcff",
|
|
16120
16144
|
transparent: !0,
|
|
16121
16145
|
opacity: i.opacity ?? 0.92,
|
|
@@ -16128,14 +16152,14 @@ class Ol {
|
|
|
16128
16152
|
}
|
|
16129
16153
|
const o = new de(i.color ?? "#7ffcff");
|
|
16130
16154
|
if (n.baseRing?.enabled) {
|
|
16131
|
-
const r = n.baseRing.radius ?? 3, l = new
|
|
16155
|
+
const r = n.baseRing.radius ?? 3, l = new Fi(r * 0.84, r, 48), c = this.materialFactory.createPulseMaterial(o, 0.85, i, n, "uvx", 0, 1), d = new F(l, c);
|
|
16132
16156
|
d.rotation.x = -Math.PI / 2, d.renderOrder = i.alwaysOnTop ? 1300 : 0, e.instance.root.add(d), e.baseRingMeshes.push(d), e.pulseMaterials.push(c);
|
|
16133
16157
|
}
|
|
16134
16158
|
if (n.ripple?.enabled) {
|
|
16135
16159
|
const r = n.ripple.count ?? 2, l = n.ripple.maxRadius ?? 12;
|
|
16136
16160
|
for (let c = 0; c < r; c += 1) {
|
|
16137
16161
|
const d = new F(
|
|
16138
|
-
new
|
|
16162
|
+
new Fi(0.86, 1, 40),
|
|
16139
16163
|
new ce({
|
|
16140
16164
|
color: o,
|
|
16141
16165
|
transparent: !0,
|
|
@@ -16149,7 +16173,7 @@ class Ol {
|
|
|
16149
16173
|
}
|
|
16150
16174
|
}
|
|
16151
16175
|
if (n.pillar?.enabled) {
|
|
16152
|
-
const r = n.pillar.height ?? 16, l = n.pillar.width ?? 1.5, c = new
|
|
16176
|
+
const r = n.pillar.height ?? 16, l = n.pillar.width ?? 1.5, c = new Vs(l * 0.5, l * 0.5, r, 20, 1, !0), d = this.materialFactory.createSurfaceMaterial({
|
|
16153
16177
|
color: i.color ?? "#7ffcff",
|
|
16154
16178
|
opacity: i.fillOpacity ?? 0.22,
|
|
16155
16179
|
style: i,
|
|
@@ -16173,10 +16197,10 @@ class Ol {
|
|
|
16173
16197
|
}
|
|
16174
16198
|
/** 线标记用 TubeGeometry 拉出体积,便于承载渐变和流动特效。 */
|
|
16175
16199
|
buildPolyline(e) {
|
|
16176
|
-
const t = e.instance.points.map((c) => Ae(c)), i = new
|
|
16200
|
+
const t = e.instance.points.map((c) => Ae(c)), i = new Us();
|
|
16177
16201
|
for (let c = 0; c < t.length - 1; c += 1)
|
|
16178
|
-
i.add(new
|
|
16179
|
-
const n = Math.max(e.instance.style.lineWidth ?? 0.18, 0.02), s = new
|
|
16202
|
+
i.add(new Gs(t[c], t[c + 1]));
|
|
16203
|
+
const n = Math.max(e.instance.style.lineWidth ?? 0.18, 0.02), s = new Ws(i, Math.max(32, t.length * 14), n, 10, !1);
|
|
16180
16204
|
s.computeBoundingBox();
|
|
16181
16205
|
const o = s.boundingBox ?? new N(new h(0, 0, 0), new h(1, 1, 1)), r = this.materialFactory.createSurfaceMaterial({
|
|
16182
16206
|
color: e.instance.style.color ?? "#7ffcff",
|
|
@@ -16191,7 +16215,7 @@ class Ol {
|
|
|
16191
16215
|
}
|
|
16192
16216
|
/** 任意平面多边形先投影到局部二维,再恢复到原始空间。 */
|
|
16193
16217
|
buildPolygon(e) {
|
|
16194
|
-
const t =
|
|
16218
|
+
const t = xn(e.instance.points), i = bn(t.localPoints), n = new Ks(i);
|
|
16195
16219
|
n.computeBoundingBox();
|
|
16196
16220
|
const s = n.boundingBox ?? new N(new h(0, 0, 0), new h(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
16197
16221
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
@@ -16214,7 +16238,7 @@ class Ol {
|
|
|
16214
16238
|
}
|
|
16215
16239
|
/** 拉伸体支持围栏类视觉效果,并记录法线供面板挂到顶部。 */
|
|
16216
16240
|
buildExtrudePolygon(e) {
|
|
16217
|
-
const t =
|
|
16241
|
+
const t = xn(e.instance.points), i = bn(t.localPoints), n = e.instance.style.volume?.height ?? 10, s = new Dn(i, {
|
|
16218
16242
|
depth: n,
|
|
16219
16243
|
bevelEnabled: !1,
|
|
16220
16244
|
steps: 1,
|
|
@@ -16264,7 +16288,7 @@ class Ol {
|
|
|
16264
16288
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1
|
|
16265
16289
|
});
|
|
16266
16290
|
m.clippingPlanes = this.engine.sectionPlane;
|
|
16267
|
-
const g = new
|
|
16291
|
+
const g = new di(new qs(l), m);
|
|
16268
16292
|
g.position.copy(r), e.instance.root.add(g), e.volumeHeight = o.y, e.animatedMaterials.push(d);
|
|
16269
16293
|
}
|
|
16270
16294
|
/** 多层轮廓线常用于电子围栏、扫描墙这类有高度层次感的体标记。 */
|
|
@@ -16293,11 +16317,11 @@ class Ol {
|
|
|
16293
16317
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1
|
|
16294
16318
|
});
|
|
16295
16319
|
s.clippingPlanes = this.engine.sectionPlane;
|
|
16296
|
-
const o = new
|
|
16320
|
+
const o = new js(n, s);
|
|
16297
16321
|
return o.renderOrder = 998, o;
|
|
16298
16322
|
}
|
|
16299
16323
|
}
|
|
16300
|
-
class
|
|
16324
|
+
class Nl {
|
|
16301
16325
|
constructor(e) {
|
|
16302
16326
|
this.engine = e;
|
|
16303
16327
|
}
|
|
@@ -16342,13 +16366,13 @@ class Fl {
|
|
|
16342
16366
|
t.scale.set(o, o, 1);
|
|
16343
16367
|
}
|
|
16344
16368
|
}
|
|
16345
|
-
class
|
|
16369
|
+
class Vl {
|
|
16346
16370
|
constructor(e) {
|
|
16347
16371
|
this.engine = e;
|
|
16348
16372
|
}
|
|
16349
16373
|
/** 构建支持渐变、流动、扫描、呼吸和发光的通用表面材质。 */
|
|
16350
16374
|
createSurfaceMaterial(e) {
|
|
16351
|
-
const t = e.style ?? {}, i = e.effect ?? {}, n = this.getGradientStops(e.color, i.gradient?.stops), s = i.gradient?.enabled === !0, o = i.glow?.enabled ? i.glow.intensity ?? 0.9 : 0, r = i.flow?.enabled === !0, l = i.pulse?.enabled === !0, c = i.scan?.enabled === !0, d = i.flow?.direction === "backward" ? -1 : 1, u = new
|
|
16375
|
+
const t = e.style ?? {}, i = e.effect ?? {}, n = this.getGradientStops(e.color, i.gradient?.stops), s = i.gradient?.enabled === !0, o = i.glow?.enabled ? i.glow.intensity ?? 0.9 : 0, r = i.flow?.enabled === !0, l = i.pulse?.enabled === !0, c = i.scan?.enabled === !0, d = i.flow?.direction === "backward" ? -1 : 1, u = new Ys({
|
|
16352
16376
|
transparent: !0,
|
|
16353
16377
|
side: oe,
|
|
16354
16378
|
depthTest: t.alwaysOnTop ? !1 : t.depthTest !== !1,
|
|
@@ -16533,7 +16557,7 @@ const dt = {
|
|
|
16533
16557
|
showBottom: !1,
|
|
16534
16558
|
edgeColor: "#d9ffff"
|
|
16535
16559
|
}
|
|
16536
|
-
},
|
|
16560
|
+
}, Ul = {
|
|
16537
16561
|
background: "rgba(10, 18, 28, 0.92)",
|
|
16538
16562
|
color: "#ffffff",
|
|
16539
16563
|
border: "1px solid rgba(127, 252, 255, 0.72)",
|
|
@@ -16542,8 +16566,8 @@ const dt = {
|
|
|
16542
16566
|
boxShadow: "0 10px 30px rgba(0, 0, 0, 0.32)",
|
|
16543
16567
|
minWidth: "120px",
|
|
16544
16568
|
pointerEvents: "auto"
|
|
16545
|
-
},
|
|
16546
|
-
class
|
|
16569
|
+
}, Gl = "bim-engine-annotation3d-panels";
|
|
16570
|
+
class Wl {
|
|
16547
16571
|
/** 新增或恢复数据前先做标准化,保证后续模块只处理完整结构。 */
|
|
16548
16572
|
normalizeData(e) {
|
|
16549
16573
|
return {
|
|
@@ -16688,7 +16712,7 @@ class Ul {
|
|
|
16688
16712
|
screenOffset: { ...e.screenOffset ?? {} },
|
|
16689
16713
|
className: e.className,
|
|
16690
16714
|
style: {
|
|
16691
|
-
...
|
|
16715
|
+
...Ul,
|
|
16692
16716
|
...e.style ?? {}
|
|
16693
16717
|
},
|
|
16694
16718
|
interactive: e.interactive ?? !0,
|
|
@@ -16697,7 +16721,7 @@ class Ul {
|
|
|
16697
16721
|
};
|
|
16698
16722
|
}
|
|
16699
16723
|
}
|
|
16700
|
-
function
|
|
16724
|
+
function Kl(a, e, t) {
|
|
16701
16725
|
const i = a.camera;
|
|
16702
16726
|
if (!i)
|
|
16703
16727
|
return !1;
|
|
@@ -16710,9 +16734,9 @@ function Gl(a, e, t) {
|
|
|
16710
16734
|
const r = o.sort((l, c) => l.distance - c.distance)[0];
|
|
16711
16735
|
return !!(r && r.distance < s - 0.05);
|
|
16712
16736
|
}
|
|
16713
|
-
class
|
|
16737
|
+
class ql {
|
|
16714
16738
|
constructor(e, t) {
|
|
16715
|
-
this.engine = e, this.isAnchorOccluded = t, this.container = document.createElement("div"), this.container.className =
|
|
16739
|
+
this.engine = e, this.isAnchorOccluded = t, this.container = document.createElement("div"), this.container.className = Gl, this.container.style.cssText = [
|
|
16716
16740
|
"position:absolute",
|
|
16717
16741
|
"left:0",
|
|
16718
16742
|
"top:0",
|
|
@@ -16740,7 +16764,7 @@ class Wl {
|
|
|
16740
16764
|
"display:none",
|
|
16741
16765
|
t.interactive === !1 ? "pointer-events:none" : "pointer-events:auto"
|
|
16742
16766
|
].join(";"), t.mode === "html" ? i.innerHTML = t.html ?? "" : i.textContent = t.text ?? "", Object.entries(t.style ?? {}).forEach(([n, s]) => {
|
|
16743
|
-
i.style.setProperty(
|
|
16767
|
+
i.style.setProperty(Ol(n), s);
|
|
16744
16768
|
}), i;
|
|
16745
16769
|
}
|
|
16746
16770
|
/** 根据标记状态刷新面板位置、遮挡逻辑和显示方式。 */
|
|
@@ -16775,7 +16799,7 @@ class Wl {
|
|
|
16775
16799
|
}
|
|
16776
16800
|
/** 不同几何类型的面板锚点算法不同,这里统一做收口。 */
|
|
16777
16801
|
getPanelAnchorPoint(e) {
|
|
16778
|
-
const t = e.instance.panel?.anchor ??
|
|
16802
|
+
const t = e.instance.panel?.anchor ?? Fl(e.instance.type), i = e.instance.panel?.offset ?? {};
|
|
16779
16803
|
let n = new h();
|
|
16780
16804
|
if (e.instance.type === "point")
|
|
16781
16805
|
n.copy(Ae(e.instance.points[0])), t === "top" && (n.y += e.volumeHeight ?? e.instance.style.point?.anchorY ?? 0);
|
|
@@ -16792,7 +16816,7 @@ class Wl {
|
|
|
16792
16816
|
return n.add(new h(i.x ?? 0, i.y ?? 0, i.z ?? 0)), n;
|
|
16793
16817
|
}
|
|
16794
16818
|
}
|
|
16795
|
-
class
|
|
16819
|
+
class jl {
|
|
16796
16820
|
engine;
|
|
16797
16821
|
rootGroup;
|
|
16798
16822
|
records;
|
|
@@ -16907,11 +16931,11 @@ class Kl {
|
|
|
16907
16931
|
};
|
|
16908
16932
|
}
|
|
16909
16933
|
}
|
|
16910
|
-
function
|
|
16934
|
+
function Yl(a) {
|
|
16911
16935
|
const { actions: e, ...t } = a;
|
|
16912
16936
|
return t;
|
|
16913
16937
|
}
|
|
16914
|
-
function
|
|
16938
|
+
function Xl(a) {
|
|
16915
16939
|
return {
|
|
16916
16940
|
id: a.instance.id,
|
|
16917
16941
|
type: a.instance.type,
|
|
@@ -16927,13 +16951,13 @@ function jl(a) {
|
|
|
16927
16951
|
function Dt(a) {
|
|
16928
16952
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
16929
16953
|
}
|
|
16930
|
-
class
|
|
16954
|
+
class Ql {
|
|
16931
16955
|
engine;
|
|
16932
16956
|
rootGroup;
|
|
16933
16957
|
records = /* @__PURE__ */ new Map();
|
|
16934
16958
|
textureLoader = new We();
|
|
16935
16959
|
occlusionRaycaster = new me();
|
|
16936
|
-
normalizer = new
|
|
16960
|
+
normalizer = new Wl();
|
|
16937
16961
|
materialFactory;
|
|
16938
16962
|
geometryBuilder;
|
|
16939
16963
|
effectsController;
|
|
@@ -16942,10 +16966,10 @@ class Yl {
|
|
|
16942
16966
|
currentTime = 0;
|
|
16943
16967
|
/** 初始化标记根节点、DOM 面板层以及交互控制器。 */
|
|
16944
16968
|
constructor(e) {
|
|
16945
|
-
this.engine = e, this.rootGroup = new fe(), this.rootGroup.name = "Annotation3dRoot", this.engine.scene.add(this.rootGroup), this.materialFactory = new
|
|
16969
|
+
this.engine = e, this.rootGroup = new fe(), this.rootGroup.name = "Annotation3dRoot", this.engine.scene.add(this.rootGroup), this.materialFactory = new Vl(this.engine), this.geometryBuilder = new Hl(this.engine, this.textureLoader, this.materialFactory), this.effectsController = new Nl(this.engine), this.panelLayer = new ql(
|
|
16946
16970
|
this.engine,
|
|
16947
|
-
(t) =>
|
|
16948
|
-
), this.interaction = new
|
|
16971
|
+
(t) => Kl(this.engine, this.occlusionRaycaster, t)
|
|
16972
|
+
), this.interaction = new jl({
|
|
16949
16973
|
engine: this.engine,
|
|
16950
16974
|
rootGroup: this.rootGroup,
|
|
16951
16975
|
records: this.records,
|
|
@@ -17044,7 +17068,7 @@ class Yl {
|
|
|
17044
17068
|
}
|
|
17045
17069
|
/** 导出纯数据快照,供保存和恢复。 */
|
|
17046
17070
|
getData() {
|
|
17047
|
-
return Array.from(this.records.values()).map((e) =>
|
|
17071
|
+
return Array.from(this.records.values()).map((e) => Xl(e));
|
|
17048
17072
|
}
|
|
17049
17073
|
/** 从纯数据快照恢复整套标记。 */
|
|
17050
17074
|
restoreData(e) {
|
|
@@ -17072,7 +17096,7 @@ class Yl {
|
|
|
17072
17096
|
selectable: e.selectable ?? !0,
|
|
17073
17097
|
style: e.style,
|
|
17074
17098
|
effect: e.effect ?? {},
|
|
17075
|
-
panel: e.panel ?
|
|
17099
|
+
panel: e.panel ? Yl(e.panel) : void 0,
|
|
17076
17100
|
data: e.data,
|
|
17077
17101
|
panelVisible: e.panel?.trigger === "always",
|
|
17078
17102
|
hovered: !1,
|
|
@@ -17087,7 +17111,7 @@ class Yl {
|
|
|
17087
17111
|
baseRingMeshes: [],
|
|
17088
17112
|
animatedMaterials: []
|
|
17089
17113
|
};
|
|
17090
|
-
return this.geometryBuilder.build(n),
|
|
17114
|
+
return this.geometryBuilder.build(n), zl(t, i.id), n;
|
|
17091
17115
|
}
|
|
17092
17116
|
/** 新记录统一走同一挂载流程,减少 add / update 重复代码。 */
|
|
17093
17117
|
attachRecord(e) {
|
|
@@ -17096,7 +17120,7 @@ class Yl {
|
|
|
17096
17120
|
/** 内部删除会负责资源回收和 hover 状态清理。 */
|
|
17097
17121
|
removeInternal(e, t) {
|
|
17098
17122
|
const i = this.records.get(e);
|
|
17099
|
-
return i ? (this.interaction.handleRecordRemoved(e),
|
|
17123
|
+
return i ? (this.interaction.handleRecordRemoved(e), Rl(i.instance.root), i.instance.root.removeFromParent(), i.panelElement?.remove(), this.records.delete(e), t && this.emit("annotation3d-removed", { id: e }), !0) : !1;
|
|
17100
17124
|
}
|
|
17101
17125
|
/** 标记显隐变化时,同时同步渲染顺序和面板显示。 */
|
|
17102
17126
|
applyVisibility(e) {
|
|
@@ -17351,7 +17375,7 @@ class it {
|
|
|
17351
17375
|
createChangeEvent(e, t, i, n) {
|
|
17352
17376
|
const s = new h(), o = new Ie(), r = new h();
|
|
17353
17377
|
t.decompose(s, o, r);
|
|
17354
|
-
const l = new
|
|
17378
|
+
const l = new Xt().setFromQuaternion(o, "XYZ"), c = [
|
|
17355
17379
|
O.radToDeg(l.x),
|
|
17356
17380
|
O.radToDeg(l.y),
|
|
17357
17381
|
O.radToDeg(l.z)
|
|
@@ -17443,10 +17467,10 @@ class it {
|
|
|
17443
17467
|
return "x" in e ? new h(e.x, e.y, e.z) : new h(e.X, e.Y, e.Z);
|
|
17444
17468
|
}
|
|
17445
17469
|
}
|
|
17446
|
-
const
|
|
17447
|
-
class
|
|
17470
|
+
const $l = 1e-3, Zl = 0.65, Jl = 1;
|
|
17471
|
+
class ec {
|
|
17448
17472
|
engine;
|
|
17449
|
-
loader = new
|
|
17473
|
+
loader = new Ai();
|
|
17450
17474
|
modelList = /* @__PURE__ */ new Map();
|
|
17451
17475
|
modelTransforms = [];
|
|
17452
17476
|
transformControl = null;
|
|
@@ -17653,7 +17677,7 @@ class Zl {
|
|
|
17653
17677
|
}
|
|
17654
17678
|
/** 透视相机使用更小的屏幕尺寸系数,正交相机维持原有尺寸。 */
|
|
17655
17679
|
syncTransformControlCamera() {
|
|
17656
|
-
!this.transformControl || !this.engine.camera || (this.transformControl.camera = this.engine.camera, this.transformControl.size = this.engine.camera.isPerspectiveCamera ?
|
|
17680
|
+
!this.transformControl || !this.engine.camera || (this.transformControl.camera = this.engine.camera, this.transformControl.size = this.engine.camera.isPerspectiveCamera ? Zl : Jl);
|
|
17657
17681
|
}
|
|
17658
17682
|
/** 使用引擎统一的捕捉器等待用户单击,并在取消或完成后恢复常规交互。 */
|
|
17659
17683
|
pickPlacementPoint(e, t) {
|
|
@@ -17692,7 +17716,7 @@ class Zl {
|
|
|
17692
17716
|
const i = t.clone(), n = e?.normal ?? e?.face?.normal;
|
|
17693
17717
|
if (n == null) return { position: i, normal: null };
|
|
17694
17718
|
const s = n.clone(), o = e?.matrix ?? e?.object?.matrixWorld;
|
|
17695
|
-
return o && s.transformDirection(o), s.lengthSq() < 1e-10 ? { position: i, normal: null } : (s.normalize(), i.addScaledVector(s,
|
|
17719
|
+
return o && s.transformDirection(o), s.lengthSq() < 1e-10 ? { position: i, normal: null } : (s.normalize(), i.addScaledVector(s, $l), { position: i, normal: s });
|
|
17696
17720
|
}
|
|
17697
17721
|
handlePointerDown(e) {
|
|
17698
17722
|
if (!(!this.editingEnabled || !this.engine.camera || !this.engine.renderer)) {
|
|
@@ -17840,8 +17864,8 @@ class Zl {
|
|
|
17840
17864
|
this.engine.requestComposerRender?.();
|
|
17841
17865
|
}
|
|
17842
17866
|
}
|
|
17843
|
-
const
|
|
17844
|
-
class
|
|
17867
|
+
const Cn = "__modelExplodeProxy", An = new H().makeScale(0, 0, 0);
|
|
17868
|
+
class tc {
|
|
17845
17869
|
engine;
|
|
17846
17870
|
/** 当前是否处于炸开模式;供外部滑块、交互模块判断是否需要走代理逻辑。 */
|
|
17847
17871
|
active = !1;
|
|
@@ -17970,7 +17994,7 @@ class Jl {
|
|
|
17970
17994
|
* 从命中的代理对象还原真实构件 ID,避免 Object3D.name 字符串化造成 nodesMap 查询失败。
|
|
17971
17995
|
*/
|
|
17972
17996
|
getObjectComponentId(e) {
|
|
17973
|
-
return e?.userData?.[
|
|
17997
|
+
return e?.userData?.[Cn] === !0 ? e.userData.componentId : null;
|
|
17974
17998
|
}
|
|
17975
17999
|
/**
|
|
17976
18000
|
* 返回炸开后用于悬浮高亮的代理网格。
|
|
@@ -18124,7 +18148,7 @@ class Jl {
|
|
|
18124
18148
|
}
|
|
18125
18149
|
/** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
|
|
18126
18150
|
assignProxyIdentity(e, t, i) {
|
|
18127
|
-
e.url = t, e.name = String(i), e.userData[
|
|
18151
|
+
e.url = t, e.name = String(i), e.userData[Cn] = !0, e.userData.componentId = i, e.userData.url = t;
|
|
18128
18152
|
}
|
|
18129
18153
|
/**
|
|
18130
18154
|
* 隐藏源渲染片段,避免与代理对象重复显示。
|
|
@@ -18132,7 +18156,7 @@ class Jl {
|
|
|
18132
18156
|
*/
|
|
18133
18157
|
hideSource(e) {
|
|
18134
18158
|
if (e.kind === "instance") {
|
|
18135
|
-
e.sourceMesh.setMatrixAt(e.subIndex,
|
|
18159
|
+
e.sourceMesh.setMatrixAt(e.subIndex, An), e.sourceMesh.instanceMatrix.needsUpdate = !0;
|
|
18136
18160
|
return;
|
|
18137
18161
|
}
|
|
18138
18162
|
this.ensureSplitState(e);
|
|
@@ -18152,7 +18176,7 @@ class Jl {
|
|
|
18152
18176
|
*/
|
|
18153
18177
|
restoreSource(e) {
|
|
18154
18178
|
if (e.kind === "instance") {
|
|
18155
|
-
const s = this.shouldKeepOriginalInstanceHidden(e) ?
|
|
18179
|
+
const s = this.shouldKeepOriginalInstanceHidden(e) ? An : e.originalMatrix;
|
|
18156
18180
|
s instanceof H && (e.sourceMesh.setMatrixAt(e.subIndex, s), e.sourceMesh.instanceMatrix.needsUpdate = !0);
|
|
18157
18181
|
return;
|
|
18158
18182
|
}
|
|
@@ -18356,7 +18380,7 @@ class Jl {
|
|
|
18356
18380
|
return Math.abs(i);
|
|
18357
18381
|
}
|
|
18358
18382
|
}
|
|
18359
|
-
class
|
|
18383
|
+
class ic {
|
|
18360
18384
|
// 引擎参数
|
|
18361
18385
|
options;
|
|
18362
18386
|
deviceType;
|
|
@@ -18467,22 +18491,22 @@ class ec {
|
|
|
18467
18491
|
// 业务数据
|
|
18468
18492
|
models = [];
|
|
18469
18493
|
reactBoundingClientRect = { left: 0, top: 0 };
|
|
18470
|
-
version =
|
|
18494
|
+
version = Js;
|
|
18471
18495
|
versionEl = null;
|
|
18472
18496
|
// 引擎容器
|
|
18473
18497
|
container;
|
|
18474
18498
|
constructor(e) {
|
|
18475
|
-
if (window.THREE =
|
|
18499
|
+
if (window.THREE = Sn, No(), this.options = e, this.container = document.getElementById(e.containerId), !this.container)
|
|
18476
18500
|
throw new Error(`Container ${e.containerId} not found`);
|
|
18477
|
-
if (this.engineModelModule = new
|
|
18501
|
+
if (this.engineModelModule = new ha(this), this.engineModelModule.init(), this.deviceModule = new xo(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new re(this), this.sceneModule = new wo(this), this.scene = this.sceneModule.scene, this.renderModule = new bo(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.orthographicCamera, this.scene.camera = this.camera, this.renderer) {
|
|
18478
18502
|
const o = this.renderer;
|
|
18479
18503
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
18480
18504
|
}
|
|
18481
|
-
this.controlModule = new
|
|
18505
|
+
this.controlModule = new Do(this), this.controlModule.switchDefaultMode(), this.controls = this.controlModule.orbitControls, this.clipping = new $a(this), this.clipping.init(), this.composerModule = new ko(this), this.composerModule.init(), this.events = new Fr();
|
|
18482
18506
|
const t = this.events.trigger.bind(this.events);
|
|
18483
18507
|
this.events.trigger = ((o, r) => {
|
|
18484
18508
|
t(o, r), String(o) !== String(se.EngineBusy) && this.requestComposerRender();
|
|
18485
|
-
}), this.engineStatus = new
|
|
18509
|
+
}), this.engineStatus = new Or(this), this.engineStatus.init(), this.loaderModule = new _e(this), this.lightModule = new sa(this), this.lightModule.init(), this.viewCube = new ma(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = ga(this), this.rangeScale = new fa(this), this.rangeScale.init(), this.setting = new Oa(this), this.engineModelModule.init(), this.handelBehaved = Li(this), this.modelMapperBatch = new sl(this), this.measure = new qa(this), this.modelToolModule = new ra(this), this.modelLink3d = new Ll(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new el(this), this.search = new nl(this), this.interactionModule = new oa(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new Yt(this), this.modelEdge = new za(this), this.modelTree = new Za(this), this.viewTree = new ul(this), this.merge2d = new pl(this), this.engineInfo = new Ja(this), this.pathRoaming = new ol(this), this.pathRoaming.init(), this.oneClickEncoding = new dl(this), this.minMap = new rl(this), this.linkElement2d3d = new cl(this), this.linkView2d3d = new hl(this), this.grid = new va(this), this.level = new Sa(this), this.issueReport = new al(this), this.fabricDraw = new _l(this), this.drawingPin = new Il(this), this.label = new kl(this), this.annotation3d = new Ql(this), this.calibration = new it(this), this.modelPlace = new ec(this), this.modelComparison = new lo(this), this.modelExplode = new tc(this), this.materialTool = new vo(this, this.options.materialEditorOptions ?? {}), this.materialTool.init(), this.text = new ll(this), this.hdr = new ba(this), this.ground = new ki(this), this.ground.init(), this.skyManager = new Ra(this), this.setting.init(), this.worldToScreen = new he(this.camera, this.renderer, this.scene), this.options.showStats && (this.stats = new ro(), this.stats.showPanel(0), this.stats.dom.style.position = "absolute", this.stats.dom.style.top = "0px", this.stats.dom.style.left = "0px", this.stats.dom.style.zIndex = "1000", this.container.appendChild(this.stats.dom));
|
|
18486
18510
|
let i = document.createElement("div");
|
|
18487
18511
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
18488
18512
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -18585,7 +18609,7 @@ class ec {
|
|
|
18585
18609
|
* 通过 viewToken 解析 3D 模型地址,再复用现有 loaderModule URL 加载逻辑。
|
|
18586
18610
|
*/
|
|
18587
18611
|
async loadModelByViewToken(e, t) {
|
|
18588
|
-
const i = await
|
|
18612
|
+
const i = await eo(
|
|
18589
18613
|
this.options,
|
|
18590
18614
|
e,
|
|
18591
18615
|
"3d"
|
|
@@ -18762,7 +18786,7 @@ class ec {
|
|
|
18762
18786
|
if (!e) return;
|
|
18763
18787
|
[...e.children].forEach((i) => {
|
|
18764
18788
|
this.clearScene(i);
|
|
18765
|
-
}), e.parent && e.parent.remove(e), e instanceof F && !(e instanceof W) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof xt && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof
|
|
18789
|
+
}), e.parent && e.parent.remove(e), e instanceof F && !(e instanceof W) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof xt && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof Xs && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof W && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material)), e.instanceMatrix && (e.instanceMatrix = null), e.instanceColor && (e.instanceColor = null)), e instanceof Ft && e.material && this.disposeMaterial(e.material), e instanceof Qs && e.shadow?.dispose?.();
|
|
18766
18790
|
}
|
|
18767
18791
|
/**
|
|
18768
18792
|
* 清理材质及其纹理
|
|
@@ -18781,7 +18805,7 @@ class ec {
|
|
|
18781
18805
|
}), e.background = null, e.environment = null, e.overrideMaterial = null, e.dirLight = null, e.camera = null;
|
|
18782
18806
|
}
|
|
18783
18807
|
disposeSceneAttachment(e) {
|
|
18784
|
-
e && (e instanceof
|
|
18808
|
+
e && (e instanceof ci || e instanceof Ge) && e.dispose?.();
|
|
18785
18809
|
}
|
|
18786
18810
|
disposeMaterial(e) {
|
|
18787
18811
|
if (!e) return;
|
|
@@ -18816,14 +18840,14 @@ class ec {
|
|
|
18816
18840
|
}), e.dispose();
|
|
18817
18841
|
}
|
|
18818
18842
|
}
|
|
18819
|
-
const
|
|
18843
|
+
const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
18820
18844
|
__proto__: null,
|
|
18821
|
-
EngineKernelV2:
|
|
18845
|
+
EngineKernelV2: ic
|
|
18822
18846
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
18823
18847
|
export {
|
|
18824
18848
|
se as E,
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18849
|
+
lo as M,
|
|
18850
|
+
Jt as a,
|
|
18851
|
+
vo as b,
|
|
18852
|
+
lc as c
|
|
18829
18853
|
};
|