u-space 0.0.27 → 0.0.29
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 +363 -368
- package/dist/plugins/u-manager/index.cjs +55 -55
- package/dist/plugins/u-manager/index.d.ts +2 -0
- package/dist/plugins/u-manager/index.js +9429 -9292
- package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +51 -0
- package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +42 -0
- package/dist/plugins/u-manager/instances/index.d.ts +2 -0
- package/dist/plugins/u-manager/loaders/SceneInstancedLayer.d.ts +6 -22
- package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +12 -3
- package/dist/plugins/u-manager/loaders/UManagerLoader.d.ts +24 -0
- package/dist/plugins/u-manager/semantics/SemanticLoader.d.ts +2 -2
- package/dist/plugins/u-manager/semantics/SemanticParser.d.ts +3 -3
- package/dist/plugins/u-manager/semantics/index.d.ts +1 -1
- package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +12 -10
- package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +5 -39
- package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +38 -15
- package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +27 -0
- package/dist/plugins/u-manager/semantics/types.d.ts +1 -0
- package/dist/src/effects/MaterialEffects.d.ts +1 -0
- package/docs/api-effects.md +3 -2
- package/docs/api-managers.md +1 -1
- package/docs/api-plugin-u-manager.md +217 -104
- package/docs/changelog.md +43 -9
- package/docs/examples-guide.md +44 -14
- package/docs/getting-started.md +1 -1
- package/docs/mcp.md +16 -8
- package/package.json +1 -1
- package/dist/plugins/u-manager/semantics/objects/SemanticSceneGroup.d.ts +0 -31
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Raycaster as
|
|
2
|
-
import { pass as
|
|
3
|
-
import { bloom as
|
|
4
|
-
import { ssgi as
|
|
5
|
-
import { traa as
|
|
6
|
-
import
|
|
7
|
-
import { RoomEnvironment as
|
|
8
|
-
import { ViewHelper as
|
|
9
|
-
import { CSS2DRenderer as
|
|
10
|
-
import { CSS2DObject as
|
|
11
|
-
import { CSS3DRenderer as
|
|
12
|
-
import { CSS3DObject as
|
|
13
|
-
import { GLTFLoader as
|
|
14
|
-
import { FBXLoader as
|
|
15
|
-
import { OBJLoader as
|
|
16
|
-
import { STLLoader as
|
|
17
|
-
import { DRACOLoader as
|
|
18
|
-
import { KTX2Loader as
|
|
19
|
-
import { MeshoptDecoder as
|
|
20
|
-
import { HDRLoader as
|
|
21
|
-
import { clone as
|
|
22
|
-
import { Easing as f, Tween as
|
|
23
|
-
class
|
|
1
|
+
import { Raycaster as De, Vector2 as C, EventDispatcher as ke, Box2 as at, Matrix4 as je, Vector3 as v, Box3 as V, Scene as Ue, Color as T, AmbientLight as ct, DirectionalLight as we, PointLight as ve, SpotLight as be, HemisphereLight as xe, DirectionalLightHelper as ht, PointLightHelper as lt, SpotLightHelper as dt, HemisphereLightHelper as pt, RenderPipeline as ut, PerspectiveCamera as se, Sphere as fe, Spherical as M, Quaternion as mt, Vector4 as ft, MathUtils as gt, PMREMGenerator as yt, OrthographicCamera as ne, TimestampQuery as Z, Cache as wt, Timer as vt, WebGPURenderer as bt, PCFShadowMap as xt, AgXToneMapping as St, Fog as Ct, FogExp2 as Tt, MeshStandardNodeMaterial as L, Loader as Mt, LoaderUtils as R, FileLoader as He, TextureLoader as Fe, Group as I, SRGBColorSpace as Ge, RepeatWrapping as Se, BufferGeometry as Q, BufferAttribute as Ce, Mesh as k, FrontSide as _t, BackSide as Et, DoubleSide as Pt, REVISION as Te, CubeTextureLoader as Ot, EquirectangularReflectionMapping as At, Sprite as Bt, AnimationMixer as Rt, LoopRepeat as It, LoopOnce as Lt, SphereGeometry as zt, TubeGeometry as Nt, LineCurve3 as Dt, CatmullRomCurve3 as kt, SpriteNodeMaterial as jt, CanvasTexture as Ut, ShapeGeometry as Ht, Shape as $e, ExtrudeGeometry as Ft, PlaneGeometry as Gt, CircleGeometry as $t, ClippingGroup as Wt, Plane as Kt, PlaneHelper as Qt, LineBasicMaterial as ie, Line as re } from "three/webgpu";
|
|
2
|
+
import { pass as ge, mrt as qt, output as Xt, add as Me, blendColor as Yt, emissive as Vt, normalView as Jt, velocity as Zt, color as H, uv as _e, time as oe, pow as ae, sin as ye, mix as ce, mx_noise_float as Ee, Fn as We, userData as O, materialColor as Pe, select as q, materialOpacity as Oe, vec3 as es } from "three/tsl";
|
|
3
|
+
import { bloom as ts } from "three/addons/tsl/display/BloomNode.js";
|
|
4
|
+
import { ssgi as ss } from "three/addons/tsl/display/SSGINode.js";
|
|
5
|
+
import { traa as ns } from "three/addons/tsl/display/TRAANode.js";
|
|
6
|
+
import Ke from "camera-controls";
|
|
7
|
+
import { RoomEnvironment as is } from "three/addons/environments/RoomEnvironment.js";
|
|
8
|
+
import { ViewHelper as rs } from "three/addons/helpers/ViewHelper.js";
|
|
9
|
+
import { CSS2DRenderer as os, CSS2DObject as as } from "three/addons/renderers/CSS2DRenderer.js";
|
|
10
|
+
import { CSS2DObject as $n } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
+
import { CSS3DRenderer as cs, CSS3DSprite as hs, CSS3DObject as ls } from "three/addons/renderers/CSS3DRenderer.js";
|
|
12
|
+
import { CSS3DObject as Kn, CSS3DSprite as Qn } from "three/addons/renderers/CSS3DRenderer.js";
|
|
13
|
+
import { GLTFLoader as Qe } from "three/addons/loaders/GLTFLoader.js";
|
|
14
|
+
import { FBXLoader as ds } from "three/addons/loaders/FBXLoader.js";
|
|
15
|
+
import { OBJLoader as ps } from "three/addons/loaders/OBJLoader.js";
|
|
16
|
+
import { STLLoader as us } from "three/addons/loaders/STLLoader.js";
|
|
17
|
+
import { DRACOLoader as ms } from "three/addons/loaders/DRACOLoader.js";
|
|
18
|
+
import { KTX2Loader as fs } from "three/addons/loaders/KTX2Loader.js";
|
|
19
|
+
import { MeshoptDecoder as Ae } from "three/addons/libs/meshopt_decoder.module.js";
|
|
20
|
+
import { HDRLoader as gs } from "three/addons/loaders/HDRLoader.js";
|
|
21
|
+
import { clone as ys } from "three/addons/utils/SkeletonUtils.js";
|
|
22
|
+
import { Easing as f, Tween as ws } from "three/addons/libs/tween.module.js";
|
|
23
|
+
class vs {
|
|
24
24
|
/** The type of event (e.g., 'click', 'pointerdown'). */
|
|
25
25
|
type;
|
|
26
26
|
/** The original 3D object that triggered the event. */
|
|
@@ -48,15 +48,15 @@ class ws {
|
|
|
48
48
|
return this._propagationStopped;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class bs {
|
|
52
52
|
domElement;
|
|
53
53
|
scene;
|
|
54
54
|
camera;
|
|
55
|
-
raycaster = new
|
|
56
|
-
pointer = new
|
|
55
|
+
raycaster = new De();
|
|
56
|
+
pointer = new C();
|
|
57
57
|
hoveredObject = null;
|
|
58
58
|
pointerDownTime = 0;
|
|
59
|
-
pointerDownPos = new
|
|
59
|
+
pointerDownPos = new C();
|
|
60
60
|
clickTimer = null;
|
|
61
61
|
longPressThreshold = 500;
|
|
62
62
|
moveThreshold = 0.01;
|
|
@@ -143,7 +143,7 @@ class vs {
|
|
|
143
143
|
* Dispatches an event to the target object and bubbles up the parent chain.
|
|
144
144
|
*/
|
|
145
145
|
_dispatchToTarget(e, t, s, n) {
|
|
146
|
-
const i = new
|
|
146
|
+
const i = new vs({
|
|
147
147
|
type: e,
|
|
148
148
|
target: t,
|
|
149
149
|
intersect: s,
|
|
@@ -205,7 +205,7 @@ class vs {
|
|
|
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 En extends ke {
|
|
209
209
|
scene;
|
|
210
210
|
camera;
|
|
211
211
|
domElement;
|
|
@@ -215,8 +215,8 @@ class Tn extends Ne {
|
|
|
215
215
|
// Box selection state
|
|
216
216
|
_boxSelectionEnabled = !1;
|
|
217
217
|
_isSelecting = !1;
|
|
218
|
-
_startPoint = new
|
|
219
|
-
_endPoint = new
|
|
218
|
+
_startPoint = new C();
|
|
219
|
+
_endPoint = new C();
|
|
220
220
|
_selectionBox = null;
|
|
221
221
|
_deep = !0;
|
|
222
222
|
/**
|
|
@@ -315,21 +315,21 @@ class Tn extends Ne {
|
|
|
315
315
|
this._selectionBox.style.left = `${e}px`, this._selectionBox.style.top = `${t}px`, this._selectionBox.style.width = `${s}px`, this._selectionBox.style.height = `${n}px`;
|
|
316
316
|
}
|
|
317
317
|
_getObjectsInBox() {
|
|
318
|
-
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new
|
|
318
|
+
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new C(
|
|
319
319
|
this._startPoint.x / t * 2 - 1,
|
|
320
320
|
-(this._startPoint.y / s) * 2 + 1
|
|
321
|
-
), i = new
|
|
321
|
+
), i = new C(
|
|
322
322
|
this._endPoint.x / t * 2 - 1,
|
|
323
323
|
-(this._endPoint.y / s) * 2 + 1
|
|
324
|
-
), r = new
|
|
325
|
-
new
|
|
326
|
-
new
|
|
327
|
-
), o = this.targetObjects || this.scene.children, a = [], c = new
|
|
324
|
+
), r = new at(
|
|
325
|
+
new C(Math.min(n.x, i.x), Math.min(n.y, i.y)),
|
|
326
|
+
new C(Math.max(n.x, i.x), Math.max(n.y, i.y))
|
|
327
|
+
), o = this.targetObjects || this.scene.children, a = [], c = new je();
|
|
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 v();
|
|
332
|
-
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new
|
|
332
|
+
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new C(p.x, p.y)) && a.push(d), this._deep)
|
|
333
333
|
for (const u of d.children)
|
|
334
334
|
l(u);
|
|
335
335
|
};
|
|
@@ -341,19 +341,15 @@ class Tn extends Ne {
|
|
|
341
341
|
this.disableBoxSelection(), this._selected.clear();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function ee(h, e) {
|
|
345
345
|
const t = h;
|
|
346
|
-
if (t.
|
|
347
|
-
t.
|
|
346
|
+
if (t.setSemanticVisible) {
|
|
347
|
+
t.setSemanticVisible(e);
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
|
|
351
|
-
t.setFacilityVisible(e);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
h.visible = e, t.markSceneInstanceRenderDirty?.(), t.markFacilityRenderDirty?.();
|
|
350
|
+
h.visible = e, t.markSemanticRenderDirty?.();
|
|
355
351
|
}
|
|
356
|
-
class
|
|
352
|
+
class xs {
|
|
357
353
|
idMap = /* @__PURE__ */ new Map();
|
|
358
354
|
nameMap = /* @__PURE__ */ new Map();
|
|
359
355
|
typeMap = /* @__PURE__ */ new Map();
|
|
@@ -460,14 +456,14 @@ class bs {
|
|
|
460
456
|
*/
|
|
461
457
|
show(e) {
|
|
462
458
|
const t = this.idMap.get(e);
|
|
463
|
-
t &&
|
|
459
|
+
t && ee(t, !0);
|
|
464
460
|
}
|
|
465
461
|
/**
|
|
466
462
|
* Hide an object by id.
|
|
467
463
|
*/
|
|
468
464
|
hide(e) {
|
|
469
465
|
const t = this.idMap.get(e);
|
|
470
|
-
t &&
|
|
466
|
+
t && ee(t, !1);
|
|
471
467
|
}
|
|
472
468
|
/**
|
|
473
469
|
* Show only the specified objects, hide all others.
|
|
@@ -476,7 +472,7 @@ class bs {
|
|
|
476
472
|
const t = new Set(e);
|
|
477
473
|
for (const s of this.allObjects) {
|
|
478
474
|
const n = this.objectIds.get(s) ?? /* @__PURE__ */ new Set();
|
|
479
|
-
|
|
475
|
+
ee(s, [...n].some((i) => t.has(i)));
|
|
480
476
|
}
|
|
481
477
|
}
|
|
482
478
|
/**
|
|
@@ -486,12 +482,8 @@ class bs {
|
|
|
486
482
|
const s = this.idMap.get(e);
|
|
487
483
|
if (!s) return;
|
|
488
484
|
const n = s;
|
|
489
|
-
if (n.
|
|
490
|
-
n.
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
if (n.setFacilityOpacity) {
|
|
494
|
-
n.setFacilityOpacity(t);
|
|
485
|
+
if (n.setSemanticOpacity) {
|
|
486
|
+
n.setSemanticOpacity(t);
|
|
495
487
|
return;
|
|
496
488
|
}
|
|
497
489
|
s.traverse((i) => {
|
|
@@ -507,7 +499,7 @@ class bs {
|
|
|
507
499
|
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
508
500
|
*/
|
|
509
501
|
getBoundingBox(e) {
|
|
510
|
-
const t = new
|
|
502
|
+
const t = new V();
|
|
511
503
|
if (e) {
|
|
512
504
|
const s = this.idMap.get(e);
|
|
513
505
|
s && t.setFromObject(s);
|
|
@@ -539,10 +531,10 @@ class bs {
|
|
|
539
531
|
*/
|
|
540
532
|
showAll() {
|
|
541
533
|
for (const e of this.allObjects)
|
|
542
|
-
|
|
534
|
+
ee(e, !0);
|
|
543
535
|
}
|
|
544
536
|
}
|
|
545
|
-
class
|
|
537
|
+
class Pn {
|
|
546
538
|
scenes = /* @__PURE__ */ new Map();
|
|
547
539
|
_activeSceneKey = null;
|
|
548
540
|
/**
|
|
@@ -555,8 +547,8 @@ class _n {
|
|
|
555
547
|
* Create and register a new scene.
|
|
556
548
|
*/
|
|
557
549
|
create(e, t = {}) {
|
|
558
|
-
const s = new
|
|
559
|
-
return t.background !== void 0 && (s.background = new
|
|
550
|
+
const s = new Ue();
|
|
551
|
+
return t.background !== void 0 && (s.background = new T(t.background)), this.scenes.set(e, s), s;
|
|
560
552
|
}
|
|
561
553
|
/**
|
|
562
554
|
* Get a scene by key.
|
|
@@ -595,7 +587,7 @@ class _n {
|
|
|
595
587
|
const t = this.scenes.get(e);
|
|
596
588
|
if (!t) return null;
|
|
597
589
|
let s = null;
|
|
598
|
-
return t.background instanceof
|
|
590
|
+
return t.background instanceof T && (s = `#${t.background.getHexString()}`), {
|
|
599
591
|
name: t.name || e,
|
|
600
592
|
background: s,
|
|
601
593
|
environmentRotation: {
|
|
@@ -616,7 +608,7 @@ class _n {
|
|
|
616
608
|
return this.scenes.size;
|
|
617
609
|
}
|
|
618
610
|
}
|
|
619
|
-
class
|
|
611
|
+
class On {
|
|
620
612
|
scene;
|
|
621
613
|
lights = /* @__PURE__ */ new Map();
|
|
622
614
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -624,15 +616,15 @@ class En {
|
|
|
624
616
|
this.scene = e;
|
|
625
617
|
}
|
|
626
618
|
addAmbient(e, t = {}) {
|
|
627
|
-
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new
|
|
619
|
+
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new ct(s, n);
|
|
628
620
|
return i.name = e, this._register(e, i), i;
|
|
629
621
|
}
|
|
630
622
|
addDirectional(e, t = {}) {
|
|
631
|
-
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize: o = 1024 } = t, a = new
|
|
623
|
+
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize: o = 1024 } = t, a = new we(s, n);
|
|
632
624
|
return a.position.set(i.x, i.y, i.z), a.castShadow = r, r && a.shadow.mapSize.setScalar(o), a.name = e, this._register(e, a), a;
|
|
633
625
|
}
|
|
634
626
|
addPoint(e, t = {}) {
|
|
635
|
-
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position: o = { x: 0, y: 5, z: 0 }, castShadow: a = !1 } = t, c = new
|
|
627
|
+
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position: o = { x: 0, y: 5, z: 0 }, castShadow: a = !1 } = t, c = new ve(s, n, i, r);
|
|
636
628
|
return c.position.set(o.x, o.y, o.z), c.castShadow = a, c.name = e, this._register(e, c), c;
|
|
637
629
|
}
|
|
638
630
|
addSpot(e, t = {}) {
|
|
@@ -646,11 +638,11 @@ class En {
|
|
|
646
638
|
position: c = { x: 0, y: 10, z: 0 },
|
|
647
639
|
target: l,
|
|
648
640
|
castShadow: d = !1
|
|
649
|
-
} = t, p = new
|
|
641
|
+
} = t, p = new be(s, n, i, r, o, a);
|
|
650
642
|
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;
|
|
651
643
|
}
|
|
652
644
|
addHemisphere(e, t = {}) {
|
|
653
|
-
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new
|
|
645
|
+
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new xe(s, n, i);
|
|
654
646
|
return r.name = e, this._register(e, r), r;
|
|
655
647
|
}
|
|
656
648
|
/**
|
|
@@ -701,7 +693,7 @@ class En {
|
|
|
701
693
|
const t = this.lights.get(e);
|
|
702
694
|
if (!t) return;
|
|
703
695
|
let s = null;
|
|
704
|
-
t instanceof
|
|
696
|
+
t instanceof we ? s = new ht(t, 1) : t instanceof ve ? s = new lt(t, 0.5) : t instanceof be ? s = new dt(t) : t instanceof xe && (s = new pt(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
705
697
|
}
|
|
706
698
|
/**
|
|
707
699
|
* Hide (remove) the helper for a light.
|
|
@@ -732,7 +724,7 @@ class En {
|
|
|
732
724
|
this.removeAll(), this.hideAllHelpers();
|
|
733
725
|
}
|
|
734
726
|
}
|
|
735
|
-
class
|
|
727
|
+
class Ss extends ut {
|
|
736
728
|
scene;
|
|
737
729
|
camera;
|
|
738
730
|
scenePass;
|
|
@@ -761,7 +753,7 @@ class xs extends dt {
|
|
|
761
753
|
#f = !0;
|
|
762
754
|
constructor(...e) {
|
|
763
755
|
const [t, s, n] = e;
|
|
764
|
-
super(t), this.scene = s, this.camera = n, this.scenePass =
|
|
756
|
+
super(t), this.scene = s, this.camera = n, this.scenePass = ge(s, n), this.needsUpdateOutputNode = !0, this.#t = /* @__PURE__ */ new Set(), this.#e = [], this.#d = /* @__PURE__ */ new Set(), this.#c = /* @__PURE__ */ new Map(), this.#g();
|
|
765
757
|
}
|
|
766
758
|
/** @deprecated Use `scenePass` instead */
|
|
767
759
|
get currentOutputNode() {
|
|
@@ -828,14 +820,14 @@ class xs extends dt {
|
|
|
828
820
|
}
|
|
829
821
|
#i() {
|
|
830
822
|
const e = this.scenePass;
|
|
831
|
-
this.scenePass =
|
|
823
|
+
this.scenePass = ge(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
832
824
|
}
|
|
833
825
|
#g() {
|
|
834
826
|
if (this.#s || this.#o || this.#h || this.#c.size > 0) {
|
|
835
|
-
const t = { output:
|
|
827
|
+
const t = { output: Xt };
|
|
836
828
|
this.#c.forEach((s, n) => {
|
|
837
829
|
n !== "output" && (t[n] = s);
|
|
838
|
-
}), this.#s && (t.emissive =
|
|
830
|
+
}), this.#s && (t.emissive = Vt), this.#o && (t.normal = Jt), this.#h && (t.velocity = Zt), this.scenePass.setMRT(qt(t));
|
|
839
831
|
}
|
|
840
832
|
}
|
|
841
833
|
#y() {
|
|
@@ -846,15 +838,15 @@ class xs extends dt {
|
|
|
846
838
|
#w() {
|
|
847
839
|
let e = this.scenePass.getTextureNode();
|
|
848
840
|
if (this.#o)
|
|
849
|
-
if (!(this.camera instanceof
|
|
841
|
+
if (!(this.camera instanceof se))
|
|
850
842
|
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
851
843
|
else {
|
|
852
|
-
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i =
|
|
844
|
+
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = ss(t, s, n, this.camera);
|
|
853
845
|
i.sliceCount.value = this.#a.sliceCount, i.stepCount.value = this.#a.stepCount, i.aoIntensity.value = this.#a.aoIntensity, i.giIntensity.value = this.#a.giIntensity, i.radius.value = this.#a.radius, i.thickness.value = this.#a.thickness, this.#p = i, e = Me(e, i), this.#e.push(i);
|
|
854
846
|
}
|
|
855
847
|
if (this.#s) {
|
|
856
848
|
const t = this.scenePass.getTextureNode("emissive");
|
|
857
|
-
this.#n =
|
|
849
|
+
this.#n = ts(
|
|
858
850
|
t,
|
|
859
851
|
this.#r.strength,
|
|
860
852
|
this.#r.radius,
|
|
@@ -874,11 +866,11 @@ class xs extends dt {
|
|
|
874
866
|
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
875
867
|
}), this.#v(s), this.#h && !t) {
|
|
876
868
|
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
877
|
-
this.#l =
|
|
869
|
+
this.#l = ns(e, i, r, this.camera), this.#e.push(this.#l), e = this.#l;
|
|
878
870
|
} else
|
|
879
871
|
this.#l = null;
|
|
880
872
|
this.#t.size > 0 && this.#t.forEach((i) => {
|
|
881
|
-
const r =
|
|
873
|
+
const r = Yt(e, i);
|
|
882
874
|
this.#e.push(r), e = r;
|
|
883
875
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
884
876
|
}
|
|
@@ -890,18 +882,18 @@ class xs extends dt {
|
|
|
890
882
|
}
|
|
891
883
|
}
|
|
892
884
|
const Cs = {
|
|
893
|
-
Vector2:
|
|
885
|
+
Vector2: C,
|
|
894
886
|
Vector3: v,
|
|
895
|
-
Vector4:
|
|
896
|
-
Quaternion:
|
|
897
|
-
Matrix4:
|
|
898
|
-
Spherical:
|
|
899
|
-
Box3:
|
|
900
|
-
Sphere:
|
|
901
|
-
Raycaster:
|
|
887
|
+
Vector4: ft,
|
|
888
|
+
Quaternion: mt,
|
|
889
|
+
Matrix4: je,
|
|
890
|
+
Spherical: M,
|
|
891
|
+
Box3: V,
|
|
892
|
+
Sphere: fe,
|
|
893
|
+
Raycaster: De
|
|
902
894
|
};
|
|
903
|
-
|
|
904
|
-
class
|
|
895
|
+
Ke.install({ THREE: Cs });
|
|
896
|
+
class Ts extends Ke {
|
|
905
897
|
constructor(...e) {
|
|
906
898
|
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
907
899
|
}
|
|
@@ -909,32 +901,35 @@ class Ss extends We {
|
|
|
909
901
|
* Set absolute angle for azimuth to avoid spinning
|
|
910
902
|
*/
|
|
911
903
|
absoluteRotations() {
|
|
912
|
-
this.azimuthAngle =
|
|
904
|
+
this.azimuthAngle = _s(this.azimuthAngle, 0);
|
|
913
905
|
}
|
|
914
906
|
async flyToBox(e, t = {}) {
|
|
915
907
|
if (e.isEmpty())
|
|
916
908
|
return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
|
|
917
909
|
this.absoluteRotations();
|
|
918
|
-
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t
|
|
910
|
+
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t;
|
|
919
911
|
if (s !== "current") {
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
this.fitToBox(e, n, {
|
|
912
|
+
const o = s.toUpperCase(), a = Be[o] ?? Be.FRONTTOP, c = a.theta, l = a.phi;
|
|
913
|
+
if (await this.rotateTo(c, l, n), Ms.has(o))
|
|
914
|
+
await this.fitToBox(e, n, {
|
|
923
915
|
paddingLeft: i,
|
|
924
916
|
paddingRight: i,
|
|
925
917
|
paddingTop: i,
|
|
926
918
|
paddingBottom: i,
|
|
927
919
|
cover: r
|
|
928
|
-
})
|
|
929
|
-
|
|
920
|
+
});
|
|
921
|
+
else {
|
|
922
|
+
const d = new fe();
|
|
923
|
+
e.getBoundingSphere(d), d.radius += i, await this.fitToSphere(d, n);
|
|
924
|
+
}
|
|
930
925
|
} else {
|
|
931
|
-
const
|
|
932
|
-
e.getBoundingSphere(
|
|
926
|
+
const o = new fe();
|
|
927
|
+
e.getBoundingSphere(o), o.radius += i, await this.fitToSphere(o, n);
|
|
933
928
|
}
|
|
934
|
-
return
|
|
929
|
+
return !0;
|
|
935
930
|
}
|
|
936
931
|
async flyToObject(e, t = {}) {
|
|
937
|
-
const s = new
|
|
932
|
+
const s = new V().setFromObject(e);
|
|
938
933
|
return this.flyToBox(s, t);
|
|
939
934
|
}
|
|
940
935
|
/**
|
|
@@ -985,33 +980,33 @@ class Ss extends We {
|
|
|
985
980
|
]);
|
|
986
981
|
}
|
|
987
982
|
}
|
|
988
|
-
const
|
|
989
|
-
LEFT: new
|
|
990
|
-
RIGHT: new
|
|
991
|
-
FRONT: new
|
|
992
|
-
BACK: new
|
|
993
|
-
TOP: new
|
|
994
|
-
BOTTOM: new
|
|
995
|
-
FRONTTOP: new
|
|
996
|
-
BACKTOP: new
|
|
997
|
-
LEFTTOP: new
|
|
998
|
-
RIGHTTOP: new
|
|
999
|
-
LEFTFRONTTOP: new
|
|
1000
|
-
RIGHTFRONTTOP: new
|
|
1001
|
-
LEFTBACKTOP: new
|
|
1002
|
-
RIGHTBACKTOP: new
|
|
1003
|
-
};
|
|
1004
|
-
function
|
|
983
|
+
const Be = {
|
|
984
|
+
LEFT: new M(0, Math.PI / 2, -Math.PI / 2),
|
|
985
|
+
RIGHT: new M(0, Math.PI / 2, Math.PI / 2),
|
|
986
|
+
FRONT: new M(0, Math.PI / 2, 0),
|
|
987
|
+
BACK: new M(0, Math.PI / 2, Math.PI),
|
|
988
|
+
TOP: new M(0, 0, 0),
|
|
989
|
+
BOTTOM: new M(0, Math.PI, 0),
|
|
990
|
+
FRONTTOP: new M(0, Math.PI / 4, 0),
|
|
991
|
+
BACKTOP: new M(0, Math.PI / 4, Math.PI),
|
|
992
|
+
LEFTTOP: new M(0, Math.PI / 4, -Math.PI / 2),
|
|
993
|
+
RIGHTTOP: new M(0, Math.PI / 4, Math.PI / 2),
|
|
994
|
+
LEFTFRONTTOP: new M(0, Math.PI / 4, -Math.PI / 4),
|
|
995
|
+
RIGHTFRONTTOP: new M(0, Math.PI / 4, Math.PI / 4),
|
|
996
|
+
LEFTBACKTOP: new M(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
997
|
+
RIGHTBACKTOP: new M(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
998
|
+
}, Ms = /* @__PURE__ */ new Set(["LEFT", "RIGHT", "FRONT", "BACK", "TOP", "BOTTOM"]);
|
|
999
|
+
function _s(h, e) {
|
|
1005
1000
|
const t = h - e;
|
|
1006
|
-
return
|
|
1001
|
+
return gt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
1007
1002
|
}
|
|
1008
|
-
class
|
|
1009
|
-
environment = new
|
|
1003
|
+
class Es {
|
|
1004
|
+
environment = new is();
|
|
1010
1005
|
renderer;
|
|
1011
1006
|
pmremGenerator;
|
|
1012
1007
|
envMap = null;
|
|
1013
1008
|
constructor(e) {
|
|
1014
|
-
this.renderer = e, this.pmremGenerator = new
|
|
1009
|
+
this.renderer = e, this.pmremGenerator = new yt(e);
|
|
1015
1010
|
}
|
|
1016
1011
|
update() {
|
|
1017
1012
|
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
@@ -1020,20 +1015,20 @@ class Ts {
|
|
|
1020
1015
|
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
1021
1016
|
}
|
|
1022
1017
|
}
|
|
1023
|
-
const
|
|
1024
|
-
class
|
|
1018
|
+
const te = 128;
|
|
1019
|
+
class Ps extends rs {
|
|
1025
1020
|
viewer;
|
|
1026
1021
|
overlayPass;
|
|
1027
1022
|
constructor(e) {
|
|
1028
1023
|
super(e.camera, e.el), this.viewer = e;
|
|
1029
|
-
const t = new
|
|
1030
|
-
t.position.set(0, 0, 2), this.overlayPass =
|
|
1024
|
+
const t = new ne(-2, 2, 2, -2, 0, 4);
|
|
1025
|
+
t.position.set(0, 0, 2), this.overlayPass = ge(this, t), this.setLabels("x", "y", "z");
|
|
1031
1026
|
}
|
|
1032
1027
|
_update = () => {
|
|
1033
1028
|
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
1034
1029
|
const e = this.location;
|
|
1035
1030
|
let t, s;
|
|
1036
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth -
|
|
1031
|
+
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - te - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - te - e.bottom, this.overlayPass.setViewport(t, s, te, te);
|
|
1037
1032
|
};
|
|
1038
1033
|
enable() {
|
|
1039
1034
|
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
@@ -1042,8 +1037,8 @@ class _s extends is {
|
|
|
1042
1037
|
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1043
1038
|
}
|
|
1044
1039
|
}
|
|
1045
|
-
const
|
|
1046
|
-
class
|
|
1040
|
+
const qe = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Os = qe + "z-index:0;", As = qe + "z-index:1;";
|
|
1041
|
+
class Bs {
|
|
1047
1042
|
el;
|
|
1048
1043
|
css2dRenderer = null;
|
|
1049
1044
|
css3dRenderer = null;
|
|
@@ -1051,21 +1046,21 @@ class Os {
|
|
|
1051
1046
|
this.el = e, getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
1052
1047
|
}
|
|
1053
1048
|
initCSS2DRenderer() {
|
|
1054
|
-
const e = new
|
|
1055
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1049
|
+
const e = new os();
|
|
1050
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = As, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
|
|
1056
1051
|
}
|
|
1057
1052
|
initCSS3DRenderer() {
|
|
1058
|
-
const e = new
|
|
1059
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1053
|
+
const e = new cs();
|
|
1054
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Os, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
|
|
1060
1055
|
}
|
|
1061
1056
|
createCSS2DObject(e) {
|
|
1062
|
-
return this.css2dRenderer || this.initCSS2DRenderer(), new
|
|
1057
|
+
return this.css2dRenderer || this.initCSS2DRenderer(), new as(e);
|
|
1063
1058
|
}
|
|
1064
1059
|
createCSS25DObject(e) {
|
|
1065
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1060
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new hs(e);
|
|
1066
1061
|
}
|
|
1067
1062
|
createCSS3DObject(e) {
|
|
1068
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1063
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new ls(e);
|
|
1069
1064
|
}
|
|
1070
1065
|
render(e, t) {
|
|
1071
1066
|
this.css2dRenderer && this.css2dRenderer.render(e, t), this.css3dRenderer && this.css3dRenderer.render(e, t);
|
|
@@ -1077,7 +1072,7 @@ class Os {
|
|
|
1077
1072
|
this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
|
|
1078
1073
|
}
|
|
1079
1074
|
}
|
|
1080
|
-
const
|
|
1075
|
+
const Rs = "timestamp-query";
|
|
1081
1076
|
class Is {
|
|
1082
1077
|
el;
|
|
1083
1078
|
renderer;
|
|
@@ -1110,9 +1105,9 @@ class Is {
|
|
|
1110
1105
|
this.timestampText.innerText = "0";
|
|
1111
1106
|
return;
|
|
1112
1107
|
}
|
|
1113
|
-
this.#n(
|
|
1108
|
+
this.#n(Z.RENDER).then((t) => {
|
|
1114
1109
|
this._enabled && (this.timestampText.innerText = t?.toFixed(2) ?? "0");
|
|
1115
|
-
}), this.#n(
|
|
1110
|
+
}), this.#n(Z.COMPUTE);
|
|
1116
1111
|
}
|
|
1117
1112
|
}
|
|
1118
1113
|
enable() {
|
|
@@ -1129,7 +1124,7 @@ class Is {
|
|
|
1129
1124
|
}
|
|
1130
1125
|
#s() {
|
|
1131
1126
|
try {
|
|
1132
|
-
return this.renderer.hasFeature(
|
|
1127
|
+
return this.renderer.hasFeature(Rs);
|
|
1133
1128
|
} catch {
|
|
1134
1129
|
return !0;
|
|
1135
1130
|
}
|
|
@@ -1148,11 +1143,11 @@ class Is {
|
|
|
1148
1143
|
}) : Promise.resolve(void 0);
|
|
1149
1144
|
}
|
|
1150
1145
|
#o() {
|
|
1151
|
-
this.#n(
|
|
1146
|
+
this.#n(Z.RENDER), this.#n(Z.COMPUTE);
|
|
1152
1147
|
}
|
|
1153
1148
|
}
|
|
1154
|
-
|
|
1155
|
-
class
|
|
1149
|
+
wt.enabled = !0;
|
|
1150
|
+
class An extends ke {
|
|
1156
1151
|
el;
|
|
1157
1152
|
renderer;
|
|
1158
1153
|
scene;
|
|
@@ -1169,11 +1164,11 @@ class Pn extends Ne {
|
|
|
1169
1164
|
frameCount = 1;
|
|
1170
1165
|
frameloop = "demand";
|
|
1171
1166
|
constructor({ el: e, rendererOptions: t }) {
|
|
1172
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Is(this.el, this.renderer), this.controls = new
|
|
1167
|
+
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Is(this.el, this.renderer), this.controls = new Ts(this.camera, this.renderer.domElement), this.renderPipeline = new Ss(this.renderer, this.scene, this.camera), this.timer = new vt(), this.roomEnvironment = new Es(this.renderer), this.interactionManager = new bs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new xs(), this.viewerHelper = new Ps(this), this.cssRenderer = new Bs(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1173
1168
|
}
|
|
1174
1169
|
onWindowResize = () => {
|
|
1175
1170
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
1176
|
-
this.camera instanceof
|
|
1171
|
+
this.camera instanceof se ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof ne && (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();
|
|
1177
1172
|
};
|
|
1178
1173
|
async init() {
|
|
1179
1174
|
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
@@ -1182,7 +1177,7 @@ class Pn extends Ne {
|
|
|
1182
1177
|
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
1183
1178
|
}
|
|
1184
1179
|
setCameraByType(e) {
|
|
1185
|
-
e === "perspective" && !(this.camera instanceof
|
|
1180
|
+
e === "perspective" && !(this.camera instanceof se) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof ne) && this.setCamera(this.createOrthographicCamera());
|
|
1186
1181
|
}
|
|
1187
1182
|
render(e = 1) {
|
|
1188
1183
|
return this.frameCount += e, new Promise((t) => {
|
|
@@ -1200,25 +1195,25 @@ class Pn extends Ne {
|
|
|
1200
1195
|
this.dispatchEvent({ type: "afterControlsUpdate", time: e, delta: t }), this.frameCount > 0 && (this.frameCount--, s = !0), this.frameloop === "always" && (s = !0), s && (this.dispatchEvent({ type: "beforeRender", time: e, delta: t }), this.renderer.info.reset(), this.renderPipeline.render(), this.cssRenderer.render(this.scene, this.camera), this.info.update(), this.dispatchEvent({ type: "afterRender", time: e, delta: t }));
|
|
1201
1196
|
};
|
|
1202
1197
|
_initRenderer(e) {
|
|
1203
|
-
const t = new
|
|
1198
|
+
const t = new bt({
|
|
1204
1199
|
reversedDepthBuffer: !0,
|
|
1205
1200
|
antialias: !1,
|
|
1206
1201
|
depth: !1,
|
|
1207
1202
|
trackTimestamp: !1,
|
|
1208
1203
|
...e
|
|
1209
1204
|
});
|
|
1210
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type =
|
|
1205
|
+
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = xt, t.toneMapping = St, 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;
|
|
1211
1206
|
}
|
|
1212
1207
|
createScene() {
|
|
1213
|
-
const e = new
|
|
1214
|
-
return e.background = new
|
|
1208
|
+
const e = new Ue();
|
|
1209
|
+
return e.background = new T(0), e;
|
|
1215
1210
|
}
|
|
1216
1211
|
createPerspectiveCamera() {
|
|
1217
|
-
const e = new
|
|
1212
|
+
const e = new se(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
1218
1213
|
return e.position.setScalar(5), e;
|
|
1219
1214
|
}
|
|
1220
1215
|
createOrthographicCamera() {
|
|
1221
|
-
const e = new
|
|
1216
|
+
const e = new ne(
|
|
1222
1217
|
-this.el.clientWidth / 2,
|
|
1223
1218
|
this.el.clientWidth / 2,
|
|
1224
1219
|
this.el.clientHeight / 2,
|
|
@@ -1247,7 +1242,7 @@ class Pn extends Ne {
|
|
|
1247
1242
|
* Set the scene background color, texture, or null.
|
|
1248
1243
|
*/
|
|
1249
1244
|
setBackground(e) {
|
|
1250
|
-
e === null ? this.scene.background = null : e instanceof
|
|
1245
|
+
e === null ? this.scene.background = null : e instanceof T || typeof e == "number" || typeof e == "string" ? this.scene.background = new T(e) : this.scene.background = e, this.render();
|
|
1251
1246
|
}
|
|
1252
1247
|
/**
|
|
1253
1248
|
* Set the scene environment map for reflections / IBL.
|
|
@@ -1272,14 +1267,14 @@ class Pn extends Ne {
|
|
|
1272
1267
|
*/
|
|
1273
1268
|
enableFog(e = {}) {
|
|
1274
1269
|
const { color: t = 13421772, near: s = 10, far: n = 100 } = e;
|
|
1275
|
-
this.scene.fog = new
|
|
1270
|
+
this.scene.fog = new Ct(t, s, n), this.render();
|
|
1276
1271
|
}
|
|
1277
1272
|
/**
|
|
1278
1273
|
* Enable exponential fog.
|
|
1279
1274
|
*/
|
|
1280
1275
|
enableFogExp2(e = {}) {
|
|
1281
1276
|
const { color: t = 13421772, density: s = 0.01 } = e;
|
|
1282
|
-
this.scene.fog = new
|
|
1277
|
+
this.scene.fog = new Tt(t, s), this.render();
|
|
1283
1278
|
}
|
|
1284
1279
|
/**
|
|
1285
1280
|
* Disable fog.
|
|
@@ -1291,22 +1286,22 @@ class Pn extends Ne {
|
|
|
1291
1286
|
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();
|
|
1292
1287
|
}
|
|
1293
1288
|
}
|
|
1294
|
-
class
|
|
1289
|
+
class Ls extends Qe {
|
|
1295
1290
|
constructor(e) {
|
|
1296
1291
|
super(e);
|
|
1297
1292
|
}
|
|
1298
1293
|
parse(e, t, s, n) {
|
|
1299
|
-
if (
|
|
1300
|
-
const r =
|
|
1294
|
+
if (zs(e.slice(0, 8)) === "SBMG----") {
|
|
1295
|
+
const r = Ns(e.slice(8));
|
|
1301
1296
|
return super.parse(r, t, s, n);
|
|
1302
1297
|
} else
|
|
1303
1298
|
return super.parse(e, t, s, n);
|
|
1304
1299
|
}
|
|
1305
1300
|
}
|
|
1306
|
-
function
|
|
1301
|
+
function zs(h) {
|
|
1307
1302
|
return new TextDecoder().decode(new Uint8Array(h));
|
|
1308
1303
|
}
|
|
1309
|
-
function
|
|
1304
|
+
function Ns(h) {
|
|
1310
1305
|
const e = new DataView(h);
|
|
1311
1306
|
for (let t = 0; t < e.byteLength; t++) {
|
|
1312
1307
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
@@ -1314,59 +1309,59 @@ function Ls(h) {
|
|
|
1314
1309
|
}
|
|
1315
1310
|
return e.buffer;
|
|
1316
1311
|
}
|
|
1317
|
-
const
|
|
1318
|
-
function
|
|
1319
|
-
let e =
|
|
1312
|
+
const Ds = 8, ks = 130, Re = 66, js = "SBK-----", Us = "SBM-----", Xe = new TextDecoder(), Hs = new TextEncoder();
|
|
1313
|
+
function Fs(h) {
|
|
1314
|
+
let e = Ds;
|
|
1320
1315
|
const t = new Uint8Array(h, 0, e);
|
|
1321
|
-
if (
|
|
1316
|
+
if (Xe.decode(t) !== js)
|
|
1322
1317
|
return h;
|
|
1323
|
-
e +=
|
|
1318
|
+
e += ks;
|
|
1324
1319
|
const n = new Uint8Array(h, 0, e);
|
|
1325
1320
|
if (n[40] === 1) {
|
|
1326
|
-
const r =
|
|
1327
|
-
let l =
|
|
1328
|
-
const d = e +
|
|
1321
|
+
const r = Hs.encode(Us), o = new Uint8Array([n[41]]), a = Gs(n), c = $s(a);
|
|
1322
|
+
let l = Re % c.length;
|
|
1323
|
+
const d = e + Re, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
|
|
1329
1324
|
for (let w = 0; w < p.length; w++)
|
|
1330
1325
|
u[w] = p[w] ^ c[l], l = (l + 1) % c.length;
|
|
1331
1326
|
const m = new Uint8Array(r.length + o.length + u.length);
|
|
1332
1327
|
return m.set(r), m.set(o, r.length), m.set(u, r.length + o.length), m.buffer;
|
|
1333
1328
|
}
|
|
1334
1329
|
}
|
|
1335
|
-
function
|
|
1330
|
+
function Gs(h) {
|
|
1336
1331
|
const e = new Uint8Array(128);
|
|
1337
1332
|
return e.set(h.slice(42, 74), 0), e.set(h.slice(74, 138), 32), e.set(h.slice(8, 40), 96), e;
|
|
1338
1333
|
}
|
|
1339
|
-
function
|
|
1334
|
+
function $s(h) {
|
|
1340
1335
|
const e = new Uint8Array(64);
|
|
1341
1336
|
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;
|
|
1342
1337
|
}
|
|
1343
|
-
const
|
|
1338
|
+
const Ws = (h, e, t) => {
|
|
1344
1339
|
const s = h.buffer.slice(t, t + e);
|
|
1345
|
-
let n =
|
|
1340
|
+
let n = Xe.decode(s);
|
|
1346
1341
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
1347
|
-
},
|
|
1342
|
+
}, Ks = (h, e, t) => {
|
|
1348
1343
|
const [s, n, i, r, o] = e, a = t || r < 1;
|
|
1349
1344
|
return new L({
|
|
1350
1345
|
name: h,
|
|
1351
|
-
color: new
|
|
1346
|
+
color: new T(s, n, i),
|
|
1352
1347
|
opacity: r,
|
|
1353
1348
|
transparent: a,
|
|
1354
1349
|
alphaTest: 0.01,
|
|
1355
1350
|
side: o
|
|
1356
1351
|
});
|
|
1357
|
-
},
|
|
1358
|
-
class
|
|
1352
|
+
}, Qs = (h) => h?.toLowerCase().endsWith(".png") ?? !1;
|
|
1353
|
+
class qs {
|
|
1359
1354
|
data;
|
|
1360
1355
|
options;
|
|
1361
1356
|
textureLoader;
|
|
1362
1357
|
littleEndian = !0;
|
|
1363
1358
|
materials = /* @__PURE__ */ new Map();
|
|
1364
1359
|
constructor(e, t) {
|
|
1365
|
-
this.data = e, this.options = t, this.textureLoader = new
|
|
1360
|
+
this.data = e, this.options = t, this.textureLoader = new Fe(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
|
|
1366
1361
|
}
|
|
1367
1362
|
parse(e, t) {
|
|
1368
1363
|
let s = this.data;
|
|
1369
|
-
const n =
|
|
1364
|
+
const n = Fs(this.data);
|
|
1370
1365
|
n && (s = n);
|
|
1371
1366
|
const i = new DataView(s);
|
|
1372
1367
|
let r = 8;
|
|
@@ -1374,7 +1369,7 @@ class Ks {
|
|
|
1374
1369
|
r += 1, o === 1 ? this._parseV2(i, r, e) : o === 2 ? this._parseV2(i, r, e) : o === 3 ? this._parseV3(i, r, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${o}`));
|
|
1375
1370
|
}
|
|
1376
1371
|
_parseV2(e, t, s) {
|
|
1377
|
-
const n = new
|
|
1372
|
+
const n = new I(), i = e.getUint16(t, this.littleEndian);
|
|
1378
1373
|
t += 2;
|
|
1379
1374
|
const r = e.getUint16(t, this.littleEndian);
|
|
1380
1375
|
t += 2;
|
|
@@ -1390,14 +1385,14 @@ class Ks {
|
|
|
1390
1385
|
const p = e.getFloat32(t, this.littleEndian);
|
|
1391
1386
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
1392
1387
|
let u = e.getUint8(t);
|
|
1393
|
-
t += 1, u === 0 ? u =
|
|
1388
|
+
t += 1, u === 0 ? u = _t : u === 1 ? u = Et : u === 2 && (u = Pt);
|
|
1394
1389
|
const m = e.getUint16(t, this.littleEndian);
|
|
1395
1390
|
t += 2;
|
|
1396
|
-
const w = m > 0 ?
|
|
1391
|
+
const w = m > 0 ? Ws(e, m, t) : "";
|
|
1397
1392
|
if (t += m, !this.materials.has(a)) {
|
|
1398
|
-
const x =
|
|
1399
|
-
this.materials.set(a, x), w && this.options.path && this.textureLoader.load(
|
|
1400
|
-
y.colorSpace =
|
|
1393
|
+
const x = Ks(a, [c, l, d, p, u], Qs(w));
|
|
1394
|
+
this.materials.set(a, x), w && this.options.path && this.textureLoader.load(R.resolveURL(w, this.options.path), (y) => {
|
|
1395
|
+
y.colorSpace = Ge, y.wrapS = Se, y.wrapT = Se, y.flipY = !1, y.anisotropy = 16, x.map = y;
|
|
1401
1396
|
});
|
|
1402
1397
|
}
|
|
1403
1398
|
}
|
|
@@ -1416,10 +1411,10 @@ class Ks {
|
|
|
1416
1411
|
if (t += 2, w > 0)
|
|
1417
1412
|
for (let g = 0; g < w; g++)
|
|
1418
1413
|
t += 4, t += 4, t += 4;
|
|
1419
|
-
const
|
|
1420
|
-
if (t += 2,
|
|
1421
|
-
for (let g = 0; g <
|
|
1422
|
-
const b = new
|
|
1414
|
+
const S = e.getUint16(t, this.littleEndian);
|
|
1415
|
+
if (t += 2, S > 0)
|
|
1416
|
+
for (let g = 0; g < S; g++) {
|
|
1417
|
+
const b = new C();
|
|
1423
1418
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
|
|
1424
1419
|
}
|
|
1425
1420
|
const x = e.getUint16(t, this.littleEndian);
|
|
@@ -1438,12 +1433,12 @@ class Ks {
|
|
|
1438
1433
|
for (let g = 0; g < p.length; g++) {
|
|
1439
1434
|
const b = p[g], z = l[b[0]], N = l[b[1]], P = l[b[2]];
|
|
1440
1435
|
y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
|
|
1441
|
-
let
|
|
1436
|
+
let J = new C(), W = new C(), j = new C();
|
|
1442
1437
|
const U = u[g];
|
|
1443
|
-
U !== void 0 && (
|
|
1438
|
+
U !== void 0 && (J = U[0], W = U[1], j = U[2]), _.push(...J.toArray(), ...W.toArray(), ...j.toArray());
|
|
1444
1439
|
}
|
|
1445
|
-
const
|
|
1446
|
-
if (
|
|
1440
|
+
const A = new Float32Array(y), B = new Float32Array(_), E = new Q();
|
|
1441
|
+
if (A.length > 0 && E.setAttribute("position", new Ce(A, 3)), B.length > 0 && E.setAttribute("uv", new Ce(B, 2)), E.computeVertexNormals(), this.materials.has(c)) {
|
|
1447
1442
|
const g = new k(E, this.materials.get(c));
|
|
1448
1443
|
g.name = a, g.castShadow = !0, g.receiveShadow = !0, n.add(g);
|
|
1449
1444
|
}
|
|
@@ -1451,24 +1446,24 @@ class Ks {
|
|
|
1451
1446
|
s(n);
|
|
1452
1447
|
}
|
|
1453
1448
|
_parseV3(e, t, s) {
|
|
1454
|
-
const n = new
|
|
1449
|
+
const n = new I();
|
|
1455
1450
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
1456
1451
|
}
|
|
1457
1452
|
}
|
|
1458
|
-
class
|
|
1453
|
+
class Xs extends Mt {
|
|
1459
1454
|
load(e, t, s, n) {
|
|
1460
1455
|
let i;
|
|
1461
1456
|
if (this.resourcePath !== "")
|
|
1462
1457
|
i = this.resourcePath;
|
|
1463
1458
|
else if (this.path !== "") {
|
|
1464
|
-
const a =
|
|
1465
|
-
i =
|
|
1459
|
+
const a = R.extractUrlBase(e);
|
|
1460
|
+
i = R.resolveURL(a, this.path);
|
|
1466
1461
|
} else
|
|
1467
|
-
i =
|
|
1462
|
+
i = R.extractUrlBase(e);
|
|
1468
1463
|
this.manager.itemStart(e);
|
|
1469
1464
|
const r = (a) => {
|
|
1470
1465
|
n ? n(a) : console.error(a), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
1471
|
-
}, o = new
|
|
1466
|
+
}, o = new He(this.manager);
|
|
1472
1467
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(
|
|
1473
1468
|
e,
|
|
1474
1469
|
(a) => {
|
|
@@ -1495,7 +1490,7 @@ class Qs extends St {
|
|
|
1495
1490
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
1496
1491
|
return;
|
|
1497
1492
|
}
|
|
1498
|
-
new
|
|
1493
|
+
new qs(e, {
|
|
1499
1494
|
path: t,
|
|
1500
1495
|
crossOrigin: this.crossOrigin,
|
|
1501
1496
|
requestHeader: this.requestHeader,
|
|
@@ -1517,7 +1512,7 @@ class Qs extends St {
|
|
|
1517
1512
|
});
|
|
1518
1513
|
}
|
|
1519
1514
|
}
|
|
1520
|
-
const
|
|
1515
|
+
const Ys = [
|
|
1521
1516
|
"map",
|
|
1522
1517
|
"alphaMap",
|
|
1523
1518
|
"aoMap",
|
|
@@ -1544,14 +1539,14 @@ const qs = [
|
|
|
1544
1539
|
"thicknessMap",
|
|
1545
1540
|
"transmissionMap"
|
|
1546
1541
|
];
|
|
1547
|
-
function
|
|
1542
|
+
function K(h) {
|
|
1548
1543
|
return h.traverse((e) => {
|
|
1549
1544
|
if (!(e instanceof k)) return;
|
|
1550
1545
|
const t = Array.isArray(e.material) ? e.material : [e.material];
|
|
1551
1546
|
for (const s of t) {
|
|
1552
1547
|
if (!s) continue;
|
|
1553
1548
|
let n = !1;
|
|
1554
|
-
for (const i of
|
|
1549
|
+
for (const i of Ys) {
|
|
1555
1550
|
const r = s[i];
|
|
1556
1551
|
r?.isTexture && r.image == null && (r.dispose(), s[i] = null, n = !0);
|
|
1557
1552
|
}
|
|
@@ -1561,19 +1556,19 @@ function W(h) {
|
|
|
1561
1556
|
}
|
|
1562
1557
|
class D {
|
|
1563
1558
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
1564
|
-
static fileLoader = new
|
|
1565
|
-
static dracoLoader = new
|
|
1566
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1559
|
+
static fileLoader = new He().setResponseType("arraybuffer");
|
|
1560
|
+
static dracoLoader = new ms().setDecoderPath(
|
|
1561
|
+
`https://cdn.jsdelivr.net/npm/three@0.${Te}.0/examples/jsm/libs/draco/`
|
|
1567
1562
|
);
|
|
1568
|
-
static ktx2Loader = new
|
|
1569
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1563
|
+
static ktx2Loader = new fs().setTranscoderPath(
|
|
1564
|
+
`https://cdn.jsdelivr.net/npm/three@0.${Te}.0/examples/jsm/libs/basis/`
|
|
1570
1565
|
);
|
|
1571
|
-
static gltfLoader = new
|
|
1572
|
-
static sbmxLoader = new
|
|
1573
|
-
static sbmLoader = new
|
|
1574
|
-
static fbxLoader = new
|
|
1575
|
-
static objLoader = new
|
|
1576
|
-
static stlLoader = new
|
|
1566
|
+
static gltfLoader = new Qe().setDRACOLoader(D.dracoLoader).setKTX2Loader(D.ktx2Loader).setMeshoptDecoder(Ae);
|
|
1567
|
+
static sbmxLoader = new Ls().setDRACOLoader(D.dracoLoader).setKTX2Loader(D.ktx2Loader).setMeshoptDecoder(Ae);
|
|
1568
|
+
static sbmLoader = new Xs();
|
|
1569
|
+
static fbxLoader = new ds();
|
|
1570
|
+
static objLoader = new ps();
|
|
1571
|
+
static stlLoader = new us();
|
|
1577
1572
|
static setLoadingManager(e) {
|
|
1578
1573
|
this.fileLoader.manager = e, this.dracoLoader.manager = e, this.ktx2Loader.manager = e, this.gltfLoader.manager = e, this.sbmxLoader.manager = e, this.sbmLoader.manager = e, this.fbxLoader.manager = e, this.objLoader.manager = e, this.stlLoader.manager = e;
|
|
1579
1574
|
}
|
|
@@ -1601,20 +1596,20 @@ class D {
|
|
|
1601
1596
|
switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
|
|
1602
1597
|
case "gltf":
|
|
1603
1598
|
case "glb":
|
|
1604
|
-
const i = await this.gltfLoader.parseAsync(n,
|
|
1605
|
-
return i.scene.animations = i.animations,
|
|
1599
|
+
const i = await this.gltfLoader.parseAsync(n, R.extractUrlBase(e));
|
|
1600
|
+
return i.scene.animations = i.animations, K(i.scene);
|
|
1606
1601
|
case "sbmx":
|
|
1607
|
-
const r = await this.sbmxLoader.parseAsync(n,
|
|
1608
|
-
return r.scene.animations = r.animations,
|
|
1602
|
+
const r = await this.sbmxLoader.parseAsync(n, R.extractUrlBase(e));
|
|
1603
|
+
return r.scene.animations = r.animations, K(r.scene);
|
|
1609
1604
|
case "sbm":
|
|
1610
|
-
const o = await this.sbmLoader.parseAsync(n,
|
|
1611
|
-
return
|
|
1605
|
+
const o = await this.sbmLoader.parseAsync(n, R.extractUrlBase(e));
|
|
1606
|
+
return K(o);
|
|
1612
1607
|
case "fbx":
|
|
1613
|
-
const a = this.fbxLoader.parse(n,
|
|
1614
|
-
return
|
|
1608
|
+
const a = this.fbxLoader.parse(n, R.extractUrlBase(e));
|
|
1609
|
+
return K(a);
|
|
1615
1610
|
case "obj":
|
|
1616
1611
|
const c = new TextDecoder().decode(n), l = this.objLoader.parse(c);
|
|
1617
|
-
return
|
|
1612
|
+
return K(l);
|
|
1618
1613
|
case "stl":
|
|
1619
1614
|
const d = this.stlLoader.parse(n);
|
|
1620
1615
|
return new k(d, new L());
|
|
@@ -1634,10 +1629,10 @@ class D {
|
|
|
1634
1629
|
}
|
|
1635
1630
|
}
|
|
1636
1631
|
}
|
|
1637
|
-
class
|
|
1638
|
-
static textureLoader = new
|
|
1639
|
-
static hdrLoader = new
|
|
1640
|
-
static cubeTextureLoader = new
|
|
1632
|
+
class Bn {
|
|
1633
|
+
static textureLoader = new Fe();
|
|
1634
|
+
static hdrLoader = new gs();
|
|
1635
|
+
static cubeTextureLoader = new Ot();
|
|
1641
1636
|
static setLoadingManager(e) {
|
|
1642
1637
|
this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
|
|
1643
1638
|
}
|
|
@@ -1646,7 +1641,7 @@ class On {
|
|
|
1646
1641
|
}
|
|
1647
1642
|
static async loadAsyncHDR(e) {
|
|
1648
1643
|
const t = await this.hdrLoader.loadAsync(e);
|
|
1649
|
-
return t.mapping =
|
|
1644
|
+
return t.mapping = At, t;
|
|
1650
1645
|
}
|
|
1651
1646
|
static async loadAsyncCubeTexture(e, t) {
|
|
1652
1647
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
@@ -1665,7 +1660,7 @@ class G extends k {
|
|
|
1665
1660
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1666
1661
|
}
|
|
1667
1662
|
}
|
|
1668
|
-
class
|
|
1663
|
+
class Ye extends I {
|
|
1669
1664
|
isBaseGroup = !0;
|
|
1670
1665
|
type = "BaseGroup";
|
|
1671
1666
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1676,7 +1671,7 @@ class Xe extends R {
|
|
|
1676
1671
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1677
1672
|
}
|
|
1678
1673
|
}
|
|
1679
|
-
class
|
|
1674
|
+
class Vs extends Bt {
|
|
1680
1675
|
isBaseSprite = !0;
|
|
1681
1676
|
type = "BaseSprite";
|
|
1682
1677
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1687,7 +1682,7 @@ class Xs extends Ot {
|
|
|
1687
1682
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1688
1683
|
}
|
|
1689
1684
|
}
|
|
1690
|
-
class he extends
|
|
1685
|
+
class he extends Ye {
|
|
1691
1686
|
isModel = !0;
|
|
1692
1687
|
type = "Model";
|
|
1693
1688
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
@@ -1702,8 +1697,8 @@ class he extends Xe {
|
|
|
1702
1697
|
try {
|
|
1703
1698
|
let i;
|
|
1704
1699
|
s ? he.memoryCache.has(t) ? i = he.memoryCache.get(t) : (i = D.loadAsync(t, { persistent: n }), he.memoryCache.set(t, i)) : i = D.loadAsync(t, { persistent: n });
|
|
1705
|
-
const r = await i, o =
|
|
1706
|
-
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new
|
|
1700
|
+
const r = await i, o = ys(r);
|
|
1701
|
+
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new Rt(o)), o;
|
|
1707
1702
|
} catch (i) {
|
|
1708
1703
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
1709
1704
|
}
|
|
@@ -1715,7 +1710,7 @@ class he extends Xe {
|
|
|
1715
1710
|
if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((c) => c.name === e), !o)
|
|
1716
1711
|
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
1717
1712
|
let a = this.actions.get(o.name);
|
|
1718
|
-
return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? It :
|
|
1713
|
+
return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? It : Lt, n), a.clampWhenFinished = r, a.timeScale = i, a.reset().play(), a;
|
|
1719
1714
|
}
|
|
1720
1715
|
playAllAnimations(e = {}) {
|
|
1721
1716
|
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
@@ -1736,7 +1731,7 @@ class he extends Xe {
|
|
|
1736
1731
|
* Get the axis-aligned bounding box of this model.
|
|
1737
1732
|
*/
|
|
1738
1733
|
getBoundingBox() {
|
|
1739
|
-
return new
|
|
1734
|
+
return new V().setFromObject(this);
|
|
1740
1735
|
}
|
|
1741
1736
|
/**
|
|
1742
1737
|
* Get the center point of this model's bounding box.
|
|
@@ -1760,11 +1755,11 @@ class he extends Xe {
|
|
|
1760
1755
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
1761
1756
|
}
|
|
1762
1757
|
}
|
|
1763
|
-
class
|
|
1758
|
+
class Js extends G {
|
|
1764
1759
|
isSphereMesh = !0;
|
|
1765
1760
|
type = "SphereMesh";
|
|
1766
1761
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1767
|
-
super(), this.geometry = new
|
|
1762
|
+
super(), this.geometry = new zt(
|
|
1768
1763
|
e?.radius,
|
|
1769
1764
|
e?.widthSegments,
|
|
1770
1765
|
e?.heightSegments,
|
|
@@ -1779,7 +1774,7 @@ class Ie extends G {
|
|
|
1779
1774
|
isTubeMesh = !0;
|
|
1780
1775
|
type = "TubeMesh";
|
|
1781
1776
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1782
|
-
super(), this.geometry = new
|
|
1777
|
+
super(), this.geometry = new Nt(
|
|
1783
1778
|
e?.path,
|
|
1784
1779
|
e?.tubularSegments,
|
|
1785
1780
|
e?.radius,
|
|
@@ -1788,7 +1783,7 @@ class Ie extends G {
|
|
|
1788
1783
|
), this.material = new L(t);
|
|
1789
1784
|
}
|
|
1790
1785
|
}
|
|
1791
|
-
class
|
|
1786
|
+
class Rn extends Ye {
|
|
1792
1787
|
isTopology = !0;
|
|
1793
1788
|
type = "Topology";
|
|
1794
1789
|
// Visuals
|
|
@@ -1891,8 +1886,8 @@ class An extends Xe {
|
|
|
1891
1886
|
* Renders the entire topology graph structure using TubeGeometry and Spheres.
|
|
1892
1887
|
*/
|
|
1893
1888
|
renderGraph() {
|
|
1894
|
-
this.clearGraph(), this.graphGroup = new
|
|
1895
|
-
const e = new
|
|
1889
|
+
this.clearGraph(), this.graphGroup = new I();
|
|
1890
|
+
const e = new Js({
|
|
1896
1891
|
geometryParameters: {
|
|
1897
1892
|
radius: this.parameters.nodeRadius,
|
|
1898
1893
|
widthSegments: 16,
|
|
@@ -1914,7 +1909,7 @@ class An extends Xe {
|
|
|
1914
1909
|
t.add(o);
|
|
1915
1910
|
const a = this.nodes.get(n), c = this.nodes.get(r);
|
|
1916
1911
|
if (a && c) {
|
|
1917
|
-
const l = new
|
|
1912
|
+
const l = new Dt(a, c), d = new Ie({
|
|
1918
1913
|
geometryParameters: {
|
|
1919
1914
|
path: l,
|
|
1920
1915
|
tubularSegments: 1,
|
|
@@ -1941,7 +1936,7 @@ class An extends Xe {
|
|
|
1941
1936
|
*/
|
|
1942
1937
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1943
1938
|
if (e.length < 2) return;
|
|
1944
|
-
const s = new
|
|
1939
|
+
const s = new kt(e, !1, "catmullrom", 0), n = new Ie({
|
|
1945
1940
|
geometryParameters: {
|
|
1946
1941
|
path: s,
|
|
1947
1942
|
tubularSegments: e.length * 10,
|
|
@@ -1991,7 +1986,7 @@ class An extends Xe {
|
|
|
1991
1986
|
return this.adjacencyMap.get(e);
|
|
1992
1987
|
}
|
|
1993
1988
|
}
|
|
1994
|
-
class In extends
|
|
1989
|
+
class In extends Vs {
|
|
1995
1990
|
isPoi = !0;
|
|
1996
1991
|
type = "Poi";
|
|
1997
1992
|
parameters = {
|
|
@@ -2010,7 +2005,7 @@ class In extends Xs {
|
|
|
2010
2005
|
_canvas = document.createElement("canvas");
|
|
2011
2006
|
_lastParametersJSON = "";
|
|
2012
2007
|
constructor(e = {}) {
|
|
2013
|
-
super(new
|
|
2008
|
+
super(new jt()), Object.assign(this.parameters, e), this.updateAsync();
|
|
2014
2009
|
}
|
|
2015
2010
|
/**
|
|
2016
2011
|
* Update the POI with new parameters
|
|
@@ -2026,33 +2021,33 @@ class In extends Xs {
|
|
|
2026
2021
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
2027
2022
|
let i = null;
|
|
2028
2023
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
2029
|
-
const { text: r, fontSize: o, color: a, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: m } = this.parameters, w = n.measureText(r),
|
|
2030
|
-
let y = 0, _ = 0,
|
|
2024
|
+
const { text: r, fontSize: o, color: a, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: m } = this.parameters, w = n.measureText(r), S = r ? w.width : 0, x = r ? o : 0;
|
|
2025
|
+
let y = 0, _ = 0, A = 0, B = 0, E = 0, g = 0;
|
|
2031
2026
|
const b = !!i, z = !!r;
|
|
2032
2027
|
if (b && z)
|
|
2033
2028
|
switch (u) {
|
|
2034
2029
|
case "top":
|
|
2035
|
-
y = Math.max(c,
|
|
2030
|
+
y = Math.max(c, S), _ = c + l + x, E = (y - S) / 2, g = x / 2, A = (y - c) / 2, B = x + l;
|
|
2036
2031
|
break;
|
|
2037
2032
|
case "bottom":
|
|
2038
|
-
y = Math.max(c,
|
|
2033
|
+
y = Math.max(c, S), _ = c + l + x, A = (y - c) / 2, B = 0, E = (y - S) / 2, g = c + l + x / 2;
|
|
2039
2034
|
break;
|
|
2040
2035
|
case "left":
|
|
2041
|
-
y = c + l +
|
|
2036
|
+
y = c + l + S, _ = Math.max(c, x), E = 0, g = _ / 2, A = S + l, B = (_ - c) / 2;
|
|
2042
2037
|
break;
|
|
2043
2038
|
default:
|
|
2044
|
-
y = c + l +
|
|
2039
|
+
y = c + l + S, _ = Math.max(c, x), A = 0, B = (_ - c) / 2, E = c + l, g = _ / 2;
|
|
2045
2040
|
break;
|
|
2046
2041
|
}
|
|
2047
|
-
else b ? (y = c, _ = c,
|
|
2042
|
+
else b ? (y = c, _ = c, A = 0, B = 0) : z && (y = S, _ = x, E = 0, g = x / 2);
|
|
2048
2043
|
const N = y + l * 2, P = _ + l * 2;
|
|
2049
|
-
if (s.width = N, s.height = P, n.font = `${o}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), b && n.drawImage(i,
|
|
2044
|
+
if (s.width = N, s.height = P, n.font = `${o}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), b && n.drawImage(i, A + l, B + l, c, c), z) {
|
|
2050
2045
|
n.fillStyle = a;
|
|
2051
|
-
const j = n.measureText(r), U = j.actualBoundingBoxAscent + j.actualBoundingBoxDescent,
|
|
2052
|
-
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l +
|
|
2046
|
+
const j = n.measureText(r), U = j.actualBoundingBoxAscent + j.actualBoundingBoxDescent, ot = j.actualBoundingBoxAscent - U / 2;
|
|
2047
|
+
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l + ot);
|
|
2053
2048
|
}
|
|
2054
|
-
const
|
|
2055
|
-
|
|
2049
|
+
const J = this.material.map, W = new Ut(s);
|
|
2050
|
+
W.colorSpace = Ge, this.material.map = W, J?.dispose(), this.scale.set(N * m, P * m, 1);
|
|
2056
2051
|
}
|
|
2057
2052
|
_loadImage(e) {
|
|
2058
2053
|
return new Promise((t, s) => {
|
|
@@ -2070,43 +2065,43 @@ class In extends Xs {
|
|
|
2070
2065
|
this.material.map?.dispose(), this.material.dispose();
|
|
2071
2066
|
}
|
|
2072
2067
|
}
|
|
2073
|
-
class
|
|
2068
|
+
class Ve extends G {
|
|
2074
2069
|
isShapeMesh = !0;
|
|
2075
2070
|
type = "ShapeMesh";
|
|
2076
2071
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2077
|
-
super(), this.geometry = new
|
|
2072
|
+
super(), this.geometry = new Ht(e?.shape, e?.curveSegments), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2078
2073
|
}
|
|
2079
2074
|
static createFromPoints(e, t = {}) {
|
|
2080
|
-
return new
|
|
2075
|
+
return new Ve({
|
|
2081
2076
|
...t,
|
|
2082
2077
|
geometryParameters: {
|
|
2083
2078
|
...t.geometryParameters,
|
|
2084
|
-
shape: new
|
|
2079
|
+
shape: new $e(e.map((s) => new C(s.x, -s.z)))
|
|
2085
2080
|
}
|
|
2086
2081
|
});
|
|
2087
2082
|
}
|
|
2088
2083
|
}
|
|
2089
|
-
class
|
|
2084
|
+
class Je extends G {
|
|
2090
2085
|
isExtrudeMesh = !0;
|
|
2091
2086
|
type = "ExtrudeMesh";
|
|
2092
2087
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2093
|
-
super(), this.geometry = new
|
|
2088
|
+
super(), this.geometry = new Ft(e?.shape, e?.options), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2094
2089
|
}
|
|
2095
2090
|
static createFromPoints(e, t = {}) {
|
|
2096
|
-
return e && e.length === 0 && (e = void 0), new
|
|
2091
|
+
return e && e.length === 0 && (e = void 0), new Je({
|
|
2097
2092
|
...t,
|
|
2098
2093
|
geometryParameters: {
|
|
2099
2094
|
...t.geometryParameters,
|
|
2100
|
-
shape: new
|
|
2095
|
+
shape: new $e(e?.map((s) => new C(s.x, -s.z)))
|
|
2101
2096
|
}
|
|
2102
2097
|
});
|
|
2103
2098
|
}
|
|
2104
2099
|
}
|
|
2105
|
-
class
|
|
2100
|
+
class Ln extends G {
|
|
2106
2101
|
isPlaneMesh = !0;
|
|
2107
2102
|
type = "PlaneMesh";
|
|
2108
2103
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2109
|
-
super(), this.geometry = new
|
|
2104
|
+
super(), this.geometry = new Gt(
|
|
2110
2105
|
e?.width,
|
|
2111
2106
|
e?.height,
|
|
2112
2107
|
e?.widthSegments,
|
|
@@ -2114,12 +2109,12 @@ class Bn extends G {
|
|
|
2114
2109
|
), this.material = new L(t);
|
|
2115
2110
|
}
|
|
2116
2111
|
}
|
|
2117
|
-
class
|
|
2112
|
+
class zn extends G {
|
|
2118
2113
|
isCircleMesh = !0;
|
|
2119
2114
|
type = "CircleMesh";
|
|
2120
2115
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2121
2116
|
super(
|
|
2122
|
-
new
|
|
2117
|
+
new $t(
|
|
2123
2118
|
e?.radius,
|
|
2124
2119
|
e?.segments,
|
|
2125
2120
|
e?.thetaStart,
|
|
@@ -2136,14 +2131,14 @@ class F {
|
|
|
2136
2131
|
});
|
|
2137
2132
|
}
|
|
2138
2133
|
}
|
|
2139
|
-
class
|
|
2134
|
+
class Nn {
|
|
2140
2135
|
static flow(e = {}) {
|
|
2141
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new
|
|
2142
|
-
return
|
|
2136
|
+
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new T(t)), a = H(new T(s)), c = _e().x.mul(i).sub(oe.mul(n)), l = ae(ye(c).add(1).mul(0.5), r);
|
|
2137
|
+
return ce(o, a, l);
|
|
2143
2138
|
}
|
|
2144
2139
|
static breathe(e = {}) {
|
|
2145
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new
|
|
2146
|
-
return
|
|
2140
|
+
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new T(t)), o = H(new T(s)), a = ye(oe.mul(n)).add(1).mul(0.5), c = ae(a, i);
|
|
2141
|
+
return ce(r, o, c);
|
|
2147
2142
|
}
|
|
2148
2143
|
static fluid(e = {}) {
|
|
2149
2144
|
const {
|
|
@@ -2153,24 +2148,24 @@ class Ln {
|
|
|
2153
2148
|
scale: i = 1,
|
|
2154
2149
|
intensity: r = 1,
|
|
2155
2150
|
distortion: o = 0.5
|
|
2156
|
-
} = e, a = H(new
|
|
2157
|
-
return
|
|
2151
|
+
} = e, a = H(new T(t)), c = H(new T(s)), l = _e().mul(i), d = oe.mul(n), p = Ee(l.add(d), 1, 0), u = l.add(p.mul(o)), m = Ee(u, 1, 0).add(1).mul(0.5), w = ae(m, r);
|
|
2152
|
+
return ce(a, c, w);
|
|
2158
2153
|
}
|
|
2159
2154
|
}
|
|
2160
|
-
function
|
|
2155
|
+
function Dn(h) {
|
|
2161
2156
|
}
|
|
2162
|
-
const
|
|
2163
|
-
const h =
|
|
2164
|
-
return
|
|
2165
|
-
})(),
|
|
2166
|
-
const h =
|
|
2167
|
-
return
|
|
2157
|
+
const $ = "uSpaceHighlight", Y = `${$}/enabled`, Ze = `${$}/opacity`, et = `${$}/color`, tt = `${$}/overwrite`, st = `${$}/multiplyOpacity`, de = `${$}/instancedOriginalOpacity`, me = "uSpaceBreathe", pe = `${me}/enabled`, nt = `${me}/color`, it = `${me}/speed`, rt = `${me}/intensity`, ue = /* @__PURE__ */ new WeakMap(), Zs = We(() => {
|
|
2158
|
+
const h = O(Y, "uint"), e = O(et, "uint"), t = O(tt, "uint"), s = Ne(e), n = Pe.mul(s), i = q(t.greaterThan(0), s, n), r = q(h.greaterThan(0), i, Pe), o = O(pe, "uint"), a = O(nt, "uint"), c = O(it, "float"), l = O(rt, "float"), d = Ne(a), p = ye(oe.mul(c)).add(1).mul(0.5), u = ae(p, l), m = ce(r, d, u);
|
|
2159
|
+
return q(o.greaterThan(0), m, r);
|
|
2160
|
+
})(), en = We(() => {
|
|
2161
|
+
const h = O(Y, "uint"), e = O(Ze, "float"), t = O(st, "uint"), s = q(t.greaterThan(0), Oe.mul(e), e);
|
|
2162
|
+
return q(h.greaterThan(0), s, Oe);
|
|
2168
2163
|
})();
|
|
2169
|
-
function
|
|
2164
|
+
function X(h) {
|
|
2170
2165
|
return Array.isArray(h.material) ? h.material : [h.material];
|
|
2171
2166
|
}
|
|
2172
|
-
function
|
|
2173
|
-
|
|
2167
|
+
function Le(h) {
|
|
2168
|
+
X(h).forEach((t) => {
|
|
2174
2169
|
if (!t) return;
|
|
2175
2170
|
let s = ue.get(t);
|
|
2176
2171
|
s || (s = {
|
|
@@ -2179,53 +2174,53 @@ function Be(h) {
|
|
|
2179
2174
|
transparent: t.transparent,
|
|
2180
2175
|
depthWrite: t.depthWrite,
|
|
2181
2176
|
activeMeshes: /* @__PURE__ */ new Set()
|
|
2182
|
-
}, ue.set(t, s)), s.activeMeshes.add(h), t.transparent = !0, t.colorNode =
|
|
2177
|
+
}, ue.set(t, s)), s.activeMeshes.add(h), t.transparent = !0, t.colorNode = Zs, t.opacityNode = en, t.needsUpdate = !0;
|
|
2183
2178
|
});
|
|
2184
2179
|
}
|
|
2185
|
-
function
|
|
2186
|
-
const e = h.userData[
|
|
2180
|
+
function ze(h) {
|
|
2181
|
+
const e = h.userData[Y], t = h.userData[pe];
|
|
2187
2182
|
if (e || t) return;
|
|
2188
|
-
|
|
2183
|
+
X(h).forEach((n) => {
|
|
2189
2184
|
if (!n) return;
|
|
2190
2185
|
const i = ue.get(n);
|
|
2191
2186
|
i && (i.activeMeshes.delete(h), !(i.activeMeshes.size > 0) && (n.colorNode = i.colorNode, n.opacityNode = i.opacityNode, n.transparent = i.transparent, n.depthWrite = i.depthWrite, n.needsUpdate = !0, ue.delete(n)));
|
|
2192
2187
|
});
|
|
2193
2188
|
}
|
|
2194
|
-
function
|
|
2195
|
-
const n = h, i = n.
|
|
2189
|
+
function tn(h, e, t, s) {
|
|
2190
|
+
const n = h, i = n.setSemanticHighlight;
|
|
2196
2191
|
if (i)
|
|
2197
2192
|
return i.call(h, e, t, s), !0;
|
|
2198
|
-
const r = n.
|
|
2193
|
+
const r = n.setSemanticColor, o = n.setSemanticOpacity, a = n.getSemanticOpacity, c = n.getSemanticColor, l = n.hasSemanticColor;
|
|
2199
2194
|
return !r || !o ? !1 : (h.userData[de] === void 0 && (h.userData[de] = {
|
|
2200
2195
|
hasColor: l?.call(h) ?? !1,
|
|
2201
|
-
color: c?.call(h, new
|
|
2196
|
+
color: c?.call(h, new T()).getHex() ?? 16777215,
|
|
2202
2197
|
opacity: a?.call(h) ?? 1
|
|
2203
2198
|
}), r.call(h, e), o.call(h, t), !0);
|
|
2204
2199
|
}
|
|
2205
|
-
function
|
|
2206
|
-
const e = h, t = e.
|
|
2200
|
+
function sn(h) {
|
|
2201
|
+
const e = h, t = e.clearSemanticHighlight;
|
|
2207
2202
|
if (t)
|
|
2208
2203
|
return t.call(h), !0;
|
|
2209
|
-
const s = e.
|
|
2204
|
+
const s = e.resetSemanticColor, n = e.setSemanticColor, i = e.setSemanticOpacity;
|
|
2210
2205
|
if (!s || !i) return !1;
|
|
2211
2206
|
const r = h.userData[de];
|
|
2212
2207
|
return r && (r.hasColor && n ? n.call(h, r.color) : s.call(h), i.call(h, r.opacity), Reflect.deleteProperty(h.userData, de)), !0;
|
|
2213
2208
|
}
|
|
2214
2209
|
class le {
|
|
2215
2210
|
static highlightColor(e, t = {}) {
|
|
2216
|
-
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o } = t,
|
|
2217
|
-
for (const
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2211
|
+
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o, multiplyOpacity: a = !1 } = t, c = new T(i).getHex();
|
|
2212
|
+
for (const l of s)
|
|
2213
|
+
tn(l, i, n, r) || F.traverseMeshes(l, (d) => {
|
|
2214
|
+
d.userData[Y] = 1, d.userData[Ze] = n, d.userData[et] = c, d.userData[tt] = r ? 1 : 0, d.userData[st] = a ? 1 : 0, Le(d), o !== void 0 && X(d).forEach((u) => {
|
|
2215
|
+
u && (u.depthWrite = o);
|
|
2221
2216
|
});
|
|
2222
2217
|
});
|
|
2223
2218
|
}
|
|
2224
2219
|
static removeHighlightColor(e) {
|
|
2225
2220
|
const t = Array.isArray(e) ? e : [e];
|
|
2226
2221
|
for (const s of t)
|
|
2227
|
-
|
|
2228
|
-
n.userData[
|
|
2222
|
+
sn(s) || F.traverseMeshes(s, (n) => {
|
|
2223
|
+
n.userData[Y] = 0, ze(n);
|
|
2229
2224
|
});
|
|
2230
2225
|
}
|
|
2231
2226
|
static breatheColor(e, t = {}) {
|
|
@@ -2237,17 +2232,17 @@ class le {
|
|
|
2237
2232
|
},
|
|
2238
2233
|
t
|
|
2239
2234
|
);
|
|
2240
|
-
n.color = new
|
|
2235
|
+
n.color = new T(n.color).getHex();
|
|
2241
2236
|
for (const i of s)
|
|
2242
2237
|
F.traverseMeshes(i, (r) => {
|
|
2243
|
-
r.userData[pe] = 1, r.userData[
|
|
2238
|
+
r.userData[pe] = 1, r.userData[nt] = n.color, r.userData[it] = n.speed, r.userData[rt] = n.intensity, Le(r);
|
|
2244
2239
|
});
|
|
2245
2240
|
}
|
|
2246
2241
|
static removeBreatheColor(e) {
|
|
2247
2242
|
const t = Array.isArray(e) ? e : [e];
|
|
2248
2243
|
for (const s of t)
|
|
2249
2244
|
F.traverseMeshes(s, (n) => {
|
|
2250
|
-
n.userData[pe] = 0,
|
|
2245
|
+
n.userData[pe] = 0, ze(n);
|
|
2251
2246
|
});
|
|
2252
2247
|
}
|
|
2253
2248
|
/**
|
|
@@ -2257,7 +2252,7 @@ class le {
|
|
|
2257
2252
|
const s = Array.isArray(e) ? e : [e];
|
|
2258
2253
|
for (const n of s)
|
|
2259
2254
|
F.traverseMeshes(n, (i) => {
|
|
2260
|
-
|
|
2255
|
+
X(i).forEach((r) => {
|
|
2261
2256
|
if (!r) return;
|
|
2262
2257
|
const o = r;
|
|
2263
2258
|
o.wireframe = t, o.needsUpdate = !0;
|
|
@@ -2290,7 +2285,7 @@ class le {
|
|
|
2290
2285
|
const i = Array.isArray(e) ? e : [e], r = /* @__PURE__ */ new Map();
|
|
2291
2286
|
for (const o of i)
|
|
2292
2287
|
F.traverseMeshes(o, (a) => {
|
|
2293
|
-
|
|
2288
|
+
X(a).forEach((c) => {
|
|
2294
2289
|
if (!c || r.has(c)) return;
|
|
2295
2290
|
const l = c.opacity, d = c.transparent, p = s >= 1 ? l : s;
|
|
2296
2291
|
r.set(c, {
|
|
@@ -2316,8 +2311,8 @@ class le {
|
|
|
2316
2311
|
c = requestAnimationFrame(l);
|
|
2317
2312
|
else {
|
|
2318
2313
|
if (s >= 1)
|
|
2319
|
-
for (const { material: m, originalOpacity: w, originalTransparent:
|
|
2320
|
-
m.opacity = w, m.transparent =
|
|
2314
|
+
for (const { material: m, originalOpacity: w, originalTransparent: S } of r.values())
|
|
2315
|
+
m.opacity = w, m.transparent = S, m.needsUpdate = !0;
|
|
2321
2316
|
o();
|
|
2322
2317
|
}
|
|
2323
2318
|
};
|
|
@@ -2325,11 +2320,11 @@ class le {
|
|
|
2325
2320
|
});
|
|
2326
2321
|
}
|
|
2327
2322
|
}
|
|
2328
|
-
const
|
|
2323
|
+
const Ne = (h) => {
|
|
2329
2324
|
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);
|
|
2330
|
-
return
|
|
2325
|
+
return es(e, t, s);
|
|
2331
2326
|
};
|
|
2332
|
-
class
|
|
2327
|
+
class nn extends ws {
|
|
2333
2328
|
viewer;
|
|
2334
2329
|
constructor(e, t) {
|
|
2335
2330
|
super(t), this.viewer = e;
|
|
@@ -2338,7 +2333,7 @@ class tn extends ys {
|
|
|
2338
2333
|
this.update(e) && this.viewer.render();
|
|
2339
2334
|
};
|
|
2340
2335
|
easingByMode(e) {
|
|
2341
|
-
const t =
|
|
2336
|
+
const t = rn[e];
|
|
2342
2337
|
return super.easing(t);
|
|
2343
2338
|
}
|
|
2344
2339
|
start(e, t) {
|
|
@@ -2348,9 +2343,9 @@ class tn extends ys {
|
|
|
2348
2343
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
2349
2344
|
}
|
|
2350
2345
|
}
|
|
2351
|
-
function
|
|
2346
|
+
function kn(h, e, t, s = {}, n, i) {
|
|
2352
2347
|
return new Promise((r, o) => {
|
|
2353
|
-
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new
|
|
2348
|
+
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new nn(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((m) => {
|
|
2354
2349
|
n?.(m, u);
|
|
2355
2350
|
}).onComplete(() => {
|
|
2356
2351
|
r();
|
|
@@ -2362,7 +2357,7 @@ function Nn(h, e, t, s = {}, n, i) {
|
|
|
2362
2357
|
typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
|
|
2363
2358
|
});
|
|
2364
2359
|
}
|
|
2365
|
-
const
|
|
2360
|
+
const rn = {
|
|
2366
2361
|
"Linear.None": f.Linear.None,
|
|
2367
2362
|
"Quadratic.In": f.Quadratic.In,
|
|
2368
2363
|
"Quadratic.Out": f.Quadratic.Out,
|
|
@@ -2395,7 +2390,7 @@ const sn = {
|
|
|
2395
2390
|
"Bounce.Out": f.Bounce.Out,
|
|
2396
2391
|
"Bounce.InOut": f.Bounce.InOut
|
|
2397
2392
|
};
|
|
2398
|
-
class
|
|
2393
|
+
class jn {
|
|
2399
2394
|
scene;
|
|
2400
2395
|
planes = /* @__PURE__ */ new Map();
|
|
2401
2396
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -2404,7 +2399,7 @@ class Dn {
|
|
|
2404
2399
|
*/
|
|
2405
2400
|
group;
|
|
2406
2401
|
constructor(e) {
|
|
2407
|
-
this.scene = e, this.group = new
|
|
2402
|
+
this.scene = e, this.group = new Wt(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
|
|
2408
2403
|
}
|
|
2409
2404
|
/**
|
|
2410
2405
|
* Move all current scene children (except the clipping group itself) into the ClippingGroup,
|
|
@@ -2445,7 +2440,7 @@ class Dn {
|
|
|
2445
2440
|
showHelper: i = !1,
|
|
2446
2441
|
helperSize: r = 5,
|
|
2447
2442
|
helperColor: o = 16711680
|
|
2448
|
-
} = t, a = new
|
|
2443
|
+
} = t, a = new Kt(new v(s.x, s.y, s.z), n);
|
|
2449
2444
|
return this.planes.set(e, a), this._syncPlanes(), i && this.showHelper(e, r, o), a;
|
|
2450
2445
|
}
|
|
2451
2446
|
/**
|
|
@@ -2471,7 +2466,7 @@ class Dn {
|
|
|
2471
2466
|
* Add a clipping box from an object's bounding box with optional padding.
|
|
2472
2467
|
*/
|
|
2473
2468
|
addBoxFromObject(e, t, s = 0, n = {}) {
|
|
2474
|
-
const i = new
|
|
2469
|
+
const i = new V().setFromObject(t);
|
|
2475
2470
|
return i.expandByScalar(s), this.addBox(e, i, n);
|
|
2476
2471
|
}
|
|
2477
2472
|
/**
|
|
@@ -2511,7 +2506,7 @@ class Dn {
|
|
|
2511
2506
|
this.hideHelper(e);
|
|
2512
2507
|
const n = this.planes.get(e);
|
|
2513
2508
|
if (!n) return;
|
|
2514
|
-
const i = new
|
|
2509
|
+
const i = new Qt(n, t, new T(s).getHex());
|
|
2515
2510
|
i.name = e, this.helpers.set(e, i), this.scene.add(i);
|
|
2516
2511
|
}
|
|
2517
2512
|
/**
|
|
@@ -2537,7 +2532,7 @@ class Dn {
|
|
|
2537
2532
|
this.detach(), this.removeAll(), this.scene.remove(this.group);
|
|
2538
2533
|
}
|
|
2539
2534
|
}
|
|
2540
|
-
class
|
|
2535
|
+
class Un {
|
|
2541
2536
|
scene;
|
|
2542
2537
|
measurements = /* @__PURE__ */ new Map();
|
|
2543
2538
|
_idCounter = 0;
|
|
@@ -2548,9 +2543,9 @@ class kn {
|
|
|
2548
2543
|
* Measure distance between two points.
|
|
2549
2544
|
*/
|
|
2550
2545
|
measureDistance(e, t, s = {}) {
|
|
2551
|
-
const { lineColor: n = 16776960 } = s, i = new v(e.x, e.y, e.z), r = new v(t.x, t.y, t.z), o = i.distanceTo(r), a = `measure_dist_${this._idCounter++}`, c = new
|
|
2546
|
+
const { lineColor: n = 16776960 } = s, i = new v(e.x, e.y, e.z), r = new v(t.x, t.y, t.z), o = i.distanceTo(r), a = `measure_dist_${this._idCounter++}`, c = new I();
|
|
2552
2547
|
c.name = a;
|
|
2553
|
-
const l = new
|
|
2548
|
+
const l = new Q().setFromPoints([i, r]), d = new ie({ color: n }), p = new re(l, d);
|
|
2554
2549
|
c.add(p), this.scene.add(c);
|
|
2555
2550
|
const u = {
|
|
2556
2551
|
id: a,
|
|
@@ -2569,9 +2564,9 @@ class kn {
|
|
|
2569
2564
|
const { lineColor: s = 65280 } = t;
|
|
2570
2565
|
if (e.length < 3)
|
|
2571
2566
|
throw new Error("MeasureTool.measureArea requires at least 3 points");
|
|
2572
|
-
const n = e.map((u) => new v(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`, o = new
|
|
2567
|
+
const n = e.map((u) => new v(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`, o = new I();
|
|
2573
2568
|
o.name = r;
|
|
2574
|
-
const a = [...n, n[0]], c = new
|
|
2569
|
+
const a = [...n, n[0]], c = new Q().setFromPoints(a), l = new ie({ color: s }), d = new re(c, l);
|
|
2575
2570
|
o.add(d), this.scene.add(o);
|
|
2576
2571
|
const p = {
|
|
2577
2572
|
id: r,
|
|
@@ -2587,9 +2582,9 @@ class kn {
|
|
|
2587
2582
|
* Measure the angle between three points (vertex at the middle point).
|
|
2588
2583
|
*/
|
|
2589
2584
|
measureAngle(e, t, s, n = {}) {
|
|
2590
|
-
const { lineColor: i = 16746496 } = n, r = new v(e.x, e.y, e.z), o = new v(t.x, t.y, t.z), a = new v(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), l = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, m = new
|
|
2585
|
+
const { lineColor: i = 16746496 } = n, r = new v(e.x, e.y, e.z), o = new v(t.x, t.y, t.z), a = new v(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), l = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, m = new I();
|
|
2591
2586
|
m.name = u;
|
|
2592
|
-
const w = new
|
|
2587
|
+
const w = new Q().setFromPoints([r, o, a]), S = new ie({ color: i }), x = new re(w, S);
|
|
2593
2588
|
m.add(x), this.scene.add(m);
|
|
2594
2589
|
const y = {
|
|
2595
2590
|
id: u,
|
|
@@ -2650,7 +2645,7 @@ class kn {
|
|
|
2650
2645
|
this.removeAll();
|
|
2651
2646
|
}
|
|
2652
2647
|
}
|
|
2653
|
-
class
|
|
2648
|
+
class Hn {
|
|
2654
2649
|
scene;
|
|
2655
2650
|
annotations = /* @__PURE__ */ new Map();
|
|
2656
2651
|
_idCounter = 0;
|
|
@@ -2670,7 +2665,7 @@ class jn {
|
|
|
2670
2665
|
*/
|
|
2671
2666
|
add(e, t) {
|
|
2672
2667
|
this.annotations.has(e) && this.remove(e);
|
|
2673
|
-
const s = new
|
|
2668
|
+
const s = new I();
|
|
2674
2669
|
s.name = `annotation_${e}`;
|
|
2675
2670
|
const n = new v(t.position.x, t.position.y, t.position.z);
|
|
2676
2671
|
s.position.copy(n);
|
|
@@ -2691,11 +2686,11 @@ class jn {
|
|
|
2691
2686
|
let r = null;
|
|
2692
2687
|
const o = t.labelOffset || { x: 0, y: 2, z: 0 };
|
|
2693
2688
|
if (t.showLeaderLine !== !1) {
|
|
2694
|
-
const { lineColor: c = 16777215 } = t, l = new
|
|
2689
|
+
const { lineColor: c = 16777215 } = t, l = new Q().setFromPoints([
|
|
2695
2690
|
new v(0, 0, 0),
|
|
2696
2691
|
new v(o.x, o.y, o.z)
|
|
2697
|
-
]), d = new
|
|
2698
|
-
r = new
|
|
2692
|
+
]), d = new ie({ color: c });
|
|
2693
|
+
r = new re(l, d), s.add(r);
|
|
2699
2694
|
}
|
|
2700
2695
|
if (this._createCSSObject) {
|
|
2701
2696
|
const c = this._createCSSObject(i);
|
|
@@ -2803,47 +2798,47 @@ class jn {
|
|
|
2803
2798
|
this.removeAll();
|
|
2804
2799
|
}
|
|
2805
2800
|
}
|
|
2806
|
-
const
|
|
2807
|
-
window.__USPACE__ = { version:
|
|
2801
|
+
const on = "0.0.29";
|
|
2802
|
+
window.__USPACE__ = { version: on };
|
|
2808
2803
|
export {
|
|
2809
|
-
|
|
2810
|
-
|
|
2804
|
+
Hn as AnnotationManager,
|
|
2805
|
+
Ye as BaseGroup,
|
|
2811
2806
|
G as BaseMesh,
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2807
|
+
Vs as BaseSprite,
|
|
2808
|
+
$n as CSS2DObject,
|
|
2809
|
+
Kn as CSS3DObject,
|
|
2810
|
+
Qn as CSS3DSprite,
|
|
2811
|
+
Bs as CSSRenderer,
|
|
2812
|
+
Ts as CameraControls,
|
|
2813
|
+
zn as CircleMesh,
|
|
2814
|
+
jn as ClippingTool,
|
|
2815
|
+
Je as ExtrudeMesh,
|
|
2816
|
+
vs as InteractionEvent,
|
|
2817
|
+
bs as InteractionManager,
|
|
2818
|
+
On as LightManager,
|
|
2824
2819
|
le as MaterialEffects,
|
|
2825
|
-
|
|
2820
|
+
Un as MeasureTool,
|
|
2826
2821
|
he as Model,
|
|
2827
2822
|
D as ModelLoaderManager,
|
|
2828
|
-
|
|
2823
|
+
xs as ObjectManager,
|
|
2829
2824
|
F as ObjectUtils,
|
|
2830
|
-
|
|
2825
|
+
Ln as PlaneMesh,
|
|
2831
2826
|
In as Poi,
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2827
|
+
Ss as RenderPipeline,
|
|
2828
|
+
Es as RoomEnvironment,
|
|
2829
|
+
Xs as SBMLoader,
|
|
2830
|
+
Ls as SBMXLoader,
|
|
2831
|
+
Pn as SceneManager,
|
|
2832
|
+
En as Selection,
|
|
2833
|
+
Ve as ShapeMesh,
|
|
2834
|
+
Js as SphereMesh,
|
|
2835
|
+
Nn as TSLEffects,
|
|
2836
|
+
Bn as TextureLoaderManager,
|
|
2837
|
+
Rn as Topology,
|
|
2843
2838
|
Ie as TubeMesh,
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2839
|
+
nn as Tween,
|
|
2840
|
+
An as Viewer,
|
|
2841
|
+
Dn as reinterpretType,
|
|
2842
|
+
kn as tweenAnimation,
|
|
2843
|
+
on as version
|
|
2849
2844
|
};
|