u-space 0.0.21 → 0.0.22
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.
- package/dist/index.cjs +3 -3
- package/dist/index.js +415 -383
- package/dist/plugins/tiles/ArcgisTilesRenderer.d.ts +1 -0
- package/dist/plugins/tiles/index.cjs +1 -1
- package/dist/plugins/tiles/index.js +60 -57
- package/dist/src/viewers/Info.d.ts +1 -0
- package/docs/api-plugin-tiles.md +1 -1
- package/docs/changelog.md +9 -1
- package/docs/examples-guide.md +6 -0
- package/docs/getting-started.md +1 -1
- package/docs/mcp.md +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Raycaster as
|
|
2
|
-
import { pass as
|
|
1
|
+
import { Raycaster as Le, Vector2 as C, EventDispatcher as Re, Box2 as st, Matrix4 as Ie, Vector3 as w, Box3 as q, Scene as ze, Color as M, AmbientLight as nt, DirectionalLight as me, PointLight as fe, SpotLight as ge, HemisphereLight as ye, DirectionalLightHelper as it, PointLightHelper as rt, SpotLightHelper as at, HemisphereLightHelper as ot, RenderPipeline as ct, PerspectiveCamera as V, Sphere as Ne, Spherical as S, Quaternion as ht, Vector4 as lt, MathUtils as dt, PMREMGenerator as pt, OrthographicCamera as Z, TimestampQuery as Y, Cache as ut, Timer as mt, WebGPURenderer as ft, PCFShadowMap as gt, AgXToneMapping as yt, Fog as wt, FogExp2 as vt, MeshStandardNodeMaterial as I, Loader as bt, LoaderUtils as L, FileLoader as je, TextureLoader as De, Group as R, SRGBColorSpace as ke, RepeatWrapping as we, BufferGeometry as K, BufferAttribute as ve, Mesh as D, FrontSide as xt, BackSide as Ct, DoubleSide as St, REVISION as be, CubeTextureLoader as Mt, EquirectangularReflectionMapping as Tt, Sprite as _t, AnimationMixer as Et, LoopRepeat as Pt, LoopOnce as Ot, SphereGeometry as At, TubeGeometry as Bt, LineCurve3 as Lt, CatmullRomCurve3 as Rt, SpriteNodeMaterial as It, CanvasTexture as zt, ShapeGeometry as Nt, Shape as Ue, ExtrudeGeometry as jt, PlaneGeometry as Dt, CircleGeometry as kt, ClippingGroup as Ut, Plane as Ht, PlaneHelper as Ft, LineBasicMaterial as ee, Line as te } from "three/webgpu";
|
|
2
|
+
import { pass as pe, mrt as Gt, output as $t, add as xe, blendColor as Wt, emissive as Kt, normalView as Qt, velocity as qt, color as H, uv as Ce, time as se, pow as ne, sin as ue, mix as ie, mx_noise_float as Se, Fn as He, userData as B, materialColor as Me, select as re, materialOpacity as Xt, vec3 as Yt } from "three/tsl";
|
|
3
3
|
import { bloom as Jt } from "three/addons/tsl/display/BloomNode.js";
|
|
4
4
|
import { ssgi as Vt } from "three/addons/tsl/display/SSGINode.js";
|
|
5
5
|
import { traa as Zt } from "three/addons/tsl/display/TRAANode.js";
|
|
6
|
-
import
|
|
6
|
+
import Fe from "camera-controls";
|
|
7
7
|
import { RoomEnvironment as es } from "three/addons/environments/RoomEnvironment.js";
|
|
8
8
|
import { ViewHelper as ts } from "three/addons/helpers/ViewHelper.js";
|
|
9
9
|
import { CSS2DRenderer as ss, CSS2DObject as ns } from "three/addons/renderers/CSS2DRenderer.js";
|
|
10
|
-
import { CSS2DObject as
|
|
11
|
-
import { CSS3DRenderer as is, CSS3DSprite as rs, CSS3DObject as
|
|
12
|
-
import { CSS3DObject as
|
|
13
|
-
import { GLTFLoader as
|
|
14
|
-
import { FBXLoader as
|
|
10
|
+
import { CSS2DObject as jn } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
+
import { CSS3DRenderer as is, CSS3DSprite as rs, CSS3DObject as as } from "three/addons/renderers/CSS3DRenderer.js";
|
|
12
|
+
import { CSS3DObject as kn, CSS3DSprite as Un } from "three/addons/renderers/CSS3DRenderer.js";
|
|
13
|
+
import { GLTFLoader as Ge } from "three/addons/loaders/GLTFLoader.js";
|
|
14
|
+
import { FBXLoader as os } from "three/addons/loaders/FBXLoader.js";
|
|
15
15
|
import { OBJLoader as cs } from "three/addons/loaders/OBJLoader.js";
|
|
16
16
|
import { STLLoader as hs } from "three/addons/loaders/STLLoader.js";
|
|
17
17
|
import { DRACOLoader as ls } from "three/addons/loaders/DRACOLoader.js";
|
|
18
18
|
import { KTX2Loader as ds } from "three/addons/loaders/KTX2Loader.js";
|
|
19
|
-
import { MeshoptDecoder as
|
|
19
|
+
import { MeshoptDecoder as Te } from "three/addons/libs/meshopt_decoder.module.js";
|
|
20
20
|
import { HDRLoader as ps } from "three/addons/loaders/HDRLoader.js";
|
|
21
21
|
import { clone as us } from "three/addons/utils/SkeletonUtils.js";
|
|
22
22
|
import { Easing as m, Tween as ms } from "three/addons/libs/tween.module.js";
|
|
@@ -52,7 +52,7 @@ class gs {
|
|
|
52
52
|
domElement;
|
|
53
53
|
scene;
|
|
54
54
|
camera;
|
|
55
|
-
raycaster = new
|
|
55
|
+
raycaster = new Le();
|
|
56
56
|
pointer = new C();
|
|
57
57
|
hoveredObject = null;
|
|
58
58
|
pointerDownTime = 0;
|
|
@@ -205,7 +205,7 @@ class gs {
|
|
|
205
205
|
this.domElement.removeEventListener("click", this._onClick), this.domElement.removeEventListener("dblclick", this._onDblClick), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this.hoveredObject = null, this._excludeSet.clear();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
class
|
|
208
|
+
class bn extends Re {
|
|
209
209
|
scene;
|
|
210
210
|
camera;
|
|
211
211
|
domElement;
|
|
@@ -321,21 +321,21 @@ class vn extends Le {
|
|
|
321
321
|
), i = new C(
|
|
322
322
|
this._endPoint.x / t * 2 - 1,
|
|
323
323
|
-(this._endPoint.y / s) * 2 + 1
|
|
324
|
-
), r = new
|
|
324
|
+
), r = new st(
|
|
325
325
|
new C(Math.min(n.x, i.x), Math.min(n.y, i.y)),
|
|
326
326
|
new C(Math.max(n.x, i.x), Math.max(n.y, i.y))
|
|
327
|
-
),
|
|
327
|
+
), a = this.targetObjects || this.scene.children, o = [], c = new Ie();
|
|
328
328
|
c.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
329
329
|
const l = (d) => {
|
|
330
330
|
if (!d.visible) return;
|
|
331
331
|
const p = new w();
|
|
332
|
-
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new C(p.x, p.y)) &&
|
|
332
|
+
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new C(p.x, p.y)) && o.push(d), this._deep)
|
|
333
333
|
for (const u of d.children)
|
|
334
334
|
l(u);
|
|
335
335
|
};
|
|
336
|
-
for (const d of
|
|
336
|
+
for (const d of a)
|
|
337
337
|
l(d);
|
|
338
|
-
return
|
|
338
|
+
return o;
|
|
339
339
|
}
|
|
340
340
|
dispose() {
|
|
341
341
|
this.disableBoxSelection(), this._selected.clear();
|
|
@@ -475,15 +475,15 @@ class ys {
|
|
|
475
475
|
const i = n.material;
|
|
476
476
|
if (!i) return;
|
|
477
477
|
const r = Array.isArray(i) ? i : [i];
|
|
478
|
-
for (const
|
|
479
|
-
|
|
478
|
+
for (const a of r)
|
|
479
|
+
a.transparent = t < 1, a.opacity = t, a.needsUpdate = !0;
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
/**
|
|
483
483
|
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
484
484
|
*/
|
|
485
485
|
getBoundingBox(e) {
|
|
486
|
-
const t = new
|
|
486
|
+
const t = new q();
|
|
487
487
|
if (e) {
|
|
488
488
|
const s = this.idMap.get(e);
|
|
489
489
|
s && t.setFromObject(s);
|
|
@@ -518,7 +518,7 @@ class ys {
|
|
|
518
518
|
e.visible = !0;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
class
|
|
521
|
+
class xn {
|
|
522
522
|
scenes = /* @__PURE__ */ new Map();
|
|
523
523
|
_activeSceneKey = null;
|
|
524
524
|
/**
|
|
@@ -531,7 +531,7 @@ class bn {
|
|
|
531
531
|
* Create and register a new scene.
|
|
532
532
|
*/
|
|
533
533
|
create(e, t = {}) {
|
|
534
|
-
const s = new
|
|
534
|
+
const s = new ze();
|
|
535
535
|
return t.background !== void 0 && (s.background = new M(t.background)), this.scenes.set(e, s), s;
|
|
536
536
|
}
|
|
537
537
|
/**
|
|
@@ -592,7 +592,7 @@ class bn {
|
|
|
592
592
|
return this.scenes.size;
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
class
|
|
595
|
+
class Cn {
|
|
596
596
|
scene;
|
|
597
597
|
lights = /* @__PURE__ */ new Map();
|
|
598
598
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -600,16 +600,16 @@ class xn {
|
|
|
600
600
|
this.scene = e;
|
|
601
601
|
}
|
|
602
602
|
addAmbient(e, t = {}) {
|
|
603
|
-
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new
|
|
603
|
+
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new nt(s, n);
|
|
604
604
|
return i.name = e, this._register(e, i), i;
|
|
605
605
|
}
|
|
606
606
|
addDirectional(e, t = {}) {
|
|
607
|
-
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize:
|
|
608
|
-
return
|
|
607
|
+
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize: a = 1024 } = t, o = new me(s, n);
|
|
608
|
+
return o.position.set(i.x, i.y, i.z), o.castShadow = r, r && o.shadow.mapSize.setScalar(a), o.name = e, this._register(e, o), o;
|
|
609
609
|
}
|
|
610
610
|
addPoint(e, t = {}) {
|
|
611
|
-
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position:
|
|
612
|
-
return c.position.set(
|
|
611
|
+
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position: a = { x: 0, y: 5, z: 0 }, castShadow: o = !1 } = t, c = new fe(s, n, i, r);
|
|
612
|
+
return c.position.set(a.x, a.y, a.z), c.castShadow = o, c.name = e, this._register(e, c), c;
|
|
613
613
|
}
|
|
614
614
|
addSpot(e, t = {}) {
|
|
615
615
|
const {
|
|
@@ -617,16 +617,16 @@ class xn {
|
|
|
617
617
|
intensity: n = 1,
|
|
618
618
|
distance: i = 0,
|
|
619
619
|
angle: r = Math.PI / 6,
|
|
620
|
-
penumbra:
|
|
621
|
-
decay:
|
|
620
|
+
penumbra: a = 0.1,
|
|
621
|
+
decay: o = 2,
|
|
622
622
|
position: c = { x: 0, y: 10, z: 0 },
|
|
623
623
|
target: l,
|
|
624
624
|
castShadow: d = !1
|
|
625
|
-
} = t, p = new
|
|
625
|
+
} = t, p = new ge(s, n, i, r, a, o);
|
|
626
626
|
return p.position.set(c.x, c.y, c.z), l && p.target.position.set(l.x, l.y, l.z), p.castShadow = d, p.name = e, this._register(e, p), p;
|
|
627
627
|
}
|
|
628
628
|
addHemisphere(e, t = {}) {
|
|
629
|
-
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new
|
|
629
|
+
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new ye(s, n, i);
|
|
630
630
|
return r.name = e, this._register(e, r), r;
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
@@ -677,7 +677,7 @@ class xn {
|
|
|
677
677
|
const t = this.lights.get(e);
|
|
678
678
|
if (!t) return;
|
|
679
679
|
let s = null;
|
|
680
|
-
t instanceof
|
|
680
|
+
t instanceof me ? s = new it(t, 1) : t instanceof fe ? s = new rt(t, 0.5) : t instanceof ge ? s = new at(t) : t instanceof ye && (s = new ot(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Hide (remove) the helper for a light.
|
|
@@ -708,18 +708,18 @@ class xn {
|
|
|
708
708
|
this.removeAll(), this.hideAllHelpers();
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
class ws extends
|
|
711
|
+
class ws extends ct {
|
|
712
712
|
scene;
|
|
713
713
|
camera;
|
|
714
714
|
scenePass;
|
|
715
715
|
needsUpdateOutputNode;
|
|
716
|
-
#
|
|
717
|
-
#
|
|
718
|
-
#
|
|
719
|
-
#
|
|
720
|
-
#
|
|
721
|
-
#
|
|
722
|
-
#
|
|
716
|
+
#t;
|
|
717
|
+
#e;
|
|
718
|
+
#s = !1;
|
|
719
|
+
#r = { strength: 1, radius: 0, threshold: 0 };
|
|
720
|
+
#n = null;
|
|
721
|
+
#a = !1;
|
|
722
|
+
#o = {
|
|
723
723
|
sliceCount: 1,
|
|
724
724
|
stepCount: 12,
|
|
725
725
|
aoIntensity: 1,
|
|
@@ -728,29 +728,29 @@ class ws extends at {
|
|
|
728
728
|
thickness: 1
|
|
729
729
|
};
|
|
730
730
|
#p = null;
|
|
731
|
-
#
|
|
732
|
-
#
|
|
731
|
+
#h = !1;
|
|
732
|
+
#l = null;
|
|
733
733
|
#u = null;
|
|
734
|
-
#
|
|
735
|
-
#
|
|
734
|
+
#d;
|
|
735
|
+
#c;
|
|
736
736
|
#m = !1;
|
|
737
737
|
#f = !0;
|
|
738
738
|
constructor(...e) {
|
|
739
739
|
const [t, s, n] = e;
|
|
740
|
-
super(t), this.scene = s, this.camera = n, this.scenePass =
|
|
740
|
+
super(t), this.scene = s, this.camera = n, this.scenePass = pe(s, n), this.needsUpdateOutputNode = !0, this.#t = /* @__PURE__ */ new Set(), this.#e = [], this.#d = /* @__PURE__ */ new Set(), this.#c = /* @__PURE__ */ new Map(), this.#g();
|
|
741
741
|
}
|
|
742
742
|
/** @deprecated Use `scenePass` instead */
|
|
743
743
|
get currentOutputNode() {
|
|
744
744
|
return this.scenePass;
|
|
745
745
|
}
|
|
746
746
|
addOverlayPass(e) {
|
|
747
|
-
this.#
|
|
747
|
+
this.#t.add(e), this.needsUpdateOutputNode = !0;
|
|
748
748
|
}
|
|
749
749
|
removeOverlayPass(e) {
|
|
750
|
-
this.#
|
|
750
|
+
this.#t.delete(e), this.needsUpdateOutputNode = !0;
|
|
751
751
|
}
|
|
752
752
|
setCamera(e) {
|
|
753
|
-
this.camera = e, this.#
|
|
753
|
+
this.camera = e, this.#i();
|
|
754
754
|
}
|
|
755
755
|
/** @deprecated Use `setOutputComposer` instead */
|
|
756
756
|
setCurrentOutputNode(e) {
|
|
@@ -764,78 +764,78 @@ class ws extends at {
|
|
|
764
764
|
this.#u = e, this.needsUpdateOutputNode = !0;
|
|
765
765
|
}
|
|
766
766
|
addOutputEffect(e) {
|
|
767
|
-
return this.#
|
|
767
|
+
return this.#d.add(e), this.needsUpdateOutputNode = !0, this;
|
|
768
768
|
}
|
|
769
769
|
removeOutputEffect(e) {
|
|
770
|
-
return this.#
|
|
770
|
+
return this.#d.delete(e), this.needsUpdateOutputNode = !0, this;
|
|
771
771
|
}
|
|
772
772
|
addMRTChannel(e, t) {
|
|
773
|
-
return this.#
|
|
773
|
+
return this.#c.get(e) === t ? this : (this.#c.set(e, t), this.#i(), this);
|
|
774
774
|
}
|
|
775
775
|
removeMRTChannel(e) {
|
|
776
|
-
return this.#
|
|
776
|
+
return this.#c.delete(e) && this.#i(), this;
|
|
777
777
|
}
|
|
778
778
|
enableBloom(e) {
|
|
779
|
-
e && Object.assign(this.#
|
|
779
|
+
e && Object.assign(this.#r, e), this.#s = !0, this.#i();
|
|
780
780
|
}
|
|
781
781
|
disableBloom() {
|
|
782
|
-
this.#
|
|
782
|
+
this.#s = !1, this.#n = null, this.#i();
|
|
783
783
|
}
|
|
784
784
|
updateBloom(e) {
|
|
785
|
-
Object.assign(this.#
|
|
785
|
+
Object.assign(this.#r, e), this.#s && (this.needsUpdateOutputNode = !0);
|
|
786
786
|
}
|
|
787
787
|
enableSSGI(e) {
|
|
788
|
-
e && Object.assign(this.#
|
|
788
|
+
e && Object.assign(this.#o, e), this.#a = !0, this.#i();
|
|
789
789
|
}
|
|
790
790
|
disableSSGI() {
|
|
791
|
-
this.#
|
|
791
|
+
this.#a = !1, this.#p = null, this.#i();
|
|
792
792
|
}
|
|
793
793
|
updateSSGI(e) {
|
|
794
|
-
if (Object.assign(this.#
|
|
794
|
+
if (Object.assign(this.#o, e), this.#p) {
|
|
795
795
|
const t = this.#p;
|
|
796
796
|
e.sliceCount !== void 0 && (t.sliceCount.value = e.sliceCount), e.stepCount !== void 0 && (t.stepCount.value = e.stepCount), e.aoIntensity !== void 0 && (t.aoIntensity.value = e.aoIntensity), e.giIntensity !== void 0 && (t.giIntensity.value = e.giIntensity), e.radius !== void 0 && (t.radius.value = e.radius), e.thickness !== void 0 && (t.thickness.value = e.thickness);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
enableTRAA() {
|
|
800
|
-
this.#
|
|
800
|
+
this.#h = !0, this.#i();
|
|
801
801
|
}
|
|
802
802
|
disableTRAA() {
|
|
803
|
-
this.#
|
|
803
|
+
this.#h = !1, this.#l = null, this.#i();
|
|
804
804
|
}
|
|
805
|
-
#
|
|
805
|
+
#i() {
|
|
806
806
|
const e = this.scenePass;
|
|
807
|
-
this.scenePass =
|
|
807
|
+
this.scenePass = pe(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
808
808
|
}
|
|
809
809
|
#g() {
|
|
810
|
-
if (this.#
|
|
810
|
+
if (this.#s || this.#a || this.#h || this.#c.size > 0) {
|
|
811
811
|
const t = { output: $t };
|
|
812
|
-
this.#
|
|
812
|
+
this.#c.forEach((s, n) => {
|
|
813
813
|
n !== "output" && (t[n] = s);
|
|
814
|
-
}), this.#
|
|
814
|
+
}), this.#s && (t.emissive = Kt), this.#a && (t.normal = Qt), this.#h && (t.velocity = qt), this.scenePass.setMRT(Gt(t));
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
#y() {
|
|
818
|
-
for (const e of this.#
|
|
818
|
+
for (const e of this.#e)
|
|
819
819
|
e.dispose();
|
|
820
|
-
this.#
|
|
820
|
+
this.#e = [];
|
|
821
821
|
}
|
|
822
822
|
#w() {
|
|
823
823
|
let e = this.scenePass.getTextureNode();
|
|
824
|
-
if (this.#
|
|
825
|
-
if (!(this.camera instanceof
|
|
824
|
+
if (this.#a)
|
|
825
|
+
if (!(this.camera instanceof V))
|
|
826
826
|
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
827
827
|
else {
|
|
828
828
|
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = Vt(t, s, n, this.camera);
|
|
829
|
-
i.sliceCount.value = this.#
|
|
829
|
+
i.sliceCount.value = this.#o.sliceCount, i.stepCount.value = this.#o.stepCount, i.aoIntensity.value = this.#o.aoIntensity, i.giIntensity.value = this.#o.giIntensity, i.radius.value = this.#o.radius, i.thickness.value = this.#o.thickness, this.#p = i, e = xe(e, i), this.#e.push(i);
|
|
830
830
|
}
|
|
831
|
-
if (this.#
|
|
831
|
+
if (this.#s) {
|
|
832
832
|
const t = this.scenePass.getTextureNode("emissive");
|
|
833
|
-
this.#
|
|
833
|
+
this.#n = Jt(
|
|
834
834
|
t,
|
|
835
|
-
this.#
|
|
836
|
-
this.#
|
|
837
|
-
this.#
|
|
838
|
-
), e =
|
|
835
|
+
this.#r.strength,
|
|
836
|
+
this.#r.radius,
|
|
837
|
+
this.#r.threshold
|
|
838
|
+
), e = xe(e, this.#n), this.#e.push(this.#n);
|
|
839
839
|
}
|
|
840
840
|
return e;
|
|
841
841
|
}
|
|
@@ -846,16 +846,16 @@ class ws extends at {
|
|
|
846
846
|
this.#y();
|
|
847
847
|
let e, t = !1, s = !1;
|
|
848
848
|
const n = this.#u !== null;
|
|
849
|
-
if (n ? e = this.#u(this.scenePass) : this.#
|
|
849
|
+
if (n ? e = this.#u(this.scenePass) : this.#s || this.#a ? e = this.#w() : e = this.#d.size > 0 ? this.scenePass.getTextureNode() : this.scenePass, n || this.#d.forEach((i) => {
|
|
850
850
|
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
851
|
-
}), this.#v(s), this.#
|
|
851
|
+
}), this.#v(s), this.#h && !t) {
|
|
852
852
|
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
853
|
-
this.#
|
|
853
|
+
this.#l = Zt(e, i, r, this.camera), this.#e.push(this.#l), e = this.#l;
|
|
854
854
|
} else
|
|
855
|
-
this.#
|
|
856
|
-
this.#
|
|
855
|
+
this.#l = null;
|
|
856
|
+
this.#t.size > 0 && this.#t.forEach((i) => {
|
|
857
857
|
const r = Wt(e, i);
|
|
858
|
-
this.#
|
|
858
|
+
this.#e.push(r), e = r;
|
|
859
859
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
860
860
|
}
|
|
861
861
|
render() {
|
|
@@ -868,16 +868,16 @@ class ws extends at {
|
|
|
868
868
|
const vs = {
|
|
869
869
|
Vector2: C,
|
|
870
870
|
Vector3: w,
|
|
871
|
-
Vector4:
|
|
872
|
-
Quaternion:
|
|
871
|
+
Vector4: lt,
|
|
872
|
+
Quaternion: ht,
|
|
873
873
|
Matrix4: Ie,
|
|
874
874
|
Spherical: S,
|
|
875
|
-
Box3:
|
|
876
|
-
Sphere:
|
|
877
|
-
Raycaster:
|
|
875
|
+
Box3: q,
|
|
876
|
+
Sphere: Ne,
|
|
877
|
+
Raycaster: Le
|
|
878
878
|
};
|
|
879
|
-
|
|
880
|
-
class bs extends
|
|
879
|
+
Fe.install({ THREE: vs });
|
|
880
|
+
class bs extends Fe {
|
|
881
881
|
constructor(...e) {
|
|
882
882
|
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
883
883
|
}
|
|
@@ -891,10 +891,10 @@ class bs extends He {
|
|
|
891
891
|
if (e.isEmpty())
|
|
892
892
|
return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
|
|
893
893
|
this.absoluteRotations();
|
|
894
|
-
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t,
|
|
894
|
+
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, a = [];
|
|
895
895
|
if (s !== "current") {
|
|
896
|
-
const
|
|
897
|
-
|
|
896
|
+
const o = _e[s.toUpperCase()] ?? _e.FRONTTOP, c = o.theta, l = o.phi;
|
|
897
|
+
a.push(
|
|
898
898
|
this.fitToBox(e, n, {
|
|
899
899
|
paddingLeft: i,
|
|
900
900
|
paddingRight: i,
|
|
@@ -902,15 +902,15 @@ class bs extends He {
|
|
|
902
902
|
paddingBottom: i,
|
|
903
903
|
cover: r
|
|
904
904
|
})
|
|
905
|
-
),
|
|
905
|
+
), a.push(this.rotateTo(c, l, n));
|
|
906
906
|
} else {
|
|
907
|
-
const
|
|
908
|
-
e.getBoundingSphere(
|
|
907
|
+
const o = new Ne();
|
|
908
|
+
e.getBoundingSphere(o), o.radius += i, a.push(this.fitToSphere(o, n));
|
|
909
909
|
}
|
|
910
|
-
return await Promise.all(
|
|
910
|
+
return await Promise.all(a), !0;
|
|
911
911
|
}
|
|
912
912
|
async flyToObject(e, t = {}) {
|
|
913
|
-
const s = new
|
|
913
|
+
const s = new q().setFromObject(e);
|
|
914
914
|
return this.flyToBox(s, t);
|
|
915
915
|
}
|
|
916
916
|
/**
|
|
@@ -979,7 +979,7 @@ const _e = {
|
|
|
979
979
|
};
|
|
980
980
|
function xs(h, e) {
|
|
981
981
|
const t = h - e;
|
|
982
|
-
return
|
|
982
|
+
return dt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
983
983
|
}
|
|
984
984
|
class Cs {
|
|
985
985
|
environment = new es();
|
|
@@ -987,7 +987,7 @@ class Cs {
|
|
|
987
987
|
pmremGenerator;
|
|
988
988
|
envMap = null;
|
|
989
989
|
constructor(e) {
|
|
990
|
-
this.renderer = e, this.pmremGenerator = new
|
|
990
|
+
this.renderer = e, this.pmremGenerator = new pt(e);
|
|
991
991
|
}
|
|
992
992
|
update() {
|
|
993
993
|
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
@@ -996,20 +996,20 @@ class Cs {
|
|
|
996
996
|
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
const
|
|
999
|
+
const J = 128;
|
|
1000
1000
|
class Ss extends ts {
|
|
1001
1001
|
viewer;
|
|
1002
1002
|
overlayPass;
|
|
1003
1003
|
constructor(e) {
|
|
1004
1004
|
super(e.camera, e.el), this.viewer = e;
|
|
1005
|
-
const t = new
|
|
1006
|
-
t.position.set(0, 0, 2), this.overlayPass =
|
|
1005
|
+
const t = new Z(-2, 2, 2, -2, 0, 4);
|
|
1006
|
+
t.position.set(0, 0, 2), this.overlayPass = pe(this, t), this.setLabels("x", "y", "z");
|
|
1007
1007
|
}
|
|
1008
1008
|
_update = () => {
|
|
1009
1009
|
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
1010
1010
|
const e = this.location;
|
|
1011
1011
|
let t, s;
|
|
1012
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth -
|
|
1012
|
+
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - J - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - J - e.bottom, this.overlayPass.setViewport(t, s, J, J);
|
|
1013
1013
|
};
|
|
1014
1014
|
enable() {
|
|
1015
1015
|
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
@@ -1018,8 +1018,8 @@ class Ss extends ts {
|
|
|
1018
1018
|
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
|
-
const
|
|
1022
|
-
class
|
|
1021
|
+
const $e = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Ms = $e + "z-index:0;", Ts = $e + "z-index:1;";
|
|
1022
|
+
class _s {
|
|
1023
1023
|
el;
|
|
1024
1024
|
css2dRenderer = null;
|
|
1025
1025
|
css3dRenderer = null;
|
|
@@ -1028,7 +1028,7 @@ class Ts {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
initCSS2DRenderer() {
|
|
1030
1030
|
const e = new ss();
|
|
1031
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1031
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ts, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
|
|
1032
1032
|
}
|
|
1033
1033
|
initCSS3DRenderer() {
|
|
1034
1034
|
const e = new is();
|
|
@@ -1041,7 +1041,7 @@ class Ts {
|
|
|
1041
1041
|
return this.css3dRenderer || this.initCSS3DRenderer(), new rs(e);
|
|
1042
1042
|
}
|
|
1043
1043
|
createCSS3DObject(e) {
|
|
1044
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1044
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new as(e);
|
|
1045
1045
|
}
|
|
1046
1046
|
render(e, t) {
|
|
1047
1047
|
this.css2dRenderer && this.css2dRenderer.render(e, t), this.css3dRenderer && this.css3dRenderer.render(e, t);
|
|
@@ -1053,7 +1053,8 @@ class Ts {
|
|
|
1053
1053
|
this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
|
-
|
|
1056
|
+
const Es = "timestamp-query";
|
|
1057
|
+
class Ps {
|
|
1057
1058
|
el;
|
|
1058
1059
|
renderer;
|
|
1059
1060
|
container;
|
|
@@ -1064,13 +1065,14 @@ class Es {
|
|
|
1064
1065
|
linesText;
|
|
1065
1066
|
timestampText;
|
|
1066
1067
|
_enabled = !1;
|
|
1068
|
+
#t = !1;
|
|
1067
1069
|
constructor(e, t) {
|
|
1068
1070
|
this.el = e, this.renderer = t;
|
|
1069
1071
|
const s = document.createElement("div");
|
|
1070
1072
|
s.style.position = "absolute", s.style.left = "12px", s.style.bottom = "12px", s.style.fontSize = "12px", s.style.color = "#fff", s.style.pointerEvents = "none", this.container = s;
|
|
1071
|
-
function n(r,
|
|
1072
|
-
const
|
|
1073
|
-
return
|
|
1073
|
+
function n(r, a = !0) {
|
|
1074
|
+
const o = document.createElement("span");
|
|
1075
|
+
return a && (o.style.marginLeft = "6px"), o.innerText = r, o;
|
|
1074
1076
|
}
|
|
1075
1077
|
function i() {
|
|
1076
1078
|
return document.createElement("br");
|
|
@@ -1080,23 +1082,53 @@ class Es {
|
|
|
1080
1082
|
update() {
|
|
1081
1083
|
if (this._enabled) {
|
|
1082
1084
|
const { render: e } = this.renderer.info;
|
|
1083
|
-
this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), this
|
|
1084
|
-
this.timestampText.innerText =
|
|
1085
|
-
|
|
1085
|
+
if (this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), !this.#t) {
|
|
1086
|
+
this.timestampText.innerText = "0";
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
this.#n(Y.RENDER).then((t) => {
|
|
1090
|
+
this._enabled && (this.timestampText.innerText = t?.toFixed(2) ?? "0");
|
|
1091
|
+
}), this.#n(Y.COMPUTE);
|
|
1086
1092
|
}
|
|
1087
1093
|
}
|
|
1088
1094
|
enable() {
|
|
1089
|
-
this._enabled = !0, this.el.appendChild(this.container);
|
|
1095
|
+
this._enabled = !0, this.#r(!0), this.el.appendChild(this.container);
|
|
1090
1096
|
}
|
|
1091
1097
|
disable() {
|
|
1092
|
-
this._enabled = !1, this.container.remove();
|
|
1098
|
+
this._enabled = !1, this.#r(!1), this.#a(), this.container.remove();
|
|
1093
1099
|
}
|
|
1094
1100
|
dispose() {
|
|
1095
1101
|
this.disable();
|
|
1096
1102
|
}
|
|
1103
|
+
#e() {
|
|
1104
|
+
return this.renderer.backend;
|
|
1105
|
+
}
|
|
1106
|
+
#s() {
|
|
1107
|
+
try {
|
|
1108
|
+
return this.renderer.hasFeature(Es);
|
|
1109
|
+
} catch {
|
|
1110
|
+
return !0;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
#r(e) {
|
|
1114
|
+
const t = this.#e();
|
|
1115
|
+
if (!t) {
|
|
1116
|
+
this.#t = !1;
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
t.trackTimestamp = e && this.#s(), this.#t = t.trackTimestamp === !0;
|
|
1120
|
+
}
|
|
1121
|
+
#n(e) {
|
|
1122
|
+
const t = this.#e()?.timestampQueryPool?.[e];
|
|
1123
|
+
return t?.resolveQueriesAsync ? Promise.resolve(t.resolveQueriesAsync()).catch(() => {
|
|
1124
|
+
}) : Promise.resolve(void 0);
|
|
1125
|
+
}
|
|
1126
|
+
#a() {
|
|
1127
|
+
this.#n(Y.RENDER), this.#n(Y.COMPUTE);
|
|
1128
|
+
}
|
|
1097
1129
|
}
|
|
1098
1130
|
ut.enabled = !0;
|
|
1099
|
-
class
|
|
1131
|
+
class Sn extends Re {
|
|
1100
1132
|
el;
|
|
1101
1133
|
renderer;
|
|
1102
1134
|
scene;
|
|
@@ -1113,11 +1145,11 @@ class Cn extends Le {
|
|
|
1113
1145
|
frameCount = 1;
|
|
1114
1146
|
frameloop = "demand";
|
|
1115
1147
|
constructor({ el: e, rendererOptions: t }) {
|
|
1116
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new
|
|
1148
|
+
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Ps(this.el, this.renderer), this.controls = new bs(this.camera, this.renderer.domElement), this.renderPipeline = new ws(this.renderer, this.scene, this.camera), this.timer = new mt(), this.roomEnvironment = new Cs(this.renderer), this.interactionManager = new gs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new ys(), this.viewerHelper = new Ss(this), this.cssRenderer = new _s(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1117
1149
|
}
|
|
1118
1150
|
onWindowResize = () => {
|
|
1119
1151
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
1120
|
-
this.camera instanceof
|
|
1152
|
+
this.camera instanceof V ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof Z && (this.camera.left = -e / 2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = -t / 2, this.camera.updateProjectionMatrix()), this.renderer.setSize(e, t), this.cssRenderer.resize(e, t), this.render();
|
|
1121
1153
|
};
|
|
1122
1154
|
async init() {
|
|
1123
1155
|
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
@@ -1126,7 +1158,7 @@ class Cn extends Le {
|
|
|
1126
1158
|
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
1127
1159
|
}
|
|
1128
1160
|
setCameraByType(e) {
|
|
1129
|
-
e === "perspective" && !(this.camera instanceof
|
|
1161
|
+
e === "perspective" && !(this.camera instanceof V) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof Z) && this.setCamera(this.createOrthographicCamera());
|
|
1130
1162
|
}
|
|
1131
1163
|
render(e = 1) {
|
|
1132
1164
|
return this.frameCount += e, new Promise((t) => {
|
|
@@ -1148,21 +1180,21 @@ class Cn extends Le {
|
|
|
1148
1180
|
logarithmicDepthBuffer: !0,
|
|
1149
1181
|
antialias: !1,
|
|
1150
1182
|
depth: !1,
|
|
1151
|
-
trackTimestamp: !
|
|
1183
|
+
trackTimestamp: !1,
|
|
1152
1184
|
...e
|
|
1153
1185
|
});
|
|
1154
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = gt, t.toneMapping = yt, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
|
|
1186
|
+
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = gt, t.toneMapping = yt, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
|
|
1155
1187
|
}
|
|
1156
1188
|
createScene() {
|
|
1157
|
-
const e = new
|
|
1189
|
+
const e = new ze();
|
|
1158
1190
|
return e.background = new M(0), e;
|
|
1159
1191
|
}
|
|
1160
1192
|
createPerspectiveCamera() {
|
|
1161
|
-
const e = new
|
|
1193
|
+
const e = new V(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
1162
1194
|
return e.position.setScalar(5), e;
|
|
1163
1195
|
}
|
|
1164
1196
|
createOrthographicCamera() {
|
|
1165
|
-
const e = new
|
|
1197
|
+
const e = new Z(
|
|
1166
1198
|
-this.el.clientWidth / 2,
|
|
1167
1199
|
this.el.clientWidth / 2,
|
|
1168
1200
|
this.el.clientHeight / 2,
|
|
@@ -1184,8 +1216,8 @@ class Cn extends Le {
|
|
|
1184
1216
|
async screenshot(e = {}) {
|
|
1185
1217
|
const { type: t = "image/png", quality: s = 1 } = e, n = this.el.clientWidth, i = this.el.clientHeight, r = e.width && e.height;
|
|
1186
1218
|
r && this.renderer.setSize(e.width, e.height), await this.render();
|
|
1187
|
-
const
|
|
1188
|
-
return r && (this.renderer.setSize(n, i), this.onWindowResize()),
|
|
1219
|
+
const a = this.renderer.domElement.toDataURL(t, s);
|
|
1220
|
+
return r && (this.renderer.setSize(n, i), this.onWindowResize()), a;
|
|
1189
1221
|
}
|
|
1190
1222
|
/**
|
|
1191
1223
|
* Set the scene background color, texture, or null.
|
|
@@ -1235,22 +1267,22 @@ class Cn extends Le {
|
|
|
1235
1267
|
this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.cssRenderer.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
|
|
1236
1268
|
}
|
|
1237
1269
|
}
|
|
1238
|
-
class
|
|
1270
|
+
class Os extends Ge {
|
|
1239
1271
|
constructor(e) {
|
|
1240
1272
|
super(e);
|
|
1241
1273
|
}
|
|
1242
1274
|
parse(e, t, s, n) {
|
|
1243
|
-
if (
|
|
1244
|
-
const r =
|
|
1275
|
+
if (As(e.slice(0, 8)) === "SBMG----") {
|
|
1276
|
+
const r = Bs(e.slice(8));
|
|
1245
1277
|
return super.parse(r, t, s, n);
|
|
1246
1278
|
} else
|
|
1247
1279
|
return super.parse(e, t, s, n);
|
|
1248
1280
|
}
|
|
1249
1281
|
}
|
|
1250
|
-
function
|
|
1282
|
+
function As(h) {
|
|
1251
1283
|
return new TextDecoder().decode(new Uint8Array(h));
|
|
1252
1284
|
}
|
|
1253
|
-
function
|
|
1285
|
+
function Bs(h) {
|
|
1254
1286
|
const e = new DataView(h);
|
|
1255
1287
|
for (let t = 0; t < e.byteLength; t++) {
|
|
1256
1288
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
@@ -1258,72 +1290,72 @@ function As(h) {
|
|
|
1258
1290
|
}
|
|
1259
1291
|
return e.buffer;
|
|
1260
1292
|
}
|
|
1261
|
-
const
|
|
1262
|
-
function
|
|
1263
|
-
let e =
|
|
1293
|
+
const Ls = 8, Rs = 130, Ee = 66, Is = "SBK-----", zs = "SBM-----", We = new TextDecoder(), Ns = new TextEncoder();
|
|
1294
|
+
function js(h) {
|
|
1295
|
+
let e = Ls;
|
|
1264
1296
|
const t = new Uint8Array(h, 0, e);
|
|
1265
|
-
if (
|
|
1297
|
+
if (We.decode(t) !== Is)
|
|
1266
1298
|
return h;
|
|
1267
|
-
e +=
|
|
1299
|
+
e += Rs;
|
|
1268
1300
|
const n = new Uint8Array(h, 0, e);
|
|
1269
1301
|
if (n[40] === 1) {
|
|
1270
|
-
const r =
|
|
1271
|
-
let l =
|
|
1272
|
-
const d = e +
|
|
1302
|
+
const r = Ns.encode(zs), a = new Uint8Array([n[41]]), o = Ds(n), c = ks(o);
|
|
1303
|
+
let l = Ee % c.length;
|
|
1304
|
+
const d = e + Ee, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
|
|
1273
1305
|
for (let v = 0; v < p.length; v++)
|
|
1274
1306
|
u[v] = p[v] ^ c[l], l = (l + 1) % c.length;
|
|
1275
|
-
const f = new Uint8Array(r.length +
|
|
1276
|
-
return f.set(r), f.set(
|
|
1307
|
+
const f = new Uint8Array(r.length + a.length + u.length);
|
|
1308
|
+
return f.set(r), f.set(a, r.length), f.set(u, r.length + a.length), f.buffer;
|
|
1277
1309
|
}
|
|
1278
1310
|
}
|
|
1279
|
-
function
|
|
1311
|
+
function Ds(h) {
|
|
1280
1312
|
const e = new Uint8Array(128);
|
|
1281
1313
|
return e.set(h.slice(42, 74), 0), e.set(h.slice(74, 138), 32), e.set(h.slice(8, 40), 96), e;
|
|
1282
1314
|
}
|
|
1283
|
-
function
|
|
1315
|
+
function ks(h) {
|
|
1284
1316
|
const e = new Uint8Array(64);
|
|
1285
1317
|
return e.set(h.slice(0, 8), 0), e.set(h.slice(24, 32), 8), e.set(h.slice(40, 56), 16), e.set(h.slice(64, 88), 32), e.set(h.slice(96, 104), 56), e;
|
|
1286
1318
|
}
|
|
1287
|
-
const
|
|
1319
|
+
const Us = (h, e, t) => {
|
|
1288
1320
|
const s = h.buffer.slice(t, t + e);
|
|
1289
|
-
let n =
|
|
1321
|
+
let n = We.decode(s);
|
|
1290
1322
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
1291
|
-
},
|
|
1292
|
-
const [s, n, i, r,
|
|
1293
|
-
return new
|
|
1323
|
+
}, Hs = (h, e, t) => {
|
|
1324
|
+
const [s, n, i, r, a] = e, o = t || r < 1;
|
|
1325
|
+
return new I({
|
|
1294
1326
|
name: h,
|
|
1295
1327
|
color: new M(s, n, i),
|
|
1296
1328
|
opacity: r,
|
|
1297
|
-
transparent:
|
|
1329
|
+
transparent: o,
|
|
1298
1330
|
alphaTest: 0.01,
|
|
1299
|
-
side:
|
|
1331
|
+
side: a
|
|
1300
1332
|
});
|
|
1301
|
-
},
|
|
1302
|
-
class
|
|
1333
|
+
}, Fs = (h) => h?.toLowerCase().endsWith(".png") ?? !1;
|
|
1334
|
+
class Gs {
|
|
1303
1335
|
data;
|
|
1304
1336
|
options;
|
|
1305
1337
|
textureLoader;
|
|
1306
1338
|
littleEndian = !0;
|
|
1307
1339
|
materials = /* @__PURE__ */ new Map();
|
|
1308
1340
|
constructor(e, t) {
|
|
1309
|
-
this.data = e, this.options = t, this.textureLoader = new
|
|
1341
|
+
this.data = e, this.options = t, this.textureLoader = new De(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
|
|
1310
1342
|
}
|
|
1311
1343
|
parse(e, t) {
|
|
1312
1344
|
let s = this.data;
|
|
1313
|
-
const n =
|
|
1345
|
+
const n = js(this.data);
|
|
1314
1346
|
n && (s = n);
|
|
1315
1347
|
const i = new DataView(s);
|
|
1316
1348
|
let r = 8;
|
|
1317
|
-
const
|
|
1318
|
-
r += 1,
|
|
1349
|
+
const a = i.getUint8(r);
|
|
1350
|
+
r += 1, a === 1 ? this._parseV2(i, r, e) : a === 2 ? this._parseV2(i, r, e) : a === 3 ? this._parseV3(i, r, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${a}`));
|
|
1319
1351
|
}
|
|
1320
1352
|
_parseV2(e, t, s) {
|
|
1321
|
-
const n = new
|
|
1353
|
+
const n = new R(), i = e.getUint16(t, this.littleEndian);
|
|
1322
1354
|
t += 2;
|
|
1323
1355
|
const r = e.getUint16(t, this.littleEndian);
|
|
1324
1356
|
t += 2;
|
|
1325
|
-
for (let
|
|
1326
|
-
const
|
|
1357
|
+
for (let a = 0; a < i; ++a) {
|
|
1358
|
+
const o = e.getUint16(t, this.littleEndian).toString();
|
|
1327
1359
|
t += 2, t += 4, t += 4, t += 4, t += 4;
|
|
1328
1360
|
const c = e.getFloat32(t, this.littleEndian);
|
|
1329
1361
|
t += 4;
|
|
@@ -1337,16 +1369,16 @@ class Fs {
|
|
|
1337
1369
|
t += 1, u === 0 ? u = xt : u === 1 ? u = Ct : u === 2 && (u = St);
|
|
1338
1370
|
const f = e.getUint16(t, this.littleEndian);
|
|
1339
1371
|
t += 2;
|
|
1340
|
-
const v = f > 0 ?
|
|
1341
|
-
if (t += f, !this.materials.has(
|
|
1342
|
-
const x =
|
|
1343
|
-
this.materials.set(
|
|
1344
|
-
y.colorSpace =
|
|
1372
|
+
const v = f > 0 ? Us(e, f, t) : "";
|
|
1373
|
+
if (t += f, !this.materials.has(o)) {
|
|
1374
|
+
const x = Hs(o, [c, l, d, p, u], Fs(v));
|
|
1375
|
+
this.materials.set(o, x), v && this.options.path && this.textureLoader.load(L.resolveURL(v, this.options.path), (y) => {
|
|
1376
|
+
y.colorSpace = ke, y.wrapS = we, y.wrapT = we, y.flipY = !1, y.anisotropy = 16, x.map = y;
|
|
1345
1377
|
});
|
|
1346
1378
|
}
|
|
1347
1379
|
}
|
|
1348
|
-
for (let
|
|
1349
|
-
const
|
|
1380
|
+
for (let a = 0; a < r; ++a) {
|
|
1381
|
+
const o = e.getUint16(t, this.littleEndian).toString();
|
|
1350
1382
|
t += 2;
|
|
1351
1383
|
const c = e.getUint16(t, this.littleEndian).toString();
|
|
1352
1384
|
t += 2;
|
|
@@ -1360,9 +1392,9 @@ class Fs {
|
|
|
1360
1392
|
if (t += 2, v > 0)
|
|
1361
1393
|
for (let g = 0; g < v; g++)
|
|
1362
1394
|
t += 4, t += 4, t += 4;
|
|
1363
|
-
const
|
|
1364
|
-
if (t += 2,
|
|
1365
|
-
for (let g = 0; g <
|
|
1395
|
+
const T = e.getUint16(t, this.littleEndian);
|
|
1396
|
+
if (t += 2, T > 0)
|
|
1397
|
+
for (let g = 0; g < T; g++) {
|
|
1366
1398
|
const b = new C();
|
|
1367
1399
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
|
|
1368
1400
|
}
|
|
@@ -1378,47 +1410,47 @@ class Fs {
|
|
|
1378
1410
|
const P = [b, z, N];
|
|
1379
1411
|
p.push(P), d.length > 0 && u.push([d[P[0]], d[P[1]], d[P[2]]]);
|
|
1380
1412
|
}
|
|
1381
|
-
const y = [],
|
|
1413
|
+
const y = [], _ = [];
|
|
1382
1414
|
for (let g = 0; g < p.length; g++) {
|
|
1383
1415
|
const b = p[g], z = l[b[0]], N = l[b[1]], P = l[b[2]];
|
|
1384
1416
|
y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
|
|
1385
|
-
let
|
|
1417
|
+
let X = new C(), $ = new C(), k = new C();
|
|
1386
1418
|
const U = u[g];
|
|
1387
|
-
U !== void 0 && (
|
|
1419
|
+
U !== void 0 && (X = U[0], $ = U[1], k = U[2]), _.push(...X.toArray(), ...$.toArray(), ...k.toArray());
|
|
1388
1420
|
}
|
|
1389
|
-
const O = new Float32Array(y), A = new Float32Array(
|
|
1390
|
-
if (O.length > 0 && E.setAttribute("position", new
|
|
1421
|
+
const O = new Float32Array(y), A = new Float32Array(_), E = new K();
|
|
1422
|
+
if (O.length > 0 && E.setAttribute("position", new ve(O, 3)), A.length > 0 && E.setAttribute("uv", new ve(A, 2)), E.computeVertexNormals(), this.materials.has(c)) {
|
|
1391
1423
|
const g = new D(E, this.materials.get(c));
|
|
1392
|
-
g.name =
|
|
1424
|
+
g.name = o, g.castShadow = !0, g.receiveShadow = !0, n.add(g);
|
|
1393
1425
|
}
|
|
1394
1426
|
}
|
|
1395
1427
|
s(n);
|
|
1396
1428
|
}
|
|
1397
1429
|
_parseV3(e, t, s) {
|
|
1398
|
-
const n = new
|
|
1430
|
+
const n = new R();
|
|
1399
1431
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
1400
1432
|
}
|
|
1401
1433
|
}
|
|
1402
|
-
class
|
|
1434
|
+
class $s extends bt {
|
|
1403
1435
|
load(e, t, s, n) {
|
|
1404
1436
|
let i;
|
|
1405
1437
|
if (this.resourcePath !== "")
|
|
1406
1438
|
i = this.resourcePath;
|
|
1407
1439
|
else if (this.path !== "") {
|
|
1408
|
-
const
|
|
1409
|
-
i = L.resolveURL(
|
|
1440
|
+
const o = L.extractUrlBase(e);
|
|
1441
|
+
i = L.resolveURL(o, this.path);
|
|
1410
1442
|
} else
|
|
1411
1443
|
i = L.extractUrlBase(e);
|
|
1412
1444
|
this.manager.itemStart(e);
|
|
1413
|
-
const r = (
|
|
1414
|
-
n ? n(
|
|
1415
|
-
},
|
|
1416
|
-
|
|
1445
|
+
const r = (o) => {
|
|
1446
|
+
n ? n(o) : console.error(o), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
1447
|
+
}, a = new je(this.manager);
|
|
1448
|
+
a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(
|
|
1417
1449
|
e,
|
|
1418
|
-
(
|
|
1450
|
+
(o) => {
|
|
1419
1451
|
try {
|
|
1420
1452
|
this.parse(
|
|
1421
|
-
|
|
1453
|
+
o,
|
|
1422
1454
|
i,
|
|
1423
1455
|
(c) => {
|
|
1424
1456
|
t(c), this.manager.itemEnd(e);
|
|
@@ -1439,7 +1471,7 @@ class Gs extends bt {
|
|
|
1439
1471
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
1440
1472
|
return;
|
|
1441
1473
|
}
|
|
1442
|
-
new
|
|
1474
|
+
new Gs(e, {
|
|
1443
1475
|
path: t,
|
|
1444
1476
|
crossOrigin: this.crossOrigin,
|
|
1445
1477
|
requestHeader: this.requestHeader,
|
|
@@ -1461,7 +1493,7 @@ class Gs extends bt {
|
|
|
1461
1493
|
});
|
|
1462
1494
|
}
|
|
1463
1495
|
}
|
|
1464
|
-
const
|
|
1496
|
+
const Ws = [
|
|
1465
1497
|
"map",
|
|
1466
1498
|
"alphaMap",
|
|
1467
1499
|
"aoMap",
|
|
@@ -1495,7 +1527,7 @@ function W(h) {
|
|
|
1495
1527
|
for (const s of t) {
|
|
1496
1528
|
if (!s) continue;
|
|
1497
1529
|
let n = !1;
|
|
1498
|
-
for (const i of
|
|
1530
|
+
for (const i of Ws) {
|
|
1499
1531
|
const r = s[i];
|
|
1500
1532
|
r?.isTexture && r.image == null && (r.dispose(), s[i] = null, n = !0);
|
|
1501
1533
|
}
|
|
@@ -1505,17 +1537,17 @@ function W(h) {
|
|
|
1505
1537
|
}
|
|
1506
1538
|
class j {
|
|
1507
1539
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
1508
|
-
static fileLoader = new
|
|
1540
|
+
static fileLoader = new je().setResponseType("arraybuffer");
|
|
1509
1541
|
static dracoLoader = new ls().setDecoderPath(
|
|
1510
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1542
|
+
`https://cdn.jsdelivr.net/npm/three@0.${be}.0/examples/jsm/libs/draco/`
|
|
1511
1543
|
);
|
|
1512
1544
|
static ktx2Loader = new ds().setTranscoderPath(
|
|
1513
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1545
|
+
`https://cdn.jsdelivr.net/npm/three@0.${be}.0/examples/jsm/libs/basis/`
|
|
1514
1546
|
);
|
|
1515
|
-
static gltfLoader = new
|
|
1516
|
-
static sbmxLoader = new
|
|
1517
|
-
static sbmLoader = new
|
|
1518
|
-
static fbxLoader = new
|
|
1547
|
+
static gltfLoader = new Ge().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(Te);
|
|
1548
|
+
static sbmxLoader = new Os().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(Te);
|
|
1549
|
+
static sbmLoader = new $s();
|
|
1550
|
+
static fbxLoader = new os();
|
|
1519
1551
|
static objLoader = new cs();
|
|
1520
1552
|
static stlLoader = new hs();
|
|
1521
1553
|
static setLoadingManager(e) {
|
|
@@ -1551,17 +1583,17 @@ class j {
|
|
|
1551
1583
|
const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
|
|
1552
1584
|
return r.scene.animations = r.animations, W(r.scene);
|
|
1553
1585
|
case "sbm":
|
|
1554
|
-
const
|
|
1555
|
-
return W(o);
|
|
1556
|
-
case "fbx":
|
|
1557
|
-
const a = this.fbxLoader.parse(n, L.extractUrlBase(e));
|
|
1586
|
+
const a = await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
|
|
1558
1587
|
return W(a);
|
|
1588
|
+
case "fbx":
|
|
1589
|
+
const o = this.fbxLoader.parse(n, L.extractUrlBase(e));
|
|
1590
|
+
return W(o);
|
|
1559
1591
|
case "obj":
|
|
1560
1592
|
const c = new TextDecoder().decode(n), l = this.objLoader.parse(c);
|
|
1561
1593
|
return W(l);
|
|
1562
1594
|
case "stl":
|
|
1563
1595
|
const d = this.stlLoader.parse(n);
|
|
1564
|
-
return new D(d, new
|
|
1596
|
+
return new D(d, new I());
|
|
1565
1597
|
default:
|
|
1566
1598
|
throw new Error(`Unsupported model format: ${s}`);
|
|
1567
1599
|
}
|
|
@@ -1578,8 +1610,8 @@ class j {
|
|
|
1578
1610
|
}
|
|
1579
1611
|
}
|
|
1580
1612
|
}
|
|
1581
|
-
class
|
|
1582
|
-
static textureLoader = new
|
|
1613
|
+
class Mn {
|
|
1614
|
+
static textureLoader = new De();
|
|
1583
1615
|
static hdrLoader = new ps();
|
|
1584
1616
|
static cubeTextureLoader = new Mt();
|
|
1585
1617
|
static setLoadingManager(e) {
|
|
@@ -1590,7 +1622,7 @@ class Sn {
|
|
|
1590
1622
|
}
|
|
1591
1623
|
static async loadAsyncHDR(e) {
|
|
1592
1624
|
const t = await this.hdrLoader.loadAsync(e);
|
|
1593
|
-
return t.mapping =
|
|
1625
|
+
return t.mapping = Tt, t;
|
|
1594
1626
|
}
|
|
1595
1627
|
static async loadAsyncCubeTexture(e, t) {
|
|
1596
1628
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
@@ -1609,7 +1641,7 @@ class G extends D {
|
|
|
1609
1641
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1610
1642
|
}
|
|
1611
1643
|
}
|
|
1612
|
-
class
|
|
1644
|
+
class Ke extends R {
|
|
1613
1645
|
isBaseGroup = !0;
|
|
1614
1646
|
type = "BaseGroup";
|
|
1615
1647
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1620,7 +1652,7 @@ class We extends I {
|
|
|
1620
1652
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1621
1653
|
}
|
|
1622
1654
|
}
|
|
1623
|
-
class
|
|
1655
|
+
class Ks extends _t {
|
|
1624
1656
|
isBaseSprite = !0;
|
|
1625
1657
|
type = "BaseSprite";
|
|
1626
1658
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1631,7 +1663,7 @@ class Ws extends Tt {
|
|
|
1631
1663
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1632
1664
|
}
|
|
1633
1665
|
}
|
|
1634
|
-
class
|
|
1666
|
+
class ae extends Ke {
|
|
1635
1667
|
isModel = !0;
|
|
1636
1668
|
type = "Model";
|
|
1637
1669
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
@@ -1645,9 +1677,9 @@ class re extends We {
|
|
|
1645
1677
|
const { url: t, cache: s = !0, persistent: n = !0 } = e;
|
|
1646
1678
|
try {
|
|
1647
1679
|
let i;
|
|
1648
|
-
s ?
|
|
1649
|
-
const r = await i,
|
|
1650
|
-
return this.add(
|
|
1680
|
+
s ? ae.memoryCache.has(t) ? i = ae.memoryCache.get(t) : (i = j.loadAsync(t, { persistent: n }), ae.memoryCache.set(t, i)) : i = j.loadAsync(t, { persistent: n });
|
|
1681
|
+
const r = await i, a = us(r);
|
|
1682
|
+
return this.add(a), a.animations && a.animations.length > 0 && (this.animations = a.animations, this.mixer = new Et(a)), a;
|
|
1651
1683
|
} catch (i) {
|
|
1652
1684
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
1653
1685
|
}
|
|
@@ -1655,11 +1687,11 @@ class re extends We {
|
|
|
1655
1687
|
playAnimation(e, t = {}) {
|
|
1656
1688
|
if (!this.mixer || this.animations.length === 0) return null;
|
|
1657
1689
|
const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished: r = !1 } = t;
|
|
1658
|
-
let
|
|
1659
|
-
if (e === void 0 ?
|
|
1690
|
+
let a;
|
|
1691
|
+
if (e === void 0 ? a = this.animations[0] : typeof e == "number" ? a = this.animations[e] : a = this.animations.find((c) => c.name === e), !a)
|
|
1660
1692
|
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
1661
|
-
let
|
|
1662
|
-
return
|
|
1693
|
+
let o = this.actions.get(a.name);
|
|
1694
|
+
return o || (o = this.mixer.clipAction(a), this.actions.set(a.name, o)), o.setLoop(s ? Pt : Ot, n), o.clampWhenFinished = r, o.timeScale = i, o.reset().play(), o;
|
|
1663
1695
|
}
|
|
1664
1696
|
playAllAnimations(e = {}) {
|
|
1665
1697
|
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
@@ -1680,7 +1712,7 @@ class re extends We {
|
|
|
1680
1712
|
* Get the axis-aligned bounding box of this model.
|
|
1681
1713
|
*/
|
|
1682
1714
|
getBoundingBox() {
|
|
1683
|
-
return new
|
|
1715
|
+
return new q().setFromObject(this);
|
|
1684
1716
|
}
|
|
1685
1717
|
/**
|
|
1686
1718
|
* Get the center point of this model's bounding box.
|
|
@@ -1704,7 +1736,7 @@ class re extends We {
|
|
|
1704
1736
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
1705
1737
|
}
|
|
1706
1738
|
}
|
|
1707
|
-
class
|
|
1739
|
+
class Qs extends G {
|
|
1708
1740
|
isSphereMesh = !0;
|
|
1709
1741
|
type = "SphereMesh";
|
|
1710
1742
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
@@ -1716,10 +1748,10 @@ class Ks extends G {
|
|
|
1716
1748
|
e?.phiLength,
|
|
1717
1749
|
e?.thetaStart,
|
|
1718
1750
|
e?.thetaLength
|
|
1719
|
-
), this.material = new
|
|
1751
|
+
), this.material = new I(t);
|
|
1720
1752
|
}
|
|
1721
1753
|
}
|
|
1722
|
-
class
|
|
1754
|
+
class Pe extends G {
|
|
1723
1755
|
isTubeMesh = !0;
|
|
1724
1756
|
type = "TubeMesh";
|
|
1725
1757
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
@@ -1729,10 +1761,10 @@ class Ee extends G {
|
|
|
1729
1761
|
e?.radius,
|
|
1730
1762
|
e?.radialSegments,
|
|
1731
1763
|
e?.closed
|
|
1732
|
-
), this.material = new
|
|
1764
|
+
), this.material = new I(t);
|
|
1733
1765
|
}
|
|
1734
1766
|
}
|
|
1735
|
-
class
|
|
1767
|
+
class Tn extends Ke {
|
|
1736
1768
|
isTopology = !0;
|
|
1737
1769
|
type = "Topology";
|
|
1738
1770
|
// Visuals
|
|
@@ -1783,8 +1815,8 @@ class Mn extends We {
|
|
|
1783
1815
|
console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
|
|
1784
1816
|
return;
|
|
1785
1817
|
}
|
|
1786
|
-
const
|
|
1787
|
-
this.getNeighbors(e)?.set(t,
|
|
1818
|
+
const a = s ?? i.distanceTo(r);
|
|
1819
|
+
this.getNeighbors(e)?.set(t, a), n && this.getNeighbors(t)?.set(e, a);
|
|
1788
1820
|
}
|
|
1789
1821
|
/**
|
|
1790
1822
|
* Remove an edge between two nodes.
|
|
@@ -1802,32 +1834,32 @@ class Mn extends We {
|
|
|
1802
1834
|
if (!this.nodes.has(e) || !this.nodes.has(t))
|
|
1803
1835
|
return console.warn("[Topology] Start or End node not found."), [];
|
|
1804
1836
|
const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1805
|
-
for (const [
|
|
1806
|
-
s.set(
|
|
1837
|
+
for (const [o] of this.nodes)
|
|
1838
|
+
s.set(o, 1 / 0), n.set(o, null), i.add(o);
|
|
1807
1839
|
for (s.set(e, 0); i.size > 0; ) {
|
|
1808
|
-
let
|
|
1840
|
+
let o = null, c = 1 / 0;
|
|
1809
1841
|
for (const d of i) {
|
|
1810
1842
|
const p = s.get(d);
|
|
1811
|
-
p < c && (c = p,
|
|
1843
|
+
p < c && (c = p, o = d);
|
|
1812
1844
|
}
|
|
1813
|
-
if (
|
|
1845
|
+
if (o === null || o === t || c === 1 / 0)
|
|
1814
1846
|
break;
|
|
1815
|
-
i.delete(
|
|
1816
|
-
const l = this.adjacencyMap?.get(
|
|
1847
|
+
i.delete(o);
|
|
1848
|
+
const l = this.adjacencyMap?.get(o);
|
|
1817
1849
|
if (l)
|
|
1818
1850
|
for (const [d, p] of l) {
|
|
1819
1851
|
if (!i.has(d)) continue;
|
|
1820
|
-
const u = s.get(
|
|
1821
|
-
u < s.get(d) && (s.set(d, u), n.set(d,
|
|
1852
|
+
const u = s.get(o) + p;
|
|
1853
|
+
u < s.get(d) && (s.set(d, u), n.set(d, o));
|
|
1822
1854
|
}
|
|
1823
1855
|
}
|
|
1824
1856
|
const r = [];
|
|
1825
|
-
let
|
|
1857
|
+
let a = t;
|
|
1826
1858
|
if (n.get(t) === null && e !== t)
|
|
1827
1859
|
return [];
|
|
1828
|
-
for (;
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1860
|
+
for (; a !== null; ) {
|
|
1861
|
+
const o = this.nodes.get(a);
|
|
1862
|
+
o && r.unshift(o), a = n.get(a) || null;
|
|
1831
1863
|
}
|
|
1832
1864
|
return r;
|
|
1833
1865
|
}
|
|
@@ -1835,8 +1867,8 @@ class Mn extends We {
|
|
|
1835
1867
|
* Renders the entire topology graph structure using TubeGeometry and Spheres.
|
|
1836
1868
|
*/
|
|
1837
1869
|
renderGraph() {
|
|
1838
|
-
this.clearGraph(), this.graphGroup = new
|
|
1839
|
-
const e = new
|
|
1870
|
+
this.clearGraph(), this.graphGroup = new R();
|
|
1871
|
+
const e = new Qs({
|
|
1840
1872
|
geometryParameters: {
|
|
1841
1873
|
radius: this.parameters.nodeRadius,
|
|
1842
1874
|
widthSegments: 16,
|
|
@@ -1853,12 +1885,12 @@ class Mn extends We {
|
|
|
1853
1885
|
const t = /* @__PURE__ */ new Set();
|
|
1854
1886
|
this.adjacencyMap.forEach((s, n) => {
|
|
1855
1887
|
s.forEach((i, r) => {
|
|
1856
|
-
const
|
|
1857
|
-
if (t.has(
|
|
1858
|
-
t.add(
|
|
1859
|
-
const
|
|
1860
|
-
if (
|
|
1861
|
-
const l = new Lt(
|
|
1888
|
+
const a = [n, r].sort().join("-");
|
|
1889
|
+
if (t.has(a)) return;
|
|
1890
|
+
t.add(a);
|
|
1891
|
+
const o = this.nodes.get(n), c = this.nodes.get(r);
|
|
1892
|
+
if (o && c) {
|
|
1893
|
+
const l = new Lt(o, c), d = new Pe({
|
|
1862
1894
|
geometryParameters: {
|
|
1863
1895
|
path: l,
|
|
1864
1896
|
tubularSegments: 1,
|
|
@@ -1885,7 +1917,7 @@ class Mn extends We {
|
|
|
1885
1917
|
*/
|
|
1886
1918
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1887
1919
|
if (e.length < 2) return;
|
|
1888
|
-
const s = new
|
|
1920
|
+
const s = new Rt(e, !1, "catmullrom", 0), n = new Pe({
|
|
1889
1921
|
geometryParameters: {
|
|
1890
1922
|
path: s,
|
|
1891
1923
|
tubularSegments: e.length * 10,
|
|
@@ -1911,9 +1943,9 @@ class Mn extends We {
|
|
|
1911
1943
|
});
|
|
1912
1944
|
const t = [], s = /* @__PURE__ */ new Set();
|
|
1913
1945
|
return this.adjacencyMap.forEach((n, i) => {
|
|
1914
|
-
n.forEach((r,
|
|
1915
|
-
const
|
|
1916
|
-
s.has(
|
|
1946
|
+
n.forEach((r, a) => {
|
|
1947
|
+
const o = [i, a].sort().join("-");
|
|
1948
|
+
s.has(o) || (s.add(o), t.push({ from: i, to: a, weight: r }));
|
|
1917
1949
|
});
|
|
1918
1950
|
}), { nodes: e, edges: t };
|
|
1919
1951
|
}
|
|
@@ -1935,7 +1967,7 @@ class Mn extends We {
|
|
|
1935
1967
|
return this.adjacencyMap.get(e);
|
|
1936
1968
|
}
|
|
1937
1969
|
}
|
|
1938
|
-
class _n extends
|
|
1970
|
+
class _n extends Ks {
|
|
1939
1971
|
isPoi = !0;
|
|
1940
1972
|
type = "Poi";
|
|
1941
1973
|
parameters = {
|
|
@@ -1954,7 +1986,7 @@ class _n extends Ws {
|
|
|
1954
1986
|
_canvas = document.createElement("canvas");
|
|
1955
1987
|
_lastParametersJSON = "";
|
|
1956
1988
|
constructor(e = {}) {
|
|
1957
|
-
super(new
|
|
1989
|
+
super(new It()), Object.assign(this.parameters, e), this.updateAsync();
|
|
1958
1990
|
}
|
|
1959
1991
|
/**
|
|
1960
1992
|
* Update the POI with new parameters
|
|
@@ -1970,33 +2002,33 @@ class _n extends Ws {
|
|
|
1970
2002
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
1971
2003
|
let i = null;
|
|
1972
2004
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
1973
|
-
const { text: r, fontSize:
|
|
1974
|
-
let y = 0,
|
|
2005
|
+
const { text: r, fontSize: a, color: o, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: f } = this.parameters, v = n.measureText(r), T = r ? v.width : 0, x = r ? a : 0;
|
|
2006
|
+
let y = 0, _ = 0, O = 0, A = 0, E = 0, g = 0;
|
|
1975
2007
|
const b = !!i, z = !!r;
|
|
1976
2008
|
if (b && z)
|
|
1977
2009
|
switch (u) {
|
|
1978
2010
|
case "top":
|
|
1979
|
-
y = Math.max(c,
|
|
2011
|
+
y = Math.max(c, T), _ = c + l + x, E = (y - T) / 2, g = x / 2, O = (y - c) / 2, A = x + l;
|
|
1980
2012
|
break;
|
|
1981
2013
|
case "bottom":
|
|
1982
|
-
y = Math.max(c,
|
|
2014
|
+
y = Math.max(c, T), _ = c + l + x, O = (y - c) / 2, A = 0, E = (y - T) / 2, g = c + l + x / 2;
|
|
1983
2015
|
break;
|
|
1984
2016
|
case "left":
|
|
1985
|
-
y = c + l +
|
|
2017
|
+
y = c + l + T, _ = Math.max(c, x), E = 0, g = _ / 2, O = T + l, A = (_ - c) / 2;
|
|
1986
2018
|
break;
|
|
1987
2019
|
default:
|
|
1988
|
-
y = c + l +
|
|
2020
|
+
y = c + l + T, _ = Math.max(c, x), O = 0, A = (_ - c) / 2, E = c + l, g = _ / 2;
|
|
1989
2021
|
break;
|
|
1990
2022
|
}
|
|
1991
|
-
else b ? (y = c,
|
|
1992
|
-
const N = y + l * 2, P =
|
|
1993
|
-
if (s.width = N, s.height = P, n.font = `${
|
|
1994
|
-
n.fillStyle =
|
|
1995
|
-
const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent,
|
|
1996
|
-
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l +
|
|
2023
|
+
else b ? (y = c, _ = c, O = 0, A = 0) : z && (y = T, _ = x, E = 0, g = x / 2);
|
|
2024
|
+
const N = y + l * 2, P = _ + l * 2;
|
|
2025
|
+
if (s.width = N, s.height = P, n.font = `${a}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), b && n.drawImage(i, O + l, A + l, c, c), z) {
|
|
2026
|
+
n.fillStyle = o;
|
|
2027
|
+
const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent, tt = k.actualBoundingBoxAscent - U / 2;
|
|
2028
|
+
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l + tt);
|
|
1997
2029
|
}
|
|
1998
|
-
const
|
|
1999
|
-
$.colorSpace =
|
|
2030
|
+
const X = this.material.map, $ = new zt(s);
|
|
2031
|
+
$.colorSpace = ke, this.material.map = $, X?.dispose(), this.scale.set(N * f, P * f, 1);
|
|
2000
2032
|
}
|
|
2001
2033
|
_loadImage(e) {
|
|
2002
2034
|
return new Promise((t, s) => {
|
|
@@ -2014,39 +2046,39 @@ class _n extends Ws {
|
|
|
2014
2046
|
this.material.map?.dispose(), this.material.dispose();
|
|
2015
2047
|
}
|
|
2016
2048
|
}
|
|
2017
|
-
class
|
|
2049
|
+
class Qe extends G {
|
|
2018
2050
|
isShapeMesh = !0;
|
|
2019
2051
|
type = "ShapeMesh";
|
|
2020
2052
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2021
|
-
super(), this.geometry = new Nt(e?.shape, e?.curveSegments), this.material = new
|
|
2053
|
+
super(), this.geometry = new Nt(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2022
2054
|
}
|
|
2023
2055
|
static createFromPoints(e, t = {}) {
|
|
2024
|
-
return new
|
|
2056
|
+
return new Qe({
|
|
2025
2057
|
...t,
|
|
2026
2058
|
geometryParameters: {
|
|
2027
2059
|
...t.geometryParameters,
|
|
2028
|
-
shape: new
|
|
2060
|
+
shape: new Ue(e.map((s) => new C(s.x, -s.z)))
|
|
2029
2061
|
}
|
|
2030
2062
|
});
|
|
2031
2063
|
}
|
|
2032
2064
|
}
|
|
2033
|
-
class
|
|
2065
|
+
class qe extends G {
|
|
2034
2066
|
isExtrudeMesh = !0;
|
|
2035
2067
|
type = "ExtrudeMesh";
|
|
2036
2068
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2037
|
-
super(), this.geometry = new jt(e?.shape, e?.options), this.material = new
|
|
2069
|
+
super(), this.geometry = new jt(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2038
2070
|
}
|
|
2039
2071
|
static createFromPoints(e, t = {}) {
|
|
2040
|
-
return e && e.length === 0 && (e = void 0), new
|
|
2072
|
+
return e && e.length === 0 && (e = void 0), new qe({
|
|
2041
2073
|
...t,
|
|
2042
2074
|
geometryParameters: {
|
|
2043
2075
|
...t.geometryParameters,
|
|
2044
|
-
shape: new
|
|
2076
|
+
shape: new Ue(e?.map((s) => new C(s.x, -s.z)))
|
|
2045
2077
|
}
|
|
2046
2078
|
});
|
|
2047
2079
|
}
|
|
2048
2080
|
}
|
|
2049
|
-
class
|
|
2081
|
+
class En extends G {
|
|
2050
2082
|
isPlaneMesh = !0;
|
|
2051
2083
|
type = "PlaneMesh";
|
|
2052
2084
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
@@ -2055,10 +2087,10 @@ class Tn extends G {
|
|
|
2055
2087
|
e?.height,
|
|
2056
2088
|
e?.widthSegments,
|
|
2057
2089
|
e?.heightSegments
|
|
2058
|
-
), this.material = new
|
|
2090
|
+
), this.material = new I(t);
|
|
2059
2091
|
}
|
|
2060
2092
|
}
|
|
2061
|
-
class
|
|
2093
|
+
class Pn extends G {
|
|
2062
2094
|
isCircleMesh = !0;
|
|
2063
2095
|
type = "CircleMesh";
|
|
2064
2096
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
@@ -2069,7 +2101,7 @@ class En extends G {
|
|
|
2069
2101
|
e?.thetaStart,
|
|
2070
2102
|
e?.thetaLength
|
|
2071
2103
|
),
|
|
2072
|
-
new
|
|
2104
|
+
new I(t)
|
|
2073
2105
|
), this.geometry.rotateX(-Math.PI / 2);
|
|
2074
2106
|
}
|
|
2075
2107
|
}
|
|
@@ -2080,14 +2112,14 @@ class F {
|
|
|
2080
2112
|
});
|
|
2081
2113
|
}
|
|
2082
2114
|
}
|
|
2083
|
-
class
|
|
2115
|
+
class On {
|
|
2084
2116
|
static flow(e = {}) {
|
|
2085
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e,
|
|
2086
|
-
return
|
|
2117
|
+
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, a = H(new M(t)), o = H(new M(s)), c = Ce().x.mul(i).sub(se.mul(n)), l = ne(ue(c).add(1).mul(0.5), r);
|
|
2118
|
+
return ie(a, o, l);
|
|
2087
2119
|
}
|
|
2088
2120
|
static breathe(e = {}) {
|
|
2089
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new M(t)),
|
|
2090
|
-
return
|
|
2121
|
+
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new M(t)), a = H(new M(s)), o = ue(se.mul(n)).add(1).mul(0.5), c = ne(o, i);
|
|
2122
|
+
return ie(r, a, c);
|
|
2091
2123
|
}
|
|
2092
2124
|
static fluid(e = {}) {
|
|
2093
2125
|
const {
|
|
@@ -2096,48 +2128,48 @@ class Pn {
|
|
|
2096
2128
|
speed: n = 1,
|
|
2097
2129
|
scale: i = 1,
|
|
2098
2130
|
intensity: r = 1,
|
|
2099
|
-
distortion:
|
|
2100
|
-
} = e,
|
|
2101
|
-
return
|
|
2131
|
+
distortion: a = 0.5
|
|
2132
|
+
} = e, o = H(new M(t)), c = H(new M(s)), l = Ce().mul(i), d = se.mul(n), p = Se(l.add(d), 1, 0), u = l.add(p.mul(a)), f = Se(u, 1, 0).add(1).mul(0.5), v = ne(f, r);
|
|
2133
|
+
return ie(o, c, v);
|
|
2102
2134
|
}
|
|
2103
2135
|
}
|
|
2104
|
-
function
|
|
2136
|
+
function An(h) {
|
|
2105
2137
|
}
|
|
2106
|
-
const
|
|
2107
|
-
const h = B(Q, "uint"), e = B(
|
|
2108
|
-
return
|
|
2109
|
-
})(), Xs =
|
|
2138
|
+
const le = "uSpaceHighlight", Q = `${le}/enabled`, Xe = `${le}/opacity`, Ye = `${le}/color`, Je = `${le}/overwrite`, de = "uSpaceBreathe", ce = `${de}/enabled`, Ve = `${de}/color`, Ze = `${de}/speed`, et = `${de}/intensity`, he = /* @__PURE__ */ new WeakMap(), qs = He(() => {
|
|
2139
|
+
const h = B(Q, "uint"), e = B(Ye, "uint"), t = B(Je, "uint"), s = Be(e), n = Me.mul(s), i = re(t.greaterThan(0), s, n), r = re(h.greaterThan(0), i, Me), a = B(ce, "uint"), o = B(Ve, "uint"), c = B(Ze, "float"), l = B(et, "float"), d = Be(o), p = ue(se.mul(c)).add(1).mul(0.5), u = ne(p, l), f = ie(r, d, u);
|
|
2140
|
+
return re(a.greaterThan(0), f, r);
|
|
2141
|
+
})(), Xs = He(() => {
|
|
2110
2142
|
const h = B(Q, "uint"), e = B(Xe, "float");
|
|
2111
|
-
return
|
|
2143
|
+
return re(h.greaterThan(0), e, Xt);
|
|
2112
2144
|
})();
|
|
2113
|
-
function
|
|
2145
|
+
function Oe(h) {
|
|
2114
2146
|
const e = h.material;
|
|
2115
2147
|
if (!e || Array.isArray(e)) return;
|
|
2116
|
-
let t =
|
|
2148
|
+
let t = he.get(e);
|
|
2117
2149
|
t || (t = {
|
|
2118
2150
|
colorNode: e.colorNode,
|
|
2119
2151
|
opacityNode: e.opacityNode,
|
|
2120
2152
|
transparent: e.transparent,
|
|
2121
2153
|
depthWrite: e.depthWrite,
|
|
2122
2154
|
activeMeshes: /* @__PURE__ */ new Set()
|
|
2123
|
-
},
|
|
2155
|
+
}, he.set(e, t)), t.activeMeshes.add(h), e.transparent = !0, e.colorNode = qs, e.opacityNode = Xs, e.needsUpdate = !0;
|
|
2124
2156
|
}
|
|
2125
|
-
function
|
|
2126
|
-
const e = h.userData[Q], t = h.userData[
|
|
2157
|
+
function Ae(h) {
|
|
2158
|
+
const e = h.userData[Q], t = h.userData[ce];
|
|
2127
2159
|
if (e || t) return;
|
|
2128
2160
|
const s = h.material;
|
|
2129
2161
|
if (!s || Array.isArray(s)) return;
|
|
2130
|
-
const n =
|
|
2131
|
-
n && (n.activeMeshes.delete(h), !(n.activeMeshes.size > 0) && (s.colorNode = n.colorNode, s.opacityNode = n.opacityNode, s.transparent = n.transparent, s.depthWrite = n.depthWrite, s.needsUpdate = !0,
|
|
2162
|
+
const n = he.get(s);
|
|
2163
|
+
n && (n.activeMeshes.delete(h), !(n.activeMeshes.size > 0) && (s.colorNode = n.colorNode, s.opacityNode = n.opacityNode, s.transparent = n.transparent, s.depthWrite = n.depthWrite, s.needsUpdate = !0, he.delete(s)));
|
|
2132
2164
|
}
|
|
2133
2165
|
class oe {
|
|
2134
2166
|
static highlightColor(e, t = {}) {
|
|
2135
|
-
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite:
|
|
2167
|
+
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: a } = t, o = new M(i).getHex();
|
|
2136
2168
|
for (const c of s)
|
|
2137
2169
|
F.traverseMeshes(c, (l) => {
|
|
2138
|
-
if (l.userData[Q] = 1, l.userData[Xe] = n, l.userData[
|
|
2170
|
+
if (l.userData[Q] = 1, l.userData[Xe] = n, l.userData[Ye] = o, l.userData[Je] = r ? 1 : 0, Oe(l), a !== void 0) {
|
|
2139
2171
|
const d = l.material;
|
|
2140
|
-
d && !Array.isArray(d) && (d.depthWrite =
|
|
2172
|
+
d && !Array.isArray(d) && (d.depthWrite = a);
|
|
2141
2173
|
}
|
|
2142
2174
|
});
|
|
2143
2175
|
}
|
|
@@ -2145,7 +2177,7 @@ class oe {
|
|
|
2145
2177
|
const t = Array.isArray(e) ? e : [e];
|
|
2146
2178
|
for (const s of t)
|
|
2147
2179
|
F.traverseMeshes(s, (n) => {
|
|
2148
|
-
n.userData[Q] = 0,
|
|
2180
|
+
n.userData[Q] = 0, Ae(n);
|
|
2149
2181
|
});
|
|
2150
2182
|
}
|
|
2151
2183
|
static breatheColor(e, t = {}) {
|
|
@@ -2160,14 +2192,14 @@ class oe {
|
|
|
2160
2192
|
n.color = new M(n.color).getHex();
|
|
2161
2193
|
for (const i of s)
|
|
2162
2194
|
F.traverseMeshes(i, (r) => {
|
|
2163
|
-
r.userData[
|
|
2195
|
+
r.userData[ce] = 1, r.userData[Ve] = n.color, r.userData[Ze] = n.speed, r.userData[et] = n.intensity, Oe(r);
|
|
2164
2196
|
});
|
|
2165
2197
|
}
|
|
2166
2198
|
static removeBreatheColor(e) {
|
|
2167
2199
|
const t = Array.isArray(e) ? e : [e];
|
|
2168
2200
|
for (const s of t)
|
|
2169
2201
|
F.traverseMeshes(s, (n) => {
|
|
2170
|
-
n.userData[
|
|
2202
|
+
n.userData[ce] = 0, Ae(n);
|
|
2171
2203
|
});
|
|
2172
2204
|
}
|
|
2173
2205
|
/**
|
|
@@ -2205,18 +2237,18 @@ class oe {
|
|
|
2205
2237
|
}
|
|
2206
2238
|
static _fade(e, t, s, n) {
|
|
2207
2239
|
const i = Array.isArray(e) ? e : [e], r = [];
|
|
2208
|
-
for (const
|
|
2209
|
-
F.traverseMeshes(
|
|
2210
|
-
const c =
|
|
2240
|
+
for (const a of i)
|
|
2241
|
+
F.traverseMeshes(a, (o) => {
|
|
2242
|
+
const c = o.material;
|
|
2211
2243
|
!c || Array.isArray(c) || (c.transparent = !0, c.opacity = t, c.needsUpdate = !0, r.push({ material: c, targetOpacity: s }));
|
|
2212
2244
|
});
|
|
2213
|
-
return r.length === 0 ? Promise.resolve() : new Promise((
|
|
2214
|
-
const
|
|
2245
|
+
return r.length === 0 ? Promise.resolve() : new Promise((a) => {
|
|
2246
|
+
const o = performance.now();
|
|
2215
2247
|
let c = 0;
|
|
2216
2248
|
const l = () => {
|
|
2217
|
-
const d = performance.now() -
|
|
2249
|
+
const d = performance.now() - o, p = Math.min(d / n, 1);
|
|
2218
2250
|
if (!i[0].parent) {
|
|
2219
|
-
cancelAnimationFrame(c),
|
|
2251
|
+
cancelAnimationFrame(c), a();
|
|
2220
2252
|
return;
|
|
2221
2253
|
}
|
|
2222
2254
|
for (const { material: f, targetOpacity: v } of r)
|
|
@@ -2227,18 +2259,18 @@ class oe {
|
|
|
2227
2259
|
if (s >= 1)
|
|
2228
2260
|
for (const { material: f } of r)
|
|
2229
2261
|
f.transparent = !1;
|
|
2230
|
-
|
|
2262
|
+
a();
|
|
2231
2263
|
}
|
|
2232
2264
|
};
|
|
2233
2265
|
c = requestAnimationFrame(l);
|
|
2234
2266
|
});
|
|
2235
2267
|
}
|
|
2236
2268
|
}
|
|
2237
|
-
const
|
|
2269
|
+
const Be = (h) => {
|
|
2238
2270
|
const e = h.shiftRight(16).bitAnd(255).toFloat().div(255), t = h.shiftRight(8).bitAnd(255).toFloat().div(255), s = h.bitAnd(255).toFloat().div(255);
|
|
2239
2271
|
return Yt(e, t, s);
|
|
2240
2272
|
};
|
|
2241
|
-
class
|
|
2273
|
+
class Ys extends ms {
|
|
2242
2274
|
viewer;
|
|
2243
2275
|
constructor(e, t) {
|
|
2244
2276
|
super(t), this.viewer = e;
|
|
@@ -2247,7 +2279,7 @@ class qs extends ms {
|
|
|
2247
2279
|
this.update(e) && this.viewer.render();
|
|
2248
2280
|
};
|
|
2249
2281
|
easingByMode(e) {
|
|
2250
|
-
const t =
|
|
2282
|
+
const t = Js[e];
|
|
2251
2283
|
return super.easing(t);
|
|
2252
2284
|
}
|
|
2253
2285
|
start(e, t) {
|
|
@@ -2257,21 +2289,21 @@ class qs extends ms {
|
|
|
2257
2289
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
2258
2290
|
}
|
|
2259
2291
|
}
|
|
2260
|
-
function
|
|
2261
|
-
return new Promise((r,
|
|
2262
|
-
const { duration:
|
|
2292
|
+
function Bn(h, e, t, s = {}, n, i) {
|
|
2293
|
+
return new Promise((r, a) => {
|
|
2294
|
+
const { duration: o = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new Ys(h, e).to(t, o).easingByMode(d).delay(c).onUpdate((f) => {
|
|
2263
2295
|
n?.(f, u);
|
|
2264
2296
|
}).onComplete(() => {
|
|
2265
2297
|
r();
|
|
2266
2298
|
}).onStop(() => {
|
|
2267
|
-
|
|
2299
|
+
a("animation stop");
|
|
2268
2300
|
}).onStart(() => {
|
|
2269
2301
|
i?.(u);
|
|
2270
2302
|
});
|
|
2271
2303
|
typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
|
|
2272
2304
|
});
|
|
2273
2305
|
}
|
|
2274
|
-
const
|
|
2306
|
+
const Js = {
|
|
2275
2307
|
"Linear.None": m.Linear.None,
|
|
2276
2308
|
"Quadratic.In": m.Quadratic.In,
|
|
2277
2309
|
"Quadratic.Out": m.Quadratic.Out,
|
|
@@ -2304,7 +2336,7 @@ const Ys = {
|
|
|
2304
2336
|
"Bounce.Out": m.Bounce.Out,
|
|
2305
2337
|
"Bounce.InOut": m.Bounce.InOut
|
|
2306
2338
|
};
|
|
2307
|
-
class
|
|
2339
|
+
class Ln {
|
|
2308
2340
|
scene;
|
|
2309
2341
|
planes = /* @__PURE__ */ new Map();
|
|
2310
2342
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -2353,24 +2385,24 @@ class Bn {
|
|
|
2353
2385
|
constant: n = 0,
|
|
2354
2386
|
showHelper: i = !1,
|
|
2355
2387
|
helperSize: r = 5,
|
|
2356
|
-
helperColor:
|
|
2357
|
-
} = t,
|
|
2358
|
-
return this.planes.set(e,
|
|
2388
|
+
helperColor: a = 16711680
|
|
2389
|
+
} = t, o = new Ht(new w(s.x, s.y, s.z), n);
|
|
2390
|
+
return this.planes.set(e, o), this._syncPlanes(), i && this.showHelper(e, r, a), o;
|
|
2359
2391
|
}
|
|
2360
2392
|
/**
|
|
2361
2393
|
* Add six clipping planes that form a box around a Box3.
|
|
2362
2394
|
* Returns the six plane ids: `${id}_+x`, `${id}_-x`, etc.
|
|
2363
2395
|
*/
|
|
2364
2396
|
addBox(e, t, s = {}) {
|
|
2365
|
-
const { showHelpers: n = !1, helperColor: i = 16711680 } = s, r = t.min,
|
|
2366
|
-
{ suffix: "+x", normal: { x: -1, y: 0, z: 0 }, constant:
|
|
2397
|
+
const { showHelpers: n = !1, helperColor: i = 16711680 } = s, r = t.min, a = t.max, o = [
|
|
2398
|
+
{ suffix: "+x", normal: { x: -1, y: 0, z: 0 }, constant: a.x },
|
|
2367
2399
|
{ suffix: "-x", normal: { x: 1, y: 0, z: 0 }, constant: -r.x },
|
|
2368
|
-
{ suffix: "+y", normal: { x: 0, y: -1, z: 0 }, constant:
|
|
2400
|
+
{ suffix: "+y", normal: { x: 0, y: -1, z: 0 }, constant: a.y },
|
|
2369
2401
|
{ suffix: "-y", normal: { x: 0, y: 1, z: 0 }, constant: -r.y },
|
|
2370
|
-
{ suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant:
|
|
2402
|
+
{ suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant: a.z },
|
|
2371
2403
|
{ suffix: "-z", normal: { x: 0, y: 0, z: 1 }, constant: -r.z }
|
|
2372
2404
|
], c = [];
|
|
2373
|
-
for (const l of
|
|
2405
|
+
for (const l of o) {
|
|
2374
2406
|
const d = `${e}_${l.suffix}`;
|
|
2375
2407
|
this.addPlane(d, { normal: l.normal, constant: l.constant, showHelper: n, helperColor: i }), c.push(d);
|
|
2376
2408
|
}
|
|
@@ -2380,7 +2412,7 @@ class Bn {
|
|
|
2380
2412
|
* Add a clipping box from an object's bounding box with optional padding.
|
|
2381
2413
|
*/
|
|
2382
2414
|
addBoxFromObject(e, t, s = 0, n = {}) {
|
|
2383
|
-
const i = new
|
|
2415
|
+
const i = new q().setFromObject(t);
|
|
2384
2416
|
return i.expandByScalar(s), this.addBox(e, i, n);
|
|
2385
2417
|
}
|
|
2386
2418
|
/**
|
|
@@ -2446,7 +2478,7 @@ class Bn {
|
|
|
2446
2478
|
this.detach(), this.removeAll(), this.scene.remove(this.group);
|
|
2447
2479
|
}
|
|
2448
2480
|
}
|
|
2449
|
-
class
|
|
2481
|
+
class Rn {
|
|
2450
2482
|
scene;
|
|
2451
2483
|
measurements = /* @__PURE__ */ new Map();
|
|
2452
2484
|
_idCounter = 0;
|
|
@@ -2457,19 +2489,19 @@ class Ln {
|
|
|
2457
2489
|
* Measure distance between two points.
|
|
2458
2490
|
*/
|
|
2459
2491
|
measureDistance(e, t, s = {}) {
|
|
2460
|
-
const { lineColor: n = 16776960 } = s, i = new w(e.x, e.y, e.z), r = new w(t.x, t.y, t.z),
|
|
2461
|
-
c.name =
|
|
2462
|
-
const l = new K().setFromPoints([i, r]), d = new
|
|
2492
|
+
const { lineColor: n = 16776960 } = s, i = new w(e.x, e.y, e.z), r = new w(t.x, t.y, t.z), a = i.distanceTo(r), o = `measure_dist_${this._idCounter++}`, c = new R();
|
|
2493
|
+
c.name = o;
|
|
2494
|
+
const l = new K().setFromPoints([i, r]), d = new ee({ color: n }), p = new te(l, d);
|
|
2463
2495
|
c.add(p), this.scene.add(c);
|
|
2464
2496
|
const u = {
|
|
2465
|
-
id:
|
|
2497
|
+
id: o,
|
|
2466
2498
|
type: "distance",
|
|
2467
|
-
value:
|
|
2499
|
+
value: a,
|
|
2468
2500
|
unit: "m",
|
|
2469
2501
|
points: [i, r],
|
|
2470
2502
|
object: c
|
|
2471
2503
|
};
|
|
2472
|
-
return this.measurements.set(
|
|
2504
|
+
return this.measurements.set(o, u), u;
|
|
2473
2505
|
}
|
|
2474
2506
|
/**
|
|
2475
2507
|
* Measure the area of a polygon defined by 3+ coplanar points.
|
|
@@ -2478,17 +2510,17 @@ class Ln {
|
|
|
2478
2510
|
const { lineColor: s = 65280 } = t;
|
|
2479
2511
|
if (e.length < 3)
|
|
2480
2512
|
throw new Error("MeasureTool.measureArea requires at least 3 points");
|
|
2481
|
-
const n = e.map((u) => new w(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`,
|
|
2482
|
-
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2513
|
+
const n = e.map((u) => new w(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`, a = new R();
|
|
2514
|
+
a.name = r;
|
|
2515
|
+
const o = [...n, n[0]], c = new K().setFromPoints(o), l = new ee({ color: s }), d = new te(c, l);
|
|
2516
|
+
a.add(d), this.scene.add(a);
|
|
2485
2517
|
const p = {
|
|
2486
2518
|
id: r,
|
|
2487
2519
|
type: "area",
|
|
2488
2520
|
value: i,
|
|
2489
2521
|
unit: "m²",
|
|
2490
2522
|
points: n,
|
|
2491
|
-
object:
|
|
2523
|
+
object: a
|
|
2492
2524
|
};
|
|
2493
2525
|
return this.measurements.set(r, p), p;
|
|
2494
2526
|
}
|
|
@@ -2496,16 +2528,16 @@ class Ln {
|
|
|
2496
2528
|
* Measure the angle between three points (vertex at the middle point).
|
|
2497
2529
|
*/
|
|
2498
2530
|
measureAngle(e, t, s, n = {}) {
|
|
2499
|
-
const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z),
|
|
2531
|
+
const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z), a = new w(t.x, t.y, t.z), o = new w(s.x, s.y, s.z), c = r.clone().sub(a).normalize(), l = o.clone().sub(a).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, f = new R();
|
|
2500
2532
|
f.name = u;
|
|
2501
|
-
const v = new K().setFromPoints([r,
|
|
2533
|
+
const v = new K().setFromPoints([r, a, o]), T = new ee({ color: i }), x = new te(v, T);
|
|
2502
2534
|
f.add(x), this.scene.add(f);
|
|
2503
2535
|
const y = {
|
|
2504
2536
|
id: u,
|
|
2505
2537
|
type: "angle",
|
|
2506
2538
|
value: p,
|
|
2507
2539
|
unit: "°",
|
|
2508
|
-
points: [r,
|
|
2540
|
+
points: [r, a, o],
|
|
2509
2541
|
object: f
|
|
2510
2542
|
};
|
|
2511
2543
|
return this.measurements.set(u, y), y;
|
|
@@ -2545,8 +2577,8 @@ class Ln {
|
|
|
2545
2577
|
_calculatePolygonArea(e) {
|
|
2546
2578
|
const t = e.length, s = new w();
|
|
2547
2579
|
for (let i = 0; i < t; i++) {
|
|
2548
|
-
const r = e[i],
|
|
2549
|
-
s.add(
|
|
2580
|
+
const r = e[i], a = e[(i + 1) % t], o = new w().crossVectors(r, a);
|
|
2581
|
+
s.add(o);
|
|
2550
2582
|
}
|
|
2551
2583
|
const n = new w();
|
|
2552
2584
|
if (t >= 3) {
|
|
@@ -2579,7 +2611,7 @@ class In {
|
|
|
2579
2611
|
*/
|
|
2580
2612
|
add(e, t) {
|
|
2581
2613
|
this.annotations.has(e) && this.remove(e);
|
|
2582
|
-
const s = new
|
|
2614
|
+
const s = new R();
|
|
2583
2615
|
s.name = `annotation_${e}`;
|
|
2584
2616
|
const n = new w(t.position.x, t.position.y, t.position.z);
|
|
2585
2617
|
s.position.copy(n);
|
|
@@ -2596,27 +2628,27 @@ class In {
|
|
|
2596
2628
|
for (const [c, l] of Object.entries(t.labelStyle))
|
|
2597
2629
|
l !== void 0 && (i.style[c] = l);
|
|
2598
2630
|
let r = null;
|
|
2599
|
-
const
|
|
2631
|
+
const a = t.labelOffset || { x: 0, y: 2, z: 0 };
|
|
2600
2632
|
if (t.showLeaderLine !== !1) {
|
|
2601
2633
|
const { lineColor: c = 16777215 } = t, l = new K().setFromPoints([
|
|
2602
2634
|
new w(0, 0, 0),
|
|
2603
|
-
new w(
|
|
2604
|
-
]), d = new
|
|
2605
|
-
r = new
|
|
2635
|
+
new w(a.x, a.y, a.z)
|
|
2636
|
+
]), d = new ee({ color: c });
|
|
2637
|
+
r = new te(l, d), s.add(r);
|
|
2606
2638
|
}
|
|
2607
2639
|
if (this._createCSSObject) {
|
|
2608
2640
|
const c = this._createCSSObject(i);
|
|
2609
|
-
c.position.set(
|
|
2641
|
+
c.position.set(a.x, a.y, a.z), s.add(c);
|
|
2610
2642
|
}
|
|
2611
2643
|
this.scene.add(s);
|
|
2612
|
-
const
|
|
2644
|
+
const o = {
|
|
2613
2645
|
id: e,
|
|
2614
2646
|
options: t,
|
|
2615
2647
|
group: s,
|
|
2616
2648
|
labelElement: i,
|
|
2617
2649
|
line: r
|
|
2618
2650
|
};
|
|
2619
|
-
return this.annotations.set(e,
|
|
2651
|
+
return this.annotations.set(e, o), o;
|
|
2620
2652
|
}
|
|
2621
2653
|
/**
|
|
2622
2654
|
* Quick-add a text annotation.
|
|
@@ -2710,47 +2742,47 @@ class In {
|
|
|
2710
2742
|
this.removeAll();
|
|
2711
2743
|
}
|
|
2712
2744
|
}
|
|
2713
|
-
const
|
|
2714
|
-
window.__USPACE__ = { version:
|
|
2745
|
+
const Vs = "0.0.22";
|
|
2746
|
+
window.__USPACE__ = { version: Vs };
|
|
2715
2747
|
export {
|
|
2716
2748
|
In as AnnotationManager,
|
|
2717
|
-
|
|
2749
|
+
Ke as BaseGroup,
|
|
2718
2750
|
G as BaseMesh,
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2751
|
+
Ks as BaseSprite,
|
|
2752
|
+
jn as CSS2DObject,
|
|
2753
|
+
kn as CSS3DObject,
|
|
2754
|
+
Un as CSS3DSprite,
|
|
2755
|
+
_s as CSSRenderer,
|
|
2724
2756
|
bs as CameraControls,
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2757
|
+
Pn as CircleMesh,
|
|
2758
|
+
Ln as ClippingTool,
|
|
2759
|
+
qe as ExtrudeMesh,
|
|
2728
2760
|
fs as InteractionEvent,
|
|
2729
2761
|
gs as InteractionManager,
|
|
2730
|
-
|
|
2762
|
+
Cn as LightManager,
|
|
2731
2763
|
oe as MaterialEffects,
|
|
2732
|
-
|
|
2733
|
-
|
|
2764
|
+
Rn as MeasureTool,
|
|
2765
|
+
ae as Model,
|
|
2734
2766
|
j as ModelLoaderManager,
|
|
2735
2767
|
ys as ObjectManager,
|
|
2736
2768
|
F as ObjectUtils,
|
|
2737
|
-
|
|
2769
|
+
En as PlaneMesh,
|
|
2738
2770
|
_n as Poi,
|
|
2739
2771
|
ws as RenderPipeline,
|
|
2740
2772
|
Cs as RoomEnvironment,
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2773
|
+
$s as SBMLoader,
|
|
2774
|
+
Os as SBMXLoader,
|
|
2775
|
+
xn as SceneManager,
|
|
2776
|
+
bn as Selection,
|
|
2777
|
+
Qe as ShapeMesh,
|
|
2778
|
+
Qs as SphereMesh,
|
|
2779
|
+
On as TSLEffects,
|
|
2780
|
+
Mn as TextureLoaderManager,
|
|
2781
|
+
Tn as Topology,
|
|
2782
|
+
Pe as TubeMesh,
|
|
2783
|
+
Ys as Tween,
|
|
2784
|
+
Sn as Viewer,
|
|
2785
|
+
An as reinterpretType,
|
|
2786
|
+
Bn as tweenAnimation,
|
|
2787
|
+
Vs as version
|
|
2756
2788
|
};
|