iflow-engine-base-3d 3.12.7 → 3.12.8
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as xi, G as ge, P as
|
|
2
|
-
import { W as he, C as to, L as
|
|
1
|
+
import { S as xi, G as ge, P as vt, O as Se, M as O, V as h, T as _n, C as vs, W as bi, a as ws, b as We, N as Ci, c as xs, d as Je, e as K, Q as Le, E as In, R as me, f as Ai, g as Dn, B as F, h as Si, A as bs, i as H, j as N, I as U, k as $t, l as Zt, m as Ln, n as kn, L as Ht, o as Cs, p as As, q as Ss, r as Ri, D as oe, s as Oi, t as Es, F as Ps, u as de, v as Bn, w as zn, x as Ei, y as Ts, z as Rn, H as ue, J as _s, K as wt, U as Is, X as Ds, Y as Ls, Z as ks, _ as Ge, $ as Vt, a0 as Pi, a1 as Q, a2 as ce, a3 as Bs, a4 as lt, a5 as Ke, a6 as Ut, a7 as Gt, a8 as He, a9 as St, aa as zs, ab as On, ac as di, ad as st, ae as Rs, af as nt, ag as Os, ah as Fs, ai as Fn, aj as Nn, ak as xt, al as Wt, am as Ns, an as Fi, ao as ot, ap as Kt, aq as bt, ar as Hs, as as Vs, at as Ni, au as Us, av as Hi, aw as Gs, ax as Ws, ay as Ks, az as qs, aA as js, aB as Ys, aC as Xs, aD as Qs, aE as ui, aF as qe, aG as $s, aH as Zs, aI as Js, aJ as eo } from "./three-vendor-CABBZGAg.js";
|
|
2
|
+
import { W as he, C as to, L as pt, B as Vi, g as ke, a as io, E as no, r as so } from "./sdk-runtime-DUxgrCmx.js";
|
|
3
3
|
import { r as J, g as oo } from "./sdk-assets-d5IWmiFA.js";
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as qt, J as pi, c as ro, b as ao, P as Jt, q as lo, k as co, n as Ui, E as Gi, S as ho } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
5
|
class uo {
|
|
6
6
|
engine;
|
|
7
7
|
scene;
|
|
@@ -11,7 +11,7 @@ class uo {
|
|
|
11
11
|
t.name = "groupEdge", this.scene.add(t);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
var
|
|
14
|
+
var Ot = /* @__PURE__ */ ((a) => (a.PERSPECTIVE = "perspective", a.ORTHOGRAPHIC = "orthographic", a))(Ot || {});
|
|
15
15
|
class re {
|
|
16
16
|
static MIN_VISIBLE_HEIGHT = 1e-4;
|
|
17
17
|
static MIN_CAMERA_DISTANCE = 1e-4;
|
|
@@ -19,14 +19,14 @@ class re {
|
|
|
19
19
|
perspectiveCamera;
|
|
20
20
|
orthographicCamera;
|
|
21
21
|
constructor(e) {
|
|
22
|
-
this.engine = e, this.perspectiveCamera = new
|
|
22
|
+
this.engine = e, this.perspectiveCamera = new vt(
|
|
23
23
|
60,
|
|
24
24
|
this.engine.container.clientWidth / this.engine.container.clientHeight,
|
|
25
25
|
0.1,
|
|
26
26
|
1e3
|
|
27
27
|
), this.perspectiveCamera.position.set(2, 2, 2), this.perspectiveCamera.lookAt(0, 0, 0);
|
|
28
28
|
const t = 50, i = this.engine.container.clientWidth / this.engine.container.clientHeight;
|
|
29
|
-
this.orthographicCamera = new
|
|
29
|
+
this.orthographicCamera = new Se(
|
|
30
30
|
t * i / -2,
|
|
31
31
|
t * i / 2,
|
|
32
32
|
t / 2,
|
|
@@ -175,7 +175,7 @@ class re {
|
|
|
175
175
|
const e = this.engine.camera;
|
|
176
176
|
if (!e)
|
|
177
177
|
return;
|
|
178
|
-
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.perspectiveCamera, r = this.getViewDirection(t, i, n), l = e instanceof
|
|
178
|
+
const t = e.position.clone(), i = this.engine.controls.target.clone(), n = e.quaternion.clone(), s = e.up.clone(), o = this.perspectiveCamera, r = this.getViewDirection(t, i, n), l = e instanceof Se ? this.getOrthographicVisibleHeight(e) : this.getPerspectiveVisibleHeight(e, i), c = O.degToRad(o.getEffectiveFOV() * 0.5), d = Math.max(
|
|
179
179
|
l / (2 * Math.tan(c)),
|
|
180
180
|
re.MIN_CAMERA_DISTANCE
|
|
181
181
|
);
|
|
@@ -188,7 +188,7 @@ class re {
|
|
|
188
188
|
const e = this.engine.camera;
|
|
189
189
|
if (!e)
|
|
190
190
|
return;
|
|
191
|
-
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), l = e instanceof
|
|
191
|
+
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), l = e instanceof vt ? this.getPerspectiveVisibleHeight(e, i) : this.getOrthographicVisibleHeight(e), c = O.degToRad(e.getEffectiveFOV() * 0.5), d = Math.max(
|
|
192
192
|
l / (2 * Math.tan(c)),
|
|
193
193
|
re.MIN_CAMERA_DISTANCE
|
|
194
194
|
);
|
|
@@ -387,7 +387,7 @@ const mo = { type: "change" }, Wi = { type: "start" }, Ki = { type: "end" }, X =
|
|
|
387
387
|
DOLLY: 2,
|
|
388
388
|
TOUCH_ROTATE: 3,
|
|
389
389
|
TOUCH_DOLLY_PAN: 4
|
|
390
|
-
}, ti = new h(1, 0, 0), fo = new h(0, 1, 0), yo = new h(0, 0, 1), et = new h(),
|
|
390
|
+
}, ti = new h(1, 0, 0), fo = new h(0, 1, 0), yo = new h(0, 0, 1), et = new h(), _t = new h(), xe = new h(), j = new h(), Pe = new h(), le = new h(), Te = new h(), Mo = new h(), It = new Le(), ii = new Le(), qi = /* @__PURE__ */ new Set([
|
|
391
391
|
"KeyW",
|
|
392
392
|
"KeyA",
|
|
393
393
|
"KeyS",
|
|
@@ -401,7 +401,7 @@ const mo = { type: "change" }, Wi = { type: "start" }, Ki = { type: "end" }, X =
|
|
|
401
401
|
"ShiftLeft",
|
|
402
402
|
"ShiftRight"
|
|
403
403
|
]);
|
|
404
|
-
function
|
|
404
|
+
function Dt(a, e, t) {
|
|
405
405
|
return Math.max(e, Math.min(t, a));
|
|
406
406
|
}
|
|
407
407
|
function ji(a) {
|
|
@@ -506,7 +506,7 @@ class Hn extends xs {
|
|
|
506
506
|
const n = e.clone();
|
|
507
507
|
return e.set(0, 0), n;
|
|
508
508
|
}
|
|
509
|
-
const t =
|
|
509
|
+
const t = Dt(this.dampingFactor, 0, 1), i = e.clone().multiplyScalar(t);
|
|
510
510
|
return e.sub(i), e.lengthSq() < X && e.set(0, 0), i;
|
|
511
511
|
}
|
|
512
512
|
_consumeNumber(e) {
|
|
@@ -514,12 +514,12 @@ class Hn extends xs {
|
|
|
514
514
|
const n = this[e];
|
|
515
515
|
return this[e] = 0, n;
|
|
516
516
|
}
|
|
517
|
-
const t =
|
|
517
|
+
const t = Dt(this.dampingFactor, 0, 1), i = this[e] * t;
|
|
518
518
|
return this[e] -= i, Math.abs(this[e]) < X && (this[e] = 0), i;
|
|
519
519
|
}
|
|
520
520
|
_applyRotation(e, t) {
|
|
521
521
|
const i = this._getRotatePivot(), n = this.object.position;
|
|
522
|
-
et.copy(n).sub(i), et.lengthSq() < X && et.set(0, 0, Math.max(this.minDistance, 1)),
|
|
522
|
+
et.copy(n).sub(i), et.lengthSq() < X && et.set(0, 0, Math.max(this.minDistance, 1)), _t.copy(this.target).sub(i), le.copy(this.target).sub(n).normalize(), Math.abs(e) > X && (It.setFromAxisAngle(this._referenceUp, -e), et.applyQuaternion(It), _t.applyQuaternion(It), le.applyQuaternion(It).normalize()), j.copy(this._getStableRightAxis(le)), Math.abs(t) > X && j.lengthSq() > X && (ii.setFromAxisAngle(j, -t), et.applyQuaternion(ii), _t.applyQuaternion(ii)), n.copy(i).add(et), this.target.copy(i).add(_t);
|
|
523
523
|
}
|
|
524
524
|
_applyPan(e, t) {
|
|
525
525
|
const { width: i, height: n } = ji(this.domElement);
|
|
@@ -539,11 +539,11 @@ class Hn extends xs {
|
|
|
539
539
|
const t = Math.pow(0.95, this.zoomSpeed * e);
|
|
540
540
|
if (this.object.isPerspectiveCamera) {
|
|
541
541
|
le.copy(this.object.position).sub(this.target);
|
|
542
|
-
const i = Math.max(le.length(), X), n =
|
|
542
|
+
const i = Math.max(le.length(), X), n = Dt(i / t, this.minDistance, this.maxDistance);
|
|
543
543
|
le.setLength(n), this.object.position.copy(this.target).add(le);
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
|
-
this.object.isOrthographicCamera && (this.object.zoom =
|
|
546
|
+
this.object.isOrthographicCamera && (this.object.zoom = Dt(this.object.zoom * t, this.minZoom, this.maxZoom), this.object.updateProjectionMatrix());
|
|
547
547
|
}
|
|
548
548
|
_alignCamera() {
|
|
549
549
|
le.copy(this.target).sub(this.object.position), !(le.lengthSq() < X) && (le.normalize(), j.copy(this._getStableRightAxis(le)), Pe.crossVectors(j, le).normalize(), Pe.lengthSq() < X && Pe.copy(this._referenceUp), this._viewRight.copy(j), this.object.up.copy(Pe), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
@@ -1138,7 +1138,7 @@ class Qi extends In {
|
|
|
1138
1138
|
/** 默认加载第三人称工人模型,并使用模型内置第一段动画作为行走动作。 */
|
|
1139
1139
|
loadAvatarModel(e, t = {}) {
|
|
1140
1140
|
const i = ++this._avatarLoadRequestId;
|
|
1141
|
-
new
|
|
1141
|
+
new Si().load(
|
|
1142
1142
|
e,
|
|
1143
1143
|
(s) => {
|
|
1144
1144
|
if (i !== this._avatarLoadRequestId || !s?.scene)
|
|
@@ -1524,7 +1524,7 @@ class Qi extends In {
|
|
|
1524
1524
|
});
|
|
1525
1525
|
}
|
|
1526
1526
|
}
|
|
1527
|
-
const gi = "__isModelUrlGroup",
|
|
1527
|
+
const gi = "__isModelUrlGroup", jt = "__modelDepthBias", Vn = 4;
|
|
1528
1528
|
function Un(a) {
|
|
1529
1529
|
return a.__modelGroupMap instanceof Map || (a.__modelGroupMap = /* @__PURE__ */ new Map()), a.__modelGroupMap;
|
|
1530
1530
|
}
|
|
@@ -1540,7 +1540,7 @@ function _i(a, e) {
|
|
|
1540
1540
|
function Ii(a, e) {
|
|
1541
1541
|
return a?.models?.find?.((t) => t?.url === e);
|
|
1542
1542
|
}
|
|
1543
|
-
function
|
|
1543
|
+
function gt(a, e, t) {
|
|
1544
1544
|
if (typeof t != "string" || t.length === 0)
|
|
1545
1545
|
return;
|
|
1546
1546
|
const i = Ii(a, e);
|
|
@@ -1580,7 +1580,7 @@ function bo(a) {
|
|
|
1580
1580
|
!_i(n) || t.has(n.uuid) || (t.add(n.uuid), e.push(n));
|
|
1581
1581
|
}), e;
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1583
|
+
function Ct(a, e) {
|
|
1584
1584
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
1585
1585
|
return bo(a).forEach((s) => {
|
|
1586
1586
|
s.traverse((o) => {
|
|
@@ -1597,7 +1597,7 @@ function xt(a, e) {
|
|
|
1597
1597
|
}), t;
|
|
1598
1598
|
}
|
|
1599
1599
|
function Di(a) {
|
|
1600
|
-
return
|
|
1600
|
+
return Ct(a, (e) => e instanceof N && !(e instanceof U));
|
|
1601
1601
|
}
|
|
1602
1602
|
function Co(a) {
|
|
1603
1603
|
if (typeof a.__modelObjectIndexSeed == "number")
|
|
@@ -1619,15 +1619,15 @@ function Li(a, e, t) {
|
|
|
1619
1619
|
function Wn(a) {
|
|
1620
1620
|
return Array.isArray(a) ? a : a != null ? [a] : [];
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function So(a) {
|
|
1623
1623
|
return 1 + (Number.isFinite(a) ? Math.abs(Math.floor(a)) : 0) % 16 * 0.125;
|
|
1624
1624
|
}
|
|
1625
1625
|
function ki(a, e) {
|
|
1626
|
-
const t = typeof e == "number" ? e : a?.index, i =
|
|
1626
|
+
const t = typeof e == "number" ? e : a?.index, i = So(t);
|
|
1627
1627
|
Wn(a?.material).forEach((n) => {
|
|
1628
1628
|
n.userData = n.userData ?? {};
|
|
1629
|
-
const s = n.userData[
|
|
1630
|
-
n.userData[
|
|
1629
|
+
const s = n.userData[jt] ?? {};
|
|
1630
|
+
n.userData[jt] = {
|
|
1631
1631
|
...s,
|
|
1632
1632
|
enabled: !0,
|
|
1633
1633
|
factor: 1,
|
|
@@ -1638,8 +1638,8 @@ function ki(a, e) {
|
|
|
1638
1638
|
function $i(a, e) {
|
|
1639
1639
|
Wn(a?.material).forEach((t) => {
|
|
1640
1640
|
t.userData = t.userData ?? {};
|
|
1641
|
-
const i = t.userData[
|
|
1642
|
-
t.userData[
|
|
1641
|
+
const i = t.userData[jt] ?? {}, n = i.enabled ? i.units : t.polygonOffsetUnits ?? 0, s = i.enabled ? i.factor : t.polygonOffsetFactor ?? 1;
|
|
1642
|
+
t.userData[jt] = {
|
|
1643
1643
|
...i,
|
|
1644
1644
|
edgeActive: e
|
|
1645
1645
|
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? Vn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
@@ -1652,10 +1652,10 @@ function Fe(a, e) {
|
|
|
1652
1652
|
if (i && i.parent != null)
|
|
1653
1653
|
return i;
|
|
1654
1654
|
i && i.parent == null && t.delete(e);
|
|
1655
|
-
const n =
|
|
1655
|
+
const n = Ct(a, (s) => s.index === e)[0];
|
|
1656
1656
|
return n != null ? (t.set(e, n), n) : a?.scene?.children?.find?.((s) => s?.index === e);
|
|
1657
1657
|
}
|
|
1658
|
-
class
|
|
1658
|
+
class Eo {
|
|
1659
1659
|
constructor(e) {
|
|
1660
1660
|
this.engine = e;
|
|
1661
1661
|
}
|
|
@@ -1670,7 +1670,7 @@ class So {
|
|
|
1670
1670
|
const l = Be(n, s), c = this.getModelSnapCache(s, o, r);
|
|
1671
1671
|
n.camera.updateMatrixWorld(!0);
|
|
1672
1672
|
const d = new H().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = n.renderer.domElement.clientWidth, g = n.renderer.domElement.clientHeight, m = new K(t.offsetX, t.offsetY), f = new $t(), w = new h(), b = new h(), p = new K(), x = new K(), C = new h();
|
|
1673
|
-
let
|
|
1673
|
+
let A = "face", I = null, D = null, R = 100;
|
|
1674
1674
|
if (i != null) {
|
|
1675
1675
|
const k = e.point.clone(), G = e.normal || (e.face ? e.face.normal : null);
|
|
1676
1676
|
if (G && e.object?.matrixWorld?.elements) {
|
|
@@ -1682,7 +1682,7 @@ class So {
|
|
|
1682
1682
|
distanceSq: be,
|
|
1683
1683
|
pointxy: ye.clone(),
|
|
1684
1684
|
style: "vertical"
|
|
1685
|
-
},
|
|
1685
|
+
}, A = "point");
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
}
|
|
@@ -1715,7 +1715,7 @@ class So {
|
|
|
1715
1715
|
});
|
|
1716
1716
|
}
|
|
1717
1717
|
if (I != null)
|
|
1718
|
-
|
|
1718
|
+
A = "point";
|
|
1719
1719
|
else {
|
|
1720
1720
|
for (let k = 0; k < c.localLines.length; k += 6) {
|
|
1721
1721
|
w.set(c.localLines[k], c.localLines[k + 1], c.localLines[k + 2]).applyMatrix4(l), b.set(c.localLines[k + 3], c.localLines[k + 4], c.localLines[k + 5]).applyMatrix4(l);
|
|
@@ -1737,9 +1737,9 @@ class So {
|
|
|
1737
1737
|
}, R = $;
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
|
-
D != null && (
|
|
1740
|
+
D != null && (A = "line");
|
|
1741
1741
|
}
|
|
1742
|
-
return
|
|
1742
|
+
return A === "point" && I != null ? (this.renderPointCandidate(I), e.point = I.point, e) : A === "line" && D != null ? (this.renderLineCandidate(D), e.point = D.point, e) : (this.renderFaceCandidate(e), e);
|
|
1743
1743
|
}
|
|
1744
1744
|
/**
|
|
1745
1745
|
* 将模型边数据压平缓存,避免鼠标移动时反复拼装点、线和中点数组。
|
|
@@ -1878,7 +1878,7 @@ function Bi(a) {
|
|
|
1878
1878
|
touchControlsSnapshot: null,
|
|
1879
1879
|
mouseMoveFrame: null,
|
|
1880
1880
|
latestMouseMoveEvent: null
|
|
1881
|
-
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new
|
|
1881
|
+
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new Eo(a);
|
|
1882
1882
|
e.handle_catch = function(y, E, z = !0, V = !0) {
|
|
1883
1883
|
const q = e.options;
|
|
1884
1884
|
e.options = {
|
|
@@ -1933,7 +1933,7 @@ function Bi(a) {
|
|
|
1933
1933
|
e.touchLongPressTimer != null && (clearTimeout(e.touchLongPressTimer), e.touchLongPressTimer = null);
|
|
1934
1934
|
}
|
|
1935
1935
|
function p() {
|
|
1936
|
-
b(), k(),
|
|
1936
|
+
b(), k(), A(), e.touchLongPressActive = !1, e.touchLatestEvent = null, e.touchStartPosition = null, e.touchInputMode = null, e.touchPointerId = null;
|
|
1937
1937
|
}
|
|
1938
1938
|
function x(y) {
|
|
1939
1939
|
y?.preventDefault?.(), y?.stopPropagation?.(), y?.stopImmediatePropagation?.();
|
|
@@ -1945,7 +1945,7 @@ function Bi(a) {
|
|
|
1945
1945
|
enabled: y.enabled !== !1
|
|
1946
1946
|
}, y.enabled = !1);
|
|
1947
1947
|
}
|
|
1948
|
-
function
|
|
1948
|
+
function A() {
|
|
1949
1949
|
const y = e.touchControlsSnapshot;
|
|
1950
1950
|
y && (y.controls && (I(y.controls), y.controls.enabled = y.enabled), e.touchControlsSnapshot = null);
|
|
1951
1951
|
}
|
|
@@ -1973,12 +1973,12 @@ function Bi(a) {
|
|
|
1973
1973
|
const ve = a?.catchSvg;
|
|
1974
1974
|
if (!ve?.childElementCount) return;
|
|
1975
1975
|
const Ie = a?.reactBoundingClientRect ?? E.getBoundingClientRect(), Ze = (we) => {
|
|
1976
|
-
const [
|
|
1977
|
-
return Number.isFinite(
|
|
1976
|
+
const [Ee, ze] = we.split(",").map(Number);
|
|
1977
|
+
return Number.isFinite(Ee) && Number.isFinite(ze) ? [(Ee - Ie.left - z) / q * n * Me, (ze - Ie.top - V) / q * n * Me] : null;
|
|
1978
1978
|
};
|
|
1979
1979
|
Array.from(ve.children).forEach((we) => {
|
|
1980
|
-
const
|
|
1981
|
-
Ce.length < 2 || (y.beginPath(), y.strokeStyle = we.getAttribute("stroke") || "rgb(8, 223, 215)", y.fillStyle = we.getAttribute("fill") || "transparent", y.lineWidth = Number(we.getAttribute("stroke-width") || 2) * Me, y.moveTo(Ce[0][0], Ce[0][1]), Ce.slice(1).forEach(([Re, Ye]) => y.lineTo(Re, Ye)),
|
|
1980
|
+
const Ee = we.tagName.toLowerCase(), Ce = (Ee === "line" ? [`${we.getAttribute("x1")},${we.getAttribute("y1")}`, `${we.getAttribute("x2")},${we.getAttribute("y2")}`].map(Ze) : (we.getAttribute("points") || "").trim().split(/\s+/).map(Ze)).filter(Boolean);
|
|
1981
|
+
Ce.length < 2 || (y.beginPath(), y.strokeStyle = we.getAttribute("stroke") || "rgb(8, 223, 215)", y.fillStyle = we.getAttribute("fill") || "transparent", y.lineWidth = Number(we.getAttribute("stroke-width") || 2) * Me, y.moveTo(Ce[0][0], Ce[0][1]), Ce.slice(1).forEach(([Re, Ye]) => y.lineTo(Re, Ye)), Ee === "polygon" && (y.closePath(), ["none", "transparent"].includes(String(y.fillStyle)) || y.fill()), y.stroke());
|
|
1982
1982
|
});
|
|
1983
1983
|
}
|
|
1984
1984
|
function ne(y) {
|
|
@@ -1998,10 +1998,10 @@ function Bi(a) {
|
|
|
1998
1998
|
Math.max(8, y.clientY - o)
|
|
1999
1999
|
);
|
|
2000
2000
|
z.style.left = `${Ze - n / 2}px`, z.style.top = `${we}px`, z.style.display = "block";
|
|
2001
|
-
const
|
|
2001
|
+
const Ee = E.width / Math.max(1, E.clientWidth), ze = E.height / Math.max(1, E.clientHeight), Ce = s, Re = Math.max(0, Math.min(E.clientWidth - Ce, ve.x - Ce / 2)), Ye = Math.max(0, Math.min(E.clientHeight - Ce, ve.y - Ce / 2));
|
|
2002
2002
|
V.save(), V.clearRect(0, 0, z.width, z.height), V.beginPath(), V.arc(z.width / 2, z.height / 2, z.width / 2, 0, Math.PI * 2), V.clip(), V.fillStyle = window.getComputedStyle(E.parentElement ?? document.body).backgroundColor || "#dfe8f2", V.fillRect(0, 0, z.width, z.height);
|
|
2003
2003
|
try {
|
|
2004
|
-
V.drawImage(E, Re *
|
|
2004
|
+
V.drawImage(E, Re * Ee, Ye * ze, Ce * Ee, Ce * ze, 0, 0, z.width, z.height), Y(V, E, Re, Ye, Ce, Ie);
|
|
2005
2005
|
} catch {
|
|
2006
2006
|
k(), V.restore();
|
|
2007
2007
|
return;
|
|
@@ -2032,7 +2032,7 @@ function Bi(a) {
|
|
|
2032
2032
|
const q = V.distanceTo(e.mouseDownPosition);
|
|
2033
2033
|
(z < 100 || q == 0) && e.self && e.self.handleMouseClick != null && ($(y, !0, !0, !1), E - e.lastClickTime < 200 ? e.self.handleMouseDoubleClick != null && y.button == 0 && e.self.handleMouseDoubleClick(y) : e.self.handleMouseClick != null && y.button == 0 ? e.self.handleMouseClick(y) : e.self.handleRightMouseClick != null && y.button == 2 && e.self.handleRightMouseClick(y), e.lastClickTime = Date.now());
|
|
2034
2034
|
}
|
|
2035
|
-
function
|
|
2035
|
+
function S(y) {
|
|
2036
2036
|
const E = y.touches[0] || y.changedTouches[0];
|
|
2037
2037
|
if (!E)
|
|
2038
2038
|
return null;
|
|
@@ -2082,7 +2082,7 @@ function Bi(a) {
|
|
|
2082
2082
|
p();
|
|
2083
2083
|
return;
|
|
2084
2084
|
}
|
|
2085
|
-
const E =
|
|
2085
|
+
const E = S(y);
|
|
2086
2086
|
if (E) {
|
|
2087
2087
|
if (f()) {
|
|
2088
2088
|
v(E, D(y) ?? new K(E.clientX, E.clientY), "touch");
|
|
@@ -2096,7 +2096,7 @@ function Bi(a) {
|
|
|
2096
2096
|
p();
|
|
2097
2097
|
return;
|
|
2098
2098
|
}
|
|
2099
|
-
const E =
|
|
2099
|
+
const E = S(y);
|
|
2100
2100
|
if (E) {
|
|
2101
2101
|
if (f()) {
|
|
2102
2102
|
e.touchLongPressActive && x(y), M(E, D(y));
|
|
@@ -2107,7 +2107,7 @@ function Bi(a) {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
function _(y) {
|
|
2109
2109
|
y.preventDefault();
|
|
2110
|
-
const E =
|
|
2110
|
+
const E = S(y);
|
|
2111
2111
|
if (E) {
|
|
2112
2112
|
if (f()) {
|
|
2113
2113
|
e.touchLongPressActive && x(y), P(E);
|
|
@@ -2591,14 +2591,14 @@ class _o {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
init() {
|
|
2593
2593
|
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 Ln(e, t, {
|
|
2594
|
-
minFilter:
|
|
2595
|
-
magFilter:
|
|
2594
|
+
minFilter: Ht,
|
|
2595
|
+
magFilter: Ht,
|
|
2596
2596
|
format: kn,
|
|
2597
2597
|
samples: 4
|
|
2598
2598
|
// 启用多重采样抗锯齿
|
|
2599
2599
|
});
|
|
2600
2600
|
r.texture.colorSpace = Cs, this.composer = new As(s, r), this.composer.setPixelRatio(o), this.composer.setSize(e, t);
|
|
2601
|
-
const l = new
|
|
2601
|
+
const l = new Ss(i, n);
|
|
2602
2602
|
this.composer.addPass(l), this.gtaoPass = new Ri(i, n, e, t), this.gtaoPass.output = Ri.OUTPUT.Default, this.gtaoPass.blendIntensity = Kn, this.gtaoPass.enabled = !1, this.gtaoPass.normalMaterial.side = oe, this.gtaoPass.normalMaterial.needsUpdate = !0, this.excludeClippingHelpersFromGtao(this.gtaoPass), this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
2603
2603
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
2604
2604
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
@@ -2625,10 +2625,10 @@ class _o {
|
|
|
2625
2625
|
samples: 32,
|
|
2626
2626
|
rings: 3,
|
|
2627
2627
|
radiusExponent: 2
|
|
2628
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new Oi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = Oi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new Zt(To), this.saturationPass.uniforms.saturation.value = qn, this.saturationPass.uniforms.contrast.value = jn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new
|
|
2628
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new Oi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = Oi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new Zt(To), this.saturationPass.uniforms.saturation.value = qn, this.saturationPass.uniforms.contrast.value = jn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new Es(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new Zt(Ps), 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();
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function At(a) {
|
|
2632
2632
|
const e = Array.isArray(a?.infos) ? a.infos[0]?.name : void 0, t = typeof e == "string" ? e : "";
|
|
2633
2633
|
let i = t;
|
|
2634
2634
|
for (const n of t.matchAll(/\[([^\[\]]*)\]/g))
|
|
@@ -2646,12 +2646,12 @@ function Io(a, e, t, i) {
|
|
|
2646
2646
|
}, b.rotation = { x: 0, y: 0, z: 0 }, b), w = (b, p) => {
|
|
2647
2647
|
if (!Array.isArray(p) || p.length === 0)
|
|
2648
2648
|
return;
|
|
2649
|
-
const x = p.map((
|
|
2650
|
-
C != null && x.forEach((
|
|
2649
|
+
const x = p.map((A) => f(A)), C = Lo(b, l, x, t, a);
|
|
2650
|
+
C != null && x.forEach((A, I) => {
|
|
2651
2651
|
const D = [[C, I, 0, 0]];
|
|
2652
|
-
|
|
2653
|
-
const R = { ...
|
|
2654
|
-
|
|
2652
|
+
A.indexes = D, A.id = Number(A.id);
|
|
2653
|
+
const R = { ...A, instance: !0, info: A, infos: [A], indexes: D };
|
|
2654
|
+
At(R), r.nodesMap.set(Number(A.id), R), c.push(Number(A.id));
|
|
2655
2655
|
});
|
|
2656
2656
|
};
|
|
2657
2657
|
w("Circle", d), w("Rect", u), w("Ellipse", m), w("Bridge", g), Do(r, c);
|
|
@@ -2681,16 +2681,16 @@ function Lo(a, e, t, i, n) {
|
|
|
2681
2681
|
};
|
|
2682
2682
|
switch (a) {
|
|
2683
2683
|
case "Rect":
|
|
2684
|
-
s =
|
|
2684
|
+
s = Lt("Rect", o);
|
|
2685
2685
|
break;
|
|
2686
2686
|
case "Bridge":
|
|
2687
|
-
s =
|
|
2687
|
+
s = Lt("Bridge", o);
|
|
2688
2688
|
break;
|
|
2689
2689
|
case "Circle":
|
|
2690
|
-
s =
|
|
2690
|
+
s = Lt("Circle", o);
|
|
2691
2691
|
break;
|
|
2692
2692
|
case "Ellipse":
|
|
2693
|
-
s =
|
|
2693
|
+
s = Lt("Ellipse", o);
|
|
2694
2694
|
break;
|
|
2695
2695
|
}
|
|
2696
2696
|
if (!s)
|
|
@@ -2702,22 +2702,22 @@ function Lo(a, e, t, i, n) {
|
|
|
2702
2702
|
const c = r.geometry.boundingBox?.clone() ?? null, d = [], u = [];
|
|
2703
2703
|
for (let m = 0; m < t.length; m++) {
|
|
2704
2704
|
const f = t[m], w = new h(f.startPoint.X, 0, -f.startPoint.Y), b = new h(f.endPoint.X, 0, -f.endPoint.Y), p = new h(f.startPoint.X, f.startPoint.Z, -f.startPoint.Y), x = new h(f.endPoint.X, f.endPoint.Z, -f.endPoint.Y);
|
|
2705
|
-
let C = 0,
|
|
2705
|
+
let C = 0, A = 0, I = 0;
|
|
2706
2706
|
if (Math.abs(b.clone().sub(w.clone()).z) < 0.01 && Math.abs(b.clone().sub(w.clone()).x) < 0.01) {
|
|
2707
2707
|
if (C = (f.startPoint.Z > f.endPoint.Z ? 1 : -1) * Math.PI * 0.5, f.base_x != null) {
|
|
2708
2708
|
const v = new h(f.base_x.X, 0, -f.base_x.Y);
|
|
2709
|
-
|
|
2709
|
+
A = (v.clone().cross(new h(0, 0, 1)).y <= 0 ? 1 : -1) * v.angleTo(new h(0, 0, 1)) + Math.PI * 0.5;
|
|
2710
2710
|
}
|
|
2711
2711
|
} else
|
|
2712
|
-
|
|
2713
|
-
const D = new H(), R = new Ai(C,
|
|
2712
|
+
A = (b.clone().sub(w.clone()).cross(new h(0, 0, 1)).y > 0 ? -1 : 1) * b.clone().sub(w.clone()).angleTo(new h(0, 0, 1)), C = (f.startPoint.Z > f.endPoint.Z ? 1 : -1) * b.clone().sub(w.clone()).angleTo(x.clone().sub(p.clone()));
|
|
2713
|
+
const D = new H(), R = new Ai(C, A, I, "YXZ"), k = D.clone().makeRotationFromEuler(R);
|
|
2714
2714
|
let G, Y;
|
|
2715
2715
|
a === "Circle" ? (G = f.diameter, Y = f.diameter) : (G = f.width, Y = f.height);
|
|
2716
2716
|
const ne = D.clone().makeScale(G, Y, f.length);
|
|
2717
2717
|
D.multiplyMatrices(k, ne), D.setPosition(f.position.x, f.position.y, f.position.z), r.setMatrixAt(m, D.clone()), r.setColorAt(m, f.color);
|
|
2718
2718
|
const $ = c?.clone().applyMatrix4(D) ?? new F(), fe = $.min.clone(), ye = $.max.clone(), be = $.getCenter(new h());
|
|
2719
2719
|
f.box = $.clone();
|
|
2720
|
-
const
|
|
2720
|
+
const S = {
|
|
2721
2721
|
name: f.name,
|
|
2722
2722
|
min: fe,
|
|
2723
2723
|
max: ye,
|
|
@@ -2726,15 +2726,15 @@ function Lo(a, e, t, i, n) {
|
|
|
2726
2726
|
dbid: m,
|
|
2727
2727
|
materialName: s.material.name
|
|
2728
2728
|
};
|
|
2729
|
-
a === "Circle" && (
|
|
2729
|
+
a === "Circle" && (S.minC = {
|
|
2730
2730
|
x: f.startPoint.X * 0.3048,
|
|
2731
2731
|
y: f.startPoint.Z * 0.3048,
|
|
2732
2732
|
z: -f.startPoint.Y * 0.3048
|
|
2733
|
-
},
|
|
2733
|
+
}, S.maxC = {
|
|
2734
2734
|
x: f.endPoint.X * 0.3048,
|
|
2735
2735
|
y: f.endPoint.Z * 0.3048,
|
|
2736
2736
|
z: -f.endPoint.Y * 0.3048
|
|
2737
|
-
}), r.ids || (r.ids = []), r.matrixs || (r.matrixs = []), r.matrixs.push(D.clone()), u.push(D.clone()), r.ids.push(Number(f.id)), d.push(
|
|
2737
|
+
}), r.ids || (r.ids = []), r.matrixs || (r.matrixs = []), r.matrixs.push(D.clone()), u.push(D.clone()), r.ids.push(Number(f.id)), d.push(S);
|
|
2738
2738
|
}
|
|
2739
2739
|
r.castShadow = !0, r.receiveShadow = !0, r.ElementInfos = d, r.name = "rootModel", r.TypeName = "InstancedMesh-Pipe", r.PipeType = a, r.MeshId = null, r.realMaterial = r.material.clone(), r.originalMaterial = r.material.clone(), r.matrixsClone = u, r.computeBoundingBox?.(), r.computeBoundingSphere?.(), r.instanceColor != null && (r.instanceColor.needsUpdate = !0), n?.sectionPlane && (r.material.clippingPlanes = n.sectionPlane, r.material.clipShadows = !0, r.originalMaterial.clippingPlanes = n.sectionPlane, r.originalMaterial.clipShadows = !0, r.realMaterial.clippingPlanes = n.sectionPlane, r.realMaterial.clipShadows = !0);
|
|
2740
2740
|
const g = {
|
|
@@ -2745,7 +2745,7 @@ function Lo(a, e, t, i, n) {
|
|
|
2745
2745
|
};
|
|
2746
2746
|
return r.meshs = g, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, l;
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2748
|
+
function Lt(a, e) {
|
|
2749
2749
|
const t = new Bn();
|
|
2750
2750
|
switch (e.width = e.width * 0.3048, e.height = e.height * 0.3048, e.diameter = e.diameter * 0.3048, a) {
|
|
2751
2751
|
case "Rect":
|
|
@@ -2767,7 +2767,7 @@ function It(a, e) {
|
|
|
2767
2767
|
};
|
|
2768
2768
|
return n(t, i, e.color, e.position, e.rotation);
|
|
2769
2769
|
function n(s, o, r, l, c) {
|
|
2770
|
-
const d = new zn(s, o), u = new
|
|
2770
|
+
const d = new zn(s, o), u = new Ei({
|
|
2771
2771
|
// MEP 最终颜色由 instanceColor 乘算,基础材质保持白色才能避免二次染色。
|
|
2772
2772
|
color: 16777215,
|
|
2773
2773
|
metalness: 0,
|
|
@@ -2837,7 +2837,7 @@ function Xo(a) {
|
|
|
2837
2837
|
return ht == null && (ht = new ks(), ht.setTranscoderPath(Zn())), Ji !== a && (ht.detectSupport(a), Ji = a), ht;
|
|
2838
2838
|
}
|
|
2839
2839
|
function Qo(a) {
|
|
2840
|
-
const e = new
|
|
2840
|
+
const e = new Si();
|
|
2841
2841
|
return e.setDRACOLoader(Yo()), e.setMeshoptDecoder(Ds), a?.renderer?.capabilities != null && typeof a.renderer.getContext == "function" && e.setKTX2Loader(Xo(a.renderer)), e;
|
|
2842
2842
|
}
|
|
2843
2843
|
function Jn() {
|
|
@@ -2864,7 +2864,7 @@ async function je(a, e, t) {
|
|
|
2864
2864
|
}
|
|
2865
2865
|
function Jo(a, e) {
|
|
2866
2866
|
return new Promise((t, i) => {
|
|
2867
|
-
|
|
2867
|
+
pt(a, (n) => {
|
|
2868
2868
|
if (n == null) {
|
|
2869
2869
|
i(new Error(`[loadLightModel] empty zip json: ${a}`));
|
|
2870
2870
|
return;
|
|
@@ -2876,7 +2876,7 @@ function Jo(a, e) {
|
|
|
2876
2876
|
});
|
|
2877
2877
|
}
|
|
2878
2878
|
async function es(a, e) {
|
|
2879
|
-
const t = await
|
|
2879
|
+
const t = await qt({
|
|
2880
2880
|
method: "get",
|
|
2881
2881
|
responseType: "arraybuffer",
|
|
2882
2882
|
url: a
|
|
@@ -2916,7 +2916,7 @@ async function ir(a, e) {
|
|
|
2916
2916
|
const n = Yt(i);
|
|
2917
2917
|
return Array.isArray(n) ? { exists: !0, value: n } : (console.warn("[loadLightModel] quota_list is not an array", { path: a, parsed: n }), { exists: !0, value: [] });
|
|
2918
2918
|
} catch (t) {
|
|
2919
|
-
return
|
|
2919
|
+
return qt.isAxiosError(t) && t.response?.status === 404 ? { exists: !1 } : (console.warn("[loadLightModel] failed to load optional quota_list", { path: a, error: t }), { exists: !1 });
|
|
2920
2920
|
}
|
|
2921
2921
|
}
|
|
2922
2922
|
function nr(a, e) {
|
|
@@ -2942,7 +2942,7 @@ function ns(a) {
|
|
|
2942
2942
|
function or(a) {
|
|
2943
2943
|
return ns(a), a.status === "loaded" && a.loadStatus.normal === !0 && a.loadStatus.modelMep === !0 && a.loadStatus.quotaList === !0;
|
|
2944
2944
|
}
|
|
2945
|
-
function
|
|
2945
|
+
function mt(a) {
|
|
2946
2946
|
const e = a?.engineStatus?.models;
|
|
2947
2947
|
!Array.isArray(e) || e.length === 0 || !e.every((i) => or(i)) || a.__loadingCompletedTriggered === !0 || (a.__loadingCompletedTriggered = !0, a.events?.trigger?.(se.LoadingCompleted, {}));
|
|
2948
2948
|
}
|
|
@@ -2984,29 +2984,29 @@ async function lr(a, e, t, i) {
|
|
|
2984
2984
|
const n = at(a, e.url);
|
|
2985
2985
|
if (n?.nodesMap == null)
|
|
2986
2986
|
return [];
|
|
2987
|
-
const s = await ar(a, t, i);
|
|
2988
|
-
console.log("[loadLightModel] pending mesh ids", t.path,
|
|
2989
|
-
const
|
|
2990
|
-
let
|
|
2991
|
-
for (const
|
|
2992
|
-
if (!n.nodesMap.has(
|
|
2987
|
+
const s = a.filterLoaderModel?.getContinueIdSet?.(e.url) ?? /* @__PURE__ */ new Set(), o = await ar(a, t, i);
|
|
2988
|
+
console.log("[loadLightModel] pending mesh ids", t.path, o.length);
|
|
2989
|
+
const r = [];
|
|
2990
|
+
let l = performance.now(), c = 0;
|
|
2991
|
+
for (const d of o) {
|
|
2992
|
+
if (s.has(Number(d)) || !n.nodesMap.has(d))
|
|
2993
2993
|
continue;
|
|
2994
|
-
const
|
|
2995
|
-
for (const
|
|
2996
|
-
const
|
|
2997
|
-
if (
|
|
2994
|
+
const u = n.nodesMap.get(d), g = Array.isArray(u?.infos) ? u.infos : [];
|
|
2995
|
+
for (const m of g) {
|
|
2996
|
+
const f = t.glbs?.[m.glb]?.[m.mesh];
|
|
2997
|
+
if (f?.geometry == null || f.material == null)
|
|
2998
2998
|
continue;
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3001
|
-
const
|
|
3002
|
-
|
|
2999
|
+
const w = new H();
|
|
3000
|
+
w.elements = m.matrix;
|
|
3001
|
+
const b = f.geometry.clone();
|
|
3002
|
+
b.applyMatrix4(w), b.computeBoundingBox(), b.attributes.position.count > 2e4 && Vo(b, {
|
|
3003
3003
|
setBoundingSphere: !0
|
|
3004
3004
|
});
|
|
3005
|
-
const
|
|
3006
|
-
|
|
3005
|
+
const p = new N(b, f.material);
|
|
3006
|
+
m.box = b.boundingBox?.clone(), m.mesh = p, p.name = Number(d), p.glb = m.glb, p.url = e.url, b.attributes.position != null && r.push(p), c++, c % Qn === 0 && (l = await je(a, i, l));
|
|
3007
3007
|
}
|
|
3008
3008
|
}
|
|
3009
|
-
return
|
|
3009
|
+
return r;
|
|
3010
3010
|
}
|
|
3011
3011
|
function os(a) {
|
|
3012
3012
|
const e = a.clone();
|
|
@@ -3020,7 +3020,7 @@ function hr(a) {
|
|
|
3020
3020
|
e.color == null || a.userData.__displayColorLinearized === !0 || (cr(e.color), a.userData.__displayColorLinearized = !0);
|
|
3021
3021
|
}
|
|
3022
3022
|
function dr(a, e, t, i, n) {
|
|
3023
|
-
const s =
|
|
3023
|
+
const s = wt(
|
|
3024
3024
|
i.map((d) => d.geometry),
|
|
3025
3025
|
!1
|
|
3026
3026
|
), o = os(n), r = new N(s, o);
|
|
@@ -3035,7 +3035,7 @@ function ur(a, e, t, i) {
|
|
|
3035
3035
|
});
|
|
3036
3036
|
}
|
|
3037
3037
|
function pr(a, e) {
|
|
3038
|
-
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s =
|
|
3038
|
+
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s = wt(n, !1);
|
|
3039
3039
|
a.geometry != null && a.geometry.dispose(), a.geometry = s, a.geometrys = n, a.castShadow = !0, a.receiveShadow = !0;
|
|
3040
3040
|
}
|
|
3041
3041
|
async function gr(a, e, t, i) {
|
|
@@ -3052,21 +3052,21 @@ async function gr(a, e, t, i) {
|
|
|
3052
3052
|
const u = l.slice(d, d + c);
|
|
3053
3053
|
if (u.length === 0)
|
|
3054
3054
|
continue;
|
|
3055
|
-
const g =
|
|
3055
|
+
const g = Sr(u[0].material, e);
|
|
3056
3056
|
let m = ur(e, a, r, g), f = 0, w = 0;
|
|
3057
3057
|
m = null, m != null ? (f = Array.isArray(m.geometrys) ? m.geometrys.length : 0, w = nn(m.geometry), pr(m, u)) : m = dr(a, e, r, u, g);
|
|
3058
3058
|
const b = /* @__PURE__ */ new Map();
|
|
3059
3059
|
let p = w;
|
|
3060
3060
|
u.forEach((x, C) => {
|
|
3061
|
-
const
|
|
3062
|
-
if (D.push([p, p + I]), b.set(
|
|
3063
|
-
const R = s.nodesMap.get(
|
|
3061
|
+
const A = Number(x.name), I = nn(x.geometry), D = b.get(A) ?? [];
|
|
3062
|
+
if (D.push([p, p + I]), b.set(A, D), s?.nodesMap?.has(A)) {
|
|
3063
|
+
const R = s.nodesMap.get(A);
|
|
3064
3064
|
R.indexes == null && (R.indexes = []), R.indexes.push([m.index, f + C, p, p + I]);
|
|
3065
3065
|
}
|
|
3066
3066
|
p += I;
|
|
3067
3067
|
}), m.indexes == null && (m.indexes = /* @__PURE__ */ new Map()), b.forEach((x, C) => {
|
|
3068
|
-
const
|
|
3069
|
-
|
|
3068
|
+
const A = m.indexes.get(C) ?? [];
|
|
3069
|
+
A.push(...x), m.indexes.set(C, A);
|
|
3070
3070
|
}), e.requestComposerRender?.(), o = await je(e, i, o);
|
|
3071
3071
|
}
|
|
3072
3072
|
}
|
|
@@ -3098,7 +3098,7 @@ async function fr(a, e, t, i, n, s) {
|
|
|
3098
3098
|
const b = mr(i, w);
|
|
3099
3099
|
if (b != null && (f.box = b.clone()), r.setMatrixAt(m, w), r.matrixs || (r.matrixs = []), r.matrixs.push(w.clone()), g.push(w.clone()), o.nodesMap.has(f.id)) {
|
|
3100
3100
|
const p = o.nodesMap.get(f.id);
|
|
3101
|
-
p.indexes == null && (p.indexes = []), p.indexes.push([c, m, 0, 0]),
|
|
3101
|
+
p.indexes == null && (p.indexes = []), p.indexes.push([c, m, 0, 0]), At(p), b != null && p?.info != null && (p.info.box instanceof F ? p.info.box.union(b) : p.info.box = b.clone());
|
|
3102
3102
|
} else {
|
|
3103
3103
|
const p = {
|
|
3104
3104
|
instance: !0,
|
|
@@ -3106,7 +3106,7 @@ async function fr(a, e, t, i, n, s) {
|
|
|
3106
3106
|
infos: [f],
|
|
3107
3107
|
indexes: [[c, m, 0, 0]]
|
|
3108
3108
|
};
|
|
3109
|
-
|
|
3109
|
+
At(p), o.nodesMap.set(f.id, p);
|
|
3110
3110
|
}
|
|
3111
3111
|
(m + 1) % Wo === 0 && (u = await je(t, s, u));
|
|
3112
3112
|
}
|
|
@@ -3116,15 +3116,21 @@ async function yr(a, e, t, i) {
|
|
|
3116
3116
|
const n = e.instanceNodes;
|
|
3117
3117
|
if (n == null)
|
|
3118
3118
|
return;
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3119
|
+
const s = t.filterLoaderModel?.getContinueIdSet?.(a.url) ?? /* @__PURE__ */ new Set();
|
|
3120
|
+
let o = performance.now();
|
|
3121
|
+
for (const r in n)
|
|
3122
|
+
if (n[r].isLoaded !== !0) {
|
|
3123
|
+
n[r].isLoaded = !0;
|
|
3124
|
+
for (const l of n[r]) {
|
|
3125
|
+
const c = e.glbs?.[r]?.[l.mesh];
|
|
3126
|
+
if (c != null) {
|
|
3127
|
+
const d = Array.isArray(l.children) ? l.children.filter((u) => s.has(Number(u?.id)) === !1) : [];
|
|
3128
|
+
if (d.length === 0)
|
|
3129
|
+
continue;
|
|
3130
|
+
await fr(a.url, l.mesh, t, c, d, i);
|
|
3131
|
+
}
|
|
3126
3132
|
}
|
|
3127
|
-
|
|
3133
|
+
o = await je(t, i, o);
|
|
3128
3134
|
}
|
|
3129
3135
|
}
|
|
3130
3136
|
async function Mr(a, e, t, i) {
|
|
@@ -3149,7 +3155,7 @@ async function vr(a, e, t, i) {
|
|
|
3149
3155
|
t.preparePromise = (async () => {
|
|
3150
3156
|
console.log("[loadLightModel] loading GLB bundle", t.path), t.glbs = t.glbs ?? {};
|
|
3151
3157
|
const n = e.url + t.path;
|
|
3152
|
-
|
|
3158
|
+
gt(a, e.url, n), console.log(`[loadLightModel] ZIP 解压开始 ${Date.now() - window.startTime}ms`);
|
|
3153
3159
|
const s = await es(n, e.key);
|
|
3154
3160
|
console.log(`[loadLightModel] ZIP 解压完成 ${Date.now() - window.startTime}ms`);
|
|
3155
3161
|
const o = await tn(s, ["/nodes.json", "nodes.json"]);
|
|
@@ -3167,12 +3173,12 @@ async function vr(a, e, t, i) {
|
|
|
3167
3173
|
const x = b[p];
|
|
3168
3174
|
if (x.glb = w, l.nodesMap.has(x.id) === !1) {
|
|
3169
3175
|
const C = { infos: [x] };
|
|
3170
|
-
|
|
3176
|
+
At(C), l.nodesMap.set(x.id, C);
|
|
3171
3177
|
} else {
|
|
3172
3178
|
const C = l.nodesMap.get(x.id);
|
|
3173
3179
|
if (!C.infos)
|
|
3174
3180
|
continue;
|
|
3175
|
-
C.infos.push(x),
|
|
3181
|
+
C.infos.push(x), At(C);
|
|
3176
3182
|
}
|
|
3177
3183
|
(p + 1) % Qn === 0 && (c = await je(a, i, c));
|
|
3178
3184
|
}
|
|
@@ -3225,9 +3231,9 @@ function wr(a, e, t) {
|
|
|
3225
3231
|
if (t.boundingBox || (t.boundingBox = new F(), t.boundingBox.min = new h(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new h(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
3226
3232
|
return 1e3;
|
|
3227
3233
|
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), l = new h(), c = new h(), d = new h(), u = new h();
|
|
3228
|
-
if (e.getWorldDirection(d), e.getWorldPosition(u), e.matrixWorld.extractBasis(l, c, new h()), e instanceof
|
|
3229
|
-
const p = Math.max((e.top - e.bottom) / e.zoom, 1e-6), x = a?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = O.degToRad(x * 0.5),
|
|
3230
|
-
u.copy(o).add(d.clone().multiplyScalar(-
|
|
3234
|
+
if (e.getWorldDirection(d), e.getWorldPosition(u), e.matrixWorld.extractBasis(l, c, new h()), e instanceof Se) {
|
|
3235
|
+
const p = Math.max((e.top - e.bottom) / e.zoom, 1e-6), x = a?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = O.degToRad(x * 0.5), A = C > 0 ? p / (2 * Math.tan(C)) : p;
|
|
3236
|
+
u.copy(o).add(d.clone().multiplyScalar(-A));
|
|
3231
3237
|
}
|
|
3232
3238
|
if (u.distanceTo(o) <= r * 0.5)
|
|
3233
3239
|
return 1e3;
|
|
@@ -3247,7 +3253,7 @@ function br(a, e, t) {
|
|
|
3247
3253
|
if (i == null)
|
|
3248
3254
|
return;
|
|
3249
3255
|
e.loadStatus.modelMep = "loading", i.modelMep == null && (i.modelMep = {}), (async () => {
|
|
3250
|
-
t || await Jn(), Io(a, i.modelMep, e.url), e.loadStatus.modelMep = !0,
|
|
3256
|
+
t || await Jn(), Io(a, i.modelMep, e.url), e.loadStatus.modelMep = !0, mt(a);
|
|
3251
3257
|
})().catch((s) => {
|
|
3252
3258
|
e.loadStatus.modelMep = !1, console.error("[loadLightModel] failed to load mep model", s);
|
|
3253
3259
|
});
|
|
@@ -3273,7 +3279,7 @@ function Cr(a, e, t, i) {
|
|
|
3273
3279
|
},
|
|
3274
3280
|
key: o
|
|
3275
3281
|
};
|
|
3276
|
-
a.engineStatus.models.push(u), l?.lods.forEach((
|
|
3282
|
+
a.engineStatus.models.push(u), l?.lods.forEach((f) => delete f.elements);
|
|
3277
3283
|
const g = {
|
|
3278
3284
|
url: e,
|
|
3279
3285
|
urls: [e + "/info"],
|
|
@@ -3295,13 +3301,18 @@ function Cr(a, e, t, i) {
|
|
|
3295
3301
|
max: new h(c.max.X * 0.3048, c.max.Z * 0.3048, -c.max.Y * 0.3048)
|
|
3296
3302
|
}
|
|
3297
3303
|
};
|
|
3298
|
-
a.models.push(g), s ?
|
|
3299
|
-
|
|
3300
|
-
})
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3304
|
+
a.models.push(g), s ? a.modelProperties.loadProperties(e, () => {
|
|
3305
|
+
a.filterLoaderModel?.buildContinueIds?.(e), m();
|
|
3306
|
+
}) : m();
|
|
3307
|
+
function m() {
|
|
3308
|
+
s ? ir(e + "/quota_list", o).then((f) => {
|
|
3309
|
+
f.exists && (g.quotaList = f.value ?? [], a.rxQuotaListMapper.loadNodeMap(g)), u.loadStatus.quotaList = !0, mt(a);
|
|
3310
|
+
}).catch((f) => {
|
|
3311
|
+
u.loadStatus.quotaList = !0, console.warn("[loadLightModel] unexpected quota_list load failure", { url: e, error: f }), mt(a);
|
|
3312
|
+
}) : (u.loadStatus.quotaList = !0, mt(a)), a.models.length == i && (a.viewCube.CameraGoHome(1), setTimeout(() => {
|
|
3313
|
+
rs(a, null, !1);
|
|
3314
|
+
}, 100));
|
|
3315
|
+
}
|
|
3305
3316
|
}).catch((r) => {
|
|
3306
3317
|
console.error("[loadLightModel] failed to load model info", { url: e, error: r });
|
|
3307
3318
|
});
|
|
@@ -3315,7 +3326,7 @@ async function rs(a, e, t = !1) {
|
|
|
3315
3326
|
await Ar(a, n, t);
|
|
3316
3327
|
} finally {
|
|
3317
3328
|
const s = is(a, n.url), o = s.length > 0 && s.every((r) => r.status === !0);
|
|
3318
|
-
n.loadStatus.normal = o, o && (n.status = "loaded"),
|
|
3329
|
+
n.loadStatus.normal = o, o && (n.status = "loaded"), mt(a);
|
|
3319
3330
|
}
|
|
3320
3331
|
}
|
|
3321
3332
|
}
|
|
@@ -3326,10 +3337,10 @@ async function Ar(a, e, t = !1) {
|
|
|
3326
3337
|
for (const n of i)
|
|
3327
3338
|
await xr(a, e, n, t);
|
|
3328
3339
|
}
|
|
3329
|
-
function
|
|
3340
|
+
function Sr(a, e) {
|
|
3330
3341
|
return hr(a), a.map != null && (a.map.colorSpace = We, a.map.needsUpdate = !0), a.side = oe, a.shadowSide = oe, a.clipShadows = !0, e?.sectionPlane && (a.clippingPlanes = e.sectionPlane), a;
|
|
3331
3342
|
}
|
|
3332
|
-
const
|
|
3343
|
+
const Er = "/__local_model__", Pr = /^(info|property|edge|quota_list|lod\d+)(?:\.zip)?$/i, Tr = /^(info|property|edge|quota_list|lod\d+)(?:~)?$/i;
|
|
3333
3344
|
class _e {
|
|
3334
3345
|
static localRequestMap = /* @__PURE__ */ new Map();
|
|
3335
3346
|
static localObjectUrls = /* @__PURE__ */ new Set();
|
|
@@ -3364,7 +3375,7 @@ class _e {
|
|
|
3364
3375
|
for (let n = 0; n < e.length; n++) {
|
|
3365
3376
|
const s = e[n];
|
|
3366
3377
|
try {
|
|
3367
|
-
const o = await
|
|
3378
|
+
const o = await qt.get(s, { responseType: "blob" });
|
|
3368
3379
|
if (!await on(o.data))
|
|
3369
3380
|
throw new Error("响应内容不是有效的 ZIP 文件");
|
|
3370
3381
|
i.push(new File(
|
|
@@ -3440,7 +3451,7 @@ class _e {
|
|
|
3440
3451
|
blob: await this.packEntriesAsZip(m)
|
|
3441
3452
|
});
|
|
3442
3453
|
c.some((g) => g.packageName === "info") && (r += 1, o.push({
|
|
3443
|
-
rootUrl: `${
|
|
3454
|
+
rootUrl: `${Er}/${_e.createLocalModelId(l, r)}`,
|
|
3444
3455
|
packages: c
|
|
3445
3456
|
}));
|
|
3446
3457
|
}
|
|
@@ -3453,7 +3464,7 @@ class _e {
|
|
|
3453
3464
|
async collectSourceEntries(e) {
|
|
3454
3465
|
const t = [];
|
|
3455
3466
|
for (const i of e) {
|
|
3456
|
-
const n = De(i.webkitRelativePath || i.name), s =
|
|
3467
|
+
const n = De(i.webkitRelativePath || i.name), s = ft(n);
|
|
3457
3468
|
if (sn(s)) {
|
|
3458
3469
|
t.push({ path: n, blob: i });
|
|
3459
3470
|
continue;
|
|
@@ -3475,7 +3486,7 @@ class _e {
|
|
|
3475
3486
|
* 识别已经打好的模型包文件,例如 `info`、`lod0.zip`。
|
|
3476
3487
|
*/
|
|
3477
3488
|
parseDirectPackageEntry(e) {
|
|
3478
|
-
const t = ni(e), i =
|
|
3489
|
+
const t = ni(e), i = ft(e);
|
|
3479
3490
|
return sn(i) ? {
|
|
3480
3491
|
modelKey: t,
|
|
3481
3492
|
packageName: Dr(i)
|
|
@@ -3498,7 +3509,7 @@ class _e {
|
|
|
3498
3509
|
innerPath: o.join("/")
|
|
3499
3510
|
};
|
|
3500
3511
|
}
|
|
3501
|
-
const i =
|
|
3512
|
+
const i = ft(e).toLowerCase();
|
|
3502
3513
|
return i === "info.json" || i === "property.json" || i === "edge.json" || i === "quota_list.json" ? {
|
|
3503
3514
|
modelKey: ni(e),
|
|
3504
3515
|
packageName: i.replace(".json", ""),
|
|
@@ -3518,7 +3529,7 @@ class _e {
|
|
|
3518
3529
|
* 注册 axios 拦截器,把虚拟模型地址改写为对应的 Blob URL。
|
|
3519
3530
|
*/
|
|
3520
3531
|
static ensureLocalRequestInterceptor() {
|
|
3521
|
-
_e.interceptorInstalled || (
|
|
3532
|
+
_e.interceptorInstalled || (qt.interceptors.request.use((e) => {
|
|
3522
3533
|
if (typeof e.url == "string") {
|
|
3523
3534
|
const t = _e.normalizeRequestKey(e.url), i = _e.localRequestMap.get(t);
|
|
3524
3535
|
i != null && (e.url = i);
|
|
@@ -3554,7 +3565,7 @@ class _e {
|
|
|
3554
3565
|
function De(a) {
|
|
3555
3566
|
return a.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
3556
3567
|
}
|
|
3557
|
-
function
|
|
3568
|
+
function ft(a) {
|
|
3558
3569
|
const e = De(a), t = e.lastIndexOf("/");
|
|
3559
3570
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
3560
3571
|
}
|
|
@@ -3565,9 +3576,9 @@ function ni(a) {
|
|
|
3565
3576
|
function _r(a, e) {
|
|
3566
3577
|
try {
|
|
3567
3578
|
const t = new URL(a, window.location.origin);
|
|
3568
|
-
return decodeURIComponent(
|
|
3579
|
+
return decodeURIComponent(ft(t.pathname)) || `model-package-${e + 1}.zip`;
|
|
3569
3580
|
} catch {
|
|
3570
|
-
return
|
|
3581
|
+
return ft(a.split("?")[0].split("#")[0]) || `model-package-${e + 1}.zip`;
|
|
3571
3582
|
}
|
|
3572
3583
|
}
|
|
3573
3584
|
function Ir(a, e) {
|
|
@@ -3690,7 +3701,7 @@ class Br {
|
|
|
3690
3701
|
});
|
|
3691
3702
|
}
|
|
3692
3703
|
}
|
|
3693
|
-
const
|
|
3704
|
+
const yt = 1, si = 1, zr = 1800, an = 1024, Rr = 1.35, Or = 20, Fr = 1200, oi = 0.5, Nr = 10, Hr = 0.08, ri = 500, ln = 5e4, cn = 120, Vr = 5e4, hn = 0.12, Ur = 8, Gr = 0.75, dn = 5e-5, Wr = 15e-4, Kr = 2.5, qr = 2.4, jr = 4.5, Yr = 0.94, Xr = 0.995, Qr = 80, $r = 0.06, Zr = 8, Jr = new h(-1, 4, 2).normalize();
|
|
3694
3705
|
class ea {
|
|
3695
3706
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
3696
3707
|
engine;
|
|
@@ -3724,10 +3735,10 @@ class ea {
|
|
|
3724
3735
|
const e = new Ge(16774630, 5);
|
|
3725
3736
|
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width = an, e.shadow.mapSize.height = an, e.shadow.camera.near = oi, e.shadow.camera.far = ri, e.shadow.bias = -dn, e.shadow.normalBias = hn;
|
|
3726
3737
|
const t = si;
|
|
3727
|
-
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 =
|
|
3738
|
+
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 = yt, e.target.name = "directionalShadowLightTarget";
|
|
3728
3739
|
const i = new Ge(16777215, 2);
|
|
3729
3740
|
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;
|
|
3730
|
-
const n = new
|
|
3741
|
+
const n = new Vt(16777215, 1);
|
|
3731
3742
|
this.engine.scene.add(n);
|
|
3732
3743
|
}
|
|
3733
3744
|
/**
|
|
@@ -3743,7 +3754,7 @@ class ea {
|
|
|
3743
3754
|
*/
|
|
3744
3755
|
updateDirectionalShadow(e) {
|
|
3745
3756
|
const t = this.getShadowDirectionalLight();
|
|
3746
|
-
if (!t || !(t.shadow.camera instanceof
|
|
3757
|
+
if (!t || !(t.shadow.camera instanceof Se))
|
|
3747
3758
|
return;
|
|
3748
3759
|
const i = t.shadow.camera, n = this.getSceneBoundingBox();
|
|
3749
3760
|
this.updateShadowCasterPolicy(n);
|
|
@@ -3782,8 +3793,8 @@ class ea {
|
|
|
3782
3793
|
f,
|
|
3783
3794
|
o,
|
|
3784
3795
|
u
|
|
3785
|
-
), x = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(p.near - this.lastShadowNear) > 1,
|
|
3786
|
-
!x && !C && !
|
|
3796
|
+
), x = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(p.near - this.lastShadowNear) > 1, A = Math.abs(p.far - this.lastShadowFar) > 1, I = b.distanceToSquared(this.lastLightPosition) > 0.25, D = f.distanceToSquared(this.lastLightTarget) > 0.25, R = Math.abs(w - this.lastShadowIntensity) > 0.01;
|
|
3797
|
+
!x && !C && !A && !I && !D && !R || (t.position.copy(b), 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 = p.near, i.far = p.far, i.updateProjectionMatrix(), this.updateShadowBias(t, u, p), t.shadow.intensity = w, t.shadow.needsUpdate = !0, this.lastShadowHalfSize = u, this.lastShadowNear = p.near, this.lastShadowFar = p.far, this.lastLightPosition.copy(b), this.lastLightTarget.copy(f), this.lastShadowIntensity = w);
|
|
3787
3798
|
}
|
|
3788
3799
|
/**
|
|
3789
3800
|
* 计算场景范围对阴影相机半边长的贡献。
|
|
@@ -3950,11 +3961,11 @@ class ea {
|
|
|
3950
3961
|
getCameraHalfExtent(e, t) {
|
|
3951
3962
|
if (!e)
|
|
3952
3963
|
return 0;
|
|
3953
|
-
if (e instanceof
|
|
3964
|
+
if (e instanceof Se) {
|
|
3954
3965
|
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);
|
|
3955
3966
|
return Math.max(s, n);
|
|
3956
3967
|
}
|
|
3957
|
-
if (e instanceof
|
|
3968
|
+
if (e instanceof vt) {
|
|
3958
3969
|
const i = this.resolveShadowTarget(e, t), n = Math.max(e.position.distanceTo(i), 1), s = O.degToRad(e.getEffectiveFOV() * 0.5), o = Math.max(Math.tan(s) * n, 1), r = o * Math.max(e.aspect, 1e-6);
|
|
3959
3970
|
return Math.min(Math.max(r, o), Fr);
|
|
3960
3971
|
}
|
|
@@ -4010,7 +4021,7 @@ class ea {
|
|
|
4010
4021
|
Xr
|
|
4011
4022
|
);
|
|
4012
4023
|
}
|
|
4013
|
-
return
|
|
4024
|
+
return yt * Math.min(o, r);
|
|
4014
4025
|
}
|
|
4015
4026
|
/**
|
|
4016
4027
|
* 把阴影 target 对齐到阴影贴图 texel 网格。
|
|
@@ -4545,7 +4556,7 @@ class ia {
|
|
|
4545
4556
|
if (e.isSplit || e instanceof U)
|
|
4546
4557
|
return;
|
|
4547
4558
|
e.geometry != null && (e.__mergedGeometryBackup = e.geometry);
|
|
4548
|
-
let t = e.material, i =
|
|
4559
|
+
let t = e.material, i = wt(e.geometrys, !0);
|
|
4549
4560
|
i.computeVertexNormals(), i.groups.forEach((n) => {
|
|
4550
4561
|
n.materialIndex = 0;
|
|
4551
4562
|
}), e.__splitComponentRanges = i.groups.map((n) => ({
|
|
@@ -4568,7 +4579,7 @@ class ia {
|
|
|
4568
4579
|
}
|
|
4569
4580
|
if (!Array.isArray(e.geometrys) || e.geometrys.length === 0)
|
|
4570
4581
|
return;
|
|
4571
|
-
const i = e.geometry, n =
|
|
4582
|
+
const i = e.geometry, n = wt(e.geometrys, !1);
|
|
4572
4583
|
n != null && (n.computeVertexNormals(), e.geometry = n, e.material = e.material[0], e.needsUpdate = !0, e.isSplit = !1, delete e.__splitComponentRanges, delete e.__splitComponentStates, i && i !== n && typeof i.dispose == "function" && i.dispose(), console.log("merge"));
|
|
4573
4584
|
}
|
|
4574
4585
|
shouldKeepSplitState(e) {
|
|
@@ -4614,7 +4625,7 @@ class ia {
|
|
|
4614
4625
|
rebatchSplitModels() {
|
|
4615
4626
|
if (!this.engine?.scene)
|
|
4616
4627
|
return;
|
|
4617
|
-
|
|
4628
|
+
Ct(this.engine, (t) => t instanceof N && !(t instanceof U) && t.isSplit === !0).forEach((t) => {
|
|
4618
4629
|
this.rebuildSplitModelGroups(t), this.un_split_merge_model(t);
|
|
4619
4630
|
}), this.rebuildCustomInstanceColorBatches();
|
|
4620
4631
|
}
|
|
@@ -4639,7 +4650,7 @@ class ia {
|
|
|
4639
4650
|
restoreSplitModelsOnIdle() {
|
|
4640
4651
|
if (!this.engine?.scene)
|
|
4641
4652
|
return;
|
|
4642
|
-
|
|
4653
|
+
Ct(this.engine, (t) => t instanceof N && !(t instanceof U)).forEach((t) => {
|
|
4643
4654
|
t instanceof N && (t.isSplit === !0 && (t.visible = !this.areAllGroupsHidden(t)), t.isSplit === !0 && this.un_split_merge_model(t));
|
|
4644
4655
|
});
|
|
4645
4656
|
}
|
|
@@ -5186,7 +5197,7 @@ class ia {
|
|
|
5186
5197
|
}
|
|
5187
5198
|
function na(a, e) {
|
|
5188
5199
|
a.forEach((t, i) => {
|
|
5189
|
-
const n =
|
|
5200
|
+
const n = Tt(e, i);
|
|
5190
5201
|
if (!(n instanceof U))
|
|
5191
5202
|
return;
|
|
5192
5203
|
const s = n.geometry, o = new ce({
|
|
@@ -5210,8 +5221,8 @@ function na(a, e) {
|
|
|
5210
5221
|
});
|
|
5211
5222
|
const l = /* @__PURE__ */ new Map(), c = new H(), d = new H();
|
|
5212
5223
|
d.makeScale(0, 0, 0), t.forEach((u, g) => {
|
|
5213
|
-
const m =
|
|
5214
|
-
|
|
5224
|
+
const m = Et(e, i, u);
|
|
5225
|
+
Pt(m, !1);
|
|
5215
5226
|
const f = m?.matrix ?? n.matrixs?.[u] ?? n.matrixsClone?.[u];
|
|
5216
5227
|
f instanceof H ? c.copy(f) : n.getMatrixAt(u, c), l.set(u, c.clone()), n.setMatrixAt(u, d), r.setMatrixAt(g, c);
|
|
5217
5228
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
@@ -5219,13 +5230,13 @@ function na(a, e) {
|
|
|
5219
5230
|
}
|
|
5220
5231
|
function un(a, e, t) {
|
|
5221
5232
|
a.forEach((i, n) => {
|
|
5222
|
-
const s =
|
|
5233
|
+
const s = Tt(e, n);
|
|
5223
5234
|
if (!(s instanceof U))
|
|
5224
5235
|
return;
|
|
5225
5236
|
i.forEach((r) => {
|
|
5226
|
-
const l =
|
|
5237
|
+
const l = Et(e, n, r);
|
|
5227
5238
|
if (l != null) {
|
|
5228
|
-
s.setMatrixAt(r, new H().makeScale(0, 0, 0)),
|
|
5239
|
+
s.setMatrixAt(r, new H().makeScale(0, 0, 0)), Pt(l, !0);
|
|
5229
5240
|
return;
|
|
5230
5241
|
}
|
|
5231
5242
|
const c = s.matrixsClone[r];
|
|
@@ -5241,7 +5252,7 @@ function un(a, e, t) {
|
|
|
5241
5252
|
}
|
|
5242
5253
|
function sa(a, e) {
|
|
5243
5254
|
a.forEach((t, i) => {
|
|
5244
|
-
const n =
|
|
5255
|
+
const n = Tt(e, i);
|
|
5245
5256
|
if (!(n instanceof U))
|
|
5246
5257
|
return;
|
|
5247
5258
|
const s = n.geometry, o = new ce({
|
|
@@ -5259,8 +5270,8 @@ function sa(a, e) {
|
|
|
5259
5270
|
r.name = "translucentModel", r.key = i;
|
|
5260
5271
|
const l = /* @__PURE__ */ new Map(), c = new H(), d = new H();
|
|
5261
5272
|
d.makeScale(0, 0, 0), t.forEach((u, g) => {
|
|
5262
|
-
const m =
|
|
5263
|
-
|
|
5273
|
+
const m = Et(e, i, u);
|
|
5274
|
+
Pt(m, !1);
|
|
5264
5275
|
const f = m?.matrix ?? n.matrixs?.[u] ?? n.matrixsClone?.[u];
|
|
5265
5276
|
f instanceof H ? c.copy(f) : n.getMatrixAt(u, c), l.set(u, c.clone()), n.setMatrixAt(u, d), r.setMatrixAt(g, c);
|
|
5266
5277
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
@@ -5273,13 +5284,13 @@ function oa(a, e) {
|
|
|
5273
5284
|
}), t.forEach((i) => {
|
|
5274
5285
|
as(i);
|
|
5275
5286
|
}), a.forEach((i, n) => {
|
|
5276
|
-
const s =
|
|
5287
|
+
const s = Tt(e, n);
|
|
5277
5288
|
if (!(s instanceof U))
|
|
5278
5289
|
return;
|
|
5279
5290
|
const o = /* @__PURE__ */ new Map(), r = new H(), l = new H();
|
|
5280
5291
|
l.makeScale(0, 0, 0), i.forEach((c) => {
|
|
5281
|
-
const d =
|
|
5282
|
-
|
|
5292
|
+
const d = Et(e, n, c);
|
|
5293
|
+
Pt(d, !1);
|
|
5283
5294
|
const u = d?.matrix ?? s.matrixs?.[c] ?? s.matrixsClone?.[c];
|
|
5284
5295
|
u instanceof H ? r.copy(u) : s.getMatrixAt(c, r), o.set(c, r.clone()), s.setMatrixAt(c, l);
|
|
5285
5296
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
@@ -5287,11 +5298,11 @@ function oa(a, e) {
|
|
|
5287
5298
|
}
|
|
5288
5299
|
function pn(a, e) {
|
|
5289
5300
|
a.forEach((t, i) => {
|
|
5290
|
-
const n =
|
|
5301
|
+
const n = Tt(e, i);
|
|
5291
5302
|
n instanceof U && (t.forEach((s) => {
|
|
5292
|
-
const o =
|
|
5303
|
+
const o = Et(e, i, s);
|
|
5293
5304
|
if (o != null) {
|
|
5294
|
-
n.setMatrixAt(s, new H().makeScale(0, 0, 0)),
|
|
5305
|
+
n.setMatrixAt(s, new H().makeScale(0, 0, 0)), Pt(o, !0);
|
|
5295
5306
|
return;
|
|
5296
5307
|
}
|
|
5297
5308
|
const r = n.matrixs[s];
|
|
@@ -5299,11 +5310,11 @@ function pn(a, e) {
|
|
|
5299
5310
|
}), n.instanceMatrix.needsUpdate = !0);
|
|
5300
5311
|
});
|
|
5301
5312
|
}
|
|
5302
|
-
function
|
|
5313
|
+
function Et(a, e, t) {
|
|
5303
5314
|
const i = a?.modelToolModule?.customModelColorRecords;
|
|
5304
5315
|
return i instanceof Map ? Array.from(i.values()).find((n) => n?.type === "instance" && n.meshIndex === e && n.instanceIndex === t) ?? null : null;
|
|
5305
5316
|
}
|
|
5306
|
-
function
|
|
5317
|
+
function Pt(a, e) {
|
|
5307
5318
|
a?.cloneModel != null && (a.cloneModel.visible = e);
|
|
5308
5319
|
}
|
|
5309
5320
|
function as(a) {
|
|
@@ -5312,7 +5323,7 @@ function as(a) {
|
|
|
5312
5323
|
const e = a.parent;
|
|
5313
5324
|
e?.remove(a), a.material?.dispose != null && a.material.dispose();
|
|
5314
5325
|
}
|
|
5315
|
-
function
|
|
5326
|
+
function Tt(a, e) {
|
|
5316
5327
|
return Fe(a, e);
|
|
5317
5328
|
}
|
|
5318
5329
|
const ls = "advanced";
|
|
@@ -5675,7 +5686,7 @@ function ca(a, e, t) {
|
|
|
5675
5686
|
const v = new h(0, 0, 1).applyQuaternion(e.camera.quaternion);
|
|
5676
5687
|
i.camera.position.copy(v.multiplyScalar(100)), x(i.orbitControls, a.controls);
|
|
5677
5688
|
}
|
|
5678
|
-
function
|
|
5689
|
+
function A() {
|
|
5679
5690
|
!i.camera || !e.camera || (e.camera.quaternion.copy(i.camera.quaternion), e.camera.up.copy(i.camera.up), x(a.controls, i.orbitControls));
|
|
5680
5691
|
}
|
|
5681
5692
|
function I(v, M) {
|
|
@@ -5778,10 +5789,10 @@ function ca(a, e, t) {
|
|
|
5778
5789
|
}
|
|
5779
5790
|
var ve = (y - te) / 2, Ie = (z - E) / 2, Ze = (e.camera.right - e.camera.left) / 2, we = (e.camera.top - e.camera.bottom) / 2;
|
|
5780
5791
|
_ = Math.min(Ze / ve, we / Ie) * 0.75;
|
|
5781
|
-
var
|
|
5782
|
-
x1:
|
|
5783
|
-
y1:
|
|
5784
|
-
z1:
|
|
5792
|
+
var Ee = e.camera.position.clone(), ze = a.controls.target.clone(), Ce = e.camera.zoom, Re = new lt.Tween({
|
|
5793
|
+
x1: Ee.x,
|
|
5794
|
+
y1: Ee.y,
|
|
5795
|
+
z1: Ee.z,
|
|
5785
5796
|
x2: ze.x,
|
|
5786
5797
|
y2: ze.y,
|
|
5787
5798
|
z2: ze.z,
|
|
@@ -5922,7 +5933,7 @@ function ca(a, e, t) {
|
|
|
5922
5933
|
function k() {
|
|
5923
5934
|
i.sceneOrtho = aa();
|
|
5924
5935
|
var P = t.clientWidth, B = t.clientWidth, v = P > B ? P / B : B / P, M = 300;
|
|
5925
|
-
i.camera = new
|
|
5936
|
+
i.camera = new Se(
|
|
5926
5937
|
M * v / -2,
|
|
5927
5938
|
M * v / 2,
|
|
5928
5939
|
M / 2,
|
|
@@ -5934,7 +5945,7 @@ function ca(a, e, t) {
|
|
|
5934
5945
|
alpha: !0
|
|
5935
5946
|
});
|
|
5936
5947
|
L.setSize(P, B), L.setClearAlpha(0), i.sceneOrtho.renderer = L;
|
|
5937
|
-
let _ = new
|
|
5948
|
+
let _ = new Vt(16777215, 0.8);
|
|
5938
5949
|
i.sceneOrtho.add(_), la(o, L), i.orbitControls = new Hn(a, i.camera, o), i.orbitControls.enableZoom = !1, i.orbitControls.enablePan = !1, i.orbitControls.enableDamping = !0, i.orbitControls.dampingFactor = 0.1, i.orbitControls.rotateSpeed = 0.5, i.orbitControls.addEventListener("start", Y), i.orbitControls.addEventListener("change", ne), i.orbitControls.addEventListener("end", $);
|
|
5939
5950
|
}
|
|
5940
5951
|
let G = !1;
|
|
@@ -5943,7 +5954,7 @@ function ca(a, e, t) {
|
|
|
5943
5954
|
}
|
|
5944
5955
|
function ne() {
|
|
5945
5956
|
if (G) {
|
|
5946
|
-
if (e.camera.quaternion.copy(i.camera.quaternion),
|
|
5957
|
+
if (e.camera.quaternion.copy(i.camera.quaternion), A(), a.controls && i._mainTarget && i._mainDistance) {
|
|
5947
5958
|
const v = new h(0, 0, 1).applyQuaternion(e.camera.quaternion);
|
|
5948
5959
|
e.camera.position.copy(i._mainTarget.clone().add(v.multiplyScalar(i._mainDistance))), a.controls.update();
|
|
5949
5960
|
}
|
|
@@ -5993,8 +6004,8 @@ function ca(a, e, t) {
|
|
|
5993
6004
|
color: 16777215,
|
|
5994
6005
|
map: ye(M, _.icon)
|
|
5995
6006
|
}));
|
|
5996
|
-
var B = new N(new
|
|
5997
|
-
i.sceneOrtho.add(B),
|
|
6007
|
+
var B = new N(new Ut(110, 110, 110), P);
|
|
6008
|
+
i.sceneOrtho.add(B), S(122), i.RenderScene();
|
|
5998
6009
|
let L = { x: 0, y: 0 };
|
|
5999
6010
|
o.addEventListener("mousedown", (_) => {
|
|
6000
6011
|
L.x = _.clientX, L.y = _.clientY;
|
|
@@ -6019,7 +6030,7 @@ function ca(a, e, t) {
|
|
|
6019
6030
|
ee.length > 0 && (ee[0].object.material.opacity = 0.2);
|
|
6020
6031
|
});
|
|
6021
6032
|
}
|
|
6022
|
-
function
|
|
6033
|
+
function S(v) {
|
|
6023
6034
|
for (var M = v * 0.5 - 20, P = [
|
|
6024
6035
|
{
|
|
6025
6036
|
name: "right",
|
|
@@ -6213,7 +6224,7 @@ function ca(a, e, t) {
|
|
|
6213
6224
|
l.push(T(L[_]));
|
|
6214
6225
|
}
|
|
6215
6226
|
function T(v) {
|
|
6216
|
-
const M = new
|
|
6227
|
+
const M = new Ut(v.a, v.b, v.c), P = new ce({
|
|
6217
6228
|
color: "blue",
|
|
6218
6229
|
transparent: !0,
|
|
6219
6230
|
opacity: 0.01
|
|
@@ -6399,32 +6410,32 @@ function da(a) {
|
|
|
6399
6410
|
s != null && (delete s.threeBox, s.children?.forEach((o) => n(o)));
|
|
6400
6411
|
}
|
|
6401
6412
|
}, e.rayInterationModel = function(t, i, n = !0) {
|
|
6402
|
-
const o = [], r = /* @__PURE__ */ new Set(), l = new h(), c = a.clipping, d = Array.isArray(a.models) ? a.models : [], u = new Map(d.map((
|
|
6403
|
-
d.forEach((
|
|
6404
|
-
const T = u.get(
|
|
6413
|
+
const o = [], r = /* @__PURE__ */ new Set(), l = new h(), c = a.clipping, d = Array.isArray(a.models) ? a.models : [], u = new Map(d.map((S) => [S.url, S])), g = ye(a.engineStatus.hideModels), m = ye(a.engineStatus.translucentModels), f = a.modelExplode?.raycast?.(t) ?? [];
|
|
6414
|
+
d.forEach((S) => {
|
|
6415
|
+
const T = u.get(S.url);
|
|
6405
6416
|
if (T == null)
|
|
6406
6417
|
return;
|
|
6407
|
-
const v = Be(a,
|
|
6408
|
-
(
|
|
6418
|
+
const v = Be(a, S.url);
|
|
6419
|
+
(S.lods ?? []).forEach((M) => {
|
|
6409
6420
|
let P = M.octreeBox;
|
|
6410
|
-
p(t, P,
|
|
6421
|
+
p(t, P, S, T, v);
|
|
6411
6422
|
});
|
|
6412
6423
|
});
|
|
6413
|
-
const w = o.map((
|
|
6424
|
+
const w = o.map((S) => R(S)).filter((S) => S instanceof N);
|
|
6414
6425
|
Oo(t);
|
|
6415
6426
|
const b = [
|
|
6416
6427
|
...f,
|
|
6417
6428
|
...t.intersectObjects(w, !1).map(ne)
|
|
6418
|
-
].sort((
|
|
6429
|
+
].sort((S, T) => S.distance - T.distance);
|
|
6419
6430
|
return Fo(t), b;
|
|
6420
|
-
function p(
|
|
6431
|
+
function p(S, T, v, M, P) {
|
|
6421
6432
|
if (T == null)
|
|
6422
6433
|
return;
|
|
6423
6434
|
if (!T.threeBox) {
|
|
6424
6435
|
let _ = new h(T.min.X * 0.3048, T.min.Z * 0.3048, -T.min.Y * 0.3048), W = new h(T.max.X * 0.3048, T.max.Z * 0.3048, -T.max.Y * 0.3048), Z = new h(Math.min(_.x, W.x), Math.min(_.y, W.y), Math.min(_.z, W.z)), ee = new h(Math.max(W.x, _.x), Math.max(W.y, _.y), Math.max(W.z, _.z));
|
|
6425
6436
|
T.threeBox = new F(Z, ee).applyMatrix4(P);
|
|
6426
6437
|
}
|
|
6427
|
-
const B = T.threeBox, L =
|
|
6438
|
+
const B = T.threeBox, L = S.ray.intersectsBox(B);
|
|
6428
6439
|
if (!(L == null || L == !1) && c?.doesBoxIntersectClippingRange?.(B) !== !1)
|
|
6429
6440
|
if (T.children == null || T.children.length == 0) {
|
|
6430
6441
|
if (T.elements != null)
|
|
@@ -6435,13 +6446,13 @@ function da(a) {
|
|
|
6435
6446
|
for (let _ of T.elements)
|
|
6436
6447
|
x(_, v, M, P);
|
|
6437
6448
|
for (let _ of T.children)
|
|
6438
|
-
p(
|
|
6449
|
+
p(S, _, v, M, P);
|
|
6439
6450
|
}
|
|
6440
6451
|
}
|
|
6441
|
-
function x(
|
|
6442
|
-
if (!a.engineStatus.isFree && i == !1 || fe(T.url,
|
|
6452
|
+
function x(S, T, v, M) {
|
|
6453
|
+
if (!a.engineStatus.isFree && i == !1 || fe(T.url, S) || a.modelExplode?.hasRecord?.(T.url, S))
|
|
6443
6454
|
return;
|
|
6444
|
-
const P = v.nodesMap.get(
|
|
6455
|
+
const P = v.nodesMap.get(S);
|
|
6445
6456
|
if (P == null)
|
|
6446
6457
|
return;
|
|
6447
6458
|
const B = I(P.indexes);
|
|
@@ -6454,7 +6465,7 @@ function da(a) {
|
|
|
6454
6465
|
if (W == null)
|
|
6455
6466
|
return;
|
|
6456
6467
|
const Z = t.ray.origin.distanceToSquared(W);
|
|
6457
|
-
|
|
6468
|
+
A(P, L, T.url, M, Z);
|
|
6458
6469
|
});
|
|
6459
6470
|
return;
|
|
6460
6471
|
}
|
|
@@ -6462,13 +6473,13 @@ function da(a) {
|
|
|
6462
6473
|
C(L.mesh, M);
|
|
6463
6474
|
});
|
|
6464
6475
|
}
|
|
6465
|
-
function C(
|
|
6466
|
-
if (!(
|
|
6476
|
+
function C(S, T) {
|
|
6477
|
+
if (!(S instanceof N) || (S.parent == null && be(S, T), n && S.geometry.attributes.position.count >= 2e3))
|
|
6467
6478
|
return;
|
|
6468
|
-
const v =
|
|
6479
|
+
const v = S.uuid ?? S.id;
|
|
6469
6480
|
if (r.has(v))
|
|
6470
6481
|
return;
|
|
6471
|
-
const M = $(
|
|
6482
|
+
const M = $(S, T);
|
|
6472
6483
|
if (M == null || c?.doesBoxIntersectClippingRange?.(M) === !1)
|
|
6473
6484
|
return;
|
|
6474
6485
|
const P = t.ray.intersectBox(M, l);
|
|
@@ -6476,10 +6487,10 @@ function da(a) {
|
|
|
6476
6487
|
key: v,
|
|
6477
6488
|
distanceSq: t.ray.origin.distanceToSquared(P),
|
|
6478
6489
|
kind: "mesh",
|
|
6479
|
-
mesh:
|
|
6490
|
+
mesh: S
|
|
6480
6491
|
}), D());
|
|
6481
6492
|
}
|
|
6482
|
-
function S
|
|
6493
|
+
function A(S, T, v, M, P) {
|
|
6483
6494
|
if (!Array.isArray(T) || T.length < 2 || !(Fe(a, T[0]) instanceof U))
|
|
6484
6495
|
return;
|
|
6485
6496
|
const L = `instance:${T[0]}:${T[1]}`;
|
|
@@ -6487,26 +6498,26 @@ function da(a) {
|
|
|
6487
6498
|
key: L,
|
|
6488
6499
|
distanceSq: P,
|
|
6489
6500
|
kind: "instance",
|
|
6490
|
-
node:
|
|
6501
|
+
node: S,
|
|
6491
6502
|
indexInfo: T,
|
|
6492
6503
|
url: v,
|
|
6493
6504
|
modelMatrix: M.clone()
|
|
6494
6505
|
}), D());
|
|
6495
6506
|
}
|
|
6496
|
-
function I(
|
|
6497
|
-
return Array.isArray(
|
|
6507
|
+
function I(S) {
|
|
6508
|
+
return Array.isArray(S) ? S.filter((T) => Array.isArray(T) && Fe(a, T[0]) instanceof U) : [];
|
|
6498
6509
|
}
|
|
6499
6510
|
function D() {
|
|
6500
|
-
if (o.sort((
|
|
6501
|
-
const
|
|
6502
|
-
|
|
6511
|
+
if (o.sort((S, T) => S.distanceSq - T.distanceSq), o.length > 20) {
|
|
6512
|
+
const S = o.pop();
|
|
6513
|
+
S != null && r.delete(S.key);
|
|
6503
6514
|
}
|
|
6504
6515
|
}
|
|
6505
|
-
function R(
|
|
6506
|
-
return
|
|
6516
|
+
function R(S) {
|
|
6517
|
+
return S.kind === "mesh" ? S.mesh : S.kind === "instance" ? k(S.node, S.indexInfo, S.url, S.modelMatrix) : null;
|
|
6507
6518
|
}
|
|
6508
|
-
function k(
|
|
6509
|
-
if (!Array.isArray(T) || T.length < 2 ||
|
|
6519
|
+
function k(S, T, v, M) {
|
|
6520
|
+
if (!Array.isArray(T) || T.length < 2 || S == null)
|
|
6510
6521
|
return null;
|
|
6511
6522
|
const P = Fe(a, T[0]);
|
|
6512
6523
|
if (!(P instanceof U) || P.geometry == null)
|
|
@@ -6514,20 +6525,20 @@ function da(a) {
|
|
|
6514
6525
|
const B = T[1], L = Y(P, B);
|
|
6515
6526
|
if (L == null)
|
|
6516
6527
|
return null;
|
|
6517
|
-
const _ = M.clone().multiply(L), W =
|
|
6528
|
+
const _ = M.clone().multiply(L), W = S.info ?? S;
|
|
6518
6529
|
W.__pickMeshes instanceof Map || (W.__pickMeshes = /* @__PURE__ */ new Map());
|
|
6519
6530
|
const Z = `${T[0]}:${B}`;
|
|
6520
6531
|
let ee = W.__pickMeshes.get(Z);
|
|
6521
6532
|
return ee instanceof N || (ee = new N(P.geometry, P.material), W.__pickMeshes.set(Z, ee)), be(ee, _), ee.userData.__instancePickMeta = {
|
|
6522
6533
|
url: v,
|
|
6523
|
-
id:
|
|
6534
|
+
id: S.info?.id ?? S.id ?? S.infos[0].id,
|
|
6524
6535
|
instanceId: B,
|
|
6525
6536
|
matrix: L.clone()
|
|
6526
6537
|
}, ee;
|
|
6527
6538
|
}
|
|
6528
|
-
function G(
|
|
6529
|
-
if (
|
|
6530
|
-
return
|
|
6539
|
+
function G(S, T, v) {
|
|
6540
|
+
if (S?.info?.box instanceof F)
|
|
6541
|
+
return S.info.box.clone().applyMatrix4(T);
|
|
6531
6542
|
const M = Fe(a, v?.[0]);
|
|
6532
6543
|
if (!(M instanceof U) || M.geometry == null)
|
|
6533
6544
|
return null;
|
|
@@ -6535,20 +6546,20 @@ function da(a) {
|
|
|
6535
6546
|
const P = Y(M, v[1]);
|
|
6536
6547
|
return M.geometry.boundingBox == null || P == null ? null : M.geometry.boundingBox.clone().applyMatrix4(P).applyMatrix4(T);
|
|
6537
6548
|
}
|
|
6538
|
-
function Y(
|
|
6549
|
+
function Y(S, T) {
|
|
6539
6550
|
const v = new H();
|
|
6540
|
-
if (typeof
|
|
6541
|
-
|
|
6542
|
-
else if (
|
|
6543
|
-
v.copy(
|
|
6551
|
+
if (typeof S.getMatrixAt == "function")
|
|
6552
|
+
S.getMatrixAt(T, v);
|
|
6553
|
+
else if (S.matrixs?.[T] instanceof H)
|
|
6554
|
+
v.copy(S.matrixs[T]);
|
|
6544
6555
|
else
|
|
6545
6556
|
return null;
|
|
6546
6557
|
return v;
|
|
6547
6558
|
}
|
|
6548
|
-
function ne(
|
|
6549
|
-
const T =
|
|
6550
|
-
return T == null ?
|
|
6551
|
-
...
|
|
6559
|
+
function ne(S) {
|
|
6560
|
+
const T = S?.object?.userData?.__instancePickMeta;
|
|
6561
|
+
return T == null ? S : {
|
|
6562
|
+
...S,
|
|
6552
6563
|
object: {
|
|
6553
6564
|
url: T.url,
|
|
6554
6565
|
id: T.id,
|
|
@@ -6559,20 +6570,20 @@ function da(a) {
|
|
|
6559
6570
|
matrix: T.matrix.clone()
|
|
6560
6571
|
};
|
|
6561
6572
|
}
|
|
6562
|
-
function $(
|
|
6563
|
-
return
|
|
6573
|
+
function $(S, T) {
|
|
6574
|
+
return S.box instanceof F ? S.box : S.geometry == null || (S.geometry.boundingBox == null && S.geometry.computeBoundingBox(), S.geometry.boundingBox == null) ? null : (S.box = S.geometry.boundingBox.clone().applyMatrix4(T), S.box);
|
|
6564
6575
|
}
|
|
6565
|
-
function fe(
|
|
6566
|
-
return g.get(
|
|
6576
|
+
function fe(S, T) {
|
|
6577
|
+
return g.get(S)?.has(T) || m.get(S)?.has(T);
|
|
6567
6578
|
}
|
|
6568
|
-
function ye(
|
|
6579
|
+
function ye(S) {
|
|
6569
6580
|
const T = /* @__PURE__ */ new Map();
|
|
6570
|
-
return
|
|
6581
|
+
return S?.forEach((v) => {
|
|
6571
6582
|
Array.isArray(v.ids) && T.set(v.url, new Set(v.ids));
|
|
6572
6583
|
}), T;
|
|
6573
6584
|
}
|
|
6574
|
-
function be(
|
|
6575
|
-
|
|
6585
|
+
function be(S, T) {
|
|
6586
|
+
S instanceof N && (S.matrixAutoUpdate = !1, S.matrix.copy(T), S.matrixWorld.copy(T), S.matrixWorldNeedsUpdate = !1, S.box instanceof F && (S.box.copy(S.geometry.boundingBox ?? new F().setFromBufferAttribute(S.geometry.attributes.position)), S.box.applyMatrix4(T)));
|
|
6576
6587
|
}
|
|
6577
6588
|
}, e;
|
|
6578
6589
|
}
|
|
@@ -6734,14 +6745,14 @@ class ua {
|
|
|
6734
6745
|
const s = new h();
|
|
6735
6746
|
e.getSize(s);
|
|
6736
6747
|
const o = Math.max(s.x, s.y, s.z);
|
|
6737
|
-
if (t instanceof
|
|
6748
|
+
if (t instanceof vt) {
|
|
6738
6749
|
const r = t.fov * (Math.PI / 180), c = o / (2 * Math.tan(r / 2)) * 1.2, d = new h();
|
|
6739
6750
|
t.getWorldDirection(d);
|
|
6740
6751
|
const u = n.clone().sub(t.position);
|
|
6741
6752
|
d.dot(u.normalize()) < 0 && d.negate();
|
|
6742
6753
|
const m = n.clone().sub(d.multiplyScalar(c));
|
|
6743
6754
|
t.position.copy(m), i.target && i.target.copy(n), t.lookAt(n), i.update();
|
|
6744
|
-
} else if (t instanceof
|
|
6755
|
+
} else if (t instanceof Se) {
|
|
6745
6756
|
const l = o * 1.2, c = this.engine.renderer?.domElement, d = c ? c.width / c.height : 1;
|
|
6746
6757
|
t.left = -l * d / 2, t.right = l * d / 2, t.top = l / 2, t.bottom = -l / 2, t.updateProjectionMatrix();
|
|
6747
6758
|
const u = new h();
|
|
@@ -6794,12 +6805,12 @@ class ma {
|
|
|
6794
6805
|
if (!e || !t)
|
|
6795
6806
|
return;
|
|
6796
6807
|
let i = 0.5;
|
|
6797
|
-
if (e instanceof
|
|
6808
|
+
if (e instanceof Se) {
|
|
6798
6809
|
const n = (e.top - e.bottom) / e.zoom, s = t.domElement.clientHeight || 1;
|
|
6799
6810
|
i = 30 * n / s;
|
|
6800
6811
|
}
|
|
6801
6812
|
this.rootGroup.traverse((n) => {
|
|
6802
|
-
n instanceof
|
|
6813
|
+
n instanceof Gt && n.scale.set(i, i, 1);
|
|
6803
6814
|
});
|
|
6804
6815
|
}
|
|
6805
6816
|
/**
|
|
@@ -6847,7 +6858,7 @@ class ma {
|
|
|
6847
6858
|
const s = new ue().setFromPoints([t, i]), o = new He({
|
|
6848
6859
|
color: 1609983,
|
|
6849
6860
|
depthTest: !1
|
|
6850
|
-
}), r = new
|
|
6861
|
+
}), r = new St(s, o);
|
|
6851
6862
|
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;
|
|
6852
6863
|
}
|
|
6853
6864
|
_makeCircleSprite(e, t) {
|
|
@@ -6862,7 +6873,7 @@ class ma {
|
|
|
6862
6873
|
map: c,
|
|
6863
6874
|
depthTest: !1,
|
|
6864
6875
|
transparent: !0
|
|
6865
|
-
}), u = new
|
|
6876
|
+
}), u = new Gt(d);
|
|
6866
6877
|
return u.position.copy(t), u.scale.set(0.5, 0.5, 1), u.renderOrder = 999, u;
|
|
6867
6878
|
}
|
|
6868
6879
|
/**
|
|
@@ -7107,7 +7118,7 @@ class zi {
|
|
|
7107
7118
|
} else {
|
|
7108
7119
|
const s = new di(n, n, 1, 1);
|
|
7109
7120
|
s.rotateX(-Math.PI / 2);
|
|
7110
|
-
const o = new
|
|
7121
|
+
const o = new Ei({
|
|
7111
7122
|
color: i.color,
|
|
7112
7123
|
roughness: i.roughness,
|
|
7113
7124
|
metalness: i.metalness
|
|
@@ -7319,12 +7330,12 @@ class Ma {
|
|
|
7319
7330
|
}
|
|
7320
7331
|
_getAmbientLightIntensity() {
|
|
7321
7332
|
return this.engine.scene?.children.find(
|
|
7322
|
-
(t) => t instanceof
|
|
7333
|
+
(t) => t instanceof Vt
|
|
7323
7334
|
)?.intensity ?? 1;
|
|
7324
7335
|
}
|
|
7325
7336
|
_setAmbientLightIntensity(e) {
|
|
7326
7337
|
const t = this.engine.scene?.children.find(
|
|
7327
|
-
(i) => i instanceof
|
|
7338
|
+
(i) => i instanceof Vt
|
|
7328
7339
|
);
|
|
7329
7340
|
t && (t.intensity = e);
|
|
7330
7341
|
}
|
|
@@ -7470,7 +7481,7 @@ class xa {
|
|
|
7470
7481
|
transparent: !0,
|
|
7471
7482
|
opacity: 0.7
|
|
7472
7483
|
});
|
|
7473
|
-
if (o.add(new
|
|
7484
|
+
if (o.add(new St(u, g)), o.visible = this.isVisible, this.engine.scene.add(o), e.group = o, this.svgOverlay) {
|
|
7474
7485
|
const m = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
7475
7486
|
m.dataset.levelId = e.data.Id;
|
|
7476
7487
|
for (let f = 0; f < 4; f += 1)
|
|
@@ -7567,7 +7578,7 @@ class xa {
|
|
|
7567
7578
|
};
|
|
7568
7579
|
}
|
|
7569
7580
|
}
|
|
7570
|
-
const
|
|
7581
|
+
const Ft = !0, yi = 0.5, ba = 32, Ca = 0.3, gs = 0.05, Aa = 0.04, Sa = 0.18, Ea = 0.01;
|
|
7571
7582
|
function Pa(a) {
|
|
7572
7583
|
return !a?.min || !a?.max ? 0 : a.min.distanceTo(a.max);
|
|
7573
7584
|
}
|
|
@@ -7575,7 +7586,7 @@ function Ta(a, e) {
|
|
|
7575
7586
|
return a instanceof h ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new h();
|
|
7576
7587
|
}
|
|
7577
7588
|
function _a(a, e, t) {
|
|
7578
|
-
if (a instanceof
|
|
7589
|
+
if (a instanceof Se)
|
|
7579
7590
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
7580
7591
|
const i = a, n = Ta(e, t), s = i.position.distanceTo(n), o = typeof i.getEffectiveFOV == "function" ? i.getEffectiveFOV() : i.fov, r = O.degToRad(o * 0.5);
|
|
7581
7592
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
@@ -7586,7 +7597,7 @@ function Ia(a, e, t, i) {
|
|
|
7586
7597
|
const n = Pa(t);
|
|
7587
7598
|
if (n <= 0)
|
|
7588
7599
|
return i;
|
|
7589
|
-
const s = _a(a, e, t), o = Math.max(n * Aa, 1), r = Math.max(n *
|
|
7600
|
+
const s = _a(a, e, t), o = Math.max(n * Aa, 1), r = Math.max(n * Sa, o + 1), l = O.clamp(
|
|
7590
7601
|
(s - o) / (r - o),
|
|
7591
7602
|
0,
|
|
7592
7603
|
1
|
|
@@ -7595,7 +7606,7 @@ function Ia(a, e, t, i) {
|
|
|
7595
7606
|
}
|
|
7596
7607
|
class Da {
|
|
7597
7608
|
engine;
|
|
7598
|
-
isActive =
|
|
7609
|
+
isActive = Ft;
|
|
7599
7610
|
groupEdge;
|
|
7600
7611
|
highlightEdgeGroup;
|
|
7601
7612
|
material;
|
|
@@ -7607,11 +7618,14 @@ class Da {
|
|
|
7607
7618
|
highlightIndexes = /* @__PURE__ */ new Map();
|
|
7608
7619
|
highlightEdgeSyncVersion = 0;
|
|
7609
7620
|
explodeHidden = !1;
|
|
7610
|
-
groupVisibleBeforeExplode =
|
|
7621
|
+
groupVisibleBeforeExplode = Ft;
|
|
7611
7622
|
highlightVisibleBeforeExplode = !0;
|
|
7612
7623
|
getModelEntry(e) {
|
|
7613
7624
|
return this.engine?.models?.find((t) => t?.url === e) ?? null;
|
|
7614
7625
|
}
|
|
7626
|
+
getFilteredIdSet(e) {
|
|
7627
|
+
return this.engine?.filterLoaderModel?.getContinueIdSet?.(e) ?? /* @__PURE__ */ new Set();
|
|
7628
|
+
}
|
|
7615
7629
|
getOrCreateItemIndex(e) {
|
|
7616
7630
|
const t = this.indexes.get(e);
|
|
7617
7631
|
if (t)
|
|
@@ -7664,7 +7678,7 @@ class Da {
|
|
|
7664
7678
|
// 高亮边线也要遵守深度,否则隐藏边线密集叠加时会像一块灰色半透明面。
|
|
7665
7679
|
depthTest: !1,
|
|
7666
7680
|
depthWrite: !1
|
|
7667
|
-
}), this.highlightEdgeMaterial.clippingPlanes = this.engine.sectionPlane, this.groupEdge.visible =
|
|
7681
|
+
}), this.highlightEdgeMaterial.clippingPlanes = this.engine.sectionPlane, this.groupEdge.visible = Ft;
|
|
7668
7682
|
}
|
|
7669
7683
|
// 启动
|
|
7670
7684
|
active() {
|
|
@@ -7697,14 +7711,14 @@ class Da {
|
|
|
7697
7711
|
this.engine?.octreeBox?.getBoundingBox?.(),
|
|
7698
7712
|
this.baseOpacity
|
|
7699
7713
|
);
|
|
7700
|
-
Math.abs(this.material.opacity - e) <=
|
|
7714
|
+
Math.abs(this.material.opacity - e) <= Ea || (this.material.opacity = e, this.material.needsUpdate = !0);
|
|
7701
7715
|
}
|
|
7702
7716
|
hasPendingModelEdges() {
|
|
7703
7717
|
return (this.engine?.models ?? []).some((t) => !Array.isArray(t?.modelEdge));
|
|
7704
7718
|
}
|
|
7705
7719
|
loadZipJsonAsync(e, t) {
|
|
7706
7720
|
return new Promise((i, n) => {
|
|
7707
|
-
|
|
7721
|
+
pt(
|
|
7708
7722
|
e,
|
|
7709
7723
|
(s) => {
|
|
7710
7724
|
if (s == null) {
|
|
@@ -7725,9 +7739,13 @@ class Da {
|
|
|
7725
7739
|
return e.modelEdge;
|
|
7726
7740
|
try {
|
|
7727
7741
|
const t = this.engine.engineStatus.models.find((s) => s.url == e.url);
|
|
7728
|
-
|
|
7742
|
+
gt(this.engine, e.url, e.url + "/edge");
|
|
7729
7743
|
const i = await this.loadZipJsonAsync(e.url + "/edge", t?.key ?? e?.key), n = JSON.parse(i);
|
|
7730
|
-
|
|
7744
|
+
if (Array.isArray(n)) {
|
|
7745
|
+
const s = this.getFilteredIdSet(e.url);
|
|
7746
|
+
e.modelEdge = s.size > 0 ? n.filter((o) => s.has(Number(o?.id)) === !1) : n;
|
|
7747
|
+
} else
|
|
7748
|
+
e.modelEdge = [];
|
|
7731
7749
|
} catch (t) {
|
|
7732
7750
|
console.error("[ModelEdge] failed to load model edge", {
|
|
7733
7751
|
url: e?.url,
|
|
@@ -7773,8 +7791,8 @@ class Da {
|
|
|
7773
7791
|
}), s.length === 0)
|
|
7774
7792
|
return;
|
|
7775
7793
|
const l = new ue();
|
|
7776
|
-
l.setAttribute("position", new
|
|
7777
|
-
const c = new
|
|
7794
|
+
l.setAttribute("position", new xt(s, 3));
|
|
7795
|
+
const c = new Wt(l, this.material);
|
|
7778
7796
|
c.url = i, this.setLineTransform(c, Be(this.engine, i)), this.groupEdge.add(c), this.highlightIndexes.set(i, o), this.releaseIndexes(i);
|
|
7779
7797
|
});
|
|
7780
7798
|
}
|
|
@@ -7821,8 +7839,8 @@ class Da {
|
|
|
7821
7839
|
}), s.length === 0)
|
|
7822
7840
|
return;
|
|
7823
7841
|
const o = new ue();
|
|
7824
|
-
o.setAttribute("position", new
|
|
7825
|
-
const r = new
|
|
7842
|
+
o.setAttribute("position", new xt(s, 3));
|
|
7843
|
+
const r = new Wt(o, this.highlightEdgeMaterial);
|
|
7826
7844
|
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r, Be(this.engine, i.url)), this.highlightEdgeGroup.add(r);
|
|
7827
7845
|
}));
|
|
7828
7846
|
}
|
|
@@ -8344,12 +8362,12 @@ class ka {
|
|
|
8344
8362
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
8345
8363
|
contrast: this._uniformToPercent(t, jn),
|
|
8346
8364
|
saturation: this._uniformToPercent(e, qn),
|
|
8347
|
-
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(),
|
|
8365
|
+
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(), yt),
|
|
8348
8366
|
lightIntensity: this._exposureToPercent(n, Ti),
|
|
8349
8367
|
gtaoIntensity: this._unitToPercent(i, Kn)
|
|
8350
8368
|
},
|
|
8351
8369
|
display: {
|
|
8352
|
-
showEdge: this.engine.modelEdge?.isEnabled?.() ??
|
|
8370
|
+
showEdge: this.engine.modelEdge?.isEnabled?.() ?? Ft,
|
|
8353
8371
|
edgeOpacity: this._unitToPercent(s, yi),
|
|
8354
8372
|
showGrid: this.engine.grid?.getVisible?.() ?? fi,
|
|
8355
8373
|
showLevel: this.engine.level?.getVisible?.() ?? ps,
|
|
@@ -8423,7 +8441,7 @@ class ka {
|
|
|
8423
8441
|
const e = this.engine.scene?.children?.filter(
|
|
8424
8442
|
(i) => i instanceof Ge
|
|
8425
8443
|
);
|
|
8426
|
-
return !e || e.length === 0 ?
|
|
8444
|
+
return !e || e.length === 0 ? yt : (e.find((i) => i.castShadow) ?? e[0]).shadow?.intensity ?? yt;
|
|
8427
8445
|
}
|
|
8428
8446
|
_applyRenderSettings(e) {
|
|
8429
8447
|
this.setRenderMode(e.mode), this.setContrast(e.contrast), this.setSaturation(e.saturation), this.setShadowIntensity(e.shadowIntensity), this.setLightIntensity(e.lightIntensity), this.setGTAOIntensity(e.gtaoIntensity);
|
|
@@ -8592,14 +8610,14 @@ class Ve {
|
|
|
8592
8610
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(se.MeasureClick, p);
|
|
8593
8611
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8594
8612
|
}
|
|
8595
|
-
let x = i(p.point1), C = i(p.point2),
|
|
8596
|
-
if (x == null || C == null ||
|
|
8613
|
+
let x = i(p.point1), C = i(p.point2), A = i(p.point3);
|
|
8614
|
+
if (x == null || C == null || A == null) {
|
|
8597
8615
|
n(p, !1);
|
|
8598
8616
|
return;
|
|
8599
8617
|
}
|
|
8600
8618
|
n(p, !0);
|
|
8601
8619
|
let I = p.container;
|
|
8602
|
-
I.getElementsByTagName("circle")[0].setAttribute("cx", x.x), I.getElementsByTagName("circle")[0].setAttribute("cy", x.y), I.getElementsByTagName("circle")[1].setAttribute("cx", C.x), I.getElementsByTagName("circle")[1].setAttribute("cy", C.y), I.getElementsByTagName("circle")[2].setAttribute("cx",
|
|
8620
|
+
I.getElementsByTagName("circle")[0].setAttribute("cx", x.x), I.getElementsByTagName("circle")[0].setAttribute("cy", x.y), I.getElementsByTagName("circle")[1].setAttribute("cx", C.x), I.getElementsByTagName("circle")[1].setAttribute("cy", C.y), I.getElementsByTagName("circle")[2].setAttribute("cx", A.x), I.getElementsByTagName("circle")[2].setAttribute("cy", A.y), I.getElementsByTagName("polyline")[0].setAttribute("points", x.x + "," + x.y + " " + C.x + "," + C.y), I.getElementsByTagName("polyline")[1].setAttribute("points", C.x + "," + C.y + " " + A.x + "," + A.y);
|
|
8603
8621
|
let D = C.x, R = C.y - 30;
|
|
8604
8622
|
I.getElementsByTagName("rect")[0].setAttribute("x", D - 40), I.getElementsByTagName("rect")[0].setAttribute("y", R - 12.5), I.getElementsByTagName("text")[0].setAttribute("x", D), I.getElementsByTagName("text")[0].setAttribute("y", R + 4), I.getElementsByTagName("text")[0].innerHTML = p.text, I.style.top = "0px", I.style.left = "0px";
|
|
8605
8623
|
}
|
|
@@ -8621,21 +8639,21 @@ class Ve {
|
|
|
8621
8639
|
}
|
|
8622
8640
|
if (!p.points || p.points.length < 2)
|
|
8623
8641
|
return;
|
|
8624
|
-
let x = [], C = 0,
|
|
8642
|
+
let x = [], C = 0, A = 0;
|
|
8625
8643
|
for (let ne = 0; ne < p.points.length; ne++) {
|
|
8626
8644
|
let $ = i(p.points[ne]);
|
|
8627
8645
|
if ($ == null) {
|
|
8628
8646
|
n(p, !1);
|
|
8629
8647
|
return;
|
|
8630
8648
|
}
|
|
8631
|
-
x.push($), C += $.x,
|
|
8649
|
+
x.push($), C += $.x, A += $.y;
|
|
8632
8650
|
}
|
|
8633
|
-
n(p, !0), C = C / x.length,
|
|
8651
|
+
n(p, !0), C = C / x.length, A = A / x.length;
|
|
8634
8652
|
let I = x.map((ne) => ne.x + "," + ne.y).join(" "), D = [...x];
|
|
8635
8653
|
x.length >= 3 && D.push(x[0]);
|
|
8636
8654
|
let R = D.map((ne) => ne.x + "," + ne.y).join(" "), k = p.container;
|
|
8637
8655
|
k.getElementsByTagName("polygon")[0].setAttribute("points", x.length >= 3 ? I : ""), k.getElementsByTagName("polyline")[0].setAttribute("points", R);
|
|
8638
|
-
let G = C, Y =
|
|
8656
|
+
let G = C, Y = A;
|
|
8639
8657
|
k.getElementsByTagName("rect")[0].setAttribute("x", G - 40), k.getElementsByTagName("rect")[0].setAttribute("y", Y - 12.5), k.getElementsByTagName("text")[0].setAttribute("x", G + 10), k.getElementsByTagName("text")[0].setAttribute("y", Y + 4), k.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 2), k.style.top = "0px", k.style.left = "0px";
|
|
8640
8658
|
}
|
|
8641
8659
|
function m(p) {
|
|
@@ -8664,10 +8682,10 @@ class Ve {
|
|
|
8664
8682
|
return;
|
|
8665
8683
|
}
|
|
8666
8684
|
n(p, !0);
|
|
8667
|
-
let
|
|
8668
|
-
|
|
8685
|
+
let A = p.container;
|
|
8686
|
+
A.getElementsByTagName("polyline")[0].setAttribute("points", x.x + "," + x.y + " " + C.x + "," + C.y);
|
|
8669
8687
|
let I = (x.x + C.x) / 2, D = (x.y + C.y) / 2 - 30;
|
|
8670
|
-
|
|
8688
|
+
A.getElementsByTagName("rect")[0].setAttribute("x", I - 50), A.getElementsByTagName("rect")[0].setAttribute("y", D - 12.5), A.getElementsByTagName("text")[0].setAttribute("x", I), A.getElementsByTagName("text")[0].setAttribute("y", D + 4), A.getElementsByTagName("text")[0].innerHTML = p.text, A.style.top = "0px", A.style.left = "0px";
|
|
8671
8689
|
}
|
|
8672
8690
|
function f(p) {
|
|
8673
8691
|
if (p.container == null) {
|
|
@@ -8692,21 +8710,21 @@ class Ve {
|
|
|
8692
8710
|
return;
|
|
8693
8711
|
}
|
|
8694
8712
|
n(p, !0), x.style.top = "0px", x.style.left = "0px";
|
|
8695
|
-
let
|
|
8696
|
-
|
|
8713
|
+
let A = x.getElementsByTagName("circle")[0];
|
|
8714
|
+
A && (A.setAttribute("cx", C.x), A.setAttribute("cy", C.y));
|
|
8697
8715
|
let I = x.getElementsByTagName("rect"), D = x.getElementsByTagName("text"), R = -55;
|
|
8698
8716
|
I[0] && (I[0].setAttribute("x", C.x + 10), I[0].setAttribute("y", C.y + 10 + R)), D[0] && (D[0].setAttribute("x", C.x + 10 + 50), D[0].setAttribute("y", C.y + 10 + 16 + R)), I[1] && (I[1].setAttribute("x", C.x + 10), I[1].setAttribute("y", C.y + 10 + 30 + R)), D[1] && (D[1].setAttribute("x", C.x + 10 + 50), D[1].setAttribute("y", C.y + 10 + 46 + R)), I[2] && (I[2].setAttribute("x", C.x + 10), I[2].setAttribute("y", C.y + 10 + 60 + R)), D[2] && (D[2].setAttribute("x", C.x + 10 + 50), D[2].setAttribute("y", C.y + 10 + 76 + R)), D[0] && (D[0].innerHTML = "X: " + e.getMeasureText(p.textX, 1)), D[1] && (D[1].innerHTML = "Y: " + e.getMeasureText(-p.textZ, 1)), D[2] && (D[2].innerHTML = "Z: " + e.getMeasureText(p.textY, 1));
|
|
8699
8717
|
}
|
|
8700
8718
|
function w(p) {
|
|
8701
8719
|
if (p.container == null) {
|
|
8702
|
-
let
|
|
8720
|
+
let A = [
|
|
8703
8721
|
'<svg width="100" height="50" class="measureSvg">',
|
|
8704
8722
|
'<rect x="0" y="0" width="100" height="25" class="measureBack" />',
|
|
8705
8723
|
'<text x="50" y="16" text-anchor="middle" class="measureLabel"> ' + e.getMeasureText(p.text, 1) + "</text>",
|
|
8706
8724
|
'<polyline class="measureLine" stroke-width="2" points="80,32 0,32 16,48 32,32" style="fill: none; opacity: 1;"/>',
|
|
8707
8725
|
"</svg>"
|
|
8708
8726
|
].join("");
|
|
8709
|
-
p.container = document.createElement("div"), p.container.className = "elevation-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML =
|
|
8727
|
+
p.container = document.createElement("div"), p.container.className = "elevation-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML = A, e.engine.measure.annotationContainer.appendChild(p.container), p.container.getElementsByTagName("svg")[0].addEventListener("click", function() {
|
|
8710
8728
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(se.MeasureClick, p);
|
|
8711
8729
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8712
8730
|
}
|
|
@@ -8738,12 +8756,12 @@ class Ve {
|
|
|
8738
8756
|
return;
|
|
8739
8757
|
} else
|
|
8740
8758
|
x.style.display = "block";
|
|
8741
|
-
let C = i(p.point1),
|
|
8742
|
-
if (C == null ||
|
|
8759
|
+
let C = i(p.point1), A = i(p.point2);
|
|
8760
|
+
if (C == null || A == null) {
|
|
8743
8761
|
n(p, !1);
|
|
8744
8762
|
return;
|
|
8745
8763
|
}
|
|
8746
|
-
n(p, !0), x.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " +
|
|
8764
|
+
n(p, !0), x.getElementsByTagName("polyline")[0].setAttribute("points", C.x + "," + C.y + " " + A.x + "," + A.y), x.getElementsByTagName("circle")[0].setAttribute("cx", C.x), x.getElementsByTagName("circle")[0].setAttribute("cy", C.y), x.getElementsByTagName("circle")[1].setAttribute("cx", A.x), x.getElementsByTagName("circle")[1].setAttribute("cy", A.y), x.getElementsByTagName("rect")[0].setAttribute("x", C.x * 0.5 + A.x * 0.5 - 40), x.getElementsByTagName("rect")[0].setAttribute("y", C.y * 0.5 + A.y * 0.5 - 12.5), x.getElementsByTagName("text")[0].setAttribute("x", C.x * 0.5 + A.x * 0.5 + 50 - 40), x.getElementsByTagName("text")[0].setAttribute("y", C.y * 0.5 + A.y * 0.5 + 16 - 12.5), x.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 1), x.style.top = "0px", x.style.left = "0px";
|
|
8747
8765
|
}
|
|
8748
8766
|
}
|
|
8749
8767
|
}
|
|
@@ -9200,7 +9218,7 @@ class Ha {
|
|
|
9200
9218
|
e != null && this.points.length >= 3 ? (e.points = this.points.map((t) => t.clone()), e.area = this.calculateArea(e.points), e.text = e.area, e.isSelect = !1, this.points = [], this.engine.events.trigger(se.MeasureChanged, e)) : this.engine.measure.tools.handelKeyEscDown();
|
|
9201
9219
|
}
|
|
9202
9220
|
}
|
|
9203
|
-
class
|
|
9221
|
+
class Mt {
|
|
9204
9222
|
engine;
|
|
9205
9223
|
tools;
|
|
9206
9224
|
static WORLD_UP = new h(0, 1, 0);
|
|
@@ -9259,7 +9277,7 @@ class ft {
|
|
|
9259
9277
|
const t = this.getWorldFaceNormal(e);
|
|
9260
9278
|
if (t == null)
|
|
9261
9279
|
return null;
|
|
9262
|
-
const i = new h().crossVectors(t,
|
|
9280
|
+
const i = new h().crossVectors(t, Mt.WORLD_UP);
|
|
9263
9281
|
if (i.lengthSq() < 1e-10)
|
|
9264
9282
|
return null;
|
|
9265
9283
|
const n = new h().crossVectors(i.normalize(), t);
|
|
@@ -9287,9 +9305,9 @@ class ft {
|
|
|
9287
9305
|
t.clone().multiplyScalar(c)
|
|
9288
9306
|
), u = o.worldToScreenIfVisible(d);
|
|
9289
9307
|
if (u != null)
|
|
9290
|
-
return this.pointToScreenLineDistance(l, r, u) <=
|
|
9308
|
+
return this.pointToScreenLineDistance(l, r, u) <= Mt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
9291
9309
|
const g = o.worldToScreenIfVisible(i);
|
|
9292
|
-
return g != null && l.distanceTo(g) <=
|
|
9310
|
+
return g != null && l.distanceTo(g) <= Mt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
9293
9311
|
}
|
|
9294
9312
|
getSlopeSnappedPoint(e, t, i) {
|
|
9295
9313
|
const n = t?.point;
|
|
@@ -9461,7 +9479,7 @@ class Ua {
|
|
|
9461
9479
|
volumeAnnotation: []
|
|
9462
9480
|
};
|
|
9463
9481
|
constructor(e) {
|
|
9464
|
-
this.engine = e, this.clearHeightMeasure = new Ba(e), this.distanceMeasure = new za(e), this.clearDistanceMeasure = new Ra(e), this.elevationMeasure = new Oa(e), this.pointMeasure = new Fa(e), this.angleMeasure = new Na(e), this.areaMeasure = new Ha(e), this.slopeMeasure = new
|
|
9482
|
+
this.engine = e, this.clearHeightMeasure = new Ba(e), this.distanceMeasure = new za(e), this.clearDistanceMeasure = new Ra(e), this.elevationMeasure = new Oa(e), this.pointMeasure = new Fa(e), this.angleMeasure = new Na(e), this.areaMeasure = new Ha(e), this.slopeMeasure = new Mt(e), this.faceDistanceMeasure = new Va(e), this.tools = new Ve(e), this.annotationContainer = document.createElement("div"), this.annotationContainer.className = "annotation-container", e.container.appendChild(this.annotationContainer);
|
|
9465
9483
|
}
|
|
9466
9484
|
setContextMenuDisabled(e) {
|
|
9467
9485
|
this.engine?.engineStatus != null && (this.engine.engineStatus.isDisableContextMenu = e);
|
|
@@ -9834,7 +9852,7 @@ class Ga {
|
|
|
9834
9852
|
return;
|
|
9835
9853
|
const n = new ot();
|
|
9836
9854
|
n.name = `SectionBoxTransformAnchor_${e}`, n.visible = this.isActive, this.engine.scene.add(n);
|
|
9837
|
-
const s = new
|
|
9855
|
+
const s = new Kt(i, t);
|
|
9838
9856
|
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(
|
|
9839
9857
|
this.transformHandleColor,
|
|
9840
9858
|
this.transformHandleColor,
|
|
@@ -9983,7 +10001,7 @@ class Ga {
|
|
|
9983
10001
|
t[3].y,
|
|
9984
10002
|
t[3].z
|
|
9985
10003
|
]), c = [0, 2, 1, 0, 3, 2];
|
|
9986
|
-
r.setAttribute("position", new
|
|
10004
|
+
r.setAttribute("position", new bt(l, 3)), r.setIndex(c);
|
|
9987
10005
|
let d = this.meshs.find((p) => p.name === n);
|
|
9988
10006
|
if (d == null) {
|
|
9989
10007
|
const p = new ce({
|
|
@@ -10019,9 +10037,9 @@ class Ga {
|
|
|
10019
10037
|
t[0].y,
|
|
10020
10038
|
t[0].z
|
|
10021
10039
|
]), g = new He({ color: 255 }), m = new ue();
|
|
10022
|
-
m.setAttribute("position", new
|
|
10040
|
+
m.setAttribute("position", new bt(u, 3));
|
|
10023
10041
|
let f = this.meshs.find((p) => p.name === n + "Line");
|
|
10024
|
-
f == null ? (f = new
|
|
10042
|
+
f == null ? (f = new St(m, g), f.name = n + "Line", e.add(f), this.meshs.push(f)) : (f.geometry = m, f.material = g);
|
|
10025
10043
|
const w = new h();
|
|
10026
10044
|
t.forEach((p) => w.add(p)), w.multiplyScalar(1 / t.length), this.updateFaceTransformControl(n, i, w, s);
|
|
10027
10045
|
const b = this.engine.sectionPlane.find((p) => p.name == n);
|
|
@@ -10251,8 +10269,8 @@ class Wa {
|
|
|
10251
10269
|
const D = I.clone().sub(r), R = D.dot(l), k = D.dot(c);
|
|
10252
10270
|
m = Math.min(m, R), f = Math.max(f, R), w = Math.min(w, k), b = Math.max(b, k);
|
|
10253
10271
|
}), m -= g, f += g, w -= g, b += g;
|
|
10254
|
-
const p = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(w)), x = r.clone().add(l.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(w)), C = r.clone().add(l.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(b)),
|
|
10255
|
-
this.current_center = r.clone(), this.createFace(i, [p, x, C,
|
|
10272
|
+
const p = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(w)), x = r.clone().add(l.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(w)), C = r.clone().add(l.clone().multiplyScalar(f)).add(c.clone().multiplyScalar(b)), A = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(b));
|
|
10273
|
+
this.current_center = r.clone(), this.createFace(i, [p, x, C, A], n, "face"), this.updateTransformControl(s), this.updateRotateControl(s);
|
|
10256
10274
|
}
|
|
10257
10275
|
createFace(e, t, i, n) {
|
|
10258
10276
|
const s = new ue(), o = new Float32Array([
|
|
@@ -10269,7 +10287,7 @@ class Wa {
|
|
|
10269
10287
|
t[3].y,
|
|
10270
10288
|
t[3].z
|
|
10271
10289
|
]), r = this.getEffectiveNormal(i), l = this.getDirectionSign() === 1 ? [0, 1, 2, 0, 2, 3] : [0, 2, 1, 0, 3, 2];
|
|
10272
|
-
s.setAttribute("position", new
|
|
10290
|
+
s.setAttribute("position", new bt(o, 3)), s.setIndex(l), s.computeVertexNormals();
|
|
10273
10291
|
let c = this.meshs.find((w) => w.name == n);
|
|
10274
10292
|
if (c == null) {
|
|
10275
10293
|
const w = new ce({
|
|
@@ -10299,9 +10317,9 @@ class Wa {
|
|
|
10299
10317
|
t[0].y,
|
|
10300
10318
|
t[0].z
|
|
10301
10319
|
]), u = new He({ color: 255 }), g = new ue();
|
|
10302
|
-
g.setAttribute("position", new
|
|
10320
|
+
g.setAttribute("position", new bt(d, 3));
|
|
10303
10321
|
let m = this.meshs.find((w) => w.name == n + "Line");
|
|
10304
|
-
m == null ? (m = new
|
|
10322
|
+
m == null ? (m = new St(g, u), m.name = n + "Line", e.add(m), this.meshs.push(m)) : (m.geometry = g, m.material = u);
|
|
10305
10323
|
const f = this.engine.sectionPlane.find((w) => w.name == n);
|
|
10306
10324
|
f && this.current_center && f.setFromNormalAndCoplanarPoint(
|
|
10307
10325
|
r,
|
|
@@ -10435,7 +10453,7 @@ class Wa {
|
|
|
10435
10453
|
return;
|
|
10436
10454
|
const i = new ot();
|
|
10437
10455
|
i.name = "SectionFaceTransformAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
10438
|
-
const n = new
|
|
10456
|
+
const n = new Kt(t, e);
|
|
10439
10457
|
n.name = "SectionFaceTransformControl", n.setMode("translate"), n.setSpace("local"), n.showX = !0, n.showY = !1, n.showZ = !1, n.size = this.transformHandleSize, n.setColors(
|
|
10440
10458
|
this.transformHandleColor,
|
|
10441
10459
|
this.transformHandleColor,
|
|
@@ -10455,7 +10473,7 @@ class Wa {
|
|
|
10455
10473
|
return;
|
|
10456
10474
|
const i = new ot();
|
|
10457
10475
|
i.name = "SectionFaceRotateAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
10458
|
-
const n = new
|
|
10476
|
+
const n = new Kt(t, e);
|
|
10459
10477
|
n.name = "SectionFaceRotateControl", n.setMode("rotate"), n.setSpace("local"), n.showX = !0, n.showY = !0, n.showZ = !1, n.size = this.rotateHandleSize, n.setColors(
|
|
10460
10478
|
this.transformHandleColor,
|
|
10461
10479
|
this.transformHandleColor,
|
|
@@ -10638,7 +10656,7 @@ class qa {
|
|
|
10638
10656
|
constructor(e) {
|
|
10639
10657
|
this.engine = e, this.evaluator = new Hs();
|
|
10640
10658
|
const t = J("/texture/fill.png", import.meta.url), i = new Ke().load(t);
|
|
10641
|
-
i.wrapS = st, i.wrapT = st, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new
|
|
10659
|
+
i.wrapS = st, i.wrapT = st, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new Ei({
|
|
10642
10660
|
color: 14079687,
|
|
10643
10661
|
map: i,
|
|
10644
10662
|
side: oe,
|
|
@@ -10714,7 +10732,7 @@ class qa {
|
|
|
10714
10732
|
}
|
|
10715
10733
|
if (c.geometry.dispose(), d.length === 0)
|
|
10716
10734
|
return;
|
|
10717
|
-
const u =
|
|
10735
|
+
const u = wt(d, !1);
|
|
10718
10736
|
if (d.forEach((w) => w.dispose()), !u)
|
|
10719
10737
|
return;
|
|
10720
10738
|
this.applyPlanarUv(u, e);
|
|
@@ -10839,7 +10857,7 @@ class qa {
|
|
|
10839
10857
|
* - 平移到 plane 上
|
|
10840
10858
|
*/
|
|
10841
10859
|
createPlaneBrush(e, t, i) {
|
|
10842
|
-
const n = new
|
|
10860
|
+
const n = new Ut(t, t, i), s = e.coplanarPoint(new h()), o = new Le().setFromUnitVectors(
|
|
10843
10861
|
new h(0, 0, 1),
|
|
10844
10862
|
e.normal.clone().normalize()
|
|
10845
10863
|
), r = new H().compose(s, o, new h(1, 1, 1));
|
|
@@ -10870,7 +10888,7 @@ class qa {
|
|
|
10870
10888
|
const i = t.getAttribute("position");
|
|
10871
10889
|
if (i && !t.getAttribute("uv")) {
|
|
10872
10890
|
const s = new Float32Array(i.count * 2);
|
|
10873
|
-
t.setAttribute("uv", new
|
|
10891
|
+
t.setAttribute("uv", new xt(s, 2));
|
|
10874
10892
|
}
|
|
10875
10893
|
const n = /* @__PURE__ */ new Set(["position", "normal", "uv"]);
|
|
10876
10894
|
return Object.keys(t.attributes).forEach((s) => {
|
|
@@ -10892,8 +10910,8 @@ class qa {
|
|
|
10892
10910
|
if (!s || s.count < 3)
|
|
10893
10911
|
return n.dispose(), null;
|
|
10894
10912
|
const o = t.normal.clone().normalize(), r = new h(), l = new h(), c = new h(), d = new h(), u = new h(), g = new h(), m = new h(), f = new h(), w = new h(), b = Math.max(i * 0.35, 1e-4), p = Math.max(i * 0.7, 1e-4), x = [];
|
|
10895
|
-
for (let
|
|
10896
|
-
if (d.fromBufferAttribute(s,
|
|
10913
|
+
for (let A = 0; A < s.count; A += 3) {
|
|
10914
|
+
if (d.fromBufferAttribute(s, A), u.fromBufferAttribute(s, A + 1), g.fromBufferAttribute(s, A + 2), l.subVectors(u, d), c.subVectors(g, d), r.crossVectors(l, c), r.lengthSq() < 1e-14 || (r.normalize(), Math.abs(r.dot(o)) < 0.9))
|
|
10897
10915
|
continue;
|
|
10898
10916
|
const I = t.distanceToPoint(d), D = t.distanceToPoint(u), R = t.distanceToPoint(g), k = Math.min(I, D, R);
|
|
10899
10917
|
if (Math.max(I, D, R) - k > b)
|
|
@@ -10904,7 +10922,7 @@ class qa {
|
|
|
10904
10922
|
if (n.dispose(), x.length < 9)
|
|
10905
10923
|
return null;
|
|
10906
10924
|
const C = new ue();
|
|
10907
|
-
return C.setAttribute("position", new
|
|
10925
|
+
return C.setAttribute("position", new xt(x, 3)), C.computeVertexNormals(), C;
|
|
10908
10926
|
}
|
|
10909
10927
|
applyPlanarUv(e, t) {
|
|
10910
10928
|
const i = e.getAttribute("position");
|
|
@@ -10920,7 +10938,7 @@ class qa {
|
|
|
10920
10938
|
const g = Math.max(c - l, 1e-6), m = Math.max(u - d, 1e-6);
|
|
10921
10939
|
for (let f = 0; f < r.length; f += 2)
|
|
10922
10940
|
r[f] = (r[f] - l) / g * this.fillTextureRepeat, r[f + 1] = (r[f + 1] - d) / m * this.fillTextureRepeat;
|
|
10923
|
-
e.setAttribute("uv", new
|
|
10941
|
+
e.setAttribute("uv", new bt(r, 2));
|
|
10924
10942
|
}
|
|
10925
10943
|
getPlaneBasis(e) {
|
|
10926
10944
|
const t = new h(1, 0, 0), i = new h(0, 1, 0), n = new h(0, 0, 1), s = Math.abs(e.dot(t)), o = Math.abs(e.dot(i)), r = Math.abs(e.dot(n));
|
|
@@ -11259,10 +11277,24 @@ class Qa {
|
|
|
11259
11277
|
i.set(s, n);
|
|
11260
11278
|
});
|
|
11261
11279
|
}
|
|
11280
|
+
// 加载模型属性,并进行回调
|
|
11281
|
+
loadProperties(e, t) {
|
|
11282
|
+
let i = this.engine.engineStatus.models.find((n) => n.url === e);
|
|
11283
|
+
i.properties == null && (gt(this.engine, e, e + "/property"), pt(
|
|
11284
|
+
e + "/property",
|
|
11285
|
+
(n) => {
|
|
11286
|
+
let s = JSON.parse(n);
|
|
11287
|
+
i.properties = s, t();
|
|
11288
|
+
},
|
|
11289
|
+
() => {
|
|
11290
|
+
},
|
|
11291
|
+
i?.key
|
|
11292
|
+
));
|
|
11293
|
+
}
|
|
11262
11294
|
// 通过构件,属性名获取构件属性
|
|
11263
11295
|
getModelPropertiesWithName(e, t, i, n) {
|
|
11264
11296
|
let s = this.extended.get(e), o = this.engine.engineStatus.models.find((l) => l.url === e);
|
|
11265
|
-
o.properties == null ? (
|
|
11297
|
+
o.properties == null ? (gt(this.engine, e, e + "/property"), pt(
|
|
11266
11298
|
e + "/property",
|
|
11267
11299
|
(l) => {
|
|
11268
11300
|
let c = JSON.parse(l);
|
|
@@ -11287,7 +11319,7 @@ class Qa {
|
|
|
11287
11319
|
// 查询构件属性
|
|
11288
11320
|
getModelProperties(e, t, i) {
|
|
11289
11321
|
let n = this.extended.get(e), s = this.engine.engineStatus.models.find((r) => r.url === e);
|
|
11290
|
-
s.properties == null && (
|
|
11322
|
+
return s.properties == null && (gt(this.engine, e, e + "/property"), pt(
|
|
11291
11323
|
e + "/property",
|
|
11292
11324
|
(r) => {
|
|
11293
11325
|
let l = JSON.parse(r);
|
|
@@ -11342,13 +11374,16 @@ class Qa {
|
|
|
11342
11374
|
構造: 9,
|
|
11343
11375
|
分析性質: 10
|
|
11344
11376
|
};
|
|
11345
|
-
d.sort((f, w) => {
|
|
11377
|
+
return d.sort((f, w) => {
|
|
11346
11378
|
const b = m[f.name] ?? 99;
|
|
11347
11379
|
return (m[w.name] ?? 99) - b;
|
|
11348
11380
|
}), c?.({
|
|
11349
11381
|
properties: d,
|
|
11350
11382
|
materials: d
|
|
11351
|
-
})
|
|
11383
|
+
}), {
|
|
11384
|
+
properties: d,
|
|
11385
|
+
materials: d
|
|
11386
|
+
};
|
|
11352
11387
|
}
|
|
11353
11388
|
}
|
|
11354
11389
|
}
|
|
@@ -11840,8 +11875,8 @@ class nl {
|
|
|
11840
11875
|
if (t.length === 0)
|
|
11841
11876
|
return;
|
|
11842
11877
|
const o = new ue();
|
|
11843
|
-
o.setAttribute("position", new
|
|
11844
|
-
const r = new
|
|
11878
|
+
o.setAttribute("position", new xt(t, 3)), o.computeBoundingSphere();
|
|
11879
|
+
const r = new Wt(o, i);
|
|
11845
11880
|
r.name = `nodeBox:${n}`, r.frustumCulled = !1, r.userData.kind = n, r.userData.url = e, this.setLineTransform(r, s), this.rootGroup.add(r);
|
|
11846
11881
|
}
|
|
11847
11882
|
appendBoxPositions(e, t, i) {
|
|
@@ -12175,7 +12210,7 @@ class ol {
|
|
|
12175
12210
|
init() {
|
|
12176
12211
|
this.miniMapContainer = document.createElement("div"), this.miniMapContainer.style.position = "absolute", this.applyContainerPosition(), this.miniMapContainer.style.width = `${this.currentMapWidth}px`, this.miniMapContainer.style.height = `${this.currentMapHeight}px`, this.miniMapContainer.style.border = "2px solid rgba(255, 255, 255, 0.4)", this.miniMapContainer.style.borderRadius = "4px", this.miniMapContainer.style.overflow = "hidden", this.miniMapContainer.style.display = "none", this.miniMapContainer.style.pointerEvents = "auto", this.miniMapContainer.style.touchAction = "none", this.miniMapContainer.style.cursor = "crosshair", this.engine.container.appendChild(this.miniMapContainer), this.miniMapRenderer = new bi({ alpha: !0, antialias: !1 }), this.miniMapRenderer.setSize(this.currentMapWidth, this.currentMapHeight), this.miniMapRenderer.setPixelRatio(window.devicePixelRatio), this.miniMapRenderer.setClearColor(1710638, 0.85), this.miniMapContainer.appendChild(this.miniMapRenderer.domElement);
|
|
12177
12212
|
const e = window.devicePixelRatio || 1;
|
|
12178
|
-
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new
|
|
12213
|
+
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new Se(
|
|
12179
12214
|
-this.currentHalfSize,
|
|
12180
12215
|
this.currentHalfSize,
|
|
12181
12216
|
this.currentHalfSize,
|
|
@@ -12767,7 +12802,7 @@ class rl {
|
|
|
12767
12802
|
const r = t ? this.toVector3(t) : i.clone().add(n), l = this.buildSafeUpDirection(n, s, o.up);
|
|
12768
12803
|
o.position.copy(i), o.up.copy(l), o.lookAt(r), o.updateMatrix(), o.updateMatrixWorld(!0);
|
|
12769
12804
|
const c = {
|
|
12770
|
-
type: this.engine.cameraModule?.getCameraType?.() ??
|
|
12805
|
+
type: this.engine.cameraModule?.getCameraType?.() ?? Ot.PERSPECTIVE,
|
|
12771
12806
|
position: this.getPoint(i),
|
|
12772
12807
|
rotation: {
|
|
12773
12808
|
x: o.rotation.x,
|
|
@@ -12782,7 +12817,7 @@ class rl {
|
|
|
12782
12817
|
},
|
|
12783
12818
|
target: this.getPoint(r)
|
|
12784
12819
|
};
|
|
12785
|
-
o instanceof
|
|
12820
|
+
o instanceof Se && (c.zoom = o.zoom, c.orthographicHeight = this.engine.cameraModule.getOrthographicVisibleHeight(o)), this.restoreCameraPose(c), this.syncOrbitOrigin(c.target);
|
|
12786
12821
|
}
|
|
12787
12822
|
zoomToIssueModel(e, t) {
|
|
12788
12823
|
const i = this.resolveModelBox(e);
|
|
@@ -12830,7 +12865,7 @@ class rl {
|
|
|
12830
12865
|
if (!e || !e.position)
|
|
12831
12866
|
return null;
|
|
12832
12867
|
const i = this.engine.camera, n = {
|
|
12833
|
-
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ??
|
|
12868
|
+
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ?? Ot.PERSPECTIVE,
|
|
12834
12869
|
position: e.position,
|
|
12835
12870
|
rotation: e.rotation ?? { x: 0, y: 0, z: 0 },
|
|
12836
12871
|
quaternion: e.quaternion ?? { x: 0, y: 0, z: 0, w: 1 },
|
|
@@ -12843,7 +12878,7 @@ class rl {
|
|
|
12843
12878
|
y: 0,
|
|
12844
12879
|
z: 0,
|
|
12845
12880
|
w: 1
|
|
12846
|
-
}), i instanceof
|
|
12881
|
+
}), i instanceof Se && n.type === Ot.ORTHOGRAPHIC && (n.zoom = e.zoom ?? i.zoom, n.orthographicHeight = e.orthographicHeight ?? this.engine.cameraModule.getOrthographicVisibleHeight(i)), n;
|
|
12847
12882
|
}
|
|
12848
12883
|
buildSafeUpDirection(e, t, i) {
|
|
12849
12884
|
const n = t.lengthSq() > 0 ? t.clone() : i.clone().normalize();
|
|
@@ -13443,16 +13478,16 @@ class yl {
|
|
|
13443
13478
|
};
|
|
13444
13479
|
}
|
|
13445
13480
|
}
|
|
13446
|
-
const
|
|
13481
|
+
const kt = {
|
|
13447
13482
|
ceilingPlan: "天花平面",
|
|
13448
13483
|
floorPlan: "楼层平面",
|
|
13449
13484
|
elevation: "立面视图",
|
|
13450
13485
|
section: "剖面视图"
|
|
13451
13486
|
}, Ml = {
|
|
13452
|
-
ceilingPlan: [
|
|
13453
|
-
floorPlan: [
|
|
13454
|
-
elevation: [
|
|
13455
|
-
section: [
|
|
13487
|
+
ceilingPlan: [kt.ceilingPlan, "天花"],
|
|
13488
|
+
floorPlan: [kt.floorPlan, "楼层"],
|
|
13489
|
+
elevation: [kt.elevation, "立面"],
|
|
13490
|
+
section: [kt.section, "剖面"]
|
|
13456
13491
|
};
|
|
13457
13492
|
class vl {
|
|
13458
13493
|
engine;
|
|
@@ -13524,7 +13559,7 @@ class vl {
|
|
|
13524
13559
|
...i.DynamicViews ?? [],
|
|
13525
13560
|
...i.FloorPlans ?? [],
|
|
13526
13561
|
...i.Sections ?? []
|
|
13527
|
-
].find((
|
|
13562
|
+
].find((A) => A.id === t || A.Id === t);
|
|
13528
13563
|
if (!s)
|
|
13529
13564
|
return;
|
|
13530
13565
|
let o = { X: 0, Y: 0, Z: 0 }, r = 1, l = 1, c = null;
|
|
@@ -13535,11 +13570,11 @@ class vl {
|
|
|
13535
13570
|
o = { X: 0, Y: 0, Z: s.Evevation }, r = -1, l = -1, c = new h(0, 0, -1);
|
|
13536
13571
|
else if (d === "elevation") {
|
|
13537
13572
|
o = s.Origin || s.origin, l = 1;
|
|
13538
|
-
const
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
-(
|
|
13573
|
+
const A = s.UpDirection || s.upDirection;
|
|
13574
|
+
A && (c = new h(
|
|
13575
|
+
A.X ?? A.x ?? 0,
|
|
13576
|
+
A.Z ?? A.z ?? 0,
|
|
13577
|
+
-(A.Y ?? A.y ?? 0)
|
|
13543
13578
|
).normalize());
|
|
13544
13579
|
} else d === "section" && (o = s.Origin || s.origin, r = -1, l = -1);
|
|
13545
13580
|
const u = s.ViewDirection || s.viewDirection;
|
|
@@ -13560,7 +13595,7 @@ class vl {
|
|
|
13560
13595
|
if (s.disableClipping === !0)
|
|
13561
13596
|
this.engine.clipping?.disActive?.();
|
|
13562
13597
|
else {
|
|
13563
|
-
const
|
|
13598
|
+
const A = s.ViewRange || s.viewRange, I = this.createViewRangePlanes(A, g);
|
|
13564
13599
|
if (I ? this.engine.clipping.setSectionPlanesByViewRange(I) : this.engine.clipping.setSectionByView(g, p), !C && this.engine.camera.type !== "OrthographicCamera" && this.engine.cameraModule.switchToOrthographicCamera(), C)
|
|
13565
13600
|
return;
|
|
13566
13601
|
s.focusBox instanceof F && !s.focusBox.isEmpty() ? this.engine.viewCube?.zoomToModel?.(s.focusBox) : I && this.zoomToCurrentViewRange();
|
|
@@ -13695,8 +13730,8 @@ function Al(a, e, t) {
|
|
|
13695
13730
|
if (!i || !n || !s)
|
|
13696
13731
|
return null;
|
|
13697
13732
|
const o = new Ln(e, t, {
|
|
13698
|
-
minFilter:
|
|
13699
|
-
magFilter:
|
|
13733
|
+
minFilter: Ht,
|
|
13734
|
+
magFilter: Ht,
|
|
13700
13735
|
format: kn,
|
|
13701
13736
|
depthBuffer: !0,
|
|
13702
13737
|
stencilBuffer: !0
|
|
@@ -13704,14 +13739,14 @@ function Al(a, e, t) {
|
|
|
13704
13739
|
try {
|
|
13705
13740
|
i.xr && (i.xr.enabled = !1), i.autoClear = !0, i.setRenderTarget(o), i.clear(!0, !0, !0), i.render(n, s);
|
|
13706
13741
|
const d = new Uint8Array(e * t * 4);
|
|
13707
|
-
return i.readRenderTargetPixels(o, 0, 0, e, t, d),
|
|
13742
|
+
return i.readRenderTargetPixels(o, 0, 0, e, t, d), Sl(d, e, t);
|
|
13708
13743
|
} catch {
|
|
13709
13744
|
return null;
|
|
13710
13745
|
} finally {
|
|
13711
13746
|
i.setRenderTarget(r), i.autoClear = l, i.xr && (i.xr.enabled = c), o.dispose();
|
|
13712
13747
|
}
|
|
13713
13748
|
}
|
|
13714
|
-
function
|
|
13749
|
+
function Sl(a, e, t) {
|
|
13715
13750
|
const i = document.createElement("canvas");
|
|
13716
13751
|
i.width = e, i.height = t;
|
|
13717
13752
|
const n = i.getContext("2d");
|
|
@@ -13725,7 +13760,7 @@ function El(a, e, t) {
|
|
|
13725
13760
|
}
|
|
13726
13761
|
return n.putImageData(s, 0, 0), i;
|
|
13727
13762
|
}
|
|
13728
|
-
const
|
|
13763
|
+
const El = [
|
|
13729
13764
|
"#ffffff",
|
|
13730
13765
|
"#000000",
|
|
13731
13766
|
"#ff4d4f",
|
|
@@ -13786,7 +13821,7 @@ class zl {
|
|
|
13786
13821
|
this.updateColorControl(this.colorInput.value), this.handlers.onColorChange(this.colorInput.value), this.setColorPresetVisible(!1);
|
|
13787
13822
|
}, s.appendChild(this.colorInput), this.colorPresetPanel = document.createElement("div"), this.colorPresetPanel.style.position = "absolute", this.colorPresetPanel.style.top = "30px", this.colorPresetPanel.style.left = "0", this.colorPresetPanel.style.display = "none", this.colorPresetPanel.style.padding = "8px", this.colorPresetPanel.style.background = "#ffffff", this.colorPresetPanel.style.border = "1px solid #d9d9d9", this.colorPresetPanel.style.borderRadius = "6px", this.colorPresetPanel.style.boxShadow = "0 6px 18px rgba(0, 0, 0, 0.14)", this.colorPresetPanel.style.zIndex = "20", this.colorPresetPanel.style.width = "152px";
|
|
13788
13823
|
const r = document.createElement("div");
|
|
13789
|
-
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px",
|
|
13824
|
+
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px", El.forEach((f) => {
|
|
13790
13825
|
const w = document.createElement("button");
|
|
13791
13826
|
w.type = "button", w.title = f, w.style.width = "22px", w.style.height = "22px", w.style.padding = "0", w.style.border = "1px solid #d9d9d9", w.style.borderRadius = "4px", w.style.background = f, w.style.cursor = "pointer", w.onclick = () => {
|
|
13792
13827
|
this.updateColorControl(f), this.handlers.onColorChange(f), this.setColorPresetVisible(!1);
|
|
@@ -14321,7 +14356,7 @@ class Rl {
|
|
|
14321
14356
|
});
|
|
14322
14357
|
return G.annotationType = "arrow", G;
|
|
14323
14358
|
}
|
|
14324
|
-
const l = s / r, c = o / r, d = -c, u = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, f = t.x - l * g, w = t.y - c * g, b = f + d * (m * 0.5), p = w + u * (m * 0.5), x = f - d * (m * 0.5), C = w - u * (m * 0.5),
|
|
14359
|
+
const l = s / r, c = o / r, d = -c, u = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, f = t.x - l * g, w = t.y - c * g, b = f + d * (m * 0.5), p = w + u * (m * 0.5), x = f - d * (m * 0.5), C = w - u * (m * 0.5), A = new Jt([e.x, e.y, t.x, t.y], {
|
|
14325
14360
|
stroke: i.stroke,
|
|
14326
14361
|
strokeWidth: i.strokeWidth,
|
|
14327
14362
|
fill: "",
|
|
@@ -14335,7 +14370,7 @@ class Rl {
|
|
|
14335
14370
|
selectable: !1,
|
|
14336
14371
|
evented: !1,
|
|
14337
14372
|
objectCaching: !1
|
|
14338
|
-
}), R = new Ui([
|
|
14373
|
+
}), R = new Ui([A, D], {
|
|
14339
14374
|
selectable: n,
|
|
14340
14375
|
evented: n,
|
|
14341
14376
|
objectCaching: !1
|
|
@@ -14386,7 +14421,7 @@ class Rl {
|
|
|
14386
14421
|
continue;
|
|
14387
14422
|
const m = -u / g, f = d / g, w = Math.max(1, Math.round(g / n));
|
|
14388
14423
|
for (let b = 1; b <= w; b++) {
|
|
14389
|
-
const p = b / w, x = l.x + d * p, C = l.y + u * p,
|
|
14424
|
+
const p = b / w, x = l.x + d * p, C = l.y + u * p, A = o % 2 === 0 ? -1 : 1, I = x + m * i * A, D = C + f * i * A;
|
|
14390
14425
|
s += ` Q ${I} ${D} ${x} ${C}`, o++;
|
|
14391
14426
|
}
|
|
14392
14427
|
}
|
|
@@ -15430,13 +15465,13 @@ class Hl {
|
|
|
15430
15465
|
return e = this.engine.clipping?.filterIntersectionsByClipping?.(e) ?? e, e.filter((i) => i?.point instanceof h).sort((i, n) => i.distance - n.distance)[0] ?? null;
|
|
15431
15466
|
}
|
|
15432
15467
|
}
|
|
15433
|
-
function
|
|
15468
|
+
function Nt(a) {
|
|
15434
15469
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
15435
15470
|
}
|
|
15436
15471
|
function Ae(a) {
|
|
15437
15472
|
return new h(a.x, a.y, a.z);
|
|
15438
15473
|
}
|
|
15439
|
-
function
|
|
15474
|
+
function Bt(a) {
|
|
15440
15475
|
const e = new h();
|
|
15441
15476
|
return a.length === 0 ? e : (a.forEach((t) => e.add(Ae(t))), e.multiplyScalar(1 / a.length));
|
|
15442
15477
|
}
|
|
@@ -15463,7 +15498,7 @@ function An(a) {
|
|
|
15463
15498
|
localPoints: r
|
|
15464
15499
|
};
|
|
15465
15500
|
}
|
|
15466
|
-
function
|
|
15501
|
+
function Sn(a) {
|
|
15467
15502
|
const e = new Bn();
|
|
15468
15503
|
return a.forEach((t, i) => {
|
|
15469
15504
|
if (i === 0) {
|
|
@@ -15531,7 +15566,7 @@ class ql {
|
|
|
15531
15566
|
depthWrite: !1
|
|
15532
15567
|
});
|
|
15533
15568
|
r.clippingPlanes = this.engine.sectionPlane;
|
|
15534
|
-
const l = new
|
|
15569
|
+
const l = new Gt(r);
|
|
15535
15570
|
l.center.set(0.5, 0.1), e.instance.root.add(l), e.iconSprite = l;
|
|
15536
15571
|
}
|
|
15537
15572
|
if ((s.size ?? 0) > 0) {
|
|
@@ -15611,7 +15646,7 @@ class ql {
|
|
|
15611
15646
|
}
|
|
15612
15647
|
/** 任意平面多边形先投影到局部二维,再恢复到原始空间。 */
|
|
15613
15648
|
buildPolygon(e) {
|
|
15614
|
-
const t = An(e.instance.points), i =
|
|
15649
|
+
const t = An(e.instance.points), i = Sn(t.localPoints), n = new js(i);
|
|
15615
15650
|
n.computeBoundingBox();
|
|
15616
15651
|
const s = n.boundingBox ?? new F(new h(0, 0, 0), new h(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
15617
15652
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
@@ -15634,7 +15669,7 @@ class ql {
|
|
|
15634
15669
|
}
|
|
15635
15670
|
/** 拉伸体支持围栏类视觉效果,并记录法线供面板挂到顶部。 */
|
|
15636
15671
|
buildExtrudePolygon(e) {
|
|
15637
|
-
const t = An(e.instance.points), i =
|
|
15672
|
+
const t = An(e.instance.points), i = Sn(t.localPoints), n = e.instance.style.volume?.height ?? 10, s = new zn(i, {
|
|
15638
15673
|
depth: n,
|
|
15639
15674
|
bevelEnabled: !1,
|
|
15640
15675
|
steps: 1,
|
|
@@ -15662,7 +15697,7 @@ class ql {
|
|
|
15662
15697
|
buildBox(e) {
|
|
15663
15698
|
if (e.instance.points.length < 2)
|
|
15664
15699
|
return;
|
|
15665
|
-
const t = Ae(e.instance.points[0]), i = Ae(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), l = new
|
|
15700
|
+
const t = Ae(e.instance.points[0]), i = Ae(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), l = new Ut(o.x || 0.1, o.y || 0.1, o.z || 0.1);
|
|
15666
15701
|
l.computeBoundingBox();
|
|
15667
15702
|
const c = l.boundingBox ?? new F(
|
|
15668
15703
|
new h(-0.5, -0.5, -0.5),
|
|
@@ -15684,7 +15719,7 @@ class ql {
|
|
|
15684
15719
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1
|
|
15685
15720
|
});
|
|
15686
15721
|
g.clippingPlanes = this.engine.sectionPlane;
|
|
15687
|
-
const m = new
|
|
15722
|
+
const m = new Wt(new Ys(l), g);
|
|
15688
15723
|
m.position.copy(r), e.instance.root.add(m), e.volumeHeight = o.y, e.animatedMaterials.push(d);
|
|
15689
15724
|
}
|
|
15690
15725
|
/** 多层轮廓线常用于电子围栏、扫描墙这类有高度层次感的体标记。 */
|
|
@@ -15755,10 +15790,10 @@ class jl {
|
|
|
15755
15790
|
const s = new h();
|
|
15756
15791
|
t.getWorldPosition(s);
|
|
15757
15792
|
let o = 1;
|
|
15758
|
-
if (this.engine.camera instanceof
|
|
15793
|
+
if (this.engine.camera instanceof vt) {
|
|
15759
15794
|
const r = this.engine.camera.position.distanceTo(s), l = O.degToRad(this.engine.camera.fov);
|
|
15760
15795
|
o = 2 * Math.tan(l * 0.5) * r / Math.max(n.clientHeight, 1) * i;
|
|
15761
|
-
} else this.engine.camera instanceof
|
|
15796
|
+
} else this.engine.camera instanceof Se && (o = Math.abs(this.engine.camera.top - this.engine.camera.bottom) / Math.max(this.engine.camera.zoom, 1e-6) / Math.max(n.clientHeight, 1) * i);
|
|
15762
15797
|
t.scale.set(o, o, 1);
|
|
15763
15798
|
}
|
|
15764
15799
|
}
|
|
@@ -15969,7 +16004,7 @@ class $l {
|
|
|
15969
16004
|
return {
|
|
15970
16005
|
...e,
|
|
15971
16006
|
id: e.id ?? `annotation3d-${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
15972
|
-
points:
|
|
16007
|
+
points: Nt(e.points ?? []),
|
|
15973
16008
|
visible: e.visible ?? !0,
|
|
15974
16009
|
selectable: e.selectable ?? !0,
|
|
15975
16010
|
style: this.mergeStyle(e.style),
|
|
@@ -15991,7 +16026,7 @@ class $l {
|
|
|
15991
16026
|
return this.normalizeData({
|
|
15992
16027
|
id: n,
|
|
15993
16028
|
type: i.type ?? e.type,
|
|
15994
|
-
points: i.points ?
|
|
16029
|
+
points: i.points ? Nt(i.points) : Nt(e.points),
|
|
15995
16030
|
visible: i.visible ?? e.visible,
|
|
15996
16031
|
selectable: i.selectable ?? e.selectable,
|
|
15997
16032
|
style: {
|
|
@@ -16200,12 +16235,12 @@ class Jl {
|
|
|
16200
16235
|
if (e.instance.type === "point")
|
|
16201
16236
|
n.copy(Ae(e.instance.points[0])), t === "top" && (n.y += e.volumeHeight ?? e.instance.style.point?.anchorY ?? 0);
|
|
16202
16237
|
else if (e.instance.type === "polyline")
|
|
16203
|
-
t === "start" ? n.copy(Ae(e.instance.points[0])) : t === "end" ? n.copy(Ae(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(
|
|
16238
|
+
t === "start" ? n.copy(Ae(e.instance.points[0])) : t === "end" ? n.copy(Ae(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(Bt(e.instance.points));
|
|
16204
16239
|
else if (e.instance.type === "polygon")
|
|
16205
|
-
n.copy(
|
|
16240
|
+
n.copy(Bt(e.instance.points));
|
|
16206
16241
|
else if (e.instance.type === "extrudePolygon")
|
|
16207
|
-
n.copy(
|
|
16208
|
-
else if (e.instance.type === "box" && (n.copy(
|
|
16242
|
+
n.copy(Bt(e.instance.points)), t === "top" && e.anchorNormal && n.add(e.anchorNormal.clone().multiplyScalar(e.volumeHeight ?? 0));
|
|
16243
|
+
else if (e.instance.type === "box" && (n.copy(Bt(e.instance.points)), t === "top" && e.instance.points.length >= 2)) {
|
|
16209
16244
|
const s = Ae(e.instance.points[0]), o = Ae(e.instance.points[1]);
|
|
16210
16245
|
n.y = Math.max(s.y, o.y);
|
|
16211
16246
|
}
|
|
@@ -16335,16 +16370,16 @@ function ic(a) {
|
|
|
16335
16370
|
return {
|
|
16336
16371
|
id: a.instance.id,
|
|
16337
16372
|
type: a.instance.type,
|
|
16338
|
-
points:
|
|
16373
|
+
points: Nt(a.instance.points),
|
|
16339
16374
|
visible: a.instance.visible,
|
|
16340
16375
|
selectable: a.instance.selectable,
|
|
16341
|
-
style:
|
|
16342
|
-
effect:
|
|
16343
|
-
panel: a.instance.panel ?
|
|
16344
|
-
data:
|
|
16376
|
+
style: zt(a.instance.style),
|
|
16377
|
+
effect: zt(a.instance.effect),
|
|
16378
|
+
panel: a.instance.panel ? zt(a.instance.panel) : void 0,
|
|
16379
|
+
data: zt(a.instance.data)
|
|
16345
16380
|
};
|
|
16346
16381
|
}
|
|
16347
|
-
function
|
|
16382
|
+
function zt(a) {
|
|
16348
16383
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
16349
16384
|
}
|
|
16350
16385
|
class nc {
|
|
@@ -16866,7 +16901,7 @@ class it {
|
|
|
16866
16901
|
const sc = 1e-3, oc = 0.65, rc = 1;
|
|
16867
16902
|
class ac {
|
|
16868
16903
|
engine;
|
|
16869
|
-
loader = new
|
|
16904
|
+
loader = new Si();
|
|
16870
16905
|
modelList = /* @__PURE__ */ new Map();
|
|
16871
16906
|
modelTransforms = [];
|
|
16872
16907
|
transformControl = null;
|
|
@@ -17067,7 +17102,7 @@ class ac {
|
|
|
17067
17102
|
this.syncTransformControlCamera();
|
|
17068
17103
|
return;
|
|
17069
17104
|
}
|
|
17070
|
-
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new
|
|
17105
|
+
!this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new Kt(this.engine.camera, this.engine.renderer.domElement), this.transformControl.addEventListener("dragging-changed", (e) => {
|
|
17071
17106
|
this.engine.controls && (this.engine.controls.enabled = !e.value), e.value ? this.saveHistory() : this.syncSelectedTransform();
|
|
17072
17107
|
}), this.transformControl.addEventListener("objectChange", () => this.requestRender()), this.transformHelper = this.transformControl.getHelper(), this.transformHelper.visible = !1, this.engine.scene.add(this.transformHelper), this.syncTransformControlCamera());
|
|
17073
17108
|
}
|
|
@@ -17703,7 +17738,7 @@ class lc {
|
|
|
17703
17738
|
});
|
|
17704
17739
|
}
|
|
17705
17740
|
}
|
|
17706
|
-
const
|
|
17741
|
+
const En = "__modelExplodeProxy", Pn = new H().makeScale(0, 0, 0);
|
|
17707
17742
|
class cc {
|
|
17708
17743
|
engine;
|
|
17709
17744
|
/** 当前是否处于炸开模式;供外部滑块、交互模块判断是否需要走代理逻辑。 */
|
|
@@ -17833,7 +17868,7 @@ class cc {
|
|
|
17833
17868
|
* 从命中的代理对象还原真实构件 ID,避免 Object3D.name 字符串化造成 nodesMap 查询失败。
|
|
17834
17869
|
*/
|
|
17835
17870
|
getObjectComponentId(e) {
|
|
17836
|
-
return e?.userData?.[
|
|
17871
|
+
return e?.userData?.[En] === !0 ? e.userData.componentId : null;
|
|
17837
17872
|
}
|
|
17838
17873
|
/**
|
|
17839
17874
|
* 返回炸开后用于悬浮高亮的代理网格。
|
|
@@ -17987,7 +18022,7 @@ class cc {
|
|
|
17987
18022
|
}
|
|
17988
18023
|
/** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
|
|
17989
18024
|
assignProxyIdentity(e, t, i) {
|
|
17990
|
-
e.url = t, e.name = String(i), e.userData[
|
|
18025
|
+
e.url = t, e.name = String(i), e.userData[En] = !0, e.userData.componentId = i, e.userData.url = t;
|
|
17991
18026
|
}
|
|
17992
18027
|
/**
|
|
17993
18028
|
* 隐藏源渲染片段,避免与代理对象重复显示。
|
|
@@ -18256,7 +18291,7 @@ class hc {
|
|
|
18256
18291
|
}), Array.from(t.values());
|
|
18257
18292
|
}
|
|
18258
18293
|
collectFromScene() {
|
|
18259
|
-
const e = /* @__PURE__ */ new Map(), t =
|
|
18294
|
+
const e = /* @__PURE__ */ new Map(), t = Ct(this.engine, (i) => this.getObjectMaterials(i).length > 0);
|
|
18260
18295
|
return t.forEach((i) => {
|
|
18261
18296
|
this.getObjectMaterials(i).forEach((n) => this.mergeMaterialOption(e, n, [i]));
|
|
18262
18297
|
}), t.length === 0 && this.engine.scene?.traverse?.((i) => {
|
|
@@ -18382,7 +18417,7 @@ function ys(a, e, t) {
|
|
|
18382
18417
|
}
|
|
18383
18418
|
(e in i || e in a) && (i[e] = t);
|
|
18384
18419
|
}
|
|
18385
|
-
function
|
|
18420
|
+
function Rt(a) {
|
|
18386
18421
|
const e = a;
|
|
18387
18422
|
return {
|
|
18388
18423
|
id: a.uuid,
|
|
@@ -18722,19 +18757,19 @@ class mc {
|
|
|
18722
18757
|
}
|
|
18723
18758
|
/** 只读取目标对象材质,不改变当前 UI 选择。 */
|
|
18724
18759
|
getMaterialsByObject(e) {
|
|
18725
|
-
return this.collector.collectFromObject(e).map((t) =>
|
|
18760
|
+
return this.collector.collectFromObject(e).map((t) => Rt(t.material));
|
|
18726
18761
|
}
|
|
18727
18762
|
/** 只读取指定构件材质,不改变当前 UI 选择。 */
|
|
18728
18763
|
getMaterialsByTarget(e) {
|
|
18729
|
-
return this.collector.collectFromTarget(e).map((t) =>
|
|
18764
|
+
return this.collector.collectFromTarget(e).map((t) => Rt(t.material));
|
|
18730
18765
|
}
|
|
18731
18766
|
/** 读取当前场景中所有可编辑材质。 */
|
|
18732
18767
|
getAllSceneMaterials() {
|
|
18733
|
-
return this.collectSceneMaterials().map((e) =>
|
|
18768
|
+
return this.collectSceneMaterials().map((e) => Rt(e.material));
|
|
18734
18769
|
}
|
|
18735
18770
|
/** 返回当前选择对象上可编辑的材质信息。 */
|
|
18736
18771
|
getSelectedMaterials() {
|
|
18737
|
-
return this.selectedMaterials.map((e) =>
|
|
18772
|
+
return this.selectedMaterials.map((e) => Rt(e.material));
|
|
18738
18773
|
}
|
|
18739
18774
|
/** 返回全场景相对快照发生变化的材质信息。 */
|
|
18740
18775
|
getModifiedMaterials() {
|
|
@@ -18848,7 +18883,156 @@ class mc {
|
|
|
18848
18883
|
this.ownedTextures.forEach((e) => e.dispose()), this.ownedTextures.clear();
|
|
18849
18884
|
}
|
|
18850
18885
|
}
|
|
18851
|
-
class
|
|
18886
|
+
class fc {
|
|
18887
|
+
engine;
|
|
18888
|
+
codeMap = [];
|
|
18889
|
+
continusIds = /* @__PURE__ */ new Map();
|
|
18890
|
+
constructor(e) {
|
|
18891
|
+
this.engine = e;
|
|
18892
|
+
}
|
|
18893
|
+
// 预构建编码到构件的映射,便于反向检索模型
|
|
18894
|
+
loadNodeMap(e) {
|
|
18895
|
+
const t = this.engine?.engineStatus?.models?.find((c) => c.url === e.url), i = this.engine?.models?.find((c) => c.url === e.url), n = t?.properties?.models;
|
|
18896
|
+
if (n == null || typeof n != "object")
|
|
18897
|
+
return;
|
|
18898
|
+
const s = t?.properties?.categorys ?? {}, o = t?.properties?.names ?? {}, r = t?.properties?.values ?? {}, l = Array.isArray(i?.quotaList) ? i.quotaList : [];
|
|
18899
|
+
String(e?.name ?? t?.name ?? ""), Object.keys(n).forEach((c) => {
|
|
18900
|
+
const d = Number(c);
|
|
18901
|
+
if (!Number.isFinite(d))
|
|
18902
|
+
return;
|
|
18903
|
+
(Array.isArray(n[c]) ? n[c] : []).forEach((g) => {
|
|
18904
|
+
if (!Array.isArray(g) || g.length < 3)
|
|
18905
|
+
return;
|
|
18906
|
+
const m = String(s[g[0]] ?? ""), f = String(o[g[1]] ?? ""), w = String(r[g[2]] ?? "");
|
|
18907
|
+
if (m !== "基础信息" || f !== "解单信息")
|
|
18908
|
+
return;
|
|
18909
|
+
let b = [];
|
|
18910
|
+
try {
|
|
18911
|
+
const p = JSON.parse(w);
|
|
18912
|
+
b = Array.isArray(p) ? p : [];
|
|
18913
|
+
} catch {
|
|
18914
|
+
b = [];
|
|
18915
|
+
}
|
|
18916
|
+
b.forEach((p) => {
|
|
18917
|
+
const x = String(p?.code ?? "").trim();
|
|
18918
|
+
if (x.length !== 0) {
|
|
18919
|
+
if (x.length > 12) {
|
|
18920
|
+
const C = l.find((A) => x.includes(String(A?.id ?? "")));
|
|
18921
|
+
if (C == null)
|
|
18922
|
+
return;
|
|
18923
|
+
this.setelementInfo(e.url, d, {
|
|
18924
|
+
...p,
|
|
18925
|
+
code: String(C?.code ?? "").trim(),
|
|
18926
|
+
name: String(C?.name ?? "").trim()
|
|
18927
|
+
});
|
|
18928
|
+
return;
|
|
18929
|
+
}
|
|
18930
|
+
x.length > 2 && this.setelementInfo(e.url, d, {
|
|
18931
|
+
...p,
|
|
18932
|
+
code: x
|
|
18933
|
+
});
|
|
18934
|
+
}
|
|
18935
|
+
});
|
|
18936
|
+
});
|
|
18937
|
+
});
|
|
18938
|
+
}
|
|
18939
|
+
// 通过 code 反查模型,返回构件明细列表
|
|
18940
|
+
seachModels(e) {
|
|
18941
|
+
if (!Array.isArray(e) || e.length === 0)
|
|
18942
|
+
return [];
|
|
18943
|
+
const t = new Set(
|
|
18944
|
+
e.map((s) => String(s ?? "").trim()).filter((s) => s.length > 0)
|
|
18945
|
+
);
|
|
18946
|
+
if (t.size === 0)
|
|
18947
|
+
return [];
|
|
18948
|
+
const i = [], n = /* @__PURE__ */ new Set();
|
|
18949
|
+
return this.continusIds.forEach((s, o) => {
|
|
18950
|
+
if (!(s instanceof Map))
|
|
18951
|
+
return;
|
|
18952
|
+
const r = this.engine?.models?.find((l) => l?.url === o);
|
|
18953
|
+
s.forEach((l, c) => {
|
|
18954
|
+
if (!Array.isArray(l) || l.length === 0 || !l.some((g) => {
|
|
18955
|
+
const m = String(g?.code ?? "").trim(), f = String(g?.name ?? "").trim();
|
|
18956
|
+
return t.has(m) || t.has(f);
|
|
18957
|
+
}))
|
|
18958
|
+
return;
|
|
18959
|
+
const u = `${o}|${c}`;
|
|
18960
|
+
n.has(u) || (n.add(u), i.push({
|
|
18961
|
+
id: Number(c),
|
|
18962
|
+
name: String(r?.nodesMap?.get(Number(c))?.name ?? r?.nodesMap?.get(String(c))?.name ?? ""),
|
|
18963
|
+
url: o,
|
|
18964
|
+
attibute: l
|
|
18965
|
+
}));
|
|
18966
|
+
});
|
|
18967
|
+
}), i;
|
|
18968
|
+
}
|
|
18969
|
+
// 添加构件id
|
|
18970
|
+
setelementInfo(e, t, i) {
|
|
18971
|
+
this.continusIds.has(e) || this.continusIds.set(e, /* @__PURE__ */ new Map());
|
|
18972
|
+
const n = this.continusIds.get(e);
|
|
18973
|
+
n != null && (n.has(t) || n.set(t, []), n.get(t)?.push(i));
|
|
18974
|
+
}
|
|
18975
|
+
}
|
|
18976
|
+
class yc {
|
|
18977
|
+
engine;
|
|
18978
|
+
continusIds = /* @__PURE__ */ new Map();
|
|
18979
|
+
constructor(e) {
|
|
18980
|
+
this.engine = e;
|
|
18981
|
+
}
|
|
18982
|
+
/**
|
|
18983
|
+
* 基于已加载的属性数据构建当前模型的过滤 id 集合。
|
|
18984
|
+
* 默认不过滤,业务侧只需要把 shouldFilterId 换成真实规则即可。
|
|
18985
|
+
*/
|
|
18986
|
+
buildContinueIds(e) {
|
|
18987
|
+
const i = this.engine?.engineStatus?.models?.find((s) => s.url === e)?.properties?.models;
|
|
18988
|
+
if (i == null || typeof i != "object") {
|
|
18989
|
+
this.continusIds.set(e, /* @__PURE__ */ new Set());
|
|
18990
|
+
return;
|
|
18991
|
+
}
|
|
18992
|
+
const n = /* @__PURE__ */ new Set();
|
|
18993
|
+
Object.keys(i).forEach((s) => {
|
|
18994
|
+
const o = Number(s);
|
|
18995
|
+
Number.isFinite(o) && this.shouldFilterId(e, s, i[s]) && n.add(o);
|
|
18996
|
+
}), this.continusIds.set(e, n);
|
|
18997
|
+
}
|
|
18998
|
+
setContinueIds(e, t) {
|
|
18999
|
+
const i = /* @__PURE__ */ new Set();
|
|
19000
|
+
t.forEach((n) => {
|
|
19001
|
+
const s = Number(n);
|
|
19002
|
+
Number.isFinite(s) && i.add(s);
|
|
19003
|
+
}), this.continusIds.set(e, i);
|
|
19004
|
+
}
|
|
19005
|
+
getContinueIds(e) {
|
|
19006
|
+
return Array.from(this.continusIds.get(e) ?? []);
|
|
19007
|
+
}
|
|
19008
|
+
getContinueIdSet(e) {
|
|
19009
|
+
return this.continusIds.get(e) ?? /* @__PURE__ */ new Set();
|
|
19010
|
+
}
|
|
19011
|
+
hasContinueId(e, t) {
|
|
19012
|
+
const i = Number(t);
|
|
19013
|
+
return Number.isFinite(i) ? this.getContinueIdSet(e).has(i) : !1;
|
|
19014
|
+
}
|
|
19015
|
+
clear(e) {
|
|
19016
|
+
if (typeof e == "string") {
|
|
19017
|
+
this.continusIds.delete(e);
|
|
19018
|
+
return;
|
|
19019
|
+
}
|
|
19020
|
+
this.continusIds.clear();
|
|
19021
|
+
}
|
|
19022
|
+
shouldFilterId(e, t, i) {
|
|
19023
|
+
const s = this.engine?.engineStatus?.models?.find((d) => d.url === e)?.properties, o = Array.isArray(i) ? i : s?.models?.[t];
|
|
19024
|
+
if (s == null || !Array.isArray(o) || o.length === 0)
|
|
19025
|
+
return !1;
|
|
19026
|
+
const r = s.categorys ?? {}, l = s.names ?? {}, c = s.values ?? {};
|
|
19027
|
+
return o.some((d) => {
|
|
19028
|
+
if (!Array.isArray(d) || d.length < 3)
|
|
19029
|
+
return !1;
|
|
19030
|
+
const u = String(r[d[0]] ?? ""), g = String(l[d[1]] ?? ""), m = String(c[d[2]] ?? "");
|
|
19031
|
+
return u.includes("图层信息") && g.includes("父类别") && (m.includes("注释") || m.includes("视口范围") || m.includes("剖面"));
|
|
19032
|
+
});
|
|
19033
|
+
}
|
|
19034
|
+
}
|
|
19035
|
+
class bc {
|
|
18852
19036
|
// 引擎参数
|
|
18853
19037
|
options;
|
|
18854
19038
|
deviceType;
|
|
@@ -18957,6 +19141,8 @@ class wc {
|
|
|
18957
19141
|
modelExplode;
|
|
18958
19142
|
/** 材质编辑器,提供 DOM 面板、材质修改记录读取和一键还原能力。 */
|
|
18959
19143
|
materialTool;
|
|
19144
|
+
rxQuotaListMapper;
|
|
19145
|
+
filterLoaderModel;
|
|
18960
19146
|
// 业务数据
|
|
18961
19147
|
models = [];
|
|
18962
19148
|
reactBoundingClientRect = { left: 0, top: 0 };
|
|
@@ -18967,7 +19153,7 @@ class wc {
|
|
|
18967
19153
|
constructor(e) {
|
|
18968
19154
|
if (window.THREE = _n, Ro(), this.options = e, this.container = document.getElementById(e.containerId), !this.container)
|
|
18969
19155
|
throw new Error(`Container ${e.containerId} not found`);
|
|
18970
|
-
if (this.engineModelModule = new ra(this), this.engineModelModule.init(), this.deviceModule = new po(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new re(this), this.sceneModule = new uo(this), this.scene = this.sceneModule.scene, this.renderModule = new go(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.orthographicCamera, this.scene.camera = this.camera, this.renderer) {
|
|
19156
|
+
if (this.rxQuotaListMapper = new fc(this), this.filterLoaderModel = new yc(this), this.engineModelModule = new ra(this), this.engineModelModule.init(), this.deviceModule = new po(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new re(this), this.sceneModule = new uo(this), this.scene = this.sceneModule.scene, this.renderModule = new go(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.orthographicCamera, this.scene.camera = this.camera, this.renderer) {
|
|
18971
19157
|
const o = this.renderer;
|
|
18972
19158
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
18973
19159
|
}
|
|
@@ -19255,7 +19441,7 @@ class wc {
|
|
|
19255
19441
|
if (!e) return;
|
|
19256
19442
|
[...e.children].forEach((i) => {
|
|
19257
19443
|
this.clearScene(i);
|
|
19258
|
-
}), e.parent && e.parent.remove(e), e instanceof N && !(e instanceof U) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof
|
|
19444
|
+
}), e.parent && e.parent.remove(e), e instanceof N && !(e instanceof U) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof St && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof Js && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof U && (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 Gt && e.material && this.disposeMaterial(e.material), e instanceof eo && e.shadow?.dispose?.();
|
|
19259
19445
|
}
|
|
19260
19446
|
/**
|
|
19261
19447
|
* 清理材质及其纹理
|
|
@@ -19310,6 +19496,6 @@ class wc {
|
|
|
19310
19496
|
}
|
|
19311
19497
|
}
|
|
19312
19498
|
export {
|
|
19313
|
-
|
|
19499
|
+
bc as E,
|
|
19314
19500
|
mc as M
|
|
19315
19501
|
};
|