iflow-engine-base-3d 3.11.4 → 3.11.5
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,25 +1,25 @@
|
|
|
1
|
-
import { S as ni, G as
|
|
2
|
-
import { W as oe, C as _s, L as
|
|
3
|
-
import { r as
|
|
4
|
-
import { a as gn, J as Yt, c as ks, b as zs, P as
|
|
1
|
+
import { S as ni, G as he, P as st, O as ve, M as R, V as h, T as tn, C as jn, W as si, a as Kn, b as Ke, N as oi, c as Yn, d as Ue, e as H, Q as De, E as nn, R as ae, f as sn, g as on, B as Y, h as ri, A as Xn, i as G, j as O, I as X, k as kt, l as zt, m as rn, n as an, L as xt, o as $n, p as Zn, q as Jn, r as yi, s as vi, t as Qn, F as es, u as Fe, v as ln, w as cn, x as ai, D as ge, y as ts, z as hn, H as Me, J as is, K as ot, U as ns, X as ss, Y as os, Z as rs, _ as Ie, $ as bt, a0 as un, a1 as Z, a2 as me, a3 as as, a4 as Je, a5 as Oe, a6 as ls, a7 as Ct, a8 as St, a9 as ke, aa as at, ab as cs, ac as dn, ad as qt, ae as Et, af as hs, ag as je, ah as us, ai as ds, aj as pn, ak as mn, al as Pt, am as jt, an as ps, ao as Mi, ap as Kt, aq as At, ar as rt, as as ms, at as gs, au as wi, av as fs, aw as xi, ax as ys, ay as vs, az as Ms, aA as ws, aB as xs, aC as bs, aD as Cs, aE as Ss, aF as Es, aG as Ps, aH as As, aI as bi } from "./three-vendor-ox3_iXFc.js";
|
|
2
|
+
import { W as oe, C as _s, L as _t, B as Ci, g as Ae, a as Ts, E as Ds, r as Ls } from "./sdk-runtime-B5mYNige.js";
|
|
3
|
+
import { r as W, g as Is } from "./sdk-assets-BbXNfc5u.js";
|
|
4
|
+
import { a as gn, J as Yt, c as ks, b as zs, P as Bt, q as Bs, k as Rs, n as Si, E as Ei, S as Fs } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
5
|
class Os {
|
|
6
6
|
engine;
|
|
7
7
|
scene;
|
|
8
8
|
constructor(e) {
|
|
9
9
|
this.engine = e, this.scene = new ni();
|
|
10
|
-
let t = new
|
|
10
|
+
let t = new he();
|
|
11
11
|
t.name = "groupEdge", this.scene.add(t);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
var
|
|
15
|
-
class
|
|
14
|
+
var Mt = /* @__PURE__ */ ((a) => (a.PERSPECTIVE = "perspective", a.ORTHOGRAPHIC = "orthographic", a))(Mt || {});
|
|
15
|
+
class ce {
|
|
16
16
|
static MIN_VISIBLE_HEIGHT = 1e-4;
|
|
17
17
|
static MIN_CAMERA_DISTANCE = 1e-4;
|
|
18
18
|
engine;
|
|
19
19
|
perspectiveCamera;
|
|
20
20
|
orthographicCamera;
|
|
21
21
|
constructor(e) {
|
|
22
|
-
this.engine = e, this.perspectiveCamera = new
|
|
22
|
+
this.engine = e, this.perspectiveCamera = new st(
|
|
23
23
|
60,
|
|
24
24
|
this.engine.container.clientWidth / this.engine.container.clientHeight,
|
|
25
25
|
0.1,
|
|
@@ -42,30 +42,30 @@ class le {
|
|
|
42
42
|
getPerspectiveVisibleHeight(e, t) {
|
|
43
43
|
const i = Math.max(
|
|
44
44
|
e.position.distanceTo(t),
|
|
45
|
-
|
|
45
|
+
ce.MIN_CAMERA_DISTANCE
|
|
46
46
|
), n = R.degToRad(e.getEffectiveFOV() * 0.5);
|
|
47
47
|
return Math.max(
|
|
48
48
|
2 * i * Math.tan(n),
|
|
49
|
-
|
|
49
|
+
ce.MIN_VISIBLE_HEIGHT
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
getOrthographicVisibleHeight(e = this.orthographicCamera) {
|
|
53
53
|
return Math.max(
|
|
54
54
|
(e.top - e.bottom) / e.zoom,
|
|
55
|
-
|
|
55
|
+
ce.MIN_VISIBLE_HEIGHT
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
setOrthographicVisibleHeight(e, t = this.orthographicCamera, i) {
|
|
59
|
-
const n = Math.max(e,
|
|
59
|
+
const n = Math.max(e, ce.MIN_VISIBLE_HEIGHT), s = Number.isFinite(i) && i > 0 ? i : this.getCameraAspect(), o = Math.max(t.zoom || 1, ce.MIN_CAMERA_DISTANCE), r = n * o * 0.5, l = r * s;
|
|
60
60
|
t.left = -l, t.right = l, t.top = r, t.bottom = -r;
|
|
61
61
|
}
|
|
62
62
|
getViewDirection(e, t, i) {
|
|
63
63
|
const n = new h().subVectors(e, t);
|
|
64
|
-
return n.lengthSq() >
|
|
64
|
+
return n.lengthSq() > ce.MIN_CAMERA_DISTANCE ? n.normalize() : new h(0, 0, 1).applyQuaternion(i).normalize();
|
|
65
65
|
}
|
|
66
66
|
getStableCameraUp(e) {
|
|
67
67
|
const t = e.clone().normalize();
|
|
68
|
-
if (t.lengthSq() <=
|
|
68
|
+
if (t.lengthSq() <= ce.MIN_CAMERA_DISTANCE)
|
|
69
69
|
return new h(0, 1, 0);
|
|
70
70
|
const i = [
|
|
71
71
|
new h(0, 1, 0),
|
|
@@ -74,7 +74,7 @@ class le {
|
|
|
74
74
|
];
|
|
75
75
|
for (const n of i) {
|
|
76
76
|
const s = n.clone().sub(t.clone().multiplyScalar(n.dot(t)));
|
|
77
|
-
if (s.lengthSq() >
|
|
77
|
+
if (s.lengthSq() > ce.MIN_CAMERA_DISTANCE)
|
|
78
78
|
return s.normalize();
|
|
79
79
|
}
|
|
80
80
|
return new h(0, 1, 0);
|
|
@@ -104,10 +104,10 @@ class le {
|
|
|
104
104
|
}
|
|
105
105
|
inferTargetFromRestoredCamera(e) {
|
|
106
106
|
const t = new h();
|
|
107
|
-
e.getWorldDirection(t), t.lengthSq() <=
|
|
107
|
+
e.getWorldDirection(t), t.lengthSq() <= ce.MIN_CAMERA_DISTANCE && t.set(0, 0, -1);
|
|
108
108
|
const n = this.engine.controls?.target?.distanceTo?.(e.position), s = this.engine.octreeBox?.getBoundingBox?.(), o = s?.min && s?.max ? s.max.distanceTo(s.min) * 0.8 : 0;
|
|
109
109
|
let r = 10;
|
|
110
|
-
return typeof n == "number" && Number.isFinite(n) && n >
|
|
110
|
+
return typeof n == "number" && Number.isFinite(n) && n > ce.MIN_CAMERA_DISTANCE ? r = n : o > ce.MIN_CAMERA_DISTANCE && (r = o), e.position.clone().add(t.normalize().multiplyScalar(r));
|
|
111
111
|
}
|
|
112
112
|
switchCurrentCamera() {
|
|
113
113
|
this.engine.camera === this.perspectiveCamera ? this.switchToOrthographicCamera() : this.switchToPerspectiveCamera();
|
|
@@ -132,7 +132,7 @@ class le {
|
|
|
132
132
|
return;
|
|
133
133
|
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 ve ? this.getOrthographicVisibleHeight(e) : this.getPerspectiveVisibleHeight(e, i), c = R.degToRad(o.getEffectiveFOV() * 0.5), u = Math.max(
|
|
134
134
|
l / (2 * Math.tan(c)),
|
|
135
|
-
|
|
135
|
+
ce.MIN_CAMERA_DISTANCE
|
|
136
136
|
);
|
|
137
137
|
o.near = e.near, o.far = e.far, o.aspect = this.getCameraAspect(), o.up.copy(s), o.position.copy(i).add(r.multiplyScalar(u)), o.lookAt(i), this.engine.camera = o, this.applySwitchedCamera(o, i);
|
|
138
138
|
}
|
|
@@ -143,12 +143,12 @@ class le {
|
|
|
143
143
|
const e = this.engine.camera;
|
|
144
144
|
if (!e)
|
|
145
145
|
return;
|
|
146
|
-
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
|
|
146
|
+
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 st ? this.getPerspectiveVisibleHeight(e, i) : this.getOrthographicVisibleHeight(e), c = R.degToRad(e.getEffectiveFOV() * 0.5), u = Math.max(
|
|
147
147
|
l / (2 * Math.tan(c)),
|
|
148
|
-
|
|
148
|
+
ce.MIN_CAMERA_DISTANCE
|
|
149
149
|
);
|
|
150
150
|
o.near = e.near, o.far = e.far, o.zoom = 1, this.setOrthographicVisibleHeight(l, o), o.up.copy(s);
|
|
151
|
-
const d = this.engine.octreeBox?.getBoundingBox?.(), g = d ? d.max.distanceTo(d.min) * 0.8 : u, m = Math.max(g,
|
|
151
|
+
const d = this.engine.octreeBox?.getBoundingBox?.(), g = d ? d.max.distanceTo(d.min) * 0.8 : u, m = Math.max(g, ce.MIN_CAMERA_DISTANCE);
|
|
152
152
|
o.position.copy(i).add(r.clone().multiplyScalar(m)), o.quaternion.copy(n), this.engine.camera = o, this.applySwitchedCamera(o, i);
|
|
153
153
|
}
|
|
154
154
|
getCameraType() {
|
|
@@ -286,13 +286,13 @@ class Ns {
|
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const li = 1.1;
|
|
290
290
|
class Hs {
|
|
291
291
|
engine;
|
|
292
292
|
renderer;
|
|
293
293
|
watermark;
|
|
294
294
|
constructor(e) {
|
|
295
|
-
this.engine = e, this.renderer = null, this.watermark = new _s(
|
|
295
|
+
this.engine = e, this.renderer = null, this.watermark = new _s(tn);
|
|
296
296
|
}
|
|
297
297
|
createRenderer() {
|
|
298
298
|
const { width: e, height: t } = this.engine.deviceModule.getContainerSize();
|
|
@@ -304,7 +304,7 @@ class Hs {
|
|
|
304
304
|
stencil: !0,
|
|
305
305
|
// 移动端放大镜需要从当前画布直接取样,保留 drawing buffer 避免读到黑屏。
|
|
306
306
|
preserveDrawingBuffer: !0
|
|
307
|
-
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = Kn, this.renderer.localClippingEnabled = !0, this.renderer.outputColorSpace =
|
|
307
|
+
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = Kn, this.renderer.localClippingEnabled = !0, this.renderer.outputColorSpace = Ke, this.renderer.toneMapping = oi, this.renderer.toneMappingExposure = li, this.engine.container.appendChild(this.renderer.domElement), this.renderer;
|
|
308
308
|
}
|
|
309
309
|
disposeRenderer() {
|
|
310
310
|
this.watermark.dispose(), this.renderer?.dispose();
|
|
@@ -316,14 +316,14 @@ class Hs {
|
|
|
316
316
|
this.renderer && this.watermark.render(this.renderer);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
const Vs = { type: "change" },
|
|
319
|
+
const Vs = { type: "change" }, Pi = { type: "start" }, Ai = { type: "end" }, K = 1e-6, Rt = Math.PI * 2, ie = {
|
|
320
320
|
NONE: -1,
|
|
321
321
|
ROTATE: 0,
|
|
322
322
|
PAN: 1,
|
|
323
323
|
DOLLY: 2,
|
|
324
324
|
TOUCH_ROTATE: 3,
|
|
325
325
|
TOUCH_DOLLY_PAN: 4
|
|
326
|
-
},
|
|
326
|
+
}, Ft = new h(1, 0, 0), Us = new h(0, 1, 0), Gs = new h(0, 0, 1), Ge = new h(), pt = new h(), pe = new h(), j = new h(), xe = new h(), se = new h(), be = new h(), Ws = new h(), mt = new De(), Ot = new De(), _i = /* @__PURE__ */ new Set([
|
|
327
327
|
"KeyW",
|
|
328
328
|
"KeyA",
|
|
329
329
|
"KeyS",
|
|
@@ -337,19 +337,19 @@ const Vs = { type: "change" }, Ei = { type: "start" }, Pi = { type: "end" }, K =
|
|
|
337
337
|
"ShiftLeft",
|
|
338
338
|
"ShiftRight"
|
|
339
339
|
]);
|
|
340
|
-
function
|
|
340
|
+
function gt(a, e, t) {
|
|
341
341
|
return Math.max(e, Math.min(t, a));
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Ti(a) {
|
|
344
344
|
return {
|
|
345
345
|
width: Math.max(a?.clientWidth || 1, 1),
|
|
346
346
|
height: Math.max(a?.clientHeight || 1, 1)
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function We(a) {
|
|
350
350
|
return a && typeof a.x == "number" && typeof a.y == "number" && typeof a.z == "number";
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Di(a) {
|
|
353
353
|
const e = a?.tagName?.toLowerCase?.();
|
|
354
354
|
return a?.isContentEditable === !0 || e === "input" || e === "textarea" || e === "select";
|
|
355
355
|
}
|
|
@@ -361,10 +361,10 @@ class fn extends Yn {
|
|
|
361
361
|
RIGHT: "ArrowRight",
|
|
362
362
|
BOTTOM: "ArrowDown"
|
|
363
363
|
}, this.mouseButtons = {
|
|
364
|
-
LEFT:
|
|
365
|
-
MIDDLE:
|
|
366
|
-
RIGHT:
|
|
367
|
-
}, this.state = ie.NONE, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.up0 = this.object.up.clone(), this.origin0 = this.origin.clone(), this._lastZoom = this.object.zoom, this._lastPosition = this.object.position.clone(), this._lastTarget = this.target.clone(), this._lastUp = this.object.up.clone(), this._lastQuaternion = this.object.quaternion.clone(), this._referenceUp = this.object.up.clone().normalize(), this._viewRight = new h(1, 0, 0).applyQuaternion(this.object.quaternion).normalize(), this._rotateVelocity = new
|
|
364
|
+
LEFT: Ue.ROTATE,
|
|
365
|
+
MIDDLE: Ue.DOLLY,
|
|
366
|
+
RIGHT: Ue.PAN
|
|
367
|
+
}, this.state = ie.NONE, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.up0 = this.object.up.clone(), this.origin0 = this.origin.clone(), this._lastZoom = this.object.zoom, this._lastPosition = this.object.position.clone(), this._lastTarget = this.target.clone(), this._lastUp = this.object.up.clone(), this._lastQuaternion = this.object.quaternion.clone(), this._referenceUp = this.object.up.clone().normalize(), this._viewRight = new h(1, 0, 0).applyQuaternion(this.object.quaternion).normalize(), this._rotateVelocity = new H(), this._panVelocity = new H(), this._zoomVelocity = 0, this._mouseStart = new H(), this._touchCenter = new H(), this._touchDistance = 0, this._pointers = /* @__PURE__ */ new Map(), this._pressedKeys = /* @__PURE__ */ new Set(), this._keyboardAnimationId = null, this._lastKeyboardMoveTime = 0, this._isInteracting = !1, this._keyDomElement = null, this._touchAction = "", this._onContextMenu = this._handleContextMenu.bind(this), this._onPointerDown = this._handlePointerDown.bind(this), this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerUp = this._handlePointerUp.bind(this), this._onPointerCancel = this._handlePointerUp.bind(this), this._onWheel = this._handleWheel.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._onKeyUp = this._handleKeyUp.bind(this), this.domElement && this.connect(this.domElement), this.update(), this.saveState();
|
|
368
368
|
}
|
|
369
369
|
connect(e) {
|
|
370
370
|
e && (this.disconnect(), this.domElement = e, this._touchAction = e.style.touchAction, e.style.touchAction = "none", e.addEventListener("contextmenu", this._onContextMenu), e.addEventListener("pointerdown", this._onPointerDown), e.addEventListener("pointermove", this._onPointerMove), e.addEventListener("pointerup", this._onPointerUp), e.addEventListener("pointercancel", this._onPointerCancel), e.addEventListener("wheel", this._onWheel, { passive: !1 }), this.listenToKeyEvents(window));
|
|
@@ -382,18 +382,18 @@ class fn extends Yn {
|
|
|
382
382
|
this._keyDomElement && (this._keyDomElement.removeEventListener("keydown", this._onKeyDown), this._keyDomElement.removeEventListener("keyup", this._onKeyUp), this._keyDomElement = null, this._pressedKeys.clear(), this._stopKeyboardMoveLoop());
|
|
383
383
|
}
|
|
384
384
|
saveState() {
|
|
385
|
-
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom, this.up0.copy(this.object.up),
|
|
385
|
+
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom, this.up0.copy(this.object.up), We(this.origin) && this.origin0.copy(this.origin);
|
|
386
386
|
}
|
|
387
387
|
reset() {
|
|
388
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.up.copy(this.up0),
|
|
388
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.up.copy(this.up0), We(this.origin) && this.origin.copy(this.origin0), this._rotateVelocity.set(0, 0), this._panVelocity.set(0, 0), this._zoomVelocity = 0, this.object.updateProjectionMatrix?.(), this.update(!0), this.state = ie.NONE;
|
|
389
389
|
}
|
|
390
390
|
setScreenUp(e) {
|
|
391
|
-
return !
|
|
391
|
+
return !We(e) || (se.copy(this.target).sub(this.object.position), se.lengthSq() < K) || (se.normalize(), xe.copy(e).normalize(), j.crossVectors(se, xe), j.lengthSq() < K) ? !1 : (this._viewRight.copy(j.normalize()), this.update(!0), !0);
|
|
392
392
|
}
|
|
393
393
|
syncStateFromCamera(e = this.object, t = this.target, i = {}) {
|
|
394
394
|
if (!e)
|
|
395
395
|
return !1;
|
|
396
|
-
this.object = e,
|
|
396
|
+
this.object = e, We(t) && this.target.copy(t), i.origin === "target" ? this.origin.copy(this.target) : We(i.origin) && this.origin.copy(i.origin);
|
|
397
397
|
const n = this.target.clone().sub(e.position), s = e.up.clone().normalize();
|
|
398
398
|
return s.lengthSq() > K && this._referenceUp.copy(s), n.lengthSq() > K && (n.normalize(), j.crossVectors(n, this._referenceUp), j.lengthSq() > K ? this._viewRight.copy(j.normalize()) : this._viewRight.set(1, 0, 0).applyQuaternion(e.quaternion).normalize()), this._rotateVelocity.set(0, 0), this._panVelocity.set(0, 0), this._zoomVelocity = 0, this._mouseStart.set(0, 0), this._touchCenter.set(0, 0), this._touchDistance = 0, this._pointers.clear(), this._pressedKeys.clear(), this._isInteracting = !1, this.state = ie.NONE, this._lastPosition.copy(e.position), this._lastTarget.copy(this.target), this._lastUp.copy(e.up), this._lastQuaternion.copy(e.quaternion), this._lastZoom = e.zoom, this.saveState(), !0;
|
|
399
399
|
}
|
|
@@ -414,7 +414,7 @@ class fn extends Yn {
|
|
|
414
414
|
return Math.abs(s) > K && this.enableZoom && (this._applyZoom(s), t = !0), t;
|
|
415
415
|
}
|
|
416
416
|
_applyKeyboardMove(e) {
|
|
417
|
-
if (!this.enabled || !this.object?.isPerspectiveCamera || this._pressedKeys.size === 0 || (be.set(0, 0, 0), (this._pressedKeys.has("KeyW") || this._pressedKeys.has("ArrowUp")) && (be.z += 1), (this._pressedKeys.has("KeyS") || this._pressedKeys.has("ArrowDown")) && (be.z -= 1), (this._pressedKeys.has("KeyA") || this._pressedKeys.has("ArrowLeft")) && (be.x -= 1), (this._pressedKeys.has("KeyD") || this._pressedKeys.has("ArrowRight")) && (be.x += 1), this._pressedKeys.has("KeyQ") && (be.y += 1), this._pressedKeys.has("KeyE") && (be.y -= 1), be.lengthSq() <= K) || (be.normalize(), j.copy(
|
|
417
|
+
if (!this.enabled || !this.object?.isPerspectiveCamera || this._pressedKeys.size === 0 || (be.set(0, 0, 0), (this._pressedKeys.has("KeyW") || this._pressedKeys.has("ArrowUp")) && (be.z += 1), (this._pressedKeys.has("KeyS") || this._pressedKeys.has("ArrowDown")) && (be.z -= 1), (this._pressedKeys.has("KeyA") || this._pressedKeys.has("ArrowLeft")) && (be.x -= 1), (this._pressedKeys.has("KeyD") || this._pressedKeys.has("ArrowRight")) && (be.x += 1), this._pressedKeys.has("KeyQ") && (be.y += 1), this._pressedKeys.has("KeyE") && (be.y -= 1), be.lengthSq() <= K) || (be.normalize(), j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(), se.set(0, 0, -1).applyQuaternion(this.object.quaternion).normalize(), xe.copy(this._referenceUp).normalize(), xe.lengthSq() <= K && xe.copy(this.object.up).normalize(), pe.set(0, 0, 0), pe.addScaledVector(j, be.x), pe.addScaledVector(se, be.z), pe.addScaledVector(xe, be.y), pe.lengthSq() <= K))
|
|
418
418
|
return !1;
|
|
419
419
|
pe.normalize();
|
|
420
420
|
const t = Number.isFinite(e) && e > 0 ? e : 1 / 60, i = Math.max(this.object.position.distanceTo(this.target), 1), n = this._pressedKeys.has("ShiftLeft") || this._pressedKeys.has("ShiftRight") ? this.keyMoveBoost : 1, s = Math.max(i * 0.8, 1) * this.keyMoveSpeed * t * n;
|
|
@@ -442,7 +442,7 @@ class fn extends Yn {
|
|
|
442
442
|
const n = e.clone();
|
|
443
443
|
return e.set(0, 0), n;
|
|
444
444
|
}
|
|
445
|
-
const t =
|
|
445
|
+
const t = gt(this.dampingFactor, 0, 1), i = e.clone().multiplyScalar(t);
|
|
446
446
|
return e.sub(i), e.lengthSq() < K && e.set(0, 0), i;
|
|
447
447
|
}
|
|
448
448
|
_consumeNumber(e) {
|
|
@@ -450,16 +450,16 @@ class fn extends Yn {
|
|
|
450
450
|
const n = this[e];
|
|
451
451
|
return this[e] = 0, n;
|
|
452
452
|
}
|
|
453
|
-
const t =
|
|
453
|
+
const t = gt(this.dampingFactor, 0, 1), i = this[e] * t;
|
|
454
454
|
return this[e] -= i, Math.abs(this[e]) < K && (this[e] = 0), i;
|
|
455
455
|
}
|
|
456
456
|
_applyRotation(e, t) {
|
|
457
457
|
const i = this._getRotatePivot(), n = this.object.position;
|
|
458
|
-
|
|
458
|
+
Ge.copy(n).sub(i), Ge.lengthSq() < K && Ge.set(0, 0, Math.max(this.minDistance, 1)), pt.copy(this.target).sub(i), se.copy(this.target).sub(n).normalize(), Math.abs(e) > K && (mt.setFromAxisAngle(this._referenceUp, -e), Ge.applyQuaternion(mt), pt.applyQuaternion(mt), se.applyQuaternion(mt).normalize()), j.copy(this._getStableRightAxis(se)), Math.abs(t) > K && j.lengthSq() > K && (Ot.setFromAxisAngle(j, -t), Ge.applyQuaternion(Ot), pt.applyQuaternion(Ot)), n.copy(i).add(Ge), this.target.copy(i).add(pt);
|
|
459
459
|
}
|
|
460
460
|
_applyPan(e, t) {
|
|
461
|
-
const { width: i, height: n } =
|
|
462
|
-
j.copy(
|
|
461
|
+
const { width: i, height: n } = Ti(this.domElement);
|
|
462
|
+
j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(), xe.copy(Us).applyQuaternion(this.object.quaternion).normalize();
|
|
463
463
|
let s = 0, o = 0;
|
|
464
464
|
if (this.object.isPerspectiveCamera) {
|
|
465
465
|
const l = 2 * Math.max(this.object.position.distanceTo(this.target), K) * Math.tan(R.degToRad(this.object.getEffectiveFOV() * 0.5)), c = l * this.object.aspect;
|
|
@@ -475,20 +475,20 @@ class fn extends Yn {
|
|
|
475
475
|
const t = Math.pow(0.95, this.zoomSpeed * e);
|
|
476
476
|
if (this.object.isPerspectiveCamera) {
|
|
477
477
|
se.copy(this.object.position).sub(this.target);
|
|
478
|
-
const i = Math.max(se.length(), K), n =
|
|
478
|
+
const i = Math.max(se.length(), K), n = gt(i / t, this.minDistance, this.maxDistance);
|
|
479
479
|
se.setLength(n), this.object.position.copy(this.target).add(se);
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
|
-
this.object.isOrthographicCamera && (this.object.zoom =
|
|
482
|
+
this.object.isOrthographicCamera && (this.object.zoom = gt(this.object.zoom * t, this.minZoom, this.maxZoom), this.object.updateProjectionMatrix());
|
|
483
483
|
}
|
|
484
484
|
_alignCamera() {
|
|
485
485
|
se.copy(this.target).sub(this.object.position), !(se.lengthSq() < K) && (se.normalize(), j.copy(this._getStableRightAxis(se)), xe.crossVectors(j, se).normalize(), xe.lengthSq() < K && xe.copy(this._referenceUp), this._viewRight.copy(j), this.object.up.copy(xe), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
486
486
|
}
|
|
487
487
|
_getStableRightAxis(e) {
|
|
488
|
-
return j.crossVectors(e, this._referenceUp), j.lengthSq() < K && (j.copy(this._viewRight), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < K && (j.copy(
|
|
488
|
+
return j.crossVectors(e, this._referenceUp), j.lengthSq() < K && (j.copy(this._viewRight), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < K && (j.copy(Ft), j.addScaledVector(e, -j.dot(e))), j.lengthSq() < K && (j.copy(Gs), j.addScaledVector(e, -j.dot(e))), j.normalize(), this._viewRight.lengthSq() > K && j.dot(this._viewRight) < 0 && j.negate(), j;
|
|
489
489
|
}
|
|
490
490
|
_getRotatePivot() {
|
|
491
|
-
return
|
|
491
|
+
return We(this.origin) ? this.origin.distanceToSquared(this.target) < K ? this.target : Ws.copy(this.origin) : this.target;
|
|
492
492
|
}
|
|
493
493
|
_hasCameraStateChanged() {
|
|
494
494
|
const e = this.object.isOrthographicCamera && Math.abs(this.object.zoom - this._lastZoom) > K;
|
|
@@ -498,13 +498,13 @@ class fn extends Yn {
|
|
|
498
498
|
this._lastPosition.copy(this.object.position), this._lastTarget.copy(this.target), this._lastUp.copy(this.object.up), this._lastQuaternion.copy(this.object.quaternion), this._lastZoom = this.object.zoom;
|
|
499
499
|
}
|
|
500
500
|
_getAutoRotateAngle(e) {
|
|
501
|
-
return e != null ?
|
|
501
|
+
return e != null ? Rt / 60 * this.autoRotateSpeed * e : Rt / 3600 * this.autoRotateSpeed;
|
|
502
502
|
}
|
|
503
503
|
_beginInteraction(e) {
|
|
504
|
-
this._isInteracting || (this.dispatchEvent(
|
|
504
|
+
this._isInteracting || (this.dispatchEvent(Pi), this._isInteracting = !0), this.state = e;
|
|
505
505
|
}
|
|
506
506
|
_endInteraction() {
|
|
507
|
-
this._isInteracting && (this._isInteracting = !1, this.state = ie.NONE, this.dispatchEvent(
|
|
507
|
+
this._isInteracting && (this._isInteracting = !1, this.state = ie.NONE, this.dispatchEvent(Ai));
|
|
508
508
|
}
|
|
509
509
|
_handleContextMenu(e) {
|
|
510
510
|
e.preventDefault();
|
|
@@ -547,14 +547,14 @@ class fn extends Yn {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
_handleWheel(e) {
|
|
550
|
-
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(
|
|
550
|
+
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(Pi), this._queueZoom(Math.sign(e.deltaY)), this.update(), this.dispatchEvent(Ai));
|
|
551
551
|
}
|
|
552
552
|
_handleKeyDown(e) {
|
|
553
553
|
if (!this.enabled)
|
|
554
554
|
return;
|
|
555
555
|
const t = e.code || e.key;
|
|
556
|
-
if (this.object?.isPerspectiveCamera &&
|
|
557
|
-
|
|
556
|
+
if (this.object?.isPerspectiveCamera && _i.has(t)) {
|
|
557
|
+
Di(e.target) || (this._pressedKeys.add(t), this._startKeyboardMoveLoop(), e.preventDefault());
|
|
558
558
|
return;
|
|
559
559
|
}
|
|
560
560
|
let i = !1;
|
|
@@ -576,7 +576,7 @@ class fn extends Yn {
|
|
|
576
576
|
}
|
|
577
577
|
_handleKeyUp(e) {
|
|
578
578
|
const t = e.code || e.key;
|
|
579
|
-
|
|
579
|
+
_i.has(t) && (this._pressedKeys.delete(t), this._pressedKeys.size === 0 && this._stopKeyboardMoveLoop(), this.object?.isPerspectiveCamera && !Di(e.target) && e.preventDefault());
|
|
580
580
|
}
|
|
581
581
|
_handleTouchStart() {
|
|
582
582
|
const e = Array.from(this._pointers.values());
|
|
@@ -620,12 +620,12 @@ class fn extends Yn {
|
|
|
620
620
|
}
|
|
621
621
|
_resolveMouseAction(e) {
|
|
622
622
|
let t = null;
|
|
623
|
-
return e.button === 0 ? t = e.ctrlKey || e.metaKey || e.shiftKey ? this.mouseButtons.RIGHT : this.mouseButtons.LEFT : e.button === 1 ? t = this.mouseButtons.MIDDLE : e.button === 2 && (t = this.mouseButtons.RIGHT), t ===
|
|
623
|
+
return e.button === 0 ? t = e.ctrlKey || e.metaKey || e.shiftKey ? this.mouseButtons.RIGHT : this.mouseButtons.LEFT : e.button === 1 ? t = this.mouseButtons.MIDDLE : e.button === 2 && (t = this.mouseButtons.RIGHT), t === Ue.ROTATE && this.enableRotate ? ie.ROTATE : t === Ue.PAN && this.enablePan ? ie.PAN : t === Ue.DOLLY && this.enableZoom ? ie.DOLLY : null;
|
|
624
624
|
}
|
|
625
625
|
_queueRotate(e, t) {
|
|
626
626
|
if (!this.enableRotate || !this.domElement)
|
|
627
627
|
return;
|
|
628
|
-
const { height: i } =
|
|
628
|
+
const { height: i } = Ti(this.domElement), n = Rt / i;
|
|
629
629
|
this._rotateVelocity.x += e * n * this.rotateSpeed, this._rotateVelocity.y += t * n * this.rotateSpeed;
|
|
630
630
|
}
|
|
631
631
|
_queuePan(e, t) {
|
|
@@ -635,9 +635,9 @@ class fn extends Yn {
|
|
|
635
635
|
this.enableZoom && (this._zoomVelocity += e);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class Li extends nn {
|
|
639
639
|
constructor(e, t, i, n) {
|
|
640
|
-
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this._rayOriginOffset = new h(0, -1, 0), this._camerLocalDirection = new h(), this._tmpVector = new h(), this._lookDirection = new h(), this._rayCaster = new
|
|
640
|
+
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this._rayOriginOffset = new h(0, -1, 0), this._camerLocalDirection = new h(), this._tmpVector = new h(), this._lookDirection = new h(), this._rayCaster = new ae(), this._fallingTime = 0, this._isMouseInElement = !1, this._euler = new sn(0, 0, 0, "YZX"), this._prevMouseX = 0, this._prevMouseY = 0, this._pointerLookActive = !1, this._externalLookActive = !1, this._interactionActive = !1, this._sharedTargetDistance = 10, this.target = this.camera.position.clone().add(
|
|
641
641
|
new h(0, 0, -1).applyQuaternion(this.camera.quaternion).normalize().multiplyScalar(this._sharedTargetDistance)
|
|
642
642
|
), this.applyGravity = !1, this.gravityMinHeight = !0, this.applyCollision = !0, this.positionEasing = !0, this.lookflag = 1, this.lookSpeed = 3e-3, this.moveSpeed = 0.02, this.playerHeight = 1.6, this.jumpSpeed = 0.24, this.jumpGravity = 0.012, this.maxRotateX = Math.PI * 0.5 - 0.01, this.g = 9.8, this.bindmousedown = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchStart.bind(this) : this.onMouseDown.bind(this), this.bindmouseup = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchEnd.bind(this) : this.onMouseUp.bind(this), this.bindmousemove = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchMove.bind(this) : this.onMouseMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindWindowBlur = this.onWindowBlur.bind(this), this.bindVisibilityChange = this.onVisibilityChange.bind(this), this.bindMousewheel = this.onMousewheel.bind(this), this.bindMouseEnter = this.onMouseEnter.bind(this), this.bindMouseLeave = this.onMouseLeave.bind(this), this.needMousewheel = !1, this.moveWheelRun = !0, this.moveWheelStop = !1, this.wheelClock, this.keydown = !1, this.shiftDown = !1, this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = this.camera.position.y, this.gravityTestCount = 5, this.catchTestCount = 10, this.GetEngine = () => e, this.syncRotationStateFromCamera(), this.sanitizeCameraOrientation(), this.syncSharedTargetFromCamera();
|
|
643
643
|
}
|
|
@@ -993,7 +993,7 @@ class Di extends tn {
|
|
|
993
993
|
return r;
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
|
-
const qs =
|
|
996
|
+
const qs = W("/assets/worker_walk.glb", import.meta.url), js = Math.PI, Ks = {
|
|
997
997
|
16: "ShiftLeft",
|
|
998
998
|
37: "ArrowLeft",
|
|
999
999
|
38: "ArrowUp",
|
|
@@ -1017,9 +1017,9 @@ const qs = G("/assets/worker_walk.glb", import.meta.url), js = Math.PI, Ks = {
|
|
|
1017
1017
|
jump: ["Space"],
|
|
1018
1018
|
boost: ["ShiftLeft", "ShiftRight"]
|
|
1019
1019
|
};
|
|
1020
|
-
class Ii extends
|
|
1020
|
+
class Ii extends nn {
|
|
1021
1021
|
constructor(e, t, i, n = {}) {
|
|
1022
|
-
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new h(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new h(), this._moveDirection = new h(), this._rayCaster = new
|
|
1022
|
+
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new h(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new h(), this._moveDirection = new h(), this._rayCaster = new ae(), this._cameraRayCaster = new ae(), this._cameraCollisionFrame = 0, this._lastCameraSafeDistance = null, this._fallingTime = 0, this._isMouseInElement = !1, this._prevMouseX = 0, this._prevMouseY = 0, this._dragRotateThreshold = n.dragRotateThreshold ?? 2, this._pointerLookActive = !1, this._externalLookActive = !1, this._scriptedMotionActive = !1, this._interactionActive = !1, this._yaw = 0, this._pitch = n.initialPitch ?? 0, this._pressedKeys = /* @__PURE__ */ new Set(), this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = 0, this.avatarRoot = new he(), this.avatarRoot.name = "ThirdPersonAvatarRoot", this.avatarRoot.visible = n.visible ?? !0, this.avatarMixer = null, this.avatarWalkAction = null, this._isWalkActionPlaying = !1, this._avatarAnimationClock = new on(), this._avatarLoadRequestId = 0, this.defaultAvatarUrl = n.avatarUrl ?? qs, this._ownsAvatarResources = !n.avatar, this.avatar = n.avatar || this.createDefaultAvatar(), this.avatar.name = this.avatar.name || "ThirdPersonAvatar", this.avatarRoot.add(this.avatar), !n.avatar && this.defaultAvatarUrl && this.loadAvatarModel(this.defaultAvatarUrl, n.avatarOptions);
|
|
1023
1023
|
const s = this.isPcDevice();
|
|
1024
1024
|
this.bindmousedown = s ? this.onMouseDown.bind(this) : this.onTouchStart.bind(this), this.bindmouseup = s ? this.onMouseUp.bind(this) : this.onTouchEnd.bind(this), this.bindmousemove = s ? this.onMouseMove.bind(this) : this.onTouchMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindWindowBlur = this.onWindowBlur.bind(this), this.bindVisibilityChange = this.onVisibilityChange.bind(this), this.bindMouseEnter = this.onMouseEnter.bind(this), this.bindMouseLeave = this.onMouseLeave.bind(this), this.initAvatarPoseFromCamera();
|
|
1025
1025
|
}
|
|
@@ -1048,7 +1048,7 @@ class Ii extends tn {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
/** 创建 GLB 加载前的空角色,避免异步加载期间显示占位方块。 */
|
|
1050
1050
|
createDefaultAvatar() {
|
|
1051
|
-
const e = new
|
|
1051
|
+
const e = new he();
|
|
1052
1052
|
return e.name = "ThirdPersonEmptyAvatar", e.visible = !1, e;
|
|
1053
1053
|
}
|
|
1054
1054
|
/** 替换角色可视模型,碰撞体仍使用 avatarRoot 的脚底点和半径参数。 */
|
|
@@ -1070,7 +1070,7 @@ class Ii extends tn {
|
|
|
1070
1070
|
/** 默认加载第三人称工人模型,并使用模型内置第一段动画作为行走动作。 */
|
|
1071
1071
|
loadAvatarModel(e, t = {}) {
|
|
1072
1072
|
const i = ++this._avatarLoadRequestId;
|
|
1073
|
-
new
|
|
1073
|
+
new ri().load(
|
|
1074
1074
|
e,
|
|
1075
1075
|
(s) => {
|
|
1076
1076
|
if (i !== this._avatarLoadRequestId || !s?.scene)
|
|
@@ -1452,7 +1452,7 @@ class Ii extends tn {
|
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
const Xt = "__isModelUrlGroup",
|
|
1455
|
+
const Xt = "__isModelUrlGroup", Tt = "__modelDepthBias", yn = 4;
|
|
1456
1456
|
function vn(a) {
|
|
1457
1457
|
return a.__modelGroupMap instanceof Map || (a.__modelGroupMap = /* @__PURE__ */ new Map()), a.__modelGroupMap;
|
|
1458
1458
|
}
|
|
@@ -1462,39 +1462,39 @@ function Mn(a) {
|
|
|
1462
1462
|
function $t(a, e) {
|
|
1463
1463
|
a.url = e, a.name = e, a.userData = a.userData ?? {}, a.userData[Xt] = !0;
|
|
1464
1464
|
}
|
|
1465
|
-
function li(a, e) {
|
|
1466
|
-
return a instanceof ce ? e == null ? a.userData?.[Xt] === !0 : a.userData?.[Xt] === !0 && a.url === e : !1;
|
|
1467
|
-
}
|
|
1468
1465
|
function ci(a, e) {
|
|
1466
|
+
return a instanceof he ? e == null ? a.userData?.[Xt] === !0 : a.userData?.[Xt] === !0 && a.url === e : !1;
|
|
1467
|
+
}
|
|
1468
|
+
function hi(a, e) {
|
|
1469
1469
|
return a?.models?.find?.((t) => t?.url === e);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function Dt(a, e, t) {
|
|
1472
1472
|
if (typeof t != "string" || t.length === 0)
|
|
1473
1473
|
return;
|
|
1474
|
-
const i =
|
|
1474
|
+
const i = hi(a, e);
|
|
1475
1475
|
i != null && (Array.isArray(i.urls) || (i.urls = []), i.urls.includes(t) || i.urls.push(t));
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function Ne(a, e) {
|
|
1478
1478
|
const t = vn(a), i = t.get(e);
|
|
1479
1479
|
if (i && i.parent != null)
|
|
1480
1480
|
return i;
|
|
1481
|
-
const n =
|
|
1482
|
-
if (n?.group instanceof
|
|
1481
|
+
const n = hi(a, e);
|
|
1482
|
+
if (n?.group instanceof he && n.group.parent != null)
|
|
1483
1483
|
return $t(n.group, e), t.set(e, n.group), n.group;
|
|
1484
|
-
const s = a?.scene?.children?.find?.((o) => o instanceof
|
|
1484
|
+
const s = a?.scene?.children?.find?.((o) => o instanceof he ? ci(o, e) ? !0 : o.name === e && o.url === e : !1);
|
|
1485
1485
|
return s != null ? ($t(s, e), t.set(e, s), n != null && (n.group = s), s) : null;
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1488
|
-
const t =
|
|
1489
|
-
return t == null ? new
|
|
1487
|
+
function He(a, e) {
|
|
1488
|
+
const t = Ne(a, e);
|
|
1489
|
+
return t == null ? new G() : (t.updateWorldMatrix(!0, !1), t.matrixWorld.clone());
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1492
|
-
const t =
|
|
1491
|
+
function Ye(a, e) {
|
|
1492
|
+
const t = Ne(a, e);
|
|
1493
1493
|
if (t != null)
|
|
1494
1494
|
return t;
|
|
1495
|
-
const i = new
|
|
1495
|
+
const i = new he();
|
|
1496
1496
|
$t(i, e), a.scene.add(i), vn(a).set(e, i);
|
|
1497
|
-
const s =
|
|
1497
|
+
const s = hi(a, e);
|
|
1498
1498
|
return s != null && (s.group = i), i;
|
|
1499
1499
|
}
|
|
1500
1500
|
function Ys(a) {
|
|
@@ -1502,13 +1502,13 @@ function Ys(a) {
|
|
|
1502
1502
|
return (Array.isArray(a?.models) ? a.models : []).forEach((n) => {
|
|
1503
1503
|
if (n?.url == null)
|
|
1504
1504
|
return;
|
|
1505
|
-
const s =
|
|
1505
|
+
const s = Ne(a, n.url);
|
|
1506
1506
|
s == null || t.has(s.uuid) || (t.add(s.uuid), e.push(s));
|
|
1507
1507
|
}), a?.scene?.children?.forEach?.((n) => {
|
|
1508
|
-
!
|
|
1508
|
+
!ci(n) || t.has(n.uuid) || (t.add(n.uuid), e.push(n));
|
|
1509
1509
|
}), e;
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1511
|
+
function ui(a, e) {
|
|
1512
1512
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
1513
1513
|
return Ys(a).forEach((s) => {
|
|
1514
1514
|
s.traverse((o) => {
|
|
@@ -1518,14 +1518,14 @@ function hi(a, e) {
|
|
|
1518
1518
|
if (s.name == "highlightModel")
|
|
1519
1519
|
i.add(s.uuid), t.push(s);
|
|
1520
1520
|
else {
|
|
1521
|
-
if (i.has(s.uuid) ||
|
|
1521
|
+
if (i.has(s.uuid) || ci(s) || s.url == null)
|
|
1522
1522
|
return;
|
|
1523
1523
|
e(s) && (i.add(s.uuid), t.push(s));
|
|
1524
1524
|
}
|
|
1525
1525
|
}), t;
|
|
1526
1526
|
}
|
|
1527
|
-
function
|
|
1528
|
-
return
|
|
1527
|
+
function di(a) {
|
|
1528
|
+
return ui(a, (e) => e instanceof O && !(e instanceof X));
|
|
1529
1529
|
}
|
|
1530
1530
|
function Xs(a) {
|
|
1531
1531
|
if (typeof a.__modelObjectIndexSeed == "number")
|
|
@@ -1540,7 +1540,7 @@ function $s(a) {
|
|
|
1540
1540
|
const e = a.__modelObjectIndexSeed;
|
|
1541
1541
|
return a.__modelObjectIndexSeed += 1, e;
|
|
1542
1542
|
}
|
|
1543
|
-
function
|
|
1543
|
+
function pi(a, e, t) {
|
|
1544
1544
|
const i = typeof t == "number" ? t : $s(a);
|
|
1545
1545
|
return e.index = i, Mn(a).set(i, e), i;
|
|
1546
1546
|
}
|
|
@@ -1550,12 +1550,12 @@ function wn(a) {
|
|
|
1550
1550
|
function Zs(a) {
|
|
1551
1551
|
return 1 + (Number.isFinite(a) ? Math.abs(Math.floor(a)) : 0) % 16 * 0.125;
|
|
1552
1552
|
}
|
|
1553
|
-
function
|
|
1553
|
+
function mi(a, e) {
|
|
1554
1554
|
const t = typeof e == "number" ? e : a?.index, i = Zs(t);
|
|
1555
1555
|
wn(a?.material).forEach((n) => {
|
|
1556
1556
|
n.userData = n.userData ?? {};
|
|
1557
|
-
const s = n.userData[
|
|
1558
|
-
n.userData[
|
|
1557
|
+
const s = n.userData[Tt] ?? {};
|
|
1558
|
+
n.userData[Tt] = {
|
|
1559
1559
|
...s,
|
|
1560
1560
|
enabled: !0,
|
|
1561
1561
|
factor: 1,
|
|
@@ -1563,11 +1563,11 @@ function pi(a, e) {
|
|
|
1563
1563
|
}, n.polygonOffset = !0, n.polygonOffsetFactor = 1, n.polygonOffsetUnits = i + (s.edgeActive ? yn : 0), n.needsUpdate = !0;
|
|
1564
1564
|
});
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1566
|
+
function ki(a, e) {
|
|
1567
1567
|
wn(a?.material).forEach((t) => {
|
|
1568
1568
|
t.userData = t.userData ?? {};
|
|
1569
|
-
const i = t.userData[
|
|
1570
|
-
t.userData[
|
|
1569
|
+
const i = t.userData[Tt] ?? {}, n = i.enabled ? i.units : t.polygonOffsetUnits ?? 0, s = i.enabled ? i.factor : t.polygonOffsetFactor ?? 1;
|
|
1570
|
+
t.userData[Tt] = {
|
|
1571
1571
|
...i,
|
|
1572
1572
|
edgeActive: e
|
|
1573
1573
|
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? yn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
@@ -1580,7 +1580,7 @@ function It(a, e) {
|
|
|
1580
1580
|
if (i && i.parent != null)
|
|
1581
1581
|
return i;
|
|
1582
1582
|
i && i.parent == null && t.delete(e);
|
|
1583
|
-
const n =
|
|
1583
|
+
const n = ui(a, (s) => s.index === e)[0];
|
|
1584
1584
|
return n != null ? (t.set(e, n), n) : a?.scene?.children?.find?.((s) => s?.index === e);
|
|
1585
1585
|
}
|
|
1586
1586
|
class Js {
|
|
@@ -1595,14 +1595,14 @@ class Js {
|
|
|
1595
1595
|
const n = this.engine, s = e.object.url, o = e.object.name;
|
|
1596
1596
|
let r = n.modelEdge.getModelEdge(s, o);
|
|
1597
1597
|
r || (r = [0, 0, []]);
|
|
1598
|
-
const l =
|
|
1598
|
+
const l = He(n, s), c = this.getModelSnapCache(s, o, r);
|
|
1599
1599
|
n.camera.updateMatrixWorld(!0);
|
|
1600
|
-
const u = new
|
|
1600
|
+
const u = new G().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), d = n.renderer.domElement.clientWidth, g = n.renderer.domElement.clientHeight, m = new H(t.offsetX, t.offsetY), w = new kt(), v = new h(), b = new h(), p = new H(), x = new H(), C = new h();
|
|
1601
1601
|
let _ = "face", E = null, k = null, B = 100;
|
|
1602
1602
|
if (i != null) {
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
const $ =
|
|
1603
|
+
const L = e.point.clone(), V = e.normal || (e.face ? e.face.normal : null);
|
|
1604
|
+
if (V && e.object?.matrixWorld?.elements) {
|
|
1605
|
+
const $ = V.clone().transformDirection(e.object.matrixWorld).normalize(), f = new h().subVectors(i, L).dot($), y = i.clone().sub($.clone().multiplyScalar(f)), P = this.projectWorldPointToScreen(y, u, d, g, p, w);
|
|
1606
1606
|
if (P != null) {
|
|
1607
1607
|
const T = this.getDistanceSq(P.x, P.y, m.x, m.y);
|
|
1608
1608
|
T < B * 4 && (B = T, E = {
|
|
@@ -1614,43 +1614,43 @@ class Js {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
|
-
for (let
|
|
1618
|
-
if (v.set(c.localPoints[
|
|
1617
|
+
for (let L = 0; L < c.localPoints.length; L += 3) {
|
|
1618
|
+
if (v.set(c.localPoints[L], c.localPoints[L + 1], c.localPoints[L + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(v))
|
|
1619
1619
|
continue;
|
|
1620
|
-
const
|
|
1621
|
-
if (
|
|
1620
|
+
const V = this.projectWorldPointToScreen(v, u, d, g, p, w);
|
|
1621
|
+
if (V == null)
|
|
1622
1622
|
continue;
|
|
1623
|
-
const $ = this.getDistanceSq(
|
|
1623
|
+
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
1624
1624
|
$ < B && (B = $, E = {
|
|
1625
1625
|
point: v.clone(),
|
|
1626
1626
|
distanceSq: $,
|
|
1627
|
-
pointxy:
|
|
1627
|
+
pointxy: V.clone(),
|
|
1628
1628
|
style: "rect"
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
|
-
for (let
|
|
1632
|
-
if (v.set(c.localCenters[
|
|
1631
|
+
for (let L = 0; L < c.localCenters.length; L += 3) {
|
|
1632
|
+
if (v.set(c.localCenters[L], c.localCenters[L + 1], c.localCenters[L + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(v))
|
|
1633
1633
|
continue;
|
|
1634
|
-
const
|
|
1635
|
-
if (
|
|
1634
|
+
const V = this.projectWorldPointToScreen(v, u, d, g, p, w);
|
|
1635
|
+
if (V == null)
|
|
1636
1636
|
continue;
|
|
1637
|
-
const $ = this.getDistanceSq(
|
|
1637
|
+
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
1638
1638
|
$ < B && (B = $, E = {
|
|
1639
1639
|
point: v.clone(),
|
|
1640
1640
|
distanceSq: $,
|
|
1641
|
-
pointxy:
|
|
1641
|
+
pointxy: V.clone(),
|
|
1642
1642
|
style: "default"
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
1645
1645
|
if (E != null)
|
|
1646
1646
|
_ = "point";
|
|
1647
1647
|
else {
|
|
1648
|
-
for (let
|
|
1649
|
-
v.set(c.localLines[
|
|
1650
|
-
const
|
|
1651
|
-
if (
|
|
1648
|
+
for (let L = 0; L < c.localLines.length; L += 6) {
|
|
1649
|
+
v.set(c.localLines[L], c.localLines[L + 1], c.localLines[L + 2]).applyMatrix4(l), b.set(c.localLines[L + 3], c.localLines[L + 4], c.localLines[L + 5]).applyMatrix4(l);
|
|
1650
|
+
const V = this.projectWorldPointToScreen(v, u, d, g, p, w), $ = this.projectWorldPointToScreen(b, u, d, g, x, w);
|
|
1651
|
+
if (V == null || $ == null)
|
|
1652
1652
|
continue;
|
|
1653
|
-
const S = this.pointToLineProjection(m,
|
|
1653
|
+
const S = this.pointToLineProjection(m, V, $), f = this.pointToLineDistanceSq(m, V, $);
|
|
1654
1654
|
if (f < B) {
|
|
1655
1655
|
const y = this.pointToLineProjection3D(S, v, b, u, C);
|
|
1656
1656
|
if (n.clipping && !n.clipping.isPointInClippingRange(y))
|
|
@@ -1658,8 +1658,8 @@ class Js {
|
|
|
1658
1658
|
k = {
|
|
1659
1659
|
distanceSq: f,
|
|
1660
1660
|
point: y.clone(),
|
|
1661
|
-
pointxy: this.projectWorldPointToScreen(y, u, d, g, p, w)?.clone() ??
|
|
1662
|
-
start:
|
|
1661
|
+
pointxy: this.projectWorldPointToScreen(y, u, d, g, p, w)?.clone() ?? V.clone(),
|
|
1662
|
+
start: V.clone(),
|
|
1663
1663
|
end: $.clone(),
|
|
1664
1664
|
style: "funnel"
|
|
1665
1665
|
}, B = f;
|
|
@@ -1716,10 +1716,10 @@ class Js {
|
|
|
1716
1716
|
return this.getDistanceSq(e.x, e.y, s, o);
|
|
1717
1717
|
}
|
|
1718
1718
|
pointToLineProjection(e, t, i) {
|
|
1719
|
-
const n = new
|
|
1719
|
+
const n = new H().subVectors(i, t), s = n.lengthSq();
|
|
1720
1720
|
if (s < 1e-10)
|
|
1721
1721
|
return 0;
|
|
1722
|
-
const o = new
|
|
1722
|
+
const o = new H().subVectors(e, t);
|
|
1723
1723
|
return R.clamp(o.dot(n) / s, 0, 1);
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
@@ -1729,7 +1729,7 @@ class Js {
|
|
|
1729
1729
|
const o = R.clamp(e, 0, 1);
|
|
1730
1730
|
if (!this.engine.camera.isPerspectiveCamera)
|
|
1731
1731
|
return s.lerpVectors(t, i, o);
|
|
1732
|
-
const r = new
|
|
1732
|
+
const r = new kt(t.x, t.y, t.z, 1).applyMatrix4(n), c = new kt(i.x, i.y, i.z, 1).applyMatrix4(n).w * (1 - o) + o * r.w, u = Math.abs(c) > 1e-10 ? o * r.w / c : o;
|
|
1733
1733
|
return s.lerpVectors(t, i, R.clamp(u, 0, 1));
|
|
1734
1734
|
}
|
|
1735
1735
|
/**
|
|
@@ -1783,7 +1783,7 @@ class Js {
|
|
|
1783
1783
|
x.setAttribute("class", "catchFace"), x.setAttribute("points", p.map((C) => `${C.x + t.reactBoundingClientRect.left},${C.y + t.reactBoundingClientRect.top}`).join(" ")), x.setAttribute("fill", "rgba(1, 238, 255, 0.2)"), x.setAttribute("stroke", "rgb(0, 255, 247)"), x.setAttribute("stroke-width", "1"), t.catchSvg.appendChild(x);
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
function
|
|
1786
|
+
function gi(a) {
|
|
1787
1787
|
const e = {
|
|
1788
1788
|
self: null,
|
|
1789
1789
|
// 当前激活的行为对象
|
|
@@ -1808,15 +1808,15 @@ function mi(a) {
|
|
|
1808
1808
|
latestMouseMoveEvent: null
|
|
1809
1809
|
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new Js(a);
|
|
1810
1810
|
e.handle_catch = function(M, A, z = !0, N = !0) {
|
|
1811
|
-
const
|
|
1811
|
+
const U = e.options;
|
|
1812
1812
|
e.options = {
|
|
1813
|
-
...
|
|
1813
|
+
...U ?? {},
|
|
1814
1814
|
showCatch: z
|
|
1815
1815
|
};
|
|
1816
1816
|
try {
|
|
1817
|
-
return
|
|
1817
|
+
return Ze(M, A, !0, N);
|
|
1818
1818
|
} finally {
|
|
1819
|
-
e.options =
|
|
1819
|
+
e.options = U;
|
|
1820
1820
|
}
|
|
1821
1821
|
}, e.init = function(M, A) {
|
|
1822
1822
|
e.self != null && e.self.disActive != null && e.self.type != M.type && e.self.disActive(), e.self = M, A == null && (A = {
|
|
@@ -1829,9 +1829,9 @@ function mi(a) {
|
|
|
1829
1829
|
e.mouseMoveFrame != null && (cancelAnimationFrame(e.mouseMoveFrame), e.mouseMoveFrame = null), e.latestMouseMoveEvent = null;
|
|
1830
1830
|
}
|
|
1831
1831
|
e.active = function() {
|
|
1832
|
-
a.renderer.domElement.addEventListener("mousedown", y), a.renderer.domElement.addEventListener("mouseup", T), a.renderer.domElement.addEventListener("mousemove", P), a.renderer.domElement.addEventListener("touchstart", Q, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchend", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchcancel", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchmove", fe, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("pointerdown", Ee, !0), a.renderer.domElement.addEventListener("pointermove",
|
|
1832
|
+
a.renderer.domElement.addEventListener("mousedown", y), a.renderer.domElement.addEventListener("mouseup", T), a.renderer.domElement.addEventListener("mousemove", P), a.renderer.domElement.addEventListener("touchstart", Q, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchend", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchcancel", J, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("touchmove", fe, { capture: !0, passive: !1 }), a.renderer.domElement.addEventListener("pointerdown", Ee, !0), a.renderer.domElement.addEventListener("pointermove", $e, !0), a.renderer.domElement.addEventListener("pointerup", Be, !0), a.renderer.domElement.addEventListener("pointercancel", Be, !0), window.addEventListener("keydown", c), window.addEventListener("keyup", u);
|
|
1833
1833
|
}, e.disActive = function() {
|
|
1834
|
-
p(), l(),
|
|
1834
|
+
p(), l(), V(), a.renderer.domElement.removeEventListener("mousedown", y), a.renderer.domElement.removeEventListener("mouseup", T), a.renderer.domElement.removeEventListener("mousemove", P), a.renderer.domElement.removeEventListener("touchstart", Q, !0), a.renderer.domElement.removeEventListener("touchend", J, !0), a.renderer.domElement.removeEventListener("touchcancel", J, !0), a.renderer.domElement.removeEventListener("touchmove", fe, !0), a.renderer.domElement.removeEventListener("pointerdown", Ee, !0), a.renderer.domElement.removeEventListener("pointermove", $e, !0), a.renderer.domElement.removeEventListener("pointerup", Be, !0), a.renderer.domElement.removeEventListener("pointercancel", Be, !0), window.removeEventListener("keydown", c), window.removeEventListener("keyup", u);
|
|
1835
1835
|
};
|
|
1836
1836
|
function c(M) {
|
|
1837
1837
|
(M.keyCode === 8 || M.keyCode === 46) && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), M.keyCode === 27 && e.self && e.self.handelKeyEscDown != null && e.self.handelKeyEscDown(), M.keyCode === 13 && e.self && e.self.handelKeyEnterDown != null && e.self.handelKeyEnterDown(), M.keyCode === 32 && e.self && e.self.handelKeySpaceDown != null && e.self.handelKeySpaceDown(), M.key === "Control" && e.self && e.self.handelKeyCtrlDown != null && e.self.handelKeyCtrlDown(), M.key === "Delete" && e.self && e.self.handelKeyDeleteDown != null && e.self.handelKeyDeleteDown(), M.key === "Shift" && e.self && e.self.handelKeyShiftDown != null && e.self.handelKeyShiftDown(), M.key === "Meta" && e.self && e.self.handelKeyMetaDown != null && e.self.handelKeyMetaDown();
|
|
@@ -1840,11 +1840,11 @@ function mi(a) {
|
|
|
1840
1840
|
M.key === "Alt" && e.self && e.self.handelKeyAltUp != null && e.self.handelKeyAltUp(), M.key === "Tab" && e.self && e.self.handelKeyTabUp != null && e.self.handelKeyTabUp(), M.key === "Control" && e.self && e.self.handelKeyCtrlUp != null && e.self.handelKeyCtrlUp(), M.key === "Shift" && e.self && e.self.handelKeyShiftUp != null && e.self.handelKeyShiftUp(), M.key === "Meta" && e.self && e.self.handelKeyMetaUp != null && e.self.handelKeyMetaUp(), M.key === "Command" && e.self && e.self.handelKeyCommandUp != null && e.self.handelKeyCommandUp(), M.key === "Windows" && e.self && e.self.handelKeyWindowsUp != null && e.self.handelKeyWindowsUp();
|
|
1841
1841
|
}
|
|
1842
1842
|
function d(M) {
|
|
1843
|
-
const A = new
|
|
1843
|
+
const A = new H(), z = a.renderer.domElement.clientWidth, N = a.renderer.domElement.clientHeight;
|
|
1844
1844
|
return A.x = M.offsetX / z * 2 - 1, A.y = -(M.offsetY / N) * 2 + 1, A;
|
|
1845
1845
|
}
|
|
1846
1846
|
function g(M) {
|
|
1847
|
-
const A = new
|
|
1847
|
+
const A = new ae(), z = d(M);
|
|
1848
1848
|
return A.setFromCamera(z, a.camera), A;
|
|
1849
1849
|
}
|
|
1850
1850
|
function m() {
|
|
@@ -1861,7 +1861,7 @@ function mi(a) {
|
|
|
1861
1861
|
e.touchLongPressTimer != null && (clearTimeout(e.touchLongPressTimer), e.touchLongPressTimer = null);
|
|
1862
1862
|
}
|
|
1863
1863
|
function p() {
|
|
1864
|
-
b(),
|
|
1864
|
+
b(), L(), _(), e.touchLongPressActive = !1, e.touchLatestEvent = null, e.touchStartPosition = null, e.touchInputMode = null, e.touchPointerId = null;
|
|
1865
1865
|
}
|
|
1866
1866
|
function x(M) {
|
|
1867
1867
|
M?.preventDefault?.(), M?.stopPropagation?.(), M?.stopImmediatePropagation?.();
|
|
@@ -1882,7 +1882,7 @@ function mi(a) {
|
|
|
1882
1882
|
}
|
|
1883
1883
|
function k(M) {
|
|
1884
1884
|
const A = M.touches[0] || M.changedTouches[0];
|
|
1885
|
-
return A ? new
|
|
1885
|
+
return A ? new H(A.clientX, A.clientY) : null;
|
|
1886
1886
|
}
|
|
1887
1887
|
function B() {
|
|
1888
1888
|
if (e.touchMagnifierCanvas)
|
|
@@ -1890,32 +1890,32 @@ function mi(a) {
|
|
|
1890
1890
|
const M = document.createElement("canvas"), A = Math.max(1, window.devicePixelRatio || 1);
|
|
1891
1891
|
return M.width = n * A, M.height = n * A, M.style.position = "fixed", M.style.width = `${n}px`, M.style.height = `${n}px`, M.style.borderRadius = "50%", M.style.border = "2px solid rgba(0, 255, 247, 0.95)", M.style.boxShadow = "0 8px 22px rgba(0, 0, 0, 0.32)", M.style.pointerEvents = "none", M.style.zIndex = "1002", M.style.display = "none", M.style.background = "#111", document.body.appendChild(M), e.touchMagnifierCanvas = M, e.touchMagnifierContext = M.getContext("2d"), M;
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function L() {
|
|
1894
1894
|
const M = e.touchMagnifierCanvas;
|
|
1895
1895
|
M && (M.style.display = "none");
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function V() {
|
|
1898
1898
|
e.touchMagnifierCanvas?.remove?.(), e.touchMagnifierCanvas = null, e.touchMagnifierContext = null;
|
|
1899
1899
|
}
|
|
1900
|
-
function $(M, A, z, N,
|
|
1900
|
+
function $(M, A, z, N, U, le) {
|
|
1901
1901
|
const ue = a?.catchSvg;
|
|
1902
1902
|
if (!ue?.childElementCount) return;
|
|
1903
1903
|
const de = a?.reactBoundingClientRect ?? A.getBoundingClientRect(), Re = (te) => {
|
|
1904
|
-
const [_e,
|
|
1905
|
-
return Number.isFinite(_e) && Number.isFinite(
|
|
1904
|
+
const [_e, Ve] = te.split(",").map(Number);
|
|
1905
|
+
return Number.isFinite(_e) && Number.isFinite(Ve) ? [(_e - de.left - z) / U * n * le, (Ve - de.top - N) / U * n * le] : null;
|
|
1906
1906
|
};
|
|
1907
1907
|
Array.from(ue.children).forEach((te) => {
|
|
1908
1908
|
const _e = te.tagName.toLowerCase(), we = (_e === "line" ? [`${te.getAttribute("x1")},${te.getAttribute("y1")}`, `${te.getAttribute("x2")},${te.getAttribute("y2")}`].map(Re) : (te.getAttribute("points") || "").trim().split(/\s+/).map(Re)).filter(Boolean);
|
|
1909
|
-
we.length < 2 || (M.beginPath(), M.strokeStyle = te.getAttribute("stroke") || "rgb(8, 223, 215)", M.fillStyle = te.getAttribute("fill") || "transparent", M.lineWidth = Number(te.getAttribute("stroke-width") || 2) *
|
|
1909
|
+
we.length < 2 || (M.beginPath(), M.strokeStyle = te.getAttribute("stroke") || "rgb(8, 223, 215)", M.fillStyle = te.getAttribute("fill") || "transparent", M.lineWidth = Number(te.getAttribute("stroke-width") || 2) * le, M.moveTo(we[0][0], we[0][1]), we.slice(1).forEach(([ut, dt]) => M.lineTo(ut, dt)), _e === "polygon" && (M.closePath(), ["none", "transparent"].includes(String(M.fillStyle)) || M.fill()), M.stroke());
|
|
1910
1910
|
});
|
|
1911
1911
|
}
|
|
1912
1912
|
function S(M) {
|
|
1913
1913
|
const A = a?.renderer?.domElement, z = B(), N = e.touchMagnifierContext;
|
|
1914
1914
|
if (!A || !z || !N)
|
|
1915
1915
|
return;
|
|
1916
|
-
const
|
|
1916
|
+
const U = M?.catch?.point, le = U && (a?.worldToScreen ?? new oe(a.camera, a.renderer, a.scene)), ue = le?.worldToScreenIfVisible?.(U) ?? le?.worldToScreen?.(U);
|
|
1917
1917
|
if (!ue || !Number.isFinite(ue.x) || !Number.isFinite(ue.y) || ue.x < 0 || ue.y < 0 || ue.x > A.clientWidth || ue.y > A.clientHeight) {
|
|
1918
|
-
|
|
1918
|
+
L();
|
|
1919
1919
|
return;
|
|
1920
1920
|
}
|
|
1921
1921
|
const de = z.width / n, Re = Math.min(
|
|
@@ -1926,21 +1926,21 @@ function mi(a) {
|
|
|
1926
1926
|
Math.max(8, M.clientY - o)
|
|
1927
1927
|
);
|
|
1928
1928
|
z.style.left = `${Re - n / 2}px`, z.style.top = `${te}px`, z.style.display = "block";
|
|
1929
|
-
const _e = A.width / Math.max(1, A.clientWidth),
|
|
1929
|
+
const _e = A.width / Math.max(1, A.clientWidth), Ve = A.height / Math.max(1, A.clientHeight), we = s, ut = Math.max(0, Math.min(A.clientWidth - we, ue.x - we / 2)), dt = Math.max(0, Math.min(A.clientHeight - we, ue.y - we / 2));
|
|
1930
1930
|
N.save(), N.clearRect(0, 0, z.width, z.height), N.beginPath(), N.arc(z.width / 2, z.height / 2, z.width / 2, 0, Math.PI * 2), N.clip(), N.fillStyle = window.getComputedStyle(A.parentElement ?? document.body).backgroundColor || "#dfe8f2", N.fillRect(0, 0, z.width, z.height);
|
|
1931
1931
|
try {
|
|
1932
|
-
N.drawImage(A,
|
|
1932
|
+
N.drawImage(A, ut * _e, dt * Ve, we * _e, we * Ve, 0, 0, z.width, z.height), $(N, A, ut, dt, we, de);
|
|
1933
1933
|
} catch {
|
|
1934
|
-
|
|
1934
|
+
L(), N.restore();
|
|
1935
1935
|
return;
|
|
1936
1936
|
}
|
|
1937
1937
|
N.strokeStyle = "rgba(0, 255, 247, 0.9)", N.lineWidth = 1.5 * de, N.beginPath(), N.moveTo(z.width / 2 - 10 * de, z.height / 2), N.lineTo(z.width / 2 + 10 * de, z.height / 2), N.moveTo(z.width / 2, z.height / 2 - 10 * de), N.lineTo(z.width / 2, z.height / 2 + 10 * de), N.stroke(), N.restore();
|
|
1938
1938
|
}
|
|
1939
1939
|
function f(M, A = !1, z = !1, N = !0) {
|
|
1940
|
-
const
|
|
1941
|
-
if (M.raycaster =
|
|
1942
|
-
const
|
|
1943
|
-
M.catch =
|
|
1940
|
+
const U = g(M);
|
|
1941
|
+
if (M.raycaster = U, A) {
|
|
1942
|
+
const le = Ze(U, M, z, N);
|
|
1943
|
+
M.catch = le;
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
1946
|
function y(M) {
|
|
@@ -1957,17 +1957,17 @@ function mi(a) {
|
|
|
1957
1957
|
return;
|
|
1958
1958
|
const A = Date.now(), z = A - e.mouseDownTime, N = new h(M.offsetX, M.offsetY, 0);
|
|
1959
1959
|
e.self && e.self.handleMouseUp != null && M.button == 0 && (f(M, !1, !1, !1), e.self.handleMouseUp(M));
|
|
1960
|
-
const
|
|
1961
|
-
(z < 100 ||
|
|
1960
|
+
const U = N.distanceTo(e.mouseDownPosition);
|
|
1961
|
+
(z < 100 || U == 0) && e.self && e.self.handleMouseClick != null && (f(M, !0, !0, !1), A - e.lastClickTime < 200 ? e.self.handleMouseDoubleClick != null && M.button == 0 && e.self.handleMouseDoubleClick(M) : e.self.handleMouseClick != null && M.button == 0 ? e.self.handleMouseClick(M) : e.self.handleRightMouseClick != null && M.button == 2 && e.self.handleRightMouseClick(M), e.lastClickTime = Date.now());
|
|
1962
1962
|
}
|
|
1963
1963
|
function D(M) {
|
|
1964
1964
|
const A = M.touches[0] || M.changedTouches[0];
|
|
1965
1965
|
if (!A)
|
|
1966
1966
|
return null;
|
|
1967
|
-
const N = a.renderer.domElement.getBoundingClientRect(),
|
|
1967
|
+
const N = a.renderer.domElement.getBoundingClientRect(), U = A.clientX - N.left, le = A.clientY - N.top;
|
|
1968
1968
|
return {
|
|
1969
|
-
offsetX:
|
|
1970
|
-
offsetY:
|
|
1969
|
+
offsetX: U,
|
|
1970
|
+
offsetY: le,
|
|
1971
1971
|
button: 0,
|
|
1972
1972
|
// 模拟左键
|
|
1973
1973
|
clientX: A.clientX,
|
|
@@ -1978,7 +1978,7 @@ function mi(a) {
|
|
|
1978
1978
|
// 保留原始触摸事件
|
|
1979
1979
|
};
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function I(M) {
|
|
1982
1982
|
const z = a.renderer.domElement.getBoundingClientRect();
|
|
1983
1983
|
return {
|
|
1984
1984
|
offsetX: M.clientX - z.left,
|
|
@@ -1993,8 +1993,8 @@ function mi(a) {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
function F(M, A, z, N = null) {
|
|
1995
1995
|
p(), e.touchInputMode = z, e.touchPointerId = N, e.touchLatestEvent = M, e.touchStartPosition = A, e.touchLongPressTimer = window.setTimeout(() => {
|
|
1996
|
-
const
|
|
1997
|
-
|
|
1996
|
+
const U = e.touchLatestEvent;
|
|
1997
|
+
U && (e.touchLongPressActive = !0, C(), e.mouseDownTime = Date.now(), e.mouseDownPosition = new h(U.offsetX, U.offsetY, 0), e.self?.handleMouseMove != null && (f(U, !0, !0, e.isClickSimpleModel), e.self.handleMouseMove(U)), S(U));
|
|
1998
1998
|
}, t);
|
|
1999
1999
|
}
|
|
2000
2000
|
function q(M, A) {
|
|
@@ -2013,7 +2013,7 @@ function mi(a) {
|
|
|
2013
2013
|
const A = D(M);
|
|
2014
2014
|
if (A) {
|
|
2015
2015
|
if (w()) {
|
|
2016
|
-
F(A, k(M) ?? new
|
|
2016
|
+
F(A, k(M) ?? new H(A.clientX, A.clientY), "touch");
|
|
2017
2017
|
return;
|
|
2018
2018
|
}
|
|
2019
2019
|
y(A);
|
|
@@ -2047,16 +2047,16 @@ function mi(a) {
|
|
|
2047
2047
|
function Ee(M) {
|
|
2048
2048
|
if (M.pointerType !== "touch" || !w() || M.isPrimary === !1)
|
|
2049
2049
|
return;
|
|
2050
|
-
const A =
|
|
2051
|
-
F(A, new
|
|
2050
|
+
const A = I(M);
|
|
2051
|
+
F(A, new H(M.clientX, M.clientY), "pointer", M.pointerId);
|
|
2052
2052
|
}
|
|
2053
|
-
function
|
|
2054
|
-
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || q(
|
|
2053
|
+
function $e(M) {
|
|
2054
|
+
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || q(I(M), new H(M.clientX, M.clientY))));
|
|
2055
2055
|
}
|
|
2056
2056
|
function Be(M) {
|
|
2057
|
-
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || ne(
|
|
2057
|
+
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || ne(I(M))));
|
|
2058
2058
|
}
|
|
2059
|
-
function
|
|
2059
|
+
function Ze(M, A, z = !1, N = !0) {
|
|
2060
2060
|
if (!a.engineStatus.isFree && z == !1) {
|
|
2061
2061
|
a.hoverHighLight.clearHighlight();
|
|
2062
2062
|
return;
|
|
@@ -2064,9 +2064,9 @@ function mi(a) {
|
|
|
2064
2064
|
if (a.engineStatus.editorMode == "simple")
|
|
2065
2065
|
return;
|
|
2066
2066
|
a.catchSvg.innerHTML = "";
|
|
2067
|
-
let
|
|
2068
|
-
if (
|
|
2069
|
-
return e.options.showCatch ? r.applySnapPreview(
|
|
2067
|
+
let U = a.octreeBox.rayInterationModel(M, z, N);
|
|
2068
|
+
if (U = a.clipping?.filterIntersectionsByClipping(U) ?? U, U.length !== 0)
|
|
2069
|
+
return e.options.showCatch ? r.applySnapPreview(U[0], A, e.lastPoint) : U[0];
|
|
2070
2070
|
}
|
|
2071
2071
|
return e.setLastPoint = function(M) {
|
|
2072
2072
|
e.lastPoint = M;
|
|
@@ -2095,12 +2095,12 @@ class Qs {
|
|
|
2095
2095
|
isDown = !1;
|
|
2096
2096
|
containerOffset = { left: 0, top: 0 };
|
|
2097
2097
|
constructor(e) {
|
|
2098
|
-
this.engine = e, this.init(), this.handelBehaved =
|
|
2098
|
+
this.engine = e, this.init(), this.handelBehaved = gi(this.engine), this.handelBehaved.init(this, null), this.handelBehaved.active();
|
|
2099
2099
|
}
|
|
2100
2100
|
init() {
|
|
2101
|
-
this.orbitControls = new fn(this.engine, this.engine.camera, this.engine.renderer.domElement), this.orbitControls.showOriginIcon = !0, this.firstPersonControls = new
|
|
2101
|
+
this.orbitControls = new fn(this.engine, this.engine.camera, this.engine.renderer.domElement), this.orbitControls.showOriginIcon = !0, this.firstPersonControls = new Li(this.engine, this.engine.camera, this.engine.renderer.domElement), this.thirdPersonControls = new Ii(this.engine, this.engine.camera, this.engine.renderer.domElement);
|
|
2102
2102
|
const e = document.createElement("div");
|
|
2103
|
-
this.originDiv = e, e.className = "originDiv", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.width = "30px", e.style.height = "30px", e.style.borderRadius = "50%", e.style.pointerEvents = "none", e.style.backgroundImage = `url(${
|
|
2103
|
+
this.originDiv = e, e.className = "originDiv", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.width = "30px", e.style.height = "30px", e.style.borderRadius = "50%", e.style.pointerEvents = "none", e.style.backgroundImage = `url(${W("/assets/svg/rotate-orbit.svg", import.meta.url)})`, this.engine.container.appendChild(this.originDiv);
|
|
2104
2104
|
}
|
|
2105
2105
|
// 激活控制器
|
|
2106
2106
|
active() {
|
|
@@ -2145,7 +2145,7 @@ class Qs {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
// 切换第一人称漫游模式
|
|
2147
2147
|
switchFirstPersonMode() {
|
|
2148
|
-
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new
|
|
2148
|
+
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new Li(
|
|
2149
2149
|
this.engine,
|
|
2150
2150
|
this.engine.camera,
|
|
2151
2151
|
this.engine.renderer.domElement,
|
|
@@ -2439,20 +2439,20 @@ class to {
|
|
|
2439
2439
|
return;
|
|
2440
2440
|
const i = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1;
|
|
2441
2441
|
this.composer.setPixelRatio(i), this.composer.setSize(e, t);
|
|
2442
|
-
const n = this.composer.passes.find((s) => s instanceof
|
|
2442
|
+
const n = this.composer.passes.find((s) => s instanceof zt && s.material.uniforms.resolution);
|
|
2443
2443
|
n && (n.material.uniforms.resolution.value.x = 1 / (e * i), n.material.uniforms.resolution.value.y = 1 / (t * i));
|
|
2444
2444
|
}
|
|
2445
2445
|
init() {
|
|
2446
2446
|
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 rn(e, t, {
|
|
2447
|
-
minFilter:
|
|
2448
|
-
magFilter:
|
|
2447
|
+
minFilter: xt,
|
|
2448
|
+
magFilter: xt,
|
|
2449
2449
|
format: an,
|
|
2450
2450
|
samples: 4
|
|
2451
2451
|
// 启用多重采样抗锯齿
|
|
2452
2452
|
});
|
|
2453
2453
|
r.texture.colorSpace = $n, this.composer = new Zn(s, r), this.composer.setPixelRatio(o), this.composer.setSize(e, t);
|
|
2454
2454
|
const l = new Jn(i, n);
|
|
2455
|
-
this.composer.addPass(l), this.gtaoPass = new
|
|
2455
|
+
this.composer.addPass(l), this.gtaoPass = new yi(i, n, e, t), this.gtaoPass.output = yi.OUTPUT.Default, this.gtaoPass.blendIntensity = xn, this.gtaoPass.enabled = !1, this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
2456
2456
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
2457
2457
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
2458
2458
|
radius: 0.45,
|
|
@@ -2478,14 +2478,14 @@ class to {
|
|
|
2478
2478
|
samples: 32,
|
|
2479
2479
|
rings: 3,
|
|
2480
2480
|
radiusExponent: 2
|
|
2481
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new
|
|
2481
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new vi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = vi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new zt(eo), this.saturationPass.uniforms.saturation.value = bn, this.saturationPass.uniforms.contrast.value = Cn, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new Qn(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new zt(es), 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);
|
|
2482
2482
|
}
|
|
2483
2483
|
}
|
|
2484
2484
|
function io(a, e, t, i) {
|
|
2485
2485
|
const r = a.models.find((v) => v.url == t);
|
|
2486
2486
|
if (r == null)
|
|
2487
2487
|
return;
|
|
2488
|
-
const l =
|
|
2488
|
+
const l = Ye(a, t), c = e.circularMeps, u = e.rectMeps?.filter((v) => v.type === "风管"), d = e.rectMeps?.filter((v) => v.type === "桥架"), g = e.ellipseMeps, m = (v) => (v.color = v.color.split(",").map((b) => parseInt(b) / 255), v.color = new Fe().setRGB(v.color[0], v.color[1], v.color[2], Ke), v.position = {
|
|
2489
2489
|
x: v.startPoint.X * 0.3048 + 0,
|
|
2490
2490
|
y: v.startPoint.Z * 0.3048 + 0,
|
|
2491
2491
|
z: -v.startPoint.Y * 0.3048 + 0
|
|
@@ -2512,24 +2512,24 @@ function no(a, e, t, i, n) {
|
|
|
2512
2512
|
};
|
|
2513
2513
|
switch (a) {
|
|
2514
2514
|
case "Rect":
|
|
2515
|
-
s =
|
|
2515
|
+
s = ft("Rect", o);
|
|
2516
2516
|
break;
|
|
2517
2517
|
case "Bridge":
|
|
2518
|
-
s =
|
|
2518
|
+
s = ft("Bridge", o);
|
|
2519
2519
|
break;
|
|
2520
2520
|
case "Circle":
|
|
2521
|
-
s =
|
|
2521
|
+
s = ft("Circle", o);
|
|
2522
2522
|
break;
|
|
2523
2523
|
case "Ellipse":
|
|
2524
|
-
s =
|
|
2524
|
+
s = ft("Ellipse", o);
|
|
2525
2525
|
break;
|
|
2526
2526
|
}
|
|
2527
2527
|
if (!s)
|
|
2528
2528
|
return null;
|
|
2529
2529
|
const r = new X(s.geometry, s.material, t.length);
|
|
2530
2530
|
r.url = i, e.add(r);
|
|
2531
|
-
const l =
|
|
2532
|
-
|
|
2531
|
+
const l = pi(n, r);
|
|
2532
|
+
mi(r, l);
|
|
2533
2533
|
const c = [], u = [];
|
|
2534
2534
|
for (let g = 0; g < t.length; g++) {
|
|
2535
2535
|
const m = t[g], w = new h(m.startPoint.X, 0, -m.startPoint.Y), v = new h(m.endPoint.X, 0, -m.endPoint.Y), b = new h(m.startPoint.X, m.startPoint.Z, -m.startPoint.Y), p = new h(m.endPoint.X, m.endPoint.Z, -m.endPoint.Y);
|
|
@@ -2541,10 +2541,10 @@ function no(a, e, t, i, n) {
|
|
|
2541
2541
|
}
|
|
2542
2542
|
} else
|
|
2543
2543
|
C = (v.clone().sub(w.clone()).cross(new h(0, 0, 1)).y > 0 ? -1 : 1) * v.clone().sub(w.clone()).angleTo(new h(0, 0, 1)), x = (m.startPoint.Z > m.endPoint.Z ? 1 : -1) * v.clone().sub(w.clone()).angleTo(p.clone().sub(b.clone()));
|
|
2544
|
-
const E = new
|
|
2545
|
-
let
|
|
2546
|
-
a === "Circle" ? (
|
|
2547
|
-
const $ = E.clone().makeScale(
|
|
2544
|
+
const E = new G(), k = new sn(x, C, _, "YXZ"), B = E.clone().makeRotationFromEuler(k);
|
|
2545
|
+
let L, V;
|
|
2546
|
+
a === "Circle" ? (L = m.diameter, V = m.diameter) : (L = m.width, V = m.height);
|
|
2547
|
+
const $ = E.clone().makeScale(L, V, m.length);
|
|
2548
2548
|
E.multiplyMatrices(B, $), E.setPosition(m.position.x, m.position.y, m.position.z), r.setMatrixAt(g, E.clone()), r.setColorAt(g, m.color), r.geometry.computeBoundingBox();
|
|
2549
2549
|
const S = r.geometry.boundingBox.min.clone().applyMatrix4(E.clone()), f = r.geometry.boundingBox.max.clone().applyMatrix4(E.clone()), y = new h(Math.min(S.x, f.x), Math.min(S.y, f.y), Math.min(S.z, f.z)), P = new h(Math.max(S.x, f.x), Math.max(S.y, f.y), Math.max(S.z, f.z)), T = y.clone().add(P.clone()).multiplyScalar(0.5), D = {
|
|
2550
2550
|
name: m.name,
|
|
@@ -2573,7 +2573,7 @@ function no(a, e, t, i, n) {
|
|
|
2573
2573
|
};
|
|
2574
2574
|
return r.meshs = d, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, l;
|
|
2575
2575
|
}
|
|
2576
|
-
function
|
|
2576
|
+
function ft(a, e) {
|
|
2577
2577
|
const t = new ln();
|
|
2578
2578
|
switch (e.width = e.width * 0.3048, e.height = e.height * 0.3048, e.diameter = e.diameter * 0.3048, a) {
|
|
2579
2579
|
case "Rect":
|
|
@@ -2595,7 +2595,7 @@ function gt(a, e) {
|
|
|
2595
2595
|
};
|
|
2596
2596
|
return n(t, i, e.color, e.position, e.rotation);
|
|
2597
2597
|
function n(s, o, r, l, c) {
|
|
2598
|
-
const u = new cn(s, o), d = new
|
|
2598
|
+
const u = new cn(s, o), d = new ai({
|
|
2599
2599
|
color: r,
|
|
2600
2600
|
side: ge
|
|
2601
2601
|
}), g = new O(u, d);
|
|
@@ -2603,10 +2603,10 @@ function gt(a, e) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
2605
2605
|
var ee = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.MeasureClick = "measure-click", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(ee || {});
|
|
2606
|
-
const
|
|
2606
|
+
const zi = "__bvhAccelerationInstalled", Sn = "__bvhBuildFailed", so = "__bvhBuilt", oo = "__bvhTriangleCount", En = 200, ro = 10;
|
|
2607
2607
|
function ao() {
|
|
2608
2608
|
const a = globalThis;
|
|
2609
|
-
a[
|
|
2609
|
+
a[zi] !== !0 && (O.prototype.raycast = ts, Me.prototype.computeBoundsTree = hn, Me.prototype.disposeBoundsTree = is, a[zi] = !0);
|
|
2610
2610
|
}
|
|
2611
2611
|
function lo(a) {
|
|
2612
2612
|
a.firstHitOnly = !0;
|
|
@@ -2646,22 +2646,22 @@ function po(a, e = {}) {
|
|
|
2646
2646
|
i.userData = i.userData ?? {}, i.userData[Sn] = !0, console.warn("[raycastAcceleration] failed to build bounds tree", n);
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
|
-
let
|
|
2649
|
+
let Qe = null, et = null, Bi = null;
|
|
2650
2650
|
const mo = 8, Pn = 24, go = 24, fo = 64, yo = 240, vo = 2, Mo = 10;
|
|
2651
2651
|
function An() {
|
|
2652
|
-
return
|
|
2652
|
+
return W("draco/", import.meta.url);
|
|
2653
2653
|
}
|
|
2654
2654
|
function _n() {
|
|
2655
|
-
return
|
|
2655
|
+
return W("basis/", import.meta.url);
|
|
2656
2656
|
}
|
|
2657
2657
|
function wo() {
|
|
2658
|
-
return
|
|
2658
|
+
return Qe == null && (Qe = new os(), Qe.setDecoderPath(An()), Qe.preload()), Qe;
|
|
2659
2659
|
}
|
|
2660
2660
|
function xo(a) {
|
|
2661
|
-
return
|
|
2661
|
+
return et == null && (et = new rs(), et.setTranscoderPath(_n())), Bi !== a && (et.detectSupport(a), Bi = a), et;
|
|
2662
2662
|
}
|
|
2663
2663
|
function bo(a) {
|
|
2664
|
-
const e = new
|
|
2664
|
+
const e = new ri();
|
|
2665
2665
|
return e.setDRACOLoader(wo()), e.setMeshoptDecoder(ss), a?.renderer?.capabilities != null && typeof a.renderer.getContext == "function" && e.setKTX2Loader(xo(a.renderer)), e;
|
|
2666
2666
|
}
|
|
2667
2667
|
function Tn() {
|
|
@@ -2688,7 +2688,7 @@ async function ze(a, e, t) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
function Eo(a, e) {
|
|
2690
2690
|
return new Promise((t, i) => {
|
|
2691
|
-
|
|
2691
|
+
_t(a, (n) => {
|
|
2692
2692
|
if (n == null) {
|
|
2693
2693
|
i(new Error(`[loadLightModel] empty zip json: ${a}`));
|
|
2694
2694
|
return;
|
|
@@ -2706,19 +2706,19 @@ async function Po(a, e) {
|
|
|
2706
2706
|
url: a
|
|
2707
2707
|
});
|
|
2708
2708
|
let i = t.data;
|
|
2709
|
-
return
|
|
2709
|
+
return Ci.isEncrypted(t.data) && (i = await Ci.decryptPzEnc(t.data, e)), Yt.loadAsync(i);
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2711
|
+
function Ri(a) {
|
|
2712
2712
|
return a.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
2713
2713
|
}
|
|
2714
2714
|
function Dn(a, e) {
|
|
2715
|
-
const t = new Set(e.map((i) =>
|
|
2715
|
+
const t = new Set(e.map((i) => Ri(i)));
|
|
2716
2716
|
for (const i of Object.keys(a.files))
|
|
2717
|
-
if (t.has(
|
|
2717
|
+
if (t.has(Ri(i)))
|
|
2718
2718
|
return a.files[i];
|
|
2719
2719
|
return null;
|
|
2720
2720
|
}
|
|
2721
|
-
function
|
|
2721
|
+
function Fi(a, e) {
|
|
2722
2722
|
const t = Dn(a, e);
|
|
2723
2723
|
return t == null || t.dir ? Promise.resolve(null) : t.async("string");
|
|
2724
2724
|
}
|
|
@@ -2734,22 +2734,22 @@ function _o(a, e) {
|
|
|
2734
2734
|
}
|
|
2735
2735
|
function To(a, e) {
|
|
2736
2736
|
return new Promise((t, i) => {
|
|
2737
|
-
bo(a).parse(e,
|
|
2737
|
+
bo(a).parse(e, Is(import.meta.url), t, i);
|
|
2738
2738
|
});
|
|
2739
2739
|
}
|
|
2740
|
-
function
|
|
2740
|
+
function Xe(a, e) {
|
|
2741
2741
|
const t = a.models.find((i) => i.url == e);
|
|
2742
|
-
return t != null && t.group == null && (t.group =
|
|
2742
|
+
return t != null && t.group == null && (t.group = Ne(a, e) ?? Ye(a, e)), t;
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2745
|
-
const t =
|
|
2744
|
+
function Ln(a, e) {
|
|
2745
|
+
const t = Xe(a, e);
|
|
2746
2746
|
return Array.isArray(t?.lods) ? t.lods : [];
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2748
|
+
function In(a) {
|
|
2749
2749
|
a.loadStatus == null && (a.loadStatus = {}), a.loadStatus.modelMep == null && (a.loadStatus.modelMep = !1), a.loadStatus.normal == null && (a.loadStatus.normal = !1);
|
|
2750
2750
|
}
|
|
2751
2751
|
function Do(a) {
|
|
2752
|
-
return
|
|
2752
|
+
return In(a), a.status === "loaded" && a.loadStatus.normal === !0 && a.loadStatus.modelMep === !0;
|
|
2753
2753
|
}
|
|
2754
2754
|
function kn(a) {
|
|
2755
2755
|
const e = a?.engineStatus?.models;
|
|
@@ -2758,17 +2758,17 @@ function kn(a) {
|
|
|
2758
2758
|
function zn(a) {
|
|
2759
2759
|
return a === !0 || a === "loading";
|
|
2760
2760
|
}
|
|
2761
|
-
function
|
|
2761
|
+
function Oi(a) {
|
|
2762
2762
|
return a.index != null ? a.index.count : a.attributes.position?.count ?? 0;
|
|
2763
2763
|
}
|
|
2764
|
-
async function
|
|
2764
|
+
async function Lo(a, e, t) {
|
|
2765
2765
|
let i = performance.now();
|
|
2766
2766
|
for (let n = 0; n < e.length; n++) {
|
|
2767
2767
|
const s = e[n];
|
|
2768
2768
|
s?.geometry != null && s.geometry.computeVertexNormals, (n + 1) % go === 0 && (i = await ze(a, t, i));
|
|
2769
2769
|
}
|
|
2770
2770
|
}
|
|
2771
|
-
async function
|
|
2771
|
+
async function Io(a, e, t) {
|
|
2772
2772
|
const i = [], n = [{ node: e.octreeBox, visited: !1 }];
|
|
2773
2773
|
let s = performance.now();
|
|
2774
2774
|
for (; n.length > 0; ) {
|
|
@@ -2790,10 +2790,10 @@ async function Lo(a, e, t) {
|
|
|
2790
2790
|
return i;
|
|
2791
2791
|
}
|
|
2792
2792
|
async function ko(a, e, t, i) {
|
|
2793
|
-
const n =
|
|
2793
|
+
const n = Xe(a, e.url);
|
|
2794
2794
|
if (n?.nodesMap == null)
|
|
2795
2795
|
return [];
|
|
2796
|
-
const s = await
|
|
2796
|
+
const s = await Io(a, t, i);
|
|
2797
2797
|
console.log("[loadLightModel] pending mesh ids", t.path, s.length);
|
|
2798
2798
|
const o = [];
|
|
2799
2799
|
let r = performance.now(), l = 0;
|
|
@@ -2805,7 +2805,7 @@ async function ko(a, e, t, i) {
|
|
|
2805
2805
|
const m = t.glbs?.[g.glb]?.[g.mesh];
|
|
2806
2806
|
if (m?.geometry == null || m.material == null)
|
|
2807
2807
|
continue;
|
|
2808
|
-
const w = new
|
|
2808
|
+
const w = new G();
|
|
2809
2809
|
w.elements = g.matrix;
|
|
2810
2810
|
const v = m.geometry.clone();
|
|
2811
2811
|
v.applyMatrix4(w), v.computeBoundingBox(), v.attributes.position.count > 2e4 && po(v, {
|
|
@@ -2822,29 +2822,29 @@ function Bn(a) {
|
|
|
2822
2822
|
return e.clippingPlanes = a.clippingPlanes, e;
|
|
2823
2823
|
}
|
|
2824
2824
|
function zo(a) {
|
|
2825
|
-
a.setRGB(a.r, a.g, a.b,
|
|
2825
|
+
a.setRGB(a.r, a.g, a.b, Ke);
|
|
2826
2826
|
}
|
|
2827
2827
|
function Bo(a) {
|
|
2828
2828
|
const e = a;
|
|
2829
2829
|
e.color == null || a.userData.__displayColorLinearized === !0 || (zo(e.color), a.userData.__displayColorLinearized = !0);
|
|
2830
2830
|
}
|
|
2831
2831
|
function Ro(a, e, t, i, n) {
|
|
2832
|
-
const s =
|
|
2832
|
+
const s = ot(
|
|
2833
2833
|
i.map((u) => u.geometry),
|
|
2834
2834
|
!1
|
|
2835
2835
|
), o = Bn(n), r = new O(s, o);
|
|
2836
|
-
r.castShadow = !0, r.receiveShadow = !0,
|
|
2837
|
-
const c =
|
|
2838
|
-
return
|
|
2836
|
+
r.castShadow = !0, r.receiveShadow = !0, Ye(e, a).add(r);
|
|
2837
|
+
const c = pi(e, r);
|
|
2838
|
+
return mi(r, c), r.url = a, r.glb = t, r.materialClone = o, r.geometrys = i.map((u) => u.geometry), r.geometry.computeVertexNormals(), r;
|
|
2839
2839
|
}
|
|
2840
2840
|
function Fo(a, e, t, i) {
|
|
2841
|
-
return (
|
|
2841
|
+
return (Ne(a, e)?.children ?? a.scene.children).find((o) => {
|
|
2842
2842
|
const r = o;
|
|
2843
2843
|
return o instanceof O && r.url == e && r.glb == t && r.materialClone === i;
|
|
2844
2844
|
});
|
|
2845
2845
|
}
|
|
2846
2846
|
function Oo(a, e) {
|
|
2847
|
-
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s =
|
|
2847
|
+
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s = ot(n, !1);
|
|
2848
2848
|
a.geometry != null && a.geometry.dispose(), a.geometry = s, a.geometrys = n, a.castShadow = !0, a.receiveShadow = !0;
|
|
2849
2849
|
}
|
|
2850
2850
|
async function No(a, e, t, i) {
|
|
@@ -2853,7 +2853,7 @@ async function No(a, e, t, i) {
|
|
|
2853
2853
|
const l = n.get(r.glb) ?? [];
|
|
2854
2854
|
l.push(r), n.set(r.glb, l);
|
|
2855
2855
|
}
|
|
2856
|
-
const s =
|
|
2856
|
+
const s = Xe(e, a);
|
|
2857
2857
|
let o = performance.now();
|
|
2858
2858
|
for (const [r, l] of n.entries()) {
|
|
2859
2859
|
const c = i ? l.length : yo;
|
|
@@ -2863,11 +2863,11 @@ async function No(a, e, t, i) {
|
|
|
2863
2863
|
continue;
|
|
2864
2864
|
const g = $o(d[0].material, e);
|
|
2865
2865
|
let m = Fo(e, a, r, g), w = 0, v = 0;
|
|
2866
|
-
m = null, m != null ? (w = Array.isArray(m.geometrys) ? m.geometrys.length : 0, v =
|
|
2866
|
+
m = null, m != null ? (w = Array.isArray(m.geometrys) ? m.geometrys.length : 0, v = Oi(m.geometry), Oo(m, d)) : m = Ro(a, e, r, d, g);
|
|
2867
2867
|
const b = /* @__PURE__ */ new Map();
|
|
2868
2868
|
let p = v;
|
|
2869
2869
|
d.forEach((x, C) => {
|
|
2870
|
-
const _ = Number(x.name), E =
|
|
2870
|
+
const _ = Number(x.name), E = Oi(x.geometry), k = b.get(_) ?? [];
|
|
2871
2871
|
if (k.push([p, p + E]), b.set(_, k), s?.nodesMap?.has(_)) {
|
|
2872
2872
|
const B = s.nodesMap.get(_);
|
|
2873
2873
|
B.indexes == null && (B.indexes = []), B.indexes.push([m.index, w + C, p, p + E]);
|
|
@@ -2887,13 +2887,13 @@ function Ho(a, e) {
|
|
|
2887
2887
|
async function Vo(a, e, t, i, n, s) {
|
|
2888
2888
|
if (i == null || n == null || n.length === 0)
|
|
2889
2889
|
return;
|
|
2890
|
-
const o =
|
|
2890
|
+
const o = Xe(t, a);
|
|
2891
2891
|
if (o == null)
|
|
2892
2892
|
return;
|
|
2893
2893
|
const r = new X(i.geometry, Bn(i.material), n.length);
|
|
2894
|
-
|
|
2895
|
-
const c =
|
|
2896
|
-
|
|
2894
|
+
Ye(t, a).add(r);
|
|
2895
|
+
const c = pi(t, r);
|
|
2896
|
+
mi(r, c);
|
|
2897
2897
|
const u = new Float32Array(n.length * 3);
|
|
2898
2898
|
for (let m = 0; m < n.length; m++)
|
|
2899
2899
|
u[m * 3] = 1, u[m * 3 + 1] = 1, u[m * 3 + 2] = 1;
|
|
@@ -2901,7 +2901,7 @@ async function Vo(a, e, t, i, n, s) {
|
|
|
2901
2901
|
let d = performance.now();
|
|
2902
2902
|
const g = [];
|
|
2903
2903
|
for (let m = 0; m < n.length; m++) {
|
|
2904
|
-
const w = n[m], v = new
|
|
2904
|
+
const w = n[m], v = new G();
|
|
2905
2905
|
v.elements = w.matrix;
|
|
2906
2906
|
const b = Ho(i, v);
|
|
2907
2907
|
if (b != null && (w.box = b.clone()), r.setMatrixAt(m, v), r.matrixs || (r.matrixs = []), r.matrixs.push(v.clone()), g.push(v.clone()), o.nodesMap.has(w.id)) {
|
|
@@ -2950,13 +2950,13 @@ async function Wo(a, e, t, i) {
|
|
|
2950
2950
|
t.preparePromise = (async () => {
|
|
2951
2951
|
console.log("[loadLightModel] loading GLB bundle", t.path), t.glbs = t.glbs ?? {};
|
|
2952
2952
|
const n = e.url + t.path;
|
|
2953
|
-
|
|
2953
|
+
Dt(a, e.url, n), console.log(`[loadLightModel] ZIP 解压开始 ${Date.now() - window.startTime}ms`);
|
|
2954
2954
|
const s = await Po(n, e.key);
|
|
2955
2955
|
console.log(`[loadLightModel] ZIP 解压完成 ${Date.now() - window.startTime}ms`);
|
|
2956
|
-
const o = await
|
|
2956
|
+
const o = await Fi(s, ["/nodes.json", "nodes.json"]);
|
|
2957
2957
|
if (o == null)
|
|
2958
2958
|
return;
|
|
2959
|
-
const r = Zt(o), l =
|
|
2959
|
+
const r = Zt(o), l = Xe(a, e.url);
|
|
2960
2960
|
if (l == null)
|
|
2961
2961
|
return;
|
|
2962
2962
|
l.nodesMap == null && (l.nodesMap = /* @__PURE__ */ new Map());
|
|
@@ -2991,7 +2991,7 @@ async function Wo(a, e, t, i) {
|
|
|
2991
2991
|
const p = await To(a, b);
|
|
2992
2992
|
b = null, t.glbs[v] = p.scene.children, t.glbs[v].forEach((x) => {
|
|
2993
2993
|
x.matrixWorld;
|
|
2994
|
-
}), await
|
|
2994
|
+
}), await Lo(a, t.glbs[v], i);
|
|
2995
2995
|
} catch (p) {
|
|
2996
2996
|
console.error("[loadLightModel] failed to load glb", {
|
|
2997
2997
|
modelUrl: e.url,
|
|
@@ -3013,7 +3013,7 @@ async function Wo(a, e, t, i) {
|
|
|
3013
3013
|
await d(v);
|
|
3014
3014
|
}
|
|
3015
3015
|
})), console.log(`[loadLightModel] 所有 GLB 加载完成 ${Date.now() - window.startTime}ms`);
|
|
3016
|
-
const w = await
|
|
3016
|
+
const w = await Fi(s, ["/instances.json", "instances.json"]);
|
|
3017
3017
|
t.instanceNodes = w != null ? Zt(w) : null, t.loadSuccess = !0;
|
|
3018
3018
|
})().finally(() => {
|
|
3019
3019
|
t.preparePromise = null;
|
|
@@ -3042,7 +3042,7 @@ async function jo(a, e, t, i) {
|
|
|
3042
3042
|
function Ko(a, e, t) {
|
|
3043
3043
|
if (zn(e.loadStatus.modelMep))
|
|
3044
3044
|
return;
|
|
3045
|
-
const i =
|
|
3045
|
+
const i = Xe(a, e.url);
|
|
3046
3046
|
if (i == null)
|
|
3047
3047
|
return;
|
|
3048
3048
|
e.loadStatus.modelMep = "loading", i.modelMep == null && (i.modelMep = {}), (async () => {
|
|
@@ -3052,7 +3052,7 @@ function Ko(a, e, t) {
|
|
|
3052
3052
|
});
|
|
3053
3053
|
}
|
|
3054
3054
|
function Yo(a, e, t, i) {
|
|
3055
|
-
const n =
|
|
3055
|
+
const n = Ye(a, e);
|
|
3056
3056
|
a.models || (a.models = []), window.startTime = Date.now();
|
|
3057
3057
|
let s = "WDDsBNtzVz6aSh/bCFh3CmjjANEDRryoXF1XCJvJjeE=";
|
|
3058
3058
|
Eo(e + "/info", s).then((o) => {
|
|
@@ -3097,25 +3097,25 @@ function Yo(a, e, t, i) {
|
|
|
3097
3097
|
async function Rn(a, e, t = !1) {
|
|
3098
3098
|
const i = a.engineStatus.models.filter((n) => e == null || n.url == e);
|
|
3099
3099
|
for (const n of i)
|
|
3100
|
-
if (
|
|
3100
|
+
if (In(n), !(n.status !== "loading" || n.type !== "light") && (Ko(a, n, t), !zn(n.loadStatus.normal))) {
|
|
3101
3101
|
n.loadStatus.normal = "loading";
|
|
3102
3102
|
try {
|
|
3103
3103
|
await Xo(a, n, t);
|
|
3104
3104
|
} finally {
|
|
3105
|
-
const s =
|
|
3105
|
+
const s = Ln(a, n.url), o = s.length > 0 && s.every((r) => r.status === !0);
|
|
3106
3106
|
n.loadStatus.normal = o, o && (n.status = "loaded"), kn(a);
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
3109
|
}
|
|
3110
3110
|
async function Xo(a, e, t = !1) {
|
|
3111
3111
|
console.log(`[loadLightModel] start loadNode ${Date.now() - window.startTime}ms`);
|
|
3112
|
-
const i =
|
|
3112
|
+
const i = Ln(a, e.url);
|
|
3113
3113
|
if (i.length !== 0)
|
|
3114
3114
|
for (const n of i)
|
|
3115
3115
|
await jo(a, e, n, t);
|
|
3116
3116
|
}
|
|
3117
3117
|
function $o(a, e) {
|
|
3118
|
-
return Bo(a), a.map != null && (a.map.colorSpace =
|
|
3118
|
+
return Bo(a), a.map != null && (a.map.colorSpace = Ke, a.map.needsUpdate = !0), a.side = ge, a.shadowSide = ge, a.clipShadows = !0, e?.sectionPlane && (a.clippingPlanes = e.sectionPlane), a;
|
|
3119
3119
|
}
|
|
3120
3120
|
const Zo = "/__local_model__", Jo = /^(info|property|edge|lod\d+)(?:\.zip)?$/i, Qo = /^(info|property|edge|lod\d+)(?:~)?$/i;
|
|
3121
3121
|
class Ce {
|
|
@@ -3169,13 +3169,13 @@ class Ce {
|
|
|
3169
3169
|
for (const l of t) {
|
|
3170
3170
|
const c = this.parseDirectPackageEntry(l.path);
|
|
3171
3171
|
if (c != null) {
|
|
3172
|
-
|
|
3172
|
+
Hi(i, c.modelKey).set(c.packageName, l.blob);
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
3175
|
const u = this.parseExtractedPackageEntry(l.path);
|
|
3176
3176
|
if (u == null)
|
|
3177
3177
|
continue;
|
|
3178
|
-
const d =
|
|
3178
|
+
const d = Hi(n, u.modelKey), g = d.get(u.packageName) ?? [];
|
|
3179
3179
|
g.push({
|
|
3180
3180
|
path: u.innerPath,
|
|
3181
3181
|
blob: l.blob
|
|
@@ -3212,13 +3212,13 @@ class Ce {
|
|
|
3212
3212
|
async collectSourceEntries(e) {
|
|
3213
3213
|
const t = [];
|
|
3214
3214
|
for (const i of e) {
|
|
3215
|
-
const n = Pe(i.webkitRelativePath || i.name), s =
|
|
3216
|
-
if (
|
|
3215
|
+
const n = Pe(i.webkitRelativePath || i.name), s = Nt(n);
|
|
3216
|
+
if (Ni(s)) {
|
|
3217
3217
|
t.push({ path: n, blob: i });
|
|
3218
3218
|
continue;
|
|
3219
3219
|
}
|
|
3220
3220
|
if (await nr(i)) {
|
|
3221
|
-
const o = await Yt.loadAsync(i), r =
|
|
3221
|
+
const o = await Yt.loadAsync(i), r = Ht(n), l = Object.values(o.files);
|
|
3222
3222
|
for (const c of l)
|
|
3223
3223
|
c.dir || t.push({
|
|
3224
3224
|
path: er(r, Pe(c.name)),
|
|
@@ -3234,8 +3234,8 @@ class Ce {
|
|
|
3234
3234
|
* 识别已经打好的模型包文件,例如 `info`、`lod0.zip`。
|
|
3235
3235
|
*/
|
|
3236
3236
|
parseDirectPackageEntry(e) {
|
|
3237
|
-
const t =
|
|
3238
|
-
return
|
|
3237
|
+
const t = Ht(e), i = Nt(e);
|
|
3238
|
+
return Ni(i) ? {
|
|
3239
3239
|
modelKey: t,
|
|
3240
3240
|
packageName: tr(i)
|
|
3241
3241
|
} : null;
|
|
@@ -3257,9 +3257,9 @@ class Ce {
|
|
|
3257
3257
|
innerPath: o.join("/")
|
|
3258
3258
|
};
|
|
3259
3259
|
}
|
|
3260
|
-
const i =
|
|
3260
|
+
const i = Nt(e).toLowerCase();
|
|
3261
3261
|
return i === "info.json" || i === "property.json" || i === "edge.json" ? {
|
|
3262
|
-
modelKey:
|
|
3262
|
+
modelKey: Ht(e),
|
|
3263
3263
|
packageName: i.replace(".json", ""),
|
|
3264
3264
|
innerPath: i
|
|
3265
3265
|
} : null;
|
|
@@ -3313,18 +3313,18 @@ class Ce {
|
|
|
3313
3313
|
function Pe(a) {
|
|
3314
3314
|
return a.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
3315
3315
|
}
|
|
3316
|
-
function
|
|
3316
|
+
function Nt(a) {
|
|
3317
3317
|
const e = Pe(a), t = e.lastIndexOf("/");
|
|
3318
3318
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
3319
3319
|
}
|
|
3320
|
-
function
|
|
3320
|
+
function Ht(a) {
|
|
3321
3321
|
const e = Pe(a), t = e.lastIndexOf("/");
|
|
3322
3322
|
return t >= 0 ? e.slice(0, t) : "";
|
|
3323
3323
|
}
|
|
3324
3324
|
function er(a, e) {
|
|
3325
3325
|
return Pe(a ? e ? `${a}/${e}` : a : e);
|
|
3326
3326
|
}
|
|
3327
|
-
function
|
|
3327
|
+
function Ni(a) {
|
|
3328
3328
|
return Jo.test(a);
|
|
3329
3329
|
}
|
|
3330
3330
|
function tr(a) {
|
|
@@ -3338,7 +3338,7 @@ async function nr(a) {
|
|
|
3338
3338
|
const e = await a.slice(0, 4).arrayBuffer(), t = new Uint8Array(e);
|
|
3339
3339
|
return t.length >= 4 && t[0] === 80 && t[1] === 75 && t[2] === 3 && t[3] === 4;
|
|
3340
3340
|
}
|
|
3341
|
-
function
|
|
3341
|
+
function Hi(a, e) {
|
|
3342
3342
|
let t = a.get(e);
|
|
3343
3343
|
return t == null && (t = /* @__PURE__ */ new Map(), a.set(e, t)), t;
|
|
3344
3344
|
}
|
|
@@ -3440,7 +3440,7 @@ class or {
|
|
|
3440
3440
|
});
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
|
-
const
|
|
3443
|
+
const it = 1, Vt = 20, rr = 1800, Vi = 1024, ar = 1.35, lr = 3, cr = 1200, Ut = 0.5, hr = 10, ur = 0.08, Gt = 500, Ui = 5e4, Gi = 120, dr = 5e4, Wi = 0.12, pr = 8, mr = 0.75, qi = 5e-5, gr = 15e-4, fr = 2.5, yr = 2.4, vr = 4.5, Mr = 0.94, wr = 0.995, xr = 80, br = 0.06, Cr = 8, Sr = new h(-1, 4, 2).normalize();
|
|
3444
3444
|
class Er {
|
|
3445
3445
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
3446
3446
|
engine;
|
|
@@ -3471,13 +3471,13 @@ class Er {
|
|
|
3471
3471
|
* 初始化场景基础光照,并把投影灯引用挂到 scene 上供后续更新使用。
|
|
3472
3472
|
*/
|
|
3473
3473
|
init() {
|
|
3474
|
-
const e = new
|
|
3475
|
-
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width =
|
|
3476
|
-
const t =
|
|
3477
|
-
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 =
|
|
3478
|
-
const i = new
|
|
3474
|
+
const e = new Ie(16774630, 5);
|
|
3475
|
+
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width = Vi, e.shadow.mapSize.height = Vi, e.shadow.camera.near = Ut, e.shadow.camera.far = Gt, e.shadow.bias = -qi, e.shadow.normalBias = Wi;
|
|
3476
|
+
const t = Vt;
|
|
3477
|
+
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 = it, e.target.name = "directionalShadowLightTarget";
|
|
3478
|
+
const i = new Ie(16777215, 0.5);
|
|
3479
3479
|
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;
|
|
3480
|
-
const n = new
|
|
3480
|
+
const n = new bt(16777215, 1);
|
|
3481
3481
|
this.engine.scene.add(n);
|
|
3482
3482
|
}
|
|
3483
3483
|
/**
|
|
@@ -3499,20 +3499,20 @@ class Er {
|
|
|
3499
3499
|
this.updateShadowCasterPolicy(n);
|
|
3500
3500
|
let s = 0, o = 0, r = null;
|
|
3501
3501
|
if (n) {
|
|
3502
|
-
const
|
|
3503
|
-
s = Math.max(
|
|
3502
|
+
const L = n.getSize(new h());
|
|
3503
|
+
s = Math.max(L.x, L.y, L.z) * 0.5, o = Math.max(L.length(), 1), r = n.getCenter(new h());
|
|
3504
3504
|
}
|
|
3505
3505
|
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l), u = this.getSceneShadowHalfSize(s, c), d = R.clamp(
|
|
3506
3506
|
Math.max(
|
|
3507
3507
|
c * ar,
|
|
3508
3508
|
u,
|
|
3509
|
-
|
|
3509
|
+
Vt
|
|
3510
3510
|
),
|
|
3511
|
-
|
|
3511
|
+
Vt,
|
|
3512
3512
|
rr
|
|
3513
3513
|
), g = R.clamp(
|
|
3514
|
-
Math.max(d * 2.5, o * 0.75,
|
|
3515
|
-
|
|
3514
|
+
Math.max(d * 2.5, o * 0.75, Gi),
|
|
3515
|
+
Gi,
|
|
3516
3516
|
dr
|
|
3517
3517
|
), m = this.getLightOffsetDirection(), w = this.snapShadowTargetToTexel(
|
|
3518
3518
|
l,
|
|
@@ -3559,13 +3559,13 @@ class Er {
|
|
|
3559
3559
|
const n = Math.max(e.shadow.mapSize.width, 1), s = t * 2 / n, o = Math.max(i.far - i.near, 1);
|
|
3560
3560
|
e.shadow.normalBias = R.clamp(
|
|
3561
3561
|
s * mr,
|
|
3562
|
-
|
|
3562
|
+
Wi,
|
|
3563
3563
|
pr
|
|
3564
3564
|
);
|
|
3565
3565
|
const r = s / o * fr;
|
|
3566
3566
|
e.shadow.bias = -R.clamp(
|
|
3567
3567
|
r,
|
|
3568
|
-
|
|
3568
|
+
qi,
|
|
3569
3569
|
gr
|
|
3570
3570
|
);
|
|
3571
3571
|
}
|
|
@@ -3591,20 +3591,20 @@ class Er {
|
|
|
3591
3591
|
const d = Math.max(
|
|
3592
3592
|
(u - c) * ur,
|
|
3593
3593
|
hr
|
|
3594
|
-
), g = Math.max(
|
|
3594
|
+
), g = Math.max(Ut, c - d), m = R.clamp(
|
|
3595
3595
|
Math.max(g + 1, u + d),
|
|
3596
3596
|
g + 1,
|
|
3597
|
-
|
|
3597
|
+
Ui
|
|
3598
3598
|
);
|
|
3599
3599
|
return { near: g, far: m };
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
3602
3602
|
const r = R.clamp(
|
|
3603
|
-
Math.max(n * 1.5, s * 4,
|
|
3604
|
-
|
|
3605
|
-
|
|
3603
|
+
Math.max(n * 1.5, s * 4, Gt),
|
|
3604
|
+
Gt,
|
|
3605
|
+
Ui
|
|
3606
3606
|
);
|
|
3607
|
-
return { near:
|
|
3607
|
+
return { near: Ut, far: r };
|
|
3608
3608
|
}
|
|
3609
3609
|
/**
|
|
3610
3610
|
* 获取包围盒 8 个顶点。
|
|
@@ -3633,8 +3633,8 @@ class Er {
|
|
|
3633
3633
|
if (!e)
|
|
3634
3634
|
return null;
|
|
3635
3635
|
const t = e.dirLightShadow ?? e.dirLightShodow;
|
|
3636
|
-
return t instanceof
|
|
3637
|
-
(i) => i instanceof
|
|
3636
|
+
return t instanceof Ie && t.castShadow ? t : e.children.find(
|
|
3637
|
+
(i) => i instanceof Ie && i.castShadow
|
|
3638
3638
|
) ?? null;
|
|
3639
3639
|
}
|
|
3640
3640
|
/**
|
|
@@ -3704,7 +3704,7 @@ class Er {
|
|
|
3704
3704
|
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);
|
|
3705
3705
|
return Math.max(s, n);
|
|
3706
3706
|
}
|
|
3707
|
-
if (e instanceof
|
|
3707
|
+
if (e instanceof st) {
|
|
3708
3708
|
const i = this.resolveShadowTarget(e, t), n = Math.max(e.position.distanceTo(i), 1), s = R.degToRad(e.getEffectiveFOV() * 0.5), o = Math.max(Math.tan(s) * n, 1), r = o * Math.max(e.aspect, 1e-6);
|
|
3709
3709
|
return Math.min(Math.max(r, o), cr);
|
|
3710
3710
|
}
|
|
@@ -3760,7 +3760,7 @@ class Er {
|
|
|
3760
3760
|
wr
|
|
3761
3761
|
);
|
|
3762
3762
|
}
|
|
3763
|
-
return
|
|
3763
|
+
return it * Math.min(o, r);
|
|
3764
3764
|
}
|
|
3765
3765
|
/**
|
|
3766
3766
|
* 把阴影 target 对齐到阴影贴图 texel 网格。
|
|
@@ -3830,11 +3830,11 @@ class Pr {
|
|
|
3830
3830
|
timeOutEvent;
|
|
3831
3831
|
selectionBox = null;
|
|
3832
3832
|
isBoxSelecting = !1;
|
|
3833
|
-
selectionStart = new
|
|
3834
|
-
selectionEnd = new
|
|
3833
|
+
selectionStart = new H();
|
|
3834
|
+
selectionEnd = new H();
|
|
3835
3835
|
suppressClickOnce = !1;
|
|
3836
3836
|
selectionThreshold = 5;
|
|
3837
|
-
tempInstanceMatrix = new
|
|
3837
|
+
tempInstanceMatrix = new G();
|
|
3838
3838
|
tempScale = new h();
|
|
3839
3839
|
constructor(e) {
|
|
3840
3840
|
this.engine = e;
|
|
@@ -4134,7 +4134,7 @@ class Pr {
|
|
|
4134
4134
|
}
|
|
4135
4135
|
getNodeWorldBox(e, t) {
|
|
4136
4136
|
if (Array.isArray(t?.infos) && t.infos.length > 0) {
|
|
4137
|
-
const i =
|
|
4137
|
+
const i = He(this.engine, e.url), n = t.infos.map((s) => s?.box).filter((s) => s instanceof Y).map((s) => s.clone().applyMatrix4(i));
|
|
4138
4138
|
return this.getMergedBox(n);
|
|
4139
4139
|
}
|
|
4140
4140
|
if (Array.isArray(t?.indexes) && t.indexes.length > 0) {
|
|
@@ -4258,7 +4258,7 @@ class Ar {
|
|
|
4258
4258
|
if (e.isSplit || e instanceof X)
|
|
4259
4259
|
return;
|
|
4260
4260
|
e.geometry != null && (e.__mergedGeometryBackup = e.geometry);
|
|
4261
|
-
let t = e.material, i =
|
|
4261
|
+
let t = e.material, i = ot(e.geometrys, !0);
|
|
4262
4262
|
i.computeVertexNormals(), i.groups.forEach((n) => {
|
|
4263
4263
|
n.materialIndex = 0;
|
|
4264
4264
|
}), e.geometry = i, e.material = [t, this.highlightMaterial, this.translucentMaterial], e.needsUpdate = !0, e.isSplit = !0;
|
|
@@ -4275,7 +4275,7 @@ class Ar {
|
|
|
4275
4275
|
}
|
|
4276
4276
|
if (!Array.isArray(e.geometrys) || e.geometrys.length === 0)
|
|
4277
4277
|
return;
|
|
4278
|
-
const i = e.geometry, n =
|
|
4278
|
+
const i = e.geometry, n = ot(e.geometrys, !1);
|
|
4279
4279
|
n != null && (n.computeVertexNormals(), e.geometry = n, e.material = e.material[0], e.needsUpdate = !0, e.isSplit = !1, i && i !== n && typeof i.dispose == "function" && i.dispose(), console.log("merge"));
|
|
4280
4280
|
}
|
|
4281
4281
|
shouldKeepSplitState(e) {
|
|
@@ -4303,7 +4303,7 @@ class Ar {
|
|
|
4303
4303
|
restoreSplitModelsOnIdle() {
|
|
4304
4304
|
if (!this.engine?.scene)
|
|
4305
4305
|
return;
|
|
4306
|
-
|
|
4306
|
+
ui(this.engine, (t) => t instanceof O && !(t instanceof X)).forEach((t) => {
|
|
4307
4307
|
t instanceof O && (t.isSplit === !0 && (t.visible = !this.areAllGroupsHidden(t)), t.isSplit === !0 && this.un_split_merge_model(t));
|
|
4308
4308
|
});
|
|
4309
4309
|
}
|
|
@@ -4323,7 +4323,7 @@ class Ar {
|
|
|
4323
4323
|
const s = this.getEngineModelByUrl(n.url);
|
|
4324
4324
|
if (s?.nodesMap == null)
|
|
4325
4325
|
return;
|
|
4326
|
-
const o =
|
|
4326
|
+
const o = He(this.engine, n.url);
|
|
4327
4327
|
n.ids.forEach((r) => {
|
|
4328
4328
|
const l = s.nodesMap.get(r);
|
|
4329
4329
|
[
|
|
@@ -4396,7 +4396,7 @@ class Ar {
|
|
|
4396
4396
|
const l = this.getSceneModel(r[0]);
|
|
4397
4397
|
l instanceof X ? n.has(r[0]) ? n.get(r[0])?.push(r[1]) : n.set(r[0], [r[1]]) : l.geometry.groups.length != 0 && (l.geometry.groups[r[1]].materialIndex = this.getCustomSimpleMaterialIndex(r[0], r[1]) ?? 0);
|
|
4398
4398
|
});
|
|
4399
|
-
}),
|
|
4399
|
+
}), ji(n, this.engine, "highlightModel");
|
|
4400
4400
|
}), this.updateMaterial(), this.syncHighlightModelEdges(this.getHighlightModelsAfterRemove(e));
|
|
4401
4401
|
}
|
|
4402
4402
|
// 取消所有模型高亮
|
|
@@ -4441,7 +4441,7 @@ class Ar {
|
|
|
4441
4441
|
const u = this.getSceneModel(c[0]);
|
|
4442
4442
|
u instanceof X ? s.has(c[0]) ? s.get(c[0])?.push(c[1]) : s.set(c[0], [c[1]]) : (u.visible = !0, u.geometry.groups[c[1]].materialIndex = this.getCustomSimpleMaterialIndex(c[0], c[1]) ?? 0, u.geometry.groups[c[1]].visible = !0);
|
|
4443
4443
|
});
|
|
4444
|
-
}), s.size > 0 &&
|
|
4444
|
+
}), s.size > 0 && Ki(s, this.engine), t)
|
|
4445
4445
|
return;
|
|
4446
4446
|
let o = this.engine.engineStatus.hideModels.find((r) => r.url == i.url);
|
|
4447
4447
|
o && (i.ids.forEach((r) => {
|
|
@@ -4664,14 +4664,14 @@ class Ar {
|
|
|
4664
4664
|
return e.__customColorMaterialIndexes.set(n, l), l;
|
|
4665
4665
|
}
|
|
4666
4666
|
hideOriginalInstance(e, t) {
|
|
4667
|
-
const i = new
|
|
4667
|
+
const i = new G();
|
|
4668
4668
|
i.makeScale(0, 0, 0), e.setMatrixAt(t, i), e.instanceMatrix.needsUpdate = !0;
|
|
4669
4669
|
}
|
|
4670
4670
|
getOriginalInstanceMatrix(e, t) {
|
|
4671
4671
|
const i = e.matrixs?.[t] ?? e.matrixsClone?.[t];
|
|
4672
|
-
if (i instanceof
|
|
4672
|
+
if (i instanceof G)
|
|
4673
4673
|
return i.clone();
|
|
4674
|
-
const n = new
|
|
4674
|
+
const n = new G();
|
|
4675
4675
|
return e.getMatrixAt(t, n), n;
|
|
4676
4676
|
}
|
|
4677
4677
|
isModelHighlighted(e, t) {
|
|
@@ -4753,7 +4753,7 @@ class Ar {
|
|
|
4753
4753
|
const l = this.getSceneModel(r[0]);
|
|
4754
4754
|
l instanceof X ? n.has(r[0]) ? n.get(r[0])?.push(r[1]) : n.set(r[0], [r[1]]) : (this.split_merge_model(l), l.geometry.groups[r[1]].materialIndex = this.getCustomSimpleMaterialIndex(r[0], r[1]) ?? 0);
|
|
4755
4755
|
});
|
|
4756
|
-
}), n.size > 0 &&
|
|
4756
|
+
}), n.size > 0 && Ki(n, this.engine), ji(n, this.engine, "translucentModel");
|
|
4757
4757
|
}), this.engine.engineStatus.translucentModels = [];
|
|
4758
4758
|
}
|
|
4759
4759
|
// ***************************************************** 设置模型半透明 ***************************************************** //
|
|
@@ -4803,7 +4803,7 @@ class Ar {
|
|
|
4803
4803
|
}
|
|
4804
4804
|
function _r(a, e) {
|
|
4805
4805
|
a.forEach((t, i) => {
|
|
4806
|
-
const n =
|
|
4806
|
+
const n = ht(e, i);
|
|
4807
4807
|
if (!(n instanceof X))
|
|
4808
4808
|
return;
|
|
4809
4809
|
const s = n.geometry, o = new me({
|
|
@@ -4825,24 +4825,24 @@ function _r(a, e) {
|
|
|
4825
4825
|
r.name = "highlightModel", r.key = i, r.ids = [], r.matrixs = [], r.url = n.url, t.forEach((d) => {
|
|
4826
4826
|
r.ids.push(n.ids[d]), r.matrixs.push(n.matrixs[d]);
|
|
4827
4827
|
});
|
|
4828
|
-
const l = /* @__PURE__ */ new Map(), c = new
|
|
4828
|
+
const l = /* @__PURE__ */ new Map(), c = new G(), u = new G();
|
|
4829
4829
|
u.makeScale(0, 0, 0), t.forEach((d, g) => {
|
|
4830
|
-
const m =
|
|
4831
|
-
|
|
4830
|
+
const m = lt(e, i, d);
|
|
4831
|
+
ct(m, !1);
|
|
4832
4832
|
const w = m?.matrix ?? n.matrixs?.[d] ?? n.matrixsClone?.[d];
|
|
4833
|
-
w instanceof
|
|
4833
|
+
w instanceof G ? c.copy(w) : n.getMatrixAt(d, c), l.set(d, c.clone()), n.setMatrixAt(d, u), r.setMatrixAt(g, c);
|
|
4834
4834
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
4835
4835
|
});
|
|
4836
4836
|
}
|
|
4837
|
-
function
|
|
4837
|
+
function ji(a, e, t) {
|
|
4838
4838
|
a.forEach((i, n) => {
|
|
4839
|
-
const s =
|
|
4839
|
+
const s = ht(e, n);
|
|
4840
4840
|
if (!(s instanceof X))
|
|
4841
4841
|
return;
|
|
4842
4842
|
i.forEach((r) => {
|
|
4843
|
-
const l =
|
|
4843
|
+
const l = lt(e, n, r);
|
|
4844
4844
|
if (l != null) {
|
|
4845
|
-
s.setMatrixAt(r, new
|
|
4845
|
+
s.setMatrixAt(r, new G().makeScale(0, 0, 0)), ct(l, !0);
|
|
4846
4846
|
return;
|
|
4847
4847
|
}
|
|
4848
4848
|
const c = s.matrixsClone[r];
|
|
@@ -4858,7 +4858,7 @@ function qi(a, e, t) {
|
|
|
4858
4858
|
}
|
|
4859
4859
|
function Tr(a, e) {
|
|
4860
4860
|
a.forEach((t, i) => {
|
|
4861
|
-
const n =
|
|
4861
|
+
const n = ht(e, i);
|
|
4862
4862
|
if (!(n instanceof X))
|
|
4863
4863
|
return;
|
|
4864
4864
|
const s = n.geometry, o = new me({
|
|
@@ -4874,12 +4874,12 @@ function Tr(a, e) {
|
|
|
4874
4874
|
o.clippingPlanes = e.sectionPlane;
|
|
4875
4875
|
const r = new X(s, o, t.length);
|
|
4876
4876
|
r.name = "translucentModel", r.key = i;
|
|
4877
|
-
const l = /* @__PURE__ */ new Map(), c = new
|
|
4877
|
+
const l = /* @__PURE__ */ new Map(), c = new G(), u = new G();
|
|
4878
4878
|
u.makeScale(0, 0, 0), t.forEach((d, g) => {
|
|
4879
|
-
const m =
|
|
4880
|
-
|
|
4879
|
+
const m = lt(e, i, d);
|
|
4880
|
+
ct(m, !1);
|
|
4881
4881
|
const w = m?.matrix ?? n.matrixs?.[d] ?? n.matrixsClone?.[d];
|
|
4882
|
-
w instanceof
|
|
4882
|
+
w instanceof G ? c.copy(w) : n.getMatrixAt(d, c), l.set(d, c.clone()), n.setMatrixAt(d, u), r.setMatrixAt(g, c);
|
|
4883
4883
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
4884
4884
|
});
|
|
4885
4885
|
}
|
|
@@ -4890,25 +4890,25 @@ function Dr(a, e) {
|
|
|
4890
4890
|
}), t.forEach((i) => {
|
|
4891
4891
|
Fn(i);
|
|
4892
4892
|
}), a.forEach((i, n) => {
|
|
4893
|
-
const s =
|
|
4893
|
+
const s = ht(e, n);
|
|
4894
4894
|
if (!(s instanceof X))
|
|
4895
4895
|
return;
|
|
4896
|
-
const o = /* @__PURE__ */ new Map(), r = new
|
|
4896
|
+
const o = /* @__PURE__ */ new Map(), r = new G(), l = new G();
|
|
4897
4897
|
l.makeScale(0, 0, 0), i.forEach((c) => {
|
|
4898
|
-
const u =
|
|
4899
|
-
|
|
4898
|
+
const u = lt(e, n, c);
|
|
4899
|
+
ct(u, !1);
|
|
4900
4900
|
const d = u?.matrix ?? s.matrixs?.[c] ?? s.matrixsClone?.[c];
|
|
4901
|
-
d instanceof
|
|
4901
|
+
d instanceof G ? r.copy(d) : s.getMatrixAt(c, r), o.set(c, r.clone()), s.setMatrixAt(c, l);
|
|
4902
4902
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
4903
4903
|
});
|
|
4904
4904
|
}
|
|
4905
|
-
function
|
|
4905
|
+
function Ki(a, e) {
|
|
4906
4906
|
a.forEach((t, i) => {
|
|
4907
|
-
const n =
|
|
4907
|
+
const n = ht(e, i);
|
|
4908
4908
|
n instanceof X && (t.forEach((s) => {
|
|
4909
|
-
const o =
|
|
4909
|
+
const o = lt(e, i, s);
|
|
4910
4910
|
if (o != null) {
|
|
4911
|
-
n.setMatrixAt(s, new
|
|
4911
|
+
n.setMatrixAt(s, new G().makeScale(0, 0, 0)), ct(o, !0);
|
|
4912
4912
|
return;
|
|
4913
4913
|
}
|
|
4914
4914
|
const r = n.matrixs[s];
|
|
@@ -4916,11 +4916,11 @@ function ji(a, e) {
|
|
|
4916
4916
|
}), n.instanceMatrix.needsUpdate = !0);
|
|
4917
4917
|
});
|
|
4918
4918
|
}
|
|
4919
|
-
function
|
|
4919
|
+
function lt(a, e, t) {
|
|
4920
4920
|
const i = a?.modelToolModule?.customModelColorRecords;
|
|
4921
4921
|
return i instanceof Map ? Array.from(i.values()).find((n) => n?.type === "instance" && n.meshIndex === e && n.instanceIndex === t) ?? null : null;
|
|
4922
4922
|
}
|
|
4923
|
-
function
|
|
4923
|
+
function ct(a, e) {
|
|
4924
4924
|
a?.cloneModel != null && (a.cloneModel.visible = e);
|
|
4925
4925
|
}
|
|
4926
4926
|
function Fn(a) {
|
|
@@ -4929,11 +4929,11 @@ function Fn(a) {
|
|
|
4929
4929
|
const e = a.parent;
|
|
4930
4930
|
e?.remove(a), a.material?.dispose != null && a.material.dispose();
|
|
4931
4931
|
}
|
|
4932
|
-
function
|
|
4932
|
+
function ht(a, e) {
|
|
4933
4933
|
return It(a, e);
|
|
4934
4934
|
}
|
|
4935
4935
|
const On = "advanced";
|
|
4936
|
-
class
|
|
4936
|
+
class Lr {
|
|
4937
4937
|
engine;
|
|
4938
4938
|
currentMode = "";
|
|
4939
4939
|
// 是否为手动设置(手动设置时,自动适配不再生效)
|
|
@@ -5021,7 +5021,7 @@ class Ir {
|
|
|
5021
5021
|
setShadows(e) {
|
|
5022
5022
|
this.engine.renderer && (this.engine.renderer.shadowMap.enabled = e);
|
|
5023
5023
|
const t = this.engine.scene?.children.find(
|
|
5024
|
-
(i) => i instanceof
|
|
5024
|
+
(i) => i instanceof Ie
|
|
5025
5025
|
);
|
|
5026
5026
|
t && (t.castShadow = e), this.engine.scene?.traverse((i) => {
|
|
5027
5027
|
i.material && (i.castShadow !== void 0 && (i.castShadow = e), i.receiveShadow !== void 0 && (i.receiveShadow = e));
|
|
@@ -5088,7 +5088,7 @@ class Ir {
|
|
|
5088
5088
|
*/
|
|
5089
5089
|
setShadowQuality(e) {
|
|
5090
5090
|
const t = this.engine.scene?.children.find(
|
|
5091
|
-
(s) => s instanceof
|
|
5091
|
+
(s) => s instanceof Ie
|
|
5092
5092
|
), n = {
|
|
5093
5093
|
low: 1024,
|
|
5094
5094
|
medium: 2048,
|
|
@@ -5118,7 +5118,7 @@ class Ir {
|
|
|
5118
5118
|
this.gtaoPass && (this.gtaoPass.blendIntensity = e);
|
|
5119
5119
|
}
|
|
5120
5120
|
}
|
|
5121
|
-
class
|
|
5121
|
+
class Lt {
|
|
5122
5122
|
engine;
|
|
5123
5123
|
overlayMaterial;
|
|
5124
5124
|
overlayMeshes = [];
|
|
@@ -5196,10 +5196,10 @@ class Tt {
|
|
|
5196
5196
|
if (this.animState === "idle" || this.overlayMeshes.length === 0) return;
|
|
5197
5197
|
const e = performance.now() - this.animStartTime, t = this.overlayMaterial.userData.targetOpacity ?? 0.35;
|
|
5198
5198
|
if (this.animState === "fadeIn") {
|
|
5199
|
-
const i = Math.min(e /
|
|
5199
|
+
const i = Math.min(e / Lt.FADE_IN_MS, 1);
|
|
5200
5200
|
this.overlayMaterial.opacity = this.easeOutQuad(i) * t, i >= 1 && (this.animState = "idle");
|
|
5201
5201
|
} else if (this.animState === "fadeOut") {
|
|
5202
|
-
const i = Math.min(e /
|
|
5202
|
+
const i = Math.min(e / Lt.FADE_OUT_MS, 1);
|
|
5203
5203
|
this.overlayMaterial.opacity = (1 - this.easeOutQuad(i)) * t, i >= 1 && (this.removeOverlayMeshes(), this.animState = "idle");
|
|
5204
5204
|
}
|
|
5205
5205
|
}
|
|
@@ -5218,7 +5218,7 @@ class Tt {
|
|
|
5218
5218
|
this.removeOverlayMeshes(), this.overlayMaterial.dispose(), this.tagDiv?.remove?.(), this.tagDiv = null, this.animState = "idle";
|
|
5219
5219
|
}
|
|
5220
5220
|
}
|
|
5221
|
-
function
|
|
5221
|
+
function Ir() {
|
|
5222
5222
|
return new ni();
|
|
5223
5223
|
}
|
|
5224
5224
|
function kr(a, e) {
|
|
@@ -5229,7 +5229,7 @@ function zr(a, e, t) {
|
|
|
5229
5229
|
i.visible = !0;
|
|
5230
5230
|
let n = null, s = 0, o, r, l = [];
|
|
5231
5231
|
i.init = function() {
|
|
5232
|
-
o || (C(), _(),
|
|
5232
|
+
o || (C(), _(), V());
|
|
5233
5233
|
}, i.Hide = function() {
|
|
5234
5234
|
o.style.display = "none", i.visible = !1;
|
|
5235
5235
|
}, i.Show = function() {
|
|
@@ -5268,8 +5268,8 @@ function zr(a, e, t) {
|
|
|
5268
5268
|
return;
|
|
5269
5269
|
const P = y.target, T = P?.clone?.().sub(f.position), D = f.up.clone().normalize();
|
|
5270
5270
|
if (y._referenceUp?.copy && y._referenceUp.copy(D), T?.lengthSq?.() > 1e-6 && y._viewRight?.copy) {
|
|
5271
|
-
const
|
|
5272
|
-
|
|
5271
|
+
const I = new h().crossVectors(T.clone().normalize(), D);
|
|
5272
|
+
I.lengthSq() > 1e-6 ? y._viewRight.copy(I.normalize()) : y._viewRight.set(1, 0, 0).applyQuaternion(f.quaternion).normalize();
|
|
5273
5273
|
}
|
|
5274
5274
|
y._rotateVelocity?.set?.(0, 0), y._panVelocity?.set?.(0, 0), typeof y._zoomVelocity == "number" && (y._zoomVelocity = 0), y._mouseStart?.set?.(0, 0), y._touchCenter?.set?.(0, 0), typeof y._touchDistance == "number" && (y._touchDistance = 0), y._pointers?.clear?.(), y._isInteracting = !1, y.state = -1, y._lastPosition?.copy?.(f.position), y._lastTarget?.copy?.(P), y._lastUp?.copy?.(f.up), y._lastQuaternion?.copy?.(f.quaternion), typeof y._lastZoom == "number" && (y._lastZoom = f.zoom), y.saveState?.();
|
|
5275
5275
|
}
|
|
@@ -5285,7 +5285,7 @@ function zr(a, e, t) {
|
|
|
5285
5285
|
}, i.ToggleDirectionView = function(f) {
|
|
5286
5286
|
var y = new h(0, 0, 0), P = null;
|
|
5287
5287
|
f == "top" ? (y = new h(0, 1, 0), P = new h(0, 0, -1)) : f == "down" || f == "button" ? (y = new h(0, -1, 0), P = new h(0, 0, 1)) : f == "front" ? y = new h(0, 0, 1) : f == "left" ? y = new h(-1, 0, 0) : f == "back" ? y = new h(0, 0, -1) : f == "right" ? y = new h(1, 0, 0) : f == "top_front" ? y = new h(1, 1, 0) : f == "top_left" ? y = new h(0, 1, -1) : f == "top_back" ? y = new h(-1, 1, 0) : f == "top_right" ? y = new h(0, 1, 1) : f == "down_front" ? y = new h(1, -1, 0) : f == "down_left" ? y = new h(0, -1, -1) : f == "down_back" ? y = new h(-1, -1, 0) : f == "down_right" ? y = new h(0, -1, 1) : f == "front_right" ? y = new h(1, 0, 1) : f == "right_back" ? y = new h(-1, 0, 1) : f == "back_left" ? y = new h(-1, 0, -1) : f == "left_front" ? y = new h(1, 0, -1) : f == "top_left_front" ? y = new h(1, 1, -1) : f == "top_front_right" ? y = new h(1, 1, 1) : f == "top_right_back" ? y = new h(-1, 1, 1) : f == "top_back_left" ? y = new h(-1, 1, -1) : f == "button_left_front" ? y = new h(1, -1, -1) : f == "button_front_right" ? y = new h(1, -1, 1) : f == "button_right_back" ? y = new h(-1, 1, 1) : f == "button_back_left" && (y = new h(-1, -1, -1));
|
|
5288
|
-
var T = a.octreeBox.getBoundingBox(), D = T.min,
|
|
5288
|
+
var T = a.octreeBox.getBoundingBox(), D = T.min, I = T.max, F = D.clone().add(I.clone()).multiplyScalar(0.5), q = F.clone().add(y.multiplyScalar(1 * I.distanceTo(D)));
|
|
5289
5289
|
x(e.camera.position, q, a.controls.target.clone(), F, null, null, 1e3, null, P);
|
|
5290
5290
|
}, i.GetCameraPose = function() {
|
|
5291
5291
|
var f = e.camera.quaternion, y = e.camera.position, P = a.controls.target, T = {
|
|
@@ -5300,13 +5300,13 @@ function zr(a, e, t) {
|
|
|
5300
5300
|
f.quaternion._y,
|
|
5301
5301
|
f.quaternion._z,
|
|
5302
5302
|
f.quaternion._w
|
|
5303
|
-
), D = new h(f.position.x, f.position.y, f.position.z),
|
|
5303
|
+
), D = new h(f.position.x, f.position.y, f.position.z), I = new h(f.target.x, f.target.y, f.target.z);
|
|
5304
5304
|
let F = !1;
|
|
5305
5305
|
x(
|
|
5306
5306
|
e.camera.position,
|
|
5307
5307
|
D,
|
|
5308
5308
|
a.controls.target.clone(),
|
|
5309
|
-
|
|
5309
|
+
I,
|
|
5310
5310
|
e.camera.quaternion,
|
|
5311
5311
|
T,
|
|
5312
5312
|
y,
|
|
@@ -5319,24 +5319,24 @@ function zr(a, e, t) {
|
|
|
5319
5319
|
}, i.CameraGoHome = function(f = 1e3) {
|
|
5320
5320
|
const y = new h(0, 1, 0);
|
|
5321
5321
|
g(y), m(y);
|
|
5322
|
-
var P = a.octreeBox.getBoundingBox(), T = a.clipping?.getClippedBoundingBox?.(P), D = T && !T.isEmpty() ? T : P,
|
|
5322
|
+
var P = a.octreeBox.getBoundingBox(), T = a.clipping?.getClippedBoundingBox?.(P), D = T && !T.isEmpty() ? T : P, I = D.min.clone().add(D.max.clone()).multiplyScalar(0.5);
|
|
5323
5323
|
let F = new h(1, 1, 1);
|
|
5324
|
-
var q = P.max.distanceTo(P.min), ne = Math.max(q / 1e5, 0.01), Q = D.max.distanceTo(D.min), fe =
|
|
5324
|
+
var q = P.max.distanceTo(P.min), ne = Math.max(q / 1e5, 0.01), Q = D.max.distanceTo(D.min), fe = I.clone().add(F.multiplyScalar(Q * 0.8));
|
|
5325
5325
|
if (e.camera.isOrthographicCamera) {
|
|
5326
5326
|
var J = a.container.clientWidth / a.container.clientHeight, Ee = Q * 0.5;
|
|
5327
5327
|
e.camera.left = -Ee * J, e.camera.right = Ee * J, e.camera.top = Ee, e.camera.bottom = -Ee, e.camera.zoom = 1, e.camera.near = ne, e.camera.far = q * 3, e.camera.updateProjectionMatrix();
|
|
5328
5328
|
} else
|
|
5329
5329
|
e.camera.near = ne, e.camera.far = q * 10, e.camera.updateProjectionMatrix();
|
|
5330
|
-
a.controlModule.orbitControls.origin =
|
|
5330
|
+
a.controlModule.orbitControls.origin = I.clone(), x(
|
|
5331
5331
|
e.camera.position,
|
|
5332
5332
|
fe,
|
|
5333
5333
|
a.controls.target.clone(),
|
|
5334
|
-
|
|
5334
|
+
I,
|
|
5335
5335
|
null,
|
|
5336
5336
|
null,
|
|
5337
5337
|
f,
|
|
5338
5338
|
() => {
|
|
5339
|
-
g(y), m(y), e.camera.lookAt(
|
|
5339
|
+
g(y), m(y), e.camera.lookAt(I), e.camera.updateMatrix(), e.camera.updateMatrixWorld(!0), p(e.camera, a.controls), p(i.camera, i.orbitControls), i.RenderScene();
|
|
5340
5340
|
}
|
|
5341
5341
|
);
|
|
5342
5342
|
}, i.zoomToBox = function(f) {
|
|
@@ -5344,7 +5344,7 @@ function zr(a, e, t) {
|
|
|
5344
5344
|
let Re = function() {
|
|
5345
5345
|
n = requestAnimationFrame(Re), de.update();
|
|
5346
5346
|
};
|
|
5347
|
-
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5), P = e.camera.position.clone().sub(a.controls.target.clone()).normalize(), T = e.camera.position.distanceTo(a.controls.target), D = y.clone().add(P.multiplyScalar(T)),
|
|
5347
|
+
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5), P = e.camera.position.clone().sub(a.controls.target.clone()).normalize(), T = e.camera.position.distanceTo(a.controls.target), D = y.clone().add(P.multiplyScalar(T)), I = e.camera.zoom, F = new h(1, 0, 0).applyQuaternion(e.camera.quaternion), q = new h(0, 1, 0).applyQuaternion(e.camera.quaternion), ne = [
|
|
5348
5348
|
new h(f.min.x, f.min.y, f.min.z),
|
|
5349
5349
|
new h(f.max.x, f.min.y, f.min.z),
|
|
5350
5350
|
new h(f.min.x, f.max.y, f.min.z),
|
|
@@ -5354,19 +5354,19 @@ function zr(a, e, t) {
|
|
|
5354
5354
|
new h(f.min.x, f.max.y, f.max.z),
|
|
5355
5355
|
new h(f.max.x, f.max.y, f.max.z)
|
|
5356
5356
|
], Q = 1 / 0, fe = -1 / 0, J = 1 / 0, Ee = -1 / 0;
|
|
5357
|
-
for (var
|
|
5358
|
-
var Be =
|
|
5359
|
-
Q = Math.min(Q, Be), fe = Math.max(fe, Be), J = Math.min(J,
|
|
5357
|
+
for (var $e of ne) {
|
|
5358
|
+
var Be = $e.dot(F), Ze = $e.dot(q);
|
|
5359
|
+
Q = Math.min(Q, Be), fe = Math.max(fe, Be), J = Math.min(J, Ze), Ee = Math.max(Ee, Ze);
|
|
5360
5360
|
}
|
|
5361
5361
|
var M = (fe - Q) / 2, A = (Ee - J) / 2, z = (e.camera.right - e.camera.left) / 2, N = (e.camera.top - e.camera.bottom) / 2;
|
|
5362
|
-
|
|
5363
|
-
var
|
|
5364
|
-
x1:
|
|
5365
|
-
y1:
|
|
5366
|
-
z1:
|
|
5367
|
-
x2:
|
|
5368
|
-
y2:
|
|
5369
|
-
z2:
|
|
5362
|
+
I = Math.min(z / M, N / A) * 0.75;
|
|
5363
|
+
var U = e.camera.position.clone(), le = a.controls.target.clone(), ue = e.camera.zoom, de = new Je.Tween({
|
|
5364
|
+
x1: U.x,
|
|
5365
|
+
y1: U.y,
|
|
5366
|
+
z1: U.z,
|
|
5367
|
+
x2: le.x,
|
|
5368
|
+
y2: le.y,
|
|
5369
|
+
z2: le.z,
|
|
5370
5370
|
zoom: ue
|
|
5371
5371
|
}).to({
|
|
5372
5372
|
x1: D.x,
|
|
@@ -5375,7 +5375,7 @@ function zr(a, e, t) {
|
|
|
5375
5375
|
x2: y.x,
|
|
5376
5376
|
y2: y.y,
|
|
5377
5377
|
z2: y.z,
|
|
5378
|
-
zoom:
|
|
5378
|
+
zoom: I
|
|
5379
5379
|
}, 1e3);
|
|
5380
5380
|
de.onUpdate(function(te) {
|
|
5381
5381
|
a.controls && (e.camera.position.set(te.x1, te.y1, te.z1), a.controls.target.set(te.x2, te.y2, te.z2), e.camera.isOrthographicCamera && (e.camera.zoom = te.zoom, e.camera.updateProjectionMatrix()), a.controls.auto = !0, a.controls.update(), i.RenderScene());
|
|
@@ -5385,7 +5385,7 @@ function zr(a, e, t) {
|
|
|
5385
5385
|
return;
|
|
5386
5386
|
}
|
|
5387
5387
|
a.controls.auto = !1, i.RenderScene(), cancelAnimationFrame(n), n = null, u();
|
|
5388
|
-
}), de.easing(
|
|
5388
|
+
}), de.easing(Je.Easing.Cubic.InOut), c(), de.start(), Re();
|
|
5389
5389
|
} else {
|
|
5390
5390
|
var y = f.min.clone().add(f.max.clone()).multiplyScalar(0.5);
|
|
5391
5391
|
let _e = e.camera.position.clone().sub(a.controls.target.clone()).normalize();
|
|
@@ -5393,9 +5393,9 @@ function zr(a, e, t) {
|
|
|
5393
5393
|
x(e.camera.position, D, a.controls.target.clone(), y);
|
|
5394
5394
|
}
|
|
5395
5395
|
};
|
|
5396
|
-
function x(f, y, P, T, D,
|
|
5396
|
+
function x(f, y, P, T, D, I, F = 1e3, q, ne) {
|
|
5397
5397
|
var Q;
|
|
5398
|
-
D &&
|
|
5398
|
+
D && I ? (Q = new Je.Tween({
|
|
5399
5399
|
x1: f.x,
|
|
5400
5400
|
// 相机当前位置x
|
|
5401
5401
|
y1: f.y,
|
|
@@ -5430,17 +5430,17 @@ function zr(a, e, t) {
|
|
|
5430
5430
|
// 新的控制中心点位置x
|
|
5431
5431
|
z2: T.z,
|
|
5432
5432
|
// 新的控制中心点位置x
|
|
5433
|
-
_x:
|
|
5433
|
+
_x: I._x,
|
|
5434
5434
|
// 新的相机quaternion
|
|
5435
|
-
_y:
|
|
5435
|
+
_y: I._y,
|
|
5436
5436
|
// 新的相机quaternion
|
|
5437
|
-
_z:
|
|
5437
|
+
_z: I._z,
|
|
5438
5438
|
// 新的相机quaternion
|
|
5439
|
-
_w:
|
|
5439
|
+
_w: I._w
|
|
5440
5440
|
// 新的相机quaternion
|
|
5441
5441
|
},
|
|
5442
5442
|
F
|
|
5443
|
-
)) : (Q = new
|
|
5443
|
+
)) : (Q = new Je.Tween({
|
|
5444
5444
|
x1: f.x,
|
|
5445
5445
|
// 相机当前位置x
|
|
5446
5446
|
y1: f.y,
|
|
@@ -5470,7 +5470,7 @@ function zr(a, e, t) {
|
|
|
5470
5470
|
},
|
|
5471
5471
|
F
|
|
5472
5472
|
)), Q.onUpdate(function(J) {
|
|
5473
|
-
a.controls && (D &&
|
|
5473
|
+
a.controls && (D && I ? (e.camera.quaternion._x = J._x, e.camera.quaternion._y = J._y, e.camera.quaternion._z = J._z, e.camera.quaternion._w = J._w) : a.controls.auto = !0, e.camera.position.x = J.x1, e.camera.position.y = J.y1, e.camera.position.z = J.z1, a.controls.target.x = J.x2, a.controls.target.y = J.y2, a.controls.target.z = J.z2, a.controls.update(), i.RenderScene());
|
|
5474
5474
|
}), Q.onComplete(function(J) {
|
|
5475
5475
|
if (!a.controls) {
|
|
5476
5476
|
u();
|
|
@@ -5480,7 +5480,7 @@ function zr(a, e, t) {
|
|
|
5480
5480
|
new h(J.x2, J.y2, J.z2),
|
|
5481
5481
|
{ preserveCameraDistance: !0 }
|
|
5482
5482
|
), a.controls.auto = !1, ne && typeof a.controls.setScreenUp == "function" ? a.controls.setScreenUp(ne) : a.controls.update(), i.RenderScene(), q && q(!0), cancelAnimationFrame(n), n = null, u();
|
|
5483
|
-
}), Q.easing(
|
|
5483
|
+
}), Q.easing(Je.Easing.Cubic.InOut);
|
|
5484
5484
|
function fe(J) {
|
|
5485
5485
|
n = requestAnimationFrame(fe), Q.update();
|
|
5486
5486
|
}
|
|
@@ -5489,7 +5489,7 @@ function zr(a, e, t) {
|
|
|
5489
5489
|
function C() {
|
|
5490
5490
|
o = document.createElement("div"), o.className = "ViewCube", t.appendChild(o), r = document.createElement("div"), r.className = "viewSettingWrapper", r.innerHTML = "...";
|
|
5491
5491
|
var f = document.createElement("div");
|
|
5492
|
-
f.className = "homeViewWrapper", f.style.backgroundImage = `url(${
|
|
5492
|
+
f.className = "homeViewWrapper", f.style.backgroundImage = `url(${W("/assets/viewcube/home.png", import.meta.url)})`, f.addEventListener("mousedown", function() {
|
|
5493
5493
|
a.viewCube.cameraGoHome(500);
|
|
5494
5494
|
}), o.appendChild(f), r.addEventListener("mousedown", function(T) {
|
|
5495
5495
|
T.stopPropagation(), cameraToggle.classList.contains("show") ? (y(), console.log("隐藏功能按钮")) : (P(), console.log("显示功能按钮"));
|
|
@@ -5502,7 +5502,7 @@ function zr(a, e, t) {
|
|
|
5502
5502
|
}
|
|
5503
5503
|
}
|
|
5504
5504
|
function _() {
|
|
5505
|
-
i.sceneOrtho =
|
|
5505
|
+
i.sceneOrtho = Ir();
|
|
5506
5506
|
var P = t.clientWidth, T = t.clientWidth, f = P > T ? P / T : T / P, y = 300;
|
|
5507
5507
|
i.camera = new ve(
|
|
5508
5508
|
y * f / -2,
|
|
@@ -5516,8 +5516,8 @@ function zr(a, e, t) {
|
|
|
5516
5516
|
alpha: !0
|
|
5517
5517
|
});
|
|
5518
5518
|
D.setSize(P, T), D.setClearAlpha(0), i.sceneOrtho.renderer = D;
|
|
5519
|
-
let
|
|
5520
|
-
i.sceneOrtho.add(
|
|
5519
|
+
let I = new bt(16777215, 0.8);
|
|
5520
|
+
i.sceneOrtho.add(I), kr(o, D), i.orbitControls = new fn(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", k), i.orbitControls.addEventListener("change", B), i.orbitControls.addEventListener("end", L);
|
|
5521
5521
|
}
|
|
5522
5522
|
let E = !1;
|
|
5523
5523
|
function k() {
|
|
@@ -5532,34 +5532,34 @@ function zr(a, e, t) {
|
|
|
5532
5532
|
a.renderer && e.camera && a.renderer.render(e, e.camera);
|
|
5533
5533
|
}
|
|
5534
5534
|
}
|
|
5535
|
-
function
|
|
5535
|
+
function L() {
|
|
5536
5536
|
E = !1, i._mainTarget = null, i._mainDistance = null, u();
|
|
5537
5537
|
}
|
|
5538
|
-
function
|
|
5538
|
+
function V() {
|
|
5539
5539
|
let f = [
|
|
5540
5540
|
{
|
|
5541
5541
|
label: "右",
|
|
5542
|
-
icon:
|
|
5542
|
+
icon: W("/assets/viewcube/cn_right.png", import.meta.url)
|
|
5543
5543
|
},
|
|
5544
5544
|
{
|
|
5545
5545
|
label: "左",
|
|
5546
|
-
icon:
|
|
5546
|
+
icon: W("/assets/viewcube/cn_left.png", import.meta.url)
|
|
5547
5547
|
},
|
|
5548
5548
|
{
|
|
5549
5549
|
label: "顶",
|
|
5550
|
-
icon:
|
|
5550
|
+
icon: W("/assets/viewcube/cn_top.png", import.meta.url)
|
|
5551
5551
|
},
|
|
5552
5552
|
{
|
|
5553
5553
|
label: "底",
|
|
5554
|
-
icon:
|
|
5554
|
+
icon: W("/assets/viewcube/cn_bottom.png", import.meta.url)
|
|
5555
5555
|
},
|
|
5556
5556
|
{
|
|
5557
5557
|
label: "前",
|
|
5558
|
-
icon:
|
|
5558
|
+
icon: W("/assets/viewcube/cn_front.png", import.meta.url)
|
|
5559
5559
|
},
|
|
5560
5560
|
{
|
|
5561
5561
|
label: "后",
|
|
5562
|
-
icon:
|
|
5562
|
+
icon: W("/assets/viewcube/cn_back.png", import.meta.url)
|
|
5563
5563
|
}
|
|
5564
5564
|
];
|
|
5565
5565
|
var y = [];
|
|
@@ -5567,32 +5567,32 @@ function zr(a, e, t) {
|
|
|
5567
5567
|
y.push(
|
|
5568
5568
|
new me({
|
|
5569
5569
|
color: 16777215,
|
|
5570
|
-
map: new
|
|
5570
|
+
map: new Oe().load(D.icon)
|
|
5571
5571
|
})
|
|
5572
5572
|
);
|
|
5573
5573
|
new ls({
|
|
5574
5574
|
color: 255
|
|
5575
5575
|
});
|
|
5576
|
-
var P = new O(new
|
|
5576
|
+
var P = new O(new Ct(110, 110, 110), y);
|
|
5577
5577
|
i.sceneOrtho.add(P), $(122);
|
|
5578
5578
|
let T = { x: 0, y: 0 };
|
|
5579
5579
|
o.addEventListener("mousedown", (D) => {
|
|
5580
5580
|
T.x = D.clientX, T.y = D.clientY;
|
|
5581
5581
|
}), o.addEventListener("mouseup", (D) => {
|
|
5582
5582
|
if (E) return;
|
|
5583
|
-
const
|
|
5584
|
-
if (Math.sqrt(
|
|
5583
|
+
const I = D.clientX - T.x, F = D.clientY - T.y;
|
|
5584
|
+
if (Math.sqrt(I * I + F * F) > 5) return;
|
|
5585
5585
|
var ne = {};
|
|
5586
5586
|
ne.x = D.offsetX / o.clientWidth * 2 - 1, ne.y = -(D.offsetY / o.clientHeight) * 2 + 1;
|
|
5587
|
-
var Q = new
|
|
5587
|
+
var Q = new ae();
|
|
5588
5588
|
Q.setFromCamera(ne, i.camera);
|
|
5589
5589
|
const fe = Q.intersectObjects(l, !1);
|
|
5590
5590
|
fe.length > 0 && i.ToggleDirectionView(fe[0].object.name);
|
|
5591
5591
|
}), o.addEventListener("mousemove", (D) => {
|
|
5592
|
-
var
|
|
5593
|
-
|
|
5594
|
-
var F = new
|
|
5595
|
-
F.setFromCamera(
|
|
5592
|
+
var I = {};
|
|
5593
|
+
I.x = D.offsetX / o.clientWidth * 2 - 1, I.y = -(D.offsetY / o.clientHeight) * 2 + 1;
|
|
5594
|
+
var F = new ae();
|
|
5595
|
+
F.setFromCamera(I, i.camera);
|
|
5596
5596
|
const q = F.intersectObjects(l, !1);
|
|
5597
5597
|
for (var ne of l)
|
|
5598
5598
|
ne.material.opacity = 0.01;
|
|
@@ -5785,21 +5785,21 @@ function zr(a, e, t) {
|
|
|
5785
5785
|
c: 30,
|
|
5786
5786
|
point: new h(y, 0, -y)
|
|
5787
5787
|
}
|
|
5788
|
-
],
|
|
5789
|
-
l.push(S(P[
|
|
5790
|
-
for (var
|
|
5791
|
-
l.push(S(T[
|
|
5792
|
-
for (var
|
|
5793
|
-
l.push(S(D[
|
|
5788
|
+
], I = 0; I < P.length; I++)
|
|
5789
|
+
l.push(S(P[I]));
|
|
5790
|
+
for (var I = 0; I < T.length; I++)
|
|
5791
|
+
l.push(S(T[I]));
|
|
5792
|
+
for (var I = 0; I < D.length; I++)
|
|
5793
|
+
l.push(S(D[I]));
|
|
5794
5794
|
}
|
|
5795
5795
|
function S(f) {
|
|
5796
|
-
const y = new
|
|
5796
|
+
const y = new Ct(f.a, f.b, f.c), P = new me({
|
|
5797
5797
|
color: "blue",
|
|
5798
5798
|
transparent: !0,
|
|
5799
5799
|
opacity: 0.01
|
|
5800
|
-
}), T = new
|
|
5801
|
-
let D = y.applyMatrix4(T),
|
|
5802
|
-
return
|
|
5800
|
+
}), T = new G().makeTranslation(f.point.x, f.point.y, f.point.z);
|
|
5801
|
+
let D = y.applyMatrix4(T), I = new O(D, P);
|
|
5802
|
+
return I.name = f.name, i.sceneOrtho.add(I), I;
|
|
5803
5803
|
}
|
|
5804
5804
|
return i.ToggleCameraType = function() {
|
|
5805
5805
|
a.cameraModule.switchCurrentCamera();
|
|
@@ -5878,7 +5878,7 @@ class Br {
|
|
|
5878
5878
|
const s = this.engine.models?.find((r) => r.url === n.url);
|
|
5879
5879
|
if (s?.nodesMap == null)
|
|
5880
5880
|
return;
|
|
5881
|
-
const o =
|
|
5881
|
+
const o = He(this.engine, n.url);
|
|
5882
5882
|
n.ids.forEach((r) => {
|
|
5883
5883
|
const l = s.nodesMap.get(r);
|
|
5884
5884
|
[
|
|
@@ -5975,7 +5975,7 @@ function Rr(a) {
|
|
|
5975
5975
|
const f = d.get(S.url);
|
|
5976
5976
|
if (f == null)
|
|
5977
5977
|
return;
|
|
5978
|
-
const y =
|
|
5978
|
+
const y = He(a, S.url);
|
|
5979
5979
|
(S.lods ?? []).forEach((P) => {
|
|
5980
5980
|
let T = P.octreeBox;
|
|
5981
5981
|
b(t, T, S, f, y);
|
|
@@ -5992,8 +5992,8 @@ function Rr(a) {
|
|
|
5992
5992
|
let F = new h(f.min.X * 0.3048, f.min.Z * 0.3048, -f.min.Y * 0.3048), q = new h(f.max.X * 0.3048, f.max.Z * 0.3048, -f.max.Y * 0.3048), ne = new h(Math.min(F.x, q.x), Math.min(F.y, q.y), Math.min(F.z, q.z)), Q = new h(Math.max(q.x, F.x), Math.max(q.y, F.y), Math.max(q.z, F.z));
|
|
5993
5993
|
f.threeBox = new Y(ne, Q).applyMatrix4(T);
|
|
5994
5994
|
}
|
|
5995
|
-
const D = f.threeBox,
|
|
5996
|
-
if (!(
|
|
5995
|
+
const D = f.threeBox, I = S.ray.intersectsBox(D);
|
|
5996
|
+
if (!(I == null || I == !1) && c?.doesBoxIntersectClippingRange?.(D) !== !1)
|
|
5997
5997
|
if (f.children == null || f.children.length == 0) {
|
|
5998
5998
|
if (f.elements != null)
|
|
5999
5999
|
for (let F of f.elements)
|
|
@@ -6007,7 +6007,7 @@ function Rr(a) {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
6009
|
function p(S, f, y, P) {
|
|
6010
|
-
if (!a.engineStatus.isFree && i == !1 ||
|
|
6010
|
+
if (!a.engineStatus.isFree && i == !1 || V(f.url, S))
|
|
6011
6011
|
return;
|
|
6012
6012
|
const T = y.nodesMap.get(S);
|
|
6013
6013
|
if (T != null) {
|
|
@@ -6025,7 +6025,7 @@ function Rr(a) {
|
|
|
6025
6025
|
const y = S.uuid ?? S.id;
|
|
6026
6026
|
if (r.has(y))
|
|
6027
6027
|
return;
|
|
6028
|
-
const P =
|
|
6028
|
+
const P = L(S, f);
|
|
6029
6029
|
if (P == null || c?.doesBoxIntersectClippingRange?.(P) === !1)
|
|
6030
6030
|
return;
|
|
6031
6031
|
const T = t.ray.intersectBox(P, l);
|
|
@@ -6054,24 +6054,24 @@ function Rr(a) {
|
|
|
6054
6054
|
const D = f[1];
|
|
6055
6055
|
if (n && T.geometry.attributes.position.count >= 2e3)
|
|
6056
6056
|
return null;
|
|
6057
|
-
const
|
|
6058
|
-
if (
|
|
6057
|
+
const I = k(T, D);
|
|
6058
|
+
if (I == null)
|
|
6059
6059
|
return null;
|
|
6060
|
-
P.clone().multiply(
|
|
6060
|
+
P.clone().multiply(I), S.info.__pickMeshes instanceof Map || (S.info.__pickMeshes = /* @__PURE__ */ new Map());
|
|
6061
6061
|
const F = `${f[0]}:${D}`;
|
|
6062
6062
|
let q = S.info.__pickMeshes.get(F);
|
|
6063
6063
|
return q instanceof O || (q = new O(T.geometry, T.material), S.info.__pickMeshes.set(F, q)), q.userData.__instancePickMeta = {
|
|
6064
6064
|
url: y,
|
|
6065
6065
|
id: S.info.id,
|
|
6066
6066
|
instanceId: D,
|
|
6067
|
-
matrix:
|
|
6067
|
+
matrix: I.clone()
|
|
6068
6068
|
}, q;
|
|
6069
6069
|
}
|
|
6070
6070
|
function k(S, f) {
|
|
6071
|
-
const y = new
|
|
6071
|
+
const y = new G();
|
|
6072
6072
|
if (typeof S.getMatrixAt == "function")
|
|
6073
6073
|
S.getMatrixAt(f, y);
|
|
6074
|
-
else if (S.matrixs?.[f] instanceof
|
|
6074
|
+
else if (S.matrixs?.[f] instanceof G)
|
|
6075
6075
|
y.copy(S.matrixs[f]);
|
|
6076
6076
|
else
|
|
6077
6077
|
return null;
|
|
@@ -6091,10 +6091,10 @@ function Rr(a) {
|
|
|
6091
6091
|
matrix: f.matrix.clone()
|
|
6092
6092
|
};
|
|
6093
6093
|
}
|
|
6094
|
-
function
|
|
6094
|
+
function L(S, f) {
|
|
6095
6095
|
return S.box instanceof Y ? S.box : S.geometry == null || (S.geometry.boundingBox == null && S.geometry.computeBoundingBox(), S.geometry.boundingBox == null) ? null : (S.box = S.geometry.boundingBox.clone().applyMatrix4(f), S.box);
|
|
6096
6096
|
}
|
|
6097
|
-
function
|
|
6097
|
+
function V(S, f) {
|
|
6098
6098
|
return g.get(S)?.has(f) || m.get(S)?.has(f);
|
|
6099
6099
|
}
|
|
6100
6100
|
function $(S) {
|
|
@@ -6109,8 +6109,8 @@ class Fr {
|
|
|
6109
6109
|
engine;
|
|
6110
6110
|
// 绘制状态
|
|
6111
6111
|
isDrawing = !1;
|
|
6112
|
-
startPoint = new
|
|
6113
|
-
endPoint = new
|
|
6112
|
+
startPoint = new H();
|
|
6113
|
+
endPoint = new H();
|
|
6114
6114
|
// UI绘制框元素
|
|
6115
6115
|
selectionBox = null;
|
|
6116
6116
|
// 坐标转换工具
|
|
@@ -6263,7 +6263,7 @@ class Fr {
|
|
|
6263
6263
|
const s = new h();
|
|
6264
6264
|
e.getSize(s);
|
|
6265
6265
|
const o = Math.max(s.x, s.y, s.z);
|
|
6266
|
-
if (t instanceof
|
|
6266
|
+
if (t instanceof st) {
|
|
6267
6267
|
const r = t.fov * (Math.PI / 180), c = o / (2 * Math.tan(r / 2)) * 1.2, u = new h();
|
|
6268
6268
|
t.getWorldDirection(u);
|
|
6269
6269
|
const d = n.clone().sub(t.position);
|
|
@@ -6283,7 +6283,7 @@ class Fr {
|
|
|
6283
6283
|
this.disActive(), this.selectionBox?.remove(), this.selectionBox = null, this.worldToScreen = null, this.isDrawing = !1;
|
|
6284
6284
|
}
|
|
6285
6285
|
}
|
|
6286
|
-
const Or = R.degToRad(10),
|
|
6286
|
+
const Or = R.degToRad(10), Yi = 1e-3, Jt = !1, Nr = [];
|
|
6287
6287
|
class Hr {
|
|
6288
6288
|
engine;
|
|
6289
6289
|
rootGroup = null;
|
|
@@ -6328,7 +6328,7 @@ class Hr {
|
|
|
6328
6328
|
i = 30 * n / s;
|
|
6329
6329
|
}
|
|
6330
6330
|
this.rootGroup.traverse((n) => {
|
|
6331
|
-
n instanceof
|
|
6331
|
+
n instanceof St && n.scale.set(i, i, 1);
|
|
6332
6332
|
});
|
|
6333
6333
|
}
|
|
6334
6334
|
/**
|
|
@@ -6340,7 +6340,7 @@ class Hr {
|
|
|
6340
6340
|
debugger;
|
|
6341
6341
|
if (s.length === 0)
|
|
6342
6342
|
return null;
|
|
6343
|
-
const o = this.toVector3(n), r = new
|
|
6343
|
+
const o = this.toVector3(n), r = new H(o.x, o.z), l = this.buildAxisFamilies(s).sort((g, m) => m.axes.length - g.axes.length).slice(0, 2).map((g, m) => ({ ...g, familyIndex: m }));
|
|
6344
6344
|
if (l.length === 0)
|
|
6345
6345
|
return null;
|
|
6346
6346
|
const c = l.map((g) => this.resolveFamilyLocation(g, r)), u = this.sortFamiliesForDisplay(c), d = u.length === 2 && u.every((g) => g.isInside);
|
|
@@ -6355,7 +6355,7 @@ class Hr {
|
|
|
6355
6355
|
this._clearAxes(), this.rootGroup && (this.engine.scene && this.engine.scene.remove(this.rootGroup), this.rootGroup = null);
|
|
6356
6356
|
}
|
|
6357
6357
|
_initRoot() {
|
|
6358
|
-
this.rootGroup = new
|
|
6358
|
+
this.rootGroup = new he(), this.rootGroup.name = "GridRoot", this.rootGroup.visible = Jt, this.engine.scene && this.engine.scene.add(this.rootGroup);
|
|
6359
6359
|
}
|
|
6360
6360
|
_clearAxes() {
|
|
6361
6361
|
this.axes.forEach((e) => {
|
|
@@ -6371,12 +6371,12 @@ class Hr {
|
|
|
6371
6371
|
_buildAxis(e) {
|
|
6372
6372
|
if (!this.rootGroup)
|
|
6373
6373
|
return;
|
|
6374
|
-
const t = this.coordinateMapper(e.data.Points[0]), i = this.coordinateMapper(e.data.Points[1]), n = new
|
|
6374
|
+
const t = this.coordinateMapper(e.data.Points[0]), i = this.coordinateMapper(e.data.Points[1]), n = new he();
|
|
6375
6375
|
n.name = `GridAxis_${e.data.Id}`;
|
|
6376
6376
|
const s = new Me().setFromPoints([t, i]), o = new ke({
|
|
6377
6377
|
color: 1609983,
|
|
6378
6378
|
depthTest: !1
|
|
6379
|
-
}), r = new
|
|
6379
|
+
}), r = new at(s, o);
|
|
6380
6380
|
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;
|
|
6381
6381
|
}
|
|
6382
6382
|
_makeCircleSprite(e, t) {
|
|
@@ -6391,7 +6391,7 @@ class Hr {
|
|
|
6391
6391
|
map: c,
|
|
6392
6392
|
depthTest: !1,
|
|
6393
6393
|
transparent: !0
|
|
6394
|
-
}), d = new
|
|
6394
|
+
}), d = new St(u);
|
|
6395
6395
|
return d.position.copy(t), d.scale.set(0.5, 0.5, 1), d.renderOrder = 999, d;
|
|
6396
6396
|
}
|
|
6397
6397
|
/**
|
|
@@ -6445,7 +6445,7 @@ class Hr {
|
|
|
6445
6445
|
t.push({
|
|
6446
6446
|
familyIndex: t.length,
|
|
6447
6447
|
direction: n.direction.clone(),
|
|
6448
|
-
normal: new
|
|
6448
|
+
normal: new H(-n.direction.y, n.direction.x),
|
|
6449
6449
|
axes: [n]
|
|
6450
6450
|
});
|
|
6451
6451
|
}), t.forEach((i) => {
|
|
@@ -6453,10 +6453,10 @@ class Hr {
|
|
|
6453
6453
|
}), t;
|
|
6454
6454
|
}
|
|
6455
6455
|
createProjection(e) {
|
|
6456
|
-
const t = this.coordinateMapper(e.Points[0]), i = this.coordinateMapper(e.Points[1]), n = new
|
|
6456
|
+
const t = this.coordinateMapper(e.Points[0]), i = this.coordinateMapper(e.Points[1]), n = new H(t.x, t.z), s = new H(i.x, i.z), o = s.clone().sub(n);
|
|
6457
6457
|
if (o.lengthSq() <= Number.EPSILON)
|
|
6458
6458
|
return null;
|
|
6459
|
-
const r = this.normalizeDirection(o), l = new
|
|
6459
|
+
const r = this.normalizeDirection(o), l = new H(-r.y, r.x);
|
|
6460
6460
|
return {
|
|
6461
6461
|
data: e,
|
|
6462
6462
|
start: n,
|
|
@@ -6467,13 +6467,13 @@ class Hr {
|
|
|
6467
6467
|
}
|
|
6468
6468
|
normalizeDirection(e) {
|
|
6469
6469
|
const t = e.clone().normalize();
|
|
6470
|
-
return (t.x < 0 || Math.abs(t.x) <=
|
|
6470
|
+
return (t.x < 0 || Math.abs(t.x) <= Yi && t.y < 0) && t.multiplyScalar(-1), t;
|
|
6471
6471
|
}
|
|
6472
6472
|
/**
|
|
6473
6473
|
* 在单个轴族内优先返回点位所属的最近轴网区间,避免落在线上时出现空描述。
|
|
6474
6474
|
*/
|
|
6475
6475
|
resolveFamilyLocation(e, t) {
|
|
6476
|
-
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <=
|
|
6476
|
+
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <= Yi) ?? null;
|
|
6477
6477
|
if (n) {
|
|
6478
6478
|
const c = e.axes.findIndex((d) => d.data.Id === n.data.Id), u = this.pickAxisPairAroundIndex(e.axes, c);
|
|
6479
6479
|
return {
|
|
@@ -6573,7 +6573,7 @@ class Hr {
|
|
|
6573
6573
|
}
|
|
6574
6574
|
}
|
|
6575
6575
|
const Nn = "0", Hn = 0, Vn = !1;
|
|
6576
|
-
class
|
|
6576
|
+
class fi {
|
|
6577
6577
|
engine;
|
|
6578
6578
|
currentId = Nn;
|
|
6579
6579
|
groundGroup;
|
|
@@ -6603,7 +6603,7 @@ class gi {
|
|
|
6603
6603
|
{ id: "14", names: ["海面", "海面", "Sea Surface"], water: !0, waterColor: 28062, distortionScale: 3.7, size: 1 }
|
|
6604
6604
|
];
|
|
6605
6605
|
constructor(e) {
|
|
6606
|
-
this.engine = e, this.groundGroup = new
|
|
6606
|
+
this.engine = e, this.groundGroup = new he(), this.groundGroup.name = "groundGroup", this.clock = new on();
|
|
6607
6607
|
}
|
|
6608
6608
|
init() {
|
|
6609
6609
|
this.engine.scene.add(this.groundGroup), this.groundGroup.visible = Vn;
|
|
@@ -6619,8 +6619,8 @@ class gi {
|
|
|
6619
6619
|
if (!i) return;
|
|
6620
6620
|
const n = t?.size ?? 3e4;
|
|
6621
6621
|
if (i.water) {
|
|
6622
|
-
const s = new
|
|
6623
|
-
m.wrapS = m.wrapT =
|
|
6622
|
+
const s = new qt(n, n), o = t?.waterNormalsUrl ?? W(fi.DEFAULT_WATER_NORMALS, import.meta.url), r = new Oe().load(o, (m) => {
|
|
6623
|
+
m.wrapS = m.wrapT = Et;
|
|
6624
6624
|
}), l = t?.sunDirection ?? new h(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, u = t?.waterSize ?? i.size ?? 1, d = t?.opacity ?? 0.92, g = new hs(s, {
|
|
6625
6625
|
textureWidth: 512,
|
|
6626
6626
|
textureHeight: 512,
|
|
@@ -6634,17 +6634,17 @@ class gi {
|
|
|
6634
6634
|
});
|
|
6635
6635
|
g.rotation.x = -Math.PI / 2, g.position.y = -0.01, g.name = "groundMesh", g.receiveShadow = !0, g.castShadow = !1, this.ensureWaterShadowUniforms(g.material), g.material.uniforms.size.value = u, this.groundMesh = g, this.isWaterAddon = !0, this.groundGroup.add(g);
|
|
6636
6636
|
} else {
|
|
6637
|
-
const s = new
|
|
6637
|
+
const s = new qt(n, n, 1, 1);
|
|
6638
6638
|
s.rotateX(-Math.PI / 2);
|
|
6639
|
-
const o = new
|
|
6639
|
+
const o = new ai({
|
|
6640
6640
|
color: i.color,
|
|
6641
6641
|
roughness: i.roughness,
|
|
6642
6642
|
metalness: i.metalness
|
|
6643
|
-
}), r = t?.textureUrl ?? (i.map ?
|
|
6644
|
-
r && new
|
|
6643
|
+
}), r = t?.textureUrl ?? (i.map ? W(i.map, import.meta.url) : void 0);
|
|
6644
|
+
r && new Oe().load(
|
|
6645
6645
|
r,
|
|
6646
6646
|
(c) => {
|
|
6647
|
-
c.wrapS = c.wrapT =
|
|
6647
|
+
c.wrapS = c.wrapT = Et, c.repeat.set(1e4, 1e4), o.map = c, o.needsUpdate = !0;
|
|
6648
6648
|
},
|
|
6649
6649
|
void 0,
|
|
6650
6650
|
() => {
|
|
@@ -6728,7 +6728,7 @@ class Gr {
|
|
|
6728
6728
|
previousBackgroundIntensity = 1;
|
|
6729
6729
|
previousEnvironmentIntensity = 1;
|
|
6730
6730
|
previousAmbientLightIntensity = 1;
|
|
6731
|
-
previousToneMapping =
|
|
6731
|
+
previousToneMapping = je;
|
|
6732
6732
|
previousToneMappingExposure = 1;
|
|
6733
6733
|
hdrList = [
|
|
6734
6734
|
{ id: "0", names: ["无", "無", "None"] },
|
|
@@ -6801,7 +6801,7 @@ class Gr {
|
|
|
6801
6801
|
this._clearHdr(), this.textureCache.forEach((e) => e.dispose()), this.textureCache.clear();
|
|
6802
6802
|
}
|
|
6803
6803
|
_loadHdr(e) {
|
|
6804
|
-
const t =
|
|
6804
|
+
const t = W(e, import.meta.url);
|
|
6805
6805
|
return new Promise((i, n) => {
|
|
6806
6806
|
new us().load(
|
|
6807
6807
|
t,
|
|
@@ -6817,10 +6817,10 @@ class Gr {
|
|
|
6817
6817
|
if (this.currentTexture = e, !this.engine.scene || !this.engine.renderer) return;
|
|
6818
6818
|
this._captureSceneState(), this.currentEnvironmentTexture?.dispose();
|
|
6819
6819
|
const t = new pn(this.engine.renderer), i = t.fromEquirectangular(e).texture;
|
|
6820
|
-
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping = oi, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure :
|
|
6820
|
+
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping = oi, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure : li, this._removeSkybox(), this._createSkybox(e), this._setAmbientLightIntensity(this._getHdrAmbientLightIntensity());
|
|
6821
6821
|
}
|
|
6822
6822
|
_captureSceneState() {
|
|
6823
|
-
this.currentHdrId !== Te || !this.engine.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousAmbientLightIntensity = this._getAmbientLightIntensity(), this.previousToneMapping = this.engine.renderer?.toneMapping ??
|
|
6823
|
+
this.currentHdrId !== Te || !this.engine.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousAmbientLightIntensity = this._getAmbientLightIntensity(), this.previousToneMapping = this.engine.renderer?.toneMapping ?? je, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1);
|
|
6824
6824
|
}
|
|
6825
6825
|
_createSkybox(e) {
|
|
6826
6826
|
if (!this.engine.scene) return;
|
|
@@ -6844,16 +6844,16 @@ class Gr {
|
|
|
6844
6844
|
!this.skybox || !this.engine.scene || (this.engine.scene.remove(this.skybox), this.skybox.geometry.dispose(), this.skybox.material.dispose(), this.skybox = null);
|
|
6845
6845
|
}
|
|
6846
6846
|
_clearHdr() {
|
|
6847
|
-
this.currentTexture = null, this._removeSkybox(), this.engine.scene && (this.currentEnvironmentTexture?.dispose(), this.currentEnvironmentTexture = null, this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this._setAmbientLightIntensity(this.previousAmbientLightIntensity), this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousAmbientLightIntensity = 1, this.previousToneMapping =
|
|
6847
|
+
this.currentTexture = null, this._removeSkybox(), this.engine.scene && (this.currentEnvironmentTexture?.dispose(), this.currentEnvironmentTexture = null, this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this._setAmbientLightIntensity(this.previousAmbientLightIntensity), this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousAmbientLightIntensity = 1, this.previousToneMapping = je, this.previousToneMappingExposure = 1);
|
|
6848
6848
|
}
|
|
6849
6849
|
_getAmbientLightIntensity() {
|
|
6850
6850
|
return this.engine.scene?.children.find(
|
|
6851
|
-
(t) => t instanceof
|
|
6851
|
+
(t) => t instanceof bt
|
|
6852
6852
|
)?.intensity ?? 1;
|
|
6853
6853
|
}
|
|
6854
6854
|
_setAmbientLightIntensity(e) {
|
|
6855
6855
|
const t = this.engine.scene?.children.find(
|
|
6856
|
-
(i) => i instanceof
|
|
6856
|
+
(i) => i instanceof bt
|
|
6857
6857
|
);
|
|
6858
6858
|
t && (t.intensity = e);
|
|
6859
6859
|
}
|
|
@@ -6978,7 +6978,7 @@ class jr {
|
|
|
6978
6978
|
return;
|
|
6979
6979
|
const i = new h(t.min.x, t.min.y, t.min.z), n = new h(t.max.x, t.max.y, t.max.z);
|
|
6980
6980
|
this.halfSize = n.distanceTo(i);
|
|
6981
|
-
const s = e.data.Elevation, o = new
|
|
6981
|
+
const s = e.data.Elevation, o = new he(), r = new qt(this.halfSize * 2, this.halfSize * 2);
|
|
6982
6982
|
r.rotateX(-Math.PI / 2);
|
|
6983
6983
|
const l = new me({
|
|
6984
6984
|
color: this.COLOR,
|
|
@@ -6999,7 +6999,7 @@ class jr {
|
|
|
6999
6999
|
transparent: !0,
|
|
7000
7000
|
opacity: 0.7
|
|
7001
7001
|
});
|
|
7002
|
-
if (o.add(new
|
|
7002
|
+
if (o.add(new at(d, g)), o.visible = this.isVisible, this.engine.scene.add(o), e.group = o, this.svgOverlay) {
|
|
7003
7003
|
const m = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
7004
7004
|
m.dataset.levelId = e.data.Id;
|
|
7005
7005
|
for (let w = 0; w < 4; w += 1)
|
|
@@ -7177,7 +7177,7 @@ class ia {
|
|
|
7177
7177
|
}), this.highlightIndexes.set(e, s), s;
|
|
7178
7178
|
}
|
|
7179
7179
|
constructor(e) {
|
|
7180
|
-
this.engine = e, this.groupEdge = this.engine.scene.getObjectByName("groupEdge"), this.highlightEdgeGroup = new
|
|
7180
|
+
this.engine = e, this.groupEdge = this.engine.scene.getObjectByName("groupEdge"), this.highlightEdgeGroup = new he(), this.highlightEdgeGroup.name = "highlightModelEdgeGroup", this.highlightEdgeGroup.renderOrder = 999, this.engine.scene.add(this.highlightEdgeGroup), this.material = new ke({
|
|
7181
7181
|
color: 0,
|
|
7182
7182
|
transparent: !0,
|
|
7183
7183
|
opacity: ei,
|
|
@@ -7195,13 +7195,13 @@ class ia {
|
|
|
7195
7195
|
// 启动
|
|
7196
7196
|
active() {
|
|
7197
7197
|
this.isActive = !0, this.groupEdge.visible = !0, this.engine.scene.traverse((e) => {
|
|
7198
|
-
e.isMesh && e.material &&
|
|
7198
|
+
e.isMesh && e.material && ki(e, !0);
|
|
7199
7199
|
}), this.update(), this.show();
|
|
7200
7200
|
}
|
|
7201
7201
|
// 关闭
|
|
7202
7202
|
disActive() {
|
|
7203
7203
|
this.isActive = !1, this.groupEdge.visible = !1, this.engine.scene.traverse((e) => {
|
|
7204
|
-
e.isMesh && e.material &&
|
|
7204
|
+
e.isMesh && e.material && ki(e, !1);
|
|
7205
7205
|
});
|
|
7206
7206
|
}
|
|
7207
7207
|
isEnabled() {
|
|
@@ -7226,7 +7226,7 @@ class ia {
|
|
|
7226
7226
|
}
|
|
7227
7227
|
loadZipJsonAsync(e, t) {
|
|
7228
7228
|
return new Promise((i, n) => {
|
|
7229
|
-
|
|
7229
|
+
_t(
|
|
7230
7230
|
e,
|
|
7231
7231
|
(s) => {
|
|
7232
7232
|
if (s == null) {
|
|
@@ -7247,7 +7247,7 @@ class ia {
|
|
|
7247
7247
|
return e.modelEdge;
|
|
7248
7248
|
try {
|
|
7249
7249
|
const t = this.engine.engineStatus.models.find((s) => s.url == e.url);
|
|
7250
|
-
|
|
7250
|
+
Dt(this.engine, e.url, e.url + "/edge");
|
|
7251
7251
|
const i = await this.loadZipJsonAsync(e.url + "/edge", t?.key ?? e?.key), n = JSON.parse(i);
|
|
7252
7252
|
e.modelEdge = Array.isArray(n) ? n : [];
|
|
7253
7253
|
} catch (t) {
|
|
@@ -7295,9 +7295,9 @@ class ia {
|
|
|
7295
7295
|
}), s.length === 0)
|
|
7296
7296
|
return;
|
|
7297
7297
|
const l = new Me();
|
|
7298
|
-
l.setAttribute("position", new
|
|
7299
|
-
const c = new
|
|
7300
|
-
c.url = i, this.setLineTransform(c,
|
|
7298
|
+
l.setAttribute("position", new Pt(s, 3));
|
|
7299
|
+
const c = new jt(l, this.material);
|
|
7300
|
+
c.url = i, this.setLineTransform(c, He(this.engine, i)), this.groupEdge.add(c), this.highlightIndexes.set(i, o), this.releaseIndexes(i);
|
|
7301
7301
|
});
|
|
7302
7302
|
}
|
|
7303
7303
|
/**
|
|
@@ -7343,9 +7343,9 @@ class ia {
|
|
|
7343
7343
|
}), s.length === 0)
|
|
7344
7344
|
return;
|
|
7345
7345
|
const o = new Me();
|
|
7346
|
-
o.setAttribute("position", new
|
|
7347
|
-
const r = new
|
|
7348
|
-
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r,
|
|
7346
|
+
o.setAttribute("position", new Pt(s, 3));
|
|
7347
|
+
const r = new jt(o, this.highlightEdgeMaterial);
|
|
7348
|
+
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r, He(this.engine, i.url)), this.highlightEdgeGroup.add(r);
|
|
7349
7349
|
}));
|
|
7350
7350
|
}
|
|
7351
7351
|
appendEdgePositions(e, t) {
|
|
@@ -7420,7 +7420,7 @@ class ia {
|
|
|
7420
7420
|
this.releaseIndexes(e);
|
|
7421
7421
|
}
|
|
7422
7422
|
}
|
|
7423
|
-
const
|
|
7423
|
+
const Xi = {
|
|
7424
7424
|
turbidity: 10,
|
|
7425
7425
|
rayleigh: 3,
|
|
7426
7426
|
mieCoefficient: 5e-3,
|
|
@@ -7604,15 +7604,15 @@ const Yi = {
|
|
|
7604
7604
|
showSunDisc: !1
|
|
7605
7605
|
}
|
|
7606
7606
|
}
|
|
7607
|
-
],
|
|
7607
|
+
], $i = ii.reduce(
|
|
7608
7608
|
(a, e) => (a[e.id] = e, a),
|
|
7609
7609
|
{}
|
|
7610
|
-
),
|
|
7610
|
+
), Zi = 2e6;
|
|
7611
7611
|
class na {
|
|
7612
7612
|
engine;
|
|
7613
7613
|
sky = null;
|
|
7614
7614
|
sun = new h();
|
|
7615
|
-
params = { ...
|
|
7615
|
+
params = { ...Xi, ...$i[ti].params };
|
|
7616
7616
|
currentPreset = ti;
|
|
7617
7617
|
currentIntensity = qn;
|
|
7618
7618
|
currentEnvironmentTarget = null;
|
|
@@ -7623,7 +7623,7 @@ class na {
|
|
|
7623
7623
|
previousEnvironment = null;
|
|
7624
7624
|
previousBackgroundIntensity = 1;
|
|
7625
7625
|
previousEnvironmentIntensity = 1;
|
|
7626
|
-
previousToneMapping =
|
|
7626
|
+
previousToneMapping = je;
|
|
7627
7627
|
previousToneMappingExposure = 1;
|
|
7628
7628
|
hasCapturedSceneState = !1;
|
|
7629
7629
|
constructor(e) {
|
|
@@ -7636,7 +7636,7 @@ class na {
|
|
|
7636
7636
|
return;
|
|
7637
7637
|
}
|
|
7638
7638
|
const e = new ps();
|
|
7639
|
-
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping =
|
|
7639
|
+
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping = Mi, this.engine.scene.background = null), this._applyParamsToSky();
|
|
7640
7640
|
}
|
|
7641
7641
|
close(e = !0) {
|
|
7642
7642
|
this.sky && (this._restoreCameraFar(), this._restoreSceneState(e), e ? (this.engine?.scene?.remove(this.sky), this.sky.material.dispose(), this.sky.geometry.dispose(), this.sky = null) : this.sky.visible = !1);
|
|
@@ -7651,8 +7651,8 @@ class na {
|
|
|
7651
7651
|
Object.assign(this.params, e), this._applyParamsToSky(), this.engine?.renderer && (e.exposure !== void 0 || e.orthoExposureScale !== void 0) && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure());
|
|
7652
7652
|
}
|
|
7653
7653
|
setPreset(e) {
|
|
7654
|
-
const t =
|
|
7655
|
-
t && (this.currentPreset = e, this.params = { ...
|
|
7654
|
+
const t = $i[e];
|
|
7655
|
+
t && (this.currentPreset = e, this.params = { ...Xi, ...t.params }, this._applyParamsToSky(), this.engine?.renderer && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure()));
|
|
7656
7656
|
}
|
|
7657
7657
|
getCurrentPreset() {
|
|
7658
7658
|
return this.currentPreset;
|
|
@@ -7696,7 +7696,7 @@ class na {
|
|
|
7696
7696
|
const e = this.engine?.camera;
|
|
7697
7697
|
if (!e || typeof e.far != "number") return;
|
|
7698
7698
|
const t = e.far;
|
|
7699
|
-
t >=
|
|
7699
|
+
t >= Zi || (this.savedCameraFar == null && (this.savedCameraFar = t), e.far = Zi, typeof e.updateProjectionMatrix == "function" && e.updateProjectionMatrix());
|
|
7700
7700
|
}
|
|
7701
7701
|
_restoreCameraFar() {
|
|
7702
7702
|
if (this.savedCameraFar == null || !this.engine?.camera) return;
|
|
@@ -7708,13 +7708,13 @@ class na {
|
|
|
7708
7708
|
const e = this.sky.material.uniforms;
|
|
7709
7709
|
this._setUniformValue(e, "turbidity", this.params.turbidity), this._setUniformValue(e, "rayleigh", this.params.rayleigh), this._setUniformValue(e, "mieCoefficient", this.params.mieCoefficient), this._setUniformValue(e, "mieDirectionalG", this.params.mieDirectionalG), this._setUniformValue(e, "cloudCoverage", this.params.cloudCoverage), this._setUniformValue(e, "cloudDensity", this.params.cloudDensity), this._setUniformValue(e, "cloudElevation", this.params.cloudElevation), this._setUniformValue(e, "showSunDisc", this.params.showSunDisc ? 1 : 0);
|
|
7710
7710
|
const t = R.degToRad(90 - this.params.elevation), i = R.degToRad(this.params.azimuth);
|
|
7711
|
-
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping =
|
|
7711
|
+
this.sun.setFromSphericalCoords(1, t, i), this._setUniformValue(e, "sunPosition", this.sun), this.engine?.renderer && (this.engine.renderer.toneMapping = Mi, this.engine.renderer.toneMappingExposure = this._getEffectiveExposure(), this.sky.visible && this._refreshEnvironmentMap());
|
|
7712
7712
|
}
|
|
7713
7713
|
_captureSceneState() {
|
|
7714
|
-
this.hasCapturedSceneState || !this.engine?.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousToneMapping = this.engine.renderer?.toneMapping ??
|
|
7714
|
+
this.hasCapturedSceneState || !this.engine?.scene || (this.previousBackground = this.engine.scene.background, this.previousEnvironment = this.engine.scene.environment, this.previousBackgroundIntensity = this.engine.scene.backgroundIntensity ?? 1, this.previousEnvironmentIntensity = this.engine.scene.environmentIntensity ?? 1, this.previousToneMapping = this.engine.renderer?.toneMapping ?? je, this.previousToneMappingExposure = this.engine.renderer?.toneMappingExposure ?? 1, this.hasCapturedSceneState = !0);
|
|
7715
7715
|
}
|
|
7716
7716
|
_restoreSceneState(e) {
|
|
7717
|
-
!this.hasCapturedSceneState || !this.engine?.scene || (this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), e && (this._disposeEnvironmentTarget(), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousToneMapping =
|
|
7717
|
+
!this.hasCapturedSceneState || !this.engine?.scene || (this.engine.scene.background = this.previousBackground, this.engine.scene.environment = this.previousEnvironment, this.engine.scene.backgroundIntensity = this.previousBackgroundIntensity, this.engine.scene.environmentIntensity = this.previousEnvironmentIntensity, this.engine.renderer && (this.engine.renderer.toneMapping = this.previousToneMapping, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure), e && (this._disposeEnvironmentTarget(), this.previousBackground = null, this.previousEnvironment = null, this.previousBackgroundIntensity = 1, this.previousEnvironmentIntensity = 1, this.previousToneMapping = je, this.previousToneMappingExposure = 1, this.hasCapturedSceneState = !1));
|
|
7718
7718
|
}
|
|
7719
7719
|
_refreshEnvironmentMap() {
|
|
7720
7720
|
if (!this.sky || !this.engine?.renderer || !this.engine?.scene) return;
|
|
@@ -7866,8 +7866,8 @@ class sa {
|
|
|
7866
7866
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
7867
7867
|
contrast: this._uniformToPercent(t, Cn),
|
|
7868
7868
|
saturation: this._uniformToPercent(e, bn),
|
|
7869
|
-
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(),
|
|
7870
|
-
lightIntensity: this._exposureToPercent(n,
|
|
7869
|
+
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(), it),
|
|
7870
|
+
lightIntensity: this._exposureToPercent(n, li),
|
|
7871
7871
|
gtaoIntensity: this._unitToPercent(i, xn)
|
|
7872
7872
|
},
|
|
7873
7873
|
display: {
|
|
@@ -7943,9 +7943,9 @@ class sa {
|
|
|
7943
7943
|
}
|
|
7944
7944
|
_getDirectionalLightShadowIntensity() {
|
|
7945
7945
|
const e = this.engine.scene?.children?.filter(
|
|
7946
|
-
(i) => i instanceof
|
|
7946
|
+
(i) => i instanceof Ie
|
|
7947
7947
|
);
|
|
7948
|
-
return !e || e.length === 0 ?
|
|
7948
|
+
return !e || e.length === 0 ? it : (e.find((i) => i.castShadow) ?? e[0]).shadow?.intensity ?? it;
|
|
7949
7949
|
}
|
|
7950
7950
|
_applyRenderSettings(e) {
|
|
7951
7951
|
this.setRenderMode(e.mode), this.setContrast(e.contrast), this.setSaturation(e.saturation), this.setShadowIntensity(e.shadowIntensity), this.setLightIntensity(e.lightIntensity), this.setGTAOIntensity(e.gtaoIntensity);
|
|
@@ -7978,7 +7978,7 @@ class sa {
|
|
|
7978
7978
|
}
|
|
7979
7979
|
_updateDirectionalLight(e) {
|
|
7980
7980
|
const t = this.engine.scene?.children.find(
|
|
7981
|
-
(i) => i instanceof
|
|
7981
|
+
(i) => i instanceof Ie
|
|
7982
7982
|
);
|
|
7983
7983
|
t && e(t);
|
|
7984
7984
|
}
|
|
@@ -8000,12 +8000,12 @@ class sa {
|
|
|
8000
8000
|
return JSON.parse(JSON.stringify(e));
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
|
-
class
|
|
8003
|
+
class Le {
|
|
8004
8004
|
engine;
|
|
8005
8005
|
handelBehaved;
|
|
8006
8006
|
setting;
|
|
8007
8007
|
constructor(e) {
|
|
8008
|
-
this.engine = e, this.handelBehaved =
|
|
8008
|
+
this.engine = e, this.handelBehaved = gi(e), this.handelBehaved.init(this, null), this.setting = {
|
|
8009
8009
|
// 单位
|
|
8010
8010
|
unit: "m",
|
|
8011
8011
|
// 保留几位小数,ui上还是显示0.001这样
|
|
@@ -8094,7 +8094,7 @@ class Ie {
|
|
|
8094
8094
|
});
|
|
8095
8095
|
function d(p) {
|
|
8096
8096
|
if (p.container == null) {
|
|
8097
|
-
let
|
|
8097
|
+
let L = [
|
|
8098
8098
|
'<svg class="measureSvg">',
|
|
8099
8099
|
'<circle class="measurePointer" cx="50" cy="50" r="5" fill="#f99d0b" />',
|
|
8100
8100
|
// 起点
|
|
@@ -8110,7 +8110,7 @@ class Ie {
|
|
|
8110
8110
|
'<text x="50" y="16" text-anchor="middle" class="measureLabel">' + p.text + "</text>",
|
|
8111
8111
|
"</svg>"
|
|
8112
8112
|
].join("");
|
|
8113
|
-
p.container = document.createElement("div"), p.container.className = "angle-annotation", p.container.id = p.id, p.container.style.pointerEvents = "none", p.container.innerHTML =
|
|
8113
|
+
p.container = document.createElement("div"), p.container.className = "angle-annotation", p.container.id = p.id, p.container.style.pointerEvents = "none", p.container.innerHTML = L, e.engine.measure.annotationContainer.appendChild(p.container), p.container.getElementsByTagName("svg")[0].addEventListener("click", function() {
|
|
8114
8114
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(ee.MeasureClick, p);
|
|
8115
8115
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8116
8116
|
}
|
|
@@ -8155,10 +8155,10 @@ class Ie {
|
|
|
8155
8155
|
n(p, !0), C = C / x.length, _ = _ / x.length;
|
|
8156
8156
|
let E = x.map((S) => S.x + "," + S.y).join(" "), k = [...x];
|
|
8157
8157
|
x.length >= 3 && k.push(x[0]);
|
|
8158
|
-
let B = k.map((S) => S.x + "," + S.y).join(" "),
|
|
8159
|
-
|
|
8160
|
-
let
|
|
8161
|
-
|
|
8158
|
+
let B = k.map((S) => S.x + "," + S.y).join(" "), L = p.container;
|
|
8159
|
+
L.getElementsByTagName("polygon")[0].setAttribute("points", x.length >= 3 ? E : ""), L.getElementsByTagName("polyline")[0].setAttribute("points", B);
|
|
8160
|
+
let V = C, $ = _;
|
|
8161
|
+
L.getElementsByTagName("rect")[0].setAttribute("x", V - 40), L.getElementsByTagName("rect")[0].setAttribute("y", $ - 12.5), L.getElementsByTagName("text")[0].setAttribute("x", V + 10), L.getElementsByTagName("text")[0].setAttribute("y", $ + 4), L.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 2), L.style.top = "0px", L.style.left = "0px";
|
|
8162
8162
|
}
|
|
8163
8163
|
function m(p) {
|
|
8164
8164
|
if (p.container == null) {
|
|
@@ -8193,7 +8193,7 @@ class Ie {
|
|
|
8193
8193
|
}
|
|
8194
8194
|
function w(p) {
|
|
8195
8195
|
if (p.container == null) {
|
|
8196
|
-
let
|
|
8196
|
+
let L = [
|
|
8197
8197
|
'<svg class="measureSvg">',
|
|
8198
8198
|
'<circle class="measurePointer" cx="0" cy="0" r="5" fill="#f99d0b" />',
|
|
8199
8199
|
'<rect x="0" y="-25" width="100" height="25" class="measureBack" />',
|
|
@@ -8204,7 +8204,7 @@ class Ie {
|
|
|
8204
8204
|
'<text x="50" y="51" text-anchor="middle" class="measureLabel"> Z: ' + e.getMeasureText(p.textY, 1) + "</text>",
|
|
8205
8205
|
"</svg>"
|
|
8206
8206
|
].join("");
|
|
8207
|
-
p.container = document.createElement("div"), p.container.className = "coordinate-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML =
|
|
8207
|
+
p.container = document.createElement("div"), p.container.className = "coordinate-annotation", p.container.id = p.id, p.container.style.position = "absolute", p.container.style.pointerEvents = "none", p.container.innerHTML = L, e.engine.measure.annotationContainer.appendChild(p.container), p.container.getElementsByTagName("svg")[0].addEventListener("click", function() {
|
|
8208
8208
|
e.clearHighlight(), p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0, e.engine.events.trigger(ee.MeasureClick, p);
|
|
8209
8209
|
}), p.isSelect && (p.container.getElementsByTagName("svg")[0].classList.add("Hight"), p.highlight = !0);
|
|
8210
8210
|
}
|
|
@@ -8278,7 +8278,7 @@ class oa {
|
|
|
8278
8278
|
catchDir = 0;
|
|
8279
8279
|
type = "point";
|
|
8280
8280
|
constructor(e) {
|
|
8281
|
-
this.engine = e, this.tools = new
|
|
8281
|
+
this.engine = e, this.tools = new Le(e);
|
|
8282
8282
|
}
|
|
8283
8283
|
// 启动净高测量
|
|
8284
8284
|
active() {
|
|
@@ -8349,7 +8349,7 @@ class oa {
|
|
|
8349
8349
|
if (this.type == "element") {
|
|
8350
8350
|
let n = e.catch.point.clone();
|
|
8351
8351
|
n.set(n.x, this.points[0].y, n.z);
|
|
8352
|
-
let s = new
|
|
8352
|
+
let s = new ae(n.add(new h(0, 0.01, 0)), new h(0, this.catchDir == 0 ? -1 : 1, 0));
|
|
8353
8353
|
i.point = this.points[0];
|
|
8354
8354
|
const o = this.engine.clipping?.filterIntersectionsByClipping(this.engine.octreeBox.rayInterationModel(s)) ?? this.engine.octreeBox.rayInterationModel(s);
|
|
8355
8355
|
if (o.length === 0) {
|
|
@@ -8358,7 +8358,7 @@ class oa {
|
|
|
8358
8358
|
}
|
|
8359
8359
|
t.point1 = n, t.point2 = o[0].point, t.text = t.point1.clone().distanceTo(t.point2.clone()), this.engine.events.trigger(ee.MeasureChanged, t);
|
|
8360
8360
|
} else {
|
|
8361
|
-
let n = new
|
|
8361
|
+
let n = new ae(e.catch.point.clone().add(new h(0, 0.01, 0)), new h(0, this.catchDir == 0 ? -1 : 1, 0));
|
|
8362
8362
|
const s = this.engine.clipping?.filterIntersectionsByClipping(this.engine.octreeBox.rayInterationModel(n)) ?? this.engine.octreeBox.rayInterationModel(n);
|
|
8363
8363
|
if (s.length === 0) {
|
|
8364
8364
|
t.point2 = null;
|
|
@@ -8375,7 +8375,7 @@ class ra {
|
|
|
8375
8375
|
points = [];
|
|
8376
8376
|
behavior;
|
|
8377
8377
|
constructor(e) {
|
|
8378
|
-
this.engine = e, this.tools = new
|
|
8378
|
+
this.engine = e, this.tools = new Le(e);
|
|
8379
8379
|
}
|
|
8380
8380
|
// 启动距离测量
|
|
8381
8381
|
active() {
|
|
@@ -8431,7 +8431,7 @@ class aa {
|
|
|
8431
8431
|
points = [];
|
|
8432
8432
|
behavior;
|
|
8433
8433
|
constructor(e) {
|
|
8434
|
-
this.engine = e, this.tools = new
|
|
8434
|
+
this.engine = e, this.tools = new Le(e);
|
|
8435
8435
|
}
|
|
8436
8436
|
// 启动净高测量
|
|
8437
8437
|
active() {
|
|
@@ -8469,7 +8469,7 @@ class aa {
|
|
|
8469
8469
|
isSelect: !0,
|
|
8470
8470
|
type: "clear-distance"
|
|
8471
8471
|
}, this.engine.measure.annotationData.normalAnnotation.push(t));
|
|
8472
|
-
let i = new
|
|
8472
|
+
let i = new ae(e.catch.point.clone().add(e.catch.face.normal.clone().setLength(0.01)), e.catch.face.normal);
|
|
8473
8473
|
const n = this.engine.clipping?.filterIntersectionsByClipping(this.engine.octreeBox.rayInterationModel(i)) ?? this.engine.octreeBox.rayInterationModel(i);
|
|
8474
8474
|
if (n.length == 0) {
|
|
8475
8475
|
t.point2 = null;
|
|
@@ -8486,7 +8486,7 @@ class la {
|
|
|
8486
8486
|
points = [];
|
|
8487
8487
|
behavior;
|
|
8488
8488
|
constructor(e) {
|
|
8489
|
-
this.engine = e, this.tools = new
|
|
8489
|
+
this.engine = e, this.tools = new Le(e);
|
|
8490
8490
|
}
|
|
8491
8491
|
active() {
|
|
8492
8492
|
this.engine.measure.tools.cancelCurrentSelectedAnnotation(), this.behavior = this.engine.handelBehaved, this.behavior.init(this, { showCatch: !0 }), this.behavior.active(), this.behavior.isClickSimpleModel = !1, this.isActive = !0;
|
|
@@ -8531,7 +8531,7 @@ class ca {
|
|
|
8531
8531
|
points = [];
|
|
8532
8532
|
behavior;
|
|
8533
8533
|
constructor(e) {
|
|
8534
|
-
this.engine = e, this.tools = new
|
|
8534
|
+
this.engine = e, this.tools = new Le(e);
|
|
8535
8535
|
}
|
|
8536
8536
|
active() {
|
|
8537
8537
|
this.engine.measure.tools.cancelCurrentSelectedAnnotation(), this.behavior = this.engine.handelBehaved, this.behavior.init(this, { showCatch: !0 }), this.behavior.active(), this.behavior.isClickSimpleModel = !1, this.isActive = !0;
|
|
@@ -8583,7 +8583,7 @@ class ha {
|
|
|
8583
8583
|
points = [];
|
|
8584
8584
|
behavior;
|
|
8585
8585
|
constructor(e) {
|
|
8586
|
-
this.engine = e, this.tools = new
|
|
8586
|
+
this.engine = e, this.tools = new Le(e);
|
|
8587
8587
|
}
|
|
8588
8588
|
// 启动角度测量
|
|
8589
8589
|
active() {
|
|
@@ -8650,7 +8650,7 @@ class ua {
|
|
|
8650
8650
|
points = [];
|
|
8651
8651
|
behavior;
|
|
8652
8652
|
constructor(e) {
|
|
8653
|
-
this.engine = e, this.tools = new
|
|
8653
|
+
this.engine = e, this.tools = new Le(e);
|
|
8654
8654
|
}
|
|
8655
8655
|
getCurrentDrawingMeasure() {
|
|
8656
8656
|
return this.engine.measure.annotationData.areaAnnotation.find((e) => e.isSelect == !0);
|
|
@@ -8717,7 +8717,7 @@ class ua {
|
|
|
8717
8717
|
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(ee.MeasureChanged, e)) : this.engine.measure.tools.handelKeyEscDown();
|
|
8718
8718
|
}
|
|
8719
8719
|
}
|
|
8720
|
-
class
|
|
8720
|
+
class nt {
|
|
8721
8721
|
engine;
|
|
8722
8722
|
tools;
|
|
8723
8723
|
static WORLD_UP = new h(0, 1, 0);
|
|
@@ -8726,7 +8726,7 @@ class tt {
|
|
|
8726
8726
|
points = [];
|
|
8727
8727
|
behavior;
|
|
8728
8728
|
constructor(e) {
|
|
8729
|
-
this.engine = e, this.tools = new
|
|
8729
|
+
this.engine = e, this.tools = new Le(e);
|
|
8730
8730
|
}
|
|
8731
8731
|
// 启动坡度测量
|
|
8732
8732
|
active() {
|
|
@@ -8776,24 +8776,24 @@ class tt {
|
|
|
8776
8776
|
const t = this.getWorldFaceNormal(e);
|
|
8777
8777
|
if (t == null)
|
|
8778
8778
|
return null;
|
|
8779
|
-
const i = new h().crossVectors(t,
|
|
8779
|
+
const i = new h().crossVectors(t, nt.WORLD_UP);
|
|
8780
8780
|
if (i.lengthSq() < 1e-10)
|
|
8781
8781
|
return null;
|
|
8782
8782
|
const n = new h().crossVectors(i.normalize(), t);
|
|
8783
8783
|
return n.lengthSq() < 1e-10 ? null : n.normalize();
|
|
8784
8784
|
}
|
|
8785
8785
|
pointToScreenLineDistance(e, t, i) {
|
|
8786
|
-
const n = new
|
|
8786
|
+
const n = new H().subVectors(i, t), s = n.lengthSq();
|
|
8787
8787
|
if (s < 1e-10)
|
|
8788
8788
|
return e.distanceTo(t);
|
|
8789
|
-
const o = new
|
|
8789
|
+
const o = new H().subVectors(e, t).dot(n) / s, r = t.clone().add(n.multiplyScalar(o));
|
|
8790
8790
|
return e.distanceTo(r);
|
|
8791
8791
|
}
|
|
8792
8792
|
isNearSlopeDirection(e, t, i, n, s) {
|
|
8793
8793
|
const o = new oe(this.engine.camera, this.engine.renderer, this.engine.scene), r = o.worldToScreenIfVisible(e);
|
|
8794
8794
|
if (r == null)
|
|
8795
8795
|
return !1;
|
|
8796
|
-
const l = Number.isFinite(s?.offsetX) && Number.isFinite(s?.offsetY) ? new
|
|
8796
|
+
const l = Number.isFinite(s?.offsetX) && Number.isFinite(s?.offsetY) ? new H(s.offsetX, s.offsetY) : o.worldToScreenIfVisible(n);
|
|
8797
8797
|
if (l == null)
|
|
8798
8798
|
return !1;
|
|
8799
8799
|
const c = Math.max(
|
|
@@ -8804,9 +8804,9 @@ class tt {
|
|
|
8804
8804
|
t.clone().multiplyScalar(c)
|
|
8805
8805
|
), d = o.worldToScreenIfVisible(u);
|
|
8806
8806
|
if (d != null)
|
|
8807
|
-
return this.pointToScreenLineDistance(l, r, d) <=
|
|
8807
|
+
return this.pointToScreenLineDistance(l, r, d) <= nt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
8808
8808
|
const g = o.worldToScreenIfVisible(i);
|
|
8809
|
-
return g != null && l.distanceTo(g) <=
|
|
8809
|
+
return g != null && l.distanceTo(g) <= nt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
8810
8810
|
}
|
|
8811
8811
|
getSlopeSnappedPoint(e, t, i) {
|
|
8812
8812
|
const n = t?.point;
|
|
@@ -8978,7 +8978,7 @@ class pa {
|
|
|
8978
8978
|
volumeAnnotation: []
|
|
8979
8979
|
};
|
|
8980
8980
|
constructor(e) {
|
|
8981
|
-
this.engine = e, this.clearHeightMeasure = new oa(e), this.distanceMeasure = new ra(e), this.clearDistanceMeasure = new aa(e), this.elevationMeasure = new la(e), this.pointMeasure = new ca(e), this.angleMeasure = new ha(e), this.areaMeasure = new ua(e), this.slopeMeasure = new
|
|
8981
|
+
this.engine = e, this.clearHeightMeasure = new oa(e), this.distanceMeasure = new ra(e), this.clearDistanceMeasure = new aa(e), this.elevationMeasure = new la(e), this.pointMeasure = new ca(e), this.angleMeasure = new ha(e), this.areaMeasure = new ua(e), this.slopeMeasure = new nt(e), this.faceDistanceMeasure = new da(e), this.tools = new Le(e), this.annotationContainer = document.createElement("div"), this.annotationContainer.className = "annotation-container", e.container.appendChild(this.annotationContainer);
|
|
8982
8982
|
}
|
|
8983
8983
|
setContextMenuDisabled(e) {
|
|
8984
8984
|
this.engine?.engineStatus != null && (this.engine.engineStatus.isDisableContextMenu = e);
|
|
@@ -9252,7 +9252,7 @@ class ma {
|
|
|
9252
9252
|
return this.meshs.filter((e) => e.type === "Mesh");
|
|
9253
9253
|
}
|
|
9254
9254
|
createRaycasterFromMouseEvent(e) {
|
|
9255
|
-
const t = new
|
|
9255
|
+
const t = new ae(), i = new H(), n = this.engine.renderer.domElement.clientWidth, s = this.engine.renderer.domElement.clientHeight;
|
|
9256
9256
|
return i.x = e.offsetX / n * 2 - 1, i.y = -(e.offsetY / s) * 2 + 1, t.setFromCamera(i, this.engine.camera), t;
|
|
9257
9257
|
}
|
|
9258
9258
|
isMobileDevice() {
|
|
@@ -9260,7 +9260,7 @@ class ma {
|
|
|
9260
9260
|
}
|
|
9261
9261
|
getTouchPoint(e) {
|
|
9262
9262
|
const t = e.touches[0] || e.changedTouches[0];
|
|
9263
|
-
return t ? new
|
|
9263
|
+
return t ? new H(t.clientX, t.clientY) : null;
|
|
9264
9264
|
}
|
|
9265
9265
|
createMouseEventFromTouch(e) {
|
|
9266
9266
|
const t = e.touches[0] || e.changedTouches[0], i = this.engine.renderer?.domElement;
|
|
@@ -9349,9 +9349,9 @@ class ma {
|
|
|
9349
9349
|
const t = this.engine.renderer?.domElement, i = this.engine.camera;
|
|
9350
9350
|
if (!t || !i)
|
|
9351
9351
|
return;
|
|
9352
|
-
const n = new
|
|
9352
|
+
const n = new Kt();
|
|
9353
9353
|
n.name = `SectionBoxTransformAnchor_${e}`, n.visible = this.isActive, this.engine.scene.add(n);
|
|
9354
|
-
const s = new
|
|
9354
|
+
const s = new At(i, t);
|
|
9355
9355
|
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(
|
|
9356
9356
|
this.transformHandleColor,
|
|
9357
9357
|
this.transformHandleColor,
|
|
@@ -9404,7 +9404,7 @@ class ma {
|
|
|
9404
9404
|
}
|
|
9405
9405
|
updata_face(e) {
|
|
9406
9406
|
let t = this.engine.scene.children.find((n) => n.type == "Group" && n.name == "ClippingBox");
|
|
9407
|
-
t == null && (t = new
|
|
9407
|
+
t == null && (t = new he(), t.name = "ClippingBox", this.engine.scene.add(t)), [
|
|
9408
9408
|
{
|
|
9409
9409
|
name: "前",
|
|
9410
9410
|
normal: new h(0, 0, -1),
|
|
@@ -9479,7 +9479,7 @@ class ma {
|
|
|
9479
9479
|
}
|
|
9480
9480
|
].forEach((n) => {
|
|
9481
9481
|
this.createFace(t, n.vertices, n.normal, n.name, n.isMinFace, n.planePoint);
|
|
9482
|
-
}),
|
|
9482
|
+
}), di(this.engine).forEach((n) => {
|
|
9483
9483
|
n.material && Array.isArray(n.material) ? n.material.forEach((s) => {
|
|
9484
9484
|
s.clippingPlanes = this.engine.sectionPlane;
|
|
9485
9485
|
}) : n.material.clippingPlanes = this.engine.sectionPlane;
|
|
@@ -9500,7 +9500,7 @@ class ma {
|
|
|
9500
9500
|
t[3].y,
|
|
9501
9501
|
t[3].z
|
|
9502
9502
|
]), c = [0, 2, 1, 0, 3, 2];
|
|
9503
|
-
r.setAttribute("position", new
|
|
9503
|
+
r.setAttribute("position", new rt(l, 3)), r.setIndex(c);
|
|
9504
9504
|
let u = this.meshs.find((p) => p.name === n);
|
|
9505
9505
|
if (u == null) {
|
|
9506
9506
|
const p = new me({
|
|
@@ -9534,9 +9534,9 @@ class ma {
|
|
|
9534
9534
|
t[0].y,
|
|
9535
9535
|
t[0].z
|
|
9536
9536
|
]), g = new ke({ color: 255 }), m = new Me();
|
|
9537
|
-
m.setAttribute("position", new
|
|
9537
|
+
m.setAttribute("position", new rt(d, 3));
|
|
9538
9538
|
let w = this.meshs.find((p) => p.name === n + "Line");
|
|
9539
|
-
w == null ? (w = new
|
|
9539
|
+
w == null ? (w = new at(m, g), w.name = n + "Line", e.add(w), this.meshs.push(w)) : (w.geometry = m, w.material = g);
|
|
9540
9540
|
const v = new h();
|
|
9541
9541
|
t.forEach((p) => v.add(p)), v.multiplyScalar(1 / t.length), this.updateFaceTransformControl(n, i, v, s);
|
|
9542
9542
|
const b = this.engine.sectionPlane.find((p) => p.name == n);
|
|
@@ -9753,7 +9753,7 @@ class ga {
|
|
|
9753
9753
|
return;
|
|
9754
9754
|
this.distance = e;
|
|
9755
9755
|
let i = this.engine.scene.children.find((E) => E.type == "Group" && E.name == "ClippingBox");
|
|
9756
|
-
i == null && (i = new
|
|
9756
|
+
i == null && (i = new he(), i.name = "ClippingBox", this.engine.scene.add(i));
|
|
9757
9757
|
const n = this.normal.clone().normalize(), s = this.getEffectiveNormal(n), o = this.center ?? new h(
|
|
9758
9758
|
(this.box.min.x + this.box.max.x) / 2,
|
|
9759
9759
|
(this.box.min.y + this.box.max.y) / 2,
|
|
@@ -9763,8 +9763,8 @@ class ga {
|
|
|
9763
9763
|
const r = t?.clone() ?? o.clone().add(n.clone().multiplyScalar(e)), { tangent: l, bitangent: c } = this.getPlaneBasis(n), u = this.getBoxCorners(this.box), d = this.box.min.distanceTo(this.box.max), g = Math.max(d * 0.02, 0.01);
|
|
9764
9764
|
let m = 1 / 0, w = -1 / 0, v = 1 / 0, b = -1 / 0;
|
|
9765
9765
|
u.forEach((E) => {
|
|
9766
|
-
const k = E.clone().sub(r), B = k.dot(l),
|
|
9767
|
-
m = Math.min(m, B), w = Math.max(w, B), v = Math.min(v,
|
|
9766
|
+
const k = E.clone().sub(r), B = k.dot(l), L = k.dot(c);
|
|
9767
|
+
m = Math.min(m, B), w = Math.max(w, B), v = Math.min(v, L), b = Math.max(b, L);
|
|
9768
9768
|
}), m -= g, w += g, v -= g, b += g;
|
|
9769
9769
|
const p = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(v)), x = r.clone().add(l.clone().multiplyScalar(w)).add(c.clone().multiplyScalar(v)), C = r.clone().add(l.clone().multiplyScalar(w)).add(c.clone().multiplyScalar(b)), _ = r.clone().add(l.clone().multiplyScalar(m)).add(c.clone().multiplyScalar(b));
|
|
9770
9770
|
this.current_center = r.clone(), this.createFace(i, [p, x, C, _], n, "face"), this.updateTransformControl(s), this.updateRotateControl(s);
|
|
@@ -9784,7 +9784,7 @@ class ga {
|
|
|
9784
9784
|
t[3].y,
|
|
9785
9785
|
t[3].z
|
|
9786
9786
|
]), r = this.getEffectiveNormal(i), l = this.getDirectionSign() === 1 ? [0, 1, 2, 0, 2, 3] : [0, 2, 1, 0, 3, 2];
|
|
9787
|
-
s.setAttribute("position", new
|
|
9787
|
+
s.setAttribute("position", new rt(o, 3)), s.setIndex(l), s.computeVertexNormals();
|
|
9788
9788
|
let c = this.meshs.find((v) => v.name == n);
|
|
9789
9789
|
if (c == null) {
|
|
9790
9790
|
const v = new me({
|
|
@@ -9814,9 +9814,9 @@ class ga {
|
|
|
9814
9814
|
t[0].y,
|
|
9815
9815
|
t[0].z
|
|
9816
9816
|
]), d = new ke({ color: 255 }), g = new Me();
|
|
9817
|
-
g.setAttribute("position", new
|
|
9817
|
+
g.setAttribute("position", new rt(u, 3));
|
|
9818
9818
|
let m = this.meshs.find((v) => v.name == n + "Line");
|
|
9819
|
-
m == null ? (m = new
|
|
9819
|
+
m == null ? (m = new at(g, d), m.name = n + "Line", e.add(m), this.meshs.push(m)) : (m.geometry = g, m.material = d);
|
|
9820
9820
|
const w = this.engine.sectionPlane.find((v) => v.name == n);
|
|
9821
9821
|
w && this.current_center && w.setFromNormalAndCoplanarPoint(
|
|
9822
9822
|
r,
|
|
@@ -9831,7 +9831,7 @@ class ga {
|
|
|
9831
9831
|
}
|
|
9832
9832
|
applyClippingToModelMeshes() {
|
|
9833
9833
|
const e = this.engine.sectionPlane?.find?.((t) => t.name === "face");
|
|
9834
|
-
|
|
9834
|
+
di(this.engine).forEach((t) => {
|
|
9835
9835
|
this.applyClippingToMaterial(t.material), this.engine.clipping.clippingStencil?.addMesh(e, t);
|
|
9836
9836
|
}), this.requestShadowRefresh();
|
|
9837
9837
|
}
|
|
@@ -9867,10 +9867,10 @@ class ga {
|
|
|
9867
9867
|
const i = e._gizmo?.picker?.[e.mode];
|
|
9868
9868
|
if (!i)
|
|
9869
9869
|
return null;
|
|
9870
|
-
const n = this.engine.renderer.domElement.getBoundingClientRect(), s = new
|
|
9870
|
+
const n = this.engine.renderer.domElement.getBoundingClientRect(), s = new H(
|
|
9871
9871
|
(t.clientX - n.left) / n.width * 2 - 1,
|
|
9872
9872
|
-((t.clientY - n.top) / n.height) * 2 + 1
|
|
9873
|
-
), o = new
|
|
9873
|
+
), o = new ae();
|
|
9874
9874
|
return o.setFromCamera(s, this.engine.camera), o.intersectObject(i, !0).find((l) => l.object.visible) ?? null;
|
|
9875
9875
|
}
|
|
9876
9876
|
getPlaneBasis(e) {
|
|
@@ -9916,7 +9916,7 @@ class ga {
|
|
|
9916
9916
|
return Math.max(e * 0.015, 0.06);
|
|
9917
9917
|
}
|
|
9918
9918
|
getPlaneQuaternion(e) {
|
|
9919
|
-
const { tangent: t, bitangent: i } = this.getPlaneBasis(e), n = new
|
|
9919
|
+
const { tangent: t, bitangent: i } = this.getPlaneBasis(e), n = new G().makeBasis(
|
|
9920
9920
|
t,
|
|
9921
9921
|
i,
|
|
9922
9922
|
e.clone().normalize()
|
|
@@ -9948,9 +9948,9 @@ class ga {
|
|
|
9948
9948
|
const e = this.engine.renderer?.domElement, t = this.engine.camera;
|
|
9949
9949
|
if (!e || !t)
|
|
9950
9950
|
return;
|
|
9951
|
-
const i = new
|
|
9951
|
+
const i = new Kt();
|
|
9952
9952
|
i.name = "SectionFaceTransformAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
9953
|
-
const n = new
|
|
9953
|
+
const n = new At(t, e);
|
|
9954
9954
|
n.name = "SectionFaceTransformControl", n.setMode("translate"), n.setSpace("local"), n.showX = !0, n.showY = !1, n.showZ = !1, n.size = this.transformHandleSize, n.setColors(
|
|
9955
9955
|
this.transformHandleColor,
|
|
9956
9956
|
this.transformHandleColor,
|
|
@@ -9968,9 +9968,9 @@ class ga {
|
|
|
9968
9968
|
const e = this.engine.renderer?.domElement, t = this.engine.camera;
|
|
9969
9969
|
if (!e || !t)
|
|
9970
9970
|
return;
|
|
9971
|
-
const i = new
|
|
9971
|
+
const i = new Kt();
|
|
9972
9972
|
i.name = "SectionFaceRotateAnchor", i.visible = this.isActive, this.engine.scene.add(i);
|
|
9973
|
-
const n = new
|
|
9973
|
+
const n = new At(t, e);
|
|
9974
9974
|
n.name = "SectionFaceRotateControl", n.setMode("rotate"), n.setSpace("local"), n.showX = !0, n.showY = !0, n.showZ = !1, n.size = this.rotateHandleSize, n.setColors(
|
|
9975
9975
|
this.transformHandleColor,
|
|
9976
9976
|
this.transformHandleColor,
|
|
@@ -9998,7 +9998,7 @@ class ga {
|
|
|
9998
9998
|
this.ensureRotateControl(), !(!this.rotateControl || !this.rotateAnchor || !this.current_center) && (this.isSyncingRotateControl = !0, this.rotateAnchor.position.copy(this.current_center), this.rotateAnchor.quaternion.copy(this.getPlaneQuaternion(e)), this.rotateAnchor.visible = this.isActive, this.rotateControl.object !== this.rotateAnchor && this.rotateControl.attach(this.rotateAnchor), this.applyControlModeLock(), this.rotateHelper && (this.rotateHelper.visible = this.isActive), this.isSyncingRotateControl = !1);
|
|
9999
9999
|
}
|
|
10000
10000
|
createRaycasterFromMouseEvent(e) {
|
|
10001
|
-
const t = new
|
|
10001
|
+
const t = new ae(), i = new H(), n = this.engine.renderer.domElement.clientWidth, s = this.engine.renderer.domElement.clientHeight;
|
|
10002
10002
|
return i.x = e.offsetX / n * 2 - 1, i.y = -(e.offsetY / s) * 2 + 1, t.setFromCamera(i, this.engine.camera), t;
|
|
10003
10003
|
}
|
|
10004
10004
|
isMobileDevice() {
|
|
@@ -10006,7 +10006,7 @@ class ga {
|
|
|
10006
10006
|
}
|
|
10007
10007
|
getTouchPoint(e) {
|
|
10008
10008
|
const t = e.touches[0] || e.changedTouches[0];
|
|
10009
|
-
return t ? new
|
|
10009
|
+
return t ? new H(t.clientX, t.clientY) : null;
|
|
10010
10010
|
}
|
|
10011
10011
|
createMouseEventFromTouch(e) {
|
|
10012
10012
|
const t = e.touches[0] || e.changedTouches[0], i = this.engine.renderer?.domElement;
|
|
@@ -10152,8 +10152,8 @@ class ya {
|
|
|
10152
10152
|
fillTextureRotation = 0;
|
|
10153
10153
|
constructor(e) {
|
|
10154
10154
|
this.engine = e, this.evaluator = new ms();
|
|
10155
|
-
const t =
|
|
10156
|
-
i.wrapS =
|
|
10155
|
+
const t = W("/texture/fill.png", import.meta.url), i = new Oe().load(t);
|
|
10156
|
+
i.wrapS = Et, i.wrapT = Et, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new ai({
|
|
10157
10157
|
color: 14079687,
|
|
10158
10158
|
map: i,
|
|
10159
10159
|
side: ge,
|
|
@@ -10229,7 +10229,7 @@ class ya {
|
|
|
10229
10229
|
}
|
|
10230
10230
|
if (c.geometry.dispose(), u.length === 0)
|
|
10231
10231
|
return;
|
|
10232
|
-
const d =
|
|
10232
|
+
const d = ot(u, !1);
|
|
10233
10233
|
if (u.forEach((v) => v.dispose()), !d)
|
|
10234
10234
|
return;
|
|
10235
10235
|
this.applyPlanarUv(d, e);
|
|
@@ -10354,13 +10354,13 @@ class ya {
|
|
|
10354
10354
|
* - 平移到 plane 上
|
|
10355
10355
|
*/
|
|
10356
10356
|
createPlaneBrush(e, t, i) {
|
|
10357
|
-
const n = new
|
|
10357
|
+
const n = new Ct(t, t, i), s = e.coplanarPoint(new h()), o = new De().setFromUnitVectors(
|
|
10358
10358
|
new h(0, 0, 1),
|
|
10359
10359
|
e.normal.clone().normalize()
|
|
10360
|
-
), r = new
|
|
10360
|
+
), r = new G().compose(s, o, new h(1, 1, 1));
|
|
10361
10361
|
n.applyMatrix4(r);
|
|
10362
10362
|
const l = this.toCsgReadyGeometry(n);
|
|
10363
|
-
return n.dispose(), new
|
|
10363
|
+
return n.dispose(), new wi(l);
|
|
10364
10364
|
}
|
|
10365
10365
|
/**
|
|
10366
10366
|
* 将场景 mesh 转为世界坐标 Brush。
|
|
@@ -10373,7 +10373,7 @@ class ya {
|
|
|
10373
10373
|
const i = t.clone();
|
|
10374
10374
|
i.applyMatrix4(e.matrixWorld);
|
|
10375
10375
|
const n = this.toCsgReadyGeometry(i);
|
|
10376
|
-
return i.dispose(), new
|
|
10376
|
+
return i.dispose(), new wi(n);
|
|
10377
10377
|
}
|
|
10378
10378
|
/**
|
|
10379
10379
|
* 统一 CSG 输入属性,避免属性不一致报错(例如 uv 缺失)。
|
|
@@ -10385,7 +10385,7 @@ class ya {
|
|
|
10385
10385
|
const i = t.getAttribute("position");
|
|
10386
10386
|
if (i && !t.getAttribute("uv")) {
|
|
10387
10387
|
const s = new Float32Array(i.count * 2);
|
|
10388
|
-
t.setAttribute("uv", new
|
|
10388
|
+
t.setAttribute("uv", new Pt(s, 2));
|
|
10389
10389
|
}
|
|
10390
10390
|
const n = /* @__PURE__ */ new Set(["position", "normal", "uv"]);
|
|
10391
10391
|
return Object.keys(t.attributes).forEach((s) => {
|
|
@@ -10410,8 +10410,8 @@ class ya {
|
|
|
10410
10410
|
for (let _ = 0; _ < s.count; _ += 3) {
|
|
10411
10411
|
if (u.fromBufferAttribute(s, _), d.fromBufferAttribute(s, _ + 1), g.fromBufferAttribute(s, _ + 2), l.subVectors(d, u), c.subVectors(g, u), r.crossVectors(l, c), r.lengthSq() < 1e-14 || (r.normalize(), Math.abs(r.dot(o)) < 0.9))
|
|
10412
10412
|
continue;
|
|
10413
|
-
const E = t.distanceToPoint(u), k = t.distanceToPoint(d), B = t.distanceToPoint(g),
|
|
10414
|
-
if (Math.max(E, k, B) -
|
|
10413
|
+
const E = t.distanceToPoint(u), k = t.distanceToPoint(d), B = t.distanceToPoint(g), L = Math.min(E, k, B);
|
|
10414
|
+
if (Math.max(E, k, B) - L > b)
|
|
10415
10415
|
continue;
|
|
10416
10416
|
const $ = (E + k + B) / 3;
|
|
10417
10417
|
Math.abs($) > p || $ < 0 || (m.copy(u).addScaledVector(o, -E), w.copy(d).addScaledVector(o, -k), v.copy(g).addScaledVector(o, -B), r.dot(o) <= 0 ? (x.push(m.x, m.y, m.z), x.push(w.x, w.y, w.z), x.push(v.x, v.y, v.z)) : (x.push(m.x, m.y, m.z), x.push(v.x, v.y, v.z), x.push(w.x, w.y, w.z)));
|
|
@@ -10419,7 +10419,7 @@ class ya {
|
|
|
10419
10419
|
if (n.dispose(), x.length < 9)
|
|
10420
10420
|
return null;
|
|
10421
10421
|
const C = new Me();
|
|
10422
|
-
return C.setAttribute("position", new
|
|
10422
|
+
return C.setAttribute("position", new Pt(x, 3)), C.computeVertexNormals(), C;
|
|
10423
10423
|
}
|
|
10424
10424
|
applyPlanarUv(e, t) {
|
|
10425
10425
|
const i = e.getAttribute("position");
|
|
@@ -10435,7 +10435,7 @@ class ya {
|
|
|
10435
10435
|
const g = Math.max(c - l, 1e-6), m = Math.max(d - u, 1e-6);
|
|
10436
10436
|
for (let w = 0; w < r.length; w += 2)
|
|
10437
10437
|
r[w] = (r[w] - l) / g * this.fillTextureRepeat, r[w + 1] = (r[w + 1] - u) / m * this.fillTextureRepeat;
|
|
10438
|
-
e.setAttribute("uv", new
|
|
10438
|
+
e.setAttribute("uv", new rt(r, 2));
|
|
10439
10439
|
}
|
|
10440
10440
|
getPlaneBasis(e) {
|
|
10441
10441
|
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));
|
|
@@ -10669,7 +10669,7 @@ class va {
|
|
|
10669
10669
|
t instanceof Z && (t.constant = 1e5), this.applySectionPlanesToModelMeshes(), this.clippingCSGSimple?.updataFaces?.(e.slice(0, 6));
|
|
10670
10670
|
}
|
|
10671
10671
|
applySectionPlanesToModelMeshes() {
|
|
10672
|
-
|
|
10672
|
+
di(this.engine).forEach((e) => {
|
|
10673
10673
|
e.material && Array.isArray(e.material) ? e.material.forEach((t) => {
|
|
10674
10674
|
t.clippingPlanes = this.engine.sectionPlane, t.clipShadows = !0;
|
|
10675
10675
|
}) : e.material && (e.material.clippingPlanes = this.engine.sectionPlane, e.material.clipShadows = !0);
|
|
@@ -10777,7 +10777,7 @@ class xa {
|
|
|
10777
10777
|
// 通过构件,属性名获取构件属性
|
|
10778
10778
|
getModelPropertiesWithName(e, t, i, n) {
|
|
10779
10779
|
let s = this.extended.get(e), o = this.engine.engineStatus.models.find((l) => l.url === e);
|
|
10780
|
-
o.properties == null ? (
|
|
10780
|
+
o.properties == null ? (Dt(this.engine, e, e + "/property"), _t(
|
|
10781
10781
|
e + "/property",
|
|
10782
10782
|
(l) => {
|
|
10783
10783
|
let c = JSON.parse(l);
|
|
@@ -10802,7 +10802,7 @@ class xa {
|
|
|
10802
10802
|
// 查询构件属性
|
|
10803
10803
|
getModelProperties(e, t, i) {
|
|
10804
10804
|
let n = this.extended.get(e), s = this.engine.engineStatus.models.find((r) => r.url === e);
|
|
10805
|
-
s.properties == null && (
|
|
10805
|
+
s.properties == null && (Dt(this.engine, e, e + "/property"), _t(
|
|
10806
10806
|
e + "/property",
|
|
10807
10807
|
(r) => {
|
|
10808
10808
|
let l = JSON.parse(r);
|
|
@@ -12136,7 +12136,7 @@ class _a {
|
|
|
12136
12136
|
const r = t ? this.toVector3(t) : i.clone().add(n), l = this.buildSafeUpDirection(n, s, o.up);
|
|
12137
12137
|
o.position.copy(i), o.up.copy(l), o.lookAt(r), o.updateMatrix(), o.updateMatrixWorld(!0);
|
|
12138
12138
|
const c = {
|
|
12139
|
-
type: this.engine.cameraModule?.getCameraType?.() ??
|
|
12139
|
+
type: this.engine.cameraModule?.getCameraType?.() ?? Mt.PERSPECTIVE,
|
|
12140
12140
|
position: this.getPoint(i),
|
|
12141
12141
|
rotation: {
|
|
12142
12142
|
x: o.rotation.x,
|
|
@@ -12199,7 +12199,7 @@ class _a {
|
|
|
12199
12199
|
if (!e || !e.position)
|
|
12200
12200
|
return null;
|
|
12201
12201
|
const i = this.engine.camera, n = {
|
|
12202
|
-
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ??
|
|
12202
|
+
type: e.type ?? this.engine.cameraModule?.getCameraType?.() ?? Mt.PERSPECTIVE,
|
|
12203
12203
|
position: e.position,
|
|
12204
12204
|
rotation: e.rotation ?? { x: 0, y: 0, z: 0 },
|
|
12205
12205
|
quaternion: e.quaternion ?? { x: 0, y: 0, z: 0, w: 1 },
|
|
@@ -12212,7 +12212,7 @@ class _a {
|
|
|
12212
12212
|
y: 0,
|
|
12213
12213
|
z: 0,
|
|
12214
12214
|
w: 1
|
|
12215
|
-
}), i instanceof ve && n.type ===
|
|
12215
|
+
}), i instanceof ve && n.type === Mt.ORTHOGRAPHIC && (n.zoom = e.zoom ?? i.zoom, n.orthographicHeight = e.orthographicHeight ?? this.engine.cameraModule.getOrthographicVisibleHeight(i)), n;
|
|
12216
12216
|
}
|
|
12217
12217
|
buildSafeUpDirection(e, t, i) {
|
|
12218
12218
|
const n = t.lengthSq() > 0 ? t.clone() : i.clone().normalize();
|
|
@@ -12258,7 +12258,7 @@ class Da {
|
|
|
12258
12258
|
}), (Number(e.detail.id) == -1 || t) && this.engine.modelToolModule.unhighlightAllModels();
|
|
12259
12259
|
};
|
|
12260
12260
|
}
|
|
12261
|
-
class
|
|
12261
|
+
class La {
|
|
12262
12262
|
engine;
|
|
12263
12263
|
constructor(e) {
|
|
12264
12264
|
this.engine = e, this.active();
|
|
@@ -12307,12 +12307,12 @@ class Ia {
|
|
|
12307
12307
|
i?.target ? (i.target.copy(l), i.update(), i.dispatchEvent?.({ type: "change" })) : t.lookAt(l);
|
|
12308
12308
|
}
|
|
12309
12309
|
}
|
|
12310
|
-
const
|
|
12310
|
+
const qe = {
|
|
12311
12311
|
EncodingStart: "encoding-start",
|
|
12312
12312
|
EncodingComplete: "encoding-complete",
|
|
12313
12313
|
EncodingError: "encoding-error"
|
|
12314
12314
|
};
|
|
12315
|
-
class
|
|
12315
|
+
class Ia {
|
|
12316
12316
|
engine;
|
|
12317
12317
|
apiKey;
|
|
12318
12318
|
baseURL = "https://api.deepseek.com";
|
|
@@ -12393,14 +12393,14 @@ class La {
|
|
|
12393
12393
|
// 开始编码
|
|
12394
12394
|
async start() {
|
|
12395
12395
|
let e = ["注释", "族名称"], t = ["梁", "墩", "桩", "墙", "面", "台", "石", "支"];
|
|
12396
|
-
this.engine.events.trigger(
|
|
12396
|
+
this.engine.events.trigger(qe.EncodingStart, { message: "编码开始" });
|
|
12397
12397
|
let i = [], n = "";
|
|
12398
12398
|
if (this.engine.models.forEach((c) => {
|
|
12399
12399
|
n = c.url, c.nodesMap.forEach((u, d) => {
|
|
12400
12400
|
t.some((g) => u.infos[0].name.includes(g)) && i.push({ id: d, url: c.url });
|
|
12401
12401
|
});
|
|
12402
12402
|
}), i.length === 0) {
|
|
12403
|
-
this.engine.events.trigger(
|
|
12403
|
+
this.engine.events.trigger(qe.EncodingComplete, { message: "无匹配构件", results: [] });
|
|
12404
12404
|
return;
|
|
12405
12405
|
}
|
|
12406
12406
|
let s = await this.queryProperties(i, e);
|
|
@@ -12408,7 +12408,7 @@ class La {
|
|
|
12408
12408
|
let r = [], l = Math.ceil(s.length / o);
|
|
12409
12409
|
for (let c = 0; c < s.length; c += o) {
|
|
12410
12410
|
let u = s.slice(c, c + o), d = Math.floor(c / o) + 1;
|
|
12411
|
-
this.engine.events.trigger(
|
|
12411
|
+
this.engine.events.trigger(qe.EncodingStart, {
|
|
12412
12412
|
message: `正在编码第 ${d}/${l} 批`,
|
|
12413
12413
|
batch: d,
|
|
12414
12414
|
totalBatches: l
|
|
@@ -12417,13 +12417,13 @@ class La {
|
|
|
12417
12417
|
let g = await this.startChat(n, JSON.stringify(u));
|
|
12418
12418
|
r = r.concat(g);
|
|
12419
12419
|
} catch (g) {
|
|
12420
|
-
this.engine.events.trigger(
|
|
12420
|
+
this.engine.events.trigger(qe.EncodingError, {
|
|
12421
12421
|
message: `第 ${d} 批编码失败`,
|
|
12422
12422
|
error: g
|
|
12423
12423
|
});
|
|
12424
12424
|
}
|
|
12425
12425
|
}
|
|
12426
|
-
this.engine.events.trigger(
|
|
12426
|
+
this.engine.events.trigger(qe.EncodingComplete, {
|
|
12427
12427
|
message: "编码完成",
|
|
12428
12428
|
url: n,
|
|
12429
12429
|
results: r,
|
|
@@ -12464,7 +12464,7 @@ class La {
|
|
|
12464
12464
|
r.set(l.id, c);
|
|
12465
12465
|
}), this.engine.modelProperties.updateExtended(e, r), this.savaModelCodeToStoge(e), o;
|
|
12466
12466
|
} catch (i) {
|
|
12467
|
-
return console.error("编码失败:", i), this.engine.events.trigger(
|
|
12467
|
+
return console.error("编码失败:", i), this.engine.events.trigger(qe.EncodingError, {
|
|
12468
12468
|
message: "编码失败",
|
|
12469
12469
|
error: i
|
|
12470
12470
|
}), [];
|
|
@@ -12679,8 +12679,8 @@ function Oa(a, e, t) {
|
|
|
12679
12679
|
if (!i || !n || !s)
|
|
12680
12680
|
return null;
|
|
12681
12681
|
const o = new rn(e, t, {
|
|
12682
|
-
minFilter:
|
|
12683
|
-
magFilter:
|
|
12682
|
+
minFilter: xt,
|
|
12683
|
+
magFilter: xt,
|
|
12684
12684
|
format: an,
|
|
12685
12685
|
depthBuffer: !0,
|
|
12686
12686
|
stencilBuffer: !0
|
|
@@ -12721,14 +12721,14 @@ const Ha = [
|
|
|
12721
12721
|
"#722ed1",
|
|
12722
12722
|
"#eb2f96"
|
|
12723
12723
|
], Va = {
|
|
12724
|
-
none:
|
|
12725
|
-
line:
|
|
12726
|
-
arrow:
|
|
12727
|
-
rect:
|
|
12728
|
-
circle:
|
|
12729
|
-
text:
|
|
12730
|
-
cloudline:
|
|
12731
|
-
}, Ua =
|
|
12724
|
+
none: W("/assets/icon/选择.svg", import.meta.url),
|
|
12725
|
+
line: W("/assets/icon/线.svg", import.meta.url),
|
|
12726
|
+
arrow: W("/assets/icon/箭头.svg", import.meta.url),
|
|
12727
|
+
rect: W("/assets/icon/矩形.svg", import.meta.url),
|
|
12728
|
+
circle: W("/assets/icon/圆形.svg", import.meta.url),
|
|
12729
|
+
text: W("/assets/icon/文字.svg", import.meta.url),
|
|
12730
|
+
cloudline: W("/assets/icon/云线.svg", import.meta.url)
|
|
12731
|
+
}, Ua = W("/assets/icon/测距.svg", import.meta.url), Ga = W("/assets/icon/截图.svg", import.meta.url), Wa = W("/assets/icon/线宽.svg", import.meta.url), qa = W("/assets/icon/字号.svg", import.meta.url), ja = `data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l4 8-4 12-4-12 4-8z" fill="#1677ff"/><circle cx="12" cy="10" r="2.5" fill="#fff"/></svg>')}`, Ka = [
|
|
12732
12732
|
{ type: "distance", label: "距离" },
|
|
12733
12733
|
{ type: "clearDistance", label: "净距" },
|
|
12734
12734
|
{ type: "clearHeight", label: "净高" },
|
|
@@ -12738,14 +12738,14 @@ const Ha = [
|
|
|
12738
12738
|
{ type: "area", label: "面积" },
|
|
12739
12739
|
{ type: "slope", label: "坡度" }
|
|
12740
12740
|
], Ya = {
|
|
12741
|
-
distance:
|
|
12742
|
-
clearDistance:
|
|
12743
|
-
clearHeight:
|
|
12744
|
-
elevation:
|
|
12745
|
-
point:
|
|
12746
|
-
angle:
|
|
12747
|
-
area:
|
|
12748
|
-
slope:
|
|
12741
|
+
distance: W("/assets/icon/距离.svg", import.meta.url),
|
|
12742
|
+
clearDistance: W("/assets/icon/净距.svg", import.meta.url),
|
|
12743
|
+
clearHeight: W("/assets/icon/净高.svg", import.meta.url),
|
|
12744
|
+
elevation: W("/assets/icon/标高.svg", import.meta.url),
|
|
12745
|
+
point: W("/assets/icon/坐标.svg", import.meta.url),
|
|
12746
|
+
angle: W("/assets/icon/角度.svg", import.meta.url),
|
|
12747
|
+
area: W("/assets/icon/面积.svg", import.meta.url),
|
|
12748
|
+
slope: W("/assets/icon/坡度.svg", import.meta.url)
|
|
12749
12749
|
};
|
|
12750
12750
|
class Xa {
|
|
12751
12751
|
constructor(e, t) {
|
|
@@ -13259,7 +13259,7 @@ class $a {
|
|
|
13259
13259
|
};
|
|
13260
13260
|
}
|
|
13261
13261
|
createLineObject(e, t, i, n) {
|
|
13262
|
-
const s = new
|
|
13262
|
+
const s = new Bt([e.x, e.y, t.x, t.y], {
|
|
13263
13263
|
...this.createObjectBase(i, n),
|
|
13264
13264
|
fill: "",
|
|
13265
13265
|
strokeLineCap: "round"
|
|
@@ -13292,34 +13292,34 @@ class $a {
|
|
|
13292
13292
|
createArrowObject(e, t, i, n) {
|
|
13293
13293
|
const s = t.x - e.x, o = t.y - e.y, r = Math.sqrt(s * s + o * o);
|
|
13294
13294
|
if (r < 1e-6) {
|
|
13295
|
-
const
|
|
13295
|
+
const L = new Bt([e.x, e.y, t.x, t.y], {
|
|
13296
13296
|
stroke: i.stroke,
|
|
13297
13297
|
strokeWidth: i.strokeWidth,
|
|
13298
13298
|
fill: "",
|
|
13299
13299
|
selectable: n,
|
|
13300
13300
|
evented: n
|
|
13301
|
-
}),
|
|
13301
|
+
}), V = new Si([L], {
|
|
13302
13302
|
selectable: n,
|
|
13303
13303
|
evented: n,
|
|
13304
13304
|
objectCaching: !1
|
|
13305
13305
|
});
|
|
13306
|
-
return
|
|
13306
|
+
return V.annotationType = "arrow", V;
|
|
13307
13307
|
}
|
|
13308
|
-
const l = s / r, c = o / r, u = -c, d = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, w = t.x - l * g, v = t.y - c * g, b = w + u * (m * 0.5), p = v + d * (m * 0.5), x = w - u * (m * 0.5), C = v - d * (m * 0.5), _ = new
|
|
13308
|
+
const l = s / r, c = o / r, u = -c, d = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, w = t.x - l * g, v = t.y - c * g, b = w + u * (m * 0.5), p = v + d * (m * 0.5), x = w - u * (m * 0.5), C = v - d * (m * 0.5), _ = new Bt([e.x, e.y, t.x, t.y], {
|
|
13309
13309
|
stroke: i.stroke,
|
|
13310
13310
|
strokeWidth: i.strokeWidth,
|
|
13311
13311
|
fill: "",
|
|
13312
13312
|
strokeLineCap: "round",
|
|
13313
13313
|
selectable: !1,
|
|
13314
13314
|
evented: !1
|
|
13315
|
-
}), E = `M ${t.x} ${t.y} L ${b} ${p} L ${x} ${C} Z`, k = new
|
|
13315
|
+
}), E = `M ${t.x} ${t.y} L ${b} ${p} L ${x} ${C} Z`, k = new Ei(E, {
|
|
13316
13316
|
fill: i.stroke,
|
|
13317
13317
|
stroke: i.stroke,
|
|
13318
13318
|
strokeWidth: 1,
|
|
13319
13319
|
selectable: !1,
|
|
13320
13320
|
evented: !1,
|
|
13321
13321
|
objectCaching: !1
|
|
13322
|
-
}), B = new
|
|
13322
|
+
}), B = new Si([_, k], {
|
|
13323
13323
|
selectable: n,
|
|
13324
13324
|
evented: n,
|
|
13325
13325
|
objectCaching: !1
|
|
@@ -13330,7 +13330,7 @@ class $a {
|
|
|
13330
13330
|
const n = this.buildCloudPath(e, t.cloudRadius);
|
|
13331
13331
|
if (!n)
|
|
13332
13332
|
return null;
|
|
13333
|
-
const s = new
|
|
13333
|
+
const s = new Ei(n, {
|
|
13334
13334
|
stroke: t.stroke,
|
|
13335
13335
|
strokeWidth: t.strokeWidth,
|
|
13336
13336
|
fill: "",
|
|
@@ -13743,10 +13743,10 @@ class Za {
|
|
|
13743
13743
|
return !e || !this.engine.camera ? Promise.resolve(null) : (e.style.cursor = "crosshair", new Promise((t) => {
|
|
13744
13744
|
const i = (n) => {
|
|
13745
13745
|
n.preventDefault(), n.stopImmediatePropagation(), e.removeEventListener("click", i, !0), e.style.cursor = "";
|
|
13746
|
-
const s = e.getBoundingClientRect(), o = n.clientX - s.left, r = n.clientY - s.top, l = new
|
|
13746
|
+
const s = e.getBoundingClientRect(), o = n.clientX - s.left, r = n.clientY - s.top, l = new H(
|
|
13747
13747
|
o / (e.clientWidth || 1) * 2 - 1,
|
|
13748
13748
|
-(r / (e.clientHeight || 1)) * 2 + 1
|
|
13749
|
-
), c = new
|
|
13749
|
+
), c = new ae();
|
|
13750
13750
|
c.setFromCamera(l, this.engine.camera);
|
|
13751
13751
|
const u = this.pickNearestModelPoint(c);
|
|
13752
13752
|
if (!u) {
|
|
@@ -13979,7 +13979,7 @@ class Za {
|
|
|
13979
13979
|
return e;
|
|
13980
13980
|
}
|
|
13981
13981
|
}
|
|
13982
|
-
const
|
|
13982
|
+
const Wt = "bim-engine:model-link-3d", Ja = "default-model-link-3d-group", Ji = {
|
|
13983
13983
|
enabled: !1,
|
|
13984
13984
|
highlight: !0,
|
|
13985
13985
|
visibility: !0,
|
|
@@ -14005,7 +14005,7 @@ class Qa {
|
|
|
14005
14005
|
* 初始化全局事件监听、相机监听和模型工具方法包装。
|
|
14006
14006
|
*/
|
|
14007
14007
|
init() {
|
|
14008
|
-
typeof window > "u" || this.disposed || (window.addEventListener(
|
|
14008
|
+
typeof window > "u" || this.disposed || (window.addEventListener(Wt, this.handleWindowEvent), this.wrapModelToolMethods(), this.bindCameraEvents());
|
|
14009
14009
|
}
|
|
14010
14010
|
/**
|
|
14011
14011
|
* 更新联动配置数据,不改变当前启停状态。
|
|
@@ -14046,11 +14046,11 @@ class Qa {
|
|
|
14046
14046
|
return this.applyingLinkedEvent;
|
|
14047
14047
|
}
|
|
14048
14048
|
dispose() {
|
|
14049
|
-
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(
|
|
14049
|
+
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(Wt, this.handleWindowEvent), this.pendingCameraTimer != null && (window.clearTimeout(this.pendingCameraTimer), this.pendingCameraTimer = null), this.firstPersonSyncFrame != null && (window.cancelAnimationFrame(this.firstPersonSyncFrame), this.firstPersonSyncFrame = null), this.unbindCameraEvents(), this.restoreModelToolMethods());
|
|
14050
14050
|
}
|
|
14051
14051
|
normalizeOptions(e) {
|
|
14052
14052
|
return {
|
|
14053
|
-
...
|
|
14053
|
+
...Ji,
|
|
14054
14054
|
...e,
|
|
14055
14055
|
groupId: e.groupId ?? this.engine?.options?.linkGroupId ?? Ja,
|
|
14056
14056
|
modelId: e.modelId ?? this.engine?.options?.modelLinkId
|
|
@@ -14144,7 +14144,7 @@ class Qa {
|
|
|
14144
14144
|
return this.engine?.controlModule?.firstPersonControls?.enabled === !0 && this.engine?.movefirst === !0;
|
|
14145
14145
|
}
|
|
14146
14146
|
emitCameraThrottled() {
|
|
14147
|
-
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ??
|
|
14147
|
+
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ?? Ji.cameraThrottleMs) - (e - this.lastCameraEmitTime));
|
|
14148
14148
|
if (t === 0) {
|
|
14149
14149
|
this.emitCamera();
|
|
14150
14150
|
return;
|
|
@@ -14167,7 +14167,7 @@ class Qa {
|
|
|
14167
14167
|
});
|
|
14168
14168
|
}
|
|
14169
14169
|
emitEvent(e) {
|
|
14170
|
-
this.shouldEmit(e.action) && window.dispatchEvent(new CustomEvent(
|
|
14170
|
+
this.shouldEmit(e.action) && window.dispatchEvent(new CustomEvent(Wt, {
|
|
14171
14171
|
detail: {
|
|
14172
14172
|
...e,
|
|
14173
14173
|
sourceGuid: this.viewerGuid,
|
|
@@ -14287,7 +14287,7 @@ class el {
|
|
|
14287
14287
|
engine;
|
|
14288
14288
|
manager;
|
|
14289
14289
|
worldToScreen;
|
|
14290
|
-
raycaster = new
|
|
14290
|
+
raycaster = new ae();
|
|
14291
14291
|
constructor(e) {
|
|
14292
14292
|
this.engine = e, this.worldToScreen = new oe(e.camera, e.renderer, e.scene), this.manager = new Ts({
|
|
14293
14293
|
container: e.container,
|
|
@@ -14351,13 +14351,13 @@ class el {
|
|
|
14351
14351
|
return e = this.engine.clipping?.filterIntersectionsByClipping?.(e) ?? e, e.filter((i) => i?.point instanceof h).sort((i, n) => i.distance - n.distance)[0] ?? null;
|
|
14352
14352
|
}
|
|
14353
14353
|
}
|
|
14354
|
-
function
|
|
14354
|
+
function wt(a) {
|
|
14355
14355
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
14356
14356
|
}
|
|
14357
14357
|
function ye(a) {
|
|
14358
14358
|
return new h(a.x, a.y, a.z);
|
|
14359
14359
|
}
|
|
14360
|
-
function
|
|
14360
|
+
function yt(a) {
|
|
14361
14361
|
const e = new h();
|
|
14362
14362
|
return a.length === 0 ? e : (a.forEach((t) => e.add(ye(t))), e.multiplyScalar(1 / a.length));
|
|
14363
14363
|
}
|
|
@@ -14369,14 +14369,14 @@ function tl(a) {
|
|
|
14369
14369
|
}
|
|
14370
14370
|
return e.normalize();
|
|
14371
14371
|
}
|
|
14372
|
-
function
|
|
14372
|
+
function Qi(a) {
|
|
14373
14373
|
const e = a.map((c) => ye(c)), t = e[0].clone(), i = e.length > 1 ? e[1].clone().sub(t).normalize() : new h(1, 0, 0);
|
|
14374
14374
|
let n = tl(e);
|
|
14375
14375
|
n.lengthSq() < 1e-8 && (n = new h(0, 1, 0));
|
|
14376
14376
|
const s = new h().crossVectors(n, i).normalize(), o = new h().crossVectors(s, n).normalize(), r = e.map((c) => {
|
|
14377
14377
|
const u = c.clone().sub(t);
|
|
14378
|
-
return new
|
|
14379
|
-
}), l = new
|
|
14378
|
+
return new H(u.dot(o), u.dot(s));
|
|
14379
|
+
}), l = new G().makeBasis(o, s, n).setPosition(t);
|
|
14380
14380
|
return {
|
|
14381
14381
|
origin: t,
|
|
14382
14382
|
normal: n,
|
|
@@ -14384,7 +14384,7 @@ function Ji(a) {
|
|
|
14384
14384
|
localPoints: r
|
|
14385
14385
|
};
|
|
14386
14386
|
}
|
|
14387
|
-
function
|
|
14387
|
+
function en(a) {
|
|
14388
14388
|
const e = new ln();
|
|
14389
14389
|
return a.forEach((t, i) => {
|
|
14390
14390
|
if (i === 0) {
|
|
@@ -14452,7 +14452,7 @@ class rl {
|
|
|
14452
14452
|
depthWrite: !1
|
|
14453
14453
|
});
|
|
14454
14454
|
r.clippingPlanes = this.engine.sectionPlane;
|
|
14455
|
-
const l = new
|
|
14455
|
+
const l = new St(r);
|
|
14456
14456
|
l.center.set(0.5, 0.1), e.instance.root.add(l), e.iconSprite = l;
|
|
14457
14457
|
}
|
|
14458
14458
|
if ((s.size ?? 0) > 0) {
|
|
@@ -14469,14 +14469,14 @@ class rl {
|
|
|
14469
14469
|
}
|
|
14470
14470
|
const o = new Fe(i.color ?? "#7ffcff");
|
|
14471
14471
|
if (n.baseRing?.enabled) {
|
|
14472
|
-
const r = n.baseRing.radius ?? 3, l = new
|
|
14472
|
+
const r = n.baseRing.radius ?? 3, l = new xi(r * 0.84, r, 48), c = this.materialFactory.createPulseMaterial(o, 0.85, i, n, "uvx", 0, 1), u = new O(l, c);
|
|
14473
14473
|
u.rotation.x = -Math.PI / 2, u.renderOrder = i.alwaysOnTop ? 1300 : 0, e.instance.root.add(u), e.baseRingMeshes.push(u), e.pulseMaterials.push(c);
|
|
14474
14474
|
}
|
|
14475
14475
|
if (n.ripple?.enabled) {
|
|
14476
14476
|
const r = n.ripple.count ?? 2, l = n.ripple.maxRadius ?? 12;
|
|
14477
14477
|
for (let c = 0; c < r; c += 1) {
|
|
14478
14478
|
const u = new O(
|
|
14479
|
-
new
|
|
14479
|
+
new xi(0.86, 1, 40),
|
|
14480
14480
|
new me({
|
|
14481
14481
|
color: o,
|
|
14482
14482
|
transparent: !0,
|
|
@@ -14532,7 +14532,7 @@ class rl {
|
|
|
14532
14532
|
}
|
|
14533
14533
|
/** 任意平面多边形先投影到局部二维,再恢复到原始空间。 */
|
|
14534
14534
|
buildPolygon(e) {
|
|
14535
|
-
const t =
|
|
14535
|
+
const t = Qi(e.instance.points), i = en(t.localPoints), n = new xs(i);
|
|
14536
14536
|
n.computeBoundingBox();
|
|
14537
14537
|
const s = n.boundingBox ?? new Y(new h(0, 0, 0), new h(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
14538
14538
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
@@ -14555,7 +14555,7 @@ class rl {
|
|
|
14555
14555
|
}
|
|
14556
14556
|
/** 拉伸体支持围栏类视觉效果,并记录法线供面板挂到顶部。 */
|
|
14557
14557
|
buildExtrudePolygon(e) {
|
|
14558
|
-
const t =
|
|
14558
|
+
const t = Qi(e.instance.points), i = en(t.localPoints), n = e.instance.style.volume?.height ?? 10, s = new cn(i, {
|
|
14559
14559
|
depth: n,
|
|
14560
14560
|
bevelEnabled: !1,
|
|
14561
14561
|
steps: 1,
|
|
@@ -14583,7 +14583,7 @@ class rl {
|
|
|
14583
14583
|
buildBox(e) {
|
|
14584
14584
|
if (e.instance.points.length < 2)
|
|
14585
14585
|
return;
|
|
14586
|
-
const t = ye(e.instance.points[0]), i = ye(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
|
|
14586
|
+
const t = ye(e.instance.points[0]), i = ye(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 Ct(o.x || 0.1, o.y || 0.1, o.z || 0.1);
|
|
14587
14587
|
l.computeBoundingBox();
|
|
14588
14588
|
const c = l.boundingBox ?? new Y(
|
|
14589
14589
|
new h(-0.5, -0.5, -0.5),
|
|
@@ -14605,7 +14605,7 @@ class rl {
|
|
|
14605
14605
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1
|
|
14606
14606
|
});
|
|
14607
14607
|
g.clippingPlanes = this.engine.sectionPlane;
|
|
14608
|
-
const m = new
|
|
14608
|
+
const m = new jt(new bs(l), g);
|
|
14609
14609
|
m.position.copy(r), e.instance.root.add(m), e.volumeHeight = o.y, e.animatedMaterials.push(u);
|
|
14610
14610
|
}
|
|
14611
14611
|
/** 多层轮廓线常用于电子围栏、扫描墙这类有高度层次感的体标记。 */
|
|
@@ -14676,7 +14676,7 @@ class al {
|
|
|
14676
14676
|
const s = new h();
|
|
14677
14677
|
t.getWorldPosition(s);
|
|
14678
14678
|
let o = 1;
|
|
14679
|
-
if (this.engine.camera instanceof
|
|
14679
|
+
if (this.engine.camera instanceof st) {
|
|
14680
14680
|
const r = this.engine.camera.position.distanceTo(s), l = R.degToRad(this.engine.camera.fov);
|
|
14681
14681
|
o = 2 * Math.tan(l * 0.5) * r / Math.max(n.clientHeight, 1) * i;
|
|
14682
14682
|
} else this.engine.camera instanceof ve && (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);
|
|
@@ -14843,7 +14843,7 @@ class ll {
|
|
|
14843
14843
|
];
|
|
14844
14844
|
}
|
|
14845
14845
|
}
|
|
14846
|
-
const
|
|
14846
|
+
const tt = {
|
|
14847
14847
|
color: "#7ffcff",
|
|
14848
14848
|
opacity: 0.92,
|
|
14849
14849
|
fillColor: "#7ffcff",
|
|
@@ -14890,7 +14890,7 @@ class ul {
|
|
|
14890
14890
|
return {
|
|
14891
14891
|
...e,
|
|
14892
14892
|
id: e.id ?? `annotation3d-${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
14893
|
-
points:
|
|
14893
|
+
points: wt(e.points ?? []),
|
|
14894
14894
|
visible: e.visible ?? !0,
|
|
14895
14895
|
selectable: e.selectable ?? !0,
|
|
14896
14896
|
style: this.mergeStyle(e.style),
|
|
@@ -14912,7 +14912,7 @@ class ul {
|
|
|
14912
14912
|
return this.normalizeData({
|
|
14913
14913
|
id: n,
|
|
14914
14914
|
type: i.type ?? e.type,
|
|
14915
|
-
points: i.points ?
|
|
14915
|
+
points: i.points ? wt(i.points) : wt(e.points),
|
|
14916
14916
|
visible: i.visible ?? e.visible,
|
|
14917
14917
|
selectable: i.selectable ?? e.selectable,
|
|
14918
14918
|
style: {
|
|
@@ -14946,22 +14946,22 @@ class ul {
|
|
|
14946
14946
|
/** 合并通用样式和不同几何类型的子样式。 */
|
|
14947
14947
|
mergeStyle(e) {
|
|
14948
14948
|
return {
|
|
14949
|
-
...
|
|
14949
|
+
...tt,
|
|
14950
14950
|
...e,
|
|
14951
14951
|
point: {
|
|
14952
|
-
...
|
|
14952
|
+
...tt.point,
|
|
14953
14953
|
...e?.point ?? {}
|
|
14954
14954
|
},
|
|
14955
14955
|
line: {
|
|
14956
|
-
...
|
|
14956
|
+
...tt.line,
|
|
14957
14957
|
...e?.line ?? {}
|
|
14958
14958
|
},
|
|
14959
14959
|
polygon: {
|
|
14960
|
-
...
|
|
14960
|
+
...tt.polygon,
|
|
14961
14961
|
...e?.polygon ?? {}
|
|
14962
14962
|
},
|
|
14963
14963
|
volume: {
|
|
14964
|
-
...
|
|
14964
|
+
...tt.volume,
|
|
14965
14965
|
...e?.volume ?? {}
|
|
14966
14966
|
}
|
|
14967
14967
|
};
|
|
@@ -15121,12 +15121,12 @@ class pl {
|
|
|
15121
15121
|
if (e.instance.type === "point")
|
|
15122
15122
|
n.copy(ye(e.instance.points[0])), t === "top" && (n.y += e.volumeHeight ?? e.instance.style.point?.anchorY ?? 0);
|
|
15123
15123
|
else if (e.instance.type === "polyline")
|
|
15124
|
-
t === "start" ? n.copy(ye(e.instance.points[0])) : t === "end" ? n.copy(ye(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(
|
|
15124
|
+
t === "start" ? n.copy(ye(e.instance.points[0])) : t === "end" ? n.copy(ye(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(yt(e.instance.points));
|
|
15125
15125
|
else if (e.instance.type === "polygon")
|
|
15126
|
-
n.copy(
|
|
15126
|
+
n.copy(yt(e.instance.points));
|
|
15127
15127
|
else if (e.instance.type === "extrudePolygon")
|
|
15128
|
-
n.copy(
|
|
15129
|
-
else if (e.instance.type === "box" && (n.copy(
|
|
15128
|
+
n.copy(yt(e.instance.points)), t === "top" && e.anchorNormal && n.add(e.anchorNormal.clone().multiplyScalar(e.volumeHeight ?? 0));
|
|
15129
|
+
else if (e.instance.type === "box" && (n.copy(yt(e.instance.points)), t === "top" && e.instance.points.length >= 2)) {
|
|
15130
15130
|
const s = ye(e.instance.points[0]), o = ye(e.instance.points[1]);
|
|
15131
15131
|
n.y = Math.max(s.y, o.y);
|
|
15132
15132
|
}
|
|
@@ -15140,7 +15140,7 @@ class ml {
|
|
|
15140
15140
|
panelContainer;
|
|
15141
15141
|
onRecordVisualChange;
|
|
15142
15142
|
onEmit;
|
|
15143
|
-
raycaster = new
|
|
15143
|
+
raycaster = new ae();
|
|
15144
15144
|
hoveredId = null;
|
|
15145
15145
|
constructor(e) {
|
|
15146
15146
|
this.engine = e.engine, this.rootGroup = e.rootGroup, this.records = e.records, this.panelContainer = e.panelContainer, this.onRecordVisualChange = e.onRecordVisualChange, this.onEmit = e.onEmit;
|
|
@@ -15162,7 +15162,7 @@ class ml {
|
|
|
15162
15162
|
const t = this.engine.renderer?.domElement, i = this.engine.camera;
|
|
15163
15163
|
if (!t || !i)
|
|
15164
15164
|
return null;
|
|
15165
|
-
const n = t.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top, r = new
|
|
15165
|
+
const n = t.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top, r = new H(
|
|
15166
15166
|
s / n.width * 2 - 1,
|
|
15167
15167
|
-(o / n.height) * 2 + 1
|
|
15168
15168
|
);
|
|
@@ -15256,24 +15256,24 @@ function fl(a) {
|
|
|
15256
15256
|
return {
|
|
15257
15257
|
id: a.instance.id,
|
|
15258
15258
|
type: a.instance.type,
|
|
15259
|
-
points:
|
|
15259
|
+
points: wt(a.instance.points),
|
|
15260
15260
|
visible: a.instance.visible,
|
|
15261
15261
|
selectable: a.instance.selectable,
|
|
15262
|
-
style:
|
|
15263
|
-
effect:
|
|
15264
|
-
panel: a.instance.panel ?
|
|
15265
|
-
data:
|
|
15262
|
+
style: vt(a.instance.style),
|
|
15263
|
+
effect: vt(a.instance.effect),
|
|
15264
|
+
panel: a.instance.panel ? vt(a.instance.panel) : void 0,
|
|
15265
|
+
data: vt(a.instance.data)
|
|
15266
15266
|
};
|
|
15267
15267
|
}
|
|
15268
|
-
function
|
|
15268
|
+
function vt(a) {
|
|
15269
15269
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
15270
15270
|
}
|
|
15271
15271
|
class yl {
|
|
15272
15272
|
engine;
|
|
15273
15273
|
rootGroup;
|
|
15274
15274
|
records = /* @__PURE__ */ new Map();
|
|
15275
|
-
textureLoader = new
|
|
15276
|
-
occlusionRaycaster = new
|
|
15275
|
+
textureLoader = new Oe();
|
|
15276
|
+
occlusionRaycaster = new ae();
|
|
15277
15277
|
normalizer = new ul();
|
|
15278
15278
|
materialFactory;
|
|
15279
15279
|
geometryBuilder;
|
|
@@ -15283,7 +15283,7 @@ class yl {
|
|
|
15283
15283
|
currentTime = 0;
|
|
15284
15284
|
/** 初始化标记根节点、DOM 面板层以及交互控制器。 */
|
|
15285
15285
|
constructor(e) {
|
|
15286
|
-
this.engine = e, this.rootGroup = new
|
|
15286
|
+
this.engine = e, this.rootGroup = new he(), this.rootGroup.name = "Annotation3dRoot", this.engine.scene.add(this.rootGroup), this.materialFactory = new ll(this.engine), this.geometryBuilder = new rl(this.engine, this.textureLoader, this.materialFactory), this.effectsController = new al(this.engine), this.panelLayer = new pl(
|
|
15287
15287
|
this.engine,
|
|
15288
15288
|
(t) => dl(this.engine, this.occlusionRaycaster, t)
|
|
15289
15289
|
), this.interaction = new ml({
|
|
@@ -15403,7 +15403,7 @@ class yl {
|
|
|
15403
15403
|
}
|
|
15404
15404
|
/** 组装运行时记录,并将几何与面板初始化好。 */
|
|
15405
15405
|
buildRecord(e) {
|
|
15406
|
-
const t = new
|
|
15406
|
+
const t = new he();
|
|
15407
15407
|
t.name = e.id;
|
|
15408
15408
|
const i = {
|
|
15409
15409
|
id: e.id,
|
|
@@ -15470,7 +15470,7 @@ class vl {
|
|
|
15470
15470
|
apply(e) {
|
|
15471
15471
|
if (!e?.url || e.matrix == null)
|
|
15472
15472
|
return !1;
|
|
15473
|
-
const t = this.toThreeMatrix(e.matrix), i =
|
|
15473
|
+
const t = this.toThreeMatrix(e.matrix), i = Ye(this.engine, e.url);
|
|
15474
15474
|
return i.matrixAutoUpdate = !1, i.matrix.copy(t), i.matrixWorldNeedsUpdate = !0, i.updateMatrixWorld(!0), this.clearRuntimeWorldBoxCache(i), this.matrices.set(e.url, t.clone()), this.updateCachedModelBox(e.url, i), this.engine.modelEdge?.setModelEdgeTransform?.(e.url, t), !0;
|
|
15475
15475
|
}
|
|
15476
15476
|
/**
|
|
@@ -15490,9 +15490,9 @@ class vl {
|
|
|
15490
15490
|
if (o.lengthSq() < 1e-10 || r.lengthSq() < 1e-10)
|
|
15491
15491
|
throw new Error("[Calibration] source and target segments must have valid length");
|
|
15492
15492
|
o.normalize(), r.normalize();
|
|
15493
|
-
const l = new
|
|
15493
|
+
const l = new G().makeRotationFromQuaternion(
|
|
15494
15494
|
new De().setFromUnitVectors(o, r)
|
|
15495
|
-
), c = new
|
|
15495
|
+
), c = new G().makeTranslation(n.x, n.y, n.z).multiply(l).multiply(new G().makeTranslation(-t.x, -t.y, -t.z)), u = this.getMatrix(e.url);
|
|
15496
15496
|
return this.apply({
|
|
15497
15497
|
url: e.url,
|
|
15498
15498
|
matrix: c.multiply(u)
|
|
@@ -15505,15 +15505,15 @@ class vl {
|
|
|
15505
15505
|
const t = this.matrices.get(e);
|
|
15506
15506
|
if (t != null)
|
|
15507
15507
|
return t.clone();
|
|
15508
|
-
const i =
|
|
15509
|
-
return i == null ? new
|
|
15508
|
+
const i = Ne(this.engine, e);
|
|
15509
|
+
return i == null ? new G() : i.matrix.clone();
|
|
15510
15510
|
}
|
|
15511
15511
|
/**
|
|
15512
15512
|
* 清除指定模型的校准。
|
|
15513
15513
|
*/
|
|
15514
15514
|
clear(e) {
|
|
15515
|
-
const t =
|
|
15516
|
-
return t == null ? !1 : (t.matrixAutoUpdate = !1, t.matrix.identity(), t.matrixWorldNeedsUpdate = !0, t.updateMatrixWorld(!0), this.clearRuntimeWorldBoxCache(t), this.matrices.delete(e), this.updateCachedModelBox(e, t), this.engine.modelEdge?.setModelEdgeTransform?.(e, new
|
|
15515
|
+
const t = Ne(this.engine, e);
|
|
15516
|
+
return t == null ? !1 : (t.matrixAutoUpdate = !1, t.matrix.identity(), t.matrixWorldNeedsUpdate = !0, t.updateMatrixWorld(!0), this.clearRuntimeWorldBoxCache(t), this.matrices.delete(e), this.updateCachedModelBox(e, t), this.engine.modelEdge?.setModelEdgeTransform?.(e, new G()), !0);
|
|
15517
15517
|
}
|
|
15518
15518
|
updateCachedModelBox(e, t) {
|
|
15519
15519
|
const i = this.engine.models?.find?.((s) => s.url === e);
|
|
@@ -15538,13 +15538,13 @@ class vl {
|
|
|
15538
15538
|
});
|
|
15539
15539
|
}
|
|
15540
15540
|
toThreeMatrix(e) {
|
|
15541
|
-
if (e instanceof
|
|
15541
|
+
if (e instanceof G)
|
|
15542
15542
|
return e.clone();
|
|
15543
15543
|
if (Array.isArray(e) && Array.isArray(e[0])) {
|
|
15544
15544
|
const i = e;
|
|
15545
15545
|
if (i.length !== 4 || i.some((n) => !Array.isArray(n) || n.length !== 4))
|
|
15546
15546
|
throw new Error("[Calibration] matrix must be a 4x4 array");
|
|
15547
|
-
return new
|
|
15547
|
+
return new G().set(
|
|
15548
15548
|
i[0][0],
|
|
15549
15549
|
i[0][1],
|
|
15550
15550
|
i[0][2],
|
|
@@ -15566,7 +15566,7 @@ class vl {
|
|
|
15566
15566
|
const t = Array.from(e);
|
|
15567
15567
|
if (t.length !== 16)
|
|
15568
15568
|
throw new Error("[Calibration] matrix must contain 16 numbers");
|
|
15569
|
-
return new
|
|
15569
|
+
return new G().fromArray(t);
|
|
15570
15570
|
}
|
|
15571
15571
|
toVector3(e) {
|
|
15572
15572
|
if (e instanceof h)
|
|
@@ -15579,7 +15579,302 @@ class vl {
|
|
|
15579
15579
|
return "x" in e ? new h(e.x, e.y, e.z) : new h(e.X, e.Y, e.Z);
|
|
15580
15580
|
}
|
|
15581
15581
|
}
|
|
15582
|
-
class
|
|
15582
|
+
class Ml {
|
|
15583
|
+
engine;
|
|
15584
|
+
loader = new ri();
|
|
15585
|
+
modelList = /* @__PURE__ */ new Map();
|
|
15586
|
+
modelTransforms = [];
|
|
15587
|
+
transformControl = null;
|
|
15588
|
+
transformHelper = null;
|
|
15589
|
+
selectedModelId = null;
|
|
15590
|
+
editingEnabled = !1;
|
|
15591
|
+
isRestoring = !1;
|
|
15592
|
+
isUndoing = !1;
|
|
15593
|
+
pendingModelIds = /* @__PURE__ */ new Set();
|
|
15594
|
+
bimHighlightDisabledBeforeEditing = null;
|
|
15595
|
+
selectionPointerDown = null;
|
|
15596
|
+
onPointerDown;
|
|
15597
|
+
onPointerUp;
|
|
15598
|
+
onKeyDown;
|
|
15599
|
+
constructor(e) {
|
|
15600
|
+
this.engine = e, this.onPointerDown = this.handlePointerDown.bind(this), this.onPointerUp = this.handlePointerUp.bind(this), this.onKeyDown = this.handleKeyDown.bind(this), this.engine.renderer?.domElement?.addEventListener("pointerdown", this.onPointerDown), this.engine.renderer?.domElement?.addEventListener("pointerup", this.onPointerUp), window.addEventListener("keydown", this.onKeyDown), this.ensureTransformControl();
|
|
15601
|
+
}
|
|
15602
|
+
/** 释放控制柄、事件和已加载模型;引擎销毁时应调用。 */
|
|
15603
|
+
dispose() {
|
|
15604
|
+
this.engine.renderer?.domElement?.removeEventListener("pointerdown", this.onPointerDown), this.engine.renderer?.domElement?.removeEventListener("pointerup", this.onPointerUp), window.removeEventListener("keydown", this.onKeyDown), this.transformControl?.detach(), this.transformHelper?.parent?.remove(this.transformHelper), this.modelList.forEach((e) => this.removeObject(e.object)), this.modelList.clear(), this.modelTransforms.length = 0, this.disableModelEditing();
|
|
15605
|
+
}
|
|
15606
|
+
/**
|
|
15607
|
+
* 加载 GLB 并放入场景。未指定 position 时,调用方需在开启捕捉的视图中单击确认落点。
|
|
15608
|
+
*/
|
|
15609
|
+
async placeModel(e) {
|
|
15610
|
+
if (!e?.url)
|
|
15611
|
+
throw new Error("放置模型失败:url 不能为空。");
|
|
15612
|
+
const t = e.id ?? this.createId();
|
|
15613
|
+
if (this.modelList.has(t) || this.pendingModelIds.has(t))
|
|
15614
|
+
throw new Error(`放置模型失败:模型 id “${t}” 已存在。`);
|
|
15615
|
+
this.pendingModelIds.add(t);
|
|
15616
|
+
try {
|
|
15617
|
+
if (e.position) {
|
|
15618
|
+
const n = this.normalizeData({ ...e, id: t, materials: [] });
|
|
15619
|
+
return this.saveHistory(), await this.loadRecord(n), this.editModel(t), this.cloneData(n);
|
|
15620
|
+
}
|
|
15621
|
+
this.enableModelEditing(), this.clearSelection();
|
|
15622
|
+
const i = await this.createRecord(this.normalizeData({ ...e, id: t, position: [0, 0, 0], materials: [] }));
|
|
15623
|
+
i.object.visible = !1, this.engine.scene?.add(i.object);
|
|
15624
|
+
try {
|
|
15625
|
+
const n = await this.pickPlacementPoint((s) => {
|
|
15626
|
+
i.object.visible = s != null, s && i.object.position.copy(s), this.requestRender();
|
|
15627
|
+
});
|
|
15628
|
+
i.data.position = n, i.object.position.fromArray(n), i.object.visible = !0, this.saveHistory(), this.addRecord(i);
|
|
15629
|
+
} catch (n) {
|
|
15630
|
+
throw this.removeObject(i.object), n;
|
|
15631
|
+
}
|
|
15632
|
+
return this.editModel(t), this.cloneData(i.data);
|
|
15633
|
+
} finally {
|
|
15634
|
+
this.pendingModelIds.delete(t);
|
|
15635
|
+
}
|
|
15636
|
+
}
|
|
15637
|
+
/** 选中模型并显示指定模式的操作柄;未传模式时沿用移动模式。 */
|
|
15638
|
+
editModel(e, t = "translate") {
|
|
15639
|
+
const i = this.modelList.get(e);
|
|
15640
|
+
if (!i) throw new Error(`编辑模型失败:未找到模型 “${e}”。`);
|
|
15641
|
+
this.enableModelEditing(), this.selectedModelId = e, this.ensureTransformControl(), this.transformControl?.setMode(t), this.transformControl?.attach(i.object), this.transformHelper && (this.transformHelper.visible = !0), this.requestRender();
|
|
15642
|
+
}
|
|
15643
|
+
/** 结束编辑并隐藏操作柄,不改变当前模型数据。 */
|
|
15644
|
+
endEdit() {
|
|
15645
|
+
this.clearSelection(), this.disableModelEditing();
|
|
15646
|
+
}
|
|
15647
|
+
/** 按材质槽位或精确名称替换贴图;同名材质会一并替换并持久化。 */
|
|
15648
|
+
async replaceMaterial(e, t, i) {
|
|
15649
|
+
const n = this.requireRecord(e);
|
|
15650
|
+
if (!i) throw new Error("替换材质失败:贴图 url 不能为空。");
|
|
15651
|
+
const s = this.getMaterials(n.object), o = this.getMaterialIndices(s, t);
|
|
15652
|
+
if (o.length === 0) {
|
|
15653
|
+
const r = typeof t == "number" ? `槽位 ${t}` : `名称 “${t}”`;
|
|
15654
|
+
throw new Error(`替换材质失败:模型不存在材质${r}。`);
|
|
15655
|
+
}
|
|
15656
|
+
this.saveHistory(), await Promise.all(o.map(async (r) => {
|
|
15657
|
+
const l = s[r], c = await new Oe().loadAsync(i);
|
|
15658
|
+
c.colorSpace = Ke, l.map = c, l.needsUpdate = !0;
|
|
15659
|
+
const u = n.data.materials.find((d) => d.materialIndex === r);
|
|
15660
|
+
u ? (u.materialName = l.name || void 0, u.mapUrl = i) : n.data.materials.push({ materialIndex: r, materialName: l.name || void 0, mapUrl: i });
|
|
15661
|
+
})), this.requestRender();
|
|
15662
|
+
}
|
|
15663
|
+
/** 获取模型可替换的材质槽位和名称,供业务层按名称替换前查询。 */
|
|
15664
|
+
getModelMaterials(e) {
|
|
15665
|
+
return this.getMaterials(this.requireRecord(e).object).map((t, i) => ({
|
|
15666
|
+
materialIndex: i,
|
|
15667
|
+
materialName: t.name
|
|
15668
|
+
}));
|
|
15669
|
+
}
|
|
15670
|
+
/** 删除模型及其场景对象。 */
|
|
15671
|
+
deleteModel(e) {
|
|
15672
|
+
const t = this.requireRecord(e);
|
|
15673
|
+
this.saveHistory(), this.removeObject(t.object), this.modelList.delete(e), this.selectedModelId === e && this.clearSelection(), this.requestRender();
|
|
15674
|
+
}
|
|
15675
|
+
/** 清空场景中的全部第三方模型并释放资源;该操作可通过 undo 撤回。 */
|
|
15676
|
+
clearModels() {
|
|
15677
|
+
this.modelList.size !== 0 && (this.saveHistory(), this.endEdit(), this.modelList.forEach((e) => this.removeObject(e.object)), this.modelList.clear(), this.requestRender());
|
|
15678
|
+
}
|
|
15679
|
+
/** 隐藏指定模型,并保留它以支持后续显示和场景还原。 */
|
|
15680
|
+
hideModel(e) {
|
|
15681
|
+
const t = this.requireRecord(e);
|
|
15682
|
+
this.saveHistory(), t.object.visible = !1, t.data.visible = !1, this.selectedModelId === e && this.clearSelection(), this.requestRender();
|
|
15683
|
+
}
|
|
15684
|
+
/** 显示当前管理器中的所有第三方模型。 */
|
|
15685
|
+
showAllModels() {
|
|
15686
|
+
this.saveHistory(), this.modelList.forEach((e) => {
|
|
15687
|
+
e.object.visible = !0, e.data.visible = !0;
|
|
15688
|
+
}), this.requestRender();
|
|
15689
|
+
}
|
|
15690
|
+
/** 获取可 JSON 序列化的第三方模型场景状态。 */
|
|
15691
|
+
getSceneModels() {
|
|
15692
|
+
return this.syncSelectedTransform(), Array.from(this.modelList.values(), (e) => this.cloneData(e.data));
|
|
15693
|
+
}
|
|
15694
|
+
/** 清空现有第三方模型后,重新加载并恢复已导出的场景状态。 */
|
|
15695
|
+
async restoreSceneModels(e) {
|
|
15696
|
+
if (!Array.isArray(e)) throw new Error("还原场景失败:场景模型数据必须是数组。");
|
|
15697
|
+
this.isRestoring || this.saveHistory(), this.isRestoring = !0;
|
|
15698
|
+
try {
|
|
15699
|
+
this.endEdit(), this.modelList.forEach((t) => this.removeObject(t.object)), this.modelList.clear();
|
|
15700
|
+
for (const t of e) await this.loadRecord(this.normalizeData(t));
|
|
15701
|
+
return this.getSceneModels();
|
|
15702
|
+
} finally {
|
|
15703
|
+
this.isRestoring = !1, this.requestRender();
|
|
15704
|
+
}
|
|
15705
|
+
}
|
|
15706
|
+
/** 撤回最近一次会改变模型状态的操作。 */
|
|
15707
|
+
async undo() {
|
|
15708
|
+
if (this.isUndoing) return !1;
|
|
15709
|
+
const e = this.modelTransforms.pop();
|
|
15710
|
+
if (!e) return !1;
|
|
15711
|
+
this.isUndoing = !0;
|
|
15712
|
+
try {
|
|
15713
|
+
return this.isRestoring = !0, await this.restoreSceneModels(e), !0;
|
|
15714
|
+
} finally {
|
|
15715
|
+
this.isUndoing = !1;
|
|
15716
|
+
}
|
|
15717
|
+
}
|
|
15718
|
+
async loadRecord(e) {
|
|
15719
|
+
this.addRecord(await this.createRecord(e));
|
|
15720
|
+
}
|
|
15721
|
+
/** 加载模型资源并创建记录,调用方可决定何时正式加入模型列表。 */
|
|
15722
|
+
async createRecord(e) {
|
|
15723
|
+
const i = (await this.loader.loadAsync(e.url)).scene;
|
|
15724
|
+
i.name = e.name, i.position.fromArray(e.position), i.rotation.fromArray(e.rotation), i.scale.fromArray(e.scale), i.visible = e.visible;
|
|
15725
|
+
const n = { data: this.cloneData(e), object: i };
|
|
15726
|
+
for (const s of e.materials)
|
|
15727
|
+
s.mapUrl && await this.applyTexture(n, s, s.mapUrl);
|
|
15728
|
+
return n;
|
|
15729
|
+
}
|
|
15730
|
+
/** 将已加载对象登记为正式模型,使其可被选中、导出和撤回。 */
|
|
15731
|
+
addRecord(e) {
|
|
15732
|
+
e.object.userData.modelPlaceId = e.data.id, this.engine.scene?.add(e.object), this.modelList.set(e.data.id, e);
|
|
15733
|
+
}
|
|
15734
|
+
async applyTexture(e, t, i) {
|
|
15735
|
+
const n = this.getMaterials(e.object), s = t.materialName ? n.find((r) => r.name === t.materialName) ?? n[t.materialIndex] : n[t.materialIndex];
|
|
15736
|
+
if (!s) return;
|
|
15737
|
+
const o = await new Oe().loadAsync(i);
|
|
15738
|
+
o.colorSpace = Ke, s.map = o, s.needsUpdate = !0;
|
|
15739
|
+
}
|
|
15740
|
+
ensureTransformControl() {
|
|
15741
|
+
this.transformControl || !this.engine.camera || !this.engine.renderer || !this.engine.scene || (this.transformControl = new At(this.engine.camera, this.engine.renderer.domElement), this.transformControl.addEventListener("dragging-changed", (e) => {
|
|
15742
|
+
this.engine.controls && (this.engine.controls.enabled = !e.value), e.value ? this.saveHistory() : this.syncSelectedTransform();
|
|
15743
|
+
}), this.transformControl.addEventListener("objectChange", () => this.requestRender()), this.transformHelper = this.transformControl.getHelper(), this.transformHelper.visible = !1, this.engine.scene.add(this.transformHelper));
|
|
15744
|
+
}
|
|
15745
|
+
/** 使用引擎统一的捕捉器等待用户单击,并在取消或完成后恢复常规交互。 */
|
|
15746
|
+
pickPlacementPoint(e) {
|
|
15747
|
+
const t = this.engine.handelBehaved;
|
|
15748
|
+
return !t?.init || !t?.active || !t?.disActive ? Promise.reject(new Error("放置模型失败:引擎捕捉交互尚未初始化。")) : new Promise((i, n) => {
|
|
15749
|
+
let s = !1;
|
|
15750
|
+
const o = (l) => {
|
|
15751
|
+
s || (s = !0, t.disActive(), this.engine.catchSvg && (this.engine.catchSvg.innerHTML = ""), this.engine.interactionModule?.init?.(), this.engine.interactionModule?.active?.(), l());
|
|
15752
|
+
}, r = {
|
|
15753
|
+
type: "model-place",
|
|
15754
|
+
// 捕捉器只会为声明了移动回调的行为刷新吸附预览。
|
|
15755
|
+
handleMouseMove: (l) => e?.(l?.catch?.point ?? null),
|
|
15756
|
+
handleMouseClick: (l) => {
|
|
15757
|
+
const c = l?.catch?.point;
|
|
15758
|
+
c && o(() => i([c.x, c.y, c.z]));
|
|
15759
|
+
},
|
|
15760
|
+
handelKeyEscDown: () => {
|
|
15761
|
+
o(() => n(new Error("已取消第三方模型放置。")));
|
|
15762
|
+
},
|
|
15763
|
+
// 被另一个捕捉工具替换时,同样结束当前 Promise,避免调用方永久等待。
|
|
15764
|
+
disActive: () => {
|
|
15765
|
+
o(() => n(new Error("第三方模型放置已被其他交互操作取消。")));
|
|
15766
|
+
}
|
|
15767
|
+
};
|
|
15768
|
+
t.init(r, { showCatch: !0 }), t.active();
|
|
15769
|
+
});
|
|
15770
|
+
}
|
|
15771
|
+
handlePointerDown(e) {
|
|
15772
|
+
if (!(!this.editingEnabled || !this.engine.camera || !this.engine.renderer)) {
|
|
15773
|
+
if (this.transformControl?.axis != null) {
|
|
15774
|
+
this.selectionPointerDown = null;
|
|
15775
|
+
return;
|
|
15776
|
+
}
|
|
15777
|
+
this.selectionPointerDown = new H(e.clientX, e.clientY);
|
|
15778
|
+
}
|
|
15779
|
+
}
|
|
15780
|
+
/** 仅把未拖动的点击视为选中/取消选中,避免旋转视图时隐藏操作柄。 */
|
|
15781
|
+
handlePointerUp(e) {
|
|
15782
|
+
if (!this.editingEnabled || !this.engine.camera || !this.engine.renderer || !this.selectionPointerDown) return;
|
|
15783
|
+
const t = this.selectionPointerDown;
|
|
15784
|
+
if (this.selectionPointerDown = null, t.distanceTo(new H(e.clientX, e.clientY)) > 4) return;
|
|
15785
|
+
const i = this.engine.renderer.domElement.getBoundingClientRect(), n = new H((e.clientX - i.left) / i.width * 2 - 1, -((e.clientY - i.top) / i.height) * 2 + 1), s = new ae();
|
|
15786
|
+
s.setFromCamera(n, this.engine.camera);
|
|
15787
|
+
const o = s.intersectObjects(Array.from(this.modelList.values(), (l) => l.object), !0)[0];
|
|
15788
|
+
if (!o) {
|
|
15789
|
+
this.clearSelection();
|
|
15790
|
+
return;
|
|
15791
|
+
}
|
|
15792
|
+
let r = o.object;
|
|
15793
|
+
for (; r && !r.userData.modelPlaceId; ) r = r.parent;
|
|
15794
|
+
r?.userData.modelPlaceId ? this.editModel(r.userData.modelPlaceId) : this.clearSelection();
|
|
15795
|
+
}
|
|
15796
|
+
/** Esc 只清除当前选中对象,保留编辑模式以便继续点选其他第三方模型。 */
|
|
15797
|
+
handleKeyDown(e) {
|
|
15798
|
+
if (this.isUndoShortcut(e)) {
|
|
15799
|
+
e.preventDefault(), this.undo().catch((t) => console.error("第三方模型撤回失败:", t));
|
|
15800
|
+
return;
|
|
15801
|
+
}
|
|
15802
|
+
(e.key === "Escape" || e.keyCode === 27) && this.editingEnabled && this.selectedModelId && this.clearSelection();
|
|
15803
|
+
}
|
|
15804
|
+
/** Ctrl+Z / Command+Z 仅在非文本输入焦点且存在历史时接管,避免影响表单编辑。 */
|
|
15805
|
+
isUndoShortcut(e) {
|
|
15806
|
+
if (!e.ctrlKey && !e.metaKey || e.shiftKey || e.altKey || e.key.toLowerCase() !== "z") return !1;
|
|
15807
|
+
const t = e.target;
|
|
15808
|
+
return t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? "") ? !1 : this.modelTransforms.length > 0 && !this.isUndoing;
|
|
15809
|
+
}
|
|
15810
|
+
/** 隐藏当前操作柄,但不关闭编辑模式。 */
|
|
15811
|
+
clearSelection() {
|
|
15812
|
+
this.selectedModelId = null, this.transformControl?.detach(), this.transformHelper && (this.transformHelper.visible = !1), this.requestRender();
|
|
15813
|
+
}
|
|
15814
|
+
/** 进入第三方模型编辑模式时,屏蔽 BIM 构件的悬浮和点击高亮,避免射线穿透。 */
|
|
15815
|
+
enableModelEditing() {
|
|
15816
|
+
this.editingEnabled = !0, this.bimHighlightDisabledBeforeEditing == null && (this.bimHighlightDisabledBeforeEditing = !!this.engine.engineStatus?.disableModelInteractionHighlight), this.engine.engineStatus && (this.engine.engineStatus.disableModelInteractionHighlight = !0), this.engine.modelToolModule?.unhighlightAllModels?.(), this.engine.hoverHighLight?.clearHighlight?.(), this.engine.hoverHighLight?.showModelNameTag?.(null, null);
|
|
15817
|
+
}
|
|
15818
|
+
/** 恢复进入编辑模式前的 BIM 构件交互高亮配置。 */
|
|
15819
|
+
disableModelEditing() {
|
|
15820
|
+
this.editingEnabled = !1, this.selectionPointerDown = null, this.bimHighlightDisabledBeforeEditing != null && this.engine.engineStatus && (this.engine.engineStatus.disableModelInteractionHighlight = this.bimHighlightDisabledBeforeEditing), this.bimHighlightDisabledBeforeEditing = null;
|
|
15821
|
+
}
|
|
15822
|
+
syncSelectedTransform() {
|
|
15823
|
+
if (!this.selectedModelId) return;
|
|
15824
|
+
const e = this.modelList.get(this.selectedModelId);
|
|
15825
|
+
e && (e.data.position = e.object.position.toArray(), e.data.rotation = e.object.rotation.toArray(), e.data.scale = e.object.scale.toArray());
|
|
15826
|
+
}
|
|
15827
|
+
saveHistory() {
|
|
15828
|
+
this.isRestoring || this.modelTransforms.push(this.getSceneModels());
|
|
15829
|
+
}
|
|
15830
|
+
requireRecord(e) {
|
|
15831
|
+
const t = this.modelList.get(e);
|
|
15832
|
+
if (!t) throw new Error(`未找到模型 “${e}”。`);
|
|
15833
|
+
return t;
|
|
15834
|
+
}
|
|
15835
|
+
getMaterials(e) {
|
|
15836
|
+
const t = [];
|
|
15837
|
+
return e.traverse((i) => {
|
|
15838
|
+
if (!i.isMesh) return;
|
|
15839
|
+
(Array.isArray(i.material) ? i.material : [i.material]).forEach((s) => {
|
|
15840
|
+
s && !t.includes(s) && t.push(s);
|
|
15841
|
+
});
|
|
15842
|
+
}), t;
|
|
15843
|
+
}
|
|
15844
|
+
/** 将数值槽位或材质名称转换为实际材质索引;同名材质应保持同一替换结果。 */
|
|
15845
|
+
getMaterialIndices(e, t) {
|
|
15846
|
+
return typeof t == "number" ? Number.isInteger(t) && t >= 0 && t < e.length ? [t] : [] : e.reduce((i, n, s) => (n.name === t && i.push(s), i), []);
|
|
15847
|
+
}
|
|
15848
|
+
normalizeData(e) {
|
|
15849
|
+
return {
|
|
15850
|
+
id: e.id ?? this.createId(),
|
|
15851
|
+
url: e.url,
|
|
15852
|
+
name: e.name ?? "第三方模型",
|
|
15853
|
+
position: e.position ?? [0, 0, 0],
|
|
15854
|
+
rotation: e.rotation ?? [0, 0, 0, "XYZ"],
|
|
15855
|
+
scale: e.scale ?? [1, 1, 1],
|
|
15856
|
+
visible: e.visible ?? !0,
|
|
15857
|
+
materials: e.materials ?? []
|
|
15858
|
+
};
|
|
15859
|
+
}
|
|
15860
|
+
cloneData(e) {
|
|
15861
|
+
return JSON.parse(JSON.stringify(e));
|
|
15862
|
+
}
|
|
15863
|
+
createId() {
|
|
15864
|
+
return `model-place-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
15865
|
+
}
|
|
15866
|
+
removeObject(e) {
|
|
15867
|
+
e.parent?.remove(e), e.traverse((t) => {
|
|
15868
|
+
t.geometry?.dispose?.(), (Array.isArray(t.material) ? t.material : [t.material]).forEach((i) => {
|
|
15869
|
+
i?.map?.dispose?.(), i?.dispose?.();
|
|
15870
|
+
});
|
|
15871
|
+
});
|
|
15872
|
+
}
|
|
15873
|
+
requestRender() {
|
|
15874
|
+
this.engine.requestComposerRender?.();
|
|
15875
|
+
}
|
|
15876
|
+
}
|
|
15877
|
+
class El {
|
|
15583
15878
|
// 引擎参数
|
|
15584
15879
|
options;
|
|
15585
15880
|
deviceType;
|
|
@@ -15674,6 +15969,8 @@ class Sl {
|
|
|
15674
15969
|
label;
|
|
15675
15970
|
annotation3d;
|
|
15676
15971
|
calibration;
|
|
15972
|
+
/** 管理第三方 GLB 的放置、编辑和场景还原。 */
|
|
15973
|
+
modelPlace;
|
|
15677
15974
|
// 业务数据
|
|
15678
15975
|
models = [];
|
|
15679
15976
|
reactBoundingClientRect = { left: 0, top: 0 };
|
|
@@ -15682,9 +15979,9 @@ class Sl {
|
|
|
15682
15979
|
// 引擎容器
|
|
15683
15980
|
container;
|
|
15684
15981
|
constructor(e) {
|
|
15685
|
-
if (window.THREE =
|
|
15982
|
+
if (window.THREE = tn, ao(), this.options = e, this.container = document.getElementById(e.containerId), !this.container)
|
|
15686
15983
|
throw new Error(`Container ${e.containerId} not found`);
|
|
15687
|
-
if (this.engineModelModule = new
|
|
15984
|
+
if (this.engineModelModule = new Lr(this), this.engineModelModule.init(), this.deviceModule = new Ns(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new ce(this), this.sceneModule = new Os(this), this.scene = this.sceneModule.scene, this.renderModule = new Hs(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.orthographicCamera, this.scene.camera = this.camera, this.renderer) {
|
|
15688
15985
|
const o = this.renderer;
|
|
15689
15986
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
15690
15987
|
}
|
|
@@ -15692,7 +15989,7 @@ class Sl {
|
|
|
15692
15989
|
const t = this.events.trigger.bind(this.events);
|
|
15693
15990
|
this.events.trigger = ((o, r) => {
|
|
15694
15991
|
t(o, r), String(o) !== String(Se.EngineBusy) && this.requestComposerRender();
|
|
15695
|
-
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new Ce(this), this.lightModule = new Er(this), this.lightModule.init(), this.viewCube = new Br(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Rr(this), this.rangeScale = new Fr(this), this.rangeScale.init(), this.setting = new sa(this), this.engineModelModule.init(), this.handelBehaved =
|
|
15992
|
+
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new Ce(this), this.lightModule = new Er(this), this.lightModule.init(), this.viewCube = new Br(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Rr(this), this.rangeScale = new Fr(this), this.rangeScale.init(), this.setting = new sa(this), this.engineModelModule.init(), this.handelBehaved = gi(this), this.modelMapperBatch = new Ea(this), this.measure = new pa(this), this.modelToolModule = new Ar(this), this.modelLink3d = new Qa(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new xa(this), this.search = new Sa(this), this.interactionModule = new Pr(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new Lt(this), this.modelEdge = new ia(this), this.modelTree = new Ma(this), this.viewTree = new ka(this), this.merge2d = new za(this), this.engineInfo = new wa(this), this.pathRoaming = new Pa(this), this.pathRoaming.init(), this.oneClickEncoding = new Ia(this), this.minMap = new Aa(this), this.linkElement2d3d = new Da(this), this.linkView2d3d = new La(this), this.grid = new Hr(this), this.level = new jr(this), this.issueReport = new _a(this), this.fabricDraw = new $a(this), this.drawingPin = new Za(this), this.label = new el(this), this.annotation3d = new yl(this), this.calibration = new vl(this), this.modelPlace = new Ml(this), this.text = new Ta(this), this.hdr = new Gr(this), this.ground = new fi(this), this.ground.init(), this.skyManager = new na(this), this.setting.init(), this.worldToScreen = new oe(this.camera, this.renderer, this.scene), this.options.showStats && (this.stats = new Fs(), this.stats.showPanel(0), this.stats.dom.style.position = "absolute", this.stats.dom.style.top = "0px", this.stats.dom.style.left = "0px", this.stats.dom.style.zIndex = "1000", this.container.appendChild(this.stats.dom));
|
|
15696
15993
|
let i = document.createElement("div");
|
|
15697
15994
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
15698
15995
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -15776,7 +16073,7 @@ class Sl {
|
|
|
15776
16073
|
* 通过 viewToken 解析 3D 模型地址,再复用现有 loaderModule URL 加载逻辑。
|
|
15777
16074
|
*/
|
|
15778
16075
|
async loadModelByViewToken(e, t) {
|
|
15779
|
-
const i = await
|
|
16076
|
+
const i = await Ls(
|
|
15780
16077
|
this.options,
|
|
15781
16078
|
e,
|
|
15782
16079
|
"3d"
|
|
@@ -15884,7 +16181,7 @@ class Sl {
|
|
|
15884
16181
|
return;
|
|
15885
16182
|
this.isDisposed = !0, console.log("[BimEngine] Starting engine disposal..."), this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null), this.isRenderingPaused = !0, this.onWindowResize && window.removeEventListener("resize", this.onWindowResize);
|
|
15886
16183
|
try {
|
|
15887
|
-
this.invokeIfExists(this.rangeScale, "dispose"), this.invokeIfExists(this.measure, "dispose"), this.invokeIfExists(this.clipping, "disActive"), this.invokeIfExists(this.interactionModule, "dispose"), this.invokeIfExists(this.controlModule, "dispose"), this.invokeIfExists(this.pathRoaming, "dispose"), this.invokeIfExists(this.hoverHighLight, "dispose"), this.invokeIfExists(this.linkElement2d3d, "dispose"), this.invokeIfExists(this.linkView2d3d, "dispose"), this.invokeIfExists(this.skyManager, "close", !0), this.invokeIfExists(this.hdr, "dispose"), this.invokeIfExists(this.minMap, "dispose"), this.invokeIfExists(this.grid, "dispose"), this.invokeIfExists(this.level, "dispose"), this.invokeIfExists(this.ground, "dispose"), this.invokeIfExists(this.text, "dispose"), this.invokeIfExists(this.issueReport, "dispose"), this.invokeIfExists(this.fabricDraw, "dispose"), this.invokeIfExists(this.modelLink3d, "dispose"), this.invokeIfExists(this.label, "dispose"), this.invokeIfExists(this.annotation3d, "dispose"), this.invokeIfExists(this.search, "dispose"), this.invokeIfExists(this.viewCube?.cubeTool, "dispose"), this.invokeIfExists(this.handelBehaved, "disActive"), this.invokeIfExists(this.engineStatus, "dispose");
|
|
16184
|
+
this.invokeIfExists(this.rangeScale, "dispose"), this.invokeIfExists(this.measure, "dispose"), this.invokeIfExists(this.clipping, "disActive"), this.invokeIfExists(this.interactionModule, "dispose"), this.invokeIfExists(this.controlModule, "dispose"), this.invokeIfExists(this.pathRoaming, "dispose"), this.invokeIfExists(this.hoverHighLight, "dispose"), this.invokeIfExists(this.linkElement2d3d, "dispose"), this.invokeIfExists(this.linkView2d3d, "dispose"), this.invokeIfExists(this.skyManager, "close", !0), this.invokeIfExists(this.hdr, "dispose"), this.invokeIfExists(this.minMap, "dispose"), this.invokeIfExists(this.grid, "dispose"), this.invokeIfExists(this.level, "dispose"), this.invokeIfExists(this.ground, "dispose"), this.invokeIfExists(this.text, "dispose"), this.invokeIfExists(this.issueReport, "dispose"), this.invokeIfExists(this.fabricDraw, "dispose"), this.invokeIfExists(this.modelLink3d, "dispose"), this.invokeIfExists(this.label, "dispose"), this.invokeIfExists(this.annotation3d, "dispose"), this.invokeIfExists(this.search, "dispose"), this.invokeIfExists(this.modelPlace, "dispose"), this.invokeIfExists(this.viewCube?.cubeTool, "dispose"), this.invokeIfExists(this.handelBehaved, "disActive"), this.invokeIfExists(this.engineStatus, "dispose");
|
|
15888
16185
|
} catch (t) {
|
|
15889
16186
|
console.warn("[BimEngine] Error disposing managers:", t);
|
|
15890
16187
|
}
|
|
@@ -15926,7 +16223,7 @@ class Sl {
|
|
|
15926
16223
|
if (!e) return;
|
|
15927
16224
|
[...e.children].forEach((i) => {
|
|
15928
16225
|
this.clearScene(i);
|
|
15929
|
-
}), e.parent && e.parent.remove(e), e instanceof O && !(e instanceof X) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof
|
|
16226
|
+
}), e.parent && e.parent.remove(e), e instanceof O && !(e instanceof X) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof at && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof Es && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof X && (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 St && e.material && this.disposeMaterial(e.material), e instanceof Ps && e.shadow?.dispose?.();
|
|
15930
16227
|
}
|
|
15931
16228
|
/**
|
|
15932
16229
|
* 清理材质及其纹理
|
|
@@ -15945,7 +16242,7 @@ class Sl {
|
|
|
15945
16242
|
}), e.background = null, e.environment = null, e.overrideMaterial = null, e.dirLight = null, e.camera = null;
|
|
15946
16243
|
}
|
|
15947
16244
|
disposeSceneAttachment(e) {
|
|
15948
|
-
e && (e instanceof As || e instanceof
|
|
16245
|
+
e && (e instanceof As || e instanceof bi) && e.dispose?.();
|
|
15949
16246
|
}
|
|
15950
16247
|
disposeMaterial(e) {
|
|
15951
16248
|
if (!e) return;
|
|
@@ -15976,10 +16273,10 @@ class Sl {
|
|
|
15976
16273
|
"iridescenceThicknessMap"
|
|
15977
16274
|
].forEach((i) => {
|
|
15978
16275
|
const n = e[i];
|
|
15979
|
-
n && n instanceof
|
|
16276
|
+
n && n instanceof bi && n.dispose();
|
|
15980
16277
|
}), e.dispose();
|
|
15981
16278
|
}
|
|
15982
16279
|
}
|
|
15983
16280
|
export {
|
|
15984
|
-
|
|
16281
|
+
El as E
|
|
15985
16282
|
};
|