u-space 0.0.26 → 0.0.28
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 +411 -373
- package/dist/plugins/atmosphere/index.cjs +1 -1
- package/dist/plugins/atmosphere/index.js +3255 -129
- package/dist/plugins/atmosphere/threeR185Compat.d.ts +2 -0
- package/dist/plugins/fire/FireEffect.d.ts +90 -0
- package/dist/plugins/fire/index.cjs +1 -0
- package/dist/plugins/fire/index.d.ts +1 -0
- package/dist/plugins/fire/index.js +433 -0
- package/dist/plugins/u-manager/index.cjs +60 -60
- package/dist/plugins/u-manager/index.d.ts +3 -0
- package/dist/plugins/u-manager/index.js +10070 -9660
- package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +37 -0
- package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +33 -0
- package/dist/plugins/u-manager/instances/index.d.ts +2 -0
- package/dist/plugins/u-manager/loaders/SceneInstancedLayer.d.ts +13 -0
- package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +5 -5
- 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 +4 -10
- package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +5 -24
- package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +30 -15
- package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +26 -0
- package/dist/plugins/u-manager/semantics/types.d.ts +1 -0
- package/dist/src/effects/MaterialEffects.d.ts +1 -0
- package/dist/src/tools/AnnotationManager.d.ts +4 -1
- package/dist/src/viewers/RenderPipeline.d.ts +6 -5
- package/docs/api-effects.md +3 -0
- package/docs/api-interactions.md +1 -0
- package/docs/api-managers.md +1 -1
- package/docs/api-plugin-fire.md +174 -0
- package/docs/api-plugin-u-manager.md +249 -57
- package/docs/api-tools.md +1 -1
- package/docs/changelog.md +41 -8
- package/docs/examples-guide.md +39 -13
- package/docs/getting-started.md +1 -1
- package/docs/index.md +1 -0
- package/docs/mcp.md +34 -1
- package/package.json +4 -4
- 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 Ne, Vector2 as C, EventDispatcher as De, Box2 as at, Matrix4 as ke, Vector3 as v, Box3 as V, Scene as je, Color as M, AmbientLight as ct, DirectionalLight as ye, PointLight as we, SpotLight as ve, HemisphereLight as be, DirectionalLightHelper as ht, PointLightHelper as lt, SpotLightHelper as dt, HemisphereLightHelper as pt, RenderPipeline as ut, PerspectiveCamera as se, Sphere as Ue, Spherical as T, 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 Mt, MeshStandardNodeMaterial as L, Loader as Tt, LoaderUtils as I, FileLoader as He, TextureLoader as Fe, Group as R, SRGBColorSpace as Ge, RepeatWrapping as xe, BufferGeometry as Q, BufferAttribute as Se, Mesh as k, FrontSide as _t, BackSide as Et, DoubleSide as Pt, REVISION as Ce, CubeTextureLoader as Ot, EquirectangularReflectionMapping as At, Sprite as Bt, AnimationMixer as It, LoopRepeat as Rt, 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 fe, 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 Te, time as oe, pow as ae, sin as ge, mix as ce, mx_noise_float as _e, Fn as We, userData as O, materialColor as Ee, select as q, materialOpacity as Pe, 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 Gn } 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 Wn, CSS3DSprite as Kn } 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 Oe } 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 gs {
|
|
|
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 Ne();
|
|
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 ys {
|
|
|
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 ys {
|
|
|
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 _n extends De {
|
|
209
209
|
scene;
|
|
210
210
|
camera;
|
|
211
211
|
domElement;
|
|
@@ -215,8 +215,8 @@ class xn extends Ie {
|
|
|
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 xn extends Ie {
|
|
|
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 ke();
|
|
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,7 +341,15 @@ class xn extends Ie {
|
|
|
341
341
|
this.disableBoxSelection(), this._selected.clear();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
function ee(h, e) {
|
|
345
|
+
const t = h;
|
|
346
|
+
if (t.setSemanticVisible) {
|
|
347
|
+
t.setSemanticVisible(e);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
h.visible = e, t.markSemanticRenderDirty?.();
|
|
351
|
+
}
|
|
352
|
+
class xs {
|
|
345
353
|
idMap = /* @__PURE__ */ new Map();
|
|
346
354
|
nameMap = /* @__PURE__ */ new Map();
|
|
347
355
|
typeMap = /* @__PURE__ */ new Map();
|
|
@@ -448,42 +456,50 @@ class ws {
|
|
|
448
456
|
*/
|
|
449
457
|
show(e) {
|
|
450
458
|
const t = this.idMap.get(e);
|
|
451
|
-
t && (t
|
|
459
|
+
t && ee(t, !0);
|
|
452
460
|
}
|
|
453
461
|
/**
|
|
454
462
|
* Hide an object by id.
|
|
455
463
|
*/
|
|
456
464
|
hide(e) {
|
|
457
465
|
const t = this.idMap.get(e);
|
|
458
|
-
t && (t
|
|
466
|
+
t && ee(t, !1);
|
|
459
467
|
}
|
|
460
468
|
/**
|
|
461
469
|
* Show only the specified objects, hide all others.
|
|
462
470
|
*/
|
|
463
471
|
isolate(e) {
|
|
464
472
|
const t = new Set(e);
|
|
465
|
-
for (const
|
|
466
|
-
n
|
|
473
|
+
for (const s of this.allObjects) {
|
|
474
|
+
const n = this.objectIds.get(s) ?? /* @__PURE__ */ new Set();
|
|
475
|
+
ee(s, [...n].some((i) => t.has(i)));
|
|
476
|
+
}
|
|
467
477
|
}
|
|
468
478
|
/**
|
|
469
479
|
* Set the opacity of an object's materials.
|
|
470
480
|
*/
|
|
471
481
|
setOpacity(e, t) {
|
|
472
482
|
const s = this.idMap.get(e);
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
483
|
+
if (!s) return;
|
|
484
|
+
const n = s;
|
|
485
|
+
if (n.setSemanticOpacity) {
|
|
486
|
+
n.setSemanticOpacity(t);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
s.traverse((i) => {
|
|
490
|
+
if (!i.isMesh) return;
|
|
491
|
+
const r = i.material;
|
|
492
|
+
if (!r) return;
|
|
493
|
+
const o = Array.isArray(r) ? r : [r];
|
|
494
|
+
for (const a of o)
|
|
495
|
+
a.transparent = t < 1, a.opacity = t, a.needsUpdate = !0;
|
|
480
496
|
});
|
|
481
497
|
}
|
|
482
498
|
/**
|
|
483
499
|
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
484
500
|
*/
|
|
485
501
|
getBoundingBox(e) {
|
|
486
|
-
const t = new
|
|
502
|
+
const t = new V();
|
|
487
503
|
if (e) {
|
|
488
504
|
const s = this.idMap.get(e);
|
|
489
505
|
s && t.setFromObject(s);
|
|
@@ -515,10 +531,10 @@ class ws {
|
|
|
515
531
|
*/
|
|
516
532
|
showAll() {
|
|
517
533
|
for (const e of this.allObjects)
|
|
518
|
-
e
|
|
534
|
+
ee(e, !0);
|
|
519
535
|
}
|
|
520
536
|
}
|
|
521
|
-
class
|
|
537
|
+
class En {
|
|
522
538
|
scenes = /* @__PURE__ */ new Map();
|
|
523
539
|
_activeSceneKey = null;
|
|
524
540
|
/**
|
|
@@ -531,8 +547,8 @@ class Cn {
|
|
|
531
547
|
* Create and register a new scene.
|
|
532
548
|
*/
|
|
533
549
|
create(e, t = {}) {
|
|
534
|
-
const s = new
|
|
535
|
-
return t.background !== void 0 && (s.background = new
|
|
550
|
+
const s = new je();
|
|
551
|
+
return t.background !== void 0 && (s.background = new M(t.background)), this.scenes.set(e, s), s;
|
|
536
552
|
}
|
|
537
553
|
/**
|
|
538
554
|
* Get a scene by key.
|
|
@@ -571,7 +587,7 @@ class Cn {
|
|
|
571
587
|
const t = this.scenes.get(e);
|
|
572
588
|
if (!t) return null;
|
|
573
589
|
let s = null;
|
|
574
|
-
return t.background instanceof
|
|
590
|
+
return t.background instanceof M && (s = `#${t.background.getHexString()}`), {
|
|
575
591
|
name: t.name || e,
|
|
576
592
|
background: s,
|
|
577
593
|
environmentRotation: {
|
|
@@ -592,7 +608,7 @@ class Cn {
|
|
|
592
608
|
return this.scenes.size;
|
|
593
609
|
}
|
|
594
610
|
}
|
|
595
|
-
class
|
|
611
|
+
class Pn {
|
|
596
612
|
scene;
|
|
597
613
|
lights = /* @__PURE__ */ new Map();
|
|
598
614
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -600,15 +616,15 @@ class Mn {
|
|
|
600
616
|
this.scene = e;
|
|
601
617
|
}
|
|
602
618
|
addAmbient(e, t = {}) {
|
|
603
|
-
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);
|
|
604
620
|
return i.name = e, this._register(e, i), i;
|
|
605
621
|
}
|
|
606
622
|
addDirectional(e, t = {}) {
|
|
607
|
-
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 ye(s, n);
|
|
608
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;
|
|
609
625
|
}
|
|
610
626
|
addPoint(e, t = {}) {
|
|
611
|
-
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 we(s, n, i, r);
|
|
612
628
|
return c.position.set(o.x, o.y, o.z), c.castShadow = a, c.name = e, this._register(e, c), c;
|
|
613
629
|
}
|
|
614
630
|
addSpot(e, t = {}) {
|
|
@@ -622,11 +638,11 @@ class Mn {
|
|
|
622
638
|
position: c = { x: 0, y: 10, z: 0 },
|
|
623
639
|
target: l,
|
|
624
640
|
castShadow: d = !1
|
|
625
|
-
} = t, p = new
|
|
641
|
+
} = t, p = new ve(s, n, i, r, o, a);
|
|
626
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;
|
|
627
643
|
}
|
|
628
644
|
addHemisphere(e, t = {}) {
|
|
629
|
-
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 be(s, n, i);
|
|
630
646
|
return r.name = e, this._register(e, r), r;
|
|
631
647
|
}
|
|
632
648
|
/**
|
|
@@ -677,7 +693,7 @@ class Mn {
|
|
|
677
693
|
const t = this.lights.get(e);
|
|
678
694
|
if (!t) return;
|
|
679
695
|
let s = null;
|
|
680
|
-
t instanceof
|
|
696
|
+
t instanceof ye ? s = new ht(t, 1) : t instanceof we ? s = new lt(t, 0.5) : t instanceof ve ? s = new dt(t) : t instanceof be && (s = new pt(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
681
697
|
}
|
|
682
698
|
/**
|
|
683
699
|
* Hide (remove) the helper for a light.
|
|
@@ -708,7 +724,7 @@ class Mn {
|
|
|
708
724
|
this.removeAll(), this.hideAllHelpers();
|
|
709
725
|
}
|
|
710
726
|
}
|
|
711
|
-
class
|
|
727
|
+
class Ss extends ut {
|
|
712
728
|
scene;
|
|
713
729
|
camera;
|
|
714
730
|
scenePass;
|
|
@@ -737,7 +753,7 @@ class vs extends ht {
|
|
|
737
753
|
#f = !0;
|
|
738
754
|
constructor(...e) {
|
|
739
755
|
const [t, s, n] = e;
|
|
740
|
-
super(t), this.scene = s, this.camera = n, this.scenePass =
|
|
756
|
+
super(t), this.scene = s, this.camera = n, this.scenePass = fe(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
757
|
}
|
|
742
758
|
/** @deprecated Use `scenePass` instead */
|
|
743
759
|
get currentOutputNode() {
|
|
@@ -804,14 +820,14 @@ class vs extends ht {
|
|
|
804
820
|
}
|
|
805
821
|
#i() {
|
|
806
822
|
const e = this.scenePass;
|
|
807
|
-
this.scenePass =
|
|
823
|
+
this.scenePass = fe(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
808
824
|
}
|
|
809
825
|
#g() {
|
|
810
826
|
if (this.#s || this.#o || this.#h || this.#c.size > 0) {
|
|
811
|
-
const t = { output:
|
|
827
|
+
const t = { output: Xt };
|
|
812
828
|
this.#c.forEach((s, n) => {
|
|
813
829
|
n !== "output" && (t[n] = s);
|
|
814
|
-
}), 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));
|
|
815
831
|
}
|
|
816
832
|
}
|
|
817
833
|
#y() {
|
|
@@ -822,20 +838,20 @@ class vs extends ht {
|
|
|
822
838
|
#w() {
|
|
823
839
|
let e = this.scenePass.getTextureNode();
|
|
824
840
|
if (this.#o)
|
|
825
|
-
if (!(this.camera instanceof
|
|
841
|
+
if (!(this.camera instanceof se))
|
|
826
842
|
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
827
843
|
else {
|
|
828
|
-
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i =
|
|
829
|
-
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 =
|
|
844
|
+
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = ss(t, s, n, this.camera);
|
|
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);
|
|
830
846
|
}
|
|
831
847
|
if (this.#s) {
|
|
832
848
|
const t = this.scenePass.getTextureNode("emissive");
|
|
833
|
-
this.#n =
|
|
849
|
+
this.#n = ts(
|
|
834
850
|
t,
|
|
835
851
|
this.#r.strength,
|
|
836
852
|
this.#r.radius,
|
|
837
853
|
this.#r.threshold
|
|
838
|
-
), e =
|
|
854
|
+
), e = Me(e, this.#n), this.#e.push(this.#n);
|
|
839
855
|
}
|
|
840
856
|
return e;
|
|
841
857
|
}
|
|
@@ -850,11 +866,11 @@ class vs extends ht {
|
|
|
850
866
|
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
851
867
|
}), this.#v(s), this.#h && !t) {
|
|
852
868
|
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
853
|
-
this.#l =
|
|
869
|
+
this.#l = ns(e, i, r, this.camera), this.#e.push(this.#l), e = this.#l;
|
|
854
870
|
} else
|
|
855
871
|
this.#l = null;
|
|
856
872
|
this.#t.size > 0 && this.#t.forEach((i) => {
|
|
857
|
-
const r =
|
|
873
|
+
const r = Yt(e, i);
|
|
858
874
|
this.#e.push(r), e = r;
|
|
859
875
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
860
876
|
}
|
|
@@ -865,19 +881,19 @@ class vs extends ht {
|
|
|
865
881
|
this.#y(), this.scenePass.dispose(), super.dispose();
|
|
866
882
|
}
|
|
867
883
|
}
|
|
868
|
-
const
|
|
869
|
-
Vector2:
|
|
884
|
+
const Cs = {
|
|
885
|
+
Vector2: C,
|
|
870
886
|
Vector3: v,
|
|
871
|
-
Vector4:
|
|
872
|
-
Quaternion:
|
|
873
|
-
Matrix4:
|
|
874
|
-
Spherical:
|
|
875
|
-
Box3:
|
|
876
|
-
Sphere:
|
|
877
|
-
Raycaster:
|
|
887
|
+
Vector4: ft,
|
|
888
|
+
Quaternion: mt,
|
|
889
|
+
Matrix4: ke,
|
|
890
|
+
Spherical: T,
|
|
891
|
+
Box3: V,
|
|
892
|
+
Sphere: Ue,
|
|
893
|
+
Raycaster: Ne
|
|
878
894
|
};
|
|
879
|
-
|
|
880
|
-
class
|
|
895
|
+
Ke.install({ THREE: Cs });
|
|
896
|
+
class Ms extends Ke {
|
|
881
897
|
constructor(...e) {
|
|
882
898
|
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
883
899
|
}
|
|
@@ -885,7 +901,7 @@ class xs extends Ge {
|
|
|
885
901
|
* Set absolute angle for azimuth to avoid spinning
|
|
886
902
|
*/
|
|
887
903
|
absoluteRotations() {
|
|
888
|
-
this.azimuthAngle =
|
|
904
|
+
this.azimuthAngle = Ts(this.azimuthAngle, 0);
|
|
889
905
|
}
|
|
890
906
|
async flyToBox(e, t = {}) {
|
|
891
907
|
if (e.isEmpty())
|
|
@@ -893,7 +909,7 @@ class xs extends Ge {
|
|
|
893
909
|
this.absoluteRotations();
|
|
894
910
|
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, o = [];
|
|
895
911
|
if (s !== "current") {
|
|
896
|
-
const a =
|
|
912
|
+
const a = Ae[s.toUpperCase()] ?? Ae.FRONTTOP, c = a.theta, l = a.phi;
|
|
897
913
|
o.push(
|
|
898
914
|
this.fitToBox(e, n, {
|
|
899
915
|
paddingLeft: i,
|
|
@@ -904,13 +920,13 @@ class xs extends Ge {
|
|
|
904
920
|
})
|
|
905
921
|
), o.push(this.rotateTo(c, l, n));
|
|
906
922
|
} else {
|
|
907
|
-
const a = new
|
|
923
|
+
const a = new Ue();
|
|
908
924
|
e.getBoundingSphere(a), a.radius += i, o.push(this.fitToSphere(a, n));
|
|
909
925
|
}
|
|
910
926
|
return await Promise.all(o), !0;
|
|
911
927
|
}
|
|
912
928
|
async flyToObject(e, t = {}) {
|
|
913
|
-
const s = new
|
|
929
|
+
const s = new V().setFromObject(e);
|
|
914
930
|
return this.flyToBox(s, t);
|
|
915
931
|
}
|
|
916
932
|
/**
|
|
@@ -961,33 +977,33 @@ class xs extends Ge {
|
|
|
961
977
|
]);
|
|
962
978
|
}
|
|
963
979
|
}
|
|
964
|
-
const
|
|
965
|
-
LEFT: new
|
|
966
|
-
RIGHT: new
|
|
967
|
-
FRONT: new
|
|
968
|
-
BACK: new
|
|
969
|
-
TOP: new
|
|
970
|
-
BOTTOM: new
|
|
971
|
-
FRONTTOP: new
|
|
972
|
-
BACKTOP: new
|
|
973
|
-
LEFTTOP: new
|
|
974
|
-
RIGHTTOP: new
|
|
975
|
-
LEFTFRONTTOP: new
|
|
976
|
-
RIGHTFRONTTOP: new
|
|
977
|
-
LEFTBACKTOP: new
|
|
978
|
-
RIGHTBACKTOP: new
|
|
980
|
+
const Ae = {
|
|
981
|
+
LEFT: new T(0, Math.PI / 2, -Math.PI / 2),
|
|
982
|
+
RIGHT: new T(0, Math.PI / 2, Math.PI / 2),
|
|
983
|
+
FRONT: new T(0, Math.PI / 2, 0),
|
|
984
|
+
BACK: new T(0, Math.PI / 2, Math.PI),
|
|
985
|
+
TOP: new T(0, 0, 0),
|
|
986
|
+
BOTTOM: new T(0, Math.PI, 0),
|
|
987
|
+
FRONTTOP: new T(0, Math.PI / 4, 0),
|
|
988
|
+
BACKTOP: new T(0, Math.PI / 4, Math.PI),
|
|
989
|
+
LEFTTOP: new T(0, Math.PI / 4, -Math.PI / 2),
|
|
990
|
+
RIGHTTOP: new T(0, Math.PI / 4, Math.PI / 2),
|
|
991
|
+
LEFTFRONTTOP: new T(0, Math.PI / 4, -Math.PI / 4),
|
|
992
|
+
RIGHTFRONTTOP: new T(0, Math.PI / 4, Math.PI / 4),
|
|
993
|
+
LEFTBACKTOP: new T(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
994
|
+
RIGHTBACKTOP: new T(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
979
995
|
};
|
|
980
|
-
function
|
|
996
|
+
function Ts(h, e) {
|
|
981
997
|
const t = h - e;
|
|
982
|
-
return
|
|
998
|
+
return gt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
983
999
|
}
|
|
984
|
-
class
|
|
985
|
-
environment = new
|
|
1000
|
+
class _s {
|
|
1001
|
+
environment = new is();
|
|
986
1002
|
renderer;
|
|
987
1003
|
pmremGenerator;
|
|
988
1004
|
envMap = null;
|
|
989
1005
|
constructor(e) {
|
|
990
|
-
this.renderer = e, this.pmremGenerator = new
|
|
1006
|
+
this.renderer = e, this.pmremGenerator = new yt(e);
|
|
991
1007
|
}
|
|
992
1008
|
update() {
|
|
993
1009
|
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
@@ -996,20 +1012,20 @@ class Ms {
|
|
|
996
1012
|
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
997
1013
|
}
|
|
998
1014
|
}
|
|
999
|
-
const
|
|
1000
|
-
class
|
|
1015
|
+
const te = 128;
|
|
1016
|
+
class Es extends rs {
|
|
1001
1017
|
viewer;
|
|
1002
1018
|
overlayPass;
|
|
1003
1019
|
constructor(e) {
|
|
1004
1020
|
super(e.camera, e.el), this.viewer = e;
|
|
1005
|
-
const t = new
|
|
1006
|
-
t.position.set(0, 0, 2), this.overlayPass =
|
|
1021
|
+
const t = new ne(-2, 2, 2, -2, 0, 4);
|
|
1022
|
+
t.position.set(0, 0, 2), this.overlayPass = fe(this, t), this.setLabels("x", "y", "z");
|
|
1007
1023
|
}
|
|
1008
1024
|
_update = () => {
|
|
1009
1025
|
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
1010
1026
|
const e = this.location;
|
|
1011
1027
|
let t, s;
|
|
1012
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth -
|
|
1028
|
+
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);
|
|
1013
1029
|
};
|
|
1014
1030
|
enable() {
|
|
1015
1031
|
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
@@ -1018,8 +1034,8 @@ class Ss extends ss {
|
|
|
1018
1034
|
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1019
1035
|
}
|
|
1020
1036
|
}
|
|
1021
|
-
const
|
|
1022
|
-
class
|
|
1037
|
+
const qe = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Ps = qe + "z-index:0;", Os = qe + "z-index:1;";
|
|
1038
|
+
class As {
|
|
1023
1039
|
el;
|
|
1024
1040
|
css2dRenderer = null;
|
|
1025
1041
|
css3dRenderer = null;
|
|
@@ -1027,21 +1043,21 @@ class Es {
|
|
|
1027
1043
|
this.el = e, getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
1028
1044
|
}
|
|
1029
1045
|
initCSS2DRenderer() {
|
|
1030
|
-
const e = new
|
|
1031
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1046
|
+
const e = new os();
|
|
1047
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Os, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
|
|
1032
1048
|
}
|
|
1033
1049
|
initCSS3DRenderer() {
|
|
1034
|
-
const e = new
|
|
1035
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1050
|
+
const e = new cs();
|
|
1051
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ps, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
|
|
1036
1052
|
}
|
|
1037
1053
|
createCSS2DObject(e) {
|
|
1038
|
-
return this.css2dRenderer || this.initCSS2DRenderer(), new
|
|
1054
|
+
return this.css2dRenderer || this.initCSS2DRenderer(), new as(e);
|
|
1039
1055
|
}
|
|
1040
1056
|
createCSS25DObject(e) {
|
|
1041
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1057
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new hs(e);
|
|
1042
1058
|
}
|
|
1043
1059
|
createCSS3DObject(e) {
|
|
1044
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1060
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new ls(e);
|
|
1045
1061
|
}
|
|
1046
1062
|
render(e, t) {
|
|
1047
1063
|
this.css2dRenderer && this.css2dRenderer.render(e, t), this.css3dRenderer && this.css3dRenderer.render(e, t);
|
|
@@ -1053,8 +1069,8 @@ class Es {
|
|
|
1053
1069
|
this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
|
|
1054
1070
|
}
|
|
1055
1071
|
}
|
|
1056
|
-
const
|
|
1057
|
-
class
|
|
1072
|
+
const Bs = "timestamp-query";
|
|
1073
|
+
class Is {
|
|
1058
1074
|
el;
|
|
1059
1075
|
renderer;
|
|
1060
1076
|
container;
|
|
@@ -1086,9 +1102,9 @@ class Os {
|
|
|
1086
1102
|
this.timestampText.innerText = "0";
|
|
1087
1103
|
return;
|
|
1088
1104
|
}
|
|
1089
|
-
this.#n(
|
|
1105
|
+
this.#n(Z.RENDER).then((t) => {
|
|
1090
1106
|
this._enabled && (this.timestampText.innerText = t?.toFixed(2) ?? "0");
|
|
1091
|
-
}), this.#n(
|
|
1107
|
+
}), this.#n(Z.COMPUTE);
|
|
1092
1108
|
}
|
|
1093
1109
|
}
|
|
1094
1110
|
enable() {
|
|
@@ -1105,7 +1121,7 @@ class Os {
|
|
|
1105
1121
|
}
|
|
1106
1122
|
#s() {
|
|
1107
1123
|
try {
|
|
1108
|
-
return this.renderer.hasFeature(
|
|
1124
|
+
return this.renderer.hasFeature(Bs);
|
|
1109
1125
|
} catch {
|
|
1110
1126
|
return !0;
|
|
1111
1127
|
}
|
|
@@ -1124,11 +1140,11 @@ class Os {
|
|
|
1124
1140
|
}) : Promise.resolve(void 0);
|
|
1125
1141
|
}
|
|
1126
1142
|
#o() {
|
|
1127
|
-
this.#n(
|
|
1143
|
+
this.#n(Z.RENDER), this.#n(Z.COMPUTE);
|
|
1128
1144
|
}
|
|
1129
1145
|
}
|
|
1130
|
-
|
|
1131
|
-
class
|
|
1146
|
+
wt.enabled = !0;
|
|
1147
|
+
class On extends De {
|
|
1132
1148
|
el;
|
|
1133
1149
|
renderer;
|
|
1134
1150
|
scene;
|
|
@@ -1145,11 +1161,11 @@ class Sn extends Ie {
|
|
|
1145
1161
|
frameCount = 1;
|
|
1146
1162
|
frameloop = "demand";
|
|
1147
1163
|
constructor({ el: e, rendererOptions: t }) {
|
|
1148
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new
|
|
1164
|
+
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 Ms(this.camera, this.renderer.domElement), this.renderPipeline = new Ss(this.renderer, this.scene, this.camera), this.timer = new vt(), this.roomEnvironment = new _s(this.renderer), this.interactionManager = new bs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new xs(), this.viewerHelper = new Es(this), this.cssRenderer = new As(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1149
1165
|
}
|
|
1150
1166
|
onWindowResize = () => {
|
|
1151
1167
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
1152
|
-
this.camera instanceof
|
|
1168
|
+
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();
|
|
1153
1169
|
};
|
|
1154
1170
|
async init() {
|
|
1155
1171
|
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
@@ -1158,7 +1174,7 @@ class Sn extends Ie {
|
|
|
1158
1174
|
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
1159
1175
|
}
|
|
1160
1176
|
setCameraByType(e) {
|
|
1161
|
-
e === "perspective" && !(this.camera instanceof
|
|
1177
|
+
e === "perspective" && !(this.camera instanceof se) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof ne) && this.setCamera(this.createOrthographicCamera());
|
|
1162
1178
|
}
|
|
1163
1179
|
render(e = 1) {
|
|
1164
1180
|
return this.frameCount += e, new Promise((t) => {
|
|
@@ -1176,25 +1192,25 @@ class Sn extends Ie {
|
|
|
1176
1192
|
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 }));
|
|
1177
1193
|
};
|
|
1178
1194
|
_initRenderer(e) {
|
|
1179
|
-
const t = new
|
|
1180
|
-
|
|
1195
|
+
const t = new bt({
|
|
1196
|
+
reversedDepthBuffer: !0,
|
|
1181
1197
|
antialias: !1,
|
|
1182
1198
|
depth: !1,
|
|
1183
1199
|
trackTimestamp: !1,
|
|
1184
1200
|
...e
|
|
1185
1201
|
});
|
|
1186
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type =
|
|
1202
|
+
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;
|
|
1187
1203
|
}
|
|
1188
1204
|
createScene() {
|
|
1189
|
-
const e = new
|
|
1190
|
-
return e.background = new
|
|
1205
|
+
const e = new je();
|
|
1206
|
+
return e.background = new M(0), e;
|
|
1191
1207
|
}
|
|
1192
1208
|
createPerspectiveCamera() {
|
|
1193
|
-
const e = new
|
|
1209
|
+
const e = new se(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
1194
1210
|
return e.position.setScalar(5), e;
|
|
1195
1211
|
}
|
|
1196
1212
|
createOrthographicCamera() {
|
|
1197
|
-
const e = new
|
|
1213
|
+
const e = new ne(
|
|
1198
1214
|
-this.el.clientWidth / 2,
|
|
1199
1215
|
this.el.clientWidth / 2,
|
|
1200
1216
|
this.el.clientHeight / 2,
|
|
@@ -1223,7 +1239,7 @@ class Sn extends Ie {
|
|
|
1223
1239
|
* Set the scene background color, texture, or null.
|
|
1224
1240
|
*/
|
|
1225
1241
|
setBackground(e) {
|
|
1226
|
-
e === null ? this.scene.background = null : e instanceof
|
|
1242
|
+
e === null ? this.scene.background = null : e instanceof M || typeof e == "number" || typeof e == "string" ? this.scene.background = new M(e) : this.scene.background = e, this.render();
|
|
1227
1243
|
}
|
|
1228
1244
|
/**
|
|
1229
1245
|
* Set the scene environment map for reflections / IBL.
|
|
@@ -1248,14 +1264,14 @@ class Sn extends Ie {
|
|
|
1248
1264
|
*/
|
|
1249
1265
|
enableFog(e = {}) {
|
|
1250
1266
|
const { color: t = 13421772, near: s = 10, far: n = 100 } = e;
|
|
1251
|
-
this.scene.fog = new
|
|
1267
|
+
this.scene.fog = new Ct(t, s, n), this.render();
|
|
1252
1268
|
}
|
|
1253
1269
|
/**
|
|
1254
1270
|
* Enable exponential fog.
|
|
1255
1271
|
*/
|
|
1256
1272
|
enableFogExp2(e = {}) {
|
|
1257
1273
|
const { color: t = 13421772, density: s = 0.01 } = e;
|
|
1258
|
-
this.scene.fog = new
|
|
1274
|
+
this.scene.fog = new Mt(t, s), this.render();
|
|
1259
1275
|
}
|
|
1260
1276
|
/**
|
|
1261
1277
|
* Disable fog.
|
|
@@ -1267,22 +1283,22 @@ class Sn extends Ie {
|
|
|
1267
1283
|
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();
|
|
1268
1284
|
}
|
|
1269
1285
|
}
|
|
1270
|
-
class
|
|
1286
|
+
class Rs extends Qe {
|
|
1271
1287
|
constructor(e) {
|
|
1272
1288
|
super(e);
|
|
1273
1289
|
}
|
|
1274
1290
|
parse(e, t, s, n) {
|
|
1275
|
-
if (
|
|
1276
|
-
const r =
|
|
1291
|
+
if (Ls(e.slice(0, 8)) === "SBMG----") {
|
|
1292
|
+
const r = zs(e.slice(8));
|
|
1277
1293
|
return super.parse(r, t, s, n);
|
|
1278
1294
|
} else
|
|
1279
1295
|
return super.parse(e, t, s, n);
|
|
1280
1296
|
}
|
|
1281
1297
|
}
|
|
1282
|
-
function
|
|
1298
|
+
function Ls(h) {
|
|
1283
1299
|
return new TextDecoder().decode(new Uint8Array(h));
|
|
1284
1300
|
}
|
|
1285
|
-
function
|
|
1301
|
+
function zs(h) {
|
|
1286
1302
|
const e = new DataView(h);
|
|
1287
1303
|
for (let t = 0; t < e.byteLength; t++) {
|
|
1288
1304
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
@@ -1290,59 +1306,59 @@ function Ls(h) {
|
|
|
1290
1306
|
}
|
|
1291
1307
|
return e.buffer;
|
|
1292
1308
|
}
|
|
1293
|
-
const
|
|
1294
|
-
function
|
|
1295
|
-
let e =
|
|
1309
|
+
const Ns = 8, Ds = 130, Be = 66, ks = "SBK-----", js = "SBM-----", Xe = new TextDecoder(), Us = new TextEncoder();
|
|
1310
|
+
function Hs(h) {
|
|
1311
|
+
let e = Ns;
|
|
1296
1312
|
const t = new Uint8Array(h, 0, e);
|
|
1297
|
-
if (
|
|
1313
|
+
if (Xe.decode(t) !== ks)
|
|
1298
1314
|
return h;
|
|
1299
|
-
e +=
|
|
1315
|
+
e += Ds;
|
|
1300
1316
|
const n = new Uint8Array(h, 0, e);
|
|
1301
1317
|
if (n[40] === 1) {
|
|
1302
|
-
const r =
|
|
1303
|
-
let l =
|
|
1304
|
-
const d = e +
|
|
1318
|
+
const r = Us.encode(js), o = new Uint8Array([n[41]]), a = Fs(n), c = Gs(a);
|
|
1319
|
+
let l = Be % c.length;
|
|
1320
|
+
const d = e + Be, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
|
|
1305
1321
|
for (let w = 0; w < p.length; w++)
|
|
1306
1322
|
u[w] = p[w] ^ c[l], l = (l + 1) % c.length;
|
|
1307
1323
|
const m = new Uint8Array(r.length + o.length + u.length);
|
|
1308
1324
|
return m.set(r), m.set(o, r.length), m.set(u, r.length + o.length), m.buffer;
|
|
1309
1325
|
}
|
|
1310
1326
|
}
|
|
1311
|
-
function
|
|
1327
|
+
function Fs(h) {
|
|
1312
1328
|
const e = new Uint8Array(128);
|
|
1313
1329
|
return e.set(h.slice(42, 74), 0), e.set(h.slice(74, 138), 32), e.set(h.slice(8, 40), 96), e;
|
|
1314
1330
|
}
|
|
1315
|
-
function
|
|
1331
|
+
function Gs(h) {
|
|
1316
1332
|
const e = new Uint8Array(64);
|
|
1317
1333
|
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;
|
|
1318
1334
|
}
|
|
1319
|
-
const
|
|
1335
|
+
const $s = (h, e, t) => {
|
|
1320
1336
|
const s = h.buffer.slice(t, t + e);
|
|
1321
|
-
let n =
|
|
1337
|
+
let n = Xe.decode(s);
|
|
1322
1338
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
1323
|
-
},
|
|
1339
|
+
}, Ws = (h, e, t) => {
|
|
1324
1340
|
const [s, n, i, r, o] = e, a = t || r < 1;
|
|
1325
|
-
return new
|
|
1341
|
+
return new L({
|
|
1326
1342
|
name: h,
|
|
1327
|
-
color: new
|
|
1343
|
+
color: new M(s, n, i),
|
|
1328
1344
|
opacity: r,
|
|
1329
1345
|
transparent: a,
|
|
1330
1346
|
alphaTest: 0.01,
|
|
1331
1347
|
side: o
|
|
1332
1348
|
});
|
|
1333
|
-
},
|
|
1334
|
-
class
|
|
1349
|
+
}, Ks = (h) => h?.toLowerCase().endsWith(".png") ?? !1;
|
|
1350
|
+
class Qs {
|
|
1335
1351
|
data;
|
|
1336
1352
|
options;
|
|
1337
1353
|
textureLoader;
|
|
1338
1354
|
littleEndian = !0;
|
|
1339
1355
|
materials = /* @__PURE__ */ new Map();
|
|
1340
1356
|
constructor(e, t) {
|
|
1341
|
-
this.data = e, this.options = t, this.textureLoader = new
|
|
1357
|
+
this.data = e, this.options = t, this.textureLoader = new Fe(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
|
|
1342
1358
|
}
|
|
1343
1359
|
parse(e, t) {
|
|
1344
1360
|
let s = this.data;
|
|
1345
|
-
const n =
|
|
1361
|
+
const n = Hs(this.data);
|
|
1346
1362
|
n && (s = n);
|
|
1347
1363
|
const i = new DataView(s);
|
|
1348
1364
|
let r = 8;
|
|
@@ -1366,14 +1382,14 @@ class $s {
|
|
|
1366
1382
|
const p = e.getFloat32(t, this.littleEndian);
|
|
1367
1383
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
1368
1384
|
let u = e.getUint8(t);
|
|
1369
|
-
t += 1, u === 0 ? u =
|
|
1385
|
+
t += 1, u === 0 ? u = _t : u === 1 ? u = Et : u === 2 && (u = Pt);
|
|
1370
1386
|
const m = e.getUint16(t, this.littleEndian);
|
|
1371
1387
|
t += 2;
|
|
1372
|
-
const w = m > 0 ?
|
|
1388
|
+
const w = m > 0 ? $s(e, m, t) : "";
|
|
1373
1389
|
if (t += m, !this.materials.has(a)) {
|
|
1374
|
-
const x =
|
|
1375
|
-
this.materials.set(a, x), w && this.options.path && this.textureLoader.load(
|
|
1376
|
-
y.colorSpace =
|
|
1390
|
+
const x = Ws(a, [c, l, d, p, u], Ks(w));
|
|
1391
|
+
this.materials.set(a, x), w && this.options.path && this.textureLoader.load(I.resolveURL(w, this.options.path), (y) => {
|
|
1392
|
+
y.colorSpace = Ge, y.wrapS = xe, y.wrapT = xe, y.flipY = !1, y.anisotropy = 16, x.map = y;
|
|
1377
1393
|
});
|
|
1378
1394
|
}
|
|
1379
1395
|
}
|
|
@@ -1392,10 +1408,10 @@ class $s {
|
|
|
1392
1408
|
if (t += 2, w > 0)
|
|
1393
1409
|
for (let g = 0; g < w; g++)
|
|
1394
1410
|
t += 4, t += 4, t += 4;
|
|
1395
|
-
const
|
|
1396
|
-
if (t += 2,
|
|
1397
|
-
for (let g = 0; g <
|
|
1398
|
-
const b = new
|
|
1411
|
+
const S = e.getUint16(t, this.littleEndian);
|
|
1412
|
+
if (t += 2, S > 0)
|
|
1413
|
+
for (let g = 0; g < S; g++) {
|
|
1414
|
+
const b = new C();
|
|
1399
1415
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
|
|
1400
1416
|
}
|
|
1401
1417
|
const x = e.getUint16(t, this.littleEndian);
|
|
@@ -1414,13 +1430,13 @@ class $s {
|
|
|
1414
1430
|
for (let g = 0; g < p.length; g++) {
|
|
1415
1431
|
const b = p[g], z = l[b[0]], N = l[b[1]], P = l[b[2]];
|
|
1416
1432
|
y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
|
|
1417
|
-
let
|
|
1433
|
+
let J = new C(), W = new C(), j = new C();
|
|
1418
1434
|
const U = u[g];
|
|
1419
|
-
U !== void 0 && (
|
|
1435
|
+
U !== void 0 && (J = U[0], W = U[1], j = U[2]), _.push(...J.toArray(), ...W.toArray(), ...j.toArray());
|
|
1420
1436
|
}
|
|
1421
|
-
const
|
|
1422
|
-
if (
|
|
1423
|
-
const g = new
|
|
1437
|
+
const A = new Float32Array(y), B = new Float32Array(_), E = new Q();
|
|
1438
|
+
if (A.length > 0 && E.setAttribute("position", new Se(A, 3)), B.length > 0 && E.setAttribute("uv", new Se(B, 2)), E.computeVertexNormals(), this.materials.has(c)) {
|
|
1439
|
+
const g = new k(E, this.materials.get(c));
|
|
1424
1440
|
g.name = a, g.castShadow = !0, g.receiveShadow = !0, n.add(g);
|
|
1425
1441
|
}
|
|
1426
1442
|
}
|
|
@@ -1431,20 +1447,20 @@ class $s {
|
|
|
1431
1447
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
1432
1448
|
}
|
|
1433
1449
|
}
|
|
1434
|
-
class
|
|
1450
|
+
class qs extends Tt {
|
|
1435
1451
|
load(e, t, s, n) {
|
|
1436
1452
|
let i;
|
|
1437
1453
|
if (this.resourcePath !== "")
|
|
1438
1454
|
i = this.resourcePath;
|
|
1439
1455
|
else if (this.path !== "") {
|
|
1440
|
-
const a =
|
|
1441
|
-
i =
|
|
1456
|
+
const a = I.extractUrlBase(e);
|
|
1457
|
+
i = I.resolveURL(a, this.path);
|
|
1442
1458
|
} else
|
|
1443
|
-
i =
|
|
1459
|
+
i = I.extractUrlBase(e);
|
|
1444
1460
|
this.manager.itemStart(e);
|
|
1445
1461
|
const r = (a) => {
|
|
1446
1462
|
n ? n(a) : console.error(a), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
1447
|
-
}, o = new
|
|
1463
|
+
}, o = new He(this.manager);
|
|
1448
1464
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(
|
|
1449
1465
|
e,
|
|
1450
1466
|
(a) => {
|
|
@@ -1471,7 +1487,7 @@ class Ws extends xt {
|
|
|
1471
1487
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
1472
1488
|
return;
|
|
1473
1489
|
}
|
|
1474
|
-
new
|
|
1490
|
+
new Qs(e, {
|
|
1475
1491
|
path: t,
|
|
1476
1492
|
crossOrigin: this.crossOrigin,
|
|
1477
1493
|
requestHeader: this.requestHeader,
|
|
@@ -1493,7 +1509,7 @@ class Ws extends xt {
|
|
|
1493
1509
|
});
|
|
1494
1510
|
}
|
|
1495
1511
|
}
|
|
1496
|
-
const
|
|
1512
|
+
const Xs = [
|
|
1497
1513
|
"map",
|
|
1498
1514
|
"alphaMap",
|
|
1499
1515
|
"aoMap",
|
|
@@ -1520,14 +1536,14 @@ const Ks = [
|
|
|
1520
1536
|
"thicknessMap",
|
|
1521
1537
|
"transmissionMap"
|
|
1522
1538
|
];
|
|
1523
|
-
function
|
|
1539
|
+
function K(h) {
|
|
1524
1540
|
return h.traverse((e) => {
|
|
1525
|
-
if (!(e instanceof
|
|
1541
|
+
if (!(e instanceof k)) return;
|
|
1526
1542
|
const t = Array.isArray(e.material) ? e.material : [e.material];
|
|
1527
1543
|
for (const s of t) {
|
|
1528
1544
|
if (!s) continue;
|
|
1529
1545
|
let n = !1;
|
|
1530
|
-
for (const i of
|
|
1546
|
+
for (const i of Xs) {
|
|
1531
1547
|
const r = s[i];
|
|
1532
1548
|
r?.isTexture && r.image == null && (r.dispose(), s[i] = null, n = !0);
|
|
1533
1549
|
}
|
|
@@ -1535,21 +1551,21 @@ function W(h) {
|
|
|
1535
1551
|
}
|
|
1536
1552
|
}), h;
|
|
1537
1553
|
}
|
|
1538
|
-
class
|
|
1554
|
+
class D {
|
|
1539
1555
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
1540
|
-
static fileLoader = new
|
|
1541
|
-
static dracoLoader = new
|
|
1542
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1556
|
+
static fileLoader = new He().setResponseType("arraybuffer");
|
|
1557
|
+
static dracoLoader = new ms().setDecoderPath(
|
|
1558
|
+
`https://cdn.jsdelivr.net/npm/three@0.${Ce}.0/examples/jsm/libs/draco/`
|
|
1543
1559
|
);
|
|
1544
|
-
static ktx2Loader = new
|
|
1545
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1560
|
+
static ktx2Loader = new fs().setTranscoderPath(
|
|
1561
|
+
`https://cdn.jsdelivr.net/npm/three@0.${Ce}.0/examples/jsm/libs/basis/`
|
|
1546
1562
|
);
|
|
1547
|
-
static gltfLoader = new
|
|
1548
|
-
static sbmxLoader = new
|
|
1549
|
-
static sbmLoader = new
|
|
1550
|
-
static fbxLoader = new
|
|
1551
|
-
static objLoader = new
|
|
1552
|
-
static stlLoader = new
|
|
1563
|
+
static gltfLoader = new Qe().setDRACOLoader(D.dracoLoader).setKTX2Loader(D.ktx2Loader).setMeshoptDecoder(Oe);
|
|
1564
|
+
static sbmxLoader = new Rs().setDRACOLoader(D.dracoLoader).setKTX2Loader(D.ktx2Loader).setMeshoptDecoder(Oe);
|
|
1565
|
+
static sbmLoader = new qs();
|
|
1566
|
+
static fbxLoader = new ds();
|
|
1567
|
+
static objLoader = new ps();
|
|
1568
|
+
static stlLoader = new us();
|
|
1553
1569
|
static setLoadingManager(e) {
|
|
1554
1570
|
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;
|
|
1555
1571
|
}
|
|
@@ -1577,23 +1593,23 @@ class j {
|
|
|
1577
1593
|
switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
|
|
1578
1594
|
case "gltf":
|
|
1579
1595
|
case "glb":
|
|
1580
|
-
const i = await this.gltfLoader.parseAsync(n,
|
|
1581
|
-
return i.scene.animations = i.animations,
|
|
1596
|
+
const i = await this.gltfLoader.parseAsync(n, I.extractUrlBase(e));
|
|
1597
|
+
return i.scene.animations = i.animations, K(i.scene);
|
|
1582
1598
|
case "sbmx":
|
|
1583
|
-
const r = await this.sbmxLoader.parseAsync(n,
|
|
1584
|
-
return r.scene.animations = r.animations,
|
|
1599
|
+
const r = await this.sbmxLoader.parseAsync(n, I.extractUrlBase(e));
|
|
1600
|
+
return r.scene.animations = r.animations, K(r.scene);
|
|
1585
1601
|
case "sbm":
|
|
1586
|
-
const o = await this.sbmLoader.parseAsync(n,
|
|
1587
|
-
return
|
|
1602
|
+
const o = await this.sbmLoader.parseAsync(n, I.extractUrlBase(e));
|
|
1603
|
+
return K(o);
|
|
1588
1604
|
case "fbx":
|
|
1589
|
-
const a = this.fbxLoader.parse(n,
|
|
1590
|
-
return
|
|
1605
|
+
const a = this.fbxLoader.parse(n, I.extractUrlBase(e));
|
|
1606
|
+
return K(a);
|
|
1591
1607
|
case "obj":
|
|
1592
1608
|
const c = new TextDecoder().decode(n), l = this.objLoader.parse(c);
|
|
1593
|
-
return
|
|
1609
|
+
return K(l);
|
|
1594
1610
|
case "stl":
|
|
1595
1611
|
const d = this.stlLoader.parse(n);
|
|
1596
|
-
return new
|
|
1612
|
+
return new k(d, new L());
|
|
1597
1613
|
default:
|
|
1598
1614
|
throw new Error(`Unsupported model format: ${s}`);
|
|
1599
1615
|
}
|
|
@@ -1610,10 +1626,10 @@ class j {
|
|
|
1610
1626
|
}
|
|
1611
1627
|
}
|
|
1612
1628
|
}
|
|
1613
|
-
class
|
|
1614
|
-
static textureLoader = new
|
|
1615
|
-
static hdrLoader = new
|
|
1616
|
-
static cubeTextureLoader = new
|
|
1629
|
+
class An {
|
|
1630
|
+
static textureLoader = new Fe();
|
|
1631
|
+
static hdrLoader = new gs();
|
|
1632
|
+
static cubeTextureLoader = new Ot();
|
|
1617
1633
|
static setLoadingManager(e) {
|
|
1618
1634
|
this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
|
|
1619
1635
|
}
|
|
@@ -1622,13 +1638,13 @@ class Tn {
|
|
|
1622
1638
|
}
|
|
1623
1639
|
static async loadAsyncHDR(e) {
|
|
1624
1640
|
const t = await this.hdrLoader.loadAsync(e);
|
|
1625
|
-
return t.mapping =
|
|
1641
|
+
return t.mapping = At, t;
|
|
1626
1642
|
}
|
|
1627
1643
|
static async loadAsyncCubeTexture(e, t) {
|
|
1628
1644
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
1629
1645
|
}
|
|
1630
1646
|
}
|
|
1631
|
-
class G extends
|
|
1647
|
+
class G extends k {
|
|
1632
1648
|
isBaseMesh = !0;
|
|
1633
1649
|
type = "BaseMesh";
|
|
1634
1650
|
castShadow = !0;
|
|
@@ -1641,7 +1657,7 @@ class G extends D {
|
|
|
1641
1657
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1642
1658
|
}
|
|
1643
1659
|
}
|
|
1644
|
-
class
|
|
1660
|
+
class Ye extends R {
|
|
1645
1661
|
isBaseGroup = !0;
|
|
1646
1662
|
type = "BaseGroup";
|
|
1647
1663
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1652,7 +1668,7 @@ class Qe extends R {
|
|
|
1652
1668
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1653
1669
|
}
|
|
1654
1670
|
}
|
|
1655
|
-
class
|
|
1671
|
+
class Ys extends Bt {
|
|
1656
1672
|
isBaseSprite = !0;
|
|
1657
1673
|
type = "BaseSprite";
|
|
1658
1674
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1663,7 +1679,7 @@ class Qs extends Et {
|
|
|
1663
1679
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1664
1680
|
}
|
|
1665
1681
|
}
|
|
1666
|
-
class
|
|
1682
|
+
class he extends Ye {
|
|
1667
1683
|
isModel = !0;
|
|
1668
1684
|
type = "Model";
|
|
1669
1685
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
@@ -1677,9 +1693,9 @@ class ae extends Qe {
|
|
|
1677
1693
|
const { url: t, cache: s = !0, persistent: n = !0 } = e;
|
|
1678
1694
|
try {
|
|
1679
1695
|
let i;
|
|
1680
|
-
s ?
|
|
1681
|
-
const r = await i, o =
|
|
1682
|
-
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new
|
|
1696
|
+
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 });
|
|
1697
|
+
const r = await i, o = ys(r);
|
|
1698
|
+
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new It(o)), o;
|
|
1683
1699
|
} catch (i) {
|
|
1684
1700
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
1685
1701
|
}
|
|
@@ -1691,7 +1707,7 @@ class ae extends Qe {
|
|
|
1691
1707
|
if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((c) => c.name === e), !o)
|
|
1692
1708
|
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
1693
1709
|
let a = this.actions.get(o.name);
|
|
1694
|
-
return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ?
|
|
1710
|
+
return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? Rt : Lt, n), a.clampWhenFinished = r, a.timeScale = i, a.reset().play(), a;
|
|
1695
1711
|
}
|
|
1696
1712
|
playAllAnimations(e = {}) {
|
|
1697
1713
|
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
@@ -1712,7 +1728,7 @@ class ae extends Qe {
|
|
|
1712
1728
|
* Get the axis-aligned bounding box of this model.
|
|
1713
1729
|
*/
|
|
1714
1730
|
getBoundingBox() {
|
|
1715
|
-
return new
|
|
1731
|
+
return new V().setFromObject(this);
|
|
1716
1732
|
}
|
|
1717
1733
|
/**
|
|
1718
1734
|
* Get the center point of this model's bounding box.
|
|
@@ -1726,7 +1742,7 @@ class ae extends Qe {
|
|
|
1726
1742
|
*/
|
|
1727
1743
|
setMaterial(e) {
|
|
1728
1744
|
this.traverse((t) => {
|
|
1729
|
-
t instanceof
|
|
1745
|
+
t instanceof k && (t.material = e);
|
|
1730
1746
|
});
|
|
1731
1747
|
}
|
|
1732
1748
|
static clearMemoryCache() {
|
|
@@ -1736,11 +1752,11 @@ class ae extends Qe {
|
|
|
1736
1752
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
1737
1753
|
}
|
|
1738
1754
|
}
|
|
1739
|
-
class
|
|
1755
|
+
class Vs extends G {
|
|
1740
1756
|
isSphereMesh = !0;
|
|
1741
1757
|
type = "SphereMesh";
|
|
1742
1758
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1743
|
-
super(), this.geometry = new
|
|
1759
|
+
super(), this.geometry = new zt(
|
|
1744
1760
|
e?.radius,
|
|
1745
1761
|
e?.widthSegments,
|
|
1746
1762
|
e?.heightSegments,
|
|
@@ -1748,23 +1764,23 @@ class qs extends G {
|
|
|
1748
1764
|
e?.phiLength,
|
|
1749
1765
|
e?.thetaStart,
|
|
1750
1766
|
e?.thetaLength
|
|
1751
|
-
), this.material = new
|
|
1767
|
+
), this.material = new L(t);
|
|
1752
1768
|
}
|
|
1753
1769
|
}
|
|
1754
|
-
class
|
|
1770
|
+
class Ie extends G {
|
|
1755
1771
|
isTubeMesh = !0;
|
|
1756
1772
|
type = "TubeMesh";
|
|
1757
1773
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1758
|
-
super(), this.geometry = new
|
|
1774
|
+
super(), this.geometry = new Nt(
|
|
1759
1775
|
e?.path,
|
|
1760
1776
|
e?.tubularSegments,
|
|
1761
1777
|
e?.radius,
|
|
1762
1778
|
e?.radialSegments,
|
|
1763
1779
|
e?.closed
|
|
1764
|
-
), this.material = new
|
|
1780
|
+
), this.material = new L(t);
|
|
1765
1781
|
}
|
|
1766
1782
|
}
|
|
1767
|
-
class
|
|
1783
|
+
class Bn extends Ye {
|
|
1768
1784
|
isTopology = !0;
|
|
1769
1785
|
type = "Topology";
|
|
1770
1786
|
// Visuals
|
|
@@ -1868,7 +1884,7 @@ class _n extends Qe {
|
|
|
1868
1884
|
*/
|
|
1869
1885
|
renderGraph() {
|
|
1870
1886
|
this.clearGraph(), this.graphGroup = new R();
|
|
1871
|
-
const e = new
|
|
1887
|
+
const e = new Vs({
|
|
1872
1888
|
geometryParameters: {
|
|
1873
1889
|
radius: this.parameters.nodeRadius,
|
|
1874
1890
|
widthSegments: 16,
|
|
@@ -1890,7 +1906,7 @@ class _n extends Qe {
|
|
|
1890
1906
|
t.add(o);
|
|
1891
1907
|
const a = this.nodes.get(n), c = this.nodes.get(r);
|
|
1892
1908
|
if (a && c) {
|
|
1893
|
-
const l = new
|
|
1909
|
+
const l = new Dt(a, c), d = new Ie({
|
|
1894
1910
|
geometryParameters: {
|
|
1895
1911
|
path: l,
|
|
1896
1912
|
tubularSegments: 1,
|
|
@@ -1909,7 +1925,7 @@ class _n extends Qe {
|
|
|
1909
1925
|
}
|
|
1910
1926
|
clearGraph() {
|
|
1911
1927
|
this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
|
|
1912
|
-
e instanceof
|
|
1928
|
+
e instanceof k && (e.geometry.dispose(), e.material.dispose());
|
|
1913
1929
|
}), this.graphGroup = null);
|
|
1914
1930
|
}
|
|
1915
1931
|
/**
|
|
@@ -1917,7 +1933,7 @@ class _n extends Qe {
|
|
|
1917
1933
|
*/
|
|
1918
1934
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1919
1935
|
if (e.length < 2) return;
|
|
1920
|
-
const s = new
|
|
1936
|
+
const s = new kt(e, !1, "catmullrom", 0), n = new Ie({
|
|
1921
1937
|
geometryParameters: {
|
|
1922
1938
|
path: s,
|
|
1923
1939
|
tubularSegments: e.length * 10,
|
|
@@ -1967,7 +1983,7 @@ class _n extends Qe {
|
|
|
1967
1983
|
return this.adjacencyMap.get(e);
|
|
1968
1984
|
}
|
|
1969
1985
|
}
|
|
1970
|
-
class
|
|
1986
|
+
class In extends Ys {
|
|
1971
1987
|
isPoi = !0;
|
|
1972
1988
|
type = "Poi";
|
|
1973
1989
|
parameters = {
|
|
@@ -1986,7 +2002,7 @@ class En extends Qs {
|
|
|
1986
2002
|
_canvas = document.createElement("canvas");
|
|
1987
2003
|
_lastParametersJSON = "";
|
|
1988
2004
|
constructor(e = {}) {
|
|
1989
|
-
super(new
|
|
2005
|
+
super(new jt()), Object.assign(this.parameters, e), this.updateAsync();
|
|
1990
2006
|
}
|
|
1991
2007
|
/**
|
|
1992
2008
|
* Update the POI with new parameters
|
|
@@ -2002,33 +2018,33 @@ class En extends Qs {
|
|
|
2002
2018
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
2003
2019
|
let i = null;
|
|
2004
2020
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
2005
|
-
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),
|
|
2006
|
-
let y = 0, _ = 0,
|
|
2021
|
+
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;
|
|
2022
|
+
let y = 0, _ = 0, A = 0, B = 0, E = 0, g = 0;
|
|
2007
2023
|
const b = !!i, z = !!r;
|
|
2008
2024
|
if (b && z)
|
|
2009
2025
|
switch (u) {
|
|
2010
2026
|
case "top":
|
|
2011
|
-
y = Math.max(c,
|
|
2027
|
+
y = Math.max(c, S), _ = c + l + x, E = (y - S) / 2, g = x / 2, A = (y - c) / 2, B = x + l;
|
|
2012
2028
|
break;
|
|
2013
2029
|
case "bottom":
|
|
2014
|
-
y = Math.max(c,
|
|
2030
|
+
y = Math.max(c, S), _ = c + l + x, A = (y - c) / 2, B = 0, E = (y - S) / 2, g = c + l + x / 2;
|
|
2015
2031
|
break;
|
|
2016
2032
|
case "left":
|
|
2017
|
-
y = c + l +
|
|
2033
|
+
y = c + l + S, _ = Math.max(c, x), E = 0, g = _ / 2, A = S + l, B = (_ - c) / 2;
|
|
2018
2034
|
break;
|
|
2019
2035
|
default:
|
|
2020
|
-
y = c + l +
|
|
2036
|
+
y = c + l + S, _ = Math.max(c, x), A = 0, B = (_ - c) / 2, E = c + l, g = _ / 2;
|
|
2021
2037
|
break;
|
|
2022
2038
|
}
|
|
2023
|
-
else b ? (y = c, _ = c,
|
|
2039
|
+
else b ? (y = c, _ = c, A = 0, B = 0) : z && (y = S, _ = x, E = 0, g = x / 2);
|
|
2024
2040
|
const N = y + l * 2, P = _ + l * 2;
|
|
2025
|
-
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,
|
|
2041
|
+
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) {
|
|
2026
2042
|
n.fillStyle = a;
|
|
2027
|
-
const
|
|
2028
|
-
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l +
|
|
2043
|
+
const j = n.measureText(r), U = j.actualBoundingBoxAscent + j.actualBoundingBoxDescent, ot = j.actualBoundingBoxAscent - U / 2;
|
|
2044
|
+
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l + ot);
|
|
2029
2045
|
}
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2046
|
+
const J = this.material.map, W = new Ut(s);
|
|
2047
|
+
W.colorSpace = Ge, this.material.map = W, J?.dispose(), this.scale.set(N * m, P * m, 1);
|
|
2032
2048
|
}
|
|
2033
2049
|
_loadImage(e) {
|
|
2034
2050
|
return new Promise((t, s) => {
|
|
@@ -2046,80 +2062,80 @@ class En extends Qs {
|
|
|
2046
2062
|
this.material.map?.dispose(), this.material.dispose();
|
|
2047
2063
|
}
|
|
2048
2064
|
}
|
|
2049
|
-
class
|
|
2065
|
+
class Ve extends G {
|
|
2050
2066
|
isShapeMesh = !0;
|
|
2051
2067
|
type = "ShapeMesh";
|
|
2052
2068
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2053
|
-
super(), this.geometry = new
|
|
2069
|
+
super(), this.geometry = new Ht(e?.shape, e?.curveSegments), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2054
2070
|
}
|
|
2055
2071
|
static createFromPoints(e, t = {}) {
|
|
2056
|
-
return new
|
|
2072
|
+
return new Ve({
|
|
2057
2073
|
...t,
|
|
2058
2074
|
geometryParameters: {
|
|
2059
2075
|
...t.geometryParameters,
|
|
2060
|
-
shape: new
|
|
2076
|
+
shape: new $e(e.map((s) => new C(s.x, -s.z)))
|
|
2061
2077
|
}
|
|
2062
2078
|
});
|
|
2063
2079
|
}
|
|
2064
2080
|
}
|
|
2065
|
-
class
|
|
2081
|
+
class Je extends G {
|
|
2066
2082
|
isExtrudeMesh = !0;
|
|
2067
2083
|
type = "ExtrudeMesh";
|
|
2068
2084
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2069
|
-
super(), this.geometry = new
|
|
2085
|
+
super(), this.geometry = new Ft(e?.shape, e?.options), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2070
2086
|
}
|
|
2071
2087
|
static createFromPoints(e, t = {}) {
|
|
2072
|
-
return e && e.length === 0 && (e = void 0), new
|
|
2088
|
+
return e && e.length === 0 && (e = void 0), new Je({
|
|
2073
2089
|
...t,
|
|
2074
2090
|
geometryParameters: {
|
|
2075
2091
|
...t.geometryParameters,
|
|
2076
|
-
shape: new
|
|
2092
|
+
shape: new $e(e?.map((s) => new C(s.x, -s.z)))
|
|
2077
2093
|
}
|
|
2078
2094
|
});
|
|
2079
2095
|
}
|
|
2080
2096
|
}
|
|
2081
|
-
class
|
|
2097
|
+
class Rn extends G {
|
|
2082
2098
|
isPlaneMesh = !0;
|
|
2083
2099
|
type = "PlaneMesh";
|
|
2084
2100
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2085
|
-
super(), this.geometry = new
|
|
2101
|
+
super(), this.geometry = new Gt(
|
|
2086
2102
|
e?.width,
|
|
2087
2103
|
e?.height,
|
|
2088
2104
|
e?.widthSegments,
|
|
2089
2105
|
e?.heightSegments
|
|
2090
|
-
), this.material = new
|
|
2106
|
+
), this.material = new L(t);
|
|
2091
2107
|
}
|
|
2092
2108
|
}
|
|
2093
|
-
class
|
|
2109
|
+
class Ln extends G {
|
|
2094
2110
|
isCircleMesh = !0;
|
|
2095
2111
|
type = "CircleMesh";
|
|
2096
2112
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2097
2113
|
super(
|
|
2098
|
-
new
|
|
2114
|
+
new $t(
|
|
2099
2115
|
e?.radius,
|
|
2100
2116
|
e?.segments,
|
|
2101
2117
|
e?.thetaStart,
|
|
2102
2118
|
e?.thetaLength
|
|
2103
2119
|
),
|
|
2104
|
-
new
|
|
2120
|
+
new L(t)
|
|
2105
2121
|
), this.geometry.rotateX(-Math.PI / 2);
|
|
2106
2122
|
}
|
|
2107
2123
|
}
|
|
2108
2124
|
class F {
|
|
2109
2125
|
static traverseMeshes(e, t) {
|
|
2110
2126
|
e.traverse((s) => {
|
|
2111
|
-
s instanceof
|
|
2127
|
+
s instanceof k && t(s);
|
|
2112
2128
|
});
|
|
2113
2129
|
}
|
|
2114
2130
|
}
|
|
2115
|
-
class
|
|
2131
|
+
class zn {
|
|
2116
2132
|
static flow(e = {}) {
|
|
2117
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new
|
|
2118
|
-
return
|
|
2133
|
+
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, o = H(new M(t)), a = H(new M(s)), c = Te().x.mul(i).sub(oe.mul(n)), l = ae(ge(c).add(1).mul(0.5), r);
|
|
2134
|
+
return ce(o, a, l);
|
|
2119
2135
|
}
|
|
2120
2136
|
static breathe(e = {}) {
|
|
2121
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new
|
|
2122
|
-
return
|
|
2137
|
+
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new M(t)), o = H(new M(s)), a = ge(oe.mul(n)).add(1).mul(0.5), c = ae(a, i);
|
|
2138
|
+
return ce(r, o, c);
|
|
2123
2139
|
}
|
|
2124
2140
|
static fluid(e = {}) {
|
|
2125
2141
|
const {
|
|
@@ -2129,59 +2145,79 @@ class An {
|
|
|
2129
2145
|
scale: i = 1,
|
|
2130
2146
|
intensity: r = 1,
|
|
2131
2147
|
distortion: o = 0.5
|
|
2132
|
-
} = e, a = H(new
|
|
2133
|
-
return
|
|
2148
|
+
} = e, a = H(new M(t)), c = H(new M(s)), l = Te().mul(i), d = oe.mul(n), p = _e(l.add(d), 1, 0), u = l.add(p.mul(o)), m = _e(u, 1, 0).add(1).mul(0.5), w = ae(m, r);
|
|
2149
|
+
return ce(a, c, w);
|
|
2134
2150
|
}
|
|
2135
2151
|
}
|
|
2136
|
-
function
|
|
2152
|
+
function Nn(h) {
|
|
2137
2153
|
}
|
|
2138
|
-
const
|
|
2139
|
-
const h =
|
|
2140
|
-
return
|
|
2141
|
-
})(),
|
|
2142
|
-
const h =
|
|
2143
|
-
return
|
|
2154
|
+
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(), Js = We(() => {
|
|
2155
|
+
const h = O(Y, "uint"), e = O(et, "uint"), t = O(tt, "uint"), s = ze(e), n = Ee.mul(s), i = q(t.greaterThan(0), s, n), r = q(h.greaterThan(0), i, Ee), o = O(pe, "uint"), a = O(nt, "uint"), c = O(it, "float"), l = O(rt, "float"), d = ze(a), p = ge(oe.mul(c)).add(1).mul(0.5), u = ae(p, l), m = ce(r, d, u);
|
|
2156
|
+
return q(o.greaterThan(0), m, r);
|
|
2157
|
+
})(), Zs = We(() => {
|
|
2158
|
+
const h = O(Y, "uint"), e = O(Ze, "float"), t = O(st, "uint"), s = q(t.greaterThan(0), Pe.mul(e), e);
|
|
2159
|
+
return q(h.greaterThan(0), s, Pe);
|
|
2144
2160
|
})();
|
|
2145
|
-
function
|
|
2161
|
+
function X(h) {
|
|
2146
2162
|
return Array.isArray(h.material) ? h.material : [h.material];
|
|
2147
2163
|
}
|
|
2148
|
-
function
|
|
2149
|
-
|
|
2164
|
+
function Re(h) {
|
|
2165
|
+
X(h).forEach((t) => {
|
|
2150
2166
|
if (!t) return;
|
|
2151
|
-
let s =
|
|
2167
|
+
let s = ue.get(t);
|
|
2152
2168
|
s || (s = {
|
|
2153
2169
|
colorNode: t.colorNode,
|
|
2154
2170
|
opacityNode: t.opacityNode,
|
|
2155
2171
|
transparent: t.transparent,
|
|
2156
2172
|
depthWrite: t.depthWrite,
|
|
2157
2173
|
activeMeshes: /* @__PURE__ */ new Set()
|
|
2158
|
-
},
|
|
2174
|
+
}, ue.set(t, s)), s.activeMeshes.add(h), t.transparent = !0, t.colorNode = Js, t.opacityNode = Zs, t.needsUpdate = !0;
|
|
2159
2175
|
});
|
|
2160
2176
|
}
|
|
2161
|
-
function
|
|
2162
|
-
const e = h.userData[
|
|
2177
|
+
function Le(h) {
|
|
2178
|
+
const e = h.userData[Y], t = h.userData[pe];
|
|
2163
2179
|
if (e || t) return;
|
|
2164
|
-
|
|
2180
|
+
X(h).forEach((n) => {
|
|
2165
2181
|
if (!n) return;
|
|
2166
|
-
const i =
|
|
2167
|
-
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,
|
|
2182
|
+
const i = ue.get(n);
|
|
2183
|
+
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)));
|
|
2168
2184
|
});
|
|
2169
2185
|
}
|
|
2170
|
-
|
|
2186
|
+
function en(h, e, t, s) {
|
|
2187
|
+
const n = h, i = n.setSemanticHighlight;
|
|
2188
|
+
if (i)
|
|
2189
|
+
return i.call(h, e, t, s), !0;
|
|
2190
|
+
const r = n.setSemanticColor, o = n.setSemanticOpacity, a = n.getSemanticOpacity, c = n.getSemanticColor, l = n.hasSemanticColor;
|
|
2191
|
+
return !r || !o ? !1 : (h.userData[de] === void 0 && (h.userData[de] = {
|
|
2192
|
+
hasColor: l?.call(h) ?? !1,
|
|
2193
|
+
color: c?.call(h, new M()).getHex() ?? 16777215,
|
|
2194
|
+
opacity: a?.call(h) ?? 1
|
|
2195
|
+
}), r.call(h, e), o.call(h, t), !0);
|
|
2196
|
+
}
|
|
2197
|
+
function tn(h) {
|
|
2198
|
+
const e = h, t = e.clearSemanticHighlight;
|
|
2199
|
+
if (t)
|
|
2200
|
+
return t.call(h), !0;
|
|
2201
|
+
const s = e.resetSemanticColor, n = e.setSemanticColor, i = e.setSemanticOpacity;
|
|
2202
|
+
if (!s || !i) return !1;
|
|
2203
|
+
const r = h.userData[de];
|
|
2204
|
+
return r && (r.hasColor && n ? n.call(h, r.color) : s.call(h), i.call(h, r.opacity), Reflect.deleteProperty(h.userData, de)), !0;
|
|
2205
|
+
}
|
|
2206
|
+
class le {
|
|
2171
2207
|
static highlightColor(e, t = {}) {
|
|
2172
|
-
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o } = t,
|
|
2173
|
-
for (const
|
|
2174
|
-
F.traverseMeshes(
|
|
2175
|
-
|
|
2176
|
-
|
|
2208
|
+
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 M(i).getHex();
|
|
2209
|
+
for (const l of s)
|
|
2210
|
+
en(l, i, n, r) || F.traverseMeshes(l, (d) => {
|
|
2211
|
+
d.userData[Y] = 1, d.userData[Ze] = n, d.userData[et] = c, d.userData[tt] = r ? 1 : 0, d.userData[st] = a ? 1 : 0, Re(d), o !== void 0 && X(d).forEach((u) => {
|
|
2212
|
+
u && (u.depthWrite = o);
|
|
2177
2213
|
});
|
|
2178
2214
|
});
|
|
2179
2215
|
}
|
|
2180
2216
|
static removeHighlightColor(e) {
|
|
2181
2217
|
const t = Array.isArray(e) ? e : [e];
|
|
2182
2218
|
for (const s of t)
|
|
2183
|
-
F.traverseMeshes(s, (n) => {
|
|
2184
|
-
n.userData[
|
|
2219
|
+
tn(s) || F.traverseMeshes(s, (n) => {
|
|
2220
|
+
n.userData[Y] = 0, Le(n);
|
|
2185
2221
|
});
|
|
2186
2222
|
}
|
|
2187
2223
|
static breatheColor(e, t = {}) {
|
|
@@ -2193,17 +2229,17 @@ class ce {
|
|
|
2193
2229
|
},
|
|
2194
2230
|
t
|
|
2195
2231
|
);
|
|
2196
|
-
n.color = new
|
|
2232
|
+
n.color = new M(n.color).getHex();
|
|
2197
2233
|
for (const i of s)
|
|
2198
2234
|
F.traverseMeshes(i, (r) => {
|
|
2199
|
-
r.userData[
|
|
2235
|
+
r.userData[pe] = 1, r.userData[nt] = n.color, r.userData[it] = n.speed, r.userData[rt] = n.intensity, Re(r);
|
|
2200
2236
|
});
|
|
2201
2237
|
}
|
|
2202
2238
|
static removeBreatheColor(e) {
|
|
2203
2239
|
const t = Array.isArray(e) ? e : [e];
|
|
2204
2240
|
for (const s of t)
|
|
2205
2241
|
F.traverseMeshes(s, (n) => {
|
|
2206
|
-
n.userData[
|
|
2242
|
+
n.userData[pe] = 0, Le(n);
|
|
2207
2243
|
});
|
|
2208
2244
|
}
|
|
2209
2245
|
/**
|
|
@@ -2213,7 +2249,7 @@ class ce {
|
|
|
2213
2249
|
const s = Array.isArray(e) ? e : [e];
|
|
2214
2250
|
for (const n of s)
|
|
2215
2251
|
F.traverseMeshes(n, (i) => {
|
|
2216
|
-
|
|
2252
|
+
X(i).forEach((r) => {
|
|
2217
2253
|
if (!r) return;
|
|
2218
2254
|
const o = r;
|
|
2219
2255
|
o.wireframe = t, o.needsUpdate = !0;
|
|
@@ -2224,7 +2260,7 @@ class ce {
|
|
|
2224
2260
|
* Remove wireframe mode.
|
|
2225
2261
|
*/
|
|
2226
2262
|
static removeWireframe(e) {
|
|
2227
|
-
|
|
2263
|
+
le.wireframe(e, !1);
|
|
2228
2264
|
}
|
|
2229
2265
|
/**
|
|
2230
2266
|
* Fade in object(s) from fully transparent to original opacity.
|
|
@@ -2232,7 +2268,7 @@ class ce {
|
|
|
2232
2268
|
*/
|
|
2233
2269
|
static fadeIn(e, t = {}) {
|
|
2234
2270
|
const { duration: s = 500 } = t;
|
|
2235
|
-
return
|
|
2271
|
+
return le._fade(e, 0, 1, s);
|
|
2236
2272
|
}
|
|
2237
2273
|
/**
|
|
2238
2274
|
* Fade out object(s) to fully transparent.
|
|
@@ -2240,13 +2276,13 @@ class ce {
|
|
|
2240
2276
|
*/
|
|
2241
2277
|
static fadeOut(e, t = {}) {
|
|
2242
2278
|
const { duration: s = 500 } = t;
|
|
2243
|
-
return
|
|
2279
|
+
return le._fade(e, 1, 0, s);
|
|
2244
2280
|
}
|
|
2245
2281
|
static _fade(e, t, s, n) {
|
|
2246
2282
|
const i = Array.isArray(e) ? e : [e], r = /* @__PURE__ */ new Map();
|
|
2247
2283
|
for (const o of i)
|
|
2248
2284
|
F.traverseMeshes(o, (a) => {
|
|
2249
|
-
|
|
2285
|
+
X(a).forEach((c) => {
|
|
2250
2286
|
if (!c || r.has(c)) return;
|
|
2251
2287
|
const l = c.opacity, d = c.transparent, p = s >= 1 ? l : s;
|
|
2252
2288
|
r.set(c, {
|
|
@@ -2272,8 +2308,8 @@ class ce {
|
|
|
2272
2308
|
c = requestAnimationFrame(l);
|
|
2273
2309
|
else {
|
|
2274
2310
|
if (s >= 1)
|
|
2275
|
-
for (const { material: m, originalOpacity: w, originalTransparent:
|
|
2276
|
-
m.opacity = w, m.transparent =
|
|
2311
|
+
for (const { material: m, originalOpacity: w, originalTransparent: S } of r.values())
|
|
2312
|
+
m.opacity = w, m.transparent = S, m.needsUpdate = !0;
|
|
2277
2313
|
o();
|
|
2278
2314
|
}
|
|
2279
2315
|
};
|
|
@@ -2281,11 +2317,11 @@ class ce {
|
|
|
2281
2317
|
});
|
|
2282
2318
|
}
|
|
2283
2319
|
}
|
|
2284
|
-
const
|
|
2320
|
+
const ze = (h) => {
|
|
2285
2321
|
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);
|
|
2286
|
-
return
|
|
2322
|
+
return es(e, t, s);
|
|
2287
2323
|
};
|
|
2288
|
-
class
|
|
2324
|
+
class sn extends ws {
|
|
2289
2325
|
viewer;
|
|
2290
2326
|
constructor(e, t) {
|
|
2291
2327
|
super(t), this.viewer = e;
|
|
@@ -2294,7 +2330,7 @@ class Js extends fs {
|
|
|
2294
2330
|
this.update(e) && this.viewer.render();
|
|
2295
2331
|
};
|
|
2296
2332
|
easingByMode(e) {
|
|
2297
|
-
const t =
|
|
2333
|
+
const t = nn[e];
|
|
2298
2334
|
return super.easing(t);
|
|
2299
2335
|
}
|
|
2300
2336
|
start(e, t) {
|
|
@@ -2304,9 +2340,9 @@ class Js extends fs {
|
|
|
2304
2340
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
2305
2341
|
}
|
|
2306
2342
|
}
|
|
2307
|
-
function
|
|
2343
|
+
function Dn(h, e, t, s = {}, n, i) {
|
|
2308
2344
|
return new Promise((r, o) => {
|
|
2309
|
-
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new
|
|
2345
|
+
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new sn(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((m) => {
|
|
2310
2346
|
n?.(m, u);
|
|
2311
2347
|
}).onComplete(() => {
|
|
2312
2348
|
r();
|
|
@@ -2318,7 +2354,7 @@ function Ln(h, e, t, s = {}, n, i) {
|
|
|
2318
2354
|
typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
|
|
2319
2355
|
});
|
|
2320
2356
|
}
|
|
2321
|
-
const
|
|
2357
|
+
const nn = {
|
|
2322
2358
|
"Linear.None": f.Linear.None,
|
|
2323
2359
|
"Quadratic.In": f.Quadratic.In,
|
|
2324
2360
|
"Quadratic.Out": f.Quadratic.Out,
|
|
@@ -2351,7 +2387,7 @@ const Vs = {
|
|
|
2351
2387
|
"Bounce.Out": f.Bounce.Out,
|
|
2352
2388
|
"Bounce.InOut": f.Bounce.InOut
|
|
2353
2389
|
};
|
|
2354
|
-
class
|
|
2390
|
+
class kn {
|
|
2355
2391
|
scene;
|
|
2356
2392
|
planes = /* @__PURE__ */ new Map();
|
|
2357
2393
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -2360,7 +2396,7 @@ class Rn {
|
|
|
2360
2396
|
*/
|
|
2361
2397
|
group;
|
|
2362
2398
|
constructor(e) {
|
|
2363
|
-
this.scene = e, this.group = new
|
|
2399
|
+
this.scene = e, this.group = new Wt(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
|
|
2364
2400
|
}
|
|
2365
2401
|
/**
|
|
2366
2402
|
* Move all current scene children (except the clipping group itself) into the ClippingGroup,
|
|
@@ -2401,7 +2437,7 @@ class Rn {
|
|
|
2401
2437
|
showHelper: i = !1,
|
|
2402
2438
|
helperSize: r = 5,
|
|
2403
2439
|
helperColor: o = 16711680
|
|
2404
|
-
} = t, a = new
|
|
2440
|
+
} = t, a = new Kt(new v(s.x, s.y, s.z), n);
|
|
2405
2441
|
return this.planes.set(e, a), this._syncPlanes(), i && this.showHelper(e, r, o), a;
|
|
2406
2442
|
}
|
|
2407
2443
|
/**
|
|
@@ -2427,7 +2463,7 @@ class Rn {
|
|
|
2427
2463
|
* Add a clipping box from an object's bounding box with optional padding.
|
|
2428
2464
|
*/
|
|
2429
2465
|
addBoxFromObject(e, t, s = 0, n = {}) {
|
|
2430
|
-
const i = new
|
|
2466
|
+
const i = new V().setFromObject(t);
|
|
2431
2467
|
return i.expandByScalar(s), this.addBox(e, i, n);
|
|
2432
2468
|
}
|
|
2433
2469
|
/**
|
|
@@ -2467,7 +2503,7 @@ class Rn {
|
|
|
2467
2503
|
this.hideHelper(e);
|
|
2468
2504
|
const n = this.planes.get(e);
|
|
2469
2505
|
if (!n) return;
|
|
2470
|
-
const i = new
|
|
2506
|
+
const i = new Qt(n, t, new M(s).getHex());
|
|
2471
2507
|
i.name = e, this.helpers.set(e, i), this.scene.add(i);
|
|
2472
2508
|
}
|
|
2473
2509
|
/**
|
|
@@ -2493,7 +2529,7 @@ class Rn {
|
|
|
2493
2529
|
this.detach(), this.removeAll(), this.scene.remove(this.group);
|
|
2494
2530
|
}
|
|
2495
2531
|
}
|
|
2496
|
-
class
|
|
2532
|
+
class jn {
|
|
2497
2533
|
scene;
|
|
2498
2534
|
measurements = /* @__PURE__ */ new Map();
|
|
2499
2535
|
_idCounter = 0;
|
|
@@ -2506,7 +2542,7 @@ class In {
|
|
|
2506
2542
|
measureDistance(e, t, s = {}) {
|
|
2507
2543
|
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 R();
|
|
2508
2544
|
c.name = a;
|
|
2509
|
-
const l = new
|
|
2545
|
+
const l = new Q().setFromPoints([i, r]), d = new ie({ color: n }), p = new re(l, d);
|
|
2510
2546
|
c.add(p), this.scene.add(c);
|
|
2511
2547
|
const u = {
|
|
2512
2548
|
id: a,
|
|
@@ -2527,7 +2563,7 @@ class In {
|
|
|
2527
2563
|
throw new Error("MeasureTool.measureArea requires at least 3 points");
|
|
2528
2564
|
const n = e.map((u) => new v(u.x, u.y, u.z)), i = this._calculatePolygonArea(n), r = `measure_area_${this._idCounter++}`, o = new R();
|
|
2529
2565
|
o.name = r;
|
|
2530
|
-
const a = [...n, n[0]], c = new
|
|
2566
|
+
const a = [...n, n[0]], c = new Q().setFromPoints(a), l = new ie({ color: s }), d = new re(c, l);
|
|
2531
2567
|
o.add(d), this.scene.add(o);
|
|
2532
2568
|
const p = {
|
|
2533
2569
|
id: r,
|
|
@@ -2545,7 +2581,7 @@ class In {
|
|
|
2545
2581
|
measureAngle(e, t, s, n = {}) {
|
|
2546
2582
|
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 R();
|
|
2547
2583
|
m.name = u;
|
|
2548
|
-
const w = new
|
|
2584
|
+
const w = new Q().setFromPoints([r, o, a]), S = new ie({ color: i }), x = new re(w, S);
|
|
2549
2585
|
m.add(x), this.scene.add(m);
|
|
2550
2586
|
const y = {
|
|
2551
2587
|
id: u,
|
|
@@ -2606,7 +2642,7 @@ class In {
|
|
|
2606
2642
|
this.removeAll();
|
|
2607
2643
|
}
|
|
2608
2644
|
}
|
|
2609
|
-
class
|
|
2645
|
+
class Un {
|
|
2610
2646
|
scene;
|
|
2611
2647
|
annotations = /* @__PURE__ */ new Map();
|
|
2612
2648
|
_idCounter = 0;
|
|
@@ -2640,16 +2676,18 @@ class zn {
|
|
|
2640
2676
|
pointer-events: auto;
|
|
2641
2677
|
white-space: nowrap;
|
|
2642
2678
|
`, t.labelStyle)
|
|
2643
|
-
for (const
|
|
2679
|
+
for (const c of Object.keys(t.labelStyle)) {
|
|
2680
|
+
const l = t.labelStyle[c];
|
|
2644
2681
|
l !== void 0 && (i.style[c] = l);
|
|
2682
|
+
}
|
|
2645
2683
|
let r = null;
|
|
2646
2684
|
const o = t.labelOffset || { x: 0, y: 2, z: 0 };
|
|
2647
2685
|
if (t.showLeaderLine !== !1) {
|
|
2648
|
-
const { lineColor: c = 16777215 } = t, l = new
|
|
2686
|
+
const { lineColor: c = 16777215 } = t, l = new Q().setFromPoints([
|
|
2649
2687
|
new v(0, 0, 0),
|
|
2650
2688
|
new v(o.x, o.y, o.z)
|
|
2651
|
-
]), d = new
|
|
2652
|
-
r = new
|
|
2689
|
+
]), d = new ie({ color: c });
|
|
2690
|
+
r = new re(l, d), s.add(r);
|
|
2653
2691
|
}
|
|
2654
2692
|
if (this._createCSSObject) {
|
|
2655
2693
|
const c = this._createCSSObject(i);
|
|
@@ -2757,47 +2795,47 @@ class zn {
|
|
|
2757
2795
|
this.removeAll();
|
|
2758
2796
|
}
|
|
2759
2797
|
}
|
|
2760
|
-
const
|
|
2761
|
-
window.__USPACE__ = { version:
|
|
2798
|
+
const rn = "0.0.28";
|
|
2799
|
+
window.__USPACE__ = { version: rn };
|
|
2762
2800
|
export {
|
|
2763
|
-
|
|
2764
|
-
|
|
2801
|
+
Un as AnnotationManager,
|
|
2802
|
+
Ye as BaseGroup,
|
|
2765
2803
|
G as BaseMesh,
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2804
|
+
Ys as BaseSprite,
|
|
2805
|
+
Gn as CSS2DObject,
|
|
2806
|
+
Wn as CSS3DObject,
|
|
2807
|
+
Kn as CSS3DSprite,
|
|
2808
|
+
As as CSSRenderer,
|
|
2809
|
+
Ms as CameraControls,
|
|
2810
|
+
Ln as CircleMesh,
|
|
2811
|
+
kn as ClippingTool,
|
|
2812
|
+
Je as ExtrudeMesh,
|
|
2813
|
+
vs as InteractionEvent,
|
|
2814
|
+
bs as InteractionManager,
|
|
2815
|
+
Pn as LightManager,
|
|
2816
|
+
le as MaterialEffects,
|
|
2817
|
+
jn as MeasureTool,
|
|
2818
|
+
he as Model,
|
|
2819
|
+
D as ModelLoaderManager,
|
|
2820
|
+
xs as ObjectManager,
|
|
2783
2821
|
F as ObjectUtils,
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2822
|
+
Rn as PlaneMesh,
|
|
2823
|
+
In as Poi,
|
|
2824
|
+
Ss as RenderPipeline,
|
|
2825
|
+
_s as RoomEnvironment,
|
|
2826
|
+
qs as SBMLoader,
|
|
2827
|
+
Rs as SBMXLoader,
|
|
2828
|
+
En as SceneManager,
|
|
2829
|
+
_n as Selection,
|
|
2830
|
+
Ve as ShapeMesh,
|
|
2831
|
+
Vs as SphereMesh,
|
|
2832
|
+
zn as TSLEffects,
|
|
2833
|
+
An as TextureLoaderManager,
|
|
2834
|
+
Bn as Topology,
|
|
2835
|
+
Ie as TubeMesh,
|
|
2836
|
+
sn as Tween,
|
|
2837
|
+
On as Viewer,
|
|
2838
|
+
Nn as reinterpretType,
|
|
2839
|
+
Dn as tweenAnimation,
|
|
2840
|
+
rn as version
|
|
2803
2841
|
};
|