iflow-engine-base-3d 3.12.17 → 3.12.19
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/README.md +5 -1
- package/dist/bim-engine-sdk.es.js +3 -3
- package/dist/bim-engine-sdk.umd.js +83 -83
- package/dist/chunks/{engine-3d-BQ3j3IyB.js → engine-3d-CvtTt8DD.js} +682 -601
- package/dist/chunks/{sdk-assets-8pIGrzeP.js → sdk-assets-DAIj-7Ou.js} +1 -1
- package/dist/chunks/{sdk-runtime-CVZ-H4BF.js → sdk-runtime-BI05CCEt.js} +2 -2
- package/dist/chunks/{three-vendor-CD0MJoK-.js → three-vendor-ClQTDDlA.js} +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Pi, G as de, P as
|
|
2
|
-
import { W as me, C as mo, L as ft, B as Yi, g as
|
|
3
|
-
import { r as ee, g as Mo } from "./sdk-assets-
|
|
1
|
+
import { S as Pi, G as de, P as qt, O as _e, M as F, V as d, e as $e, T as Bn, C as Ss, W as Ti, a as Ps, b as je, N as Ii, c as Ts, d as ot, f as G, Q as Se, E as zn, R as fe, g as Ze, h as _i, B as R, i as Di, A as Rn, j as V, k as z, I as W, l as ii, m as ni, n as On, o as Fn, L as Kt, p as Is, q as _s, r as Ds, s as Gi, D as re, t as qi, u as ks, F as Ls, v as Me, w as Nn, x as Hn, y as ki, z as Bs, H as Vn, J as ge, K as zs, U as bt, X as Rs, Y as Os, Z as Un, _ as Fs, $ as qe, a0 as jt, a1 as Li, a2 as Z, a3 as oe, a4 as Ct, a5 as Ns, a6 as Je, a7 as fi, a8 as He, a9 as It, aa as Hs, ab as Vs, ac as yi, ad as ht, ae as Us, af as ct, ag as Ws, ah as Gs, ai as Wn, aj as Yt, ak as At, al as Xt, am as qs, an as Ki, ao as dt, ap as Et, aq as St, ar as Ks, as as js, at as ji, au as Ys, av as Xs, aw as Qs, ax as $s, ay as Zs, az as Js, aA as eo, aB as to, aC as io, aD as Gn, aE as no, aF as so, aG as oo, aH as Mi, aI as Ye, aJ as ro, aK as ao, aL as lo, aM as co, aN as ho, aO as uo, aP as po } from "./three-vendor-ClQTDDlA.js";
|
|
2
|
+
import { W as me, C as mo, L as ft, B as Yi, g as Be, a as go, E as fo, r as yo } from "./sdk-runtime-BI05CCEt.js";
|
|
3
|
+
import { r as ee, g as Mo } from "./sdk-assets-DAIj-7Ou.js";
|
|
4
4
|
import { a as Qt, J as vi, c as vo, b as xo, P as si, q as wo, k as bo, n as Xi, E as Qi, S as Co } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
5
|
class Ao {
|
|
6
6
|
engine;
|
|
@@ -21,7 +21,7 @@ class se {
|
|
|
21
21
|
orthographicCamera;
|
|
22
22
|
cameraAnimationFrame = null;
|
|
23
23
|
constructor(e) {
|
|
24
|
-
this.engine = e, this.perspectiveCamera = new
|
|
24
|
+
this.engine = e, this.perspectiveCamera = new qt(
|
|
25
25
|
60,
|
|
26
26
|
this.engine.container.clientWidth / this.engine.container.clientHeight,
|
|
27
27
|
0.1,
|
|
@@ -190,7 +190,7 @@ class se {
|
|
|
190
190
|
const e = this.engine.camera;
|
|
191
191
|
if (!e)
|
|
192
192
|
return;
|
|
193
|
-
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.orthographicCamera, r = this.getViewDirection(t, i, n), a = e instanceof
|
|
193
|
+
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.orthographicCamera, r = this.getViewDirection(t, i, n), a = e instanceof qt ? this.getPerspectiveVisibleHeight(e, i) : this.getOrthographicVisibleHeight(e), c = F.degToRad(e.getEffectiveFOV() * 0.5), h = Math.max(
|
|
194
194
|
a / (2 * Math.tan(c)),
|
|
195
195
|
se.MIN_CAMERA_DISTANCE
|
|
196
196
|
);
|
|
@@ -341,7 +341,7 @@ class se {
|
|
|
341
341
|
a(), h.start(), u();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
class
|
|
344
|
+
class Eo {
|
|
345
345
|
engine;
|
|
346
346
|
deviceType;
|
|
347
347
|
constructor(e) {
|
|
@@ -406,7 +406,7 @@ class So {
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
const Bi = 1.1;
|
|
409
|
-
class
|
|
409
|
+
class So {
|
|
410
410
|
engine;
|
|
411
411
|
renderer;
|
|
412
412
|
watermark;
|
|
@@ -415,7 +415,7 @@ class Eo {
|
|
|
415
415
|
}
|
|
416
416
|
createRenderer() {
|
|
417
417
|
const { width: e, height: t } = this.engine.deviceModule.getContainerSize();
|
|
418
|
-
return
|
|
418
|
+
return Ss.enabled = !0, this.renderer = new Ti({
|
|
419
419
|
// 原生 MSAA 主要覆盖非后处理路径;后处理链路的边缘由 composer 的 samples 和 FXAA 继续处理。
|
|
420
420
|
antialias: this.engine.options.antialias ?? !0,
|
|
421
421
|
alpha: !0,
|
|
@@ -442,7 +442,7 @@ const Po = { type: "change" }, $i = { type: "start" }, Zi = { type: "end" }, X =
|
|
|
442
442
|
DOLLY: 2,
|
|
443
443
|
TOUCH_ROTATE: 3,
|
|
444
444
|
TOUCH_DOLLY_PAN: 4
|
|
445
|
-
}, ri = new d(1, 0, 0), To = new d(0, 1, 0), Io = new d(0, 0, 1),
|
|
445
|
+
}, ri = new d(1, 0, 0), To = new d(0, 1, 0), Io = new d(0, 0, 1), rt = new d(), Lt = new d(), Ce = new d(), Y = new d(), Pe = new d(), pe = new d(), Te = new d(), _o = new d(), Bt = new Se(), ai = new Se(), Ji = /* @__PURE__ */ new Set([
|
|
446
446
|
"KeyW",
|
|
447
447
|
"KeyA",
|
|
448
448
|
"KeyS",
|
|
@@ -456,7 +456,7 @@ const Po = { type: "change" }, $i = { type: "start" }, Zi = { type: "end" }, X =
|
|
|
456
456
|
"ShiftLeft",
|
|
457
457
|
"ShiftRight"
|
|
458
458
|
]);
|
|
459
|
-
function
|
|
459
|
+
function zt(l, e, t) {
|
|
460
460
|
return Math.max(e, Math.min(t, l));
|
|
461
461
|
}
|
|
462
462
|
function en(l) {
|
|
@@ -480,9 +480,9 @@ class qn extends Ts {
|
|
|
480
480
|
RIGHT: "ArrowRight",
|
|
481
481
|
BOTTOM: "ArrowDown"
|
|
482
482
|
}, this.mouseButtons = {
|
|
483
|
-
LEFT:
|
|
484
|
-
MIDDLE:
|
|
485
|
-
RIGHT:
|
|
483
|
+
LEFT: ot.ROTATE,
|
|
484
|
+
MIDDLE: ot.DOLLY,
|
|
485
|
+
RIGHT: ot.PAN
|
|
486
486
|
}, this.state = he.NONE, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.up0 = this.object.up.clone(), this.origin0 = this.origin.clone(), this._lastZoom = this.object.zoom, this._lastPosition = this.object.position.clone(), this._lastTarget = this.target.clone(), this._lastUp = this.object.up.clone(), this._lastQuaternion = this.object.quaternion.clone(), this._referenceUp = this.object.up.clone().normalize(), this._viewRight = new d(1, 0, 0).applyQuaternion(this.object.quaternion).normalize(), this._rotateVelocity = new G(), this._panVelocity = new G(), this._zoomVelocity = 0, this._mouseStart = new G(), this._touchCenter = new G(), this._touchDistance = 0, this._pointers = /* @__PURE__ */ new Map(), this._pressedKeys = /* @__PURE__ */ new Set(), this._keyboardAnimationId = null, this._lastKeyboardMoveTime = 0, this._isInteracting = !1, this._keyDomElement = null, this._touchAction = "", this._onContextMenu = this._handleContextMenu.bind(this), this._onPointerDown = this._handlePointerDown.bind(this), this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerUp = this._handlePointerUp.bind(this), this._onPointerCancel = this._handlePointerUp.bind(this), this._onWheel = this._handleWheel.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._onKeyUp = this._handleKeyUp.bind(this), this.domElement && this.connect(this.domElement), this.update(), this.saveState();
|
|
487
487
|
}
|
|
488
488
|
connect(e) {
|
|
@@ -561,7 +561,7 @@ class qn extends Ts {
|
|
|
561
561
|
const n = e.clone();
|
|
562
562
|
return e.set(0, 0), n;
|
|
563
563
|
}
|
|
564
|
-
const t =
|
|
564
|
+
const t = zt(this.dampingFactor, 0, 1), i = e.clone().multiplyScalar(t);
|
|
565
565
|
return e.sub(i), e.lengthSq() < X && e.set(0, 0), i;
|
|
566
566
|
}
|
|
567
567
|
_consumeNumber(e) {
|
|
@@ -569,12 +569,12 @@ class qn extends Ts {
|
|
|
569
569
|
const n = this[e];
|
|
570
570
|
return this[e] = 0, n;
|
|
571
571
|
}
|
|
572
|
-
const t =
|
|
572
|
+
const t = zt(this.dampingFactor, 0, 1), i = this[e] * t;
|
|
573
573
|
return this[e] -= i, Math.abs(this[e]) < X && (this[e] = 0), i;
|
|
574
574
|
}
|
|
575
575
|
_applyRotation(e, t) {
|
|
576
576
|
const i = this._getRotatePivot(), n = this.object.position;
|
|
577
|
-
|
|
577
|
+
rt.copy(n).sub(i), rt.lengthSq() < X && rt.set(0, 0, Math.max(this.minDistance, 1)), Lt.copy(this.target).sub(i), pe.copy(this.target).sub(n).normalize(), Math.abs(e) > X && (Bt.setFromAxisAngle(this._referenceUp, -e), rt.applyQuaternion(Bt), Lt.applyQuaternion(Bt), pe.applyQuaternion(Bt).normalize()), Y.copy(this._getStableRightAxis(pe)), Math.abs(t) > X && Y.lengthSq() > X && (ai.setFromAxisAngle(Y, -t), rt.applyQuaternion(ai), Lt.applyQuaternion(ai)), n.copy(i).add(rt), this.target.copy(i).add(Lt);
|
|
578
578
|
}
|
|
579
579
|
_applyPan(e, t) {
|
|
580
580
|
const { width: i, height: n } = en(this.domElement);
|
|
@@ -594,11 +594,11 @@ class qn extends Ts {
|
|
|
594
594
|
const t = Math.pow(0.95, this.zoomSpeed * e);
|
|
595
595
|
if (this.object.isPerspectiveCamera) {
|
|
596
596
|
pe.copy(this.object.position).sub(this.target);
|
|
597
|
-
const i = Math.max(pe.length(), X), n =
|
|
597
|
+
const i = Math.max(pe.length(), X), n = zt(i / t, this.minDistance, this.maxDistance);
|
|
598
598
|
pe.setLength(n), this.object.position.copy(this.target).add(pe);
|
|
599
599
|
return;
|
|
600
600
|
}
|
|
601
|
-
this.object.isOrthographicCamera && (this.object.zoom =
|
|
601
|
+
this.object.isOrthographicCamera && (this.object.zoom = zt(this.object.zoom * t, this.minZoom, this.maxZoom), this.object.updateProjectionMatrix());
|
|
602
602
|
}
|
|
603
603
|
_alignCamera() {
|
|
604
604
|
pe.copy(this.target).sub(this.object.position), !(pe.lengthSq() < X) && (pe.normalize(), Y.copy(this._getStableRightAxis(pe)), Pe.crossVectors(Y, pe).normalize(), Pe.lengthSq() < X && Pe.copy(this._referenceUp), this._viewRight.copy(Y), this.object.up.copy(Pe), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
@@ -739,7 +739,7 @@ class qn extends Ts {
|
|
|
739
739
|
}
|
|
740
740
|
_resolveMouseAction(e) {
|
|
741
741
|
let t = null;
|
|
742
|
-
return e.button === 0 ? t = e.ctrlKey || e.metaKey || e.shiftKey ? this.mouseButtons.RIGHT : this.mouseButtons.LEFT : e.button === 1 ? t = this.mouseButtons.MIDDLE : e.button === 2 && (t = this.mouseButtons.RIGHT), t ===
|
|
742
|
+
return e.button === 0 ? t = e.ctrlKey || e.metaKey || e.shiftKey ? this.mouseButtons.RIGHT : this.mouseButtons.LEFT : e.button === 1 ? t = this.mouseButtons.MIDDLE : e.button === 2 && (t = this.mouseButtons.RIGHT), t === ot.ROTATE && this.enableRotate ? he.ROTATE : t === ot.PAN && this.enablePan ? he.PAN : t === ot.DOLLY && this.enableZoom ? he.DOLLY : null;
|
|
743
743
|
}
|
|
744
744
|
_queueRotate(e, t) {
|
|
745
745
|
if (!this.enableRotate || !this.domElement)
|
|
@@ -1178,7 +1178,7 @@ class sn extends zn {
|
|
|
1178
1178
|
setAvatarModel(e, t = {}) {
|
|
1179
1179
|
if (e) {
|
|
1180
1180
|
if (this.clearAvatarAnimation(), this.avatar && (this.avatarRoot.remove(this.avatar), this._ownsAvatarResources && this.disposeObjectResources(this.avatar)), this.avatar = e, this._ownsAvatarResources = t.ownsResources === !0, e.rotation.y += t.yawOffset ?? 0, t.alignToFeet !== !1) {
|
|
1181
|
-
const i = new
|
|
1181
|
+
const i = new R().setFromObject(e), n = i.max.y - i.min.y;
|
|
1182
1182
|
if (t.fitToPlayerHeight !== !1 && Number.isFinite(n) && n > 1e-6) {
|
|
1183
1183
|
const o = (t.targetHeight ?? this.playerHeight) / n;
|
|
1184
1184
|
e.scale.multiplyScalar(o), i.setFromObject(e);
|
|
@@ -1611,11 +1611,11 @@ function et(l, e) {
|
|
|
1611
1611
|
const s = l?.scene?.children?.find?.((o) => o instanceof de ? zi(o, e) ? !0 : o.name === e && o.url === e : !1);
|
|
1612
1612
|
return s != null ? (wi(s, e), t.set(e, s), n != null && (n.group = s), s) : null;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function ze(l, e) {
|
|
1615
1615
|
const t = et(l, e);
|
|
1616
1616
|
return t == null ? new V() : (t.updateWorldMatrix(!0, !1), t.matrixWorld.clone());
|
|
1617
1617
|
}
|
|
1618
|
-
function
|
|
1618
|
+
function it(l, e) {
|
|
1619
1619
|
const t = et(l, e);
|
|
1620
1620
|
if (t != null)
|
|
1621
1621
|
return t;
|
|
@@ -1635,7 +1635,7 @@ function Bo(l) {
|
|
|
1635
1635
|
!zi(n) || t.has(n.uuid) || (t.add(n.uuid), e.push(n));
|
|
1636
1636
|
}), e;
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function Pt(l, e) {
|
|
1639
1639
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
1640
1640
|
return Bo(l).forEach((s) => {
|
|
1641
1641
|
s.traverse((o) => {
|
|
@@ -1652,7 +1652,7 @@ function Et(l, e) {
|
|
|
1652
1652
|
}), t;
|
|
1653
1653
|
}
|
|
1654
1654
|
function Oi(l) {
|
|
1655
|
-
return
|
|
1655
|
+
return Pt(l, (e) => e instanceof z && !(e instanceof W));
|
|
1656
1656
|
}
|
|
1657
1657
|
function zo(l) {
|
|
1658
1658
|
if (typeof l.__modelObjectIndexSeed == "number")
|
|
@@ -1700,14 +1700,14 @@ function on(l, e) {
|
|
|
1700
1700
|
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? Kn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
1701
1701
|
});
|
|
1702
1702
|
}
|
|
1703
|
-
function
|
|
1703
|
+
function Le(l, e) {
|
|
1704
1704
|
if (!Number.isFinite(e))
|
|
1705
1705
|
return;
|
|
1706
1706
|
const t = Yn(l), i = t.get(e);
|
|
1707
1707
|
if (i && i.parent != null)
|
|
1708
1708
|
return i;
|
|
1709
1709
|
i && i.parent == null && t.delete(e);
|
|
1710
|
-
const n =
|
|
1710
|
+
const n = Pt(l, (s) => s.index === e)[0];
|
|
1711
1711
|
return n != null ? (t.set(e, n), n) : l?.scene?.children?.find?.((s) => s?.index === e);
|
|
1712
1712
|
}
|
|
1713
1713
|
class Fo {
|
|
@@ -1722,22 +1722,22 @@ class Fo {
|
|
|
1722
1722
|
const n = this.engine, s = e.object.url, o = e.object.name;
|
|
1723
1723
|
let r = n.modelEdge.getModelEdge(s, o);
|
|
1724
1724
|
r || (r = [0, 0, []]);
|
|
1725
|
-
const a =
|
|
1725
|
+
const a = ze(n, s), c = this.getModelSnapCache(s, o, r);
|
|
1726
1726
|
n.camera.updateMatrixWorld(!0);
|
|
1727
1727
|
const h = new V().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, p = n.renderer.domElement.clientHeight, g = new G(t.offsetX, t.offsetY), f = new ii(), x = new d(), w = new d(), m = new G(), b = new G(), C = new d();
|
|
1728
|
-
let
|
|
1728
|
+
let S = "face", P = null, I = null, B = 100;
|
|
1729
1729
|
if (i != null) {
|
|
1730
1730
|
const k = e.point.clone(), O = e.normal || (e.face ? e.face.normal : null);
|
|
1731
1731
|
if (O && e.object?.matrixWorld?.elements) {
|
|
1732
|
-
const q = O.clone().transformDirection(e.object.matrixWorld).normalize(), Q = new d().subVectors(i, k).dot(q), ce = i.clone().sub(q.clone().multiplyScalar(Q)),
|
|
1733
|
-
if (
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1732
|
+
const q = O.clone().transformDirection(e.object.matrixWorld).normalize(), Q = new d().subVectors(i, k).dot(q), ce = i.clone().sub(q.clone().multiplyScalar(Q)), ae = this.projectWorldPointToScreen(ce, h, u, p, m, f);
|
|
1733
|
+
if (ae != null) {
|
|
1734
|
+
const le = this.getDistanceSq(ae.x, ae.y, g.x, g.y);
|
|
1735
|
+
le < B * 4 && (B = le, P = {
|
|
1736
1736
|
point: ce,
|
|
1737
|
-
distanceSq:
|
|
1738
|
-
pointxy:
|
|
1737
|
+
distanceSq: le,
|
|
1738
|
+
pointxy: ae.clone(),
|
|
1739
1739
|
style: "vertical"
|
|
1740
|
-
},
|
|
1740
|
+
}, S = "point");
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
@@ -1770,7 +1770,7 @@ class Fo {
|
|
|
1770
1770
|
});
|
|
1771
1771
|
}
|
|
1772
1772
|
if (P != null)
|
|
1773
|
-
|
|
1773
|
+
S = "point";
|
|
1774
1774
|
else {
|
|
1775
1775
|
for (let k = 0; k < c.localLines.length; k += 6) {
|
|
1776
1776
|
x.set(c.localLines[k], c.localLines[k + 1], c.localLines[k + 2]).applyMatrix4(a), w.set(c.localLines[k + 3], c.localLines[k + 4], c.localLines[k + 5]).applyMatrix4(a);
|
|
@@ -1792,9 +1792,9 @@ class Fo {
|
|
|
1792
1792
|
}, B = Q;
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
I != null && (
|
|
1795
|
+
I != null && (S = "line");
|
|
1796
1796
|
}
|
|
1797
|
-
return
|
|
1797
|
+
return S === "point" && P != null ? (this.renderPointCandidate(P), e.point = P.point, e) : S === "line" && I != null ? (this.renderLineCandidate(I), e.point = I.point, e) : (this.renderFaceCandidate(e), e);
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
1800
1800
|
* 将模型边数据压平缓存,避免鼠标移动时反复拼装点、线和中点数组。
|
|
@@ -1956,9 +1956,9 @@ function Hi(l) {
|
|
|
1956
1956
|
e.mouseMoveFrame != null && (cancelAnimationFrame(e.mouseMoveFrame), e.mouseMoveFrame = null), e.latestMouseMoveEvent = null;
|
|
1957
1957
|
}
|
|
1958
1958
|
e.active = function() {
|
|
1959
|
-
l.renderer.domElement.addEventListener("mousedown", ce), l.renderer.domElement.addEventListener("mouseup",
|
|
1959
|
+
l.renderer.domElement.addEventListener("mousedown", ce), l.renderer.domElement.addEventListener("mouseup", le), l.renderer.domElement.addEventListener("mousemove", ae), l.renderer.domElement.addEventListener("touchstart", _, { capture: !0, passive: !1 }), l.renderer.domElement.addEventListener("touchend", T, { capture: !0, passive: !1 }), l.renderer.domElement.addEventListener("touchcancel", T, { capture: !0, passive: !1 }), l.renderer.domElement.addEventListener("touchmove", D, { capture: !0, passive: !1 }), l.renderer.domElement.addEventListener("pointerdown", N, !0), l.renderer.domElement.addEventListener("pointermove", H, !0), l.renderer.domElement.addEventListener("pointerup", K, !0), l.renderer.domElement.addEventListener("pointercancel", K, !0), window.addEventListener("keydown", c), window.addEventListener("keyup", h);
|
|
1960
1960
|
}, e.disActive = function() {
|
|
1961
|
-
m(), a(), O(), l.renderer.domElement.removeEventListener("mousedown", ce), l.renderer.domElement.removeEventListener("mouseup",
|
|
1961
|
+
m(), a(), O(), l.renderer.domElement.removeEventListener("mousedown", ce), l.renderer.domElement.removeEventListener("mouseup", le), l.renderer.domElement.removeEventListener("mousemove", ae), l.renderer.domElement.removeEventListener("touchstart", _, !0), l.renderer.domElement.removeEventListener("touchend", T, !0), l.renderer.domElement.removeEventListener("touchcancel", T, !0), l.renderer.domElement.removeEventListener("touchmove", D, !0), l.renderer.domElement.removeEventListener("pointerdown", N, !0), l.renderer.domElement.removeEventListener("pointermove", H, !0), l.renderer.domElement.removeEventListener("pointerup", K, !0), l.renderer.domElement.removeEventListener("pointercancel", K, !0), window.removeEventListener("keydown", c), window.removeEventListener("keyup", h);
|
|
1962
1962
|
};
|
|
1963
1963
|
function c(v) {
|
|
1964
1964
|
(v.keyCode === 8 || v.keyCode === 46) && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), v.keyCode === 27 && e.self && e.self.handelKeyEscDown != null && e.self.handelKeyEscDown(), v.keyCode === 13 && e.self && e.self.handelKeyEnterDown != null && e.self.handelKeyEnterDown(), v.keyCode === 32 && e.self && e.self.handelKeySpaceDown != null && e.self.handelKeySpaceDown(v), v.key === "Tab" && e.self && e.self.handelKeyTabDown != null && e.self.handelKeyTabDown(v), v.key === "Control" && e.self && e.self.handelKeyCtrlDown != null && e.self.handelKeyCtrlDown(), v.key === "Delete" && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), v.key === "Shift" && e.self && e.self.handelKeyShiftDown != null && e.self.handelKeyShiftDown(), v.key === "Meta" && e.self && e.self.handelKeyMetaDown != null && e.self.handelKeyMetaDown();
|
|
@@ -1988,7 +1988,7 @@ function Hi(l) {
|
|
|
1988
1988
|
e.touchLongPressTimer != null && (clearTimeout(e.touchLongPressTimer), e.touchLongPressTimer = null);
|
|
1989
1989
|
}
|
|
1990
1990
|
function m() {
|
|
1991
|
-
w(), k(),
|
|
1991
|
+
w(), k(), S(), e.touchLongPressActive = !1, e.touchLatestEvent = null, e.touchStartPosition = null, e.touchInputMode = null, e.touchPointerId = null;
|
|
1992
1992
|
}
|
|
1993
1993
|
function b(v) {
|
|
1994
1994
|
v?.preventDefault?.(), v?.stopPropagation?.(), v?.stopImmediatePropagation?.();
|
|
@@ -2000,7 +2000,7 @@ function Hi(l) {
|
|
|
2000
2000
|
enabled: v.enabled !== !1
|
|
2001
2001
|
}, v.enabled = !1);
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function S() {
|
|
2004
2004
|
const v = e.touchControlsSnapshot;
|
|
2005
2005
|
v && (v.controls && (P(v.controls), v.controls.enabled = v.enabled), e.touchControlsSnapshot = null);
|
|
2006
2006
|
}
|
|
@@ -2027,13 +2027,13 @@ function Hi(l) {
|
|
|
2027
2027
|
function q(v, A, L, U, j, we) {
|
|
2028
2028
|
const ve = l?.catchSvg;
|
|
2029
2029
|
if (!ve?.childElementCount) return;
|
|
2030
|
-
const De = l?.reactBoundingClientRect ?? A.getBoundingClientRect(),
|
|
2031
|
-
const [
|
|
2032
|
-
return Number.isFinite(
|
|
2030
|
+
const De = l?.reactBoundingClientRect ?? A.getBoundingClientRect(), nt = (be) => {
|
|
2031
|
+
const [Re, Oe] = be.split(",").map(Number);
|
|
2032
|
+
return Number.isFinite(Re) && Number.isFinite(Oe) ? [(Re - De.left - L) / j * n * we, (Oe - De.top - U) / j * n * we] : null;
|
|
2033
2033
|
};
|
|
2034
2034
|
Array.from(ve.children).forEach((be) => {
|
|
2035
|
-
const
|
|
2036
|
-
xe.length < 2 || (v.beginPath(), v.strokeStyle = be.getAttribute("stroke") || "rgb(8, 223, 215)", v.fillStyle = be.getAttribute("fill") || "transparent", v.lineWidth = Number(be.getAttribute("stroke-width") || 2) * we, v.moveTo(xe[0][0], xe[0][1]), xe.slice(1).forEach(([
|
|
2035
|
+
const Re = be.tagName.toLowerCase(), xe = (Re === "line" ? [`${be.getAttribute("x1")},${be.getAttribute("y1")}`, `${be.getAttribute("x2")},${be.getAttribute("y2")}`].map(nt) : (be.getAttribute("points") || "").trim().split(/\s+/).map(nt)).filter(Boolean);
|
|
2036
|
+
xe.length < 2 || (v.beginPath(), v.strokeStyle = be.getAttribute("stroke") || "rgb(8, 223, 215)", v.fillStyle = be.getAttribute("fill") || "transparent", v.lineWidth = Number(be.getAttribute("stroke-width") || 2) * we, v.moveTo(xe[0][0], xe[0][1]), xe.slice(1).forEach(([st, Fe]) => v.lineTo(st, Fe)), Re === "polygon" && (v.closePath(), ["none", "transparent"].includes(String(v.fillStyle)) || v.fill()), v.stroke());
|
|
2037
2037
|
});
|
|
2038
2038
|
}
|
|
2039
2039
|
function te(v) {
|
|
@@ -2045,18 +2045,18 @@ function Hi(l) {
|
|
|
2045
2045
|
k();
|
|
2046
2046
|
return;
|
|
2047
2047
|
}
|
|
2048
|
-
const De = L.width / n,
|
|
2048
|
+
const De = L.width / n, nt = Math.min(
|
|
2049
2049
|
window.innerWidth - n / 2 - 8,
|
|
2050
2050
|
Math.max(n / 2 + 8, v.clientX)
|
|
2051
2051
|
), be = Math.min(
|
|
2052
2052
|
window.innerHeight - n - 8,
|
|
2053
2053
|
Math.max(8, v.clientY - o)
|
|
2054
2054
|
);
|
|
2055
|
-
L.style.left = `${
|
|
2056
|
-
const
|
|
2055
|
+
L.style.left = `${nt - n / 2}px`, L.style.top = `${be}px`, L.style.display = "block";
|
|
2056
|
+
const Re = A.width / Math.max(1, A.clientWidth), Oe = A.height / Math.max(1, A.clientHeight), xe = s, st = Math.max(0, Math.min(A.clientWidth - xe, ve.x - xe / 2)), Fe = Math.max(0, Math.min(A.clientHeight - xe, ve.y - xe / 2));
|
|
2057
2057
|
U.save(), U.clearRect(0, 0, L.width, L.height), U.beginPath(), U.arc(L.width / 2, L.height / 2, L.width / 2, 0, Math.PI * 2), U.clip(), U.fillStyle = window.getComputedStyle(A.parentElement ?? document.body).backgroundColor || "#dfe8f2", U.fillRect(0, 0, L.width, L.height);
|
|
2058
2058
|
try {
|
|
2059
|
-
U.drawImage(A,
|
|
2059
|
+
U.drawImage(A, st * Re, Fe * Oe, xe * Re, xe * Oe, 0, 0, L.width, L.height), q(U, A, st, Fe, xe, De);
|
|
2060
2060
|
} catch {
|
|
2061
2061
|
k(), U.restore();
|
|
2062
2062
|
return;
|
|
@@ -2073,13 +2073,13 @@ function Hi(l) {
|
|
|
2073
2073
|
function ce(v) {
|
|
2074
2074
|
x(v) || (e.mouseDownTime = Date.now(), e.mouseDownPosition = new d(v.offsetX, v.offsetY, 0), e.self && e.self.handleMouseDown != null && v.button == 0 && (Q(v, !0, !0), v.catch != null && (l.engineStatus.highlightModels == null || l.engineStatus.highlightModels.length == 0) && (l.engineStatus?.suppressNextOrbitOriginPick === !0 ? l.engineStatus.suppressNextOrbitOriginPick = !1 : l.controlModule.orbitControls.origin.set(v.catch.point.x, v.catch.point.y, v.catch.point.z)), e.self.handleMouseDown(v)));
|
|
2075
2075
|
}
|
|
2076
|
-
function
|
|
2076
|
+
function ae(v) {
|
|
2077
2077
|
x(v) || e.self && e.self.handleMouseMove != null && (e.latestMouseMoveEvent = v, e.mouseMoveFrame == null && (e.mouseMoveFrame = requestAnimationFrame(() => {
|
|
2078
2078
|
const A = e.latestMouseMoveEvent;
|
|
2079
2079
|
e.latestMouseMoveEvent = null, e.mouseMoveFrame = null, A && (l.engineStatus.isFree && Q(A, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(A));
|
|
2080
2080
|
})));
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function le(v) {
|
|
2083
2083
|
if (x(v))
|
|
2084
2084
|
return;
|
|
2085
2085
|
const A = Date.now(), L = A - e.mouseDownTime, U = new d(v.offsetX, v.offsetY, 0);
|
|
@@ -2129,7 +2129,7 @@ function Hi(l) {
|
|
|
2129
2129
|
const L = e.touchStartPosition;
|
|
2130
2130
|
!e.touchLongPressActive && L && A && L.distanceTo(A) > i && w(), e.touchLongPressActive && (e.self?.handleMouseMove != null && (Q(v, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(v)), te(v));
|
|
2131
2131
|
}
|
|
2132
|
-
function
|
|
2132
|
+
function E(v) {
|
|
2133
2133
|
w(), e.touchLongPressActive && (Q(v, !0, !0, e.isClickSimpleModel), e.self?.handleMouseClick != null && e.self.handleMouseClick(v), e.self?.handleMouseUp != null && e.self.handleMouseUp(v)), m();
|
|
2134
2134
|
}
|
|
2135
2135
|
function _(v) {
|
|
@@ -2157,7 +2157,7 @@ function Hi(l) {
|
|
|
2157
2157
|
e.touchLongPressActive && b(v), M(A, I(v));
|
|
2158
2158
|
return;
|
|
2159
2159
|
}
|
|
2160
|
-
|
|
2160
|
+
ae(A);
|
|
2161
2161
|
}
|
|
2162
2162
|
}
|
|
2163
2163
|
function T(v) {
|
|
@@ -2165,10 +2165,10 @@ function Hi(l) {
|
|
|
2165
2165
|
const A = ue(v);
|
|
2166
2166
|
if (A) {
|
|
2167
2167
|
if (f()) {
|
|
2168
|
-
e.touchLongPressActive && b(v),
|
|
2168
|
+
e.touchLongPressActive && b(v), E(A);
|
|
2169
2169
|
return;
|
|
2170
2170
|
}
|
|
2171
|
-
|
|
2171
|
+
le(A);
|
|
2172
2172
|
}
|
|
2173
2173
|
}
|
|
2174
2174
|
function N(v) {
|
|
@@ -2181,7 +2181,7 @@ function Hi(l) {
|
|
|
2181
2181
|
v.pointerType !== "touch" || !f() || (e.touchLongPressActive && b(v), e.touchInputMode === "pointer" && (e.touchPointerId != null && v.pointerId !== e.touchPointerId || M(Ae(v), new G(v.clientX, v.clientY))));
|
|
2182
2182
|
}
|
|
2183
2183
|
function K(v) {
|
|
2184
|
-
v.pointerType !== "touch" || !f() || (e.touchLongPressActive && b(v), e.touchInputMode === "pointer" && (e.touchPointerId != null && v.pointerId !== e.touchPointerId ||
|
|
2184
|
+
v.pointerType !== "touch" || !f() || (e.touchLongPressActive && b(v), e.touchInputMode === "pointer" && (e.touchPointerId != null && v.pointerId !== e.touchPointerId || E(Ae(v))));
|
|
2185
2185
|
}
|
|
2186
2186
|
function $(v, A, L = !1, U = !0) {
|
|
2187
2187
|
if (!l.engineStatus.isFree && L == !1) {
|
|
@@ -2646,15 +2646,15 @@ class Vo {
|
|
|
2646
2646
|
}
|
|
2647
2647
|
init() {
|
|
2648
2648
|
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 On(e, t, {
|
|
2649
|
-
minFilter:
|
|
2650
|
-
magFilter:
|
|
2649
|
+
minFilter: Kt,
|
|
2650
|
+
magFilter: Kt,
|
|
2651
2651
|
format: Fn,
|
|
2652
2652
|
samples: 4
|
|
2653
2653
|
// 启用多重采样抗锯齿
|
|
2654
2654
|
});
|
|
2655
2655
|
r.texture.colorSpace = Is, this.composer = new _s(s, r), this.composer.setPixelRatio(o), this.composer.setSize(e, t);
|
|
2656
2656
|
const a = new Ds(i, n);
|
|
2657
|
-
this.composer.addPass(a), this.gtaoPass = new Gi(i, n, e, t), this.gtaoPass.output = Gi.OUTPUT.Default, this.gtaoPass.blendIntensity = Qn, this.gtaoPass.enabled = !1, this.gtaoPass.normalMaterial.side =
|
|
2657
|
+
this.composer.addPass(a), this.gtaoPass = new Gi(i, n, e, t), this.gtaoPass.output = Gi.OUTPUT.Default, this.gtaoPass.blendIntensity = Qn, this.gtaoPass.enabled = !1, this.gtaoPass.normalMaterial.side = re, this.gtaoPass.normalMaterial.needsUpdate = !0, this.excludeClippingHelpersFromGtao(this.gtaoPass), this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
2658
2658
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
2659
2659
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
2660
2660
|
radius: 0.45,
|
|
@@ -2680,10 +2680,10 @@ class Vo {
|
|
|
2680
2680
|
samples: 32,
|
|
2681
2681
|
rings: 3,
|
|
2682
2682
|
radiusExponent: 2
|
|
2683
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new qi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = qi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new ni(Ho), this.saturationPass.uniforms.saturation.value = $n, this.saturationPass.uniforms.contrast.value = Zn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new ks(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new ni(Ls), 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();
|
|
2683
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new qi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = qi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.excludeClippingHelpersFromGtao(this.ssaoPass), this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new ni(Ho), this.saturationPass.uniforms.saturation.value = $n, this.saturationPass.uniforms.contrast.value = Zn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new ks(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new ni(Ls), 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();
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
|
-
function
|
|
2686
|
+
function Tt(l) {
|
|
2687
2687
|
const e = Array.isArray(l?.infos) ? l.infos[0]?.name : void 0, t = typeof e == "string" ? e : "";
|
|
2688
2688
|
let i = t;
|
|
2689
2689
|
for (const n of t.matchAll(/\[([^\[\]]*)\]/g))
|
|
@@ -2694,19 +2694,19 @@ function Uo(l, e, t, i) {
|
|
|
2694
2694
|
const r = l.models.find((w) => w.url == t);
|
|
2695
2695
|
if (r == null)
|
|
2696
2696
|
return;
|
|
2697
|
-
const a =
|
|
2697
|
+
const a = it(l, t), c = [], h = e.circularMeps, u = e.rectMeps?.filter((w) => w.type === "风管"), p = e.rectMeps?.filter((w) => w.type === "桥架"), g = e.ellipseMeps, f = (w) => (w.color = w.color.split(",").map((m) => parseInt(m) / 255), w.color = new Me().setRGB(w.color[0], w.color[1], w.color[2], je), w.position = {
|
|
2698
2698
|
x: w.startPoint.X * 0.3048 + 0,
|
|
2699
2699
|
y: w.startPoint.Z * 0.3048 + 0,
|
|
2700
2700
|
z: -w.startPoint.Y * 0.3048 + 0
|
|
2701
2701
|
}, w.rotation = { x: 0, y: 0, z: 0 }, w), x = (w, m) => {
|
|
2702
2702
|
if (!Array.isArray(m) || m.length === 0)
|
|
2703
2703
|
return;
|
|
2704
|
-
const b = m.map((
|
|
2705
|
-
C != null && b.forEach((
|
|
2704
|
+
const b = m.map((S) => f(S)), C = Go(w, a, b, t, l);
|
|
2705
|
+
C != null && b.forEach((S, P) => {
|
|
2706
2706
|
const I = [[C, P, 0, 0]];
|
|
2707
|
-
|
|
2708
|
-
const B = { ...
|
|
2709
|
-
|
|
2707
|
+
S.indexes = I, S.id = Number(S.id);
|
|
2708
|
+
const B = { ...S, instance: !0, info: S, infos: [S], indexes: I };
|
|
2709
|
+
Tt(B), r.nodesMap.set(Number(S.id), B), c.push(Number(S.id));
|
|
2710
2710
|
});
|
|
2711
2711
|
};
|
|
2712
2712
|
x("Circle", h), x("Rect", u), x("Ellipse", g), x("Bridge", p), Wo(r, c);
|
|
@@ -2736,16 +2736,16 @@ function Go(l, e, t, i, n) {
|
|
|
2736
2736
|
};
|
|
2737
2737
|
switch (l) {
|
|
2738
2738
|
case "Rect":
|
|
2739
|
-
s =
|
|
2739
|
+
s = Rt("Rect", o);
|
|
2740
2740
|
break;
|
|
2741
2741
|
case "Bridge":
|
|
2742
|
-
s =
|
|
2742
|
+
s = Rt("Bridge", o);
|
|
2743
2743
|
break;
|
|
2744
2744
|
case "Circle":
|
|
2745
|
-
s =
|
|
2745
|
+
s = Rt("Circle", o);
|
|
2746
2746
|
break;
|
|
2747
2747
|
case "Ellipse":
|
|
2748
|
-
s =
|
|
2748
|
+
s = Rt("Ellipse", o);
|
|
2749
2749
|
break;
|
|
2750
2750
|
}
|
|
2751
2751
|
if (!s)
|
|
@@ -2757,26 +2757,26 @@ function Go(l, e, t, i, n) {
|
|
|
2757
2757
|
const c = r.geometry.boundingBox?.clone() ?? null, h = [], u = [];
|
|
2758
2758
|
for (let g = 0; g < t.length; g++) {
|
|
2759
2759
|
const f = t[g], x = new d(f.startPoint.X, 0, -f.startPoint.Y), w = new d(f.endPoint.X, 0, -f.endPoint.Y), m = new d(f.startPoint.X, f.startPoint.Z, -f.startPoint.Y), b = new d(f.endPoint.X, f.endPoint.Z, -f.endPoint.Y);
|
|
2760
|
-
let C = 0,
|
|
2760
|
+
let C = 0, S = 0, P = 0;
|
|
2761
2761
|
if (Math.abs(w.clone().sub(x.clone()).z) < 0.01 && Math.abs(w.clone().sub(x.clone()).x) < 0.01) {
|
|
2762
2762
|
if (C = (f.startPoint.Z > f.endPoint.Z ? 1 : -1) * Math.PI * 0.5, f.base_x != null) {
|
|
2763
2763
|
const y = new d(f.base_x.X, 0, -f.base_x.Y);
|
|
2764
|
-
|
|
2764
|
+
S = (y.clone().cross(new d(0, 0, 1)).y <= 0 ? 1 : -1) * y.angleTo(new d(0, 0, 1)) + Math.PI * 0.5;
|
|
2765
2765
|
}
|
|
2766
2766
|
} else
|
|
2767
|
-
|
|
2768
|
-
const I = new V(), B = new Ze(C,
|
|
2767
|
+
S = (w.clone().sub(x.clone()).cross(new d(0, 0, 1)).y > 0 ? -1 : 1) * w.clone().sub(x.clone()).angleTo(new d(0, 0, 1)), C = (f.startPoint.Z > f.endPoint.Z ? 1 : -1) * w.clone().sub(x.clone()).angleTo(b.clone().sub(m.clone()));
|
|
2768
|
+
const I = new V(), B = new Ze(C, S, P, "YXZ"), k = I.clone().makeRotationFromEuler(B);
|
|
2769
2769
|
let O, q;
|
|
2770
2770
|
l === "Circle" ? (O = f.diameter, q = f.diameter) : (O = f.width, q = f.height);
|
|
2771
2771
|
const te = I.clone().makeScale(O, q, f.length);
|
|
2772
2772
|
I.multiplyMatrices(k, te), I.setPosition(f.position.x, f.position.y, f.position.z), r.setMatrixAt(g, I.clone()), r.setColorAt(g, f.color);
|
|
2773
|
-
const Q = c?.clone().applyMatrix4(I) ?? new
|
|
2773
|
+
const Q = c?.clone().applyMatrix4(I) ?? new R(), ce = Q.min.clone(), ae = Q.max.clone(), le = Q.getCenter(new d());
|
|
2774
2774
|
f.box = Q.clone();
|
|
2775
2775
|
const ue = {
|
|
2776
2776
|
name: f.name,
|
|
2777
2777
|
min: ce,
|
|
2778
|
-
max:
|
|
2779
|
-
center:
|
|
2778
|
+
max: ae,
|
|
2779
|
+
center: le,
|
|
2780
2780
|
box: Q.clone(),
|
|
2781
2781
|
dbid: g,
|
|
2782
2782
|
materialName: s.material.name
|
|
@@ -2800,7 +2800,7 @@ function Go(l, e, t, i, n) {
|
|
|
2800
2800
|
};
|
|
2801
2801
|
return r.meshs = p, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, a;
|
|
2802
2802
|
}
|
|
2803
|
-
function
|
|
2803
|
+
function Rt(l, e) {
|
|
2804
2804
|
const t = new Nn();
|
|
2805
2805
|
switch (e.width = e.width * 0.3048, e.height = e.height * 0.3048, e.diameter = e.diameter * 0.3048, l) {
|
|
2806
2806
|
case "Rect":
|
|
@@ -2827,9 +2827,9 @@ function zt(l, e) {
|
|
|
2827
2827
|
color: 16777215,
|
|
2828
2828
|
metalness: 0,
|
|
2829
2829
|
roughness: 1,
|
|
2830
|
-
side:
|
|
2831
|
-
shadowSide:
|
|
2832
|
-
}), p = new
|
|
2830
|
+
side: re,
|
|
2831
|
+
shadowSide: re
|
|
2832
|
+
}), p = new z(h, u);
|
|
2833
2833
|
return p.position.set(a.x, a.y, a.z), p.rotation._order = "YXZ", p.rotation.set(c.x, c.y, c.z), p;
|
|
2834
2834
|
}
|
|
2835
2835
|
}
|
|
@@ -2837,7 +2837,7 @@ var ne = /* @__PURE__ */ ((l) => (l.ModelLoadStart = "model-load-start", l.Model
|
|
|
2837
2837
|
const rn = "__bvhAccelerationInstalled", Jn = "__bvhBuildFailed", qo = "__bvhBuilt", Ko = "__bvhTriangleCount", es = 200, jo = 10;
|
|
2838
2838
|
function Yo() {
|
|
2839
2839
|
const l = globalThis;
|
|
2840
|
-
l[rn] !== !0 && (
|
|
2840
|
+
l[rn] !== !0 && (z.prototype.raycast = Bs, ge.prototype.computeBoundsTree = Vn, ge.prototype.disposeBoundsTree = zs, l[rn] = !0);
|
|
2841
2841
|
}
|
|
2842
2842
|
function Xo(l) {
|
|
2843
2843
|
l.firstHitOnly = !0;
|
|
@@ -2985,7 +2985,7 @@ function fr(l, e) {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
function ut(l, e) {
|
|
2987
2987
|
const t = l.models.find((i) => i.url == e);
|
|
2988
|
-
return t != null && t.group == null && (t.group = et(l, e) ??
|
|
2988
|
+
return t != null && t.group == null && (t.group = et(l, e) ?? it(l, e)), t;
|
|
2989
2989
|
}
|
|
2990
2990
|
function as(l, e) {
|
|
2991
2991
|
const t = ut(l, e);
|
|
@@ -3057,7 +3057,7 @@ async function xr(l, e, t, i) {
|
|
|
3057
3057
|
w.applyMatrix4(x), w.computeBoundingBox(), w.attributes.position.count > 2e4 && Jo(w, {
|
|
3058
3058
|
setBoundingSphere: !0
|
|
3059
3059
|
});
|
|
3060
|
-
const m = new
|
|
3060
|
+
const m = new z(w, f.material);
|
|
3061
3061
|
g.box = w.boundingBox?.clone(), g.mesh = m, m.name = Number(h), m.glb = g.glb, m.url = e.url, w.attributes.position != null && r.push(m), c++, c % ts === 0 && (a = await Xe(l, i, a));
|
|
3062
3062
|
}
|
|
3063
3063
|
}
|
|
@@ -3078,22 +3078,22 @@ function Cr(l, e, t, i, n) {
|
|
|
3078
3078
|
const s = bt(
|
|
3079
3079
|
i.map((h) => h.geometry),
|
|
3080
3080
|
!1
|
|
3081
|
-
), o = hs(n), r = new
|
|
3082
|
-
r.castShadow = !0, r.receiveShadow = !0,
|
|
3081
|
+
), o = hs(n), r = new z(s, o);
|
|
3082
|
+
r.castShadow = !0, r.receiveShadow = !0, it(e, l).add(r);
|
|
3083
3083
|
const c = Fi(e, r);
|
|
3084
3084
|
return Ni(r, c), r.url = l, r.glb = t, r.materialClone = o, r.geometrys = i.map((h) => h.geometry), r.geometry.computeVertexNormals(), r;
|
|
3085
3085
|
}
|
|
3086
3086
|
function Ar(l, e, t, i) {
|
|
3087
3087
|
return (et(l, e)?.children ?? l.scene.children).find((o) => {
|
|
3088
3088
|
const r = o;
|
|
3089
|
-
return o instanceof
|
|
3089
|
+
return o instanceof z && r.url == e && r.glb == t && r.materialClone === i;
|
|
3090
3090
|
});
|
|
3091
3091
|
}
|
|
3092
|
-
function
|
|
3092
|
+
function Er(l, e) {
|
|
3093
3093
|
const t = Array.isArray(l.geometrys) ? l.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s = bt(n, !1);
|
|
3094
3094
|
l.geometry != null && l.geometry.dispose(), l.geometry = s, l.geometrys = n, l.castShadow = !0, l.receiveShadow = !0;
|
|
3095
3095
|
}
|
|
3096
|
-
async function
|
|
3096
|
+
async function Sr(l, e, t, i) {
|
|
3097
3097
|
const n = /* @__PURE__ */ new Map();
|
|
3098
3098
|
for (const r of t) {
|
|
3099
3099
|
const a = n.get(r.glb) ?? [];
|
|
@@ -3109,19 +3109,19 @@ async function Er(l, e, t, i) {
|
|
|
3109
3109
|
continue;
|
|
3110
3110
|
const p = Or(u[0].material, e);
|
|
3111
3111
|
let g = Ar(e, l, r, p), f = 0, x = 0;
|
|
3112
|
-
g = null, g != null ? (f = Array.isArray(g.geometrys) ? g.geometrys.length : 0, x = hn(g.geometry),
|
|
3112
|
+
g = null, g != null ? (f = Array.isArray(g.geometrys) ? g.geometrys.length : 0, x = hn(g.geometry), Er(g, u)) : g = Cr(l, e, r, u, p);
|
|
3113
3113
|
const w = /* @__PURE__ */ new Map();
|
|
3114
3114
|
let m = x;
|
|
3115
3115
|
u.forEach((b, C) => {
|
|
3116
|
-
const
|
|
3117
|
-
if (I.push([m, m + P]), w.set(
|
|
3118
|
-
const B = s.nodesMap.get(
|
|
3116
|
+
const S = Number(b.name), P = hn(b.geometry), I = w.get(S) ?? [];
|
|
3117
|
+
if (I.push([m, m + P]), w.set(S, I), s?.nodesMap?.has(S)) {
|
|
3118
|
+
const B = s.nodesMap.get(S);
|
|
3119
3119
|
B.indexes == null && (B.indexes = []), B.indexes.push([g.index, f + C, m, m + P]);
|
|
3120
3120
|
}
|
|
3121
3121
|
m += P;
|
|
3122
3122
|
}), g.indexes == null && (g.indexes = /* @__PURE__ */ new Map()), w.forEach((b, C) => {
|
|
3123
|
-
const
|
|
3124
|
-
|
|
3123
|
+
const S = g.indexes.get(C) ?? [];
|
|
3124
|
+
S.push(...b), g.indexes.set(C, S);
|
|
3125
3125
|
}), e.requestComposerRender?.(), o = await Xe(e, i, o);
|
|
3126
3126
|
}
|
|
3127
3127
|
}
|
|
@@ -3138,7 +3138,7 @@ async function Tr(l, e, t, i, n, s) {
|
|
|
3138
3138
|
return;
|
|
3139
3139
|
i.geometry.computeVertexNormals();
|
|
3140
3140
|
const r = new W(i.geometry, hs(i.material), n.length);
|
|
3141
|
-
|
|
3141
|
+
it(t, l).add(r);
|
|
3142
3142
|
const c = Fi(t, r);
|
|
3143
3143
|
Ni(r, c);
|
|
3144
3144
|
const h = new Float32Array(n.length * 3);
|
|
@@ -3153,7 +3153,7 @@ async function Tr(l, e, t, i, n, s) {
|
|
|
3153
3153
|
const w = Pr(i, x);
|
|
3154
3154
|
if (w != null && (f.box = w.clone()), r.setMatrixAt(g, x), r.matrixs || (r.matrixs = []), r.matrixs.push(x.clone()), p.push(x.clone()), o.nodesMap.has(f.id)) {
|
|
3155
3155
|
const m = o.nodesMap.get(f.id);
|
|
3156
|
-
m.indexes == null && (m.indexes = []), m.indexes.push([c, g, 0, 0]),
|
|
3156
|
+
m.indexes == null && (m.indexes = []), m.indexes.push([c, g, 0, 0]), Tt(m), w != null && m?.info != null && (m.info.box instanceof R ? m.info.box.union(w) : m.info.box = w.clone());
|
|
3157
3157
|
} else {
|
|
3158
3158
|
const m = {
|
|
3159
3159
|
instance: !0,
|
|
@@ -3161,7 +3161,7 @@ async function Tr(l, e, t, i, n, s) {
|
|
|
3161
3161
|
infos: [f],
|
|
3162
3162
|
indexes: [[c, g, 0, 0]]
|
|
3163
3163
|
};
|
|
3164
|
-
|
|
3164
|
+
Tt(m), o.nodesMap.set(f.id, m);
|
|
3165
3165
|
}
|
|
3166
3166
|
(g + 1) % ir === 0 && (u = await Xe(t, s, u));
|
|
3167
3167
|
}
|
|
@@ -3196,7 +3196,7 @@ async function _r(l, e, t, i) {
|
|
|
3196
3196
|
t.meshPromise = (async () => {
|
|
3197
3197
|
console.log(`[loadLightModel] start build lod meshes ${Date.now() - window.startTime}ms`);
|
|
3198
3198
|
const n = await xr(l, e, t, i);
|
|
3199
|
-
await
|
|
3199
|
+
await Sr(e.url, l, n, i), await Ir(e, t, l, i), t.instanceNodes = null, t.status = !0, console.log(`[loadLightModel] *****************************************************finish build lod meshes ${Date.now() - window.startTime}ms`);
|
|
3200
3200
|
})().finally(() => {
|
|
3201
3201
|
t.meshPromise = null;
|
|
3202
3202
|
}), await t.meshPromise;
|
|
@@ -3228,12 +3228,12 @@ async function Dr(l, e, t, i) {
|
|
|
3228
3228
|
const b = w[m];
|
|
3229
3229
|
if (b.glb = x, a.nodesMap.has(b.id) === !1) {
|
|
3230
3230
|
const C = { infos: [b] };
|
|
3231
|
-
|
|
3231
|
+
Tt(C), a.nodesMap.set(b.id, C);
|
|
3232
3232
|
} else {
|
|
3233
3233
|
const C = a.nodesMap.get(b.id);
|
|
3234
3234
|
if (!C.infos)
|
|
3235
3235
|
continue;
|
|
3236
|
-
C.infos.push(b),
|
|
3236
|
+
C.infos.push(b), Tt(C);
|
|
3237
3237
|
}
|
|
3238
3238
|
(m + 1) % ts === 0 && (c = await Xe(l, i, c));
|
|
3239
3239
|
}
|
|
@@ -3283,12 +3283,12 @@ async function Dr(l, e, t, i) {
|
|
|
3283
3283
|
}
|
|
3284
3284
|
}
|
|
3285
3285
|
function kr(l, e, t) {
|
|
3286
|
-
if (t.boundingBox || (t.boundingBox = new
|
|
3286
|
+
if (t.boundingBox || (t.boundingBox = new R(), t.boundingBox.min = new d(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new d(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
3287
3287
|
return 1e3;
|
|
3288
3288
|
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), a = new d(), c = new d(), h = new d(), u = new d();
|
|
3289
3289
|
if (e.getWorldDirection(h), e.getWorldPosition(u), e.matrixWorld.extractBasis(a, c, new d()), e instanceof _e) {
|
|
3290
|
-
const m = Math.max((e.top - e.bottom) / e.zoom, 1e-6), b = l?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = F.degToRad(b * 0.5),
|
|
3291
|
-
u.copy(o).add(h.clone().multiplyScalar(-
|
|
3290
|
+
const m = Math.max((e.top - e.bottom) / e.zoom, 1e-6), b = l?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = F.degToRad(b * 0.5), S = C > 0 ? m / (2 * Math.tan(C)) : m;
|
|
3291
|
+
u.copy(o).add(h.clone().multiplyScalar(-S));
|
|
3292
3292
|
}
|
|
3293
3293
|
if (u.distanceTo(o) <= r * 0.5)
|
|
3294
3294
|
return 1e3;
|
|
@@ -3314,17 +3314,17 @@ function Br(l, e, t) {
|
|
|
3314
3314
|
});
|
|
3315
3315
|
}
|
|
3316
3316
|
function zr(l, e, t, i) {
|
|
3317
|
-
const n =
|
|
3317
|
+
const n = it(l, e);
|
|
3318
3318
|
l.models || (l.models = []);
|
|
3319
|
-
const s = t?.loadQuotaList ?? !1;
|
|
3319
|
+
const s = t?.loadQuotaList ?? !1, o = t?.loadEdge !== !1;
|
|
3320
3320
|
window.startTime = Date.now();
|
|
3321
|
-
let
|
|
3322
|
-
dr(e + "/info",
|
|
3323
|
-
const
|
|
3321
|
+
let r = "WDDsBNtzVz6aSh/bCFh3CmjjANEDRryoXF1XCJvJjeE=";
|
|
3322
|
+
dr(e + "/info", r).then((a) => {
|
|
3323
|
+
const c = Zt(a), h = c?.baseInfo ?? {}, u = typeof h?.name == "string" ? h.name : "";
|
|
3324
3324
|
l.__loadingCompletedTriggered = !1;
|
|
3325
|
-
const
|
|
3325
|
+
const p = {
|
|
3326
3326
|
type: "light",
|
|
3327
|
-
name:
|
|
3327
|
+
name: u,
|
|
3328
3328
|
status: "loading",
|
|
3329
3329
|
url: e,
|
|
3330
3330
|
loadStatus: {
|
|
@@ -3332,44 +3332,45 @@ function zr(l, e, t, i) {
|
|
|
3332
3332
|
normal: !1,
|
|
3333
3333
|
quotaList: "loading"
|
|
3334
3334
|
},
|
|
3335
|
-
key:
|
|
3335
|
+
key: r
|
|
3336
3336
|
};
|
|
3337
|
-
l.engineStatus.models.push(
|
|
3338
|
-
const
|
|
3337
|
+
l.engineStatus.models.push(p), c?.lods.forEach((x) => delete x.elements);
|
|
3338
|
+
const g = {
|
|
3339
3339
|
url: e,
|
|
3340
3340
|
urls: [e + "/info"],
|
|
3341
|
+
loadEdge: o,
|
|
3341
3342
|
group: n,
|
|
3342
3343
|
nodesMap: /* @__PURE__ */ new Map(),
|
|
3343
|
-
grids:
|
|
3344
|
-
levels:
|
|
3345
|
-
rooms:
|
|
3346
|
-
views:
|
|
3347
|
-
name:
|
|
3348
|
-
key:
|
|
3349
|
-
baseInfo:
|
|
3350
|
-
lods: Array.isArray(
|
|
3351
|
-
modelMep:
|
|
3352
|
-
modelMapper: Array.isArray(
|
|
3353
|
-
modelTree:
|
|
3344
|
+
grids: c?.modelGrid,
|
|
3345
|
+
levels: c?.modelLevel,
|
|
3346
|
+
rooms: c?.modelRoom,
|
|
3347
|
+
views: c?.modelView,
|
|
3348
|
+
name: u,
|
|
3349
|
+
key: r,
|
|
3350
|
+
baseInfo: h,
|
|
3351
|
+
lods: Array.isArray(c?.lods) ? c.lods : [],
|
|
3352
|
+
modelMep: c?.modelMep ?? {},
|
|
3353
|
+
modelMapper: Array.isArray(c?.modelMapper) ? c.modelMapper : [],
|
|
3354
|
+
modelTree: c?.modelTree ?? {},
|
|
3354
3355
|
boundingBox: {
|
|
3355
|
-
min: new d(
|
|
3356
|
-
max: new d(
|
|
3356
|
+
min: new d(h.min.X * 0.3048, h.min.Z * 0.3048, -h.min.Y * 0.3048),
|
|
3357
|
+
max: new d(h.max.X * 0.3048, h.max.Z * 0.3048, -h.max.Y * 0.3048)
|
|
3357
3358
|
}
|
|
3358
3359
|
};
|
|
3359
|
-
l.models.push(
|
|
3360
|
-
l.filterLoaderModel?.buildContinueIds?.(e),
|
|
3361
|
-
}) :
|
|
3362
|
-
function
|
|
3363
|
-
s ? mr(e + "/quota_list",
|
|
3364
|
-
|
|
3365
|
-
}).catch((
|
|
3366
|
-
|
|
3367
|
-
}) : (
|
|
3360
|
+
l.models.push(g), s ? l.modelProperties.loadProperties(e, () => {
|
|
3361
|
+
l.filterLoaderModel?.buildContinueIds?.(e), f();
|
|
3362
|
+
}) : f();
|
|
3363
|
+
function f() {
|
|
3364
|
+
s ? mr(e + "/quota_list", r).then((x) => {
|
|
3365
|
+
x.exists && (g.quotaList = x.value ?? [], l.rxQuotaListMapper.loadNodeMap(g)), p.loadStatus.quotaList = !0, Mt(l);
|
|
3366
|
+
}).catch((x) => {
|
|
3367
|
+
p.loadStatus.quotaList = !0, console.warn("[loadLightModel] unexpected quota_list load failure", { url: e, error: x }), Mt(l);
|
|
3368
|
+
}) : (p.loadStatus.quotaList = !0, Mt(l)), l.viewCube.CameraGoHome(1), l.models.length == i && setTimeout(() => {
|
|
3368
3369
|
ds(l, null, !1);
|
|
3369
|
-
}, 100)
|
|
3370
|
+
}, 100);
|
|
3370
3371
|
}
|
|
3371
|
-
}).catch((
|
|
3372
|
-
console.error("[loadLightModel] failed to load model info", { url: e, error:
|
|
3372
|
+
}).catch((a) => {
|
|
3373
|
+
console.error("[loadLightModel] failed to load model info", { url: e, error: a });
|
|
3373
3374
|
});
|
|
3374
3375
|
}
|
|
3375
3376
|
async function ds(l, e, t = !1) {
|
|
@@ -3393,7 +3394,7 @@ async function Rr(l, e, t = !1) {
|
|
|
3393
3394
|
await Lr(l, e, n, t);
|
|
3394
3395
|
}
|
|
3395
3396
|
function Or(l, e) {
|
|
3396
|
-
return br(l), l.map != null && (l.map.colorSpace = je, l.map.needsUpdate = !0), l.side =
|
|
3397
|
+
return br(l), l.map != null && (l.map.colorSpace = je, l.map.needsUpdate = !0), l.side = re, l.shadowSide = re, l.clipShadows = !0, e?.sectionPlane && (l.clippingPlanes = e.sectionPlane), l;
|
|
3397
3398
|
}
|
|
3398
3399
|
const Fr = "/__local_model__", Nr = /^(info|property|edge|quota_list|lod\d+)(?:\.zip)?$/i, Hr = /^(info|property|edge|quota_list|lod\d+)(?:~)?$/i;
|
|
3399
3400
|
class Ie {
|
|
@@ -3793,7 +3794,7 @@ class ua {
|
|
|
3793
3794
|
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 = xt, e.target.name = "directionalShadowLightTarget";
|
|
3794
3795
|
const i = new qe(16777215, 2);
|
|
3795
3796
|
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;
|
|
3796
|
-
const n = new
|
|
3797
|
+
const n = new jt(16777215, 1);
|
|
3797
3798
|
this.engine.scene.add(n);
|
|
3798
3799
|
}
|
|
3799
3800
|
/**
|
|
@@ -3848,8 +3849,8 @@ class ua {
|
|
|
3848
3849
|
f,
|
|
3849
3850
|
o,
|
|
3850
3851
|
u
|
|
3851
|
-
), b = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(m.near - this.lastShadowNear) > 1,
|
|
3852
|
-
!b && !C && !
|
|
3852
|
+
), b = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(m.near - this.lastShadowNear) > 1, S = Math.abs(m.far - this.lastShadowFar) > 1, P = w.distanceToSquared(this.lastLightPosition) > 0.25, I = f.distanceToSquared(this.lastLightTarget) > 0.25, B = Math.abs(x - this.lastShadowIntensity) > 0.01;
|
|
3853
|
+
!b && !C && !S && !P && !I && !B || (t.position.copy(w), t.target.position.copy(f), t.target.updateMatrixWorld(!0), t.updateMatrixWorld(!0), i.left = -u, i.right = u, i.top = u, i.bottom = -u, i.near = m.near, i.far = m.far, i.updateProjectionMatrix(), this.updateShadowBias(t, u, m), t.shadow.intensity = x, t.shadow.needsUpdate = !0, this.lastShadowHalfSize = u, this.lastShadowNear = m.near, this.lastShadowFar = m.far, this.lastLightPosition.copy(w), this.lastLightTarget.copy(f), this.lastShadowIntensity = x);
|
|
3853
3854
|
}
|
|
3854
3855
|
/**
|
|
3855
3856
|
* 计算场景范围对阴影相机半边长的贡献。
|
|
@@ -3967,11 +3968,11 @@ class ua {
|
|
|
3967
3968
|
const t = this.engine.scene;
|
|
3968
3969
|
if (!t)
|
|
3969
3970
|
return null;
|
|
3970
|
-
const i = new
|
|
3971
|
+
const i = new R();
|
|
3971
3972
|
let n = !1;
|
|
3972
3973
|
return t.traverse((s) => {
|
|
3973
|
-
if (s instanceof
|
|
3974
|
-
const o = new
|
|
3974
|
+
if (s instanceof z || s instanceof W) {
|
|
3975
|
+
const o = new R().setFromObject(s);
|
|
3975
3976
|
o.isEmpty() || (i.union(o), n = !0);
|
|
3976
3977
|
}
|
|
3977
3978
|
}), !n || i.isEmpty() ? null : this.validateBox(i);
|
|
@@ -3984,7 +3985,7 @@ class ua {
|
|
|
3984
3985
|
*/
|
|
3985
3986
|
normalizeBox(e, t) {
|
|
3986
3987
|
return [e.x, e.y, e.z, t.x, t.y, t.z].every(Number.isFinite) ? this.validateBox(
|
|
3987
|
-
new
|
|
3988
|
+
new R(
|
|
3988
3989
|
new d(
|
|
3989
3990
|
Math.min(e.x, t.x),
|
|
3990
3991
|
Math.min(e.y, t.y),
|
|
@@ -4020,7 +4021,7 @@ class ua {
|
|
|
4020
4021
|
const i = Math.max(e.zoom, 1e-6), n = Math.max((e.top - e.bottom) / (2 * i), 1), s = Math.max((e.right - e.left) / (2 * i), 1);
|
|
4021
4022
|
return Math.max(s, n);
|
|
4022
4023
|
}
|
|
4023
|
-
if (e instanceof
|
|
4024
|
+
if (e instanceof qt) {
|
|
4024
4025
|
const i = this.resolveShadowTarget(e, t), n = Math.max(e.position.distanceTo(i), 1), s = F.degToRad(e.getEffectiveFOV() * 0.5), o = Math.max(Math.tan(s) * n, 1), r = o * Math.max(e.aspect, 1e-6);
|
|
4025
4026
|
return Math.min(Math.max(r, o), Qr);
|
|
4026
4027
|
}
|
|
@@ -4103,7 +4104,7 @@ class ua {
|
|
|
4103
4104
|
return;
|
|
4104
4105
|
const i = e.getSize(new d()).length();
|
|
4105
4106
|
(this.lastShadowCasterPolicySceneSize <= 0 || Math.abs(i - this.lastShadowCasterPolicySceneSize) > this.lastShadowCasterPolicySceneSize * 0.1) && (this.shadowCasterPolicyChecked = /* @__PURE__ */ new WeakSet(), this.lastShadowCasterPolicySceneSize = i), t.traverse((n) => {
|
|
4106
|
-
this.shadowCasterPolicyChecked.has(n) || (n instanceof
|
|
4107
|
+
this.shadowCasterPolicyChecked.has(n) || (n instanceof z || n instanceof W) && (this.shadowCasterPolicyChecked.add(n), this.applyShadowCasterPolicy(n));
|
|
4107
4108
|
});
|
|
4108
4109
|
}
|
|
4109
4110
|
/**
|
|
@@ -4114,7 +4115,7 @@ class ua {
|
|
|
4114
4115
|
const t = e.userData;
|
|
4115
4116
|
if (t.__lightModuleOriginalCastShadow == null && (t.__lightModuleOriginalCastShadow = e.castShadow), t.__lightModuleOriginalCastShadow !== !0 || e.receiveShadow !== !0)
|
|
4116
4117
|
return;
|
|
4117
|
-
const i = new
|
|
4118
|
+
const i = new R().setFromObject(e);
|
|
4118
4119
|
if (i.isEmpty())
|
|
4119
4120
|
return;
|
|
4120
4121
|
const n = i.getSize(new d()), s = Math.max(n.x, n.z), o = Math.max(
|
|
@@ -4459,11 +4460,11 @@ class pa {
|
|
|
4459
4460
|
getNodeWorldBox(e, t, i) {
|
|
4460
4461
|
if (i != null) {
|
|
4461
4462
|
const n = this.engine.modelExplode?.getExplodedWorldBox?.(e.url, i);
|
|
4462
|
-
if (n instanceof
|
|
4463
|
+
if (n instanceof R)
|
|
4463
4464
|
return n;
|
|
4464
4465
|
}
|
|
4465
4466
|
if (Array.isArray(t?.infos) && t.infos.length > 0) {
|
|
4466
|
-
const n =
|
|
4467
|
+
const n = ze(this.engine, e.url), s = t.infos.map((o) => o?.box).filter((o) => o instanceof R).map((o) => o.clone().applyMatrix4(n));
|
|
4467
4468
|
return this.getMergedBox(s);
|
|
4468
4469
|
}
|
|
4469
4470
|
if (Array.isArray(t?.indexes) && t.indexes.length > 0) {
|
|
@@ -4488,15 +4489,15 @@ class pa {
|
|
|
4488
4489
|
const n = e.indexes.map((s) => {
|
|
4489
4490
|
const o = this.getSceneModel(s[0]);
|
|
4490
4491
|
return this.createInstanceCatchMesh(o, s[1]);
|
|
4491
|
-
}).filter((s) => s instanceof
|
|
4492
|
+
}).filter((s) => s instanceof z);
|
|
4492
4493
|
if (n.length > 0)
|
|
4493
4494
|
return n;
|
|
4494
4495
|
}
|
|
4495
4496
|
if (Array.isArray(e?.infos) && e.infos.length > 0) {
|
|
4496
|
-
const n = e.infos.map((o) => o?.mesh).filter((o) => o instanceof
|
|
4497
|
+
const n = e.infos.map((o) => o?.mesh).filter((o) => o instanceof z && o.userData?.__pickBox !== !0);
|
|
4497
4498
|
if (t == null)
|
|
4498
4499
|
return n;
|
|
4499
|
-
const s =
|
|
4500
|
+
const s = ze(this.engine, t);
|
|
4500
4501
|
return n.forEach((o) => {
|
|
4501
4502
|
o.parent == null && (o.matrixAutoUpdate = !1, o.matrix.copy(s), o.matrixWorld.copy(s), o.matrixWorldNeedsUpdate = !1);
|
|
4502
4503
|
}), n;
|
|
@@ -4513,7 +4514,7 @@ class pa {
|
|
|
4513
4514
|
else
|
|
4514
4515
|
return null;
|
|
4515
4516
|
const i = e.geometry.clone();
|
|
4516
|
-
return e.updateWorldMatrix(!0, !1), i.applyMatrix4(this.tempInstanceMatrix), i.applyMatrix4(e.matrixWorld), new
|
|
4517
|
+
return e.updateWorldMatrix(!0, !1), i.applyMatrix4(this.tempInstanceMatrix), i.applyMatrix4(e.matrixWorld), new z(i, e.material);
|
|
4517
4518
|
}
|
|
4518
4519
|
getInstanceWorldBox(e, t) {
|
|
4519
4520
|
if (!(e instanceof W))
|
|
@@ -4558,11 +4559,11 @@ class pa {
|
|
|
4558
4559
|
getMergedBox(e) {
|
|
4559
4560
|
if (e.length === 0)
|
|
4560
4561
|
return null;
|
|
4561
|
-
const t = new
|
|
4562
|
+
const t = new R().makeEmpty();
|
|
4562
4563
|
return e.forEach((i) => t.union(i)), t.isEmpty() ? null : t;
|
|
4563
4564
|
}
|
|
4564
4565
|
getSceneModel(e) {
|
|
4565
|
-
return
|
|
4566
|
+
return Le(this.engine, e);
|
|
4566
4567
|
}
|
|
4567
4568
|
/** 从射线命中的对象还原真实构件 ID,兼容炸开代理和普通模型对象。 */
|
|
4568
4569
|
getHitModelId(e) {
|
|
@@ -4576,13 +4577,14 @@ class ma {
|
|
|
4576
4577
|
engine;
|
|
4577
4578
|
highlightMaterial;
|
|
4578
4579
|
translucentMaterial;
|
|
4580
|
+
pickBoxMaterial;
|
|
4579
4581
|
customModelColorRecords;
|
|
4580
4582
|
customInstanceColorBatches;
|
|
4581
4583
|
// 存储克隆的高亮模型,用于后续清理
|
|
4582
4584
|
// 存储被隐藏的 InstancedMesh 实例的原始矩阵,用于后续恢复
|
|
4583
4585
|
// key: 场景中 InstancedMesh 的索引,value: Map<实例索引, 原始矩阵>
|
|
4584
4586
|
constructor(e) {
|
|
4585
|
-
this.engine = e, this.customModelColorRecords = /* @__PURE__ */ new Map(), this.customInstanceColorBatches = /* @__PURE__ */ new Map(), this.highlightMaterial = new
|
|
4587
|
+
this.engine = e, this.customModelColorRecords = /* @__PURE__ */ new Map(), this.customInstanceColorBatches = /* @__PURE__ */ new Map(), this.highlightMaterial = new oe({
|
|
4586
4588
|
color: 43775,
|
|
4587
4589
|
// 明显的蓝色
|
|
4588
4590
|
depthTest: !1,
|
|
@@ -4592,19 +4594,77 @@ class ma {
|
|
|
4592
4594
|
transparent: !0,
|
|
4593
4595
|
opacity: 0.3,
|
|
4594
4596
|
// 半透明效果
|
|
4595
|
-
side:
|
|
4597
|
+
side: re
|
|
4596
4598
|
// 双面渲染
|
|
4597
|
-
}), this.translucentMaterial = new
|
|
4599
|
+
}), this.translucentMaterial = new oe({
|
|
4598
4600
|
color: 16777215,
|
|
4599
4601
|
transparent: !0,
|
|
4600
4602
|
opacity: 0.05,
|
|
4601
4603
|
// 半透明效果
|
|
4602
|
-
side:
|
|
4604
|
+
side: re
|
|
4603
4605
|
// 双面渲染
|
|
4604
|
-
}), this.
|
|
4606
|
+
}), this.pickBoxMaterial = new oe({
|
|
4607
|
+
transparent: !0,
|
|
4608
|
+
opacity: 0,
|
|
4609
|
+
colorWrite: !1,
|
|
4610
|
+
depthWrite: !1
|
|
4611
|
+
}), this.highlightMaterial.clippingPlanes = this.engine.sectionPlane, this.translucentMaterial.clippingPlanes = this.engine.sectionPlane, this.pickBoxMaterial.clippingPlanes = this.engine.sectionPlane, this.engine.events?.on?.(ie.EngineFree, () => {
|
|
4605
4612
|
this.restoreSplitModelsOnIdle();
|
|
4606
4613
|
});
|
|
4607
4614
|
}
|
|
4615
|
+
/**
|
|
4616
|
+
* 为名称匹配的普通构件新增透明拾取 Box,并追加到原节点 infos 中。
|
|
4617
|
+
* @param names 构件名称关键词,任一关键词被包含即视为匹配
|
|
4618
|
+
* @param minSize Box 三个方向的最小尺寸,单位为米
|
|
4619
|
+
* @returns 成功新增的拾取 Box 数量
|
|
4620
|
+
*/
|
|
4621
|
+
addPickBoxByNames(e, t = 0.2) {
|
|
4622
|
+
const i = Array.isArray(e) ? e.map((o) => o.trim()).filter(Boolean) : [];
|
|
4623
|
+
if (i.length === 0)
|
|
4624
|
+
return 0;
|
|
4625
|
+
const n = Number.isFinite(t) && t > 0 ? t : 0.2;
|
|
4626
|
+
let s = 0;
|
|
4627
|
+
return this.engine.models.forEach((o) => {
|
|
4628
|
+
if (!(o?.nodesMap instanceof Map) || !o.url)
|
|
4629
|
+
return;
|
|
4630
|
+
const r = it(this.engine, o.url);
|
|
4631
|
+
o.nodesMap.forEach((a, c) => {
|
|
4632
|
+
const h = String(a?.name ?? a?.info?.name ?? a?.infos?.[0]?.name ?? "");
|
|
4633
|
+
if (!i.some((m) => h.includes(m)) || a?.pickBoxMesh instanceof z || a?.indexes?.some((m) => Le(this.engine, m?.[0]) instanceof W))
|
|
4634
|
+
return;
|
|
4635
|
+
const p = this.getNodeLocalBox(a);
|
|
4636
|
+
if (p == null)
|
|
4637
|
+
return;
|
|
4638
|
+
const g = p.getCenter(new d()), f = p.getSize(new d());
|
|
4639
|
+
f.set(
|
|
4640
|
+
Math.max(f.x, n),
|
|
4641
|
+
Math.max(f.y, n),
|
|
4642
|
+
Math.max(f.z, n)
|
|
4643
|
+
);
|
|
4644
|
+
const x = new Ct(f.x, f.y, f.z);
|
|
4645
|
+
x.translate(g.x, g.y, g.z), x.computeBoundingBox();
|
|
4646
|
+
const w = new z(x, this.pickBoxMaterial);
|
|
4647
|
+
w.name = c, w.url = o.url, w.castShadow = !1, w.receiveShadow = !1, w.userData.excludeFromAmbientOcclusion = !0, w.userData.__pickBox = !0, r.add(w), Array.isArray(a.infos) || (a.infos = a.info != null ? [a.info] : []), a.infos.push({
|
|
4648
|
+
id: c,
|
|
4649
|
+
name: h,
|
|
4650
|
+
mesh: w,
|
|
4651
|
+
isPickBox: !0
|
|
4652
|
+
}), a.pickBoxMesh = w, s += 1;
|
|
4653
|
+
});
|
|
4654
|
+
}), s;
|
|
4655
|
+
}
|
|
4656
|
+
/** 合并节点已有的本地包围盒,作为拾取 Box 的位置和尺寸来源。 */
|
|
4657
|
+
getNodeLocalBox(e) {
|
|
4658
|
+
const t = [
|
|
4659
|
+
e?.box,
|
|
4660
|
+
e?.info?.box,
|
|
4661
|
+
...Array.isArray(e?.infos) ? e.infos.map((n) => n?.box) : []
|
|
4662
|
+
].filter((n) => n instanceof R && !n.isEmpty());
|
|
4663
|
+
if (t.length === 0)
|
|
4664
|
+
return null;
|
|
4665
|
+
const i = t[0].clone();
|
|
4666
|
+
return t.slice(1).forEach((n) => i.union(n)), i;
|
|
4667
|
+
}
|
|
4608
4668
|
// ***************************************************** 模型高亮 ***************************************************** //
|
|
4609
4669
|
// 拆分网格
|
|
4610
4670
|
split_merge_model(e) {
|
|
@@ -4680,7 +4740,7 @@ class ma {
|
|
|
4680
4740
|
rebatchSplitModels() {
|
|
4681
4741
|
if (!this.engine?.scene)
|
|
4682
4742
|
return;
|
|
4683
|
-
|
|
4743
|
+
Pt(this.engine, (t) => t instanceof z && !(t instanceof W) && t.isSplit === !0).forEach((t) => {
|
|
4684
4744
|
this.rebuildSplitModelGroups(t), this.un_split_merge_model(t);
|
|
4685
4745
|
}), this.rebuildCustomInstanceColorBatches();
|
|
4686
4746
|
}
|
|
@@ -4705,13 +4765,13 @@ class ma {
|
|
|
4705
4765
|
restoreSplitModelsOnIdle() {
|
|
4706
4766
|
if (!this.engine?.scene)
|
|
4707
4767
|
return;
|
|
4708
|
-
|
|
4709
|
-
t instanceof
|
|
4768
|
+
Pt(this.engine, (t) => t instanceof z && !(t instanceof W)).forEach((t) => {
|
|
4769
|
+
t instanceof z && (t.isSplit === !0 && (t.visible = !this.areAllGroupsHidden(t)), t.isSplit === !0 && this.un_split_merge_model(t));
|
|
4710
4770
|
});
|
|
4711
4771
|
}
|
|
4712
4772
|
// 获取场景中的所有模型
|
|
4713
4773
|
getSceneModel(e) {
|
|
4714
|
-
return
|
|
4774
|
+
return Le(this.engine, e);
|
|
4715
4775
|
}
|
|
4716
4776
|
/** 炸开模式下,原模型状态变化后需要同步到代理构件,保证交互语义一致。 */
|
|
4717
4777
|
syncExplodeVisualState() {
|
|
@@ -4721,7 +4781,7 @@ class ma {
|
|
|
4721
4781
|
getModelCenter(e = this.engine.engineStatus.highlightModels ?? []) {
|
|
4722
4782
|
if (!Array.isArray(e) || e.length === 0)
|
|
4723
4783
|
return null;
|
|
4724
|
-
const t = new
|
|
4784
|
+
const t = new R();
|
|
4725
4785
|
let i = !1;
|
|
4726
4786
|
return e.forEach((n) => {
|
|
4727
4787
|
if (n?.url == null || !Array.isArray(n.ids))
|
|
@@ -4729,7 +4789,7 @@ class ma {
|
|
|
4729
4789
|
const s = this.getEngineModelByUrl(n.url);
|
|
4730
4790
|
if (s?.nodesMap == null)
|
|
4731
4791
|
return;
|
|
4732
|
-
const o =
|
|
4792
|
+
const o = ze(this.engine, n.url);
|
|
4733
4793
|
n.ids.forEach((r) => {
|
|
4734
4794
|
const a = s.nodesMap.get(r);
|
|
4735
4795
|
[
|
|
@@ -4737,7 +4797,7 @@ class ma {
|
|
|
4737
4797
|
a?.info?.box,
|
|
4738
4798
|
a?.box
|
|
4739
4799
|
].forEach((h) => {
|
|
4740
|
-
!(h instanceof
|
|
4800
|
+
!(h instanceof R) || h.isEmpty() || (i ? t.union(h.clone().applyMatrix4(o)) : (t.copy(h).applyMatrix4(o), i = !0));
|
|
4741
4801
|
});
|
|
4742
4802
|
});
|
|
4743
4803
|
}), i ? t.getCenter(new d()) : null;
|
|
@@ -4904,7 +4964,7 @@ class ma {
|
|
|
4904
4964
|
/** 设置构件自定义颜色,入参与高亮接口一致:[{ url, ids }],同时兼容旧的直接 Mesh 入参。 */
|
|
4905
4965
|
setModelColor(e, t = 16777215, i = 1) {
|
|
4906
4966
|
const n = this.normalizeOpacity(i);
|
|
4907
|
-
if (e instanceof
|
|
4967
|
+
if (e instanceof z && !(e instanceof W)) {
|
|
4908
4968
|
e.material?.color != null && (e.material.color.set(t), this.clearMaterialTextures(e.material), e.material.transparent = n < 1, e.material.opacity = n, e.material.needsUpdate = !0);
|
|
4909
4969
|
return;
|
|
4910
4970
|
}
|
|
@@ -4917,7 +4977,7 @@ class ma {
|
|
|
4917
4977
|
let c = r.nodesMap.get(a);
|
|
4918
4978
|
c == null || c.indexes == null || c.indexes.forEach((h) => {
|
|
4919
4979
|
const u = this.getSceneModel(h[0]);
|
|
4920
|
-
u instanceof W ? this.setInstanceModelColor(o.url, a, u, h[0], h[1], s, n) : u instanceof
|
|
4980
|
+
u instanceof W ? this.setInstanceModelColor(o.url, a, u, h[0], h[1], s, n) : u instanceof z && this.setSimpleModelColor(o.url, a, u, h[1], s, n);
|
|
4921
4981
|
});
|
|
4922
4982
|
});
|
|
4923
4983
|
}), this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
@@ -4936,7 +4996,7 @@ class ma {
|
|
|
4936
4996
|
if (r == null || !r.has(String(o?.id)))
|
|
4937
4997
|
return;
|
|
4938
4998
|
const a = this.getSceneModel(o.meshIndex);
|
|
4939
|
-
o.type === "instance" && a instanceof W ? this.restoreInstanceColorRecord(a, o) : o.type === "mesh" && a instanceof
|
|
4999
|
+
o.type === "instance" && a instanceof W ? this.restoreInstanceColorRecord(a, o) : o.type === "mesh" && a instanceof z && this.restoreSimpleColorRecord(a, o), this.customModelColorRecords.delete(s);
|
|
4940
5000
|
}), this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
4941
5001
|
}
|
|
4942
5002
|
// 设置所有模型颜色
|
|
@@ -4958,7 +5018,7 @@ class ma {
|
|
|
4958
5018
|
if (t == null)
|
|
4959
5019
|
return;
|
|
4960
5020
|
const i = this.getSceneModel(t.meshIndex);
|
|
4961
|
-
t.type === "instance" && i instanceof W ? this.restoreInstanceColorRecord(i, t) : t.type === "mesh" && i instanceof
|
|
5021
|
+
t.type === "instance" && i instanceof W ? this.restoreInstanceColorRecord(i, t) : t.type === "mesh" && i instanceof z && this.restoreSimpleColorRecord(i, t), this.customModelColorRecords.delete(e);
|
|
4962
5022
|
}), this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
4963
5023
|
}
|
|
4964
5024
|
/** 获取所有通过 setModelColor/setAllModelsColor 改过颜色的构件,返回 [{url, ids}]。 */
|
|
@@ -5082,7 +5142,7 @@ class ma {
|
|
|
5082
5142
|
if (typeof s == "number" && Array.isArray(e.material) && e.material[s] != null)
|
|
5083
5143
|
return s;
|
|
5084
5144
|
typeof s == "number" && e.__customColorMaterialIndexes.delete(n), Array.isArray(e.material) || (e.material = [e.material]);
|
|
5085
|
-
const o = Array.isArray(e.material) ? e.material[0] : e.material, r = typeof o?.clone == "function" ? o.clone() : new
|
|
5145
|
+
const o = Array.isArray(e.material) ? e.material[0] : e.material, r = typeof o?.clone == "function" ? o.clone() : new oe();
|
|
5086
5146
|
r.color != null && r.color.copy(t), this.clearMaterialTextures(r), r.transparent = i < 1, r.opacity = i, r.depthWrite = i >= 1, r.clippingPlanes = this.engine.sectionPlane, r.needsUpdate = !0, e.material.push(r);
|
|
5087
5147
|
const a = e.material.length - 1;
|
|
5088
5148
|
return e.__customColorMaterialIndexes.set(n, a), a;
|
|
@@ -5131,12 +5191,12 @@ class ma {
|
|
|
5131
5191
|
}
|
|
5132
5192
|
/** 创建同一颜色状态下的 InstancedMesh 批次。 */
|
|
5133
5193
|
createCustomInstanceBatch(e, t, i, n, s) {
|
|
5134
|
-
const o = new
|
|
5194
|
+
const o = new oe({
|
|
5135
5195
|
color: n,
|
|
5136
5196
|
transparent: s < 1,
|
|
5137
5197
|
opacity: s,
|
|
5138
5198
|
depthWrite: s >= 1,
|
|
5139
|
-
side:
|
|
5199
|
+
side: re
|
|
5140
5200
|
});
|
|
5141
5201
|
this.clearMaterialTextures(o), o.clippingPlanes = this.engine.sectionPlane, o.needsUpdate = !0;
|
|
5142
5202
|
const r = new W(e.geometry, o, i.length);
|
|
@@ -5257,10 +5317,10 @@ class ma {
|
|
|
5257
5317
|
}
|
|
5258
5318
|
function ga(l, e) {
|
|
5259
5319
|
l.forEach((t, i) => {
|
|
5260
|
-
const n =
|
|
5320
|
+
const n = kt(e, i);
|
|
5261
5321
|
if (!(n instanceof W))
|
|
5262
5322
|
return;
|
|
5263
|
-
const s = n.geometry, o = new
|
|
5323
|
+
const s = n.geometry, o = new oe({
|
|
5264
5324
|
color: 43775,
|
|
5265
5325
|
// 明显的蓝色
|
|
5266
5326
|
depthTest: !1,
|
|
@@ -5271,7 +5331,7 @@ function ga(l, e) {
|
|
|
5271
5331
|
// 启用透明
|
|
5272
5332
|
opacity: 0.5,
|
|
5273
5333
|
// 半透明效果
|
|
5274
|
-
side:
|
|
5334
|
+
side: re
|
|
5275
5335
|
// 双面渲染
|
|
5276
5336
|
});
|
|
5277
5337
|
o.clippingPlanes = e.sectionPlane;
|
|
@@ -5281,8 +5341,8 @@ function ga(l, e) {
|
|
|
5281
5341
|
});
|
|
5282
5342
|
const a = /* @__PURE__ */ new Map(), c = new V(), h = new V();
|
|
5283
5343
|
h.makeScale(0, 0, 0), t.forEach((u, p) => {
|
|
5284
|
-
const g =
|
|
5285
|
-
|
|
5344
|
+
const g = _t(e, i, u);
|
|
5345
|
+
Dt(g, !1);
|
|
5286
5346
|
const f = g?.matrix ?? n.matrixs?.[u] ?? n.matrixsClone?.[u];
|
|
5287
5347
|
f instanceof V ? c.copy(f) : n.getMatrixAt(u, c), a.set(u, c.clone()), n.setMatrixAt(u, h), r.setMatrixAt(p, c);
|
|
5288
5348
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
@@ -5290,13 +5350,13 @@ function ga(l, e) {
|
|
|
5290
5350
|
}
|
|
5291
5351
|
function vn(l, e, t) {
|
|
5292
5352
|
l.forEach((i, n) => {
|
|
5293
|
-
const s =
|
|
5353
|
+
const s = kt(e, n);
|
|
5294
5354
|
if (!(s instanceof W))
|
|
5295
5355
|
return;
|
|
5296
5356
|
i.forEach((r) => {
|
|
5297
|
-
const a =
|
|
5357
|
+
const a = _t(e, n, r);
|
|
5298
5358
|
if (a != null) {
|
|
5299
|
-
s.setMatrixAt(r, new V().makeScale(0, 0, 0)),
|
|
5359
|
+
s.setMatrixAt(r, new V().makeScale(0, 0, 0)), Dt(a, !0);
|
|
5300
5360
|
return;
|
|
5301
5361
|
}
|
|
5302
5362
|
const c = s.matrixsClone[r];
|
|
@@ -5312,17 +5372,17 @@ function vn(l, e, t) {
|
|
|
5312
5372
|
}
|
|
5313
5373
|
function fa(l, e, t = 0.05) {
|
|
5314
5374
|
l.forEach((i, n) => {
|
|
5315
|
-
const s =
|
|
5375
|
+
const s = kt(e, n);
|
|
5316
5376
|
if (!(s instanceof W))
|
|
5317
5377
|
return;
|
|
5318
|
-
const o = s.geometry, r = new
|
|
5378
|
+
const o = s.geometry, r = new oe({
|
|
5319
5379
|
color: 16777215,
|
|
5320
5380
|
// 明显的蓝色
|
|
5321
5381
|
transparent: !0,
|
|
5322
5382
|
// 启用透明
|
|
5323
5383
|
opacity: t,
|
|
5324
5384
|
// 半透明效果
|
|
5325
|
-
side:
|
|
5385
|
+
side: re
|
|
5326
5386
|
// 双面渲染
|
|
5327
5387
|
});
|
|
5328
5388
|
r.clippingPlanes = e.sectionPlane;
|
|
@@ -5330,8 +5390,8 @@ function fa(l, e, t = 0.05) {
|
|
|
5330
5390
|
a.name = "translucentModel", a.key = n;
|
|
5331
5391
|
const c = /* @__PURE__ */ new Map(), h = new V(), u = new V();
|
|
5332
5392
|
u.makeScale(0, 0, 0), i.forEach((p, g) => {
|
|
5333
|
-
const f =
|
|
5334
|
-
|
|
5393
|
+
const f = _t(e, n, p);
|
|
5394
|
+
Dt(f, !1);
|
|
5335
5395
|
const x = f?.matrix ?? s.matrixs?.[p] ?? s.matrixsClone?.[p];
|
|
5336
5396
|
x instanceof V ? h.copy(x) : s.getMatrixAt(p, h), c.set(p, h.clone()), s.setMatrixAt(p, u), a.setMatrixAt(g, h);
|
|
5337
5397
|
}), s.instanceMatrix.needsUpdate = !0, a.instanceMatrix.needsUpdate = !0, (s.parent ?? e.scene).add(a);
|
|
@@ -5344,13 +5404,13 @@ function ya(l, e) {
|
|
|
5344
5404
|
}), t.forEach((i) => {
|
|
5345
5405
|
us(i);
|
|
5346
5406
|
}), l.forEach((i, n) => {
|
|
5347
|
-
const s =
|
|
5407
|
+
const s = kt(e, n);
|
|
5348
5408
|
if (!(s instanceof W))
|
|
5349
5409
|
return;
|
|
5350
5410
|
const o = /* @__PURE__ */ new Map(), r = new V(), a = new V();
|
|
5351
5411
|
a.makeScale(0, 0, 0), i.forEach((c) => {
|
|
5352
|
-
const h =
|
|
5353
|
-
|
|
5412
|
+
const h = _t(e, n, c);
|
|
5413
|
+
Dt(h, !1);
|
|
5354
5414
|
const u = h?.matrix ?? s.matrixs?.[c] ?? s.matrixsClone?.[c];
|
|
5355
5415
|
u instanceof V ? r.copy(u) : s.getMatrixAt(c, r), o.set(c, r.clone()), s.setMatrixAt(c, a);
|
|
5356
5416
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
@@ -5358,11 +5418,11 @@ function ya(l, e) {
|
|
|
5358
5418
|
}
|
|
5359
5419
|
function xn(l, e) {
|
|
5360
5420
|
l.forEach((t, i) => {
|
|
5361
|
-
const n =
|
|
5421
|
+
const n = kt(e, i);
|
|
5362
5422
|
n instanceof W && (t.forEach((s) => {
|
|
5363
|
-
const o =
|
|
5423
|
+
const o = _t(e, i, s);
|
|
5364
5424
|
if (o != null) {
|
|
5365
|
-
n.setMatrixAt(s, new V().makeScale(0, 0, 0)),
|
|
5425
|
+
n.setMatrixAt(s, new V().makeScale(0, 0, 0)), Dt(o, !0);
|
|
5366
5426
|
return;
|
|
5367
5427
|
}
|
|
5368
5428
|
const r = n.matrixs[s];
|
|
@@ -5370,11 +5430,11 @@ function xn(l, e) {
|
|
|
5370
5430
|
}), n.instanceMatrix.needsUpdate = !0);
|
|
5371
5431
|
});
|
|
5372
5432
|
}
|
|
5373
|
-
function
|
|
5433
|
+
function _t(l, e, t) {
|
|
5374
5434
|
const i = l?.modelToolModule?.customModelColorRecords;
|
|
5375
5435
|
return i instanceof Map ? Array.from(i.values()).find((n) => n?.type === "instance" && n.meshIndex === e && n.instanceIndex === t) ?? null : null;
|
|
5376
5436
|
}
|
|
5377
|
-
function
|
|
5437
|
+
function Dt(l, e) {
|
|
5378
5438
|
l?.cloneModel != null && (l.cloneModel.visible = e);
|
|
5379
5439
|
}
|
|
5380
5440
|
function us(l) {
|
|
@@ -5383,8 +5443,8 @@ function us(l) {
|
|
|
5383
5443
|
const e = l.parent;
|
|
5384
5444
|
e?.remove(l), l.material?.dispose != null && l.material.dispose();
|
|
5385
5445
|
}
|
|
5386
|
-
function
|
|
5387
|
-
return
|
|
5446
|
+
function kt(l, e) {
|
|
5447
|
+
return Le(l, e);
|
|
5388
5448
|
}
|
|
5389
5449
|
const ps = "advanced";
|
|
5390
5450
|
class Ma {
|
|
@@ -5607,7 +5667,7 @@ class Jt {
|
|
|
5607
5667
|
this.tagDiv ? (this.tagDiv.style.left = o.x + 10 + this.engine.reactBoundingClientRect.left + "px", this.tagDiv.style.top = o.y - 10 + this.engine.reactBoundingClientRect.top + "px", this.tagDiv.style.display = "block") : this.tagDiv && (this.tagDiv.style.display = "none");
|
|
5608
5668
|
}
|
|
5609
5669
|
init() {
|
|
5610
|
-
this.overlayMaterial = new
|
|
5670
|
+
this.overlayMaterial = new oe({
|
|
5611
5671
|
color: 16777215,
|
|
5612
5672
|
transparent: !0,
|
|
5613
5673
|
opacity: 0,
|
|
@@ -5632,7 +5692,7 @@ class Jt {
|
|
|
5632
5692
|
for (const s of n) {
|
|
5633
5693
|
let o = s.geometry.clone();
|
|
5634
5694
|
o.computeVertexNormals();
|
|
5635
|
-
const r = new
|
|
5695
|
+
const r = new z(o, this.overlayMaterial);
|
|
5636
5696
|
s.updateWorldMatrix(!0, !1), r.matrix.copy(s.matrixWorld), r.matrixAutoUpdate = !1, this.engine.scene.add(r), this.overlayMeshes.push(r);
|
|
5637
5697
|
}
|
|
5638
5698
|
this.animState = "fadeIn", this.animStartTime = performance.now(), this.setAnimationFrameRateExempt(!0);
|
|
@@ -5704,15 +5764,15 @@ function wa(l, e, t) {
|
|
|
5704
5764
|
const y = i.sceneOrtho?.renderer;
|
|
5705
5765
|
if (!y || !i.camera)
|
|
5706
5766
|
return;
|
|
5707
|
-
const { width: M, height:
|
|
5708
|
-
if (_.x !== M || _.y !==
|
|
5709
|
-
y.setSize(M,
|
|
5710
|
-
const D = M >
|
|
5767
|
+
const { width: M, height: E } = h(), _ = y.getSize(new G());
|
|
5768
|
+
if (_.x !== M || _.y !== E) {
|
|
5769
|
+
y.setSize(M, E);
|
|
5770
|
+
const D = M > E ? M / E : E / M, T = 300;
|
|
5711
5771
|
i.camera.left = T * D / -2, i.camera.right = T * D / 2, i.camera.top = T / 2, i.camera.bottom = T / -2, i.camera.updateProjectionMatrix();
|
|
5712
5772
|
}
|
|
5713
5773
|
}
|
|
5714
5774
|
i.init = function() {
|
|
5715
|
-
o || (B(), k(), i.ready =
|
|
5775
|
+
o || (B(), k(), i.ready = le());
|
|
5716
5776
|
}, i.Hide = function() {
|
|
5717
5777
|
o.style.display = "none", i.visible = !1;
|
|
5718
5778
|
}, i.Show = function() {
|
|
@@ -5727,8 +5787,8 @@ function wa(l, e, t) {
|
|
|
5727
5787
|
function f() {
|
|
5728
5788
|
s <= 0 || (s -= 1, !(s > 0) && (l.renderer && (l.renderer.interactionActive = !1), l.setIdleFrameRateExempt?.("view-cube-animation", !1), l.events?.trigger?.("engine-free"), t?.style && (t.style.cursor = "default")));
|
|
5729
5789
|
}
|
|
5730
|
-
function x(y, M,
|
|
5731
|
-
!
|
|
5790
|
+
function x(y, M, E) {
|
|
5791
|
+
!E || !y || (y.up.copy(E), M && (M._referenceUp?.copy && M._referenceUp.copy(E).normalize(), M.up0?.copy && M.up0.copy(E), M._lastUp?.copy && M._lastUp.copy(E)));
|
|
5732
5792
|
}
|
|
5733
5793
|
function w(y) {
|
|
5734
5794
|
x(e.camera, l.controls, y);
|
|
@@ -5746,18 +5806,18 @@ function wa(l, e, t) {
|
|
|
5746
5806
|
const y = new d(0, 0, 1).applyQuaternion(e.camera.quaternion);
|
|
5747
5807
|
i.camera.position.copy(y.multiplyScalar(100)), b(i.orbitControls, l.controls);
|
|
5748
5808
|
}
|
|
5749
|
-
function
|
|
5809
|
+
function S() {
|
|
5750
5810
|
!i.camera || !e.camera || (e.camera.quaternion.copy(i.camera.quaternion), e.camera.up.copy(i.camera.up), b(l.controls, i.orbitControls));
|
|
5751
5811
|
}
|
|
5752
5812
|
function P(y, M) {
|
|
5753
5813
|
if (!y || !M)
|
|
5754
5814
|
return;
|
|
5755
|
-
const
|
|
5815
|
+
const E = M.target, _ = E?.clone?.().sub(y.position), D = y.up.clone().normalize();
|
|
5756
5816
|
if (M._referenceUp?.copy && M._referenceUp.copy(D), _?.lengthSq?.() > 1e-6 && M._viewRight?.copy) {
|
|
5757
5817
|
const T = new d().crossVectors(_.clone().normalize(), D);
|
|
5758
5818
|
T.lengthSq() > 1e-6 ? M._viewRight.copy(T.normalize()) : M._viewRight.set(1, 0, 0).applyQuaternion(y.quaternion).normalize();
|
|
5759
5819
|
}
|
|
5760
|
-
M._rotateVelocity?.set?.(0, 0), M._panVelocity?.set?.(0, 0), typeof M._zoomVelocity == "number" && (M._zoomVelocity = 0), M._mouseStart?.set?.(0, 0), M._touchCenter?.set?.(0, 0), typeof M._touchDistance == "number" && (M._touchDistance = 0), M._pointers?.clear?.(), M._isInteracting = !1, M.state = -1, M._lastPosition?.copy?.(y.position), M._lastTarget?.copy?.(
|
|
5820
|
+
M._rotateVelocity?.set?.(0, 0), M._panVelocity?.set?.(0, 0), typeof M._zoomVelocity == "number" && (M._zoomVelocity = 0), M._mouseStart?.set?.(0, 0), M._touchCenter?.set?.(0, 0), typeof M._touchDistance == "number" && (M._touchDistance = 0), M._pointers?.clear?.(), M._isInteracting = !1, M.state = -1, M._lastPosition?.copy?.(y.position), M._lastTarget?.copy?.(E), M._lastUp?.copy?.(y.up), M._lastQuaternion?.copy?.(y.quaternion), typeof M._lastZoom == "number" && (M._lastZoom = y.zoom), M.saveState?.();
|
|
5761
5821
|
}
|
|
5762
5822
|
i.RenderScene = function() {
|
|
5763
5823
|
if (u(), O)
|
|
@@ -5770,20 +5830,20 @@ function wa(l, e, t) {
|
|
|
5770
5830
|
i.sceneOrtho.renderer.render(i.sceneOrtho, i.camera);
|
|
5771
5831
|
}, i.ToggleDirectionView = function(y) {
|
|
5772
5832
|
p();
|
|
5773
|
-
var M = new d(0, 0, 0),
|
|
5774
|
-
y == "top" ? (M = new d(0, 1, 0),
|
|
5833
|
+
var M = new d(0, 0, 0), E = null;
|
|
5834
|
+
y == "top" ? (M = new d(0, 1, 0), E = new d(0, 0, -1)) : y == "down" || y == "button" ? (M = new d(0, -1, 0), E = new d(0, 0, 1)) : y == "front" ? M = new d(0, 0, 1) : y == "left" ? M = new d(-1, 0, 0) : y == "back" ? M = new d(0, 0, -1) : y == "right" ? M = new d(1, 0, 0) : y == "top_front" ? M = new d(1, 1, 0) : y == "top_left" ? M = new d(0, 1, -1) : y == "top_back" ? M = new d(-1, 1, 0) : y == "top_right" ? M = new d(0, 1, 1) : y == "down_front" ? M = new d(1, -1, 0) : y == "down_left" ? M = new d(0, -1, -1) : y == "down_back" ? M = new d(-1, -1, 0) : y == "down_right" ? M = new d(0, -1, 1) : y == "front_right" ? M = new d(1, 0, 1) : y == "right_back" ? M = new d(-1, 0, 1) : y == "back_left" ? M = new d(-1, 0, -1) : y == "left_front" ? M = new d(1, 0, -1) : y == "top_left_front" ? M = new d(1, 1, -1) : y == "top_front_right" ? M = new d(1, 1, 1) : y == "top_right_back" ? M = new d(-1, 1, 1) : y == "top_back_left" ? M = new d(-1, 1, -1) : y == "button_left_front" ? M = new d(1, -1, -1) : y == "button_front_right" ? M = new d(1, -1, 1) : y == "button_right_back" ? M = new d(-1, 1, 1) : y == "button_back_left" && (M = new d(-1, -1, -1));
|
|
5775
5835
|
var _ = l.octreeBox.getBoundingBox(), D = _.min, T = _.max, N = D.clone().add(T.clone()).multiplyScalar(0.5), H = N.clone().add(M.multiplyScalar(1 * T.distanceTo(D)));
|
|
5776
|
-
I(e.camera.position, H, l.controls.target.clone(), N, null, null, 1e3, null,
|
|
5836
|
+
I(e.camera.position, H, l.controls.target.clone(), N, null, null, 1e3, null, E);
|
|
5777
5837
|
}, i.GetCameraPose = function() {
|
|
5778
|
-
var y = e.camera.quaternion, M = e.camera.position,
|
|
5838
|
+
var y = e.camera.quaternion, M = e.camera.position, E = l.controls.target, _ = {
|
|
5779
5839
|
quaternion: y,
|
|
5780
5840
|
position: M,
|
|
5781
|
-
target:
|
|
5841
|
+
target: E
|
|
5782
5842
|
};
|
|
5783
5843
|
return _;
|
|
5784
|
-
}, i.ReductionCameraPose = function(y, M = 1e3,
|
|
5844
|
+
}, i.ReductionCameraPose = function(y, M = 1e3, E) {
|
|
5785
5845
|
p();
|
|
5786
|
-
var _ = new
|
|
5846
|
+
var _ = new Se(
|
|
5787
5847
|
y.quaternion._x,
|
|
5788
5848
|
y.quaternion._y,
|
|
5789
5849
|
y.quaternion._z,
|
|
@@ -5799,18 +5859,18 @@ function wa(l, e, t) {
|
|
|
5799
5859
|
_,
|
|
5800
5860
|
M,
|
|
5801
5861
|
(H) => {
|
|
5802
|
-
|
|
5862
|
+
E && (N || (E(H), N = !0));
|
|
5803
5863
|
}
|
|
5804
|
-
),
|
|
5805
|
-
N || (
|
|
5864
|
+
), E && setTimeout(() => {
|
|
5865
|
+
N || (E(!0), N = !0);
|
|
5806
5866
|
}, M + 10);
|
|
5807
5867
|
}, i.CameraGoHome = function(y = 1e3) {
|
|
5808
5868
|
p();
|
|
5809
5869
|
const M = new d(0, 1, 0);
|
|
5810
5870
|
w(M), m(M);
|
|
5811
|
-
var
|
|
5871
|
+
var E = l.octreeBox.getBoundingBox(), _ = l.clipping?.getClippedBoundingBox?.(E), D = _ && !_.isEmpty() ? _ : E, T = D.min.clone().add(D.max.clone()).multiplyScalar(0.5);
|
|
5812
5872
|
let N = new d(1, 1, 1);
|
|
5813
|
-
var H =
|
|
5873
|
+
var H = E.max.distanceTo(E.min), K = Math.max(H / 1e5, 0.01), $ = D.max.distanceTo(D.min), v = T.clone().add(N.multiplyScalar($ * 0.8));
|
|
5814
5874
|
if (e.camera.isOrthographicCamera) {
|
|
5815
5875
|
var A = l.container.clientWidth / l.container.clientHeight, L = $ * 0.5;
|
|
5816
5876
|
e.camera.left = -L * A, e.camera.right = L * A, e.camera.top = L, e.camera.bottom = -L, e.camera.zoom = 1, e.camera.near = K, e.camera.far = H * 3, e.camera.updateProjectionMatrix();
|
|
@@ -5831,9 +5891,9 @@ function wa(l, e, t) {
|
|
|
5831
5891
|
}, i.zoomToBox = function(y, M = 1e3) {
|
|
5832
5892
|
if (p(), e.camera.isOrthographicCamera) {
|
|
5833
5893
|
let ti = function() {
|
|
5834
|
-
n = requestAnimationFrame(ti),
|
|
5894
|
+
n = requestAnimationFrame(ti), Fe.update();
|
|
5835
5895
|
};
|
|
5836
|
-
var
|
|
5896
|
+
var E = y.min.clone().add(y.max.clone()).multiplyScalar(0.5), _ = e.camera.position.clone().sub(l.controls.target.clone()).normalize(), D = e.camera.position.distanceTo(l.controls.target), T = E.clone().add(_.multiplyScalar(D)), N = e.camera.zoom, H = new d(1, 0, 0).applyQuaternion(e.camera.quaternion), K = new d(0, 1, 0).applyQuaternion(e.camera.quaternion), $ = [
|
|
5837
5897
|
new d(y.min.x, y.min.y, y.min.z),
|
|
5838
5898
|
new d(y.max.x, y.min.y, y.min.z),
|
|
5839
5899
|
new d(y.min.x, y.max.y, y.min.z),
|
|
@@ -5847,42 +5907,42 @@ function wa(l, e, t) {
|
|
|
5847
5907
|
var we = j.dot(H), ve = j.dot(K);
|
|
5848
5908
|
v = Math.min(v, we), A = Math.max(A, we), L = Math.min(L, ve), U = Math.max(U, ve);
|
|
5849
5909
|
}
|
|
5850
|
-
var De = (A - v) / 2,
|
|
5851
|
-
N = Math.min(be / De,
|
|
5852
|
-
var
|
|
5853
|
-
x1:
|
|
5854
|
-
y1:
|
|
5855
|
-
z1:
|
|
5910
|
+
var De = (A - v) / 2, nt = (U - L) / 2, be = (e.camera.right - e.camera.left) / 2, Re = (e.camera.top - e.camera.bottom) / 2;
|
|
5911
|
+
N = Math.min(be / De, Re / nt) * 0.75;
|
|
5912
|
+
var Oe = e.camera.position.clone(), xe = l.controls.target.clone(), st = e.camera.zoom, Fe = new $e.Tween({
|
|
5913
|
+
x1: Oe.x,
|
|
5914
|
+
y1: Oe.y,
|
|
5915
|
+
z1: Oe.z,
|
|
5856
5916
|
x2: xe.x,
|
|
5857
5917
|
y2: xe.y,
|
|
5858
5918
|
z2: xe.z,
|
|
5859
|
-
zoom:
|
|
5919
|
+
zoom: st
|
|
5860
5920
|
}).to({
|
|
5861
5921
|
x1: T.x,
|
|
5862
5922
|
y1: T.y,
|
|
5863
5923
|
z1: T.z,
|
|
5864
|
-
x2:
|
|
5865
|
-
y2:
|
|
5866
|
-
z2:
|
|
5924
|
+
x2: E.x,
|
|
5925
|
+
y2: E.y,
|
|
5926
|
+
z2: E.z,
|
|
5867
5927
|
zoom: N
|
|
5868
5928
|
}, M);
|
|
5869
|
-
|
|
5929
|
+
Fe.onUpdate(function(We) {
|
|
5870
5930
|
l.controls && (e.camera.position.set(We.x1, We.y1, We.z1), l.controls.target.set(We.x2, We.y2, We.z2), e.camera.isOrthographicCamera && (e.camera.zoom = We.zoom, e.camera.updateProjectionMatrix()), l.controls.auto = !0, l.controls.update(), i.RenderScene());
|
|
5871
|
-
}),
|
|
5931
|
+
}), Fe.onComplete(function() {
|
|
5872
5932
|
if (!l.controls) {
|
|
5873
5933
|
f();
|
|
5874
5934
|
return;
|
|
5875
5935
|
}
|
|
5876
5936
|
l.controls.auto = !1, i.RenderScene(), cancelAnimationFrame(n), n = null, f();
|
|
5877
|
-
}),
|
|
5937
|
+
}), Fe.easing($e.Easing.Cubic.InOut), g(), Fe.start(), ti();
|
|
5878
5938
|
} else {
|
|
5879
|
-
var
|
|
5880
|
-
let
|
|
5881
|
-
var T =
|
|
5882
|
-
I(e.camera.position, T, l.controls.target.clone(),
|
|
5939
|
+
var E = y.min.clone().add(y.max.clone()).multiplyScalar(0.5);
|
|
5940
|
+
let Es = e.camera.position.clone().sub(l.controls.target.clone()).normalize();
|
|
5941
|
+
var T = E.clone().add(Es.multiplyScalar(2 * y.max.distanceTo(y.min)));
|
|
5942
|
+
I(e.camera.position, T, l.controls.target.clone(), E, null, null, M);
|
|
5883
5943
|
}
|
|
5884
5944
|
};
|
|
5885
|
-
function I(y, M,
|
|
5945
|
+
function I(y, M, E, _, D, T, N = 1e3, H, K) {
|
|
5886
5946
|
var $;
|
|
5887
5947
|
D && T ? ($ = new $e.Tween({
|
|
5888
5948
|
x1: y.x,
|
|
@@ -5891,11 +5951,11 @@ function wa(l, e, t) {
|
|
|
5891
5951
|
// 相机当前位置y
|
|
5892
5952
|
z1: y.z,
|
|
5893
5953
|
// 相机当前位置z
|
|
5894
|
-
x2:
|
|
5954
|
+
x2: E.x,
|
|
5895
5955
|
// 控制当前的中心点x
|
|
5896
|
-
y2:
|
|
5956
|
+
y2: E.y,
|
|
5897
5957
|
// 控制当前的中心点y
|
|
5898
|
-
z2:
|
|
5958
|
+
z2: E.z,
|
|
5899
5959
|
// 控制当前的中心点z
|
|
5900
5960
|
_x: D._x,
|
|
5901
5961
|
// 相机当前quaternion
|
|
@@ -5936,11 +5996,11 @@ function wa(l, e, t) {
|
|
|
5936
5996
|
// 相机当前位置y
|
|
5937
5997
|
z1: y.z,
|
|
5938
5998
|
// 相机当前位置z
|
|
5939
|
-
x2:
|
|
5999
|
+
x2: E.x,
|
|
5940
6000
|
// 控制当前的中心点x
|
|
5941
|
-
y2:
|
|
6001
|
+
y2: E.y,
|
|
5942
6002
|
// 控制当前的中心点y
|
|
5943
|
-
z2:
|
|
6003
|
+
z2: E.z
|
|
5944
6004
|
// 控制当前的中心点z
|
|
5945
6005
|
}), $.to(
|
|
5946
6006
|
{
|
|
@@ -5981,18 +6041,18 @@ function wa(l, e, t) {
|
|
|
5981
6041
|
y.className = "homeViewWrapper", y.style.backgroundImage = `url(${Qe.home})`, y.addEventListener("mousedown", function() {
|
|
5982
6042
|
l.viewCube.cameraGoHome(500);
|
|
5983
6043
|
}), o.appendChild(y), r.addEventListener("mousedown", function(_) {
|
|
5984
|
-
_.stopPropagation(), cameraToggle.classList.contains("show") ? (M(), console.log("隐藏功能按钮")) : (
|
|
6044
|
+
_.stopPropagation(), cameraToggle.classList.contains("show") ? (M(), console.log("隐藏功能按钮")) : (E(), console.log("显示功能按钮"));
|
|
5985
6045
|
});
|
|
5986
6046
|
function M() {
|
|
5987
6047
|
cameraToggle.classList.remove("show"), screenshot.classList.remove("show"), fullscreen.classList.remove("show");
|
|
5988
6048
|
}
|
|
5989
|
-
function
|
|
6049
|
+
function E() {
|
|
5990
6050
|
cameraToggle.classList.add("show"), screenshot.classList.add("show"), fullscreen.classList.add("show");
|
|
5991
6051
|
}
|
|
5992
6052
|
}
|
|
5993
6053
|
function k() {
|
|
5994
6054
|
i.sceneOrtho = va();
|
|
5995
|
-
var
|
|
6055
|
+
var E = t.clientWidth, _ = t.clientWidth, y = E > _ ? E / _ : _ / E, M = 300;
|
|
5996
6056
|
i.camera = new _e(
|
|
5997
6057
|
M * y / -2,
|
|
5998
6058
|
M * y / 2,
|
|
@@ -6001,11 +6061,11 @@ function wa(l, e, t) {
|
|
|
6001
6061
|
0.01,
|
|
6002
6062
|
1e4
|
|
6003
6063
|
);
|
|
6004
|
-
var
|
|
6064
|
+
var E = o.clientWidth, _ = o.clientHeight, D = new Ti({
|
|
6005
6065
|
alpha: !0
|
|
6006
6066
|
});
|
|
6007
|
-
D.setSize(
|
|
6008
|
-
let T = new
|
|
6067
|
+
D.setSize(E, _), D.setClearAlpha(0), i.sceneOrtho.renderer = D;
|
|
6068
|
+
let T = new jt(16777215, 0.8);
|
|
6009
6069
|
i.sceneOrtho.add(T), xa(o, D), i.orbitControls = new qn(l, 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", q), i.orbitControls.addEventListener("change", te), i.orbitControls.addEventListener("end", Q);
|
|
6010
6070
|
}
|
|
6011
6071
|
let O = !1;
|
|
@@ -6014,7 +6074,7 @@ function wa(l, e, t) {
|
|
|
6014
6074
|
}
|
|
6015
6075
|
function te() {
|
|
6016
6076
|
if (O) {
|
|
6017
|
-
if (e.camera.quaternion.copy(i.camera.quaternion),
|
|
6077
|
+
if (e.camera.quaternion.copy(i.camera.quaternion), S(), l.controls && i._mainTarget && i._mainDistance) {
|
|
6018
6078
|
const y = new d(0, 0, 1).applyQuaternion(e.camera.quaternion);
|
|
6019
6079
|
e.camera.position.copy(i._mainTarget.clone().add(y.multiplyScalar(i._mainDistance))), l.controls.update();
|
|
6020
6080
|
}
|
|
@@ -6027,13 +6087,13 @@ function wa(l, e, t) {
|
|
|
6027
6087
|
function ce(y) {
|
|
6028
6088
|
return y ? (y.colorSpace = je, y.needsUpdate = !0, y) : null;
|
|
6029
6089
|
}
|
|
6030
|
-
function
|
|
6031
|
-
const
|
|
6090
|
+
function ae(y, M) {
|
|
6091
|
+
const E = y.load(M, () => {
|
|
6032
6092
|
i.RenderScene();
|
|
6033
6093
|
});
|
|
6034
|
-
return ce(
|
|
6094
|
+
return ce(E);
|
|
6035
6095
|
}
|
|
6036
|
-
async function
|
|
6096
|
+
async function le() {
|
|
6037
6097
|
let y = [
|
|
6038
6098
|
{
|
|
6039
6099
|
label: "右",
|
|
@@ -6060,11 +6120,11 @@ function wa(l, e, t) {
|
|
|
6060
6120
|
icon: Qe.back
|
|
6061
6121
|
}
|
|
6062
6122
|
];
|
|
6063
|
-
const M = new Je(),
|
|
6123
|
+
const M = new Je(), E = y.map((T) => new oe({
|
|
6064
6124
|
color: 16777215,
|
|
6065
|
-
map:
|
|
6125
|
+
map: ae(M, T.icon)
|
|
6066
6126
|
}));
|
|
6067
|
-
var _ = new
|
|
6127
|
+
var _ = new z(new Ct(110, 110, 110), E);
|
|
6068
6128
|
i.sceneOrtho.add(_), ue(122), i.RenderScene();
|
|
6069
6129
|
let D = { x: 0, y: 0 };
|
|
6070
6130
|
o.addEventListener("mousedown", (T) => {
|
|
@@ -6091,7 +6151,7 @@ function wa(l, e, t) {
|
|
|
6091
6151
|
});
|
|
6092
6152
|
}
|
|
6093
6153
|
function ue(y) {
|
|
6094
|
-
for (var M = y * 0.5 - 20,
|
|
6154
|
+
for (var M = y * 0.5 - 20, E = [
|
|
6095
6155
|
{
|
|
6096
6156
|
name: "right",
|
|
6097
6157
|
a: 30,
|
|
@@ -6276,20 +6336,20 @@ function wa(l, e, t) {
|
|
|
6276
6336
|
c: 30,
|
|
6277
6337
|
point: new d(M, 0, -M)
|
|
6278
6338
|
}
|
|
6279
|
-
], T = 0; T <
|
|
6280
|
-
a.push(Ae(
|
|
6339
|
+
], T = 0; T < E.length; T++)
|
|
6340
|
+
a.push(Ae(E[T]));
|
|
6281
6341
|
for (var T = 0; T < _.length; T++)
|
|
6282
6342
|
a.push(Ae(_[T]));
|
|
6283
6343
|
for (var T = 0; T < D.length; T++)
|
|
6284
6344
|
a.push(Ae(D[T]));
|
|
6285
6345
|
}
|
|
6286
6346
|
function Ae(y) {
|
|
6287
|
-
const M = new
|
|
6347
|
+
const M = new Ct(y.a, y.b, y.c), E = new oe({
|
|
6288
6348
|
color: "blue",
|
|
6289
6349
|
transparent: !0,
|
|
6290
6350
|
opacity: 0.01
|
|
6291
6351
|
}), _ = new V().makeTranslation(y.point.x, y.point.y, y.point.z);
|
|
6292
|
-
let D = M.applyMatrix4(_), T = new
|
|
6352
|
+
let D = M.applyMatrix4(_), T = new z(D, E);
|
|
6293
6353
|
return T.name = y.name, i.sceneOrtho.add(T), T;
|
|
6294
6354
|
}
|
|
6295
6355
|
return i.ToggleCameraType = function() {
|
|
@@ -6301,8 +6361,8 @@ function wa(l, e, t) {
|
|
|
6301
6361
|
return;
|
|
6302
6362
|
}
|
|
6303
6363
|
l.renderer.render(e, e.camera);
|
|
6304
|
-
const M = l.renderer.domElement.toDataURL("image/png"),
|
|
6305
|
-
|
|
6364
|
+
const M = l.renderer.domElement.toDataURL("image/png"), E = document.createElement("a"), _ = (/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-");
|
|
6365
|
+
E.download = `screenshot_${_}.png`, E.href = M, E.click(), console.log("截图已保存");
|
|
6306
6366
|
} catch (y) {
|
|
6307
6367
|
console.error("截图失败:", y);
|
|
6308
6368
|
}
|
|
@@ -6361,7 +6421,7 @@ class ba {
|
|
|
6361
6421
|
flyToModels(e = this.engine.engineStatus.highlightModels ?? []) {
|
|
6362
6422
|
if (!Array.isArray(e) || e.length === 0)
|
|
6363
6423
|
return;
|
|
6364
|
-
const t = new
|
|
6424
|
+
const t = new R();
|
|
6365
6425
|
let i = !1;
|
|
6366
6426
|
e.forEach((n) => {
|
|
6367
6427
|
if (n?.url == null || !Array.isArray(n.ids))
|
|
@@ -6369,7 +6429,7 @@ class ba {
|
|
|
6369
6429
|
const s = this.engine.models?.find((r) => r.url === n.url);
|
|
6370
6430
|
if (s?.nodesMap == null)
|
|
6371
6431
|
return;
|
|
6372
|
-
const o =
|
|
6432
|
+
const o = ze(this.engine, n.url);
|
|
6373
6433
|
n.ids.forEach((r) => {
|
|
6374
6434
|
const a = s.nodesMap.get(r);
|
|
6375
6435
|
[
|
|
@@ -6377,7 +6437,7 @@ class ba {
|
|
|
6377
6437
|
a?.info?.box,
|
|
6378
6438
|
a?.box
|
|
6379
6439
|
].forEach((h) => {
|
|
6380
|
-
!(h instanceof
|
|
6440
|
+
!(h instanceof R) || h.isEmpty() || (i ? t.union(h.clone().applyMatrix4(o)) : (t.copy(h).applyMatrix4(o), i = !0));
|
|
6381
6441
|
});
|
|
6382
6442
|
});
|
|
6383
6443
|
}), i && this.zoomToModel(t);
|
|
@@ -6490,44 +6550,44 @@ function Ca(l) {
|
|
|
6490
6550
|
const M = p.get(y.url);
|
|
6491
6551
|
if (M == null)
|
|
6492
6552
|
return;
|
|
6493
|
-
const
|
|
6553
|
+
const E = ze(l, y.url);
|
|
6494
6554
|
(y.lods ?? []).forEach((_) => {
|
|
6495
6555
|
let D = _.octreeBox;
|
|
6496
|
-
b(i, D, y, M,
|
|
6556
|
+
b(i, D, y, M, E);
|
|
6497
6557
|
});
|
|
6498
6558
|
});
|
|
6499
|
-
const w = r.map((y) => k(y)).filter((y) => y instanceof
|
|
6559
|
+
const w = r.map((y) => k(y)).filter((y) => y instanceof z);
|
|
6500
6560
|
Xo(i);
|
|
6501
6561
|
const m = [
|
|
6502
6562
|
...x,
|
|
6503
6563
|
...i.intersectObjects(w, !1).map(Q)
|
|
6504
6564
|
].sort((y, M) => y.distance - M.distance);
|
|
6505
6565
|
return Qo(i), m;
|
|
6506
|
-
function b(y, M,
|
|
6566
|
+
function b(y, M, E, _, D) {
|
|
6507
6567
|
if (M == null)
|
|
6508
6568
|
return;
|
|
6509
6569
|
if (!M.threeBox) {
|
|
6510
6570
|
let H = new d(M.min.X * 0.3048, M.min.Z * 0.3048, -M.min.Y * 0.3048), K = new d(M.max.X * 0.3048, M.max.Z * 0.3048, -M.max.Y * 0.3048), $ = new d(Math.min(H.x, K.x), Math.min(H.y, K.y), Math.min(H.z, K.z)), v = new d(Math.max(K.x, H.x), Math.max(K.y, H.y), Math.max(K.z, H.z));
|
|
6511
|
-
M.threeBox = new
|
|
6571
|
+
M.threeBox = new R($, v).applyMatrix4(D);
|
|
6512
6572
|
}
|
|
6513
6573
|
const T = M.threeBox, N = y.ray.intersectsBox(T);
|
|
6514
6574
|
if (!(N == null || N == !1) && h?.doesBoxIntersectClippingRange?.(T) !== !1)
|
|
6515
6575
|
if (M.children == null || M.children.length == 0) {
|
|
6516
6576
|
if (M.elements != null)
|
|
6517
6577
|
for (let H of M.elements)
|
|
6518
|
-
C(H,
|
|
6578
|
+
C(H, E, _, D);
|
|
6519
6579
|
} else {
|
|
6520
6580
|
if (M.elements != null)
|
|
6521
6581
|
for (let H of M.elements)
|
|
6522
|
-
C(H,
|
|
6582
|
+
C(H, E, _, D);
|
|
6523
6583
|
for (let H of M.children)
|
|
6524
|
-
b(y, H,
|
|
6584
|
+
b(y, H, E, _, D);
|
|
6525
6585
|
}
|
|
6526
6586
|
}
|
|
6527
|
-
function C(y, M,
|
|
6528
|
-
if (!l.engineStatus.isFree && n == !1 || !
|
|
6587
|
+
function C(y, M, E, _) {
|
|
6588
|
+
if (!l.engineStatus.isFree && n == !1 || !le(M.url, y) || ae(M.url, y) || l.modelExplode?.hasRecord?.(M.url, y))
|
|
6529
6589
|
return;
|
|
6530
|
-
const D =
|
|
6590
|
+
const D = E.nodesMap.get(y);
|
|
6531
6591
|
if (D == null)
|
|
6532
6592
|
return;
|
|
6533
6593
|
const T = I(D.indexes);
|
|
@@ -6545,28 +6605,28 @@ function Ca(l) {
|
|
|
6545
6605
|
return;
|
|
6546
6606
|
}
|
|
6547
6607
|
D.infos != null && D.infos.forEach((N) => {
|
|
6548
|
-
|
|
6608
|
+
S(N.mesh, _);
|
|
6549
6609
|
});
|
|
6550
6610
|
}
|
|
6551
|
-
function
|
|
6552
|
-
if (!(y instanceof
|
|
6611
|
+
function S(y, M) {
|
|
6612
|
+
if (!(y instanceof z) || (y.parent == null && Ae(y, M), s && y.geometry.attributes.position.count >= 2e3))
|
|
6553
6613
|
return;
|
|
6554
|
-
const
|
|
6555
|
-
if (a.has(
|
|
6614
|
+
const E = y.uuid ?? y.id;
|
|
6615
|
+
if (a.has(E))
|
|
6556
6616
|
return;
|
|
6557
6617
|
const _ = ce(y, M);
|
|
6558
6618
|
if (_ == null || h?.doesBoxIntersectClippingRange?.(_) === !1)
|
|
6559
6619
|
return;
|
|
6560
6620
|
const D = i.ray.intersectBox(_, c);
|
|
6561
|
-
D != null && (a.add(
|
|
6562
|
-
key:
|
|
6621
|
+
D != null && (a.add(E), r.push({
|
|
6622
|
+
key: E,
|
|
6563
6623
|
distanceSq: i.ray.origin.distanceToSquared(D),
|
|
6564
6624
|
kind: "mesh",
|
|
6565
6625
|
mesh: y
|
|
6566
6626
|
}), B());
|
|
6567
6627
|
}
|
|
6568
|
-
function P(y, M,
|
|
6569
|
-
if (!Array.isArray(M) || M.length < 2 || !(
|
|
6628
|
+
function P(y, M, E, _, D) {
|
|
6629
|
+
if (!Array.isArray(M) || M.length < 2 || !(Le(l, M[0]) instanceof W))
|
|
6570
6630
|
return;
|
|
6571
6631
|
const N = `instance:${M[0]}:${M[1]}`;
|
|
6572
6632
|
a.has(N) || (a.add(N), r.push({
|
|
@@ -6575,12 +6635,12 @@ function Ca(l) {
|
|
|
6575
6635
|
kind: "instance",
|
|
6576
6636
|
node: y,
|
|
6577
6637
|
indexInfo: M,
|
|
6578
|
-
url:
|
|
6638
|
+
url: E,
|
|
6579
6639
|
modelMatrix: _.clone()
|
|
6580
6640
|
}), B());
|
|
6581
6641
|
}
|
|
6582
6642
|
function I(y) {
|
|
6583
|
-
return Array.isArray(y) ? y.filter((M) => Array.isArray(M) &&
|
|
6643
|
+
return Array.isArray(y) ? y.filter((M) => Array.isArray(M) && Le(l, M[0]) instanceof W) : [];
|
|
6584
6644
|
}
|
|
6585
6645
|
function B() {
|
|
6586
6646
|
if (r.sort((y, M) => y.distanceSq - M.distanceSq), r.length > 20) {
|
|
@@ -6591,10 +6651,10 @@ function Ca(l) {
|
|
|
6591
6651
|
function k(y) {
|
|
6592
6652
|
return y.kind === "mesh" ? y.mesh : y.kind === "instance" ? O(y.node, y.indexInfo, y.url, y.modelMatrix) : null;
|
|
6593
6653
|
}
|
|
6594
|
-
function O(y, M,
|
|
6654
|
+
function O(y, M, E, _) {
|
|
6595
6655
|
if (!Array.isArray(M) || M.length < 2 || y == null)
|
|
6596
6656
|
return null;
|
|
6597
|
-
const D =
|
|
6657
|
+
const D = Le(l, M[0]);
|
|
6598
6658
|
if (!(D instanceof W) || D.geometry == null)
|
|
6599
6659
|
return null;
|
|
6600
6660
|
const T = M[1], N = te(D, T);
|
|
@@ -6604,32 +6664,32 @@ function Ca(l) {
|
|
|
6604
6664
|
K.__pickMeshes instanceof Map || (K.__pickMeshes = /* @__PURE__ */ new Map());
|
|
6605
6665
|
const $ = `${M[0]}:${T}`;
|
|
6606
6666
|
let v = K.__pickMeshes.get($);
|
|
6607
|
-
return v instanceof
|
|
6608
|
-
url:
|
|
6667
|
+
return v instanceof z || (v = new z(D.geometry, D.material), K.__pickMeshes.set($, v)), Ae(v, H), v.userData.__instancePickMeta = {
|
|
6668
|
+
url: E,
|
|
6609
6669
|
id: y.info?.id ?? y.id ?? y.infos[0].id,
|
|
6610
6670
|
instanceId: T,
|
|
6611
6671
|
matrix: N.clone()
|
|
6612
6672
|
}, v;
|
|
6613
6673
|
}
|
|
6614
|
-
function q(y, M,
|
|
6615
|
-
if (y?.info?.box instanceof
|
|
6674
|
+
function q(y, M, E) {
|
|
6675
|
+
if (y?.info?.box instanceof R)
|
|
6616
6676
|
return y.info.box.clone().applyMatrix4(M);
|
|
6617
|
-
const _ =
|
|
6677
|
+
const _ = Le(l, E?.[0]);
|
|
6618
6678
|
if (!(_ instanceof W) || _.geometry == null)
|
|
6619
6679
|
return null;
|
|
6620
6680
|
_.geometry.boundingBox == null && _.geometry.computeBoundingBox();
|
|
6621
|
-
const D = te(_,
|
|
6681
|
+
const D = te(_, E[1]);
|
|
6622
6682
|
return _.geometry.boundingBox == null || D == null ? null : _.geometry.boundingBox.clone().applyMatrix4(D).applyMatrix4(M);
|
|
6623
6683
|
}
|
|
6624
6684
|
function te(y, M) {
|
|
6625
|
-
const
|
|
6685
|
+
const E = new V();
|
|
6626
6686
|
if (typeof y.getMatrixAt == "function")
|
|
6627
|
-
y.getMatrixAt(M,
|
|
6687
|
+
y.getMatrixAt(M, E);
|
|
6628
6688
|
else if (y.matrixs?.[M] instanceof V)
|
|
6629
|
-
|
|
6689
|
+
E.copy(y.matrixs[M]);
|
|
6630
6690
|
else
|
|
6631
6691
|
return null;
|
|
6632
|
-
return
|
|
6692
|
+
return E;
|
|
6633
6693
|
}
|
|
6634
6694
|
function Q(y) {
|
|
6635
6695
|
const M = y?.object?.userData?.__instancePickMeta;
|
|
@@ -6646,22 +6706,22 @@ function Ca(l) {
|
|
|
6646
6706
|
};
|
|
6647
6707
|
}
|
|
6648
6708
|
function ce(y, M) {
|
|
6649
|
-
return y.box instanceof
|
|
6709
|
+
return y.box instanceof R ? y.box : y.geometry == null || (y.geometry.boundingBox == null && y.geometry.computeBoundingBox(), y.geometry.boundingBox == null) ? null : (y.box = y.geometry.boundingBox.clone().applyMatrix4(M), y.box);
|
|
6650
6710
|
}
|
|
6651
|
-
function
|
|
6711
|
+
function ae(y, M) {
|
|
6652
6712
|
return g.get(y)?.has(M) || f.get(y)?.has(M);
|
|
6653
6713
|
}
|
|
6654
|
-
function
|
|
6714
|
+
function le(y, M) {
|
|
6655
6715
|
return t == null ? !0 : t.get(y)?.has(M) === !0;
|
|
6656
6716
|
}
|
|
6657
6717
|
function ue(y) {
|
|
6658
6718
|
const M = /* @__PURE__ */ new Map();
|
|
6659
|
-
return y?.forEach((
|
|
6660
|
-
Array.isArray(
|
|
6719
|
+
return y?.forEach((E) => {
|
|
6720
|
+
Array.isArray(E.ids) && M.set(E.url, new Set(E.ids));
|
|
6661
6721
|
}), M;
|
|
6662
6722
|
}
|
|
6663
6723
|
function Ae(y, M) {
|
|
6664
|
-
y instanceof
|
|
6724
|
+
y instanceof z && (y.matrixAutoUpdate = !1, y.matrix.copy(M), y.matrixWorld.copy(M), y.matrixWorldNeedsUpdate = !1, y.box instanceof R && (y.box.copy(y.geometry.boundingBox ?? new R().setFromBufferAttribute(y.geometry.attributes.position)), y.box.applyMatrix4(M)));
|
|
6665
6725
|
}
|
|
6666
6726
|
}, e;
|
|
6667
6727
|
}
|
|
@@ -6799,7 +6859,7 @@ class Aa {
|
|
|
6799
6859
|
console.warn("RangeScale: 无法将屏幕区域转换为世界坐标");
|
|
6800
6860
|
return;
|
|
6801
6861
|
}
|
|
6802
|
-
const c = new
|
|
6862
|
+
const c = new R();
|
|
6803
6863
|
for (const h of r)
|
|
6804
6864
|
c.expandByPoint(h);
|
|
6805
6865
|
if (c.isEmpty()) {
|
|
@@ -6823,7 +6883,7 @@ class Aa {
|
|
|
6823
6883
|
const s = new d();
|
|
6824
6884
|
e.getSize(s);
|
|
6825
6885
|
const o = Math.max(s.x, s.y, s.z);
|
|
6826
|
-
if (t instanceof
|
|
6886
|
+
if (t instanceof qt) {
|
|
6827
6887
|
const r = t.fov * (Math.PI / 180), c = o / (2 * Math.tan(r / 2)) * 1.2, h = new d();
|
|
6828
6888
|
t.getWorldDirection(h);
|
|
6829
6889
|
const u = n.clone().sub(t.position);
|
|
@@ -6843,7 +6903,7 @@ class Aa {
|
|
|
6843
6903
|
this.disActive(), this.selectionBox?.remove(), this.selectionBox = null, this.worldToScreen = null, this.isDrawing = !1;
|
|
6844
6904
|
}
|
|
6845
6905
|
}
|
|
6846
|
-
const
|
|
6906
|
+
const Ea = F.degToRad(10), wn = 1e-3, bi = !1, Sa = [];
|
|
6847
6907
|
class Pa {
|
|
6848
6908
|
engine;
|
|
6849
6909
|
rootGroup = null;
|
|
@@ -6858,7 +6918,7 @@ class Pa {
|
|
|
6858
6918
|
}
|
|
6859
6919
|
setMockData() {
|
|
6860
6920
|
const e = this.engine.models?.[0]?.grids;
|
|
6861
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
6921
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : Sa);
|
|
6862
6922
|
}
|
|
6863
6923
|
show() {
|
|
6864
6924
|
this.isVisible = !0, this.rootGroup && (this.rootGroup.visible = !0);
|
|
@@ -6936,7 +6996,7 @@ class Pa {
|
|
|
6936
6996
|
const s = new ge().setFromPoints([t, i]), o = new He({
|
|
6937
6997
|
color: 1609983,
|
|
6938
6998
|
depthTest: !1
|
|
6939
|
-
}), r = new
|
|
6999
|
+
}), r = new It(s, o);
|
|
6940
7000
|
r.renderOrder = 998, n.add(r), n.add(this._makeCircleSprite(e.data.Name, t)), n.add(this._makeCircleSprite(e.data.Name, i)), this.rootGroup.add(n), e.group = n;
|
|
6941
7001
|
}
|
|
6942
7002
|
_makeCircleSprite(e, t) {
|
|
@@ -6997,7 +7057,7 @@ class Pa {
|
|
|
6997
7057
|
const n = this.createProjection(i);
|
|
6998
7058
|
if (!n)
|
|
6999
7059
|
return;
|
|
7000
|
-
const s = t.find((o) => o.direction.angleTo(n.direction) <=
|
|
7060
|
+
const s = t.find((o) => o.direction.angleTo(n.direction) <= Ea);
|
|
7001
7061
|
if (s) {
|
|
7002
7062
|
s.axes.push(n);
|
|
7003
7063
|
return;
|
|
@@ -7180,7 +7240,7 @@ class Vi {
|
|
|
7180
7240
|
const n = t?.size ?? 3e4;
|
|
7181
7241
|
if (i.water) {
|
|
7182
7242
|
const s = new yi(n, n), o = t?.waterNormalsUrl ?? ee(Vi.DEFAULT_WATER_NORMALS, import.meta.url), r = new Je().load(o, (g) => {
|
|
7183
|
-
g.wrapS = g.wrapT =
|
|
7243
|
+
g.wrapS = g.wrapT = ht;
|
|
7184
7244
|
}), a = t?.sunDirection ?? new d(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, h = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, p = new Us(s, {
|
|
7185
7245
|
textureWidth: 512,
|
|
7186
7246
|
textureHeight: 512,
|
|
@@ -7204,13 +7264,13 @@ class Vi {
|
|
|
7204
7264
|
r && new Je().load(
|
|
7205
7265
|
r,
|
|
7206
7266
|
(c) => {
|
|
7207
|
-
c.wrapS = c.wrapT =
|
|
7267
|
+
c.wrapS = c.wrapT = ht, c.repeat.set(1e4, 1e4), o.map = c, o.needsUpdate = !0;
|
|
7208
7268
|
},
|
|
7209
7269
|
void 0,
|
|
7210
7270
|
() => {
|
|
7211
7271
|
}
|
|
7212
7272
|
);
|
|
7213
|
-
const a = new
|
|
7273
|
+
const a = new z(s, o);
|
|
7214
7274
|
a.name = "groundMesh", a.receiveShadow = !0, a.castShadow = !1, a.position.y = -0.01, this.groundMesh = a, this.isWaterAddon = !1, this.groundGroup.add(a);
|
|
7215
7275
|
}
|
|
7216
7276
|
this.groundGroup.position.y = this.groundY, this.clock.start();
|
|
@@ -7273,10 +7333,10 @@ class Vi {
|
|
|
7273
7333
|
Array.isArray(e) ? e.forEach((t) => t.dispose()) : e.dispose(), this.groundGroup.remove(this.groundMesh), this.groundMesh = null, this.isWaterAddon = !1;
|
|
7274
7334
|
}
|
|
7275
7335
|
}
|
|
7276
|
-
const
|
|
7336
|
+
const Ne = "0", Ta = !0, ys = 0.2, Ia = 0.35;
|
|
7277
7337
|
class _a {
|
|
7278
7338
|
engine;
|
|
7279
|
-
currentHdrId =
|
|
7339
|
+
currentHdrId = Ne;
|
|
7280
7340
|
isVisible = Ta;
|
|
7281
7341
|
currentIntensity = ys;
|
|
7282
7342
|
currentTexture = null;
|
|
@@ -7288,7 +7348,7 @@ class _a {
|
|
|
7288
7348
|
previousBackgroundIntensity = 1;
|
|
7289
7349
|
previousEnvironmentIntensity = 1;
|
|
7290
7350
|
previousAmbientLightIntensity = 1;
|
|
7291
|
-
previousToneMapping =
|
|
7351
|
+
previousToneMapping = ct;
|
|
7292
7352
|
previousToneMappingExposure = 1;
|
|
7293
7353
|
hdrList = [
|
|
7294
7354
|
{ id: "0", names: ["无", "無", "None"] },
|
|
@@ -7323,8 +7383,8 @@ class _a {
|
|
|
7323
7383
|
console.warn(`[Hdr] HDR id "${e}" not found`);
|
|
7324
7384
|
return;
|
|
7325
7385
|
}
|
|
7326
|
-
if (e ===
|
|
7327
|
-
this._clearHdr(), this.currentHdrId =
|
|
7386
|
+
if (e === Ne || !t.url) {
|
|
7387
|
+
this._clearHdr(), this.currentHdrId = Ne, this._requestRender();
|
|
7328
7388
|
return;
|
|
7329
7389
|
}
|
|
7330
7390
|
if (this.textureCache.has(e)) {
|
|
@@ -7348,7 +7408,7 @@ class _a {
|
|
|
7348
7408
|
return this.isVisible;
|
|
7349
7409
|
}
|
|
7350
7410
|
setIntensity(e) {
|
|
7351
|
-
this.currentIntensity = e, !(!this.engine.scene || this.currentHdrId ===
|
|
7411
|
+
this.currentIntensity = e, !(!this.engine.scene || this.currentHdrId === Ne) && (this.engine.scene.environmentIntensity = e, this._updateSkyboxIntensity(), this._requestRender());
|
|
7352
7412
|
}
|
|
7353
7413
|
getIntensity() {
|
|
7354
7414
|
return this.currentIntensity;
|
|
@@ -7380,11 +7440,11 @@ class _a {
|
|
|
7380
7440
|
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 = Ii, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure : Bi, this._removeSkybox(), this._createSkybox(e), this._setAmbientLightIntensity(this._getHdrAmbientLightIntensity());
|
|
7381
7441
|
}
|
|
7382
7442
|
_captureSceneState() {
|
|
7383
|
-
this.currentHdrId !==
|
|
7443
|
+
this.currentHdrId !== Ne || !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 ?? ct, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1);
|
|
7384
7444
|
}
|
|
7385
7445
|
_createSkybox(e) {
|
|
7386
7446
|
if (!this.engine.scene) return;
|
|
7387
|
-
const t = new Yt(1e3, 64, 32), i = new
|
|
7447
|
+
const t = new Yt(1e3, 64, 32), i = new oe({
|
|
7388
7448
|
map: e,
|
|
7389
7449
|
side: Li,
|
|
7390
7450
|
depthWrite: !1,
|
|
@@ -7392,7 +7452,7 @@ class _a {
|
|
|
7392
7452
|
fog: !1,
|
|
7393
7453
|
toneMapped: !0
|
|
7394
7454
|
});
|
|
7395
|
-
this.skybox = new
|
|
7455
|
+
this.skybox = new z(t, i), this.skybox.name = "hdr_skybox", this.skybox.renderOrder = -1e3, this.skybox.frustumCulled = !1, this.skybox.visible = this.isVisible, this.skybox.onBeforeRender = (n, s, o) => {
|
|
7396
7456
|
this.skybox?.position.copy(o.position);
|
|
7397
7457
|
}, this._updateSkyboxIntensity(), this.engine.scene.add(this.skybox);
|
|
7398
7458
|
}
|
|
@@ -7404,16 +7464,16 @@ class _a {
|
|
|
7404
7464
|
!this.skybox || !this.engine.scene || (this.engine.scene.remove(this.skybox), this.skybox.geometry.dispose(), this.skybox.material.dispose(), this.skybox = null);
|
|
7405
7465
|
}
|
|
7406
7466
|
_clearHdr() {
|
|
7407
|
-
this.currentTexture = null, this._removeSkybox(), this.engine.scene && (this.currentEnvironmentTexture?.dispose(), this.currentEnvironmentTexture = null, this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this._setAmbientLightIntensity(this.previousAmbientLightIntensity), this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousAmbientLightIntensity = 1, this.previousToneMapping =
|
|
7467
|
+
this.currentTexture = null, this._removeSkybox(), this.engine.scene && (this.currentEnvironmentTexture?.dispose(), this.currentEnvironmentTexture = null, this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this._setAmbientLightIntensity(this.previousAmbientLightIntensity), this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousAmbientLightIntensity = 1, this.previousToneMapping = ct, this.previousToneMappingExposure = 1);
|
|
7408
7468
|
}
|
|
7409
7469
|
_getAmbientLightIntensity() {
|
|
7410
7470
|
return this.engine.scene?.children.find(
|
|
7411
|
-
(t) => t instanceof
|
|
7471
|
+
(t) => t instanceof jt
|
|
7412
7472
|
)?.intensity ?? 1;
|
|
7413
7473
|
}
|
|
7414
7474
|
_setAmbientLightIntensity(e) {
|
|
7415
7475
|
const t = this.engine.scene?.children.find(
|
|
7416
|
-
(i) => i instanceof
|
|
7476
|
+
(i) => i instanceof jt
|
|
7417
7477
|
);
|
|
7418
7478
|
t && (t.intensity = e);
|
|
7419
7479
|
}
|
|
@@ -7540,13 +7600,13 @@ class La {
|
|
|
7540
7600
|
this.halfSize = n.distanceTo(i);
|
|
7541
7601
|
const s = e.data.Elevation, o = new de(), r = new yi(this.halfSize * 2, this.halfSize * 2);
|
|
7542
7602
|
r.rotateX(-Math.PI / 2);
|
|
7543
|
-
const a = new
|
|
7603
|
+
const a = new oe({
|
|
7544
7604
|
color: this.COLOR,
|
|
7545
7605
|
transparent: !0,
|
|
7546
7606
|
opacity: this.PLANE_OPACITY,
|
|
7547
|
-
side:
|
|
7607
|
+
side: re,
|
|
7548
7608
|
depthWrite: !1
|
|
7549
|
-
}), c = new
|
|
7609
|
+
}), c = new z(r, a);
|
|
7550
7610
|
c.position.y = s, o.add(c);
|
|
7551
7611
|
const h = [
|
|
7552
7612
|
new d(-this.halfSize, s, -this.halfSize),
|
|
@@ -7559,7 +7619,7 @@ class La {
|
|
|
7559
7619
|
transparent: !0,
|
|
7560
7620
|
opacity: 0.7
|
|
7561
7621
|
});
|
|
7562
|
-
if (o.add(new
|
|
7622
|
+
if (o.add(new It(u, p)), o.visible = this.isVisible, this.engine.scene.add(o), e.group = o, this.svgOverlay) {
|
|
7563
7623
|
const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
7564
7624
|
g.dataset.levelId = e.data.Id;
|
|
7565
7625
|
for (let f = 0; f < 4; f += 1)
|
|
@@ -7638,7 +7698,7 @@ class La {
|
|
|
7638
7698
|
min: { x: -this.halfSize, y: -this.halfSize, z: -this.halfSize },
|
|
7639
7699
|
max: { x: this.halfSize, y: this.halfSize, z: this.halfSize }
|
|
7640
7700
|
};
|
|
7641
|
-
const e = new
|
|
7701
|
+
const e = new R();
|
|
7642
7702
|
let t = !1;
|
|
7643
7703
|
return this.engine.models.forEach((i) => {
|
|
7644
7704
|
const n = i.boundingBox;
|
|
@@ -7656,7 +7716,7 @@ class La {
|
|
|
7656
7716
|
};
|
|
7657
7717
|
}
|
|
7658
7718
|
}
|
|
7659
|
-
const
|
|
7719
|
+
const Wt = !0, Ci = 0.5, Ba = 32, za = 0.3, vs = 0.05, Ra = 0.04, Oa = 0.18, Fa = 0.01;
|
|
7660
7720
|
function Na(l) {
|
|
7661
7721
|
return !l?.min || !l?.max ? 0 : l.min.distanceTo(l.max);
|
|
7662
7722
|
}
|
|
@@ -7684,7 +7744,7 @@ function Ua(l, e, t, i) {
|
|
|
7684
7744
|
}
|
|
7685
7745
|
class Wa {
|
|
7686
7746
|
engine;
|
|
7687
|
-
isActive =
|
|
7747
|
+
isActive = Wt;
|
|
7688
7748
|
groupEdge;
|
|
7689
7749
|
highlightEdgeGroup;
|
|
7690
7750
|
material;
|
|
@@ -7696,11 +7756,15 @@ class Wa {
|
|
|
7696
7756
|
highlightIndexes = /* @__PURE__ */ new Map();
|
|
7697
7757
|
highlightEdgeSyncVersion = 0;
|
|
7698
7758
|
explodeHidden = !1;
|
|
7699
|
-
groupVisibleBeforeExplode =
|
|
7759
|
+
groupVisibleBeforeExplode = Wt;
|
|
7700
7760
|
highlightVisibleBeforeExplode = !0;
|
|
7701
7761
|
getModelEntry(e) {
|
|
7702
7762
|
return this.engine?.models?.find((t) => t?.url === e) ?? null;
|
|
7703
7763
|
}
|
|
7764
|
+
/** 判断模型是否允许加载边线;旧模型记录未包含该字段时按允许处理。 */
|
|
7765
|
+
shouldLoadModelEdge(e) {
|
|
7766
|
+
return e?.loadEdge !== !1;
|
|
7767
|
+
}
|
|
7704
7768
|
getFilteredIdSet(e) {
|
|
7705
7769
|
return this.engine?.filterLoaderModel?.getContinueIdSet?.(e) ?? /* @__PURE__ */ new Set();
|
|
7706
7770
|
}
|
|
@@ -7708,7 +7772,10 @@ class Wa {
|
|
|
7708
7772
|
const t = this.indexes.get(e);
|
|
7709
7773
|
if (t)
|
|
7710
7774
|
return t;
|
|
7711
|
-
const i = this.getModelEntry(e)
|
|
7775
|
+
const i = this.getModelEntry(e);
|
|
7776
|
+
if (!this.shouldLoadModelEdge(i))
|
|
7777
|
+
return null;
|
|
7778
|
+
const n = Array.isArray(i?.modelEdge) ? i.modelEdge : null;
|
|
7712
7779
|
if (!n)
|
|
7713
7780
|
return null;
|
|
7714
7781
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -7734,7 +7801,10 @@ class Wa {
|
|
|
7734
7801
|
const t = this.highlightIndexes.get(e);
|
|
7735
7802
|
if (t)
|
|
7736
7803
|
return t;
|
|
7737
|
-
const i = this.getModelEntry(e)
|
|
7804
|
+
const i = this.getModelEntry(e);
|
|
7805
|
+
if (!this.shouldLoadModelEdge(i))
|
|
7806
|
+
return null;
|
|
7807
|
+
const n = Array.isArray(i?.modelEdge) ? i.modelEdge : null;
|
|
7738
7808
|
if (!n)
|
|
7739
7809
|
return null;
|
|
7740
7810
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -7756,7 +7826,7 @@ class Wa {
|
|
|
7756
7826
|
// 高亮边线也要遵守深度,否则隐藏边线密集叠加时会像一块灰色半透明面。
|
|
7757
7827
|
depthTest: !1,
|
|
7758
7828
|
depthWrite: !1
|
|
7759
|
-
}), this.highlightEdgeMaterial.clippingPlanes = this.engine.sectionPlane, this.groupEdge.visible =
|
|
7829
|
+
}), this.highlightEdgeMaterial.clippingPlanes = this.engine.sectionPlane, this.groupEdge.visible = Wt;
|
|
7760
7830
|
}
|
|
7761
7831
|
// 启动
|
|
7762
7832
|
active() {
|
|
@@ -7792,7 +7862,7 @@ class Wa {
|
|
|
7792
7862
|
Math.abs(this.material.opacity - e) <= Fa || (this.material.opacity = e, this.material.needsUpdate = !0);
|
|
7793
7863
|
}
|
|
7794
7864
|
hasPendingModelEdges() {
|
|
7795
|
-
return (this.engine?.models ?? []).some((t) => !Array.isArray(t?.modelEdge));
|
|
7865
|
+
return (this.engine?.models ?? []).some((t) => this.shouldLoadModelEdge(t) && !Array.isArray(t?.modelEdge));
|
|
7796
7866
|
}
|
|
7797
7867
|
loadZipJsonAsync(e, t) {
|
|
7798
7868
|
return new Promise((i, n) => {
|
|
@@ -7813,6 +7883,8 @@ class Wa {
|
|
|
7813
7883
|
});
|
|
7814
7884
|
}
|
|
7815
7885
|
async ensureModelEdgeData(e) {
|
|
7886
|
+
if (!this.shouldLoadModelEdge(e))
|
|
7887
|
+
return [];
|
|
7816
7888
|
if (Array.isArray(e?.modelEdge))
|
|
7817
7889
|
return e.modelEdge;
|
|
7818
7890
|
try {
|
|
@@ -7841,7 +7913,7 @@ class Wa {
|
|
|
7841
7913
|
this.modelEdgeLoadingPromise = (async () => {
|
|
7842
7914
|
const e = this.engine?.models ?? [];
|
|
7843
7915
|
for (const t of e)
|
|
7844
|
-
Array.isArray(t?.modelEdge) || await this.ensureModelEdgeData(t);
|
|
7916
|
+
!this.shouldLoadModelEdge(t) || Array.isArray(t?.modelEdge) || await this.ensureModelEdgeData(t);
|
|
7845
7917
|
this.modelEdgeLoaded = !this.hasPendingModelEdges();
|
|
7846
7918
|
})().finally(() => {
|
|
7847
7919
|
this.modelEdgeLoadingPromise = null;
|
|
@@ -7853,6 +7925,8 @@ class Wa {
|
|
|
7853
7925
|
if (await this.loadModelEdge(), !this.isActive || this.explodeHidden)
|
|
7854
7926
|
return;
|
|
7855
7927
|
(this.engine?.models ?? []).forEach((t) => {
|
|
7928
|
+
if (!this.shouldLoadModelEdge(t))
|
|
7929
|
+
return;
|
|
7856
7930
|
const i = t?.url;
|
|
7857
7931
|
if (typeof i != "string" || i.length === 0)
|
|
7858
7932
|
return;
|
|
@@ -7869,9 +7943,9 @@ class Wa {
|
|
|
7869
7943
|
}), s.length === 0)
|
|
7870
7944
|
return;
|
|
7871
7945
|
const a = new ge();
|
|
7872
|
-
a.setAttribute("position", new
|
|
7946
|
+
a.setAttribute("position", new At(s, 3));
|
|
7873
7947
|
const c = new Xt(a, this.material);
|
|
7874
|
-
c.url = i, this.setLineTransform(c,
|
|
7948
|
+
c.url = i, this.setLineTransform(c, ze(this.engine, i)), this.groupEdge.add(c), this.highlightIndexes.set(i, o), this.releaseIndexes(i);
|
|
7875
7949
|
});
|
|
7876
7950
|
}
|
|
7877
7951
|
/**
|
|
@@ -7917,9 +7991,9 @@ class Wa {
|
|
|
7917
7991
|
}), s.length === 0)
|
|
7918
7992
|
return;
|
|
7919
7993
|
const o = new ge();
|
|
7920
|
-
o.setAttribute("position", new
|
|
7994
|
+
o.setAttribute("position", new At(s, 3));
|
|
7921
7995
|
const r = new Xt(o, this.highlightEdgeMaterial);
|
|
7922
|
-
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r,
|
|
7996
|
+
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r, ze(this.engine, i.url)), this.highlightEdgeGroup.add(r);
|
|
7923
7997
|
}));
|
|
7924
7998
|
}
|
|
7925
7999
|
appendEdgePositions(e, t) {
|
|
@@ -7934,6 +8008,8 @@ class Wa {
|
|
|
7934
8008
|
}
|
|
7935
8009
|
// 获取指定模型的边线
|
|
7936
8010
|
getModelEdge(e, t) {
|
|
8011
|
+
if (!this.shouldLoadModelEdge(this.getModelEntry(e)))
|
|
8012
|
+
return null;
|
|
7937
8013
|
const i = this.getOrCreateItemIndex(e);
|
|
7938
8014
|
if (i) {
|
|
7939
8015
|
const n = i.get(Number(t));
|
|
@@ -7946,6 +8022,8 @@ class Wa {
|
|
|
7946
8022
|
}
|
|
7947
8023
|
// 隐藏边线
|
|
7948
8024
|
hideModelEdge(e, t) {
|
|
8025
|
+
if (!this.shouldLoadModelEdge(this.getModelEntry(e)))
|
|
8026
|
+
return;
|
|
7949
8027
|
const i = this.getLineByUrl(e), n = this.getOrCreateItemIndex(e);
|
|
7950
8028
|
if (!n) {
|
|
7951
8029
|
this.loadModelEdge();
|
|
@@ -7969,6 +8047,8 @@ class Wa {
|
|
|
7969
8047
|
}
|
|
7970
8048
|
// 显示边线
|
|
7971
8049
|
showModelEdge(e, t) {
|
|
8050
|
+
if (!this.shouldLoadModelEdge(this.getModelEntry(e)))
|
|
8051
|
+
return;
|
|
7972
8052
|
const i = this.getLineByUrl(e), n = this.getOrCreateItemIndex(e);
|
|
7973
8053
|
if (!n) {
|
|
7974
8054
|
this.loadModelEdge();
|
|
@@ -8007,7 +8087,7 @@ const bn = {
|
|
|
8007
8087
|
cloudDensity: 0.4,
|
|
8008
8088
|
cloudElevation: 0.5,
|
|
8009
8089
|
showSunDisc: !0
|
|
8010
|
-
}, Ai = "sunrise_clear", xs = 0.2,
|
|
8090
|
+
}, Ai = "sunrise_clear", xs = 0.2, Ei = [
|
|
8011
8091
|
{
|
|
8012
8092
|
id: "sunrise_clear",
|
|
8013
8093
|
names: ["晴朗日出", "晴朗日出", "Clear Sunrise"],
|
|
@@ -8178,7 +8258,7 @@ const bn = {
|
|
|
8178
8258
|
showSunDisc: !1
|
|
8179
8259
|
}
|
|
8180
8260
|
}
|
|
8181
|
-
], Cn =
|
|
8261
|
+
], Cn = Ei.reduce(
|
|
8182
8262
|
(l, e) => (l[e.id] = e, l),
|
|
8183
8263
|
{}
|
|
8184
8264
|
), An = 2e6;
|
|
@@ -8197,7 +8277,7 @@ class Ga {
|
|
|
8197
8277
|
previousEnvironment = null;
|
|
8198
8278
|
previousBackgroundIntensity = 1;
|
|
8199
8279
|
previousEnvironmentIntensity = 1;
|
|
8200
|
-
previousToneMapping =
|
|
8280
|
+
previousToneMapping = ct;
|
|
8201
8281
|
previousToneMappingExposure = 1;
|
|
8202
8282
|
hasCapturedSceneState = !1;
|
|
8203
8283
|
constructor(e) {
|
|
@@ -8232,10 +8312,10 @@ class Ga {
|
|
|
8232
8312
|
return this.currentPreset;
|
|
8233
8313
|
}
|
|
8234
8314
|
getPresetNames() {
|
|
8235
|
-
return
|
|
8315
|
+
return Ei.map((e) => e.id);
|
|
8236
8316
|
}
|
|
8237
8317
|
getPresetList() {
|
|
8238
|
-
return
|
|
8318
|
+
return Ei.map((e) => ({
|
|
8239
8319
|
id: e.id,
|
|
8240
8320
|
names: [...e.names],
|
|
8241
8321
|
params: { ...e.params }
|
|
@@ -8285,10 +8365,10 @@ class Ga {
|
|
|
8285
8365
|
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping = Ki, this.engine.renderer.toneMappingExposure = this._getEffectiveExposure(), this.sky.visible && this._refreshEnvironmentMap());
|
|
8286
8366
|
}
|
|
8287
8367
|
_captureSceneState() {
|
|
8288
|
-
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 ??
|
|
8368
|
+
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 ?? ct, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1, this.hasCapturedSceneState = !0);
|
|
8289
8369
|
}
|
|
8290
8370
|
_restoreSceneState(e) {
|
|
8291
|
-
!this.hasCapturedSceneState || !this.engine?.scene || (this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), e && (this._disposeEnvironmentTarget(), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousToneMapping =
|
|
8371
|
+
!this.hasCapturedSceneState || !this.engine?.scene || (this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), e && (this._disposeEnvironmentTarget(), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousToneMapping = ct, this.previousToneMappingExposure = 1, this.hasCapturedSceneState = !1));
|
|
8292
8372
|
}
|
|
8293
8373
|
_refreshEnvironmentMap() {
|
|
8294
8374
|
if (!this.sky || !this.engine?.renderer || !this.engine?.scene) return;
|
|
@@ -8434,7 +8514,7 @@ class qa {
|
|
|
8434
8514
|
this.settings = this._readCurrentSettingsFromModules();
|
|
8435
8515
|
}
|
|
8436
8516
|
_buildDefaultSettingsFromModules() {
|
|
8437
|
-
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?.() ??
|
|
8517
|
+
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?.() ?? Ne, r = this.engine.hdr?.getIntensity?.(), a = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? Ai, h = this.engine.skyManager?.isActive?.() === !0;
|
|
8438
8518
|
return {
|
|
8439
8519
|
render: {
|
|
8440
8520
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
@@ -8445,7 +8525,7 @@ class qa {
|
|
|
8445
8525
|
gtaoIntensity: this._unitToPercent(i, Qn)
|
|
8446
8526
|
},
|
|
8447
8527
|
display: {
|
|
8448
|
-
showEdge: this.engine.modelEdge?.isEnabled?.() ??
|
|
8528
|
+
showEdge: this.engine.modelEdge?.isEnabled?.() ?? Wt,
|
|
8449
8529
|
edgeOpacity: this._unitToPercent(s, Ci),
|
|
8450
8530
|
showGrid: this.engine.grid?.getVisible?.() ?? bi,
|
|
8451
8531
|
showLevel: this.engine.level?.getVisible?.() ?? Ms,
|
|
@@ -8454,7 +8534,7 @@ class qa {
|
|
|
8454
8534
|
groundHeight: this.engine.ground?.getHeight?.() ?? gs
|
|
8455
8535
|
},
|
|
8456
8536
|
environment: {
|
|
8457
|
-
type: h ? "sky" : o !==
|
|
8537
|
+
type: h ? "sky" : o !== Ne ? "hdr" : "none",
|
|
8458
8538
|
hdrId: o,
|
|
8459
8539
|
hdrIntensity: this._unitToPercent(r, ys),
|
|
8460
8540
|
skyPreset: c,
|
|
@@ -8484,7 +8564,7 @@ class qa {
|
|
|
8484
8564
|
groundHeight: this.engine.ground?.getHeight?.() ?? this.settings.display.groundHeight
|
|
8485
8565
|
},
|
|
8486
8566
|
environment: {
|
|
8487
|
-
type: u ? "sky" : o !==
|
|
8567
|
+
type: u ? "sky" : o !== Ne ? "hdr" : "none",
|
|
8488
8568
|
hdrId: o,
|
|
8489
8569
|
hdrIntensity: this._unitToPercent(r, this.settings.environment.hdrIntensity / 100),
|
|
8490
8570
|
skyPreset: c,
|
|
@@ -8532,12 +8612,12 @@ class qa {
|
|
|
8532
8612
|
* 搴旂敤鐜璁剧疆銆? * 鍏堝叧闂綋鍓?HDR 鍜屽ぉ绌猴紝鍐嶆牴鎹被鍨嬮噸鏂板惎鐢ㄣ€? * 浣跨敤鐗堟湰鍙锋満鍒堕槻姝㈠娆″紓姝ヨ皟鐢ㄤ箣闂寸殑绔炴€佹潯浠躲€? */
|
|
8533
8613
|
async _applyEnvironmentSettings(e) {
|
|
8534
8614
|
const t = ++this.environmentApplyVersion;
|
|
8535
|
-
if (await this.engine.hdr?.setHdr(
|
|
8615
|
+
if (await this.engine.hdr?.setHdr(Ne), t === this.environmentApplyVersion && (this.engine.skyManager?.close(!0), t === this.environmentApplyVersion))
|
|
8536
8616
|
switch (e.type) {
|
|
8537
8617
|
case "none":
|
|
8538
8618
|
break;
|
|
8539
8619
|
case "hdr":
|
|
8540
|
-
if (e.hdrId !==
|
|
8620
|
+
if (e.hdrId !== Ne) {
|
|
8541
8621
|
if (await this.engine.hdr?.setHdr(e.hdrId), t !== this.environmentApplyVersion) {
|
|
8542
8622
|
this._applyEnvironmentSettings(this._clone(this.settings.environment));
|
|
8543
8623
|
return;
|
|
@@ -8688,14 +8768,14 @@ class Ve {
|
|
|
8688
8768
|
e.clearHighlight(), m.container.getElementsByTagName("svg")[0].classList.add("Hight"), m.highlight = !0, e.engine.events.trigger(ne.MeasureClick, m);
|
|
8689
8769
|
}), m.isSelect && (m.container.getElementsByTagName("svg")[0].classList.add("Hight"), m.highlight = !0);
|
|
8690
8770
|
}
|
|
8691
|
-
let b = i(m.point1), C = i(m.point2),
|
|
8692
|
-
if (b == null || C == null ||
|
|
8771
|
+
let b = i(m.point1), C = i(m.point2), S = i(m.point3);
|
|
8772
|
+
if (b == null || C == null || S == null) {
|
|
8693
8773
|
n(m, !1);
|
|
8694
8774
|
return;
|
|
8695
8775
|
}
|
|
8696
8776
|
n(m, !0);
|
|
8697
8777
|
let P = m.container;
|
|
8698
|
-
P.getElementsByTagName("circle")[0].setAttribute("cx", b.x), P.getElementsByTagName("circle")[0].setAttribute("cy", b.y), P.getElementsByTagName("circle")[1].setAttribute("cx", C.x), P.getElementsByTagName("circle")[1].setAttribute("cy", C.y), P.getElementsByTagName("circle")[2].setAttribute("cx",
|
|
8778
|
+
P.getElementsByTagName("circle")[0].setAttribute("cx", b.x), P.getElementsByTagName("circle")[0].setAttribute("cy", b.y), P.getElementsByTagName("circle")[1].setAttribute("cx", C.x), P.getElementsByTagName("circle")[1].setAttribute("cy", C.y), P.getElementsByTagName("circle")[2].setAttribute("cx", S.x), P.getElementsByTagName("circle")[2].setAttribute("cy", S.y), P.getElementsByTagName("polyline")[0].setAttribute("points", b.x + "," + b.y + " " + C.x + "," + C.y), P.getElementsByTagName("polyline")[1].setAttribute("points", C.x + "," + C.y + " " + S.x + "," + S.y);
|
|
8699
8779
|
let I = C.x, B = C.y - 30;
|
|
8700
8780
|
P.getElementsByTagName("rect")[0].setAttribute("x", I - 40), P.getElementsByTagName("rect")[0].setAttribute("y", B - 12.5), P.getElementsByTagName("text")[0].setAttribute("x", I), P.getElementsByTagName("text")[0].setAttribute("y", B + 4), P.getElementsByTagName("text")[0].innerHTML = m.text, P.style.top = "0px", P.style.left = "0px";
|
|
8701
8781
|
}
|
|
@@ -8717,21 +8797,21 @@ class Ve {
|
|
|
8717
8797
|
}
|
|
8718
8798
|
if (!m.points || m.points.length < 2)
|
|
8719
8799
|
return;
|
|
8720
|
-
let b = [], C = 0,
|
|
8800
|
+
let b = [], C = 0, S = 0;
|
|
8721
8801
|
for (let te = 0; te < m.points.length; te++) {
|
|
8722
8802
|
let Q = i(m.points[te]);
|
|
8723
8803
|
if (Q == null) {
|
|
8724
8804
|
n(m, !1);
|
|
8725
8805
|
return;
|
|
8726
8806
|
}
|
|
8727
|
-
b.push(Q), C += Q.x,
|
|
8807
|
+
b.push(Q), C += Q.x, S += Q.y;
|
|
8728
8808
|
}
|
|
8729
|
-
n(m, !0), C = C / b.length,
|
|
8809
|
+
n(m, !0), C = C / b.length, S = S / b.length;
|
|
8730
8810
|
let P = b.map((te) => te.x + "," + te.y).join(" "), I = [...b];
|
|
8731
8811
|
b.length >= 3 && I.push(b[0]);
|
|
8732
8812
|
let B = I.map((te) => te.x + "," + te.y).join(" "), k = m.container;
|
|
8733
8813
|
k.getElementsByTagName("polygon")[0].setAttribute("points", b.length >= 3 ? P : ""), k.getElementsByTagName("polyline")[0].setAttribute("points", B);
|
|
8734
|
-
let O = C, q =
|
|
8814
|
+
let O = C, q = S;
|
|
8735
8815
|
k.getElementsByTagName("rect")[0].setAttribute("x", O - 40), k.getElementsByTagName("rect")[0].setAttribute("y", q - 12.5), k.getElementsByTagName("text")[0].setAttribute("x", O + 10), k.getElementsByTagName("text")[0].setAttribute("y", q + 4), k.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(m.text, 2), k.style.top = "0px", k.style.left = "0px";
|
|
8736
8816
|
}
|
|
8737
8817
|
function g(m) {
|
|
@@ -8760,10 +8840,10 @@ class Ve {
|
|
|
8760
8840
|
return;
|
|
8761
8841
|
}
|
|
8762
8842
|
n(m, !0);
|
|
8763
|
-
let
|
|
8764
|
-
|
|
8843
|
+
let S = m.container;
|
|
8844
|
+
S.getElementsByTagName("polyline")[0].setAttribute("points", b.x + "," + b.y + " " + C.x + "," + C.y);
|
|
8765
8845
|
let P = (b.x + C.x) / 2, I = (b.y + C.y) / 2 - 30;
|
|
8766
|
-
|
|
8846
|
+
S.getElementsByTagName("rect")[0].setAttribute("x", P - 50), S.getElementsByTagName("rect")[0].setAttribute("y", I - 12.5), S.getElementsByTagName("text")[0].setAttribute("x", P), S.getElementsByTagName("text")[0].setAttribute("y", I + 4), S.getElementsByTagName("text")[0].innerHTML = m.text, S.style.top = "0px", S.style.left = "0px";
|
|
8767
8847
|
}
|
|
8768
8848
|
function f(m) {
|
|
8769
8849
|
if (m.container == null) {
|
|
@@ -8788,21 +8868,21 @@ class Ve {
|
|
|
8788
8868
|
return;
|
|
8789
8869
|
}
|
|
8790
8870
|
n(m, !0), b.style.top = "0px", b.style.left = "0px";
|
|
8791
|
-
let
|
|
8792
|
-
|
|
8871
|
+
let S = b.getElementsByTagName("circle")[0];
|
|
8872
|
+
S && (S.setAttribute("cx", C.x), S.setAttribute("cy", C.y));
|
|
8793
8873
|
let P = b.getElementsByTagName("rect"), I = b.getElementsByTagName("text"), B = -55;
|
|
8794
8874
|
P[0] && (P[0].setAttribute("x", C.x + 10), P[0].setAttribute("y", C.y + 10 + B)), I[0] && (I[0].setAttribute("x", C.x + 10 + 50), I[0].setAttribute("y", C.y + 10 + 16 + B)), P[1] && (P[1].setAttribute("x", C.x + 10), P[1].setAttribute("y", C.y + 10 + 30 + B)), I[1] && (I[1].setAttribute("x", C.x + 10 + 50), I[1].setAttribute("y", C.y + 10 + 46 + B)), P[2] && (P[2].setAttribute("x", C.x + 10), P[2].setAttribute("y", C.y + 10 + 60 + B)), I[2] && (I[2].setAttribute("x", C.x + 10 + 50), I[2].setAttribute("y", C.y + 10 + 76 + B)), I[0] && (I[0].innerHTML = "X: " + e.getMeasureText(m.textX, 1)), I[1] && (I[1].innerHTML = "Y: " + e.getMeasureText(-m.textZ, 1)), I[2] && (I[2].innerHTML = "Z: " + e.getMeasureText(m.textY, 1));
|
|
8795
8875
|
}
|
|
8796
8876
|
function x(m) {
|
|
8797
8877
|
if (m.container == null) {
|
|
8798
|
-
let
|
|
8878
|
+
let S = [
|
|
8799
8879
|
'<svg width="100" height="50" class="measureSvg">',
|
|
8800
8880
|
'<rect x="0" y="0" width="100" height="25" class="measureBack" />',
|
|
8801
8881
|
'<text x="50" y="16" text-anchor="middle" class="measureLabel"> ' + e.getMeasureText(m.text, 1) + "</text>",
|
|
8802
8882
|
'<polyline class="measureLine" stroke-width="2" points="80,32 0,32 16,48 32,32" style="fill: none; opacity: 1;"/>',
|
|
8803
8883
|
"</svg>"
|
|
8804
8884
|
].join("");
|
|
8805
|
-
m.container = document.createElement("div"), m.container.className = "elevation-annotation", m.container.id = m.id, m.container.style.position = "absolute", m.container.style.pointerEvents = "none", m.container.innerHTML =
|
|
8885
|
+
m.container = document.createElement("div"), m.container.className = "elevation-annotation", m.container.id = m.id, m.container.style.position = "absolute", m.container.style.pointerEvents = "none", m.container.innerHTML = S, e.engine.measure.annotationContainer.appendChild(m.container), m.container.getElementsByTagName("svg")[0].addEventListener("click", function() {
|
|
8806
8886
|
e.clearHighlight(), m.container.getElementsByTagName("svg")[0].classList.add("Hight"), m.highlight = !0, e.engine.events.trigger(ne.MeasureClick, m);
|
|
8807
8887
|
}), m.isSelect && (m.container.getElementsByTagName("svg")[0].classList.add("Hight"), m.highlight = !0);
|
|
8808
8888
|
}
|
|
@@ -8834,12 +8914,12 @@ class Ve {
|
|
|
8834
8914
|
return;
|
|
8835
8915
|
} else
|
|
8836
8916
|
b.style.display = "block";
|
|
8837
|
-
let C = i(m.point1),
|
|
8838
|
-
if (C == null ||
|
|
8917
|
+
let C = i(m.point1), S = i(m.point2);
|
|
8918
|
+
if (C == null || S == null) {
|
|
8839
8919
|
n(m, !1);
|
|
8840
8920
|
return;
|
|
8841
8921
|
}
|
|
8842
|
-
n(m, !0), b.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " +
|
|
8922
|
+
n(m, !0), b.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " + S.x + "," + S.y), b.getElementsByTagName("circle")[0].setAttribute("cx", C.x), b.getElementsByTagName("circle")[0].setAttribute("cy", C.y), b.getElementsByTagName("circle")[1].setAttribute("cx", S.x), b.getElementsByTagName("circle")[1].setAttribute("cy", S.y), b.getElementsByTagName("rect")[0].setAttribute("x", C.x * 0.5 + S.x * 0.5 - 40), b.getElementsByTagName("rect")[0].setAttribute("y", C.y * 0.5 + S.y * 0.5 - 12.5), b.getElementsByTagName("text")[0].setAttribute("x", C.x * 0.5 + S.x * 0.5 + 50 - 40), b.getElementsByTagName("text")[0].setAttribute("y", C.y * 0.5 + S.y * 0.5 + 16 - 12.5), b.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(m.text, 1), b.style.top = "0px", b.style.left = "0px";
|
|
8843
8923
|
}
|
|
8844
8924
|
}
|
|
8845
8925
|
}
|
|
@@ -8890,7 +8970,7 @@ class Ka {
|
|
|
8890
8970
|
if (!s)
|
|
8891
8971
|
continue;
|
|
8892
8972
|
typeof s.updateMatrixWorld == "function" && s.updateMatrixWorld(!0);
|
|
8893
|
-
const o = new
|
|
8973
|
+
const o = new R().setFromObject(s);
|
|
8894
8974
|
!Number.isFinite(o.min.y) || !Number.isFinite(o.max.y) || (o.min.y < t && (t = o.min.y), o.max.y > i && (i = o.max.y));
|
|
8895
8975
|
}
|
|
8896
8976
|
return !Number.isFinite(t) || !Number.isFinite(i) ? null : { minY: t, maxY: i };
|
|
@@ -8920,7 +9000,7 @@ class Ka {
|
|
|
8920
9000
|
let t = this.engine.measure.annotationData.normalAnnotation.find((n) => n.isSelect == !0);
|
|
8921
9001
|
t == null && (t = {
|
|
8922
9002
|
text: null,
|
|
8923
|
-
id:
|
|
9003
|
+
id: Be(),
|
|
8924
9004
|
isSelect: !0,
|
|
8925
9005
|
type: "clear-height"
|
|
8926
9006
|
}, this.engine.measure.annotationData.normalAnnotation.push(t));
|
|
@@ -8992,7 +9072,7 @@ class ja {
|
|
|
8992
9072
|
if (t != null && this.points.length == 1) {
|
|
8993
9073
|
let i = this.engine.measure.annotationData.normalAnnotation.find((n) => n.isSelect == !0);
|
|
8994
9074
|
i == null && (i = {
|
|
8995
|
-
id:
|
|
9075
|
+
id: Be(),
|
|
8996
9076
|
point1: this.points[0].clone(),
|
|
8997
9077
|
point2: t.point.clone(),
|
|
8998
9078
|
text: this.points[0].clone().distanceTo(t.point.clone()),
|
|
@@ -9044,7 +9124,7 @@ class Ya {
|
|
|
9044
9124
|
let t = this.engine.measure.annotationData.normalAnnotation.find((o) => o.isSelect == !0);
|
|
9045
9125
|
t == null && (t = {
|
|
9046
9126
|
text: null,
|
|
9047
|
-
id:
|
|
9127
|
+
id: Be(),
|
|
9048
9128
|
isSelect: !0,
|
|
9049
9129
|
type: "clear-distance"
|
|
9050
9130
|
}, this.engine.measure.annotationData.normalAnnotation.push(t));
|
|
@@ -9092,7 +9172,7 @@ class Xa {
|
|
|
9092
9172
|
let t = this.engine.measure.annotationData.elevationAnnotation.find((i) => i.isSelect == !0);
|
|
9093
9173
|
if (t == null) {
|
|
9094
9174
|
t = {
|
|
9095
|
-
id:
|
|
9175
|
+
id: Be(),
|
|
9096
9176
|
point: e.catch.point.clone(),
|
|
9097
9177
|
text: e.catch.point.y,
|
|
9098
9178
|
isSelect: !0,
|
|
@@ -9140,7 +9220,7 @@ class Qa {
|
|
|
9140
9220
|
let t = this.engine.measure.annotationData.coordinateAnnotation.find((i) => i.isSelect == !0);
|
|
9141
9221
|
if (t == null) {
|
|
9142
9222
|
t = {
|
|
9143
|
-
id:
|
|
9223
|
+
id: Be(),
|
|
9144
9224
|
point: e.catch.point.clone(),
|
|
9145
9225
|
text: Math.round(e.catch.point.y) + " m",
|
|
9146
9226
|
isSelect: !0,
|
|
@@ -9208,7 +9288,7 @@ class $a {
|
|
|
9208
9288
|
if (e.catch != null && this.points.length != 1 && this.points.length == 2) {
|
|
9209
9289
|
let t = this.engine.measure.annotationData.angleAnnotation.find((i) => i.isSelect == !0);
|
|
9210
9290
|
t == null && (t = {
|
|
9211
|
-
id:
|
|
9291
|
+
id: Be(),
|
|
9212
9292
|
point1: this.points[0].clone(),
|
|
9213
9293
|
// 起点
|
|
9214
9294
|
point2: this.points[1].clone(),
|
|
@@ -9265,7 +9345,7 @@ class Za {
|
|
|
9265
9345
|
this.points.length === 0 && this.engine.measure.tools.clearHighlight(), this.points.push(t.point.clone());
|
|
9266
9346
|
let i = this.getCurrentDrawingMeasure();
|
|
9267
9347
|
i == null ? (i = {
|
|
9268
|
-
id:
|
|
9348
|
+
id: Be(),
|
|
9269
9349
|
points: this.points.map((n) => n.clone()),
|
|
9270
9350
|
area: 0,
|
|
9271
9351
|
text: 0,
|
|
@@ -9277,7 +9357,7 @@ class Za {
|
|
|
9277
9357
|
if (e.catch != null && this.points.length >= 1) {
|
|
9278
9358
|
let t = this.getCurrentDrawingMeasure();
|
|
9279
9359
|
t == null && (t = {
|
|
9280
|
-
id:
|
|
9360
|
+
id: Be(),
|
|
9281
9361
|
points: [],
|
|
9282
9362
|
area: 0,
|
|
9283
9363
|
text: 0,
|
|
@@ -9432,7 +9512,7 @@ class wt {
|
|
|
9432
9512
|
if (t != null && this.points.length == 1) {
|
|
9433
9513
|
let i = this.engine.measure.annotationData.slopeAnnotation.find((s) => s.isSelect == !0);
|
|
9434
9514
|
i == null && (i = {
|
|
9435
|
-
id:
|
|
9515
|
+
id: Be(),
|
|
9436
9516
|
point1: this.points[0].clone(),
|
|
9437
9517
|
// 起点
|
|
9438
9518
|
point2: this.getSlopeSnappedPoint(this.points[0], t, e),
|
|
@@ -9484,7 +9564,7 @@ class Ja {
|
|
|
9484
9564
|
return;
|
|
9485
9565
|
let s = this.engine.measure.annotationData.normalAnnotation.find((o) => o.isSelect == !0);
|
|
9486
9566
|
s == null && (s = {
|
|
9487
|
-
id:
|
|
9567
|
+
id: Be(),
|
|
9488
9568
|
type: "clear-distance",
|
|
9489
9569
|
isSelect: !0
|
|
9490
9570
|
}, this.engine.measure.annotationData.normalAnnotation.push(s)), s.point1 = i, s.point2 = n.footPoint, s.text = n.distance, s.facePoint = t.point.clone(), s.faceNormal = t.normal.clone(), s.isSelect = !1, this.points = [], this.behavior?.clearLastPoint?.(), this.engine.events.trigger(ne.MeasureChanged, s);
|
|
@@ -9500,7 +9580,7 @@ class Ja {
|
|
|
9500
9580
|
return;
|
|
9501
9581
|
let s = this.engine.measure.annotationData.normalAnnotation.find((o) => o.isSelect == !0);
|
|
9502
9582
|
s == null && (s = {
|
|
9503
|
-
id:
|
|
9583
|
+
id: Be(),
|
|
9504
9584
|
point1: i.clone(),
|
|
9505
9585
|
point2: n.footPoint.clone(),
|
|
9506
9586
|
text: n.distance,
|
|
@@ -9928,9 +10008,9 @@ class tl {
|
|
|
9928
10008
|
const t = this.engine.renderer?.domElement, i = this.engine.camera;
|
|
9929
10009
|
if (!t || !i)
|
|
9930
10010
|
return;
|
|
9931
|
-
const n = new
|
|
10011
|
+
const n = new dt();
|
|
9932
10012
|
n.name = `SectionBoxTransformAnchor_${e}`, n.visible = this.isActive, this.engine.scene.add(n);
|
|
9933
|
-
const s = new
|
|
10013
|
+
const s = new Et(i, t);
|
|
9934
10014
|
s.name = `SectionBoxTransformControl_${e}`, s.setMode("translate"), s.setSpace("local"), s.showX = !0, s.showY = !1, s.showZ = !1, s.size = this.transformHandleSize, s.setColors(
|
|
9935
10015
|
this.transformHandleColor,
|
|
9936
10016
|
this.transformHandleColor,
|
|
@@ -9949,7 +10029,7 @@ class tl {
|
|
|
9949
10029
|
const s = this.transformAnchors.get(e), o = this.transformControls.get(e);
|
|
9950
10030
|
if (!s || !o)
|
|
9951
10031
|
return;
|
|
9952
|
-
const r = this.getFaceTransformOffset(), a = new
|
|
10032
|
+
const r = this.getFaceTransformOffset(), a = new Se().setFromUnitVectors(
|
|
9953
10033
|
new d(1, 0, 0),
|
|
9954
10034
|
t.clone().normalize()
|
|
9955
10035
|
), c = i.clone().add(t.clone().setLength(r));
|
|
@@ -10082,13 +10162,13 @@ class tl {
|
|
|
10082
10162
|
r.setAttribute("position", new St(a, 3)), r.setIndex(c);
|
|
10083
10163
|
let h = this.meshs.find((m) => m.name === n);
|
|
10084
10164
|
if (h == null) {
|
|
10085
|
-
const m = new
|
|
10165
|
+
const m = new oe({
|
|
10086
10166
|
color: 65280,
|
|
10087
10167
|
transparent: !0,
|
|
10088
10168
|
opacity: this.faceIdleOpacity,
|
|
10089
|
-
side:
|
|
10169
|
+
side: re
|
|
10090
10170
|
});
|
|
10091
|
-
m.polygonOffset = !0, m.polygonOffsetFactor = 1, m.polygonOffsetUnits = 4, h = new
|
|
10171
|
+
m.polygonOffset = !0, m.polygonOffsetFactor = 1, m.polygonOffsetUnits = 4, h = new z(r, m), h.name = n, e.add(h), this.meshs.push(h);
|
|
10092
10172
|
} else
|
|
10093
10173
|
h.geometry = r;
|
|
10094
10174
|
h.userData = {
|
|
@@ -10117,7 +10197,7 @@ class tl {
|
|
|
10117
10197
|
]), p = new He({ color: 255 }), g = new ge();
|
|
10118
10198
|
g.setAttribute("position", new St(u, 3));
|
|
10119
10199
|
let f = this.meshs.find((m) => m.name === n + "Line");
|
|
10120
|
-
f == null ? (f = new
|
|
10200
|
+
f == null ? (f = new It(g, p), f.name = n + "Line", e.add(f), this.meshs.push(f)) : (f.geometry = g, f.material = p);
|
|
10121
10201
|
const x = new d();
|
|
10122
10202
|
t.forEach((m) => x.add(m)), x.multiplyScalar(1 / t.length), this.updateFaceTransformControl(n, i, x, s);
|
|
10123
10203
|
const w = this.engine.sectionPlane.find((m) => m.name == n);
|
|
@@ -10347,8 +10427,8 @@ class il {
|
|
|
10347
10427
|
const I = P.clone().sub(r), B = I.dot(a), k = I.dot(c);
|
|
10348
10428
|
g = Math.min(g, B), f = Math.max(f, B), x = Math.min(x, k), w = Math.max(w, k);
|
|
10349
10429
|
}), g -= p, f += p, x -= p, w += p;
|
|
10350
|
-
const m = r.clone().add(a.clone().multiplyScalar(g)).add(c.clone().multiplyScalar(x)), b = r.clone().add(a.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(x)), C = r.clone().add(a.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(w)),
|
|
10351
|
-
this.current_center = r.clone(), this.createFace(i, [m, b, C,
|
|
10430
|
+
const m = r.clone().add(a.clone().multiplyScalar(g)).add(c.clone().multiplyScalar(x)), b = r.clone().add(a.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(x)), C = r.clone().add(a.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(w)), S = r.clone().add(a.clone().multiplyScalar(g)).add(c.clone().multiplyScalar(w));
|
|
10431
|
+
this.current_center = r.clone(), this.createFace(i, [m, b, C, S], n, "face"), this.updateTransformControl(s), this.updateRotateControl(s);
|
|
10352
10432
|
}
|
|
10353
10433
|
createFace(e, t, i, n) {
|
|
10354
10434
|
const s = new ge(), o = new Float32Array([
|
|
@@ -10368,13 +10448,13 @@ class il {
|
|
|
10368
10448
|
s.setAttribute("position", new St(o, 3)), s.setIndex(a), s.computeVertexNormals();
|
|
10369
10449
|
let c = this.meshs.find((x) => x.name == n);
|
|
10370
10450
|
if (c == null) {
|
|
10371
|
-
const x = new
|
|
10451
|
+
const x = new oe({
|
|
10372
10452
|
color: 65280,
|
|
10373
10453
|
transparent: !0,
|
|
10374
10454
|
opacity: this.idleOpacity,
|
|
10375
|
-
side:
|
|
10455
|
+
side: re
|
|
10376
10456
|
});
|
|
10377
|
-
x.polygonOffset = !0, x.polygonOffsetFactor = 1, x.polygonOffsetUnits = 4, c = new
|
|
10457
|
+
x.polygonOffset = !0, x.polygonOffsetFactor = 1, x.polygonOffsetUnits = 4, c = new z(s, x), c.name = n, e.add(c), this.meshs.push(c);
|
|
10378
10458
|
} else
|
|
10379
10459
|
c.geometry = s;
|
|
10380
10460
|
c.normal = r.clone(), c.userData.excludeFromAmbientOcclusion = !0;
|
|
@@ -10397,7 +10477,7 @@ class il {
|
|
|
10397
10477
|
]), u = new He({ color: 255 }), p = new ge();
|
|
10398
10478
|
p.setAttribute("position", new St(h, 3));
|
|
10399
10479
|
let g = this.meshs.find((x) => x.name == n + "Line");
|
|
10400
|
-
g == null ? (g = new
|
|
10480
|
+
g == null ? (g = new It(p, u), g.name = n + "Line", e.add(g), this.meshs.push(g)) : (g.geometry = p, g.material = u);
|
|
10401
10481
|
const f = this.engine.sectionPlane.find((x) => x.name == n);
|
|
10402
10482
|
f && this.current_center && f.setFromNormalAndCoplanarPoint(
|
|
10403
10483
|
r,
|
|
@@ -10421,7 +10501,7 @@ class il {
|
|
|
10421
10501
|
e.forEach((t) => this.applyClippingToMaterial(t));
|
|
10422
10502
|
return;
|
|
10423
10503
|
}
|
|
10424
|
-
e && (e.clippingPlanes = this.engine.sectionPlane, e.clipShadows = !0, e.shadowSide =
|
|
10504
|
+
e && (e.clippingPlanes = this.engine.sectionPlane, e.clipShadows = !0, e.shadowSide = re, e.needsUpdate = !0);
|
|
10425
10505
|
}
|
|
10426
10506
|
requestShadowRefresh() {
|
|
10427
10507
|
const e = this.engine?.renderer?.shadowMap;
|
|
@@ -10502,7 +10582,7 @@ class il {
|
|
|
10502
10582
|
i,
|
|
10503
10583
|
e.clone().normalize()
|
|
10504
10584
|
);
|
|
10505
|
-
return new
|
|
10585
|
+
return new Se().setFromRotationMatrix(n);
|
|
10506
10586
|
}
|
|
10507
10587
|
keepSingleDirectionArrow(e, t = "X") {
|
|
10508
10588
|
const i = e.getHelper(), n = [];
|
|
@@ -10529,9 +10609,9 @@ class il {
|
|
|
10529
10609
|
const e = this.engine.renderer?.domElement, t = this.engine.camera;
|
|
10530
10610
|
if (!e || !t)
|
|
10531
10611
|
return;
|
|
10532
|
-
const i = new
|
|
10612
|
+
const i = new dt();
|
|
10533
10613
|
i.name = "SectionFaceTransformAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
10534
|
-
const n = new
|
|
10614
|
+
const n = new Et(t, e);
|
|
10535
10615
|
n.name = "SectionFaceTransformControl", n.setMode("translate"), n.setSpace("local"), n.showX = !0, n.showY = !1, n.showZ = !1, n.size = this.transformHandleSize, n.setColors(
|
|
10536
10616
|
this.transformHandleColor,
|
|
10537
10617
|
this.transformHandleColor,
|
|
@@ -10549,9 +10629,9 @@ class il {
|
|
|
10549
10629
|
const e = this.engine.renderer?.domElement, t = this.engine.camera;
|
|
10550
10630
|
if (!e || !t)
|
|
10551
10631
|
return;
|
|
10552
|
-
const i = new
|
|
10632
|
+
const i = new dt();
|
|
10553
10633
|
i.name = "SectionFaceRotateAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
10554
|
-
const n = new
|
|
10634
|
+
const n = new Et(t, e);
|
|
10555
10635
|
n.name = "SectionFaceRotateControl", n.setMode("rotate"), n.setSpace("local"), n.showX = !0, n.showY = !0, n.showZ = !1, n.size = this.rotateHandleSize, n.setColors(
|
|
10556
10636
|
this.transformHandleColor,
|
|
10557
10637
|
this.transformHandleColor,
|
|
@@ -10569,7 +10649,7 @@ class il {
|
|
|
10569
10649
|
updateTransformControl(e) {
|
|
10570
10650
|
if (this.ensureTransformControl(), !this.transformControl || !this.transformAnchor || !this.current_center)
|
|
10571
10651
|
return;
|
|
10572
|
-
const t = this.getTransformHandleOffset(), i = this.current_center.clone().add(e.clone().setLength(t)), n = new
|
|
10652
|
+
const t = this.getTransformHandleOffset(), i = this.current_center.clone().add(e.clone().setLength(t)), n = new Se().setFromUnitVectors(
|
|
10573
10653
|
new d(1, 0, 0),
|
|
10574
10654
|
e.clone().normalize().multiplyScalar(-1)
|
|
10575
10655
|
);
|
|
@@ -10734,10 +10814,10 @@ class sl {
|
|
|
10734
10814
|
constructor(e) {
|
|
10735
10815
|
this.engine = e, this.evaluator = new Ks();
|
|
10736
10816
|
const t = ee("/texture/fill.png", import.meta.url), i = new Je().load(t);
|
|
10737
|
-
i.wrapS =
|
|
10817
|
+
i.wrapS = ht, i.wrapT = ht, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new ki({
|
|
10738
10818
|
color: 14079687,
|
|
10739
10819
|
map: i,
|
|
10740
|
-
side:
|
|
10820
|
+
side: re,
|
|
10741
10821
|
toneMapped: !1
|
|
10742
10822
|
}), this.fillMaterial.clipShadows = !0, this.fillMaterial.clippingPlanes = e.sectionPlane;
|
|
10743
10823
|
}
|
|
@@ -10820,7 +10900,7 @@ class sl {
|
|
|
10820
10900
|
e.normal.y * p * g,
|
|
10821
10901
|
e.normal.z * p * g
|
|
10822
10902
|
);
|
|
10823
|
-
const f = new
|
|
10903
|
+
const f = new z(u, this.fillMaterial);
|
|
10824
10904
|
f.name = `${this.fillMeshName}_${t}`, f.frustumCulled = !1, f.renderOrder = 20, f.castShadow = !1, f.receiveShadow = !1, this.engine.scene.add(f), this.fillMeshes.set(t, f);
|
|
10825
10905
|
}
|
|
10826
10906
|
/**
|
|
@@ -10867,7 +10947,7 @@ class sl {
|
|
|
10867
10947
|
if (!(p?.instance === !0 || !Array.isArray(p?.infos)))
|
|
10868
10948
|
for (const g of p.infos) {
|
|
10869
10949
|
const f = g?.mesh;
|
|
10870
|
-
f instanceof
|
|
10950
|
+
f instanceof z && (i.has(f.uuid) || (i.add(f.uuid), t.push(f)));
|
|
10871
10951
|
}
|
|
10872
10952
|
}
|
|
10873
10953
|
}
|
|
@@ -10912,7 +10992,7 @@ class sl {
|
|
|
10912
10992
|
Math.max(t.y, i.y),
|
|
10913
10993
|
Math.max(t.z, i.z)
|
|
10914
10994
|
);
|
|
10915
|
-
return new
|
|
10995
|
+
return new R(n, s);
|
|
10916
10996
|
}
|
|
10917
10997
|
/**
|
|
10918
10998
|
* 候选 mesh 二次筛选:
|
|
@@ -10921,7 +11001,7 @@ class sl {
|
|
|
10921
11001
|
* - world bbox 必须与 plane 相交
|
|
10922
11002
|
*/
|
|
10923
11003
|
filterMeshesByBoxAndComplexity(e, t) {
|
|
10924
|
-
const i = [], n = new
|
|
11004
|
+
const i = [], n = new R();
|
|
10925
11005
|
for (const s of t) {
|
|
10926
11006
|
const o = s.geometry, r = o?.attributes?.position;
|
|
10927
11007
|
!o || !r || r.count === 0 || (o.index ? Math.floor(o.index.count / 3) : Math.floor(r.count / 3)) > this.maxTriangleCountPerMesh || (o.boundingBox || o.computeBoundingBox(), o.boundingBox && (n.copy(o.boundingBox), s.updateWorldMatrix(!0, !1), n.applyMatrix4(s.matrixWorld), e.intersectsBox(n) && (s.geometry.attributes.position.count > 500 || i.push(s))));
|
|
@@ -10935,7 +11015,7 @@ class sl {
|
|
|
10935
11015
|
* - 平移到 plane 上
|
|
10936
11016
|
*/
|
|
10937
11017
|
createPlaneBrush(e, t, i) {
|
|
10938
|
-
const n = new
|
|
11018
|
+
const n = new Ct(t, t, i), s = e.coplanarPoint(new d()), o = new Se().setFromUnitVectors(
|
|
10939
11019
|
new d(0, 0, 1),
|
|
10940
11020
|
e.normal.clone().normalize()
|
|
10941
11021
|
), r = new V().compose(s, o, new d(1, 1, 1));
|
|
@@ -10966,7 +11046,7 @@ class sl {
|
|
|
10966
11046
|
const i = t.getAttribute("position");
|
|
10967
11047
|
if (i && !t.getAttribute("uv")) {
|
|
10968
11048
|
const s = new Float32Array(i.count * 2);
|
|
10969
|
-
t.setAttribute("uv", new
|
|
11049
|
+
t.setAttribute("uv", new At(s, 2));
|
|
10970
11050
|
}
|
|
10971
11051
|
const n = /* @__PURE__ */ new Set(["position", "normal", "uv"]);
|
|
10972
11052
|
return Object.keys(t.attributes).forEach((s) => {
|
|
@@ -10988,8 +11068,8 @@ class sl {
|
|
|
10988
11068
|
if (!s || s.count < 3)
|
|
10989
11069
|
return n.dispose(), null;
|
|
10990
11070
|
const o = t.normal.clone().normalize(), r = new d(), a = new d(), c = new d(), h = new d(), u = new d(), p = new d(), g = new d(), f = new d(), x = new d(), w = Math.max(i * 0.35, 1e-4), m = Math.max(i * 0.7, 1e-4), b = [];
|
|
10991
|
-
for (let
|
|
10992
|
-
if (h.fromBufferAttribute(s,
|
|
11071
|
+
for (let S = 0; S < s.count; S += 3) {
|
|
11072
|
+
if (h.fromBufferAttribute(s, S), u.fromBufferAttribute(s, S + 1), p.fromBufferAttribute(s, S + 2), a.subVectors(u, h), c.subVectors(p, h), r.crossVectors(a, c), r.lengthSq() < 1e-14 || (r.normalize(), Math.abs(r.dot(o)) < 0.9))
|
|
10993
11073
|
continue;
|
|
10994
11074
|
const P = t.distanceToPoint(h), I = t.distanceToPoint(u), B = t.distanceToPoint(p), k = Math.min(P, I, B);
|
|
10995
11075
|
if (Math.max(P, I, B) - k > w)
|
|
@@ -11000,7 +11080,7 @@ class sl {
|
|
|
11000
11080
|
if (n.dispose(), b.length < 9)
|
|
11001
11081
|
return null;
|
|
11002
11082
|
const C = new ge();
|
|
11003
|
-
return C.setAttribute("position", new
|
|
11083
|
+
return C.setAttribute("position", new At(b, 3)), C.computeVertexNormals(), C;
|
|
11004
11084
|
}
|
|
11005
11085
|
applyPlanarUv(e, t) {
|
|
11006
11086
|
const i = e.getAttribute("position");
|
|
@@ -11087,7 +11167,7 @@ class ol {
|
|
|
11087
11167
|
let o = new d(1e8, 1e9, 1e10), r = new d(-1e8, -1e9, -1e10);
|
|
11088
11168
|
return s.forEach((a) => {
|
|
11089
11169
|
a.min.x < o.x && (o.x = a.min.x), a.min.y < o.y && (o.y = a.min.y), a.min.z < o.z && (o.z = a.min.z), a.max.x > r.x && (r.x = a.max.x), a.max.y > r.y && (r.y = a.max.y), a.max.z > r.z && (r.z = a.max.z);
|
|
11090
|
-
}), new
|
|
11170
|
+
}), new R(o, r);
|
|
11091
11171
|
}
|
|
11092
11172
|
}
|
|
11093
11173
|
// ****************************更新剖切值*******************************
|
|
@@ -11160,7 +11240,7 @@ class ol {
|
|
|
11160
11240
|
const c = this.intersectThreePlanes(n[o], n[r], n[a]);
|
|
11161
11241
|
c && this.isPointInsidePlanes(c, n) && this.pushUniquePoint(s, c);
|
|
11162
11242
|
}
|
|
11163
|
-
return s.length === 0 ? null : new
|
|
11243
|
+
return s.length === 0 ? null : new R().setFromPoints(s);
|
|
11164
11244
|
}
|
|
11165
11245
|
getEffectiveClippingPlanes() {
|
|
11166
11246
|
const e = Array.isArray(this.engine.sectionPlane) ? this.engine.sectionPlane : [];
|
|
@@ -11173,7 +11253,7 @@ class ol {
|
|
|
11173
11253
|
return [];
|
|
11174
11254
|
}
|
|
11175
11255
|
toBox3(e) {
|
|
11176
|
-
return e == null || e.min == null || e.max == null ? null : new
|
|
11256
|
+
return e == null || e.min == null || e.max == null ? null : new R(
|
|
11177
11257
|
new d(e.min.x, e.min.y, e.min.z),
|
|
11178
11258
|
new d(e.max.x, e.max.y, e.max.z)
|
|
11179
11259
|
);
|
|
@@ -11318,7 +11398,7 @@ class al {
|
|
|
11318
11398
|
totalTriangles: 0,
|
|
11319
11399
|
meshCount: 0
|
|
11320
11400
|
} : (this.engine.scene.traverse((n) => {
|
|
11321
|
-
if (n instanceof
|
|
11401
|
+
if (n instanceof z) {
|
|
11322
11402
|
const s = n.geometry;
|
|
11323
11403
|
if (s && s.attributes) {
|
|
11324
11404
|
const o = s.attributes.position;
|
|
@@ -11709,10 +11789,10 @@ class dl {
|
|
|
11709
11789
|
return Array.isArray(e) ? e : e && typeof e == "object" ? Object.values(e) : [];
|
|
11710
11790
|
}
|
|
11711
11791
|
toBox3(e) {
|
|
11712
|
-
if (e instanceof
|
|
11792
|
+
if (e instanceof R) return e.clone();
|
|
11713
11793
|
const t = e?.min ?? e?.Min, i = e?.max ?? e?.Max;
|
|
11714
11794
|
if (!t || !i) return;
|
|
11715
|
-
const n = new
|
|
11795
|
+
const n = new R(
|
|
11716
11796
|
new d(t.x ?? t.X, t.y ?? t.Y, t.z ?? t.Z),
|
|
11717
11797
|
new d(i.x ?? i.X, i.y ?? i.Y, i.z ?? i.Z)
|
|
11718
11798
|
);
|
|
@@ -11822,14 +11902,14 @@ class ul {
|
|
|
11822
11902
|
}), t && t(i), i;
|
|
11823
11903
|
}
|
|
11824
11904
|
}
|
|
11825
|
-
const
|
|
11905
|
+
const En = !1, pl = 51283, ml = 2718207;
|
|
11826
11906
|
class gl {
|
|
11827
11907
|
engine;
|
|
11828
11908
|
rootGroup;
|
|
11829
11909
|
meshMaterial;
|
|
11830
11910
|
instanceMaterial;
|
|
11831
11911
|
handleLoadingCompleted;
|
|
11832
|
-
isVisible =
|
|
11912
|
+
isVisible = En;
|
|
11833
11913
|
filterState = {
|
|
11834
11914
|
urls: null,
|
|
11835
11915
|
ids: null,
|
|
@@ -11837,7 +11917,7 @@ class gl {
|
|
|
11837
11917
|
showInstance: !0
|
|
11838
11918
|
};
|
|
11839
11919
|
constructor(e) {
|
|
11840
|
-
this.engine = e, this.rootGroup = new de(), this.rootGroup.name = "nodeBoxGroup", this.rootGroup.visible =
|
|
11920
|
+
this.engine = e, this.rootGroup = new de(), this.rootGroup.name = "nodeBoxGroup", this.rootGroup.visible = En, this.engine.scene?.add(this.rootGroup), this.meshMaterial = this.createMaterial(pl), this.instanceMaterial = this.createMaterial(ml), this.handleLoadingCompleted = () => {
|
|
11841
11921
|
this.isVisible && this.rebuild();
|
|
11842
11922
|
}, this.engine.events?.on?.(ie.LoadingCompleted, this.handleLoadingCompleted);
|
|
11843
11923
|
}
|
|
@@ -11883,7 +11963,7 @@ class gl {
|
|
|
11883
11963
|
this.appendBoxPositions(g.min, g.max, p);
|
|
11884
11964
|
});
|
|
11885
11965
|
});
|
|
11886
|
-
const r =
|
|
11966
|
+
const r = ze(this.engine, i.url);
|
|
11887
11967
|
this.addLineGroup(i.url, n, this.meshMaterial, "mesh", r), this.addLineGroup(i.url, s, this.instanceMaterial, "instance", r);
|
|
11888
11968
|
}), this.rootGroup.visible = this.isVisible, this.engine.requestComposerRender?.();
|
|
11889
11969
|
}
|
|
@@ -11931,7 +12011,7 @@ class gl {
|
|
|
11931
12011
|
e?.box
|
|
11932
12012
|
], i = /* @__PURE__ */ new Set(), n = [];
|
|
11933
12013
|
return t.forEach((s) => {
|
|
11934
|
-
if (!(s instanceof
|
|
12014
|
+
if (!(s instanceof R) || s.isEmpty())
|
|
11935
12015
|
return;
|
|
11936
12016
|
const o = `${s.min.x},${s.min.y},${s.min.z},${s.max.x},${s.max.y},${s.max.z}`;
|
|
11937
12017
|
i.has(o) || (i.add(o), n.push(s));
|
|
@@ -11944,7 +12024,7 @@ class gl {
|
|
|
11944
12024
|
for (const i of t) {
|
|
11945
12025
|
if (!Array.isArray(i) || i.length === 0)
|
|
11946
12026
|
continue;
|
|
11947
|
-
if (
|
|
12027
|
+
if (Le(this.engine, i[0]) instanceof W)
|
|
11948
12028
|
return !0;
|
|
11949
12029
|
}
|
|
11950
12030
|
return !1;
|
|
@@ -11953,7 +12033,7 @@ class gl {
|
|
|
11953
12033
|
if (t.length === 0)
|
|
11954
12034
|
return;
|
|
11955
12035
|
const o = new ge();
|
|
11956
|
-
o.setAttribute("position", new
|
|
12036
|
+
o.setAttribute("position", new At(t, 3)), o.computeBoundingSphere();
|
|
11957
12037
|
const r = new Xt(o, i);
|
|
11958
12038
|
r.name = `nodeBox:${n}`, r.frustumCulled = !1, r.userData.kind = n, r.userData.url = e, this.setLineTransform(r, s), this.rootGroup.add(r);
|
|
11959
12039
|
}
|
|
@@ -11968,7 +12048,7 @@ class gl {
|
|
|
11968
12048
|
e.matrixAutoUpdate = !1, e.matrix.copy(t), e.matrixWorldNeedsUpdate = !0, e.updateMatrixWorld(!0);
|
|
11969
12049
|
}
|
|
11970
12050
|
}
|
|
11971
|
-
const fl = "path-roaming-animation", yl = 8e3, Ml = 100,
|
|
12051
|
+
const fl = "path-roaming-animation", yl = 8e3, Ml = 100, Ot = 16;
|
|
11972
12052
|
class vl {
|
|
11973
12053
|
engine;
|
|
11974
12054
|
points = [];
|
|
@@ -12166,7 +12246,7 @@ class vl {
|
|
|
12166
12246
|
this.segments = [];
|
|
12167
12247
|
let i = 0;
|
|
12168
12248
|
for (let n = 0; n < this.activePoints.length - 1; n++) {
|
|
12169
|
-
const s = this.activePoints[n], o = this.activePoints[n + 1], r = Math.max(t[n] ??
|
|
12249
|
+
const s = this.activePoints[n], o = this.activePoints[n + 1], r = Math.max(t[n] ?? Ot, Number.EPSILON), a = this.toNonNegativeNumber(o.stayTime, 0), c = i + r, h = c + a;
|
|
12170
12250
|
this.segments.push({
|
|
12171
12251
|
fromPoint: s,
|
|
12172
12252
|
toPoint: o,
|
|
@@ -12190,16 +12270,16 @@ class vl {
|
|
|
12190
12270
|
const t = e.filter((o) => o <= 1e-9).length;
|
|
12191
12271
|
if (this.options.speed && Number.isFinite(this.options.speed) && this.options.speed > 0)
|
|
12192
12272
|
return e.map(
|
|
12193
|
-
(o) => o > 1e-9 ? o / this.options.speed * 1e3 :
|
|
12273
|
+
(o) => o > 1e-9 ? o / this.options.speed * 1e3 : Ot
|
|
12194
12274
|
);
|
|
12195
12275
|
const i = e.reduce((o, r) => o + r, 0);
|
|
12196
12276
|
if (i <= 1e-9) {
|
|
12197
12277
|
const o = this.options.duration / Math.max(e.length, 1);
|
|
12198
12278
|
return e.map(() => o);
|
|
12199
12279
|
}
|
|
12200
|
-
const n = t *
|
|
12280
|
+
const n = t * Ot, s = Math.max(this.options.duration - n, Number.EPSILON);
|
|
12201
12281
|
return e.map(
|
|
12202
|
-
(o) => o > 1e-9 ? s * (o / i) :
|
|
12282
|
+
(o) => o > 1e-9 ? s * (o / i) : Ot
|
|
12203
12283
|
);
|
|
12204
12284
|
}
|
|
12205
12285
|
/** 根据播放头计算并应用当前姿态。 */
|
|
@@ -12273,7 +12353,7 @@ class vl {
|
|
|
12273
12353
|
}
|
|
12274
12354
|
s.normalize();
|
|
12275
12355
|
const o = s.clone().cross(n).normalize(), r = n.clone().negate(), a = new V().makeBasis(s, o, r);
|
|
12276
|
-
return new
|
|
12356
|
+
return new Se().setFromRotationMatrix(a).normalize();
|
|
12277
12357
|
}
|
|
12278
12358
|
/** 直接更新相机;只有相机类型切换时才调用完整恢复流程。 */
|
|
12279
12359
|
applyPose(e) {
|
|
@@ -12367,7 +12447,7 @@ class vl {
|
|
|
12367
12447
|
if (n.lengthSq() > Number.EPSILON) return n.normalize();
|
|
12368
12448
|
}
|
|
12369
12449
|
const i = e?.rotation;
|
|
12370
|
-
return new
|
|
12450
|
+
return new Se().setFromEuler(new Ze(
|
|
12371
12451
|
this.toFiniteNumber(i?.x, 0),
|
|
12372
12452
|
this.toFiniteNumber(i?.y, 0),
|
|
12373
12453
|
this.toFiniteNumber(i?.z, 0),
|
|
@@ -12478,7 +12558,7 @@ class vl {
|
|
|
12478
12558
|
return { x: e.x, y: e.y, z: e.z };
|
|
12479
12559
|
}
|
|
12480
12560
|
toQuaternion(e) {
|
|
12481
|
-
return new
|
|
12561
|
+
return new Se(e.x, e.y, e.z, e.w).normalize();
|
|
12482
12562
|
}
|
|
12483
12563
|
fromQuaternion(e) {
|
|
12484
12564
|
return { x: e.x, y: e.y, z: e.z, w: e.w };
|
|
@@ -12876,7 +12956,7 @@ class xl {
|
|
|
12876
12956
|
c > Math.PI && (c -= 2 * Math.PI), c < -Math.PI && (c += 2 * Math.PI);
|
|
12877
12957
|
const h = n.target ? Math.max(i.position.distanceTo(n.target), 1e-3) : 10, u = this.engine.controlModule?.firstPersonControls, p = this.getThirdPersonControl();
|
|
12878
12958
|
if (u?.enabled) {
|
|
12879
|
-
const x = new d(0, 1, 0), w = new
|
|
12959
|
+
const x = new d(0, 1, 0), w = new Se().setFromAxisAngle(x, -c);
|
|
12880
12960
|
i.quaternion.premultiply(w), i.up.copy(x), i.updateMatrixWorld(!0);
|
|
12881
12961
|
const m = i.position.clone().add(i.getWorldDirection(new d()).multiplyScalar(h));
|
|
12882
12962
|
n.target?.copy(m), u.syncRotationStateFromCamera?.(), u.syncSharedTargetFromCamera?.();
|
|
@@ -13209,7 +13289,7 @@ class wl {
|
|
|
13209
13289
|
const i = e.ids.map((s) => t.nodesMap.get(s)).flatMap((s) => s?.infos?.map((o) => o?.box).filter(Boolean) ?? []);
|
|
13210
13290
|
if (i.length === 0)
|
|
13211
13291
|
return null;
|
|
13212
|
-
const n = new
|
|
13292
|
+
const n = new R();
|
|
13213
13293
|
n.copy(i[0]);
|
|
13214
13294
|
for (let s = 1; s < i.length; s++)
|
|
13215
13295
|
n.union(i[s]);
|
|
@@ -13249,7 +13329,7 @@ class bl {
|
|
|
13249
13329
|
update() {
|
|
13250
13330
|
}
|
|
13251
13331
|
}
|
|
13252
|
-
const
|
|
13332
|
+
const Sn = "bim-engine:link-element-2d3d-state", Pn = "link-element-2d3d";
|
|
13253
13333
|
class Cl {
|
|
13254
13334
|
engine;
|
|
13255
13335
|
constructor(e) {
|
|
@@ -13257,11 +13337,11 @@ class Cl {
|
|
|
13257
13337
|
}
|
|
13258
13338
|
// 激活
|
|
13259
13339
|
active() {
|
|
13260
|
-
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(
|
|
13340
|
+
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(Sn, this.listenLinkStateChange);
|
|
13261
13341
|
}
|
|
13262
13342
|
// 取消
|
|
13263
13343
|
disActive() {
|
|
13264
|
-
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(
|
|
13344
|
+
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(Sn, this.listenLinkStateChange), this.engine?.setIdleFrameRateExempt?.(Pn, !1);
|
|
13265
13345
|
}
|
|
13266
13346
|
dispose() {
|
|
13267
13347
|
this.disActive();
|
|
@@ -13333,12 +13413,12 @@ class Al {
|
|
|
13333
13413
|
i?.target ? (i.target.copy(a), i.update(), i.dispatchEvent?.({ type: "change" })) : t.lookAt(a);
|
|
13334
13414
|
}
|
|
13335
13415
|
}
|
|
13336
|
-
const
|
|
13416
|
+
const at = {
|
|
13337
13417
|
EncodingStart: "encoding-start",
|
|
13338
13418
|
EncodingComplete: "encoding-complete",
|
|
13339
13419
|
EncodingError: "encoding-error"
|
|
13340
13420
|
};
|
|
13341
|
-
class
|
|
13421
|
+
class El {
|
|
13342
13422
|
engine;
|
|
13343
13423
|
apiKey;
|
|
13344
13424
|
baseURL = "https://api.deepseek.com";
|
|
@@ -13419,14 +13499,14 @@ class Sl {
|
|
|
13419
13499
|
// 开始编码
|
|
13420
13500
|
async start() {
|
|
13421
13501
|
let e = ["注释", "族名称"], t = ["梁", "墩", "桩", "墙", "面", "台", "石", "支"];
|
|
13422
|
-
this.engine.events.trigger(
|
|
13502
|
+
this.engine.events.trigger(at.EncodingStart, { message: "编码开始" });
|
|
13423
13503
|
let i = [], n = "";
|
|
13424
13504
|
if (this.engine.models.forEach((c) => {
|
|
13425
13505
|
n = c.url, c.nodesMap.forEach((h, u) => {
|
|
13426
13506
|
t.some((p) => h.infos[0].name.includes(p)) && i.push({ id: u, url: c.url });
|
|
13427
13507
|
});
|
|
13428
13508
|
}), i.length === 0) {
|
|
13429
|
-
this.engine.events.trigger(
|
|
13509
|
+
this.engine.events.trigger(at.EncodingComplete, { message: "无匹配构件", results: [] });
|
|
13430
13510
|
return;
|
|
13431
13511
|
}
|
|
13432
13512
|
let s = await this.queryProperties(i, e);
|
|
@@ -13434,7 +13514,7 @@ class Sl {
|
|
|
13434
13514
|
let r = [], a = Math.ceil(s.length / o);
|
|
13435
13515
|
for (let c = 0; c < s.length; c += o) {
|
|
13436
13516
|
let h = s.slice(c, c + o), u = Math.floor(c / o) + 1;
|
|
13437
|
-
this.engine.events.trigger(
|
|
13517
|
+
this.engine.events.trigger(at.EncodingStart, {
|
|
13438
13518
|
message: `正在编码第 ${u}/${a} 批`,
|
|
13439
13519
|
batch: u,
|
|
13440
13520
|
totalBatches: a
|
|
@@ -13443,13 +13523,13 @@ class Sl {
|
|
|
13443
13523
|
let p = await this.startChat(n, JSON.stringify(h));
|
|
13444
13524
|
r = r.concat(p);
|
|
13445
13525
|
} catch (p) {
|
|
13446
|
-
this.engine.events.trigger(
|
|
13526
|
+
this.engine.events.trigger(at.EncodingError, {
|
|
13447
13527
|
message: `第 ${u} 批编码失败`,
|
|
13448
13528
|
error: p
|
|
13449
13529
|
});
|
|
13450
13530
|
}
|
|
13451
13531
|
}
|
|
13452
|
-
this.engine.events.trigger(
|
|
13532
|
+
this.engine.events.trigger(at.EncodingComplete, {
|
|
13453
13533
|
message: "编码完成",
|
|
13454
13534
|
url: n,
|
|
13455
13535
|
results: r,
|
|
@@ -13490,7 +13570,7 @@ class Sl {
|
|
|
13490
13570
|
r.set(a.id, c);
|
|
13491
13571
|
}), this.engine.modelProperties.updateExtended(e, r), this.savaModelCodeToStoge(e), o;
|
|
13492
13572
|
} catch (i) {
|
|
13493
|
-
return console.error("编码失败:", i), this.engine.events.trigger(
|
|
13573
|
+
return console.error("编码失败:", i), this.engine.events.trigger(at.EncodingError, {
|
|
13494
13574
|
message: "编码失败",
|
|
13495
13575
|
error: i
|
|
13496
13576
|
}), [];
|
|
@@ -13526,7 +13606,7 @@ class Sl {
|
|
|
13526
13606
|
}
|
|
13527
13607
|
}
|
|
13528
13608
|
}
|
|
13529
|
-
const ui = 1 / 0.3048,
|
|
13609
|
+
const ui = 1 / 0.3048, Sl = 1, Pl = 1.8, Tn = /* @__PURE__ */ new Set([
|
|
13530
13610
|
"dynamic-elevation-bar-area",
|
|
13531
13611
|
"dynamic-elevation-guest-area",
|
|
13532
13612
|
"dynamic-elevation-door-head-area"
|
|
@@ -13656,7 +13736,7 @@ class kl {
|
|
|
13656
13736
|
* 相机始终在观察面外侧偏移固定距离,且高度统一锁定为 1.8 米。
|
|
13657
13737
|
*/
|
|
13658
13738
|
createCameraPosition(e, t) {
|
|
13659
|
-
const i = e.clone().add(t.clone().multiplyScalar(
|
|
13739
|
+
const i = e.clone().add(t.clone().multiplyScalar(Sl));
|
|
13660
13740
|
return i.y = Pl, i;
|
|
13661
13741
|
}
|
|
13662
13742
|
/**
|
|
@@ -13707,7 +13787,7 @@ class kl {
|
|
|
13707
13787
|
const i = e?.nodesMap;
|
|
13708
13788
|
if (!(i instanceof Map))
|
|
13709
13789
|
return [];
|
|
13710
|
-
const n =
|
|
13790
|
+
const n = ze(this.engine, e.url), s = [];
|
|
13711
13791
|
return i.forEach((o) => {
|
|
13712
13792
|
const r = this.normalizeName(this.getNodeName(o));
|
|
13713
13793
|
if (!r || !t.some((c) => r.includes(this.normalizeName(c))))
|
|
@@ -13740,7 +13820,7 @@ class kl {
|
|
|
13740
13820
|
];
|
|
13741
13821
|
let n = null;
|
|
13742
13822
|
return i.forEach((s) => {
|
|
13743
|
-
if (!(s instanceof
|
|
13823
|
+
if (!(s instanceof R) || s.isEmpty())
|
|
13744
13824
|
return;
|
|
13745
13825
|
const o = s.clone().applyMatrix4(t);
|
|
13746
13826
|
n ? n.union(o) : n = o;
|
|
@@ -13832,16 +13912,16 @@ class kl {
|
|
|
13832
13912
|
};
|
|
13833
13913
|
}
|
|
13834
13914
|
}
|
|
13835
|
-
const
|
|
13915
|
+
const Ft = {
|
|
13836
13916
|
ceilingPlan: "天花平面",
|
|
13837
13917
|
floorPlan: "楼层平面",
|
|
13838
13918
|
elevation: "立面视图",
|
|
13839
13919
|
section: "剖面视图"
|
|
13840
13920
|
}, Ll = {
|
|
13841
|
-
ceilingPlan: [
|
|
13842
|
-
floorPlan: [
|
|
13843
|
-
elevation: [
|
|
13844
|
-
section: [
|
|
13921
|
+
ceilingPlan: [Ft.ceilingPlan, "天花"],
|
|
13922
|
+
floorPlan: [Ft.floorPlan, "楼层"],
|
|
13923
|
+
elevation: [Ft.elevation, "立面"],
|
|
13924
|
+
section: [Ft.section, "剖面"]
|
|
13845
13925
|
};
|
|
13846
13926
|
class Ui {
|
|
13847
13927
|
static OPEN_VIEW_ANIMATION_DURATION = 1e3;
|
|
@@ -13939,7 +14019,7 @@ class Ui {
|
|
|
13939
14019
|
u.X ?? u.x,
|
|
13940
14020
|
u.Z ?? u.z,
|
|
13941
14021
|
-(u.Y ?? u.y)
|
|
13942
|
-
).setLength(r), b = x ? x.distanceTo(w) : null, C = s.__dynamic === !0,
|
|
14022
|
+
).setLength(r), b = x ? x.distanceTo(w) : null, C = s.__dynamic === !0, S = Ui.OPEN_VIEW_ANIMATION_DURATION;
|
|
13943
14023
|
if (s.disableClipping === !0)
|
|
13944
14024
|
this.engine.clipping?.disActive?.();
|
|
13945
14025
|
else {
|
|
@@ -13949,9 +14029,9 @@ class Ui {
|
|
|
13949
14029
|
m.clone().multiplyScalar(a),
|
|
13950
14030
|
c,
|
|
13951
14031
|
b,
|
|
13952
|
-
|
|
14032
|
+
S,
|
|
13953
14033
|
C ? void 0 : () => {
|
|
13954
|
-
s.focusBox instanceof
|
|
14034
|
+
s.focusBox instanceof R && !s.focusBox.isEmpty() ? this.engine.viewCube?.zoomToModel?.(s.focusBox, 0) : I && this.zoomToCurrentViewRange(0);
|
|
13955
14035
|
}
|
|
13956
14036
|
);
|
|
13957
14037
|
return;
|
|
@@ -13961,9 +14041,9 @@ class Ui {
|
|
|
13961
14041
|
m.clone().multiplyScalar(a),
|
|
13962
14042
|
c,
|
|
13963
14043
|
b,
|
|
13964
|
-
|
|
14044
|
+
S,
|
|
13965
14045
|
C ? void 0 : () => {
|
|
13966
|
-
s.focusBox instanceof
|
|
14046
|
+
s.focusBox instanceof R && !s.focusBox.isEmpty() && this.engine.viewCube?.zoomToModel?.(s.focusBox, 0);
|
|
13967
14047
|
}
|
|
13968
14048
|
);
|
|
13969
14049
|
}
|
|
@@ -14094,8 +14174,8 @@ function Fl(l, e, t) {
|
|
|
14094
14174
|
if (!i || !n || !s)
|
|
14095
14175
|
return null;
|
|
14096
14176
|
const o = new On(e, t, {
|
|
14097
|
-
minFilter:
|
|
14098
|
-
magFilter:
|
|
14177
|
+
minFilter: Kt,
|
|
14178
|
+
magFilter: Kt,
|
|
14099
14179
|
format: Fn,
|
|
14100
14180
|
depthBuffer: !0,
|
|
14101
14181
|
stencilBuffer: !0
|
|
@@ -14720,7 +14800,7 @@ class Ql {
|
|
|
14720
14800
|
});
|
|
14721
14801
|
return O.annotationType = "arrow", O;
|
|
14722
14802
|
}
|
|
14723
|
-
const a = s / r, c = o / r, h = -c, u = a, p = Math.max(10, i.strokeWidth * 6), g = p * 0.72, f = t.x - a * p, x = t.y - c * p, w = f + h * (g * 0.5), m = x + u * (g * 0.5), b = f - h * (g * 0.5), C = x - u * (g * 0.5),
|
|
14803
|
+
const a = s / r, c = o / r, h = -c, u = a, p = Math.max(10, i.strokeWidth * 6), g = p * 0.72, f = t.x - a * p, x = t.y - c * p, w = f + h * (g * 0.5), m = x + u * (g * 0.5), b = f - h * (g * 0.5), C = x - u * (g * 0.5), S = new si([e.x, e.y, t.x, t.y], {
|
|
14724
14804
|
stroke: i.stroke,
|
|
14725
14805
|
strokeWidth: i.strokeWidth,
|
|
14726
14806
|
fill: "",
|
|
@@ -14734,7 +14814,7 @@ class Ql {
|
|
|
14734
14814
|
selectable: !1,
|
|
14735
14815
|
evented: !1,
|
|
14736
14816
|
objectCaching: !1
|
|
14737
|
-
}), B = new Xi([
|
|
14817
|
+
}), B = new Xi([S, I], {
|
|
14738
14818
|
selectable: n,
|
|
14739
14819
|
evented: n,
|
|
14740
14820
|
objectCaching: !1
|
|
@@ -14785,7 +14865,7 @@ class Ql {
|
|
|
14785
14865
|
continue;
|
|
14786
14866
|
const g = -u / p, f = h / p, x = Math.max(1, Math.round(p / n));
|
|
14787
14867
|
for (let w = 1; w <= x; w++) {
|
|
14788
|
-
const m = w / x, b = a.x + h * m, C = a.y + u * m,
|
|
14868
|
+
const m = w / x, b = a.x + h * m, C = a.y + u * m, S = o % 2 === 0 ? -1 : 1, P = b + g * i * S, I = C + f * i * S;
|
|
14789
14869
|
s += ` Q ${P} ${I} ${b} ${C}`, o++;
|
|
14790
14870
|
}
|
|
14791
14871
|
}
|
|
@@ -15972,7 +16052,7 @@ class ic {
|
|
|
15972
16052
|
return { id: e.instance.id, annotation: e.instance, originalEvent: t };
|
|
15973
16053
|
}
|
|
15974
16054
|
}
|
|
15975
|
-
const
|
|
16055
|
+
const Ee = {
|
|
15976
16056
|
color: "#7ffcff",
|
|
15977
16057
|
opacity: 0.92,
|
|
15978
16058
|
fillColor: "#7ffcff",
|
|
@@ -16169,13 +16249,13 @@ const Se = {
|
|
|
16169
16249
|
minWidth: "120px",
|
|
16170
16250
|
pointerEvents: "auto"
|
|
16171
16251
|
}, sc = "bim-engine-annotation3d-panels";
|
|
16172
|
-
function
|
|
16252
|
+
function Gt(l) {
|
|
16173
16253
|
return l.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
16174
16254
|
}
|
|
16175
16255
|
function J(l) {
|
|
16176
16256
|
return new d(l.x, l.y, l.z);
|
|
16177
16257
|
}
|
|
16178
|
-
function
|
|
16258
|
+
function Nt(l) {
|
|
16179
16259
|
const e = new d();
|
|
16180
16260
|
return l.length === 0 ? e : (l.forEach((t) => e.add(J(t))), e.multiplyScalar(1 / l.length));
|
|
16181
16261
|
}
|
|
@@ -16232,29 +16312,29 @@ function cc(l) {
|
|
|
16232
16312
|
}
|
|
16233
16313
|
class hc {
|
|
16234
16314
|
render(e) {
|
|
16235
|
-
const t = e.instance.style.leaderPoint ?? {}, i = t.strokeColor || e.instance.style.color || "#7ffcff", n = t.backgroundColor || e.instance.style.fillColor || i, s = t.borderColor || i, o = t.anchorColor || n, r = t.anchorRingColor || i, a = t.iconBackgroundColor || n, c = t.side ?? "right", h = t.icon ? this.escapeXmlAttribute(t.icon) : "", u = Math.max(t.iconWidth ?? 22, 1), p = Math.max(t.iconHeight ?? 22, 1), g = (t.text ?? "").trim(), f = Math.max(t.fontSize ?? 14, 10), x = t.textColor || e.instance.style.color || "#ffffff", w = t.fontWeight ?? 500, m = Math.max(Math.round((t.height ?? 8) * 12), 48), b = Math.max(Math.round(Math.abs(t.offsetX ?? t.armLength ?? 4) * 18), 56), C = this.getBoardWidth(e, g, f),
|
|
16236
|
-
<rect x="${
|
|
16315
|
+
const t = e.instance.style.leaderPoint ?? {}, i = t.strokeColor || e.instance.style.color || "#7ffcff", n = t.backgroundColor || e.instance.style.fillColor || i, s = t.borderColor || i, o = t.anchorColor || n, r = t.anchorRingColor || i, a = t.iconBackgroundColor || n, c = t.side ?? "right", h = t.icon ? this.escapeXmlAttribute(t.icon) : "", u = Math.max(t.iconWidth ?? 22, 1), p = Math.max(t.iconHeight ?? 22, 1), g = (t.text ?? "").trim(), f = Math.max(t.fontSize ?? 14, 10), x = t.textColor || e.instance.style.color || "#ffffff", w = t.fontWeight ?? 500, m = Math.max(Math.round((t.height ?? 8) * 12), 48), b = Math.max(Math.round(Math.abs(t.offsetX ?? t.armLength ?? 4) * 18), 56), C = this.getBoardWidth(e, g, f), S = Math.max(Math.round((t.boardHeight ?? 1.8) * 22), f + 18, 34), P = Math.max(Math.round((t.stemWidth ?? e.instance.style.lineWidth ?? 0.12) * 20), 2), I = t.borderWidth ?? 2.5, B = t.variant ?? "elbow", k = c === "right" ? 22 + b - 8 : 22 - b - C + 8, O = 8, q = Math.min(22, k) - 16, te = Math.max(22, k + C) + 16, Q = Math.max(te - q, 140), ce = Math.max(m + S + 36, 120), ae = 22 - q, le = k - q, ue = ce - 18, Ae = Math.max(ue - m, 14), y = c === "right" ? le : le + C, M = O + Math.round(S * 0.5), E = B === "vertical" ? [`${ae},${ue}`, `${ae},${Ae}`] : [`${ae},${ue}`, `${ae},${M}`, `${y},${M}`], _ = e.instance.selectable !== !1, D = _ ? "visiblePainted" : "none", T = _ ? "pointer" : "default", N = le + (h || !g ? 38 : 12), H = t.showBoard === !1 ? "" : `
|
|
16316
|
+
<rect x="${le}" y="${O}" width="${C}" height="${S}" rx="10"
|
|
16237
16317
|
fill="${n}" fill-opacity="${t.backgroundOpacity ?? t.boardOpacity ?? 0.18}"
|
|
16238
16318
|
stroke="${s}" stroke-width="${I}" />
|
|
16239
|
-
${t.iconBackgroundOpacity && t.iconBackgroundOpacity > 0 ? `<circle cx="${
|
|
16240
|
-
${h ? `<image href="${h}" x="${
|
|
16319
|
+
${t.iconBackgroundOpacity && t.iconBackgroundOpacity > 0 ? `<circle cx="${le + 19}" cy="${O + 17}" r="11" fill="${a}" fill-opacity="${t.iconBackgroundOpacity}" />` : ""}
|
|
16320
|
+
${h ? `<image href="${h}" x="${le + 8}" y="${O + 6}" width="${u}" height="${p}" preserveAspectRatio="xMidYMid meet" />` : g ? "" : `<circle cx="${le + 19}" cy="${O + 17}" r="8" fill="${i}" />`}
|
|
16241
16321
|
${g ? `<text x="${N}" y="${M}" fill="${x}" font-size="${f}" font-weight="${this.escapeXmlAttribute(String(w))}" dominant-baseline="middle">${this.escapeXmlText(g)}</text>` : ""}
|
|
16242
16322
|
`, K = t.showAnchor === !1 ? "" : `
|
|
16243
|
-
<circle cx="${
|
|
16244
|
-
<circle cx="${
|
|
16323
|
+
<circle cx="${ae}" cy="${ue}" r="7" fill="${o}" fill-opacity="0.92" />
|
|
16324
|
+
<circle cx="${ae}" cy="${ue}" r="10" fill="none" stroke="${r}" stroke-width="2" stroke-opacity="0.9" />
|
|
16245
16325
|
`;
|
|
16246
16326
|
return `
|
|
16247
16327
|
<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${ce}" viewBox="0 0 ${Q} ${ce}" style="pointer-events:none;overflow:visible">
|
|
16248
16328
|
<g style="pointer-events:${D};cursor:${T}">
|
|
16249
16329
|
<polyline
|
|
16250
|
-
points="${
|
|
16330
|
+
points="${E.join(" ")}"
|
|
16251
16331
|
fill="none"
|
|
16252
16332
|
stroke="transparent"
|
|
16253
16333
|
stroke-width="${Math.max(P + 10, 12)}"
|
|
16254
16334
|
pointer-events="stroke"
|
|
16255
16335
|
/>
|
|
16256
16336
|
<polyline
|
|
16257
|
-
points="${
|
|
16337
|
+
points="${E.join(" ")}"
|
|
16258
16338
|
fill="none"
|
|
16259
16339
|
stroke="${i}"
|
|
16260
16340
|
stroke-width="${P}"
|
|
@@ -16463,12 +16543,12 @@ class mc {
|
|
|
16463
16543
|
if (pc.has(e.instance.type))
|
|
16464
16544
|
n.copy(J(e.instance.points[0])), i === "top" && (n.y += e.volumeHeight ?? 0);
|
|
16465
16545
|
else if (e.instance.type === "polyline" || e.instance.type === "curve3d")
|
|
16466
|
-
i === "start" ? n.copy(J(e.instance.points[0])) : i === "end" ? n.copy(J(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(
|
|
16546
|
+
i === "start" ? n.copy(J(e.instance.points[0])) : i === "end" ? n.copy(J(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(Nt(e.instance.points));
|
|
16467
16547
|
else if (e.instance.type === "polygon")
|
|
16468
|
-
n.copy(
|
|
16548
|
+
n.copy(Nt(e.instance.points));
|
|
16469
16549
|
else if (e.instance.type === "extrudePolygon")
|
|
16470
|
-
n.copy(
|
|
16471
|
-
else if (e.instance.type === "box" && (n.copy(
|
|
16550
|
+
n.copy(Nt(e.instance.points)), i === "top" && e.anchorNormal && n.add(e.anchorNormal.clone().multiplyScalar(e.volumeHeight ?? 0));
|
|
16551
|
+
else if (e.instance.type === "box" && (n.copy(Nt(e.instance.points)), i === "top" && e.instance.points.length >= 2)) {
|
|
16472
16552
|
const s = J(e.instance.points[0]), o = J(e.instance.points[1]);
|
|
16473
16553
|
n.y = Math.max(s.y, o.y);
|
|
16474
16554
|
}
|
|
@@ -16489,7 +16569,7 @@ class fc {
|
|
|
16489
16569
|
createSurfaceMaterial(e) {
|
|
16490
16570
|
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, a = i.pulse?.enabled === !0, c = i.scan?.enabled === !0, h = i.flow?.direction === "backward" ? -1 : 1, u = new Xs({
|
|
16491
16571
|
transparent: !0,
|
|
16492
|
-
side:
|
|
16572
|
+
side: re,
|
|
16493
16573
|
depthTest: t.alwaysOnTop ? !1 : t.depthTest !== !1,
|
|
16494
16574
|
depthWrite: !1,
|
|
16495
16575
|
uniforms: {
|
|
@@ -16642,7 +16722,7 @@ class Ue {
|
|
|
16642
16722
|
createTubeMesh(e, t, i, n, s, o, r = 10, a = !1) {
|
|
16643
16723
|
const c = new Zs(t, i, n, r, a);
|
|
16644
16724
|
c.computeBoundingBox();
|
|
16645
|
-
const h = c.boundingBox ?? new
|
|
16725
|
+
const h = c.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), u = this.materialFactory.createSurfaceMaterial({
|
|
16646
16726
|
color: s.color ?? "#7ffcff",
|
|
16647
16727
|
opacity: s.opacity ?? 0.92,
|
|
16648
16728
|
style: s,
|
|
@@ -16650,7 +16730,7 @@ class Ue {
|
|
|
16650
16730
|
axisMode: "uvx",
|
|
16651
16731
|
axisMin: h.min.x,
|
|
16652
16732
|
axisMax: h.max.x
|
|
16653
|
-
}), p = new
|
|
16733
|
+
}), p = new z(c, u);
|
|
16654
16734
|
return e.animatedMaterials.push(u), p;
|
|
16655
16735
|
}
|
|
16656
16736
|
createLoopLine(e, t, i) {
|
|
@@ -16670,9 +16750,9 @@ class yc extends Ue {
|
|
|
16670
16750
|
build(e) {
|
|
16671
16751
|
if (e.instance.points.length < 2)
|
|
16672
16752
|
return;
|
|
16673
|
-
const t = J(e.instance.points[0]), i = J(e.instance.points[1]), n = t.clone().min(i), s = t.clone().max(i), o = s.clone().sub(n), r = n.clone().add(s).multiplyScalar(0.5), a = new
|
|
16753
|
+
const t = J(e.instance.points[0]), i = J(e.instance.points[1]), n = t.clone().min(i), s = t.clone().max(i), o = s.clone().sub(n), r = n.clone().add(s).multiplyScalar(0.5), a = new Ct(o.x || 0.1, o.y || 0.1, o.z || 0.1);
|
|
16674
16754
|
a.computeBoundingBox();
|
|
16675
|
-
const c = a.boundingBox ?? new
|
|
16755
|
+
const c = a.boundingBox ?? new R(
|
|
16676
16756
|
new d(-0.5, -0.5, -0.5),
|
|
16677
16757
|
new d(0.5, 0.5, 0.5)
|
|
16678
16758
|
), h = this.materialFactory.createSurfaceMaterial({
|
|
@@ -16683,7 +16763,7 @@ class yc extends Ue {
|
|
|
16683
16763
|
axisMode: "y",
|
|
16684
16764
|
axisMin: c.min.y,
|
|
16685
16765
|
axisMax: c.max.y
|
|
16686
|
-
}), u = new
|
|
16766
|
+
}), u = new z(a, h);
|
|
16687
16767
|
u.position.copy(r), e.instance.root.add(u);
|
|
16688
16768
|
const p = new He({
|
|
16689
16769
|
color: e.instance.style.volume?.edgeColor ?? "#d9ffff",
|
|
@@ -16727,7 +16807,7 @@ class vc extends Ue {
|
|
|
16727
16807
|
curveSegments: 24
|
|
16728
16808
|
});
|
|
16729
16809
|
s.computeBoundingBox();
|
|
16730
|
-
const o = s.boundingBox ?? new
|
|
16810
|
+
const o = s.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), r = this.materialFactory.createSurfaceMaterial({
|
|
16731
16811
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
16732
16812
|
opacity: e.instance.style.fillOpacity ?? 0.22,
|
|
16733
16813
|
style: e.instance.style,
|
|
@@ -16735,7 +16815,7 @@ class vc extends Ue {
|
|
|
16735
16815
|
axisMode: "z",
|
|
16736
16816
|
axisMin: o.min.z,
|
|
16737
16817
|
axisMax: o.max.z
|
|
16738
|
-
}), a = new
|
|
16818
|
+
}), a = new z(s, r);
|
|
16739
16819
|
a.applyMatrix4(t.matrix), e.instance.root.add(a), e.anchorNormal = t.normal, e.volumeHeight = n, this.appendLayerLoops(e, t.normal), e.instance.root.add(
|
|
16740
16820
|
this.createLoopLine(
|
|
16741
16821
|
e.instance.points,
|
|
@@ -16836,18 +16916,18 @@ class Cc extends Ue {
|
|
|
16836
16916
|
axisMode: "y",
|
|
16837
16917
|
axisMin: -s * 0.5,
|
|
16838
16918
|
axisMax: s * 0.5
|
|
16839
|
-
}), c = new
|
|
16919
|
+
}), c = new z(o, a);
|
|
16840
16920
|
if (c.position.y = s * 0.5, e.instance.root.add(c), e.animatedMaterials.push(a), t.showBaseRing !== !1) {
|
|
16841
|
-
const h = new
|
|
16921
|
+
const h = new oe({
|
|
16842
16922
|
color: t.baseRingColor ?? r,
|
|
16843
16923
|
transparent: !0,
|
|
16844
16924
|
opacity: F.clamp(t.baseRingOpacity ?? 0.72, 0, 1),
|
|
16845
|
-
side:
|
|
16925
|
+
side: re,
|
|
16846
16926
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1,
|
|
16847
16927
|
depthWrite: !1
|
|
16848
16928
|
});
|
|
16849
16929
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
16850
|
-
const u = new
|
|
16930
|
+
const u = new z(
|
|
16851
16931
|
new Gn(
|
|
16852
16932
|
Math.max(t.baseRingInnerRadius ?? 1.9, 1e-3),
|
|
16853
16933
|
Math.max(t.baseRingOuterRadius ?? 2.4, (t.baseRingInnerRadius ?? 1.9) + 1e-3),
|
|
@@ -16864,7 +16944,7 @@ class Ac extends Ue {
|
|
|
16864
16944
|
build(e) {
|
|
16865
16945
|
const t = ws(e.instance.points), i = bs(t.localPoints), n = new no(i);
|
|
16866
16946
|
n.computeBoundingBox();
|
|
16867
|
-
const s = n.boundingBox ?? new
|
|
16947
|
+
const s = n.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
16868
16948
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
16869
16949
|
opacity: e.instance.style.fillOpacity ?? 0.18,
|
|
16870
16950
|
style: e.instance.style,
|
|
@@ -16872,7 +16952,7 @@ class Ac extends Ue {
|
|
|
16872
16952
|
axisMode: "y",
|
|
16873
16953
|
axisMin: s.min.y,
|
|
16874
16954
|
axisMax: s.max.y
|
|
16875
|
-
}), r = new
|
|
16955
|
+
}), r = new z(n, o);
|
|
16876
16956
|
r.applyMatrix4(t.matrix), e.instance.root.add(r), e.anchorNormal = t.normal, e.instance.style.polygon?.showEdge !== !1 && e.instance.root.add(
|
|
16877
16957
|
this.createLoopLine(
|
|
16878
16958
|
e.instance.points,
|
|
@@ -16882,7 +16962,7 @@ class Ac extends Ue {
|
|
|
16882
16962
|
), e.animatedMaterials.push(o);
|
|
16883
16963
|
}
|
|
16884
16964
|
}
|
|
16885
|
-
class
|
|
16965
|
+
class Ec extends Ue {
|
|
16886
16966
|
type = "polyline";
|
|
16887
16967
|
build(e) {
|
|
16888
16968
|
const t = e.instance.points.map((s) => J(s)), i = this.createSegmentCurve(t), n = this.createTubeMesh(
|
|
@@ -16896,13 +16976,13 @@ class Sc extends Ue {
|
|
|
16896
16976
|
e.instance.root.add(n), e.anchorCurve = i, e.panelAnchorPoint = i.getPoint(0.5);
|
|
16897
16977
|
}
|
|
16898
16978
|
}
|
|
16899
|
-
class
|
|
16979
|
+
class Sc extends Ue {
|
|
16900
16980
|
type = "ripplePoint";
|
|
16901
16981
|
/** 根据波纹参数创建中心点和错相扩散圆环。 */
|
|
16902
16982
|
build(e) {
|
|
16903
16983
|
const t = e.instance.style.ripplePoint ?? {}, i = J(e.instance.points[0]), n = new d(t.offsetX ?? 0, t.offsetY ?? 0, t.offsetZ ?? 0);
|
|
16904
16984
|
if (e.instance.root.position.copy(i).add(n), e.panelAnchorPoint = i.clone().add(n), t.showCenter !== !1) {
|
|
16905
|
-
const c = new
|
|
16985
|
+
const c = new oe({
|
|
16906
16986
|
color: t.centerColor ?? t.color ?? "#7ffcff",
|
|
16907
16987
|
transparent: !0,
|
|
16908
16988
|
opacity: F.clamp(t.centerOpacity ?? 0.92, 0, 1),
|
|
@@ -16910,7 +16990,7 @@ class Ec extends Ue {
|
|
|
16910
16990
|
depthWrite: !1
|
|
16911
16991
|
});
|
|
16912
16992
|
c.clippingPlanes = this.engine.sectionPlane;
|
|
16913
|
-
const h = new
|
|
16993
|
+
const h = new z(
|
|
16914
16994
|
new Yt(Math.max(t.centerRadius ?? 0.28, 0.01), 20, 16),
|
|
16915
16995
|
c
|
|
16916
16996
|
);
|
|
@@ -16918,16 +16998,16 @@ class Ec extends Ue {
|
|
|
16918
16998
|
}
|
|
16919
16999
|
const s = Math.max(1, Math.floor(t.count ?? 3)), o = Math.max(t.maxRadius ?? 8, 0.02), r = F.clamp(t.ringWidth ?? 0.12, 1e-3, o), a = Math.max(12, Math.floor(t.segments ?? 48));
|
|
16920
17000
|
for (let c = 0; c < s; c += 1) {
|
|
16921
|
-
const h = new
|
|
17001
|
+
const h = new oe({
|
|
16922
17002
|
color: t.color ?? "#7ffcff",
|
|
16923
17003
|
transparent: !0,
|
|
16924
17004
|
opacity: F.clamp(t.opacity ?? 0.55, 0, 1),
|
|
16925
|
-
side:
|
|
17005
|
+
side: re,
|
|
16926
17006
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1,
|
|
16927
17007
|
depthWrite: !1
|
|
16928
17008
|
});
|
|
16929
17009
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
16930
|
-
const u = new
|
|
17010
|
+
const u = new z(
|
|
16931
17011
|
new Gn(Math.max(o - r, 1e-3), o, a),
|
|
16932
17012
|
h
|
|
16933
17013
|
);
|
|
@@ -16947,10 +17027,10 @@ function Tc(l, e) {
|
|
|
16947
17027
|
new xc(l, e),
|
|
16948
17028
|
new Pc(l, e),
|
|
16949
17029
|
new wc(l, e),
|
|
16950
|
-
new
|
|
17030
|
+
new Sc(l, e),
|
|
16951
17031
|
new Cc(l, e),
|
|
16952
17032
|
new bc(l, e),
|
|
16953
|
-
new
|
|
17033
|
+
new Ec(l, e),
|
|
16954
17034
|
new Mc(l, e),
|
|
16955
17035
|
new Ac(l, e),
|
|
16956
17036
|
new vc(l, e),
|
|
@@ -16976,7 +17056,7 @@ class _c {
|
|
|
16976
17056
|
const t = {
|
|
16977
17057
|
...e,
|
|
16978
17058
|
id: e.id ?? `annotation3d-${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
16979
|
-
points:
|
|
17059
|
+
points: Gt(e.points ?? []),
|
|
16980
17060
|
visible: e.visible ?? !0,
|
|
16981
17061
|
selectable: e.selectable ?? !0,
|
|
16982
17062
|
style: this.mergeStyle(e.style),
|
|
@@ -16998,7 +17078,7 @@ class _c {
|
|
|
16998
17078
|
return this.normalizeData({
|
|
16999
17079
|
id: n,
|
|
17000
17080
|
type: i.type ?? e.type,
|
|
17001
|
-
points: i.points ?
|
|
17081
|
+
points: i.points ? Gt(i.points) : Gt(e.points),
|
|
17002
17082
|
visible: i.visible ?? e.visible,
|
|
17003
17083
|
selectable: i.selectable ?? e.selectable,
|
|
17004
17084
|
style: {
|
|
@@ -17034,30 +17114,30 @@ class _c {
|
|
|
17034
17114
|
}
|
|
17035
17115
|
mergeStyle(e) {
|
|
17036
17116
|
return {
|
|
17037
|
-
...
|
|
17117
|
+
...Ee,
|
|
17038
17118
|
...e,
|
|
17039
17119
|
iconPoint: {
|
|
17040
|
-
...
|
|
17120
|
+
...Ee.iconPoint,
|
|
17041
17121
|
...e?.iconPoint ?? {},
|
|
17042
|
-
background: { ...
|
|
17122
|
+
background: { ...Ee.iconPoint?.background, ...e?.iconPoint?.background ?? {} }
|
|
17043
17123
|
},
|
|
17044
17124
|
textPoint: {
|
|
17045
|
-
...
|
|
17125
|
+
...Ee.textPoint,
|
|
17046
17126
|
...e?.textPoint ?? {},
|
|
17047
|
-
background: { ...
|
|
17127
|
+
background: { ...Ee.textPoint?.background, ...e?.textPoint?.background ?? {} }
|
|
17048
17128
|
},
|
|
17049
17129
|
iconTextPoint: {
|
|
17050
|
-
...
|
|
17130
|
+
...Ee.iconTextPoint,
|
|
17051
17131
|
...e?.iconTextPoint ?? {},
|
|
17052
|
-
background: { ...
|
|
17132
|
+
background: { ...Ee.iconTextPoint?.background, ...e?.iconTextPoint?.background ?? {} }
|
|
17053
17133
|
},
|
|
17054
|
-
ripplePoint: { ...
|
|
17055
|
-
pillarPoint: { ...
|
|
17056
|
-
leaderPoint: { ...
|
|
17057
|
-
line: { ...
|
|
17058
|
-
curve: { ...
|
|
17059
|
-
polygon: { ...
|
|
17060
|
-
volume: { ...
|
|
17134
|
+
ripplePoint: { ...Ee.ripplePoint, ...e?.ripplePoint ?? {} },
|
|
17135
|
+
pillarPoint: { ...Ee.pillarPoint, ...e?.pillarPoint ?? {} },
|
|
17136
|
+
leaderPoint: { ...Ee.leaderPoint, ...e?.leaderPoint ?? {} },
|
|
17137
|
+
line: { ...Ee.line, ...e?.line ?? {} },
|
|
17138
|
+
curve: { ...Ee.curve, ...e?.curve ?? {} },
|
|
17139
|
+
polygon: { ...Ee.polygon, ...e?.polygon ?? {} },
|
|
17140
|
+
volume: { ...Ee.volume, ...e?.volume ?? {} }
|
|
17061
17141
|
};
|
|
17062
17142
|
}
|
|
17063
17143
|
mergeEffect(e) {
|
|
@@ -17151,16 +17231,16 @@ function kc(l) {
|
|
|
17151
17231
|
return {
|
|
17152
17232
|
id: l.instance.id,
|
|
17153
17233
|
type: l.instance.type,
|
|
17154
|
-
points:
|
|
17234
|
+
points: Gt(l.instance.points),
|
|
17155
17235
|
visible: l.instance.visible,
|
|
17156
17236
|
selectable: l.instance.selectable,
|
|
17157
|
-
style:
|
|
17158
|
-
effect:
|
|
17159
|
-
panel: l.instance.panel ?
|
|
17160
|
-
data:
|
|
17237
|
+
style: Ht(l.instance.style),
|
|
17238
|
+
effect: Ht(l.instance.effect),
|
|
17239
|
+
panel: l.instance.panel ? Ht(l.instance.panel) : void 0,
|
|
17240
|
+
data: Ht(l.instance.data)
|
|
17161
17241
|
};
|
|
17162
17242
|
}
|
|
17163
|
-
function
|
|
17243
|
+
function Ht(l) {
|
|
17164
17244
|
return l === void 0 ? l : JSON.parse(JSON.stringify(l));
|
|
17165
17245
|
}
|
|
17166
17246
|
class Lc {
|
|
@@ -17358,7 +17438,7 @@ class Rc {
|
|
|
17358
17438
|
this.engine.events?.trigger?.(e, t);
|
|
17359
17439
|
}
|
|
17360
17440
|
}
|
|
17361
|
-
class
|
|
17441
|
+
class lt {
|
|
17362
17442
|
constructor(e) {
|
|
17363
17443
|
this.engine = e, typeof window < "u" && window.addEventListener("keydown", this.onKeyDown);
|
|
17364
17444
|
}
|
|
@@ -17392,7 +17472,7 @@ class at {
|
|
|
17392
17472
|
applyInternal(e, t) {
|
|
17393
17473
|
if (!e?.url || e.matrix == null)
|
|
17394
17474
|
return !1;
|
|
17395
|
-
const i = this.toThreeMatrix(e.matrix), n = this.getMatrix(e.url), s =
|
|
17475
|
+
const i = this.toThreeMatrix(e.matrix), n = this.getMatrix(e.url), s = it(this.engine, e.url);
|
|
17396
17476
|
return t.saveHistory !== !1 && this.pushHistory(e.url, n), s.matrixAutoUpdate = !1, s.matrix.copy(i), s.matrixWorldNeedsUpdate = !0, s.updateMatrixWorld(!0), this.clearRuntimeWorldBoxCache(s), this.engine.octreeBox?.invalidateModelWorldCache?.(e.url), this.matrices.set(e.url, i.clone()), this.updateCachedModelBox(e.url, s), this.engine.modelEdge?.setModelEdgeTransform?.(e.url, i), this.engine.nodeBox?.setModelBoxTransform?.(e.url, i), this.engine.requestComposerRender?.(), this.notifyChange(e.url, i, n, t), !0;
|
|
17397
17477
|
}
|
|
17398
17478
|
/**
|
|
@@ -17413,7 +17493,7 @@ class at {
|
|
|
17413
17493
|
throw new Error("[Calibration] source and target segments must have valid length");
|
|
17414
17494
|
o.normalize(), r.normalize();
|
|
17415
17495
|
const a = new V().makeRotationFromQuaternion(
|
|
17416
|
-
new
|
|
17496
|
+
new Se().setFromUnitVectors(o, r)
|
|
17417
17497
|
), c = new V().makeTranslation(n.x, n.y, n.z).multiply(a).multiply(new V().makeTranslation(-t.x, -t.y, -t.z)), h = this.getMatrix(e.url);
|
|
17418
17498
|
return this.applyInternal({
|
|
17419
17499
|
url: e.url,
|
|
@@ -17444,7 +17524,7 @@ class at {
|
|
|
17444
17524
|
throw new Error("[Calibration] source and target segments must have valid length");
|
|
17445
17525
|
r.normalize(), a.normalize();
|
|
17446
17526
|
const c = new V().makeRotationFromQuaternion(
|
|
17447
|
-
new
|
|
17527
|
+
new Se().setFromUnitVectors(r, a)
|
|
17448
17528
|
), h = new V().makeTranslation(s.x, s.y, s.z).multiply(c).multiply(new V().makeTranslation(-i.x, -i.y, -i.z)), u = this.getMatrix(this.pointCalibrationUrl);
|
|
17449
17529
|
this.applyInternal({
|
|
17450
17530
|
url: this.pointCalibrationUrl,
|
|
@@ -17489,12 +17569,12 @@ class at {
|
|
|
17489
17569
|
this.drawCalibrationSegment(
|
|
17490
17570
|
t,
|
|
17491
17571
|
n,
|
|
17492
|
-
|
|
17572
|
+
lt.sourceColor,
|
|
17493
17573
|
i.length < 2 ? e : null
|
|
17494
17574
|
), this.drawCalibrationSegment(
|
|
17495
17575
|
t,
|
|
17496
17576
|
s,
|
|
17497
|
-
|
|
17577
|
+
lt.targetColor,
|
|
17498
17578
|
i.length >= 2 && i.length < 4 ? e : null
|
|
17499
17579
|
);
|
|
17500
17580
|
}
|
|
@@ -17516,12 +17596,12 @@ class at {
|
|
|
17516
17596
|
}
|
|
17517
17597
|
/** 向捕捉 SVG 追加线段。 */
|
|
17518
17598
|
appendSvgLine(e, t, i, n, s = !1) {
|
|
17519
|
-
const o = document.createElementNS(
|
|
17599
|
+
const o = document.createElementNS(lt.svgNamespace, "line");
|
|
17520
17600
|
o.setAttribute("x1", `${t.x}`), o.setAttribute("y1", `${t.y}`), o.setAttribute("x2", `${i.x}`), o.setAttribute("y2", `${i.y}`), o.setAttribute("stroke", n), o.setAttribute("stroke-width", s ? "2" : "3"), s && o.setAttribute("stroke-dasharray", "6 4"), e.appendChild(o);
|
|
17521
17601
|
}
|
|
17522
17602
|
/** 向捕捉 SVG 追加确认点或半透明的当前捕捉预览点。 */
|
|
17523
17603
|
appendSvgPoint(e, t, i, n = !1) {
|
|
17524
|
-
const s = document.createElementNS(
|
|
17604
|
+
const s = document.createElementNS(lt.svgNamespace, "circle");
|
|
17525
17605
|
s.setAttribute("cx", `${t.x}`), s.setAttribute("cy", `${t.y}`), s.setAttribute("r", n ? "6" : "5"), s.setAttribute("fill", n ? "transparent" : i), s.setAttribute("fill-opacity", n ? "0" : "1"), s.setAttribute("stroke", i), s.setAttribute("stroke-width", n ? "2" : "1"), n && s.setAttribute("stroke-dasharray", "3 2"), e.appendChild(s);
|
|
17526
17606
|
}
|
|
17527
17607
|
/** 清理四点校准留下的 SVG 覆盖元素。 */
|
|
@@ -17590,7 +17670,7 @@ class at {
|
|
|
17590
17670
|
this.engine.events?.trigger?.(ie.ModelCalibrationChanged, s);
|
|
17591
17671
|
}
|
|
17592
17672
|
createChangeEvent(e, t, i, n) {
|
|
17593
|
-
const s = new d(), o = new
|
|
17673
|
+
const s = new d(), o = new Se(), r = new d();
|
|
17594
17674
|
t.decompose(s, o, r);
|
|
17595
17675
|
const a = new Ze().setFromQuaternion(o, "XYZ"), c = [
|
|
17596
17676
|
F.radToDeg(a.x),
|
|
@@ -17628,7 +17708,7 @@ class at {
|
|
|
17628
17708
|
min: i.boundingBox.min.clone(),
|
|
17629
17709
|
max: i.boundingBox.max.clone()
|
|
17630
17710
|
});
|
|
17631
|
-
const n = new
|
|
17711
|
+
const n = new R(
|
|
17632
17712
|
i.localBoundingBox.min.clone(),
|
|
17633
17713
|
i.localBoundingBox.max.clone()
|
|
17634
17714
|
);
|
|
@@ -17639,7 +17719,7 @@ class at {
|
|
|
17639
17719
|
}
|
|
17640
17720
|
clearRuntimeWorldBoxCache(e) {
|
|
17641
17721
|
e.traverse((t) => {
|
|
17642
|
-
t?.box instanceof
|
|
17722
|
+
t?.box instanceof R && delete t.box;
|
|
17643
17723
|
});
|
|
17644
17724
|
}
|
|
17645
17725
|
toThreeMatrix(e) {
|
|
@@ -17991,7 +18071,7 @@ class Hc {
|
|
|
17991
18071
|
this.syncTransformControlCamera();
|
|
17992
18072
|
return;
|
|
17993
18073
|
}
|
|
17994
|
-
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new
|
|
18074
|
+
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new Et(this.engine.camera, this.engine.renderer.domElement), this.transformControl.addEventListener("dragging-changed", (e) => {
|
|
17995
18075
|
this.engine.controls && (this.engine.controls.enabled = !e.value), e.value ? this.saveHistory() : this.syncSelectedTransform();
|
|
17996
18076
|
}), this.transformControl.addEventListener("objectChange", () => this.requestRender()), this.transformHelper = this.transformControl.getHelper(), this.transformHelper.visible = !1, this.engine.scene.add(this.transformHelper), this.syncTransformControlCamera());
|
|
17997
18077
|
}
|
|
@@ -18651,19 +18731,19 @@ class Uc {
|
|
|
18651
18731
|
translucentMaterial;
|
|
18652
18732
|
/** 初始化代理材质,并继承当前剖切平面配置。 */
|
|
18653
18733
|
constructor(e) {
|
|
18654
|
-
this.engine = e, this.highlightMaterial = new
|
|
18734
|
+
this.engine = e, this.highlightMaterial = new oe({
|
|
18655
18735
|
color: 43775,
|
|
18656
18736
|
depthTest: !1,
|
|
18657
18737
|
depthWrite: !1,
|
|
18658
18738
|
transparent: !0,
|
|
18659
18739
|
opacity: 0.45,
|
|
18660
|
-
side:
|
|
18661
|
-
}), this.translucentMaterial = new
|
|
18740
|
+
side: re
|
|
18741
|
+
}), this.translucentMaterial = new oe({
|
|
18662
18742
|
color: 16777215,
|
|
18663
18743
|
transparent: !0,
|
|
18664
18744
|
opacity: 0.08,
|
|
18665
18745
|
depthWrite: !1,
|
|
18666
|
-
side:
|
|
18746
|
+
side: re
|
|
18667
18747
|
}), this.highlightMaterial.clippingPlanes = this.engine.sectionPlane, this.translucentMaterial.clippingPlanes = this.engine.sectionPlane;
|
|
18668
18748
|
}
|
|
18669
18749
|
/**
|
|
@@ -18776,10 +18856,10 @@ class Uc {
|
|
|
18776
18856
|
* 这里以代理对象的实时 matrixWorld 为准,因此滑块拖动和动画过程中也能得到正确位置。
|
|
18777
18857
|
*/
|
|
18778
18858
|
getExplodedWorldBox(e, t) {
|
|
18779
|
-
const i = new
|
|
18859
|
+
const i = new R().makeEmpty();
|
|
18780
18860
|
let n = !1;
|
|
18781
18861
|
return this.records.forEach((s) => {
|
|
18782
|
-
s.url !== e || !this.isSameId(s.id, t) || !s.proxy.visible || (s.proxy.updateWorldMatrix(!0, !1), i.union(new
|
|
18862
|
+
s.url !== e || !this.isSameId(s.id, t) || !s.proxy.visible || (s.proxy.updateWorldMatrix(!0, !1), i.union(new R().setFromObject(s.proxy)), n = !0);
|
|
18783
18863
|
}), n && !i.isEmpty() ? i : null;
|
|
18784
18864
|
}
|
|
18785
18865
|
/**
|
|
@@ -18813,7 +18893,7 @@ class Uc {
|
|
|
18813
18893
|
* 这里提前缓存整体包围盒、模型中心和分组包围盒,避免每个构件重复遍历 nodesMap。
|
|
18814
18894
|
*/
|
|
18815
18895
|
buildExplodeContext(e, t) {
|
|
18816
|
-
const i = new
|
|
18896
|
+
const i = new R().makeEmpty(), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
18817
18897
|
return e.forEach((r) => {
|
|
18818
18898
|
const a = this.getEngineModel(r.url), c = this.getModelWorldBox(a);
|
|
18819
18899
|
c != null && !c.isEmpty() && (s.set(r.url, c.getCenter(new d())), o.set(r.url, Math.max(1, c.getSize(new d()).length()))), r.ids.forEach((h) => {
|
|
@@ -18822,7 +18902,7 @@ class Uc {
|
|
|
18822
18902
|
return;
|
|
18823
18903
|
i.union(p);
|
|
18824
18904
|
const g = this.getGroupKey(r.url, h, t.mode);
|
|
18825
|
-
n.has(g) || n.set(g, new
|
|
18905
|
+
n.has(g) || n.set(g, new R().makeEmpty()), n.get(g)?.union(p);
|
|
18826
18906
|
});
|
|
18827
18907
|
}), {
|
|
18828
18908
|
box: i,
|
|
@@ -18868,8 +18948,8 @@ class Uc {
|
|
|
18868
18948
|
createRecord(e, t, i, n) {
|
|
18869
18949
|
if (!Array.isArray(i) || i.length < 2)
|
|
18870
18950
|
return;
|
|
18871
|
-
const s =
|
|
18872
|
-
if (!(s instanceof
|
|
18951
|
+
const s = Le(this.engine, i[0]);
|
|
18952
|
+
if (!(s instanceof z))
|
|
18873
18953
|
return;
|
|
18874
18954
|
const o = s instanceof W ? "instance" : "mesh", r = o === "instance" ? this.createInstanceProxy(s, i[1], e, t) : this.createMeshProxy(s, i[1], e, t);
|
|
18875
18955
|
if (r == null)
|
|
@@ -18896,7 +18976,7 @@ class Uc {
|
|
|
18896
18976
|
const s = Array.isArray(e.geometrys) ? e.geometrys[t] : null;
|
|
18897
18977
|
if (!(s instanceof ge))
|
|
18898
18978
|
return null;
|
|
18899
|
-
const o = new
|
|
18979
|
+
const o = new z(s.clone(), this.cloneProxyMaterial(e.material));
|
|
18900
18980
|
return o.geometry.computeVertexNormals(), o.castShadow = e.castShadow === !0, o.receiveShadow = e.receiveShadow === !0, this.assignProxyIdentity(o, i, n), (e.parent ?? this.engine.scene).add(o), o;
|
|
18901
18981
|
}
|
|
18902
18982
|
/**
|
|
@@ -18911,7 +18991,7 @@ class Uc {
|
|
|
18911
18991
|
return null;
|
|
18912
18992
|
const o = e.geometry.clone();
|
|
18913
18993
|
o.applyMatrix4(s);
|
|
18914
|
-
const r = new
|
|
18994
|
+
const r = new z(o, this.cloneProxyMaterial(e.material));
|
|
18915
18995
|
return r.geometry.computeVertexNormals(), r.castShadow = e.castShadow === !0, r.receiveShadow = e.receiveShadow === !0, this.assignProxyIdentity(r, i, n), (e.parent ?? this.engine.scene).add(r), r;
|
|
18916
18996
|
}
|
|
18917
18997
|
/** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
|
|
@@ -19044,7 +19124,7 @@ class Uc {
|
|
|
19044
19124
|
* 当前普通构件代理以主材质为准;高亮、半透明和自定义颜色会在 applyProxyVisualState 中覆盖。
|
|
19045
19125
|
*/
|
|
19046
19126
|
cloneProxyMaterial(e) {
|
|
19047
|
-
const t = Array.isArray(e) ? e[0] : e, i = typeof t?.clone == "function" ? t.clone() : new
|
|
19127
|
+
const t = Array.isArray(e) ? e[0] : e, i = typeof t?.clone == "function" ? t.clone() : new oe({ color: 16777215, side: re });
|
|
19048
19128
|
return i.clippingPlanes = this.engine.sectionPlane, i.needsUpdate = !0, i;
|
|
19049
19129
|
}
|
|
19050
19130
|
/**
|
|
@@ -19056,17 +19136,17 @@ class Uc {
|
|
|
19056
19136
|
...Array.isArray(t?.infos) ? t.infos.map((o) => o?.box) : [],
|
|
19057
19137
|
t?.info?.box,
|
|
19058
19138
|
t?.box
|
|
19059
|
-
].filter((o) => o instanceof
|
|
19139
|
+
].filter((o) => o instanceof R && !o.isEmpty());
|
|
19060
19140
|
if (i.length === 0)
|
|
19061
19141
|
return null;
|
|
19062
|
-
const n =
|
|
19142
|
+
const n = ze(this.engine, e.url), s = new R().makeEmpty();
|
|
19063
19143
|
return i.forEach((o) => s.union(o.clone().applyMatrix4(n))), s.isEmpty() ? null : s;
|
|
19064
19144
|
}
|
|
19065
19145
|
/** 计算单个模型在世界坐标下的整体包围盒,作为默认爆炸原点的依据。 */
|
|
19066
19146
|
getModelWorldBox(e) {
|
|
19067
19147
|
if (e?.nodesMap == null)
|
|
19068
19148
|
return null;
|
|
19069
|
-
const t = new
|
|
19149
|
+
const t = new R().makeEmpty();
|
|
19070
19150
|
return e.nodesMap.forEach((i) => {
|
|
19071
19151
|
const n = this.getNodeWorldBox(e, i);
|
|
19072
19152
|
n != null && !n.isEmpty() && t.union(n);
|
|
@@ -19157,7 +19237,7 @@ const Ln = "bim-material-editor-style", tt = [
|
|
|
19157
19237
|
"aoMap",
|
|
19158
19238
|
"bumpMap",
|
|
19159
19239
|
"emissiveMap"
|
|
19160
|
-
],
|
|
19240
|
+
], Si = {
|
|
19161
19241
|
map: "颜色贴图",
|
|
19162
19242
|
normalMap: "法线贴图",
|
|
19163
19243
|
roughnessMap: "粗糙贴图",
|
|
@@ -19185,7 +19265,7 @@ class Wc {
|
|
|
19185
19265
|
}), Array.from(t.values());
|
|
19186
19266
|
}
|
|
19187
19267
|
collectFromScene() {
|
|
19188
|
-
const e = /* @__PURE__ */ new Map(), t =
|
|
19268
|
+
const e = /* @__PURE__ */ new Map(), t = Pt(this.engine, (i) => this.getObjectMaterials(i).length > 0);
|
|
19189
19269
|
return t.forEach((i) => {
|
|
19190
19270
|
this.getObjectMaterials(i).forEach((n) => this.mergeMaterialOption(e, n, [i]));
|
|
19191
19271
|
}), t.length === 0 && this.engine.scene?.traverse?.((i) => {
|
|
@@ -19198,11 +19278,11 @@ class Wc {
|
|
|
19198
19278
|
collectFromNode(e) {
|
|
19199
19279
|
const t = /* @__PURE__ */ new Map();
|
|
19200
19280
|
return (Array.isArray(e?.indexes) ? e.indexes : []).forEach((s) => {
|
|
19201
|
-
const o =
|
|
19202
|
-
o instanceof
|
|
19281
|
+
const o = Le(this.engine, s?.[0]);
|
|
19282
|
+
o instanceof dt && this.getObjectMaterials(o).forEach((r) => this.mergeMaterialOption(t, r, [o]));
|
|
19203
19283
|
}), (Array.isArray(e?.infos) ? e.infos : []).forEach((s) => {
|
|
19204
19284
|
const o = s?.mesh;
|
|
19205
|
-
o instanceof
|
|
19285
|
+
o instanceof dt && this.getObjectMaterials(o).forEach((r) => this.mergeMaterialOption(t, r, [o]));
|
|
19206
19286
|
}), Array.from(t.values());
|
|
19207
19287
|
}
|
|
19208
19288
|
getObjectMaterials(e) {
|
|
@@ -19311,7 +19391,7 @@ function As(l, e, t) {
|
|
|
19311
19391
|
}
|
|
19312
19392
|
(e in i || e in l) && (i[e] = t);
|
|
19313
19393
|
}
|
|
19314
|
-
function
|
|
19394
|
+
function Vt(l) {
|
|
19315
19395
|
const e = l;
|
|
19316
19396
|
return {
|
|
19317
19397
|
id: l.uuid,
|
|
@@ -19328,7 +19408,7 @@ function Ht(l) {
|
|
|
19328
19408
|
wireframe: typeof e.wireframe == "boolean" ? e.wireframe : void 0,
|
|
19329
19409
|
textures: tt.filter((t) => t in e).map((t) => ({
|
|
19330
19410
|
slot: t,
|
|
19331
|
-
name:
|
|
19411
|
+
name: Si[t],
|
|
19332
19412
|
url: ei(e[t]),
|
|
19333
19413
|
hasTexture: e[t] instanceof Ye
|
|
19334
19414
|
}))
|
|
@@ -19435,7 +19515,7 @@ class Kc {
|
|
|
19435
19515
|
t.appendChild(this.createElement("div", "bim-material-editor__section-title", "贴图"));
|
|
19436
19516
|
const i = e;
|
|
19437
19517
|
return tt.filter((n) => n in i).forEach((n) => {
|
|
19438
|
-
const s = this.createElement("div", "bim-material-editor__texture-row"), o = this.createElement("label", "",
|
|
19518
|
+
const s = this.createElement("div", "bim-material-editor__texture-row"), o = this.createElement("label", "", Si[n]), r = document.createElement("input");
|
|
19439
19519
|
r.type = "text", r.placeholder = "输入贴图 URL", r.value = ei(i[n]), r.addEventListener("change", () => {
|
|
19440
19520
|
this.host.setTexture(e.uuid, n, r.value.trim() || null);
|
|
19441
19521
|
});
|
|
@@ -19444,7 +19524,7 @@ class Kc {
|
|
|
19444
19524
|
const h = a.files?.[0];
|
|
19445
19525
|
h != null && this.host.setTexture(e.uuid, n, h);
|
|
19446
19526
|
});
|
|
19447
|
-
const c = this.createButton("清除", `清除${
|
|
19527
|
+
const c = this.createButton("清除", `清除${Si[n]}`, () => {
|
|
19448
19528
|
r.value = "", this.host.setTexture(e.uuid, n, null);
|
|
19449
19529
|
});
|
|
19450
19530
|
s.append(o, r, a, c), t.appendChild(s);
|
|
@@ -19490,7 +19570,7 @@ class Kc {
|
|
|
19490
19570
|
return [
|
|
19491
19571
|
{ label: "正面", value: ro },
|
|
19492
19572
|
{ label: "背面", value: Li },
|
|
19493
|
-
{ label: "双面", value:
|
|
19573
|
+
{ label: "双面", value: re }
|
|
19494
19574
|
].forEach((s) => {
|
|
19495
19575
|
const o = document.createElement("option");
|
|
19496
19576
|
o.value = String(s.value), o.textContent = s.label, o.selected = s.value === e, n.appendChild(o);
|
|
@@ -19625,7 +19705,7 @@ class Yc {
|
|
|
19625
19705
|
}
|
|
19626
19706
|
/** 显示编辑器,可同时传入目标对象或构件选择信息。 */
|
|
19627
19707
|
show(e) {
|
|
19628
|
-
this.visible = !0, this.panel.ensureRoot(), e != null ? e instanceof
|
|
19708
|
+
this.visible = !0, this.panel.ensureRoot(), e != null ? e instanceof dt ? this.selectObject(e) : this.selectTarget(e) : this.render();
|
|
19629
19709
|
}
|
|
19630
19710
|
/** 隐藏编辑器但保留已有修改记录。 */
|
|
19631
19711
|
hide() {
|
|
@@ -19651,19 +19731,19 @@ class Yc {
|
|
|
19651
19731
|
}
|
|
19652
19732
|
/** 只读取目标对象材质,不改变当前 UI 选择。 */
|
|
19653
19733
|
getMaterialsByObject(e) {
|
|
19654
|
-
return this.collector.collectFromObject(e).map((t) =>
|
|
19734
|
+
return this.collector.collectFromObject(e).map((t) => Vt(t.material));
|
|
19655
19735
|
}
|
|
19656
19736
|
/** 只读取指定构件材质,不改变当前 UI 选择。 */
|
|
19657
19737
|
getMaterialsByTarget(e) {
|
|
19658
|
-
return this.collector.collectFromTarget(e).map((t) =>
|
|
19738
|
+
return this.collector.collectFromTarget(e).map((t) => Vt(t.material));
|
|
19659
19739
|
}
|
|
19660
19740
|
/** 读取当前场景中所有可编辑材质。 */
|
|
19661
19741
|
getAllSceneMaterials() {
|
|
19662
|
-
return this.collectSceneMaterials().map((e) =>
|
|
19742
|
+
return this.collectSceneMaterials().map((e) => Vt(e.material));
|
|
19663
19743
|
}
|
|
19664
19744
|
/** 返回当前选择对象上可编辑的材质信息。 */
|
|
19665
19745
|
getSelectedMaterials() {
|
|
19666
|
-
return this.selectedMaterials.map((e) =>
|
|
19746
|
+
return this.selectedMaterials.map((e) => Vt(e.material));
|
|
19667
19747
|
}
|
|
19668
19748
|
/** 返回全场景相对快照发生变化的材质信息。 */
|
|
19669
19749
|
getModifiedMaterials() {
|
|
@@ -19763,7 +19843,7 @@ class Yc {
|
|
|
19763
19843
|
}
|
|
19764
19844
|
replaceTexture(e, t, i) {
|
|
19765
19845
|
const n = e, s = n[t];
|
|
19766
|
-
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? je : ao, i.wrapS =
|
|
19846
|
+
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? je : ao, i.wrapS = ht, i.wrapT = ht, i.needsUpdate = !0, this.ownedTextures.add(i)), n[t] = i, e.needsUpdate = !0, this.requestRender();
|
|
19767
19847
|
}
|
|
19768
19848
|
loadTexture(e) {
|
|
19769
19849
|
return new Promise((t, i) => {
|
|
@@ -19811,7 +19891,7 @@ class Xc {
|
|
|
19811
19891
|
const b = String(m?.code ?? "").trim();
|
|
19812
19892
|
if (b.length !== 0) {
|
|
19813
19893
|
if (b.length > 12) {
|
|
19814
|
-
const C = a.find((
|
|
19894
|
+
const C = a.find((S) => b.includes(String(S?.id ?? "")));
|
|
19815
19895
|
if (C == null)
|
|
19816
19896
|
return;
|
|
19817
19897
|
this.setelementInfo(e.url, h, {
|
|
@@ -19867,7 +19947,7 @@ class Xc {
|
|
|
19867
19947
|
n != null && (n.has(t) || n.set(t, []), n.get(t)?.push(i));
|
|
19868
19948
|
}
|
|
19869
19949
|
}
|
|
19870
|
-
const
|
|
19950
|
+
const Ut = {
|
|
19871
19951
|
lineType: "bezier",
|
|
19872
19952
|
lineColor: "#22c55e",
|
|
19873
19953
|
previewColor: "#f59e0b",
|
|
@@ -19894,9 +19974,9 @@ class Zc {
|
|
|
19894
19974
|
pointsGroup = new de();
|
|
19895
19975
|
points = [];
|
|
19896
19976
|
history = [];
|
|
19897
|
-
options = { ...
|
|
19898
|
-
lineType =
|
|
19899
|
-
roundedRadius =
|
|
19977
|
+
options = { ...Ut };
|
|
19978
|
+
lineType = Ut.lineType;
|
|
19979
|
+
roundedRadius = Ut.roundedRadius;
|
|
19900
19980
|
line = null;
|
|
19901
19981
|
previewLine = null;
|
|
19902
19982
|
previewMarker = null;
|
|
@@ -19923,7 +20003,7 @@ class Zc {
|
|
|
19923
20003
|
}
|
|
19924
20004
|
/** 打开路径编辑器;重复打开会先彻底清理上一次会话。 */
|
|
19925
20005
|
open(e = {}) {
|
|
19926
|
-
this.active && this.close(), this.options = { ...
|
|
20006
|
+
this.active && this.close(), this.options = { ...Ut, ...e }, this.pathId = e.id ?? `path-${Date.now()}`, this.lineType = this.options.lineType, this.roundedRadius = Math.max(0, this.options.roundedRadius), this.active = !0, this.mode = "editing", this.engine.scene?.add(this.root), this.ensureTransformControl(), this.createPanel(), this.activateBehavior(), window.addEventListener("keydown", this.onKeyDown, !0), this.refreshAll();
|
|
19927
20007
|
}
|
|
19928
20008
|
/** 点击“添加点”后进入单次拾取,成功落点会立即回到编辑状态。 */
|
|
19929
20009
|
startAddPoint() {
|
|
@@ -20046,7 +20126,7 @@ class Zc {
|
|
|
20046
20126
|
this.transformHelper && !this.transformHelper.parent && this.engine.scene?.add(this.transformHelper);
|
|
20047
20127
|
return;
|
|
20048
20128
|
}
|
|
20049
|
-
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new
|
|
20129
|
+
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new Et(this.engine.camera, this.engine.renderer.domElement), this.transformControl.setMode("translate"), this.transformControl.size = 0.72, this.transformControl.addEventListener("dragging-changed", (e) => {
|
|
20050
20130
|
if (this.transformDragging = !!e.value, this.transformDragging) {
|
|
20051
20131
|
this.saveHistory(), this.controlsEnabledBeforeDrag = this.engine.controls?.enabled !== !1, this.engine.controls && (this.engine.controls.enabled = !1);
|
|
20052
20132
|
return;
|
|
@@ -20063,11 +20143,11 @@ class Zc {
|
|
|
20063
20143
|
this.transformControl?.detach(), this.transformHelper && (this.transformHelper.visible = !1, this.transformHelper.parent?.remove(this.transformHelper));
|
|
20064
20144
|
}
|
|
20065
20145
|
createPointRecord(e, t) {
|
|
20066
|
-
const i = new Yt(this.options.pointSize, 18, 12), n = new
|
|
20146
|
+
const i = new Yt(this.options.pointSize, 18, 12), n = new oe({
|
|
20067
20147
|
color: this.options.pointColor,
|
|
20068
20148
|
depthTest: !1,
|
|
20069
20149
|
depthWrite: !1
|
|
20070
|
-
}), s = new
|
|
20150
|
+
}), s = new z(i, n), o = t ?? `path-point-${++this.pointSequence}`;
|
|
20071
20151
|
return s.name = o, s.position.copy(e), s.renderOrder = 1002, s.userData.pathDrawPointId = o, { id: o, position: e.clone(), mesh: s };
|
|
20072
20152
|
}
|
|
20073
20153
|
selectPoint(e) {
|
|
@@ -20093,9 +20173,9 @@ class Zc {
|
|
|
20093
20173
|
return s.setFromCamera(n, this.engine.camera), s.intersectObjects(this.pointsGroup.children, !1)[0]?.object ?? null;
|
|
20094
20174
|
}
|
|
20095
20175
|
updatePreview(e) {
|
|
20096
|
-
this.previewMarker || (this.previewMarker = new
|
|
20176
|
+
this.previewMarker || (this.previewMarker = new z(
|
|
20097
20177
|
new Yt(this.options.pointSize * 0.72, 14, 10),
|
|
20098
|
-
new
|
|
20178
|
+
new oe({ color: this.options.previewColor, depthTest: !1, depthWrite: !1 })
|
|
20099
20179
|
), this.previewMarker.renderOrder = 1003, this.root.add(this.previewMarker)), this.previewMarker.position.copy(e), this.previewMarker.visible = !0;
|
|
20100
20180
|
const t = [...this.points.map((n) => n.position), e];
|
|
20101
20181
|
if (t.length < 2) {
|
|
@@ -20553,7 +20633,7 @@ class sh {
|
|
|
20553
20633
|
constructor(e) {
|
|
20554
20634
|
if (window.THREE = Bn, Yo(), this.options = e, this.container = document.getElementById(e.containerId), !this.container)
|
|
20555
20635
|
throw new Error(`Container ${e.containerId} not found`);
|
|
20556
|
-
if (this.rxQuotaListMapper = new Xc(this), this.filterLoaderModel = new Jc(this), this.engineModelModule = new Ma(this), this.engineModelModule.init(), this.deviceModule = new
|
|
20636
|
+
if (this.rxQuotaListMapper = new Xc(this), this.filterLoaderModel = new Jc(this), this.engineModelModule = new Ma(this), this.engineModelModule.init(), this.deviceModule = new Eo(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new se(this), this.sceneModule = new Ao(this), this.scene = this.sceneModule.scene, this.renderModule = new So(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.orthographicCamera, this.scene.camera = this.camera, this.renderer) {
|
|
20557
20637
|
const o = this.renderer;
|
|
20558
20638
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
20559
20639
|
}
|
|
@@ -20561,7 +20641,7 @@ class sh {
|
|
|
20561
20641
|
const t = this.events.trigger.bind(this.events);
|
|
20562
20642
|
this.events.trigger = ((o, r) => {
|
|
20563
20643
|
t(o, r), String(o) !== String(ie.EngineBusy) && this.requestComposerRender();
|
|
20564
|
-
}), this.engineStatus = new qr(this), this.engineStatus.init(), this.loaderModule = new Ie(this), this.lightModule = new ua(this), this.lightModule.init(), this.viewCube = new ba(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Ca(this), this.rangeScale = new Aa(this), this.rangeScale.init(), this.setting = new qa(this), this.engineModelModule.init(), this.handelBehaved = Hi(this), this.modelMapperBatch = new ul(this), this.measure = new el(this), this.modelToolModule = new ma(this), this.modelLink3d = new Jl(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new ll(this), this.search = new dl(this), this.interactionModule = new pa(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new Jt(this), this.modelEdge = new Wa(this), this.nodeBox = new gl(this), this.modelTree = new rl(this), this.viewTree = new Ui(this), this.merge2d = new Bl(this), this.engineInfo = new al(this), this.pathRoaming = new vl(this), this.pathRoaming.init(), this.oneClickEncoding = new
|
|
20644
|
+
}), this.engineStatus = new qr(this), this.engineStatus.init(), this.loaderModule = new Ie(this), this.lightModule = new ua(this), this.lightModule.init(), this.viewCube = new ba(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Ca(this), this.rangeScale = new Aa(this), this.rangeScale.init(), this.setting = new qa(this), this.engineModelModule.init(), this.handelBehaved = Hi(this), this.modelMapperBatch = new ul(this), this.measure = new el(this), this.modelToolModule = new ma(this), this.modelLink3d = new Jl(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new ll(this), this.search = new dl(this), this.interactionModule = new pa(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new Jt(this), this.modelEdge = new Wa(this), this.nodeBox = new gl(this), this.modelTree = new rl(this), this.viewTree = new Ui(this), this.merge2d = new Bl(this), this.engineInfo = new al(this), this.pathRoaming = new vl(this), this.pathRoaming.init(), this.oneClickEncoding = new El(this), this.minMap = new xl(this), this.linkElement2d3d = new Cl(this), this.linkView2d3d = new Al(this), this.grid = new Pa(this), this.level = new La(this), this.issueReport = new wl(this), this.fabricDraw = new Ql(this), this.drawingPin = new $l(this), this.label = new ec(this), this.annotation3d = new Rc(this), this.calibration = new lt(this), this.modelPlace = new Hc(this), this.modelComparison = new Vc(this), this.modelExplode = new Uc(this), this.materialTool = new Yc(this, this.options.materialEditorOptions ?? {}), this.materialTool.init(), this.pathDraw = new Zc(this), this.text = new bl(this), this.hdr = new _a(this), this.ground = new Vi(this), this.ground.init(), this.skyManager = new Ga(this), this.setting.init(), this.worldToScreen = new me(this.camera, this.renderer, this.scene), this.options.showStats && (this.stats = new Co(), 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));
|
|
20565
20645
|
let i = document.createElement("div");
|
|
20566
20646
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
20567
20647
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -20569,8 +20649,8 @@ class sh {
|
|
|
20569
20649
|
this.handleWindowResize();
|
|
20570
20650
|
}, window.addEventListener("resize", this.onWindowResize);
|
|
20571
20651
|
let s = this;
|
|
20572
|
-
this.bindControlEvents(this.controls), this.events.on(ie.LoadingCompleted, (
|
|
20573
|
-
s.modelEdge.active();
|
|
20652
|
+
this.bindControlEvents(this.controls), this.events.on(ie.LoadingCompleted, () => {
|
|
20653
|
+
s.modelEdge.active(), s.modelToolModule.addPickBoxByNames(["门店编号"]);
|
|
20574
20654
|
}), this.events.on(ie.EngineBusy, () => {
|
|
20575
20655
|
s.requestComposerRender();
|
|
20576
20656
|
}), this.events.on(ie.EngineFree, () => {
|
|
@@ -20674,6 +20754,7 @@ class sh {
|
|
|
20674
20754
|
}
|
|
20675
20755
|
/**
|
|
20676
20756
|
* 通过 viewToken 解析 3D 模型地址,再复用现有 loaderModule URL 加载逻辑。
|
|
20757
|
+
* 解析得到多个模型地址时,共用同一份加载选项,包括是否加载边线。
|
|
20677
20758
|
*/
|
|
20678
20759
|
async loadModelByViewToken(e, t) {
|
|
20679
20760
|
const i = await yo(
|
|
@@ -20853,7 +20934,7 @@ class sh {
|
|
|
20853
20934
|
if (!e) return;
|
|
20854
20935
|
[...e.children].forEach((i) => {
|
|
20855
20936
|
this.clearScene(i);
|
|
20856
|
-
}), e.parent && e.parent.remove(e), e instanceof
|
|
20937
|
+
}), e.parent && e.parent.remove(e), e instanceof z && !(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 It && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof uo && (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 fi && e.material && this.disposeMaterial(e.material), e instanceof po && e.shadow?.dispose?.();
|
|
20857
20938
|
}
|
|
20858
20939
|
/**
|
|
20859
20940
|
* 清理材质及其纹理
|