iflow-engine-base-3d 4.0.5 → 4.0.7
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-BX8ofLsJ.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 Vo {
|
|
|
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 Uo {
|
|
|
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 Wo = { 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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 es extends Ws {
|
|
|
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 Un {
|
|
|
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 jo = ee("/assets/worker_walk.glb", import.meta.url), Yo = Math.PI, Xo = {
|
|
|
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 Un {
|
|
|
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 Un {
|
|
|
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 Un {
|
|
|
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 Un {
|
|
|
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 Qo(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 $o(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 tr {
|
|
|
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 tr {
|
|
|
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 tr {
|
|
|
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 tr {
|
|
|
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 ir = {
|
|
|
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 nr {
|
|
|
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 nr {
|
|
|
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 sr(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 sr(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 or(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 rr(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
|
|
2918
|
+
function Er() {
|
|
2919
|
+
return gt == null && (gt = new Zn(), gt.setDecoderPath(ps()), gt.preload()), gt;
|
|
2914
2920
|
}
|
|
2915
|
-
function
|
|
2916
|
-
return ft == null && (ft = new
|
|
2921
|
+
function Ar(a) {
|
|
2922
|
+
return ft == null && (ft = new to(), ft.setTranscoderPath(ms())), un !== a && (ft.detectSupport(a), un = a), ft;
|
|
2917
2923
|
}
|
|
2918
|
-
function
|
|
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 ps() {
|
|
|
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 Pr(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 ms(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 _r(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 zr(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 Rr(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 Ur(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 Ur(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 Ur(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 Gr(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 Gr(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 qr(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 qr(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 jr(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 jr(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 jr(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 jr(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 Yr(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,52 +3448,58 @@ function $r(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) {
|
|
3497
|
+
if (e !== "map" || a == null)
|
|
3498
|
+
return;
|
|
3499
|
+
const t = a.color;
|
|
3500
|
+
t != null && (t.getHex() === 0 && t.set(16777215), a.needsUpdate = !0);
|
|
3501
|
+
}
|
|
3502
|
+
function Cs(a, e) {
|
|
3491
3503
|
if (e?.deviceModule?.isMobile?.() !== !0 || e?.mobileMemoryProfile?.restrictTextureSize === !1 || a == null)
|
|
3492
3504
|
return;
|
|
3493
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;
|
|
@@ -3496,12 +3508,12 @@ function ws(a, e) {
|
|
|
3496
3508
|
const l = o[r];
|
|
3497
3509
|
if (l?.isTexture !== !0)
|
|
3498
3510
|
return;
|
|
3499
|
-
if (
|
|
3500
|
-
o[r] = null;
|
|
3511
|
+
if (pn.has(l)) {
|
|
3512
|
+
o[r] = null, yn(o, r);
|
|
3501
3513
|
return;
|
|
3502
3514
|
}
|
|
3503
|
-
const c =
|
|
3504
|
-
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", {
|
|
3505
3517
|
slot: r,
|
|
3506
3518
|
width: c.width,
|
|
3507
3519
|
height: c.height,
|
|
@@ -3510,7 +3522,7 @@ function ws(a, e) {
|
|
|
3510
3522
|
});
|
|
3511
3523
|
});
|
|
3512
3524
|
}
|
|
3513
|
-
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;
|
|
3514
3526
|
class ve {
|
|
3515
3527
|
static localRequestMap = /* @__PURE__ */ new Map();
|
|
3516
3528
|
static localObjectUrls = /* @__PURE__ */ new Set();
|
|
@@ -3533,7 +3545,7 @@ class ve {
|
|
|
3533
3545
|
for (const n of e) {
|
|
3534
3546
|
this.unloadedModelUrls.delete(n);
|
|
3535
3547
|
const s = (this.modelLoadVersions.get(n) ?? 0) + 1;
|
|
3536
|
-
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);
|
|
3537
3549
|
}
|
|
3538
3550
|
function i(n) {
|
|
3539
3551
|
const s = n.split(".").pop();
|
|
@@ -3551,11 +3563,11 @@ class ve {
|
|
|
3551
3563
|
const s = e[n];
|
|
3552
3564
|
try {
|
|
3553
3565
|
const o = await ei.get(s, { responseType: "blob" });
|
|
3554
|
-
if (!await
|
|
3566
|
+
if (!await vn(o.data))
|
|
3555
3567
|
throw new Error("响应内容不是有效的 ZIP 文件");
|
|
3556
3568
|
i.push(new File(
|
|
3557
3569
|
[o.data],
|
|
3558
|
-
|
|
3570
|
+
pa(s, n),
|
|
3559
3571
|
{ type: o.data.type || "application/zip" }
|
|
3560
3572
|
));
|
|
3561
3573
|
} catch (o) {
|
|
@@ -3596,8 +3608,8 @@ class ve {
|
|
|
3596
3608
|
if (typeof e != "string" || e.length === 0)
|
|
3597
3609
|
return;
|
|
3598
3610
|
this.unloadedModelUrls.add(e), this.modelLoadVersions.set(e, (this.modelLoadVersions.get(e) ?? 0) + 1);
|
|
3599
|
-
const t = Array.isArray(this.engine?.models) ? this.engine.models.filter((s) => s?.url === e) : [], i =
|
|
3600
|
-
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?.();
|
|
3601
3613
|
}
|
|
3602
3614
|
/** 返回指定 URL 是否已收到卸载请求,供异步加载链路避免卸载后回写。 */
|
|
3603
3615
|
isModelUnloadRequested(e) {
|
|
@@ -3627,13 +3639,13 @@ class ve {
|
|
|
3627
3639
|
for (const l of t) {
|
|
3628
3640
|
const c = this.parseDirectPackageEntry(l.path);
|
|
3629
3641
|
if (c != null) {
|
|
3630
|
-
|
|
3642
|
+
xn(i, c.modelKey).set(c.packageName, l.blob);
|
|
3631
3643
|
continue;
|
|
3632
3644
|
}
|
|
3633
3645
|
const h = this.parseExtractedPackageEntry(l.path);
|
|
3634
3646
|
if (h == null)
|
|
3635
3647
|
continue;
|
|
3636
|
-
const u =
|
|
3648
|
+
const u = xn(n, h.modelKey), p = u.get(h.packageName) ?? [];
|
|
3637
3649
|
p.push({
|
|
3638
3650
|
path: h.innerPath,
|
|
3639
3651
|
blob: l.blob
|
|
@@ -3657,7 +3669,7 @@ class ve {
|
|
|
3657
3669
|
blob: await this.packEntriesAsZip(g)
|
|
3658
3670
|
});
|
|
3659
3671
|
c.some((p) => p.packageName === "info") && (r += 1, o.push({
|
|
3660
|
-
rootUrl: `${
|
|
3672
|
+
rootUrl: `${sa}/${ve.createLocalModelId(l, r)}`,
|
|
3661
3673
|
packages: c
|
|
3662
3674
|
}));
|
|
3663
3675
|
}
|
|
@@ -3671,15 +3683,15 @@ class ve {
|
|
|
3671
3683
|
const t = [];
|
|
3672
3684
|
for (const i of e) {
|
|
3673
3685
|
const n = Re(i.webkitRelativePath || i.name), s = wt(n);
|
|
3674
|
-
if (
|
|
3686
|
+
if (Mn(s)) {
|
|
3675
3687
|
t.push({ path: n, blob: i });
|
|
3676
3688
|
continue;
|
|
3677
3689
|
}
|
|
3678
|
-
if (await
|
|
3690
|
+
if (await vn(i)) {
|
|
3679
3691
|
const o = await Ci.loadAsync(i), r = ui(n), l = Object.values(o.files);
|
|
3680
3692
|
for (const c of l)
|
|
3681
3693
|
c.dir || t.push({
|
|
3682
|
-
path:
|
|
3694
|
+
path: ma(r, Re(c.name)),
|
|
3683
3695
|
blob: await c.async("blob")
|
|
3684
3696
|
});
|
|
3685
3697
|
continue;
|
|
@@ -3693,9 +3705,9 @@ class ve {
|
|
|
3693
3705
|
*/
|
|
3694
3706
|
parseDirectPackageEntry(e) {
|
|
3695
3707
|
const t = ui(e), i = wt(e);
|
|
3696
|
-
return
|
|
3708
|
+
return Mn(i) ? {
|
|
3697
3709
|
modelKey: t,
|
|
3698
|
-
packageName:
|
|
3710
|
+
packageName: ga(i)
|
|
3699
3711
|
} : null;
|
|
3700
3712
|
}
|
|
3701
3713
|
/**
|
|
@@ -3704,7 +3716,7 @@ class ve {
|
|
|
3704
3716
|
parseExtractedPackageEntry(e) {
|
|
3705
3717
|
const t = Re(e).split("/").filter(Boolean);
|
|
3706
3718
|
for (let n = 0; n < t.length; n++) {
|
|
3707
|
-
const s =
|
|
3719
|
+
const s = fa(t[n]);
|
|
3708
3720
|
if (s == null)
|
|
3709
3721
|
continue;
|
|
3710
3722
|
const o = t.slice(n + 1);
|
|
@@ -3775,14 +3787,14 @@ class ve {
|
|
|
3775
3787
|
return `${e.replace(/[^a-zA-Z0-9/_-]/g, "_").replace(/\//g, "__") || "model"}_${Date.now()}_${t}_${Math.random().toString(36).slice(2, 8)}`;
|
|
3776
3788
|
}
|
|
3777
3789
|
}
|
|
3778
|
-
function
|
|
3790
|
+
function Es() {
|
|
3779
3791
|
return {
|
|
3780
3792
|
geometries: /* @__PURE__ */ new Set(),
|
|
3781
3793
|
materials: /* @__PURE__ */ new Set(),
|
|
3782
3794
|
textures: /* @__PURE__ */ new Set()
|
|
3783
3795
|
};
|
|
3784
3796
|
}
|
|
3785
|
-
function
|
|
3797
|
+
function As(a, e) {
|
|
3786
3798
|
Object.values(a).forEach((i) => {
|
|
3787
3799
|
i instanceof Ie && e.add(i);
|
|
3788
3800
|
});
|
|
@@ -3798,13 +3810,13 @@ function Si(a, e) {
|
|
|
3798
3810
|
[a?.geometry, ...Array.isArray(a?.geometrys) ? a.geometrys : []].forEach((n) => {
|
|
3799
3811
|
n instanceof ae && e.geometries.add(n);
|
|
3800
3812
|
}), (Array.isArray(a?.material) ? a.material : [a?.material]).forEach((n) => {
|
|
3801
|
-
n instanceof At && (e.materials.add(n),
|
|
3813
|
+
n instanceof At && (e.materials.add(n), As(n, e.textures));
|
|
3802
3814
|
});
|
|
3803
3815
|
}
|
|
3804
3816
|
function Ve(a, e) {
|
|
3805
3817
|
a instanceof it && a.traverse((t) => e.add(t));
|
|
3806
3818
|
}
|
|
3807
|
-
function
|
|
3819
|
+
function Ss(a, e) {
|
|
3808
3820
|
Ve(a?.group, e), a?.nodesMap?.forEach?.((t) => {
|
|
3809
3821
|
Ve(t?.mesh, e), Ve(t?.pickBoxMesh, e), Ve(t?.info?.mesh, e), t?.infos?.forEach?.((i) => Ve(i?.mesh, e));
|
|
3810
3822
|
}), a?.lods?.forEach?.((t) => {
|
|
@@ -3813,23 +3825,23 @@ function Es(a, e) {
|
|
|
3813
3825
|
});
|
|
3814
3826
|
});
|
|
3815
3827
|
}
|
|
3816
|
-
function
|
|
3828
|
+
function aa(a, e, t) {
|
|
3817
3829
|
const i = /* @__PURE__ */ new Set();
|
|
3818
|
-
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) => {
|
|
3819
3831
|
(n?.url === e || n?.userData?.url === e) && Ve(n, i);
|
|
3820
3832
|
}), a?.scene?.traverse?.((n) => {
|
|
3821
3833
|
(n?.url === e || n?.userData?.url === e) && Ve(n, i);
|
|
3822
3834
|
}), i;
|
|
3823
3835
|
}
|
|
3824
|
-
function
|
|
3825
|
-
const i =
|
|
3836
|
+
function la(a, e, t) {
|
|
3837
|
+
const i = Es();
|
|
3826
3838
|
a?.scene?.traverse?.((s) => {
|
|
3827
3839
|
t.has(s) || Si(s, i);
|
|
3828
3840
|
}), a?.models?.forEach?.((s) => {
|
|
3829
3841
|
if (s?.url === e)
|
|
3830
3842
|
return;
|
|
3831
3843
|
const o = /* @__PURE__ */ new Set();
|
|
3832
|
-
|
|
3844
|
+
Ss(s, o), o.forEach((r) => Si(r, i));
|
|
3833
3845
|
});
|
|
3834
3846
|
const n = a?.scene;
|
|
3835
3847
|
return n?.background instanceof Ie && i.textures.add(n.background), n?.environment instanceof Ie && i.textures.add(n.environment), [
|
|
@@ -3843,16 +3855,16 @@ function ra(a, e, t) {
|
|
|
3843
3855
|
a?.modelExplode?.highlightMaterial,
|
|
3844
3856
|
a?.modelExplode?.translucentMaterial
|
|
3845
3857
|
].forEach((s) => {
|
|
3846
|
-
s instanceof At && (i.materials.add(s),
|
|
3858
|
+
s instanceof At && (i.materials.add(s), As(s, i.textures));
|
|
3847
3859
|
}), i;
|
|
3848
3860
|
}
|
|
3849
|
-
function
|
|
3861
|
+
function ca(a) {
|
|
3850
3862
|
a.forEach((e) => {
|
|
3851
3863
|
e.parent != null && !a.has(e.parent) && e.parent.remove(e);
|
|
3852
3864
|
});
|
|
3853
3865
|
}
|
|
3854
|
-
function
|
|
3855
|
-
const t =
|
|
3866
|
+
function ha(a, e) {
|
|
3867
|
+
const t = Es();
|
|
3856
3868
|
a.forEach((i) => Si(i, t)), t.geometries.forEach((i) => {
|
|
3857
3869
|
e.geometries.has(i) || (i.disposeBoundsTree?.(), i.dispose());
|
|
3858
3870
|
}), t.materials.forEach((i) => {
|
|
@@ -3861,7 +3873,7 @@ function la(a, e) {
|
|
|
3861
3873
|
e.textures.has(i) || i.dispose();
|
|
3862
3874
|
});
|
|
3863
3875
|
}
|
|
3864
|
-
function
|
|
3876
|
+
function da(a, e, t, i) {
|
|
3865
3877
|
const n = /* @__PURE__ */ new Set();
|
|
3866
3878
|
t.forEach((o) => {
|
|
3867
3879
|
Number.isFinite(o?.index) && n.add(o.index);
|
|
@@ -3877,7 +3889,7 @@ function ca(a, e, t, i) {
|
|
|
3877
3889
|
(n.has(r) || t.has(o) || o?.url === e) && s.delete(r);
|
|
3878
3890
|
});
|
|
3879
3891
|
}
|
|
3880
|
-
function
|
|
3892
|
+
function ua(a) {
|
|
3881
3893
|
a?.nodesMap?.clear?.(), a?.lods?.forEach?.((e) => {
|
|
3882
3894
|
e.glbs = [], e.instanceNodes = null, e.preparePromise = null, e.meshPromise = null, e.octreeBox = null;
|
|
3883
3895
|
}), a.group = null, a.modelEdge = null, a.modelMep = null, a.modelMapper = null, a.modelTree = null, a.quotaList = null, a.urls = [];
|
|
@@ -3893,7 +3905,7 @@ function ui(a) {
|
|
|
3893
3905
|
const e = Re(a), t = e.lastIndexOf("/");
|
|
3894
3906
|
return t >= 0 ? e.slice(0, t) : "";
|
|
3895
3907
|
}
|
|
3896
|
-
function
|
|
3908
|
+
function pa(a, e) {
|
|
3897
3909
|
try {
|
|
3898
3910
|
const t = new URL(a, window.location.origin);
|
|
3899
3911
|
return decodeURIComponent(wt(t.pathname)) || `model-package-${e + 1}.zip`;
|
|
@@ -3901,29 +3913,29 @@ function da(a, e) {
|
|
|
3901
3913
|
return wt(a.split("?")[0].split("#")[0]) || `model-package-${e + 1}.zip`;
|
|
3902
3914
|
}
|
|
3903
3915
|
}
|
|
3904
|
-
function
|
|
3916
|
+
function ma(a, e) {
|
|
3905
3917
|
return Re(a ? e ? `${a}/${e}` : a : e);
|
|
3906
3918
|
}
|
|
3907
|
-
function
|
|
3908
|
-
return
|
|
3919
|
+
function Mn(a) {
|
|
3920
|
+
return oa.test(a);
|
|
3909
3921
|
}
|
|
3910
|
-
function
|
|
3922
|
+
function ga(a) {
|
|
3911
3923
|
return a.replace(/\.zip$/i, "").toLowerCase();
|
|
3912
3924
|
}
|
|
3913
|
-
function
|
|
3914
|
-
const e =
|
|
3925
|
+
function fa(a) {
|
|
3926
|
+
const e = ra.exec(a);
|
|
3915
3927
|
return e == null ? null : e[1].toLowerCase();
|
|
3916
3928
|
}
|
|
3917
|
-
async function
|
|
3929
|
+
async function vn(a) {
|
|
3918
3930
|
const e = await a.slice(0, 4).arrayBuffer(), t = new Uint8Array(e);
|
|
3919
3931
|
return t.length >= 4 && t[0] === 80 && t[1] === 75 && t[2] === 3 && t[3] === 4;
|
|
3920
3932
|
}
|
|
3921
|
-
function
|
|
3933
|
+
function xn(a, e) {
|
|
3922
3934
|
let t = a.get(e);
|
|
3923
3935
|
return t == null && (t = /* @__PURE__ */ new Map(), a.set(e, t)), t;
|
|
3924
3936
|
}
|
|
3925
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 || {});
|
|
3926
|
-
class
|
|
3938
|
+
class ya {
|
|
3927
3939
|
engine;
|
|
3928
3940
|
isFree;
|
|
3929
3941
|
// 是否是编辑模式
|
|
@@ -3946,7 +3958,7 @@ class ga {
|
|
|
3946
3958
|
}
|
|
3947
3959
|
init() {
|
|
3948
3960
|
this.engine.renderer?.domElement?.addEventListener("contextmenu", this.handleContextMenu, !0), this.engine.events.on(ne.EngineFree, (e) => {
|
|
3949
|
-
this.updateFree(!0),
|
|
3961
|
+
this.updateFree(!0), bs(this.engine, e, !1), this.engine?.octreeBox?.requestBvhBuild?.();
|
|
3950
3962
|
}), this.engine.events.on(ne.EngineBusy, () => {
|
|
3951
3963
|
this.updateFree(!1);
|
|
3952
3964
|
});
|
|
@@ -3965,7 +3977,7 @@ class ga {
|
|
|
3965
3977
|
closeAllFunction = () => {
|
|
3966
3978
|
};
|
|
3967
3979
|
}
|
|
3968
|
-
class
|
|
3980
|
+
class Ma {
|
|
3969
3981
|
// 使用字符串作为键,以确保不同来源的 EventType 枚举值能够正确匹配
|
|
3970
3982
|
listeners = /* @__PURE__ */ new Map();
|
|
3971
3983
|
// 是否启用调试模式(可以通过外部设置)
|
|
@@ -4021,8 +4033,8 @@ class fa {
|
|
|
4021
4033
|
});
|
|
4022
4034
|
}
|
|
4023
4035
|
}
|
|
4024
|
-
const bt = 1, pi = 1,
|
|
4025
|
-
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 {
|
|
4026
4038
|
// 引擎实例,要求至少提供 scene、controls、octreeBox 等运行时对象。
|
|
4027
4039
|
engine;
|
|
4028
4040
|
// 上一次应用到阴影相机的半边长,用于跳过无意义的小幅更新。
|
|
@@ -4053,7 +4065,7 @@ class Ra {
|
|
|
4053
4065
|
*/
|
|
4054
4066
|
init() {
|
|
4055
4067
|
const e = new Xe(16774630, 2);
|
|
4056
|
-
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;
|
|
4057
4069
|
const t = pi;
|
|
4058
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";
|
|
4059
4071
|
const i = new Xe(16777215, 2);
|
|
@@ -4085,16 +4097,16 @@ class Ra {
|
|
|
4085
4097
|
}
|
|
4086
4098
|
const l = this.resolveShadowTarget(e, r), c = this.getCameraHalfExtent(e, l), h = this.getSceneShadowHalfSize(s, c), u = F.clamp(
|
|
4087
4099
|
Math.max(
|
|
4088
|
-
c *
|
|
4100
|
+
c * xa,
|
|
4089
4101
|
h,
|
|
4090
4102
|
pi
|
|
4091
4103
|
),
|
|
4092
4104
|
pi,
|
|
4093
|
-
|
|
4105
|
+
va
|
|
4094
4106
|
), p = F.clamp(
|
|
4095
|
-
Math.max(u * 2.5, o * 0.75,
|
|
4096
|
-
|
|
4097
|
-
|
|
4107
|
+
Math.max(u * 2.5, o * 0.75, Cn),
|
|
4108
|
+
Cn,
|
|
4109
|
+
Aa
|
|
4098
4110
|
), g = this.getLightOffsetDirection(), y = this.snapShadowTargetToTexel(
|
|
4099
4111
|
l,
|
|
4100
4112
|
g,
|
|
@@ -4127,7 +4139,7 @@ class Ra {
|
|
|
4127
4139
|
return 0;
|
|
4128
4140
|
if (t <= 0)
|
|
4129
4141
|
return e * 0.75;
|
|
4130
|
-
const i = t *
|
|
4142
|
+
const i = t * wa;
|
|
4131
4143
|
return Math.min(e * 0.75, i);
|
|
4132
4144
|
}
|
|
4133
4145
|
/**
|
|
@@ -4139,15 +4151,15 @@ class Ra {
|
|
|
4139
4151
|
updateShadowBias(e, t, i) {
|
|
4140
4152
|
const n = Math.max(e.shadow.mapSize.width, 1), s = t * 2 / n, o = Math.max(i.far - i.near, 1);
|
|
4141
4153
|
e.shadow.normalBias = F.clamp(
|
|
4142
|
-
s *
|
|
4143
|
-
|
|
4144
|
-
|
|
4154
|
+
s * Pa,
|
|
4155
|
+
En,
|
|
4156
|
+
Sa
|
|
4145
4157
|
);
|
|
4146
|
-
const r = s / o *
|
|
4158
|
+
const r = s / o * Ia;
|
|
4147
4159
|
e.shadow.bias = -F.clamp(
|
|
4148
4160
|
r,
|
|
4149
|
-
|
|
4150
|
-
|
|
4161
|
+
An,
|
|
4162
|
+
Ta
|
|
4151
4163
|
);
|
|
4152
4164
|
}
|
|
4153
4165
|
/**
|
|
@@ -4170,12 +4182,12 @@ class Ra {
|
|
|
4170
4182
|
}
|
|
4171
4183
|
if (Number.isFinite(c) && Number.isFinite(h)) {
|
|
4172
4184
|
const u = Math.max(
|
|
4173
|
-
(h - c) *
|
|
4174
|
-
|
|
4185
|
+
(h - c) * Ea,
|
|
4186
|
+
Ca
|
|
4175
4187
|
), p = Math.max(mi, c - u), g = F.clamp(
|
|
4176
4188
|
Math.max(p + 1, h + u),
|
|
4177
4189
|
p + 1,
|
|
4178
|
-
|
|
4190
|
+
bn
|
|
4179
4191
|
);
|
|
4180
4192
|
return { near: p, far: g };
|
|
4181
4193
|
}
|
|
@@ -4183,7 +4195,7 @@ class Ra {
|
|
|
4183
4195
|
const r = F.clamp(
|
|
4184
4196
|
Math.max(n * 1.5, s * 4, gi),
|
|
4185
4197
|
gi,
|
|
4186
|
-
|
|
4198
|
+
bn
|
|
4187
4199
|
);
|
|
4188
4200
|
return { near: mi, far: r };
|
|
4189
4201
|
}
|
|
@@ -4287,7 +4299,7 @@ class Ra {
|
|
|
4287
4299
|
}
|
|
4288
4300
|
if (e instanceof Xt) {
|
|
4289
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);
|
|
4290
|
-
return Math.min(Math.max(r, o),
|
|
4302
|
+
return Math.min(Math.max(r, o), ba);
|
|
4291
4303
|
}
|
|
4292
4304
|
return 0;
|
|
4293
4305
|
}
|
|
@@ -4314,7 +4326,7 @@ class Ra {
|
|
|
4314
4326
|
* @returns 标准化后的世界空间光源偏移方向。
|
|
4315
4327
|
*/
|
|
4316
4328
|
getLightOffsetDirection() {
|
|
4317
|
-
return
|
|
4329
|
+
return Oa.clone();
|
|
4318
4330
|
}
|
|
4319
4331
|
/**
|
|
4320
4332
|
* 根据当前视角和阴影贴图密度计算最终显示强度。
|
|
@@ -4327,8 +4339,8 @@ class Ra {
|
|
|
4327
4339
|
getShadowDisplayIntensity(e, t, i, n) {
|
|
4328
4340
|
const s = i * 2 / Math.max(n, 1), o = 1 - F.smoothstep(
|
|
4329
4341
|
s,
|
|
4330
|
-
|
|
4331
|
-
|
|
4342
|
+
_a,
|
|
4343
|
+
Da
|
|
4332
4344
|
);
|
|
4333
4345
|
let r = 1;
|
|
4334
4346
|
if (e) {
|
|
@@ -4337,8 +4349,8 @@ class Ra {
|
|
|
4337
4349
|
const c = Math.abs(l.dot(t.clone().normalize()));
|
|
4338
4350
|
r = 1 - F.smoothstep(
|
|
4339
4351
|
c,
|
|
4340
|
-
|
|
4341
|
-
|
|
4352
|
+
ka,
|
|
4353
|
+
La
|
|
4342
4354
|
);
|
|
4343
4355
|
}
|
|
4344
4356
|
return bt * Math.min(o, r);
|
|
@@ -4383,10 +4395,10 @@ class Ra {
|
|
|
4383
4395
|
if (i.isEmpty())
|
|
4384
4396
|
return;
|
|
4385
4397
|
const n = i.getSize(new d()), s = Math.max(n.x, n.z), o = Math.max(
|
|
4386
|
-
|
|
4387
|
-
s *
|
|
4398
|
+
Ra,
|
|
4399
|
+
s * za
|
|
4388
4400
|
);
|
|
4389
|
-
if (s >=
|
|
4401
|
+
if (s >= Ba && n.y <= o) {
|
|
4390
4402
|
e.castShadow = !1, t.__lightModuleReceiverOnlyShadow = !0;
|
|
4391
4403
|
return;
|
|
4392
4404
|
}
|
|
@@ -4402,7 +4414,7 @@ class Ra {
|
|
|
4402
4414
|
i && (i.shadowSide = Oi);
|
|
4403
4415
|
}
|
|
4404
4416
|
}
|
|
4405
|
-
class
|
|
4417
|
+
class Na {
|
|
4406
4418
|
engine;
|
|
4407
4419
|
behavior;
|
|
4408
4420
|
isCtrlDown = !1;
|
|
@@ -4837,7 +4849,7 @@ class Oa {
|
|
|
4837
4849
|
return e?.nodesMap?.get(t) ?? e?.nodesMap?.get(Number(t)) ?? e?.nodesMap?.get(String(t));
|
|
4838
4850
|
}
|
|
4839
4851
|
}
|
|
4840
|
-
class
|
|
4852
|
+
class Ha {
|
|
4841
4853
|
engine;
|
|
4842
4854
|
highlightMaterial;
|
|
4843
4855
|
translucentMaterial;
|
|
@@ -5109,7 +5121,7 @@ class Fa {
|
|
|
5109
5121
|
const u = this.getSceneModel(h[0]);
|
|
5110
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);
|
|
5111
5123
|
});
|
|
5112
|
-
}),
|
|
5124
|
+
}), Va(o, this.engine);
|
|
5113
5125
|
let r = this.engine.engineStatus.highlightModels.find((l) => l.url == t.url);
|
|
5114
5126
|
r != null ? (Array.isArray(r.guids) || (r.guids = this.getModelGuids(i, r.ids)), n.forEach((l, c) => {
|
|
5115
5127
|
const h = r.ids.indexOf(l);
|
|
@@ -5139,7 +5151,7 @@ class Fa {
|
|
|
5139
5151
|
!0
|
|
5140
5152
|
);
|
|
5141
5153
|
});
|
|
5142
|
-
}),
|
|
5154
|
+
}), Sn(n, this.engine, "highlightModel");
|
|
5143
5155
|
}), this.rebatchSplitModels(), this.updateMaterial(), this.syncHighlightModelEdges(this.getHighlightModelsAfterRemove(e)), this.syncExplodeVisualState();
|
|
5144
5156
|
}
|
|
5145
5157
|
// 取消所有模型高亮
|
|
@@ -5163,7 +5175,7 @@ class Fa {
|
|
|
5163
5175
|
const c = this.getSceneModel(l[0]);
|
|
5164
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);
|
|
5165
5177
|
});
|
|
5166
|
-
}), n.size > 0 &&
|
|
5178
|
+
}), n.size > 0 && Wa(n, this.engine);
|
|
5167
5179
|
let s = this.engine.engineStatus.hideModels.find((o) => o.url == t.url);
|
|
5168
5180
|
s != null ? this.appendUniqueIds(s.ids, t.ids) : this.engine.engineStatus.hideModels.push({
|
|
5169
5181
|
url: t.url,
|
|
@@ -5189,7 +5201,7 @@ class Fa {
|
|
|
5189
5201
|
!0
|
|
5190
5202
|
);
|
|
5191
5203
|
});
|
|
5192
|
-
}), s.size > 0 &&
|
|
5204
|
+
}), s.size > 0 && Pn(s, this.engine), t)
|
|
5193
5205
|
return;
|
|
5194
5206
|
let o = this.engine.engineStatus.hideModels.find((r) => r.url == i.url);
|
|
5195
5207
|
o && (i.ids.forEach((r) => {
|
|
@@ -5515,7 +5527,7 @@ class Fa {
|
|
|
5515
5527
|
const u = this.getSceneModel(h[0]);
|
|
5516
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);
|
|
5517
5529
|
});
|
|
5518
|
-
}),
|
|
5530
|
+
}), Ua(o, this.engine, i);
|
|
5519
5531
|
let r = this.engine.engineStatus.translucentModels.find((l) => l.url == n.url);
|
|
5520
5532
|
r != null ? r.ids.push(...n.ids) : this.engine.engineStatus.translucentModels.push({
|
|
5521
5533
|
url: n.url,
|
|
@@ -5541,7 +5553,7 @@ class Fa {
|
|
|
5541
5553
|
!0
|
|
5542
5554
|
);
|
|
5543
5555
|
});
|
|
5544
|
-
}), n.size > 0 &&
|
|
5556
|
+
}), n.size > 0 && Pn(n, this.engine), Sn(n, this.engine, "translucentModel");
|
|
5545
5557
|
}), this.engine.engineStatus.translucentModels = [], this.rebatchSplitModels(), this.syncExplodeVisualState();
|
|
5546
5558
|
}
|
|
5547
5559
|
// ***************************************************** 设置模型半透明 ***************************************************** //
|
|
@@ -5589,7 +5601,7 @@ class Fa {
|
|
|
5589
5601
|
}
|
|
5590
5602
|
// ***************************************************** 设置模型颜色 ***************************************************** //
|
|
5591
5603
|
}
|
|
5592
|
-
function
|
|
5604
|
+
function Va(a, e) {
|
|
5593
5605
|
a.forEach((t, i) => {
|
|
5594
5606
|
const n = Rt(e, i);
|
|
5595
5607
|
if (!(n instanceof V))
|
|
@@ -5622,7 +5634,7 @@ function Na(a, e) {
|
|
|
5622
5634
|
}), n.instanceMatrix.needsUpdate = !0, r.instanceMatrix.needsUpdate = !0, (n.parent ?? e.scene).add(r);
|
|
5623
5635
|
});
|
|
5624
5636
|
}
|
|
5625
|
-
function
|
|
5637
|
+
function Sn(a, e, t) {
|
|
5626
5638
|
a.forEach((i, n) => {
|
|
5627
5639
|
const s = Rt(e, n);
|
|
5628
5640
|
if (!(s instanceof V))
|
|
@@ -5640,11 +5652,11 @@ function En(a, e, t) {
|
|
|
5640
5652
|
e.scene.traverse((r) => {
|
|
5641
5653
|
r.key == n && r.name == t && o.push(r);
|
|
5642
5654
|
}), o.forEach((r) => {
|
|
5643
|
-
|
|
5655
|
+
Ps(r);
|
|
5644
5656
|
});
|
|
5645
5657
|
});
|
|
5646
5658
|
}
|
|
5647
|
-
function
|
|
5659
|
+
function Ua(a, e, t = 0.05) {
|
|
5648
5660
|
a.forEach((i, n) => {
|
|
5649
5661
|
const s = Rt(e, n);
|
|
5650
5662
|
if (!(s instanceof V))
|
|
@@ -5671,12 +5683,12 @@ function Ha(a, e, t = 0.05) {
|
|
|
5671
5683
|
}), s.instanceMatrix.needsUpdate = !0, l.instanceMatrix.needsUpdate = !0, (s.parent ?? e.scene).add(l);
|
|
5672
5684
|
});
|
|
5673
5685
|
}
|
|
5674
|
-
function
|
|
5686
|
+
function Wa(a, e) {
|
|
5675
5687
|
const t = [];
|
|
5676
5688
|
e.scene.traverse((i) => {
|
|
5677
5689
|
i.name == "highlightModel" && t.push(i);
|
|
5678
5690
|
}), t.forEach((i) => {
|
|
5679
|
-
|
|
5691
|
+
Ps(i);
|
|
5680
5692
|
}), a.forEach((i, n) => {
|
|
5681
5693
|
const s = Rt(e, n);
|
|
5682
5694
|
if (!(s instanceof V))
|
|
@@ -5690,7 +5702,7 @@ function Va(a, e) {
|
|
|
5690
5702
|
}), s.instanceMatrix.needsUpdate = !0;
|
|
5691
5703
|
});
|
|
5692
5704
|
}
|
|
5693
|
-
function
|
|
5705
|
+
function Pn(a, e) {
|
|
5694
5706
|
a.forEach((t, i) => {
|
|
5695
5707
|
const n = Rt(e, i);
|
|
5696
5708
|
n instanceof V && (t.forEach((s) => {
|
|
@@ -5711,7 +5723,7 @@ function Bt(a, e, t) {
|
|
|
5711
5723
|
function zt(a, e) {
|
|
5712
5724
|
a?.cloneModel != null && (a.cloneModel.visible = e);
|
|
5713
5725
|
}
|
|
5714
|
-
function
|
|
5726
|
+
function Ps(a) {
|
|
5715
5727
|
if (a == null)
|
|
5716
5728
|
return;
|
|
5717
5729
|
const e = a.parent;
|
|
@@ -5720,8 +5732,8 @@ function As(a) {
|
|
|
5720
5732
|
function Rt(a, e) {
|
|
5721
5733
|
return Le(a, e);
|
|
5722
5734
|
}
|
|
5723
|
-
const
|
|
5724
|
-
class
|
|
5735
|
+
const Ts = "advanced";
|
|
5736
|
+
class Ga {
|
|
5725
5737
|
engine;
|
|
5726
5738
|
currentMode = "";
|
|
5727
5739
|
// 是否为手动设置(手动设置时,自动适配不再生效)
|
|
@@ -5739,7 +5751,7 @@ class Ua {
|
|
|
5739
5751
|
* 初始化模块
|
|
5740
5752
|
*/
|
|
5741
5753
|
init() {
|
|
5742
|
-
this.cachePassReferences(), this.autoSwitch(
|
|
5754
|
+
this.cachePassReferences(), this.autoSwitch(Ts);
|
|
5743
5755
|
}
|
|
5744
5756
|
/**
|
|
5745
5757
|
* 手动切换渲染模式(用户调用),锁定自动适配
|
|
@@ -5945,7 +5957,7 @@ class ni {
|
|
|
5945
5957
|
color: 16777215,
|
|
5946
5958
|
transparent: !0,
|
|
5947
5959
|
opacity: 0,
|
|
5948
|
-
blending:
|
|
5960
|
+
blending: io,
|
|
5949
5961
|
depthWrite: !1
|
|
5950
5962
|
}), this.overlayMaterial.clippingPlanes = this.engine.sectionPlane;
|
|
5951
5963
|
}
|
|
@@ -6010,10 +6022,10 @@ class ni {
|
|
|
6010
6022
|
this.setAnimationFrameRateExempt(!1), this.removeOverlayMeshes(), this.overlayMaterial.dispose(), this.tagDiv?.remove?.(), this.tagDiv = null, this.animState = "idle";
|
|
6011
6023
|
}
|
|
6012
6024
|
}
|
|
6013
|
-
function
|
|
6025
|
+
function qa() {
|
|
6014
6026
|
return new ki();
|
|
6015
6027
|
}
|
|
6016
|
-
function
|
|
6028
|
+
function Ka(a, e) {
|
|
6017
6029
|
a.appendChild(e.domElement);
|
|
6018
6030
|
}
|
|
6019
6031
|
const Je = {
|
|
@@ -6025,7 +6037,7 @@ const Je = {
|
|
|
6025
6037
|
front: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAABp0lEQVR4nO3ZwWnDQBBA0XFwM9uA23FtbkcNqByngxCCzQb/985CzOEzaFeXmXkOWdeZmfM8d8/BBmut+do9BHsJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAoi77h7gne73+xzH8bL33W63eTweL3vff2ADxAkgTgBxAogTQNxHnwJ+8olf9H9hA8QJIE4AcQKIE0CcAOIEECeAOAHEZW8Cj+OYtdavn//Um0MbIE4AcQKIE0CcAOKyp4CZmfM8d4+wnQ0QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiLvMzNNv0aa1lg1QJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxF1m5rl7CPb5Bhi1Gm3j3a/lAAAAAElFTkSuQmCC",
|
|
6026
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"
|
|
6027
6039
|
};
|
|
6028
|
-
function
|
|
6040
|
+
function ja(a, e, t) {
|
|
6029
6041
|
var i = new Object();
|
|
6030
6042
|
i.visible = !0;
|
|
6031
6043
|
let n = null, s = 0, o, r, l = [];
|
|
@@ -6211,8 +6223,8 @@ function qa(a, e, t) {
|
|
|
6211
6223
|
}), He.easing(et.Easing.Cubic.InOut), g(), He.start(), oi();
|
|
6212
6224
|
} else {
|
|
6213
6225
|
var E = w.min.clone().add(w.max.clone()).multiplyScalar(0.5);
|
|
6214
|
-
let
|
|
6215
|
-
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)));
|
|
6216
6228
|
P(e.camera.position, T, a.controls.target.clone(), E, null, null, f);
|
|
6217
6229
|
}
|
|
6218
6230
|
};
|
|
@@ -6325,7 +6337,7 @@ function qa(a, e, t) {
|
|
|
6325
6337
|
}
|
|
6326
6338
|
}
|
|
6327
6339
|
function k() {
|
|
6328
|
-
i.sceneOrtho =
|
|
6340
|
+
i.sceneOrtho = qa();
|
|
6329
6341
|
var E = t.clientWidth, _ = t.clientWidth, w = E > _ ? E / _ : _ / E, f = 300;
|
|
6330
6342
|
i.camera = new Be(
|
|
6331
6343
|
f * w / -2,
|
|
@@ -6340,7 +6352,7 @@ function qa(a, e, t) {
|
|
|
6340
6352
|
});
|
|
6341
6353
|
D.setSize(E, _), D.setClearAlpha(0), i.sceneOrtho.renderer = D;
|
|
6342
6354
|
let T = new $t(16777215, 0.8);
|
|
6343
|
-
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);
|
|
6344
6356
|
}
|
|
6345
6357
|
let O = !1;
|
|
6346
6358
|
function K() {
|
|
@@ -6645,7 +6657,7 @@ function qa(a, e, t) {
|
|
|
6645
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("已退出全屏模式"));
|
|
6646
6658
|
}, i;
|
|
6647
6659
|
}
|
|
6648
|
-
class
|
|
6660
|
+
class Ya {
|
|
6649
6661
|
engine;
|
|
6650
6662
|
cubeTool;
|
|
6651
6663
|
mainViewPort;
|
|
@@ -6653,7 +6665,7 @@ class Ka {
|
|
|
6653
6665
|
this.engine = e;
|
|
6654
6666
|
}
|
|
6655
6667
|
init() {
|
|
6656
|
-
this.cubeTool =
|
|
6668
|
+
this.cubeTool = ja(this.engine, this.engine.scene, this.engine.container), this.cubeTool.init();
|
|
6657
6669
|
}
|
|
6658
6670
|
// 隐藏视图立方体,供 showViewCube=false 的初始化配置调用。
|
|
6659
6671
|
hide() {
|
|
@@ -6773,7 +6785,7 @@ class Ka {
|
|
|
6773
6785
|
this.cubeTool.TakeScreenshot();
|
|
6774
6786
|
}
|
|
6775
6787
|
}
|
|
6776
|
-
function
|
|
6788
|
+
function Xa(a) {
|
|
6777
6789
|
let e = new Object(), t = null;
|
|
6778
6790
|
return e.getBoundingBox = function() {
|
|
6779
6791
|
let i = a.models, n = new d(1e8, 1e9, 1e10), s = new d(-1e8, -1e9, -1e10);
|
|
@@ -6831,12 +6843,12 @@ function ja(a) {
|
|
|
6831
6843
|
});
|
|
6832
6844
|
});
|
|
6833
6845
|
const m = l.map((f) => O(f)).filter((f) => f instanceof z);
|
|
6834
|
-
|
|
6846
|
+
pr(i);
|
|
6835
6847
|
const b = [
|
|
6836
6848
|
...x,
|
|
6837
6849
|
...i.intersectObjects(m, !1).map(he)
|
|
6838
6850
|
].sort((f, E) => f.distance - E.distance);
|
|
6839
|
-
return
|
|
6851
|
+
return mr(i), b;
|
|
6840
6852
|
function C(f, E, _, D, T) {
|
|
6841
6853
|
if (E == null)
|
|
6842
6854
|
return;
|
|
@@ -6999,7 +7011,7 @@ function ja(a) {
|
|
|
6999
7011
|
}
|
|
7000
7012
|
}, e;
|
|
7001
7013
|
}
|
|
7002
|
-
class
|
|
7014
|
+
class Qa {
|
|
7003
7015
|
engine;
|
|
7004
7016
|
// 绘制状态
|
|
7005
7017
|
isDrawing = !1;
|
|
@@ -7177,8 +7189,8 @@ class Ya {
|
|
|
7177
7189
|
this.disActive(), this.selectionBox?.remove(), this.selectionBox = null, this.worldToScreen = null, this.isDrawing = !1;
|
|
7178
7190
|
}
|
|
7179
7191
|
}
|
|
7180
|
-
const
|
|
7181
|
-
class
|
|
7192
|
+
const $a = F.degToRad(10), Tn = 1e-3, Pi = !1, Za = [];
|
|
7193
|
+
class Ja {
|
|
7182
7194
|
engine;
|
|
7183
7195
|
rootGroup = null;
|
|
7184
7196
|
isVisible = Pi;
|
|
@@ -7192,7 +7204,7 @@ class $a {
|
|
|
7192
7204
|
}
|
|
7193
7205
|
setMockData() {
|
|
7194
7206
|
const e = this.engine.models?.[0]?.grids;
|
|
7195
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
7207
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : Za);
|
|
7196
7208
|
}
|
|
7197
7209
|
show() {
|
|
7198
7210
|
this.isVisible = !0, this.rootGroup && (this.rootGroup.visible = !0);
|
|
@@ -7281,7 +7293,7 @@ class $a {
|
|
|
7281
7293
|
throw new Error("Grid sprite canvas context is not available");
|
|
7282
7294
|
const o = 128 / 2, r = 128 / 2, l = 128 / 2 - 4;
|
|
7283
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);
|
|
7284
|
-
const c = new
|
|
7296
|
+
const c = new no(n), h = new so({
|
|
7285
7297
|
map: c,
|
|
7286
7298
|
depthTest: !1,
|
|
7287
7299
|
transparent: !0
|
|
@@ -7331,7 +7343,7 @@ class $a {
|
|
|
7331
7343
|
const n = this.createProjection(i);
|
|
7332
7344
|
if (!n)
|
|
7333
7345
|
return;
|
|
7334
|
-
const s = t.find((o) => o.direction.angleTo(n.direction) <=
|
|
7346
|
+
const s = t.find((o) => o.direction.angleTo(n.direction) <= $a);
|
|
7335
7347
|
if (s) {
|
|
7336
7348
|
s.axes.push(n);
|
|
7337
7349
|
return;
|
|
@@ -7361,13 +7373,13 @@ class $a {
|
|
|
7361
7373
|
}
|
|
7362
7374
|
normalizeDirection(e) {
|
|
7363
7375
|
const t = e.clone().normalize();
|
|
7364
|
-
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;
|
|
7365
7377
|
}
|
|
7366
7378
|
/**
|
|
7367
7379
|
* 在单个轴族内优先返回点位所属的最近轴网区间,避免落在线上时出现空描述。
|
|
7368
7380
|
*/
|
|
7369
7381
|
resolveFamilyLocation(e, t) {
|
|
7370
|
-
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;
|
|
7371
7383
|
if (n) {
|
|
7372
7384
|
const c = e.axes.findIndex((u) => u.data.Id === n.data.Id), h = this.pickAxisPairAroundIndex(e.axes, c);
|
|
7373
7385
|
return {
|
|
@@ -7466,15 +7478,15 @@ class $a {
|
|
|
7466
7478
|
return e instanceof d ? e.clone() : new d(e.x, e.y, e.z);
|
|
7467
7479
|
}
|
|
7468
7480
|
}
|
|
7469
|
-
const
|
|
7481
|
+
const Is = "0", _s = 0, Ds = !1;
|
|
7470
7482
|
class qi {
|
|
7471
7483
|
engine;
|
|
7472
|
-
currentId =
|
|
7484
|
+
currentId = Is;
|
|
7473
7485
|
groundGroup;
|
|
7474
7486
|
groundMesh = null;
|
|
7475
7487
|
/** 当前为官方 Water 水面时为 true,用于 update/dispose 分支 */
|
|
7476
7488
|
isWaterAddon = !1;
|
|
7477
|
-
groundY =
|
|
7489
|
+
groundY = _s;
|
|
7478
7490
|
/** 默认水面法线贴图路径(项目内为 public/textture/waternormals.jpg) */
|
|
7479
7491
|
static DEFAULT_WATER_NORMALS = "/texture/waternormals.jpg";
|
|
7480
7492
|
groundList = [
|
|
@@ -7499,7 +7511,7 @@ class qi {
|
|
|
7499
7511
|
this.engine = e, this.groundGroup = new pe(), this.groundGroup.name = "groundGroup";
|
|
7500
7512
|
}
|
|
7501
7513
|
init() {
|
|
7502
|
-
this.engine.scene.add(this.groundGroup), this.groundGroup.visible =
|
|
7514
|
+
this.engine.scene.add(this.groundGroup), this.groundGroup.visible = Ds;
|
|
7503
7515
|
}
|
|
7504
7516
|
/**
|
|
7505
7517
|
* 切换地面类型
|
|
@@ -7514,7 +7526,7 @@ class qi {
|
|
|
7514
7526
|
if (i.water) {
|
|
7515
7527
|
const s = new bi(n, n), o = t?.waterNormalsUrl ?? ee(qi.DEFAULT_WATER_NORMALS, import.meta.url), r = new nt().load(o, (g) => {
|
|
7516
7528
|
g.wrapS = g.wrapT = pt;
|
|
7517
|
-
}), 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, {
|
|
7518
7530
|
textureWidth: 512,
|
|
7519
7531
|
textureHeight: 512,
|
|
7520
7532
|
waterNormals: r,
|
|
@@ -7606,12 +7618,12 @@ class qi {
|
|
|
7606
7618
|
Array.isArray(e) ? e.forEach((t) => t.dispose()) : e.dispose(), this.groundGroup.remove(this.groundMesh), this.groundMesh = null, this.isWaterAddon = !1;
|
|
7607
7619
|
}
|
|
7608
7620
|
}
|
|
7609
|
-
const Ue = "0",
|
|
7610
|
-
class
|
|
7621
|
+
const Ue = "0", el = !0, ks = 0.2, tl = 0.35;
|
|
7622
|
+
class il {
|
|
7611
7623
|
engine;
|
|
7612
7624
|
currentHdrId = Ue;
|
|
7613
|
-
isVisible =
|
|
7614
|
-
currentIntensity =
|
|
7625
|
+
isVisible = el;
|
|
7626
|
+
currentIntensity = ks;
|
|
7615
7627
|
currentTexture = null;
|
|
7616
7628
|
currentEnvironmentTexture = null;
|
|
7617
7629
|
skybox = null;
|
|
@@ -7696,10 +7708,10 @@ class el {
|
|
|
7696
7708
|
_loadHdr(e) {
|
|
7697
7709
|
const t = ee(e, import.meta.url);
|
|
7698
7710
|
return new Promise((i, n) => {
|
|
7699
|
-
new
|
|
7711
|
+
new ro().load(
|
|
7700
7712
|
t,
|
|
7701
7713
|
(s) => {
|
|
7702
|
-
s.mapping =
|
|
7714
|
+
s.mapping = ao, i(s);
|
|
7703
7715
|
},
|
|
7704
7716
|
void 0,
|
|
7705
7717
|
(s) => n(s)
|
|
@@ -7709,7 +7721,7 @@ class el {
|
|
|
7709
7721
|
_applyTexture(e) {
|
|
7710
7722
|
if (this.currentTexture = e, !this.engine.scene || !this.engine.renderer) return;
|
|
7711
7723
|
this._captureSceneState(), this.currentEnvironmentTexture?.dispose();
|
|
7712
|
-
const t = new
|
|
7724
|
+
const t = new Jn(this.engine.renderer), i = t.fromEquirectangular(e).texture;
|
|
7713
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());
|
|
7714
7726
|
}
|
|
7715
7727
|
_captureSceneState() {
|
|
@@ -7751,20 +7763,20 @@ class el {
|
|
|
7751
7763
|
t && (t.intensity = e);
|
|
7752
7764
|
}
|
|
7753
7765
|
_getHdrAmbientLightIntensity() {
|
|
7754
|
-
return Math.max(this.previousAmbientLightIntensity *
|
|
7766
|
+
return Math.max(this.previousAmbientLightIntensity * tl, 0);
|
|
7755
7767
|
}
|
|
7756
7768
|
_requestRender() {
|
|
7757
7769
|
this.engine?.requestComposerRender?.();
|
|
7758
7770
|
}
|
|
7759
7771
|
}
|
|
7760
|
-
const
|
|
7772
|
+
const nl = 1e-3, Ls = !1, sl = [
|
|
7761
7773
|
{ Id: "339", Name: "L1", Elevation: -0.32808398950131235 },
|
|
7762
7774
|
{ Id: "2787", Name: "L2", Elevation: 16.896325459317584 },
|
|
7763
7775
|
{ Id: "236633", Name: "L3", Elevation: 36.745406824146976 }
|
|
7764
7776
|
];
|
|
7765
|
-
class
|
|
7777
|
+
class ol {
|
|
7766
7778
|
engine;
|
|
7767
|
-
isVisible =
|
|
7779
|
+
isVisible = Ls;
|
|
7768
7780
|
levels = [];
|
|
7769
7781
|
svgContainer = null;
|
|
7770
7782
|
svgOverlay = null;
|
|
@@ -7782,7 +7794,7 @@ class nl {
|
|
|
7782
7794
|
}
|
|
7783
7795
|
setMockData() {
|
|
7784
7796
|
const e = this.engine.models?.[0]?.levels, t = this.engine.models?.[0]?.boundingBox;
|
|
7785
|
-
this.setData(Array.isArray(e) && e.length > 0 ? e :
|
|
7797
|
+
this.setData(Array.isArray(e) && e.length > 0 ? e : sl, t);
|
|
7786
7798
|
}
|
|
7787
7799
|
show() {
|
|
7788
7800
|
this.isVisible = !0, this.svgContainer && (this.svgContainer.style.display = "block"), this.levels.forEach((e) => {
|
|
@@ -7815,7 +7827,7 @@ class nl {
|
|
|
7815
7827
|
const { url: i, targetPoint: n } = this.resolvePointLookupArgs(e, t), s = this.getLevelData(i).slice().sort((g, y) => g.Elevation - y.Elevation);
|
|
7816
7828
|
if (s.length === 0)
|
|
7817
7829
|
return null;
|
|
7818
|
-
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;
|
|
7819
7831
|
if (r)
|
|
7820
7832
|
return {
|
|
7821
7833
|
pointY: o,
|
|
@@ -7989,33 +8001,33 @@ class nl {
|
|
|
7989
8001
|
};
|
|
7990
8002
|
}
|
|
7991
8003
|
}
|
|
7992
|
-
const jt = !0, Ti = 0.5,
|
|
7993
|
-
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) {
|
|
7994
8006
|
return !a?.min || !a?.max ? 0 : a.min.distanceTo(a.max);
|
|
7995
8007
|
}
|
|
7996
|
-
function
|
|
8008
|
+
function ul(a, e) {
|
|
7997
8009
|
return a instanceof d ? a.clone() : e?.min && e?.max ? e.min.clone().add(e.max).multiplyScalar(0.5) : new d();
|
|
7998
8010
|
}
|
|
7999
|
-
function
|
|
8011
|
+
function pl(a, e, t) {
|
|
8000
8012
|
if (a instanceof Be)
|
|
8001
8013
|
return Math.max((a.top - a.bottom) / Math.max(a.zoom, 1e-6), 1);
|
|
8002
|
-
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);
|
|
8003
8015
|
return Math.max(2 * s * Math.tan(r), 1);
|
|
8004
8016
|
}
|
|
8005
|
-
function
|
|
8017
|
+
function ml(a, e, t, i) {
|
|
8006
8018
|
if (a == null)
|
|
8007
8019
|
return i;
|
|
8008
|
-
const n =
|
|
8020
|
+
const n = dl(t);
|
|
8009
8021
|
if (n <= 0)
|
|
8010
8022
|
return i;
|
|
8011
|
-
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(
|
|
8012
8024
|
(s - o) / (r - o),
|
|
8013
8025
|
0,
|
|
8014
8026
|
1
|
|
8015
|
-
), c = Math.max(i *
|
|
8027
|
+
), c = Math.max(i * al, Bs);
|
|
8016
8028
|
return F.lerp(i, c, l);
|
|
8017
8029
|
}
|
|
8018
|
-
class
|
|
8030
|
+
class gl {
|
|
8019
8031
|
engine;
|
|
8020
8032
|
isActive = jt;
|
|
8021
8033
|
groupEdge;
|
|
@@ -8104,13 +8116,13 @@ class pl {
|
|
|
8104
8116
|
// 启动
|
|
8105
8117
|
active() {
|
|
8106
8118
|
this.isActive = !0, this.groupEdge.visible = !this.explodeHidden, this.engine.scene.traverse((e) => {
|
|
8107
|
-
e.isMesh && e.material &&
|
|
8119
|
+
e.isMesh && e.material && hn(e, !0);
|
|
8108
8120
|
}), this.update(), this.show();
|
|
8109
8121
|
}
|
|
8110
8122
|
// 关闭
|
|
8111
8123
|
disActive() {
|
|
8112
8124
|
this.isActive = !1, this.groupEdge.visible = !1, this.engine.scene.traverse((e) => {
|
|
8113
|
-
e.isMesh && e.material &&
|
|
8125
|
+
e.isMesh && e.material && hn(e, !1);
|
|
8114
8126
|
});
|
|
8115
8127
|
}
|
|
8116
8128
|
isEnabled() {
|
|
@@ -8126,13 +8138,13 @@ class pl {
|
|
|
8126
8138
|
update() {
|
|
8127
8139
|
if (!this.isActive || !this.material)
|
|
8128
8140
|
return;
|
|
8129
|
-
const e =
|
|
8141
|
+
const e = ml(
|
|
8130
8142
|
this.engine?.camera,
|
|
8131
8143
|
this.engine?.controls?.target,
|
|
8132
8144
|
this.engine?.octreeBox?.getBoundingBox?.(),
|
|
8133
8145
|
this.baseOpacity
|
|
8134
8146
|
);
|
|
8135
|
-
Math.abs(this.material.opacity - e) <=
|
|
8147
|
+
Math.abs(this.material.opacity - e) <= hl || (this.material.opacity = e, this.material.needsUpdate = !0);
|
|
8136
8148
|
}
|
|
8137
8149
|
hasPendingModelEdges() {
|
|
8138
8150
|
return (this.engine?.models ?? []).some((t) => this.shouldLoadModelEdge(t) && !Array.isArray(t?.modelEdge));
|
|
@@ -8265,7 +8277,7 @@ class pl {
|
|
|
8265
8277
|
if (i.ids.forEach((l) => {
|
|
8266
8278
|
const c = n?.get(Number(l)), h = typeof c == "number" ? this.getEdgePointsByIndex(i.url, c) : null;
|
|
8267
8279
|
if (Array.isArray(h)) {
|
|
8268
|
-
if (h.length >
|
|
8280
|
+
if (h.length > rl)
|
|
8269
8281
|
return;
|
|
8270
8282
|
this.appendEdgePositions(s, h);
|
|
8271
8283
|
}
|
|
@@ -8324,7 +8336,7 @@ class pl {
|
|
|
8324
8336
|
}
|
|
8325
8337
|
// 设置边线材质透明度
|
|
8326
8338
|
setOpacity(e) {
|
|
8327
|
-
this.baseOpacity = F.clamp(e,
|
|
8339
|
+
this.baseOpacity = F.clamp(e, Bs, 1), this.update();
|
|
8328
8340
|
}
|
|
8329
8341
|
// 显示边线
|
|
8330
8342
|
showModelEdge(e, t) {
|
|
@@ -8355,7 +8367,7 @@ class pl {
|
|
|
8355
8367
|
this.releaseIndexes(e);
|
|
8356
8368
|
}
|
|
8357
8369
|
}
|
|
8358
|
-
const
|
|
8370
|
+
const In = {
|
|
8359
8371
|
turbidity: 10,
|
|
8360
8372
|
rayleigh: 3,
|
|
8361
8373
|
mieCoefficient: 5e-3,
|
|
@@ -8368,7 +8380,7 @@ const Pn = {
|
|
|
8368
8380
|
cloudDensity: 0.4,
|
|
8369
8381
|
cloudElevation: 0.5,
|
|
8370
8382
|
showSunDisc: !0
|
|
8371
|
-
}, Ii = "sunrise_clear",
|
|
8383
|
+
}, Ii = "sunrise_clear", zs = 0.2, _i = [
|
|
8372
8384
|
{
|
|
8373
8385
|
id: "sunrise_clear",
|
|
8374
8386
|
names: ["晴朗日出", "晴朗日出", "Clear Sunrise"],
|
|
@@ -8539,17 +8551,17 @@ const Pn = {
|
|
|
8539
8551
|
showSunDisc: !1
|
|
8540
8552
|
}
|
|
8541
8553
|
}
|
|
8542
|
-
],
|
|
8554
|
+
], _n = _i.reduce(
|
|
8543
8555
|
(a, e) => (a[e.id] = e, a),
|
|
8544
8556
|
{}
|
|
8545
|
-
),
|
|
8546
|
-
class
|
|
8557
|
+
), Dn = 2e6;
|
|
8558
|
+
class fl {
|
|
8547
8559
|
engine;
|
|
8548
8560
|
sky = null;
|
|
8549
8561
|
sun = new d();
|
|
8550
|
-
params = { ...
|
|
8562
|
+
params = { ...In, ..._n[Ii].params };
|
|
8551
8563
|
currentPreset = Ii;
|
|
8552
|
-
currentIntensity =
|
|
8564
|
+
currentIntensity = zs;
|
|
8553
8565
|
currentEnvironmentTarget = null;
|
|
8554
8566
|
skyScale = 45e4;
|
|
8555
8567
|
skyName = "bim_engine_sky";
|
|
@@ -8570,7 +8582,7 @@ class ml {
|
|
|
8570
8582
|
this.sky.visible = !0, this._captureSceneState(), this._expandCameraFarForSky(), this._applyParamsToSky();
|
|
8571
8583
|
return;
|
|
8572
8584
|
}
|
|
8573
|
-
const e = new
|
|
8585
|
+
const e = new lo();
|
|
8574
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();
|
|
8575
8587
|
}
|
|
8576
8588
|
close(e = !0) {
|
|
@@ -8586,8 +8598,8 @@ class ml {
|
|
|
8586
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());
|
|
8587
8599
|
}
|
|
8588
8600
|
setPreset(e) {
|
|
8589
|
-
const t =
|
|
8590
|
-
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()));
|
|
8591
8603
|
}
|
|
8592
8604
|
getCurrentPreset() {
|
|
8593
8605
|
return this.currentPreset;
|
|
@@ -8631,7 +8643,7 @@ class ml {
|
|
|
8631
8643
|
const e = this.engine?.camera;
|
|
8632
8644
|
if (!e || typeof e.far != "number") return;
|
|
8633
8645
|
const t = e.far;
|
|
8634
|
-
t >=
|
|
8646
|
+
t >= Dn || (this.savedCameraFar == null && (this.savedCameraFar = t), e.far = Dn, typeof e.updateProjectionMatrix == "function" && e.updateProjectionMatrix());
|
|
8635
8647
|
}
|
|
8636
8648
|
_restoreCameraFar() {
|
|
8637
8649
|
if (this.savedCameraFar == null || !this.engine?.camera) return;
|
|
@@ -8656,7 +8668,7 @@ class ml {
|
|
|
8656
8668
|
this._disposeEnvironmentTarget();
|
|
8657
8669
|
const e = new ki(), t = this.sky.clone();
|
|
8658
8670
|
t.material = this.sky.material.clone(), e.add(t);
|
|
8659
|
-
const i = new
|
|
8671
|
+
const i = new Jn(this.engine.renderer);
|
|
8660
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();
|
|
8661
8673
|
}
|
|
8662
8674
|
_disposeEnvironmentTarget() {
|
|
@@ -8667,7 +8679,7 @@ class ml {
|
|
|
8667
8679
|
n && (i instanceof d && typeof n.value?.copy == "function" ? n.value.copy(i) : n.value = i);
|
|
8668
8680
|
}
|
|
8669
8681
|
}
|
|
8670
|
-
class
|
|
8682
|
+
class yl {
|
|
8671
8683
|
/** 寮曟搸瀹炰緥寮曠敤 */
|
|
8672
8684
|
engine;
|
|
8673
8685
|
defaultSettings;
|
|
@@ -8799,28 +8811,28 @@ class gl {
|
|
|
8799
8811
|
return {
|
|
8800
8812
|
render: {
|
|
8801
8813
|
mode: this._toRenderMode(this.engine.engineModelModule?.getCurrentMode?.()),
|
|
8802
|
-
contrast: this._uniformToPercent(t,
|
|
8803
|
-
saturation: this._uniformToPercent(e,
|
|
8814
|
+
contrast: this._uniformToPercent(t, cs),
|
|
8815
|
+
saturation: this._uniformToPercent(e, ls),
|
|
8804
8816
|
shadowIntensity: this._shadowToPercent(this._getDirectionalLightShadowIntensity(), bt),
|
|
8805
8817
|
lightIntensity: this._exposureToPercent(n, Fi),
|
|
8806
|
-
gtaoIntensity: this._unitToPercent(i,
|
|
8818
|
+
gtaoIntensity: this._unitToPercent(i, as)
|
|
8807
8819
|
},
|
|
8808
8820
|
display: {
|
|
8809
8821
|
showEdge: this.engine.modelEdge?.isEnabled?.() ?? jt,
|
|
8810
8822
|
edgeOpacity: this._unitToPercent(s, Ti),
|
|
8811
8823
|
showGrid: this.engine.grid?.getVisible?.() ?? Pi,
|
|
8812
|
-
showLevel: this.engine.level?.getVisible?.() ??
|
|
8813
|
-
showGround: this.engine.ground?.getVisible?.() ??
|
|
8814
|
-
groundId: this.engine.ground?.getCurrentId?.() ??
|
|
8815
|
-
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
|
|
8816
8828
|
},
|
|
8817
8829
|
environment: {
|
|
8818
8830
|
type: h ? "sky" : o !== Ue ? "hdr" : "none",
|
|
8819
8831
|
hdrId: o,
|
|
8820
|
-
hdrIntensity: this._unitToPercent(r,
|
|
8832
|
+
hdrIntensity: this._unitToPercent(r, ks),
|
|
8821
8833
|
skyPreset: c,
|
|
8822
8834
|
skyParams: {},
|
|
8823
|
-
skyIntensity: this._unitToPercent(l,
|
|
8835
|
+
skyIntensity: this._unitToPercent(l, zs)
|
|
8824
8836
|
}
|
|
8825
8837
|
};
|
|
8826
8838
|
}
|
|
@@ -8855,7 +8867,7 @@ class gl {
|
|
|
8855
8867
|
};
|
|
8856
8868
|
}
|
|
8857
8869
|
_toRenderMode(e) {
|
|
8858
|
-
return e === "simple" || e === "balance" || e === "advanced" ? e :
|
|
8870
|
+
return e === "simple" || e === "balance" || e === "advanced" ? e : Ts;
|
|
8859
8871
|
}
|
|
8860
8872
|
_uniformToPercent(e, t) {
|
|
8861
8873
|
const i = typeof e == "number" ? e : t;
|
|
@@ -9204,7 +9216,7 @@ class qe {
|
|
|
9204
9216
|
}
|
|
9205
9217
|
}
|
|
9206
9218
|
}
|
|
9207
|
-
class
|
|
9219
|
+
class Ml {
|
|
9208
9220
|
engine;
|
|
9209
9221
|
isActive = !1;
|
|
9210
9222
|
tools;
|
|
@@ -9308,7 +9320,7 @@ class fl {
|
|
|
9308
9320
|
}
|
|
9309
9321
|
}
|
|
9310
9322
|
}
|
|
9311
|
-
class
|
|
9323
|
+
class vl {
|
|
9312
9324
|
engine;
|
|
9313
9325
|
tools;
|
|
9314
9326
|
isActive = !1;
|
|
@@ -9364,7 +9376,7 @@ class yl {
|
|
|
9364
9376
|
}
|
|
9365
9377
|
// 按下esc
|
|
9366
9378
|
}
|
|
9367
|
-
class
|
|
9379
|
+
class xl {
|
|
9368
9380
|
engine;
|
|
9369
9381
|
isActive = !1;
|
|
9370
9382
|
tools;
|
|
@@ -9419,7 +9431,7 @@ class Ml {
|
|
|
9419
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);
|
|
9420
9432
|
}
|
|
9421
9433
|
}
|
|
9422
|
-
class
|
|
9434
|
+
class wl {
|
|
9423
9435
|
engine;
|
|
9424
9436
|
isActive = !1;
|
|
9425
9437
|
tools;
|
|
@@ -9464,7 +9476,7 @@ class vl {
|
|
|
9464
9476
|
t.point = e.catch.point.clone(), t.text = e.catch.point.y, t.isSelect = !1, this.engine.events.trigger(se.MeasureChanged, t);
|
|
9465
9477
|
}
|
|
9466
9478
|
}
|
|
9467
|
-
class
|
|
9479
|
+
class bl {
|
|
9468
9480
|
engine;
|
|
9469
9481
|
isActive = !1;
|
|
9470
9482
|
tools;
|
|
@@ -9516,7 +9528,7 @@ class xl {
|
|
|
9516
9528
|
e != null && (e.isSelect = !1, this.engine.events.trigger(se.MeasureChanged, e));
|
|
9517
9529
|
}
|
|
9518
9530
|
}
|
|
9519
|
-
class
|
|
9531
|
+
class Cl {
|
|
9520
9532
|
engine;
|
|
9521
9533
|
tools;
|
|
9522
9534
|
// 存储三个点:起点、顶点(中间点)、终点
|
|
@@ -9584,7 +9596,7 @@ class wl {
|
|
|
9584
9596
|
}
|
|
9585
9597
|
}
|
|
9586
9598
|
}
|
|
9587
|
-
class
|
|
9599
|
+
class El {
|
|
9588
9600
|
engine;
|
|
9589
9601
|
tools;
|
|
9590
9602
|
points = [];
|
|
@@ -9811,7 +9823,7 @@ class Ct {
|
|
|
9811
9823
|
}
|
|
9812
9824
|
}
|
|
9813
9825
|
}
|
|
9814
|
-
class
|
|
9826
|
+
class Al {
|
|
9815
9827
|
engine;
|
|
9816
9828
|
isActive = !1;
|
|
9817
9829
|
points = [];
|
|
@@ -9892,7 +9904,7 @@ class Cl {
|
|
|
9892
9904
|
};
|
|
9893
9905
|
}
|
|
9894
9906
|
}
|
|
9895
|
-
class
|
|
9907
|
+
class Sl {
|
|
9896
9908
|
isActive = !1;
|
|
9897
9909
|
engine;
|
|
9898
9910
|
clearHeightMeasure;
|
|
@@ -9918,7 +9930,7 @@ class El {
|
|
|
9918
9930
|
volumeAnnotation: []
|
|
9919
9931
|
};
|
|
9920
9932
|
constructor(e) {
|
|
9921
|
-
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);
|
|
9922
9934
|
}
|
|
9923
9935
|
setContextMenuDisabled(e) {
|
|
9924
9936
|
this.engine?.engineStatus != null && (this.engine.engineStatus.isDisableContextMenu = e);
|
|
@@ -9966,7 +9978,7 @@ class El {
|
|
|
9966
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;
|
|
9967
9979
|
}
|
|
9968
9980
|
}
|
|
9969
|
-
class
|
|
9981
|
+
class Pl {
|
|
9970
9982
|
engine;
|
|
9971
9983
|
isActive = !1;
|
|
9972
9984
|
isCtrlDown = !1;
|
|
@@ -10485,7 +10497,7 @@ class Al {
|
|
|
10485
10497
|
x && x.setFromNormalAndCoplanarPoint(i.clone().setLength(-1), o);
|
|
10486
10498
|
}
|
|
10487
10499
|
}
|
|
10488
|
-
class
|
|
10500
|
+
class Tl {
|
|
10489
10501
|
engine;
|
|
10490
10502
|
isActive = !1;
|
|
10491
10503
|
isDrag = !1;
|
|
@@ -11040,7 +11052,7 @@ class Sl {
|
|
|
11040
11052
|
}
|
|
11041
11053
|
}
|
|
11042
11054
|
}
|
|
11043
|
-
class
|
|
11055
|
+
class Il {
|
|
11044
11056
|
engine;
|
|
11045
11057
|
callback_;
|
|
11046
11058
|
isActive;
|
|
@@ -11071,7 +11083,7 @@ class Pl {
|
|
|
11071
11083
|
});
|
|
11072
11084
|
}
|
|
11073
11085
|
}
|
|
11074
|
-
class
|
|
11086
|
+
class _l {
|
|
11075
11087
|
/** 引擎实例(包含 scene / models / engineStatus / octreeBox 等) */
|
|
11076
11088
|
engine;
|
|
11077
11089
|
/** three-bvh-csg 计算器,负责执行布尔操作 */
|
|
@@ -11093,7 +11105,7 @@ class Tl {
|
|
|
11093
11105
|
fillTextureRepeat = 60;
|
|
11094
11106
|
fillTextureRotation = 0;
|
|
11095
11107
|
constructor(e) {
|
|
11096
|
-
this.engine = e, this.evaluator = new
|
|
11108
|
+
this.engine = e, this.evaluator = new co();
|
|
11097
11109
|
const t = ee("/texture/fill.png", import.meta.url), i = new nt().load(t);
|
|
11098
11110
|
i.wrapS = pt, i.wrapT = pt, i.center.set(0.5, 0.5), i.rotation = this.fillTextureRotation, this.fillMaterial = new Ri({
|
|
11099
11111
|
color: 14079687,
|
|
@@ -11159,7 +11171,7 @@ class Tl {
|
|
|
11159
11171
|
const x = this.createWorldBrushFromMesh(M);
|
|
11160
11172
|
if (x != null)
|
|
11161
11173
|
try {
|
|
11162
|
-
const b = this.evaluator.evaluate(x, c,
|
|
11174
|
+
const b = this.evaluator.evaluate(x, c, ho)?.geometry;
|
|
11163
11175
|
if (!b)
|
|
11164
11176
|
continue;
|
|
11165
11177
|
const C = this.extractPlaneCapGeometry(b, e, l);
|
|
@@ -11387,7 +11399,7 @@ class Tl {
|
|
|
11387
11399
|
return { tangent: l, bitangent: c };
|
|
11388
11400
|
}
|
|
11389
11401
|
}
|
|
11390
|
-
class
|
|
11402
|
+
class Dl {
|
|
11391
11403
|
engine;
|
|
11392
11404
|
clippingTolerance = 1e-4;
|
|
11393
11405
|
sectionBox;
|
|
@@ -11399,7 +11411,7 @@ class Il {
|
|
|
11399
11411
|
fillCutFace = !0;
|
|
11400
11412
|
viewRangePlanes = null;
|
|
11401
11413
|
constructor(e) {
|
|
11402
|
-
this.engine = e, this.sectionCatchFace = new
|
|
11414
|
+
this.engine = e, this.sectionCatchFace = new Il(this.engine);
|
|
11403
11415
|
let t = new Z(new d(0, 0, 1), 1e5);
|
|
11404
11416
|
t.name = "前";
|
|
11405
11417
|
let i = new Z(new d(0, 0, 1), 1e5);
|
|
@@ -11416,7 +11428,7 @@ class Il {
|
|
|
11416
11428
|
l.name = "face", this.engine.sectionPlane = [t, i, n, s, o, r, l];
|
|
11417
11429
|
}
|
|
11418
11430
|
init() {
|
|
11419
|
-
this.sectionBox = new
|
|
11431
|
+
this.sectionBox = new Pl(this.engine), this.sectionFace = new Tl(this.engine), this.clippingCSGSimple = new _l(this.engine);
|
|
11420
11432
|
}
|
|
11421
11433
|
// 自动缩放适用的视图比例
|
|
11422
11434
|
scaleBox() {
|
|
@@ -11623,7 +11635,7 @@ class Il {
|
|
|
11623
11635
|
});
|
|
11624
11636
|
}
|
|
11625
11637
|
}
|
|
11626
|
-
class
|
|
11638
|
+
class kl {
|
|
11627
11639
|
engine;
|
|
11628
11640
|
constructor(e) {
|
|
11629
11641
|
this.engine = e;
|
|
@@ -11662,7 +11674,7 @@ class _l {
|
|
|
11662
11674
|
}), e;
|
|
11663
11675
|
}
|
|
11664
11676
|
}
|
|
11665
|
-
class
|
|
11677
|
+
class Ll {
|
|
11666
11678
|
engine;
|
|
11667
11679
|
constructor(e) {
|
|
11668
11680
|
this.engine = e;
|
|
@@ -11700,7 +11712,7 @@ class Dl {
|
|
|
11700
11712
|
});
|
|
11701
11713
|
}
|
|
11702
11714
|
}
|
|
11703
|
-
class
|
|
11715
|
+
class Bl {
|
|
11704
11716
|
engine;
|
|
11705
11717
|
// 扩展属性
|
|
11706
11718
|
extended = /* @__PURE__ */ new Map();
|
|
@@ -11826,8 +11838,8 @@ class kl {
|
|
|
11826
11838
|
}
|
|
11827
11839
|
}
|
|
11828
11840
|
}
|
|
11829
|
-
const
|
|
11830
|
-
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 {
|
|
11831
11843
|
manager;
|
|
11832
11844
|
wrapper;
|
|
11833
11845
|
input;
|
|
@@ -11843,7 +11855,7 @@ class Bl {
|
|
|
11843
11855
|
this.manager = t, this.wrapper = document.createElement("div"), this.wrapper.className = "engine-3d-search", this.wrapper.innerHTML = `
|
|
11844
11856
|
<section class="engine-3d-search__box" role="dialog" aria-label="模型检索">
|
|
11845
11857
|
<div class="engine-3d-search__input-row">
|
|
11846
|
-
<span class="engine-3d-search__icon">${
|
|
11858
|
+
<span class="engine-3d-search__icon">${zl}</span>
|
|
11847
11859
|
<input class="engine-3d-search__input" type="search" placeholder="检索模型名称、构件 ID、房间" autocomplete="off" spellcheck="false" />
|
|
11848
11860
|
<button class="engine-3d-search__clear" type="button" aria-label="关闭检索框">×</button>
|
|
11849
11861
|
</div>
|
|
@@ -11946,13 +11958,13 @@ class Bl {
|
|
|
11946
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();
|
|
11947
11959
|
}
|
|
11948
11960
|
}
|
|
11949
|
-
class
|
|
11961
|
+
class Ol {
|
|
11950
11962
|
engine;
|
|
11951
11963
|
searchUI = null;
|
|
11952
11964
|
constructor(e) {
|
|
11953
11965
|
this.engine = e;
|
|
11954
11966
|
const t = e?.container;
|
|
11955
|
-
t && (this.searchUI = new
|
|
11967
|
+
t && (this.searchUI = new Rl(t, this), this.setTheme(e?.options?.searchTheme === "light" ? "light" : "dark"));
|
|
11956
11968
|
}
|
|
11957
11969
|
/** 按名称、ID、房间名称/编号检索已加载模型。 */
|
|
11958
11970
|
search(e, t = {}) {
|
|
@@ -12090,7 +12102,7 @@ class zl {
|
|
|
12090
12102
|
return s < 0 ? null : (s === 0 ? 1e3 : 500) - s - Math.max(0, n.length - t.length) * 0.01;
|
|
12091
12103
|
}
|
|
12092
12104
|
}
|
|
12093
|
-
class
|
|
12105
|
+
class Fl {
|
|
12094
12106
|
engine;
|
|
12095
12107
|
constructor(e) {
|
|
12096
12108
|
this.engine = e;
|
|
@@ -12183,14 +12195,14 @@ class Rl {
|
|
|
12183
12195
|
}), t && t(i), i;
|
|
12184
12196
|
}
|
|
12185
12197
|
}
|
|
12186
|
-
const
|
|
12187
|
-
class
|
|
12198
|
+
const kn = !1, Nl = 51283, Hl = 2718207;
|
|
12199
|
+
class Vl {
|
|
12188
12200
|
engine;
|
|
12189
12201
|
rootGroup;
|
|
12190
12202
|
meshMaterial;
|
|
12191
12203
|
instanceMaterial;
|
|
12192
12204
|
handleLoadingCompleted;
|
|
12193
|
-
isVisible =
|
|
12205
|
+
isVisible = kn;
|
|
12194
12206
|
filterState = {
|
|
12195
12207
|
urls: null,
|
|
12196
12208
|
ids: null,
|
|
@@ -12198,7 +12210,7 @@ class Nl {
|
|
|
12198
12210
|
showInstance: !0
|
|
12199
12211
|
};
|
|
12200
12212
|
constructor(e) {
|
|
12201
|
-
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 = () => {
|
|
12202
12214
|
this.isVisible && this.rebuild();
|
|
12203
12215
|
}, this.engine.events?.on?.(ne.LoadingCompleted, this.handleLoadingCompleted);
|
|
12204
12216
|
}
|
|
@@ -12329,8 +12341,8 @@ class Nl {
|
|
|
12329
12341
|
e.matrixAutoUpdate = !1, e.matrix.copy(t), e.matrixWorldNeedsUpdate = !0, e.updateMatrixWorld(!0);
|
|
12330
12342
|
}
|
|
12331
12343
|
}
|
|
12332
|
-
const
|
|
12333
|
-
class
|
|
12344
|
+
const Ul = "path-roaming-animation", Wl = 8e3, Gl = 100, Vt = 16;
|
|
12345
|
+
class ql {
|
|
12334
12346
|
engine;
|
|
12335
12347
|
points = [];
|
|
12336
12348
|
status = "idle";
|
|
@@ -12680,7 +12692,7 @@ class Wl {
|
|
|
12680
12692
|
const t = e.loopMode ?? (e.loop ? "repeat" : "none");
|
|
12681
12693
|
return {
|
|
12682
12694
|
...e,
|
|
12683
|
-
duration: this.toPositiveNumber(e.duration,
|
|
12695
|
+
duration: this.toPositiveNumber(e.duration, Wl),
|
|
12684
12696
|
playbackRate: this.toPositiveNumber(e.playbackRate, 1),
|
|
12685
12697
|
timing: "distance",
|
|
12686
12698
|
positionInterpolation: "linear",
|
|
@@ -12690,7 +12702,7 @@ class Wl {
|
|
|
12690
12702
|
loopMode: t,
|
|
12691
12703
|
loopCount: e.loopCount === void 0 ? Number.POSITIVE_INFINITY : Math.max(Math.floor(this.toNonNegativeNumber(e.loopCount, 0)), 0),
|
|
12692
12704
|
direction: e.direction ?? "forward",
|
|
12693
|
-
maxFrameDelta: this.toPositiveNumber(e.maxFrameDelta,
|
|
12705
|
+
maxFrameDelta: this.toPositiveNumber(e.maxFrameDelta, Gl)
|
|
12694
12706
|
};
|
|
12695
12707
|
}
|
|
12696
12708
|
/** 规范化外部关键帧,并以四元数作为旋转的权威数据。 */
|
|
@@ -12784,7 +12796,7 @@ class Wl {
|
|
|
12784
12796
|
}
|
|
12785
12797
|
/** 播放期间解除引擎空闲限帧。 */
|
|
12786
12798
|
setFrameRateExempt(e) {
|
|
12787
|
-
this.engine.setIdleFrameRateExempt?.(
|
|
12799
|
+
this.engine.setIdleFrameRateExempt?.(Ul, e);
|
|
12788
12800
|
}
|
|
12789
12801
|
isValidPointIndex(e) {
|
|
12790
12802
|
return Number.isInteger(e) && e >= 0 && e < this.points.length;
|
|
@@ -12845,7 +12857,7 @@ class Wl {
|
|
|
12845
12857
|
return { x: e.x, y: e.y, z: e.z, w: e.w };
|
|
12846
12858
|
}
|
|
12847
12859
|
}
|
|
12848
|
-
class
|
|
12860
|
+
class Kl {
|
|
12849
12861
|
engine;
|
|
12850
12862
|
miniMapCamera = null;
|
|
12851
12863
|
miniMapRenderer = null;
|
|
@@ -13247,7 +13259,7 @@ class Gl {
|
|
|
13247
13259
|
p.rotateYaw(-c);
|
|
13248
13260
|
return;
|
|
13249
13261
|
}
|
|
13250
|
-
const g = i.getWorldDirection(new d()).multiplyScalar(h), y = new
|
|
13262
|
+
const g = i.getWorldDirection(new d()).multiplyScalar(h), y = new uo().setFromVector3(g);
|
|
13251
13263
|
y.theta -= c, g.setFromSpherical(y), n.target?.copy(i.position).add(g), n.update?.(), this.engine.controlModule?.firstPersonControls?.syncRotationStateFromCamera?.();
|
|
13252
13264
|
}
|
|
13253
13265
|
drawOverlay() {
|
|
@@ -13306,7 +13318,7 @@ class Gl {
|
|
|
13306
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;
|
|
13307
13319
|
}
|
|
13308
13320
|
}
|
|
13309
|
-
class
|
|
13321
|
+
class jl {
|
|
13310
13322
|
engine;
|
|
13311
13323
|
constructor(e) {
|
|
13312
13324
|
this.engine = e;
|
|
@@ -13603,26 +13615,26 @@ class ql {
|
|
|
13603
13615
|
return Math.abs(s.dot(e)) < 0.999 ? s : new d(1, 0, 0);
|
|
13604
13616
|
}
|
|
13605
13617
|
}
|
|
13606
|
-
class
|
|
13618
|
+
class Yl {
|
|
13607
13619
|
engine;
|
|
13608
13620
|
constructor(e) {
|
|
13609
13621
|
}
|
|
13610
13622
|
update() {
|
|
13611
13623
|
}
|
|
13612
13624
|
}
|
|
13613
|
-
const
|
|
13614
|
-
class
|
|
13625
|
+
const Ln = "bim-engine:link-element-2d3d-state", Bn = "link-element-2d3d";
|
|
13626
|
+
class Xl {
|
|
13615
13627
|
engine;
|
|
13616
13628
|
constructor(e) {
|
|
13617
13629
|
this.engine = e, this.active();
|
|
13618
13630
|
}
|
|
13619
13631
|
// 激活
|
|
13620
13632
|
active() {
|
|
13621
|
-
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(
|
|
13633
|
+
window.addEventListener("D2ElementClick", this.listenElementClick), window.addEventListener(Ln, this.listenLinkStateChange);
|
|
13622
13634
|
}
|
|
13623
13635
|
// 取消
|
|
13624
13636
|
disActive() {
|
|
13625
|
-
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(
|
|
13637
|
+
window.removeEventListener("D2ElementClick", this.listenElementClick), window.removeEventListener(Ln, this.listenLinkStateChange), this.engine?.setIdleFrameRateExempt?.(Bn, !1);
|
|
13626
13638
|
}
|
|
13627
13639
|
dispose() {
|
|
13628
13640
|
this.disActive();
|
|
@@ -13642,10 +13654,10 @@ class jl {
|
|
|
13642
13654
|
/** 二三维模型联动开启时保持 3D 引擎全帧渲染,避免等待空闲限帧间隔。 */
|
|
13643
13655
|
listenLinkStateChange = (e) => {
|
|
13644
13656
|
const t = e.detail?.enabled === !0;
|
|
13645
|
-
this.engine?.setIdleFrameRateExempt?.(
|
|
13657
|
+
this.engine?.setIdleFrameRateExempt?.(Bn, t);
|
|
13646
13658
|
};
|
|
13647
13659
|
}
|
|
13648
|
-
class
|
|
13660
|
+
class Ql {
|
|
13649
13661
|
engine;
|
|
13650
13662
|
constructor(e) {
|
|
13651
13663
|
this.engine = e, this.active();
|
|
@@ -13699,7 +13711,7 @@ const ht = {
|
|
|
13699
13711
|
EncodingComplete: "encoding-complete",
|
|
13700
13712
|
EncodingError: "encoding-error"
|
|
13701
13713
|
};
|
|
13702
|
-
class
|
|
13714
|
+
class $l {
|
|
13703
13715
|
engine;
|
|
13704
13716
|
apiKey;
|
|
13705
13717
|
baseURL = "https://api.deepseek.com";
|
|
@@ -13887,12 +13899,12 @@ class Xl {
|
|
|
13887
13899
|
}
|
|
13888
13900
|
}
|
|
13889
13901
|
}
|
|
13890
|
-
const fi = 1 / 0.3048,
|
|
13902
|
+
const fi = 1 / 0.3048, Zl = 1, Jl = 1.8, zn = /* @__PURE__ */ new Set([
|
|
13891
13903
|
"dynamic-elevation-bar-area",
|
|
13892
13904
|
"dynamic-elevation-guest-area",
|
|
13893
13905
|
"dynamic-elevation-door-head-area"
|
|
13894
|
-
]),
|
|
13895
|
-
class
|
|
13906
|
+
]), ec = ["台面"], tc = ["咖啡机"], ic = ["门店编号"], nc = ["发光logo", "发光Logo"];
|
|
13907
|
+
class sc {
|
|
13896
13908
|
engine;
|
|
13897
13909
|
constructor(e) {
|
|
13898
13910
|
this.engine = e;
|
|
@@ -13906,10 +13918,10 @@ class ic {
|
|
|
13906
13918
|
return null;
|
|
13907
13919
|
const t = e.views ?? {}, i = (t.Elevations ?? []).filter((o) => {
|
|
13908
13920
|
const r = o?.Id ?? o?.id;
|
|
13909
|
-
return !
|
|
13921
|
+
return !zn.has(String(r ?? ""));
|
|
13910
13922
|
}), n = (t.DynamicViews ?? []).filter((o) => {
|
|
13911
13923
|
const r = o?.Id ?? o?.id, l = String(r ?? "");
|
|
13912
|
-
return !
|
|
13924
|
+
return !zn.has(l) && !l.startsWith("dynamic-elevation-door-head-area");
|
|
13913
13925
|
}), s = this.generate(e);
|
|
13914
13926
|
return e.views = {
|
|
13915
13927
|
...t,
|
|
@@ -13926,7 +13938,7 @@ class ic {
|
|
|
13926
13938
|
generate(e) {
|
|
13927
13939
|
if (!(e?.nodesMap instanceof Map) || e.nodesMap.size === 0)
|
|
13928
13940
|
return [];
|
|
13929
|
-
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 = [];
|
|
13930
13942
|
if (t && i && n) {
|
|
13931
13943
|
const r = this.createBarAreaView(t, i, n), l = this.createGuestAreaView(t, i, n);
|
|
13932
13944
|
r && o.push(r), l && o.push(l);
|
|
@@ -14017,8 +14029,8 @@ class ic {
|
|
|
14017
14029
|
* 相机始终在观察面外侧偏移固定距离,且高度统一锁定为 1.8 米。
|
|
14018
14030
|
*/
|
|
14019
14031
|
createCameraPosition(e, t) {
|
|
14020
|
-
const i = e.clone().add(t.clone().multiplyScalar(
|
|
14021
|
-
return i.y =
|
|
14032
|
+
const i = e.clone().add(t.clone().multiplyScalar(Zl));
|
|
14033
|
+
return i.y = Jl, i;
|
|
14022
14034
|
}
|
|
14023
14035
|
/**
|
|
14024
14036
|
* 将 three.js 空间中的观察参数转换成运行时立面视图结构。
|
|
@@ -14193,8 +14205,8 @@ class ic {
|
|
|
14193
14205
|
};
|
|
14194
14206
|
}
|
|
14195
14207
|
}
|
|
14196
|
-
const
|
|
14197
|
-
function
|
|
14208
|
+
const Rn = 16, On = 0.02, yi = 1e-6, oc = 600;
|
|
14209
|
+
function Rs() {
|
|
14198
14210
|
return {
|
|
14199
14211
|
ceilingPlans: [],
|
|
14200
14212
|
elevations: [],
|
|
@@ -14203,14 +14215,14 @@ function Bs() {
|
|
|
14203
14215
|
sections: []
|
|
14204
14216
|
};
|
|
14205
14217
|
}
|
|
14206
|
-
function
|
|
14218
|
+
function Os(a, e) {
|
|
14207
14219
|
return {
|
|
14208
14220
|
id: a.Id ?? a.id,
|
|
14209
14221
|
name: a.Name ?? a.name,
|
|
14210
14222
|
url: e
|
|
14211
14223
|
};
|
|
14212
14224
|
}
|
|
14213
|
-
class
|
|
14225
|
+
class rc {
|
|
14214
14226
|
engine;
|
|
14215
14227
|
resolveViewTree;
|
|
14216
14228
|
openView;
|
|
@@ -14220,7 +14232,7 @@ class sc {
|
|
|
14220
14232
|
}
|
|
14221
14233
|
/** 获取构件可见的动态视图,并可选择直接打开第一个匹配项。 */
|
|
14222
14234
|
getElementVisibleViews(e, t, i = !1) {
|
|
14223
|
-
const n =
|
|
14235
|
+
const n = Rs(), s = this.engine.models.find((p) => p.url === e);
|
|
14224
14236
|
if (!s)
|
|
14225
14237
|
return n;
|
|
14226
14238
|
const o = this.findModelNode(s, t), r = this.getNodeWorldBox(s, o), l = this.resolveViewTree(e);
|
|
@@ -14233,7 +14245,7 @@ class sc {
|
|
|
14233
14245
|
h = p.length > 0 ? p : [this.getNearestCameraCandidate(c, r)];
|
|
14234
14246
|
}
|
|
14235
14247
|
h.forEach((p) => {
|
|
14236
|
-
n.dynamicViews.push(
|
|
14248
|
+
n.dynamicViews.push(Os(p.view, e));
|
|
14237
14249
|
});
|
|
14238
14250
|
const u = n.dynamicViews[0];
|
|
14239
14251
|
return i && u ? this.openView(u.url, u.id, () => {
|
|
@@ -14293,14 +14305,14 @@ class sc {
|
|
|
14293
14305
|
t.projectionMatrix,
|
|
14294
14306
|
t.matrixWorldInverse
|
|
14295
14307
|
);
|
|
14296
|
-
if (new
|
|
14308
|
+
if (new po().setFromProjectionMatrix(i).intersectsBox(e))
|
|
14297
14309
|
return;
|
|
14298
14310
|
const s = e.getCenter(new d()), o = this.engine.cameraModule?.rotateToTarget;
|
|
14299
14311
|
if (typeof o == "function") {
|
|
14300
14312
|
o.call(
|
|
14301
14313
|
this.engine.cameraModule,
|
|
14302
14314
|
s,
|
|
14303
|
-
|
|
14315
|
+
oc,
|
|
14304
14316
|
() => this.syncControlRotationState()
|
|
14305
14317
|
);
|
|
14306
14318
|
return;
|
|
@@ -14323,13 +14335,13 @@ class sc {
|
|
|
14323
14335
|
*/
|
|
14324
14336
|
createElementSamplePoints(e, t, i, n) {
|
|
14325
14337
|
const s = this.collectSampleSources(e, t), o = [];
|
|
14326
|
-
for (let r = 0; r <
|
|
14338
|
+
for (let r = 0; r < Rn && s.length > 0; r++) {
|
|
14327
14339
|
const l = s[r % s.length], c = this.sampleGeometrySurface(l, n);
|
|
14328
14340
|
c && o.push(c);
|
|
14329
14341
|
}
|
|
14330
14342
|
if (o.length > 0)
|
|
14331
14343
|
return o;
|
|
14332
|
-
for (o.push(i.getCenter(new d())); o.length <
|
|
14344
|
+
for (o.push(i.getCenter(new d())); o.length < Rn; )
|
|
14333
14345
|
o.push(new d(
|
|
14334
14346
|
F.lerp(i.min.x, i.max.x, n()),
|
|
14335
14347
|
F.lerp(i.min.y, i.max.y, n()),
|
|
@@ -14376,9 +14388,9 @@ class sc {
|
|
|
14376
14388
|
if (typeof s != "function")
|
|
14377
14389
|
return !1;
|
|
14378
14390
|
const o = t.clone().sub(e), r = o.length();
|
|
14379
|
-
if (r <=
|
|
14391
|
+
if (r <= On)
|
|
14380
14392
|
return !0;
|
|
14381
|
-
this.raycaster.near = 0, this.raycaster.far = r +
|
|
14393
|
+
this.raycaster.near = 0, this.raycaster.far = r + On, this.raycaster.set(e, o.normalize());
|
|
14382
14394
|
const c = (s.call(
|
|
14383
14395
|
this.engine.octreeBox,
|
|
14384
14396
|
this.raycaster,
|
|
@@ -14423,12 +14435,12 @@ const Ut = {
|
|
|
14423
14435
|
floorPlan: "楼层平面",
|
|
14424
14436
|
elevation: "立面视图",
|
|
14425
14437
|
section: "剖面视图"
|
|
14426
|
-
},
|
|
14438
|
+
}, ac = {
|
|
14427
14439
|
ceilingPlan: [Ut.ceilingPlan, "天花"],
|
|
14428
14440
|
floorPlan: [Ut.floorPlan, "楼层"],
|
|
14429
14441
|
elevation: [Ut.elevation, "立面"],
|
|
14430
14442
|
section: [Ut.section, "剖面"]
|
|
14431
|
-
},
|
|
14443
|
+
}, lc = [
|
|
14432
14444
|
["CeilingPlans", "ceilingPlans"],
|
|
14433
14445
|
["Elevations", "elevations"],
|
|
14434
14446
|
["DynamicViews", "dynamicViews"],
|
|
@@ -14442,7 +14454,7 @@ class Ki {
|
|
|
14442
14454
|
dynamicViewVisibility;
|
|
14443
14455
|
/** 管理模型原生视图与运行时动态视图的统一入口。 */
|
|
14444
14456
|
constructor(e) {
|
|
14445
|
-
this.engine = e, this.dynamicElevationViewGenerator = new
|
|
14457
|
+
this.engine = e, this.dynamicElevationViewGenerator = new sc(e), this.dynamicViewVisibility = new rc(
|
|
14446
14458
|
e,
|
|
14447
14459
|
(t) => this.getResolvedViewTree(t),
|
|
14448
14460
|
(t, i, n) => this.openViewInternal(t, i, n)
|
|
@@ -14461,10 +14473,10 @@ class Ki {
|
|
|
14461
14473
|
}
|
|
14462
14474
|
/** 获取单个模型的视图树数据,并补充运行时生成的动态视图分类。 */
|
|
14463
14475
|
getViewTreeData(e) {
|
|
14464
|
-
const t = this.getResolvedViewTree(e), i =
|
|
14465
|
-
return t &&
|
|
14476
|
+
const t = this.getResolvedViewTree(e), i = Rs();
|
|
14477
|
+
return t && lc.forEach(([n, s]) => {
|
|
14466
14478
|
(t[n] ?? []).forEach((o) => {
|
|
14467
|
-
i[s].push(
|
|
14479
|
+
i[s].push(Os(o, e));
|
|
14468
14480
|
});
|
|
14469
14481
|
}), i;
|
|
14470
14482
|
}
|
|
@@ -14577,7 +14589,7 @@ class Ki {
|
|
|
14577
14589
|
const t = String(e ?? "").replace(/\s+/g, "");
|
|
14578
14590
|
if (!t)
|
|
14579
14591
|
return "unknown";
|
|
14580
|
-
const i = Object.entries(
|
|
14592
|
+
const i = Object.entries(ac);
|
|
14581
14593
|
for (const [n, s] of i)
|
|
14582
14594
|
if (s.some((o) => t.includes(o)))
|
|
14583
14595
|
return n;
|
|
@@ -14614,7 +14626,7 @@ class Ki {
|
|
|
14614
14626
|
!t || t.isEmpty?.() || this.engine.viewCube?.zoomToModel?.(t, e);
|
|
14615
14627
|
}
|
|
14616
14628
|
}
|
|
14617
|
-
class
|
|
14629
|
+
class cc {
|
|
14618
14630
|
constructor(e) {
|
|
14619
14631
|
}
|
|
14620
14632
|
/** 3D 独立包不支持加载 2D 视图。 */
|
|
@@ -14625,16 +14637,16 @@ class ac {
|
|
|
14625
14637
|
removeSectionPlane() {
|
|
14626
14638
|
}
|
|
14627
14639
|
}
|
|
14628
|
-
function
|
|
14640
|
+
function hc(a, e, t = "bim-snapshot.png") {
|
|
14629
14641
|
const i = a?.renderer, n = i?.domElement;
|
|
14630
14642
|
if (!i || !n || !e)
|
|
14631
14643
|
return null;
|
|
14632
14644
|
const s = n.width || n.clientWidth, o = n.height || n.clientHeight;
|
|
14633
14645
|
if (s <= 0 || o <= 0)
|
|
14634
14646
|
return null;
|
|
14635
|
-
let r =
|
|
14636
|
-
if (!
|
|
14637
|
-
const p =
|
|
14647
|
+
let r = dc(n, s, o);
|
|
14648
|
+
if (!uc(r)) {
|
|
14649
|
+
const p = pc(a, s, o);
|
|
14638
14650
|
p && (r = p);
|
|
14639
14651
|
}
|
|
14640
14652
|
const l = document.createElement("canvas");
|
|
@@ -14646,13 +14658,13 @@ function lc(a, e, t = "bim-snapshot.png") {
|
|
|
14646
14658
|
const h = l.toDataURL("image/png"), u = document.createElement("a");
|
|
14647
14659
|
return u.href = h, u.download = t.toLowerCase().endsWith(".png") ? t : `${t}.png`, u.click(), h;
|
|
14648
14660
|
}
|
|
14649
|
-
function
|
|
14661
|
+
function dc(a, e, t) {
|
|
14650
14662
|
const i = document.createElement("canvas");
|
|
14651
14663
|
i.width = e, i.height = t;
|
|
14652
14664
|
const n = i.getContext("2d");
|
|
14653
14665
|
return n && n.drawImage(a, 0, 0, e, t), i;
|
|
14654
14666
|
}
|
|
14655
|
-
function
|
|
14667
|
+
function uc(a) {
|
|
14656
14668
|
const e = a.getContext("2d");
|
|
14657
14669
|
if (!e || a.width <= 0 || a.height <= 0)
|
|
14658
14670
|
return !1;
|
|
@@ -14665,28 +14677,28 @@ function hc(a) {
|
|
|
14665
14677
|
}
|
|
14666
14678
|
return !1;
|
|
14667
14679
|
}
|
|
14668
|
-
function
|
|
14680
|
+
function pc(a, e, t) {
|
|
14669
14681
|
const i = a?.renderer, n = a?.scene, s = a?.camera;
|
|
14670
14682
|
if (!i || !n || !s)
|
|
14671
14683
|
return null;
|
|
14672
|
-
const o = new
|
|
14684
|
+
const o = new jn(e, t, {
|
|
14673
14685
|
minFilter: Qt,
|
|
14674
14686
|
magFilter: Qt,
|
|
14675
|
-
format:
|
|
14687
|
+
format: Yn,
|
|
14676
14688
|
depthBuffer: !0,
|
|
14677
14689
|
stencilBuffer: !0
|
|
14678
14690
|
}), r = i.getRenderTarget(), l = i.autoClear, c = i.xr?.enabled ?? !1;
|
|
14679
14691
|
try {
|
|
14680
14692
|
i.xr && (i.xr.enabled = !1), i.autoClear = !0, i.setRenderTarget(o), i.clear(!0, !0, !0), i.render(n, s);
|
|
14681
14693
|
const h = new Uint8Array(e * t * 4);
|
|
14682
|
-
return i.readRenderTargetPixels(o, 0, 0, e, t, h),
|
|
14694
|
+
return i.readRenderTargetPixels(o, 0, 0, e, t, h), mc(h, e, t);
|
|
14683
14695
|
} catch {
|
|
14684
14696
|
return null;
|
|
14685
14697
|
} finally {
|
|
14686
14698
|
i.setRenderTarget(r), i.autoClear = l, i.xr && (i.xr.enabled = c), o.dispose();
|
|
14687
14699
|
}
|
|
14688
14700
|
}
|
|
14689
|
-
function
|
|
14701
|
+
function mc(a, e, t) {
|
|
14690
14702
|
const i = document.createElement("canvas");
|
|
14691
14703
|
i.width = e, i.height = t;
|
|
14692
14704
|
const n = i.getContext("2d");
|
|
@@ -14700,7 +14712,7 @@ function uc(a, e, t) {
|
|
|
14700
14712
|
}
|
|
14701
14713
|
return n.putImageData(s, 0, 0), i;
|
|
14702
14714
|
}
|
|
14703
|
-
const
|
|
14715
|
+
const gc = [
|
|
14704
14716
|
"#ffffff",
|
|
14705
14717
|
"#000000",
|
|
14706
14718
|
"#ff4d4f",
|
|
@@ -14711,7 +14723,7 @@ const pc = [
|
|
|
14711
14723
|
"#1677ff",
|
|
14712
14724
|
"#722ed1",
|
|
14713
14725
|
"#eb2f96"
|
|
14714
|
-
],
|
|
14726
|
+
], fc = {
|
|
14715
14727
|
none: ee("/assets/icon/选择.svg", import.meta.url),
|
|
14716
14728
|
line: ee("/assets/icon/线.svg", import.meta.url),
|
|
14717
14729
|
arrow: ee("/assets/icon/箭头.svg", import.meta.url),
|
|
@@ -14719,7 +14731,7 @@ const pc = [
|
|
|
14719
14731
|
circle: ee("/assets/icon/圆形.svg", import.meta.url),
|
|
14720
14732
|
text: ee("/assets/icon/文字.svg", import.meta.url),
|
|
14721
14733
|
cloudline: ee("/assets/icon/云线.svg", import.meta.url)
|
|
14722
|
-
},
|
|
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 = [
|
|
14723
14735
|
{ type: "distance", label: "距离" },
|
|
14724
14736
|
{ type: "clearDistance", label: "净距" },
|
|
14725
14737
|
{ type: "clearHeight", label: "净高" },
|
|
@@ -14728,7 +14740,7 @@ const pc = [
|
|
|
14728
14740
|
{ type: "angle", label: "角度" },
|
|
14729
14741
|
{ type: "area", label: "面积" },
|
|
14730
14742
|
{ type: "slope", label: "坡度" }
|
|
14731
|
-
],
|
|
14743
|
+
], Cc = {
|
|
14732
14744
|
distance: ee("/assets/icon/距离.svg", import.meta.url),
|
|
14733
14745
|
clearDistance: ee("/assets/icon/净距.svg", import.meta.url),
|
|
14734
14746
|
clearHeight: ee("/assets/icon/净高.svg", import.meta.url),
|
|
@@ -14738,7 +14750,7 @@ const pc = [
|
|
|
14738
14750
|
area: ee("/assets/icon/面积.svg", import.meta.url),
|
|
14739
14751
|
slope: ee("/assets/icon/坡度.svg", import.meta.url)
|
|
14740
14752
|
};
|
|
14741
|
-
class
|
|
14753
|
+
class Ec {
|
|
14742
14754
|
constructor(e, t) {
|
|
14743
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";
|
|
14744
14756
|
const i = document.createElement("div");
|
|
@@ -14751,7 +14763,7 @@ class bc {
|
|
|
14751
14763
|
{ type: "text", label: "文字" },
|
|
14752
14764
|
{ type: "cloudline", label: "云线" }
|
|
14753
14765
|
].forEach((y) => {
|
|
14754
|
-
const M = this.createIconButton(y.label,
|
|
14766
|
+
const M = this.createIconButton(y.label, fc[y.type]);
|
|
14755
14767
|
M.onclick = () => this.handlers.onDrawTypeChange(y.type), this.drawButtons[y.type] = M, i.appendChild(M);
|
|
14756
14768
|
});
|
|
14757
14769
|
const s = document.createElement("div");
|
|
@@ -14761,23 +14773,23 @@ class bc {
|
|
|
14761
14773
|
this.updateColorControl(this.colorInput.value), this.handlers.onColorChange(this.colorInput.value), this.setColorPresetVisible(!1);
|
|
14762
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";
|
|
14763
14775
|
const r = document.createElement("div");
|
|
14764
|
-
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) => {
|
|
14765
14777
|
const M = document.createElement("button");
|
|
14766
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 = () => {
|
|
14767
14779
|
this.updateColorControl(y), this.handlers.onColorChange(y), this.setColorPresetVisible(!1);
|
|
14768
14780
|
}, r.appendChild(M);
|
|
14769
14781
|
}), this.colorPresetPanel.appendChild(r);
|
|
14770
14782
|
const l = document.createElement("button");
|
|
14771
|
-
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,
|
|
14772
|
-
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);
|
|
14773
14785
|
c.onclick = () => this.handlers.onScreenshot(), i.appendChild(c);
|
|
14774
|
-
const h = this.createIconButton("捕捉点",
|
|
14786
|
+
const h = this.createIconButton("捕捉点", wc);
|
|
14775
14787
|
h.onclick = () => this.handlers.onPickPoint(), i.appendChild(h);
|
|
14776
14788
|
const u = this.createTextButton("×", "取消");
|
|
14777
14789
|
u.onclick = () => this.handlers.onCancel(), u.style.background = "#ff4d4f", u.style.borderColor = "#ff4d4f", u.style.color = "#ffffff", i.appendChild(u);
|
|
14778
14790
|
const p = this.createTextButton("✔", "确定");
|
|
14779
|
-
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",
|
|
14780
|
-
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]);
|
|
14781
14793
|
M.onclick = () => this.handlers.onMeasureTypeChange(y.type), this.measureTypeButtons[y.type] = M, this.measureSubPanel.appendChild(M);
|
|
14782
14794
|
}), this.editPanel.appendChild(i), this.editPanel.appendChild(this.measureSubPanel);
|
|
14783
14795
|
const g = this.createTextButton("关闭", "关闭");
|
|
@@ -14902,7 +14914,7 @@ class bc {
|
|
|
14902
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;
|
|
14903
14915
|
}
|
|
14904
14916
|
}
|
|
14905
|
-
class
|
|
14917
|
+
class Ac {
|
|
14906
14918
|
engine;
|
|
14907
14919
|
wrapper;
|
|
14908
14920
|
canvasEl;
|
|
@@ -14941,7 +14953,7 @@ class Cc {
|
|
|
14941
14953
|
const t = this.engine.container;
|
|
14942
14954
|
if (!t)
|
|
14943
14955
|
throw new Error("FabricDraw: engine container not found.");
|
|
14944
|
-
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({
|
|
14945
14957
|
onDrawTypeChange: (n) => this.setDrawType(n),
|
|
14946
14958
|
onMeasureToggle: () => this.toggleMeasurePanel(),
|
|
14947
14959
|
onMeasureTypeChange: (n) => this.activateDistanceMeasure(n),
|
|
@@ -14967,7 +14979,7 @@ class Cc {
|
|
|
14967
14979
|
fontSize: this.drawStyle.fontSize
|
|
14968
14980
|
}), this.toolbar.mount(this.wrapper);
|
|
14969
14981
|
const i = this.engine.renderer?.domElement;
|
|
14970
|
-
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, {
|
|
14971
14983
|
selection: !0,
|
|
14972
14984
|
preserveObjectStacking: !0
|
|
14973
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();
|
|
@@ -15053,7 +15065,7 @@ class Cc {
|
|
|
15053
15065
|
/**
|
|
15054
15066
|
* 鐩存帴缁樺埗鏂囧瓧銆? */
|
|
15055
15067
|
drawText(e, t, i) {
|
|
15056
|
-
const n = this.mergeStyle(i), s = new
|
|
15068
|
+
const n = this.mergeStyle(i), s = new Fo(t ?? n.text, {
|
|
15057
15069
|
left: e.x,
|
|
15058
15070
|
top: e.y,
|
|
15059
15071
|
...this.createTextStyle(n),
|
|
@@ -15090,7 +15102,7 @@ class Cc {
|
|
|
15090
15102
|
* 鎴浘淇濆瓨锛堟ā鍨?Fabric鎵规敞鍚堟垚锛夈€? */
|
|
15091
15103
|
saveScreenshot(e = "bim-snapshot.png") {
|
|
15092
15104
|
const t = this.canvas.lowerCanvasEl;
|
|
15093
|
-
return t ?
|
|
15105
|
+
return t ? hc(this.engine, t, e) : null;
|
|
15094
15106
|
}
|
|
15095
15107
|
/**
|
|
15096
15108
|
* 鍚屾鐢诲竷灏哄銆? */
|
|
@@ -15258,7 +15270,7 @@ class Cc {
|
|
|
15258
15270
|
return s.annotationType = "line", s;
|
|
15259
15271
|
}
|
|
15260
15272
|
createRectObject(e, t, i, n) {
|
|
15261
|
-
const s = this.getBoxFromPoints(e, t), o = new
|
|
15273
|
+
const s = this.getBoxFromPoints(e, t), o = new No({
|
|
15262
15274
|
...this.createObjectBase(i, n),
|
|
15263
15275
|
left: s.left,
|
|
15264
15276
|
top: s.top,
|
|
@@ -15270,7 +15282,7 @@ class Cc {
|
|
|
15270
15282
|
return o.annotationType = "rect", o;
|
|
15271
15283
|
}
|
|
15272
15284
|
createCircleObject(e, t, i, n) {
|
|
15273
|
-
const s = this.getCircleFromPoints(e, t), o = new
|
|
15285
|
+
const s = this.getCircleFromPoints(e, t), o = new Ho({
|
|
15274
15286
|
...this.createObjectBase(i, n),
|
|
15275
15287
|
left: s.left,
|
|
15276
15288
|
top: s.top,
|
|
@@ -15574,7 +15586,7 @@ class Cc {
|
|
|
15574
15586
|
return JSON.parse(JSON.stringify(e));
|
|
15575
15587
|
}
|
|
15576
15588
|
}
|
|
15577
|
-
class
|
|
15589
|
+
class Sc {
|
|
15578
15590
|
engine;
|
|
15579
15591
|
capturePoint = null;
|
|
15580
15592
|
labelPrefix = "drawing-pin-label-";
|
|
@@ -16024,7 +16036,7 @@ class Ec {
|
|
|
16024
16036
|
return e;
|
|
16025
16037
|
}
|
|
16026
16038
|
}
|
|
16027
|
-
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 = {
|
|
16028
16040
|
enabled: !1,
|
|
16029
16041
|
highlight: !0,
|
|
16030
16042
|
visibility: !0,
|
|
@@ -16033,7 +16045,7 @@ const Mi = "bim-engine:model-link-3d", Ac = "default-model-link-3d-group", Rn =
|
|
|
16033
16045
|
cameraMode: "onStop",
|
|
16034
16046
|
cameraThrottleMs: 50
|
|
16035
16047
|
};
|
|
16036
|
-
class
|
|
16048
|
+
class Tc {
|
|
16037
16049
|
viewerGuid;
|
|
16038
16050
|
engine;
|
|
16039
16051
|
options;
|
|
@@ -16091,20 +16103,20 @@ class Sc {
|
|
|
16091
16103
|
return this.applyingLinkedEvent;
|
|
16092
16104
|
}
|
|
16093
16105
|
dispose() {
|
|
16094
|
-
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());
|
|
16095
16107
|
}
|
|
16096
16108
|
normalizeOptions(e) {
|
|
16097
16109
|
return {
|
|
16098
|
-
...
|
|
16110
|
+
...Nn,
|
|
16099
16111
|
...e,
|
|
16100
|
-
groupId: e.groupId ?? this.engine?.options?.linkGroupId ??
|
|
16112
|
+
groupId: e.groupId ?? this.engine?.options?.linkGroupId ?? Pc,
|
|
16101
16113
|
modelId: e.modelId ?? this.engine?.options?.modelLinkId
|
|
16102
16114
|
};
|
|
16103
16115
|
}
|
|
16104
16116
|
/** 模型联动开启后需要持续响应外部视图变化,不能进入空闲限帧。 */
|
|
16105
16117
|
syncIdleFrameRateExempt() {
|
|
16106
16118
|
this.engine?.setIdleFrameRateExempt?.(
|
|
16107
|
-
|
|
16119
|
+
Fn,
|
|
16108
16120
|
this.options.enabled === !0
|
|
16109
16121
|
);
|
|
16110
16122
|
}
|
|
@@ -16196,7 +16208,7 @@ class Sc {
|
|
|
16196
16208
|
return this.engine?.controlModule?.firstPersonControls?.enabled === !0 && this.engine?.movefirst === !0;
|
|
16197
16209
|
}
|
|
16198
16210
|
emitCameraThrottled() {
|
|
16199
|
-
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));
|
|
16200
16212
|
if (t === 0) {
|
|
16201
16213
|
this.emitCamera();
|
|
16202
16214
|
return;
|
|
@@ -16337,13 +16349,13 @@ class Sc {
|
|
|
16337
16349
|
}).filter((n) => n.ids.length > 0);
|
|
16338
16350
|
}
|
|
16339
16351
|
}
|
|
16340
|
-
class
|
|
16352
|
+
class Ic {
|
|
16341
16353
|
engine;
|
|
16342
16354
|
manager;
|
|
16343
16355
|
worldToScreen;
|
|
16344
16356
|
raycaster = new me();
|
|
16345
16357
|
constructor(e) {
|
|
16346
|
-
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({
|
|
16347
16359
|
container: e.container,
|
|
16348
16360
|
className: "bim-engine-label-container bim-engine-label-container-3d",
|
|
16349
16361
|
projectCoordinate: (t) => this.projectCoordinate(t),
|
|
@@ -16405,7 +16417,7 @@ class Pc {
|
|
|
16405
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;
|
|
16406
16418
|
}
|
|
16407
16419
|
}
|
|
16408
|
-
class
|
|
16420
|
+
class _c {
|
|
16409
16421
|
/** 推进当前标记注册的材质与独立点动画。 */
|
|
16410
16422
|
updateRecord(e, t) {
|
|
16411
16423
|
const i = t + e.timeSeed;
|
|
@@ -16428,7 +16440,7 @@ class Tc {
|
|
|
16428
16440
|
});
|
|
16429
16441
|
}
|
|
16430
16442
|
}
|
|
16431
|
-
class
|
|
16443
|
+
class Dc {
|
|
16432
16444
|
engine;
|
|
16433
16445
|
rootGroup;
|
|
16434
16446
|
records;
|
|
@@ -16735,7 +16747,7 @@ const Pe = {
|
|
|
16735
16747
|
showBottom: !1,
|
|
16736
16748
|
edgeColor: "#d9ffff"
|
|
16737
16749
|
}
|
|
16738
|
-
},
|
|
16750
|
+
}, kc = {
|
|
16739
16751
|
background: "rgba(10, 18, 28, 0.92)",
|
|
16740
16752
|
color: "#ffffff",
|
|
16741
16753
|
border: "1px solid rgba(127, 252, 255, 0.72)",
|
|
@@ -16744,7 +16756,7 @@ const Pe = {
|
|
|
16744
16756
|
boxShadow: "0 10px 30px rgba(0, 0, 0, 0.32)",
|
|
16745
16757
|
minWidth: "120px",
|
|
16746
16758
|
pointerEvents: "auto"
|
|
16747
|
-
},
|
|
16759
|
+
}, Lc = "bim-engine-annotation3d-panels";
|
|
16748
16760
|
function Yt(a) {
|
|
16749
16761
|
return a.map((e) => ({ x: e.x, y: e.y, z: e.z }));
|
|
16750
16762
|
}
|
|
@@ -16755,7 +16767,7 @@ function Wt(a) {
|
|
|
16755
16767
|
const e = new d();
|
|
16756
16768
|
return a.length === 0 ? e : (a.forEach((t) => e.add(J(t))), e.multiplyScalar(1 / a.length));
|
|
16757
16769
|
}
|
|
16758
|
-
function
|
|
16770
|
+
function Bc(a) {
|
|
16759
16771
|
const e = new d();
|
|
16760
16772
|
for (let t = 0; t < a.length; t += 1) {
|
|
16761
16773
|
const i = a[t], n = a[(t + 1) % a.length];
|
|
@@ -16763,9 +16775,9 @@ function kc(a) {
|
|
|
16763
16775
|
}
|
|
16764
16776
|
return e.normalize();
|
|
16765
16777
|
}
|
|
16766
|
-
function
|
|
16778
|
+
function Fs(a) {
|
|
16767
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);
|
|
16768
|
-
let n =
|
|
16780
|
+
let n = Bc(e);
|
|
16769
16781
|
n.lengthSq() < 1e-8 && (n = new d(0, 1, 0));
|
|
16770
16782
|
const s = new d().crossVectors(n, i).normalize(), o = new d().crossVectors(s, n).normalize(), r = e.map((c) => {
|
|
16771
16783
|
const h = c.clone().sub(t);
|
|
@@ -16773,8 +16785,8 @@ function Rs(a) {
|
|
|
16773
16785
|
}), l = new H().makeBasis(o, s, n).setPosition(t);
|
|
16774
16786
|
return { origin: t, normal: n, matrix: l, localPoints: r };
|
|
16775
16787
|
}
|
|
16776
|
-
function
|
|
16777
|
-
const e = new
|
|
16788
|
+
function Ns(a) {
|
|
16789
|
+
const e = new Xn();
|
|
16778
16790
|
return a.forEach((t, i) => {
|
|
16779
16791
|
if (i === 0) {
|
|
16780
16792
|
e.moveTo(t.x, t.y);
|
|
@@ -16783,12 +16795,12 @@ function Os(a) {
|
|
|
16783
16795
|
e.lineTo(t.x, t.y);
|
|
16784
16796
|
}), e.closePath(), e;
|
|
16785
16797
|
}
|
|
16786
|
-
function
|
|
16798
|
+
function zc(a, e) {
|
|
16787
16799
|
a.traverse((t) => {
|
|
16788
16800
|
t.userData = t.userData ?? {}, t.userData.annotationId = e;
|
|
16789
16801
|
});
|
|
16790
16802
|
}
|
|
16791
|
-
function
|
|
16803
|
+
function Rc(a) {
|
|
16792
16804
|
a.traverse((e) => {
|
|
16793
16805
|
const t = e;
|
|
16794
16806
|
t.geometry?.dispose?.();
|
|
@@ -16800,13 +16812,13 @@ function Bc(a) {
|
|
|
16800
16812
|
i?.dispose?.();
|
|
16801
16813
|
});
|
|
16802
16814
|
}
|
|
16803
|
-
function
|
|
16815
|
+
function Oc(a) {
|
|
16804
16816
|
return a.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
16805
16817
|
}
|
|
16806
|
-
function
|
|
16818
|
+
function Fc(a) {
|
|
16807
16819
|
return a === "polyline" || a === "curve3d" ? "center" : a === "polygon" ? "centroid" : "top";
|
|
16808
16820
|
}
|
|
16809
|
-
class
|
|
16821
|
+
class Nc {
|
|
16810
16822
|
render(e) {
|
|
16811
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 ? "" : `
|
|
16812
16824
|
<rect x="${ce}" y="${O}" width="${C}" height="${S}" rx="10"
|
|
@@ -16860,7 +16872,7 @@ class Oc {
|
|
|
16860
16872
|
return Math.max(Math.round((n.boardWidth ?? 4.6) * 22), Math.ceil(r), 78);
|
|
16861
16873
|
}
|
|
16862
16874
|
}
|
|
16863
|
-
class
|
|
16875
|
+
class Hc {
|
|
16864
16876
|
/** 按标记类型重建内容,并返回相对三维锚点的布局参数。 */
|
|
16865
16877
|
render(e, t) {
|
|
16866
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({
|
|
@@ -16933,10 +16945,10 @@ class Fc {
|
|
|
16933
16945
|
return `rgba(${r >> 16 & 255}, ${r >> 8 & 255}, ${r & 255}, ${i})`;
|
|
16934
16946
|
}
|
|
16935
16947
|
}
|
|
16936
|
-
const
|
|
16937
|
-
class
|
|
16948
|
+
const Vc = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint"]), Uc = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint", "ripplePoint", "pillarPoint", "leaderPoint"]);
|
|
16949
|
+
class Wc {
|
|
16938
16950
|
constructor(e, t) {
|
|
16939
|
-
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 = [
|
|
16940
16952
|
"position:absolute",
|
|
16941
16953
|
"left:0",
|
|
16942
16954
|
"top:0",
|
|
@@ -16949,8 +16961,8 @@ class Vc {
|
|
|
16949
16961
|
}
|
|
16950
16962
|
container;
|
|
16951
16963
|
worldToScreen;
|
|
16952
|
-
leaderMarker = new
|
|
16953
|
-
pointContentMarker = new
|
|
16964
|
+
leaderMarker = new Nc();
|
|
16965
|
+
pointContentMarker = new Hc();
|
|
16954
16966
|
updateProjectionState() {
|
|
16955
16967
|
this.worldToScreen.updateCamera(this.engine.camera), this.worldToScreen.updateRenderer(this.engine.renderer), this.worldToScreen.updateScene(this.engine.scene);
|
|
16956
16968
|
}
|
|
@@ -16963,7 +16975,7 @@ class Vc {
|
|
|
16963
16975
|
"transform:translate(-50%, -100%)",
|
|
16964
16976
|
"display:none",
|
|
16965
16977
|
t.interactive === !1 ? "pointer-events:none" : "pointer-events:auto"
|
|
16966
|
-
].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;
|
|
16967
16979
|
}
|
|
16968
16980
|
createLeaderMarkerElement(e) {
|
|
16969
16981
|
const t = document.createElement("div");
|
|
@@ -16975,7 +16987,7 @@ class Vc {
|
|
|
16975
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;
|
|
16976
16988
|
}
|
|
16977
16989
|
updateRecord(e) {
|
|
16978
|
-
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)
|
|
16979
16991
|
return;
|
|
16980
16992
|
const t = e.instance.panel;
|
|
16981
16993
|
if (!(t.visible !== !1 && this.shouldShowPanel(e)) || !e.instance.visible) {
|
|
@@ -17034,9 +17046,9 @@ class Vc {
|
|
|
17034
17046
|
const t = e.instance.panel?.offset ?? {};
|
|
17035
17047
|
if (e.panelAnchorPoint)
|
|
17036
17048
|
return e.panelAnchorPoint.clone().add(new d(t.x ?? 0, t.y ?? 0, t.z ?? 0));
|
|
17037
|
-
const i = e.instance.panel?.anchor ??
|
|
17049
|
+
const i = e.instance.panel?.anchor ?? Fc(e.instance.type);
|
|
17038
17050
|
let n = new d();
|
|
17039
|
-
if (
|
|
17051
|
+
if (Uc.has(e.instance.type))
|
|
17040
17052
|
n.copy(J(e.instance.points[0])), i === "top" && (n.y += e.volumeHeight ?? 0);
|
|
17041
17053
|
else if (e.instance.type === "polyline" || e.instance.type === "curve3d")
|
|
17042
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));
|
|
@@ -17051,19 +17063,19 @@ class Vc {
|
|
|
17051
17063
|
return n.add(new d(t.x ?? 0, t.y ?? 0, t.z ?? 0)), n;
|
|
17052
17064
|
}
|
|
17053
17065
|
}
|
|
17054
|
-
class
|
|
17066
|
+
class Gc {
|
|
17055
17067
|
apply(e, t) {
|
|
17056
17068
|
e.instance.root.visible = e.instance.visible, e.instance.style.alwaysOnTop && e.instance.root.traverse((i) => {
|
|
17057
17069
|
i.renderOrder = Math.max(i.renderOrder, 1200);
|
|
17058
17070
|
}), t(e);
|
|
17059
17071
|
}
|
|
17060
17072
|
}
|
|
17061
|
-
class
|
|
17073
|
+
class qc {
|
|
17062
17074
|
constructor(e) {
|
|
17063
17075
|
this.engine = e;
|
|
17064
17076
|
}
|
|
17065
17077
|
createSurfaceMaterial(e) {
|
|
17066
|
-
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({
|
|
17067
17079
|
transparent: !0,
|
|
17068
17080
|
side: re,
|
|
17069
17081
|
depthTest: t.alwaysOnTop ? !1 : t.depthTest !== !1,
|
|
@@ -17210,13 +17222,13 @@ class Ke {
|
|
|
17210
17222
|
this.engine = e, this.materialFactory = t;
|
|
17211
17223
|
}
|
|
17212
17224
|
createSegmentCurve(e) {
|
|
17213
|
-
const t = new
|
|
17225
|
+
const t = new go();
|
|
17214
17226
|
for (let i = 0; i < e.length - 1; i += 1)
|
|
17215
|
-
t.add(new
|
|
17227
|
+
t.add(new fo(e[i], e[i + 1]));
|
|
17216
17228
|
return t;
|
|
17217
17229
|
}
|
|
17218
17230
|
createTubeMesh(e, t, i, n, s, o, r = 10, l = !1) {
|
|
17219
|
-
const c = new
|
|
17231
|
+
const c = new yo(t, i, n, r, l);
|
|
17220
17232
|
c.computeBoundingBox();
|
|
17221
17233
|
const h = c.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), u = this.materialFactory.createSurfaceMaterial({
|
|
17222
17234
|
color: s.color ?? "#7ffcff",
|
|
@@ -17237,11 +17249,11 @@ class Ke {
|
|
|
17237
17249
|
depthTest: i.alwaysOnTop ? !1 : i.depthTest !== !1
|
|
17238
17250
|
});
|
|
17239
17251
|
s.clippingPlanes = this.engine.sectionPlane;
|
|
17240
|
-
const o = new
|
|
17252
|
+
const o = new Mo(n, s);
|
|
17241
17253
|
return o.renderOrder = 998, o;
|
|
17242
17254
|
}
|
|
17243
17255
|
}
|
|
17244
|
-
class
|
|
17256
|
+
class Kc extends Ke {
|
|
17245
17257
|
type = "box";
|
|
17246
17258
|
build(e) {
|
|
17247
17259
|
if (e.instance.points.length < 2)
|
|
@@ -17268,14 +17280,14 @@ class Gc extends Ke {
|
|
|
17268
17280
|
depthTest: e.instance.style.alwaysOnTop ? !1 : e.instance.style.depthTest !== !1
|
|
17269
17281
|
});
|
|
17270
17282
|
p.clippingPlanes = this.engine.sectionPlane;
|
|
17271
|
-
const g = new Jt(new
|
|
17283
|
+
const g = new Jt(new vo(l), p);
|
|
17272
17284
|
g.position.copy(r), e.instance.root.add(g), e.volumeHeight = o.y, e.animatedMaterials.push(h);
|
|
17273
17285
|
}
|
|
17274
17286
|
}
|
|
17275
|
-
class
|
|
17287
|
+
class jc extends Ke {
|
|
17276
17288
|
type = "curve3d";
|
|
17277
17289
|
build(e) {
|
|
17278
|
-
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(
|
|
17279
17291
|
t,
|
|
17280
17292
|
i.closed ?? !1,
|
|
17281
17293
|
n === "catmullRom" ? "catmullrom" : n,
|
|
@@ -17293,10 +17305,10 @@ class qc extends Ke {
|
|
|
17293
17305
|
e.instance.root.add(o), e.anchorCurve = s, e.panelAnchorPoint = s.getPoint(0.5);
|
|
17294
17306
|
}
|
|
17295
17307
|
}
|
|
17296
|
-
class
|
|
17308
|
+
class Yc extends Ke {
|
|
17297
17309
|
type = "extrudePolygon";
|
|
17298
17310
|
build(e) {
|
|
17299
|
-
const t =
|
|
17311
|
+
const t = Fs(e.instance.points), i = Ns(t.localPoints), n = e.instance.style.volume?.height ?? 10, s = new Qn(i, {
|
|
17300
17312
|
depth: n,
|
|
17301
17313
|
bevelEnabled: !1,
|
|
17302
17314
|
steps: 1,
|
|
@@ -17341,21 +17353,21 @@ class ji extends Ke {
|
|
|
17341
17353
|
e.instance.root.position.copy(t), e.panelAnchorPoint = t.clone();
|
|
17342
17354
|
}
|
|
17343
17355
|
}
|
|
17344
|
-
class
|
|
17356
|
+
class Xc extends ji {
|
|
17345
17357
|
type = "iconPoint";
|
|
17346
17358
|
/** 将图标点绑定到首个世界坐标。 */
|
|
17347
17359
|
build(e) {
|
|
17348
17360
|
this.buildDomAnchor(e);
|
|
17349
17361
|
}
|
|
17350
17362
|
}
|
|
17351
|
-
class
|
|
17363
|
+
class Qc extends ji {
|
|
17352
17364
|
type = "iconTextPoint";
|
|
17353
17365
|
/** 将图文组合点绑定到首个世界坐标。 */
|
|
17354
17366
|
build(e) {
|
|
17355
17367
|
this.buildDomAnchor(e);
|
|
17356
17368
|
}
|
|
17357
17369
|
}
|
|
17358
|
-
class
|
|
17370
|
+
class $c extends Ke {
|
|
17359
17371
|
type = "leaderPoint";
|
|
17360
17372
|
build(e) {
|
|
17361
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();
|
|
@@ -17375,13 +17387,13 @@ class Xc extends Ke {
|
|
|
17375
17387
|
];
|
|
17376
17388
|
}
|
|
17377
17389
|
}
|
|
17378
|
-
class
|
|
17390
|
+
class Zc extends Ke {
|
|
17379
17391
|
type = "pillarPoint";
|
|
17380
17392
|
/** 根据光柱专属参数创建柱体与可选底环。 */
|
|
17381
17393
|
build(e) {
|
|
17382
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);
|
|
17383
17395
|
e.instance.root.position.copy(i).add(n), e.panelAnchorPoint = i.clone().add(n).add(new d(0, s, 0)), e.volumeHeight = s;
|
|
17384
|
-
const o = new
|
|
17396
|
+
const o = new wo(
|
|
17385
17397
|
Math.max(t.radiusTop ?? 0.3, 1e-3),
|
|
17386
17398
|
Math.max(t.radiusBottom ?? 0.75, 1e-3),
|
|
17387
17399
|
s,
|
|
@@ -17424,7 +17436,7 @@ class Qc extends Ke {
|
|
|
17424
17436
|
});
|
|
17425
17437
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
17426
17438
|
const u = new z(
|
|
17427
|
-
new
|
|
17439
|
+
new es(
|
|
17428
17440
|
Math.max(t.baseRingInnerRadius ?? 1.9, 1e-3),
|
|
17429
17441
|
Math.max(t.baseRingOuterRadius ?? 2.4, (t.baseRingInnerRadius ?? 1.9) + 1e-3),
|
|
17430
17442
|
Math.max(12, Math.floor(t.baseRingSegments ?? 48))
|
|
@@ -17435,10 +17447,10 @@ class Qc extends Ke {
|
|
|
17435
17447
|
}
|
|
17436
17448
|
}
|
|
17437
17449
|
}
|
|
17438
|
-
class
|
|
17450
|
+
class Jc extends Ke {
|
|
17439
17451
|
type = "polygon";
|
|
17440
17452
|
build(e) {
|
|
17441
|
-
const t =
|
|
17453
|
+
const t = Fs(e.instance.points), i = Ns(t.localPoints), n = new bo(i);
|
|
17442
17454
|
n.computeBoundingBox();
|
|
17443
17455
|
const s = n.boundingBox ?? new R(new d(0, 0, 0), new d(1, 1, 1)), o = this.materialFactory.createSurfaceMaterial({
|
|
17444
17456
|
color: e.instance.style.fillColor ?? e.instance.style.color ?? "#7ffcff",
|
|
@@ -17458,7 +17470,7 @@ class $c extends Ke {
|
|
|
17458
17470
|
), e.animatedMaterials.push(o);
|
|
17459
17471
|
}
|
|
17460
17472
|
}
|
|
17461
|
-
class
|
|
17473
|
+
class eh extends Ke {
|
|
17462
17474
|
type = "polyline";
|
|
17463
17475
|
build(e) {
|
|
17464
17476
|
const t = e.instance.points.map((s) => J(s)), i = this.createSegmentCurve(t), n = this.createTubeMesh(
|
|
@@ -17472,7 +17484,7 @@ class Zc extends Ke {
|
|
|
17472
17484
|
e.instance.root.add(n), e.anchorCurve = i, e.panelAnchorPoint = i.getPoint(0.5);
|
|
17473
17485
|
}
|
|
17474
17486
|
}
|
|
17475
|
-
class
|
|
17487
|
+
class th extends Ke {
|
|
17476
17488
|
type = "ripplePoint";
|
|
17477
17489
|
/** 根据波纹参数创建中心点和错相扩散圆环。 */
|
|
17478
17490
|
build(e) {
|
|
@@ -17504,36 +17516,36 @@ class Jc extends Ke {
|
|
|
17504
17516
|
});
|
|
17505
17517
|
h.clippingPlanes = this.engine.sectionPlane;
|
|
17506
17518
|
const u = new z(
|
|
17507
|
-
new
|
|
17519
|
+
new es(Math.max(o - r, 1e-3), o, l),
|
|
17508
17520
|
h
|
|
17509
17521
|
);
|
|
17510
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);
|
|
17511
17523
|
}
|
|
17512
17524
|
}
|
|
17513
17525
|
}
|
|
17514
|
-
class
|
|
17526
|
+
class ih extends ji {
|
|
17515
17527
|
type = "textPoint";
|
|
17516
17528
|
/** 将文字点绑定到首个世界坐标。 */
|
|
17517
17529
|
build(e) {
|
|
17518
17530
|
this.buildDomAnchor(e);
|
|
17519
17531
|
}
|
|
17520
17532
|
}
|
|
17521
|
-
function
|
|
17533
|
+
function nh(a, e) {
|
|
17522
17534
|
return [
|
|
17523
|
-
new jc(a, e),
|
|
17524
|
-
new eh(a, e),
|
|
17525
|
-
new Yc(a, e),
|
|
17526
|
-
new Jc(a, e),
|
|
17527
|
-
new Qc(a, e),
|
|
17528
17535
|
new Xc(a, e),
|
|
17536
|
+
new ih(a, e),
|
|
17537
|
+
new Qc(a, e),
|
|
17538
|
+
new th(a, e),
|
|
17529
17539
|
new Zc(a, e),
|
|
17530
|
-
new qc(a, e),
|
|
17531
17540
|
new $c(a, e),
|
|
17532
|
-
new
|
|
17533
|
-
new
|
|
17541
|
+
new eh(a, e),
|
|
17542
|
+
new jc(a, e),
|
|
17543
|
+
new Jc(a, e),
|
|
17544
|
+
new Yc(a, e),
|
|
17545
|
+
new Kc(a, e)
|
|
17534
17546
|
];
|
|
17535
17547
|
}
|
|
17536
|
-
function
|
|
17548
|
+
function sh(a, e, t) {
|
|
17537
17549
|
const i = a.camera;
|
|
17538
17550
|
if (!i)
|
|
17539
17551
|
return !1;
|
|
@@ -17546,7 +17558,7 @@ function ih(a, e, t) {
|
|
|
17546
17558
|
const r = o.sort((l, c) => l.distance - c.distance)[0];
|
|
17547
17559
|
return !!(r && r.distance < s - 0.05);
|
|
17548
17560
|
}
|
|
17549
|
-
class
|
|
17561
|
+
class oh {
|
|
17550
17562
|
/** 归一化外部数据,并在创建几何前校验类型对应的必要输入。 */
|
|
17551
17563
|
normalizeData(e) {
|
|
17552
17564
|
const t = {
|
|
@@ -17680,7 +17692,7 @@ class nh {
|
|
|
17680
17692
|
offset: { ...e.offset ?? {} },
|
|
17681
17693
|
screenOffset: { ...e.screenOffset ?? {} },
|
|
17682
17694
|
className: e.className,
|
|
17683
|
-
style: { ...
|
|
17695
|
+
style: { ...kc, ...e.style ?? {} },
|
|
17684
17696
|
interactive: e.interactive ?? !0,
|
|
17685
17697
|
occlusion: e.occlusion ?? "show",
|
|
17686
17698
|
actions: e.actions
|
|
@@ -17719,11 +17731,11 @@ class nh {
|
|
|
17719
17731
|
}
|
|
17720
17732
|
}
|
|
17721
17733
|
}
|
|
17722
|
-
function
|
|
17734
|
+
function rh(a) {
|
|
17723
17735
|
const { actions: e, ...t } = a;
|
|
17724
17736
|
return t;
|
|
17725
17737
|
}
|
|
17726
|
-
function
|
|
17738
|
+
function ah(a) {
|
|
17727
17739
|
return {
|
|
17728
17740
|
id: a.instance.id,
|
|
17729
17741
|
type: a.instance.type,
|
|
@@ -17739,7 +17751,7 @@ function oh(a) {
|
|
|
17739
17751
|
function Gt(a) {
|
|
17740
17752
|
return a === void 0 ? a : JSON.parse(JSON.stringify(a));
|
|
17741
17753
|
}
|
|
17742
|
-
class
|
|
17754
|
+
class lh {
|
|
17743
17755
|
builders = /* @__PURE__ */ new Map();
|
|
17744
17756
|
constructor(e) {
|
|
17745
17757
|
e.forEach((t) => this.builders.set(t.type, t));
|
|
@@ -17751,8 +17763,8 @@ class rh {
|
|
|
17751
17763
|
t.build(e);
|
|
17752
17764
|
}
|
|
17753
17765
|
}
|
|
17754
|
-
const
|
|
17755
|
-
class
|
|
17766
|
+
const ch = /* @__PURE__ */ new Set(["iconPoint", "textPoint", "iconTextPoint"]);
|
|
17767
|
+
class hh {
|
|
17756
17768
|
constructor(e, t) {
|
|
17757
17769
|
this.markerRegistry = e, this.overlayController = t;
|
|
17758
17770
|
}
|
|
@@ -17767,7 +17779,7 @@ class lh {
|
|
|
17767
17779
|
selectable: e.selectable ?? !0,
|
|
17768
17780
|
style: e.style,
|
|
17769
17781
|
effect: e.effect ?? {},
|
|
17770
|
-
panel: e.panel ?
|
|
17782
|
+
panel: e.panel ? rh(e.panel) : void 0,
|
|
17771
17783
|
data: e.data,
|
|
17772
17784
|
panelVisible: e.panel?.trigger === "always",
|
|
17773
17785
|
hovered: !1,
|
|
@@ -17776,37 +17788,37 @@ class lh {
|
|
|
17776
17788
|
instance: i,
|
|
17777
17789
|
actions: e.panel?.actions,
|
|
17778
17790
|
panelElement: e.panel ? this.overlayController.createPanelElement(i, e.panel) : null,
|
|
17779
|
-
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,
|
|
17780
17792
|
timeSeed: Math.random() * Math.PI * 2,
|
|
17781
17793
|
pulseMaterials: [],
|
|
17782
17794
|
rippleMeshes: [],
|
|
17783
17795
|
baseRingMeshes: [],
|
|
17784
17796
|
animatedMaterials: []
|
|
17785
17797
|
};
|
|
17786
|
-
return this.markerRegistry.build(n),
|
|
17798
|
+
return this.markerRegistry.build(n), zc(t, i.id), n;
|
|
17787
17799
|
}
|
|
17788
17800
|
}
|
|
17789
|
-
class
|
|
17801
|
+
class dh {
|
|
17790
17802
|
engine;
|
|
17791
17803
|
rootGroup;
|
|
17792
17804
|
records = /* @__PURE__ */ new Map();
|
|
17793
17805
|
occlusionRaycaster = new me();
|
|
17794
|
-
normalizer = new
|
|
17806
|
+
normalizer = new oh();
|
|
17795
17807
|
materialFactory;
|
|
17796
17808
|
overlayController;
|
|
17797
17809
|
interactionController;
|
|
17798
17810
|
effectsController;
|
|
17799
|
-
visibilityController = new
|
|
17811
|
+
visibilityController = new Gc();
|
|
17800
17812
|
markerRegistry;
|
|
17801
17813
|
recordFactory;
|
|
17802
17814
|
currentTime = 0;
|
|
17803
17815
|
constructor(e) {
|
|
17804
|
-
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(
|
|
17805
17817
|
this.engine,
|
|
17806
|
-
(t) =>
|
|
17807
|
-
), this.markerRegistry = new
|
|
17808
|
-
|
|
17809
|
-
), 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({
|
|
17810
17822
|
engine: this.engine,
|
|
17811
17823
|
rootGroup: this.rootGroup,
|
|
17812
17824
|
records: this.records,
|
|
@@ -17907,7 +17919,7 @@ class ch {
|
|
|
17907
17919
|
return this.update(e, { panel: n });
|
|
17908
17920
|
}
|
|
17909
17921
|
getData() {
|
|
17910
|
-
return Array.from(this.records.values()).map((e) =>
|
|
17922
|
+
return Array.from(this.records.values()).map((e) => ah(e));
|
|
17911
17923
|
}
|
|
17912
17924
|
restoreData(e) {
|
|
17913
17925
|
this.clear(), e.forEach((t) => this.add(t));
|
|
@@ -17925,7 +17937,7 @@ class ch {
|
|
|
17925
17937
|
}
|
|
17926
17938
|
removeInternal(e, t) {
|
|
17927
17939
|
const i = this.records.get(e);
|
|
17928
|
-
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;
|
|
17929
17941
|
}
|
|
17930
17942
|
toEventPayload(e, t) {
|
|
17931
17943
|
return { id: e.instance.id, annotation: e.instance, originalEvent: t };
|
|
@@ -18260,15 +18272,15 @@ class dt {
|
|
|
18260
18272
|
return "x" in e ? new d(e.x, e.y, e.z) : new d(e.X, e.Y, e.Z);
|
|
18261
18273
|
}
|
|
18262
18274
|
}
|
|
18263
|
-
const
|
|
18264
|
-
class
|
|
18275
|
+
const uh = 1e-3, ph = 0.65, mh = 1;
|
|
18276
|
+
class gh {
|
|
18265
18277
|
engine;
|
|
18266
18278
|
loader;
|
|
18267
18279
|
dracoLoader;
|
|
18268
18280
|
dracoDecoderPath;
|
|
18269
18281
|
modelList = /* @__PURE__ */ new Map();
|
|
18270
18282
|
modelTransforms = [];
|
|
18271
|
-
animationTimer = new
|
|
18283
|
+
animationTimer = new qn();
|
|
18272
18284
|
transformControl = null;
|
|
18273
18285
|
transformHelper = null;
|
|
18274
18286
|
selectedModelId = null;
|
|
@@ -18426,13 +18438,13 @@ class ph {
|
|
|
18426
18438
|
const l = t ? `“${t}”` : "默认动画";
|
|
18427
18439
|
throw new Error(`播放模型动画失败:模型 “${e}” 不存在${l}。`);
|
|
18428
18440
|
}
|
|
18429
|
-
(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) => {
|
|
18430
18442
|
n.actions.forEach((c, h) => {
|
|
18431
18443
|
c === l.action && n.actions.delete(h);
|
|
18432
18444
|
});
|
|
18433
18445
|
}));
|
|
18434
18446
|
const o = n.mixer.clipAction(s);
|
|
18435
|
-
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);
|
|
18436
18448
|
const r = i.fadeIn ?? 0;
|
|
18437
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 };
|
|
18438
18450
|
}
|
|
@@ -18525,7 +18537,7 @@ class ph {
|
|
|
18525
18537
|
}
|
|
18526
18538
|
/** 创建独立解码器实例,便于管理器销毁或切换资源目录时释放 worker。 */
|
|
18527
18539
|
createDracoLoader(e) {
|
|
18528
|
-
const t = new
|
|
18540
|
+
const t = new Zn();
|
|
18529
18541
|
return t.setDecoderPath(e), t;
|
|
18530
18542
|
}
|
|
18531
18543
|
resolveDracoDecoderPath(e) {
|
|
@@ -18573,7 +18585,7 @@ class ph {
|
|
|
18573
18585
|
}
|
|
18574
18586
|
/** 透视相机使用更小的屏幕尺寸系数,正交相机维持原有尺寸。 */
|
|
18575
18587
|
syncTransformControlCamera() {
|
|
18576
|
-
!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);
|
|
18577
18589
|
}
|
|
18578
18590
|
/** 使用引擎统一的捕捉器等待用户单击,并在取消或完成后恢复常规交互。 */
|
|
18579
18591
|
pickPlacementPoint(e, t) {
|
|
@@ -18612,7 +18624,7 @@ class ph {
|
|
|
18612
18624
|
const i = t.clone(), n = e?.normal ?? e?.face?.normal;
|
|
18613
18625
|
if (n == null) return { position: i, normal: null };
|
|
18614
18626
|
const s = n.clone(), o = e?.matrix ?? e?.object?.matrixWorld;
|
|
18615
|
-
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 });
|
|
18616
18628
|
}
|
|
18617
18629
|
handlePointerDown(e) {
|
|
18618
18630
|
if (!(!this.editingEnabled || !this.engine.camera || !this.engine.renderer)) {
|
|
@@ -18770,7 +18782,7 @@ class vi extends Error {
|
|
|
18770
18782
|
super("模型对比已取消"), this.name = "ModelComparisonCancelledError";
|
|
18771
18783
|
}
|
|
18772
18784
|
}
|
|
18773
|
-
class
|
|
18785
|
+
class fh {
|
|
18774
18786
|
constructor(e) {
|
|
18775
18787
|
this.engine = e;
|
|
18776
18788
|
}
|
|
@@ -19208,8 +19220,8 @@ class mh {
|
|
|
19208
19220
|
});
|
|
19209
19221
|
}
|
|
19210
19222
|
}
|
|
19211
|
-
const
|
|
19212
|
-
class
|
|
19223
|
+
const Hn = "__modelExplodeProxy", Vn = new H().makeScale(0, 0, 0);
|
|
19224
|
+
class yh {
|
|
19213
19225
|
engine;
|
|
19214
19226
|
/** 当前是否处于炸开模式;供外部滑块、交互模块判断是否需要走代理逻辑。 */
|
|
19215
19227
|
active = !1;
|
|
@@ -19350,7 +19362,7 @@ class gh {
|
|
|
19350
19362
|
* 从命中的代理对象还原真实构件 ID,避免 Object3D.name 字符串化造成 nodesMap 查询失败。
|
|
19351
19363
|
*/
|
|
19352
19364
|
getObjectComponentId(e) {
|
|
19353
|
-
return e?.userData?.[
|
|
19365
|
+
return e?.userData?.[Hn] === !0 ? e.userData.componentId : null;
|
|
19354
19366
|
}
|
|
19355
19367
|
/**
|
|
19356
19368
|
* 返回炸开后用于悬浮高亮的代理网格。
|
|
@@ -19504,7 +19516,7 @@ class gh {
|
|
|
19504
19516
|
}
|
|
19505
19517
|
/** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
|
|
19506
19518
|
assignProxyIdentity(e, t, i) {
|
|
19507
|
-
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;
|
|
19508
19520
|
}
|
|
19509
19521
|
/**
|
|
19510
19522
|
* 隐藏源渲染片段,避免与代理对象重复显示。
|
|
@@ -19512,7 +19524,7 @@ class gh {
|
|
|
19512
19524
|
*/
|
|
19513
19525
|
hideSource(e) {
|
|
19514
19526
|
if (e.kind === "instance") {
|
|
19515
|
-
e.sourceMesh.setMatrixAt(e.subIndex,
|
|
19527
|
+
e.sourceMesh.setMatrixAt(e.subIndex, Vn), e.sourceMesh.instanceMatrix.needsUpdate = !0;
|
|
19516
19528
|
return;
|
|
19517
19529
|
}
|
|
19518
19530
|
this.ensureSplitState(e);
|
|
@@ -19532,7 +19544,7 @@ class gh {
|
|
|
19532
19544
|
*/
|
|
19533
19545
|
restoreSource(e) {
|
|
19534
19546
|
if (e.kind === "instance") {
|
|
19535
|
-
const s = this.shouldKeepOriginalInstanceHidden(e) ?
|
|
19547
|
+
const s = this.shouldKeepOriginalInstanceHidden(e) ? Vn : e.originalMatrix;
|
|
19536
19548
|
s instanceof H && (e.sourceMesh.setMatrixAt(e.subIndex, s), e.sourceMesh.instanceMatrix.needsUpdate = !0);
|
|
19537
19549
|
return;
|
|
19538
19550
|
}
|
|
@@ -19736,7 +19748,7 @@ class gh {
|
|
|
19736
19748
|
return Math.abs(i);
|
|
19737
19749
|
}
|
|
19738
19750
|
}
|
|
19739
|
-
const
|
|
19751
|
+
const Un = "bim-material-editor-style", st = [
|
|
19740
19752
|
"map",
|
|
19741
19753
|
"normalMap",
|
|
19742
19754
|
"roughnessMap",
|
|
@@ -19755,7 +19767,7 @@ const Hn = "bim-material-editor-style", st = [
|
|
|
19755
19767
|
bumpMap: "凹凸贴图",
|
|
19756
19768
|
emissiveMap: "自发光贴图"
|
|
19757
19769
|
};
|
|
19758
|
-
class
|
|
19770
|
+
class Mh {
|
|
19759
19771
|
constructor(e) {
|
|
19760
19772
|
this.engine = e;
|
|
19761
19773
|
}
|
|
@@ -19841,7 +19853,7 @@ function si(a) {
|
|
|
19841
19853
|
function xi(a) {
|
|
19842
19854
|
return a.map((e) => e.name || e.url || e.type || e.uuid).filter((e, t, i) => e.length > 0 && i.indexOf(e) === t);
|
|
19843
19855
|
}
|
|
19844
|
-
function
|
|
19856
|
+
function Hs(a) {
|
|
19845
19857
|
const e = {
|
|
19846
19858
|
name: a.name,
|
|
19847
19859
|
opacity: a.opacity,
|
|
@@ -19861,7 +19873,7 @@ function Fs(a) {
|
|
|
19861
19873
|
function yt(a) {
|
|
19862
19874
|
return a instanceof Ie ? si(a) || a.uuid : a;
|
|
19863
19875
|
}
|
|
19864
|
-
function
|
|
19876
|
+
function vh(a) {
|
|
19865
19877
|
const e = a, t = {
|
|
19866
19878
|
type: a.type,
|
|
19867
19879
|
name: a.name || a.type,
|
|
@@ -19877,8 +19889,8 @@ function yh(a) {
|
|
|
19877
19889
|
i in e && (t[i] = yt(e[i]) ?? null);
|
|
19878
19890
|
}), JSON.stringify(t);
|
|
19879
19891
|
}
|
|
19880
|
-
function
|
|
19881
|
-
const t =
|
|
19892
|
+
function xh(a, e) {
|
|
19893
|
+
const t = Hs(a), i = {};
|
|
19882
19894
|
return Object.entries(e.values).forEach(([n, s]) => {
|
|
19883
19895
|
const o = t[n];
|
|
19884
19896
|
yt(s) !== yt(o) && (i[n] = {
|
|
@@ -19887,7 +19899,7 @@ function Mh(a, e) {
|
|
|
19887
19899
|
});
|
|
19888
19900
|
}), i;
|
|
19889
19901
|
}
|
|
19890
|
-
function
|
|
19902
|
+
function Vs(a, e, t) {
|
|
19891
19903
|
const i = a;
|
|
19892
19904
|
if ((e === "color" || e === "emissive") && i[e] instanceof xe && typeof t == "string") {
|
|
19893
19905
|
i[e].set(t);
|
|
@@ -19922,7 +19934,7 @@ function qt(a) {
|
|
|
19922
19934
|
}))
|
|
19923
19935
|
};
|
|
19924
19936
|
}
|
|
19925
|
-
class
|
|
19937
|
+
class wh {
|
|
19926
19938
|
constructor(e, t) {
|
|
19927
19939
|
this.engine = e, this.host = t;
|
|
19928
19940
|
}
|
|
@@ -20076,7 +20088,7 @@ class vh {
|
|
|
20076
20088
|
createSideSelect(e, t) {
|
|
20077
20089
|
const i = this.createElement("div", "bim-material-editor__row"), n = document.createElement("select");
|
|
20078
20090
|
return [
|
|
20079
|
-
{ label: "正面", value:
|
|
20091
|
+
{ label: "正面", value: Ao },
|
|
20080
20092
|
{ label: "背面", value: Oi },
|
|
20081
20093
|
{ label: "双面", value: re }
|
|
20082
20094
|
].forEach((s) => {
|
|
@@ -20093,10 +20105,10 @@ class vh {
|
|
|
20093
20105
|
return t && (n.className = t), i && (n.textContent = i), n;
|
|
20094
20106
|
}
|
|
20095
20107
|
ensureStyle() {
|
|
20096
|
-
if (document.getElementById(
|
|
20108
|
+
if (document.getElementById(Un) != null)
|
|
20097
20109
|
return;
|
|
20098
20110
|
const e = document.createElement("style");
|
|
20099
|
-
e.id =
|
|
20111
|
+
e.id = Un, e.textContent = `
|
|
20100
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}
|
|
20101
20113
|
.bim-material-editor *{box-sizing:border-box}
|
|
20102
20114
|
.bim-material-editor__header{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
@@ -20129,7 +20141,7 @@ class vh {
|
|
|
20129
20141
|
`, document.head.appendChild(e);
|
|
20130
20142
|
}
|
|
20131
20143
|
}
|
|
20132
|
-
class
|
|
20144
|
+
class bh {
|
|
20133
20145
|
constructor(e) {
|
|
20134
20146
|
this.collectSceneMaterials = e;
|
|
20135
20147
|
}
|
|
@@ -20150,7 +20162,7 @@ class xh {
|
|
|
20150
20162
|
name: e.name,
|
|
20151
20163
|
type: e.type,
|
|
20152
20164
|
objectNames: xi(t),
|
|
20153
|
-
values:
|
|
20165
|
+
values: Hs(e)
|
|
20154
20166
|
});
|
|
20155
20167
|
}
|
|
20156
20168
|
getModifiedMaterials() {
|
|
@@ -20160,7 +20172,7 @@ class xh {
|
|
|
20160
20172
|
const i = this.baselineSnapshots.get(t.material.uuid);
|
|
20161
20173
|
if (i == null)
|
|
20162
20174
|
return;
|
|
20163
|
-
const n =
|
|
20175
|
+
const n = xh(t.material, i);
|
|
20164
20176
|
Object.keys(n).length !== 0 && e.push({
|
|
20165
20177
|
id: t.material.uuid,
|
|
20166
20178
|
name: t.material.name || i.name,
|
|
@@ -20173,17 +20185,17 @@ class xh {
|
|
|
20173
20185
|
restore(e) {
|
|
20174
20186
|
const t = this.baselineSnapshots.get(e.uuid);
|
|
20175
20187
|
return t == null ? !1 : (Object.entries(t.values).forEach(([i, n]) => {
|
|
20176
|
-
|
|
20188
|
+
Vs(e, i, n);
|
|
20177
20189
|
}), e.needsUpdate = !0, !0);
|
|
20178
20190
|
}
|
|
20179
20191
|
}
|
|
20180
|
-
class
|
|
20192
|
+
class Ch {
|
|
20181
20193
|
constructor(e, t = {}) {
|
|
20182
20194
|
this.engine = e, this.options = {
|
|
20183
20195
|
visible: t.visible ?? !1,
|
|
20184
20196
|
title: t.title ?? "材质编辑器",
|
|
20185
20197
|
width: t.width ?? 340
|
|
20186
|
-
}, 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);
|
|
20187
20199
|
}
|
|
20188
20200
|
options;
|
|
20189
20201
|
selectedMaterials = [];
|
|
@@ -20266,7 +20278,7 @@ class wh {
|
|
|
20266
20278
|
const i = this.findMaterialGroupById(e);
|
|
20267
20279
|
i.length !== 0 && (i.forEach((n) => {
|
|
20268
20280
|
this.snapshots.ensure(n, this.collector.findOwners(n)), Object.entries(t).forEach(([s, o]) => {
|
|
20269
|
-
|
|
20281
|
+
Vs(n, s, o);
|
|
20270
20282
|
}), n.needsUpdate = !0;
|
|
20271
20283
|
}), this.requestRender(), this.render());
|
|
20272
20284
|
}
|
|
@@ -20325,7 +20337,7 @@ class wh {
|
|
|
20325
20337
|
dedupeMaterials(e) {
|
|
20326
20338
|
const t = /* @__PURE__ */ new Map();
|
|
20327
20339
|
return e.forEach((i) => {
|
|
20328
|
-
const n =
|
|
20340
|
+
const n = vh(i.material), s = t.get(n);
|
|
20329
20341
|
if (s == null) {
|
|
20330
20342
|
t.set(n, { material: i.material, materials: [i.material], owners: [...i.owners] });
|
|
20331
20343
|
return;
|
|
@@ -20351,7 +20363,7 @@ class wh {
|
|
|
20351
20363
|
}
|
|
20352
20364
|
replaceTexture(e, t, i) {
|
|
20353
20365
|
const n = e, s = n[t];
|
|
20354
|
-
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();
|
|
20355
20367
|
}
|
|
20356
20368
|
loadTexture(e) {
|
|
20357
20369
|
return new Promise((t, i) => {
|
|
@@ -20365,7 +20377,7 @@ class wh {
|
|
|
20365
20377
|
this.ownedTextures.forEach((e) => e.dispose()), this.ownedTextures.clear();
|
|
20366
20378
|
}
|
|
20367
20379
|
}
|
|
20368
|
-
class
|
|
20380
|
+
class Eh {
|
|
20369
20381
|
engine;
|
|
20370
20382
|
codeMap = [];
|
|
20371
20383
|
continusIds = /* @__PURE__ */ new Map();
|
|
@@ -20466,16 +20478,16 @@ const Kt = {
|
|
|
20466
20478
|
sampleCount: 64,
|
|
20467
20479
|
roundedRadius: 1,
|
|
20468
20480
|
historyLimit: 100
|
|
20469
|
-
},
|
|
20481
|
+
}, Ah = {
|
|
20470
20482
|
bezier: "贝塞尔曲线",
|
|
20471
20483
|
straight: "直线",
|
|
20472
20484
|
rounded: "圆角直线"
|
|
20473
|
-
},
|
|
20485
|
+
}, Sh = {
|
|
20474
20486
|
bezier: "∿",
|
|
20475
20487
|
straight: "╱",
|
|
20476
20488
|
rounded: "⌁"
|
|
20477
20489
|
};
|
|
20478
|
-
class
|
|
20490
|
+
class Ph {
|
|
20479
20491
|
type = "path-draw";
|
|
20480
20492
|
engine;
|
|
20481
20493
|
root = new pe();
|
|
@@ -20709,10 +20721,10 @@ class Ah {
|
|
|
20709
20721
|
}
|
|
20710
20722
|
/** 使用 Line2 保证 WebGL 环境下的像素线宽真实生效。 */
|
|
20711
20723
|
updateLineObject(e, t, i) {
|
|
20712
|
-
const n = new
|
|
20724
|
+
const n = new Po();
|
|
20713
20725
|
if (n.setPositions(t.flatMap((r) => [r.x, r.y, r.z])), e)
|
|
20714
20726
|
return e.geometry.dispose(), e.geometry = n, e.computeLineDistances(), this.syncLineResolution(e), this.requestRender(), e;
|
|
20715
|
-
const s = new
|
|
20727
|
+
const s = new To({
|
|
20716
20728
|
color: i ? this.options.previewColor : this.options.lineColor,
|
|
20717
20729
|
linewidth: this.options.lineWidth,
|
|
20718
20730
|
dashed: i,
|
|
@@ -20721,7 +20733,7 @@ class Ah {
|
|
|
20721
20733
|
depthTest: !1,
|
|
20722
20734
|
transparent: i,
|
|
20723
20735
|
opacity: i ? 0.82 : 1
|
|
20724
|
-
}), o = new
|
|
20736
|
+
}), o = new Io(n, s);
|
|
20725
20737
|
return o.name = i ? "PathDrawPreviewLine" : "PathDrawLine", o.renderOrder = i ? 1001 : 1e3, o.computeLineDistances(), this.syncLineResolution(o), this.root.add(o), this.requestRender(), o;
|
|
20726
20738
|
}
|
|
20727
20739
|
syncLineResolution(e) {
|
|
@@ -20841,7 +20853,7 @@ class Ah {
|
|
|
20841
20853
|
t.append(i, n, s), e.appendChild(t), this.statusElement = n;
|
|
20842
20854
|
const o = document.createElement("div");
|
|
20843
20855
|
Object.assign(o.style, { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "4px", padding: "8px" }), ["bezier", "straight", "rounded"].forEach((x) => {
|
|
20844
|
-
const m = this.createIconButton(
|
|
20856
|
+
const m = this.createIconButton(Sh[x], Ah[x], () => this.setLineType(x));
|
|
20845
20857
|
m.dataset.lineType = x, m.style.width = "100%", m.style.fontSize = "18px", o.appendChild(m);
|
|
20846
20858
|
}), e.appendChild(o);
|
|
20847
20859
|
const r = document.createElement("label");
|
|
@@ -20959,7 +20971,7 @@ class Ah {
|
|
|
20959
20971
|
return { x: e.x, y: e.y, z: e.z };
|
|
20960
20972
|
}
|
|
20961
20973
|
}
|
|
20962
|
-
class
|
|
20974
|
+
class Th {
|
|
20963
20975
|
engine;
|
|
20964
20976
|
continusIds = /* @__PURE__ */ new Map();
|
|
20965
20977
|
constructor(e) {
|
|
@@ -21018,27 +21030,27 @@ class Sh {
|
|
|
21018
21030
|
});
|
|
21019
21031
|
}
|
|
21020
21032
|
}
|
|
21021
|
-
const
|
|
21022
|
-
maxTextureSize:
|
|
21033
|
+
const Ih = Object.freeze({
|
|
21034
|
+
maxTextureSize: 2,
|
|
21023
21035
|
samples: 0,
|
|
21024
21036
|
restrictTextureSize: !0
|
|
21025
|
-
}),
|
|
21026
|
-
maxTextureSize:
|
|
21037
|
+
}), _h = Object.freeze({
|
|
21038
|
+
maxTextureSize: 4096,
|
|
21027
21039
|
samples: 4,
|
|
21028
21040
|
restrictTextureSize: !0
|
|
21029
|
-
}),
|
|
21030
|
-
maxTextureSize:
|
|
21041
|
+
}), Dh = Object.freeze({
|
|
21042
|
+
maxTextureSize: 10240,
|
|
21031
21043
|
samples: 4,
|
|
21032
21044
|
restrictTextureSize: !0
|
|
21033
|
-
}),
|
|
21034
|
-
maxTextureSize:
|
|
21045
|
+
}), kh = Object.freeze({
|
|
21046
|
+
maxTextureSize: 10240,
|
|
21035
21047
|
samples: 4,
|
|
21036
21048
|
restrictTextureSize: !1
|
|
21037
21049
|
});
|
|
21038
|
-
function
|
|
21039
|
-
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;
|
|
21040
21052
|
}
|
|
21041
|
-
class
|
|
21053
|
+
class Fh {
|
|
21042
21054
|
// 引擎参数
|
|
21043
21055
|
options;
|
|
21044
21056
|
mobileMemoryProfile;
|
|
@@ -21155,22 +21167,22 @@ class Rh {
|
|
|
21155
21167
|
// 业务数据
|
|
21156
21168
|
models = [];
|
|
21157
21169
|
reactBoundingClientRect = { left: 0, top: 0 };
|
|
21158
|
-
version =
|
|
21170
|
+
version = Bo;
|
|
21159
21171
|
versionEl = null;
|
|
21160
21172
|
// 引擎容器
|
|
21161
21173
|
container;
|
|
21162
21174
|
constructor(e) {
|
|
21163
|
-
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)
|
|
21164
21176
|
throw new Error(`Container ${e.containerId} not found`);
|
|
21165
|
-
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) {
|
|
21166
21178
|
const o = this.renderer;
|
|
21167
21179
|
o.interactionCullingEnabled = !0, o.interactionActive = !1, o.interactionRenderScene = this.scene, o.interactionFrameBudgetMs = this.options.interactionFrameBudgetMs ?? 6, o.interactionSkipShadows = this.options.interactionSkipShadows ?? !0;
|
|
21168
21180
|
}
|
|
21169
|
-
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();
|
|
21170
21182
|
const t = this.events.trigger.bind(this.events);
|
|
21171
21183
|
this.events.trigger = ((o, r) => {
|
|
21172
21184
|
t(o, r), String(o) !== String(ne.EngineBusy) && this.requestComposerRender();
|
|
21173
|
-
}), 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));
|
|
21174
21186
|
let i = document.createElement("div");
|
|
21175
21187
|
i.className = "versionText", this.versionEl = i, this.updateVersionDisplay(), this.container.appendChild(i);
|
|
21176
21188
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
@@ -21286,7 +21298,7 @@ class Rh {
|
|
|
21286
21298
|
* 解析得到多个模型地址时,共用同一份加载选项,包括是否加载边线。
|
|
21287
21299
|
*/
|
|
21288
21300
|
async loadModelByViewToken(e, t) {
|
|
21289
|
-
const i = await
|
|
21301
|
+
const i = await zo(
|
|
21290
21302
|
this.options,
|
|
21291
21303
|
e,
|
|
21292
21304
|
"3d"
|
|
@@ -21396,7 +21408,7 @@ class Rh {
|
|
|
21396
21408
|
const i = this.getViewportSize(e, t);
|
|
21397
21409
|
e = i.width, t = i.height;
|
|
21398
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?.();
|
|
21399
|
-
this.renderer.setPixelRatio(
|
|
21411
|
+
this.renderer.setPixelRatio(ts(this)), this.renderer.setSize(e, t, !1);
|
|
21400
21412
|
const c = this.renderer.domElement.clientWidth || e, h = this.renderer.domElement.clientHeight || t;
|
|
21401
21413
|
if (!c || !h)
|
|
21402
21414
|
return;
|
|
@@ -21463,7 +21475,7 @@ class Rh {
|
|
|
21463
21475
|
if (!e) return;
|
|
21464
21476
|
[...e.children].forEach((i) => {
|
|
21465
21477
|
this.clearScene(i);
|
|
21466
|
-
}), 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?.();
|
|
21467
21479
|
}
|
|
21468
21480
|
/**
|
|
21469
21481
|
* 清理材质及其纹理
|
|
@@ -21518,6 +21530,6 @@ class Rh {
|
|
|
21518
21530
|
}
|
|
21519
21531
|
}
|
|
21520
21532
|
export {
|
|
21521
|
-
|
|
21522
|
-
|
|
21533
|
+
Fh as E,
|
|
21534
|
+
Ch as M
|
|
21523
21535
|
};
|