iflow-engine-base-3d 3.11.5 → 3.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as ni, G as
|
|
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
|
|
3
|
-
import { r as W, g as
|
|
1
|
+
import { S as ni, G as de, P as st, O as Me, 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, D as he, s as vi, t as Qn, F as es, u as Fe, v as ln, w as cn, x as ai, y as ts, z as hn, H as we, J as is, K as ot, U as ns, X as ss, Y as os, Z as rs, _ as Le, $ as bt, a0 as dn, a1 as Z, a2 as ge, 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 un, ad as qt, ae as Et, af as hs, ag as je, ah as ds, ai as us, 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 Is } from "./sdk-runtime-BmnLG3N7.js";
|
|
3
|
+
import { r as W, g as Ls } from "./sdk-assets-BbXNfc5u.js";
|
|
4
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 de();
|
|
11
11
|
t.name = "groupEdge", this.scene.add(t);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -26,7 +26,7 @@ class ce {
|
|
|
26
26
|
1e3
|
|
27
27
|
), this.perspectiveCamera.position.set(2, 2, 2), this.perspectiveCamera.lookAt(0, 0, 0);
|
|
28
28
|
const t = 50, i = this.engine.container.clientWidth / this.engine.container.clientHeight;
|
|
29
|
-
this.orthographicCamera = new
|
|
29
|
+
this.orthographicCamera = new Me(
|
|
30
30
|
t * i / -2,
|
|
31
31
|
t * i / 2,
|
|
32
32
|
t / 2,
|
|
@@ -117,7 +117,7 @@ class ce {
|
|
|
117
117
|
if (t?.adjustDistance !== !1 && this.engine.camera === i && this.engine.controls?.target) {
|
|
118
118
|
const r = this.engine.controls.target.clone(), l = i.position.clone(), c = l.distanceTo(r);
|
|
119
119
|
if (c > 1e-6) {
|
|
120
|
-
const
|
|
120
|
+
const d = R.degToRad(n * 0.5), u = R.degToRad(s * 0.5), g = Math.tan(d) / Math.tan(u), m = c * g, w = new h().subVectors(l, r).normalize();
|
|
121
121
|
i.position.copy(r).add(w.multiplyScalar(m));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -130,11 +130,11 @@ class ce {
|
|
|
130
130
|
const e = this.engine.camera;
|
|
131
131
|
if (!e)
|
|
132
132
|
return;
|
|
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
|
|
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 Me ? this.getOrthographicVisibleHeight(e) : this.getPerspectiveVisibleHeight(e, i), c = R.degToRad(o.getEffectiveFOV() * 0.5), d = Math.max(
|
|
134
134
|
l / (2 * Math.tan(c)),
|
|
135
135
|
ce.MIN_CAMERA_DISTANCE
|
|
136
136
|
);
|
|
137
|
-
o.near = e.near, o.far = e.far, o.aspect = this.getCameraAspect(), o.up.copy(s), o.position.copy(i).add(r.multiplyScalar(
|
|
137
|
+
o.near = e.near, o.far = e.far, o.aspect = this.getCameraAspect(), o.up.copy(s), o.position.copy(i).add(r.multiplyScalar(d)), o.lookAt(i), this.engine.camera = o, this.applySwitchedCamera(o, i);
|
|
138
138
|
}
|
|
139
139
|
// 转换成正交相机
|
|
140
140
|
switchToOrthographicCamera() {
|
|
@@ -143,12 +143,12 @@ class ce {
|
|
|
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 st ? this.getPerspectiveVisibleHeight(e, i) : this.getOrthographicVisibleHeight(e), c = R.degToRad(e.getEffectiveFOV() * 0.5),
|
|
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), d = 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
|
|
151
|
+
const u = this.engine.octreeBox?.getBoundingBox?.(), g = u ? u.max.distanceTo(u.min) * 0.8 : d, 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() {
|
|
@@ -213,8 +213,8 @@ class ce {
|
|
|
213
213
|
if (o == null || o <= 0) {
|
|
214
214
|
const c = this.engine.octreeBox?.getBoundingBox?.();
|
|
215
215
|
if (c && c.min && c.max) {
|
|
216
|
-
const
|
|
217
|
-
o = Math.max(
|
|
216
|
+
const d = new h().subVectors(c.max, c.min);
|
|
217
|
+
o = Math.max(d.x, d.y, d.z) * 1.2;
|
|
218
218
|
} else
|
|
219
219
|
o = 50;
|
|
220
220
|
}
|
|
@@ -243,7 +243,7 @@ class Ns {
|
|
|
243
243
|
/BlackBerry/i,
|
|
244
244
|
/Windows Phone/i,
|
|
245
245
|
/Mobile/i
|
|
246
|
-
], t = navigator.userAgent || globalThis.opera, i = e.some((
|
|
246
|
+
], t = navigator.userAgent || globalThis.opera, i = e.some((d) => d.test(t)), n = "ontouchstart" in globalThis || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, s = globalThis.screen.width, o = globalThis.screen.height, r = s <= 768 || o <= 768, c = (globalThis.devicePixelRatio || 1) >= 2;
|
|
247
247
|
return i || n && r || n && c ? "mobile" : "PC";
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
@@ -323,7 +323,7 @@ const Vs = { type: "change" }, Pi = { type: "start" }, Ai = { type: "end" }, K =
|
|
|
323
323
|
DOLLY: 2,
|
|
324
324
|
TOUCH_ROTATE: 3,
|
|
325
325
|
TOUCH_DOLLY_PAN: 4
|
|
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(),
|
|
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(), me = new h(), j = new h(), be = new h(), se = new h(), Ce = new h(), Ws = new h(), mt = new De(), Ot = new De(), _i = /* @__PURE__ */ new Set([
|
|
327
327
|
"KeyW",
|
|
328
328
|
"KeyA",
|
|
329
329
|
"KeyS",
|
|
@@ -388,7 +388,7 @@ class fn extends Yn {
|
|
|
388
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 !We(e) || (se.copy(this.target).sub(this.object.position), se.lengthSq() < K) || (se.normalize(),
|
|
391
|
+
return !We(e) || (se.copy(this.target).sub(this.object.position), se.lengthSq() < K) || (se.normalize(), be.copy(e).normalize(), j.crossVectors(se, be), 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)
|
|
@@ -414,11 +414,11 @@ 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 || (
|
|
417
|
+
if (!this.enabled || !this.object?.isPerspectiveCamera || this._pressedKeys.size === 0 || (Ce.set(0, 0, 0), (this._pressedKeys.has("KeyW") || this._pressedKeys.has("ArrowUp")) && (Ce.z += 1), (this._pressedKeys.has("KeyS") || this._pressedKeys.has("ArrowDown")) && (Ce.z -= 1), (this._pressedKeys.has("KeyA") || this._pressedKeys.has("ArrowLeft")) && (Ce.x -= 1), (this._pressedKeys.has("KeyD") || this._pressedKeys.has("ArrowRight")) && (Ce.x += 1), this._pressedKeys.has("KeyQ") && (Ce.y += 1), this._pressedKeys.has("KeyE") && (Ce.y -= 1), Ce.lengthSq() <= K) || (Ce.normalize(), j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(), se.set(0, 0, -1).applyQuaternion(this.object.quaternion).normalize(), be.copy(this._referenceUp).normalize(), be.lengthSq() <= K && be.copy(this.object.up).normalize(), me.set(0, 0, 0), me.addScaledVector(j, Ce.x), me.addScaledVector(se, Ce.z), me.addScaledVector(be, Ce.y), me.lengthSq() <= K))
|
|
418
418
|
return !1;
|
|
419
|
-
|
|
419
|
+
me.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;
|
|
421
|
-
return
|
|
421
|
+
return me.multiplyScalar(s), this.object.position.add(me), this.target.add(me), this.origin.add(me), !0;
|
|
422
422
|
}
|
|
423
423
|
_startKeyboardMoveLoop() {
|
|
424
424
|
if (this._keyboardAnimationId != null)
|
|
@@ -459,7 +459,7 @@ class fn extends Yn {
|
|
|
459
459
|
}
|
|
460
460
|
_applyPan(e, t) {
|
|
461
461
|
const { width: i, height: n } = Ti(this.domElement);
|
|
462
|
-
j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(),
|
|
462
|
+
j.copy(Ft).applyQuaternion(this.object.quaternion).normalize(), be.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;
|
|
@@ -469,7 +469,7 @@ class fn extends Yn {
|
|
|
469
469
|
s = e / i * r * this.panSpeed, o = t / n * l * this.panSpeed;
|
|
470
470
|
} else
|
|
471
471
|
return;
|
|
472
|
-
|
|
472
|
+
me.set(0, 0, 0), me.addScaledVector(j, -s), me.addScaledVector(be, o), this.object.position.add(me), this.target.add(me);
|
|
473
473
|
}
|
|
474
474
|
_applyZoom(e) {
|
|
475
475
|
const t = Math.pow(0.95, this.zoomSpeed * e);
|
|
@@ -482,7 +482,7 @@ class fn extends Yn {
|
|
|
482
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
|
-
se.copy(this.target).sub(this.object.position), !(se.lengthSq() < K) && (se.normalize(), j.copy(this._getStableRightAxis(se)),
|
|
485
|
+
se.copy(this.target).sub(this.object.position), !(se.lengthSq() < K) && (se.normalize(), j.copy(this._getStableRightAxis(se)), be.crossVectors(j, se).normalize(), be.lengthSq() < K && be.copy(this._referenceUp), this._viewRight.copy(j), this.object.up.copy(be), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
486
486
|
}
|
|
487
487
|
_getStableRightAxis(e) {
|
|
488
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;
|
|
@@ -635,7 +635,7 @@ class fn extends Yn {
|
|
|
635
635
|
this.enableZoom && (this._zoomVelocity += e);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class Ii extends nn {
|
|
639
639
|
constructor(e, t, i, n) {
|
|
640
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)
|
|
@@ -984,10 +984,10 @@ class Li extends nn {
|
|
|
984
984
|
let o = {}, r = n.handelBehaved.handle_catch(this._rayCaster, o, !1);
|
|
985
985
|
if (this._rayCaster.far = 1 / 0, r == null)
|
|
986
986
|
return null;
|
|
987
|
-
let l = r.object.name, c = r.object.url,
|
|
988
|
-
if (
|
|
989
|
-
let
|
|
990
|
-
if (
|
|
987
|
+
let l = r.object.name, c = r.object.url, d = n.models.find((u) => u.url == c);
|
|
988
|
+
if (d != null) {
|
|
989
|
+
let u = d.nodesMap.get(l);
|
|
990
|
+
if (u.infos != null && u.infos.length != 0 && u.infos[0].name && (u.infos[0].name.includes("门") || u.infos[0].name.includes("門") || u.infos[0].name.includes("door")))
|
|
991
991
|
return null;
|
|
992
992
|
}
|
|
993
993
|
return r;
|
|
@@ -1017,9 +1017,9 @@ const qs = W("/assets/worker_walk.glb", import.meta.url), js = Math.PI, Ks = {
|
|
|
1017
1017
|
jump: ["Space"],
|
|
1018
1018
|
boost: ["ShiftLeft", "ShiftRight"]
|
|
1019
1019
|
};
|
|
1020
|
-
class
|
|
1020
|
+
class Li 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 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
|
|
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 de(), 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 nn {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
/** 创建 GLB 加载前的空角色,避免异步加载期间显示占位方块。 */
|
|
1050
1050
|
createDefaultAvatar() {
|
|
1051
|
-
const e = new
|
|
1051
|
+
const e = new de();
|
|
1052
1052
|
return e.name = "ThirdPersonEmptyAvatar", e.visible = !1, e;
|
|
1053
1053
|
}
|
|
1054
1054
|
/** 替换角色可视模型,碰撞体仍使用 avatarRoot 的脚底点和半径参数。 */
|
|
@@ -1353,8 +1353,8 @@ class Ii extends nn {
|
|
|
1353
1353
|
const i = t.duration ?? 500, n = this.avatarRoot.position.clone(), s = this.resolveAvatarFlightTarget(e), o = performance.now();
|
|
1354
1354
|
this.resetMovementState(), this.setScriptedMotionActive(!0);
|
|
1355
1355
|
const r = () => {
|
|
1356
|
-
const l = performance.now() - o, c = Math.min(l / i, 1),
|
|
1357
|
-
this.avatarRoot.position.lerpVectors(n, s,
|
|
1356
|
+
const l = performance.now() - o, c = Math.min(l / i, 1), d = c < 0.5 ? 2 * c * c : 1 - Math.pow(-2 * c + 2, 2) / 2;
|
|
1357
|
+
this.avatarRoot.position.lerpVectors(n, s, d), this.updateCameraFromAvatar(), c < 1 ? requestAnimationFrame(r) : (this.setAvatarHeight(s.y), this.updateCameraFromAvatar(), this.setScriptedMotionActive(!1));
|
|
1358
1358
|
};
|
|
1359
1359
|
return requestAnimationFrame(r), !0;
|
|
1360
1360
|
}
|
|
@@ -1430,8 +1430,8 @@ class Ii extends nn {
|
|
|
1430
1430
|
return null;
|
|
1431
1431
|
const o = s.object?.name, r = s.object?.url, l = this._Engine?.models?.find?.((c) => c.url === r);
|
|
1432
1432
|
if (l && o) {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1433
|
+
const d = l.nodesMap?.get?.(o)?.infos?.[0]?.name;
|
|
1434
|
+
if (d && (d.includes("门") || d.includes("門") || d.toLowerCase().includes("door")))
|
|
1435
1435
|
return null;
|
|
1436
1436
|
}
|
|
1437
1437
|
return s;
|
|
@@ -1463,7 +1463,7 @@ function $t(a, e) {
|
|
|
1463
1463
|
a.url = e, a.name = e, a.userData = a.userData ?? {}, a.userData[Xt] = !0;
|
|
1464
1464
|
}
|
|
1465
1465
|
function ci(a, e) {
|
|
1466
|
-
return a instanceof
|
|
1466
|
+
return a instanceof de ? e == null ? a.userData?.[Xt] === !0 : a.userData?.[Xt] === !0 && a.url === e : !1;
|
|
1467
1467
|
}
|
|
1468
1468
|
function hi(a, e) {
|
|
1469
1469
|
return a?.models?.find?.((t) => t?.url === e);
|
|
@@ -1479,9 +1479,9 @@ function Ne(a, e) {
|
|
|
1479
1479
|
if (i && i.parent != null)
|
|
1480
1480
|
return i;
|
|
1481
1481
|
const n = hi(a, e);
|
|
1482
|
-
if (n?.group instanceof
|
|
1482
|
+
if (n?.group instanceof de && 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 de ? 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
1487
|
function He(a, e) {
|
|
@@ -1492,7 +1492,7 @@ function Ye(a, e) {
|
|
|
1492
1492
|
const t = Ne(a, e);
|
|
1493
1493
|
if (t != null)
|
|
1494
1494
|
return t;
|
|
1495
|
-
const i = new
|
|
1495
|
+
const i = new de();
|
|
1496
1496
|
$t(i, e), a.scene.add(i), vn(a).set(e, i);
|
|
1497
1497
|
const s = hi(a, e);
|
|
1498
1498
|
return s != null && (s.group = i), i;
|
|
@@ -1508,7 +1508,7 @@ function Ys(a) {
|
|
|
1508
1508
|
!ci(n) || t.has(n.uuid) || (t.add(n.uuid), e.push(n));
|
|
1509
1509
|
}), e;
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1511
|
+
function di(a, e) {
|
|
1512
1512
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
1513
1513
|
return Ys(a).forEach((s) => {
|
|
1514
1514
|
s.traverse((o) => {
|
|
@@ -1524,8 +1524,8 @@ function ui(a, e) {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
}), t;
|
|
1526
1526
|
}
|
|
1527
|
-
function
|
|
1528
|
-
return
|
|
1527
|
+
function ui(a) {
|
|
1528
|
+
return di(a, (e) => e instanceof O && !(e instanceof X));
|
|
1529
1529
|
}
|
|
1530
1530
|
function Xs(a) {
|
|
1531
1531
|
if (typeof a.__modelObjectIndexSeed == "number")
|
|
@@ -1573,14 +1573,14 @@ function ki(a, e) {
|
|
|
1573
1573
|
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? yn : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
1574
1574
|
});
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function Lt(a, e) {
|
|
1577
1577
|
if (!Number.isFinite(e))
|
|
1578
1578
|
return;
|
|
1579
1579
|
const t = Mn(a), i = t.get(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 = di(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 {
|
|
@@ -1597,12 +1597,12 @@ class Js {
|
|
|
1597
1597
|
r || (r = [0, 0, []]);
|
|
1598
1598
|
const l = He(n, s), c = this.getModelSnapCache(s, o, r);
|
|
1599
1599
|
n.camera.updateMatrixWorld(!0);
|
|
1600
|
-
const
|
|
1600
|
+
const d = new G().multiplyMatrices(n.camera.projectionMatrix, n.camera.matrixWorldInverse), u = 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
|
|
1603
|
+
const I = e.point.clone(), V = e.normal || (e.face ? e.face.normal : null);
|
|
1604
1604
|
if (V && e.object?.matrixWorld?.elements) {
|
|
1605
|
-
const $ = V.clone().transformDirection(e.object.matrixWorld).normalize(), f = new h().subVectors(i,
|
|
1605
|
+
const $ = V.clone().transformDirection(e.object.matrixWorld).normalize(), f = new h().subVectors(i, I).dot($), y = i.clone().sub($.clone().multiplyScalar(f)), P = this.projectWorldPointToScreen(y, d, u, 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,10 +1614,10 @@ class Js {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
|
-
for (let
|
|
1618
|
-
if (v.set(c.localPoints[
|
|
1617
|
+
for (let I = 0; I < c.localPoints.length; I += 3) {
|
|
1618
|
+
if (v.set(c.localPoints[I], c.localPoints[I + 1], c.localPoints[I + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(v))
|
|
1619
1619
|
continue;
|
|
1620
|
-
const V = this.projectWorldPointToScreen(v,
|
|
1620
|
+
const V = this.projectWorldPointToScreen(v, d, u, g, p, w);
|
|
1621
1621
|
if (V == null)
|
|
1622
1622
|
continue;
|
|
1623
1623
|
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
@@ -1628,10 +1628,10 @@ class Js {
|
|
|
1628
1628
|
style: "rect"
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
|
-
for (let
|
|
1632
|
-
if (v.set(c.localCenters[
|
|
1631
|
+
for (let I = 0; I < c.localCenters.length; I += 3) {
|
|
1632
|
+
if (v.set(c.localCenters[I], c.localCenters[I + 1], c.localCenters[I + 2]).applyMatrix4(l), n.clipping && !n.clipping.isPointInClippingRange(v))
|
|
1633
1633
|
continue;
|
|
1634
|
-
const V = this.projectWorldPointToScreen(v,
|
|
1634
|
+
const V = this.projectWorldPointToScreen(v, d, u, g, p, w);
|
|
1635
1635
|
if (V == null)
|
|
1636
1636
|
continue;
|
|
1637
1637
|
const $ = this.getDistanceSq(V.x, V.y, m.x, m.y);
|
|
@@ -1645,20 +1645,20 @@ class Js {
|
|
|
1645
1645
|
if (E != null)
|
|
1646
1646
|
_ = "point";
|
|
1647
1647
|
else {
|
|
1648
|
-
for (let
|
|
1649
|
-
v.set(c.localLines[
|
|
1650
|
-
const V = this.projectWorldPointToScreen(v,
|
|
1648
|
+
for (let I = 0; I < c.localLines.length; I += 6) {
|
|
1649
|
+
v.set(c.localLines[I], c.localLines[I + 1], c.localLines[I + 2]).applyMatrix4(l), b.set(c.localLines[I + 3], c.localLines[I + 4], c.localLines[I + 5]).applyMatrix4(l);
|
|
1650
|
+
const V = this.projectWorldPointToScreen(v, d, u, g, p, w), $ = this.projectWorldPointToScreen(b, d, u, g, x, w);
|
|
1651
1651
|
if (V == null || $ == null)
|
|
1652
1652
|
continue;
|
|
1653
1653
|
const S = this.pointToLineProjection(m, V, $), f = this.pointToLineDistanceSq(m, V, $);
|
|
1654
1654
|
if (f < B) {
|
|
1655
|
-
const y = this.pointToLineProjection3D(S, v, b,
|
|
1655
|
+
const y = this.pointToLineProjection3D(S, v, b, d, C);
|
|
1656
1656
|
if (n.clipping && !n.clipping.isPointInClippingRange(y))
|
|
1657
1657
|
continue;
|
|
1658
1658
|
k = {
|
|
1659
1659
|
distanceSq: f,
|
|
1660
1660
|
point: y.clone(),
|
|
1661
|
-
pointxy: this.projectWorldPointToScreen(y,
|
|
1661
|
+
pointxy: this.projectWorldPointToScreen(y, d, u, g, p, w)?.clone() ?? V.clone(),
|
|
1662
1662
|
start: V.clone(),
|
|
1663
1663
|
end: $.clone(),
|
|
1664
1664
|
style: "funnel"
|
|
@@ -1677,17 +1677,17 @@ class Js {
|
|
|
1677
1677
|
if (o && o.source === s)
|
|
1678
1678
|
return o;
|
|
1679
1679
|
const r = new Float32Array(s.length * 3), l = new Float32Array(s.length * 3), c = new Float32Array(s.length * 6);
|
|
1680
|
-
let
|
|
1680
|
+
let d = 0, u = 0, g = 0;
|
|
1681
1681
|
s.forEach((w) => {
|
|
1682
1682
|
if (w?.[0] == null || w?.[1] == null)
|
|
1683
1683
|
return;
|
|
1684
1684
|
const v = w[0], b = w[1];
|
|
1685
|
-
r[
|
|
1685
|
+
r[d++] = v.X, r[d++] = v.Z, r[d++] = -v.Y, l[u++] = (v.X + b.X) * 0.5, l[u++] = (v.Z + b.Z) * 0.5, l[u++] = (-v.Y - b.Y) * 0.5, c[g++] = v.X, c[g++] = v.Z, c[g++] = -v.Y, c[g++] = b.X, c[g++] = b.Z, c[g++] = -b.Y;
|
|
1686
1686
|
});
|
|
1687
1687
|
const m = {
|
|
1688
1688
|
source: s,
|
|
1689
|
-
localPoints: r.subarray(0,
|
|
1690
|
-
localCenters: l.subarray(0,
|
|
1689
|
+
localPoints: r.subarray(0, d),
|
|
1690
|
+
localCenters: l.subarray(0, u),
|
|
1691
1691
|
localLines: c.subarray(0, g)
|
|
1692
1692
|
};
|
|
1693
1693
|
return this.snapModelCache.set(n, m), m;
|
|
@@ -1729,8 +1729,8 @@ 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 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,
|
|
1733
|
-
return s.lerpVectors(t, i, R.clamp(
|
|
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, d = Math.abs(c) > 1e-10 ? o * r.w / c : o;
|
|
1733
|
+
return s.lerpVectors(t, i, R.clamp(d, 0, 1));
|
|
1734
1734
|
}
|
|
1735
1735
|
/**
|
|
1736
1736
|
* 渲染点捕捉指示器,并复用原有的图形语义。
|
|
@@ -1770,14 +1770,14 @@ class Js {
|
|
|
1770
1770
|
* 渲染面捕捉指示器,保持固定像素大小,避免缩放时视觉尺寸漂移。
|
|
1771
1771
|
*/
|
|
1772
1772
|
renderFaceCandidate(e) {
|
|
1773
|
-
const t = this.engine, i = e.point.clone(), n = e.normal || (e.face ? e.face.normal : null), s = (n ? n.clone() : new h(0, 0, 1)).normalize(), o = Math.abs(s.y) < 0.9 ? new h(0, 1, 0) : new h(1, 0, 0), r = new h().crossVectors(s, o).normalize(), l = new h().crossVectors(s, r).normalize(), c = 20,
|
|
1774
|
-
(g.x -
|
|
1773
|
+
const t = this.engine, i = e.point.clone(), n = e.normal || (e.face ? e.face.normal : null), s = (n ? n.clone() : new h(0, 0, 1)).normalize(), o = Math.abs(s.y) < 0.9 ? new h(0, 1, 0) : new h(1, 0, 0), r = new h().crossVectors(s, o).normalize(), l = new h().crossVectors(s, r).normalize(), c = 20, d = new oe(t.camera, t.renderer, t.scene), u = d.worldToScreen(i), g = d.worldToScreen(new h().copy(i).add(r)), m = Math.sqrt(
|
|
1774
|
+
(g.x - u.x) ** 2 + (g.y - u.y) ** 2
|
|
1775
1775
|
), w = m > 0 ? c / m : 0.2, p = [
|
|
1776
1776
|
new h().copy(r).add(l).multiplyScalar(w),
|
|
1777
1777
|
new h().copy(r).sub(l).multiplyScalar(w),
|
|
1778
1778
|
new h().copy(r).multiplyScalar(-1).sub(l).multiplyScalar(w),
|
|
1779
1779
|
new h().copy(r).multiplyScalar(-1).add(l).multiplyScalar(w)
|
|
1780
|
-
].map((C) => new h().copy(i).add(C)).map((C) =>
|
|
1780
|
+
].map((C) => new h().copy(i).add(C)).map((C) => d.worldToScreen(C));
|
|
1781
1781
|
t.catchSvg.innerHTML = "";
|
|
1782
1782
|
const x = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
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);
|
|
@@ -1829,22 +1829,22 @@ function gi(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", $e, !0), a.renderer.domElement.addEventListener("pointerup", Be, !0), a.renderer.domElement.addEventListener("pointercancel", Be, !0), window.addEventListener("keydown", c), window.addEventListener("keyup",
|
|
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", d);
|
|
1833
1833
|
}, e.disActive = function() {
|
|
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",
|
|
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", d);
|
|
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();
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1839
|
+
function d(M) {
|
|
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
|
-
function
|
|
1842
|
+
function u(M) {
|
|
1843
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 ae(), z =
|
|
1847
|
+
const A = new ae(), z = u(M);
|
|
1848
1848
|
return A.setFromCamera(z, a.camera), A;
|
|
1849
1849
|
}
|
|
1850
1850
|
function m() {
|
|
@@ -1861,7 +1861,7 @@ function gi(a) {
|
|
|
1861
1861
|
e.touchLongPressTimer != null && (clearTimeout(e.touchLongPressTimer), e.touchLongPressTimer = null);
|
|
1862
1862
|
}
|
|
1863
1863
|
function p() {
|
|
1864
|
-
b(),
|
|
1864
|
+
b(), I(), _(), 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?.();
|
|
@@ -1890,7 +1890,7 @@ function gi(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 I() {
|
|
1894
1894
|
const M = e.touchMagnifierCanvas;
|
|
1895
1895
|
M && (M.style.display = "none");
|
|
1896
1896
|
}
|
|
@@ -1900,13 +1900,13 @@ function gi(a) {
|
|
|
1900
1900
|
function $(M, A, z, N, U, le) {
|
|
1901
1901
|
const ue = a?.catchSvg;
|
|
1902
1902
|
if (!ue?.childElementCount) return;
|
|
1903
|
-
const
|
|
1903
|
+
const pe = a?.reactBoundingClientRect ?? A.getBoundingClientRect(), Re = (te) => {
|
|
1904
1904
|
const [_e, Ve] = te.split(",").map(Number);
|
|
1905
|
-
return Number.isFinite(_e) && Number.isFinite(Ve) ? [(_e -
|
|
1905
|
+
return Number.isFinite(_e) && Number.isFinite(Ve) ? [(_e - pe.left - z) / U * n * le, (Ve - pe.top - N) / U * n * le] : null;
|
|
1906
1906
|
};
|
|
1907
1907
|
Array.from(ue.children).forEach((te) => {
|
|
1908
|
-
const _e = te.tagName.toLowerCase(),
|
|
1909
|
-
|
|
1908
|
+
const _e = te.tagName.toLowerCase(), xe = (_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
|
+
xe.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(xe[0][0], xe[0][1]), xe.slice(1).forEach(([dt, ut]) => M.lineTo(dt, ut)), _e === "polygon" && (M.closePath(), ["none", "transparent"].includes(String(M.fillStyle)) || M.fill()), M.stroke());
|
|
1910
1910
|
});
|
|
1911
1911
|
}
|
|
1912
1912
|
function S(M) {
|
|
@@ -1915,10 +1915,10 @@ function gi(a) {
|
|
|
1915
1915
|
return;
|
|
1916
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
|
+
I();
|
|
1919
1919
|
return;
|
|
1920
1920
|
}
|
|
1921
|
-
const
|
|
1921
|
+
const pe = z.width / n, Re = Math.min(
|
|
1922
1922
|
window.innerWidth - n / 2 - 8,
|
|
1923
1923
|
Math.max(n / 2 + 8, M.clientX)
|
|
1924
1924
|
), te = Math.min(
|
|
@@ -1926,15 +1926,15 @@ function gi(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), Ve = A.height / Math.max(1, A.clientHeight),
|
|
1929
|
+
const _e = A.width / Math.max(1, A.clientWidth), Ve = A.height / Math.max(1, A.clientHeight), xe = s, dt = Math.max(0, Math.min(A.clientWidth - xe, ue.x - xe / 2)), ut = Math.max(0, Math.min(A.clientHeight - xe, ue.y - xe / 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, dt * _e, ut * Ve, xe * _e, xe * Ve, 0, 0, z.width, z.height), $(N, A, dt, ut, xe, pe);
|
|
1933
1933
|
} catch {
|
|
1934
|
-
|
|
1934
|
+
I(), N.restore();
|
|
1935
1935
|
return;
|
|
1936
1936
|
}
|
|
1937
|
-
N.strokeStyle = "rgba(0, 255, 247, 0.9)", N.lineWidth = 1.5 *
|
|
1937
|
+
N.strokeStyle = "rgba(0, 255, 247, 0.9)", N.lineWidth = 1.5 * pe, N.beginPath(), N.moveTo(z.width / 2 - 10 * pe, z.height / 2), N.lineTo(z.width / 2 + 10 * pe, z.height / 2), N.moveTo(z.width / 2, z.height / 2 - 10 * pe), N.lineTo(z.width / 2, z.height / 2 + 10 * pe), N.stroke(), N.restore();
|
|
1938
1938
|
}
|
|
1939
1939
|
function f(M, A = !1, z = !1, N = !0) {
|
|
1940
1940
|
const U = g(M);
|
|
@@ -1978,7 +1978,7 @@ function gi(a) {
|
|
|
1978
1978
|
// 保留原始触摸事件
|
|
1979
1979
|
};
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function L(M) {
|
|
1982
1982
|
const z = a.renderer.domElement.getBoundingClientRect();
|
|
1983
1983
|
return {
|
|
1984
1984
|
offsetX: M.clientX - z.left,
|
|
@@ -2047,14 +2047,14 @@ function gi(a) {
|
|
|
2047
2047
|
function Ee(M) {
|
|
2048
2048
|
if (M.pointerType !== "touch" || !w() || M.isPrimary === !1)
|
|
2049
2049
|
return;
|
|
2050
|
-
const A =
|
|
2050
|
+
const A = L(M);
|
|
2051
2051
|
F(A, new H(M.clientX, M.clientY), "pointer", M.pointerId);
|
|
2052
2052
|
}
|
|
2053
2053
|
function $e(M) {
|
|
2054
|
-
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || q(
|
|
2054
|
+
M.pointerType !== "touch" || !w() || (e.touchLongPressActive && x(M), e.touchInputMode === "pointer" && (e.touchPointerId != null && M.pointerId !== e.touchPointerId || q(L(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(L(M))));
|
|
2058
2058
|
}
|
|
2059
2059
|
function Ze(M, A, z = !1, N = !0) {
|
|
2060
2060
|
if (!a.engineStatus.isFree && z == !1) {
|
|
@@ -2098,7 +2098,7 @@ class Qs {
|
|
|
2098
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 Ii(this.engine, this.engine.camera, this.engine.renderer.domElement), this.thirdPersonControls = new Li(this.engine, this.engine.camera, this.engine.renderer.domElement);
|
|
2102
2102
|
const e = document.createElement("div");
|
|
2103
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
|
}
|
|
@@ -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 Ii(
|
|
2149
2149
|
this.engine,
|
|
2150
2150
|
this.engine.camera,
|
|
2151
2151
|
this.engine.renderer.domElement,
|
|
@@ -2162,7 +2162,7 @@ class Qs {
|
|
|
2162
2162
|
applyCollision: t?.applyCollision,
|
|
2163
2163
|
applyGravity: t?.applyGravity
|
|
2164
2164
|
};
|
|
2165
|
-
return t?.dispose?.(), this.thirdPersonControls = new
|
|
2165
|
+
return t?.dispose?.(), this.thirdPersonControls = new Li(
|
|
2166
2166
|
this.engine,
|
|
2167
2167
|
this.engine.camera,
|
|
2168
2168
|
this.engine.renderer.domElement,
|
|
@@ -2310,10 +2310,10 @@ class Qs {
|
|
|
2310
2310
|
}
|
|
2311
2311
|
bindMovePad(e) {
|
|
2312
2312
|
const t = e.querySelector(".bim-mobile-roam-move-knob"), i = (s) => {
|
|
2313
|
-
const o = e.getBoundingClientRect(), r = Math.min(o.width, o.height) * 0.5, l = r * 0.48, c = r * 0.22,
|
|
2313
|
+
const o = e.getBoundingClientRect(), r = Math.min(o.width, o.height) * 0.5, l = r * 0.48, c = r * 0.22, d = s.clientX - o.left - r, u = s.clientY - o.top - r, g = Math.hypot(d, u), m = Math.min(g, l), w = g > l ? l / g : 1, v = d * w, b = u * w;
|
|
2314
2314
|
t && (t.style.transform = `translate(${v}px, ${b}px)`);
|
|
2315
2315
|
const p = [];
|
|
2316
|
-
|
|
2316
|
+
u < -c ? p.push("w") : u > c && p.push("s"), d < -c ? p.push("a") : d > c && p.push("d"), this.mobileMoveIntensity = p.length === 0 ? 0 : Math.max(0, Math.min(1, (m - c) / (l - c))), this.updateMobileMoveKeys(p);
|
|
2317
2317
|
};
|
|
2318
2318
|
e.addEventListener("pointerdown", (s) => {
|
|
2319
2319
|
s.preventDefault(), s.stopPropagation(), this.mobileMovePointerId = s.pointerId, e.classList.add("is-active"), e.setPointerCapture?.(s.pointerId), i(s);
|
|
@@ -2452,7 +2452,7 @@ class to {
|
|
|
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 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({
|
|
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.normalMaterial.side = he, this.gtaoPass.normalMaterial.needsUpdate = !0, this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
2456
2456
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
2457
2457
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
2458
2458
|
radius: 0.45,
|
|
@@ -2485,7 +2485,7 @@ 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 = Ye(a, t), c = e.circularMeps,
|
|
2488
|
+
const l = Ye(a, t), c = e.circularMeps, d = e.rectMeps?.filter((v) => v.type === "风管"), u = 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
|
|
@@ -2497,7 +2497,7 @@ function io(a, e, t, i) {
|
|
|
2497
2497
|
C.indexes = [[x, _, 0, 0]], r.nodesMap.set(Number(C.id), C);
|
|
2498
2498
|
});
|
|
2499
2499
|
};
|
|
2500
|
-
w("Circle", c), w("Rect",
|
|
2500
|
+
w("Circle", c), w("Rect", d), w("Ellipse", g), w("Bridge", u);
|
|
2501
2501
|
}
|
|
2502
2502
|
function no(a, e, t, i, n) {
|
|
2503
2503
|
let s;
|
|
@@ -2530,7 +2530,7 @@ function no(a, e, t, i, n) {
|
|
|
2530
2530
|
r.url = i, e.add(r);
|
|
2531
2531
|
const l = pi(n, r);
|
|
2532
2532
|
mi(r, l);
|
|
2533
|
-
const c = [],
|
|
2533
|
+
const c = [], d = [];
|
|
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);
|
|
2536
2536
|
let x = 0, C = 0, _ = 0;
|
|
@@ -2542,9 +2542,9 @@ function no(a, e, t, i, n) {
|
|
|
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
2544
|
const E = new G(), k = new sn(x, C, _, "YXZ"), B = E.clone().makeRotationFromEuler(k);
|
|
2545
|
-
let
|
|
2546
|
-
a === "Circle" ? (
|
|
2547
|
-
const $ = E.clone().makeScale(
|
|
2545
|
+
let I, V;
|
|
2546
|
+
a === "Circle" ? (I = m.diameter, V = m.diameter) : (I = m.width, V = m.height);
|
|
2547
|
+
const $ = E.clone().makeScale(I, 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,
|
|
@@ -2562,16 +2562,16 @@ function no(a, e, t, i, n) {
|
|
|
2562
2562
|
x: m.endPoint.X * 0.3048,
|
|
2563
2563
|
y: m.endPoint.Z * 0.3048,
|
|
2564
2564
|
z: -m.endPoint.Y * 0.3048
|
|
2565
|
-
}), r.ids || (r.ids = []), r.matrixs || (r.matrixs = []), r.matrixs.push(E.clone()),
|
|
2565
|
+
}), r.ids || (r.ids = []), r.matrixs || (r.matrixs = []), r.matrixs.push(E.clone()), d.push(E.clone()), r.ids.push(Number(m.id)), c.push(D);
|
|
2566
2566
|
}
|
|
2567
|
-
r.castShadow = !0, r.ElementInfos = c, r.name = "rootModel", r.TypeName = "InstancedMesh-Pipe", r.PipeType = a, r.MeshId = null, r.realMaterial = r.material.clone(), r.originalMaterial = r.material.clone(), r.matrixsClone =
|
|
2568
|
-
const
|
|
2567
|
+
r.castShadow = !0, r.ElementInfos = c, r.name = "rootModel", r.TypeName = "InstancedMesh-Pipe", r.PipeType = a, r.MeshId = null, r.realMaterial = r.material.clone(), r.originalMaterial = r.material.clone(), r.matrixsClone = d, n?.sectionPlane && (r.material.clippingPlanes = n.sectionPlane, r.originalMaterial.clippingPlanes = n.sectionPlane, r.realMaterial.clippingPlanes = n.sectionPlane);
|
|
2568
|
+
const u = {
|
|
2569
2569
|
geometry: r.geometry,
|
|
2570
2570
|
matrix: r.matrix,
|
|
2571
2571
|
position: r.position,
|
|
2572
2572
|
rotation: r.rotation
|
|
2573
2573
|
};
|
|
2574
|
-
return r.meshs =
|
|
2574
|
+
return r.meshs = u, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, l;
|
|
2575
2575
|
}
|
|
2576
2576
|
function ft(a, e) {
|
|
2577
2577
|
const t = new ln();
|
|
@@ -2595,18 +2595,18 @@ function ft(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
|
|
2598
|
+
const d = new cn(s, o), u = new ai({
|
|
2599
2599
|
color: r,
|
|
2600
|
-
side:
|
|
2601
|
-
}), g = new O(
|
|
2600
|
+
side: he
|
|
2601
|
+
}), g = new O(d, u);
|
|
2602
2602
|
return g.position.set(l.x, l.y, l.z), g.rotation._order = "YXZ", g.rotation.set(c.x, c.y, c.z), g;
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
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 || {});
|
|
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.ModelPlaceSelected = "model-place-selected", 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
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[zi] !== !0 && (O.prototype.raycast = ts,
|
|
2609
|
+
a[zi] !== !0 && (O.prototype.raycast = ts, we.prototype.computeBoundsTree = hn, we.prototype.disposeBoundsTree = is, a[zi] = !0);
|
|
2610
2610
|
}
|
|
2611
2611
|
function lo(a) {
|
|
2612
2612
|
a.firstHitOnly = !0;
|
|
@@ -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, Ls(import.meta.url), t, i);
|
|
2738
2738
|
});
|
|
2739
2739
|
}
|
|
2740
2740
|
function Xe(a, e) {
|
|
2741
2741
|
const t = a.models.find((i) => i.url == e);
|
|
2742
2742
|
return t != null && t.group == null && (t.group = Ne(a, e) ?? Ye(a, e)), t;
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2744
|
+
function In(a, e) {
|
|
2745
2745
|
const t = Xe(a, e);
|
|
2746
2746
|
return Array.isArray(t?.lods) ? t.lods : [];
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2748
|
+
function Ln(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 Ln(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;
|
|
@@ -2761,14 +2761,14 @@ function zn(a) {
|
|
|
2761
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 Io(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 Lo(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; ) {
|
|
@@ -2778,7 +2778,7 @@ async function Io(a, e, t) {
|
|
|
2778
2778
|
const r = o.node;
|
|
2779
2779
|
if (o.visited) {
|
|
2780
2780
|
const c = Array.isArray(r.children) ? r.children : [];
|
|
2781
|
-
(c.length === 0 || c.findIndex((
|
|
2781
|
+
(c.length === 0 || c.findIndex((d) => d.status != !0) === -1) && (r.status = !0), s = await ze(a, t, s);
|
|
2782
2782
|
continue;
|
|
2783
2783
|
}
|
|
2784
2784
|
n.push({ node: r, visited: !0 }), Array.isArray(r.elements) && i.push(...r.elements);
|
|
@@ -2793,15 +2793,15 @@ async function ko(a, e, t, i) {
|
|
|
2793
2793
|
const n = Xe(a, e.url);
|
|
2794
2794
|
if (n?.nodesMap == null)
|
|
2795
2795
|
return [];
|
|
2796
|
-
const s = await
|
|
2796
|
+
const s = await Lo(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;
|
|
2800
2800
|
for (const c of s) {
|
|
2801
2801
|
if (!n.nodesMap.has(c))
|
|
2802
2802
|
continue;
|
|
2803
|
-
const
|
|
2804
|
-
for (const g of
|
|
2803
|
+
const d = n.nodesMap.get(c), u = Array.isArray(d?.infos) ? d.infos : [];
|
|
2804
|
+
for (const g of u) {
|
|
2805
2805
|
const m = t.glbs?.[g.glb]?.[g.mesh];
|
|
2806
2806
|
if (m?.geometry == null || m.material == null)
|
|
2807
2807
|
continue;
|
|
@@ -2830,12 +2830,12 @@ function Bo(a) {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
function Ro(a, e, t, i, n) {
|
|
2832
2832
|
const s = ot(
|
|
2833
|
-
i.map((
|
|
2833
|
+
i.map((d) => d.geometry),
|
|
2834
2834
|
!1
|
|
2835
2835
|
), o = Bn(n), r = new O(s, o);
|
|
2836
2836
|
r.castShadow = !0, r.receiveShadow = !0, Ye(e, a).add(r);
|
|
2837
2837
|
const c = pi(e, r);
|
|
2838
|
-
return mi(r, c), r.url = a, r.glb = t, r.materialClone = o, r.geometrys = i.map((
|
|
2838
|
+
return mi(r, c), r.url = a, r.glb = t, r.materialClone = o, r.geometrys = i.map((d) => d.geometry), r.geometry.computeVertexNormals(), r;
|
|
2839
2839
|
}
|
|
2840
2840
|
function Fo(a, e, t, i) {
|
|
2841
2841
|
return (Ne(a, e)?.children ?? a.scene.children).find((o) => {
|
|
@@ -2857,16 +2857,16 @@ async function No(a, e, t, i) {
|
|
|
2857
2857
|
let o = performance.now();
|
|
2858
2858
|
for (const [r, l] of n.entries()) {
|
|
2859
2859
|
const c = i ? l.length : yo;
|
|
2860
|
-
for (let
|
|
2861
|
-
const
|
|
2862
|
-
if (
|
|
2860
|
+
for (let d = 0; d < l.length; d += c) {
|
|
2861
|
+
const u = l.slice(d, d + c);
|
|
2862
|
+
if (u.length === 0)
|
|
2863
2863
|
continue;
|
|
2864
|
-
const g = $o(
|
|
2864
|
+
const g = $o(u[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 = Oi(m.geometry), Oo(m,
|
|
2866
|
+
m = null, m != null ? (w = Array.isArray(m.geometrys) ? m.geometrys.length : 0, v = Oi(m.geometry), Oo(m, u)) : m = Ro(a, e, r, u, g);
|
|
2867
2867
|
const b = /* @__PURE__ */ new Map();
|
|
2868
2868
|
let p = v;
|
|
2869
|
-
|
|
2869
|
+
u.forEach((x, C) => {
|
|
2870
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(_);
|
|
@@ -2882,7 +2882,7 @@ async function No(a, e, t, i) {
|
|
|
2882
2882
|
}
|
|
2883
2883
|
function Ho(a, e) {
|
|
2884
2884
|
const t = a?.geometry;
|
|
2885
|
-
return t instanceof
|
|
2885
|
+
return t instanceof we ? (t.boundingBox == null && t.computeBoundingBox(), t.boundingBox?.clone().applyMatrix4(e) ?? null) : null;
|
|
2886
2886
|
}
|
|
2887
2887
|
async function Vo(a, e, t, i, n, s) {
|
|
2888
2888
|
if (i == null || n == null || n.length === 0)
|
|
@@ -2894,11 +2894,11 @@ async function Vo(a, e, t, i, n, s) {
|
|
|
2894
2894
|
Ye(t, a).add(r);
|
|
2895
2895
|
const c = pi(t, r);
|
|
2896
2896
|
mi(r, c);
|
|
2897
|
-
const
|
|
2897
|
+
const d = new Float32Array(n.length * 3);
|
|
2898
2898
|
for (let m = 0; m < n.length; m++)
|
|
2899
|
-
|
|
2900
|
-
r.instanceColor = new ns(
|
|
2901
|
-
let
|
|
2899
|
+
d[m * 3] = 1, d[m * 3 + 1] = 1, d[m * 3 + 2] = 1;
|
|
2900
|
+
r.instanceColor = new ns(d, 3);
|
|
2901
|
+
let u = performance.now();
|
|
2902
2902
|
const g = [];
|
|
2903
2903
|
for (let m = 0; m < n.length; m++) {
|
|
2904
2904
|
const w = n[m], v = new G();
|
|
@@ -2909,7 +2909,7 @@ async function Vo(a, e, t, i, n, s) {
|
|
|
2909
2909
|
p.indexes == null && (p.indexes = []), p.indexes.push([c, m, 0, 0]), b != null && p?.info != null && (p.info.box instanceof Y ? p.info.box.union(b) : p.info.box = b.clone());
|
|
2910
2910
|
} else
|
|
2911
2911
|
o.nodesMap.set(w.id, { instance: !0, info: w, indexes: [[c, m, 0, 0]] });
|
|
2912
|
-
(m + 1) % fo === 0 && (
|
|
2912
|
+
(m + 1) % fo === 0 && (u = await ze(t, s, u));
|
|
2913
2913
|
}
|
|
2914
2914
|
r.instanceMatrix.needsUpdate = !0, r.instanceColor != null && (r.instanceColor.needsUpdate = !0), r.materialClone = r.material, r.url = a, r.glb = i.glb, r.ids = n.map((m) => m.id), r.matrixsClone = g, r.meshIndex = e, t.requestComposerRender?.();
|
|
2915
2915
|
}
|
|
@@ -2961,8 +2961,8 @@ async function Wo(a, e, t, i) {
|
|
|
2961
2961
|
return;
|
|
2962
2962
|
l.nodesMap == null && (l.nodesMap = /* @__PURE__ */ new Map());
|
|
2963
2963
|
let c = performance.now();
|
|
2964
|
-
const
|
|
2965
|
-
for (const v of
|
|
2964
|
+
const d = Object.keys(r);
|
|
2965
|
+
for (const v of d) {
|
|
2966
2966
|
const b = r[v];
|
|
2967
2967
|
for (let p = 0; p < b.length; p++) {
|
|
2968
2968
|
const x = b[p];
|
|
@@ -2976,7 +2976,7 @@ async function Wo(a, e, t, i) {
|
|
|
2976
2976
|
(p + 1) % Pn === 0 && (c = await ze(a, i, c));
|
|
2977
2977
|
}
|
|
2978
2978
|
}
|
|
2979
|
-
const
|
|
2979
|
+
const u = async (v) => {
|
|
2980
2980
|
let b = await _o(s, [`/${v}.glb`, `${v}.glb`, v + ".glb"]);
|
|
2981
2981
|
if (b == null) {
|
|
2982
2982
|
console.error("[loadLightModel] glb not found in zip", {
|
|
@@ -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 Io(a, t.glbs[v], i);
|
|
2995
2995
|
} catch (p) {
|
|
2996
2996
|
console.error("[loadLightModel] failed to load glb", {
|
|
2997
2997
|
modelUrl: e.url,
|
|
@@ -3006,11 +3006,11 @@ async function Wo(a, e, t, i) {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
};
|
|
3008
3008
|
let g = 0;
|
|
3009
|
-
const m = Math.min(vo,
|
|
3009
|
+
const m = Math.min(vo, d.length);
|
|
3010
3010
|
await Promise.all(Array.from({ length: m }, async () => {
|
|
3011
|
-
for (; g <
|
|
3012
|
-
const v =
|
|
3013
|
-
await
|
|
3011
|
+
for (; g < d.length; ) {
|
|
3012
|
+
const v = d[g++];
|
|
3013
|
+
await u(v);
|
|
3014
3014
|
}
|
|
3015
3015
|
})), console.log(`[loadLightModel] 所有 GLB 加载完成 ${Date.now() - window.startTime}ms`);
|
|
3016
3016
|
const w = await Fi(s, ["/instances.json", "instances.json"]);
|
|
@@ -3023,17 +3023,17 @@ async function Wo(a, e, t, i) {
|
|
|
3023
3023
|
function qo(a, e, t) {
|
|
3024
3024
|
if (t.boundingBox || (t.boundingBox = new Y(), t.boundingBox.min = new h(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new h(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
3025
3025
|
return 1e3;
|
|
3026
|
-
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), l = new h(), c = new h(),
|
|
3027
|
-
if (e.getWorldDirection(
|
|
3026
|
+
const i = t.boundingBox, n = i.min, s = i.max, o = n.clone().add(s.clone()).multiplyScalar(0.5), r = n.distanceTo(s), l = new h(), c = new h(), d = new h(), u = new h();
|
|
3027
|
+
if (e.getWorldDirection(d), e.getWorldPosition(u), e.matrixWorld.extractBasis(l, c, new h()), e instanceof Me) {
|
|
3028
3028
|
const p = Math.max((e.top - e.bottom) / e.zoom, 1e-6), x = a?.cameraModule?.perspectiveCamera?.getEffectiveFOV?.() ?? 20, C = R.degToRad(x * 0.5), _ = C > 0 ? p / (2 * Math.tan(C)) : p;
|
|
3029
|
-
|
|
3029
|
+
u.copy(o).add(d.clone().multiplyScalar(-_));
|
|
3030
3030
|
}
|
|
3031
|
-
if (
|
|
3031
|
+
if (u.distanceTo(o) <= r * 0.5)
|
|
3032
3032
|
return 1e3;
|
|
3033
|
-
const g = o.clone().sub(
|
|
3033
|
+
const g = o.clone().sub(u).dot(d);
|
|
3034
3034
|
if (g <= 0)
|
|
3035
3035
|
return 0;
|
|
3036
|
-
const m =
|
|
3036
|
+
const m = u.clone().add(d.multiplyScalar(Math.max(g, r))), w = m.clone().add(l.setLength(t.maxSize)), v = new oe(e, a.renderer, a.scene).worldToScreen(m), b = new oe(e, a.renderer, a.scene).worldToScreen(w);
|
|
3037
3037
|
return v.distanceTo(b);
|
|
3038
3038
|
}
|
|
3039
3039
|
async function jo(a, e, t, i) {
|
|
@@ -3067,7 +3067,7 @@ function Yo(a, e, t, i) {
|
|
|
3067
3067
|
normal: !1
|
|
3068
3068
|
},
|
|
3069
3069
|
key: s
|
|
3070
|
-
}), r?.lods.forEach((
|
|
3070
|
+
}), r?.lods.forEach((d) => delete d.elements), a.models.push({
|
|
3071
3071
|
url: e,
|
|
3072
3072
|
urls: [e + "/info"],
|
|
3073
3073
|
group: n,
|
|
@@ -3097,28 +3097,28 @@ 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 (Ln(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 = In(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 = In(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 = Ke, a.map.needsUpdate = !0), a.side =
|
|
3118
|
+
return Bo(a), a.map != null && (a.map.colorSpace = Ke, a.map.needsUpdate = !0), a.side = he, a.shadowSide = he, 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
|
-
class
|
|
3121
|
+
class Se {
|
|
3122
3122
|
static localRequestMap = /* @__PURE__ */ new Map();
|
|
3123
3123
|
static localObjectUrls = /* @__PURE__ */ new Set();
|
|
3124
3124
|
static interceptorInstalled = !1;
|
|
@@ -3147,7 +3147,7 @@ class Ce {
|
|
|
3147
3147
|
async loadModelFile(e, t) {
|
|
3148
3148
|
if (e.length === 0)
|
|
3149
3149
|
return;
|
|
3150
|
-
|
|
3150
|
+
Se.ensureLocalRequestInterceptor();
|
|
3151
3151
|
const i = await this.buildLocalModelEntries(e);
|
|
3152
3152
|
if (i.length === 0)
|
|
3153
3153
|
throw new Error("未找到可加载的本地模型,请至少提供包含 info 的模型文件");
|
|
@@ -3156,7 +3156,7 @@ class Ce {
|
|
|
3156
3156
|
n.push(s.rootUrl);
|
|
3157
3157
|
for (const o of s.packages) {
|
|
3158
3158
|
const r = `${s.rootUrl}/${o.packageName}`;
|
|
3159
|
-
|
|
3159
|
+
Se.registerLocalRequest(r, o.blob);
|
|
3160
3160
|
}
|
|
3161
3161
|
}
|
|
3162
3162
|
await this.loadModels(n, t);
|
|
@@ -3172,14 +3172,14 @@ class Ce {
|
|
|
3172
3172
|
Hi(i, c.modelKey).set(c.packageName, l.blob);
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
const
|
|
3176
|
-
if (
|
|
3175
|
+
const d = this.parseExtractedPackageEntry(l.path);
|
|
3176
|
+
if (d == null)
|
|
3177
3177
|
continue;
|
|
3178
|
-
const
|
|
3178
|
+
const u = Hi(n, d.modelKey), g = u.get(d.packageName) ?? [];
|
|
3179
3179
|
g.push({
|
|
3180
|
-
path:
|
|
3180
|
+
path: d.innerPath,
|
|
3181
3181
|
blob: l.blob
|
|
3182
|
-
}),
|
|
3182
|
+
}), u.set(d.packageName, g);
|
|
3183
3183
|
}
|
|
3184
3184
|
const s = /* @__PURE__ */ new Set([
|
|
3185
3185
|
...i.keys(),
|
|
@@ -3187,19 +3187,19 @@ class Ce {
|
|
|
3187
3187
|
]), o = [];
|
|
3188
3188
|
let r = 0;
|
|
3189
3189
|
for (const l of s) {
|
|
3190
|
-
const c = [],
|
|
3191
|
-
|
|
3190
|
+
const c = [], d = i.get(l);
|
|
3191
|
+
d?.forEach((g, m) => {
|
|
3192
3192
|
c.push({ packageName: m, blob: g });
|
|
3193
3193
|
});
|
|
3194
|
-
const
|
|
3195
|
-
if (
|
|
3196
|
-
for (const [g, m] of
|
|
3197
|
-
|
|
3194
|
+
const u = n.get(l);
|
|
3195
|
+
if (u != null)
|
|
3196
|
+
for (const [g, m] of u.entries())
|
|
3197
|
+
d?.has(g) || c.push({
|
|
3198
3198
|
packageName: g,
|
|
3199
3199
|
blob: await this.packEntriesAsZip(m)
|
|
3200
3200
|
});
|
|
3201
3201
|
c.some((g) => g.packageName === "info") && (r += 1, o.push({
|
|
3202
|
-
rootUrl: `${Zo}/${
|
|
3202
|
+
rootUrl: `${Zo}/${Se.createLocalModelId(l, r)}`,
|
|
3203
3203
|
packages: c
|
|
3204
3204
|
}));
|
|
3205
3205
|
}
|
|
@@ -3277,20 +3277,20 @@ class Ce {
|
|
|
3277
3277
|
* 注册 axios 拦截器,把虚拟模型地址改写为对应的 Blob URL。
|
|
3278
3278
|
*/
|
|
3279
3279
|
static ensureLocalRequestInterceptor() {
|
|
3280
|
-
|
|
3280
|
+
Se.interceptorInstalled || (gn.interceptors.request.use((e) => {
|
|
3281
3281
|
if (typeof e.url == "string") {
|
|
3282
|
-
const t =
|
|
3282
|
+
const t = Se.normalizeRequestKey(e.url), i = Se.localRequestMap.get(t);
|
|
3283
3283
|
i != null && (e.url = i);
|
|
3284
3284
|
}
|
|
3285
3285
|
return e;
|
|
3286
|
-
}),
|
|
3286
|
+
}), Se.interceptorInstalled = !0);
|
|
3287
3287
|
}
|
|
3288
3288
|
/**
|
|
3289
3289
|
* 为某个虚拟请求地址生成 Blob URL 映射。
|
|
3290
3290
|
*/
|
|
3291
3291
|
static registerLocalRequest(e, t) {
|
|
3292
3292
|
const i = URL.createObjectURL(t);
|
|
3293
|
-
|
|
3293
|
+
Se.localObjectUrls.add(i), Se.localRequestMap.set(Se.normalizeRequestKey(e), i);
|
|
3294
3294
|
}
|
|
3295
3295
|
/**
|
|
3296
3296
|
* 统一规范虚拟请求 key,兼容传入绝对地址或带 query 的地址。
|
|
@@ -3342,7 +3342,7 @@ 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
|
}
|
|
3345
|
-
var
|
|
3345
|
+
var ye = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.ModelPlaceSelected = "model-place-selected", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.ViewportResize = "viewport-resize", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(ye || {});
|
|
3346
3346
|
class sr {
|
|
3347
3347
|
engine;
|
|
3348
3348
|
isFree;
|
|
@@ -3364,9 +3364,9 @@ class sr {
|
|
|
3364
3364
|
this.engine = e, this.isFree = !0, this.isForceFree = !1, this.isDisableContextMenu = !1, this.disableModelInteractionHighlight = !1, this.highlightModels = [], this.hideModels = [], this.translucentModels = [], this.models = [];
|
|
3365
3365
|
}
|
|
3366
3366
|
init() {
|
|
3367
|
-
this.engine.renderer?.domElement?.addEventListener("contextmenu", this.handleContextMenu, !0), this.engine.events.on(
|
|
3367
|
+
this.engine.renderer?.domElement?.addEventListener("contextmenu", this.handleContextMenu, !0), this.engine.events.on(ye.EngineFree, (e) => {
|
|
3368
3368
|
this.updateFree(!0), Rn(this.engine, e, !1), this.engine?.octreeBox?.requestBvhBuild?.();
|
|
3369
|
-
}), this.engine.events.on(
|
|
3369
|
+
}), this.engine.events.on(ye.EngineBusy, () => {
|
|
3370
3370
|
this.updateFree(!1);
|
|
3371
3371
|
});
|
|
3372
3372
|
}
|
|
@@ -3440,7 +3440,7 @@ class or {
|
|
|
3440
3440
|
});
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
|
-
const it = 1, Vt =
|
|
3443
|
+
const it = 1, Vt = 1, rr = 1800, Vi = 1024, ar = 1.35, lr = 20, cr = 1200, Ut = 0.5, hr = 10, dr = 0.08, Gt = 500, Ui = 5e4, Gi = 120, ur = 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,11 +3471,11 @@ class Er {
|
|
|
3471
3471
|
* 初始化场景基础光照,并把投影灯引用挂到 scene 上供后续更新使用。
|
|
3472
3472
|
*/
|
|
3473
3473
|
init() {
|
|
3474
|
-
const e = new
|
|
3474
|
+
const e = new Le(16774630, 5);
|
|
3475
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
3476
|
const t = Vt;
|
|
3477
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
|
|
3478
|
+
const i = new Le(16777215, 2);
|
|
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
3480
|
const n = new bt(16777215, 1);
|
|
3481
3481
|
this.engine.scene.add(n);
|
|
@@ -3493,36 +3493,36 @@ class Er {
|
|
|
3493
3493
|
*/
|
|
3494
3494
|
updateDirectionalShadow(e) {
|
|
3495
3495
|
const t = this.getShadowDirectionalLight();
|
|
3496
|
-
if (!t || !(t.shadow.camera instanceof
|
|
3496
|
+
if (!t || !(t.shadow.camera instanceof Me))
|
|
3497
3497
|
return;
|
|
3498
3498
|
const i = t.shadow.camera, n = this.getSceneBoundingBox();
|
|
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 I = n.getSize(new h());
|
|
3503
|
+
s = Math.max(I.x, I.y, I.z) * 0.5, o = Math.max(I.length(), 1), r = n.getCenter(new h());
|
|
3504
3504
|
}
|
|
3505
|
-
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l),
|
|
3505
|
+
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l), d = this.getSceneShadowHalfSize(s, c), u = R.clamp(
|
|
3506
3506
|
Math.max(
|
|
3507
3507
|
c * ar,
|
|
3508
|
-
|
|
3508
|
+
d,
|
|
3509
3509
|
Vt
|
|
3510
3510
|
),
|
|
3511
3511
|
Vt,
|
|
3512
3512
|
rr
|
|
3513
3513
|
), g = R.clamp(
|
|
3514
|
-
Math.max(
|
|
3514
|
+
Math.max(u * 2.5, o * 0.75, Gi),
|
|
3515
3515
|
Gi,
|
|
3516
|
-
|
|
3516
|
+
ur
|
|
3517
3517
|
), m = this.getLightOffsetDirection(), w = this.snapShadowTargetToTexel(
|
|
3518
3518
|
l,
|
|
3519
3519
|
m,
|
|
3520
|
-
|
|
3520
|
+
u,
|
|
3521
3521
|
t.shadow.mapSize.width
|
|
3522
3522
|
), v = this.getShadowDisplayIntensity(
|
|
3523
3523
|
e,
|
|
3524
3524
|
m,
|
|
3525
|
-
|
|
3525
|
+
u,
|
|
3526
3526
|
t.shadow.mapSize.width
|
|
3527
3527
|
), b = w.clone().add(
|
|
3528
3528
|
m.clone().multiplyScalar(g)
|
|
@@ -3531,9 +3531,9 @@ class Er {
|
|
|
3531
3531
|
b,
|
|
3532
3532
|
w,
|
|
3533
3533
|
o,
|
|
3534
|
-
|
|
3535
|
-
), x = Math.abs(
|
|
3536
|
-
!x && !C && !_ && !E && !k && !B || (t.position.copy(b), t.target.position.copy(w), t.target.updateMatrixWorld(!0), t.updateMatrixWorld(!0), i.left = -
|
|
3534
|
+
u
|
|
3535
|
+
), x = Math.abs(u - this.lastShadowHalfSize) > 0.5, C = Math.abs(p.near - this.lastShadowNear) > 1, _ = Math.abs(p.far - this.lastShadowFar) > 1, E = b.distanceToSquared(this.lastLightPosition) > 0.25, k = w.distanceToSquared(this.lastLightTarget) > 0.25, B = Math.abs(v - this.lastShadowIntensity) > 0.01;
|
|
3536
|
+
!x && !C && !_ && !E && !k && !B || (t.position.copy(b), t.target.position.copy(w), t.target.updateMatrixWorld(!0), t.updateMatrixWorld(!0), i.left = -u, i.right = u, i.top = u, i.bottom = -u, i.near = p.near, i.far = p.far, i.updateProjectionMatrix(), this.updateShadowBias(t, u, p), t.shadow.intensity = v, t.shadow.needsUpdate = !0, this.lastShadowHalfSize = u, this.lastShadowNear = p.near, this.lastShadowFar = p.far, this.lastLightPosition.copy(b), this.lastLightTarget.copy(w), this.lastShadowIntensity = v);
|
|
3537
3537
|
}
|
|
3538
3538
|
/**
|
|
3539
3539
|
* 计算场景范围对阴影相机半边长的贡献。
|
|
@@ -3582,17 +3582,17 @@ class Er {
|
|
|
3582
3582
|
const o = i.clone().sub(t).normalize();
|
|
3583
3583
|
if (e) {
|
|
3584
3584
|
const l = this.getBoxCorners(e);
|
|
3585
|
-
let c = Number.POSITIVE_INFINITY,
|
|
3586
|
-
for (const
|
|
3587
|
-
const g =
|
|
3588
|
-
c = Math.min(c, g),
|
|
3585
|
+
let c = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY;
|
|
3586
|
+
for (const u of l) {
|
|
3587
|
+
const g = u.clone().sub(t).dot(o);
|
|
3588
|
+
c = Math.min(c, g), d = Math.max(d, g);
|
|
3589
3589
|
}
|
|
3590
|
-
if (Number.isFinite(c) && Number.isFinite(
|
|
3591
|
-
const
|
|
3592
|
-
(
|
|
3590
|
+
if (Number.isFinite(c) && Number.isFinite(d)) {
|
|
3591
|
+
const u = Math.max(
|
|
3592
|
+
(d - c) * dr,
|
|
3593
3593
|
hr
|
|
3594
|
-
), g = Math.max(Ut, c -
|
|
3595
|
-
Math.max(g + 1,
|
|
3594
|
+
), g = Math.max(Ut, c - u), m = R.clamp(
|
|
3595
|
+
Math.max(g + 1, d + u),
|
|
3596
3596
|
g + 1,
|
|
3597
3597
|
Ui
|
|
3598
3598
|
);
|
|
@@ -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 Le && t.castShadow ? t : e.children.find(
|
|
3637
|
+
(i) => i instanceof Le && i.castShadow
|
|
3638
3638
|
) ?? null;
|
|
3639
3639
|
}
|
|
3640
3640
|
/**
|
|
@@ -3700,7 +3700,7 @@ class Er {
|
|
|
3700
3700
|
getCameraHalfExtent(e, t) {
|
|
3701
3701
|
if (!e)
|
|
3702
3702
|
return 0;
|
|
3703
|
-
if (e instanceof
|
|
3703
|
+
if (e instanceof Me) {
|
|
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
|
}
|
|
@@ -3774,8 +3774,8 @@ class Er {
|
|
|
3774
3774
|
const s = i * 2 / Math.max(n, 1);
|
|
3775
3775
|
if (!Number.isFinite(s) || s <= 0)
|
|
3776
3776
|
return e.clone();
|
|
3777
|
-
const o = t.clone().normalize(), r = Math.abs(o.dot(new h(0, 1, 0))) > 0.95 ? new h(1, 0, 0) : new h(0, 1, 0), l = new h().crossVectors(r, o).normalize(), c = new h().crossVectors(o, l).normalize(),
|
|
3778
|
-
return e.clone().add(l.multiplyScalar(g -
|
|
3777
|
+
const o = t.clone().normalize(), r = Math.abs(o.dot(new h(0, 1, 0))) > 0.95 ? new h(1, 0, 0) : new h(0, 1, 0), l = new h().crossVectors(r, o).normalize(), c = new h().crossVectors(o, l).normalize(), d = e.dot(l), u = e.dot(c), g = Math.round(d / s) * s, m = Math.round(u / s) * s;
|
|
3778
|
+
return e.clone().add(l.multiplyScalar(g - d)).add(c.multiplyScalar(m - u));
|
|
3779
3779
|
}
|
|
3780
3780
|
/**
|
|
3781
3781
|
* 自动降低大面积薄片构件的投影风险。
|
|
@@ -3818,7 +3818,7 @@ class Er {
|
|
|
3818
3818
|
setBackSideShadowCasting(e) {
|
|
3819
3819
|
const t = Array.isArray(e) ? e : [e];
|
|
3820
3820
|
for (const i of t)
|
|
3821
|
-
i && (i.shadowSide =
|
|
3821
|
+
i && (i.shadowSide = dn);
|
|
3822
3822
|
}
|
|
3823
3823
|
}
|
|
3824
3824
|
class Pr {
|
|
@@ -3965,11 +3965,11 @@ class Pr {
|
|
|
3965
3965
|
if (this.engine.controlModule?.firstPersonControls?.enabled === !0 && t.point instanceof h) {
|
|
3966
3966
|
const r = this.engine.camera, l = r.position.clone();
|
|
3967
3967
|
let c = t.point.clone();
|
|
3968
|
-
const
|
|
3968
|
+
const d = 500, u = performance.now();
|
|
3969
3969
|
let g = c.clone().sub(l).normalize();
|
|
3970
3970
|
c = c.clone().sub(g.clone().setLength(0.5));
|
|
3971
3971
|
const m = () => {
|
|
3972
|
-
const w = performance.now() -
|
|
3972
|
+
const w = performance.now() - u, v = Math.min(w / d, 1), b = v < 0.5 ? 2 * v * v : 1 - Math.pow(-2 * v + 2, 2) / 2;
|
|
3973
3973
|
r.position.lerpVectors(l, c, b), v < 1 ? requestAnimationFrame(m) : this.engine.controlModule.firstPersonControls.setCameraHeight(r.position.y);
|
|
3974
3974
|
};
|
|
3975
3975
|
this.clearModelHighlightBeforeCameraFlight(), requestAnimationFrame(m);
|
|
@@ -4053,8 +4053,8 @@ class Pr {
|
|
|
4053
4053
|
const c = this.getNodeWorldBox(s, r);
|
|
4054
4054
|
if (!this.isBoxVisibleUnderClipping(c))
|
|
4055
4055
|
return;
|
|
4056
|
-
const
|
|
4057
|
-
|
|
4056
|
+
const d = this.projectBoxToScreenRect(c);
|
|
4057
|
+
d == null || !(t ? this.containsRect(e, d) : this.intersectsRect(e, d)) || (i.has(s.url) || i.set(s.url, /* @__PURE__ */ new Set()), i.get(s.url)?.add(l));
|
|
4058
4058
|
});
|
|
4059
4059
|
}), Array.from(i.entries()).map(([s, o]) => ({
|
|
4060
4060
|
url: s,
|
|
@@ -4217,7 +4217,7 @@ class Pr {
|
|
|
4217
4217
|
return e.forEach((i) => t.union(i)), t.isEmpty() ? null : t;
|
|
4218
4218
|
}
|
|
4219
4219
|
getSceneModel(e) {
|
|
4220
|
-
return
|
|
4220
|
+
return Lt(this.engine, e);
|
|
4221
4221
|
}
|
|
4222
4222
|
}
|
|
4223
4223
|
class Ar {
|
|
@@ -4229,7 +4229,7 @@ class Ar {
|
|
|
4229
4229
|
// 存储被隐藏的 InstancedMesh 实例的原始矩阵,用于后续恢复
|
|
4230
4230
|
// key: 场景中 InstancedMesh 的索引,value: Map<实例索引, 原始矩阵>
|
|
4231
4231
|
constructor(e) {
|
|
4232
|
-
this.engine = e, this.customModelColorRecords = /* @__PURE__ */ new Map(), this.highlightMaterial = new
|
|
4232
|
+
this.engine = e, this.customModelColorRecords = /* @__PURE__ */ new Map(), this.highlightMaterial = new ge({
|
|
4233
4233
|
color: 43775,
|
|
4234
4234
|
// 明显的蓝色
|
|
4235
4235
|
depthTest: !1,
|
|
@@ -4239,16 +4239,16 @@ class Ar {
|
|
|
4239
4239
|
transparent: !0,
|
|
4240
4240
|
opacity: 0.3,
|
|
4241
4241
|
// 半透明效果
|
|
4242
|
-
side:
|
|
4242
|
+
side: he
|
|
4243
4243
|
// 双面渲染
|
|
4244
|
-
}), this.translucentMaterial = new
|
|
4244
|
+
}), this.translucentMaterial = new ge({
|
|
4245
4245
|
color: 16777215,
|
|
4246
4246
|
transparent: !0,
|
|
4247
4247
|
opacity: 0.05,
|
|
4248
4248
|
// 半透明效果
|
|
4249
|
-
side:
|
|
4249
|
+
side: he
|
|
4250
4250
|
// 双面渲染
|
|
4251
|
-
}), this.highlightMaterial.clippingPlanes = this.engine.sectionPlane, this.translucentMaterial.clippingPlanes = this.engine.sectionPlane, this.engine.events?.on?.(
|
|
4251
|
+
}), this.highlightMaterial.clippingPlanes = this.engine.sectionPlane, this.translucentMaterial.clippingPlanes = this.engine.sectionPlane, this.engine.events?.on?.(ye.EngineFree, () => {
|
|
4252
4252
|
this.restoreSplitModelsOnIdle();
|
|
4253
4253
|
});
|
|
4254
4254
|
}
|
|
@@ -4303,13 +4303,13 @@ class Ar {
|
|
|
4303
4303
|
restoreSplitModelsOnIdle() {
|
|
4304
4304
|
if (!this.engine?.scene)
|
|
4305
4305
|
return;
|
|
4306
|
-
|
|
4306
|
+
di(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
|
}
|
|
4310
4310
|
// 获取场景中的所有模型
|
|
4311
4311
|
getSceneModel(e) {
|
|
4312
|
-
return
|
|
4312
|
+
return Lt(this.engine, e);
|
|
4313
4313
|
}
|
|
4314
4314
|
// 获取指定高亮构件整体最外包围框的世界坐标中心点。
|
|
4315
4315
|
getModelCenter(e = this.engine.engineStatus.highlightModels ?? []) {
|
|
@@ -4327,11 +4327,11 @@ class Ar {
|
|
|
4327
4327
|
n.ids.forEach((r) => {
|
|
4328
4328
|
const l = s.nodesMap.get(r);
|
|
4329
4329
|
[
|
|
4330
|
-
...Array.isArray(l?.infos) ? l.infos.map((
|
|
4330
|
+
...Array.isArray(l?.infos) ? l.infos.map((d) => d?.box) : [],
|
|
4331
4331
|
l?.info?.box,
|
|
4332
4332
|
l?.box
|
|
4333
|
-
].forEach((
|
|
4334
|
-
!(
|
|
4333
|
+
].forEach((d) => {
|
|
4334
|
+
!(d instanceof Y) || d.isEmpty() || (i ? t.union(d.clone().applyMatrix4(o)) : (t.copy(d).applyMatrix4(o), i = !0));
|
|
4335
4335
|
});
|
|
4336
4336
|
});
|
|
4337
4337
|
}), i ? t.getCenter(new h()) : null;
|
|
@@ -4438,8 +4438,8 @@ class Ar {
|
|
|
4438
4438
|
if (i.ids.forEach((r) => {
|
|
4439
4439
|
let l = n.nodesMap.get(r);
|
|
4440
4440
|
this.engine.modelEdge.showModelEdge(i.url, r), l != null && l.indexes != null && l.indexes.forEach((c) => {
|
|
4441
|
-
const
|
|
4442
|
-
|
|
4441
|
+
const d = this.getSceneModel(c[0]);
|
|
4442
|
+
d instanceof X ? s.has(c[0]) ? s.get(c[0])?.push(c[1]) : s.set(c[0], [c[1]]) : (d.visible = !0, d.geometry.groups[c[1]].materialIndex = this.getCustomSimpleMaterialIndex(c[0], c[1]) ?? 0, d.geometry.groups[c[1]].visible = !0);
|
|
4443
4443
|
});
|
|
4444
4444
|
}), s.size > 0 && Ki(s, this.engine), t)
|
|
4445
4445
|
return;
|
|
@@ -4487,9 +4487,9 @@ class Ar {
|
|
|
4487
4487
|
const r = this.getEngineModelByUrl(o.url);
|
|
4488
4488
|
r == null || !Array.isArray(o.ids) || o.ids.forEach((l) => {
|
|
4489
4489
|
let c = r.nodesMap.get(l);
|
|
4490
|
-
c == null || c.indexes == null || c.indexes.forEach((
|
|
4491
|
-
const
|
|
4492
|
-
|
|
4490
|
+
c == null || c.indexes == null || c.indexes.forEach((d) => {
|
|
4491
|
+
const u = this.getSceneModel(d[0]);
|
|
4492
|
+
u instanceof X ? this.setInstanceModelColor(o.url, l, u, d[0], d[1], s, n) : u instanceof O && this.setSimpleModelColor(o.url, l, u, d[1], s, n);
|
|
4493
4493
|
});
|
|
4494
4494
|
});
|
|
4495
4495
|
});
|
|
@@ -4576,8 +4576,8 @@ class Ar {
|
|
|
4576
4576
|
customColor: `#${s.getHexString()}`,
|
|
4577
4577
|
customOpacity: o
|
|
4578
4578
|
});
|
|
4579
|
-
const c = this.getCustomColorMaterialIndex(i, s, o),
|
|
4580
|
-
|
|
4579
|
+
const c = this.getCustomColorMaterialIndex(i, s, o), d = this.customModelColorRecords.get(l);
|
|
4580
|
+
d != null && (d.customMaterialIndex = c, d.customColor = `#${s.getHexString()}`, d.customOpacity = o), r.materialIndex = c;
|
|
4581
4581
|
}
|
|
4582
4582
|
restoreSimpleModelColor(e, t, i, n, s) {
|
|
4583
4583
|
const o = this.getCustomColorRecordKey(e, t, n, s), r = this.customModelColorRecords.get(o);
|
|
@@ -4598,14 +4598,14 @@ class Ar {
|
|
|
4598
4598
|
if (this.customModelColorRecords.has(l))
|
|
4599
4599
|
this.removeCustomInstanceClone(this.customModelColorRecords.get(l));
|
|
4600
4600
|
else {
|
|
4601
|
-
const
|
|
4601
|
+
const d = this.getOriginalInstanceMatrix(i, s);
|
|
4602
4602
|
this.customModelColorRecords.set(l, {
|
|
4603
4603
|
type: "instance",
|
|
4604
4604
|
url: e,
|
|
4605
4605
|
id: t,
|
|
4606
4606
|
meshIndex: n,
|
|
4607
4607
|
instanceIndex: s,
|
|
4608
|
-
matrix:
|
|
4608
|
+
matrix: d.clone(),
|
|
4609
4609
|
cloneModel: null,
|
|
4610
4610
|
customColor: `#${o.getHexString()}`,
|
|
4611
4611
|
customOpacity: r
|
|
@@ -4658,7 +4658,7 @@ class Ar {
|
|
|
4658
4658
|
if (typeof s == "number" && Array.isArray(e.material) && e.material[s] != null)
|
|
4659
4659
|
return s;
|
|
4660
4660
|
typeof s == "number" && e.__customColorMaterialIndexes.delete(n), Array.isArray(e.material) || (e.material = [e.material]);
|
|
4661
|
-
const o = Array.isArray(e.material) ? e.material[0] : e.material, r = typeof o?.clone == "function" ? o.clone() : new
|
|
4661
|
+
const o = Array.isArray(e.material) ? e.material[0] : e.material, r = typeof o?.clone == "function" ? o.clone() : new ge();
|
|
4662
4662
|
r.color != null && r.color.copy(t), this.clearMaterialTextures(r), r.transparent = i < 1, r.opacity = i, r.depthWrite = i >= 1, r.clippingPlanes = this.engine.sectionPlane, r.needsUpdate = !0, e.material.push(r);
|
|
4663
4663
|
const l = e.material.length - 1;
|
|
4664
4664
|
return e.__customColorMaterialIndexes.set(n, l), l;
|
|
@@ -4681,12 +4681,12 @@ class Ar {
|
|
|
4681
4681
|
return this.engine.engineStatus.hideModels?.some((i) => i.url === e && Array.isArray(i.ids) && i.ids.includes(t)) === !0;
|
|
4682
4682
|
}
|
|
4683
4683
|
createCustomInstanceClone(e, t, i, n, s, o) {
|
|
4684
|
-
const r = new
|
|
4684
|
+
const r = new ge({
|
|
4685
4685
|
color: s,
|
|
4686
4686
|
transparent: o < 1,
|
|
4687
4687
|
opacity: o,
|
|
4688
4688
|
depthWrite: o >= 1,
|
|
4689
|
-
side:
|
|
4689
|
+
side: he
|
|
4690
4690
|
});
|
|
4691
4691
|
this.clearMaterialTextures(r), r.clippingPlanes = this.engine.sectionPlane, r.needsUpdate = !0;
|
|
4692
4692
|
const l = new X(e.geometry, r, 1);
|
|
@@ -4806,7 +4806,7 @@ function _r(a, e) {
|
|
|
4806
4806
|
const n = ht(e, i);
|
|
4807
4807
|
if (!(n instanceof X))
|
|
4808
4808
|
return;
|
|
4809
|
-
const s = n.geometry, o = new
|
|
4809
|
+
const s = n.geometry, o = new ge({
|
|
4810
4810
|
color: 43775,
|
|
4811
4811
|
// 明显的蓝色
|
|
4812
4812
|
depthTest: !1,
|
|
@@ -4817,20 +4817,20 @@ function _r(a, e) {
|
|
|
4817
4817
|
// 启用透明
|
|
4818
4818
|
opacity: 0.5,
|
|
4819
4819
|
// 半透明效果
|
|
4820
|
-
side:
|
|
4820
|
+
side: he
|
|
4821
4821
|
// 双面渲染
|
|
4822
4822
|
});
|
|
4823
4823
|
o.clippingPlanes = e.sectionPlane;
|
|
4824
4824
|
const r = new X(s, o, t.length);
|
|
4825
|
-
r.name = "highlightModel", r.key = i, r.ids = [], r.matrixs = [], r.url = n.url, t.forEach((
|
|
4826
|
-
r.ids.push(n.ids[
|
|
4825
|
+
r.name = "highlightModel", r.key = i, r.ids = [], r.matrixs = [], r.url = n.url, t.forEach((u) => {
|
|
4826
|
+
r.ids.push(n.ids[u]), r.matrixs.push(n.matrixs[u]);
|
|
4827
4827
|
});
|
|
4828
|
-
const l = /* @__PURE__ */ new Map(), c = new G(),
|
|
4829
|
-
|
|
4830
|
-
const m = lt(e, i,
|
|
4828
|
+
const l = /* @__PURE__ */ new Map(), c = new G(), d = new G();
|
|
4829
|
+
d.makeScale(0, 0, 0), t.forEach((u, g) => {
|
|
4830
|
+
const m = lt(e, i, u);
|
|
4831
4831
|
ct(m, !1);
|
|
4832
|
-
const w = m?.matrix ?? n.matrixs?.[
|
|
4833
|
-
w instanceof G ? c.copy(w) : n.getMatrixAt(
|
|
4832
|
+
const w = m?.matrix ?? n.matrixs?.[u] ?? n.matrixsClone?.[u];
|
|
4833
|
+
w instanceof G ? c.copy(w) : n.getMatrixAt(u, c), l.set(u, c.clone()), n.setMatrixAt(u, d), r.setMatrixAt(g, c);
|
|
4834
4834
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
4835
4835
|
});
|
|
4836
4836
|
}
|
|
@@ -4861,25 +4861,25 @@ function Tr(a, e) {
|
|
|
4861
4861
|
const n = ht(e, i);
|
|
4862
4862
|
if (!(n instanceof X))
|
|
4863
4863
|
return;
|
|
4864
|
-
const s = n.geometry, o = new
|
|
4864
|
+
const s = n.geometry, o = new ge({
|
|
4865
4865
|
color: 16777215,
|
|
4866
4866
|
// 明显的蓝色
|
|
4867
4867
|
transparent: !0,
|
|
4868
4868
|
// 启用透明
|
|
4869
4869
|
opacity: 0.05,
|
|
4870
4870
|
// 半透明效果
|
|
4871
|
-
side:
|
|
4871
|
+
side: he
|
|
4872
4872
|
// 双面渲染
|
|
4873
4873
|
});
|
|
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 G(),
|
|
4878
|
-
|
|
4879
|
-
const m = lt(e, i,
|
|
4877
|
+
const l = /* @__PURE__ */ new Map(), c = new G(), d = new G();
|
|
4878
|
+
d.makeScale(0, 0, 0), t.forEach((u, g) => {
|
|
4879
|
+
const m = lt(e, i, u);
|
|
4880
4880
|
ct(m, !1);
|
|
4881
|
-
const w = m?.matrix ?? n.matrixs?.[
|
|
4882
|
-
w instanceof G ? c.copy(w) : n.getMatrixAt(
|
|
4881
|
+
const w = m?.matrix ?? n.matrixs?.[u] ?? n.matrixsClone?.[u];
|
|
4882
|
+
w instanceof G ? c.copy(w) : n.getMatrixAt(u, c), l.set(u, c.clone()), n.setMatrixAt(u, d), r.setMatrixAt(g, c);
|
|
4883
4883
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
4884
4884
|
});
|
|
4885
4885
|
}
|
|
@@ -4895,10 +4895,10 @@ function Dr(a, e) {
|
|
|
4895
4895
|
return;
|
|
4896
4896
|
const o = /* @__PURE__ */ new Map(), r = new G(), l = new G();
|
|
4897
4897
|
l.makeScale(0, 0, 0), i.forEach((c) => {
|
|
4898
|
-
const
|
|
4899
|
-
ct(
|
|
4900
|
-
const
|
|
4901
|
-
|
|
4898
|
+
const d = lt(e, n, c);
|
|
4899
|
+
ct(d, !1);
|
|
4900
|
+
const u = d?.matrix ?? s.matrixs?.[c] ?? s.matrixsClone?.[c];
|
|
4901
|
+
u instanceof G ? r.copy(u) : s.getMatrixAt(c, r), o.set(c, r.clone()), s.setMatrixAt(c, l);
|
|
4902
4902
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
4903
4903
|
});
|
|
4904
4904
|
}
|
|
@@ -4930,10 +4930,10 @@ function Fn(a) {
|
|
|
4930
4930
|
e?.remove(a), a.material?.dispose != null && a.material.dispose();
|
|
4931
4931
|
}
|
|
4932
4932
|
function ht(a, e) {
|
|
4933
|
-
return
|
|
4933
|
+
return Lt(a, e);
|
|
4934
4934
|
}
|
|
4935
4935
|
const On = "advanced";
|
|
4936
|
-
class
|
|
4936
|
+
class Ir {
|
|
4937
4937
|
engine;
|
|
4938
4938
|
currentMode = "";
|
|
4939
4939
|
// 是否为手动设置(手动设置时,自动适配不再生效)
|
|
@@ -5021,7 +5021,7 @@ class Lr {
|
|
|
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 Le
|
|
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 Lr {
|
|
|
5088
5088
|
*/
|
|
5089
5089
|
setShadowQuality(e) {
|
|
5090
5090
|
const t = this.engine.scene?.children.find(
|
|
5091
|
-
(s) => s instanceof
|
|
5091
|
+
(s) => s instanceof Le
|
|
5092
5092
|
), n = {
|
|
5093
5093
|
low: 1024,
|
|
5094
5094
|
medium: 2048,
|
|
@@ -5118,7 +5118,7 @@ class Lr {
|
|
|
5118
5118
|
this.gtaoPass && (this.gtaoPass.blendIntensity = e);
|
|
5119
5119
|
}
|
|
5120
5120
|
}
|
|
5121
|
-
class
|
|
5121
|
+
class It {
|
|
5122
5122
|
engine;
|
|
5123
5123
|
overlayMaterial;
|
|
5124
5124
|
overlayMeshes = [];
|
|
@@ -5153,7 +5153,7 @@ class Lt {
|
|
|
5153
5153
|
this.tagDiv ? (this.tagDiv.style.left = o.x + 10 + this.engine.reactBoundingClientRect.left + "px", this.tagDiv.style.top = o.y - 10 + this.engine.reactBoundingClientRect.top + "px", this.tagDiv.style.display = "block") : this.tagDiv && (this.tagDiv.style.display = "none");
|
|
5154
5154
|
}
|
|
5155
5155
|
init() {
|
|
5156
|
-
this.overlayMaterial = new
|
|
5156
|
+
this.overlayMaterial = new ge({
|
|
5157
5157
|
color: 16777215,
|
|
5158
5158
|
transparent: !0,
|
|
5159
5159
|
opacity: 0,
|
|
@@ -5196,10 +5196,10 @@ class Lt {
|
|
|
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 / It.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 / It.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 Lt {
|
|
|
5218
5218
|
this.removeOverlayMeshes(), this.overlayMaterial.dispose(), this.tagDiv?.remove?.(), this.tagDiv = null, this.animState = "idle";
|
|
5219
5219
|
}
|
|
5220
5220
|
}
|
|
5221
|
-
function
|
|
5221
|
+
function Lr() {
|
|
5222
5222
|
return new ni();
|
|
5223
5223
|
}
|
|
5224
5224
|
function kr(a, e) {
|
|
@@ -5238,17 +5238,17 @@ function zr(a, e, t) {
|
|
|
5238
5238
|
function c() {
|
|
5239
5239
|
s += 1, !(s > 1) && (a.renderer && (a.renderer.interactionActive = !0), a.events?.trigger?.("engine-busy"), t?.style && (t.style.cursor = "none"));
|
|
5240
5240
|
}
|
|
5241
|
-
function
|
|
5241
|
+
function d() {
|
|
5242
5242
|
s <= 0 || (s -= 1, !(s > 0) && (a.renderer && (a.renderer.interactionActive = !1), a.events?.trigger?.("engine-free"), t?.style && (t.style.cursor = "default")));
|
|
5243
5243
|
}
|
|
5244
|
-
function
|
|
5244
|
+
function u(f, y, P) {
|
|
5245
5245
|
!P || !f || (f.up.copy(P), y && (y._referenceUp?.copy && y._referenceUp.copy(P).normalize(), y.up0?.copy && y.up0.copy(P), y._lastUp?.copy && y._lastUp.copy(P)));
|
|
5246
5246
|
}
|
|
5247
5247
|
function g(f) {
|
|
5248
|
-
|
|
5248
|
+
u(e.camera, a.controls, f);
|
|
5249
5249
|
}
|
|
5250
5250
|
function m(f) {
|
|
5251
|
-
|
|
5251
|
+
u(i.camera, i.orbitControls, f);
|
|
5252
5252
|
}
|
|
5253
5253
|
function w(f, y) {
|
|
5254
5254
|
!f || !y || (f._referenceUp?.copy && y._referenceUp && f._referenceUp.copy(y._referenceUp).normalize(), f._viewRight?.copy && y._viewRight && f._viewRight.copy(y._viewRight).normalize());
|
|
@@ -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 L = new h().crossVectors(T.clone().normalize(), D);
|
|
5272
|
+
L.lengthSq() > 1e-6 ? y._viewRight.copy(L.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, L = T.max, F = D.clone().add(L.clone()).multiplyScalar(0.5), q = F.clone().add(y.multiplyScalar(1 * L.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), L = 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
|
+
L,
|
|
5310
5310
|
e.camera.quaternion,
|
|
5311
5311
|
T,
|
|
5312
5312
|
y,
|
|
@@ -5319,32 +5319,32 @@ 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, L = 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 = L.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 = L.clone(), x(
|
|
5331
5331
|
e.camera.position,
|
|
5332
5332
|
fe,
|
|
5333
5333
|
a.controls.target.clone(),
|
|
5334
|
-
|
|
5334
|
+
L,
|
|
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(L), 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) {
|
|
5343
5343
|
if (e.camera.isOrthographicCamera) {
|
|
5344
5344
|
let Re = function() {
|
|
5345
|
-
n = requestAnimationFrame(Re),
|
|
5345
|
+
n = requestAnimationFrame(Re), pe.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)), L = 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),
|
|
@@ -5359,8 +5359,8 @@ function zr(a, e, t) {
|
|
|
5359
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 U = e.camera.position.clone(), le = a.controls.target.clone(), ue = e.camera.zoom,
|
|
5362
|
+
L = Math.min(z / M, N / A) * 0.75;
|
|
5363
|
+
var U = e.camera.position.clone(), le = a.controls.target.clone(), ue = e.camera.zoom, pe = new Je.Tween({
|
|
5364
5364
|
x1: U.x,
|
|
5365
5365
|
y1: U.y,
|
|
5366
5366
|
z1: U.z,
|
|
@@ -5375,17 +5375,17 @@ function zr(a, e, t) {
|
|
|
5375
5375
|
x2: y.x,
|
|
5376
5376
|
y2: y.y,
|
|
5377
5377
|
z2: y.z,
|
|
5378
|
-
zoom:
|
|
5378
|
+
zoom: L
|
|
5379
5379
|
}, 1e3);
|
|
5380
|
-
|
|
5380
|
+
pe.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());
|
|
5382
|
-
}),
|
|
5382
|
+
}), pe.onComplete(function() {
|
|
5383
5383
|
if (!a.controls) {
|
|
5384
|
-
|
|
5384
|
+
d();
|
|
5385
5385
|
return;
|
|
5386
5386
|
}
|
|
5387
|
-
a.controls.auto = !1, i.RenderScene(), cancelAnimationFrame(n), n = null,
|
|
5388
|
-
}),
|
|
5387
|
+
a.controls.auto = !1, i.RenderScene(), cancelAnimationFrame(n), n = null, d();
|
|
5388
|
+
}), pe.easing(Je.Easing.Cubic.InOut), c(), pe.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, L, F = 1e3, q, ne) {
|
|
5397
5397
|
var Q;
|
|
5398
|
-
D &&
|
|
5398
|
+
D && L ? (Q = new Je.Tween({
|
|
5399
5399
|
x1: f.x,
|
|
5400
5400
|
// 相机当前位置x
|
|
5401
5401
|
y1: f.y,
|
|
@@ -5430,13 +5430,13 @@ function zr(a, e, t) {
|
|
|
5430
5430
|
// 新的控制中心点位置x
|
|
5431
5431
|
z2: T.z,
|
|
5432
5432
|
// 新的控制中心点位置x
|
|
5433
|
-
_x:
|
|
5433
|
+
_x: L._x,
|
|
5434
5434
|
// 新的相机quaternion
|
|
5435
|
-
_y:
|
|
5435
|
+
_y: L._y,
|
|
5436
5436
|
// 新的相机quaternion
|
|
5437
|
-
_z:
|
|
5437
|
+
_z: L._z,
|
|
5438
5438
|
// 新的相机quaternion
|
|
5439
|
-
_w:
|
|
5439
|
+
_w: L._w
|
|
5440
5440
|
// 新的相机quaternion
|
|
5441
5441
|
},
|
|
5442
5442
|
F
|
|
@@ -5470,16 +5470,16 @@ function zr(a, e, t) {
|
|
|
5470
5470
|
},
|
|
5471
5471
|
F
|
|
5472
5472
|
)), Q.onUpdate(function(J) {
|
|
5473
|
-
a.controls && (D &&
|
|
5473
|
+
a.controls && (D && L ? (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
|
+
d();
|
|
5477
5477
|
return;
|
|
5478
5478
|
}
|
|
5479
5479
|
a.controls.syncAvatarFromCameraTarget?.(
|
|
5480
5480
|
new h(J.x2, J.y2, J.z2),
|
|
5481
5481
|
{ preserveCameraDistance: !0 }
|
|
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,
|
|
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, d();
|
|
5483
5483
|
}), Q.easing(Je.Easing.Cubic.InOut);
|
|
5484
5484
|
function fe(J) {
|
|
5485
5485
|
n = requestAnimationFrame(fe), Q.update();
|
|
@@ -5502,9 +5502,9 @@ function zr(a, e, t) {
|
|
|
5502
5502
|
}
|
|
5503
5503
|
}
|
|
5504
5504
|
function _() {
|
|
5505
|
-
i.sceneOrtho =
|
|
5505
|
+
i.sceneOrtho = Lr();
|
|
5506
5506
|
var P = t.clientWidth, T = t.clientWidth, f = P > T ? P / T : T / P, y = 300;
|
|
5507
|
-
i.camera = new
|
|
5507
|
+
i.camera = new Me(
|
|
5508
5508
|
y * f / -2,
|
|
5509
5509
|
y * f / 2,
|
|
5510
5510
|
y / 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 L = new bt(16777215, 0.8);
|
|
5520
|
+
i.sceneOrtho.add(L), 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", I);
|
|
5521
5521
|
}
|
|
5522
5522
|
let E = !1;
|
|
5523
5523
|
function k() {
|
|
@@ -5532,8 +5532,8 @@ function zr(a, e, t) {
|
|
|
5532
5532
|
a.renderer && e.camera && a.renderer.render(e, e.camera);
|
|
5533
5533
|
}
|
|
5534
5534
|
}
|
|
5535
|
-
function
|
|
5536
|
-
E = !1, i._mainTarget = null, i._mainDistance = null,
|
|
5535
|
+
function I() {
|
|
5536
|
+
E = !1, i._mainTarget = null, i._mainDistance = null, d();
|
|
5537
5537
|
}
|
|
5538
5538
|
function V() {
|
|
5539
5539
|
let f = [
|
|
@@ -5565,7 +5565,7 @@ function zr(a, e, t) {
|
|
|
5565
5565
|
var y = [];
|
|
5566
5566
|
for (const D of f)
|
|
5567
5567
|
y.push(
|
|
5568
|
-
new
|
|
5568
|
+
new ge({
|
|
5569
5569
|
color: 16777215,
|
|
5570
5570
|
map: new Oe().load(D.icon)
|
|
5571
5571
|
})
|
|
@@ -5580,8 +5580,8 @@ function zr(a, e, t) {
|
|
|
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 L = D.clientX - T.x, F = D.clientY - T.y;
|
|
5584
|
+
if (Math.sqrt(L * L + 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
5587
|
var Q = new ae();
|
|
@@ -5589,10 +5589,10 @@ function zr(a, e, t) {
|
|
|
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
|
-
|
|
5592
|
+
var L = {};
|
|
5593
|
+
L.x = D.offsetX / o.clientWidth * 2 - 1, L.y = -(D.offsetY / o.clientHeight) * 2 + 1;
|
|
5594
5594
|
var F = new ae();
|
|
5595
|
-
F.setFromCamera(
|
|
5595
|
+
F.setFromCamera(L, 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
|
+
], L = 0; L < P.length; L++)
|
|
5789
|
+
l.push(S(P[L]));
|
|
5790
|
+
for (var L = 0; L < T.length; L++)
|
|
5791
|
+
l.push(S(T[L]));
|
|
5792
|
+
for (var L = 0; L < D.length; L++)
|
|
5793
|
+
l.push(S(D[L]));
|
|
5794
5794
|
}
|
|
5795
5795
|
function S(f) {
|
|
5796
|
-
const y = new Ct(f.a, f.b, f.c), P = new
|
|
5796
|
+
const y = new Ct(f.a, f.b, f.c), P = new ge({
|
|
5797
5797
|
color: "blue",
|
|
5798
5798
|
transparent: !0,
|
|
5799
5799
|
opacity: 0.01
|
|
5800
5800
|
}), T = new G().makeTranslation(f.point.x, f.point.y, f.point.z);
|
|
5801
|
-
let D = y.applyMatrix4(T),
|
|
5802
|
-
return
|
|
5801
|
+
let D = y.applyMatrix4(T), L = new O(D, P);
|
|
5802
|
+
return L.name = f.name, i.sceneOrtho.add(L), L;
|
|
5803
5803
|
}
|
|
5804
5804
|
return i.ToggleCameraType = function() {
|
|
5805
5805
|
a.cameraModule.switchCurrentCamera();
|
|
@@ -5882,11 +5882,11 @@ class Br {
|
|
|
5882
5882
|
n.ids.forEach((r) => {
|
|
5883
5883
|
const l = s.nodesMap.get(r);
|
|
5884
5884
|
[
|
|
5885
|
-
...Array.isArray(l?.infos) ? l.infos.map((
|
|
5885
|
+
...Array.isArray(l?.infos) ? l.infos.map((d) => d?.box) : [],
|
|
5886
5886
|
l?.info?.box,
|
|
5887
5887
|
l?.box
|
|
5888
|
-
].forEach((
|
|
5889
|
-
!(
|
|
5888
|
+
].forEach((d) => {
|
|
5889
|
+
!(d instanceof Y) || d.isEmpty() || (i ? t.union(d.clone().applyMatrix4(o)) : (t.copy(d).applyMatrix4(o), i = !0));
|
|
5890
5890
|
});
|
|
5891
5891
|
});
|
|
5892
5892
|
}), i && this.zoomToModel(t);
|
|
@@ -5952,27 +5952,27 @@ function Rr(a) {
|
|
|
5952
5952
|
let e = new Object();
|
|
5953
5953
|
return e.getBoundingBox = function() {
|
|
5954
5954
|
let t = a.models, i = new h(1e8, 1e9, 1e10), n = new h(-1e8, -1e9, -1e10);
|
|
5955
|
-
t.forEach((
|
|
5955
|
+
t.forEach((u) => {
|
|
5956
5956
|
let g = new h(
|
|
5957
|
-
Math.min(
|
|
5958
|
-
Math.min(
|
|
5959
|
-
Math.min(
|
|
5957
|
+
Math.min(u.boundingBox.min.x, u.boundingBox.max.x),
|
|
5958
|
+
Math.min(u.boundingBox.min.y, u.boundingBox.max.y),
|
|
5959
|
+
Math.min(u.boundingBox.min.z, u.boundingBox.max.z)
|
|
5960
5960
|
), m = new h(
|
|
5961
|
-
Math.max(
|
|
5962
|
-
Math.max(
|
|
5963
|
-
Math.max(
|
|
5961
|
+
Math.max(u.boundingBox.min.x, u.boundingBox.max.x),
|
|
5962
|
+
Math.max(u.boundingBox.min.y, u.boundingBox.max.y),
|
|
5963
|
+
Math.max(u.boundingBox.min.z, u.boundingBox.max.z)
|
|
5964
5964
|
);
|
|
5965
5965
|
g.x < i.x && (i.x = g.x), g.y < i.y && (i.y = g.y), g.z < i.z && (i.z = g.z), m.x > n.x && (n.x = m.x), m.y > n.y && (n.y = m.y), m.z > n.z && (n.z = m.z);
|
|
5966
5966
|
});
|
|
5967
|
-
let s = Math.min(i.x, n.x), o = Math.min(i.y, n.y), r = Math.min(i.z, n.z), l = Math.max(i.x, n.x), c = Math.max(i.y, n.y),
|
|
5967
|
+
let s = Math.min(i.x, n.x), o = Math.min(i.y, n.y), r = Math.min(i.z, n.z), l = Math.max(i.x, n.x), c = Math.max(i.y, n.y), d = Math.max(i.z, n.z);
|
|
5968
5968
|
return {
|
|
5969
5969
|
min: new h(s, o, r),
|
|
5970
|
-
max: new h(l, c,
|
|
5970
|
+
max: new h(l, c, d)
|
|
5971
5971
|
};
|
|
5972
5972
|
}, e.rayInterationModel = function(t, i, n = !0) {
|
|
5973
|
-
const o = [], r = /* @__PURE__ */ new Set(), l = new h(), c = a.clipping,
|
|
5974
|
-
|
|
5975
|
-
const f =
|
|
5973
|
+
const o = [], r = /* @__PURE__ */ new Set(), l = new h(), c = a.clipping, d = Array.isArray(a.models) ? a.models : [], u = new Map(d.map((S) => [S.url, S])), g = $(a.engineStatus.hideModels), m = $(a.engineStatus.translucentModels);
|
|
5974
|
+
d.forEach((S) => {
|
|
5975
|
+
const f = u.get(S.url);
|
|
5976
5976
|
if (f == null)
|
|
5977
5977
|
return;
|
|
5978
5978
|
const y = He(a, S.url);
|
|
@@ -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, L = S.ray.intersectsBox(D);
|
|
5996
|
+
if (!(L == null || L == !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)
|
|
@@ -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 = I(S, f);
|
|
6029
6029
|
if (P == null || c?.doesBoxIntersectClippingRange?.(P) === !1)
|
|
6030
6030
|
return;
|
|
6031
6031
|
const T = t.ray.intersectBox(P, l);
|
|
@@ -6048,23 +6048,23 @@ function Rr(a) {
|
|
|
6048
6048
|
function E(S, f, y, P) {
|
|
6049
6049
|
if (!Array.isArray(f) || f.length < 2 || S?.info == null)
|
|
6050
6050
|
return null;
|
|
6051
|
-
const T =
|
|
6051
|
+
const T = Lt(a, f[0]);
|
|
6052
6052
|
if (!(T instanceof X) || T.geometry == null)
|
|
6053
6053
|
return null;
|
|
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 L = k(T, D);
|
|
6058
|
+
if (L == null)
|
|
6059
6059
|
return null;
|
|
6060
|
-
P.clone().multiply(
|
|
6060
|
+
P.clone().multiply(L), 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: L.clone()
|
|
6068
6068
|
}, q;
|
|
6069
6069
|
}
|
|
6070
6070
|
function k(S, f) {
|
|
@@ -6091,7 +6091,7 @@ function Rr(a) {
|
|
|
6091
6091
|
matrix: f.matrix.clone()
|
|
6092
6092
|
};
|
|
6093
6093
|
}
|
|
6094
|
-
function
|
|
6094
|
+
function I(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
6097
|
function V(S, f) {
|
|
@@ -6227,9 +6227,9 @@ class Fr {
|
|
|
6227
6227
|
{ x: i, y: o }
|
|
6228
6228
|
// 左下
|
|
6229
6229
|
];
|
|
6230
|
-
for (const
|
|
6231
|
-
const
|
|
6232
|
-
|
|
6230
|
+
for (const d of l) {
|
|
6231
|
+
const u = this.worldToScreen.screenToWorld(d.x, d.y);
|
|
6232
|
+
u && r.push(u);
|
|
6233
6233
|
}
|
|
6234
6234
|
if (r.length < 3) {
|
|
6235
6235
|
console.warn("RangeScale: 框选区域未命中模型,无法执行缩放操作");
|
|
@@ -6240,8 +6240,8 @@ class Fr {
|
|
|
6240
6240
|
return;
|
|
6241
6241
|
}
|
|
6242
6242
|
const c = new Y();
|
|
6243
|
-
for (const
|
|
6244
|
-
c.expandByPoint(
|
|
6243
|
+
for (const d of r)
|
|
6244
|
+
c.expandByPoint(d);
|
|
6245
6245
|
if (c.isEmpty()) {
|
|
6246
6246
|
console.warn("RangeScale: 计算得到的包围盒无效");
|
|
6247
6247
|
return;
|
|
@@ -6264,18 +6264,18 @@ class Fr {
|
|
|
6264
6264
|
e.getSize(s);
|
|
6265
6265
|
const o = Math.max(s.x, s.y, s.z);
|
|
6266
6266
|
if (t instanceof st) {
|
|
6267
|
-
const r = t.fov * (Math.PI / 180), c = o / (2 * Math.tan(r / 2)) * 1.2,
|
|
6268
|
-
t.getWorldDirection(u);
|
|
6269
|
-
const d = n.clone().sub(t.position);
|
|
6270
|
-
u.dot(d.normalize()) < 0 && u.negate();
|
|
6271
|
-
const m = n.clone().sub(u.multiplyScalar(c));
|
|
6272
|
-
t.position.copy(m), i.target && i.target.copy(n), t.lookAt(n), i.update();
|
|
6273
|
-
} else if (t instanceof ve) {
|
|
6274
|
-
const l = o * 1.2, c = this.engine.renderer?.domElement, u = c ? c.width / c.height : 1;
|
|
6275
|
-
t.left = -l * u / 2, t.right = l * u / 2, t.top = l / 2, t.bottom = -l / 2, t.updateProjectionMatrix();
|
|
6276
|
-
const d = new h();
|
|
6267
|
+
const r = t.fov * (Math.PI / 180), c = o / (2 * Math.tan(r / 2)) * 1.2, d = new h();
|
|
6277
6268
|
t.getWorldDirection(d);
|
|
6278
|
-
const
|
|
6269
|
+
const u = n.clone().sub(t.position);
|
|
6270
|
+
d.dot(u.normalize()) < 0 && d.negate();
|
|
6271
|
+
const m = n.clone().sub(d.multiplyScalar(c));
|
|
6272
|
+
t.position.copy(m), i.target && i.target.copy(n), t.lookAt(n), i.update();
|
|
6273
|
+
} else if (t instanceof Me) {
|
|
6274
|
+
const l = o * 1.2, c = this.engine.renderer?.domElement, d = c ? c.width / c.height : 1;
|
|
6275
|
+
t.left = -l * d / 2, t.right = l * d / 2, t.top = l / 2, t.bottom = -l / 2, t.updateProjectionMatrix();
|
|
6276
|
+
const u = new h();
|
|
6277
|
+
t.getWorldDirection(u);
|
|
6278
|
+
const g = o * 1.5, m = n.clone().sub(u.multiplyScalar(g));
|
|
6279
6279
|
t.position.copy(m), i.target && i.target.copy(n), t.lookAt(n), i.update();
|
|
6280
6280
|
}
|
|
6281
6281
|
}
|
|
@@ -6323,7 +6323,7 @@ class Hr {
|
|
|
6323
6323
|
if (!e || !t)
|
|
6324
6324
|
return;
|
|
6325
6325
|
let i = 0.5;
|
|
6326
|
-
if (e instanceof
|
|
6326
|
+
if (e instanceof Me) {
|
|
6327
6327
|
const n = (e.top - e.bottom) / e.zoom, s = t.domElement.clientHeight || 1;
|
|
6328
6328
|
i = 30 * n / s;
|
|
6329
6329
|
}
|
|
@@ -6343,19 +6343,19 @@ class Hr {
|
|
|
6343
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
|
-
const c = l.map((g) => this.resolveFamilyLocation(g, r)),
|
|
6346
|
+
const c = l.map((g) => this.resolveFamilyLocation(g, r)), d = this.sortFamiliesForDisplay(c), u = d.length === 2 && d.every((g) => g.isInside);
|
|
6347
6347
|
return {
|
|
6348
6348
|
point: { x: o.x, y: o.y, z: o.z },
|
|
6349
|
-
description: this.formatGridDescription(
|
|
6350
|
-
families:
|
|
6351
|
-
isInside:
|
|
6349
|
+
description: this.formatGridDescription(d),
|
|
6350
|
+
families: d,
|
|
6351
|
+
isInside: u
|
|
6352
6352
|
};
|
|
6353
6353
|
}
|
|
6354
6354
|
dispose() {
|
|
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 de(), 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,9 +6371,9 @@ 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 de();
|
|
6375
6375
|
n.name = `GridAxis_${e.data.Id}`;
|
|
6376
|
-
const s = new
|
|
6376
|
+
const s = new we().setFromPoints([t, i]), o = new ke({
|
|
6377
6377
|
color: 1609983,
|
|
6378
6378
|
depthTest: !1
|
|
6379
6379
|
}), r = new at(s, o);
|
|
@@ -6387,12 +6387,12 @@ class Hr {
|
|
|
6387
6387
|
throw new Error("Grid sprite canvas context is not available");
|
|
6388
6388
|
const o = 128 / 2, r = 128 / 2, l = 128 / 2 - 4;
|
|
6389
6389
|
s.beginPath(), s.arc(o, r, l, 0, Math.PI * 2), s.fillStyle = "white", s.fill(), s.strokeStyle = "#1890ff", s.lineWidth = 6, s.stroke(), s.fillStyle = "#1890ff", s.font = `bold ${Math.round(128 * 0.38)}px Arial`, s.textAlign = "center", s.textBaseline = "middle", s.fillText(e, o, r);
|
|
6390
|
-
const c = new cs(n),
|
|
6390
|
+
const c = new cs(n), d = new un({
|
|
6391
6391
|
map: c,
|
|
6392
6392
|
depthTest: !1,
|
|
6393
6393
|
transparent: !0
|
|
6394
|
-
}),
|
|
6395
|
-
return
|
|
6394
|
+
}), u = new St(d);
|
|
6395
|
+
return u.position.copy(t), u.scale.set(0.5, 0.5, 1), u.renderOrder = 999, u;
|
|
6396
6396
|
}
|
|
6397
6397
|
/**
|
|
6398
6398
|
* 优先读取指定 url 对应模型的轴网数据;未指定时退回当前已加载轴网或全部模型轴网。
|
|
@@ -6475,16 +6475,16 @@ class Hr {
|
|
|
6475
6475
|
resolveFamilyLocation(e, t) {
|
|
6476
6476
|
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <= Yi) ?? null;
|
|
6477
6477
|
if (n) {
|
|
6478
|
-
const c = e.axes.findIndex((
|
|
6478
|
+
const c = e.axes.findIndex((u) => u.data.Id === n.data.Id), d = this.pickAxisPairAroundIndex(e.axes, c);
|
|
6479
6479
|
return {
|
|
6480
6480
|
familyIndex: e.familyIndex,
|
|
6481
|
-
description:
|
|
6482
|
-
startAxisName:
|
|
6483
|
-
endAxisName:
|
|
6481
|
+
description: d ? this.formatAxisPair(d[0].data.Name, d[1].data.Name) : n.data.Name,
|
|
6482
|
+
startAxisName: d?.[0].data.Name ?? n.data.Name,
|
|
6483
|
+
endAxisName: d?.[1].data.Name ?? n.data.Name,
|
|
6484
6484
|
axisName: n.data.Name,
|
|
6485
6485
|
pointOffset: i,
|
|
6486
6486
|
isOnAxis: !0,
|
|
6487
|
-
isInside:
|
|
6487
|
+
isInside: d !== null
|
|
6488
6488
|
};
|
|
6489
6489
|
}
|
|
6490
6490
|
let s = null, o = null;
|
|
@@ -6603,7 +6603,7 @@ class fi {
|
|
|
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 de(), 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;
|
|
@@ -6621,7 +6621,7 @@ class fi {
|
|
|
6621
6621
|
if (i.water) {
|
|
6622
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
6623
|
m.wrapS = m.wrapT = Et;
|
|
6624
|
-
}), l = t?.sunDirection ?? new h(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7,
|
|
6624
|
+
}), l = t?.sunDirection ?? new h(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, d = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, g = new hs(s, {
|
|
6625
6625
|
textureWidth: 512,
|
|
6626
6626
|
textureHeight: 512,
|
|
6627
6627
|
waterNormals: r,
|
|
@@ -6629,10 +6629,10 @@ class fi {
|
|
|
6629
6629
|
sunColor: 16777215,
|
|
6630
6630
|
waterColor: i.waterColor ?? 28062,
|
|
6631
6631
|
distortionScale: c,
|
|
6632
|
-
alpha:
|
|
6632
|
+
alpha: u,
|
|
6633
6633
|
fog: !!this.engine.scene?.fog
|
|
6634
6634
|
});
|
|
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 =
|
|
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 = d, this.groundMesh = g, this.isWaterAddon = !0, this.groundGroup.add(g);
|
|
6636
6636
|
} else {
|
|
6637
6637
|
const s = new qt(n, n, 1, 1);
|
|
6638
6638
|
s.rotateX(-Math.PI / 2);
|
|
@@ -6803,10 +6803,10 @@ class Gr {
|
|
|
6803
6803
|
_loadHdr(e) {
|
|
6804
6804
|
const t = W(e, import.meta.url);
|
|
6805
6805
|
return new Promise((i, n) => {
|
|
6806
|
-
new
|
|
6806
|
+
new ds().load(
|
|
6807
6807
|
t,
|
|
6808
6808
|
(s) => {
|
|
6809
|
-
s.mapping =
|
|
6809
|
+
s.mapping = us, i(s);
|
|
6810
6810
|
},
|
|
6811
6811
|
void 0,
|
|
6812
6812
|
(s) => n(s)
|
|
@@ -6824,9 +6824,9 @@ class Gr {
|
|
|
6824
6824
|
}
|
|
6825
6825
|
_createSkybox(e) {
|
|
6826
6826
|
if (!this.engine.scene) return;
|
|
6827
|
-
const t = new mn(1e3, 64, 32), i = new
|
|
6827
|
+
const t = new mn(1e3, 64, 32), i = new ge({
|
|
6828
6828
|
map: e,
|
|
6829
|
-
side:
|
|
6829
|
+
side: dn,
|
|
6830
6830
|
depthWrite: !1,
|
|
6831
6831
|
depthTest: !1,
|
|
6832
6832
|
fog: !1,
|
|
@@ -6941,12 +6941,12 @@ class jr {
|
|
|
6941
6941
|
}
|
|
6942
6942
|
c || (c = m);
|
|
6943
6943
|
});
|
|
6944
|
-
const
|
|
6944
|
+
const d = this.pickNearestLevel(o, l, c), u = d ? `标高${d.Name}` : "";
|
|
6945
6945
|
let g = !1;
|
|
6946
6946
|
return l && c && (g = !0), {
|
|
6947
6947
|
pointY: o,
|
|
6948
|
-
description:
|
|
6949
|
-
currentLevel:
|
|
6948
|
+
description: u,
|
|
6949
|
+
currentLevel: d,
|
|
6950
6950
|
lowerLevel: l,
|
|
6951
6951
|
upperLevel: c,
|
|
6952
6952
|
isOnLevel: !1,
|
|
@@ -6978,28 +6978,28 @@ 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 de(), r = new qt(this.halfSize * 2, this.halfSize * 2);
|
|
6982
6982
|
r.rotateX(-Math.PI / 2);
|
|
6983
|
-
const l = new
|
|
6983
|
+
const l = new ge({
|
|
6984
6984
|
color: this.COLOR,
|
|
6985
6985
|
transparent: !0,
|
|
6986
6986
|
opacity: this.PLANE_OPACITY,
|
|
6987
|
-
side:
|
|
6987
|
+
side: he,
|
|
6988
6988
|
depthWrite: !1
|
|
6989
6989
|
}), c = new O(r, l);
|
|
6990
6990
|
c.position.y = s, o.add(c);
|
|
6991
|
-
const
|
|
6991
|
+
const d = [
|
|
6992
6992
|
new h(-this.halfSize, s, -this.halfSize),
|
|
6993
6993
|
new h(this.halfSize, s, -this.halfSize),
|
|
6994
6994
|
new h(this.halfSize, s, this.halfSize),
|
|
6995
6995
|
new h(-this.halfSize, s, this.halfSize),
|
|
6996
6996
|
new h(-this.halfSize, s, -this.halfSize)
|
|
6997
|
-
],
|
|
6997
|
+
], u = new we().setFromPoints(d), g = new ke({
|
|
6998
6998
|
color: this.COLOR,
|
|
6999
6999
|
transparent: !0,
|
|
7000
7000
|
opacity: 0.7
|
|
7001
7001
|
});
|
|
7002
|
-
if (o.add(new at(
|
|
7002
|
+
if (o.add(new at(u, 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)
|
|
@@ -7104,7 +7104,7 @@ function Qr(a, e) {
|
|
|
7104
7104
|
return a instanceof h ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new h();
|
|
7105
7105
|
}
|
|
7106
7106
|
function ea(a, e, t) {
|
|
7107
|
-
if (a instanceof
|
|
7107
|
+
if (a instanceof Me)
|
|
7108
7108
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
7109
7109
|
const i = a, n = Qr(e, t), s = i.position.distanceTo(n), o = typeof i.getEffectiveFOV == "function" ? i.getEffectiveFOV() : i.fov, r = R.degToRad(o * 0.5);
|
|
7110
7110
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
@@ -7151,10 +7151,10 @@ class ia {
|
|
|
7151
7151
|
const c = Array.isArray(r?.points) ? r.points : null;
|
|
7152
7152
|
if (!c)
|
|
7153
7153
|
return;
|
|
7154
|
-
const
|
|
7155
|
-
for (let
|
|
7156
|
-
c[
|
|
7157
|
-
s.set(Number(r.id), [
|
|
7154
|
+
const d = o;
|
|
7155
|
+
for (let u = 0; u < c.length; u++)
|
|
7156
|
+
c[u]?.length === 2 && (o += 6);
|
|
7157
|
+
s.set(Number(r.id), [d, o, l]);
|
|
7158
7158
|
}), this.indexes.set(e, s), s;
|
|
7159
7159
|
}
|
|
7160
7160
|
getEdgePointsByIndex(e, t) {
|
|
@@ -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 de(), 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,
|
|
@@ -7282,19 +7282,19 @@ class ia {
|
|
|
7282
7282
|
const i = t?.url;
|
|
7283
7283
|
if (typeof i != "string" || i.length === 0)
|
|
7284
7284
|
return;
|
|
7285
|
-
const n = this.groupEdge.children.find((
|
|
7285
|
+
const n = this.groupEdge.children.find((d) => d.url == i);
|
|
7286
7286
|
if (n) {
|
|
7287
7287
|
n.visible = !0;
|
|
7288
7288
|
return;
|
|
7289
7289
|
}
|
|
7290
7290
|
const s = [], o = /* @__PURE__ */ new Map();
|
|
7291
|
-
if ((Array.isArray(t?.modelEdge) ? t.modelEdge : []).forEach((
|
|
7292
|
-
o.set(Number(
|
|
7291
|
+
if ((Array.isArray(t?.modelEdge) ? t.modelEdge : []).forEach((d, u) => {
|
|
7292
|
+
o.set(Number(d?.id), u), (Array.isArray(d?.points) ? d.points : []).forEach((m) => {
|
|
7293
7293
|
m?.length === 2 && (s.push(m[0].X), s.push(m[0].Z), s.push(-m[0].Y), s.push(m[1].X), s.push(m[1].Z), s.push(-m[1].Y));
|
|
7294
7294
|
});
|
|
7295
7295
|
}), s.length === 0)
|
|
7296
7296
|
return;
|
|
7297
|
-
const l = new
|
|
7297
|
+
const l = new we();
|
|
7298
7298
|
l.setAttribute("position", new Pt(s, 3));
|
|
7299
7299
|
const c = new jt(l, this.material);
|
|
7300
7300
|
c.url = i, this.setLineTransform(c, He(this.engine, i)), this.groupEdge.add(c), this.highlightIndexes.set(i, o), this.releaseIndexes(i);
|
|
@@ -7334,15 +7334,15 @@ class ia {
|
|
|
7334
7334
|
return;
|
|
7335
7335
|
const s = [];
|
|
7336
7336
|
if (i.ids.forEach((l) => {
|
|
7337
|
-
const c = n?.get(Number(l)),
|
|
7338
|
-
if (Array.isArray(
|
|
7339
|
-
if (
|
|
7337
|
+
const c = n?.get(Number(l)), d = typeof c == "number" ? this.getEdgePointsByIndex(i.url, c) : null;
|
|
7338
|
+
if (Array.isArray(d)) {
|
|
7339
|
+
if (d.length > Kr)
|
|
7340
7340
|
return;
|
|
7341
|
-
this.appendEdgePositions(s,
|
|
7341
|
+
this.appendEdgePositions(s, d);
|
|
7342
7342
|
}
|
|
7343
7343
|
}), s.length === 0)
|
|
7344
7344
|
return;
|
|
7345
|
-
const o = new
|
|
7345
|
+
const o = new we();
|
|
7346
7346
|
o.setAttribute("position", new Pt(s, 3));
|
|
7347
7347
|
const r = new jt(o, this.highlightEdgeMaterial);
|
|
7348
7348
|
r.name = "highlightModelEdge", r.url = i.url, this.setLineTransform(r, He(this.engine, i.url)), this.highlightEdgeGroup.add(r);
|
|
@@ -7405,15 +7405,15 @@ class ia {
|
|
|
7405
7405
|
return;
|
|
7406
7406
|
const [o, r, l] = s, c = typeof l == "number" ? this.getEdgePointsByIndex(e, l) : null;
|
|
7407
7407
|
if (i && Array.isArray(c)) {
|
|
7408
|
-
const
|
|
7409
|
-
let
|
|
7408
|
+
const d = i.geometry.attributes.position.array;
|
|
7409
|
+
let u = 0;
|
|
7410
7410
|
for (let g = o; g < r; g += 3) {
|
|
7411
|
-
const m = Math.floor(
|
|
7411
|
+
const m = Math.floor(u / 6), w = u % 6 >= 3;
|
|
7412
7412
|
if (c[m] && c[m].length === 2) {
|
|
7413
7413
|
const v = w ? c[m][1] : c[m][0];
|
|
7414
|
-
|
|
7414
|
+
d[g] = v.X, d[g + 1] = v.Z, d[g + 2] = -v.Y;
|
|
7415
7415
|
}
|
|
7416
|
-
|
|
7416
|
+
u += 3;
|
|
7417
7417
|
}
|
|
7418
7418
|
i.geometry.attributes.position.needsUpdate = !0;
|
|
7419
7419
|
}
|
|
@@ -7860,7 +7860,7 @@ class sa {
|
|
|
7860
7860
|
this.settings = this._readCurrentSettingsFromModules();
|
|
7861
7861
|
}
|
|
7862
7862
|
_buildDefaultSettingsFromModules() {
|
|
7863
|
-
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? Te, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? ti,
|
|
7863
|
+
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? Te, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? ti, d = this.engine.skyManager?.isActive?.() === !0;
|
|
7864
7864
|
return {
|
|
7865
7865
|
render: {
|
|
7866
7866
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
@@ -7880,7 +7880,7 @@ class sa {
|
|
|
7880
7880
|
groundHeight: this.engine.ground?.getHeight?.() ?? Hn
|
|
7881
7881
|
},
|
|
7882
7882
|
environment: {
|
|
7883
|
-
type:
|
|
7883
|
+
type: d ? "sky" : o !== Te ? "hdr" : "none",
|
|
7884
7884
|
hdrId: o,
|
|
7885
7885
|
hdrIntensity: this._unitToPercent(r, Un),
|
|
7886
7886
|
skyPreset: c,
|
|
@@ -7890,7 +7890,7 @@ class sa {
|
|
|
7890
7890
|
};
|
|
7891
7891
|
}
|
|
7892
7892
|
_readCurrentSettingsFromModules() {
|
|
7893
|
-
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? this.settings.environment.hdrId, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? this.settings.environment.skyPreset,
|
|
7893
|
+
const e = this.engine.composerModule?.saturationPass?.uniforms?.saturation?.value, t = this.engine.composerModule?.saturationPass?.uniforms?.contrast?.value, i = this.engine.composerModule?.gtaoPass?.blendIntensity, n = this.engine.renderer?.toneMappingExposure, s = this.engine.modelEdge?.getOpacity?.(), o = this.engine.hdr?.getCurrentHdrId?.() ?? this.settings.environment.hdrId, r = this.engine.hdr?.getIntensity?.(), l = this.engine.skyManager?.getIntensity?.(), c = this.engine.skyManager?.getCurrentPreset?.() ?? this.settings.environment.skyPreset, d = this.engine.skyManager?.getParams?.(), u = this.engine.skyManager?.isActive?.() === !0;
|
|
7894
7894
|
return {
|
|
7895
7895
|
render: {
|
|
7896
7896
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.() ?? this.settings.render.mode),
|
|
@@ -7910,11 +7910,11 @@ class sa {
|
|
|
7910
7910
|
groundHeight: this.engine.ground?.getHeight?.() ?? this.settings.display.groundHeight
|
|
7911
7911
|
},
|
|
7912
7912
|
environment: {
|
|
7913
|
-
type:
|
|
7913
|
+
type: u ? "sky" : o !== Te ? "hdr" : "none",
|
|
7914
7914
|
hdrId: o,
|
|
7915
7915
|
hdrIntensity: this._unitToPercent(r, this.settings.environment.hdrIntensity / 100),
|
|
7916
7916
|
skyPreset: c,
|
|
7917
|
-
skyParams:
|
|
7917
|
+
skyParams: d ? this._clone(d) : this._clone(this.settings.environment.skyParams),
|
|
7918
7918
|
skyIntensity: this._unitToPercent(l, this.settings.environment.skyIntensity / 100)
|
|
7919
7919
|
}
|
|
7920
7920
|
};
|
|
@@ -7943,7 +7943,7 @@ class sa {
|
|
|
7943
7943
|
}
|
|
7944
7944
|
_getDirectionalLightShadowIntensity() {
|
|
7945
7945
|
const e = this.engine.scene?.children?.filter(
|
|
7946
|
-
(i) => i instanceof
|
|
7946
|
+
(i) => i instanceof Le
|
|
7947
7947
|
);
|
|
7948
7948
|
return !e || e.length === 0 ? it : (e.find((i) => i.castShadow) ?? e[0]).shadow?.intensity ?? it;
|
|
7949
7949
|
}
|
|
@@ -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 Le
|
|
7982
7982
|
);
|
|
7983
7983
|
t && e(t);
|
|
7984
7984
|
}
|
|
@@ -8000,7 +8000,7 @@ class sa {
|
|
|
8000
8000
|
return JSON.parse(JSON.stringify(e));
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
|
-
class
|
|
8003
|
+
class Ie {
|
|
8004
8004
|
engine;
|
|
8005
8005
|
handelBehaved;
|
|
8006
8006
|
setting;
|
|
@@ -8086,15 +8086,15 @@ class Le {
|
|
|
8086
8086
|
}), this.engine.measure.annotationData.coordinateAnnotation.forEach((p) => {
|
|
8087
8087
|
w(p);
|
|
8088
8088
|
}), this.engine.measure.annotationData.angleAnnotation.forEach((p) => {
|
|
8089
|
-
|
|
8089
|
+
u(p);
|
|
8090
8090
|
}), this.engine.measure.annotationData.areaAnnotation.forEach((p) => {
|
|
8091
8091
|
g(p);
|
|
8092
8092
|
}), this.engine.measure.annotationData.slopeAnnotation.forEach((p) => {
|
|
8093
8093
|
m(p);
|
|
8094
8094
|
});
|
|
8095
|
-
function
|
|
8095
|
+
function u(p) {
|
|
8096
8096
|
if (p.container == null) {
|
|
8097
|
-
let
|
|
8097
|
+
let I = [
|
|
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 Le {
|
|
|
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 = I, 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 Le {
|
|
|
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
|
-
|
|
8158
|
+
let B = k.map((S) => S.x + "," + S.y).join(" "), I = p.container;
|
|
8159
|
+
I.getElementsByTagName("polygon")[0].setAttribute("points", x.length >= 3 ? E : ""), I.getElementsByTagName("polyline")[0].setAttribute("points", B);
|
|
8160
8160
|
let V = C, $ = _;
|
|
8161
|
-
|
|
8161
|
+
I.getElementsByTagName("rect")[0].setAttribute("x", V - 40), I.getElementsByTagName("rect")[0].setAttribute("y", $ - 12.5), I.getElementsByTagName("text")[0].setAttribute("x", V + 10), I.getElementsByTagName("text")[0].setAttribute("y", $ + 4), I.getElementsByTagName("text")[0].innerHTML = e.getMeasureText(p.text, 2), I.style.top = "0px", I.style.left = "0px";
|
|
8162
8162
|
}
|
|
8163
8163
|
function m(p) {
|
|
8164
8164
|
if (p.container == null) {
|
|
@@ -8193,7 +8193,7 @@ class Le {
|
|
|
8193
8193
|
}
|
|
8194
8194
|
function w(p) {
|
|
8195
8195
|
if (p.container == null) {
|
|
8196
|
-
let
|
|
8196
|
+
let I = [
|
|
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 Le {
|
|
|
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 = I, 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 Ie(e);
|
|
8282
8282
|
}
|
|
8283
8283
|
// 启动净高测量
|
|
8284
8284
|
active() {
|
|
@@ -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 Ie(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 Ie(e);
|
|
8435
8435
|
}
|
|
8436
8436
|
// 启动净高测量
|
|
8437
8437
|
active() {
|
|
@@ -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 Ie(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 Ie(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 Ie(e);
|
|
8587
8587
|
}
|
|
8588
8588
|
// 启动角度测量
|
|
8589
8589
|
active() {
|
|
@@ -8605,8 +8605,8 @@ class ha {
|
|
|
8605
8605
|
const n = new h().subVectors(e, t), s = new h().subVectors(i, t), o = n.length(), r = s.length();
|
|
8606
8606
|
if (o === 0 || r === 0)
|
|
8607
8607
|
return 0;
|
|
8608
|
-
const c = n.dot(s) / (o * r),
|
|
8609
|
-
return Math.acos(
|
|
8608
|
+
const c = n.dot(s) / (o * r), d = Math.max(-1, Math.min(1, c));
|
|
8609
|
+
return Math.acos(d) * (180 / Math.PI);
|
|
8610
8610
|
}
|
|
8611
8611
|
// 处理鼠标点击事件
|
|
8612
8612
|
handleMouseClick(e) {
|
|
@@ -8644,13 +8644,13 @@ class ha {
|
|
|
8644
8644
|
}
|
|
8645
8645
|
}
|
|
8646
8646
|
}
|
|
8647
|
-
class
|
|
8647
|
+
class da {
|
|
8648
8648
|
engine;
|
|
8649
8649
|
tools;
|
|
8650
8650
|
points = [];
|
|
8651
8651
|
behavior;
|
|
8652
8652
|
constructor(e) {
|
|
8653
|
-
this.engine = e, this.tools = new
|
|
8653
|
+
this.engine = e, this.tools = new Ie(e);
|
|
8654
8654
|
}
|
|
8655
8655
|
getCurrentDrawingMeasure() {
|
|
8656
8656
|
return this.engine.measure.annotationData.areaAnnotation.find((e) => e.isSelect == !0);
|
|
@@ -8726,7 +8726,7 @@ class nt {
|
|
|
8726
8726
|
points = [];
|
|
8727
8727
|
behavior;
|
|
8728
8728
|
constructor(e) {
|
|
8729
|
-
this.engine = e, this.tools = new
|
|
8729
|
+
this.engine = e, this.tools = new Ie(e);
|
|
8730
8730
|
}
|
|
8731
8731
|
// 启动坡度测量
|
|
8732
8732
|
active() {
|
|
@@ -8800,11 +8800,11 @@ class nt {
|
|
|
8800
8800
|
e.distanceTo(n),
|
|
8801
8801
|
e.distanceTo(i),
|
|
8802
8802
|
1
|
|
8803
|
-
),
|
|
8803
|
+
), d = e.clone().add(
|
|
8804
8804
|
t.clone().multiplyScalar(c)
|
|
8805
|
-
),
|
|
8806
|
-
if (
|
|
8807
|
-
return this.pointToScreenLineDistance(l, r,
|
|
8805
|
+
), u = o.worldToScreenIfVisible(d);
|
|
8806
|
+
if (u != null)
|
|
8807
|
+
return this.pointToScreenLineDistance(l, r, u) <= nt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
8808
8808
|
const g = o.worldToScreenIfVisible(i);
|
|
8809
8809
|
return g != null && l.distanceTo(g) <= nt.SLOPE_DIRECTION_SNAP_DISTANCE;
|
|
8810
8810
|
}
|
|
@@ -8871,7 +8871,7 @@ class nt {
|
|
|
8871
8871
|
}
|
|
8872
8872
|
}
|
|
8873
8873
|
}
|
|
8874
|
-
class
|
|
8874
|
+
class ua {
|
|
8875
8875
|
engine;
|
|
8876
8876
|
isActive = !1;
|
|
8877
8877
|
points = [];
|
|
@@ -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
|
|
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 da(e), this.slopeMeasure = new nt(e), this.faceDistanceMeasure = new ua(e), this.tools = new Ie(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);
|
|
@@ -9229,7 +9229,7 @@ class ma {
|
|
|
9229
9229
|
}
|
|
9230
9230
|
}
|
|
9231
9231
|
calculate_ratio() {
|
|
9232
|
-
const e = this.maxBox.max.x - this.maxBox.min.x, t = this.maxBox.max.y - this.maxBox.min.y, i = this.maxBox.max.z - this.maxBox.min.z, n = this.toPercent((this.box.min.x - this.maxBox.min.x) / e * 100), s = this.toPercent((this.box.max.x - this.maxBox.min.x) / e * 100), o = this.toPercent((this.box.min.y - this.maxBox.min.y) / t * 100), r = this.toPercent((this.box.max.y - this.maxBox.min.y) / t * 100), l = this.toPercent((this.box.min.z - this.maxBox.min.z) / i * 100), c = this.toPercent((this.box.max.z - this.maxBox.min.z) / i * 100),
|
|
9232
|
+
const e = this.maxBox.max.x - this.maxBox.min.x, t = this.maxBox.max.y - this.maxBox.min.y, i = this.maxBox.max.z - this.maxBox.min.z, n = this.toPercent((this.box.min.x - this.maxBox.min.x) / e * 100), s = this.toPercent((this.box.max.x - this.maxBox.min.x) / e * 100), o = this.toPercent((this.box.min.y - this.maxBox.min.y) / t * 100), r = this.toPercent((this.box.max.y - this.maxBox.min.y) / t * 100), l = this.toPercent((this.box.min.z - this.maxBox.min.z) / i * 100), c = this.toPercent((this.box.max.z - this.maxBox.min.z) / i * 100), d = {
|
|
9233
9233
|
x: {
|
|
9234
9234
|
min: n,
|
|
9235
9235
|
max: s
|
|
@@ -9243,7 +9243,7 @@ class ma {
|
|
|
9243
9243
|
max: c
|
|
9244
9244
|
}
|
|
9245
9245
|
};
|
|
9246
|
-
this.engine.events.trigger(ee.SectionMove,
|
|
9246
|
+
this.engine.events.trigger(ee.SectionMove, d);
|
|
9247
9247
|
}
|
|
9248
9248
|
toPercent(e) {
|
|
9249
9249
|
return e < 0 ? 0 : e > 100 ? 100 : e;
|
|
@@ -9328,8 +9328,8 @@ class ma {
|
|
|
9328
9328
|
const l = r.getCenter(new h());
|
|
9329
9329
|
if (!(t === "X" && l.x < 0 || t === "Y" && l.y < 0 || t === "Z" && l.z < 0))
|
|
9330
9330
|
return;
|
|
9331
|
-
const
|
|
9332
|
-
(
|
|
9331
|
+
const d = o.parameters, u = d && d.radiusTop === 0 && d.radiusBottom === 0.04 && d.height === 0.1, g = d && d.radiusTop === 0.2 && d.radiusBottom === 0 && d.height === 0.6;
|
|
9332
|
+
(u || g) && n.push(s);
|
|
9333
9333
|
}), n.forEach((s) => {
|
|
9334
9334
|
s.parent?.remove(s);
|
|
9335
9335
|
});
|
|
@@ -9379,8 +9379,8 @@ class ma {
|
|
|
9379
9379
|
isMinFace: n,
|
|
9380
9380
|
center: i.clone()
|
|
9381
9381
|
}), this.isSyncingTransform = !0, s.position.copy(c), s.quaternion.copy(l), s.visible = this.isActive, o.object !== s && o.attach(s), o.enabled = this.isActive;
|
|
9382
|
-
const
|
|
9383
|
-
|
|
9382
|
+
const d = this.transformHelpers.get(e);
|
|
9383
|
+
d && (d.visible = this.isActive), this.isSyncingTransform = !1;
|
|
9384
9384
|
}
|
|
9385
9385
|
getDominantAxis(e) {
|
|
9386
9386
|
const t = Math.abs(e.x), i = Math.abs(e.y), n = Math.abs(e.z);
|
|
@@ -9394,17 +9394,17 @@ class ma {
|
|
|
9394
9394
|
return;
|
|
9395
9395
|
const n = i.normal, s = this.getDominantAxis(n), o = this.getFaceTransformOffset(), r = n[s], l = t.position[s] - r * o;
|
|
9396
9396
|
if (i.isMinFace) {
|
|
9397
|
-
const c = this.maxBox.min[s],
|
|
9398
|
-
this.box.min[s] = Math.max(c, Math.min(
|
|
9397
|
+
const c = this.maxBox.min[s], d = this.box.max[s];
|
|
9398
|
+
this.box.min[s] = Math.max(c, Math.min(d, l));
|
|
9399
9399
|
} else {
|
|
9400
|
-
const c = this.box.min[s],
|
|
9401
|
-
this.box.max[s] = Math.max(c, Math.min(
|
|
9400
|
+
const c = this.box.min[s], d = this.maxBox.max[s];
|
|
9401
|
+
this.box.max[s] = Math.max(c, Math.min(d, l));
|
|
9402
9402
|
}
|
|
9403
9403
|
this.updata_face(this.box), this.calculate_ratio();
|
|
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 de(), t.name = "ClippingBox", this.engine.scene.add(t)), [
|
|
9408
9408
|
{
|
|
9409
9409
|
name: "前",
|
|
9410
9410
|
normal: new h(0, 0, -1),
|
|
@@ -9479,14 +9479,14 @@ 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
|
+
}), ui(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;
|
|
9486
9486
|
});
|
|
9487
9487
|
}
|
|
9488
9488
|
createFace(e, t, i, n, s, o) {
|
|
9489
|
-
const r = new
|
|
9489
|
+
const r = new we(), l = new Float32Array([
|
|
9490
9490
|
t[0].x,
|
|
9491
9491
|
t[0].y,
|
|
9492
9492
|
t[0].z,
|
|
@@ -9501,23 +9501,23 @@ class ma {
|
|
|
9501
9501
|
t[3].z
|
|
9502
9502
|
]), c = [0, 2, 1, 0, 3, 2];
|
|
9503
9503
|
r.setAttribute("position", new rt(l, 3)), r.setIndex(c);
|
|
9504
|
-
let
|
|
9505
|
-
if (
|
|
9506
|
-
const p = new
|
|
9504
|
+
let d = this.meshs.find((p) => p.name === n);
|
|
9505
|
+
if (d == null) {
|
|
9506
|
+
const p = new ge({
|
|
9507
9507
|
color: 65280,
|
|
9508
9508
|
transparent: !0,
|
|
9509
9509
|
opacity: this.faceIdleOpacity,
|
|
9510
|
-
side:
|
|
9510
|
+
side: he
|
|
9511
9511
|
});
|
|
9512
|
-
p.polygonOffset = !0, p.polygonOffsetFactor = 1, p.polygonOffsetUnits = 4,
|
|
9512
|
+
p.polygonOffset = !0, p.polygonOffsetFactor = 1, p.polygonOffsetUnits = 4, d = new O(r, p), d.name = n, e.add(d), this.meshs.push(d);
|
|
9513
9513
|
} else
|
|
9514
|
-
|
|
9515
|
-
|
|
9514
|
+
d.geometry = r;
|
|
9515
|
+
d.userData = {
|
|
9516
9516
|
dragNormal: i.clone(),
|
|
9517
9517
|
isMinFace: s,
|
|
9518
9518
|
faceName: n
|
|
9519
9519
|
};
|
|
9520
|
-
const
|
|
9520
|
+
const u = new Float32Array([
|
|
9521
9521
|
t[0].x,
|
|
9522
9522
|
t[0].y,
|
|
9523
9523
|
t[0].z,
|
|
@@ -9533,8 +9533,8 @@ class ma {
|
|
|
9533
9533
|
t[0].x,
|
|
9534
9534
|
t[0].y,
|
|
9535
9535
|
t[0].z
|
|
9536
|
-
]), g = new ke({ color: 255 }), m = new
|
|
9537
|
-
m.setAttribute("position", new rt(
|
|
9536
|
+
]), g = new ke({ color: 255 }), m = new we();
|
|
9537
|
+
m.setAttribute("position", new rt(u, 3));
|
|
9538
9538
|
let w = this.meshs.find((p) => p.name === n + "Line");
|
|
9539
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();
|
|
@@ -9753,24 +9753,24 @@ 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 de(), 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,
|
|
9760
9760
|
(this.box.min.z + this.box.max.z) / 2
|
|
9761
9761
|
);
|
|
9762
9762
|
this.center = o.clone();
|
|
9763
|
-
const r = t?.clone() ?? o.clone().add(n.clone().multiplyScalar(e)), { tangent: l, bitangent: c } = this.getPlaneBasis(n),
|
|
9763
|
+
const r = t?.clone() ?? o.clone().add(n.clone().multiplyScalar(e)), { tangent: l, bitangent: c } = this.getPlaneBasis(n), d = this.getBoxCorners(this.box), u = this.box.min.distanceTo(this.box.max), g = Math.max(u * 0.02, 0.01);
|
|
9764
9764
|
let m = 1 / 0, w = -1 / 0, v = 1 / 0, b = -1 / 0;
|
|
9765
|
-
|
|
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,
|
|
9765
|
+
d.forEach((E) => {
|
|
9766
|
+
const k = E.clone().sub(r), B = k.dot(l), I = k.dot(c);
|
|
9767
|
+
m = Math.min(m, B), w = Math.max(w, B), v = Math.min(v, I), b = Math.max(b, I);
|
|
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);
|
|
9771
9771
|
}
|
|
9772
9772
|
createFace(e, t, i, n) {
|
|
9773
|
-
const s = new
|
|
9773
|
+
const s = new we(), o = new Float32Array([
|
|
9774
9774
|
t[0].x,
|
|
9775
9775
|
t[0].y,
|
|
9776
9776
|
t[0].z,
|
|
@@ -9787,17 +9787,17 @@ class ga {
|
|
|
9787
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
|
-
const v = new
|
|
9790
|
+
const v = new ge({
|
|
9791
9791
|
color: 65280,
|
|
9792
9792
|
transparent: !0,
|
|
9793
9793
|
opacity: this.idleOpacity,
|
|
9794
|
-
side:
|
|
9794
|
+
side: he
|
|
9795
9795
|
});
|
|
9796
9796
|
v.polygonOffset = !0, v.polygonOffsetFactor = 1, v.polygonOffsetUnits = 4, c = new O(s, v), c.name = n, e.add(c), this.meshs.push(c);
|
|
9797
9797
|
} else
|
|
9798
9798
|
c.geometry = s;
|
|
9799
9799
|
c.normal = r.clone();
|
|
9800
|
-
const
|
|
9800
|
+
const d = new Float32Array([
|
|
9801
9801
|
t[0].x,
|
|
9802
9802
|
t[0].y,
|
|
9803
9803
|
t[0].z,
|
|
@@ -9813,10 +9813,10 @@ class ga {
|
|
|
9813
9813
|
t[0].x,
|
|
9814
9814
|
t[0].y,
|
|
9815
9815
|
t[0].z
|
|
9816
|
-
]),
|
|
9817
|
-
g.setAttribute("position", new rt(
|
|
9816
|
+
]), u = new ke({ color: 255 }), g = new we();
|
|
9817
|
+
g.setAttribute("position", new rt(d, 3));
|
|
9818
9818
|
let m = this.meshs.find((v) => v.name == n + "Line");
|
|
9819
|
-
m == null ? (m = new at(g,
|
|
9819
|
+
m == null ? (m = new at(g, u), m.name = n + "Line", e.add(m), this.meshs.push(m)) : (m.geometry = g, m.material = u);
|
|
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
|
+
ui(this.engine).forEach((t) => {
|
|
9835
9835
|
this.applyClippingToMaterial(t.material), this.engine.clipping.clippingStencil?.addMesh(e, t);
|
|
9836
9836
|
}), this.requestShadowRefresh();
|
|
9837
9837
|
}
|
|
@@ -9840,7 +9840,7 @@ class ga {
|
|
|
9840
9840
|
e.forEach((t) => this.applyClippingToMaterial(t));
|
|
9841
9841
|
return;
|
|
9842
9842
|
}
|
|
9843
|
-
e && (e.clippingPlanes = this.engine.sectionPlane, e.clipShadows = !0, e.shadowSide =
|
|
9843
|
+
e && (e.clippingPlanes = this.engine.sectionPlane, e.clipShadows = !0, e.shadowSide = he, e.needsUpdate = !0);
|
|
9844
9844
|
}
|
|
9845
9845
|
requestShadowRefresh() {
|
|
9846
9846
|
const e = this.engine?.renderer?.shadowMap;
|
|
@@ -9936,8 +9936,8 @@ class ga {
|
|
|
9936
9936
|
const l = r.getCenter(new h());
|
|
9937
9937
|
if (!(t === "X" && l.x < 0 || t === "Y" && l.y < 0 || t === "Z" && l.z < 0))
|
|
9938
9938
|
return;
|
|
9939
|
-
const
|
|
9940
|
-
(
|
|
9939
|
+
const d = o.parameters, u = d && d.radiusTop === 0 && d.radiusBottom === 0.04 && d.height === 0.1, g = d && d.radiusTop === 0.2 && d.radiusBottom === 0 && d.height === 0.6;
|
|
9940
|
+
(u || g) && n.push(s);
|
|
9941
9941
|
}), n.forEach((s) => {
|
|
9942
9942
|
s.parent?.remove(s);
|
|
9943
9943
|
});
|
|
@@ -10090,10 +10090,10 @@ class ga {
|
|
|
10090
10090
|
if (i != null && n != null && s != null) {
|
|
10091
10091
|
const o = new h();
|
|
10092
10092
|
if (e.raycaster.ray.intersectPlane(s, o)) {
|
|
10093
|
-
const r = o.clone().sub(i.clone()).dot(n.clone()), l = this.getDistanceRange(this.normal.clone().normalize()), c = n.dot(this.normal.clone().normalize()) >= 0 ? 1 : -1,
|
|
10094
|
-
this.distance = Math.min(l.max, Math.max(l.min,
|
|
10095
|
-
const
|
|
10096
|
-
this.updata_face(this.distance,
|
|
10093
|
+
const r = o.clone().sub(i.clone()).dot(n.clone()), l = this.getDistanceRange(this.normal.clone().normalize()), c = n.dot(this.normal.clone().normalize()) >= 0 ? 1 : -1, d = this.dragStartDistance + r * c;
|
|
10094
|
+
this.distance = Math.min(l.max, Math.max(l.min, d));
|
|
10095
|
+
const u = (this.dragStartCenter ?? this.current_center)?.clone().add(this.normal.clone().normalize().multiplyScalar(this.distance - this.dragStartDistance));
|
|
10096
|
+
this.updata_face(this.distance, u);
|
|
10097
10097
|
}
|
|
10098
10098
|
}
|
|
10099
10099
|
}
|
|
@@ -10156,7 +10156,7 @@ class ya {
|
|
|
10156
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
|
-
side:
|
|
10159
|
+
side: he,
|
|
10160
10160
|
toneMapped: !1
|
|
10161
10161
|
}), this.fillMaterial.clipShadows = !0, this.fillMaterial.clippingPlanes = e.sectionPlane;
|
|
10162
10162
|
}
|
|
@@ -10212,7 +10212,7 @@ class ya {
|
|
|
10212
10212
|
const s = this.filterMeshesByBoxAndComplexity(e, n);
|
|
10213
10213
|
if (s.length === 0)
|
|
10214
10214
|
return;
|
|
10215
|
-
const o = i.min.distanceTo(i.max), r = o * 5, l = 0.1, c = this.createPlaneBrush(e, r, l),
|
|
10215
|
+
const o = i.min.distanceTo(i.max), r = o * 5, l = 0.1, c = this.createPlaneBrush(e, r, l), d = [];
|
|
10216
10216
|
for (const v of s.slice(0, this.maxCandidates)) {
|
|
10217
10217
|
const b = this.createWorldBrushFromMesh(v);
|
|
10218
10218
|
if (b != null)
|
|
@@ -10221,25 +10221,25 @@ class ya {
|
|
|
10221
10221
|
if (!x)
|
|
10222
10222
|
continue;
|
|
10223
10223
|
const C = this.extractPlaneCapGeometry(x, e, l);
|
|
10224
|
-
C &&
|
|
10224
|
+
C && d.push(C), x.dispose();
|
|
10225
10225
|
} catch {
|
|
10226
10226
|
} finally {
|
|
10227
10227
|
b.geometry.dispose();
|
|
10228
10228
|
}
|
|
10229
10229
|
}
|
|
10230
|
-
if (c.geometry.dispose(),
|
|
10230
|
+
if (c.geometry.dispose(), d.length === 0)
|
|
10231
10231
|
return;
|
|
10232
|
-
const
|
|
10233
|
-
if (
|
|
10232
|
+
const u = ot(d, !1);
|
|
10233
|
+
if (d.forEach((v) => v.dispose()), !u)
|
|
10234
10234
|
return;
|
|
10235
|
-
this.applyPlanarUv(
|
|
10235
|
+
this.applyPlanarUv(u, e);
|
|
10236
10236
|
const g = this.getFaceOffsetDistance(o), m = this.getFaceOffsetSign();
|
|
10237
|
-
|
|
10237
|
+
u.translate(
|
|
10238
10238
|
e.normal.x * g * m,
|
|
10239
10239
|
e.normal.y * g * m,
|
|
10240
10240
|
e.normal.z * g * m
|
|
10241
10241
|
);
|
|
10242
|
-
const w = new O(
|
|
10242
|
+
const w = new O(u, this.fillMaterial);
|
|
10243
10243
|
w.name = `${this.fillMeshName}_${t}`, w.frustumCulled = !1, w.renderOrder = 20, w.castShadow = !1, w.receiveShadow = !1, this.engine.scene.add(w), this.fillMeshes.set(t, w);
|
|
10244
10244
|
}
|
|
10245
10245
|
/**
|
|
@@ -10278,11 +10278,11 @@ class ya {
|
|
|
10278
10278
|
const c = l?.octreeBox;
|
|
10279
10279
|
if (!c)
|
|
10280
10280
|
continue;
|
|
10281
|
-
const
|
|
10282
|
-
for (const
|
|
10283
|
-
if (o.has(
|
|
10281
|
+
const d = this.collectIntersectElementIds(c, e);
|
|
10282
|
+
for (const u of d) {
|
|
10283
|
+
if (o.has(u))
|
|
10284
10284
|
continue;
|
|
10285
|
-
const g = s.nodesMap.get(
|
|
10285
|
+
const g = s.nodesMap.get(u);
|
|
10286
10286
|
if (!(g?.instance === !0 || !Array.isArray(g?.infos)))
|
|
10287
10287
|
for (const m of g.infos) {
|
|
10288
10288
|
const w = m?.mesh;
|
|
@@ -10406,19 +10406,19 @@ class ya {
|
|
|
10406
10406
|
const n = e.index ? e.toNonIndexed() : e.clone(), s = n.getAttribute("position");
|
|
10407
10407
|
if (!s || s.count < 3)
|
|
10408
10408
|
return n.dispose(), null;
|
|
10409
|
-
const o = t.normal.clone().normalize(), r = new h(), l = new h(), c = new h(),
|
|
10409
|
+
const o = t.normal.clone().normalize(), r = new h(), l = new h(), c = new h(), d = new h(), u = new h(), g = new h(), m = new h(), w = new h(), v = new h(), b = Math.max(i * 0.35, 1e-4), p = Math.max(i * 0.7, 1e-4), x = [];
|
|
10410
10410
|
for (let _ = 0; _ < s.count; _ += 3) {
|
|
10411
|
-
if (
|
|
10411
|
+
if (d.fromBufferAttribute(s, _), u.fromBufferAttribute(s, _ + 1), g.fromBufferAttribute(s, _ + 2), l.subVectors(u, d), c.subVectors(g, d), r.crossVectors(l, c), r.lengthSq() < 1e-14 || (r.normalize(), Math.abs(r.dot(o)) < 0.9))
|
|
10412
10412
|
continue;
|
|
10413
|
-
const E = t.distanceToPoint(
|
|
10414
|
-
if (Math.max(E, k, B) -
|
|
10413
|
+
const E = t.distanceToPoint(d), k = t.distanceToPoint(u), B = t.distanceToPoint(g), I = Math.min(E, k, B);
|
|
10414
|
+
if (Math.max(E, k, B) - I > b)
|
|
10415
10415
|
continue;
|
|
10416
10416
|
const $ = (E + k + B) / 3;
|
|
10417
|
-
Math.abs($) > p || $ < 0 || (m.copy(
|
|
10417
|
+
Math.abs($) > p || $ < 0 || (m.copy(d).addScaledVector(o, -E), w.copy(u).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)));
|
|
10418
10418
|
}
|
|
10419
10419
|
if (n.dispose(), x.length < 9)
|
|
10420
10420
|
return null;
|
|
10421
|
-
const C = new
|
|
10421
|
+
const C = new we();
|
|
10422
10422
|
return C.setAttribute("position", new Pt(x, 3)), C.computeVertexNormals(), C;
|
|
10423
10423
|
}
|
|
10424
10424
|
applyPlanarUv(e, t) {
|
|
@@ -10426,15 +10426,15 @@ class ya {
|
|
|
10426
10426
|
if (!i || i.count === 0)
|
|
10427
10427
|
return;
|
|
10428
10428
|
const { tangent: n, bitangent: s } = this.getPlaneBasis(t.normal.clone().normalize()), o = new h(), r = new Float32Array(i.count * 2);
|
|
10429
|
-
let l = 1 / 0, c = -1 / 0,
|
|
10429
|
+
let l = 1 / 0, c = -1 / 0, d = 1 / 0, u = -1 / 0;
|
|
10430
10430
|
for (let w = 0; w < i.count; w++) {
|
|
10431
10431
|
o.fromBufferAttribute(i, w);
|
|
10432
10432
|
const v = o.dot(n), b = o.dot(s), p = w * 2;
|
|
10433
|
-
r[p] = v, r[p + 1] = b, l = Math.min(l, v), c = Math.max(c, v),
|
|
10433
|
+
r[p] = v, r[p + 1] = b, l = Math.min(l, v), c = Math.max(c, v), d = Math.min(d, b), u = Math.max(u, b);
|
|
10434
10434
|
}
|
|
10435
|
-
const g = Math.max(c - l, 1e-6), m = Math.max(
|
|
10435
|
+
const g = Math.max(c - l, 1e-6), m = Math.max(u - d, 1e-6);
|
|
10436
10436
|
for (let w = 0; w < r.length; w += 2)
|
|
10437
|
-
r[w] = (r[w] - l) / g * this.fillTextureRepeat, r[w + 1] = (r[w + 1] -
|
|
10437
|
+
r[w] = (r[w] - l) / g * this.fillTextureRepeat, r[w + 1] = (r[w + 1] - d) / m * this.fillTextureRepeat;
|
|
10438
10438
|
e.setAttribute("uv", new rt(r, 2));
|
|
10439
10439
|
}
|
|
10440
10440
|
getPlaneBasis(e) {
|
|
@@ -10611,8 +10611,8 @@ class va {
|
|
|
10611
10611
|
const n = e.normal, s = t.normal, o = i.normal, r = n.dot(new h().crossVectors(s, o));
|
|
10612
10612
|
if (Math.abs(r) < 1e-8)
|
|
10613
10613
|
return null;
|
|
10614
|
-
const l = new h().crossVectors(s, o).multiplyScalar(-e.constant), c = new h().crossVectors(o, n).multiplyScalar(-t.constant),
|
|
10615
|
-
return l.add(c).add(
|
|
10614
|
+
const l = new h().crossVectors(s, o).multiplyScalar(-e.constant), c = new h().crossVectors(o, n).multiplyScalar(-t.constant), d = new h().crossVectors(n, s).multiplyScalar(-i.constant);
|
|
10615
|
+
return l.add(c).add(d).divideScalar(r);
|
|
10616
10616
|
}
|
|
10617
10617
|
isPointInsidePlanes(e, t) {
|
|
10618
10618
|
return t.every((i) => i.distanceToPoint(e) >= -this.clippingTolerance);
|
|
@@ -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
|
+
ui(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);
|
|
@@ -10789,12 +10789,12 @@ class xa {
|
|
|
10789
10789
|
},
|
|
10790
10790
|
o?.key
|
|
10791
10791
|
)) : r(o.properties, i, t, n);
|
|
10792
|
-
function r(l, c,
|
|
10793
|
-
let g = {}, m = l.models[
|
|
10794
|
-
m == null && (m = l.models[
|
|
10792
|
+
function r(l, c, d, u) {
|
|
10793
|
+
let g = {}, m = l.models[d];
|
|
10794
|
+
m == null && (m = l.models[d.toString() || ""]), m.forEach((w) => {
|
|
10795
10795
|
i.includes(l.names[w[1]]) && (g[l.names[w[1]]] = l.values[w[2]]);
|
|
10796
|
-
}), s != null && s.has(
|
|
10797
|
-
id:
|
|
10796
|
+
}), s != null && s.has(d) && g.push(s.get(d)), u?.({
|
|
10797
|
+
id: d,
|
|
10798
10798
|
properties: g
|
|
10799
10799
|
});
|
|
10800
10800
|
}
|
|
@@ -10815,21 +10815,21 @@ class xa {
|
|
|
10815
10815
|
s?.key
|
|
10816
10816
|
)), o(s.properties, t, i);
|
|
10817
10817
|
function o(r, l, c) {
|
|
10818
|
-
let
|
|
10819
|
-
|
|
10820
|
-
let g =
|
|
10818
|
+
let d = [], u = r.models[l];
|
|
10819
|
+
u == null && (u = r.models[l.toString() || ""]);
|
|
10820
|
+
let g = u.map((w) => w[0]);
|
|
10821
10821
|
g = g.filter((w, v) => g.indexOf(w) === v), g.forEach((w) => {
|
|
10822
10822
|
let v = {
|
|
10823
10823
|
name: r.categorys[w],
|
|
10824
10824
|
children: []
|
|
10825
10825
|
};
|
|
10826
|
-
|
|
10826
|
+
d.push(v), u.filter((b) => b[0] === w).forEach((b) => {
|
|
10827
10827
|
v.children.push({
|
|
10828
10828
|
name: r.names[b[1]],
|
|
10829
10829
|
value: r.values[b[2]]
|
|
10830
10830
|
});
|
|
10831
10831
|
});
|
|
10832
|
-
}), n != null && n.has(l) &&
|
|
10832
|
+
}), n != null && n.has(l) && d.push(n.get(l));
|
|
10833
10833
|
const m = {
|
|
10834
10834
|
// 简体中文
|
|
10835
10835
|
基础数据: 0,
|
|
@@ -10857,12 +10857,12 @@ class xa {
|
|
|
10857
10857
|
構造: 9,
|
|
10858
10858
|
分析性質: 10
|
|
10859
10859
|
};
|
|
10860
|
-
|
|
10860
|
+
d.sort((w, v) => {
|
|
10861
10861
|
const b = m[w.name] ?? 99;
|
|
10862
10862
|
return (m[v.name] ?? 99) - b;
|
|
10863
10863
|
}), c?.({
|
|
10864
|
-
properties:
|
|
10865
|
-
materials:
|
|
10864
|
+
properties: d,
|
|
10865
|
+
materials: d
|
|
10866
10866
|
});
|
|
10867
10867
|
}
|
|
10868
10868
|
}
|
|
@@ -11056,15 +11056,15 @@ class Sa {
|
|
|
11056
11056
|
}
|
|
11057
11057
|
collectElementResults(e, t, i, n) {
|
|
11058
11058
|
t?.nodesMap?.forEach?.((s, o) => {
|
|
11059
|
-
const r = String(o), l = this.getMatchScore(r, i, n), c = Array.isArray(s?.infos) ? s.infos[0] : s?.info,
|
|
11060
|
-
l == null &&
|
|
11059
|
+
const r = String(o), l = this.getMatchScore(r, i, n), c = Array.isArray(s?.infos) ? s.infos[0] : s?.info, d = String(c?.name ?? s?.name ?? r), u = this.getMatchScore(d, i);
|
|
11060
|
+
l == null && u == null || e.push({
|
|
11061
11061
|
id: o,
|
|
11062
|
-
name:
|
|
11062
|
+
name: d,
|
|
11063
11063
|
type: "element",
|
|
11064
11064
|
url: t.url,
|
|
11065
11065
|
modelName: t.name,
|
|
11066
11066
|
elementIds: [o],
|
|
11067
|
-
score: Math.max(l ?? -1 / 0,
|
|
11067
|
+
score: Math.max(l ?? -1 / 0, u ?? -1 / 0)
|
|
11068
11068
|
});
|
|
11069
11069
|
});
|
|
11070
11070
|
}
|
|
@@ -11544,7 +11544,7 @@ class Aa {
|
|
|
11544
11544
|
init() {
|
|
11545
11545
|
this.miniMapContainer = document.createElement("div"), this.miniMapContainer.style.position = "absolute", this.applyContainerPosition(), this.miniMapContainer.style.width = `${this.currentMapWidth}px`, this.miniMapContainer.style.height = `${this.currentMapHeight}px`, this.miniMapContainer.style.border = "2px solid rgba(255, 255, 255, 0.4)", this.miniMapContainer.style.borderRadius = "4px", this.miniMapContainer.style.overflow = "hidden", this.miniMapContainer.style.display = "none", this.miniMapContainer.style.pointerEvents = "auto", this.miniMapContainer.style.touchAction = "none", this.miniMapContainer.style.cursor = "crosshair", this.engine.container.appendChild(this.miniMapContainer), this.miniMapRenderer = new si({ alpha: !0, antialias: !1 }), this.miniMapRenderer.setSize(this.currentMapWidth, this.currentMapHeight), this.miniMapRenderer.setPixelRatio(window.devicePixelRatio), this.miniMapRenderer.setClearColor(1710638, 0.85), this.miniMapContainer.appendChild(this.miniMapRenderer.domElement);
|
|
11546
11546
|
const e = window.devicePixelRatio || 1;
|
|
11547
|
-
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new
|
|
11547
|
+
this.overlayCanvas = document.createElement("canvas"), this.overlayCanvas.width = this.currentMapWidth * e, this.overlayCanvas.height = this.currentMapHeight * e, this.overlayCanvas.style.position = "absolute", this.overlayCanvas.style.top = "0", this.overlayCanvas.style.left = "0", this.overlayCanvas.style.width = `${this.currentMapWidth}px`, this.overlayCanvas.style.height = `${this.currentMapHeight}px`, this.overlayCanvas.style.pointerEvents = "none", this.miniMapContainer.appendChild(this.overlayCanvas), this.overlayCtx = this.overlayCanvas.getContext("2d"), this.overlayCtx && this.overlayCtx.scale(e, e), this.initLevelSelectors(), this.initResizeHandle(), this.initSizeToggleButton(), this.miniMapCamera = new Me(
|
|
11548
11548
|
-this.currentHalfSize,
|
|
11549
11549
|
this.currentHalfSize,
|
|
11550
11550
|
this.currentHalfSize,
|
|
@@ -11854,19 +11854,19 @@ class Aa {
|
|
|
11854
11854
|
const o = this.worldToPixel(s.x, s.z), r = Math.atan2(this.lastMouseY - o.y, this.lastMouseX - o.x);
|
|
11855
11855
|
let c = Math.atan2(t - o.y, e - o.x) - r;
|
|
11856
11856
|
c > Math.PI && (c -= 2 * Math.PI), c < -Math.PI && (c += 2 * Math.PI);
|
|
11857
|
-
const
|
|
11858
|
-
if (
|
|
11857
|
+
const d = n.target ? Math.max(i.position.distanceTo(n.target), 1e-3) : 10, u = this.engine.controlModule?.firstPersonControls, g = this.getThirdPersonControl();
|
|
11858
|
+
if (u?.enabled) {
|
|
11859
11859
|
const v = new h(0, 1, 0), b = new De().setFromAxisAngle(v, -c);
|
|
11860
11860
|
i.quaternion.premultiply(b), i.up.copy(v), i.updateMatrixWorld(!0);
|
|
11861
|
-
const p = i.position.clone().add(i.getWorldDirection(new h()).multiplyScalar(
|
|
11862
|
-
n.target?.copy(p),
|
|
11861
|
+
const p = i.position.clone().add(i.getWorldDirection(new h()).multiplyScalar(d));
|
|
11862
|
+
n.target?.copy(p), u.syncRotationStateFromCamera?.(), u.syncSharedTargetFromCamera?.();
|
|
11863
11863
|
return;
|
|
11864
11864
|
}
|
|
11865
11865
|
if (g?.rotateYaw) {
|
|
11866
11866
|
g.rotateYaw(-c);
|
|
11867
11867
|
return;
|
|
11868
11868
|
}
|
|
11869
|
-
const m = i.getWorldDirection(new h()).multiplyScalar(
|
|
11869
|
+
const m = i.getWorldDirection(new h()).multiplyScalar(d), w = new fs().setFromVector3(m);
|
|
11870
11870
|
w.theta -= c, m.setFromSpherical(w), n.target?.copy(i.position).add(m), n.update?.(), this.engine.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.();
|
|
11871
11871
|
}
|
|
11872
11872
|
drawOverlay() {
|
|
@@ -11877,12 +11877,12 @@ class Aa {
|
|
|
11877
11877
|
if (!i) return;
|
|
11878
11878
|
const n = this.worldToPixel(i.x, i.z), s = n.x, o = n.y, r = new h();
|
|
11879
11879
|
t.getWorldDirection(r);
|
|
11880
|
-
const l = Math.atan2(r.x, -r.z), c = 50,
|
|
11880
|
+
const l = Math.atan2(r.x, -r.z), c = 50, d = Math.PI / 6;
|
|
11881
11881
|
e.save(), e.translate(s, o), e.rotate(l);
|
|
11882
|
-
const
|
|
11883
|
-
|
|
11884
|
-
const g = -Math.sin(
|
|
11885
|
-
e.beginPath(), e.moveTo(0, 0), e.lineTo(g, m), e.lineTo(w, v), e.closePath(), e.fillStyle =
|
|
11882
|
+
const u = e.createRadialGradient(0, 0, 1, 0, 0, c);
|
|
11883
|
+
u.addColorStop(0, "rgba(0, 230, 130, 0.9)"), u.addColorStop(1, "rgba(0, 230, 130, 0)");
|
|
11884
|
+
const g = -Math.sin(d) * c, m = -Math.cos(d) * c, w = Math.sin(d) * c, v = -Math.cos(d) * c;
|
|
11885
|
+
e.beginPath(), e.moveTo(0, 0), e.lineTo(g, m), e.lineTo(w, v), e.closePath(), e.fillStyle = u, e.fill(), e.fillStyle = "rgba(255, 255, 255, 0.95)", e.strokeStyle = "rgba(0, 200, 110, 0.9)", e.lineWidth = 1.5, e.beginPath(), e.arc(0, 0, 4, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
|
|
11886
11886
|
}
|
|
11887
11887
|
show() {
|
|
11888
11888
|
this.isVisible = !0;
|
|
@@ -12151,7 +12151,7 @@ class _a {
|
|
|
12151
12151
|
},
|
|
12152
12152
|
target: this.getPoint(r)
|
|
12153
12153
|
};
|
|
12154
|
-
o instanceof
|
|
12154
|
+
o instanceof Me && (c.zoom = o.zoom, c.orthographicHeight = this.engine.cameraModule.getOrthographicVisibleHeight(o)), this.restoreCameraPose(c), this.syncOrbitOrigin(c.target);
|
|
12155
12155
|
}
|
|
12156
12156
|
zoomToIssueModel(e, t) {
|
|
12157
12157
|
const i = this.resolveModelBox(e);
|
|
@@ -12212,7 +12212,7 @@ class _a {
|
|
|
12212
12212
|
y: 0,
|
|
12213
12213
|
z: 0,
|
|
12214
12214
|
w: 1
|
|
12215
|
-
}), i instanceof
|
|
12215
|
+
}), i instanceof Me && 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 Ia {
|
|
12262
12262
|
engine;
|
|
12263
12263
|
constructor(e) {
|
|
12264
12264
|
this.engine = e, this.active();
|
|
@@ -12312,7 +12312,7 @@ const qe = {
|
|
|
12312
12312
|
EncodingComplete: "encoding-complete",
|
|
12313
12313
|
EncodingError: "encoding-error"
|
|
12314
12314
|
};
|
|
12315
|
-
class
|
|
12315
|
+
class La {
|
|
12316
12316
|
engine;
|
|
12317
12317
|
apiKey;
|
|
12318
12318
|
baseURL = "https://api.deepseek.com";
|
|
@@ -12396,8 +12396,8 @@ class Ia {
|
|
|
12396
12396
|
this.engine.events.trigger(qe.EncodingStart, { message: "编码开始" });
|
|
12397
12397
|
let i = [], n = "";
|
|
12398
12398
|
if (this.engine.models.forEach((c) => {
|
|
12399
|
-
n = c.url, c.nodesMap.forEach((
|
|
12400
|
-
t.some((g) =>
|
|
12399
|
+
n = c.url, c.nodesMap.forEach((d, u) => {
|
|
12400
|
+
t.some((g) => d.infos[0].name.includes(g)) && i.push({ id: u, url: c.url });
|
|
12401
12401
|
});
|
|
12402
12402
|
}), i.length === 0) {
|
|
12403
12403
|
this.engine.events.trigger(qe.EncodingComplete, { message: "无匹配构件", results: [] });
|
|
@@ -12407,18 +12407,18 @@ class Ia {
|
|
|
12407
12407
|
const o = 40;
|
|
12408
12408
|
let r = [], l = Math.ceil(s.length / o);
|
|
12409
12409
|
for (let c = 0; c < s.length; c += o) {
|
|
12410
|
-
let
|
|
12410
|
+
let d = s.slice(c, c + o), u = Math.floor(c / o) + 1;
|
|
12411
12411
|
this.engine.events.trigger(qe.EncodingStart, {
|
|
12412
|
-
message: `正在编码第 ${
|
|
12413
|
-
batch:
|
|
12412
|
+
message: `正在编码第 ${u}/${l} 批`,
|
|
12413
|
+
batch: u,
|
|
12414
12414
|
totalBatches: l
|
|
12415
12415
|
});
|
|
12416
12416
|
try {
|
|
12417
|
-
let g = await this.startChat(n, JSON.stringify(
|
|
12417
|
+
let g = await this.startChat(n, JSON.stringify(d));
|
|
12418
12418
|
r = r.concat(g);
|
|
12419
12419
|
} catch (g) {
|
|
12420
12420
|
this.engine.events.trigger(qe.EncodingError, {
|
|
12421
|
-
message: `第 ${
|
|
12421
|
+
message: `第 ${u} 批编码失败`,
|
|
12422
12422
|
error: g
|
|
12423
12423
|
});
|
|
12424
12424
|
}
|
|
@@ -12564,12 +12564,12 @@ class ka {
|
|
|
12564
12564
|
if (!s) return;
|
|
12565
12565
|
let o = { X: 0, Y: 0, Z: 0 }, r = 1, l = 1, c = null;
|
|
12566
12566
|
s.ViewType == "天花平面" ? (o = { X: 0, Y: 0, Z: s.Evevation }, l = -1, r = -1, c = new h(0, 0, 1)) : s.ViewType == "楼层平面" ? (o = { X: 0, Y: 0, Z: s.Evevation }, r = -1, l = -1, c = new h(0, 0, -1)) : s.ViewType == "立面视图" ? (o = s.Origin || s.origin, l = 1) : s.ViewType == "剖面视图" && (o = s.Origin || s.origin, r = -1, l = -1);
|
|
12567
|
-
const
|
|
12568
|
-
if (!o || !
|
|
12569
|
-
const
|
|
12570
|
-
this.engine.cameraModule.setViewFromOriginAndDirection(
|
|
12571
|
-
const m = s.ViewRange || s.viewRange, w = this.createViewRangePlanes(m,
|
|
12572
|
-
w ? this.engine.clipping.setSectionPlanesByViewRange(w) : this.engine.clipping.setSectionByView(
|
|
12567
|
+
const d = s.ViewDirection || s.viewDirection;
|
|
12568
|
+
if (!o || !d) return;
|
|
12569
|
+
const u = new h(o.X ?? o.x, o.Z ?? o.z, -(o.Y ?? o.y)).multiplyScalar(0.3048), g = new h(d.X ?? d.x, d.Z ?? d.z, -(d.Y ?? d.y)).setLength(r);
|
|
12570
|
+
this.engine.cameraModule.setViewFromOriginAndDirection(u, g.clone().multiplyScalar(l), c);
|
|
12571
|
+
const m = s.ViewRange || s.viewRange, w = this.createViewRangePlanes(m, u);
|
|
12572
|
+
w ? this.engine.clipping.setSectionPlanesByViewRange(w) : this.engine.clipping.setSectionByView(u, g), this.engine.camera.type != "OrthographicCamera" && this.engine.cameraModule.switchToOrthographicCamera(), w && this.zoomToCurrentViewRange();
|
|
12573
12573
|
}
|
|
12574
12574
|
createViewRangePlanes(e, t) {
|
|
12575
12575
|
if (!e)
|
|
@@ -12577,7 +12577,7 @@ class ka {
|
|
|
12577
12577
|
const i = this.toRevitVector(e.Min || e.min), n = this.toRevitVector(e.Max || e.max), s = e.Transform || e.transform, o = this.toRevitVector(s?.Origin || s?.origin), r = this.toRevitVector(s?.BasisX || s?.basisX), l = this.toRevitVector(s?.BasisY || s?.basisY), c = this.toRevitVector(s?.BasisZ || s?.basisZ);
|
|
12578
12578
|
if (!i || !n || !o || !r || !l || !c)
|
|
12579
12579
|
return null;
|
|
12580
|
-
const
|
|
12580
|
+
const d = this.toEnginePoint(o), u = t.clone().sub(d), g = this.shouldCorrectViewRangeOrigin(u) ? u : new h(), m = (v) => {
|
|
12581
12581
|
const b = o.clone().add(r.clone().multiplyScalar(v.x)).add(l.clone().multiplyScalar(v.y)).add(c.clone().multiplyScalar(v.z));
|
|
12582
12582
|
return this.toEnginePoint(b).add(g);
|
|
12583
12583
|
}, w = (v) => {
|
|
@@ -12652,8 +12652,8 @@ function Ba(a, e, t = "bim-snapshot.png") {
|
|
|
12652
12652
|
if (!c)
|
|
12653
12653
|
return null;
|
|
12654
12654
|
c.drawImage(r, 0, 0, s, o), c.drawImage(e, 0, 0, s, o);
|
|
12655
|
-
const
|
|
12656
|
-
return
|
|
12655
|
+
const d = l.toDataURL("image/png"), u = document.createElement("a");
|
|
12656
|
+
return u.href = d, u.download = t.toLowerCase().endsWith(".png") ? t : `${t}.png`, u.click(), d;
|
|
12657
12657
|
}
|
|
12658
12658
|
function Ra(a, e, t) {
|
|
12659
12659
|
const i = document.createElement("canvas");
|
|
@@ -12687,8 +12687,8 @@ function Oa(a, e, t) {
|
|
|
12687
12687
|
}), r = i.getRenderTarget(), l = i.autoClear, c = i.xr?.enabled ?? !1;
|
|
12688
12688
|
try {
|
|
12689
12689
|
i.xr && (i.xr.enabled = !1), i.autoClear = !0, i.setRenderTarget(o), i.clear(!0, !0, !0), i.render(n, s);
|
|
12690
|
-
const
|
|
12691
|
-
return i.readRenderTargetPixels(o, 0, 0, e, t,
|
|
12690
|
+
const d = new Uint8Array(e * t * 4);
|
|
12691
|
+
return i.readRenderTargetPixels(o, 0, 0, e, t, d), Na(d, e, t);
|
|
12692
12692
|
} catch {
|
|
12693
12693
|
return null;
|
|
12694
12694
|
} finally {
|
|
@@ -12704,8 +12704,8 @@ function Na(a, e, t) {
|
|
|
12704
12704
|
const s = n.createImageData(e, t), o = e * 4;
|
|
12705
12705
|
for (let r = 0; r < t; r++) {
|
|
12706
12706
|
const l = (t - 1 - r) * o, c = r * o;
|
|
12707
|
-
for (let
|
|
12708
|
-
s.data[c +
|
|
12707
|
+
for (let d = 0; d < o; d++)
|
|
12708
|
+
s.data[c + d] = a[l + d];
|
|
12709
12709
|
}
|
|
12710
12710
|
return n.putImageData(s, 0, 0), i;
|
|
12711
12711
|
}
|
|
@@ -12780,10 +12780,10 @@ class Xa {
|
|
|
12780
12780
|
l.type = "button", l.textContent = "自定义", l.style.marginTop = "8px", l.style.width = "100%", l.style.height = "26px", l.style.border = "1px solid #d9d9d9", l.style.borderRadius = "4px", l.style.background = "#ffffff", l.style.color = "#333333", l.style.cursor = "pointer", l.onclick = () => this.openNativeColorPicker(), this.colorPresetPanel.appendChild(l), s.appendChild(this.colorPresetPanel), this.updateColorControl(t.stroke), i.appendChild(this.createField("", s)), this.strokeWidthInput = document.createElement("input"), this.strokeWidthInput.type = "number", this.strokeWidthInput.min = "1", this.strokeWidthInput.max = "20", this.strokeWidthInput.step = "1", this.strokeWidthInput.value = String(t.strokeWidth), this.strokeWidthInput.style.width = "46px", this.strokeWidthInput.oninput = () => this.handlers.onStrokeWidthChange(this.strokeWidthInput.value), i.appendChild(this.createField("", this.strokeWidthInput, Wa, "线宽")), this.fontSizeInput = document.createElement("input"), this.fontSizeInput.type = "number", this.fontSizeInput.min = "10", this.fontSizeInput.max = "96", this.fontSizeInput.step = "1", this.fontSizeInput.value = String(t.fontSize), this.fontSizeInput.style.width = "46px", this.fontSizeInput.oninput = () => this.handlers.onFontSizeChange(this.fontSizeInput.value), i.appendChild(this.createField("", this.fontSizeInput, qa, "字号")), this.distanceButton = this.createIconButton("测量", Ua), this.distanceButton.onclick = () => this.handlers.onMeasureToggle(), i.appendChild(this.distanceButton);
|
|
12781
12781
|
const c = this.createIconButton("截图", Ga);
|
|
12782
12782
|
c.onclick = () => this.handlers.onScreenshot(), i.appendChild(c);
|
|
12783
|
-
const
|
|
12784
|
-
|
|
12785
|
-
const
|
|
12786
|
-
|
|
12783
|
+
const d = this.createIconButton("捕捉点", ja);
|
|
12784
|
+
d.onclick = () => this.handlers.onPickPoint(), i.appendChild(d);
|
|
12785
|
+
const u = this.createTextButton("×", "取消");
|
|
12786
|
+
u.onclick = () => this.handlers.onCancel(), u.style.background = "#ff4d4f", u.style.borderColor = "#ff4d4f", u.style.color = "#ffffff", i.appendChild(u);
|
|
12787
12787
|
const g = this.createTextButton("✔", "确定");
|
|
12788
12788
|
g.onclick = () => this.handlers.onConfirm(), g.style.background = "#52c41a", g.style.borderColor = "#52c41a", g.style.color = "#ffffff", i.appendChild(g), this.measureSubPanel = document.createElement("div"), this.measureSubPanel.style.display = "none", this.measureSubPanel.style.alignItems = "center", this.measureSubPanel.style.gap = "6px", this.measureSubPanel.style.flexWrap = "wrap", this.measureSubPanel.style.paddingTop = "2px", Ka.forEach((w) => {
|
|
12789
12789
|
const v = this.createSmallIconButton(w.label, Ya[w.type]);
|
|
@@ -13292,20 +13292,20 @@ 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 I = 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
|
-
}), V = new Si([
|
|
13301
|
+
}), V = new Si([I], {
|
|
13302
13302
|
selectable: n,
|
|
13303
13303
|
evented: n,
|
|
13304
13304
|
objectCaching: !1
|
|
13305
13305
|
});
|
|
13306
13306
|
return V.annotationType = "arrow", V;
|
|
13307
13307
|
}
|
|
13308
|
-
const l = s / r, c = o / r,
|
|
13308
|
+
const l = s / r, c = o / r, d = -c, u = l, g = Math.max(10, i.strokeWidth * 6), m = g * 0.72, w = t.x - l * g, v = t.y - c * g, b = w + d * (m * 0.5), p = v + u * (m * 0.5), x = w - d * (m * 0.5), C = v - u * (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: "",
|
|
@@ -13365,12 +13365,12 @@ class $a {
|
|
|
13365
13365
|
const i = Math.max(2, t), n = i * 1.4;
|
|
13366
13366
|
let s = `M ${e[0].x} ${e[0].y}`, o = 1;
|
|
13367
13367
|
for (let r = 1; r < e.length; r++) {
|
|
13368
|
-
const l = e[r - 1], c = e[r],
|
|
13368
|
+
const l = e[r - 1], c = e[r], d = c.x - l.x, u = c.y - l.y, g = Math.sqrt(d * d + u * u);
|
|
13369
13369
|
if (g < 0.1)
|
|
13370
13370
|
continue;
|
|
13371
|
-
const m = -
|
|
13371
|
+
const m = -u / g, w = d / g, v = Math.max(1, Math.round(g / n));
|
|
13372
13372
|
for (let b = 1; b <= v; b++) {
|
|
13373
|
-
const p = b / v, x = l.x +
|
|
13373
|
+
const p = b / v, x = l.x + d * p, C = l.y + u * p, _ = o % 2 === 0 ? -1 : 1, E = x + m * i * _, k = C + w * i * _;
|
|
13374
13374
|
s += ` Q ${E} ${k} ${x} ${C}`, o++;
|
|
13375
13375
|
}
|
|
13376
13376
|
}
|
|
@@ -13748,15 +13748,15 @@ class Za {
|
|
|
13748
13748
|
-(r / (e.clientHeight || 1)) * 2 + 1
|
|
13749
13749
|
), c = new ae();
|
|
13750
13750
|
c.setFromCamera(l, this.engine.camera);
|
|
13751
|
-
const
|
|
13752
|
-
if (!
|
|
13751
|
+
const d = this.pickNearestModelPoint(c);
|
|
13752
|
+
if (!d) {
|
|
13753
13753
|
t(null);
|
|
13754
13754
|
return;
|
|
13755
13755
|
}
|
|
13756
13756
|
t({
|
|
13757
|
-
x:
|
|
13758
|
-
y:
|
|
13759
|
-
z:
|
|
13757
|
+
x: d.x,
|
|
13758
|
+
y: d.y,
|
|
13759
|
+
z: d.z,
|
|
13760
13760
|
type: "model"
|
|
13761
13761
|
});
|
|
13762
13762
|
};
|
|
@@ -14158,7 +14158,7 @@ class Qa {
|
|
|
14158
14158
|
e && (this.lastCameraEmitTime = Date.now(), this.emitEvent({
|
|
14159
14159
|
action: "camera",
|
|
14160
14160
|
camera: e
|
|
14161
|
-
}), this.engine?.events?.trigger?.(
|
|
14161
|
+
}), this.engine?.events?.trigger?.(ye.CameraChanged, e));
|
|
14162
14162
|
}
|
|
14163
14163
|
emitModelAction(e, t) {
|
|
14164
14164
|
this.emitEvent({
|
|
@@ -14354,12 +14354,12 @@ class el {
|
|
|
14354
14354
|
function wt(a) {
|
|
14355
14355
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
14356
14356
|
}
|
|
14357
|
-
function
|
|
14357
|
+
function ve(a) {
|
|
14358
14358
|
return new h(a.x, a.y, a.z);
|
|
14359
14359
|
}
|
|
14360
14360
|
function yt(a) {
|
|
14361
14361
|
const e = new h();
|
|
14362
|
-
return a.length === 0 ? e : (a.forEach((t) => e.add(
|
|
14362
|
+
return a.length === 0 ? e : (a.forEach((t) => e.add(ve(t))), e.multiplyScalar(1 / a.length));
|
|
14363
14363
|
}
|
|
14364
14364
|
function tl(a) {
|
|
14365
14365
|
const e = new h();
|
|
@@ -14370,12 +14370,12 @@ function tl(a) {
|
|
|
14370
14370
|
return e.normalize();
|
|
14371
14371
|
}
|
|
14372
14372
|
function Qi(a) {
|
|
14373
|
-
const e = a.map((c) =>
|
|
14373
|
+
const e = a.map((c) => ve(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
|
-
const
|
|
14378
|
-
return new H(
|
|
14377
|
+
const d = c.clone().sub(t);
|
|
14378
|
+
return new H(d.dot(o), d.dot(s));
|
|
14379
14379
|
}), l = new G().makeBasis(o, s, n).setPosition(t);
|
|
14380
14380
|
return {
|
|
14381
14381
|
origin: t,
|
|
@@ -14443,9 +14443,9 @@ class rl {
|
|
|
14443
14443
|
}
|
|
14444
14444
|
/** 点位支持图标、底环、波纹、光柱等常用告警标记效果。 */
|
|
14445
14445
|
buildPoint(e) {
|
|
14446
|
-
const t =
|
|
14446
|
+
const t = ve(e.instance.points[0]), i = e.instance.style, n = e.instance.effect, s = i.point ?? {};
|
|
14447
14447
|
if (e.instance.root.position.copy(t), s.icon) {
|
|
14448
|
-
const r = new
|
|
14448
|
+
const r = new un({
|
|
14449
14449
|
map: this.textureLoader.load(s.icon),
|
|
14450
14450
|
transparent: !0,
|
|
14451
14451
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1,
|
|
@@ -14456,7 +14456,7 @@ class rl {
|
|
|
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) {
|
|
14459
|
-
const r = Math.max(s.size ?? 0, 0.01), l = new mn(r * 0.5, 20, 16), c = new
|
|
14459
|
+
const r = Math.max(s.size ?? 0, 0.01), l = new mn(r * 0.5, 20, 16), c = new ge({
|
|
14460
14460
|
color: i.color ?? "#7ffcff",
|
|
14461
14461
|
transparent: !0,
|
|
14462
14462
|
opacity: i.opacity ?? 0.92,
|
|
@@ -14464,33 +14464,33 @@ class rl {
|
|
|
14464
14464
|
depthWrite: !1
|
|
14465
14465
|
});
|
|
14466
14466
|
c.clippingPlanes = this.engine.sectionPlane;
|
|
14467
|
-
const
|
|
14468
|
-
|
|
14467
|
+
const d = new O(l, c);
|
|
14468
|
+
d.renderOrder = i.alwaysOnTop ? 1300 : 0, e.instance.root.add(d);
|
|
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 xi(r * 0.84, r, 48), c = this.materialFactory.createPulseMaterial(o, 0.85, i, n, "uvx", 0, 1),
|
|
14473
|
-
|
|
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), d = new O(l, c);
|
|
14473
|
+
d.rotation.x = -Math.PI / 2, d.renderOrder = i.alwaysOnTop ? 1300 : 0, e.instance.root.add(d), e.baseRingMeshes.push(d), e.pulseMaterials.push(c);
|
|
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
|
-
const
|
|
14478
|
+
const d = new O(
|
|
14479
14479
|
new xi(0.86, 1, 40),
|
|
14480
|
-
new
|
|
14480
|
+
new ge({
|
|
14481
14481
|
color: o,
|
|
14482
14482
|
transparent: !0,
|
|
14483
14483
|
opacity: 0.5,
|
|
14484
|
-
side:
|
|
14484
|
+
side: he,
|
|
14485
14485
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1,
|
|
14486
14486
|
depthWrite: !1
|
|
14487
14487
|
})
|
|
14488
14488
|
);
|
|
14489
|
-
|
|
14489
|
+
d.material.clippingPlanes = this.engine.sectionPlane, d.rotation.x = -Math.PI / 2, d.userData.maxRadius = l, d.userData.phase = c / r, e.instance.root.add(d), e.rippleMeshes.push(d);
|
|
14490
14490
|
}
|
|
14491
14491
|
}
|
|
14492
14492
|
if (n.pillar?.enabled) {
|
|
14493
|
-
const r = n.pillar.height ?? 16, l = n.pillar.width ?? 1.5, c = new ys(l * 0.5, l * 0.5, r, 20, 1, !0),
|
|
14493
|
+
const r = n.pillar.height ?? 16, l = n.pillar.width ?? 1.5, c = new ys(l * 0.5, l * 0.5, r, 20, 1, !0), d = this.materialFactory.createSurfaceMaterial({
|
|
14494
14494
|
color: i.color ?? "#7ffcff",
|
|
14495
14495
|
opacity: i.fillOpacity ?? 0.22,
|
|
14496
14496
|
style: i,
|
|
@@ -14508,13 +14508,13 @@ class rl {
|
|
|
14508
14508
|
axisMode: "y",
|
|
14509
14509
|
axisMin: -r * 0.5,
|
|
14510
14510
|
axisMax: r * 0.5
|
|
14511
|
-
}),
|
|
14512
|
-
|
|
14511
|
+
}), u = new O(c, d);
|
|
14512
|
+
u.position.y = r * 0.5, e.instance.root.add(u), e.volumeHeight = Math.max(e.volumeHeight ?? 0, r), e.animatedMaterials.push(d);
|
|
14513
14513
|
}
|
|
14514
14514
|
}
|
|
14515
14515
|
/** 线标记用 TubeGeometry 拉出体积,便于承载渐变和流动特效。 */
|
|
14516
14516
|
buildPolyline(e) {
|
|
14517
|
-
const t = e.instance.points.map((c) =>
|
|
14517
|
+
const t = e.instance.points.map((c) => ve(c)), i = new vs();
|
|
14518
14518
|
for (let c = 0; c < t.length - 1; c += 1)
|
|
14519
14519
|
i.add(new Ms(t[c], t[c + 1]));
|
|
14520
14520
|
const n = Math.max(e.instance.style.lineWidth ?? 0.18, 0.02), s = new ws(i, Math.max(32, t.length * 14), n, 10, !1);
|
|
@@ -14583,12 +14583,12 @@ class rl {
|
|
|
14583
14583
|
buildBox(e) {
|
|
14584
14584
|
if (e.instance.points.length < 2)
|
|
14585
14585
|
return;
|
|
14586
|
-
const t =
|
|
14586
|
+
const t = ve(e.instance.points[0]), i = ve(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),
|
|
14590
14590
|
new h(0.5, 0.5, 0.5)
|
|
14591
|
-
),
|
|
14591
|
+
), d = this.materialFactory.createSurfaceMaterial({
|
|
14592
14592
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
14593
14593
|
opacity: e.instance.style.fillOpacity ?? 0.16,
|
|
14594
14594
|
style: e.instance.style,
|
|
@@ -14596,8 +14596,8 @@ class rl {
|
|
|
14596
14596
|
axisMode: "y",
|
|
14597
14597
|
axisMin: c.min.y,
|
|
14598
14598
|
axisMax: c.max.y
|
|
14599
|
-
}),
|
|
14600
|
-
|
|
14599
|
+
}), u = new O(l, d);
|
|
14600
|
+
u.position.copy(r), e.instance.root.add(u);
|
|
14601
14601
|
const g = new ke({
|
|
14602
14602
|
color: e.instance.style.volume?.edgeColor ?? "#d9ffff",
|
|
14603
14603
|
transparent: !0,
|
|
@@ -14606,7 +14606,7 @@ class rl {
|
|
|
14606
14606
|
});
|
|
14607
14607
|
g.clippingPlanes = this.engine.sectionPlane;
|
|
14608
14608
|
const m = new jt(new bs(l), g);
|
|
14609
|
-
m.position.copy(r), e.instance.root.add(m), e.volumeHeight = o.y, e.animatedMaterials.push(
|
|
14609
|
+
m.position.copy(r), e.instance.root.add(m), e.volumeHeight = o.y, e.animatedMaterials.push(d);
|
|
14610
14610
|
}
|
|
14611
14611
|
/** 多层轮廓线常用于电子围栏、扫描墙这类有高度层次感的体标记。 */
|
|
14612
14612
|
appendLayerLoops(e, t) {
|
|
@@ -14615,7 +14615,7 @@ class rl {
|
|
|
14615
14615
|
const i = e.instance.effect.layers.count ?? 3, n = e.instance.effect.layers.offsetY ?? 3;
|
|
14616
14616
|
for (let s = 1; s <= i; s += 1) {
|
|
14617
14617
|
const o = e.instance.points.map((l) => {
|
|
14618
|
-
const c =
|
|
14618
|
+
const c = ve(l).add(t.clone().multiplyScalar(n * s));
|
|
14619
14619
|
return { x: c.x, y: c.y, z: c.z };
|
|
14620
14620
|
}), r = this.createLoopLine(
|
|
14621
14621
|
o,
|
|
@@ -14627,7 +14627,7 @@ class rl {
|
|
|
14627
14627
|
}
|
|
14628
14628
|
/** 闭合轮廓线用于面边框、围栏层线以及体外框。 */
|
|
14629
14629
|
createLoopLine(e, t, i) {
|
|
14630
|
-
const n = new
|
|
14630
|
+
const n = new we().setFromPoints(e.map((r) => ve(r))), s = new ke({
|
|
14631
14631
|
color: t,
|
|
14632
14632
|
transparent: !0,
|
|
14633
14633
|
opacity: 0.94,
|
|
@@ -14652,10 +14652,10 @@ class al {
|
|
|
14652
14652
|
}), e.instance.effect.ripple?.enabled) {
|
|
14653
14653
|
const n = e.instance.effect.ripple.speed ?? 0.9, s = e.instance.effect.ripple.maxRadius ?? 12;
|
|
14654
14654
|
e.rippleMeshes.forEach((o, r) => {
|
|
14655
|
-
const l = o.userData.phase ?? r / Math.max(e.rippleMeshes.length, 1), c = (i * n + l) % 1,
|
|
14656
|
-
o.scale.setScalar(
|
|
14657
|
-
const
|
|
14658
|
-
|
|
14655
|
+
const l = o.userData.phase ?? r / Math.max(e.rippleMeshes.length, 1), c = (i * n + l) % 1, d = R.lerp(0.2, s, c);
|
|
14656
|
+
o.scale.setScalar(d);
|
|
14657
|
+
const u = o.material;
|
|
14658
|
+
u.opacity = (1 - c) * 0.55;
|
|
14659
14659
|
});
|
|
14660
14660
|
}
|
|
14661
14661
|
if (e.instance.effect.baseRing?.enabled) {
|
|
@@ -14679,7 +14679,7 @@ class al {
|
|
|
14679
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
|
-
} else this.engine.camera instanceof
|
|
14682
|
+
} else this.engine.camera instanceof Me && (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);
|
|
14683
14683
|
t.scale.set(o, o, 1);
|
|
14684
14684
|
}
|
|
14685
14685
|
}
|
|
@@ -14689,9 +14689,9 @@ class ll {
|
|
|
14689
14689
|
}
|
|
14690
14690
|
/** 构建支持渐变、流动、扫描、呼吸和发光的通用表面材质。 */
|
|
14691
14691
|
createSurfaceMaterial(e) {
|
|
14692
|
-
const t = e.style ?? {}, i = e.effect ?? {}, n = this.getGradientStops(e.color, i.gradient?.stops), s = i.gradient?.enabled === !0, o = i.glow?.enabled ? i.glow.intensity ?? 0.9 : 0, r = i.flow?.enabled === !0, l = i.pulse?.enabled === !0, c = i.scan?.enabled === !0,
|
|
14692
|
+
const t = e.style ?? {}, i = e.effect ?? {}, n = this.getGradientStops(e.color, i.gradient?.stops), s = i.gradient?.enabled === !0, o = i.glow?.enabled ? i.glow.intensity ?? 0.9 : 0, r = i.flow?.enabled === !0, l = i.pulse?.enabled === !0, c = i.scan?.enabled === !0, d = i.flow?.direction === "backward" ? -1 : 1, u = new Ss({
|
|
14693
14693
|
transparent: !0,
|
|
14694
|
-
side:
|
|
14694
|
+
side: he,
|
|
14695
14695
|
depthTest: t.alwaysOnTop ? !1 : t.depthTest !== !1,
|
|
14696
14696
|
depthWrite: !1,
|
|
14697
14697
|
uniforms: {
|
|
@@ -14710,7 +14710,7 @@ class ll {
|
|
|
14710
14710
|
uFlowEnabled: { value: r ? 1 : 0 },
|
|
14711
14711
|
uFlowSpeed: { value: i.flow?.speed ?? 0.6 },
|
|
14712
14712
|
uFlowWidth: { value: i.flow?.width ?? 0.18 },
|
|
14713
|
-
uFlowDirection: { value:
|
|
14713
|
+
uFlowDirection: { value: d },
|
|
14714
14714
|
uPulseEnabled: { value: l ? 1 : 0 },
|
|
14715
14715
|
uPulseSpeed: { value: i.pulse?.speed ?? 1.4 },
|
|
14716
14716
|
uPulseMinOpacity: { value: i.pulse?.minOpacity ?? 0.55 },
|
|
@@ -14803,7 +14803,7 @@ class ll {
|
|
|
14803
14803
|
}
|
|
14804
14804
|
`
|
|
14805
14805
|
});
|
|
14806
|
-
return
|
|
14806
|
+
return u.clippingPlanes = this.engine.sectionPlane, t.alwaysOnTop && (u.depthTest = !1), u;
|
|
14807
14807
|
}
|
|
14808
14808
|
/** 点位底环等脉冲效果统一通过同一套 shader 开关实现。 */
|
|
14809
14809
|
createPulseMaterial(e, t, i, n, s, o, r) {
|
|
@@ -14884,7 +14884,7 @@ const tt = {
|
|
|
14884
14884
|
minWidth: "120px",
|
|
14885
14885
|
pointerEvents: "auto"
|
|
14886
14886
|
}, hl = "bim-engine-annotation3d-panels";
|
|
14887
|
-
class
|
|
14887
|
+
class dl {
|
|
14888
14888
|
/** 新增或恢复数据前先做标准化,保证后续模块只处理完整结构。 */
|
|
14889
14889
|
normalizeData(e) {
|
|
14890
14890
|
return {
|
|
@@ -15038,7 +15038,7 @@ class ul {
|
|
|
15038
15038
|
};
|
|
15039
15039
|
}
|
|
15040
15040
|
}
|
|
15041
|
-
function
|
|
15041
|
+
function ul(a, e, t) {
|
|
15042
15042
|
const i = a.camera;
|
|
15043
15043
|
if (!i)
|
|
15044
15044
|
return !1;
|
|
@@ -15119,15 +15119,15 @@ class pl {
|
|
|
15119
15119
|
const t = e.instance.panel?.anchor ?? ol(e.instance.type), i = e.instance.panel?.offset ?? {};
|
|
15120
15120
|
let n = new h();
|
|
15121
15121
|
if (e.instance.type === "point")
|
|
15122
|
-
n.copy(
|
|
15122
|
+
n.copy(ve(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(
|
|
15124
|
+
t === "start" ? n.copy(ve(e.instance.points[0])) : t === "end" ? n.copy(ve(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
15126
|
n.copy(yt(e.instance.points));
|
|
15127
15127
|
else if (e.instance.type === "extrudePolygon")
|
|
15128
15128
|
n.copy(yt(e.instance.points)), t === "top" && e.anchorNormal && n.add(e.anchorNormal.clone().multiplyScalar(e.volumeHeight ?? 0));
|
|
15129
15129
|
else if (e.instance.type === "box" && (n.copy(yt(e.instance.points)), t === "top" && e.instance.points.length >= 2)) {
|
|
15130
|
-
const s =
|
|
15130
|
+
const s = ve(e.instance.points[0]), o = ve(e.instance.points[1]);
|
|
15131
15131
|
n.y = Math.max(s.y, o.y);
|
|
15132
15132
|
}
|
|
15133
15133
|
return n.add(new h(i.x ?? 0, i.y ?? 0, i.z ?? 0)), n;
|
|
@@ -15169,14 +15169,14 @@ class ml {
|
|
|
15169
15169
|
this.raycaster.setFromCamera(r, i);
|
|
15170
15170
|
const l = this.raycaster.intersectObjects(this.rootGroup.children, !0);
|
|
15171
15171
|
for (const c of l) {
|
|
15172
|
-
let
|
|
15173
|
-
for (;
|
|
15174
|
-
const
|
|
15175
|
-
if (
|
|
15176
|
-
const g = this.records.get(
|
|
15172
|
+
let d = c.object;
|
|
15173
|
+
for (; d; ) {
|
|
15174
|
+
const u = d.userData?.annotationId;
|
|
15175
|
+
if (u && this.records.has(u)) {
|
|
15176
|
+
const g = this.records.get(u);
|
|
15177
15177
|
return g.instance.selectable !== !1 && g.instance.visible ? g : null;
|
|
15178
15178
|
}
|
|
15179
|
-
|
|
15179
|
+
d = d.parent;
|
|
15180
15180
|
}
|
|
15181
15181
|
}
|
|
15182
15182
|
return null;
|
|
@@ -15274,7 +15274,7 @@ class yl {
|
|
|
15274
15274
|
records = /* @__PURE__ */ new Map();
|
|
15275
15275
|
textureLoader = new Oe();
|
|
15276
15276
|
occlusionRaycaster = new ae();
|
|
15277
|
-
normalizer = new
|
|
15277
|
+
normalizer = new dl();
|
|
15278
15278
|
materialFactory;
|
|
15279
15279
|
geometryBuilder;
|
|
15280
15280
|
effectsController;
|
|
@@ -15283,9 +15283,9 @@ 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 de(), 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
|
-
(t) =>
|
|
15288
|
+
(t) => ul(this.engine, this.occlusionRaycaster, t)
|
|
15289
15289
|
), this.interaction = new ml({
|
|
15290
15290
|
engine: this.engine,
|
|
15291
15291
|
rootGroup: this.rootGroup,
|
|
@@ -15403,7 +15403,7 @@ class yl {
|
|
|
15403
15403
|
}
|
|
15404
15404
|
/** 组装运行时记录,并将几何与面板初始化好。 */
|
|
15405
15405
|
buildRecord(e) {
|
|
15406
|
-
const t = new
|
|
15406
|
+
const t = new de();
|
|
15407
15407
|
t.name = e.id;
|
|
15408
15408
|
const i = {
|
|
15409
15409
|
id: e.id,
|
|
@@ -15492,10 +15492,10 @@ class vl {
|
|
|
15492
15492
|
o.normalize(), r.normalize();
|
|
15493
15493
|
const l = new G().makeRotationFromQuaternion(
|
|
15494
15494
|
new De().setFromUnitVectors(o, r)
|
|
15495
|
-
), c = new G().makeTranslation(n.x, n.y, n.z).multiply(l).multiply(new G().makeTranslation(-t.x, -t.y, -t.z)),
|
|
15495
|
+
), c = new G().makeTranslation(n.x, n.y, n.z).multiply(l).multiply(new G().makeTranslation(-t.x, -t.y, -t.z)), d = this.getMatrix(e.url);
|
|
15496
15496
|
return this.apply({
|
|
15497
15497
|
url: e.url,
|
|
15498
|
-
matrix: c.multiply(
|
|
15498
|
+
matrix: c.multiply(d)
|
|
15499
15499
|
});
|
|
15500
15500
|
}
|
|
15501
15501
|
/**
|
|
@@ -15638,12 +15638,20 @@ class Ml {
|
|
|
15638
15638
|
editModel(e, t = "translate") {
|
|
15639
15639
|
const i = this.modelList.get(e);
|
|
15640
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.
|
|
15641
|
+
this.enableModelEditing(), this.selectedModelId = e, this.ensureTransformControl(), this.transformControl?.setMode(t), this.transformControl?.attach(i.object), this.transformHelper && (this.transformHelper.visible = !0), this.engine.events?.trigger?.(ye.ModelPlaceSelected, {
|
|
15642
|
+
modelId: e,
|
|
15643
|
+
data: this.cloneData(i.data),
|
|
15644
|
+
object: i.object
|
|
15645
|
+
}), this.requestRender();
|
|
15642
15646
|
}
|
|
15643
15647
|
/** 结束编辑并隐藏操作柄,不改变当前模型数据。 */
|
|
15644
15648
|
endEdit() {
|
|
15645
15649
|
this.clearSelection(), this.disableModelEditing();
|
|
15646
15650
|
}
|
|
15651
|
+
/** 获取当前显示操作柄的模型 ID;没有选中模型时返回 null。 */
|
|
15652
|
+
getSelectedModelId() {
|
|
15653
|
+
return this.selectedModelId;
|
|
15654
|
+
}
|
|
15647
15655
|
/** 按材质槽位或精确名称替换贴图;同名材质会一并替换并持久化。 */
|
|
15648
15656
|
async replaceMaterial(e, t, i) {
|
|
15649
15657
|
const n = this.requireRecord(e);
|
|
@@ -15656,8 +15664,8 @@ class Ml {
|
|
|
15656
15664
|
this.saveHistory(), await Promise.all(o.map(async (r) => {
|
|
15657
15665
|
const l = s[r], c = await new Oe().loadAsync(i);
|
|
15658
15666
|
c.colorSpace = Ke, l.map = c, l.needsUpdate = !0;
|
|
15659
|
-
const
|
|
15660
|
-
|
|
15667
|
+
const d = n.data.materials.find((u) => u.materialIndex === r);
|
|
15668
|
+
d ? (d.materialName = l.name || void 0, d.mapUrl = i) : n.data.materials.push({ materialIndex: r, materialName: l.name || void 0, mapUrl: i });
|
|
15661
15669
|
})), this.requestRender();
|
|
15662
15670
|
}
|
|
15663
15671
|
/** 获取模型可替换的材质槽位和名称,供业务层按名称替换前查询。 */
|
|
@@ -15793,12 +15801,16 @@ class Ml {
|
|
|
15793
15801
|
for (; r && !r.userData.modelPlaceId; ) r = r.parent;
|
|
15794
15802
|
r?.userData.modelPlaceId ? this.editModel(r.userData.modelPlaceId) : this.clearSelection();
|
|
15795
15803
|
}
|
|
15796
|
-
/** Esc
|
|
15804
|
+
/** 处理第三方模型编辑快捷键:Tab 切换操作柄,Esc 清除当前选中,Ctrl/Command+Z 撤回。 */
|
|
15797
15805
|
handleKeyDown(e) {
|
|
15798
15806
|
if (this.isUndoShortcut(e)) {
|
|
15799
15807
|
e.preventDefault(), this.undo().catch((t) => console.error("第三方模型撤回失败:", t));
|
|
15800
15808
|
return;
|
|
15801
15809
|
}
|
|
15810
|
+
if (this.isTransformModeShortcut(e)) {
|
|
15811
|
+
e.preventDefault(), this.switchTransformMode(e.shiftKey ? -1 : 1);
|
|
15812
|
+
return;
|
|
15813
|
+
}
|
|
15802
15814
|
(e.key === "Escape" || e.keyCode === 27) && this.editingEnabled && this.selectedModelId && this.clearSelection();
|
|
15803
15815
|
}
|
|
15804
15816
|
/** Ctrl+Z / Command+Z 仅在非文本输入焦点且存在历史时接管,避免影响表单编辑。 */
|
|
@@ -15807,6 +15819,17 @@ class Ml {
|
|
|
15807
15819
|
const t = e.target;
|
|
15808
15820
|
return t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? "") ? !1 : this.modelTransforms.length > 0 && !this.isUndoing;
|
|
15809
15821
|
}
|
|
15822
|
+
/** 仅在操作柄实际显示且非文本输入焦点时接管 Tab,避免破坏常规表单焦点导航。 */
|
|
15823
|
+
isTransformModeShortcut(e) {
|
|
15824
|
+
if (e.key !== "Tab" || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
15825
|
+
const t = e.target;
|
|
15826
|
+
return t?.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t?.tagName ?? "") ? !1 : this.editingEnabled && this.selectedModelId != null && this.transformHelper?.visible === !0;
|
|
15827
|
+
}
|
|
15828
|
+
/** 按移动、旋转、缩放顺序循环切换;Shift+Tab 可反向切换。 */
|
|
15829
|
+
switchTransformMode(e) {
|
|
15830
|
+
const t = ["translate", "rotate", "scale"], i = this.transformControl?.mode, s = (Math.max(0, t.indexOf(i ?? "translate")) + e + t.length) % t.length;
|
|
15831
|
+
this.transformControl?.setMode(t[s]), this.requestRender();
|
|
15832
|
+
}
|
|
15810
15833
|
/** 隐藏当前操作柄,但不关闭编辑模式。 */
|
|
15811
15834
|
clearSelection() {
|
|
15812
15835
|
this.selectedModelId = null, this.transformControl?.detach(), this.transformHelper && (this.transformHelper.visible = !1), this.requestRender();
|
|
@@ -15981,15 +16004,15 @@ class El {
|
|
|
15981
16004
|
constructor(e) {
|
|
15982
16005
|
if (window.THREE = tn, ao(), this.options = e, this.container = document.getElementById(e.containerId), !this.container)
|
|
15983
16006
|
throw new Error(`Container ${e.containerId} not found`);
|
|
15984
|
-
if (this.engineModelModule = new
|
|
16007
|
+
if (this.engineModelModule = new Ir(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) {
|
|
15985
16008
|
const o = this.renderer;
|
|
15986
16009
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
15987
16010
|
}
|
|
15988
16011
|
this.controlModule = new Qs(this), this.controlModule.switchDefaultMode(), this.controls = this.controlModule.orbitControls, this.clipping = new va(this), this.clipping.init(), this.composerModule = new to(this), this.composerModule.init(), this.events = new or();
|
|
15989
16012
|
const t = this.events.trigger.bind(this.events);
|
|
15990
16013
|
this.events.trigger = ((o, r) => {
|
|
15991
|
-
t(o, r), String(o) !== String(
|
|
15992
|
-
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new
|
|
16014
|
+
t(o, r), String(o) !== String(ye.EngineBusy) && this.requestComposerRender();
|
|
16015
|
+
}), this.engineStatus = new sr(this), this.engineStatus.init(), this.loaderModule = new Se(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 It(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 La(this), this.minMap = new Aa(this), this.linkElement2d3d = new Da(this), this.linkView2d3d = new Ia(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));
|
|
15993
16016
|
let i = document.createElement("div");
|
|
15994
16017
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
15995
16018
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -15997,11 +16020,11 @@ class El {
|
|
|
15997
16020
|
this.handleWindowResize();
|
|
15998
16021
|
}, window.addEventListener("resize", this.onWindowResize);
|
|
15999
16022
|
let s = this;
|
|
16000
|
-
this.bindControlEvents(this.controls), this.events.on(
|
|
16023
|
+
this.bindControlEvents(this.controls), this.events.on(ye.LoadingCompleted, (o) => {
|
|
16001
16024
|
s.modelEdge.active();
|
|
16002
|
-
}), this.events.on(
|
|
16025
|
+
}), this.events.on(ye.EngineBusy, () => {
|
|
16003
16026
|
s.requestComposerRender();
|
|
16004
|
-
}), this.events.on(
|
|
16027
|
+
}), this.events.on(ye.EngineFree, () => {
|
|
16005
16028
|
s.requestComposerRender();
|
|
16006
16029
|
}), this.animate = () => {
|
|
16007
16030
|
if (this.isRenderingPaused = !1, !this.isRenderingPaused)
|
|
@@ -16043,9 +16066,9 @@ class El {
|
|
|
16043
16066
|
if (this.boundControl === e || (this.boundControl?.removeEventListener && this.controlEventHandlers && (this.boundControl.removeEventListener("start", this.controlEventHandlers.start), this.boundControl.removeEventListener("end", this.controlEventHandlers.end), this.boundControl.removeEventListener("change", this.controlEventHandlers.change)), this.boundControl = e, this.controlEventHandlers = null, !e?.addEventListener))
|
|
16044
16067
|
return;
|
|
16045
16068
|
const t = () => {
|
|
16046
|
-
this.renderer && (this.renderer.interactionActive = !0), this.events.trigger(
|
|
16069
|
+
this.renderer && (this.renderer.interactionActive = !0), this.events.trigger(ye.EngineBusy), this.container && (this.container.style.cursor = "none");
|
|
16047
16070
|
}, i = () => {
|
|
16048
|
-
this.renderer && (this.renderer.interactionActive = !1), this.events.trigger(
|
|
16071
|
+
this.renderer && (this.renderer.interactionActive = !1), this.events.trigger(ye.EngineFree), this.container && (this.container.style.cursor = "default");
|
|
16049
16072
|
}, n = () => {
|
|
16050
16073
|
if (!this.camera)
|
|
16051
16074
|
return;
|
|
@@ -16073,7 +16096,7 @@ class El {
|
|
|
16073
16096
|
* 通过 viewToken 解析 3D 模型地址,再复用现有 loaderModule URL 加载逻辑。
|
|
16074
16097
|
*/
|
|
16075
16098
|
async loadModelByViewToken(e, t) {
|
|
16076
|
-
const i = await
|
|
16099
|
+
const i = await Is(
|
|
16077
16100
|
this.options,
|
|
16078
16101
|
e,
|
|
16079
16102
|
"3d"
|
|
@@ -16164,14 +16187,14 @@ class El {
|
|
|
16164
16187
|
if (this.camera === this.cameraModule.perspectiveCamera)
|
|
16165
16188
|
this.cameraModule.perspectiveCamera.aspect = l, this.cameraModule.perspectiveCamera.updateProjectionMatrix(), this.camera = this.cameraModule.perspectiveCamera;
|
|
16166
16189
|
else if (this.camera === this.cameraModule.orthographicCamera) {
|
|
16167
|
-
const c = this.cameraModule.orthographicCamera,
|
|
16168
|
-
this.cameraModule.setOrthographicVisibleHeight(
|
|
16190
|
+
const c = this.cameraModule.orthographicCamera, d = this.cameraModule.getOrthographicVisibleHeight(c);
|
|
16191
|
+
this.cameraModule.setOrthographicVisibleHeight(d, c, l), c.updateProjectionMatrix();
|
|
16169
16192
|
}
|
|
16170
16193
|
if (this.composerModule && (typeof this.composerModule.resize == "function" ? this.composerModule.resize(e, t) : this.composerModule.composer && this.composerModule.composer.setSize(e, t)), this.catchSvg && this.catchSvg.setAttribute("viewBox", `0 0 ${e} ${t}`), this.fabricDraw && this.fabricDraw.resize(e, t), this.camera.position.copy(i), this.camera.quaternion.copy(n), this.camera.up.copy(s), this.camera.updateMatrix(), this.camera.updateMatrixWorld(!0), o && this.controls?.target && this.controls.target.copy(o), r && this.controlModule?.orbitControls?.origin && this.controlModule.orbitControls.origin.copy(r), this.controlModule?.orbitControls) {
|
|
16171
16194
|
const c = this.controlModule.orbitControls;
|
|
16172
16195
|
c._lastPosition?.copy?.(this.camera.position), c._lastTarget?.copy?.(c.target), c._lastUp?.copy?.(this.camera.up), c._lastQuaternion?.copy?.(this.camera.quaternion), c._lastZoom = this.camera.zoom;
|
|
16173
16196
|
}
|
|
16174
|
-
this.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.(), this.controlModule?.firstPersonControls?.syncSharedTargetFromCamera?.(), this.controlModule?.thirdPersonControls?.syncRotationStateFromCamera?.(), this.controlModule?.thirdPersonControls?.syncSharedTargetFromAvatar?.(), this.events && this.events.trigger(
|
|
16197
|
+
this.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.(), this.controlModule?.firstPersonControls?.syncSharedTargetFromCamera?.(), this.controlModule?.thirdPersonControls?.syncRotationStateFromCamera?.(), this.controlModule?.thirdPersonControls?.syncSharedTargetFromAvatar?.(), this.events && this.events.trigger(ye.ViewportResize, { width: e, height: t });
|
|
16175
16198
|
}
|
|
16176
16199
|
/**
|
|
16177
16200
|
* 销毁引擎,释放资源,
|