iflow-engine-base-3d 4.0.6 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as ki, G as pe, P as Xt, O as Be, M as F, V as d, e as et, T as
|
|
2
|
-
import { W as fe, C as
|
|
3
|
-
import { r as ee, g as
|
|
4
|
-
import { a as ei, J as Ci, c as
|
|
5
|
-
class
|
|
1
|
+
import { S as ki, G as pe, P as Xt, O as Be, M as F, V as d, e as et, T as Wn, C as Ws, W as Li, a as Gs, b as We, N as Bi, c as qs, d as lt, f as W, Q as Te, E as Gn, R as me, g as tt, h as qn, B as R, i as zi, A as Kn, j as H, k as z, I as V, l as ri, m as ai, n as jn, o as Yn, L as Qt, p as Ks, q as js, r as Ys, s as Yi, D as re, t as Xi, u as Xs, F as Qs, v as xe, w as Xn, x as Qn, y as Ri, z as $s, H as $n, J as ae, K as Zs, U as Js, X as Et, Y as eo, Z as Zn, _ as to, $ as Ie, a0 as At, a1 as it, a2 as Xe, a3 as $t, a4 as Oi, a5 as Z, a6 as oe, a7 as St, a8 as io, a9 as nt, aa as wi, ab as Ge, ac as Lt, ad as no, ae as so, af as bi, ag as pt, ah as oo, ai as ut, aj as ro, ak as ao, al as Jn, am as Zt, an as Pt, ao as Jt, ap as lo, aq as Qi, ar as Tt, as as It, at as co, au as ho, av as $i, aw as uo, ax as po, ay as mo, az as go, aA as fo, aB as yo, aC as Mo, aD as vo, aE as xo, aF as wo, aG as es, aH as bo, aI as Co, aJ as Eo, aK as Ao, aL as So, aM as Po, aN as To, aO as Io, aP as _o, aQ as Do } from "./three-vendor-UroN9p1L.js";
|
|
2
|
+
import { W as fe, C as ko, L as Mt, B as Zi, g as Oe, a as Lo, E as Bo, r as zo } from "./sdk-runtime-D_LD_zQX.js";
|
|
3
|
+
import { r as ee, g as Ro } from "./sdk-assets-DHhjv3WO.js";
|
|
4
|
+
import { a as ei, J as Ci, c as Oo, b as Fo, P as li, q as No, k as Ho, n as Ji, E as en, S as Vo } from "./sdk-vendor-DYgn7sFs.js";
|
|
5
|
+
class Uo {
|
|
6
6
|
engine;
|
|
7
7
|
scene;
|
|
8
8
|
constructor(e) {
|
|
@@ -358,7 +358,7 @@ class ie {
|
|
|
358
358
|
l(), h.start(), u();
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class Wo {
|
|
362
362
|
engine;
|
|
363
363
|
deviceType;
|
|
364
364
|
constructor(e) {
|
|
@@ -423,30 +423,36 @@ class Uo {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
const Fi = 1.1;
|
|
426
|
-
function
|
|
426
|
+
function ts(a) {
|
|
427
427
|
if (a?.deviceModule?.isMobile?.() !== !0)
|
|
428
428
|
return window.devicePixelRatio || 1;
|
|
429
429
|
const e = Number(a?.options?.limit_memory);
|
|
430
|
-
return !Number.isFinite(e) || e <= 4 ?
|
|
430
|
+
return !Number.isFinite(e) || e <= 4 ? 0.8 : e >= 8 || e >= 6 ? 2 : 1;
|
|
431
431
|
}
|
|
432
|
-
|
|
432
|
+
function tn(a) {
|
|
433
|
+
if (a?.deviceModule?.isMobile?.() !== !0)
|
|
434
|
+
return !0;
|
|
435
|
+
const e = Number(a?.options?.limit_memory);
|
|
436
|
+
return !(!Number.isFinite(e) || e <= 4);
|
|
437
|
+
}
|
|
438
|
+
class Go {
|
|
433
439
|
engine;
|
|
434
440
|
renderer;
|
|
435
441
|
watermark;
|
|
436
442
|
constructor(e) {
|
|
437
|
-
this.engine = e, this.renderer = null, this.watermark = new
|
|
443
|
+
this.engine = e, this.renderer = null, this.watermark = new ko(Wn);
|
|
438
444
|
}
|
|
439
445
|
createRenderer() {
|
|
440
446
|
const { width: e, height: t } = this.engine.deviceModule.getContainerSize();
|
|
441
|
-
return this.engine.deviceModule.isMobile(),
|
|
447
|
+
return this.engine.deviceModule.isMobile(), Ws.enabled = !0, this.renderer = new Li({
|
|
442
448
|
// 原生 MSAA 主要覆盖非后处理路径;后处理链路的边缘由 composer 的 samples 和 FXAA 继续处理。
|
|
443
449
|
antialias: this.engine.options.antialias ?? !0,
|
|
444
450
|
alpha: !0,
|
|
445
451
|
premultipliedAlpha: !1,
|
|
446
452
|
stencil: !0,
|
|
447
453
|
// iOS 保留 drawing buffer 会长期占用额外帧缓冲;移动端优先保证大模型稳定加载。
|
|
448
|
-
preserveDrawingBuffer:
|
|
449
|
-
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t, !1), this.renderer.setPixelRatio(
|
|
454
|
+
preserveDrawingBuffer: tn(this.engine)
|
|
455
|
+
}), this.renderer.setClearColor(0, 0), this.renderer.setSize(e, t, !1), this.renderer.setPixelRatio(ts(this.engine)), this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%", this.renderer.domElement.style.display = "block", this.renderer.shadowMap.enabled = tn(this.engine), this.renderer.shadowMap.type = Gs, this.renderer.localClippingEnabled = !0, this.renderer.outputColorSpace = We, this.renderer.toneMapping = Bi, this.renderer.toneMappingExposure = Fi, this.engine.container.appendChild(this.renderer.domElement), this.renderer;
|
|
450
456
|
}
|
|
451
457
|
disposeRenderer() {
|
|
452
458
|
this.watermark.dispose(), this.renderer?.dispose();
|
|
@@ -458,14 +464,14 @@ class Wo {
|
|
|
458
464
|
this.renderer && this.watermark.render(this.renderer);
|
|
459
465
|
}
|
|
460
466
|
}
|
|
461
|
-
const
|
|
467
|
+
const qo = { type: "change" }, nn = { type: "start" }, sn = { type: "end" }, $ = 1e-6, ci = Math.PI * 2, de = {
|
|
462
468
|
NONE: -1,
|
|
463
469
|
ROTATE: 0,
|
|
464
470
|
PAN: 1,
|
|
465
471
|
DOLLY: 2,
|
|
466
472
|
TOUCH_ROTATE: 3,
|
|
467
473
|
TOUCH_DOLLY_PAN: 4
|
|
468
|
-
}, hi = new d(1, 0, 0),
|
|
474
|
+
}, hi = new d(1, 0, 0), Ko = new d(0, 1, 0), jo = new d(0, 0, 1), ct = new d(), Ot = new d(), Ae = new d(), X = new d(), De = new d(), ge = new d(), ke = new d(), Yo = new d(), Ft = new Te(), di = new Te(), on = /* @__PURE__ */ new Set([
|
|
469
475
|
"KeyW",
|
|
470
476
|
"KeyA",
|
|
471
477
|
"KeyS",
|
|
@@ -482,7 +488,7 @@ const Go = { type: "change" }, tn = { type: "start" }, nn = { type: "end" }, $ =
|
|
|
482
488
|
function Nt(a, e, t) {
|
|
483
489
|
return Math.max(e, Math.min(t, a));
|
|
484
490
|
}
|
|
485
|
-
function
|
|
491
|
+
function rn(a) {
|
|
486
492
|
return {
|
|
487
493
|
width: Math.max(a?.clientWidth || 1, 1),
|
|
488
494
|
height: Math.max(a?.clientHeight || 1, 1)
|
|
@@ -491,11 +497,11 @@ function on(a) {
|
|
|
491
497
|
function Ye(a) {
|
|
492
498
|
return a && typeof a.x == "number" && typeof a.y == "number" && typeof a.z == "number";
|
|
493
499
|
}
|
|
494
|
-
function
|
|
500
|
+
function an(a) {
|
|
495
501
|
const e = a?.tagName?.toLowerCase?.();
|
|
496
502
|
return a?.isContentEditable === !0 || e === "input" || e === "textarea" || e === "select";
|
|
497
503
|
}
|
|
498
|
-
class
|
|
504
|
+
class is extends qs {
|
|
499
505
|
constructor(e, t, i = null) {
|
|
500
506
|
super(t, i), this.engine = e, this.target = new d(), this.origin = new d(), this.cursor = new d(), this.showOriginIcon = !0, this.auto = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.enableRotate = !0, this.enablePan = !0, this.enableZoom = !0, this.enableDamping = !1, this.rotateSpeed = 0.51, this.panSpeed = 1, this.zoomSpeed = 1, this.touchZoomSpeed = 1.35, this.dampingFactor = 0.08, this.keyRotateSpeed = 1, this.keyPanSpeed = 7, this.keyMoveSpeed = 0.5, this.keyMoveBoost = 2, this.keys = {
|
|
501
507
|
LEFT: "ArrowLeft",
|
|
@@ -543,7 +549,7 @@ class ts extends Gs {
|
|
|
543
549
|
const i = typeof e == "number" ? e : null, n = typeof e == "boolean" ? e : !!t, s = this._applyPendingMotion(i);
|
|
544
550
|
this._alignCamera();
|
|
545
551
|
const o = n || s || this._hasCameraStateChanged();
|
|
546
|
-
return o && (this.dispatchEvent(
|
|
552
|
+
return o && (this.dispatchEvent(qo), this._rememberState()), o;
|
|
547
553
|
}
|
|
548
554
|
_applyPendingMotion(e) {
|
|
549
555
|
let t = !1;
|
|
@@ -600,8 +606,8 @@ class ts extends Gs {
|
|
|
600
606
|
ct.copy(n).sub(i), ct.lengthSq() < $ && ct.set(0, 0, Math.max(this.minDistance, 1)), Ot.copy(this.target).sub(i), ge.copy(this.target).sub(n).normalize(), Math.abs(e) > $ && (Ft.setFromAxisAngle(this._referenceUp, -e), ct.applyQuaternion(Ft), Ot.applyQuaternion(Ft), ge.applyQuaternion(Ft).normalize()), X.copy(this._getStableRightAxis(ge)), Math.abs(t) > $ && X.lengthSq() > $ && (di.setFromAxisAngle(X, -t), ct.applyQuaternion(di), Ot.applyQuaternion(di)), n.copy(i).add(ct), this.target.copy(i).add(Ot);
|
|
601
607
|
}
|
|
602
608
|
_applyPan(e, t) {
|
|
603
|
-
const { width: i, height: n } =
|
|
604
|
-
X.copy(hi).applyQuaternion(this.object.quaternion).normalize(), De.copy(
|
|
609
|
+
const { width: i, height: n } = rn(this.domElement);
|
|
610
|
+
X.copy(hi).applyQuaternion(this.object.quaternion).normalize(), De.copy(Ko).applyQuaternion(this.object.quaternion).normalize();
|
|
605
611
|
let s = 0, o = 0;
|
|
606
612
|
if (this.object.isPerspectiveCamera) {
|
|
607
613
|
const l = 2 * Math.max(this.object.position.distanceTo(this.target), $) * Math.tan(F.degToRad(this.object.getEffectiveFOV() * 0.5)), c = l * this.object.aspect;
|
|
@@ -627,10 +633,10 @@ class ts extends Gs {
|
|
|
627
633
|
ge.copy(this.target).sub(this.object.position), !(ge.lengthSq() < $) && (ge.normalize(), X.copy(this._getStableRightAxis(ge)), De.crossVectors(X, ge).normalize(), De.lengthSq() < $ && De.copy(this._referenceUp), this._viewRight.copy(X), this.object.up.copy(De), this.object.lookAt(this.target), this.object.updateMatrixWorld());
|
|
628
634
|
}
|
|
629
635
|
_getStableRightAxis(e) {
|
|
630
|
-
return X.crossVectors(e, this._referenceUp), X.lengthSq() < $ && (X.copy(this._viewRight), X.addScaledVector(e, -X.dot(e))), X.lengthSq() < $ && (X.copy(hi), X.addScaledVector(e, -X.dot(e))), X.lengthSq() < $ && (X.copy(
|
|
636
|
+
return X.crossVectors(e, this._referenceUp), X.lengthSq() < $ && (X.copy(this._viewRight), X.addScaledVector(e, -X.dot(e))), X.lengthSq() < $ && (X.copy(hi), X.addScaledVector(e, -X.dot(e))), X.lengthSq() < $ && (X.copy(jo), X.addScaledVector(e, -X.dot(e))), X.normalize(), this._viewRight.lengthSq() > $ && X.dot(this._viewRight) < 0 && X.negate(), X;
|
|
631
637
|
}
|
|
632
638
|
_getRotatePivot() {
|
|
633
|
-
return Ye(this.origin) ? this.origin.distanceToSquared(this.target) < $ ? this.target :
|
|
639
|
+
return Ye(this.origin) ? this.origin.distanceToSquared(this.target) < $ ? this.target : Yo.copy(this.origin) : this.target;
|
|
634
640
|
}
|
|
635
641
|
_hasCameraStateChanged() {
|
|
636
642
|
const e = this.object.isOrthographicCamera && Math.abs(this.object.zoom - this._lastZoom) > $;
|
|
@@ -643,10 +649,10 @@ class ts extends Gs {
|
|
|
643
649
|
return e != null ? ci / 60 * this.autoRotateSpeed * e : ci / 3600 * this.autoRotateSpeed;
|
|
644
650
|
}
|
|
645
651
|
_beginInteraction(e) {
|
|
646
|
-
this._isInteracting || (this.dispatchEvent(
|
|
652
|
+
this._isInteracting || (this.dispatchEvent(nn), this._isInteracting = !0), this.state = e;
|
|
647
653
|
}
|
|
648
654
|
_endInteraction() {
|
|
649
|
-
this._isInteracting && (this._isInteracting = !1, this.state = de.NONE, this.dispatchEvent(
|
|
655
|
+
this._isInteracting && (this._isInteracting = !1, this.state = de.NONE, this.dispatchEvent(sn));
|
|
650
656
|
}
|
|
651
657
|
_handleContextMenu(e) {
|
|
652
658
|
e.preventDefault();
|
|
@@ -689,14 +695,14 @@ class ts extends Gs {
|
|
|
689
695
|
}
|
|
690
696
|
}
|
|
691
697
|
_handleWheel(e) {
|
|
692
|
-
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(
|
|
698
|
+
!this.enabled || !this.enableZoom || (e.preventDefault(), this.dispatchEvent(nn), this._queueZoom(Math.sign(e.deltaY)), this.update(), this.dispatchEvent(sn));
|
|
693
699
|
}
|
|
694
700
|
_handleKeyDown(e) {
|
|
695
701
|
if (!this.enabled)
|
|
696
702
|
return;
|
|
697
703
|
const t = e.code || e.key;
|
|
698
|
-
if (this.object?.isPerspectiveCamera &&
|
|
699
|
-
|
|
704
|
+
if (this.object?.isPerspectiveCamera && on.has(t)) {
|
|
705
|
+
an(e.target) || (this._pressedKeys.add(t), this._startKeyboardMoveLoop(), e.preventDefault());
|
|
700
706
|
return;
|
|
701
707
|
}
|
|
702
708
|
let i = !1;
|
|
@@ -718,7 +724,7 @@ class ts extends Gs {
|
|
|
718
724
|
}
|
|
719
725
|
_handleKeyUp(e) {
|
|
720
726
|
const t = e.code || e.key;
|
|
721
|
-
|
|
727
|
+
on.has(t) && (this._pressedKeys.delete(t), this._pressedKeys.size === 0 && this._stopKeyboardMoveLoop(), this.object?.isPerspectiveCamera && !an(e.target) && e.preventDefault());
|
|
722
728
|
}
|
|
723
729
|
_handleTouchStart() {
|
|
724
730
|
const e = Array.from(this._pointers.values());
|
|
@@ -767,7 +773,7 @@ class ts extends Gs {
|
|
|
767
773
|
_queueRotate(e, t) {
|
|
768
774
|
if (!this.enableRotate || !this.domElement)
|
|
769
775
|
return;
|
|
770
|
-
const { height: i } =
|
|
776
|
+
const { height: i } = rn(this.domElement), n = ci / i;
|
|
771
777
|
this._rotateVelocity.x += e * n * this.rotateSpeed, this._rotateVelocity.y += t * n * this.rotateSpeed;
|
|
772
778
|
}
|
|
773
779
|
_queuePan(e, t) {
|
|
@@ -777,7 +783,7 @@ class ts extends Gs {
|
|
|
777
783
|
this.enableZoom && (this._zoomVelocity += e);
|
|
778
784
|
}
|
|
779
785
|
}
|
|
780
|
-
class
|
|
786
|
+
class ln extends Gn {
|
|
781
787
|
constructor(e, t, i, n) {
|
|
782
788
|
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this._rayOriginOffset = new d(0, -1, 0), this._camerLocalDirection = new d(), this._tmpVector = new d(), this._lookDirection = new d(), this._rayCaster = new me(), this._fallingTime = 0, this._isMouseInElement = !1, this._euler = new tt(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(
|
|
783
789
|
new d(0, 0, -1).applyQuaternion(this.camera.quaternion).normalize().multiplyScalar(this._sharedTargetDistance)
|
|
@@ -1139,7 +1145,7 @@ class an extends Wn {
|
|
|
1139
1145
|
return r;
|
|
1140
1146
|
}
|
|
1141
1147
|
}
|
|
1142
|
-
const
|
|
1148
|
+
const Xo = ee("/assets/worker_walk.glb", import.meta.url), Qo = Math.PI, $o = {
|
|
1143
1149
|
16: "ShiftLeft",
|
|
1144
1150
|
37: "ArrowLeft",
|
|
1145
1151
|
38: "ArrowUp",
|
|
@@ -1163,9 +1169,9 @@ const Yo = ee("/assets/worker_walk.glb", import.meta.url), Xo = Math.PI, Qo = {
|
|
|
1163
1169
|
jump: ["Space"],
|
|
1164
1170
|
boost: ["ShiftLeft", "ShiftRight"]
|
|
1165
1171
|
};
|
|
1166
|
-
class
|
|
1172
|
+
class cn extends Gn {
|
|
1167
1173
|
constructor(e, t, i, n = {}) {
|
|
1168
|
-
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new d(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookHorizontalFlag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new d(), this._moveDirection = new d(), this._rayCaster = new me(), this._cameraRayCaster = new me(), this._cameraCollisionFrame = 0, this._lastCameraSafeDistance = null, this._fallingTime = 0, this._isMouseInElement = !1, this._prevMouseX = 0, this._prevMouseY = 0, this._dragRotateThreshold = n.dragRotateThreshold ?? 2, this._pointerLookActive = !1, this._externalLookActive = !1, this._scriptedMotionActive = !1, this._interactionActive = !1, this._yaw = 0, this._pitch = n.initialPitch ?? 0, this._pressedKeys = /* @__PURE__ */ new Set(), this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = 0, this.avatarRoot = new pe(), this.avatarRoot.name = "ThirdPersonAvatarRoot", this.avatarRoot.visible = n.visible ?? !0, this.avatarMixer = null, this.avatarWalkAction = null, this._isWalkActionPlaying = !1, this._avatarAnimationTimer = new
|
|
1174
|
+
super(), this._Engine = e, this.camera = t, this.object = t, this.domElement = i, this._isEnabled = !1, this.target = new d(), this.auto = !1, this.applyGravity = n.applyGravity ?? !0, this.gravityMinHeight = !0, this.applyCollision = n.applyCollision ?? !0, this.positionEasing = !0, this.lookflag = 1, this.lookHorizontalFlag = 1, this.lookSpeed = n.lookSpeed ?? 3e-3, this.moveSpeed = n.moveSpeed ?? 0.02, this.playerHeight = n.playerHeight ?? 1.6, this.playerRadius = n.playerRadius ?? 0.3, this.cameraDistance = n.cameraDistance ?? 2, this.cameraHeight = n.cameraHeight ?? 0, this.targetHeight = n.targetHeight ?? this.playerHeight, this.cameraCollisionTargetHeight = n.cameraCollisionTargetHeight ?? this.playerHeight + 0.1, this.cameraCollisionInterval = Math.max(1, Math.floor(n.cameraCollisionInterval ?? 20)), this.cameraCollisionPadding = n.cameraCollisionPadding ?? 0.15, this.minCameraCollisionDistance = n.minCameraCollisionDistance ?? 0.35, this.jumpSpeed = n.jumpSpeed ?? 0.24, this.jumpGravity = n.jumpGravity ?? 0.012, this.maxRotateX = n.maxPitch ?? Math.PI * 0.45, this.minPitch = n.minPitch ?? -Math.PI * 0.38, this.g = 9.8, this._moveInput = new d(), this._moveDirection = new d(), this._rayCaster = new me(), this._cameraRayCaster = new me(), this._cameraCollisionFrame = 0, this._lastCameraSafeDistance = null, this._fallingTime = 0, this._isMouseInElement = !1, this._prevMouseX = 0, this._prevMouseY = 0, this._dragRotateThreshold = n.dragRotateThreshold ?? 2, this._pointerLookActive = !1, this._externalLookActive = !1, this._scriptedMotionActive = !1, this._interactionActive = !1, this._yaw = 0, this._pitch = n.initialPitch ?? 0, this._pressedKeys = /* @__PURE__ */ new Set(), this._verticalVelocity = 0, this._isJumping = !1, this._isJumpKeyDown = !1, this._jumpStartHeight = 0, this.avatarRoot = new pe(), this.avatarRoot.name = "ThirdPersonAvatarRoot", this.avatarRoot.visible = n.visible ?? !0, this.avatarMixer = null, this.avatarWalkAction = null, this._isWalkActionPlaying = !1, this._avatarAnimationTimer = new qn(), this._avatarAnimationTimer.connect(document), this._avatarLoadRequestId = 0, this.defaultAvatarUrl = n.avatarUrl ?? Xo, 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);
|
|
1169
1175
|
const s = this.isPcDevice();
|
|
1170
1176
|
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();
|
|
1171
1177
|
}
|
|
@@ -1226,7 +1232,7 @@ class ln extends Wn {
|
|
|
1226
1232
|
alignToFeet: !0,
|
|
1227
1233
|
fitToPlayerHeight: !0,
|
|
1228
1234
|
ownsResources: !0,
|
|
1229
|
-
yawOffset:
|
|
1235
|
+
yawOffset: Qo,
|
|
1230
1236
|
...t
|
|
1231
1237
|
}), this.setupAvatarAnimation(o, s.animations || []);
|
|
1232
1238
|
},
|
|
@@ -1240,7 +1246,7 @@ class ln extends Wn {
|
|
|
1240
1246
|
setupAvatarAnimation(e, t) {
|
|
1241
1247
|
if (!t.length)
|
|
1242
1248
|
return;
|
|
1243
|
-
this.avatarMixer = new
|
|
1249
|
+
this.avatarMixer = new Kn(e);
|
|
1244
1250
|
const i = t.find((n) => /walk|run|move/i.test(n.name)) || t[0];
|
|
1245
1251
|
this.avatarWalkAction = this.avatarMixer.clipAction(i), this.avatarWalkAction.enabled = !0, this.avatarWalkAction.clampWhenFinished = !1, this.avatarWalkAction.setEffectiveWeight(1), this.avatarWalkAction.paused = !0, this.avatarWalkAction.play(), this._avatarAnimationTimer.reset();
|
|
1246
1252
|
}
|
|
@@ -1345,7 +1351,7 @@ class ln extends Wn {
|
|
|
1345
1351
|
}
|
|
1346
1352
|
}
|
|
1347
1353
|
getEventCode(e) {
|
|
1348
|
-
return e.code ||
|
|
1354
|
+
return e.code || $o[e.keyCode] || e.key || "";
|
|
1349
1355
|
}
|
|
1350
1356
|
hasPressed(e) {
|
|
1351
1357
|
return e.some((t) => this._pressedKeys.has(t));
|
|
@@ -1602,11 +1608,11 @@ class ln extends Wn {
|
|
|
1602
1608
|
});
|
|
1603
1609
|
}
|
|
1604
1610
|
}
|
|
1605
|
-
const Ei = "__isModelUrlGroup", ti = "__modelDepthBias",
|
|
1606
|
-
function
|
|
1611
|
+
const Ei = "__isModelUrlGroup", ti = "__modelDepthBias", ns = 4;
|
|
1612
|
+
function ss(a) {
|
|
1607
1613
|
return a.__modelGroupMap instanceof Map || (a.__modelGroupMap = /* @__PURE__ */ new Map()), a.__modelGroupMap;
|
|
1608
1614
|
}
|
|
1609
|
-
function
|
|
1615
|
+
function os(a) {
|
|
1610
1616
|
return a.__modelObjectIndexMap instanceof Map || (a.__modelObjectIndexMap = /* @__PURE__ */ new Map()), a.__modelObjectIndexMap;
|
|
1611
1617
|
}
|
|
1612
1618
|
function Ai(a, e) {
|
|
@@ -1625,7 +1631,7 @@ function vt(a, e, t) {
|
|
|
1625
1631
|
i != null && (Array.isArray(i.urls) || (i.urls = []), i.urls.includes(t) || i.urls.push(t));
|
|
1626
1632
|
}
|
|
1627
1633
|
function $e(a, e) {
|
|
1628
|
-
const t =
|
|
1634
|
+
const t = ss(a), i = t.get(e);
|
|
1629
1635
|
if (i && i.parent != null)
|
|
1630
1636
|
return i;
|
|
1631
1637
|
const n = Hi(a, e);
|
|
@@ -1643,11 +1649,11 @@ function ot(a, e) {
|
|
|
1643
1649
|
if (t != null)
|
|
1644
1650
|
return t;
|
|
1645
1651
|
const i = new pe();
|
|
1646
|
-
Ai(i, e), a.scene.add(i),
|
|
1652
|
+
Ai(i, e), a.scene.add(i), ss(a).set(e, i);
|
|
1647
1653
|
const s = Hi(a, e);
|
|
1648
1654
|
return s != null && (s.group = i), i;
|
|
1649
1655
|
}
|
|
1650
|
-
function
|
|
1656
|
+
function Zo(a) {
|
|
1651
1657
|
const e = [], t = /* @__PURE__ */ new Set();
|
|
1652
1658
|
return (Array.isArray(a?.models) ? a.models : []).forEach((n) => {
|
|
1653
1659
|
if (n?.url == null)
|
|
@@ -1660,7 +1666,7 @@ function $o(a) {
|
|
|
1660
1666
|
}
|
|
1661
1667
|
function _t(a, e) {
|
|
1662
1668
|
const t = [], i = /* @__PURE__ */ new Set();
|
|
1663
|
-
return
|
|
1669
|
+
return Zo(a).forEach((s) => {
|
|
1664
1670
|
s.traverse((o) => {
|
|
1665
1671
|
o === s || i.has(o.uuid) || e(o) && (i.add(o.uuid), t.push(o));
|
|
1666
1672
|
});
|
|
@@ -1677,7 +1683,7 @@ function _t(a, e) {
|
|
|
1677
1683
|
function Vi(a) {
|
|
1678
1684
|
return _t(a, (e) => e instanceof z && !(e instanceof V));
|
|
1679
1685
|
}
|
|
1680
|
-
function
|
|
1686
|
+
function Jo(a) {
|
|
1681
1687
|
if (typeof a.__modelObjectIndexSeed == "number")
|
|
1682
1688
|
return;
|
|
1683
1689
|
let e = -1;
|
|
@@ -1685,24 +1691,24 @@ function Zo(a) {
|
|
|
1685
1691
|
typeof t?.index == "number" && Number.isFinite(t.index) && (e = Math.max(e, t.index));
|
|
1686
1692
|
}), a.__modelObjectIndexSeed = e + 1;
|
|
1687
1693
|
}
|
|
1688
|
-
function
|
|
1689
|
-
|
|
1694
|
+
function er(a) {
|
|
1695
|
+
Jo(a);
|
|
1690
1696
|
const e = a.__modelObjectIndexSeed;
|
|
1691
1697
|
return a.__modelObjectIndexSeed += 1, e;
|
|
1692
1698
|
}
|
|
1693
1699
|
function Ui(a, e, t) {
|
|
1694
|
-
const i = typeof t == "number" ? t :
|
|
1695
|
-
return e.index = i,
|
|
1700
|
+
const i = typeof t == "number" ? t : er(a);
|
|
1701
|
+
return e.index = i, os(a).set(i, e), i;
|
|
1696
1702
|
}
|
|
1697
|
-
function
|
|
1703
|
+
function rs(a) {
|
|
1698
1704
|
return Array.isArray(a) ? a : a != null ? [a] : [];
|
|
1699
1705
|
}
|
|
1700
|
-
function
|
|
1706
|
+
function tr(a) {
|
|
1701
1707
|
return 1 + (Number.isFinite(a) ? Math.abs(Math.floor(a)) : 0) % 16 * 0.125;
|
|
1702
1708
|
}
|
|
1703
1709
|
function Wi(a, e) {
|
|
1704
|
-
const t = typeof e == "number" ? e : a?.index, i =
|
|
1705
|
-
|
|
1710
|
+
const t = typeof e == "number" ? e : a?.index, i = tr(t);
|
|
1711
|
+
rs(a?.material).forEach((n) => {
|
|
1706
1712
|
n.userData = n.userData ?? {};
|
|
1707
1713
|
const s = n.userData[ti] ?? {};
|
|
1708
1714
|
n.userData[ti] = {
|
|
@@ -1710,30 +1716,30 @@ function Wi(a, e) {
|
|
|
1710
1716
|
enabled: !0,
|
|
1711
1717
|
factor: 1,
|
|
1712
1718
|
units: i
|
|
1713
|
-
}, n.polygonOffset = !0, n.polygonOffsetFactor = 1, n.polygonOffsetUnits = i + (s.edgeActive ?
|
|
1719
|
+
}, n.polygonOffset = !0, n.polygonOffsetFactor = 1, n.polygonOffsetUnits = i + (s.edgeActive ? ns : 0), n.needsUpdate = !0;
|
|
1714
1720
|
});
|
|
1715
1721
|
}
|
|
1716
|
-
function
|
|
1717
|
-
|
|
1722
|
+
function hn(a, e) {
|
|
1723
|
+
rs(a?.material).forEach((t) => {
|
|
1718
1724
|
t.userData = t.userData ?? {};
|
|
1719
1725
|
const i = t.userData[ti] ?? {}, n = i.enabled ? i.units : t.polygonOffsetUnits ?? 0, s = i.enabled ? i.factor : t.polygonOffsetFactor ?? 1;
|
|
1720
1726
|
t.userData[ti] = {
|
|
1721
1727
|
...i,
|
|
1722
1728
|
edgeActive: e
|
|
1723
|
-
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ?
|
|
1729
|
+
}, i.enabled || e ? (t.polygonOffset = !1, t.polygonOffsetFactor = s, t.polygonOffsetUnits = n + (e ? ns : 0)) : t.polygonOffset = !1, t.needsUpdate = !0;
|
|
1724
1730
|
});
|
|
1725
1731
|
}
|
|
1726
1732
|
function Le(a, e) {
|
|
1727
1733
|
if (!Number.isFinite(e))
|
|
1728
1734
|
return;
|
|
1729
|
-
const t =
|
|
1735
|
+
const t = os(a), i = t.get(e);
|
|
1730
1736
|
if (i && i.parent != null)
|
|
1731
1737
|
return i;
|
|
1732
1738
|
i && i.parent == null && t.delete(e);
|
|
1733
1739
|
const n = _t(a, (s) => s.index === e)[0];
|
|
1734
1740
|
return n != null ? (t.set(e, n), n) : a?.scene?.children?.find?.((s) => s?.index === e);
|
|
1735
1741
|
}
|
|
1736
|
-
class
|
|
1742
|
+
class ir {
|
|
1737
1743
|
constructor(e) {
|
|
1738
1744
|
this.engine = e;
|
|
1739
1745
|
}
|
|
@@ -1956,7 +1962,7 @@ function Gi(a) {
|
|
|
1956
1962
|
touchControlsSnapshot: null,
|
|
1957
1963
|
mouseMoveFrame: null,
|
|
1958
1964
|
latestMouseMoveEvent: null
|
|
1959
|
-
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new
|
|
1965
|
+
}, t = 800, i = 28, n = 132, s = 44, o = 168, r = new ir(a);
|
|
1960
1966
|
e.handle_catch = function(v, A, B = !0, U = !0) {
|
|
1961
1967
|
const Y = e.options;
|
|
1962
1968
|
e.options = {
|
|
@@ -2224,7 +2230,7 @@ function Gi(a) {
|
|
|
2224
2230
|
e.lastPoint = null;
|
|
2225
2231
|
}, e;
|
|
2226
2232
|
}
|
|
2227
|
-
class
|
|
2233
|
+
class nr {
|
|
2228
2234
|
engine;
|
|
2229
2235
|
orbitControls;
|
|
2230
2236
|
firstPersonControls;
|
|
@@ -2250,7 +2256,7 @@ class ir {
|
|
|
2250
2256
|
this.engine = e, this.init(), this.handelBehaved = Gi(this.engine), this.handelBehaved.init(this, null), this.handelBehaved.active();
|
|
2251
2257
|
}
|
|
2252
2258
|
init() {
|
|
2253
|
-
this.orbitControls = new
|
|
2259
|
+
this.orbitControls = new is(this.engine, this.engine.camera, this.engine.renderer.domElement), this.orbitControls.showOriginIcon = !0, this.firstPersonControls = new ln(this.engine, this.engine.camera, this.engine.renderer.domElement), this.thirdPersonControls = new cn(this.engine, this.engine.camera, this.engine.renderer.domElement), this.applyRoamLookDirection(this.firstPersonControls), this.applyRoamLookDirection(this.thirdPersonControls);
|
|
2254
2260
|
const e = document.createElement("div");
|
|
2255
2261
|
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(${ee("/assets/svg/rotate-orbit.svg", import.meta.url)})`, this.engine.container.appendChild(this.originDiv);
|
|
2256
2262
|
}
|
|
@@ -2312,7 +2318,7 @@ class ir {
|
|
|
2312
2318
|
}
|
|
2313
2319
|
// 切换第一人称漫游模式
|
|
2314
2320
|
switchFirstPersonMode() {
|
|
2315
|
-
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new
|
|
2321
|
+
this.engine.cameraModule.switchToPerspectiveCamera(), this.firstPersonControls && (this.firstPersonControls.sanitizeCameraOrientation?.(), this.firstPersonControls.enabled = !1), this.thirdPersonControls && (this.thirdPersonControls.enabled = !1), this.firstPersonControls = new ln(
|
|
2316
2322
|
this.engine,
|
|
2317
2323
|
this.engine.camera,
|
|
2318
2324
|
this.engine.renderer.domElement,
|
|
@@ -2329,7 +2335,7 @@ class ir {
|
|
|
2329
2335
|
applyCollision: t?.applyCollision,
|
|
2330
2336
|
applyGravity: t?.applyGravity
|
|
2331
2337
|
};
|
|
2332
|
-
return t?.dispose?.(), this.thirdPersonControls = new
|
|
2338
|
+
return t?.dispose?.(), this.thirdPersonControls = new cn(
|
|
2333
2339
|
this.engine,
|
|
2334
2340
|
this.engine.camera,
|
|
2335
2341
|
this.engine.renderer.domElement,
|
|
@@ -2546,7 +2552,7 @@ class ir {
|
|
|
2546
2552
|
this.isActive = !1, this.handelBehaved?.disActive?.(), this.orbitControls?.dispose?.(), this.firstPersonControls?.dispose?.(), this.thirdPersonControls?.dispose?.(), this.removeMobileRoamControls(), this.originDiv?.remove(), this.originDiv = null, this.orbitControls = null, this.firstPersonControls = null, this.thirdPersonControls = null, this.handelBehaved = null;
|
|
2547
2553
|
}
|
|
2548
2554
|
}
|
|
2549
|
-
const
|
|
2555
|
+
const sr = {
|
|
2550
2556
|
uniforms: {
|
|
2551
2557
|
tDiffuse: { value: null },
|
|
2552
2558
|
saturation: { value: 1.2 },
|
|
@@ -2582,8 +2588,8 @@ const nr = {
|
|
|
2582
2588
|
gl_FragColor = color;
|
|
2583
2589
|
}
|
|
2584
2590
|
`
|
|
2585
|
-
},
|
|
2586
|
-
class
|
|
2591
|
+
}, as = 0.5, ls = 1.1, cs = 1;
|
|
2592
|
+
class or {
|
|
2587
2593
|
engine;
|
|
2588
2594
|
composer;
|
|
2589
2595
|
saturationPass;
|
|
@@ -2668,16 +2674,16 @@ class sr {
|
|
|
2668
2674
|
this.composer && (this.syncAmbientOcclusionDepthTextures(), this.composer.render());
|
|
2669
2675
|
}
|
|
2670
2676
|
init() {
|
|
2671
|
-
const { width: e, height: t } = this.engine.deviceModule.getContainerSize(), i = this.engine.scene, n = this.engine.camera, s = this.engine.renderer, o = this.engine.deviceModule.isMobile(), r = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1, l = o ? this.engine.mobileMemoryProfile.samples : 4, c = new
|
|
2677
|
+
const { width: e, height: t } = this.engine.deviceModule.getContainerSize(), i = this.engine.scene, n = this.engine.camera, s = this.engine.renderer, o = this.engine.deviceModule.isMobile(), r = this.engine.renderer?.getPixelRatio?.() ?? window.devicePixelRatio ?? 1, l = o ? this.engine.mobileMemoryProfile.samples : 4, c = new jn(e, t, {
|
|
2672
2678
|
minFilter: Qt,
|
|
2673
2679
|
magFilter: Qt,
|
|
2674
|
-
format:
|
|
2680
|
+
format: Yn,
|
|
2675
2681
|
// 移动端按设备内存控制多重采样,平衡边缘质量与全分辨率缓冲占用。
|
|
2676
2682
|
samples: l
|
|
2677
2683
|
});
|
|
2678
|
-
c.texture.colorSpace =
|
|
2679
|
-
const h = new
|
|
2680
|
-
this.composer.addPass(h), this.gtaoPass = new Yi(i, n, e, t), this.gtaoPass.output = Yi.OUTPUT.Default, this.gtaoPass.blendIntensity =
|
|
2684
|
+
c.texture.colorSpace = Ks, this.composer = new js(s, c), this.composer.setPixelRatio(r), this.composer.setSize(e, t);
|
|
2685
|
+
const h = new Ys(i, n);
|
|
2686
|
+
this.composer.addPass(h), this.gtaoPass = new Yi(i, n, e, t), this.gtaoPass.output = Yi.OUTPUT.Default, this.gtaoPass.blendIntensity = as, this.gtaoPass.enabled = !1, this.gtaoPass.normalMaterial.side = re, this.gtaoPass.normalMaterial.needsUpdate = !0, this.excludeClippingHelpersFromGtao(this.gtaoPass), this.gtaoPass.updateGtaoMaterial && this.gtaoPass.updateGtaoMaterial({
|
|
2681
2687
|
// AO 采样半径。推荐范围:0.1 ~ 2.0。
|
|
2682
2688
|
// 越大遮蔽范围越广,但容易发灰、丢细节;对性能有轻到中等影响。
|
|
2683
2689
|
radius: 0.45,
|
|
@@ -2703,7 +2709,7 @@ class sr {
|
|
|
2703
2709
|
samples: 32,
|
|
2704
2710
|
rings: 3,
|
|
2705
2711
|
radiusExponent: 2
|
|
2706
|
-
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new Xi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = Xi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.excludeClippingHelpersFromGtao(this.ssaoPass), this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new ai(
|
|
2712
|
+
}), this.applyClippingToAmbientOcclusionPass(this.gtaoPass), this.composer.addPass(this.gtaoPass), this.ssaoPass = new Xi(i, n, e, t), this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 5e-3, this.ssaoPass.maxDistance = 0.1, this.ssaoPass.output = Xi.OUTPUT.Default, this.ssaoPass.enabled = !1, this.excludeClippingHelpersFromGtao(this.ssaoPass), this.applyClippingToAmbientOcclusionPass(this.ssaoPass), this.composer.addPass(this.ssaoPass), this.saturationPass = new ai(sr), this.saturationPass.uniforms.saturation.value = ls, this.saturationPass.uniforms.contrast.value = cs, this.saturationPass.enabled = !1, this.composer.addPass(this.saturationPass), this.outputPass = new Xs(), this.outputPass.enabled = !0, this.composer.addPass(this.outputPass), this.fxaaPass = new ai(Qs), this.fxaaPass.material.uniforms.resolution.value.x = 1 / (e * r), this.fxaaPass.material.uniforms.resolution.value.y = 1 / (t * r), this.fxaaPass.enabled = o, this.composer.addPass(this.fxaaPass), this.syncAmbientOcclusionDepthTextures();
|
|
2707
2713
|
}
|
|
2708
2714
|
}
|
|
2709
2715
|
function Dt(a) {
|
|
@@ -2713,7 +2719,7 @@ function Dt(a) {
|
|
|
2713
2719
|
i = n[1];
|
|
2714
2720
|
a.name = t, a.guid = i;
|
|
2715
2721
|
}
|
|
2716
|
-
function
|
|
2722
|
+
function rr(a, e, t, i) {
|
|
2717
2723
|
const r = a.models.find((x) => x.url == t);
|
|
2718
2724
|
if (r == null)
|
|
2719
2725
|
return;
|
|
@@ -2724,7 +2730,7 @@ function or(a, e, t, i) {
|
|
|
2724
2730
|
}, x.rotation = { x: 0, y: 0, z: 0 }, x), M = (x, m) => {
|
|
2725
2731
|
if (!Array.isArray(m) || m.length === 0)
|
|
2726
2732
|
return;
|
|
2727
|
-
const b = m.map((S) => y(S)), C =
|
|
2733
|
+
const b = m.map((S) => y(S)), C = lr(x, l, b, t, a);
|
|
2728
2734
|
C != null && b.forEach((S, I) => {
|
|
2729
2735
|
const P = [[C, I, 0, 0]];
|
|
2730
2736
|
S.indexes = P, S.id = Number(S.id);
|
|
@@ -2732,9 +2738,9 @@ function or(a, e, t, i) {
|
|
|
2732
2738
|
Dt(L), r.nodesMap.set(Number(S.id), L), c.push(Number(S.id));
|
|
2733
2739
|
});
|
|
2734
2740
|
};
|
|
2735
|
-
M("Circle", h), M("Rect", u), M("Ellipse", g), M("Bridge", p),
|
|
2741
|
+
M("Circle", h), M("Rect", u), M("Ellipse", g), M("Bridge", p), ar(r, c);
|
|
2736
2742
|
}
|
|
2737
|
-
function
|
|
2743
|
+
function ar(a, e) {
|
|
2738
2744
|
if (e.length === 0 || !Array.isArray(a?.lods))
|
|
2739
2745
|
return;
|
|
2740
2746
|
const i = a.lods[0]?.octreeBox;
|
|
@@ -2746,7 +2752,7 @@ function rr(a, e) {
|
|
|
2746
2752
|
n.has(s) || (i.elements.push(s), n.add(s));
|
|
2747
2753
|
});
|
|
2748
2754
|
}
|
|
2749
|
-
function
|
|
2755
|
+
function lr(a, e, t, i, n) {
|
|
2750
2756
|
let s;
|
|
2751
2757
|
const o = {
|
|
2752
2758
|
width: 1,
|
|
@@ -2824,7 +2830,7 @@ function ar(a, e, t, i, n) {
|
|
|
2824
2830
|
return r.meshs = p, r.instanceMatrix && r.instanceMatrix.array && (r.cloneInstanceMatrix = Array.from(r.instanceMatrix.array)), r.instanceMatrix.needsUpdate = !0, l;
|
|
2825
2831
|
}
|
|
2826
2832
|
function Ht(a, e) {
|
|
2827
|
-
const t = new
|
|
2833
|
+
const t = new Xn();
|
|
2828
2834
|
switch (e.width = e.width * 0.3048, e.height = e.height * 0.3048, e.diameter = e.diameter * 0.3048, a) {
|
|
2829
2835
|
case "Rect":
|
|
2830
2836
|
t.moveTo(-e.width / 2, -e.height / 2), t.lineTo(-e.width / 2, e.height / 2), t.lineTo(e.width / 2, e.height / 2), t.lineTo(e.width / 2, -e.height / 2), t.lineTo(-e.width / 2, -e.height / 2);
|
|
@@ -2845,7 +2851,7 @@ function Ht(a, e) {
|
|
|
2845
2851
|
};
|
|
2846
2852
|
return n(t, i, e.color, e.position, e.rotation);
|
|
2847
2853
|
function n(s, o, r, l, c) {
|
|
2848
|
-
const h = new
|
|
2854
|
+
const h = new Qn(s, o), u = new Ri({
|
|
2849
2855
|
// MEP 最终颜色由 instanceColor 乘算,基础材质保持白色才能避免二次染色。
|
|
2850
2856
|
color: 16777215,
|
|
2851
2857
|
metalness: 0,
|
|
@@ -2857,69 +2863,69 @@ function Ht(a, e) {
|
|
|
2857
2863
|
}
|
|
2858
2864
|
}
|
|
2859
2865
|
var se = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.ModelPlaceSelected = "model-place-selected", a.ModelCalibrationChanged = "model-calibration-changed", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.MeasureClick = "measure-click", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(se || {});
|
|
2860
|
-
const
|
|
2861
|
-
function
|
|
2866
|
+
const dn = "__bvhAccelerationInstalled", hs = "__bvhBuildFailed", cr = "__bvhBuilt", hr = "__bvhTriangleCount", ds = 200, dr = 10;
|
|
2867
|
+
function ur() {
|
|
2862
2868
|
const a = globalThis;
|
|
2863
|
-
a[
|
|
2869
|
+
a[dn] !== !0 && (z.prototype.raycast = $s, ae.prototype.computeBoundsTree = $n, ae.prototype.disposeBoundsTree = Zs, a[dn] = !0);
|
|
2864
2870
|
}
|
|
2865
|
-
function
|
|
2871
|
+
function pr(a) {
|
|
2866
2872
|
a.firstHitOnly = !0;
|
|
2867
2873
|
}
|
|
2868
|
-
function
|
|
2874
|
+
function mr(a) {
|
|
2869
2875
|
delete a.firstHitOnly;
|
|
2870
2876
|
}
|
|
2871
|
-
function
|
|
2877
|
+
function gr(a, e = ds) {
|
|
2872
2878
|
if (a == null)
|
|
2873
2879
|
return !1;
|
|
2874
2880
|
const t = a;
|
|
2875
|
-
if (t.boundsTree != null || t.userData?.[
|
|
2881
|
+
if (t.boundsTree != null || t.userData?.[hs] === !0)
|
|
2876
2882
|
return !1;
|
|
2877
2883
|
const i = a.attributes.position?.count ?? 0;
|
|
2878
2884
|
return (a.index?.count ?? i) / 3 >= e;
|
|
2879
2885
|
}
|
|
2880
|
-
function
|
|
2886
|
+
function fr(a) {
|
|
2881
2887
|
if (a == null)
|
|
2882
2888
|
return 0;
|
|
2883
2889
|
const e = a.attributes.position?.count ?? 0;
|
|
2884
2890
|
return (a.index?.count ?? e) / 3;
|
|
2885
2891
|
}
|
|
2886
|
-
function
|
|
2892
|
+
function yr(a, e = {}) {
|
|
2887
2893
|
if (a == null)
|
|
2888
2894
|
return;
|
|
2889
|
-
const t = e.triangleThreshold ??
|
|
2890
|
-
if (!
|
|
2895
|
+
const t = e.triangleThreshold ?? ds;
|
|
2896
|
+
if (!gr(a, t)) {
|
|
2891
2897
|
e.setBoundingBox === !0 && a.boundingBox == null && a.computeBoundingBox(), e.setBoundingSphere === !0 && a.boundingSphere == null && a.computeBoundingSphere();
|
|
2892
2898
|
return;
|
|
2893
2899
|
}
|
|
2894
2900
|
const i = a;
|
|
2895
2901
|
try {
|
|
2896
|
-
i.userData = i.userData ?? {}, i.userData[
|
|
2902
|
+
i.userData = i.userData ?? {}, i.userData[hr] = fr(a), e.setBoundingBox === !0 && a.boundingBox == null && a.computeBoundingBox(), e.setBoundingSphere === !0 && a.boundingSphere == null && a.computeBoundingSphere(), $n.call(i, {
|
|
2897
2903
|
// 对外继续兼容旧字段,内部改用 three-mesh-bvh 0.9.10 的新参数名。
|
|
2898
|
-
maxLeafSize: e.maxLeafTris ??
|
|
2899
|
-
}), i.userData[
|
|
2904
|
+
maxLeafSize: e.maxLeafTris ?? dr
|
|
2905
|
+
}), i.userData[cr] = i.boundsTree != null;
|
|
2900
2906
|
} catch (n) {
|
|
2901
|
-
i.userData = i.userData ?? {}, i.userData[
|
|
2907
|
+
i.userData = i.userData ?? {}, i.userData[hs] = !0, console.warn("[raycastAcceleration] failed to build bounds tree", n);
|
|
2902
2908
|
}
|
|
2903
2909
|
}
|
|
2904
|
-
let gt = null, ft = null,
|
|
2905
|
-
const
|
|
2906
|
-
function
|
|
2910
|
+
let gt = null, ft = null, un = null;
|
|
2911
|
+
const Mr = 8, us = 24, vr = 24, xr = 64, wr = 240, br = 2, pn = /* @__PURE__ */ new WeakSet(), Cr = 10;
|
|
2912
|
+
function ps() {
|
|
2907
2913
|
return ee("draco/", import.meta.url);
|
|
2908
2914
|
}
|
|
2909
|
-
function
|
|
2915
|
+
function ms() {
|
|
2910
2916
|
return ee("basis/", import.meta.url);
|
|
2911
2917
|
}
|
|
2912
|
-
function
|
|
2913
|
-
return gt == null && (gt = new
|
|
2914
|
-
}
|
|
2915
|
-
function Er(a) {
|
|
2916
|
-
return ft == null && (ft = new eo(), ft.setTranscoderPath(ps())), dn !== a && (ft.detectSupport(a), dn = a), ft;
|
|
2918
|
+
function Er() {
|
|
2919
|
+
return gt == null && (gt = new Zn(), gt.setDecoderPath(ps()), gt.preload()), gt;
|
|
2917
2920
|
}
|
|
2918
2921
|
function Ar(a) {
|
|
2922
|
+
return ft == null && (ft = new to(), ft.setTranscoderPath(ms())), un !== a && (ft.detectSupport(a), un = a), ft;
|
|
2923
|
+
}
|
|
2924
|
+
function Sr(a) {
|
|
2919
2925
|
const e = new zi();
|
|
2920
|
-
return e.setDRACOLoader(
|
|
2926
|
+
return e.setDRACOLoader(Er()), e.setMeshoptDecoder(eo), a?.renderer != null && e.setKTX2Loader(Ar(a.renderer)), e;
|
|
2921
2927
|
}
|
|
2922
|
-
function
|
|
2928
|
+
function gs() {
|
|
2923
2929
|
return new Promise((a) => {
|
|
2924
2930
|
if (typeof requestAnimationFrame == "function") {
|
|
2925
2931
|
requestAnimationFrame(() => a());
|
|
@@ -2928,20 +2934,20 @@ function ms() {
|
|
|
2928
2934
|
setTimeout(a, 16);
|
|
2929
2935
|
});
|
|
2930
2936
|
}
|
|
2931
|
-
function
|
|
2937
|
+
function Pr() {
|
|
2932
2938
|
const a = navigator?.scheduling;
|
|
2933
2939
|
return typeof a?.isInputPending == "function" ? a.isInputPending() : !1;
|
|
2934
2940
|
}
|
|
2935
|
-
function
|
|
2936
|
-
return a?.engineStatus?.isFree === !1 ||
|
|
2941
|
+
function Tr(a) {
|
|
2942
|
+
return a?.engineStatus?.isFree === !1 || Pr();
|
|
2937
2943
|
}
|
|
2938
2944
|
async function Ze(a, e, t) {
|
|
2939
2945
|
if (e)
|
|
2940
2946
|
return t;
|
|
2941
2947
|
const i = performance.now();
|
|
2942
|
-
return
|
|
2948
|
+
return Tr(a) || i - t >= Mr ? (await gs(), performance.now()) : t;
|
|
2943
2949
|
}
|
|
2944
|
-
function
|
|
2950
|
+
function Ir(a, e) {
|
|
2945
2951
|
return new Promise((t, i) => {
|
|
2946
2952
|
Mt(a, (n) => {
|
|
2947
2953
|
if (n == null) {
|
|
@@ -2954,7 +2960,7 @@ function Tr(a, e) {
|
|
|
2954
2960
|
}, e);
|
|
2955
2961
|
});
|
|
2956
2962
|
}
|
|
2957
|
-
async function
|
|
2963
|
+
async function fs(a, e) {
|
|
2958
2964
|
const t = await ei({
|
|
2959
2965
|
method: "get",
|
|
2960
2966
|
responseType: "arraybuffer",
|
|
@@ -2963,33 +2969,33 @@ async function gs(a, e) {
|
|
|
2963
2969
|
let i = t.data;
|
|
2964
2970
|
return Zi.isEncrypted(t.data) && (i = await Zi.decryptPzEnc(t.data, e)), Ci.loadAsync(i);
|
|
2965
2971
|
}
|
|
2966
|
-
function
|
|
2972
|
+
function mn(a) {
|
|
2967
2973
|
return a.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
2968
2974
|
}
|
|
2969
|
-
function
|
|
2970
|
-
const t = new Set(e.map((i) =>
|
|
2975
|
+
function ys(a, e) {
|
|
2976
|
+
const t = new Set(e.map((i) => mn(i)));
|
|
2971
2977
|
for (const i of Object.keys(a.files))
|
|
2972
|
-
if (t.has(
|
|
2978
|
+
if (t.has(mn(i)))
|
|
2973
2979
|
return a.files[i];
|
|
2974
2980
|
return null;
|
|
2975
2981
|
}
|
|
2976
|
-
function
|
|
2977
|
-
const t =
|
|
2982
|
+
function gn(a, e) {
|
|
2983
|
+
const t = ys(a, e);
|
|
2978
2984
|
return t == null || t.dir ? Promise.resolve(null) : t.async("string");
|
|
2979
2985
|
}
|
|
2980
|
-
function
|
|
2986
|
+
function _r(a) {
|
|
2981
2987
|
const e = Object.values(a.files).find((t) => t != null && t.dir !== !0);
|
|
2982
2988
|
return e == null ? Promise.resolve(null) : e.async("string");
|
|
2983
2989
|
}
|
|
2984
|
-
function
|
|
2990
|
+
function Dr(a) {
|
|
2985
2991
|
return a.charCodeAt(0) === 65279 ? a.slice(1) : a;
|
|
2986
2992
|
}
|
|
2987
2993
|
function ii(a) {
|
|
2988
|
-
return JSON.parse(
|
|
2994
|
+
return JSON.parse(Dr(a));
|
|
2989
2995
|
}
|
|
2990
|
-
async function
|
|
2996
|
+
async function kr(a, e) {
|
|
2991
2997
|
try {
|
|
2992
|
-
const t = await
|
|
2998
|
+
const t = await fs(a, e), i = await _r(t);
|
|
2993
2999
|
if (i == null)
|
|
2994
3000
|
return { exists: !0, value: [] };
|
|
2995
3001
|
const n = ii(i);
|
|
@@ -2998,13 +3004,13 @@ async function Dr(a, e) {
|
|
|
2998
3004
|
return ei.isAxiosError(t) && t.response?.status === 404 ? { exists: !1 } : (console.warn("[loadLightModel] failed to load optional quota_list", { path: a, error: t }), { exists: !1 });
|
|
2999
3005
|
}
|
|
3000
3006
|
}
|
|
3001
|
-
function
|
|
3002
|
-
const t =
|
|
3007
|
+
function Lr(a, e) {
|
|
3008
|
+
const t = ys(a, e);
|
|
3003
3009
|
return t == null || t.dir ? Promise.resolve(null) : t.async("arraybuffer");
|
|
3004
3010
|
}
|
|
3005
|
-
function
|
|
3011
|
+
function Br(a, e) {
|
|
3006
3012
|
return new Promise((t, i) => {
|
|
3007
|
-
|
|
3013
|
+
Sr(a).parse(e, Ro(import.meta.url), t, i);
|
|
3008
3014
|
});
|
|
3009
3015
|
}
|
|
3010
3016
|
function mt(a, e) {
|
|
@@ -3022,34 +3028,34 @@ function kt(a) {
|
|
|
3022
3028
|
t.disposeBoundsTree?.(), t.dispose();
|
|
3023
3029
|
}), a.length = 0;
|
|
3024
3030
|
}
|
|
3025
|
-
function
|
|
3031
|
+
function Ms(a, e) {
|
|
3026
3032
|
const t = mt(a, e);
|
|
3027
3033
|
return Array.isArray(t?.lods) ? t.lods : [];
|
|
3028
3034
|
}
|
|
3029
|
-
function
|
|
3035
|
+
function vs(a) {
|
|
3030
3036
|
a.loadStatus == null && (a.loadStatus = {}), a.loadStatus.modelMep == null && (a.loadStatus.modelMep = !1), a.loadStatus.normal == null && (a.loadStatus.normal = !1), a.loadStatus.quotaList == null && (a.loadStatus.quotaList = !1);
|
|
3031
3037
|
}
|
|
3032
|
-
function
|
|
3033
|
-
return
|
|
3038
|
+
function zr(a) {
|
|
3039
|
+
return vs(a), a.status === "loaded" && a.loadStatus.normal === !0 && a.loadStatus.modelMep === !0 && a.loadStatus.quotaList === !0;
|
|
3034
3040
|
}
|
|
3035
3041
|
function xt(a) {
|
|
3036
3042
|
const e = a?.engineStatus?.models;
|
|
3037
|
-
!Array.isArray(e) || e.length === 0 || !e.every((i) =>
|
|
3043
|
+
!Array.isArray(e) || e.length === 0 || !e.every((i) => zr(i)) || a.__loadingCompletedTriggered === !0 || (a.__loadingCompletedTriggered = !0, a.events?.trigger?.(se.LoadingCompleted, {}));
|
|
3038
3044
|
}
|
|
3039
|
-
function
|
|
3045
|
+
function xs(a) {
|
|
3040
3046
|
return a === !0 || a === "loading";
|
|
3041
3047
|
}
|
|
3042
|
-
function
|
|
3048
|
+
function fn(a) {
|
|
3043
3049
|
return a.index != null ? a.index.count : a.attributes.position?.count ?? 0;
|
|
3044
3050
|
}
|
|
3045
|
-
async function
|
|
3051
|
+
async function Rr(a, e, t) {
|
|
3046
3052
|
let i = performance.now();
|
|
3047
3053
|
for (let n = 0; n < e.length; n++)
|
|
3048
3054
|
e[n]?.traverse?.((s) => {
|
|
3049
|
-
|
|
3050
|
-
}), (n + 1) %
|
|
3055
|
+
Cs(s?.material, a);
|
|
3056
|
+
}), (n + 1) % vr === 0 && (i = await Ze(a, t, i));
|
|
3051
3057
|
}
|
|
3052
|
-
async function
|
|
3058
|
+
async function Or(a, e, t) {
|
|
3053
3059
|
const i = [], n = [{ node: e.octreeBox, visited: !1 }];
|
|
3054
3060
|
let s = performance.now();
|
|
3055
3061
|
for (; n.length > 0; ) {
|
|
@@ -3070,13 +3076,13 @@ async function Rr(a, e, t) {
|
|
|
3070
3076
|
}
|
|
3071
3077
|
return i;
|
|
3072
3078
|
}
|
|
3073
|
-
async function
|
|
3079
|
+
async function Fr(a, e, t, i) {
|
|
3074
3080
|
if (ue(a, e.url, e.loadVersion))
|
|
3075
3081
|
return [];
|
|
3076
3082
|
const n = mt(a, e.url);
|
|
3077
3083
|
if (n?.nodesMap == null)
|
|
3078
3084
|
return [];
|
|
3079
|
-
const s = a.filterLoaderModel?.getContinueIdSet?.(e.url) ?? /* @__PURE__ */ new Set(), o = await
|
|
3085
|
+
const s = a.filterLoaderModel?.getContinueIdSet?.(e.url) ?? /* @__PURE__ */ new Set(), o = await Or(a, t, i);
|
|
3080
3086
|
console.log("[loadLightModel] pending mesh ids", t.path, o.length);
|
|
3081
3087
|
const r = [], l = a?.deviceModule?.isMobile?.() !== !0;
|
|
3082
3088
|
let c = performance.now(), h = 0;
|
|
@@ -3097,46 +3103,46 @@ async function Or(a, e, t, i) {
|
|
|
3097
3103
|
m.dispose();
|
|
3098
3104
|
continue;
|
|
3099
3105
|
}
|
|
3100
|
-
m.applyMatrix4(x), m.computeBoundingBox(), l && b.count > 2e4 &&
|
|
3106
|
+
m.applyMatrix4(x), m.computeBoundingBox(), l && b.count > 2e4 && yr(m, {
|
|
3101
3107
|
setBoundingSphere: !0
|
|
3102
3108
|
});
|
|
3103
3109
|
const C = new z(m, M.material);
|
|
3104
|
-
y.box = m.boundingBox?.clone(), y.mesh = C, C.name = Number(u), C.glb = y.glb, C.url = e.url, r.push(C), h++, h %
|
|
3110
|
+
y.box = m.boundingBox?.clone(), y.mesh = C, C.name = Number(u), C.glb = y.glb, C.url = e.url, r.push(C), h++, h % us === 0 && (c = await Ze(a, i, c));
|
|
3105
3111
|
}
|
|
3106
3112
|
}
|
|
3107
3113
|
return r;
|
|
3108
3114
|
}
|
|
3109
|
-
function
|
|
3115
|
+
function ws(a) {
|
|
3110
3116
|
const e = a.clone();
|
|
3111
3117
|
return e.clippingPlanes = a.clippingPlanes, e;
|
|
3112
3118
|
}
|
|
3113
|
-
function
|
|
3119
|
+
function Nr(a) {
|
|
3114
3120
|
a.setRGB(a.r, a.g, a.b, We);
|
|
3115
3121
|
}
|
|
3116
|
-
function
|
|
3122
|
+
function Hr(a) {
|
|
3117
3123
|
const e = a;
|
|
3118
|
-
e.color == null || a.userData.__displayColorLinearized === !0 || (
|
|
3124
|
+
e.color == null || a.userData.__displayColorLinearized === !0 || (Nr(e.color), a.userData.__displayColorLinearized = !0);
|
|
3119
3125
|
}
|
|
3120
|
-
function
|
|
3126
|
+
function Vr(a, e, t, i, n, s) {
|
|
3121
3127
|
const o = Et(
|
|
3122
3128
|
i.map((u) => u.geometry),
|
|
3123
3129
|
!1
|
|
3124
|
-
), r =
|
|
3130
|
+
), r = ws(n), l = new z(o, r);
|
|
3125
3131
|
s != null && (l.visible = !1, s.push(l)), l.castShadow = !0, l.receiveShadow = !0, ot(e, a).add(l);
|
|
3126
3132
|
const h = Ui(e, l);
|
|
3127
3133
|
return Wi(l, h), l.url = a, l.glb = t, l.materialClone = r, l.geometrys = i.map((u) => u.geometry), l.geometry.computeVertexNormals(), l;
|
|
3128
3134
|
}
|
|
3129
|
-
function
|
|
3135
|
+
function Ur(a, e, t, i) {
|
|
3130
3136
|
return ($e(a, e)?.children ?? a.scene.children).find((o) => {
|
|
3131
3137
|
const r = o;
|
|
3132
3138
|
return o instanceof z && r.url == e && r.glb == t && r.materialClone === i;
|
|
3133
3139
|
});
|
|
3134
3140
|
}
|
|
3135
|
-
function
|
|
3141
|
+
function Wr(a, e) {
|
|
3136
3142
|
const t = Array.isArray(a.geometrys) ? a.geometrys : [], i = e.map((o) => o.geometry), n = [...t, ...i], s = Et(n, !1);
|
|
3137
3143
|
a.geometry != null && a.geometry.dispose(), a.geometry = s, a.geometrys = n, a.castShadow = !0, a.receiveShadow = !0;
|
|
3138
3144
|
}
|
|
3139
|
-
async function
|
|
3145
|
+
async function Gr(a, e, t, i, n, s) {
|
|
3140
3146
|
if (ue(t, a, e)) {
|
|
3141
3147
|
kt(i);
|
|
3142
3148
|
return;
|
|
@@ -3149,7 +3155,7 @@ async function Wr(a, e, t, i, n, s) {
|
|
|
3149
3155
|
const r = mt(t, a);
|
|
3150
3156
|
let l = performance.now();
|
|
3151
3157
|
for (const [c, h] of o.entries()) {
|
|
3152
|
-
const u = n ? h.length :
|
|
3158
|
+
const u = n ? h.length : wr;
|
|
3153
3159
|
for (let p = 0; p < h.length; p += u) {
|
|
3154
3160
|
if (ue(t, a, e)) {
|
|
3155
3161
|
kt(i);
|
|
@@ -3158,13 +3164,13 @@ async function Wr(a, e, t, i, n, s) {
|
|
|
3158
3164
|
const g = h.slice(p, p + u);
|
|
3159
3165
|
if (g.length === 0)
|
|
3160
3166
|
continue;
|
|
3161
|
-
const y =
|
|
3162
|
-
let M =
|
|
3163
|
-
M = null, M != null ? (x = Array.isArray(M.geometrys) ? M.geometrys.length : 0, m =
|
|
3167
|
+
const y = ta(g[0].material, t);
|
|
3168
|
+
let M = Ur(t, a, c, y), x = 0, m = 0;
|
|
3169
|
+
M = null, M != null ? (x = Array.isArray(M.geometrys) ? M.geometrys.length : 0, m = fn(M.geometry), Wr(M, g)) : M = Vr(a, t, c, g, y, s);
|
|
3164
3170
|
const b = /* @__PURE__ */ new Map();
|
|
3165
3171
|
let C = m;
|
|
3166
3172
|
g.forEach((S, I) => {
|
|
3167
|
-
const P = Number(S.name), L =
|
|
3173
|
+
const P = Number(S.name), L = fn(S.geometry), k = b.get(P) ?? [];
|
|
3168
3174
|
if (k.push([C, C + L]), b.set(P, k), r?.nodesMap?.has(P)) {
|
|
3169
3175
|
const O = r.nodesMap.get(P);
|
|
3170
3176
|
O.indexes == null && (O.indexes = []), O.indexes.push([M.index, x + I, C, C + L]);
|
|
@@ -3177,25 +3183,25 @@ async function Wr(a, e, t, i, n, s) {
|
|
|
3177
3183
|
}
|
|
3178
3184
|
}
|
|
3179
3185
|
}
|
|
3180
|
-
function
|
|
3186
|
+
function qr(a, e) {
|
|
3181
3187
|
const t = a?.geometry;
|
|
3182
3188
|
return t instanceof ae ? (t.boundingBox == null && t.computeBoundingBox(), t.boundingBox?.clone().applyMatrix4(e) ?? null) : null;
|
|
3183
3189
|
}
|
|
3184
|
-
async function
|
|
3190
|
+
async function Kr(a, e, t, i, n, s, o, r) {
|
|
3185
3191
|
if (ue(i, a, e) || n == null || s == null || s.length === 0)
|
|
3186
3192
|
return;
|
|
3187
3193
|
const l = mt(i, a);
|
|
3188
3194
|
if (l == null)
|
|
3189
3195
|
return;
|
|
3190
3196
|
n.geometry.computeVertexNormals();
|
|
3191
|
-
const c = new V(n.geometry,
|
|
3197
|
+
const c = new V(n.geometry, ws(n.material), s.length);
|
|
3192
3198
|
r != null && (c.visible = !1, r.push(c)), ot(i, a).add(c);
|
|
3193
3199
|
const u = Ui(i, c);
|
|
3194
3200
|
Wi(c, u);
|
|
3195
3201
|
const p = new Float32Array(s.length * 3);
|
|
3196
3202
|
for (let M = 0; M < s.length; M++)
|
|
3197
3203
|
p[M * 3] = 1, p[M * 3 + 1] = 1, p[M * 3 + 2] = 1;
|
|
3198
|
-
c.instanceColor = new
|
|
3204
|
+
c.instanceColor = new Js(p, 3);
|
|
3199
3205
|
let g = performance.now();
|
|
3200
3206
|
const y = [];
|
|
3201
3207
|
for (let M = 0; M < s.length; M++) {
|
|
@@ -3205,7 +3211,7 @@ async function qr(a, e, t, i, n, s, o, r) {
|
|
|
3205
3211
|
}
|
|
3206
3212
|
const x = s[M], m = new H();
|
|
3207
3213
|
m.elements = x.matrix;
|
|
3208
|
-
const b =
|
|
3214
|
+
const b = qr(n, m);
|
|
3209
3215
|
if (b != null && (x.box = b.clone()), c.setMatrixAt(M, m), c.matrixs || (c.matrixs = []), c.matrixs.push(m.clone()), y.push(m.clone()), l.nodesMap.has(x.id)) {
|
|
3210
3216
|
const C = l.nodesMap.get(x.id);
|
|
3211
3217
|
C.indexes == null && (C.indexes = []), C.indexes.push([u, M, 0, 0]), Dt(C), b != null && C?.info != null && (C.info.box instanceof R ? C.info.box.union(b) : C.info.box = b.clone());
|
|
@@ -3218,11 +3224,11 @@ async function qr(a, e, t, i, n, s, o, r) {
|
|
|
3218
3224
|
};
|
|
3219
3225
|
Dt(C), l.nodesMap.set(x.id, C);
|
|
3220
3226
|
}
|
|
3221
|
-
(M + 1) %
|
|
3227
|
+
(M + 1) % xr === 0 && (g = await Ze(i, o, g));
|
|
3222
3228
|
}
|
|
3223
3229
|
c.instanceMatrix.needsUpdate = !0, c.instanceColor != null && (c.instanceColor.needsUpdate = !0), c.materialClone = c.material, c.url = a, c.glb = n.glb, c.ids = s.map((M) => M.id), c.matrixsClone = y, c.meshIndex = t, r == null && i.requestComposerRender?.();
|
|
3224
3230
|
}
|
|
3225
|
-
async function
|
|
3231
|
+
async function jr(a, e, t, i, n) {
|
|
3226
3232
|
const s = e.instanceNodes;
|
|
3227
3233
|
if (s == null)
|
|
3228
3234
|
return;
|
|
@@ -3239,7 +3245,7 @@ async function Kr(a, e, t, i, n) {
|
|
|
3239
3245
|
const u = Array.isArray(c.children) ? c.children.filter((p) => o.has(Number(p?.id)) === !1) : [];
|
|
3240
3246
|
if (u.length === 0)
|
|
3241
3247
|
continue;
|
|
3242
|
-
await
|
|
3248
|
+
await Kr(
|
|
3243
3249
|
a.url,
|
|
3244
3250
|
a.loadVersion,
|
|
3245
3251
|
c.mesh,
|
|
@@ -3255,30 +3261,30 @@ async function Kr(a, e, t, i, n) {
|
|
|
3255
3261
|
}
|
|
3256
3262
|
}
|
|
3257
3263
|
}
|
|
3258
|
-
async function
|
|
3264
|
+
async function Yr(a, e, t, i) {
|
|
3259
3265
|
if (t.status === !0 || t.meshPromise != null) {
|
|
3260
3266
|
await t.meshPromise;
|
|
3261
3267
|
return;
|
|
3262
3268
|
}
|
|
3263
3269
|
t.meshPromise = (async () => {
|
|
3264
3270
|
console.log(`[loadLightModel] start build lod meshes ${Date.now() - window.startTime}ms`);
|
|
3265
|
-
const n = a?.deviceModule?.isMobile?.() === !0 ? [] : void 0, s = await
|
|
3271
|
+
const n = a?.deviceModule?.isMobile?.() === !0 ? [] : void 0, s = await Fr(a, e, t, i);
|
|
3266
3272
|
if (ue(a, e.url, e.loadVersion)) {
|
|
3267
3273
|
kt(s);
|
|
3268
3274
|
return;
|
|
3269
3275
|
}
|
|
3270
|
-
if (await
|
|
3276
|
+
if (await jr(e, t, a, i, n), ue(a, e.url, e.loadVersion)) {
|
|
3271
3277
|
kt(s);
|
|
3272
3278
|
return;
|
|
3273
3279
|
}
|
|
3274
|
-
t.glbs = [], await
|
|
3280
|
+
t.glbs = [], await Gr(e.url, e.loadVersion, a, s, i, n), !ue(a, e.url, e.loadVersion) && (t.instanceNodes = null, t.status = !0, n?.forEach((o) => {
|
|
3275
3281
|
o.visible = !0;
|
|
3276
3282
|
}), a.requestComposerRender?.(), console.log(`[loadLightModel] *****************************************************finish build lod meshes ${Date.now() - window.startTime}ms`));
|
|
3277
3283
|
})().finally(() => {
|
|
3278
3284
|
t.meshPromise = null;
|
|
3279
3285
|
}), await t.meshPromise;
|
|
3280
3286
|
}
|
|
3281
|
-
async function
|
|
3287
|
+
async function Xr(a, e, t, i) {
|
|
3282
3288
|
if (t.loadSuccess !== !0) {
|
|
3283
3289
|
if (t.preparePromise != null) {
|
|
3284
3290
|
await t.preparePromise;
|
|
@@ -3288,9 +3294,9 @@ async function Yr(a, e, t, i) {
|
|
|
3288
3294
|
console.log("[loadLightModel] loading GLB bundle", t.path), t.glbs = t.glbs ?? {};
|
|
3289
3295
|
const n = e.url + t.path;
|
|
3290
3296
|
vt(a, e.url, n), console.log(`[loadLightModel] ZIP 解压开始 ${Date.now() - window.startTime}ms`);
|
|
3291
|
-
const s = await
|
|
3297
|
+
const s = await fs(n, e.key);
|
|
3292
3298
|
console.log(`[loadLightModel] ZIP 解压完成 ${Date.now() - window.startTime}ms`);
|
|
3293
|
-
const o = await
|
|
3299
|
+
const o = await gn(s, ["/nodes.json", "nodes.json"]);
|
|
3294
3300
|
if (o == null)
|
|
3295
3301
|
return;
|
|
3296
3302
|
const r = ii(o), l = mt(a, e.url);
|
|
@@ -3312,11 +3318,11 @@ async function Yr(a, e, t, i) {
|
|
|
3312
3318
|
continue;
|
|
3313
3319
|
S.infos.push(C), Dt(S);
|
|
3314
3320
|
}
|
|
3315
|
-
(b + 1) %
|
|
3321
|
+
(b + 1) % us === 0 && (c = await Ze(a, i, c));
|
|
3316
3322
|
}
|
|
3317
3323
|
}
|
|
3318
3324
|
const u = async (x) => {
|
|
3319
|
-
let m = await
|
|
3325
|
+
let m = await Lr(s, [`/${x}.glb`, `${x}.glb`, x + ".glb"]);
|
|
3320
3326
|
if (m == null) {
|
|
3321
3327
|
console.error("[loadLightModel] glb not found in zip", {
|
|
3322
3328
|
modelUrl: e.url,
|
|
@@ -3327,17 +3333,17 @@ async function Yr(a, e, t, i) {
|
|
|
3327
3333
|
return;
|
|
3328
3334
|
}
|
|
3329
3335
|
try {
|
|
3330
|
-
const b = await
|
|
3336
|
+
const b = await Br(a, m);
|
|
3331
3337
|
m = null, t.glbs[x] = b.scene.children, t.glbs[x].forEach((C) => {
|
|
3332
3338
|
C.matrixWorld;
|
|
3333
|
-
}), await
|
|
3339
|
+
}), await Rr(a, t.glbs[x], i);
|
|
3334
3340
|
} catch (b) {
|
|
3335
3341
|
console.error("[loadLightModel] failed to load glb", {
|
|
3336
3342
|
modelUrl: e.url,
|
|
3337
3343
|
lodPath: t.path,
|
|
3338
3344
|
glbKey: `${x}.glb`,
|
|
3339
|
-
dracoDecoderPath:
|
|
3340
|
-
basisTranscoderPath:
|
|
3345
|
+
dracoDecoderPath: ps(),
|
|
3346
|
+
basisTranscoderPath: ms(),
|
|
3341
3347
|
error: b
|
|
3342
3348
|
});
|
|
3343
3349
|
} finally {
|
|
@@ -3345,21 +3351,21 @@ async function Yr(a, e, t, i) {
|
|
|
3345
3351
|
}
|
|
3346
3352
|
};
|
|
3347
3353
|
let p = 0;
|
|
3348
|
-
const g = a?.deviceModule?.isMobile?.() === !0 ? 1 :
|
|
3354
|
+
const g = a?.deviceModule?.isMobile?.() === !0 ? 1 : br, y = Math.min(g, h.length);
|
|
3349
3355
|
await Promise.all(Array.from({ length: y }, async () => {
|
|
3350
3356
|
for (; p < h.length; ) {
|
|
3351
3357
|
const x = h[p++];
|
|
3352
3358
|
await u(x);
|
|
3353
3359
|
}
|
|
3354
3360
|
})), console.log(`[loadLightModel] 所有 GLB 加载完成 ${Date.now() - window.startTime}ms`);
|
|
3355
|
-
const M = await
|
|
3361
|
+
const M = await gn(s, ["/instances.json", "instances.json"]);
|
|
3356
3362
|
t.instanceNodes = M != null ? ii(M) : null, t.loadSuccess = !0;
|
|
3357
3363
|
})().finally(() => {
|
|
3358
3364
|
t.preparePromise = null;
|
|
3359
3365
|
}), await t.preparePromise;
|
|
3360
3366
|
}
|
|
3361
3367
|
}
|
|
3362
|
-
function
|
|
3368
|
+
function Qr(a, e, t) {
|
|
3363
3369
|
if (t.boundingBox || (t.boundingBox = new R(), t.boundingBox.min = new d(t.octreeBox.min.X, t.octreeBox.min.Z, -t.octreeBox.min.Y), t.boundingBox.max = new d(t.octreeBox.max.X, t.octreeBox.max.Z, -t.octreeBox.max.Y)), !t.maxSize)
|
|
3364
3370
|
return 1e3;
|
|
3365
3371
|
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 d(), c = new d(), h = new d(), u = new d();
|
|
@@ -3375,28 +3381,28 @@ function Xr(a, e, t) {
|
|
|
3375
3381
|
const g = u.clone().add(h.multiplyScalar(Math.max(p, r))), y = g.clone().add(l.setLength(t.maxSize)), M = new fe(e, a.renderer, a.scene).worldToScreen(g), x = new fe(e, a.renderer, a.scene).worldToScreen(y);
|
|
3376
3382
|
return M.distanceTo(x);
|
|
3377
3383
|
}
|
|
3378
|
-
async function
|
|
3379
|
-
ue(a, e.url, e.loadVersion) || t.maxSize < 1e6 && t.path != "/lod0" && (!(
|
|
3384
|
+
async function $r(a, e, t, i) {
|
|
3385
|
+
ue(a, e.url, e.loadVersion) || t.maxSize < 1e6 && t.path != "/lod0" && (!(Qr(a, a.camera, t) >= Cr) || t.status === !0) || (await Xr(a, e, t, i), !ue(a, e.url, e.loadVersion) && t.loadSuccess === !0 && await Yr(a, e, t, i));
|
|
3380
3386
|
}
|
|
3381
|
-
function
|
|
3382
|
-
if (
|
|
3387
|
+
function Zr(a, e, t) {
|
|
3388
|
+
if (xs(e.loadStatus.modelMep))
|
|
3383
3389
|
return;
|
|
3384
3390
|
const i = mt(a, e.url);
|
|
3385
3391
|
if (i == null)
|
|
3386
3392
|
return;
|
|
3387
3393
|
e.loadStatus.modelMep = "loading", i.modelMep == null && (i.modelMep = {}), (async () => {
|
|
3388
|
-
t || await
|
|
3394
|
+
t || await gs(), !ue(a, e.url, e.loadVersion) && (rr(a, i.modelMep, e.url), e.loadStatus.modelMep = !0, xt(a));
|
|
3389
3395
|
})().catch((s) => {
|
|
3390
3396
|
e.loadStatus.modelMep = !1, console.error("[loadLightModel] failed to load mep model", s);
|
|
3391
3397
|
});
|
|
3392
3398
|
}
|
|
3393
|
-
function
|
|
3399
|
+
function Jr(a, e, t, i, n) {
|
|
3394
3400
|
const s = ot(a, e);
|
|
3395
3401
|
a.models || (a.models = []);
|
|
3396
3402
|
const o = t?.loadQuotaList ?? !1, r = t?.loadEdge !== !1;
|
|
3397
3403
|
window.startTime = Date.now();
|
|
3398
3404
|
let l = "WDDsBNtzVz6aSh/bCFh3CmjjANEDRryoXF1XCJvJjeE=";
|
|
3399
|
-
|
|
3405
|
+
Ir(e + "/info", l).then((c) => {
|
|
3400
3406
|
if (ue(a, e, n))
|
|
3401
3407
|
return;
|
|
3402
3408
|
const h = ii(c), u = h?.baseInfo ?? {}, p = typeof u?.name == "string" ? u.name : "";
|
|
@@ -3442,58 +3448,58 @@ function Zr(a, e, t, i, n) {
|
|
|
3442
3448
|
ue(a, e, n) || (a.filterLoaderModel?.buildContinueIds?.(e), M());
|
|
3443
3449
|
}) : M();
|
|
3444
3450
|
function M() {
|
|
3445
|
-
ue(a, e, n) || (o ?
|
|
3451
|
+
ue(a, e, n) || (o ? kr(e + "/quota_list", l).then((x) => {
|
|
3446
3452
|
ue(a, e, n) || (x.exists && (y.quotaList = x.value ?? [], a.rxQuotaListMapper.loadNodeMap(y)), g.loadStatus.quotaList = !0, xt(a));
|
|
3447
3453
|
}).catch((x) => {
|
|
3448
3454
|
ue(a, e, n) || (g.loadStatus.quotaList = !0, console.warn("[loadLightModel] unexpected quota_list load failure", { url: e, error: x }), xt(a));
|
|
3449
3455
|
}) : (g.loadStatus.quotaList = !0, xt(a)), a.viewCube.CameraGoHome(1), a.models.length == i && setTimeout(() => {
|
|
3450
|
-
|
|
3456
|
+
bs(a, null, !1);
|
|
3451
3457
|
}, 100));
|
|
3452
3458
|
}
|
|
3453
3459
|
}).catch((c) => {
|
|
3454
3460
|
console.error("[loadLightModel] failed to load model info", { url: e, error: c });
|
|
3455
3461
|
});
|
|
3456
3462
|
}
|
|
3457
|
-
async function
|
|
3463
|
+
async function bs(a, e, t = !1) {
|
|
3458
3464
|
const i = a.engineStatus.models.filter((n) => e == null || n.url == e);
|
|
3459
3465
|
for (const n of i)
|
|
3460
|
-
if (!ue(a, n.url, n.loadVersion) && (
|
|
3466
|
+
if (!ue(a, n.url, n.loadVersion) && (vs(n), !(n.status !== "loading" || n.type !== "light") && (Zr(a, n, t), !xs(n.loadStatus.normal)))) {
|
|
3461
3467
|
n.loadStatus.normal = "loading";
|
|
3462
3468
|
try {
|
|
3463
|
-
await
|
|
3469
|
+
await ea(a, n, t);
|
|
3464
3470
|
} finally {
|
|
3465
|
-
const s =
|
|
3471
|
+
const s = Ms(a, n.url), o = s.length > 0 && s.every((r) => r.status === !0);
|
|
3466
3472
|
n.loadStatus.normal = o, o && (n.status = "loaded"), xt(a);
|
|
3467
3473
|
}
|
|
3468
3474
|
}
|
|
3469
3475
|
}
|
|
3470
|
-
async function
|
|
3476
|
+
async function ea(a, e, t = !1) {
|
|
3471
3477
|
console.log(`[loadLightModel] start loadNode ${Date.now() - window.startTime}ms`);
|
|
3472
|
-
const i =
|
|
3478
|
+
const i = Ms(a, e.url);
|
|
3473
3479
|
if (i.length !== 0)
|
|
3474
3480
|
for (const n of i)
|
|
3475
|
-
await
|
|
3481
|
+
await $r(a, e, n, t);
|
|
3476
3482
|
}
|
|
3477
|
-
function
|
|
3478
|
-
|
|
3483
|
+
function ta(a, e) {
|
|
3484
|
+
Hr(a), Cs(a, e);
|
|
3479
3485
|
const t = a.map;
|
|
3480
3486
|
return t != null && t.colorSpace !== We && (t.colorSpace = We, t.needsUpdate = !0), a.side = re, a.shadowSide = re, a.clipShadows = !0, e?.sectionPlane && (a.clippingPlanes = e.sectionPlane), a;
|
|
3481
3487
|
}
|
|
3482
|
-
function
|
|
3488
|
+
function ia(a) {
|
|
3483
3489
|
const e = a.source?.data ?? a.image, t = Array.isArray(a.mipmaps) ? a.mipmaps[0] : null, i = Number(e?.videoWidth ?? e?.naturalWidth ?? e?.width ?? t?.width), n = Number(e?.videoHeight ?? e?.naturalHeight ?? e?.height ?? t?.height);
|
|
3484
3490
|
return Number.isFinite(i) && i > 0 && Number.isFinite(n) && n > 0 ? { width: i, height: n } : null;
|
|
3485
3491
|
}
|
|
3486
|
-
function
|
|
3492
|
+
function na(a) {
|
|
3487
3493
|
const e = a.source?.data ?? a.image;
|
|
3488
3494
|
typeof e?.close == "function" && e.close(), Array.isArray(a.mipmaps) && (a.mipmaps.length = 0), a.dispose(), a.source != null && (a.source.data = null);
|
|
3489
3495
|
}
|
|
3490
|
-
function
|
|
3496
|
+
function yn(a, e) {
|
|
3491
3497
|
if (e !== "map" || a == null)
|
|
3492
3498
|
return;
|
|
3493
3499
|
const t = a.color;
|
|
3494
3500
|
t != null && (t.getHex() === 0 && t.set(16777215), a.needsUpdate = !0);
|
|
3495
3501
|
}
|
|
3496
|
-
function
|
|
3502
|
+
function Cs(a, e) {
|
|
3497
3503
|
if (e?.deviceModule?.isMobile?.() !== !0 || e?.mobileMemoryProfile?.restrictTextureSize === !1 || a == null)
|
|
3498
3504
|
return;
|
|
3499
3505
|
const t = Array.isArray(a) ? a : [a], i = Number(e?.renderer?.capabilities?.maxTextureSize), n = Number(e?.mobileMemoryProfile?.maxTextureSize ?? 2048), s = Number.isFinite(i) ? Math.min(n, i) : n;
|
|
@@ -3502,12 +3508,12 @@ function bs(a, e) {
|
|
|
3502
3508
|
const l = o[r];
|
|
3503
3509
|
if (l?.isTexture !== !0)
|
|
3504
3510
|
return;
|
|
3505
|
-
if (
|
|
3506
|
-
o[r] = null,
|
|
3511
|
+
if (pn.has(l)) {
|
|
3512
|
+
o[r] = null, yn(o, r);
|
|
3507
3513
|
return;
|
|
3508
3514
|
}
|
|
3509
|
-
const c =
|
|
3510
|
-
c == null || Math.max(c.width, c.height) <= s || (
|
|
3515
|
+
const c = ia(l);
|
|
3516
|
+
c == null || Math.max(c.width, c.height) <= s || (pn.add(l), o[r] = null, yn(o, r), na(l), console.warn("[loadLightModel] discarded oversized mobile texture", {
|
|
3511
3517
|
slot: r,
|
|
3512
3518
|
width: c.width,
|
|
3513
3519
|
height: c.height,
|
|
@@ -3516,7 +3522,7 @@ function bs(a, e) {
|
|
|
3516
3522
|
});
|
|
3517
3523
|
});
|
|
3518
3524
|
}
|
|
3519
|
-
const
|
|
3525
|
+
const sa = "/__local_model__", oa = /^(info|property|edge|quota_list|lod\d+)(?:\.zip)?$/i, ra = /^(info|property|edge|quota_list|lod\d+)(?:~)?$/i;
|
|
3520
3526
|
class ve {
|
|
3521
3527
|
static localRequestMap = /* @__PURE__ */ new Map();
|
|
3522
3528
|
static localObjectUrls = /* @__PURE__ */ new Set();
|
|
@@ -3539,7 +3545,7 @@ class ve {
|
|
|
3539
3545
|
for (const n of e) {
|
|
3540
3546
|
this.unloadedModelUrls.delete(n);
|
|
3541
3547
|
const s = (this.modelLoadVersions.get(n) ?? 0) + 1;
|
|
3542
|
-
this.modelLoadVersions.set(n, s), i(n) === "light" &&
|
|
3548
|
+
this.modelLoadVersions.set(n, s), i(n) === "light" && Jr(this.engine, n, t, e.length, s);
|
|
3543
3549
|
}
|
|
3544
3550
|
function i(n) {
|
|
3545
3551
|
const s = n.split(".").pop();
|
|
@@ -3557,11 +3563,11 @@ class ve {
|
|
|
3557
3563
|
const s = e[n];
|
|
3558
3564
|
try {
|
|
3559
3565
|
const o = await ei.get(s, { responseType: "blob" });
|
|
3560
|
-
if (!await
|
|
3566
|
+
if (!await vn(o.data))
|
|
3561
3567
|
throw new Error("响应内容不是有效的 ZIP 文件");
|
|
3562
3568
|
i.push(new File(
|
|
3563
3569
|
[o.data],
|
|
3564
|
-
|
|
3570
|
+
pa(s, n),
|
|
3565
3571
|
{ type: o.data.type || "application/zip" }
|
|
3566
3572
|
));
|
|
3567
3573
|
} catch (o) {
|
|
@@ -3602,8 +3608,8 @@ class ve {
|
|
|
3602
3608
|
if (typeof e != "string" || e.length === 0)
|
|
3603
3609
|
return;
|
|
3604
3610
|
this.unloadedModelUrls.add(e), this.modelLoadVersions.set(e, (this.modelLoadVersions.get(e) ?? 0) + 1);
|
|
3605
|
-
const t = Array.isArray(this.engine?.models) ? this.engine.models.filter((s) => s?.url === e) : [], i =
|
|
3606
|
-
this.engine?.modelExplode?.releaseModel?.(e), this.engine?.modelToolModule?.releaseModelRuntimeState?.(e), this.engine?.modelEdge?.releaseModel?.(e),
|
|
3611
|
+
const t = Array.isArray(this.engine?.models) ? this.engine.models.filter((s) => s?.url === e) : [], i = aa(this.engine, e, t), n = la(this.engine, e, i);
|
|
3612
|
+
this.engine?.modelExplode?.releaseModel?.(e), this.engine?.modelToolModule?.releaseModelRuntimeState?.(e), this.engine?.modelEdge?.releaseModel?.(e), ca(i), ha(i, n), da(this.engine, e, i, t), t.forEach(ua), Array.isArray(this.engine?.models) && (this.engine.models = this.engine.models.filter((s) => s?.url !== e)), this.clearEngineStatus(e), this.engine?.filterLoaderModel?.clear?.(e), this.removeModelGroupReference(e), ve.releaseLocalRequests(e), this.engine.requestComposerRender?.();
|
|
3607
3613
|
}
|
|
3608
3614
|
/** 返回指定 URL 是否已收到卸载请求,供异步加载链路避免卸载后回写。 */
|
|
3609
3615
|
isModelUnloadRequested(e) {
|
|
@@ -3633,13 +3639,13 @@ class ve {
|
|
|
3633
3639
|
for (const l of t) {
|
|
3634
3640
|
const c = this.parseDirectPackageEntry(l.path);
|
|
3635
3641
|
if (c != null) {
|
|
3636
|
-
|
|
3642
|
+
xn(i, c.modelKey).set(c.packageName, l.blob);
|
|
3637
3643
|
continue;
|
|
3638
3644
|
}
|
|
3639
3645
|
const h = this.parseExtractedPackageEntry(l.path);
|
|
3640
3646
|
if (h == null)
|
|
3641
3647
|
continue;
|
|
3642
|
-
const u =
|
|
3648
|
+
const u = xn(n, h.modelKey), p = u.get(h.packageName) ?? [];
|
|
3643
3649
|
p.push({
|
|
3644
3650
|
path: h.innerPath,
|
|
3645
3651
|
blob: l.blob
|
|
@@ -3663,7 +3669,7 @@ class ve {
|
|
|
3663
3669
|
blob: await this.packEntriesAsZip(g)
|
|
3664
3670
|
});
|
|
3665
3671
|
c.some((p) => p.packageName === "info") && (r += 1, o.push({
|
|
3666
|
-
rootUrl: `${
|
|
3672
|
+
rootUrl: `${sa}/${ve.createLocalModelId(l, r)}`,
|
|
3667
3673
|
packages: c
|
|
3668
3674
|
}));
|
|
3669
3675
|
}
|
|
@@ -3677,15 +3683,15 @@ class ve {
|
|
|
3677
3683
|
const t = [];
|
|
3678
3684
|
for (const i of e) {
|
|
3679
3685
|
const n = Re(i.webkitRelativePath || i.name), s = wt(n);
|
|
3680
|
-
if (
|
|
3686
|
+
if (Mn(s)) {
|
|
3681
3687
|
t.push({ path: n, blob: i });
|
|
3682
3688
|
continue;
|
|
3683
3689
|
}
|
|
3684
|
-
if (await
|
|
3690
|
+
if (await vn(i)) {
|
|
3685
3691
|
const o = await Ci.loadAsync(i), r = ui(n), l = Object.values(o.files);
|
|
3686
3692
|
for (const c of l)
|
|
3687
3693
|
c.dir || t.push({
|
|
3688
|
-
path:
|
|
3694
|
+
path: ma(r, Re(c.name)),
|
|
3689
3695
|
blob: await c.async("blob")
|
|
3690
3696
|
});
|
|
3691
3697
|
continue;
|
|
@@ -3699,9 +3705,9 @@ class ve {
|
|
|
3699
3705
|
*/
|
|
3700
3706
|
parseDirectPackageEntry(e) {
|
|
3701
3707
|
const t = ui(e), i = wt(e);
|
|
3702
|
-
return
|
|
3708
|
+
return Mn(i) ? {
|
|
3703
3709
|
modelKey: t,
|
|
3704
|
-
packageName:
|
|
3710
|
+
packageName: ga(i)
|
|
3705
3711
|
} : null;
|
|
3706
3712
|
}
|
|
3707
3713
|
/**
|
|
@@ -3710,7 +3716,7 @@ class ve {
|
|
|
3710
3716
|
parseExtractedPackageEntry(e) {
|
|
3711
3717
|
const t = Re(e).split("/").filter(Boolean);
|
|
3712
3718
|
for (let n = 0; n < t.length; n++) {
|
|
3713
|
-
const s =
|
|
3719
|
+
const s = fa(t[n]);
|
|
3714
3720
|
if (s == null)
|
|
3715
3721
|
continue;
|
|
3716
3722
|
const o = t.slice(n + 1);
|
|
@@ -3781,14 +3787,14 @@ class ve {
|
|
|
3781
3787
|
return `${e.replace(/[^a-zA-Z0-9/_-]/g, "_").replace(/\//g, "__") || "model"}_${Date.now()}_${t}_${Math.random().toString(36).slice(2, 8)}`;
|
|
3782
3788
|
}
|
|
3783
3789
|
}
|
|
3784
|
-
function
|
|
3790
|
+
function Es() {
|
|
3785
3791
|
return {
|
|
3786
3792
|
geometries: /* @__PURE__ */ new Set(),
|
|
3787
3793
|
materials: /* @__PURE__ */ new Set(),
|
|
3788
3794
|
textures: /* @__PURE__ */ new Set()
|
|
3789
3795
|
};
|
|
3790
3796
|
}
|
|
3791
|
-
function
|
|
3797
|
+
function As(a, e) {
|
|
3792
3798
|
Object.values(a).forEach((i) => {
|
|
3793
3799
|
i instanceof Ie && e.add(i);
|
|
3794
3800
|
});
|
|
@@ -3804,13 +3810,13 @@ function Si(a, e) {
|
|
|
3804
3810
|
[a?.geometry, ...Array.isArray(a?.geometrys) ? a.geometrys : []].forEach((n) => {
|
|
3805
3811
|
n instanceof ae && e.geometries.add(n);
|
|
3806
3812
|
}), (Array.isArray(a?.material) ? a.material : [a?.material]).forEach((n) => {
|
|
3807
|
-
n instanceof At && (e.materials.add(n),
|
|
3813
|
+
n instanceof At && (e.materials.add(n), As(n, e.textures));
|
|
3808
3814
|
});
|
|
3809
3815
|
}
|
|
3810
3816
|
function Ve(a, e) {
|
|
3811
3817
|
a instanceof it && a.traverse((t) => e.add(t));
|
|
3812
3818
|
}
|
|
3813
|
-
function
|
|
3819
|
+
function Ss(a, e) {
|
|
3814
3820
|
Ve(a?.group, e), a?.nodesMap?.forEach?.((t) => {
|
|
3815
3821
|
Ve(t?.mesh, e), Ve(t?.pickBoxMesh, e), Ve(t?.info?.mesh, e), t?.infos?.forEach?.((i) => Ve(i?.mesh, e));
|
|
3816
3822
|
}), a?.lods?.forEach?.((t) => {
|
|
@@ -3819,23 +3825,23 @@ function As(a, e) {
|
|
|
3819
3825
|
});
|
|
3820
3826
|
});
|
|
3821
3827
|
}
|
|
3822
|
-
function
|
|
3828
|
+
function aa(a, e, t) {
|
|
3823
3829
|
const i = /* @__PURE__ */ new Set();
|
|
3824
|
-
return Ve(a?.__modelGroupMap instanceof Map ? a.__modelGroupMap.get(e) : null, i), Ve($e(a, e), i), t.forEach((n) =>
|
|
3830
|
+
return Ve(a?.__modelGroupMap instanceof Map ? a.__modelGroupMap.get(e) : null, i), Ve($e(a, e), i), t.forEach((n) => Ss(n, i)), a?.__modelObjectIndexMap instanceof Map && a.__modelObjectIndexMap.forEach((n) => {
|
|
3825
3831
|
(n?.url === e || n?.userData?.url === e) && Ve(n, i);
|
|
3826
3832
|
}), a?.scene?.traverse?.((n) => {
|
|
3827
3833
|
(n?.url === e || n?.userData?.url === e) && Ve(n, i);
|
|
3828
3834
|
}), i;
|
|
3829
3835
|
}
|
|
3830
|
-
function
|
|
3831
|
-
const i =
|
|
3836
|
+
function la(a, e, t) {
|
|
3837
|
+
const i = Es();
|
|
3832
3838
|
a?.scene?.traverse?.((s) => {
|
|
3833
3839
|
t.has(s) || Si(s, i);
|
|
3834
3840
|
}), a?.models?.forEach?.((s) => {
|
|
3835
3841
|
if (s?.url === e)
|
|
3836
3842
|
return;
|
|
3837
3843
|
const o = /* @__PURE__ */ new Set();
|
|
3838
|
-
|
|
3844
|
+
Ss(s, o), o.forEach((r) => Si(r, i));
|
|
3839
3845
|
});
|
|
3840
3846
|
const n = a?.scene;
|
|
3841
3847
|
return n?.background instanceof Ie && i.textures.add(n.background), n?.environment instanceof Ie && i.textures.add(n.environment), [
|
|
@@ -3849,16 +3855,16 @@ function aa(a, e, t) {
|
|
|
3849
3855
|
a?.modelExplode?.highlightMaterial,
|
|
3850
3856
|
a?.modelExplode?.translucentMaterial
|
|
3851
3857
|
].forEach((s) => {
|
|
3852
|
-
s instanceof At && (i.materials.add(s),
|
|
3858
|
+
s instanceof At && (i.materials.add(s), As(s, i.textures));
|
|
3853
3859
|
}), i;
|
|
3854
3860
|
}
|
|
3855
|
-
function
|
|
3861
|
+
function ca(a) {
|
|
3856
3862
|
a.forEach((e) => {
|
|
3857
3863
|
e.parent != null && !a.has(e.parent) && e.parent.remove(e);
|
|
3858
3864
|
});
|
|
3859
3865
|
}
|
|
3860
|
-
function
|
|
3861
|
-
const t =
|
|
3866
|
+
function ha(a, e) {
|
|
3867
|
+
const t = Es();
|
|
3862
3868
|
a.forEach((i) => Si(i, t)), t.geometries.forEach((i) => {
|
|
3863
3869
|
e.geometries.has(i) || (i.disposeBoundsTree?.(), i.dispose());
|
|
3864
3870
|
}), t.materials.forEach((i) => {
|
|
@@ -3867,7 +3873,7 @@ function ca(a, e) {
|
|
|
3867
3873
|
e.textures.has(i) || i.dispose();
|
|
3868
3874
|
});
|
|
3869
3875
|
}
|
|
3870
|
-
function
|
|
3876
|
+
function da(a, e, t, i) {
|
|
3871
3877
|
const n = /* @__PURE__ */ new Set();
|
|
3872
3878
|
t.forEach((o) => {
|
|
3873
3879
|
Number.isFinite(o?.index) && n.add(o.index);
|
|
@@ -3883,7 +3889,7 @@ function ha(a, e, t, i) {
|
|
|
3883
3889
|
(n.has(r) || t.has(o) || o?.url === e) && s.delete(r);
|
|
3884
3890
|
});
|
|
3885
3891
|
}
|
|
3886
|
-
function
|
|
3892
|
+
function ua(a) {
|
|
3887
3893
|
a?.nodesMap?.clear?.(), a?.lods?.forEach?.((e) => {
|
|
3888
3894
|
e.glbs = [], e.instanceNodes = null, e.preparePromise = null, e.meshPromise = null, e.octreeBox = null;
|
|
3889
3895
|
}), a.group = null, a.modelEdge = null, a.modelMep = null, a.modelMapper = null, a.modelTree = null, a.quotaList = null, a.urls = [];
|
|
@@ -3899,7 +3905,7 @@ function ui(a) {
|
|
|
3899
3905
|
const e = Re(a), t = e.lastIndexOf("/");
|
|
3900
3906
|
return t >= 0 ? e.slice(0, t) : "";
|
|
3901
3907
|
}
|
|
3902
|
-
function
|
|
3908
|
+
function pa(a, e) {
|
|
3903
3909
|
try {
|
|
3904
3910
|
const t = new URL(a, window.location.origin);
|
|
3905
3911
|
return decodeURIComponent(wt(t.pathname)) || `model-package-${e + 1}.zip`;
|
|
@@ -3907,29 +3913,29 @@ function ua(a, e) {
|
|
|
3907
3913
|
return wt(a.split("?")[0].split("#")[0]) || `model-package-${e + 1}.zip`;
|
|
3908
3914
|
}
|
|
3909
3915
|
}
|
|
3910
|
-
function
|
|
3916
|
+
function ma(a, e) {
|
|
3911
3917
|
return Re(a ? e ? `${a}/${e}` : a : e);
|
|
3912
3918
|
}
|
|
3913
|
-
function
|
|
3914
|
-
return
|
|
3919
|
+
function Mn(a) {
|
|
3920
|
+
return oa.test(a);
|
|
3915
3921
|
}
|
|
3916
|
-
function
|
|
3922
|
+
function ga(a) {
|
|
3917
3923
|
return a.replace(/\.zip$/i, "").toLowerCase();
|
|
3918
3924
|
}
|
|
3919
|
-
function
|
|
3920
|
-
const e =
|
|
3925
|
+
function fa(a) {
|
|
3926
|
+
const e = ra.exec(a);
|
|
3921
3927
|
return e == null ? null : e[1].toLowerCase();
|
|
3922
3928
|
}
|
|
3923
|
-
async function
|
|
3929
|
+
async function vn(a) {
|
|
3924
3930
|
const e = await a.slice(0, 4).arrayBuffer(), t = new Uint8Array(e);
|
|
3925
3931
|
return t.length >= 4 && t[0] === 80 && t[1] === 75 && t[2] === 3 && t[3] === 4;
|
|
3926
3932
|
}
|
|
3927
|
-
function
|
|
3933
|
+
function xn(a, e) {
|
|
3928
3934
|
let t = a.get(e);
|
|
3929
3935
|
return t == null && (t = /* @__PURE__ */ new Map(), a.set(e, t)), t;
|
|
3930
3936
|
}
|
|
3931
3937
|
var ne = /* @__PURE__ */ ((a) => (a.ModelLoadStart = "model-load-start", a.ModelLoadProgress = "model-load-progress", a.ModelLoaded = "model-loaded", a.ModelError = "model-error", a.SelectionChanged = "selection-changed", a.HoverChanged = "hover-changed", a.Click = "click", a.MouseMove = "mouse-move", a.ModelPlaceSelected = "model-place-selected", a.ModelCalibrationChanged = "model-calibration-changed", a.CameraChanged = "camera-changed", a.CameraIdle = "camera-idle", a.ViewportResize = "viewport-resize", a.EngineFree = "engine-free", a.EngineBusy = "engine-busy", a.MeasureChanged = "measure-changed", a.SectionMove = "section-move", a.LoadingCompleted = "loading_completed", a))(ne || {});
|
|
3932
|
-
class
|
|
3938
|
+
class ya {
|
|
3933
3939
|
engine;
|
|
3934
3940
|
isFree;
|
|
3935
3941
|
// 是否是编辑模式
|
|
@@ -3952,7 +3958,7 @@ class fa {
|
|
|
3952
3958
|
}
|
|
3953
3959
|
init() {
|
|
3954
3960
|
this.engine.renderer?.domElement?.addEventListener("contextmenu", this.handleContextMenu, !0), this.engine.events.on(ne.EngineFree, (e) => {
|
|
3955
|
-
this.updateFree(!0),
|
|
3961
|
+
this.updateFree(!0), bs(this.engine, e, !1), this.engine?.octreeBox?.requestBvhBuild?.();
|
|
3956
3962
|
}), this.engine.events.on(ne.EngineBusy, () => {
|
|
3957
3963
|
this.updateFree(!1);
|
|
3958
3964
|
});
|
|
@@ -3971,7 +3977,7 @@ class fa {
|
|
|
3971
3977
|
closeAllFunction = () => {
|
|
3972
3978
|
};
|
|
3973
3979
|
}
|
|
3974
|
-
class
|
|
3980
|
+
class Ma {
|
|
3975
3981
|
// 使用字符串作为键,以确保不同来源的 EventType 枚举值能够正确匹配
|
|
3976
3982
|
listeners = /* @__PURE__ */ new Map();
|
|
3977
3983
|
// 是否启用调试模式(可以通过外部设置)
|
|
@@ -4027,8 +4033,8 @@ class ya {
|
|
|
4027
4033
|
});
|
|
4028
4034
|
}
|
|
4029
4035
|
}
|
|
4030
|
-
const bt = 1, pi = 1,
|
|
4031
|
-
class
|
|
4036
|
+
const bt = 1, pi = 1, va = 1800, wn = 1024, xa = 1.35, wa = 20, ba = 1200, mi = 0.5, Ca = 10, Ea = 0.08, gi = 500, bn = 5e4, Cn = 120, Aa = 5e4, En = 0.12, Sa = 8, Pa = 0.75, An = 5e-5, Ta = 15e-4, Ia = 2.5, _a = 2.4, Da = 4.5, ka = 0.94, La = 0.995, Ba = 80, za = 0.06, Ra = 8, Oa = new d(-1, 4, 2).normalize();
|
|
4037
|
+
class Fa {
|
|
4032
4038
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
4033
4039
|
engine;
|
|
4034
4040
|
// 上一次应用到阴影相机的半边长,用于跳过无意义的小幅更新。
|
|
@@ -4059,7 +4065,7 @@ class Oa {
|
|
|
4059
4065
|
*/
|
|
4060
4066
|
init() {
|
|
4061
4067
|
const e = new Xe(16774630, 2);
|
|
4062
|
-
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width =
|
|
4068
|
+
e.name = "directionalShadowLight", e.castShadow = !0, e.shadow.mapSize.width = wn, e.shadow.mapSize.height = wn, e.shadow.camera.near = mi, e.shadow.camera.far = gi, e.shadow.bias = -An, e.shadow.normalBias = En;
|
|
4063
4069
|
const t = pi;
|
|
4064
4070
|
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 = bt, e.target.name = "directionalShadowLightTarget";
|
|
4065
4071
|
const i = new Xe(16777215, 2);
|
|
@@ -4091,16 +4097,16 @@ class Oa {
|
|
|
4091
4097
|
}
|
|
4092
4098
|
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l), h = this.getSceneShadowHalfSize(s, c), u = F.clamp(
|
|
4093
4099
|
Math.max(
|
|
4094
|
-
c *
|
|
4100
|
+
c * xa,
|
|
4095
4101
|
h,
|
|
4096
4102
|
pi
|
|
4097
4103
|
),
|
|
4098
4104
|
pi,
|
|
4099
|
-
|
|
4105
|
+
va
|
|
4100
4106
|
), p = F.clamp(
|
|
4101
|
-
Math.max(u * 2.5, o * 0.75,
|
|
4102
|
-
|
|
4103
|
-
|
|
4107
|
+
Math.max(u * 2.5, o * 0.75, Cn),
|
|
4108
|
+
Cn,
|
|
4109
|
+
Aa
|
|
4104
4110
|
), g = this.getLightOffsetDirection(), y = this.snapShadowTargetToTexel(
|
|
4105
4111
|
l,
|
|
4106
4112
|
g,
|
|
@@ -4133,7 +4139,7 @@ class Oa {
|
|
|
4133
4139
|
return 0;
|
|
4134
4140
|
if (t <= 0)
|
|
4135
4141
|
return e * 0.75;
|
|
4136
|
-
const i = t *
|
|
4142
|
+
const i = t * wa;
|
|
4137
4143
|
return Math.min(e * 0.75, i);
|
|
4138
4144
|
}
|
|
4139
4145
|
/**
|
|
@@ -4145,15 +4151,15 @@ class Oa {
|
|
|
4145
4151
|
updateShadowBias(e, t, i) {
|
|
4146
4152
|
const n = Math.max(e.shadow.mapSize.width, 1), s = t * 2 / n, o = Math.max(i.far - i.near, 1);
|
|
4147
4153
|
e.shadow.normalBias = F.clamp(
|
|
4148
|
-
s *
|
|
4149
|
-
|
|
4150
|
-
|
|
4154
|
+
s * Pa,
|
|
4155
|
+
En,
|
|
4156
|
+
Sa
|
|
4151
4157
|
);
|
|
4152
|
-
const r = s / o *
|
|
4158
|
+
const r = s / o * Ia;
|
|
4153
4159
|
e.shadow.bias = -F.clamp(
|
|
4154
4160
|
r,
|
|
4155
|
-
|
|
4156
|
-
|
|
4161
|
+
An,
|
|
4162
|
+
Ta
|
|
4157
4163
|
);
|
|
4158
4164
|
}
|
|
4159
4165
|
/**
|
|
@@ -4176,12 +4182,12 @@ class Oa {
|
|
|
4176
4182
|
}
|
|
4177
4183
|
if (Number.isFinite(c) && Number.isFinite(h)) {
|
|
4178
4184
|
const u = Math.max(
|
|
4179
|
-
(h - c) *
|
|
4180
|
-
|
|
4185
|
+
(h - c) * Ea,
|
|
4186
|
+
Ca
|
|
4181
4187
|
), p = Math.max(mi, c - u), g = F.clamp(
|
|
4182
4188
|
Math.max(p + 1, h + u),
|
|
4183
4189
|
p + 1,
|
|
4184
|
-
|
|
4190
|
+
bn
|
|
4185
4191
|
);
|
|
4186
4192
|
return { near: p, far: g };
|
|
4187
4193
|
}
|
|
@@ -4189,7 +4195,7 @@ class Oa {
|
|
|
4189
4195
|
const r = F.clamp(
|
|
4190
4196
|
Math.max(n * 1.5, s * 4, gi),
|
|
4191
4197
|
gi,
|
|
4192
|
-
|
|
4198
|
+
bn
|
|
4193
4199
|
);
|
|
4194
4200
|
return { near: mi, far: r };
|
|
4195
4201
|
}
|
|
@@ -4293,7 +4299,7 @@ class Oa {
|
|
|
4293
4299
|
}
|
|
4294
4300
|
if (e instanceof Xt) {
|
|
4295
4301
|
const i = this.resolveShadowTarget(e, t), n = Math.max(e.position.distanceTo(i), 1), s = F.degToRad(e.getEffectiveFOV() * 0.5), o = Math.max(Math.tan(s) * n, 1), r = o * Math.max(e.aspect, 1e-6);
|
|
4296
|
-
return Math.min(Math.max(r, o),
|
|
4302
|
+
return Math.min(Math.max(r, o), ba);
|
|
4297
4303
|
}
|
|
4298
4304
|
return 0;
|
|
4299
4305
|
}
|
|
@@ -4320,7 +4326,7 @@ class Oa {
|
|
|
4320
4326
|
* @returns 标准化后的世界空间光源偏移方向。
|
|
4321
4327
|
*/
|
|
4322
4328
|
getLightOffsetDirection() {
|
|
4323
|
-
return
|
|
4329
|
+
return Oa.clone();
|
|
4324
4330
|
}
|
|
4325
4331
|
/**
|
|
4326
4332
|
* 根据当前视角和阴影贴图密度计算最终显示强度。
|
|
@@ -4333,8 +4339,8 @@ class Oa {
|
|
|
4333
4339
|
getShadowDisplayIntensity(e, t, i, n) {
|
|
4334
4340
|
const s = i * 2 / Math.max(n, 1), o = 1 - F.smoothstep(
|
|
4335
4341
|
s,
|
|
4336
|
-
|
|
4337
|
-
|
|
4342
|
+
_a,
|
|
4343
|
+
Da
|
|
4338
4344
|
);
|
|
4339
4345
|
let r = 1;
|
|
4340
4346
|
if (e) {
|
|
@@ -4343,8 +4349,8 @@ class Oa {
|
|
|
4343
4349
|
const c = Math.abs(l.dot(t.clone().normalize()));
|
|
4344
4350
|
r = 1 - F.smoothstep(
|
|
4345
4351
|
c,
|
|
4346
|
-
|
|
4347
|
-
|
|
4352
|
+
ka,
|
|
4353
|
+
La
|
|
4348
4354
|
);
|
|
4349
4355
|
}
|
|
4350
4356
|
return bt * Math.min(o, r);
|
|
@@ -4389,10 +4395,10 @@ class Oa {
|
|
|
4389
4395
|
if (i.isEmpty())
|
|
4390
4396
|
return;
|
|
4391
4397
|
const n = i.getSize(new d()), s = Math.max(n.x, n.z), o = Math.max(
|
|
4392
|
-
|
|
4393
|
-
s *
|
|
4398
|
+
Ra,
|
|
4399
|
+
s * za
|
|
4394
4400
|
);
|
|
4395
|
-
if (s >=
|
|
4401
|
+
if (s >= Ba && n.y <= o) {
|
|
4396
4402
|
e.castShadow = !1, t.__lightModuleReceiverOnlyShadow = !0;
|
|
4397
4403
|
return;
|
|
4398
4404
|
}
|
|
@@ -4408,7 +4414,7 @@ class Oa {
|
|
|
4408
4414
|
i && (i.shadowSide = Oi);
|
|
4409
4415
|
}
|
|
4410
4416
|
}
|
|
4411
|
-
class
|
|
4417
|
+
class Na {
|
|
4412
4418
|
engine;
|
|
4413
4419
|
behavior;
|
|
4414
4420
|
isCtrlDown = !1;
|
|
@@ -4843,7 +4849,7 @@ class Fa {
|
|
|
4843
4849
|
return e?.nodesMap?.get(t) ?? e?.nodesMap?.get(Number(t)) ?? e?.nodesMap?.get(String(t));
|
|
4844
4850
|
}
|
|
4845
4851
|
}
|
|
4846
|
-
class
|
|
4852
|
+
class Ha {
|
|
4847
4853
|
engine;
|
|
4848
4854
|
highlightMaterial;
|
|
4849
4855
|
translucentMaterial;
|
|
@@ -5115,7 +5121,7 @@ class Na {
|
|
|
5115
5121
|
const u = this.getSceneModel(h[0]);
|
|
5116
5122
|
u instanceof V ? o.has(h[0]) ? o.get(h[0])?.push(h[1]) : o.set(h[0], [h[1]]) : this.setSplitComponentState(u, h[1], 1, !0);
|
|
5117
5123
|
});
|
|
5118
|
-
}),
|
|
5124
|
+
}), Va(o, this.engine);
|
|
5119
5125
|
let r = this.engine.engineStatus.highlightModels.find((l) => l.url == t.url);
|
|
5120
5126
|
r != null ? (Array.isArray(r.guids) || (r.guids = this.getModelGuids(i, r.ids)), n.forEach((l, c) => {
|
|
5121
5127
|
const h = r.ids.indexOf(l);
|
|
@@ -5145,7 +5151,7 @@ class Na {
|
|
|
5145
5151
|
!0
|
|
5146
5152
|
);
|
|
5147
5153
|
});
|
|
5148
|
-
}),
|
|
5154
|
+
}), Sn(n, this.engine, "highlightModel");
|
|
5149
5155
|
}), this.rebatchSplitModels(), this.updateMaterial(), this.syncHighlightModelEdges(this.getHighlightModelsAfterRemove(e)), this.syncExplodeVisualState();
|
|
5150
5156
|
}
|
|
5151
5157
|
// 取消所有模型高亮
|
|
@@ -5169,7 +5175,7 @@ class Na {
|
|
|
5169
5175
|
const c = this.getSceneModel(l[0]);
|
|
5170
5176
|
c instanceof V ? n.has(l[0]) ? n.get(l[0])?.push(l[1]) : n.set(l[0], [l[1]]) : this.setSplitComponentState(c, l[1], -1, !1);
|
|
5171
5177
|
});
|
|
5172
|
-
}), n.size > 0 &&
|
|
5178
|
+
}), n.size > 0 && Wa(n, this.engine);
|
|
5173
5179
|
let s = this.engine.engineStatus.hideModels.find((o) => o.url == t.url);
|
|
5174
5180
|
s != null ? this.appendUniqueIds(s.ids, t.ids) : this.engine.engineStatus.hideModels.push({
|
|
5175
5181
|
url: t.url,
|
|
@@ -5195,7 +5201,7 @@ class Na {
|
|
|
5195
5201
|
!0
|
|
5196
5202
|
);
|
|
5197
5203
|
});
|
|
5198
|
-
}), s.size > 0 &&
|
|
5204
|
+
}), s.size > 0 && Pn(s, this.engine), t)
|
|
5199
5205
|
return;
|
|
5200
5206
|
let o = this.engine.engineStatus.hideModels.find((r) => r.url == i.url);
|
|
5201
5207
|
o && (i.ids.forEach((r) => {
|
|
@@ -5521,7 +5527,7 @@ class Na {
|
|
|
5521
5527
|
const u = this.getSceneModel(h[0]);
|
|
5522
5528
|
u instanceof V ? o.has(h[0]) ? o.get(h[0])?.push(h[1]) : o.set(h[0], [h[1]]) : this.setSplitComponentState(u, h[1], 2, !0);
|
|
5523
5529
|
});
|
|
5524
|
-
}),
|
|
5530
|
+
}), Ua(o, this.engine, i);
|
|
5525
5531
|
let r = this.engine.engineStatus.translucentModels.find((l) => l.url == n.url);
|
|
5526
5532
|
r != null ? r.ids.push(...n.ids) : this.engine.engineStatus.translucentModels.push({
|
|
5527
5533
|
url: n.url,
|
|
@@ -5547,7 +5553,7 @@ class Na {
|
|
|
5547
5553
|
!0
|
|
5548
5554
|
);
|
|
5549
5555
|
});
|
|
5550
|
-
}), n.size > 0 &&
|
|
5556
|
+
}), n.size > 0 && Pn(n, this.engine), Sn(n, this.engine, "translucentModel");
|
|
5551
5557
|
}), this.engine.engineStatus.translucentModels = [], this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
5552
5558
|
}
|
|
5553
5559
|
// ***************************************************** 设置模型半透明 ***************************************************** //
|
|
@@ -5595,7 +5601,7 @@ class Na {
|
|
|
5595
5601
|
}
|
|
5596
5602
|
// ***************************************************** 设置模型颜色 ***************************************************** //
|
|
5597
5603
|
}
|
|
5598
|
-
function
|
|
5604
|
+
function Va(a, e) {
|
|
5599
5605
|
a.forEach((t, i) => {
|
|
5600
5606
|
const n = Rt(e, i);
|
|
5601
5607
|
if (!(n instanceof V))
|
|
@@ -5628,7 +5634,7 @@ function Ha(a, e) {
|
|
|
5628
5634
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
5629
5635
|
});
|
|
5630
5636
|
}
|
|
5631
|
-
function
|
|
5637
|
+
function Sn(a, e, t) {
|
|
5632
5638
|
a.forEach((i, n) => {
|
|
5633
5639
|
const s = Rt(e, n);
|
|
5634
5640
|
if (!(s instanceof V))
|
|
@@ -5646,11 +5652,11 @@ function An(a, e, t) {
|
|
|
5646
5652
|
e.scene.traverse((r) => {
|
|
5647
5653
|
r.key == n && r.name == t && o.push(r);
|
|
5648
5654
|
}), o.forEach((r) => {
|
|
5649
|
-
|
|
5655
|
+
Ps(r);
|
|
5650
5656
|
});
|
|
5651
5657
|
});
|
|
5652
5658
|
}
|
|
5653
|
-
function
|
|
5659
|
+
function Ua(a, e, t = 0.05) {
|
|
5654
5660
|
a.forEach((i, n) => {
|
|
5655
5661
|
const s = Rt(e, n);
|
|
5656
5662
|
if (!(s instanceof V))
|
|
@@ -5677,12 +5683,12 @@ function Va(a, e, t = 0.05) {
|
|
|
5677
5683
|
}), s.instanceMatrix.needsUpdate = !0, l.instanceMatrix.needsUpdate = !0, (s.parent ?? e.scene).add(l);
|
|
5678
5684
|
});
|
|
5679
5685
|
}
|
|
5680
|
-
function
|
|
5686
|
+
function Wa(a, e) {
|
|
5681
5687
|
const t = [];
|
|
5682
5688
|
e.scene.traverse((i) => {
|
|
5683
5689
|
i.name == "highlightModel" && t.push(i);
|
|
5684
5690
|
}), t.forEach((i) => {
|
|
5685
|
-
|
|
5691
|
+
Ps(i);
|
|
5686
5692
|
}), a.forEach((i, n) => {
|
|
5687
5693
|
const s = Rt(e, n);
|
|
5688
5694
|
if (!(s instanceof V))
|
|
@@ -5696,7 +5702,7 @@ function Ua(a, e) {
|
|
|
5696
5702
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
5697
5703
|
});
|
|
5698
5704
|
}
|
|
5699
|
-
function
|
|
5705
|
+
function Pn(a, e) {
|
|
5700
5706
|
a.forEach((t, i) => {
|
|
5701
5707
|
const n = Rt(e, i);
|
|
5702
5708
|
n instanceof V && (t.forEach((s) => {
|
|
@@ -5717,7 +5723,7 @@ function Bt(a, e, t) {
|
|
|
5717
5723
|
function zt(a, e) {
|
|
5718
5724
|
a?.cloneModel != null && (a.cloneModel.visible = e);
|
|
5719
5725
|
}
|
|
5720
|
-
function
|
|
5726
|
+
function Ps(a) {
|
|
5721
5727
|
if (a == null)
|
|
5722
5728
|
return;
|
|
5723
5729
|
const e = a.parent;
|
|
@@ -5726,8 +5732,8 @@ function Ss(a) {
|
|
|
5726
5732
|
function Rt(a, e) {
|
|
5727
5733
|
return Le(a, e);
|
|
5728
5734
|
}
|
|
5729
|
-
const
|
|
5730
|
-
class
|
|
5735
|
+
const Ts = "advanced";
|
|
5736
|
+
class Ga {
|
|
5731
5737
|
engine;
|
|
5732
5738
|
currentMode = "";
|
|
5733
5739
|
// 是否为手动设置(手动设置时,自动适配不再生效)
|
|
@@ -5745,7 +5751,7 @@ class Wa {
|
|
|
5745
5751
|
* 初始化模块
|
|
5746
5752
|
*/
|
|
5747
5753
|
init() {
|
|
5748
|
-
this.cachePassReferences(), this.autoSwitch(
|
|
5754
|
+
this.cachePassReferences(), this.autoSwitch(Ts);
|
|
5749
5755
|
}
|
|
5750
5756
|
/**
|
|
5751
5757
|
* 手动切换渲染模式(用户调用),锁定自动适配
|
|
@@ -5951,7 +5957,7 @@ class ni {
|
|
|
5951
5957
|
color: 16777215,
|
|
5952
5958
|
transparent: !0,
|
|
5953
5959
|
opacity: 0,
|
|
5954
|
-
blending:
|
|
5960
|
+
blending: io,
|
|
5955
5961
|
depthWrite: !1
|
|
5956
5962
|
}), this.overlayMaterial.clippingPlanes = this.engine.sectionPlane;
|
|
5957
5963
|
}
|
|
@@ -6016,10 +6022,10 @@ class ni {
|
|
|
6016
6022
|
this.setAnimationFrameRateExempt(!1), this.removeOverlayMeshes(), this.overlayMaterial.dispose(), this.tagDiv?.remove?.(), this.tagDiv = null, this.animState = "idle";
|
|
6017
6023
|
}
|
|
6018
6024
|
}
|
|
6019
|
-
function
|
|
6025
|
+
function qa() {
|
|
6020
6026
|
return new ki();
|
|
6021
6027
|
}
|
|
6022
|
-
function
|
|
6028
|
+
function Ka(a, e) {
|
|
6023
6029
|
a.appendChild(e.domElement);
|
|
6024
6030
|
}
|
|
6025
6031
|
const Je = {
|
|
@@ -6031,7 +6037,7 @@ const Je = {
|
|
|
6031
6037
|
front: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAABp0lEQVR4nO3ZwWnDQBBA0XFwM9uA23FtbkcNqByngxCCzQb/985CzOEzaFeXmXkOWdeZmfM8d8/BBmut+do9BHsJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAoi77h7gne73+xzH8bL33W63eTweL3vff2ADxAkgTgBxAogTQNxHnwJ+8olf9H9hA8QJIE4AcQKIE0CcAOIEECeAOAHEZW8Cj+OYtdavn//Um0MbIE4AcQKIE0CcAOKyp4CZmfM8d4+wnQ0QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiLvMzNNv0aa1lg1QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxF1m5rl7CPb5Bhi1Gm3j3a/lAAAAAElFTkSuQmCC",
|
|
6032
6038
|
back: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAADuklEQVR4nO3dMUvjYADG8cfjlsxugkRBkAwuog5+gJKAk1un4iLZbAQds+nioG7FzamDH0BXN4ngKg6i0k0IuEhGbzlFvCY1veR97/I8vzURnuFPkzYBJwC8QWj9BIDb21vbO8QCz/Pww/YIsUsBkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAC5n7YHVK3T6SBJkrH/fmVlBe12GwDg+35Vs/5ZjQvgbyVJ8hFQFEUIwxDr6+uYnp62vKweugSM0Ov10Gq1cHFxYXtKLRTAN0VRhLOzM9szKqcASojjGDc3N7ZnVEoBlHR8fGx7QqXobgKH/XucLMtweXmJfr8/8htEkiQYDAaNuSnUJwAAx3Hg+z5OT08/vgIWeXx8rH+UIQrgi52dHbiua3uGMQrgC8dxsLq6anuGMQpgDDMzM7YnVEYBDPHy8pJ7zHXdxtwAAgrgD3d3dzg/P8893u12zY0xQAF8kqYp9vf3c48HQdC4B0R0vwMMk6Yprq+vEUVR7jlBEGBvb8/gKjPoAvA8r/TfhGGIra2tGtbYRxdAGWEYwvd9zM/P255SG90DFJiamsLDw4PtGbVSAAXiOEYURfA8r5GPggEF8G1xHKPT6SBNU9tTKqUASkiSBNvb28iyzPaUytDdBA57HAx8/5FwkiQ4OTlpzLcCfQL89vmR8O7ubuG5vV4Pg8HA0LJ6KYAhNjY2EARB4TlXV1eG1tRLAeRotVqFx/MuJf8bBZBjdna28Pj9/b2hJfVSADleX19tTzBCAeR4fn4uPD45OWloSb0UwBBZlqHf7xees7CwYGhNvRTAEAcHByNfD5+bmzO0pl50PwTleX8n4OjoCE9PT4Xnuq6LpaUlQ8vqRRfAOO8DfNXtduE4TgVr7NMloKSmvRamAEpo4mthdJeAcYVhiM3NzcZ89L9TACO0222sra1hcXHR9pRaKIAhDg8PAQDLy8uN+cEnzwSAt6Y82JByPM/TTSA7BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkFMA5BQAOQVATgGQUwDkFAA5BUBOAZBTAOQUADkFQE4BkJsA8GZ7hNjzC2Yhv7BCBMu8AAAAAElFTkSuQmCC"
|
|
6033
6039
|
};
|
|
6034
|
-
function
|
|
6040
|
+
function ja(a, e, t) {
|
|
6035
6041
|
var i = new Object();
|
|
6036
6042
|
i.visible = !0;
|
|
6037
6043
|
let n = null, s = 0, o, r, l = [];
|
|
@@ -6217,8 +6223,8 @@ function Ka(a, e, t) {
|
|
|
6217
6223
|
}), He.easing(et.Easing.Cubic.InOut), g(), He.start(), oi();
|
|
6218
6224
|
} else {
|
|
6219
6225
|
var E = w.min.clone().add(w.max.clone()).multiplyScalar(0.5);
|
|
6220
|
-
let
|
|
6221
|
-
var T = E.clone().add(
|
|
6226
|
+
let Us = e.camera.position.clone().sub(a.controls.target.clone()).normalize();
|
|
6227
|
+
var T = E.clone().add(Us.multiplyScalar(2 * w.max.distanceTo(w.min)));
|
|
6222
6228
|
P(e.camera.position, T, a.controls.target.clone(), E, null, null, f);
|
|
6223
6229
|
}
|
|
6224
6230
|
};
|
|
@@ -6331,7 +6337,7 @@ function Ka(a, e, t) {
|
|
|
6331
6337
|
}
|
|
6332
6338
|
}
|
|
6333
6339
|
function k() {
|
|
6334
|
-
i.sceneOrtho =
|
|
6340
|
+
i.sceneOrtho = qa();
|
|
6335
6341
|
var E = t.clientWidth, _ = t.clientWidth, w = E > _ ? E / _ : _ / E, f = 300;
|
|
6336
6342
|
i.camera = new Be(
|
|
6337
6343
|
f * w / -2,
|
|
@@ -6346,7 +6352,7 @@ function Ka(a, e, t) {
|
|
|
6346
6352
|
});
|
|
6347
6353
|
D.setSize(E, _), D.setClearAlpha(0), i.sceneOrtho.renderer = D;
|
|
6348
6354
|
let T = new $t(16777215, 0.8);
|
|
6349
|
-
i.sceneOrtho.add(T),
|
|
6355
|
+
i.sceneOrtho.add(T), Ka(o, D), i.orbitControls = new is(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", te), i.orbitControls.addEventListener("end", Q);
|
|
6350
6356
|
}
|
|
6351
6357
|
let O = !1;
|
|
6352
6358
|
function K() {
|
|
@@ -6651,7 +6657,7 @@ function Ka(a, e, t) {
|
|
|
6651
6657
|
!document.fullscreenElement && !document.webkitFullscreenElement && !document.mozFullScreenElement && !document.msFullscreenElement ? (w.requestFullscreen ? w.requestFullscreen() : w.webkitRequestFullscreen ? w.webkitRequestFullscreen() : w.mozRequestFullScreen ? w.mozRequestFullScreen() : w.msRequestFullscreen && w.msRequestFullscreen(), console.log("已进入全屏模式")) : (document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen(), console.log("已退出全屏模式"));
|
|
6652
6658
|
}, i;
|
|
6653
6659
|
}
|
|
6654
|
-
class
|
|
6660
|
+
class Ya {
|
|
6655
6661
|
engine;
|
|
6656
6662
|
cubeTool;
|
|
6657
6663
|
mainViewPort;
|
|
@@ -6659,7 +6665,7 @@ class ja {
|
|
|
6659
6665
|
this.engine = e;
|
|
6660
6666
|
}
|
|
6661
6667
|
init() {
|
|
6662
|
-
this.cubeTool =
|
|
6668
|
+
this.cubeTool = ja(this.engine, this.engine.scene, this.engine.container), this.cubeTool.init();
|
|
6663
6669
|
}
|
|
6664
6670
|
// 隐藏视图立方体,供 showViewCube=false 的初始化配置调用。
|
|
6665
6671
|
hide() {
|
|
@@ -6779,7 +6785,7 @@ class ja {
|
|
|
6779
6785
|
this.cubeTool.TakeScreenshot();
|
|
6780
6786
|
}
|
|
6781
6787
|
}
|
|
6782
|
-
function
|
|
6788
|
+
function Xa(a) {
|
|
6783
6789
|
let e = new Object(), t = null;
|
|
6784
6790
|
return e.getBoundingBox = function() {
|
|
6785
6791
|
let i = a.models, n = new d(1e8, 1e9, 1e10), s = new d(-1e8, -1e9, -1e10);
|
|
@@ -6837,12 +6843,12 @@ function Ya(a) {
|
|
|
6837
6843
|
});
|
|
6838
6844
|
});
|
|
6839
6845
|
const m = l.map((f) => O(f)).filter((f) => f instanceof z);
|
|
6840
|
-
|
|
6846
|
+
pr(i);
|
|
6841
6847
|
const b = [
|
|
6842
6848
|
...x,
|
|
6843
6849
|
...i.intersectObjects(m, !1).map(he)
|
|
6844
6850
|
].sort((f, E) => f.distance - E.distance);
|
|
6845
|
-
return
|
|
6851
|
+
return mr(i), b;
|
|
6846
6852
|
function C(f, E, _, D, T) {
|
|
6847
6853
|
if (E == null)
|
|
6848
6854
|
return;
|
|
@@ -7005,7 +7011,7 @@ function Ya(a) {
|
|
|
7005
7011
|
}
|
|
7006
7012
|
}, e;
|
|
7007
7013
|
}
|
|
7008
|
-
class
|
|
7014
|
+
class Qa {
|
|
7009
7015
|
engine;
|
|
7010
7016
|
// 绘制状态
|
|
7011
7017
|
isDrawing = !1;
|
|
@@ -7183,8 +7189,8 @@ class Xa {
|
|
|
7183
7189
|
this.disActive(), this.selectionBox?.remove(), this.selectionBox = null, this.worldToScreen = null, this.isDrawing = !1;
|
|
7184
7190
|
}
|
|
7185
7191
|
}
|
|
7186
|
-
const
|
|
7187
|
-
class
|
|
7192
|
+
const $a = F.degToRad(10), Tn = 1e-3, Pi = !1, Za = [];
|
|
7193
|
+
class Ja {
|
|
7188
7194
|
engine;
|
|
7189
7195
|
rootGroup = null;
|
|
7190
7196
|
isVisible = Pi;
|
|
@@ -7198,7 +7204,7 @@ class Za {
|
|
|
7198
7204
|
}
|
|
7199
7205
|
setMockData() {
|
|
7200
7206
|
const e = this.engine.models?.[0]?.grids;
|
|
7201
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
7207
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : Za);
|
|
7202
7208
|
}
|
|
7203
7209
|
show() {
|
|
7204
7210
|
this.isVisible = !0, this.rootGroup && (this.rootGroup.visible = !0);
|
|
@@ -7287,7 +7293,7 @@ class Za {
|
|
|
7287
7293
|
throw new Error("Grid sprite canvas context is not available");
|
|
7288
7294
|
const o = 128 / 2, r = 128 / 2, l = 128 / 2 - 4;
|
|
7289
7295
|
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);
|
|
7290
|
-
const c = new
|
|
7296
|
+
const c = new no(n), h = new so({
|
|
7291
7297
|
map: c,
|
|
7292
7298
|
depthTest: !1,
|
|
7293
7299
|
transparent: !0
|
|
@@ -7337,7 +7343,7 @@ class Za {
|
|
|
7337
7343
|
const n = this.createProjection(i);
|
|
7338
7344
|
if (!n)
|
|
7339
7345
|
return;
|
|
7340
|
-
const s = t.find((o) => o.direction.angleTo(n.direction) <=
|
|
7346
|
+
const s = t.find((o) => o.direction.angleTo(n.direction) <= $a);
|
|
7341
7347
|
if (s) {
|
|
7342
7348
|
s.axes.push(n);
|
|
7343
7349
|
return;
|
|
@@ -7367,13 +7373,13 @@ class Za {
|
|
|
7367
7373
|
}
|
|
7368
7374
|
normalizeDirection(e) {
|
|
7369
7375
|
const t = e.clone().normalize();
|
|
7370
|
-
return (t.x < 0 || Math.abs(t.x) <=
|
|
7376
|
+
return (t.x < 0 || Math.abs(t.x) <= Tn && t.y < 0) && t.multiplyScalar(-1), t;
|
|
7371
7377
|
}
|
|
7372
7378
|
/**
|
|
7373
7379
|
* 在单个轴族内优先返回点位所属的最近轴网区间,避免落在线上时出现空描述。
|
|
7374
7380
|
*/
|
|
7375
7381
|
resolveFamilyLocation(e, t) {
|
|
7376
|
-
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <=
|
|
7382
|
+
const i = t.dot(e.normal), n = e.axes.find((c) => Math.abs(c.offset - i) <= Tn) ?? null;
|
|
7377
7383
|
if (n) {
|
|
7378
7384
|
const c = e.axes.findIndex((u) => u.data.Id === n.data.Id), h = this.pickAxisPairAroundIndex(e.axes, c);
|
|
7379
7385
|
return {
|
|
@@ -7472,15 +7478,15 @@ class Za {
|
|
|
7472
7478
|
return e instanceof d ? e.clone() : new d(e.x, e.y, e.z);
|
|
7473
7479
|
}
|
|
7474
7480
|
}
|
|
7475
|
-
const
|
|
7481
|
+
const Is = "0", _s = 0, Ds = !1;
|
|
7476
7482
|
class qi {
|
|
7477
7483
|
engine;
|
|
7478
|
-
currentId =
|
|
7484
|
+
currentId = Is;
|
|
7479
7485
|
groundGroup;
|
|
7480
7486
|
groundMesh = null;
|
|
7481
7487
|
/** 当前为官方 Water 水面时为 true,用于 update/dispose 分支 */
|
|
7482
7488
|
isWaterAddon = !1;
|
|
7483
|
-
groundY =
|
|
7489
|
+
groundY = _s;
|
|
7484
7490
|
/** 默认水面法线贴图路径(项目内为 public/textture/waternormals.jpg) */
|
|
7485
7491
|
static DEFAULT_WATER_NORMALS = "/texture/waternormals.jpg";
|
|
7486
7492
|
groundList = [
|
|
@@ -7505,7 +7511,7 @@ class qi {
|
|
|
7505
7511
|
this.engine = e, this.groundGroup = new pe(), this.groundGroup.name = "groundGroup";
|
|
7506
7512
|
}
|
|
7507
7513
|
init() {
|
|
7508
|
-
this.engine.scene.add(this.groundGroup), this.groundGroup.visible =
|
|
7514
|
+
this.engine.scene.add(this.groundGroup), this.groundGroup.visible = Ds;
|
|
7509
7515
|
}
|
|
7510
7516
|
/**
|
|
7511
7517
|
* 切换地面类型
|
|
@@ -7520,7 +7526,7 @@ class qi {
|
|
|
7520
7526
|
if (i.water) {
|
|
7521
7527
|
const s = new bi(n, n), o = t?.waterNormalsUrl ?? ee(qi.DEFAULT_WATER_NORMALS, import.meta.url), r = new nt().load(o, (g) => {
|
|
7522
7528
|
g.wrapS = g.wrapT = pt;
|
|
7523
|
-
}), l = t?.sunDirection ?? new d(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, h = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, p = new
|
|
7529
|
+
}), l = t?.sunDirection ?? new d(0.5, 0.8, 0.5).normalize(), c = t?.distortionScale ?? i.distortionScale ?? 3.7, h = t?.waterSize ?? i.size ?? 1, u = t?.opacity ?? 0.92, p = new oo(s, {
|
|
7524
7530
|
textureWidth: 512,
|
|
7525
7531
|
textureHeight: 512,
|
|
7526
7532
|
waterNormals: r,
|
|
@@ -7612,12 +7618,12 @@ class qi {
|
|
|
7612
7618
|
Array.isArray(e) ? e.forEach((t) => t.dispose()) : e.dispose(), this.groundGroup.remove(this.groundMesh), this.groundMesh = null, this.isWaterAddon = !1;
|
|
7613
7619
|
}
|
|
7614
7620
|
}
|
|
7615
|
-
const Ue = "0",
|
|
7616
|
-
class
|
|
7621
|
+
const Ue = "0", el = !0, ks = 0.2, tl = 0.35;
|
|
7622
|
+
class il {
|
|
7617
7623
|
engine;
|
|
7618
7624
|
currentHdrId = Ue;
|
|
7619
|
-
isVisible =
|
|
7620
|
-
currentIntensity =
|
|
7625
|
+
isVisible = el;
|
|
7626
|
+
currentIntensity = ks;
|
|
7621
7627
|
currentTexture = null;
|
|
7622
7628
|
currentEnvironmentTexture = null;
|
|
7623
7629
|
skybox = null;
|
|
@@ -7702,10 +7708,10 @@ class tl {
|
|
|
7702
7708
|
_loadHdr(e) {
|
|
7703
7709
|
const t = ee(e, import.meta.url);
|
|
7704
7710
|
return new Promise((i, n) => {
|
|
7705
|
-
new
|
|
7711
|
+
new ro().load(
|
|
7706
7712
|
t,
|
|
7707
7713
|
(s) => {
|
|
7708
|
-
s.mapping =
|
|
7714
|
+
s.mapping = ao, i(s);
|
|
7709
7715
|
},
|
|
7710
7716
|
void 0,
|
|
7711
7717
|
(s) => n(s)
|
|
@@ -7715,7 +7721,7 @@ class tl {
|
|
|
7715
7721
|
_applyTexture(e) {
|
|
7716
7722
|
if (this.currentTexture = e, !this.engine.scene || !this.engine.renderer) return;
|
|
7717
7723
|
this._captureSceneState(), this.currentEnvironmentTexture?.dispose();
|
|
7718
|
-
const t = new
|
|
7724
|
+
const t = new Jn(this.engine.renderer), i = t.fromEquirectangular(e).texture;
|
|
7719
7725
|
t.dispose(), this.currentEnvironmentTexture = i, this.engine.scene.background = null, this.engine.scene.environment = i, this.engine.scene.environmentIntensity = this.currentIntensity, this.engine.renderer.toneMapping = Bi, this.engine.renderer.toneMappingExposure = this.previousToneMappingExposure > 0 ? this.previousToneMappingExposure : Fi, this._removeSkybox(), this._createSkybox(e), this._setAmbientLightIntensity(this._getHdrAmbientLightIntensity());
|
|
7720
7726
|
}
|
|
7721
7727
|
_captureSceneState() {
|
|
@@ -7757,20 +7763,20 @@ class tl {
|
|
|
7757
7763
|
t && (t.intensity = e);
|
|
7758
7764
|
}
|
|
7759
7765
|
_getHdrAmbientLightIntensity() {
|
|
7760
|
-
return Math.max(this.previousAmbientLightIntensity *
|
|
7766
|
+
return Math.max(this.previousAmbientLightIntensity * tl, 0);
|
|
7761
7767
|
}
|
|
7762
7768
|
_requestRender() {
|
|
7763
7769
|
this.engine?.requestComposerRender?.();
|
|
7764
7770
|
}
|
|
7765
7771
|
}
|
|
7766
|
-
const
|
|
7772
|
+
const nl = 1e-3, Ls = !1, sl = [
|
|
7767
7773
|
{ Id: "339", Name: "L1", Elevation: -0.32808398950131235 },
|
|
7768
7774
|
{ Id: "2787", Name: "L2", Elevation: 16.896325459317584 },
|
|
7769
7775
|
{ Id: "236633", Name: "L3", Elevation: 36.745406824146976 }
|
|
7770
7776
|
];
|
|
7771
|
-
class
|
|
7777
|
+
class ol {
|
|
7772
7778
|
engine;
|
|
7773
|
-
isVisible =
|
|
7779
|
+
isVisible = Ls;
|
|
7774
7780
|
levels = [];
|
|
7775
7781
|
svgContainer = null;
|
|
7776
7782
|
svgOverlay = null;
|
|
@@ -7788,7 +7794,7 @@ class sl {
|
|
|
7788
7794
|
}
|
|
7789
7795
|
setMockData() {
|
|
7790
7796
|
const e = this.engine.models?.[0]?.levels, t = this.engine.models?.[0]?.boundingBox;
|
|
7791
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
7797
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : sl, t);
|
|
7792
7798
|
}
|
|
7793
7799
|
show() {
|
|
7794
7800
|
this.isVisible = !0, this.svgContainer && (this.svgContainer.style.display = "block"), this.levels.forEach((e) => {
|
|
@@ -7821,7 +7827,7 @@ class sl {
|
|
|
7821
7827
|
const { url: i, targetPoint: n } = this.resolvePointLookupArgs(e, t), s = this.getLevelData(i).slice().sort((g, y) => g.Elevation - y.Elevation);
|
|
7822
7828
|
if (s.length === 0)
|
|
7823
7829
|
return null;
|
|
7824
|
-
const o = (n instanceof d, n.y), r = s.find((g) => Math.abs(g.Elevation - o) <=
|
|
7830
|
+
const o = (n instanceof d, n.y), r = s.find((g) => Math.abs(g.Elevation - o) <= nl) ?? null;
|
|
7825
7831
|
if (r)
|
|
7826
7832
|
return {
|
|
7827
7833
|
pointY: o,
|
|
@@ -7995,33 +8001,33 @@ class sl {
|
|
|
7995
8001
|
};
|
|
7996
8002
|
}
|
|
7997
8003
|
}
|
|
7998
|
-
const jt = !0, Ti = 0.5,
|
|
7999
|
-
function
|
|
8004
|
+
const jt = !0, Ti = 0.5, rl = 32, al = 0.3, Bs = 0.05, ll = 0.04, cl = 0.18, hl = 0.01;
|
|
8005
|
+
function dl(a) {
|
|
8000
8006
|
return !a?.min || !a?.max ? 0 : a.min.distanceTo(a.max);
|
|
8001
8007
|
}
|
|
8002
|
-
function
|
|
8008
|
+
function ul(a, e) {
|
|
8003
8009
|
return a instanceof d ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new d();
|
|
8004
8010
|
}
|
|
8005
|
-
function
|
|
8011
|
+
function pl(a, e, t) {
|
|
8006
8012
|
if (a instanceof Be)
|
|
8007
8013
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
8008
|
-
const i = a, n =
|
|
8014
|
+
const i = a, n = ul(e, t), s = i.position.distanceTo(n), o = typeof i.getEffectiveFOV == "function" ? i.getEffectiveFOV() : i.fov, r = F.degToRad(o * 0.5);
|
|
8009
8015
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
8010
8016
|
}
|
|
8011
|
-
function
|
|
8017
|
+
function ml(a, e, t, i) {
|
|
8012
8018
|
if (a == null)
|
|
8013
8019
|
return i;
|
|
8014
|
-
const n =
|
|
8020
|
+
const n = dl(t);
|
|
8015
8021
|
if (n <= 0)
|
|
8016
8022
|
return i;
|
|
8017
|
-
const s =
|
|
8023
|
+
const s = pl(a, e, t), o = Math.max(n * ll, 1), r = Math.max(n * cl, o + 1), l = F.clamp(
|
|
8018
8024
|
(s - o) / (r - o),
|
|
8019
8025
|
0,
|
|
8020
8026
|
1
|
|
8021
|
-
), c = Math.max(i *
|
|
8027
|
+
), c = Math.max(i * al, Bs);
|
|
8022
8028
|
return F.lerp(i, c, l);
|
|
8023
8029
|
}
|
|
8024
|
-
class
|
|
8030
|
+
class gl {
|
|
8025
8031
|
engine;
|
|
8026
8032
|
isActive = jt;
|
|
8027
8033
|
groupEdge;
|
|
@@ -8110,13 +8116,13 @@ class ml {
|
|
|
8110
8116
|
// 启动
|
|
8111
8117
|
active() {
|
|
8112
8118
|
this.isActive = !0, this.groupEdge.visible = !this.explodeHidden, this.engine.scene.traverse((e) => {
|
|
8113
|
-
e.isMesh && e.material &&
|
|
8119
|
+
e.isMesh && e.material && hn(e, !0);
|
|
8114
8120
|
}), this.update(), this.show();
|
|
8115
8121
|
}
|
|
8116
8122
|
// 关闭
|
|
8117
8123
|
disActive() {
|
|
8118
8124
|
this.isActive = !1, this.groupEdge.visible = !1, this.engine.scene.traverse((e) => {
|
|
8119
|
-
e.isMesh && e.material &&
|
|
8125
|
+
e.isMesh && e.material && hn(e, !1);
|
|
8120
8126
|
});
|
|
8121
8127
|
}
|
|
8122
8128
|
isEnabled() {
|
|
@@ -8132,13 +8138,13 @@ class ml {
|
|
|
8132
8138
|
update() {
|
|
8133
8139
|
if (!this.isActive || !this.material)
|
|
8134
8140
|
return;
|
|
8135
|
-
const e =
|
|
8141
|
+
const e = ml(
|
|
8136
8142
|
this.engine?.camera,
|
|
8137
8143
|
this.engine?.controls?.target,
|
|
8138
8144
|
this.engine?.octreeBox?.getBoundingBox?.(),
|
|
8139
8145
|
this.baseOpacity
|
|
8140
8146
|
);
|
|
8141
|
-
Math.abs(this.material.opacity - e) <=
|
|
8147
|
+
Math.abs(this.material.opacity - e) <= hl || (this.material.opacity = e, this.material.needsUpdate = !0);
|
|
8142
8148
|
}
|
|
8143
8149
|
hasPendingModelEdges() {
|
|
8144
8150
|
return (this.engine?.models ?? []).some((t) => this.shouldLoadModelEdge(t) && !Array.isArray(t?.modelEdge));
|
|
@@ -8271,7 +8277,7 @@ class ml {
|
|
|
8271
8277
|
if (i.ids.forEach((l) => {
|
|
8272
8278
|
const c = n?.get(Number(l)), h = typeof c == "number" ? this.getEdgePointsByIndex(i.url, c) : null;
|
|
8273
8279
|
if (Array.isArray(h)) {
|
|
8274
|
-
if (h.length >
|
|
8280
|
+
if (h.length > rl)
|
|
8275
8281
|
return;
|
|
8276
8282
|
this.appendEdgePositions(s, h);
|
|
8277
8283
|
}
|
|
@@ -8330,7 +8336,7 @@ class ml {
|
|
|
8330
8336
|
}
|
|
8331
8337
|
// 设置边线材质透明度
|
|
8332
8338
|
setOpacity(e) {
|
|
8333
|
-
this.baseOpacity = F.clamp(e,
|
|
8339
|
+
this.baseOpacity = F.clamp(e, Bs, 1), this.update();
|
|
8334
8340
|
}
|
|
8335
8341
|
// 显示边线
|
|
8336
8342
|
showModelEdge(e, t) {
|
|
@@ -8361,7 +8367,7 @@ class ml {
|
|
|
8361
8367
|
this.releaseIndexes(e);
|
|
8362
8368
|
}
|
|
8363
8369
|
}
|
|
8364
|
-
const
|
|
8370
|
+
const In = {
|
|
8365
8371
|
turbidity: 10,
|
|
8366
8372
|
rayleigh: 3,
|
|
8367
8373
|
mieCoefficient: 5e-3,
|
|
@@ -8374,7 +8380,7 @@ const Tn = {
|
|
|
8374
8380
|
cloudDensity: 0.4,
|
|
8375
8381
|
cloudElevation: 0.5,
|
|
8376
8382
|
showSunDisc: !0
|
|
8377
|
-
}, Ii = "sunrise_clear",
|
|
8383
|
+
}, Ii = "sunrise_clear", zs = 0.2, _i = [
|
|
8378
8384
|
{
|
|
8379
8385
|
id: "sunrise_clear",
|
|
8380
8386
|
names: ["晴朗日出", "晴朗日出", "Clear Sunrise"],
|
|
@@ -8545,17 +8551,17 @@ const Tn = {
|
|
|
8545
8551
|
showSunDisc: !1
|
|
8546
8552
|
}
|
|
8547
8553
|
}
|
|
8548
|
-
],
|
|
8554
|
+
], _n = _i.reduce(
|
|
8549
8555
|
(a, e) => (a[e.id] = e, a),
|
|
8550
8556
|
{}
|
|
8551
|
-
),
|
|
8552
|
-
class
|
|
8557
|
+
), Dn = 2e6;
|
|
8558
|
+
class fl {
|
|
8553
8559
|
engine;
|
|
8554
8560
|
sky = null;
|
|
8555
8561
|
sun = new d();
|
|
8556
|
-
params = { ...
|
|
8562
|
+
params = { ...In, ..._n[Ii].params };
|
|
8557
8563
|
currentPreset = Ii;
|
|
8558
|
-
currentIntensity =
|
|
8564
|
+
currentIntensity = zs;
|
|
8559
8565
|
currentEnvironmentTarget = null;
|
|
8560
8566
|
skyScale = 45e4;
|
|
8561
8567
|
skyName = "bim_engine_sky";
|
|
@@ -8576,7 +8582,7 @@ class gl {
|
|
|
8576
8582
|
this.sky.visible = !0, this._captureSceneState(), this._expandCameraFarForSky(), this._applyParamsToSky();
|
|
8577
8583
|
return;
|
|
8578
8584
|
}
|
|
8579
|
-
const e = new
|
|
8585
|
+
const e = new lo();
|
|
8580
8586
|
e.scale.setScalar(this.skyScale), e.name = this.skyName, this.sky = e, this.engine.scene.add(e), this._captureSceneState(), this._expandCameraFarForSky(), this.engine.renderer && (this.engine.renderer.toneMapping = Qi, this.engine.scene.background = null), this._applyParamsToSky();
|
|
8581
8587
|
}
|
|
8582
8588
|
close(e = !0) {
|
|
@@ -8592,8 +8598,8 @@ class gl {
|
|
|
8592
8598
|
Object.assign(this.params, e), this._applyParamsToSky(), this.engine?.renderer && (e.exposure !== void 0 || e.orthoExposureScale !== void 0) && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure());
|
|
8593
8599
|
}
|
|
8594
8600
|
setPreset(e) {
|
|
8595
|
-
const t =
|
|
8596
|
-
t && (this.currentPreset = e, this.params = { ...
|
|
8601
|
+
const t = _n[e];
|
|
8602
|
+
t && (this.currentPreset = e, this.params = { ...In, ...t.params }, this._applyParamsToSky(), this.engine?.renderer && (this.engine.renderer.toneMappingExposure = this._getEffectiveExposure()));
|
|
8597
8603
|
}
|
|
8598
8604
|
getCurrentPreset() {
|
|
8599
8605
|
return this.currentPreset;
|
|
@@ -8637,7 +8643,7 @@ class gl {
|
|
|
8637
8643
|
const e = this.engine?.camera;
|
|
8638
8644
|
if (!e || typeof e.far != "number") return;
|
|
8639
8645
|
const t = e.far;
|
|
8640
|
-
t >=
|
|
8646
|
+
t >= Dn || (this.savedCameraFar == null && (this.savedCameraFar = t), e.far = Dn, typeof e.updateProjectionMatrix == "function" && e.updateProjectionMatrix());
|
|
8641
8647
|
}
|
|
8642
8648
|
_restoreCameraFar() {
|
|
8643
8649
|
if (this.savedCameraFar == null || !this.engine?.camera) return;
|
|
@@ -8662,7 +8668,7 @@ class gl {
|
|
|
8662
8668
|
this._disposeEnvironmentTarget();
|
|
8663
8669
|
const e = new ki(), t = this.sky.clone();
|
|
8664
8670
|
t.material = this.sky.material.clone(), e.add(t);
|
|
8665
|
-
const i = new
|
|
8671
|
+
const i = new Jn(this.engine.renderer);
|
|
8666
8672
|
this.currentEnvironmentTarget = i.fromScene(e, 0, 0.1, this.skyScale * 2), i.dispose(), this.engine.scene.background = null, this.engine.scene.environment = this.currentEnvironmentTarget.texture, this.engine.scene.environmentIntensity = this.currentIntensity, t.material.dispose();
|
|
8667
8673
|
}
|
|
8668
8674
|
_disposeEnvironmentTarget() {
|
|
@@ -8673,7 +8679,7 @@ class gl {
|
|
|
8673
8679
|
n && (i instanceof d && typeof n.value?.copy == "function" ? n.value.copy(i) : n.value = i);
|
|
8674
8680
|
}
|
|
8675
8681
|
}
|
|
8676
|
-
class
|
|
8682
|
+
class yl {
|
|
8677
8683
|
/** 寮曟搸瀹炰緥寮曠敤 */
|
|
8678
8684
|
engine;
|
|
8679
8685
|
defaultSettings;
|
|
@@ -8805,28 +8811,28 @@ class fl {
|
|
|
8805
8811
|
return {
|
|
8806
8812
|
render: {
|
|
8807
8813
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
8808
|
-
contrast: this._uniformToPercent(t,
|
|
8809
|
-
saturation: this._uniformToPercent(e,
|
|
8814
|
+
contrast: this._uniformToPercent(t, cs),
|
|
8815
|
+
saturation: this._uniformToPercent(e, ls),
|
|
8810
8816
|
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(), bt),
|
|
8811
8817
|
lightIntensity: this._exposureToPercent(n, Fi),
|
|
8812
|
-
gtaoIntensity: this._unitToPercent(i,
|
|
8818
|
+
gtaoIntensity: this._unitToPercent(i, as)
|
|
8813
8819
|
},
|
|
8814
8820
|
display: {
|
|
8815
8821
|
showEdge: this.engine.modelEdge?.isEnabled?.() ?? jt,
|
|
8816
8822
|
edgeOpacity: this._unitToPercent(s, Ti),
|
|
8817
8823
|
showGrid: this.engine.grid?.getVisible?.() ?? Pi,
|
|
8818
|
-
showLevel: this.engine.level?.getVisible?.() ??
|
|
8819
|
-
showGround: this.engine.ground?.getVisible?.() ??
|
|
8820
|
-
groundId: this.engine.ground?.getCurrentId?.() ??
|
|
8821
|
-
groundHeight: this.engine.ground?.getHeight?.() ??
|
|
8824
|
+
showLevel: this.engine.level?.getVisible?.() ?? Ls,
|
|
8825
|
+
showGround: this.engine.ground?.getVisible?.() ?? Ds,
|
|
8826
|
+
groundId: this.engine.ground?.getCurrentId?.() ?? Is,
|
|
8827
|
+
groundHeight: this.engine.ground?.getHeight?.() ?? _s
|
|
8822
8828
|
},
|
|
8823
8829
|
environment: {
|
|
8824
8830
|
type: h ? "sky" : o !== Ue ? "hdr" : "none",
|
|
8825
8831
|
hdrId: o,
|
|
8826
|
-
hdrIntensity: this._unitToPercent(r,
|
|
8832
|
+
hdrIntensity: this._unitToPercent(r, ks),
|
|
8827
8833
|
skyPreset: c,
|
|
8828
8834
|
skyParams: {},
|
|
8829
|
-
skyIntensity: this._unitToPercent(l,
|
|
8835
|
+
skyIntensity: this._unitToPercent(l, zs)
|
|
8830
8836
|
}
|
|
8831
8837
|
};
|
|
8832
8838
|
}
|
|
@@ -8861,7 +8867,7 @@ class fl {
|
|
|
8861
8867
|
};
|
|
8862
8868
|
}
|
|
8863
8869
|
_toRenderMode(e) {
|
|
8864
|
-
return e === "simple" || e === "balance" || e === "advanced" ? e :
|
|
8870
|
+
return e === "simple" || e === "balance" || e === "advanced" ? e : Ts;
|
|
8865
8871
|
}
|
|
8866
8872
|
_uniformToPercent(e, t) {
|
|
8867
8873
|
const i = typeof e == "number" ? e : t;
|
|
@@ -9210,7 +9216,7 @@ class qe {
|
|
|
9210
9216
|
}
|
|
9211
9217
|
}
|
|
9212
9218
|
}
|
|
9213
|
-
class
|
|
9219
|
+
class Ml {
|
|
9214
9220
|
engine;
|
|
9215
9221
|
isActive = !1;
|
|
9216
9222
|
tools;
|
|
@@ -9314,7 +9320,7 @@ class yl {
|
|
|
9314
9320
|
}
|
|
9315
9321
|
}
|
|
9316
9322
|
}
|
|
9317
|
-
class
|
|
9323
|
+
class vl {
|
|
9318
9324
|
engine;
|
|
9319
9325
|
tools;
|
|
9320
9326
|
isActive = !1;
|
|
@@ -9370,7 +9376,7 @@ class Ml {
|
|
|
9370
9376
|
}
|
|
9371
9377
|
// 按下esc
|
|
9372
9378
|
}
|
|
9373
|
-
class
|
|
9379
|
+
class xl {
|
|
9374
9380
|
engine;
|
|
9375
9381
|
isActive = !1;
|
|
9376
9382
|
tools;
|
|
@@ -9425,7 +9431,7 @@ class vl {
|
|
|
9425
9431
|
t.point1 = s.point, t.point2 = n[0].point, t.text = t.point1.clone().distanceTo(t.point2.clone()), this.engine.events.trigger(se.MeasureChanged, t);
|
|
9426
9432
|
}
|
|
9427
9433
|
}
|
|
9428
|
-
class
|
|
9434
|
+
class wl {
|
|
9429
9435
|
engine;
|
|
9430
9436
|
isActive = !1;
|
|
9431
9437
|
tools;
|
|
@@ -9470,7 +9476,7 @@ class xl {
|
|
|
9470
9476
|
t.point = e.catch.point.clone(), t.text = e.catch.point.y, t.isSelect = !1, this.engine.events.trigger(se.MeasureChanged, t);
|
|
9471
9477
|
}
|
|
9472
9478
|
}
|
|
9473
|
-
class
|
|
9479
|
+
class bl {
|
|
9474
9480
|
engine;
|
|
9475
9481
|
isActive = !1;
|
|
9476
9482
|
tools;
|
|
@@ -9522,7 +9528,7 @@ class wl {
|
|
|
9522
9528
|
e != null && (e.isSelect = !1, this.engine.events.trigger(se.MeasureChanged, e));
|
|
9523
9529
|
}
|
|
9524
9530
|
}
|
|
9525
|
-
class
|
|
9531
|
+
class Cl {
|
|
9526
9532
|
engine;
|
|
9527
9533
|
tools;
|
|
9528
9534
|
// 存储三个点:起点、顶点(中间点)、终点
|
|
@@ -9590,7 +9596,7 @@ class bl {
|
|
|
9590
9596
|
}
|
|
9591
9597
|
}
|
|
9592
9598
|
}
|
|
9593
|
-
class
|
|
9599
|
+
class El {
|
|
9594
9600
|
engine;
|
|
9595
9601
|
tools;
|
|
9596
9602
|
points = [];
|
|
@@ -9817,7 +9823,7 @@ class Ct {
|
|
|
9817
9823
|
}
|
|
9818
9824
|
}
|
|
9819
9825
|
}
|
|
9820
|
-
class
|
|
9826
|
+
class Al {
|
|
9821
9827
|
engine;
|
|
9822
9828
|
isActive = !1;
|
|
9823
9829
|
points = [];
|
|
@@ -9898,7 +9904,7 @@ class El {
|
|
|
9898
9904
|
};
|
|
9899
9905
|
}
|
|
9900
9906
|
}
|
|
9901
|
-
class
|
|
9907
|
+
class Sl {
|
|
9902
9908
|
isActive = !1;
|
|
9903
9909
|
engine;
|
|
9904
9910
|
clearHeightMeasure;
|
|
@@ -9924,7 +9930,7 @@ class Al {
|
|
|
9924
9930
|
volumeAnnotation: []
|
|
9925
9931
|
};
|
|
9926
9932
|
constructor(e) {
|
|
9927
|
-
this.engine = e, this.clearHeightMeasure = new
|
|
9933
|
+
this.engine = e, this.clearHeightMeasure = new Ml(e), this.distanceMeasure = new vl(e), this.clearDistanceMeasure = new xl(e), this.elevationMeasure = new wl(e), this.pointMeasure = new bl(e), this.angleMeasure = new Cl(e), this.areaMeasure = new El(e), this.slopeMeasure = new Ct(e), this.faceDistanceMeasure = new Al(e), this.tools = new qe(e), this.annotationContainer = document.createElement("div"), this.annotationContainer.className = "annotation-container", e.container.appendChild(this.annotationContainer);
|
|
9928
9934
|
}
|
|
9929
9935
|
setContextMenuDisabled(e) {
|
|
9930
9936
|
this.engine?.engineStatus != null && (this.engine.engineStatus.isDisableContextMenu = e);
|
|
@@ -9972,7 +9978,7 @@ class Al {
|
|
|
9972
9978
|
this.engine.setIdleFrameRateExempt?.("measure", !1), this.setContextMenuDisabled(!1), this.tools.disActive(), this.clearHeightMeasure.disActive(), this.distanceMeasure.disActive(), this.clearDistanceMeasure.disActive(), this.elevationMeasure.disActive(), this.pointMeasure.disActive(), this.angleMeasure.disActive(), this.areaMeasure.disActive(), this.slopeMeasure.disActive(), this.faceDistanceMeasure.disActive(), this.clearAll(), this.annotationContainer.remove(), this.isActive = !1;
|
|
9973
9979
|
}
|
|
9974
9980
|
}
|
|
9975
|
-
class
|
|
9981
|
+
class Pl {
|
|
9976
9982
|
engine;
|
|
9977
9983
|
isActive = !1;
|
|
9978
9984
|
isCtrlDown = !1;
|
|
@@ -10491,7 +10497,7 @@ class Sl {
|
|
|
10491
10497
|
x && x.setFromNormalAndCoplanarPoint(i.clone().setLength(-1), o);
|
|
10492
10498
|
}
|
|
10493
10499
|
}
|
|
10494
|
-
class
|
|
10500
|
+
class Tl {
|
|
10495
10501
|
engine;
|
|
10496
10502
|
isActive = !1;
|
|
10497
10503
|
isDrag = !1;
|
|
@@ -11046,7 +11052,7 @@ class Pl {
|
|
|
11046
11052
|
}
|
|
11047
11053
|
}
|
|
11048
11054
|
}
|
|
11049
|
-
class
|
|
11055
|
+
class Il {
|
|
11050
11056
|
engine;
|
|
11051
11057
|
callback_;
|
|
11052
11058
|
isActive;
|
|
@@ -11077,7 +11083,7 @@ class Tl {
|
|
|
11077
11083
|
});
|
|
11078
11084
|
}
|
|
11079
11085
|
}
|
|
11080
|
-
class
|
|
11086
|
+
class _l {
|
|
11081
11087
|
/** 引擎实例(包含 scene / models / engineStatus / octreeBox 等) */
|
|
11082
11088
|
engine;
|
|
11083
11089
|
/** three-bvh-csg 计算器,负责执行布尔操作 */
|
|
@@ -11099,7 +11105,7 @@ class Il {
|
|
|
11099
11105
|
fillTextureRepeat = 60;
|
|
11100
11106
|
fillTextureRotation = 0;
|
|
11101
11107
|
constructor(e) {
|
|
11102
|
-
this.engine = e, this.evaluator = new
|
|
11108
|
+
this.engine = e, this.evaluator = new co();
|
|
11103
11109
|
const t = ee("/texture/fill.png", import.meta.url), i = new nt().load(t);
|
|
11104
11110
|
i.wrapS = pt, i.wrapT = pt, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new Ri({
|
|
11105
11111
|
color: 14079687,
|
|
@@ -11165,7 +11171,7 @@ class Il {
|
|
|
11165
11171
|
const x = this.createWorldBrushFromMesh(M);
|
|
11166
11172
|
if (x != null)
|
|
11167
11173
|
try {
|
|
11168
|
-
const b = this.evaluator.evaluate(x, c,
|
|
11174
|
+
const b = this.evaluator.evaluate(x, c, ho)?.geometry;
|
|
11169
11175
|
if (!b)
|
|
11170
11176
|
continue;
|
|
11171
11177
|
const C = this.extractPlaneCapGeometry(b, e, l);
|
|
@@ -11393,7 +11399,7 @@ class Il {
|
|
|
11393
11399
|
return { tangent: l, bitangent: c };
|
|
11394
11400
|
}
|
|
11395
11401
|
}
|
|
11396
|
-
class
|
|
11402
|
+
class Dl {
|
|
11397
11403
|
engine;
|
|
11398
11404
|
clippingTolerance = 1e-4;
|
|
11399
11405
|
sectionBox;
|
|
@@ -11405,7 +11411,7 @@ class _l {
|
|
|
11405
11411
|
fillCutFace = !0;
|
|
11406
11412
|
viewRangePlanes = null;
|
|
11407
11413
|
constructor(e) {
|
|
11408
|
-
this.engine = e, this.sectionCatchFace = new
|
|
11414
|
+
this.engine = e, this.sectionCatchFace = new Il(this.engine);
|
|
11409
11415
|
let t = new Z(new d(0, 0, 1), 1e5);
|
|
11410
11416
|
t.name = "前";
|
|
11411
11417
|
let i = new Z(new d(0, 0, 1), 1e5);
|
|
@@ -11422,7 +11428,7 @@ class _l {
|
|
|
11422
11428
|
l.name = "face", this.engine.sectionPlane = [t, i, n, s, o, r, l];
|
|
11423
11429
|
}
|
|
11424
11430
|
init() {
|
|
11425
|
-
this.sectionBox = new
|
|
11431
|
+
this.sectionBox = new Pl(this.engine), this.sectionFace = new Tl(this.engine), this.clippingCSGSimple = new _l(this.engine);
|
|
11426
11432
|
}
|
|
11427
11433
|
// 自动缩放适用的视图比例
|
|
11428
11434
|
scaleBox() {
|
|
@@ -11629,7 +11635,7 @@ class _l {
|
|
|
11629
11635
|
});
|
|
11630
11636
|
}
|
|
11631
11637
|
}
|
|
11632
|
-
class
|
|
11638
|
+
class kl {
|
|
11633
11639
|
engine;
|
|
11634
11640
|
constructor(e) {
|
|
11635
11641
|
this.engine = e;
|
|
@@ -11668,7 +11674,7 @@ class Dl {
|
|
|
11668
11674
|
}), e;
|
|
11669
11675
|
}
|
|
11670
11676
|
}
|
|
11671
|
-
class
|
|
11677
|
+
class Ll {
|
|
11672
11678
|
engine;
|
|
11673
11679
|
constructor(e) {
|
|
11674
11680
|
this.engine = e;
|
|
@@ -11706,7 +11712,7 @@ class kl {
|
|
|
11706
11712
|
});
|
|
11707
11713
|
}
|
|
11708
11714
|
}
|
|
11709
|
-
class
|
|
11715
|
+
class Bl {
|
|
11710
11716
|
engine;
|
|
11711
11717
|
// 扩展属性
|
|
11712
11718
|
extended = /* @__PURE__ */ new Map();
|
|
@@ -11832,8 +11838,8 @@ class Ll {
|
|
|
11832
11838
|
}
|
|
11833
11839
|
}
|
|
11834
11840
|
}
|
|
11835
|
-
const
|
|
11836
|
-
class
|
|
11841
|
+
const zl = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="10.8" cy="10.8" r="6.5" stroke="currentColor" stroke-width="2"/><path d="m16 16 4.3 4.3" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';
|
|
11842
|
+
class Rl {
|
|
11837
11843
|
manager;
|
|
11838
11844
|
wrapper;
|
|
11839
11845
|
input;
|
|
@@ -11849,7 +11855,7 @@ class zl {
|
|
|
11849
11855
|
this.manager = t, this.wrapper = document.createElement("div"), this.wrapper.className = "engine-3d-search", this.wrapper.innerHTML = `
|
|
11850
11856
|
<section class="engine-3d-search__box" role="dialog" aria-label="模型检索">
|
|
11851
11857
|
<div class="engine-3d-search__input-row">
|
|
11852
|
-
<span class="engine-3d-search__icon">${
|
|
11858
|
+
<span class="engine-3d-search__icon">${zl}</span>
|
|
11853
11859
|
<input class="engine-3d-search__input" type="search" placeholder="检索模型名称、构件 ID、房间" autocomplete="off" spellcheck="false" />
|
|
11854
11860
|
<button class="engine-3d-search__clear" type="button" aria-label="关闭检索框">×</button>
|
|
11855
11861
|
</div>
|
|
@@ -11952,13 +11958,13 @@ class zl {
|
|
|
11952
11958
|
this.input.removeEventListener("input", this.onInput), this.input.removeEventListener("keydown", this.onKeyDown), this.wrapper.querySelector(".engine-3d-search__clear")?.removeEventListener("click", this.onCloseClick), this.pagination.removeEventListener("click", this.onPageClick), document.removeEventListener("mousedown", this.onDocumentMouseDown), document.removeEventListener("keydown", this.onDocumentKeyDown), this.debounceTimer !== null && clearTimeout(this.debounceTimer), this.wrapper.remove();
|
|
11953
11959
|
}
|
|
11954
11960
|
}
|
|
11955
|
-
class
|
|
11961
|
+
class Ol {
|
|
11956
11962
|
engine;
|
|
11957
11963
|
searchUI = null;
|
|
11958
11964
|
constructor(e) {
|
|
11959
11965
|
this.engine = e;
|
|
11960
11966
|
const t = e?.container;
|
|
11961
|
-
t && (this.searchUI = new
|
|
11967
|
+
t && (this.searchUI = new Rl(t, this), this.setTheme(e?.options?.searchTheme === "light" ? "light" : "dark"));
|
|
11962
11968
|
}
|
|
11963
11969
|
/** 按名称、ID、房间名称/编号检索已加载模型。 */
|
|
11964
11970
|
search(e, t = {}) {
|
|
@@ -12096,7 +12102,7 @@ class Rl {
|
|
|
12096
12102
|
return s < 0 ? null : (s === 0 ? 1e3 : 500) - s - Math.max(0, n.length - t.length) * 0.01;
|
|
12097
12103
|
}
|
|
12098
12104
|
}
|
|
12099
|
-
class
|
|
12105
|
+
class Fl {
|
|
12100
12106
|
engine;
|
|
12101
12107
|
constructor(e) {
|
|
12102
12108
|
this.engine = e;
|
|
@@ -12189,14 +12195,14 @@ class Ol {
|
|
|
12189
12195
|
}), t && t(i), i;
|
|
12190
12196
|
}
|
|
12191
12197
|
}
|
|
12192
|
-
const
|
|
12193
|
-
class
|
|
12198
|
+
const kn = !1, Nl = 51283, Hl = 2718207;
|
|
12199
|
+
class Vl {
|
|
12194
12200
|
engine;
|
|
12195
12201
|
rootGroup;
|
|
12196
12202
|
meshMaterial;
|
|
12197
12203
|
instanceMaterial;
|
|
12198
12204
|
handleLoadingCompleted;
|
|
12199
|
-
isVisible =
|
|
12205
|
+
isVisible = kn;
|
|
12200
12206
|
filterState = {
|
|
12201
12207
|
urls: null,
|
|
12202
12208
|
ids: null,
|
|
@@ -12204,7 +12210,7 @@ class Hl {
|
|
|
12204
12210
|
showInstance: !0
|
|
12205
12211
|
};
|
|
12206
12212
|
constructor(e) {
|
|
12207
|
-
this.engine = e, this.rootGroup = new pe(), this.rootGroup.name = "nodeBoxGroup", this.rootGroup.visible =
|
|
12213
|
+
this.engine = e, this.rootGroup = new pe(), this.rootGroup.name = "nodeBoxGroup", this.rootGroup.visible = kn, this.engine.scene?.add(this.rootGroup), this.meshMaterial = this.createMaterial(Nl), this.instanceMaterial = this.createMaterial(Hl), this.handleLoadingCompleted = () => {
|
|
12208
12214
|
this.isVisible && this.rebuild();
|
|
12209
12215
|
}, this.engine.events?.on?.(ne.LoadingCompleted, this.handleLoadingCompleted);
|
|
12210
12216
|
}
|
|
@@ -12335,8 +12341,8 @@ class Hl {
|
|
|
12335
12341
|
e.matrixAutoUpdate = !1, e.matrix.copy(t), e.matrixWorldNeedsUpdate = !0, e.updateMatrixWorld(!0);
|
|
12336
12342
|
}
|
|
12337
12343
|
}
|
|
12338
|
-
const
|
|
12339
|
-
class
|
|
12344
|
+
const Ul = "path-roaming-animation", Wl = 8e3, Gl = 100, Vt = 16;
|
|
12345
|
+
class ql {
|
|
12340
12346
|
engine;
|
|
12341
12347
|
points = [];
|
|
12342
12348
|
status = "idle";
|
|
@@ -12686,7 +12692,7 @@ class Gl {
|
|
|
12686
12692
|
const t = e.loopMode ?? (e.loop ? "repeat" : "none");
|
|
12687
12693
|
return {
|
|
12688
12694
|
...e,
|
|
12689
|
-
duration: this.toPositiveNumber(e.duration,
|
|
12695
|
+
duration: this.toPositiveNumber(e.duration, Wl),
|
|
12690
12696
|
playbackRate: this.toPositiveNumber(e.playbackRate, 1),
|
|
12691
12697
|
timing: "distance",
|
|
12692
12698
|
positionInterpolation: "linear",
|
|
@@ -12696,7 +12702,7 @@ class Gl {
|
|
|
12696
12702
|
loopMode: t,
|
|
12697
12703
|
loopCount: e.loopCount === void 0 ? Number.POSITIVE_INFINITY : Math.max(Math.floor(this.toNonNegativeNumber(e.loopCount, 0)), 0),
|
|
12698
12704
|
direction: e.direction ?? "forward",
|
|
12699
|
-
maxFrameDelta: this.toPositiveNumber(e.maxFrameDelta,
|
|
12705
|
+
maxFrameDelta: this.toPositiveNumber(e.maxFrameDelta, Gl)
|
|
12700
12706
|
};
|
|
12701
12707
|
}
|
|
12702
12708
|
/** 规范化外部关键帧,并以四元数作为旋转的权威数据。 */
|
|
@@ -12790,7 +12796,7 @@ class Gl {
|
|
|
12790
12796
|
}
|
|
12791
12797
|
/** 播放期间解除引擎空闲限帧。 */
|
|
12792
12798
|
setFrameRateExempt(e) {
|
|
12793
|
-
this.engine.setIdleFrameRateExempt?.(
|
|
12799
|
+
this.engine.setIdleFrameRateExempt?.(Ul, e);
|
|
12794
12800
|
}
|
|
12795
12801
|
isValidPointIndex(e) {
|
|
12796
12802
|
return Number.isInteger(e) && e >= 0 && e < this.points.length;
|
|
@@ -12851,7 +12857,7 @@ class Gl {
|
|
|
12851
12857
|
return { x: e.x, y: e.y, z: e.z, w: e.w };
|
|
12852
12858
|
}
|
|
12853
12859
|
}
|
|
12854
|
-
class
|
|
12860
|
+
class Kl {
|
|
12855
12861
|
engine;
|
|
12856
12862
|
miniMapCamera = null;
|
|
12857
12863
|
miniMapRenderer = null;
|
|
@@ -13253,7 +13259,7 @@ class ql {
|
|
|
13253
13259
|
p.rotateYaw(-c);
|
|
13254
13260
|
return;
|
|
13255
13261
|
}
|
|
13256
|
-
const g = i.getWorldDirection(new d()).multiplyScalar(h), y = new
|
|
13262
|
+
const g = i.getWorldDirection(new d()).multiplyScalar(h), y = new uo().setFromVector3(g);
|
|
13257
13263
|
y.theta -= c, g.setFromSpherical(y), n.target?.copy(i.position).add(g), n.update?.(), this.engine.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.();
|
|
13258
13264
|
}
|
|
13259
13265
|
drawOverlay() {
|
|
@@ -13312,7 +13318,7 @@ class ql {
|
|
|
13312
13318
|
this.miniMapContainer && (this.miniMapContainer.removeEventListener("wheel", this.onWheel), this.miniMapContainer.removeEventListener("mousedown", this.onMouseDown), this.miniMapContainer.removeEventListener("mousemove", this.onMouseMove), this.miniMapContainer.removeEventListener("mouseup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointerdown", this.onMouseDown), this.miniMapContainer.removeEventListener("pointermove", this.onMouseMove), this.miniMapContainer.removeEventListener("pointerup", this.onMouseUp), this.miniMapContainer.removeEventListener("pointercancel", this.onMouseUp), this.miniMapContainer.removeEventListener("mouseenter", this.onMouseEnter), this.miniMapContainer.removeEventListener("mouseleave", this.onMouseLeave)), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("pointermove", this.onMouseMove), window.removeEventListener("pointerup", this.onMouseUp), window.removeEventListener("pointercancel", this.onMouseUp), window.removeEventListener("resize", this.onWindowResize), this.sizeToggleButton?.removeEventListener("click", this.onSizeToggleClick), this.resizeHandle?.removeEventListener("mousedown", this.onResizeHandleMouseDown), this.resizeHandle?.removeEventListener("pointerdown", this.onResizeHandleMouseDown), this.modelSelect?.removeEventListener("change", this.onModelChange), this.levelSelect?.removeEventListener("change", this.onLevelChange), this.engine.events?.off?.(this.loadingCompletedEventName, this.onLoadingCompleted), this.miniMapRenderer && (this.miniMapRenderer.dispose(), this.miniMapRenderer = null), this.miniMapContainer && (this.miniMapContainer.remove(), this.miniMapContainer = null), this.miniMapCamera = null, this.overlayCtx = null, this.overlayCanvas = null, this.levelToolbar = null, this.sizeToggleButton = null, this.resizeHandle = null, this.modelSelect = null, this.levelSelect = null, this.levelModels = [], this.levelDataSignature = "", this.selectedModelUrl = null;
|
|
13313
13319
|
}
|
|
13314
13320
|
}
|
|
13315
|
-
class
|
|
13321
|
+
class jl {
|
|
13316
13322
|
engine;
|
|
13317
13323
|
constructor(e) {
|
|
13318
13324
|
this.engine = e;
|
|
@@ -13609,26 +13615,26 @@ class Kl {
|
|
|
13609
13615
|
return Math.abs(s.dot(e)) < 0.999 ? s : new d(1, 0, 0);
|
|
13610
13616
|
}
|
|
13611
13617
|
}
|
|
13612
|
-
class
|
|
13618
|
+
class Yl {
|
|
13613
13619
|
engine;
|
|
13614
13620
|
constructor(e) {
|
|
13615
13621
|
}
|
|
13616
13622
|
update() {
|
|
13617
13623
|
}
|
|
13618
13624
|
}
|
|
13619
|
-
const
|
|
13620
|
-
class
|
|
13625
|
+
const Ln = "bim-engine:link-element-2d3d-state", Bn = "link-element-2d3d";
|
|
13626
|
+
class Xl {
|
|
13621
13627
|
engine;
|
|
13622
13628
|
constructor(e) {
|
|
13623
13629
|
this.engine = e, this.active();
|
|
13624
13630
|
}
|
|
13625
13631
|
// 激活
|
|
13626
13632
|
active() {
|
|
13627
|
-
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(
|
|
13633
|
+
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(Ln, this.listenLinkStateChange);
|
|
13628
13634
|
}
|
|
13629
13635
|
// 取消
|
|
13630
13636
|
disActive() {
|
|
13631
|
-
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(
|
|
13637
|
+
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(Ln, this.listenLinkStateChange), this.engine?.setIdleFrameRateExempt?.(Bn, !1);
|
|
13632
13638
|
}
|
|
13633
13639
|
dispose() {
|
|
13634
13640
|
this.disActive();
|
|
@@ -13648,10 +13654,10 @@ class Yl {
|
|
|
13648
13654
|
/** 二三维模型联动开启时保持 3D 引擎全帧渲染,避免等待空闲限帧间隔。 */
|
|
13649
13655
|
listenLinkStateChange = (e) => {
|
|
13650
13656
|
const t = e.detail?.enabled === !0;
|
|
13651
|
-
this.engine?.setIdleFrameRateExempt?.(
|
|
13657
|
+
this.engine?.setIdleFrameRateExempt?.(Bn, t);
|
|
13652
13658
|
};
|
|
13653
13659
|
}
|
|
13654
|
-
class
|
|
13660
|
+
class Ql {
|
|
13655
13661
|
engine;
|
|
13656
13662
|
constructor(e) {
|
|
13657
13663
|
this.engine = e, this.active();
|
|
@@ -13705,7 +13711,7 @@ const ht = {
|
|
|
13705
13711
|
EncodingComplete: "encoding-complete",
|
|
13706
13712
|
EncodingError: "encoding-error"
|
|
13707
13713
|
};
|
|
13708
|
-
class
|
|
13714
|
+
class $l {
|
|
13709
13715
|
engine;
|
|
13710
13716
|
apiKey;
|
|
13711
13717
|
baseURL = "https://api.deepseek.com";
|
|
@@ -13893,12 +13899,12 @@ class Ql {
|
|
|
13893
13899
|
}
|
|
13894
13900
|
}
|
|
13895
13901
|
}
|
|
13896
|
-
const fi = 1 / 0.3048,
|
|
13902
|
+
const fi = 1 / 0.3048, Zl = 1, Jl = 1.8, zn = /* @__PURE__ */ new Set([
|
|
13897
13903
|
"dynamic-elevation-bar-area",
|
|
13898
13904
|
"dynamic-elevation-guest-area",
|
|
13899
13905
|
"dynamic-elevation-door-head-area"
|
|
13900
|
-
]),
|
|
13901
|
-
class
|
|
13906
|
+
]), ec = ["台面"], tc = ["咖啡机"], ic = ["门店编号"], nc = ["发光logo", "发光Logo"];
|
|
13907
|
+
class sc {
|
|
13902
13908
|
engine;
|
|
13903
13909
|
constructor(e) {
|
|
13904
13910
|
this.engine = e;
|
|
@@ -13912,10 +13918,10 @@ class nc {
|
|
|
13912
13918
|
return null;
|
|
13913
13919
|
const t = e.views ?? {}, i = (t.Elevations ?? []).filter((o) => {
|
|
13914
13920
|
const r = o?.Id ?? o?.id;
|
|
13915
|
-
return !
|
|
13921
|
+
return !zn.has(String(r ?? ""));
|
|
13916
13922
|
}), n = (t.DynamicViews ?? []).filter((o) => {
|
|
13917
13923
|
const r = o?.Id ?? o?.id, l = String(r ?? "");
|
|
13918
|
-
return !
|
|
13924
|
+
return !zn.has(l) && !l.startsWith("dynamic-elevation-door-head-area");
|
|
13919
13925
|
}), s = this.generate(e);
|
|
13920
13926
|
return e.views = {
|
|
13921
13927
|
...t,
|
|
@@ -13932,7 +13938,7 @@ class nc {
|
|
|
13932
13938
|
generate(e) {
|
|
13933
13939
|
if (!(e?.nodesMap instanceof Map) || e.nodesMap.size === 0)
|
|
13934
13940
|
return [];
|
|
13935
|
-
const t = this.collectMergedWorldBoxByKeywords(e,
|
|
13941
|
+
const t = this.collectMergedWorldBoxByKeywords(e, ec), i = this.collectMergedWorldBoxByKeywords(e, tc), n = this.collectMergedWorldBoxByKeywords(e, ic), s = this.collectWorldBoxesByKeywords(e, nc), o = [];
|
|
13936
13942
|
if (t && i && n) {
|
|
13937
13943
|
const r = this.createBarAreaView(t, i, n), l = this.createGuestAreaView(t, i, n);
|
|
13938
13944
|
r && o.push(r), l && o.push(l);
|
|
@@ -14023,8 +14029,8 @@ class nc {
|
|
|
14023
14029
|
* 相机始终在观察面外侧偏移固定距离,且高度统一锁定为 1.8 米。
|
|
14024
14030
|
*/
|
|
14025
14031
|
createCameraPosition(e, t) {
|
|
14026
|
-
const i = e.clone().add(t.clone().multiplyScalar(
|
|
14027
|
-
return i.y =
|
|
14032
|
+
const i = e.clone().add(t.clone().multiplyScalar(Zl));
|
|
14033
|
+
return i.y = Jl, i;
|
|
14028
14034
|
}
|
|
14029
14035
|
/**
|
|
14030
14036
|
* 将 three.js 空间中的观察参数转换成运行时立面视图结构。
|
|
@@ -14199,8 +14205,8 @@ class nc {
|
|
|
14199
14205
|
};
|
|
14200
14206
|
}
|
|
14201
14207
|
}
|
|
14202
|
-
const
|
|
14203
|
-
function
|
|
14208
|
+
const Rn = 16, On = 0.02, yi = 1e-6, oc = 600;
|
|
14209
|
+
function Rs() {
|
|
14204
14210
|
return {
|
|
14205
14211
|
ceilingPlans: [],
|
|
14206
14212
|
elevations: [],
|
|
@@ -14209,14 +14215,14 @@ function zs() {
|
|
|
14209
14215
|
sections: []
|
|
14210
14216
|
};
|
|
14211
14217
|
}
|
|
14212
|
-
function
|
|
14218
|
+
function Os(a, e) {
|
|
14213
14219
|
return {
|
|
14214
14220
|
id: a.Id ?? a.id,
|
|
14215
14221
|
name: a.Name ?? a.name,
|
|
14216
14222
|
url: e
|
|
14217
14223
|
};
|
|
14218
14224
|
}
|
|
14219
|
-
class
|
|
14225
|
+
class rc {
|
|
14220
14226
|
engine;
|
|
14221
14227
|
resolveViewTree;
|
|
14222
14228
|
openView;
|
|
@@ -14226,7 +14232,7 @@ class oc {
|
|
|
14226
14232
|
}
|
|
14227
14233
|
/** 获取构件可见的动态视图,并可选择直接打开第一个匹配项。 */
|
|
14228
14234
|
getElementVisibleViews(e, t, i = !1) {
|
|
14229
|
-
const n =
|
|
14235
|
+
const n = Rs(), s = this.engine.models.find((p) => p.url === e);
|
|
14230
14236
|
if (!s)
|
|
14231
14237
|
return n;
|
|
14232
14238
|
const o = this.findModelNode(s, t), r = this.getNodeWorldBox(s, o), l = this.resolveViewTree(e);
|
|
@@ -14239,7 +14245,7 @@ class oc {
|
|
|
14239
14245
|
h = p.length > 0 ? p : [this.getNearestCameraCandidate(c, r)];
|
|
14240
14246
|
}
|
|
14241
14247
|
h.forEach((p) => {
|
|
14242
|
-
n.dynamicViews.push(
|
|
14248
|
+
n.dynamicViews.push(Os(p.view, e));
|
|
14243
14249
|
});
|
|
14244
14250
|
const u = n.dynamicViews[0];
|
|
14245
14251
|
return i && u ? this.openView(u.url, u.id, () => {
|
|
@@ -14299,14 +14305,14 @@ class oc {
|
|
|
14299
14305
|
t.projectionMatrix,
|
|
14300
14306
|
t.matrixWorldInverse
|
|
14301
14307
|
);
|
|
14302
|
-
if (new
|
|
14308
|
+
if (new po().setFromProjectionMatrix(i).intersectsBox(e))
|
|
14303
14309
|
return;
|
|
14304
14310
|
const s = e.getCenter(new d()), o = this.engine.cameraModule?.rotateToTarget;
|
|
14305
14311
|
if (typeof o == "function") {
|
|
14306
14312
|
o.call(
|
|
14307
14313
|
this.engine.cameraModule,
|
|
14308
14314
|
s,
|
|
14309
|
-
|
|
14315
|
+
oc,
|
|
14310
14316
|
() => this.syncControlRotationState()
|
|
14311
14317
|
);
|
|
14312
14318
|
return;
|
|
@@ -14329,13 +14335,13 @@ class oc {
|
|
|
14329
14335
|
*/
|
|
14330
14336
|
createElementSamplePoints(e, t, i, n) {
|
|
14331
14337
|
const s = this.collectSampleSources(e, t), o = [];
|
|
14332
|
-
for (let r = 0; r <
|
|
14338
|
+
for (let r = 0; r < Rn && s.length > 0; r++) {
|
|
14333
14339
|
const l = s[r % s.length], c = this.sampleGeometrySurface(l, n);
|
|
14334
14340
|
c && o.push(c);
|
|
14335
14341
|
}
|
|
14336
14342
|
if (o.length > 0)
|
|
14337
14343
|
return o;
|
|
14338
|
-
for (o.push(i.getCenter(new d())); o.length <
|
|
14344
|
+
for (o.push(i.getCenter(new d())); o.length < Rn; )
|
|
14339
14345
|
o.push(new d(
|
|
14340
14346
|
F.lerp(i.min.x, i.max.x, n()),
|
|
14341
14347
|
F.lerp(i.min.y, i.max.y, n()),
|
|
@@ -14382,9 +14388,9 @@ class oc {
|
|
|
14382
14388
|
if (typeof s != "function")
|
|
14383
14389
|
return !1;
|
|
14384
14390
|
const o = t.clone().sub(e), r = o.length();
|
|
14385
|
-
if (r <=
|
|
14391
|
+
if (r <= On)
|
|
14386
14392
|
return !0;
|
|
14387
|
-
this.raycaster.near = 0, this.raycaster.far = r +
|
|
14393
|
+
this.raycaster.near = 0, this.raycaster.far = r + On, this.raycaster.set(e, o.normalize());
|
|
14388
14394
|
const c = (s.call(
|
|
14389
14395
|
this.engine.octreeBox,
|
|
14390
14396
|
this.raycaster,
|
|
@@ -14429,12 +14435,12 @@ const Ut = {
|
|
|
14429
14435
|
floorPlan: "楼层平面",
|
|
14430
14436
|
elevation: "立面视图",
|
|
14431
14437
|
section: "剖面视图"
|
|
14432
|
-
},
|
|
14438
|
+
}, ac = {
|
|
14433
14439
|
ceilingPlan: [Ut.ceilingPlan, "天花"],
|
|
14434
14440
|
floorPlan: [Ut.floorPlan, "楼层"],
|
|
14435
14441
|
elevation: [Ut.elevation, "立面"],
|
|
14436
14442
|
section: [Ut.section, "剖面"]
|
|
14437
|
-
},
|
|
14443
|
+
}, lc = [
|
|
14438
14444
|
["CeilingPlans", "ceilingPlans"],
|
|
14439
14445
|
["Elevations", "elevations"],
|
|
14440
14446
|
["DynamicViews", "dynamicViews"],
|
|
@@ -14448,7 +14454,7 @@ class Ki {
|
|
|
14448
14454
|
dynamicViewVisibility;
|
|
14449
14455
|
/** 管理模型原生视图与运行时动态视图的统一入口。 */
|
|
14450
14456
|
constructor(e) {
|
|
14451
|
-
this.engine = e, this.dynamicElevationViewGenerator = new
|
|
14457
|
+
this.engine = e, this.dynamicElevationViewGenerator = new sc(e), this.dynamicViewVisibility = new rc(
|
|
14452
14458
|
e,
|
|
14453
14459
|
(t) => this.getResolvedViewTree(t),
|
|
14454
14460
|
(t, i, n) => this.openViewInternal(t, i, n)
|
|
@@ -14467,10 +14473,10 @@ class Ki {
|
|
|
14467
14473
|
}
|
|
14468
14474
|
/** 获取单个模型的视图树数据,并补充运行时生成的动态视图分类。 */
|
|
14469
14475
|
getViewTreeData(e) {
|
|
14470
|
-
const t = this.getResolvedViewTree(e), i =
|
|
14471
|
-
return t &&
|
|
14476
|
+
const t = this.getResolvedViewTree(e), i = Rs();
|
|
14477
|
+
return t && lc.forEach(([n, s]) => {
|
|
14472
14478
|
(t[n] ?? []).forEach((o) => {
|
|
14473
|
-
i[s].push(
|
|
14479
|
+
i[s].push(Os(o, e));
|
|
14474
14480
|
});
|
|
14475
14481
|
}), i;
|
|
14476
14482
|
}
|
|
@@ -14583,7 +14589,7 @@ class Ki {
|
|
|
14583
14589
|
const t = String(e ?? "").replace(/\s+/g, "");
|
|
14584
14590
|
if (!t)
|
|
14585
14591
|
return "unknown";
|
|
14586
|
-
const i = Object.entries(
|
|
14592
|
+
const i = Object.entries(ac);
|
|
14587
14593
|
for (const [n, s] of i)
|
|
14588
14594
|
if (s.some((o) => t.includes(o)))
|
|
14589
14595
|
return n;
|
|
@@ -14620,7 +14626,7 @@ class Ki {
|
|
|
14620
14626
|
!t || t.isEmpty?.() || this.engine.viewCube?.zoomToModel?.(t, e);
|
|
14621
14627
|
}
|
|
14622
14628
|
}
|
|
14623
|
-
class
|
|
14629
|
+
class cc {
|
|
14624
14630
|
constructor(e) {
|
|
14625
14631
|
}
|
|
14626
14632
|
/** 3D 独立包不支持加载 2D 视图。 */
|
|
@@ -14631,16 +14637,16 @@ class lc {
|
|
|
14631
14637
|
removeSectionPlane() {
|
|
14632
14638
|
}
|
|
14633
14639
|
}
|
|
14634
|
-
function
|
|
14640
|
+
function hc(a, e, t = "bim-snapshot.png") {
|
|
14635
14641
|
const i = a?.renderer, n = i?.domElement;
|
|
14636
14642
|
if (!i || !n || !e)
|
|
14637
14643
|
return null;
|
|
14638
14644
|
const s = n.width || n.clientWidth, o = n.height || n.clientHeight;
|
|
14639
14645
|
if (s <= 0 || o <= 0)
|
|
14640
14646
|
return null;
|
|
14641
|
-
let r =
|
|
14642
|
-
if (!
|
|
14643
|
-
const p =
|
|
14647
|
+
let r = dc(n, s, o);
|
|
14648
|
+
if (!uc(r)) {
|
|
14649
|
+
const p = pc(a, s, o);
|
|
14644
14650
|
p && (r = p);
|
|
14645
14651
|
}
|
|
14646
14652
|
const l = document.createElement("canvas");
|
|
@@ -14652,13 +14658,13 @@ function cc(a, e, t = "bim-snapshot.png") {
|
|
|
14652
14658
|
const h = l.toDataURL("image/png"), u = document.createElement("a");
|
|
14653
14659
|
return u.href = h, u.download = t.toLowerCase().endsWith(".png") ? t : `${t}.png`, u.click(), h;
|
|
14654
14660
|
}
|
|
14655
|
-
function
|
|
14661
|
+
function dc(a, e, t) {
|
|
14656
14662
|
const i = document.createElement("canvas");
|
|
14657
14663
|
i.width = e, i.height = t;
|
|
14658
14664
|
const n = i.getContext("2d");
|
|
14659
14665
|
return n && n.drawImage(a, 0, 0, e, t), i;
|
|
14660
14666
|
}
|
|
14661
|
-
function
|
|
14667
|
+
function uc(a) {
|
|
14662
14668
|
const e = a.getContext("2d");
|
|
14663
14669
|
if (!e || a.width <= 0 || a.height <= 0)
|
|
14664
14670
|
return !1;
|
|
@@ -14671,28 +14677,28 @@ function dc(a) {
|
|
|
14671
14677
|
}
|
|
14672
14678
|
return !1;
|
|
14673
14679
|
}
|
|
14674
|
-
function
|
|
14680
|
+
function pc(a, e, t) {
|
|
14675
14681
|
const i = a?.renderer, n = a?.scene, s = a?.camera;
|
|
14676
14682
|
if (!i || !n || !s)
|
|
14677
14683
|
return null;
|
|
14678
|
-
const o = new
|
|
14684
|
+
const o = new jn(e, t, {
|
|
14679
14685
|
minFilter: Qt,
|
|
14680
14686
|
magFilter: Qt,
|
|
14681
|
-
format:
|
|
14687
|
+
format: Yn,
|
|
14682
14688
|
depthBuffer: !0,
|
|
14683
14689
|
stencilBuffer: !0
|
|
14684
14690
|
}), r = i.getRenderTarget(), l = i.autoClear, c = i.xr?.enabled ?? !1;
|
|
14685
14691
|
try {
|
|
14686
14692
|
i.xr && (i.xr.enabled = !1), i.autoClear = !0, i.setRenderTarget(o), i.clear(!0, !0, !0), i.render(n, s);
|
|
14687
14693
|
const h = new Uint8Array(e * t * 4);
|
|
14688
|
-
return i.readRenderTargetPixels(o, 0, 0, e, t, h),
|
|
14694
|
+
return i.readRenderTargetPixels(o, 0, 0, e, t, h), mc(h, e, t);
|
|
14689
14695
|
} catch {
|
|
14690
14696
|
return null;
|
|
14691
14697
|
} finally {
|
|
14692
14698
|
i.setRenderTarget(r), i.autoClear = l, i.xr && (i.xr.enabled = c), o.dispose();
|
|
14693
14699
|
}
|
|
14694
14700
|
}
|
|
14695
|
-
function
|
|
14701
|
+
function mc(a, e, t) {
|
|
14696
14702
|
const i = document.createElement("canvas");
|
|
14697
14703
|
i.width = e, i.height = t;
|
|
14698
14704
|
const n = i.getContext("2d");
|
|
@@ -14706,7 +14712,7 @@ function pc(a, e, t) {
|
|
|
14706
14712
|
}
|
|
14707
14713
|
return n.putImageData(s, 0, 0), i;
|
|
14708
14714
|
}
|
|
14709
|
-
const
|
|
14715
|
+
const gc = [
|
|
14710
14716
|
"#ffffff",
|
|
14711
14717
|
"#000000",
|
|
14712
14718
|
"#ff4d4f",
|
|
@@ -14717,7 +14723,7 @@ const mc = [
|
|
|
14717
14723
|
"#1677ff",
|
|
14718
14724
|
"#722ed1",
|
|
14719
14725
|
"#eb2f96"
|
|
14720
|
-
],
|
|
14726
|
+
], fc = {
|
|
14721
14727
|
none: ee("/assets/icon/选择.svg", import.meta.url),
|
|
14722
14728
|
line: ee("/assets/icon/线.svg", import.meta.url),
|
|
14723
14729
|
arrow: ee("/assets/icon/箭头.svg", import.meta.url),
|
|
@@ -14725,7 +14731,7 @@ const mc = [
|
|
|
14725
14731
|
circle: ee("/assets/icon/圆形.svg", import.meta.url),
|
|
14726
14732
|
text: ee("/assets/icon/文字.svg", import.meta.url),
|
|
14727
14733
|
cloudline: ee("/assets/icon/云线.svg", import.meta.url)
|
|
14728
|
-
},
|
|
14734
|
+
}, yc = ee("/assets/icon/测距.svg", import.meta.url), Mc = ee("/assets/icon/截图.svg", import.meta.url), vc = ee("/assets/icon/线宽.svg", import.meta.url), xc = ee("/assets/icon/字号.svg", import.meta.url), wc = `data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l4 8-4 12-4-12 4-8z" fill="#1677ff"/><circle cx="12" cy="10" r="2.5" fill="#fff"/></svg>')}`, bc = [
|
|
14729
14735
|
{ type: "distance", label: "距离" },
|
|
14730
14736
|
{ type: "clearDistance", label: "净距" },
|
|
14731
14737
|
{ type: "clearHeight", label: "净高" },
|
|
@@ -14734,7 +14740,7 @@ const mc = [
|
|
|
14734
14740
|
{ type: "angle", label: "角度" },
|
|
14735
14741
|
{ type: "area", label: "面积" },
|
|
14736
14742
|
{ type: "slope", label: "坡度" }
|
|
14737
|
-
],
|
|
14743
|
+
], Cc = {
|
|
14738
14744
|
distance: ee("/assets/icon/距离.svg", import.meta.url),
|
|
14739
14745
|
clearDistance: ee("/assets/icon/净距.svg", import.meta.url),
|
|
14740
14746
|
clearHeight: ee("/assets/icon/净高.svg", import.meta.url),
|
|
@@ -14744,7 +14750,7 @@ const mc = [
|
|
|
14744
14750
|
area: ee("/assets/icon/面积.svg", import.meta.url),
|
|
14745
14751
|
slope: ee("/assets/icon/坡度.svg", import.meta.url)
|
|
14746
14752
|
};
|
|
14747
|
-
class
|
|
14753
|
+
class Ec {
|
|
14748
14754
|
constructor(e, t) {
|
|
14749
14755
|
this.handlers = e, this.root = document.createElement("div"), this.root.style.position = "absolute", this.root.style.top = "8px", this.root.style.left = "50%", this.root.style.transform = "translateX(-50%)", this.root.style.display = "none", this.root.style.padding = "6px", this.root.style.background = "#ffffff", this.root.style.border = "1px solid #d9d9d9", this.root.style.borderRadius = "8px", this.root.style.pointerEvents = "auto", this.root.style.userSelect = "none", this.root.style.boxShadow = "0 4px 14px rgba(0, 0, 0, 0.12)", this.root.style.zIndex = "1300", this.root.style.overflow = "visible", this.editPanel = document.createElement("div"), this.editPanel.style.display = "flex", this.editPanel.style.flexDirection = "column", this.editPanel.style.gap = "6px", this.viewPanel = document.createElement("div"), this.viewPanel.style.display = "none", this.viewPanel.style.alignItems = "center", this.viewPanel.style.gap = "6px";
|
|
14750
14756
|
const i = document.createElement("div");
|
|
@@ -14757,7 +14763,7 @@ class Cc {
|
|
|
14757
14763
|
{ type: "text", label: "文字" },
|
|
14758
14764
|
{ type: "cloudline", label: "云线" }
|
|
14759
14765
|
].forEach((y) => {
|
|
14760
|
-
const M = this.createIconButton(y.label,
|
|
14766
|
+
const M = this.createIconButton(y.label, fc[y.type]);
|
|
14761
14767
|
M.onclick = () => this.handlers.onDrawTypeChange(y.type), this.drawButtons[y.type] = M, i.appendChild(M);
|
|
14762
14768
|
});
|
|
14763
14769
|
const s = document.createElement("div");
|
|
@@ -14767,23 +14773,23 @@ class Cc {
|
|
|
14767
14773
|
this.updateColorControl(this.colorInput.value), this.handlers.onColorChange(this.colorInput.value), this.setColorPresetVisible(!1);
|
|
14768
14774
|
}, s.appendChild(this.colorInput), this.colorPresetPanel = document.createElement("div"), this.colorPresetPanel.style.position = "absolute", this.colorPresetPanel.style.top = "30px", this.colorPresetPanel.style.left = "0", this.colorPresetPanel.style.display = "none", this.colorPresetPanel.style.padding = "8px", this.colorPresetPanel.style.background = "#ffffff", this.colorPresetPanel.style.border = "1px solid #d9d9d9", this.colorPresetPanel.style.borderRadius = "6px", this.colorPresetPanel.style.boxShadow = "0 6px 18px rgba(0, 0, 0, 0.14)", this.colorPresetPanel.style.zIndex = "20", this.colorPresetPanel.style.width = "152px";
|
|
14769
14775
|
const r = document.createElement("div");
|
|
14770
|
-
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px",
|
|
14776
|
+
r.style.display = "grid", r.style.gridTemplateColumns = "repeat(5, 1fr)", r.style.gap = "6px", gc.forEach((y) => {
|
|
14771
14777
|
const M = document.createElement("button");
|
|
14772
14778
|
M.type = "button", M.title = y, M.style.width = "22px", M.style.height = "22px", M.style.padding = "0", M.style.border = "1px solid #d9d9d9", M.style.borderRadius = "4px", M.style.background = y, M.style.cursor = "pointer", M.onclick = () => {
|
|
14773
14779
|
this.updateColorControl(y), this.handlers.onColorChange(y), this.setColorPresetVisible(!1);
|
|
14774
14780
|
}, r.appendChild(M);
|
|
14775
14781
|
}), this.colorPresetPanel.appendChild(r);
|
|
14776
14782
|
const l = document.createElement("button");
|
|
14777
|
-
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,
|
|
14778
|
-
const c = this.createIconButton("截图",
|
|
14783
|
+
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, vc, "线宽")), 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, xc, "字号")), this.distanceButton = this.createIconButton("测量", yc), this.distanceButton.onclick = () => this.handlers.onMeasureToggle(), i.appendChild(this.distanceButton);
|
|
14784
|
+
const c = this.createIconButton("截图", Mc);
|
|
14779
14785
|
c.onclick = () => this.handlers.onScreenshot(), i.appendChild(c);
|
|
14780
|
-
const h = this.createIconButton("捕捉点",
|
|
14786
|
+
const h = this.createIconButton("捕捉点", wc);
|
|
14781
14787
|
h.onclick = () => this.handlers.onPickPoint(), i.appendChild(h);
|
|
14782
14788
|
const u = this.createTextButton("×", "取消");
|
|
14783
14789
|
u.onclick = () => this.handlers.onCancel(), u.style.background = "#ff4d4f", u.style.borderColor = "#ff4d4f", u.style.color = "#ffffff", i.appendChild(u);
|
|
14784
14790
|
const p = this.createTextButton("✔", "确定");
|
|
14785
|
-
p.onclick = () => this.handlers.onConfirm(), p.style.background = "#52c41a", p.style.borderColor = "#52c41a", p.style.color = "#ffffff", i.appendChild(p), 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",
|
|
14786
|
-
const M = this.createSmallIconButton(y.label,
|
|
14791
|
+
p.onclick = () => this.handlers.onConfirm(), p.style.background = "#52c41a", p.style.borderColor = "#52c41a", p.style.color = "#ffffff", i.appendChild(p), 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", bc.forEach((y) => {
|
|
14792
|
+
const M = this.createSmallIconButton(y.label, Cc[y.type]);
|
|
14787
14793
|
M.onclick = () => this.handlers.onMeasureTypeChange(y.type), this.measureTypeButtons[y.type] = M, this.measureSubPanel.appendChild(M);
|
|
14788
14794
|
}), this.editPanel.appendChild(i), this.editPanel.appendChild(this.measureSubPanel);
|
|
14789
14795
|
const g = this.createTextButton("关闭", "关闭");
|
|
@@ -14908,7 +14914,7 @@ class Cc {
|
|
|
14908
14914
|
return i.type = "button", i.title = t, i.textContent = e, i.style.width = "28px", i.style.height = "28px", i.style.padding = "0 10px", i.style.border = "1px solid #d9d9d9", i.style.borderRadius = "4px", i.style.background = "#ffffff", i.style.color = "#333333", i.style.fontSize = "13px", i.style.lineHeight = "1", i.style.cursor = "pointer", i;
|
|
14909
14915
|
}
|
|
14910
14916
|
}
|
|
14911
|
-
class
|
|
14917
|
+
class Ac {
|
|
14912
14918
|
engine;
|
|
14913
14919
|
wrapper;
|
|
14914
14920
|
canvasEl;
|
|
@@ -14947,7 +14953,7 @@ class Ec {
|
|
|
14947
14953
|
const t = this.engine.container;
|
|
14948
14954
|
if (!t)
|
|
14949
14955
|
throw new Error("FabricDraw: engine container not found.");
|
|
14950
|
-
this.wrapper = document.createElement("div"), this.wrapper.className = "fabric-draw-layer", this.wrapper.style.position = "absolute", this.wrapper.style.left = "0", this.wrapper.style.top = "0", this.wrapper.style.right = "0", this.wrapper.style.bottom = "0", this.wrapper.style.pointerEvents = "none", this.canvasEl = document.createElement("canvas"), this.canvasEl.style.width = "100%", this.canvasEl.style.height = "100%", this.wrapper.appendChild(this.canvasEl), this.toolbar = new
|
|
14956
|
+
this.wrapper = document.createElement("div"), this.wrapper.className = "fabric-draw-layer", this.wrapper.style.position = "absolute", this.wrapper.style.left = "0", this.wrapper.style.top = "0", this.wrapper.style.right = "0", this.wrapper.style.bottom = "0", this.wrapper.style.pointerEvents = "none", this.canvasEl = document.createElement("canvas"), this.canvasEl.style.width = "100%", this.canvasEl.style.height = "100%", this.wrapper.appendChild(this.canvasEl), this.toolbar = new Ec({
|
|
14951
14957
|
onDrawTypeChange: (n) => this.setDrawType(n),
|
|
14952
14958
|
onMeasureToggle: () => this.toggleMeasurePanel(),
|
|
14953
14959
|
onMeasureTypeChange: (n) => this.activateDistanceMeasure(n),
|
|
@@ -14973,7 +14979,7 @@ class Ec {
|
|
|
14973
14979
|
fontSize: this.drawStyle.fontSize
|
|
14974
14980
|
}), this.toolbar.mount(this.wrapper);
|
|
14975
14981
|
const i = this.engine.renderer?.domElement;
|
|
14976
|
-
i?.nextSibling ? t.insertBefore(this.wrapper, i.nextSibling) : t.appendChild(this.wrapper), this.canvas = new
|
|
14982
|
+
i?.nextSibling ? t.insertBefore(this.wrapper, i.nextSibling) : t.appendChild(this.wrapper), this.canvas = new Oo(this.canvasEl, {
|
|
14977
14983
|
selection: !0,
|
|
14978
14984
|
preserveObjectStacking: !0
|
|
14979
14985
|
}), this.resize(), this.canvas.on("mouse:down", this.onMouseDown), this.canvas.on("mouse:move", this.onMouseMove), this.canvas.on("mouse:up", this.onMouseUp), this.canvas.on("mouse:dblclick", this.onMouseDblClick), this.canvas.on("selection:created", this.onSelectionChanged), this.canvas.on("selection:updated", this.onSelectionChanged), this.canvas.on("selection:cleared", this.onSelectionChanged), window.addEventListener("keydown", this.onKeyDown), this.refreshToolbarState();
|
|
@@ -15059,7 +15065,7 @@ class Ec {
|
|
|
15059
15065
|
/**
|
|
15060
15066
|
* 鐩存帴缁樺埗鏂囧瓧銆? */
|
|
15061
15067
|
drawText(e, t, i) {
|
|
15062
|
-
const n = this.mergeStyle(i), s = new
|
|
15068
|
+
const n = this.mergeStyle(i), s = new Fo(t ?? n.text, {
|
|
15063
15069
|
left: e.x,
|
|
15064
15070
|
top: e.y,
|
|
15065
15071
|
...this.createTextStyle(n),
|
|
@@ -15096,7 +15102,7 @@ class Ec {
|
|
|
15096
15102
|
* 鎴浘淇濆瓨锛堟ā鍨?Fabric鎵规敞鍚堟垚锛夈€? */
|
|
15097
15103
|
saveScreenshot(e = "bim-snapshot.png") {
|
|
15098
15104
|
const t = this.canvas.lowerCanvasEl;
|
|
15099
|
-
return t ?
|
|
15105
|
+
return t ? hc(this.engine, t, e) : null;
|
|
15100
15106
|
}
|
|
15101
15107
|
/**
|
|
15102
15108
|
* 鍚屾鐢诲竷灏哄銆? */
|
|
@@ -15264,7 +15270,7 @@ class Ec {
|
|
|
15264
15270
|
return s.annotationType = "line", s;
|
|
15265
15271
|
}
|
|
15266
15272
|
createRectObject(e, t, i, n) {
|
|
15267
|
-
const s = this.getBoxFromPoints(e, t), o = new
|
|
15273
|
+
const s = this.getBoxFromPoints(e, t), o = new No({
|
|
15268
15274
|
...this.createObjectBase(i, n),
|
|
15269
15275
|
left: s.left,
|
|
15270
15276
|
top: s.top,
|
|
@@ -15276,7 +15282,7 @@ class Ec {
|
|
|
15276
15282
|
return o.annotationType = "rect", o;
|
|
15277
15283
|
}
|
|
15278
15284
|
createCircleObject(e, t, i, n) {
|
|
15279
|
-
const s = this.getCircleFromPoints(e, t), o = new
|
|
15285
|
+
const s = this.getCircleFromPoints(e, t), o = new Ho({
|
|
15280
15286
|
...this.createObjectBase(i, n),
|
|
15281
15287
|
left: s.left,
|
|
15282
15288
|
top: s.top,
|
|
@@ -15580,7 +15586,7 @@ class Ec {
|
|
|
15580
15586
|
return JSON.parse(JSON.stringify(e));
|
|
15581
15587
|
}
|
|
15582
15588
|
}
|
|
15583
|
-
class
|
|
15589
|
+
class Sc {
|
|
15584
15590
|
engine;
|
|
15585
15591
|
capturePoint = null;
|
|
15586
15592
|
labelPrefix = "drawing-pin-label-";
|
|
@@ -16030,7 +16036,7 @@ class Ac {
|
|
|
16030
16036
|
return e;
|
|
16031
16037
|
}
|
|
16032
16038
|
}
|
|
16033
|
-
const Mi = "bim-engine:model-link-3d",
|
|
16039
|
+
const Mi = "bim-engine:model-link-3d", Pc = "default-model-link-3d-group", Fn = "model-link-3d", Nn = {
|
|
16034
16040
|
enabled: !1,
|
|
16035
16041
|
highlight: !0,
|
|
16036
16042
|
visibility: !0,
|
|
@@ -16039,7 +16045,7 @@ const Mi = "bim-engine:model-link-3d", Sc = "default-model-link-3d-group", On =
|
|
|
16039
16045
|
cameraMode: "onStop",
|
|
16040
16046
|
cameraThrottleMs: 50
|
|
16041
16047
|
};
|
|
16042
|
-
class
|
|
16048
|
+
class Tc {
|
|
16043
16049
|
viewerGuid;
|
|
16044
16050
|
engine;
|
|
16045
16051
|
options;
|
|
@@ -16097,20 +16103,20 @@ class Pc {
|
|
|
16097
16103
|
return this.applyingLinkedEvent;
|
|
16098
16104
|
}
|
|
16099
16105
|
dispose() {
|
|
16100
|
-
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(Mi, this.handleWindowEvent), this.pendingCameraTimer != null && (window.clearTimeout(this.pendingCameraTimer), this.pendingCameraTimer = null), this.firstPersonSyncFrame != null && (window.cancelAnimationFrame(this.firstPersonSyncFrame), this.firstPersonSyncFrame = null), this.engine?.setIdleFrameRateExempt?.(
|
|
16106
|
+
this.disposed || (this.disposed = !0, typeof window < "u" && window.removeEventListener(Mi, this.handleWindowEvent), this.pendingCameraTimer != null && (window.clearTimeout(this.pendingCameraTimer), this.pendingCameraTimer = null), this.firstPersonSyncFrame != null && (window.cancelAnimationFrame(this.firstPersonSyncFrame), this.firstPersonSyncFrame = null), this.engine?.setIdleFrameRateExempt?.(Fn, !1), this.unbindCameraEvents(), this.restoreModelToolMethods());
|
|
16101
16107
|
}
|
|
16102
16108
|
normalizeOptions(e) {
|
|
16103
16109
|
return {
|
|
16104
|
-
...
|
|
16110
|
+
...Nn,
|
|
16105
16111
|
...e,
|
|
16106
|
-
groupId: e.groupId ?? this.engine?.options?.linkGroupId ??
|
|
16112
|
+
groupId: e.groupId ?? this.engine?.options?.linkGroupId ?? Pc,
|
|
16107
16113
|
modelId: e.modelId ?? this.engine?.options?.modelLinkId
|
|
16108
16114
|
};
|
|
16109
16115
|
}
|
|
16110
16116
|
/** 模型联动开启后需要持续响应外部视图变化,不能进入空闲限帧。 */
|
|
16111
16117
|
syncIdleFrameRateExempt() {
|
|
16112
16118
|
this.engine?.setIdleFrameRateExempt?.(
|
|
16113
|
-
|
|
16119
|
+
Fn,
|
|
16114
16120
|
this.options.enabled === !0
|
|
16115
16121
|
);
|
|
16116
16122
|
}
|
|
@@ -16202,7 +16208,7 @@ class Pc {
|
|
|
16202
16208
|
return this.engine?.controlModule?.firstPersonControls?.enabled === !0 && this.engine?.movefirst === !0;
|
|
16203
16209
|
}
|
|
16204
16210
|
emitCameraThrottled() {
|
|
16205
|
-
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ??
|
|
16211
|
+
const e = Date.now(), t = Math.max(0, (this.options.cameraThrottleMs ?? Nn.cameraThrottleMs) - (e - this.lastCameraEmitTime));
|
|
16206
16212
|
if (t === 0) {
|
|
16207
16213
|
this.emitCamera();
|
|
16208
16214
|
return;
|
|
@@ -16343,13 +16349,13 @@ class Pc {
|
|
|
16343
16349
|
}).filter((n) => n.ids.length > 0);
|
|
16344
16350
|
}
|
|
16345
16351
|
}
|
|
16346
|
-
class
|
|
16352
|
+
class Ic {
|
|
16347
16353
|
engine;
|
|
16348
16354
|
manager;
|
|
16349
16355
|
worldToScreen;
|
|
16350
16356
|
raycaster = new me();
|
|
16351
16357
|
constructor(e) {
|
|
16352
|
-
this.engine = e, this.worldToScreen = new fe(e.camera, e.renderer, e.scene), this.manager = new
|
|
16358
|
+
this.engine = e, this.worldToScreen = new fe(e.camera, e.renderer, e.scene), this.manager = new Lo({
|
|
16353
16359
|
container: e.container,
|
|
16354
16360
|
className: "bim-engine-label-container bim-engine-label-container-3d",
|
|
16355
16361
|
projectCoordinate: (t) => this.projectCoordinate(t),
|
|
@@ -16411,7 +16417,7 @@ class Tc {
|
|
|
16411
16417
|
return e = this.engine.clipping?.filterIntersectionsByClipping?.(e) ?? e, e.filter((i) => i?.point instanceof d).sort((i, n) => i.distance - n.distance)[0] ?? null;
|
|
16412
16418
|
}
|
|
16413
16419
|
}
|
|
16414
|
-
class
|
|
16420
|
+
class _c {
|
|
16415
16421
|
/** 推进当前标记注册的材质与独立点动画。 */
|
|
16416
16422
|
updateRecord(e, t) {
|
|
16417
16423
|
const i = t + e.timeSeed;
|
|
@@ -16434,7 +16440,7 @@ class Ic {
|
|
|
16434
16440
|
});
|
|
16435
16441
|
}
|
|
16436
16442
|
}
|
|
16437
|
-
class
|
|
16443
|
+
class Dc {
|
|
16438
16444
|
engine;
|
|
16439
16445
|
rootGroup;
|
|
16440
16446
|
records;
|
|
@@ -16741,7 +16747,7 @@ const Pe = {
|
|
|
16741
16747
|
showBottom: !1,
|
|
16742
16748
|
edgeColor: "#d9ffff"
|
|
16743
16749
|
}
|
|
16744
|
-
},
|
|
16750
|
+
}, kc = {
|
|
16745
16751
|
background: "rgba(10, 18, 28, 0.92)",
|
|
16746
16752
|
color: "#ffffff",
|
|
16747
16753
|
border: "1px solid rgba(127, 252, 255, 0.72)",
|
|
@@ -16750,7 +16756,7 @@ const Pe = {
|
|
|
16750
16756
|
boxShadow: "0 10px 30px rgba(0, 0, 0, 0.32)",
|
|
16751
16757
|
minWidth: "120px",
|
|
16752
16758
|
pointerEvents: "auto"
|
|
16753
|
-
},
|
|
16759
|
+
}, Lc = "bim-engine-annotation3d-panels";
|
|
16754
16760
|
function Yt(a) {
|
|
16755
16761
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
16756
16762
|
}
|
|
@@ -16761,7 +16767,7 @@ function Wt(a) {
|
|
|
16761
16767
|
const e = new d();
|
|
16762
16768
|
return a.length === 0 ? e : (a.forEach((t) => e.add(J(t))), e.multiplyScalar(1 / a.length));
|
|
16763
16769
|
}
|
|
16764
|
-
function
|
|
16770
|
+
function Bc(a) {
|
|
16765
16771
|
const e = new d();
|
|
16766
16772
|
for (let t = 0; t < a.length; t += 1) {
|
|
16767
16773
|
const i = a[t], n = a[(t + 1) % a.length];
|
|
@@ -16769,9 +16775,9 @@ function Lc(a) {
|
|
|
16769
16775
|
}
|
|
16770
16776
|
return e.normalize();
|
|
16771
16777
|
}
|
|
16772
|
-
function
|
|
16778
|
+
function Fs(a) {
|
|
16773
16779
|
const e = a.map((c) => J(c)), t = e[0].clone(), i = e.length > 1 ? e[1].clone().sub(t).normalize() : new d(1, 0, 0);
|
|
16774
|
-
let n =
|
|
16780
|
+
let n = Bc(e);
|
|
16775
16781
|
n.lengthSq() < 1e-8 && (n = new d(0, 1, 0));
|
|
16776
16782
|
const s = new d().crossVectors(n, i).normalize(), o = new d().crossVectors(s, n).normalize(), r = e.map((c) => {
|
|
16777
16783
|
const h = c.clone().sub(t);
|
|
@@ -16779,8 +16785,8 @@ function Os(a) {
|
|
|
16779
16785
|
}), l = new H().makeBasis(o, s, n).setPosition(t);
|
|
16780
16786
|
return { origin: t, normal: n, matrix: l, localPoints: r };
|
|
16781
16787
|
}
|
|
16782
|
-
function
|
|
16783
|
-
const e = new
|
|
16788
|
+
function Ns(a) {
|
|
16789
|
+
const e = new Xn();
|
|
16784
16790
|
return a.forEach((t, i) => {
|
|
16785
16791
|
if (i === 0) {
|
|
16786
16792
|
e.moveTo(t.x, t.y);
|
|
@@ -16789,12 +16795,12 @@ function Fs(a) {
|
|
|
16789
16795
|
e.lineTo(t.x, t.y);
|
|
16790
16796
|
}), e.closePath(), e;
|
|
16791
16797
|
}
|
|
16792
|
-
function
|
|
16798
|
+
function zc(a, e) {
|
|
16793
16799
|
a.traverse((t) => {
|
|
16794
16800
|
t.userData = t.userData ?? {}, t.userData.annotationId = e;
|
|
16795
16801
|
});
|
|
16796
16802
|
}
|
|
16797
|
-
function
|
|
16803
|
+
function Rc(a) {
|
|
16798
16804
|
a.traverse((e) => {
|
|
16799
16805
|
const t = e;
|
|
16800
16806
|
t.geometry?.dispose?.();
|
|
@@ -16806,13 +16812,13 @@ function zc(a) {
|
|
|
16806
16812
|
i?.dispose?.();
|
|
16807
16813
|
});
|
|
16808
16814
|
}
|
|
16809
|
-
function
|
|
16815
|
+
function Oc(a) {
|
|
16810
16816
|
return a.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
16811
16817
|
}
|
|
16812
|
-
function
|
|
16818
|
+
function Fc(a) {
|
|
16813
16819
|
return a === "polyline" || a === "curve3d" ? "center" : a === "polygon" ? "centroid" : "top";
|
|
16814
16820
|
}
|
|
16815
|
-
class
|
|
16821
|
+
class Nc {
|
|
16816
16822
|
render(e) {
|
|
16817
16823
|
const t = e.instance.style.leaderPoint ?? {}, i = t.strokeColor || e.instance.style.color || "#7ffcff", n = t.backgroundColor || e.instance.style.fillColor || i, s = t.borderColor || i, o = t.anchorColor || n, r = t.anchorRingColor || i, l = t.iconBackgroundColor || n, c = t.side ?? "right", h = t.icon ? this.escapeXmlAttribute(t.icon) : "", u = Math.max(t.iconWidth ?? 22, 1), p = Math.max(t.iconHeight ?? 22, 1), g = (t.text ?? "").trim(), y = Math.max(t.fontSize ?? 14, 10), M = t.textColor || e.instance.style.color || "#ffffff", x = t.fontWeight ?? 500, m = Math.max(Math.round((t.height ?? 8) * 12), 48), b = Math.max(Math.round(Math.abs(t.offsetX ?? t.armLength ?? 4) * 18), 56), C = this.getBoardWidth(e, g, y), S = Math.max(Math.round((t.boardHeight ?? 1.8) * 22), y + 18, 34), I = Math.max(Math.round((t.stemWidth ?? e.instance.style.lineWidth ?? 0.12) * 20), 2), P = t.borderWidth ?? 2.5, L = t.variant ?? "elbow", k = c === "right" ? 22 + b - 8 : 22 - b - C + 8, O = 8, K = Math.min(22, k) - 16, te = Math.max(22, k + C) + 16, Q = Math.max(te - K, 140), he = Math.max(m + S + 36, 120), le = 22 - K, ce = k - K, ye = he - 18, Se = Math.max(ye - m, 14), w = c === "right" ? ce : ce + C, f = O + Math.round(S * 0.5), E = L === "vertical" ? [`${le},${ye}`, `${le},${Se}`] : [`${le},${ye}`, `${le},${f}`, `${w},${f}`], _ = e.instance.selectable !== !1, D = _ ? "visiblePainted" : "none", T = _ ? "pointer" : "default", N = ce + (h || !g ? 38 : 12), G = t.showBoard === !1 ? "" : `
|
|
16818
16824
|
<rect x="${ce}" y="${O}" width="${C}" height="${S}" rx="10"
|
|
@@ -16866,7 +16872,7 @@ class Fc {
|
|
|
16866
16872
|
return Math.max(Math.round((n.boardWidth ?? 4.6) * 22), Math.ceil(r), 78);
|
|
16867
16873
|
}
|
|
16868
16874
|
}
|
|
16869
|
-
class
|
|
16875
|
+
class Hc {
|
|
16870
16876
|
/** 按标记类型重建内容,并返回相对三维锚点的布局参数。 */
|
|
16871
16877
|
render(e, t) {
|
|
16872
16878
|
const i = t.instance.type === "iconPoint" ? t.instance.style.iconPoint ?? {} : t.instance.type === "textPoint" ? t.instance.style.textPoint ?? {} : t.instance.style.iconTextPoint ?? {}, n = JSON.stringify({
|
|
@@ -16939,10 +16945,10 @@ class Nc {
|
|
|
16939
16945
|
return `rgba(${r >> 16 & 255}, ${r >> 8 & 255}, ${r & 255}, ${i})`;
|
|
16940
16946
|
}
|
|
16941
16947
|
}
|
|
16942
|
-
const
|
|
16943
|
-
class
|
|
16948
|
+
const Vc = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint"]), Uc = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint", "ripplePoint", "pillarPoint", "leaderPoint"]);
|
|
16949
|
+
class Wc {
|
|
16944
16950
|
constructor(e, t) {
|
|
16945
|
-
this.engine = e, this.isAnchorOccluded = t, this.container = document.createElement("div"), this.container.className =
|
|
16951
|
+
this.engine = e, this.isAnchorOccluded = t, this.container = document.createElement("div"), this.container.className = Lc, this.container.style.cssText = [
|
|
16946
16952
|
"position:absolute",
|
|
16947
16953
|
"left:0",
|
|
16948
16954
|
"top:0",
|
|
@@ -16955,8 +16961,8 @@ class Uc {
|
|
|
16955
16961
|
}
|
|
16956
16962
|
container;
|
|
16957
16963
|
worldToScreen;
|
|
16958
|
-
leaderMarker = new
|
|
16959
|
-
pointContentMarker = new
|
|
16964
|
+
leaderMarker = new Nc();
|
|
16965
|
+
pointContentMarker = new Hc();
|
|
16960
16966
|
updateProjectionState() {
|
|
16961
16967
|
this.worldToScreen.updateCamera(this.engine.camera), this.worldToScreen.updateRenderer(this.engine.renderer), this.worldToScreen.updateScene(this.engine.scene);
|
|
16962
16968
|
}
|
|
@@ -16969,7 +16975,7 @@ class Uc {
|
|
|
16969
16975
|
"transform:translate(-50%, -100%)",
|
|
16970
16976
|
"display:none",
|
|
16971
16977
|
t.interactive === !1 ? "pointer-events:none" : "pointer-events:auto"
|
|
16972
|
-
].join(";"), t.mode === "html" ? i.innerHTML = t.html ?? "" : i.textContent = t.text ?? "", Object.entries(t.style ?? {}).forEach(([n, s]) => i.style.setProperty(
|
|
16978
|
+
].join(";"), t.mode === "html" ? i.innerHTML = t.html ?? "" : i.textContent = t.text ?? "", Object.entries(t.style ?? {}).forEach(([n, s]) => i.style.setProperty(Oc(n), s)), i;
|
|
16973
16979
|
}
|
|
16974
16980
|
createLeaderMarkerElement(e) {
|
|
16975
16981
|
const t = document.createElement("div");
|
|
@@ -16981,7 +16987,7 @@ class Uc {
|
|
|
16981
16987
|
return t.className = "bim-annotation3d-marker bim-annotation3d-point-marker", t.dataset.annotationId = e.id, t.style.cssText = ["position:absolute", "left:0", "top:0", "display:none", "pointer-events:none"].join(";"), t;
|
|
16982
16988
|
}
|
|
16983
16989
|
updateRecord(e) {
|
|
16984
|
-
if (e.markerElement && e.instance.type === "leaderPoint" ? this.updateLeaderMarker(e) : e.markerElement &&
|
|
16990
|
+
if (e.markerElement && e.instance.type === "leaderPoint" ? this.updateLeaderMarker(e) : e.markerElement && Vc.has(e.instance.type) && this.updatePointMarker(e), !e.panelElement || !e.instance.panel)
|
|
16985
16991
|
return;
|
|
16986
16992
|
const t = e.instance.panel;
|
|
16987
16993
|
if (!(t.visible !== !1 && this.shouldShowPanel(e)) || !e.instance.visible) {
|
|
@@ -17040,9 +17046,9 @@ class Uc {
|
|
|
17040
17046
|
const t = e.instance.panel?.offset ?? {};
|
|
17041
17047
|
if (e.panelAnchorPoint)
|
|
17042
17048
|
return e.panelAnchorPoint.clone().add(new d(t.x ?? 0, t.y ?? 0, t.z ?? 0));
|
|
17043
|
-
const i = e.instance.panel?.anchor ??
|
|
17049
|
+
const i = e.instance.panel?.anchor ?? Fc(e.instance.type);
|
|
17044
17050
|
let n = new d();
|
|
17045
|
-
if (
|
|
17051
|
+
if (Uc.has(e.instance.type))
|
|
17046
17052
|
n.copy(J(e.instance.points[0])), i === "top" && (n.y += e.volumeHeight ?? 0);
|
|
17047
17053
|
else if (e.instance.type === "polyline" || e.instance.type === "curve3d")
|
|
17048
17054
|
i === "start" ? n.copy(J(e.instance.points[0])) : i === "end" ? n.copy(J(e.instance.points[e.instance.points.length - 1])) : e.anchorCurve ? n.copy(e.anchorCurve.getPoint(0.5)) : n.copy(Wt(e.instance.points));
|
|
@@ -17057,19 +17063,19 @@ class Uc {
|
|
|
17057
17063
|
return n.add(new d(t.x ?? 0, t.y ?? 0, t.z ?? 0)), n;
|
|
17058
17064
|
}
|
|
17059
17065
|
}
|
|
17060
|
-
class
|
|
17066
|
+
class Gc {
|
|
17061
17067
|
apply(e, t) {
|
|
17062
17068
|
e.instance.root.visible = e.instance.visible, e.instance.style.alwaysOnTop && e.instance.root.traverse((i) => {
|
|
17063
17069
|
i.renderOrder = Math.max(i.renderOrder, 1200);
|
|
17064
17070
|
}), t(e);
|
|
17065
17071
|
}
|
|
17066
17072
|
}
|
|
17067
|
-
class
|
|
17073
|
+
class qc {
|
|
17068
17074
|
constructor(e) {
|
|
17069
17075
|
this.engine = e;
|
|
17070
17076
|
}
|
|
17071
17077
|
createSurfaceMaterial(e) {
|
|
17072
|
-
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, h = i.flow?.direction === "backward" ? -1 : 1, u = new
|
|
17078
|
+
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, h = i.flow?.direction === "backward" ? -1 : 1, u = new mo({
|
|
17073
17079
|
transparent: !0,
|
|
17074
17080
|
side: re,
|
|
17075
17081
|
depthTest: t.alwaysOnTop ? !1 : t.depthTest !== !1,
|
|
@@ -17216,13 +17222,13 @@ class Ke {
|
|
|
17216
17222
|
this.engine = e, this.materialFactory = t;
|
|
17217
17223
|
}
|
|
17218
17224
|
createSegmentCurve(e) {
|
|
17219
|
-
const t = new
|
|
17225
|
+
const t = new go();
|
|
17220
17226
|
for (let i = 0; i < e.length - 1; i += 1)
|
|
17221
|
-
t.add(new
|
|
17227
|
+
t.add(new fo(e[i], e[i + 1]));
|
|
17222
17228
|
return t;
|
|
17223
17229
|
}
|
|
17224
17230
|
createTubeMesh(e, t, i, n, s, o, r = 10, l = !1) {
|
|
17225
|
-
const c = new
|
|
17231
|
+
const c = new yo(t, i, n, r, l);
|
|
17226
17232
|
c.computeBoundingBox();
|
|
17227
17233
|
const h = c.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), u = this.materialFactory.createSurfaceMaterial({
|
|
17228
17234
|
color: s.color ?? "#7ffcff",
|
|
@@ -17243,11 +17249,11 @@ class Ke {
|
|
|
17243
17249
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1
|
|
17244
17250
|
});
|
|
17245
17251
|
s.clippingPlanes = this.engine.sectionPlane;
|
|
17246
|
-
const o = new
|
|
17252
|
+
const o = new Mo(n, s);
|
|
17247
17253
|
return o.renderOrder = 998, o;
|
|
17248
17254
|
}
|
|
17249
17255
|
}
|
|
17250
|
-
class
|
|
17256
|
+
class Kc extends Ke {
|
|
17251
17257
|
type = "box";
|
|
17252
17258
|
build(e) {
|
|
17253
17259
|
if (e.instance.points.length < 2)
|
|
@@ -17274,14 +17280,14 @@ class qc extends Ke {
|
|
|
17274
17280
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1
|
|
17275
17281
|
});
|
|
17276
17282
|
p.clippingPlanes = this.engine.sectionPlane;
|
|
17277
|
-
const g = new Jt(new
|
|
17283
|
+
const g = new Jt(new vo(l), p);
|
|
17278
17284
|
g.position.copy(r), e.instance.root.add(g), e.volumeHeight = o.y, e.animatedMaterials.push(h);
|
|
17279
17285
|
}
|
|
17280
17286
|
}
|
|
17281
|
-
class
|
|
17287
|
+
class jc extends Ke {
|
|
17282
17288
|
type = "curve3d";
|
|
17283
17289
|
build(e) {
|
|
17284
|
-
const t = e.instance.points.map((r) => J(r)), i = e.instance.style.curve ?? {}, n = i.interpolation ?? "catmullRom", s = new
|
|
17290
|
+
const t = e.instance.points.map((r) => J(r)), i = e.instance.style.curve ?? {}, n = i.interpolation ?? "catmullRom", s = new xo(
|
|
17285
17291
|
t,
|
|
17286
17292
|
i.closed ?? !1,
|
|
17287
17293
|
n === "catmullRom" ? "catmullrom" : n,
|
|
@@ -17299,10 +17305,10 @@ class Kc extends Ke {
|
|
|
17299
17305
|
e.instance.root.add(o), e.anchorCurve = s, e.panelAnchorPoint = s.getPoint(0.5);
|
|
17300
17306
|
}
|
|
17301
17307
|
}
|
|
17302
|
-
class
|
|
17308
|
+
class Yc extends Ke {
|
|
17303
17309
|
type = "extrudePolygon";
|
|
17304
17310
|
build(e) {
|
|
17305
|
-
const t =
|
|
17311
|
+
const t = Fs(e.instance.points), i = Ns(t.localPoints), n = e.instance.style.volume?.height ?? 10, s = new Qn(i, {
|
|
17306
17312
|
depth: n,
|
|
17307
17313
|
bevelEnabled: !1,
|
|
17308
17314
|
steps: 1,
|
|
@@ -17347,21 +17353,21 @@ class ji extends Ke {
|
|
|
17347
17353
|
e.instance.root.position.copy(t), e.panelAnchorPoint = t.clone();
|
|
17348
17354
|
}
|
|
17349
17355
|
}
|
|
17350
|
-
class
|
|
17356
|
+
class Xc extends ji {
|
|
17351
17357
|
type = "iconPoint";
|
|
17352
17358
|
/** 将图标点绑定到首个世界坐标。 */
|
|
17353
17359
|
build(e) {
|
|
17354
17360
|
this.buildDomAnchor(e);
|
|
17355
17361
|
}
|
|
17356
17362
|
}
|
|
17357
|
-
class
|
|
17363
|
+
class Qc extends ji {
|
|
17358
17364
|
type = "iconTextPoint";
|
|
17359
17365
|
/** 将图文组合点绑定到首个世界坐标。 */
|
|
17360
17366
|
build(e) {
|
|
17361
17367
|
this.buildDomAnchor(e);
|
|
17362
17368
|
}
|
|
17363
17369
|
}
|
|
17364
|
-
class
|
|
17370
|
+
class $c extends Ke {
|
|
17365
17371
|
type = "leaderPoint";
|
|
17366
17372
|
build(e) {
|
|
17367
17373
|
const t = J(e.instance.points[0]), i = e.instance.style.leaderPoint ?? {}, n = Math.max(i.height ?? 8, 0.5), s = i.offsetX ?? i.armLength ?? 4, o = i.offsetZ ?? 0, r = this.createLeaderPathPoints(i.variant ?? "elbow", n, s, o), l = r[r.length - 1].clone();
|
|
@@ -17381,13 +17387,13 @@ class Qc extends Ke {
|
|
|
17381
17387
|
];
|
|
17382
17388
|
}
|
|
17383
17389
|
}
|
|
17384
|
-
class
|
|
17390
|
+
class Zc extends Ke {
|
|
17385
17391
|
type = "pillarPoint";
|
|
17386
17392
|
/** 根据光柱专属参数创建柱体与可选底环。 */
|
|
17387
17393
|
build(e) {
|
|
17388
17394
|
const t = e.instance.style.pillarPoint ?? {}, i = J(e.instance.points[0]), n = new d(t.offsetX ?? 0, t.offsetY ?? 0, t.offsetZ ?? 0), s = Math.max(t.height ?? 16, 0.01);
|
|
17389
17395
|
e.instance.root.position.copy(i).add(n), e.panelAnchorPoint = i.clone().add(n).add(new d(0, s, 0)), e.volumeHeight = s;
|
|
17390
|
-
const o = new
|
|
17396
|
+
const o = new wo(
|
|
17391
17397
|
Math.max(t.radiusTop ?? 0.3, 1e-3),
|
|
17392
17398
|
Math.max(t.radiusBottom ?? 0.75, 1e-3),
|
|
17393
17399
|
s,
|
|
@@ -17430,7 +17436,7 @@ class $c extends Ke {
|
|
|
17430
17436
|
});
|
|
17431
17437
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
17432
17438
|
const u = new z(
|
|
17433
|
-
new
|
|
17439
|
+
new es(
|
|
17434
17440
|
Math.max(t.baseRingInnerRadius ?? 1.9, 1e-3),
|
|
17435
17441
|
Math.max(t.baseRingOuterRadius ?? 2.4, (t.baseRingInnerRadius ?? 1.9) + 1e-3),
|
|
17436
17442
|
Math.max(12, Math.floor(t.baseRingSegments ?? 48))
|
|
@@ -17441,10 +17447,10 @@ class $c extends Ke {
|
|
|
17441
17447
|
}
|
|
17442
17448
|
}
|
|
17443
17449
|
}
|
|
17444
|
-
class
|
|
17450
|
+
class Jc extends Ke {
|
|
17445
17451
|
type = "polygon";
|
|
17446
17452
|
build(e) {
|
|
17447
|
-
const t =
|
|
17453
|
+
const t = Fs(e.instance.points), i = Ns(t.localPoints), n = new bo(i);
|
|
17448
17454
|
n.computeBoundingBox();
|
|
17449
17455
|
const s = n.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
17450
17456
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
@@ -17464,7 +17470,7 @@ class Zc extends Ke {
|
|
|
17464
17470
|
), e.animatedMaterials.push(o);
|
|
17465
17471
|
}
|
|
17466
17472
|
}
|
|
17467
|
-
class
|
|
17473
|
+
class eh extends Ke {
|
|
17468
17474
|
type = "polyline";
|
|
17469
17475
|
build(e) {
|
|
17470
17476
|
const t = e.instance.points.map((s) => J(s)), i = this.createSegmentCurve(t), n = this.createTubeMesh(
|
|
@@ -17478,7 +17484,7 @@ class Jc extends Ke {
|
|
|
17478
17484
|
e.instance.root.add(n), e.anchorCurve = i, e.panelAnchorPoint = i.getPoint(0.5);
|
|
17479
17485
|
}
|
|
17480
17486
|
}
|
|
17481
|
-
class
|
|
17487
|
+
class th extends Ke {
|
|
17482
17488
|
type = "ripplePoint";
|
|
17483
17489
|
/** 根据波纹参数创建中心点和错相扩散圆环。 */
|
|
17484
17490
|
build(e) {
|
|
@@ -17510,36 +17516,36 @@ class eh extends Ke {
|
|
|
17510
17516
|
});
|
|
17511
17517
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
17512
17518
|
const u = new z(
|
|
17513
|
-
new
|
|
17519
|
+
new es(Math.max(o - r, 1e-3), o, l),
|
|
17514
17520
|
h
|
|
17515
17521
|
);
|
|
17516
17522
|
u.rotation.set(t.rotationX ?? -Math.PI / 2, t.rotationY ?? 0, t.rotationZ ?? 0), u.userData.ripplePhase = c / s, u.userData.rippleSpeed = Math.max(t.speed ?? 0.9, 0), u.userData.rippleStartRadius = Math.max(t.startRadius ?? 0.2, 0), u.userData.rippleMaxRadius = o, u.userData.rippleBaseOpacity = h.opacity, e.instance.root.add(u), e.rippleMeshes.push(u);
|
|
17517
17523
|
}
|
|
17518
17524
|
}
|
|
17519
17525
|
}
|
|
17520
|
-
class
|
|
17526
|
+
class ih extends ji {
|
|
17521
17527
|
type = "textPoint";
|
|
17522
17528
|
/** 将文字点绑定到首个世界坐标。 */
|
|
17523
17529
|
build(e) {
|
|
17524
17530
|
this.buildDomAnchor(e);
|
|
17525
17531
|
}
|
|
17526
17532
|
}
|
|
17527
|
-
function
|
|
17533
|
+
function nh(a, e) {
|
|
17528
17534
|
return [
|
|
17529
|
-
new Yc(a, e),
|
|
17530
|
-
new th(a, e),
|
|
17531
17535
|
new Xc(a, e),
|
|
17532
|
-
new
|
|
17533
|
-
new $c(a, e),
|
|
17536
|
+
new ih(a, e),
|
|
17534
17537
|
new Qc(a, e),
|
|
17535
|
-
new
|
|
17536
|
-
new Kc(a, e),
|
|
17538
|
+
new th(a, e),
|
|
17537
17539
|
new Zc(a, e),
|
|
17540
|
+
new $c(a, e),
|
|
17541
|
+
new eh(a, e),
|
|
17538
17542
|
new jc(a, e),
|
|
17539
|
-
new
|
|
17543
|
+
new Jc(a, e),
|
|
17544
|
+
new Yc(a, e),
|
|
17545
|
+
new Kc(a, e)
|
|
17540
17546
|
];
|
|
17541
17547
|
}
|
|
17542
|
-
function
|
|
17548
|
+
function sh(a, e, t) {
|
|
17543
17549
|
const i = a.camera;
|
|
17544
17550
|
if (!i)
|
|
17545
17551
|
return !1;
|
|
@@ -17552,7 +17558,7 @@ function nh(a, e, t) {
|
|
|
17552
17558
|
const r = o.sort((l, c) => l.distance - c.distance)[0];
|
|
17553
17559
|
return !!(r && r.distance < s - 0.05);
|
|
17554
17560
|
}
|
|
17555
|
-
class
|
|
17561
|
+
class oh {
|
|
17556
17562
|
/** 归一化外部数据,并在创建几何前校验类型对应的必要输入。 */
|
|
17557
17563
|
normalizeData(e) {
|
|
17558
17564
|
const t = {
|
|
@@ -17686,7 +17692,7 @@ class sh {
|
|
|
17686
17692
|
offset: { ...e.offset ?? {} },
|
|
17687
17693
|
screenOffset: { ...e.screenOffset ?? {} },
|
|
17688
17694
|
className: e.className,
|
|
17689
|
-
style: { ...
|
|
17695
|
+
style: { ...kc, ...e.style ?? {} },
|
|
17690
17696
|
interactive: e.interactive ?? !0,
|
|
17691
17697
|
occlusion: e.occlusion ?? "show",
|
|
17692
17698
|
actions: e.actions
|
|
@@ -17725,11 +17731,11 @@ class sh {
|
|
|
17725
17731
|
}
|
|
17726
17732
|
}
|
|
17727
17733
|
}
|
|
17728
|
-
function
|
|
17734
|
+
function rh(a) {
|
|
17729
17735
|
const { actions: e, ...t } = a;
|
|
17730
17736
|
return t;
|
|
17731
17737
|
}
|
|
17732
|
-
function
|
|
17738
|
+
function ah(a) {
|
|
17733
17739
|
return {
|
|
17734
17740
|
id: a.instance.id,
|
|
17735
17741
|
type: a.instance.type,
|
|
@@ -17745,7 +17751,7 @@ function rh(a) {
|
|
|
17745
17751
|
function Gt(a) {
|
|
17746
17752
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
17747
17753
|
}
|
|
17748
|
-
class
|
|
17754
|
+
class lh {
|
|
17749
17755
|
builders = /* @__PURE__ */ new Map();
|
|
17750
17756
|
constructor(e) {
|
|
17751
17757
|
e.forEach((t) => this.builders.set(t.type, t));
|
|
@@ -17757,8 +17763,8 @@ class ah {
|
|
|
17757
17763
|
t.build(e);
|
|
17758
17764
|
}
|
|
17759
17765
|
}
|
|
17760
|
-
const
|
|
17761
|
-
class
|
|
17766
|
+
const ch = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint"]);
|
|
17767
|
+
class hh {
|
|
17762
17768
|
constructor(e, t) {
|
|
17763
17769
|
this.markerRegistry = e, this.overlayController = t;
|
|
17764
17770
|
}
|
|
@@ -17773,7 +17779,7 @@ class ch {
|
|
|
17773
17779
|
selectable: e.selectable ?? !0,
|
|
17774
17780
|
style: e.style,
|
|
17775
17781
|
effect: e.effect ?? {},
|
|
17776
|
-
panel: e.panel ?
|
|
17782
|
+
panel: e.panel ? rh(e.panel) : void 0,
|
|
17777
17783
|
data: e.data,
|
|
17778
17784
|
panelVisible: e.panel?.trigger === "always",
|
|
17779
17785
|
hovered: !1,
|
|
@@ -17782,37 +17788,37 @@ class ch {
|
|
|
17782
17788
|
instance: i,
|
|
17783
17789
|
actions: e.panel?.actions,
|
|
17784
17790
|
panelElement: e.panel ? this.overlayController.createPanelElement(i, e.panel) : null,
|
|
17785
|
-
markerElement: e.type === "leaderPoint" ? this.overlayController.createLeaderMarkerElement(i) :
|
|
17791
|
+
markerElement: e.type === "leaderPoint" ? this.overlayController.createLeaderMarkerElement(i) : ch.has(e.type) ? this.overlayController.createPointMarkerElement(i) : null,
|
|
17786
17792
|
timeSeed: Math.random() * Math.PI * 2,
|
|
17787
17793
|
pulseMaterials: [],
|
|
17788
17794
|
rippleMeshes: [],
|
|
17789
17795
|
baseRingMeshes: [],
|
|
17790
17796
|
animatedMaterials: []
|
|
17791
17797
|
};
|
|
17792
|
-
return this.markerRegistry.build(n),
|
|
17798
|
+
return this.markerRegistry.build(n), zc(t, i.id), n;
|
|
17793
17799
|
}
|
|
17794
17800
|
}
|
|
17795
|
-
class
|
|
17801
|
+
class dh {
|
|
17796
17802
|
engine;
|
|
17797
17803
|
rootGroup;
|
|
17798
17804
|
records = /* @__PURE__ */ new Map();
|
|
17799
17805
|
occlusionRaycaster = new me();
|
|
17800
|
-
normalizer = new
|
|
17806
|
+
normalizer = new oh();
|
|
17801
17807
|
materialFactory;
|
|
17802
17808
|
overlayController;
|
|
17803
17809
|
interactionController;
|
|
17804
17810
|
effectsController;
|
|
17805
|
-
visibilityController = new
|
|
17811
|
+
visibilityController = new Gc();
|
|
17806
17812
|
markerRegistry;
|
|
17807
17813
|
recordFactory;
|
|
17808
17814
|
currentTime = 0;
|
|
17809
17815
|
constructor(e) {
|
|
17810
|
-
this.engine = e, this.rootGroup = new pe(), this.rootGroup.name = "Annotation3dRoot", this.engine.scene.add(this.rootGroup), this.materialFactory = new
|
|
17816
|
+
this.engine = e, this.rootGroup = new pe(), this.rootGroup.name = "Annotation3dRoot", this.engine.scene.add(this.rootGroup), this.materialFactory = new qc(this.engine), this.overlayController = new Wc(
|
|
17811
17817
|
this.engine,
|
|
17812
|
-
(t) =>
|
|
17813
|
-
), this.markerRegistry = new
|
|
17814
|
-
|
|
17815
|
-
), this.recordFactory = new
|
|
17818
|
+
(t) => sh(this.engine, this.occlusionRaycaster, t)
|
|
17819
|
+
), this.markerRegistry = new lh(
|
|
17820
|
+
nh(this.engine, this.materialFactory)
|
|
17821
|
+
), this.recordFactory = new hh(this.markerRegistry, this.overlayController), this.effectsController = new _c(), this.interactionController = new Dc({
|
|
17816
17822
|
engine: this.engine,
|
|
17817
17823
|
rootGroup: this.rootGroup,
|
|
17818
17824
|
records: this.records,
|
|
@@ -17913,7 +17919,7 @@ class hh {
|
|
|
17913
17919
|
return this.update(e, { panel: n });
|
|
17914
17920
|
}
|
|
17915
17921
|
getData() {
|
|
17916
|
-
return Array.from(this.records.values()).map((e) =>
|
|
17922
|
+
return Array.from(this.records.values()).map((e) => ah(e));
|
|
17917
17923
|
}
|
|
17918
17924
|
restoreData(e) {
|
|
17919
17925
|
this.clear(), e.forEach((t) => this.add(t));
|
|
@@ -17931,7 +17937,7 @@ class hh {
|
|
|
17931
17937
|
}
|
|
17932
17938
|
removeInternal(e, t) {
|
|
17933
17939
|
const i = this.records.get(e);
|
|
17934
|
-
return i ? (this.interactionController.handleRecordRemoved(e),
|
|
17940
|
+
return i ? (this.interactionController.handleRecordRemoved(e), Rc(i.instance.root), i.instance.root.removeFromParent(), i.panelElement?.remove(), i.markerElement?.remove(), this.records.delete(e), t && this.emit("annotation3d-removed", { id: e }), !0) : !1;
|
|
17935
17941
|
}
|
|
17936
17942
|
toEventPayload(e, t) {
|
|
17937
17943
|
return { id: e.instance.id, annotation: e.instance, originalEvent: t };
|
|
@@ -18266,15 +18272,15 @@ class dt {
|
|
|
18266
18272
|
return "x" in e ? new d(e.x, e.y, e.z) : new d(e.X, e.Y, e.Z);
|
|
18267
18273
|
}
|
|
18268
18274
|
}
|
|
18269
|
-
const
|
|
18270
|
-
class
|
|
18275
|
+
const uh = 1e-3, ph = 0.65, mh = 1;
|
|
18276
|
+
class gh {
|
|
18271
18277
|
engine;
|
|
18272
18278
|
loader;
|
|
18273
18279
|
dracoLoader;
|
|
18274
18280
|
dracoDecoderPath;
|
|
18275
18281
|
modelList = /* @__PURE__ */ new Map();
|
|
18276
18282
|
modelTransforms = [];
|
|
18277
|
-
animationTimer = new
|
|
18283
|
+
animationTimer = new qn();
|
|
18278
18284
|
transformControl = null;
|
|
18279
18285
|
transformHelper = null;
|
|
18280
18286
|
selectedModelId = null;
|
|
@@ -18432,13 +18438,13 @@ class mh {
|
|
|
18432
18438
|
const l = t ? `“${t}”` : "默认动画";
|
|
18433
18439
|
throw new Error(`播放模型动画失败:模型 “${e}” 不存在${l}。`);
|
|
18434
18440
|
}
|
|
18435
|
-
(i.stopOthers ?? !0) && this.stopAnimation(e), n.mixer || (n.mixer = new
|
|
18441
|
+
(i.stopOthers ?? !0) && this.stopAnimation(e), n.mixer || (n.mixer = new Kn(n.object), n.mixer.addEventListener("finished", (l) => {
|
|
18436
18442
|
n.actions.forEach((c, h) => {
|
|
18437
18443
|
c === l.action && n.actions.delete(h);
|
|
18438
18444
|
});
|
|
18439
18445
|
}));
|
|
18440
18446
|
const o = n.mixer.clipAction(s);
|
|
18441
|
-
o.reset(), o.enabled = !0, o.clampWhenFinished = i.clampWhenFinished ?? !1, o.setEffectiveTimeScale(i.timeScale ?? 1), i.loop ?? !0 ? o.setLoop(
|
|
18447
|
+
o.reset(), o.enabled = !0, o.clampWhenFinished = i.clampWhenFinished ?? !1, o.setEffectiveTimeScale(i.timeScale ?? 1), i.loop ?? !0 ? o.setLoop(Co, i.repetitions ?? 1 / 0) : o.setLoop(Eo, i.repetitions ?? 1);
|
|
18442
18448
|
const r = i.fadeIn ?? 0;
|
|
18443
18449
|
return r > 0 && o.fadeIn(r), o.play(), n.actions.set(s.name, o), this.animationTimer.reset(), this.requestRender(), { name: s.name, duration: s.duration };
|
|
18444
18450
|
}
|
|
@@ -18531,7 +18537,7 @@ class mh {
|
|
|
18531
18537
|
}
|
|
18532
18538
|
/** 创建独立解码器实例,便于管理器销毁或切换资源目录时释放 worker。 */
|
|
18533
18539
|
createDracoLoader(e) {
|
|
18534
|
-
const t = new
|
|
18540
|
+
const t = new Zn();
|
|
18535
18541
|
return t.setDecoderPath(e), t;
|
|
18536
18542
|
}
|
|
18537
18543
|
resolveDracoDecoderPath(e) {
|
|
@@ -18579,7 +18585,7 @@ class mh {
|
|
|
18579
18585
|
}
|
|
18580
18586
|
/** 透视相机使用更小的屏幕尺寸系数,正交相机维持原有尺寸。 */
|
|
18581
18587
|
syncTransformControlCamera() {
|
|
18582
|
-
!this.transformControl || !this.engine.camera || (this.transformControl.camera = this.engine.camera, this.transformControl.size = this.engine.camera.isPerspectiveCamera ?
|
|
18588
|
+
!this.transformControl || !this.engine.camera || (this.transformControl.camera = this.engine.camera, this.transformControl.size = this.engine.camera.isPerspectiveCamera ? ph : mh);
|
|
18583
18589
|
}
|
|
18584
18590
|
/** 使用引擎统一的捕捉器等待用户单击,并在取消或完成后恢复常规交互。 */
|
|
18585
18591
|
pickPlacementPoint(e, t) {
|
|
@@ -18618,7 +18624,7 @@ class mh {
|
|
|
18618
18624
|
const i = t.clone(), n = e?.normal ?? e?.face?.normal;
|
|
18619
18625
|
if (n == null) return { position: i, normal: null };
|
|
18620
18626
|
const s = n.clone(), o = e?.matrix ?? e?.object?.matrixWorld;
|
|
18621
|
-
return o && s.transformDirection(o), s.lengthSq() < 1e-10 ? { position: i, normal: null } : (s.normalize(), i.addScaledVector(s,
|
|
18627
|
+
return o && s.transformDirection(o), s.lengthSq() < 1e-10 ? { position: i, normal: null } : (s.normalize(), i.addScaledVector(s, uh), { position: i, normal: s });
|
|
18622
18628
|
}
|
|
18623
18629
|
handlePointerDown(e) {
|
|
18624
18630
|
if (!(!this.editingEnabled || !this.engine.camera || !this.engine.renderer)) {
|
|
@@ -18776,7 +18782,7 @@ class vi extends Error {
|
|
|
18776
18782
|
super("模型对比已取消"), this.name = "ModelComparisonCancelledError";
|
|
18777
18783
|
}
|
|
18778
18784
|
}
|
|
18779
|
-
class
|
|
18785
|
+
class fh {
|
|
18780
18786
|
constructor(e) {
|
|
18781
18787
|
this.engine = e;
|
|
18782
18788
|
}
|
|
@@ -19214,8 +19220,8 @@ class gh {
|
|
|
19214
19220
|
});
|
|
19215
19221
|
}
|
|
19216
19222
|
}
|
|
19217
|
-
const
|
|
19218
|
-
class
|
|
19223
|
+
const Hn = "__modelExplodeProxy", Vn = new H().makeScale(0, 0, 0);
|
|
19224
|
+
class yh {
|
|
19219
19225
|
engine;
|
|
19220
19226
|
/** 当前是否处于炸开模式;供外部滑块、交互模块判断是否需要走代理逻辑。 */
|
|
19221
19227
|
active = !1;
|
|
@@ -19356,7 +19362,7 @@ class fh {
|
|
|
19356
19362
|
* 从命中的代理对象还原真实构件 ID,避免 Object3D.name 字符串化造成 nodesMap 查询失败。
|
|
19357
19363
|
*/
|
|
19358
19364
|
getObjectComponentId(e) {
|
|
19359
|
-
return e?.userData?.[
|
|
19365
|
+
return e?.userData?.[Hn] === !0 ? e.userData.componentId : null;
|
|
19360
19366
|
}
|
|
19361
19367
|
/**
|
|
19362
19368
|
* 返回炸开后用于悬浮高亮的代理网格。
|
|
@@ -19510,7 +19516,7 @@ class fh {
|
|
|
19510
19516
|
}
|
|
19511
19517
|
/** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
|
|
19512
19518
|
assignProxyIdentity(e, t, i) {
|
|
19513
|
-
e.url = t, e.name = String(i), e.userData[
|
|
19519
|
+
e.url = t, e.name = String(i), e.userData[Hn] = !0, e.userData.componentId = i, e.userData.url = t;
|
|
19514
19520
|
}
|
|
19515
19521
|
/**
|
|
19516
19522
|
* 隐藏源渲染片段,避免与代理对象重复显示。
|
|
@@ -19518,7 +19524,7 @@ class fh {
|
|
|
19518
19524
|
*/
|
|
19519
19525
|
hideSource(e) {
|
|
19520
19526
|
if (e.kind === "instance") {
|
|
19521
|
-
e.sourceMesh.setMatrixAt(e.subIndex,
|
|
19527
|
+
e.sourceMesh.setMatrixAt(e.subIndex, Vn), e.sourceMesh.instanceMatrix.needsUpdate = !0;
|
|
19522
19528
|
return;
|
|
19523
19529
|
}
|
|
19524
19530
|
this.ensureSplitState(e);
|
|
@@ -19538,7 +19544,7 @@ class fh {
|
|
|
19538
19544
|
*/
|
|
19539
19545
|
restoreSource(e) {
|
|
19540
19546
|
if (e.kind === "instance") {
|
|
19541
|
-
const s = this.shouldKeepOriginalInstanceHidden(e) ?
|
|
19547
|
+
const s = this.shouldKeepOriginalInstanceHidden(e) ? Vn : e.originalMatrix;
|
|
19542
19548
|
s instanceof H && (e.sourceMesh.setMatrixAt(e.subIndex, s), e.sourceMesh.instanceMatrix.needsUpdate = !0);
|
|
19543
19549
|
return;
|
|
19544
19550
|
}
|
|
@@ -19742,7 +19748,7 @@ class fh {
|
|
|
19742
19748
|
return Math.abs(i);
|
|
19743
19749
|
}
|
|
19744
19750
|
}
|
|
19745
|
-
const
|
|
19751
|
+
const Un = "bim-material-editor-style", st = [
|
|
19746
19752
|
"map",
|
|
19747
19753
|
"normalMap",
|
|
19748
19754
|
"roughnessMap",
|
|
@@ -19761,7 +19767,7 @@ const Vn = "bim-material-editor-style", st = [
|
|
|
19761
19767
|
bumpMap: "凹凸贴图",
|
|
19762
19768
|
emissiveMap: "自发光贴图"
|
|
19763
19769
|
};
|
|
19764
|
-
class
|
|
19770
|
+
class Mh {
|
|
19765
19771
|
constructor(e) {
|
|
19766
19772
|
this.engine = e;
|
|
19767
19773
|
}
|
|
@@ -19847,7 +19853,7 @@ function si(a) {
|
|
|
19847
19853
|
function xi(a) {
|
|
19848
19854
|
return a.map((e) => e.name || e.url || e.type || e.uuid).filter((e, t, i) => e.length > 0 && i.indexOf(e) === t);
|
|
19849
19855
|
}
|
|
19850
|
-
function
|
|
19856
|
+
function Hs(a) {
|
|
19851
19857
|
const e = {
|
|
19852
19858
|
name: a.name,
|
|
19853
19859
|
opacity: a.opacity,
|
|
@@ -19867,7 +19873,7 @@ function Ns(a) {
|
|
|
19867
19873
|
function yt(a) {
|
|
19868
19874
|
return a instanceof Ie ? si(a) || a.uuid : a;
|
|
19869
19875
|
}
|
|
19870
|
-
function
|
|
19876
|
+
function vh(a) {
|
|
19871
19877
|
const e = a, t = {
|
|
19872
19878
|
type: a.type,
|
|
19873
19879
|
name: a.name || a.type,
|
|
@@ -19883,8 +19889,8 @@ function Mh(a) {
|
|
|
19883
19889
|
i in e && (t[i] = yt(e[i]) ?? null);
|
|
19884
19890
|
}), JSON.stringify(t);
|
|
19885
19891
|
}
|
|
19886
|
-
function
|
|
19887
|
-
const t =
|
|
19892
|
+
function xh(a, e) {
|
|
19893
|
+
const t = Hs(a), i = {};
|
|
19888
19894
|
return Object.entries(e.values).forEach(([n, s]) => {
|
|
19889
19895
|
const o = t[n];
|
|
19890
19896
|
yt(s) !== yt(o) && (i[n] = {
|
|
@@ -19893,7 +19899,7 @@ function vh(a, e) {
|
|
|
19893
19899
|
});
|
|
19894
19900
|
}), i;
|
|
19895
19901
|
}
|
|
19896
|
-
function
|
|
19902
|
+
function Vs(a, e, t) {
|
|
19897
19903
|
const i = a;
|
|
19898
19904
|
if ((e === "color" || e === "emissive") && i[e] instanceof xe && typeof t == "string") {
|
|
19899
19905
|
i[e].set(t);
|
|
@@ -19928,7 +19934,7 @@ function qt(a) {
|
|
|
19928
19934
|
}))
|
|
19929
19935
|
};
|
|
19930
19936
|
}
|
|
19931
|
-
class
|
|
19937
|
+
class wh {
|
|
19932
19938
|
constructor(e, t) {
|
|
19933
19939
|
this.engine = e, this.host = t;
|
|
19934
19940
|
}
|
|
@@ -20082,7 +20088,7 @@ class xh {
|
|
|
20082
20088
|
createSideSelect(e, t) {
|
|
20083
20089
|
const i = this.createElement("div", "bim-material-editor__row"), n = document.createElement("select");
|
|
20084
20090
|
return [
|
|
20085
|
-
{ label: "正面", value:
|
|
20091
|
+
{ label: "正面", value: Ao },
|
|
20086
20092
|
{ label: "背面", value: Oi },
|
|
20087
20093
|
{ label: "双面", value: re }
|
|
20088
20094
|
].forEach((s) => {
|
|
@@ -20099,10 +20105,10 @@ class xh {
|
|
|
20099
20105
|
return t && (n.className = t), i && (n.textContent = i), n;
|
|
20100
20106
|
}
|
|
20101
20107
|
ensureStyle() {
|
|
20102
|
-
if (document.getElementById(
|
|
20108
|
+
if (document.getElementById(Un) != null)
|
|
20103
20109
|
return;
|
|
20104
20110
|
const e = document.createElement("style");
|
|
20105
|
-
e.id =
|
|
20111
|
+
e.id = Un, e.textContent = `
|
|
20106
20112
|
.bim-material-editor{position:absolute;right:0;top:0;bottom:0;z-index:1005;height:100%;max-height:100%;display:grid;grid-template-rows:auto auto auto auto minmax(0,1fr) auto;gap:8px;padding:12px;background:#f7f9fc;color:#1b2430;border-left:1px solid #d7dde8;box-shadow:-8px 0 24px rgba(20,30,45,.16);font:13px/1.4 Arial,"Microsoft YaHei",sans-serif;box-sizing:border-box;overflow:hidden}
|
|
20107
20113
|
.bim-material-editor *{box-sizing:border-box}
|
|
20108
20114
|
.bim-material-editor__header{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
@@ -20135,7 +20141,7 @@ class xh {
|
|
|
20135
20141
|
`, document.head.appendChild(e);
|
|
20136
20142
|
}
|
|
20137
20143
|
}
|
|
20138
|
-
class
|
|
20144
|
+
class bh {
|
|
20139
20145
|
constructor(e) {
|
|
20140
20146
|
this.collectSceneMaterials = e;
|
|
20141
20147
|
}
|
|
@@ -20156,7 +20162,7 @@ class wh {
|
|
|
20156
20162
|
name: e.name,
|
|
20157
20163
|
type: e.type,
|
|
20158
20164
|
objectNames: xi(t),
|
|
20159
|
-
values:
|
|
20165
|
+
values: Hs(e)
|
|
20160
20166
|
});
|
|
20161
20167
|
}
|
|
20162
20168
|
getModifiedMaterials() {
|
|
@@ -20166,7 +20172,7 @@ class wh {
|
|
|
20166
20172
|
const i = this.baselineSnapshots.get(t.material.uuid);
|
|
20167
20173
|
if (i == null)
|
|
20168
20174
|
return;
|
|
20169
|
-
const n =
|
|
20175
|
+
const n = xh(t.material, i);
|
|
20170
20176
|
Object.keys(n).length !== 0 && e.push({
|
|
20171
20177
|
id: t.material.uuid,
|
|
20172
20178
|
name: t.material.name || i.name,
|
|
@@ -20179,17 +20185,17 @@ class wh {
|
|
|
20179
20185
|
restore(e) {
|
|
20180
20186
|
const t = this.baselineSnapshots.get(e.uuid);
|
|
20181
20187
|
return t == null ? !1 : (Object.entries(t.values).forEach(([i, n]) => {
|
|
20182
|
-
|
|
20188
|
+
Vs(e, i, n);
|
|
20183
20189
|
}), e.needsUpdate = !0, !0);
|
|
20184
20190
|
}
|
|
20185
20191
|
}
|
|
20186
|
-
class
|
|
20192
|
+
class Ch {
|
|
20187
20193
|
constructor(e, t = {}) {
|
|
20188
20194
|
this.engine = e, this.options = {
|
|
20189
20195
|
visible: t.visible ?? !1,
|
|
20190
20196
|
title: t.title ?? "材质编辑器",
|
|
20191
20197
|
width: t.width ?? 340
|
|
20192
|
-
}, this.visible = this.options.visible, this.collector = new
|
|
20198
|
+
}, this.visible = this.options.visible, this.collector = new Mh(e), this.snapshots = new bh(() => this.collectSceneMaterials()), this.panel = new wh(e, this);
|
|
20193
20199
|
}
|
|
20194
20200
|
options;
|
|
20195
20201
|
selectedMaterials = [];
|
|
@@ -20272,7 +20278,7 @@ class bh {
|
|
|
20272
20278
|
const i = this.findMaterialGroupById(e);
|
|
20273
20279
|
i.length !== 0 && (i.forEach((n) => {
|
|
20274
20280
|
this.snapshots.ensure(n, this.collector.findOwners(n)), Object.entries(t).forEach(([s, o]) => {
|
|
20275
|
-
|
|
20281
|
+
Vs(n, s, o);
|
|
20276
20282
|
}), n.needsUpdate = !0;
|
|
20277
20283
|
}), this.requestRender(), this.render());
|
|
20278
20284
|
}
|
|
@@ -20331,7 +20337,7 @@ class bh {
|
|
|
20331
20337
|
dedupeMaterials(e) {
|
|
20332
20338
|
const t = /* @__PURE__ */ new Map();
|
|
20333
20339
|
return e.forEach((i) => {
|
|
20334
|
-
const n =
|
|
20340
|
+
const n = vh(i.material), s = t.get(n);
|
|
20335
20341
|
if (s == null) {
|
|
20336
20342
|
t.set(n, { material: i.material, materials: [i.material], owners: [...i.owners] });
|
|
20337
20343
|
return;
|
|
@@ -20357,7 +20363,7 @@ class bh {
|
|
|
20357
20363
|
}
|
|
20358
20364
|
replaceTexture(e, t, i) {
|
|
20359
20365
|
const n = e, s = n[t];
|
|
20360
|
-
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? We :
|
|
20366
|
+
s != null && this.ownedTextures.has(s) && (s.dispose(), this.ownedTextures.delete(s)), i != null && (i.colorSpace = t === "map" || t === "emissiveMap" ? We : So, i.wrapS = pt, i.wrapT = pt, i.needsUpdate = !0, this.ownedTextures.add(i)), n[t] = i, e.needsUpdate = !0, this.requestRender();
|
|
20361
20367
|
}
|
|
20362
20368
|
loadTexture(e) {
|
|
20363
20369
|
return new Promise((t, i) => {
|
|
@@ -20371,7 +20377,7 @@ class bh {
|
|
|
20371
20377
|
this.ownedTextures.forEach((e) => e.dispose()), this.ownedTextures.clear();
|
|
20372
20378
|
}
|
|
20373
20379
|
}
|
|
20374
|
-
class
|
|
20380
|
+
class Eh {
|
|
20375
20381
|
engine;
|
|
20376
20382
|
codeMap = [];
|
|
20377
20383
|
continusIds = /* @__PURE__ */ new Map();
|
|
@@ -20472,16 +20478,16 @@ const Kt = {
|
|
|
20472
20478
|
sampleCount: 64,
|
|
20473
20479
|
roundedRadius: 1,
|
|
20474
20480
|
historyLimit: 100
|
|
20475
|
-
},
|
|
20481
|
+
}, Ah = {
|
|
20476
20482
|
bezier: "贝塞尔曲线",
|
|
20477
20483
|
straight: "直线",
|
|
20478
20484
|
rounded: "圆角直线"
|
|
20479
|
-
},
|
|
20485
|
+
}, Sh = {
|
|
20480
20486
|
bezier: "∿",
|
|
20481
20487
|
straight: "╱",
|
|
20482
20488
|
rounded: "⌁"
|
|
20483
20489
|
};
|
|
20484
|
-
class
|
|
20490
|
+
class Ph {
|
|
20485
20491
|
type = "path-draw";
|
|
20486
20492
|
engine;
|
|
20487
20493
|
root = new pe();
|
|
@@ -20715,10 +20721,10 @@ class Sh {
|
|
|
20715
20721
|
}
|
|
20716
20722
|
/** 使用 Line2 保证 WebGL 环境下的像素线宽真实生效。 */
|
|
20717
20723
|
updateLineObject(e, t, i) {
|
|
20718
|
-
const n = new
|
|
20724
|
+
const n = new Po();
|
|
20719
20725
|
if (n.setPositions(t.flatMap((r) => [r.x, r.y, r.z])), e)
|
|
20720
20726
|
return e.geometry.dispose(), e.geometry = n, e.computeLineDistances(), this.syncLineResolution(e), this.requestRender(), e;
|
|
20721
|
-
const s = new
|
|
20727
|
+
const s = new To({
|
|
20722
20728
|
color: i ? this.options.previewColor : this.options.lineColor,
|
|
20723
20729
|
linewidth: this.options.lineWidth,
|
|
20724
20730
|
dashed: i,
|
|
@@ -20727,7 +20733,7 @@ class Sh {
|
|
|
20727
20733
|
depthTest: !1,
|
|
20728
20734
|
transparent: i,
|
|
20729
20735
|
opacity: i ? 0.82 : 1
|
|
20730
|
-
}), o = new
|
|
20736
|
+
}), o = new Io(n, s);
|
|
20731
20737
|
return o.name = i ? "PathDrawPreviewLine" : "PathDrawLine", o.renderOrder = i ? 1001 : 1e3, o.computeLineDistances(), this.syncLineResolution(o), this.root.add(o), this.requestRender(), o;
|
|
20732
20738
|
}
|
|
20733
20739
|
syncLineResolution(e) {
|
|
@@ -20847,7 +20853,7 @@ class Sh {
|
|
|
20847
20853
|
t.append(i, n, s), e.appendChild(t), this.statusElement = n;
|
|
20848
20854
|
const o = document.createElement("div");
|
|
20849
20855
|
Object.assign(o.style, { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "4px", padding: "8px" }), ["bezier", "straight", "rounded"].forEach((x) => {
|
|
20850
|
-
const m = this.createIconButton(
|
|
20856
|
+
const m = this.createIconButton(Sh[x], Ah[x], () => this.setLineType(x));
|
|
20851
20857
|
m.dataset.lineType = x, m.style.width = "100%", m.style.fontSize = "18px", o.appendChild(m);
|
|
20852
20858
|
}), e.appendChild(o);
|
|
20853
20859
|
const r = document.createElement("label");
|
|
@@ -20965,7 +20971,7 @@ class Sh {
|
|
|
20965
20971
|
return { x: e.x, y: e.y, z: e.z };
|
|
20966
20972
|
}
|
|
20967
20973
|
}
|
|
20968
|
-
class
|
|
20974
|
+
class Th {
|
|
20969
20975
|
engine;
|
|
20970
20976
|
continusIds = /* @__PURE__ */ new Map();
|
|
20971
20977
|
constructor(e) {
|
|
@@ -21024,27 +21030,27 @@ class Ph {
|
|
|
21024
21030
|
});
|
|
21025
21031
|
}
|
|
21026
21032
|
}
|
|
21027
|
-
const
|
|
21028
|
-
maxTextureSize:
|
|
21033
|
+
const Ih = Object.freeze({
|
|
21034
|
+
maxTextureSize: 4096,
|
|
21029
21035
|
samples: 0,
|
|
21030
21036
|
restrictTextureSize: !0
|
|
21031
|
-
}),
|
|
21037
|
+
}), _h = Object.freeze({
|
|
21032
21038
|
maxTextureSize: 4096,
|
|
21033
21039
|
samples: 4,
|
|
21034
21040
|
restrictTextureSize: !0
|
|
21035
|
-
}),
|
|
21041
|
+
}), Dh = Object.freeze({
|
|
21036
21042
|
maxTextureSize: 10240,
|
|
21037
21043
|
samples: 4,
|
|
21038
21044
|
restrictTextureSize: !0
|
|
21039
|
-
}),
|
|
21045
|
+
}), kh = Object.freeze({
|
|
21040
21046
|
maxTextureSize: 10240,
|
|
21041
21047
|
samples: 4,
|
|
21042
21048
|
restrictTextureSize: !1
|
|
21043
21049
|
});
|
|
21044
|
-
function
|
|
21045
|
-
return typeof a != "number" || !Number.isFinite(a) || a <= 4 ?
|
|
21050
|
+
function Lh(a) {
|
|
21051
|
+
return typeof a != "number" || !Number.isFinite(a) || a <= 4 ? Ih : a <= 6 ? _h : a < 8 ? Dh : kh;
|
|
21046
21052
|
}
|
|
21047
|
-
class
|
|
21053
|
+
class Fh {
|
|
21048
21054
|
// 引擎参数
|
|
21049
21055
|
options;
|
|
21050
21056
|
mobileMemoryProfile;
|
|
@@ -21161,22 +21167,22 @@ class Oh {
|
|
|
21161
21167
|
// 业务数据
|
|
21162
21168
|
models = [];
|
|
21163
21169
|
reactBoundingClientRect = { left: 0, top: 0 };
|
|
21164
|
-
version =
|
|
21170
|
+
version = Bo;
|
|
21165
21171
|
versionEl = null;
|
|
21166
21172
|
// 引擎容器
|
|
21167
21173
|
container;
|
|
21168
21174
|
constructor(e) {
|
|
21169
|
-
if (window.THREE =
|
|
21175
|
+
if (window.THREE = Wn, ur(), this.options = e, this.mobileMemoryProfile = Lh(e.limit_memory), this.container = document.getElementById(e.containerId), !this.container)
|
|
21170
21176
|
throw new Error(`Container ${e.containerId} not found`);
|
|
21171
|
-
if (this.rxQuotaListMapper = new
|
|
21177
|
+
if (this.rxQuotaListMapper = new Eh(this), this.filterLoaderModel = new Th(this), this.engineModelModule = new Ga(this), this.engineModelModule.init(), this.deviceModule = new Wo(this), this.deviceType = this.deviceModule.getDeviceType(), this.cameraModule = new ie(this), this.sceneModule = new Uo(this), this.scene = this.sceneModule.scene, this.renderModule = new Go(this), this.renderer = this.renderModule.createRenderer(), this.camera = this.cameraModule.perspectiveCamera, this.scene.camera = this.camera, this.renderer) {
|
|
21172
21178
|
const o = this.renderer;
|
|
21173
21179
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
21174
21180
|
}
|
|
21175
|
-
this.controlModule = new
|
|
21181
|
+
this.controlModule = new nr(this), this.controlModule.switchDefaultMode(), this.controls = this.controlModule.orbitControls, this.clipping = new Dl(this), this.clipping.init(), this.composerModule = new or(this), this.composerModule.init(), this.events = new Ma();
|
|
21176
21182
|
const t = this.events.trigger.bind(this.events);
|
|
21177
21183
|
this.events.trigger = ((o, r) => {
|
|
21178
21184
|
t(o, r), String(o) !== String(ne.EngineBusy) && this.requestComposerRender();
|
|
21179
|
-
}), this.engineStatus = new
|
|
21185
|
+
}), this.engineStatus = new ya(this), this.engineStatus.init(), this.loaderModule = new ve(this), this.lightModule = new Fa(this), this.lightModule.init(), this.viewCube = new Ya(this), this.viewCube.init(), this.options.showViewCube == !1 && this.viewCube.hide(), this.octreeBox = Xa(this), this.rangeScale = new Qa(this), this.rangeScale.init(), this.setting = new yl(this), this.engineModelModule.init(), this.handelBehaved = Gi(this), this.modelMapperBatch = new Fl(this), this.measure = new Sl(this), this.modelToolModule = new Ha(this), this.modelLink3d = new Tc(this, this.options.linkOptions ?? {}), this.modelLink3d.init(), this.modelProperties = new Bl(this), this.search = new Ol(this), this.interactionModule = new Na(this), this.interactionModule.init(), this.interactionModule.active(), this.hoverHighLight = new ni(this), this.modelEdge = new gl(this), this.nodeBox = new Vl(this), this.modelTree = new kl(this), this.viewTree = new Ki(this), this.merge2d = new cc(this), this.engineInfo = new Ll(this), this.pathRoaming = new ql(this), this.pathRoaming.init(), this.oneClickEncoding = new $l(this), this.minMap = new Kl(this), this.linkElement2d3d = new Xl(this), this.linkView2d3d = new Ql(this), this.grid = new Ja(this), this.level = new ol(this), this.issueReport = new jl(this), this.fabricDraw = new Ac(this), this.drawingPin = new Sc(this), this.label = new Ic(this), this.annotation3d = new dh(this), this.calibration = new dt(this), this.modelPlace = new gh(this), this.modelComparison = new fh(this), this.modelExplode = new yh(this), this.materialTool = new Ch(this, this.options.materialEditorOptions ?? {}), this.materialTool.init(), this.pathDraw = new Ph(this), this.text = new Yl(this), this.hdr = new il(this), this.ground = new qi(this), this.ground.init(), this.skyManager = new fl(this), this.setting.init(), this.worldToScreen = new fe(this.camera, this.renderer, this.scene), this.options.showStats && (this.stats = new Vo(), 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));
|
|
21180
21186
|
let i = document.createElement("div");
|
|
21181
21187
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
21182
21188
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -21292,7 +21298,7 @@ class Oh {
|
|
|
21292
21298
|
* 解析得到多个模型地址时,共用同一份加载选项,包括是否加载边线。
|
|
21293
21299
|
*/
|
|
21294
21300
|
async loadModelByViewToken(e, t) {
|
|
21295
|
-
const i = await
|
|
21301
|
+
const i = await zo(
|
|
21296
21302
|
this.options,
|
|
21297
21303
|
e,
|
|
21298
21304
|
"3d"
|
|
@@ -21402,7 +21408,7 @@ class Oh {
|
|
|
21402
21408
|
const i = this.getViewportSize(e, t);
|
|
21403
21409
|
e = i.width, t = i.height;
|
|
21404
21410
|
const n = this.camera.position.clone(), s = this.camera.quaternion.clone(), o = this.camera.up.clone(), r = this.controls?.target?.clone?.(), l = this.controlModule?.orbitControls?.origin?.clone?.();
|
|
21405
|
-
this.renderer.setPixelRatio(
|
|
21411
|
+
this.renderer.setPixelRatio(ts(this)), this.renderer.setSize(e, t, !1);
|
|
21406
21412
|
const c = this.renderer.domElement.clientWidth || e, h = this.renderer.domElement.clientHeight || t;
|
|
21407
21413
|
if (!c || !h)
|
|
21408
21414
|
return;
|
|
@@ -21469,7 +21475,7 @@ class Oh {
|
|
|
21469
21475
|
if (!e) return;
|
|
21470
21476
|
[...e.children].forEach((i) => {
|
|
21471
21477
|
this.clearScene(i);
|
|
21472
|
-
}), e.parent && e.parent.remove(e), e instanceof z && !(e instanceof V) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof Lt && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof
|
|
21478
|
+
}), e.parent && e.parent.remove(e), e instanceof z && !(e instanceof V) && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material))), e instanceof Lt && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof _o && (e.geometry && e.geometry.dispose(), e.material && this.disposeMaterial(e.material)), e instanceof V && (e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((i) => this.disposeMaterial(i)) : this.disposeMaterial(e.material)), e.instanceMatrix && (e.instanceMatrix = null), e.instanceColor && (e.instanceColor = null)), e instanceof wi && e.material && this.disposeMaterial(e.material), e instanceof Do && e.shadow?.dispose?.();
|
|
21473
21479
|
}
|
|
21474
21480
|
/**
|
|
21475
21481
|
* 清理材质及其纹理
|
|
@@ -21524,6 +21530,6 @@ class Oh {
|
|
|
21524
21530
|
}
|
|
21525
21531
|
}
|
|
21526
21532
|
export {
|
|
21527
|
-
|
|
21528
|
-
|
|
21533
|
+
Fh as E,
|
|
21534
|
+
Ch as M
|
|
21529
21535
|
};
|