u-space 0.0.23 → 0.0.26
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 +504 -489
- package/dist/plugins/u-manager/index.cjs +56 -56
- package/dist/plugins/u-manager/index.js +9664 -9091
- 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 +2 -0
- package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +21 -4
- package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +31 -0
- package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +18 -7
- package/dist/plugins/u-manager/semantics/objects/SemanticSceneGroup.d.ts +31 -0
- package/dist/plugins/u-manager/semantics/types.d.ts +2 -0
- package/docs/api-plugin-u-manager.md +105 -19
- package/docs/changelog.md +39 -0
- package/docs/examples-guide.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/mcp.md +1 -1
- package/package.json +2 -2
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
|
|
23
|
-
class
|
|
1
|
+
import { Raycaster as Re, Vector2 as M, EventDispatcher as Ie, Box2 as nt, Matrix4 as ze, Vector3 as v, Box3 as X, Scene as Ne, Color as T, AmbientLight as it, DirectionalLight as fe, PointLight as ge, SpotLight as ye, HemisphereLight as we, DirectionalLightHelper as rt, PointLightHelper as ot, SpotLightHelper as at, HemisphereLightHelper as ct, RenderPipeline as ht, PerspectiveCamera as Z, Sphere as je, Spherical as S, Quaternion as lt, Vector4 as dt, MathUtils as pt, PMREMGenerator as ut, OrthographicCamera as ee, TimestampQuery as J, Cache as mt, Timer as ft, WebGPURenderer as gt, PCFShadowMap as yt, AgXToneMapping as wt, Fog as vt, FogExp2 as bt, MeshStandardNodeMaterial as I, Loader as xt, LoaderUtils as L, FileLoader as De, TextureLoader as ke, Group as R, SRGBColorSpace as Ue, RepeatWrapping as ve, BufferGeometry as K, BufferAttribute as be, Mesh as D, FrontSide as Ct, BackSide as Mt, DoubleSide as St, REVISION as xe, CubeTextureLoader as Tt, EquirectangularReflectionMapping as _t, Sprite as Et, AnimationMixer as Pt, LoopRepeat as Ot, LoopOnce as At, SphereGeometry as Bt, TubeGeometry as Lt, LineCurve3 as Rt, CatmullRomCurve3 as It, SpriteNodeMaterial as zt, CanvasTexture as Nt, ShapeGeometry as jt, Shape as He, ExtrudeGeometry as Dt, PlaneGeometry as kt, CircleGeometry as Ut, ClippingGroup as Ht, Plane as Ft, PlaneHelper as Gt, LineBasicMaterial as te, Line as se } from "three/webgpu";
|
|
2
|
+
import { pass as ue, mrt as $t, output as Wt, add as Ce, blendColor as Kt, emissive as Qt, normalView as qt, velocity as Xt, color as H, uv as Me, time as ne, pow as ie, sin as me, mix as re, mx_noise_float as Se, Fn as Fe, userData as B, materialColor as Te, select as oe, materialOpacity as Yt, vec3 as Jt } from "three/tsl";
|
|
3
|
+
import { bloom as Vt } from "three/addons/tsl/display/BloomNode.js";
|
|
4
|
+
import { ssgi as Zt } from "three/addons/tsl/display/SSGINode.js";
|
|
5
|
+
import { traa as es } from "three/addons/tsl/display/TRAANode.js";
|
|
6
|
+
import Ge from "camera-controls";
|
|
7
|
+
import { RoomEnvironment as ts } from "three/addons/environments/RoomEnvironment.js";
|
|
8
|
+
import { ViewHelper as ss } from "three/addons/helpers/ViewHelper.js";
|
|
9
|
+
import { CSS2DRenderer as ns, CSS2DObject as is } from "three/addons/renderers/CSS2DRenderer.js";
|
|
10
|
+
import { CSS2DObject as Dn } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
+
import { CSS3DRenderer as rs, CSS3DSprite as os, CSS3DObject as as } from "three/addons/renderers/CSS3DRenderer.js";
|
|
12
|
+
import { CSS3DObject as Un, CSS3DSprite as Hn } from "three/addons/renderers/CSS3DRenderer.js";
|
|
13
|
+
import { GLTFLoader as $e } from "three/addons/loaders/GLTFLoader.js";
|
|
14
|
+
import { FBXLoader as cs } from "three/addons/loaders/FBXLoader.js";
|
|
15
|
+
import { OBJLoader as hs } from "three/addons/loaders/OBJLoader.js";
|
|
16
|
+
import { STLLoader as ls } from "three/addons/loaders/STLLoader.js";
|
|
17
|
+
import { DRACOLoader as ds } from "three/addons/loaders/DRACOLoader.js";
|
|
18
|
+
import { KTX2Loader as ps } from "three/addons/loaders/KTX2Loader.js";
|
|
19
|
+
import { MeshoptDecoder as _e } from "three/addons/libs/meshopt_decoder.module.js";
|
|
20
|
+
import { HDRLoader as us } from "three/addons/loaders/HDRLoader.js";
|
|
21
|
+
import { clone as ms } from "three/addons/utils/SkeletonUtils.js";
|
|
22
|
+
import { Easing as f, Tween as fs } from "three/addons/libs/tween.module.js";
|
|
23
|
+
class gs {
|
|
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 fs {
|
|
|
48
48
|
return this._propagationStopped;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class ys {
|
|
52
52
|
domElement;
|
|
53
53
|
scene;
|
|
54
54
|
camera;
|
|
55
|
-
raycaster = new
|
|
56
|
-
pointer = new
|
|
55
|
+
raycaster = new Re();
|
|
56
|
+
pointer = new M();
|
|
57
57
|
hoveredObject = null;
|
|
58
58
|
pointerDownTime = 0;
|
|
59
|
-
pointerDownPos = new
|
|
59
|
+
pointerDownPos = new M();
|
|
60
60
|
clickTimer = null;
|
|
61
61
|
longPressThreshold = 500;
|
|
62
62
|
moveThreshold = 0.01;
|
|
@@ -143,7 +143,7 @@ class gs {
|
|
|
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 gs({
|
|
147
147
|
type: e,
|
|
148
148
|
target: t,
|
|
149
149
|
intersect: s,
|
|
@@ -205,7 +205,7 @@ class gs {
|
|
|
205
205
|
this.domElement.removeEventListener("click", this._onClick), this.domElement.removeEventListener("dblclick", this._onDblClick), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this.hoveredObject = null, this._excludeSet.clear();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
class
|
|
208
|
+
class xn extends Ie {
|
|
209
209
|
scene;
|
|
210
210
|
camera;
|
|
211
211
|
domElement;
|
|
@@ -215,8 +215,8 @@ class bn extends Re {
|
|
|
215
215
|
// Box selection state
|
|
216
216
|
_boxSelectionEnabled = !1;
|
|
217
217
|
_isSelecting = !1;
|
|
218
|
-
_startPoint = new
|
|
219
|
-
_endPoint = new
|
|
218
|
+
_startPoint = new M();
|
|
219
|
+
_endPoint = new M();
|
|
220
220
|
_selectionBox = null;
|
|
221
221
|
_deep = !0;
|
|
222
222
|
/**
|
|
@@ -315,33 +315,33 @@ class bn extends Re {
|
|
|
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 M(
|
|
319
319
|
this._startPoint.x / t * 2 - 1,
|
|
320
320
|
-(this._startPoint.y / s) * 2 + 1
|
|
321
|
-
), i = new
|
|
321
|
+
), i = new M(
|
|
322
322
|
this._endPoint.x / t * 2 - 1,
|
|
323
323
|
-(this._endPoint.y / s) * 2 + 1
|
|
324
|
-
), r = new
|
|
325
|
-
new
|
|
326
|
-
new
|
|
327
|
-
),
|
|
324
|
+
), r = new nt(
|
|
325
|
+
new M(Math.min(n.x, i.x), Math.min(n.y, i.y)),
|
|
326
|
+
new M(Math.max(n.x, i.x), Math.max(n.y, i.y))
|
|
327
|
+
), o = this.targetObjects || this.scene.children, a = [], c = new ze();
|
|
328
328
|
c.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
329
329
|
const l = (d) => {
|
|
330
330
|
if (!d.visible) return;
|
|
331
|
-
const p = new
|
|
332
|
-
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new
|
|
331
|
+
const p = new v();
|
|
332
|
+
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new M(p.x, p.y)) && a.push(d), this._deep)
|
|
333
333
|
for (const u of d.children)
|
|
334
334
|
l(u);
|
|
335
335
|
};
|
|
336
|
-
for (const d of
|
|
336
|
+
for (const d of o)
|
|
337
337
|
l(d);
|
|
338
|
-
return
|
|
338
|
+
return a;
|
|
339
339
|
}
|
|
340
340
|
dispose() {
|
|
341
341
|
this.disableBoxSelection(), this._selected.clear();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
class
|
|
344
|
+
class ws {
|
|
345
345
|
idMap = /* @__PURE__ */ new Map();
|
|
346
346
|
nameMap = /* @__PURE__ */ new Map();
|
|
347
347
|
typeMap = /* @__PURE__ */ new Map();
|
|
@@ -475,15 +475,15 @@ class ys {
|
|
|
475
475
|
const i = n.material;
|
|
476
476
|
if (!i) return;
|
|
477
477
|
const r = Array.isArray(i) ? i : [i];
|
|
478
|
-
for (const
|
|
479
|
-
|
|
478
|
+
for (const o of r)
|
|
479
|
+
o.transparent = t < 1, o.opacity = t, o.needsUpdate = !0;
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
/**
|
|
483
483
|
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
484
484
|
*/
|
|
485
485
|
getBoundingBox(e) {
|
|
486
|
-
const t = new
|
|
486
|
+
const t = new X();
|
|
487
487
|
if (e) {
|
|
488
488
|
const s = this.idMap.get(e);
|
|
489
489
|
s && t.setFromObject(s);
|
|
@@ -518,7 +518,7 @@ class ys {
|
|
|
518
518
|
e.visible = !0;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
class
|
|
521
|
+
class Cn {
|
|
522
522
|
scenes = /* @__PURE__ */ new Map();
|
|
523
523
|
_activeSceneKey = null;
|
|
524
524
|
/**
|
|
@@ -531,8 +531,8 @@ class xn {
|
|
|
531
531
|
* Create and register a new scene.
|
|
532
532
|
*/
|
|
533
533
|
create(e, t = {}) {
|
|
534
|
-
const s = new
|
|
535
|
-
return t.background !== void 0 && (s.background = new
|
|
534
|
+
const s = new Ne();
|
|
535
|
+
return t.background !== void 0 && (s.background = new T(t.background)), this.scenes.set(e, s), s;
|
|
536
536
|
}
|
|
537
537
|
/**
|
|
538
538
|
* Get a scene by key.
|
|
@@ -571,7 +571,7 @@ class xn {
|
|
|
571
571
|
const t = this.scenes.get(e);
|
|
572
572
|
if (!t) return null;
|
|
573
573
|
let s = null;
|
|
574
|
-
return t.background instanceof
|
|
574
|
+
return t.background instanceof T && (s = `#${t.background.getHexString()}`), {
|
|
575
575
|
name: t.name || e,
|
|
576
576
|
background: s,
|
|
577
577
|
environmentRotation: {
|
|
@@ -592,7 +592,7 @@ class xn {
|
|
|
592
592
|
return this.scenes.size;
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
class
|
|
595
|
+
class Mn {
|
|
596
596
|
scene;
|
|
597
597
|
lights = /* @__PURE__ */ new Map();
|
|
598
598
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -600,16 +600,16 @@ class Cn {
|
|
|
600
600
|
this.scene = e;
|
|
601
601
|
}
|
|
602
602
|
addAmbient(e, t = {}) {
|
|
603
|
-
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new
|
|
603
|
+
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new it(s, n);
|
|
604
604
|
return i.name = e, this._register(e, i), i;
|
|
605
605
|
}
|
|
606
606
|
addDirectional(e, t = {}) {
|
|
607
|
-
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize:
|
|
608
|
-
return
|
|
607
|
+
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: r = !1, shadowMapSize: o = 1024 } = t, a = new fe(s, n);
|
|
608
|
+
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
609
|
}
|
|
610
610
|
addPoint(e, t = {}) {
|
|
611
|
-
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position:
|
|
612
|
-
return c.position.set(
|
|
611
|
+
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: r = 2, position: o = { x: 0, y: 5, z: 0 }, castShadow: a = !1 } = t, c = new ge(s, n, i, r);
|
|
612
|
+
return c.position.set(o.x, o.y, o.z), c.castShadow = a, c.name = e, this._register(e, c), c;
|
|
613
613
|
}
|
|
614
614
|
addSpot(e, t = {}) {
|
|
615
615
|
const {
|
|
@@ -617,16 +617,16 @@ class Cn {
|
|
|
617
617
|
intensity: n = 1,
|
|
618
618
|
distance: i = 0,
|
|
619
619
|
angle: r = Math.PI / 6,
|
|
620
|
-
penumbra:
|
|
621
|
-
decay:
|
|
620
|
+
penumbra: o = 0.1,
|
|
621
|
+
decay: a = 2,
|
|
622
622
|
position: c = { x: 0, y: 10, z: 0 },
|
|
623
623
|
target: l,
|
|
624
624
|
castShadow: d = !1
|
|
625
|
-
} = t, p = new
|
|
625
|
+
} = t, p = new ye(s, n, i, r, o, a);
|
|
626
626
|
return p.position.set(c.x, c.y, c.z), l && p.target.position.set(l.x, l.y, l.z), p.castShadow = d, p.name = e, this._register(e, p), p;
|
|
627
627
|
}
|
|
628
628
|
addHemisphere(e, t = {}) {
|
|
629
|
-
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new
|
|
629
|
+
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new we(s, n, i);
|
|
630
630
|
return r.name = e, this._register(e, r), r;
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
@@ -677,7 +677,7 @@ class Cn {
|
|
|
677
677
|
const t = this.lights.get(e);
|
|
678
678
|
if (!t) return;
|
|
679
679
|
let s = null;
|
|
680
|
-
t instanceof
|
|
680
|
+
t instanceof fe ? s = new rt(t, 1) : t instanceof ge ? s = new ot(t, 0.5) : t instanceof ye ? s = new at(t) : t instanceof we && (s = new ct(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Hide (remove) the helper for a light.
|
|
@@ -708,7 +708,7 @@ class Cn {
|
|
|
708
708
|
this.removeAll(), this.hideAllHelpers();
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
class
|
|
711
|
+
class vs extends ht {
|
|
712
712
|
scene;
|
|
713
713
|
camera;
|
|
714
714
|
scenePass;
|
|
@@ -718,8 +718,8 @@ class ws extends ct {
|
|
|
718
718
|
#s = !1;
|
|
719
719
|
#r = { strength: 1, radius: 0, threshold: 0 };
|
|
720
720
|
#n = null;
|
|
721
|
-
#
|
|
722
|
-
#
|
|
721
|
+
#o = !1;
|
|
722
|
+
#a = {
|
|
723
723
|
sliceCount: 1,
|
|
724
724
|
stepCount: 12,
|
|
725
725
|
aoIntensity: 1,
|
|
@@ -737,7 +737,7 @@ class ws extends ct {
|
|
|
737
737
|
#f = !0;
|
|
738
738
|
constructor(...e) {
|
|
739
739
|
const [t, s, n] = e;
|
|
740
|
-
super(t), this.scene = s, this.camera = n, this.scenePass =
|
|
740
|
+
super(t), this.scene = s, this.camera = n, this.scenePass = ue(s, n), this.needsUpdateOutputNode = !0, this.#t = /* @__PURE__ */ new Set(), this.#e = [], this.#d = /* @__PURE__ */ new Set(), this.#c = /* @__PURE__ */ new Map(), this.#g();
|
|
741
741
|
}
|
|
742
742
|
/** @deprecated Use `scenePass` instead */
|
|
743
743
|
get currentOutputNode() {
|
|
@@ -785,13 +785,13 @@ class ws extends ct {
|
|
|
785
785
|
Object.assign(this.#r, e), this.#s && (this.needsUpdateOutputNode = !0);
|
|
786
786
|
}
|
|
787
787
|
enableSSGI(e) {
|
|
788
|
-
e && Object.assign(this.#
|
|
788
|
+
e && Object.assign(this.#a, e), this.#o = !0, this.#i();
|
|
789
789
|
}
|
|
790
790
|
disableSSGI() {
|
|
791
|
-
this.#
|
|
791
|
+
this.#o = !1, this.#p = null, this.#i();
|
|
792
792
|
}
|
|
793
793
|
updateSSGI(e) {
|
|
794
|
-
if (Object.assign(this.#
|
|
794
|
+
if (Object.assign(this.#a, e), this.#p) {
|
|
795
795
|
const t = this.#p;
|
|
796
796
|
e.sliceCount !== void 0 && (t.sliceCount.value = e.sliceCount), e.stepCount !== void 0 && (t.stepCount.value = e.stepCount), e.aoIntensity !== void 0 && (t.aoIntensity.value = e.aoIntensity), e.giIntensity !== void 0 && (t.giIntensity.value = e.giIntensity), e.radius !== void 0 && (t.radius.value = e.radius), e.thickness !== void 0 && (t.thickness.value = e.thickness);
|
|
797
797
|
}
|
|
@@ -804,14 +804,14 @@ class ws extends ct {
|
|
|
804
804
|
}
|
|
805
805
|
#i() {
|
|
806
806
|
const e = this.scenePass;
|
|
807
|
-
this.scenePass =
|
|
807
|
+
this.scenePass = ue(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
808
808
|
}
|
|
809
809
|
#g() {
|
|
810
|
-
if (this.#s || this.#
|
|
811
|
-
const t = { output:
|
|
810
|
+
if (this.#s || this.#o || this.#h || this.#c.size > 0) {
|
|
811
|
+
const t = { output: Wt };
|
|
812
812
|
this.#c.forEach((s, n) => {
|
|
813
813
|
n !== "output" && (t[n] = s);
|
|
814
|
-
}), this.#s && (t.emissive =
|
|
814
|
+
}), this.#s && (t.emissive = Qt), this.#o && (t.normal = qt), this.#h && (t.velocity = Xt), this.scenePass.setMRT($t(t));
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
#y() {
|
|
@@ -821,21 +821,21 @@ class ws extends ct {
|
|
|
821
821
|
}
|
|
822
822
|
#w() {
|
|
823
823
|
let e = this.scenePass.getTextureNode();
|
|
824
|
-
if (this.#
|
|
825
|
-
if (!(this.camera instanceof
|
|
824
|
+
if (this.#o)
|
|
825
|
+
if (!(this.camera instanceof Z))
|
|
826
826
|
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
827
827
|
else {
|
|
828
|
-
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i =
|
|
829
|
-
i.sliceCount.value = this.#
|
|
828
|
+
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = Zt(t, s, n, this.camera);
|
|
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 = Ce(e, i), this.#e.push(i);
|
|
830
830
|
}
|
|
831
831
|
if (this.#s) {
|
|
832
832
|
const t = this.scenePass.getTextureNode("emissive");
|
|
833
|
-
this.#n =
|
|
833
|
+
this.#n = Vt(
|
|
834
834
|
t,
|
|
835
835
|
this.#r.strength,
|
|
836
836
|
this.#r.radius,
|
|
837
837
|
this.#r.threshold
|
|
838
|
-
), e =
|
|
838
|
+
), e = Ce(e, this.#n), this.#e.push(this.#n);
|
|
839
839
|
}
|
|
840
840
|
return e;
|
|
841
841
|
}
|
|
@@ -846,15 +846,15 @@ class ws extends ct {
|
|
|
846
846
|
this.#y();
|
|
847
847
|
let e, t = !1, s = !1;
|
|
848
848
|
const n = this.#u !== null;
|
|
849
|
-
if (n ? e = this.#u(this.scenePass) : this.#s || this.#
|
|
849
|
+
if (n ? e = this.#u(this.scenePass) : this.#s || this.#o ? e = this.#w() : e = this.#d.size > 0 ? this.scenePass.getTextureNode() : this.scenePass, n || this.#d.forEach((i) => {
|
|
850
850
|
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
851
851
|
}), this.#v(s), this.#h && !t) {
|
|
852
852
|
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
853
|
-
this.#l =
|
|
853
|
+
this.#l = es(e, i, r, this.camera), this.#e.push(this.#l), e = this.#l;
|
|
854
854
|
} else
|
|
855
855
|
this.#l = null;
|
|
856
856
|
this.#t.size > 0 && this.#t.forEach((i) => {
|
|
857
|
-
const r =
|
|
857
|
+
const r = Kt(e, i);
|
|
858
858
|
this.#e.push(r), e = r;
|
|
859
859
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
860
860
|
}
|
|
@@ -865,19 +865,19 @@ class ws extends ct {
|
|
|
865
865
|
this.#y(), this.scenePass.dispose(), super.dispose();
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
const
|
|
869
|
-
Vector2:
|
|
870
|
-
Vector3:
|
|
871
|
-
Vector4:
|
|
872
|
-
Quaternion:
|
|
873
|
-
Matrix4:
|
|
868
|
+
const bs = {
|
|
869
|
+
Vector2: M,
|
|
870
|
+
Vector3: v,
|
|
871
|
+
Vector4: dt,
|
|
872
|
+
Quaternion: lt,
|
|
873
|
+
Matrix4: ze,
|
|
874
874
|
Spherical: S,
|
|
875
|
-
Box3:
|
|
876
|
-
Sphere:
|
|
877
|
-
Raycaster:
|
|
875
|
+
Box3: X,
|
|
876
|
+
Sphere: je,
|
|
877
|
+
Raycaster: Re
|
|
878
878
|
};
|
|
879
|
-
|
|
880
|
-
class
|
|
879
|
+
Ge.install({ THREE: bs });
|
|
880
|
+
class xs extends Ge {
|
|
881
881
|
constructor(...e) {
|
|
882
882
|
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
883
883
|
}
|
|
@@ -885,16 +885,16 @@ class bs extends Fe {
|
|
|
885
885
|
* Set absolute angle for azimuth to avoid spinning
|
|
886
886
|
*/
|
|
887
887
|
absoluteRotations() {
|
|
888
|
-
this.azimuthAngle =
|
|
888
|
+
this.azimuthAngle = Cs(this.azimuthAngle, 0);
|
|
889
889
|
}
|
|
890
890
|
async flyToBox(e, t = {}) {
|
|
891
891
|
if (e.isEmpty())
|
|
892
892
|
return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
|
|
893
893
|
this.absoluteRotations();
|
|
894
|
-
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t,
|
|
894
|
+
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, o = [];
|
|
895
895
|
if (s !== "current") {
|
|
896
|
-
const
|
|
897
|
-
|
|
896
|
+
const a = Ee[s.toUpperCase()] ?? Ee.FRONTTOP, c = a.theta, l = a.phi;
|
|
897
|
+
o.push(
|
|
898
898
|
this.fitToBox(e, n, {
|
|
899
899
|
paddingLeft: i,
|
|
900
900
|
paddingRight: i,
|
|
@@ -902,15 +902,15 @@ class bs extends Fe {
|
|
|
902
902
|
paddingBottom: i,
|
|
903
903
|
cover: r
|
|
904
904
|
})
|
|
905
|
-
),
|
|
905
|
+
), o.push(this.rotateTo(c, l, n));
|
|
906
906
|
} else {
|
|
907
|
-
const
|
|
908
|
-
e.getBoundingSphere(
|
|
907
|
+
const a = new je();
|
|
908
|
+
e.getBoundingSphere(a), a.radius += i, o.push(this.fitToSphere(a, n));
|
|
909
909
|
}
|
|
910
|
-
return await Promise.all(
|
|
910
|
+
return await Promise.all(o), !0;
|
|
911
911
|
}
|
|
912
912
|
async flyToObject(e, t = {}) {
|
|
913
|
-
const s = new
|
|
913
|
+
const s = new X().setFromObject(e);
|
|
914
914
|
return this.flyToBox(s, t);
|
|
915
915
|
}
|
|
916
916
|
/**
|
|
@@ -924,7 +924,7 @@ class bs extends Fe {
|
|
|
924
924
|
* Get the current camera viewpoint data (position, target, zoom).
|
|
925
925
|
*/
|
|
926
926
|
getCameraViewpoint() {
|
|
927
|
-
const e = new
|
|
927
|
+
const e = new v(), t = new v();
|
|
928
928
|
return this.getPosition(e), this.getTarget(t), {
|
|
929
929
|
position: { x: e.x, y: e.y, z: e.z },
|
|
930
930
|
target: { x: t.x, y: t.y, z: t.z },
|
|
@@ -948,7 +948,7 @@ class bs extends Fe {
|
|
|
948
948
|
*/
|
|
949
949
|
async setViewMode(e, t = !0) {
|
|
950
950
|
if (e === "2d") {
|
|
951
|
-
const s = new
|
|
951
|
+
const s = new v();
|
|
952
952
|
this.getTarget(s), await this.rotateTo(0, 0, t), this.minPolarAngle = 0, this.maxPolarAngle = 0;
|
|
953
953
|
} else
|
|
954
954
|
this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, await this.rotateTo(0, Math.PI / 4, t);
|
|
@@ -961,7 +961,7 @@ class bs extends Fe {
|
|
|
961
961
|
]);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
const
|
|
964
|
+
const Ee = {
|
|
965
965
|
LEFT: new S(0, Math.PI / 2, -Math.PI / 2),
|
|
966
966
|
RIGHT: new S(0, Math.PI / 2, Math.PI / 2),
|
|
967
967
|
FRONT: new S(0, Math.PI / 2, 0),
|
|
@@ -977,17 +977,17 @@ const _e = {
|
|
|
977
977
|
LEFTBACKTOP: new S(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
978
978
|
RIGHTBACKTOP: new S(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
979
979
|
};
|
|
980
|
-
function
|
|
980
|
+
function Cs(h, e) {
|
|
981
981
|
const t = h - e;
|
|
982
|
-
return
|
|
982
|
+
return pt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
983
983
|
}
|
|
984
|
-
class
|
|
985
|
-
environment = new
|
|
984
|
+
class Ms {
|
|
985
|
+
environment = new ts();
|
|
986
986
|
renderer;
|
|
987
987
|
pmremGenerator;
|
|
988
988
|
envMap = null;
|
|
989
989
|
constructor(e) {
|
|
990
|
-
this.renderer = e, this.pmremGenerator = new
|
|
990
|
+
this.renderer = e, this.pmremGenerator = new ut(e);
|
|
991
991
|
}
|
|
992
992
|
update() {
|
|
993
993
|
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
@@ -996,20 +996,20 @@ class Cs {
|
|
|
996
996
|
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
const
|
|
1000
|
-
class Ss extends
|
|
999
|
+
const V = 128;
|
|
1000
|
+
class Ss extends ss {
|
|
1001
1001
|
viewer;
|
|
1002
1002
|
overlayPass;
|
|
1003
1003
|
constructor(e) {
|
|
1004
1004
|
super(e.camera, e.el), this.viewer = e;
|
|
1005
|
-
const t = new
|
|
1006
|
-
t.position.set(0, 0, 2), this.overlayPass =
|
|
1005
|
+
const t = new ee(-2, 2, 2, -2, 0, 4);
|
|
1006
|
+
t.position.set(0, 0, 2), this.overlayPass = ue(this, t), this.setLabels("x", "y", "z");
|
|
1007
1007
|
}
|
|
1008
1008
|
_update = () => {
|
|
1009
1009
|
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
1010
1010
|
const e = this.location;
|
|
1011
1011
|
let t, s;
|
|
1012
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth -
|
|
1012
|
+
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - V - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - V - e.bottom, this.overlayPass.setViewport(t, s, V, V);
|
|
1013
1013
|
};
|
|
1014
1014
|
enable() {
|
|
1015
1015
|
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
@@ -1018,8 +1018,8 @@ class Ss extends ts {
|
|
|
1018
1018
|
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
|
-
const
|
|
1022
|
-
class
|
|
1021
|
+
const We = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Ts = We + "z-index:0;", _s = We + "z-index:1;";
|
|
1022
|
+
class Es {
|
|
1023
1023
|
el;
|
|
1024
1024
|
css2dRenderer = null;
|
|
1025
1025
|
css3dRenderer = null;
|
|
@@ -1027,18 +1027,18 @@ class _s {
|
|
|
1027
1027
|
this.el = e, getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
1028
1028
|
}
|
|
1029
1029
|
initCSS2DRenderer() {
|
|
1030
|
-
const e = new
|
|
1031
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1030
|
+
const e = new ns();
|
|
1031
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = _s, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
|
|
1032
1032
|
}
|
|
1033
1033
|
initCSS3DRenderer() {
|
|
1034
|
-
const e = new
|
|
1035
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText =
|
|
1034
|
+
const e = new rs();
|
|
1035
|
+
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ts, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
|
|
1036
1036
|
}
|
|
1037
1037
|
createCSS2DObject(e) {
|
|
1038
|
-
return this.css2dRenderer || this.initCSS2DRenderer(), new
|
|
1038
|
+
return this.css2dRenderer || this.initCSS2DRenderer(), new is(e);
|
|
1039
1039
|
}
|
|
1040
1040
|
createCSS25DObject(e) {
|
|
1041
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new
|
|
1041
|
+
return this.css3dRenderer || this.initCSS3DRenderer(), new os(e);
|
|
1042
1042
|
}
|
|
1043
1043
|
createCSS3DObject(e) {
|
|
1044
1044
|
return this.css3dRenderer || this.initCSS3DRenderer(), new as(e);
|
|
@@ -1053,8 +1053,8 @@ class _s {
|
|
|
1053
1053
|
this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
|
-
const
|
|
1057
|
-
class
|
|
1056
|
+
const Ps = "timestamp-query";
|
|
1057
|
+
class Os {
|
|
1058
1058
|
el;
|
|
1059
1059
|
renderer;
|
|
1060
1060
|
container;
|
|
@@ -1070,9 +1070,9 @@ class Ps {
|
|
|
1070
1070
|
this.el = e, this.renderer = t;
|
|
1071
1071
|
const s = document.createElement("div");
|
|
1072
1072
|
s.style.position = "absolute", s.style.left = "12px", s.style.bottom = "12px", s.style.fontSize = "12px", s.style.color = "#fff", s.style.pointerEvents = "none", this.container = s;
|
|
1073
|
-
function n(r,
|
|
1074
|
-
const
|
|
1075
|
-
return
|
|
1073
|
+
function n(r, o = !0) {
|
|
1074
|
+
const a = document.createElement("span");
|
|
1075
|
+
return o && (a.style.marginLeft = "6px"), a.innerText = r, a;
|
|
1076
1076
|
}
|
|
1077
1077
|
function i() {
|
|
1078
1078
|
return document.createElement("br");
|
|
@@ -1086,16 +1086,16 @@ class Ps {
|
|
|
1086
1086
|
this.timestampText.innerText = "0";
|
|
1087
1087
|
return;
|
|
1088
1088
|
}
|
|
1089
|
-
this.#n(
|
|
1089
|
+
this.#n(J.RENDER).then((t) => {
|
|
1090
1090
|
this._enabled && (this.timestampText.innerText = t?.toFixed(2) ?? "0");
|
|
1091
|
-
}), this.#n(
|
|
1091
|
+
}), this.#n(J.COMPUTE);
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
enable() {
|
|
1095
1095
|
this._enabled = !0, this.#r(!0), this.el.appendChild(this.container);
|
|
1096
1096
|
}
|
|
1097
1097
|
disable() {
|
|
1098
|
-
this._enabled = !1, this.#r(!1), this.#
|
|
1098
|
+
this._enabled = !1, this.#r(!1), this.#o(), this.container.remove();
|
|
1099
1099
|
}
|
|
1100
1100
|
dispose() {
|
|
1101
1101
|
this.disable();
|
|
@@ -1105,7 +1105,7 @@ class Ps {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
#s() {
|
|
1107
1107
|
try {
|
|
1108
|
-
return this.renderer.hasFeature(
|
|
1108
|
+
return this.renderer.hasFeature(Ps);
|
|
1109
1109
|
} catch {
|
|
1110
1110
|
return !0;
|
|
1111
1111
|
}
|
|
@@ -1123,12 +1123,12 @@ class Ps {
|
|
|
1123
1123
|
return t?.resolveQueriesAsync ? Promise.resolve(t.resolveQueriesAsync()).catch(() => {
|
|
1124
1124
|
}) : Promise.resolve(void 0);
|
|
1125
1125
|
}
|
|
1126
|
-
#
|
|
1127
|
-
this.#n(
|
|
1126
|
+
#o() {
|
|
1127
|
+
this.#n(J.RENDER), this.#n(J.COMPUTE);
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
|
-
|
|
1131
|
-
class Sn extends
|
|
1130
|
+
mt.enabled = !0;
|
|
1131
|
+
class Sn extends Ie {
|
|
1132
1132
|
el;
|
|
1133
1133
|
renderer;
|
|
1134
1134
|
scene;
|
|
@@ -1145,11 +1145,11 @@ class Sn extends Re {
|
|
|
1145
1145
|
frameCount = 1;
|
|
1146
1146
|
frameloop = "demand";
|
|
1147
1147
|
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
|
|
1148
|
+
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Os(this.el, this.renderer), this.controls = new xs(this.camera, this.renderer.domElement), this.renderPipeline = new vs(this.renderer, this.scene, this.camera), this.timer = new ft(), this.roomEnvironment = new Ms(this.renderer), this.interactionManager = new ys(this.renderer.domElement, this.scene, this.camera), this.objectManager = new ws(), this.viewerHelper = new Ss(this), this.cssRenderer = new Es(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1149
1149
|
}
|
|
1150
1150
|
onWindowResize = () => {
|
|
1151
1151
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
1152
|
-
this.camera instanceof
|
|
1152
|
+
this.camera instanceof Z ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof ee && (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
1153
|
};
|
|
1154
1154
|
async init() {
|
|
1155
1155
|
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
@@ -1158,7 +1158,7 @@ class Sn extends Re {
|
|
|
1158
1158
|
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
1159
1159
|
}
|
|
1160
1160
|
setCameraByType(e) {
|
|
1161
|
-
e === "perspective" && !(this.camera instanceof
|
|
1161
|
+
e === "perspective" && !(this.camera instanceof Z) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof ee) && this.setCamera(this.createOrthographicCamera());
|
|
1162
1162
|
}
|
|
1163
1163
|
render(e = 1) {
|
|
1164
1164
|
return this.frameCount += e, new Promise((t) => {
|
|
@@ -1176,25 +1176,25 @@ class Sn extends Re {
|
|
|
1176
1176
|
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
1177
|
};
|
|
1178
1178
|
_initRenderer(e) {
|
|
1179
|
-
const t = new
|
|
1179
|
+
const t = new gt({
|
|
1180
1180
|
logarithmicDepthBuffer: !0,
|
|
1181
1181
|
antialias: !1,
|
|
1182
1182
|
depth: !1,
|
|
1183
1183
|
trackTimestamp: !1,
|
|
1184
1184
|
...e
|
|
1185
1185
|
});
|
|
1186
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type =
|
|
1186
|
+
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = yt, t.toneMapping = wt, 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
1187
|
}
|
|
1188
1188
|
createScene() {
|
|
1189
|
-
const e = new
|
|
1190
|
-
return e.background = new
|
|
1189
|
+
const e = new Ne();
|
|
1190
|
+
return e.background = new T(0), e;
|
|
1191
1191
|
}
|
|
1192
1192
|
createPerspectiveCamera() {
|
|
1193
|
-
const e = new
|
|
1193
|
+
const e = new Z(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
1194
1194
|
return e.position.setScalar(5), e;
|
|
1195
1195
|
}
|
|
1196
1196
|
createOrthographicCamera() {
|
|
1197
|
-
const e = new
|
|
1197
|
+
const e = new ee(
|
|
1198
1198
|
-this.el.clientWidth / 2,
|
|
1199
1199
|
this.el.clientWidth / 2,
|
|
1200
1200
|
this.el.clientHeight / 2,
|
|
@@ -1216,14 +1216,14 @@ class Sn extends Re {
|
|
|
1216
1216
|
async screenshot(e = {}) {
|
|
1217
1217
|
const { type: t = "image/png", quality: s = 1 } = e, n = this.el.clientWidth, i = this.el.clientHeight, r = e.width && e.height;
|
|
1218
1218
|
r && this.renderer.setSize(e.width, e.height), await this.render();
|
|
1219
|
-
const
|
|
1220
|
-
return r && (this.renderer.setSize(n, i), this.onWindowResize()),
|
|
1219
|
+
const o = this.renderer.domElement.toDataURL(t, s);
|
|
1220
|
+
return r && (this.renderer.setSize(n, i), this.onWindowResize()), o;
|
|
1221
1221
|
}
|
|
1222
1222
|
/**
|
|
1223
1223
|
* Set the scene background color, texture, or null.
|
|
1224
1224
|
*/
|
|
1225
1225
|
setBackground(e) {
|
|
1226
|
-
e === null ? this.scene.background = null : e instanceof
|
|
1226
|
+
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();
|
|
1227
1227
|
}
|
|
1228
1228
|
/**
|
|
1229
1229
|
* Set the scene environment map for reflections / IBL.
|
|
@@ -1248,14 +1248,14 @@ class Sn extends Re {
|
|
|
1248
1248
|
*/
|
|
1249
1249
|
enableFog(e = {}) {
|
|
1250
1250
|
const { color: t = 13421772, near: s = 10, far: n = 100 } = e;
|
|
1251
|
-
this.scene.fog = new
|
|
1251
|
+
this.scene.fog = new vt(t, s, n), this.render();
|
|
1252
1252
|
}
|
|
1253
1253
|
/**
|
|
1254
1254
|
* Enable exponential fog.
|
|
1255
1255
|
*/
|
|
1256
1256
|
enableFogExp2(e = {}) {
|
|
1257
1257
|
const { color: t = 13421772, density: s = 0.01 } = e;
|
|
1258
|
-
this.scene.fog = new
|
|
1258
|
+
this.scene.fog = new bt(t, s), this.render();
|
|
1259
1259
|
}
|
|
1260
1260
|
/**
|
|
1261
1261
|
* Disable fog.
|
|
@@ -1267,22 +1267,22 @@ class Sn extends Re {
|
|
|
1267
1267
|
this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.cssRenderer.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
-
class
|
|
1270
|
+
class As extends $e {
|
|
1271
1271
|
constructor(e) {
|
|
1272
1272
|
super(e);
|
|
1273
1273
|
}
|
|
1274
1274
|
parse(e, t, s, n) {
|
|
1275
|
-
if (
|
|
1276
|
-
const r =
|
|
1275
|
+
if (Bs(e.slice(0, 8)) === "SBMG----") {
|
|
1276
|
+
const r = Ls(e.slice(8));
|
|
1277
1277
|
return super.parse(r, t, s, n);
|
|
1278
1278
|
} else
|
|
1279
1279
|
return super.parse(e, t, s, n);
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function Bs(h) {
|
|
1283
1283
|
return new TextDecoder().decode(new Uint8Array(h));
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function Ls(h) {
|
|
1286
1286
|
const e = new DataView(h);
|
|
1287
1287
|
for (let t = 0; t < e.byteLength; t++) {
|
|
1288
1288
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
@@ -1290,72 +1290,72 @@ function Bs(h) {
|
|
|
1290
1290
|
}
|
|
1291
1291
|
return e.buffer;
|
|
1292
1292
|
}
|
|
1293
|
-
const
|
|
1294
|
-
function
|
|
1295
|
-
let e =
|
|
1293
|
+
const Rs = 8, Is = 130, Pe = 66, zs = "SBK-----", Ns = "SBM-----", Ke = new TextDecoder(), js = new TextEncoder();
|
|
1294
|
+
function Ds(h) {
|
|
1295
|
+
let e = Rs;
|
|
1296
1296
|
const t = new Uint8Array(h, 0, e);
|
|
1297
|
-
if (
|
|
1297
|
+
if (Ke.decode(t) !== zs)
|
|
1298
1298
|
return h;
|
|
1299
|
-
e +=
|
|
1299
|
+
e += Is;
|
|
1300
1300
|
const n = new Uint8Array(h, 0, e);
|
|
1301
1301
|
if (n[40] === 1) {
|
|
1302
|
-
const r =
|
|
1303
|
-
let l =
|
|
1304
|
-
const d = e +
|
|
1305
|
-
for (let
|
|
1306
|
-
u[
|
|
1307
|
-
const
|
|
1308
|
-
return
|
|
1302
|
+
const r = js.encode(Ns), o = new Uint8Array([n[41]]), a = ks(n), c = Us(a);
|
|
1303
|
+
let l = Pe % c.length;
|
|
1304
|
+
const d = e + Pe, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
|
|
1305
|
+
for (let w = 0; w < p.length; w++)
|
|
1306
|
+
u[w] = p[w] ^ c[l], l = (l + 1) % c.length;
|
|
1307
|
+
const m = new Uint8Array(r.length + o.length + u.length);
|
|
1308
|
+
return m.set(r), m.set(o, r.length), m.set(u, r.length + o.length), m.buffer;
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function ks(h) {
|
|
1312
1312
|
const e = new Uint8Array(128);
|
|
1313
1313
|
return e.set(h.slice(42, 74), 0), e.set(h.slice(74, 138), 32), e.set(h.slice(8, 40), 96), e;
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function Us(h) {
|
|
1316
1316
|
const e = new Uint8Array(64);
|
|
1317
1317
|
return e.set(h.slice(0, 8), 0), e.set(h.slice(24, 32), 8), e.set(h.slice(40, 56), 16), e.set(h.slice(64, 88), 32), e.set(h.slice(96, 104), 56), e;
|
|
1318
1318
|
}
|
|
1319
|
-
const
|
|
1319
|
+
const Hs = (h, e, t) => {
|
|
1320
1320
|
const s = h.buffer.slice(t, t + e);
|
|
1321
|
-
let n =
|
|
1321
|
+
let n = Ke.decode(s);
|
|
1322
1322
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
1323
|
-
},
|
|
1324
|
-
const [s, n, i, r,
|
|
1323
|
+
}, Fs = (h, e, t) => {
|
|
1324
|
+
const [s, n, i, r, o] = e, a = t || r < 1;
|
|
1325
1325
|
return new I({
|
|
1326
1326
|
name: h,
|
|
1327
|
-
color: new
|
|
1327
|
+
color: new T(s, n, i),
|
|
1328
1328
|
opacity: r,
|
|
1329
|
-
transparent:
|
|
1329
|
+
transparent: a,
|
|
1330
1330
|
alphaTest: 0.01,
|
|
1331
|
-
side:
|
|
1331
|
+
side: o
|
|
1332
1332
|
});
|
|
1333
|
-
},
|
|
1334
|
-
class
|
|
1333
|
+
}, Gs = (h) => h?.toLowerCase().endsWith(".png") ?? !1;
|
|
1334
|
+
class $s {
|
|
1335
1335
|
data;
|
|
1336
1336
|
options;
|
|
1337
1337
|
textureLoader;
|
|
1338
1338
|
littleEndian = !0;
|
|
1339
1339
|
materials = /* @__PURE__ */ new Map();
|
|
1340
1340
|
constructor(e, t) {
|
|
1341
|
-
this.data = e, this.options = t, this.textureLoader = new
|
|
1341
|
+
this.data = e, this.options = t, this.textureLoader = new ke(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
|
|
1342
1342
|
}
|
|
1343
1343
|
parse(e, t) {
|
|
1344
1344
|
let s = this.data;
|
|
1345
|
-
const n =
|
|
1345
|
+
const n = Ds(this.data);
|
|
1346
1346
|
n && (s = n);
|
|
1347
1347
|
const i = new DataView(s);
|
|
1348
1348
|
let r = 8;
|
|
1349
|
-
const
|
|
1350
|
-
r += 1,
|
|
1349
|
+
const o = i.getUint8(r);
|
|
1350
|
+
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}`));
|
|
1351
1351
|
}
|
|
1352
1352
|
_parseV2(e, t, s) {
|
|
1353
1353
|
const n = new R(), i = e.getUint16(t, this.littleEndian);
|
|
1354
1354
|
t += 2;
|
|
1355
1355
|
const r = e.getUint16(t, this.littleEndian);
|
|
1356
1356
|
t += 2;
|
|
1357
|
-
for (let
|
|
1358
|
-
const
|
|
1357
|
+
for (let o = 0; o < i; ++o) {
|
|
1358
|
+
const a = e.getUint16(t, this.littleEndian).toString();
|
|
1359
1359
|
t += 2, t += 4, t += 4, t += 4, t += 4;
|
|
1360
1360
|
const c = e.getFloat32(t, this.littleEndian);
|
|
1361
1361
|
t += 4;
|
|
@@ -1366,36 +1366,36 @@ class Gs {
|
|
|
1366
1366
|
const p = e.getFloat32(t, this.littleEndian);
|
|
1367
1367
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
1368
1368
|
let u = e.getUint8(t);
|
|
1369
|
-
t += 1, u === 0 ? u =
|
|
1370
|
-
const
|
|
1369
|
+
t += 1, u === 0 ? u = Ct : u === 1 ? u = Mt : u === 2 && (u = St);
|
|
1370
|
+
const m = e.getUint16(t, this.littleEndian);
|
|
1371
1371
|
t += 2;
|
|
1372
|
-
const
|
|
1373
|
-
if (t +=
|
|
1374
|
-
const x =
|
|
1375
|
-
this.materials.set(
|
|
1376
|
-
y.colorSpace =
|
|
1372
|
+
const w = m > 0 ? Hs(e, m, t) : "";
|
|
1373
|
+
if (t += m, !this.materials.has(a)) {
|
|
1374
|
+
const x = Fs(a, [c, l, d, p, u], Gs(w));
|
|
1375
|
+
this.materials.set(a, x), w && this.options.path && this.textureLoader.load(L.resolveURL(w, this.options.path), (y) => {
|
|
1376
|
+
y.colorSpace = Ue, y.wrapS = ve, y.wrapT = ve, y.flipY = !1, y.anisotropy = 16, x.map = y;
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
|
-
for (let
|
|
1381
|
-
const
|
|
1380
|
+
for (let o = 0; o < r; ++o) {
|
|
1381
|
+
const a = e.getUint16(t, this.littleEndian).toString();
|
|
1382
1382
|
t += 2;
|
|
1383
1383
|
const c = e.getUint16(t, this.littleEndian).toString();
|
|
1384
1384
|
t += 2;
|
|
1385
|
-
const l = [], d = [], p = [], u = [],
|
|
1386
|
-
if (t += 2,
|
|
1387
|
-
for (let g = 0; g <
|
|
1388
|
-
const b = new
|
|
1385
|
+
const l = [], d = [], p = [], u = [], m = e.getUint16(t, this.littleEndian);
|
|
1386
|
+
if (t += 2, m > 0)
|
|
1387
|
+
for (let g = 0; g < m; g++) {
|
|
1388
|
+
const b = new v();
|
|
1389
1389
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, b.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(b);
|
|
1390
1390
|
}
|
|
1391
|
-
const
|
|
1392
|
-
if (t += 2,
|
|
1393
|
-
for (let g = 0; g <
|
|
1391
|
+
const w = e.getUint16(t, this.littleEndian);
|
|
1392
|
+
if (t += 2, w > 0)
|
|
1393
|
+
for (let g = 0; g < w; g++)
|
|
1394
1394
|
t += 4, t += 4, t += 4;
|
|
1395
|
-
const
|
|
1396
|
-
if (t += 2,
|
|
1397
|
-
for (let g = 0; g <
|
|
1398
|
-
const b = new
|
|
1395
|
+
const C = e.getUint16(t, this.littleEndian);
|
|
1396
|
+
if (t += 2, C > 0)
|
|
1397
|
+
for (let g = 0; g < C; g++) {
|
|
1398
|
+
const b = new M();
|
|
1399
1399
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
|
|
1400
1400
|
}
|
|
1401
1401
|
const x = e.getUint16(t, this.littleEndian);
|
|
@@ -1414,14 +1414,14 @@ class Gs {
|
|
|
1414
1414
|
for (let g = 0; g < p.length; g++) {
|
|
1415
1415
|
const b = p[g], z = l[b[0]], N = l[b[1]], P = l[b[2]];
|
|
1416
1416
|
y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
|
|
1417
|
-
let
|
|
1417
|
+
let Y = new M(), $ = new M(), k = new M();
|
|
1418
1418
|
const U = u[g];
|
|
1419
|
-
U !== void 0 && (
|
|
1419
|
+
U !== void 0 && (Y = U[0], $ = U[1], k = U[2]), _.push(...Y.toArray(), ...$.toArray(), ...k.toArray());
|
|
1420
1420
|
}
|
|
1421
1421
|
const O = new Float32Array(y), A = new Float32Array(_), E = new K();
|
|
1422
|
-
if (O.length > 0 && E.setAttribute("position", new
|
|
1422
|
+
if (O.length > 0 && E.setAttribute("position", new be(O, 3)), A.length > 0 && E.setAttribute("uv", new be(A, 2)), E.computeVertexNormals(), this.materials.has(c)) {
|
|
1423
1423
|
const g = new D(E, this.materials.get(c));
|
|
1424
|
-
g.name =
|
|
1424
|
+
g.name = a, g.castShadow = !0, g.receiveShadow = !0, n.add(g);
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
s(n);
|
|
@@ -1431,26 +1431,26 @@ class Gs {
|
|
|
1431
1431
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
|
-
class
|
|
1434
|
+
class Ws extends xt {
|
|
1435
1435
|
load(e, t, s, n) {
|
|
1436
1436
|
let i;
|
|
1437
1437
|
if (this.resourcePath !== "")
|
|
1438
1438
|
i = this.resourcePath;
|
|
1439
1439
|
else if (this.path !== "") {
|
|
1440
|
-
const
|
|
1441
|
-
i = L.resolveURL(
|
|
1440
|
+
const a = L.extractUrlBase(e);
|
|
1441
|
+
i = L.resolveURL(a, this.path);
|
|
1442
1442
|
} else
|
|
1443
1443
|
i = L.extractUrlBase(e);
|
|
1444
1444
|
this.manager.itemStart(e);
|
|
1445
|
-
const r = (
|
|
1446
|
-
n ? n(
|
|
1447
|
-
},
|
|
1448
|
-
|
|
1445
|
+
const r = (a) => {
|
|
1446
|
+
n ? n(a) : console.error(a), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
1447
|
+
}, o = new De(this.manager);
|
|
1448
|
+
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(
|
|
1449
1449
|
e,
|
|
1450
|
-
(
|
|
1450
|
+
(a) => {
|
|
1451
1451
|
try {
|
|
1452
1452
|
this.parse(
|
|
1453
|
-
|
|
1453
|
+
a,
|
|
1454
1454
|
i,
|
|
1455
1455
|
(c) => {
|
|
1456
1456
|
t(c), this.manager.itemEnd(e);
|
|
@@ -1471,7 +1471,7 @@ class $s extends bt {
|
|
|
1471
1471
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
1472
1472
|
return;
|
|
1473
1473
|
}
|
|
1474
|
-
new
|
|
1474
|
+
new $s(e, {
|
|
1475
1475
|
path: t,
|
|
1476
1476
|
crossOrigin: this.crossOrigin,
|
|
1477
1477
|
requestHeader: this.requestHeader,
|
|
@@ -1493,7 +1493,7 @@ class $s extends bt {
|
|
|
1493
1493
|
});
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
|
-
const
|
|
1496
|
+
const Ks = [
|
|
1497
1497
|
"map",
|
|
1498
1498
|
"alphaMap",
|
|
1499
1499
|
"aoMap",
|
|
@@ -1527,7 +1527,7 @@ function W(h) {
|
|
|
1527
1527
|
for (const s of t) {
|
|
1528
1528
|
if (!s) continue;
|
|
1529
1529
|
let n = !1;
|
|
1530
|
-
for (const i of
|
|
1530
|
+
for (const i of Ks) {
|
|
1531
1531
|
const r = s[i];
|
|
1532
1532
|
r?.isTexture && r.image == null && (r.dispose(), s[i] = null, n = !0);
|
|
1533
1533
|
}
|
|
@@ -1537,19 +1537,19 @@ function W(h) {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
class j {
|
|
1539
1539
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
1540
|
-
static fileLoader = new
|
|
1541
|
-
static dracoLoader = new
|
|
1542
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1540
|
+
static fileLoader = new De().setResponseType("arraybuffer");
|
|
1541
|
+
static dracoLoader = new ds().setDecoderPath(
|
|
1542
|
+
`https://cdn.jsdelivr.net/npm/three@0.${xe}.0/examples/jsm/libs/draco/`
|
|
1543
1543
|
);
|
|
1544
|
-
static ktx2Loader = new
|
|
1545
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
1544
|
+
static ktx2Loader = new ps().setTranscoderPath(
|
|
1545
|
+
`https://cdn.jsdelivr.net/npm/three@0.${xe}.0/examples/jsm/libs/basis/`
|
|
1546
1546
|
);
|
|
1547
|
-
static gltfLoader = new
|
|
1548
|
-
static sbmxLoader = new
|
|
1549
|
-
static sbmLoader = new
|
|
1550
|
-
static fbxLoader = new
|
|
1551
|
-
static objLoader = new
|
|
1552
|
-
static stlLoader = new
|
|
1547
|
+
static gltfLoader = new $e().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(_e);
|
|
1548
|
+
static sbmxLoader = new As().setDRACOLoader(j.dracoLoader).setKTX2Loader(j.ktx2Loader).setMeshoptDecoder(_e);
|
|
1549
|
+
static sbmLoader = new Ws();
|
|
1550
|
+
static fbxLoader = new cs();
|
|
1551
|
+
static objLoader = new hs();
|
|
1552
|
+
static stlLoader = new ls();
|
|
1553
1553
|
static setLoadingManager(e) {
|
|
1554
1554
|
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
1555
|
}
|
|
@@ -1583,11 +1583,11 @@ class j {
|
|
|
1583
1583
|
const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
|
|
1584
1584
|
return r.scene.animations = r.animations, W(r.scene);
|
|
1585
1585
|
case "sbm":
|
|
1586
|
-
const
|
|
1587
|
-
return W(a);
|
|
1588
|
-
case "fbx":
|
|
1589
|
-
const o = this.fbxLoader.parse(n, L.extractUrlBase(e));
|
|
1586
|
+
const o = await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
|
|
1590
1587
|
return W(o);
|
|
1588
|
+
case "fbx":
|
|
1589
|
+
const a = this.fbxLoader.parse(n, L.extractUrlBase(e));
|
|
1590
|
+
return W(a);
|
|
1591
1591
|
case "obj":
|
|
1592
1592
|
const c = new TextDecoder().decode(n), l = this.objLoader.parse(c);
|
|
1593
1593
|
return W(l);
|
|
@@ -1610,10 +1610,10 @@ class j {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
|
-
class
|
|
1614
|
-
static textureLoader = new
|
|
1615
|
-
static hdrLoader = new
|
|
1616
|
-
static cubeTextureLoader = new
|
|
1613
|
+
class Tn {
|
|
1614
|
+
static textureLoader = new ke();
|
|
1615
|
+
static hdrLoader = new us();
|
|
1616
|
+
static cubeTextureLoader = new Tt();
|
|
1617
1617
|
static setLoadingManager(e) {
|
|
1618
1618
|
this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
|
|
1619
1619
|
}
|
|
@@ -1622,7 +1622,7 @@ class Mn {
|
|
|
1622
1622
|
}
|
|
1623
1623
|
static async loadAsyncHDR(e) {
|
|
1624
1624
|
const t = await this.hdrLoader.loadAsync(e);
|
|
1625
|
-
return t.mapping =
|
|
1625
|
+
return t.mapping = _t, t;
|
|
1626
1626
|
}
|
|
1627
1627
|
static async loadAsyncCubeTexture(e, t) {
|
|
1628
1628
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
@@ -1641,7 +1641,7 @@ class G extends D {
|
|
|
1641
1641
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
|
-
class
|
|
1644
|
+
class Qe extends R {
|
|
1645
1645
|
isBaseGroup = !0;
|
|
1646
1646
|
type = "BaseGroup";
|
|
1647
1647
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1652,7 +1652,7 @@ class Ke extends R {
|
|
|
1652
1652
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1653
1653
|
}
|
|
1654
1654
|
}
|
|
1655
|
-
class
|
|
1655
|
+
class Qs extends Et {
|
|
1656
1656
|
isBaseSprite = !0;
|
|
1657
1657
|
type = "BaseSprite";
|
|
1658
1658
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1663,7 +1663,7 @@ class Ks extends _t {
|
|
|
1663
1663
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
|
-
class ae extends
|
|
1666
|
+
class ae extends Qe {
|
|
1667
1667
|
isModel = !0;
|
|
1668
1668
|
type = "Model";
|
|
1669
1669
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
@@ -1678,8 +1678,8 @@ class ae extends Ke {
|
|
|
1678
1678
|
try {
|
|
1679
1679
|
let i;
|
|
1680
1680
|
s ? ae.memoryCache.has(t) ? i = ae.memoryCache.get(t) : (i = j.loadAsync(t, { persistent: n }), ae.memoryCache.set(t, i)) : i = j.loadAsync(t, { persistent: n });
|
|
1681
|
-
const r = await i,
|
|
1682
|
-
return this.add(
|
|
1681
|
+
const r = await i, o = ms(r);
|
|
1682
|
+
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new Pt(o)), o;
|
|
1683
1683
|
} catch (i) {
|
|
1684
1684
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
1685
1685
|
}
|
|
@@ -1687,11 +1687,11 @@ class ae extends Ke {
|
|
|
1687
1687
|
playAnimation(e, t = {}) {
|
|
1688
1688
|
if (!this.mixer || this.animations.length === 0) return null;
|
|
1689
1689
|
const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished: r = !1 } = t;
|
|
1690
|
-
let
|
|
1691
|
-
if (e === void 0 ?
|
|
1690
|
+
let o;
|
|
1691
|
+
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
1692
|
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
1693
|
-
let
|
|
1694
|
-
return
|
|
1693
|
+
let a = this.actions.get(o.name);
|
|
1694
|
+
return a || (a = this.mixer.clipAction(o), this.actions.set(o.name, a)), a.setLoop(s ? Ot : At, n), a.clampWhenFinished = r, a.timeScale = i, a.reset().play(), a;
|
|
1695
1695
|
}
|
|
1696
1696
|
playAllAnimations(e = {}) {
|
|
1697
1697
|
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
@@ -1712,13 +1712,13 @@ class ae extends Ke {
|
|
|
1712
1712
|
* Get the axis-aligned bounding box of this model.
|
|
1713
1713
|
*/
|
|
1714
1714
|
getBoundingBox() {
|
|
1715
|
-
return new
|
|
1715
|
+
return new X().setFromObject(this);
|
|
1716
1716
|
}
|
|
1717
1717
|
/**
|
|
1718
1718
|
* Get the center point of this model's bounding box.
|
|
1719
1719
|
*/
|
|
1720
1720
|
getCenter() {
|
|
1721
|
-
const e = new
|
|
1721
|
+
const e = new v();
|
|
1722
1722
|
return this.getBoundingBox().getCenter(e), e;
|
|
1723
1723
|
}
|
|
1724
1724
|
/**
|
|
@@ -1736,11 +1736,11 @@ class ae extends Ke {
|
|
|
1736
1736
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
1737
1737
|
}
|
|
1738
1738
|
}
|
|
1739
|
-
class
|
|
1739
|
+
class qs extends G {
|
|
1740
1740
|
isSphereMesh = !0;
|
|
1741
1741
|
type = "SphereMesh";
|
|
1742
1742
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1743
|
-
super(), this.geometry = new
|
|
1743
|
+
super(), this.geometry = new Bt(
|
|
1744
1744
|
e?.radius,
|
|
1745
1745
|
e?.widthSegments,
|
|
1746
1746
|
e?.heightSegments,
|
|
@@ -1751,11 +1751,11 @@ class Qs extends G {
|
|
|
1751
1751
|
), this.material = new I(t);
|
|
1752
1752
|
}
|
|
1753
1753
|
}
|
|
1754
|
-
class
|
|
1754
|
+
class Oe extends G {
|
|
1755
1755
|
isTubeMesh = !0;
|
|
1756
1756
|
type = "TubeMesh";
|
|
1757
1757
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1758
|
-
super(), this.geometry = new
|
|
1758
|
+
super(), this.geometry = new Lt(
|
|
1759
1759
|
e?.path,
|
|
1760
1760
|
e?.tubularSegments,
|
|
1761
1761
|
e?.radius,
|
|
@@ -1764,7 +1764,7 @@ class Pe extends G {
|
|
|
1764
1764
|
), this.material = new I(t);
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
|
-
class
|
|
1767
|
+
class _n extends Qe {
|
|
1768
1768
|
isTopology = !0;
|
|
1769
1769
|
type = "Topology";
|
|
1770
1770
|
// Visuals
|
|
@@ -1815,8 +1815,8 @@ class Tn extends Ke {
|
|
|
1815
1815
|
console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
|
|
1816
1816
|
return;
|
|
1817
1817
|
}
|
|
1818
|
-
const
|
|
1819
|
-
this.getNeighbors(e)?.set(t,
|
|
1818
|
+
const o = s ?? i.distanceTo(r);
|
|
1819
|
+
this.getNeighbors(e)?.set(t, o), n && this.getNeighbors(t)?.set(e, o);
|
|
1820
1820
|
}
|
|
1821
1821
|
/**
|
|
1822
1822
|
* Remove an edge between two nodes.
|
|
@@ -1834,32 +1834,32 @@ class Tn extends Ke {
|
|
|
1834
1834
|
if (!this.nodes.has(e) || !this.nodes.has(t))
|
|
1835
1835
|
return console.warn("[Topology] Start or End node not found."), [];
|
|
1836
1836
|
const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1837
|
-
for (const [
|
|
1838
|
-
s.set(
|
|
1837
|
+
for (const [a] of this.nodes)
|
|
1838
|
+
s.set(a, 1 / 0), n.set(a, null), i.add(a);
|
|
1839
1839
|
for (s.set(e, 0); i.size > 0; ) {
|
|
1840
|
-
let
|
|
1840
|
+
let a = null, c = 1 / 0;
|
|
1841
1841
|
for (const d of i) {
|
|
1842
1842
|
const p = s.get(d);
|
|
1843
|
-
p < c && (c = p,
|
|
1843
|
+
p < c && (c = p, a = d);
|
|
1844
1844
|
}
|
|
1845
|
-
if (
|
|
1845
|
+
if (a === null || a === t || c === 1 / 0)
|
|
1846
1846
|
break;
|
|
1847
|
-
i.delete(
|
|
1848
|
-
const l = this.adjacencyMap?.get(
|
|
1847
|
+
i.delete(a);
|
|
1848
|
+
const l = this.adjacencyMap?.get(a);
|
|
1849
1849
|
if (l)
|
|
1850
1850
|
for (const [d, p] of l) {
|
|
1851
1851
|
if (!i.has(d)) continue;
|
|
1852
|
-
const u = s.get(
|
|
1853
|
-
u < s.get(d) && (s.set(d, u), n.set(d,
|
|
1852
|
+
const u = s.get(a) + p;
|
|
1853
|
+
u < s.get(d) && (s.set(d, u), n.set(d, a));
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
1856
|
const r = [];
|
|
1857
|
-
let
|
|
1857
|
+
let o = t;
|
|
1858
1858
|
if (n.get(t) === null && e !== t)
|
|
1859
1859
|
return [];
|
|
1860
|
-
for (;
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1860
|
+
for (; o !== null; ) {
|
|
1861
|
+
const a = this.nodes.get(o);
|
|
1862
|
+
a && r.unshift(a), o = n.get(o) || null;
|
|
1863
1863
|
}
|
|
1864
1864
|
return r;
|
|
1865
1865
|
}
|
|
@@ -1868,7 +1868,7 @@ class Tn extends Ke {
|
|
|
1868
1868
|
*/
|
|
1869
1869
|
renderGraph() {
|
|
1870
1870
|
this.clearGraph(), this.graphGroup = new R();
|
|
1871
|
-
const e = new
|
|
1871
|
+
const e = new qs({
|
|
1872
1872
|
geometryParameters: {
|
|
1873
1873
|
radius: this.parameters.nodeRadius,
|
|
1874
1874
|
widthSegments: 16,
|
|
@@ -1885,12 +1885,12 @@ class Tn extends Ke {
|
|
|
1885
1885
|
const t = /* @__PURE__ */ new Set();
|
|
1886
1886
|
this.adjacencyMap.forEach((s, n) => {
|
|
1887
1887
|
s.forEach((i, r) => {
|
|
1888
|
-
const
|
|
1889
|
-
if (t.has(
|
|
1890
|
-
t.add(
|
|
1891
|
-
const
|
|
1892
|
-
if (
|
|
1893
|
-
const l = new
|
|
1888
|
+
const o = [n, r].sort().join("-");
|
|
1889
|
+
if (t.has(o)) return;
|
|
1890
|
+
t.add(o);
|
|
1891
|
+
const a = this.nodes.get(n), c = this.nodes.get(r);
|
|
1892
|
+
if (a && c) {
|
|
1893
|
+
const l = new Rt(a, c), d = new Oe({
|
|
1894
1894
|
geometryParameters: {
|
|
1895
1895
|
path: l,
|
|
1896
1896
|
tubularSegments: 1,
|
|
@@ -1917,7 +1917,7 @@ class Tn extends Ke {
|
|
|
1917
1917
|
*/
|
|
1918
1918
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1919
1919
|
if (e.length < 2) return;
|
|
1920
|
-
const s = new
|
|
1920
|
+
const s = new It(e, !1, "catmullrom", 0), n = new Oe({
|
|
1921
1921
|
geometryParameters: {
|
|
1922
1922
|
path: s,
|
|
1923
1923
|
tubularSegments: e.length * 10,
|
|
@@ -1943,9 +1943,9 @@ class Tn extends Ke {
|
|
|
1943
1943
|
});
|
|
1944
1944
|
const t = [], s = /* @__PURE__ */ new Set();
|
|
1945
1945
|
return this.adjacencyMap.forEach((n, i) => {
|
|
1946
|
-
n.forEach((r,
|
|
1947
|
-
const
|
|
1948
|
-
s.has(
|
|
1946
|
+
n.forEach((r, o) => {
|
|
1947
|
+
const a = [i, o].sort().join("-");
|
|
1948
|
+
s.has(a) || (s.add(a), t.push({ from: i, to: o, weight: r }));
|
|
1949
1949
|
});
|
|
1950
1950
|
}), { nodes: e, edges: t };
|
|
1951
1951
|
}
|
|
@@ -1955,7 +1955,7 @@ class Tn extends Ke {
|
|
|
1955
1955
|
*/
|
|
1956
1956
|
importData(e) {
|
|
1957
1957
|
this.clearGraph(), this.clearPaths(), this.nodes.clear(), this.adjacencyMap.clear(), Object.entries(e.nodes).forEach(([t, s]) => {
|
|
1958
|
-
this.addNode(t, new
|
|
1958
|
+
this.addNode(t, new v(s.x, s.y, s.z));
|
|
1959
1959
|
}), e.edges.forEach(({ from: t, to: s, weight: n }) => {
|
|
1960
1960
|
this.addEdge(t, s, n);
|
|
1961
1961
|
}), this.renderGraph();
|
|
@@ -1967,7 +1967,7 @@ class Tn extends Ke {
|
|
|
1967
1967
|
return this.adjacencyMap.get(e);
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
|
-
class
|
|
1970
|
+
class En extends Qs {
|
|
1971
1971
|
isPoi = !0;
|
|
1972
1972
|
type = "Poi";
|
|
1973
1973
|
parameters = {
|
|
@@ -1986,7 +1986,7 @@ class _n extends Ks {
|
|
|
1986
1986
|
_canvas = document.createElement("canvas");
|
|
1987
1987
|
_lastParametersJSON = "";
|
|
1988
1988
|
constructor(e = {}) {
|
|
1989
|
-
super(new
|
|
1989
|
+
super(new zt()), Object.assign(this.parameters, e), this.updateAsync();
|
|
1990
1990
|
}
|
|
1991
1991
|
/**
|
|
1992
1992
|
* Update the POI with new parameters
|
|
@@ -2002,33 +2002,33 @@ class _n extends Ks {
|
|
|
2002
2002
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
2003
2003
|
let i = null;
|
|
2004
2004
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
2005
|
-
const { text: r, fontSize:
|
|
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), C = r ? w.width : 0, x = r ? o : 0;
|
|
2006
2006
|
let y = 0, _ = 0, O = 0, A = 0, E = 0, g = 0;
|
|
2007
2007
|
const b = !!i, z = !!r;
|
|
2008
2008
|
if (b && z)
|
|
2009
2009
|
switch (u) {
|
|
2010
2010
|
case "top":
|
|
2011
|
-
y = Math.max(c,
|
|
2011
|
+
y = Math.max(c, C), _ = c + l + x, E = (y - C) / 2, g = x / 2, O = (y - c) / 2, A = x + l;
|
|
2012
2012
|
break;
|
|
2013
2013
|
case "bottom":
|
|
2014
|
-
y = Math.max(c,
|
|
2014
|
+
y = Math.max(c, C), _ = c + l + x, O = (y - c) / 2, A = 0, E = (y - C) / 2, g = c + l + x / 2;
|
|
2015
2015
|
break;
|
|
2016
2016
|
case "left":
|
|
2017
|
-
y = c + l +
|
|
2017
|
+
y = c + l + C, _ = Math.max(c, x), E = 0, g = _ / 2, O = C + l, A = (_ - c) / 2;
|
|
2018
2018
|
break;
|
|
2019
2019
|
default:
|
|
2020
|
-
y = c + l +
|
|
2020
|
+
y = c + l + C, _ = Math.max(c, x), O = 0, A = (_ - c) / 2, E = c + l, g = _ / 2;
|
|
2021
2021
|
break;
|
|
2022
2022
|
}
|
|
2023
|
-
else b ? (y = c, _ = c, O = 0, A = 0) : z && (y =
|
|
2023
|
+
else b ? (y = c, _ = c, O = 0, A = 0) : z && (y = C, _ = x, E = 0, g = x / 2);
|
|
2024
2024
|
const N = y + l * 2, P = _ + l * 2;
|
|
2025
|
-
if (s.width = N, s.height = P, n.font = `${
|
|
2026
|
-
n.fillStyle =
|
|
2027
|
-
const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent,
|
|
2028
|
-
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l +
|
|
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, O + l, A + l, c, c), z) {
|
|
2026
|
+
n.fillStyle = a;
|
|
2027
|
+
const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent, st = k.actualBoundingBoxAscent - U / 2;
|
|
2028
|
+
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l + st);
|
|
2029
2029
|
}
|
|
2030
|
-
const
|
|
2031
|
-
$.colorSpace =
|
|
2030
|
+
const Y = this.material.map, $ = new Nt(s);
|
|
2031
|
+
$.colorSpace = Ue, this.material.map = $, Y?.dispose(), this.scale.set(N * m, P * m, 1);
|
|
2032
2032
|
}
|
|
2033
2033
|
_loadImage(e) {
|
|
2034
2034
|
return new Promise((t, s) => {
|
|
@@ -2046,43 +2046,43 @@ class _n extends Ks {
|
|
|
2046
2046
|
this.material.map?.dispose(), this.material.dispose();
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
|
-
class
|
|
2049
|
+
class qe extends G {
|
|
2050
2050
|
isShapeMesh = !0;
|
|
2051
2051
|
type = "ShapeMesh";
|
|
2052
2052
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2053
|
-
super(), this.geometry = new
|
|
2053
|
+
super(), this.geometry = new jt(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2054
2054
|
}
|
|
2055
2055
|
static createFromPoints(e, t = {}) {
|
|
2056
|
-
return new
|
|
2056
|
+
return new qe({
|
|
2057
2057
|
...t,
|
|
2058
2058
|
geometryParameters: {
|
|
2059
2059
|
...t.geometryParameters,
|
|
2060
|
-
shape: new
|
|
2060
|
+
shape: new He(e.map((s) => new M(s.x, -s.z)))
|
|
2061
2061
|
}
|
|
2062
2062
|
});
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
|
-
class
|
|
2065
|
+
class Xe extends G {
|
|
2066
2066
|
isExtrudeMesh = !0;
|
|
2067
2067
|
type = "ExtrudeMesh";
|
|
2068
2068
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2069
|
-
super(), this.geometry = new
|
|
2069
|
+
super(), this.geometry = new Dt(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2070
2070
|
}
|
|
2071
2071
|
static createFromPoints(e, t = {}) {
|
|
2072
|
-
return e && e.length === 0 && (e = void 0), new
|
|
2072
|
+
return e && e.length === 0 && (e = void 0), new Xe({
|
|
2073
2073
|
...t,
|
|
2074
2074
|
geometryParameters: {
|
|
2075
2075
|
...t.geometryParameters,
|
|
2076
|
-
shape: new
|
|
2076
|
+
shape: new He(e?.map((s) => new M(s.x, -s.z)))
|
|
2077
2077
|
}
|
|
2078
2078
|
});
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
|
-
class
|
|
2081
|
+
class Pn extends G {
|
|
2082
2082
|
isPlaneMesh = !0;
|
|
2083
2083
|
type = "PlaneMesh";
|
|
2084
2084
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2085
|
-
super(), this.geometry = new
|
|
2085
|
+
super(), this.geometry = new kt(
|
|
2086
2086
|
e?.width,
|
|
2087
2087
|
e?.height,
|
|
2088
2088
|
e?.widthSegments,
|
|
@@ -2090,12 +2090,12 @@ class En extends G {
|
|
|
2090
2090
|
), this.material = new I(t);
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
class
|
|
2093
|
+
class On extends G {
|
|
2094
2094
|
isCircleMesh = !0;
|
|
2095
2095
|
type = "CircleMesh";
|
|
2096
2096
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2097
2097
|
super(
|
|
2098
|
-
new
|
|
2098
|
+
new Ut(
|
|
2099
2099
|
e?.radius,
|
|
2100
2100
|
e?.segments,
|
|
2101
2101
|
e?.thetaStart,
|
|
@@ -2112,14 +2112,14 @@ class F {
|
|
|
2112
2112
|
});
|
|
2113
2113
|
}
|
|
2114
2114
|
}
|
|
2115
|
-
class
|
|
2115
|
+
class An {
|
|
2116
2116
|
static flow(e = {}) {
|
|
2117
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e,
|
|
2118
|
-
return
|
|
2117
|
+
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 = Me().x.mul(i).sub(ne.mul(n)), l = ie(me(c).add(1).mul(0.5), r);
|
|
2118
|
+
return re(o, a, l);
|
|
2119
2119
|
}
|
|
2120
2120
|
static breathe(e = {}) {
|
|
2121
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = H(new
|
|
2122
|
-
return
|
|
2121
|
+
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 = me(ne.mul(n)).add(1).mul(0.5), c = ie(a, i);
|
|
2122
|
+
return re(r, o, c);
|
|
2123
2123
|
}
|
|
2124
2124
|
static fluid(e = {}) {
|
|
2125
2125
|
const {
|
|
@@ -2128,56 +2128,60 @@ class On {
|
|
|
2128
2128
|
speed: n = 1,
|
|
2129
2129
|
scale: i = 1,
|
|
2130
2130
|
intensity: r = 1,
|
|
2131
|
-
distortion:
|
|
2132
|
-
} = e,
|
|
2133
|
-
return
|
|
2131
|
+
distortion: o = 0.5
|
|
2132
|
+
} = e, a = H(new T(t)), c = H(new T(s)), l = Me().mul(i), d = ne.mul(n), p = Se(l.add(d), 1, 0), u = l.add(p.mul(o)), m = Se(u, 1, 0).add(1).mul(0.5), w = ie(m, r);
|
|
2133
|
+
return re(a, c, w);
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
|
-
function
|
|
2136
|
+
function Bn(h) {
|
|
2137
2137
|
}
|
|
2138
|
-
const
|
|
2139
|
-
const h = B(
|
|
2140
|
-
return
|
|
2141
|
-
})(),
|
|
2142
|
-
const h = B(
|
|
2143
|
-
return
|
|
2138
|
+
const de = "uSpaceHighlight", q = `${de}/enabled`, Ye = `${de}/opacity`, Je = `${de}/color`, Ve = `${de}/overwrite`, pe = "uSpaceBreathe", he = `${pe}/enabled`, Ze = `${pe}/color`, et = `${pe}/speed`, tt = `${pe}/intensity`, le = /* @__PURE__ */ new WeakMap(), Xs = Fe(() => {
|
|
2139
|
+
const h = B(q, "uint"), e = B(Je, "uint"), t = B(Ve, "uint"), s = Le(e), n = Te.mul(s), i = oe(t.greaterThan(0), s, n), r = oe(h.greaterThan(0), i, Te), o = B(he, "uint"), a = B(Ze, "uint"), c = B(et, "float"), l = B(tt, "float"), d = Le(a), p = me(ne.mul(c)).add(1).mul(0.5), u = ie(p, l), m = re(r, d, u);
|
|
2140
|
+
return oe(o.greaterThan(0), m, r);
|
|
2141
|
+
})(), Ys = Fe(() => {
|
|
2142
|
+
const h = B(q, "uint"), e = B(Ye, "float");
|
|
2143
|
+
return oe(h.greaterThan(0), e, Yt);
|
|
2144
2144
|
})();
|
|
2145
|
-
function
|
|
2146
|
-
|
|
2147
|
-
if (!e || Array.isArray(e)) return;
|
|
2148
|
-
let t = he.get(e);
|
|
2149
|
-
t || (t = {
|
|
2150
|
-
colorNode: e.colorNode,
|
|
2151
|
-
opacityNode: e.opacityNode,
|
|
2152
|
-
transparent: e.transparent,
|
|
2153
|
-
depthWrite: e.depthWrite,
|
|
2154
|
-
activeMeshes: /* @__PURE__ */ new Set()
|
|
2155
|
-
}, he.set(e, t)), t.activeMeshes.add(h), e.transparent = !0, e.colorNode = qs, e.opacityNode = Xs, e.needsUpdate = !0;
|
|
2145
|
+
function Q(h) {
|
|
2146
|
+
return Array.isArray(h.material) ? h.material : [h.material];
|
|
2156
2147
|
}
|
|
2157
2148
|
function Ae(h) {
|
|
2158
|
-
|
|
2149
|
+
Q(h).forEach((t) => {
|
|
2150
|
+
if (!t) return;
|
|
2151
|
+
let s = le.get(t);
|
|
2152
|
+
s || (s = {
|
|
2153
|
+
colorNode: t.colorNode,
|
|
2154
|
+
opacityNode: t.opacityNode,
|
|
2155
|
+
transparent: t.transparent,
|
|
2156
|
+
depthWrite: t.depthWrite,
|
|
2157
|
+
activeMeshes: /* @__PURE__ */ new Set()
|
|
2158
|
+
}, le.set(t, s)), s.activeMeshes.add(h), t.transparent = !0, t.colorNode = Xs, t.opacityNode = Ys, t.needsUpdate = !0;
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
function Be(h) {
|
|
2162
|
+
const e = h.userData[q], t = h.userData[he];
|
|
2159
2163
|
if (e || t) return;
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
+
Q(h).forEach((n) => {
|
|
2165
|
+
if (!n) return;
|
|
2166
|
+
const i = le.get(n);
|
|
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, le.delete(n)));
|
|
2168
|
+
});
|
|
2164
2169
|
}
|
|
2165
|
-
class
|
|
2170
|
+
class ce {
|
|
2166
2171
|
static highlightColor(e, t = {}) {
|
|
2167
|
-
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite:
|
|
2172
|
+
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: r = !1, depthWrite: o } = t, a = new T(i).getHex();
|
|
2168
2173
|
for (const c of s)
|
|
2169
2174
|
F.traverseMeshes(c, (l) => {
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
}
|
|
2175
|
+
l.userData[q] = 1, l.userData[Ye] = n, l.userData[Je] = a, l.userData[Ve] = r ? 1 : 0, Ae(l), o !== void 0 && Q(l).forEach((p) => {
|
|
2176
|
+
p && (p.depthWrite = o);
|
|
2177
|
+
});
|
|
2174
2178
|
});
|
|
2175
2179
|
}
|
|
2176
2180
|
static removeHighlightColor(e) {
|
|
2177
2181
|
const t = Array.isArray(e) ? e : [e];
|
|
2178
2182
|
for (const s of t)
|
|
2179
2183
|
F.traverseMeshes(s, (n) => {
|
|
2180
|
-
n.userData[
|
|
2184
|
+
n.userData[q] = 0, Be(n);
|
|
2181
2185
|
});
|
|
2182
2186
|
}
|
|
2183
2187
|
static breatheColor(e, t = {}) {
|
|
@@ -2189,17 +2193,17 @@ class oe {
|
|
|
2189
2193
|
},
|
|
2190
2194
|
t
|
|
2191
2195
|
);
|
|
2192
|
-
n.color = new
|
|
2196
|
+
n.color = new T(n.color).getHex();
|
|
2193
2197
|
for (const i of s)
|
|
2194
2198
|
F.traverseMeshes(i, (r) => {
|
|
2195
|
-
r.userData[
|
|
2199
|
+
r.userData[he] = 1, r.userData[Ze] = n.color, r.userData[et] = n.speed, r.userData[tt] = n.intensity, Ae(r);
|
|
2196
2200
|
});
|
|
2197
2201
|
}
|
|
2198
2202
|
static removeBreatheColor(e) {
|
|
2199
2203
|
const t = Array.isArray(e) ? e : [e];
|
|
2200
2204
|
for (const s of t)
|
|
2201
2205
|
F.traverseMeshes(s, (n) => {
|
|
2202
|
-
n.userData[
|
|
2206
|
+
n.userData[he] = 0, Be(n);
|
|
2203
2207
|
});
|
|
2204
2208
|
}
|
|
2205
2209
|
/**
|
|
@@ -2209,15 +2213,18 @@ class oe {
|
|
|
2209
2213
|
const s = Array.isArray(e) ? e : [e];
|
|
2210
2214
|
for (const n of s)
|
|
2211
2215
|
F.traverseMeshes(n, (i) => {
|
|
2212
|
-
|
|
2213
|
-
|
|
2216
|
+
Q(i).forEach((r) => {
|
|
2217
|
+
if (!r) return;
|
|
2218
|
+
const o = r;
|
|
2219
|
+
o.wireframe = t, o.needsUpdate = !0;
|
|
2220
|
+
});
|
|
2214
2221
|
});
|
|
2215
2222
|
}
|
|
2216
2223
|
/**
|
|
2217
2224
|
* Remove wireframe mode.
|
|
2218
2225
|
*/
|
|
2219
2226
|
static removeWireframe(e) {
|
|
2220
|
-
|
|
2227
|
+
ce.wireframe(e, !1);
|
|
2221
2228
|
}
|
|
2222
2229
|
/**
|
|
2223
2230
|
* Fade in object(s) from fully transparent to original opacity.
|
|
@@ -2225,7 +2232,7 @@ class oe {
|
|
|
2225
2232
|
*/
|
|
2226
2233
|
static fadeIn(e, t = {}) {
|
|
2227
2234
|
const { duration: s = 500 } = t;
|
|
2228
|
-
return
|
|
2235
|
+
return ce._fade(e, 0, 1, s);
|
|
2229
2236
|
}
|
|
2230
2237
|
/**
|
|
2231
2238
|
* Fade out object(s) to fully transparent.
|
|
@@ -2233,44 +2240,52 @@ class oe {
|
|
|
2233
2240
|
*/
|
|
2234
2241
|
static fadeOut(e, t = {}) {
|
|
2235
2242
|
const { duration: s = 500 } = t;
|
|
2236
|
-
return
|
|
2243
|
+
return ce._fade(e, 1, 0, s);
|
|
2237
2244
|
}
|
|
2238
2245
|
static _fade(e, t, s, n) {
|
|
2239
|
-
const i = Array.isArray(e) ? e : [e], r =
|
|
2240
|
-
for (const
|
|
2241
|
-
F.traverseMeshes(
|
|
2242
|
-
|
|
2243
|
-
|
|
2246
|
+
const i = Array.isArray(e) ? e : [e], r = /* @__PURE__ */ new Map();
|
|
2247
|
+
for (const o of i)
|
|
2248
|
+
F.traverseMeshes(o, (a) => {
|
|
2249
|
+
Q(a).forEach((c) => {
|
|
2250
|
+
if (!c || r.has(c)) return;
|
|
2251
|
+
const l = c.opacity, d = c.transparent, p = s >= 1 ? l : s;
|
|
2252
|
+
r.set(c, {
|
|
2253
|
+
material: c,
|
|
2254
|
+
targetOpacity: p,
|
|
2255
|
+
originalOpacity: l,
|
|
2256
|
+
originalTransparent: d
|
|
2257
|
+
}), c.transparent = !0, c.opacity = t, c.needsUpdate = !0;
|
|
2258
|
+
});
|
|
2244
2259
|
});
|
|
2245
|
-
return r.
|
|
2246
|
-
const
|
|
2260
|
+
return r.size === 0 ? Promise.resolve() : new Promise((o) => {
|
|
2261
|
+
const a = performance.now();
|
|
2247
2262
|
let c = 0;
|
|
2248
2263
|
const l = () => {
|
|
2249
|
-
const d = performance.now() -
|
|
2264
|
+
const d = performance.now() - a, p = Math.min(d / n, 1);
|
|
2250
2265
|
if (!i[0].parent) {
|
|
2251
|
-
cancelAnimationFrame(c),
|
|
2266
|
+
cancelAnimationFrame(c), o();
|
|
2252
2267
|
return;
|
|
2253
2268
|
}
|
|
2254
|
-
for (const { material:
|
|
2255
|
-
|
|
2269
|
+
for (const { material: m, targetOpacity: w } of r.values())
|
|
2270
|
+
m.opacity = t + (w - t) * p, m.needsUpdate = !0;
|
|
2256
2271
|
if (p < 1)
|
|
2257
2272
|
c = requestAnimationFrame(l);
|
|
2258
2273
|
else {
|
|
2259
2274
|
if (s >= 1)
|
|
2260
|
-
for (const { material:
|
|
2261
|
-
|
|
2262
|
-
|
|
2275
|
+
for (const { material: m, originalOpacity: w, originalTransparent: C } of r.values())
|
|
2276
|
+
m.opacity = w, m.transparent = C, m.needsUpdate = !0;
|
|
2277
|
+
o();
|
|
2263
2278
|
}
|
|
2264
2279
|
};
|
|
2265
2280
|
c = requestAnimationFrame(l);
|
|
2266
2281
|
});
|
|
2267
2282
|
}
|
|
2268
2283
|
}
|
|
2269
|
-
const
|
|
2284
|
+
const Le = (h) => {
|
|
2270
2285
|
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);
|
|
2271
|
-
return
|
|
2286
|
+
return Jt(e, t, s);
|
|
2272
2287
|
};
|
|
2273
|
-
class
|
|
2288
|
+
class Js extends fs {
|
|
2274
2289
|
viewer;
|
|
2275
2290
|
constructor(e, t) {
|
|
2276
2291
|
super(t), this.viewer = e;
|
|
@@ -2279,7 +2294,7 @@ class Ys extends ms {
|
|
|
2279
2294
|
this.update(e) && this.viewer.render();
|
|
2280
2295
|
};
|
|
2281
2296
|
easingByMode(e) {
|
|
2282
|
-
const t =
|
|
2297
|
+
const t = Vs[e];
|
|
2283
2298
|
return super.easing(t);
|
|
2284
2299
|
}
|
|
2285
2300
|
start(e, t) {
|
|
@@ -2289,54 +2304,54 @@ class Ys extends ms {
|
|
|
2289
2304
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
2290
2305
|
}
|
|
2291
2306
|
}
|
|
2292
|
-
function
|
|
2293
|
-
return new Promise((r,
|
|
2294
|
-
const { duration:
|
|
2295
|
-
n?.(
|
|
2307
|
+
function Ln(h, e, t, s = {}, n, i) {
|
|
2308
|
+
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 Js(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((m) => {
|
|
2310
|
+
n?.(m, u);
|
|
2296
2311
|
}).onComplete(() => {
|
|
2297
2312
|
r();
|
|
2298
2313
|
}).onStop(() => {
|
|
2299
|
-
|
|
2314
|
+
o("animation stop");
|
|
2300
2315
|
}).onStart(() => {
|
|
2301
2316
|
i?.(u);
|
|
2302
2317
|
});
|
|
2303
2318
|
typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), p && u.repeatDelay(20), u.yoyo(p), u.start();
|
|
2304
2319
|
});
|
|
2305
2320
|
}
|
|
2306
|
-
const
|
|
2307
|
-
"Linear.None":
|
|
2308
|
-
"Quadratic.In":
|
|
2309
|
-
"Quadratic.Out":
|
|
2310
|
-
"Quadratic.InOut":
|
|
2311
|
-
"Cubic.In":
|
|
2312
|
-
"Cubic.Out":
|
|
2313
|
-
"Cubic.InOut":
|
|
2314
|
-
"Quartic.In":
|
|
2315
|
-
"Quartic.Out":
|
|
2316
|
-
"Quartic.InOut":
|
|
2317
|
-
"Quintic.In":
|
|
2318
|
-
"Quintic.Out":
|
|
2319
|
-
"Quintic.InOut":
|
|
2320
|
-
"Sinusoidal.In":
|
|
2321
|
-
"Sinusoidal.Out":
|
|
2322
|
-
"Sinusoidal.InOut":
|
|
2323
|
-
"Exponential.In":
|
|
2324
|
-
"Exponential.Out":
|
|
2325
|
-
"Exponential.InOut":
|
|
2326
|
-
"Circular.In":
|
|
2327
|
-
"Circular.Out":
|
|
2328
|
-
"Circular.InOut":
|
|
2329
|
-
"Elastic.In":
|
|
2330
|
-
"Elastic.Out":
|
|
2331
|
-
"Elastic.InOut":
|
|
2332
|
-
"Back.In":
|
|
2333
|
-
"Back.Out":
|
|
2334
|
-
"Back.InOut":
|
|
2335
|
-
"Bounce.In":
|
|
2336
|
-
"Bounce.Out":
|
|
2337
|
-
"Bounce.InOut":
|
|
2321
|
+
const Vs = {
|
|
2322
|
+
"Linear.None": f.Linear.None,
|
|
2323
|
+
"Quadratic.In": f.Quadratic.In,
|
|
2324
|
+
"Quadratic.Out": f.Quadratic.Out,
|
|
2325
|
+
"Quadratic.InOut": f.Quadratic.InOut,
|
|
2326
|
+
"Cubic.In": f.Cubic.In,
|
|
2327
|
+
"Cubic.Out": f.Cubic.Out,
|
|
2328
|
+
"Cubic.InOut": f.Cubic.InOut,
|
|
2329
|
+
"Quartic.In": f.Quartic.In,
|
|
2330
|
+
"Quartic.Out": f.Quartic.Out,
|
|
2331
|
+
"Quartic.InOut": f.Quartic.InOut,
|
|
2332
|
+
"Quintic.In": f.Quintic.In,
|
|
2333
|
+
"Quintic.Out": f.Quintic.Out,
|
|
2334
|
+
"Quintic.InOut": f.Quintic.InOut,
|
|
2335
|
+
"Sinusoidal.In": f.Sinusoidal.In,
|
|
2336
|
+
"Sinusoidal.Out": f.Sinusoidal.Out,
|
|
2337
|
+
"Sinusoidal.InOut": f.Sinusoidal.InOut,
|
|
2338
|
+
"Exponential.In": f.Exponential.In,
|
|
2339
|
+
"Exponential.Out": f.Exponential.Out,
|
|
2340
|
+
"Exponential.InOut": f.Exponential.InOut,
|
|
2341
|
+
"Circular.In": f.Circular.In,
|
|
2342
|
+
"Circular.Out": f.Circular.Out,
|
|
2343
|
+
"Circular.InOut": f.Circular.InOut,
|
|
2344
|
+
"Elastic.In": f.Elastic.In,
|
|
2345
|
+
"Elastic.Out": f.Elastic.Out,
|
|
2346
|
+
"Elastic.InOut": f.Elastic.InOut,
|
|
2347
|
+
"Back.In": f.Back.In,
|
|
2348
|
+
"Back.Out": f.Back.Out,
|
|
2349
|
+
"Back.InOut": f.Back.InOut,
|
|
2350
|
+
"Bounce.In": f.Bounce.In,
|
|
2351
|
+
"Bounce.Out": f.Bounce.Out,
|
|
2352
|
+
"Bounce.InOut": f.Bounce.InOut
|
|
2338
2353
|
};
|
|
2339
|
-
class
|
|
2354
|
+
class Rn {
|
|
2340
2355
|
scene;
|
|
2341
2356
|
planes = /* @__PURE__ */ new Map();
|
|
2342
2357
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -2345,7 +2360,7 @@ class Ln {
|
|
|
2345
2360
|
*/
|
|
2346
2361
|
group;
|
|
2347
2362
|
constructor(e) {
|
|
2348
|
-
this.scene = e, this.group = new
|
|
2363
|
+
this.scene = e, this.group = new Ht(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
|
|
2349
2364
|
}
|
|
2350
2365
|
/**
|
|
2351
2366
|
* Move all current scene children (except the clipping group itself) into the ClippingGroup,
|
|
@@ -2385,24 +2400,24 @@ class Ln {
|
|
|
2385
2400
|
constant: n = 0,
|
|
2386
2401
|
showHelper: i = !1,
|
|
2387
2402
|
helperSize: r = 5,
|
|
2388
|
-
helperColor:
|
|
2389
|
-
} = t,
|
|
2390
|
-
return this.planes.set(e,
|
|
2403
|
+
helperColor: o = 16711680
|
|
2404
|
+
} = t, a = new Ft(new v(s.x, s.y, s.z), n);
|
|
2405
|
+
return this.planes.set(e, a), this._syncPlanes(), i && this.showHelper(e, r, o), a;
|
|
2391
2406
|
}
|
|
2392
2407
|
/**
|
|
2393
2408
|
* Add six clipping planes that form a box around a Box3.
|
|
2394
2409
|
* Returns the six plane ids: `${id}_+x`, `${id}_-x`, etc.
|
|
2395
2410
|
*/
|
|
2396
2411
|
addBox(e, t, s = {}) {
|
|
2397
|
-
const { showHelpers: n = !1, helperColor: i = 16711680 } = s, r = t.min,
|
|
2398
|
-
{ suffix: "+x", normal: { x: -1, y: 0, z: 0 }, constant:
|
|
2412
|
+
const { showHelpers: n = !1, helperColor: i = 16711680 } = s, r = t.min, o = t.max, a = [
|
|
2413
|
+
{ suffix: "+x", normal: { x: -1, y: 0, z: 0 }, constant: o.x },
|
|
2399
2414
|
{ suffix: "-x", normal: { x: 1, y: 0, z: 0 }, constant: -r.x },
|
|
2400
|
-
{ suffix: "+y", normal: { x: 0, y: -1, z: 0 }, constant:
|
|
2415
|
+
{ suffix: "+y", normal: { x: 0, y: -1, z: 0 }, constant: o.y },
|
|
2401
2416
|
{ suffix: "-y", normal: { x: 0, y: 1, z: 0 }, constant: -r.y },
|
|
2402
|
-
{ suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant:
|
|
2417
|
+
{ suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant: o.z },
|
|
2403
2418
|
{ suffix: "-z", normal: { x: 0, y: 0, z: 1 }, constant: -r.z }
|
|
2404
2419
|
], c = [];
|
|
2405
|
-
for (const l of
|
|
2420
|
+
for (const l of a) {
|
|
2406
2421
|
const d = `${e}_${l.suffix}`;
|
|
2407
2422
|
this.addPlane(d, { normal: l.normal, constant: l.constant, showHelper: n, helperColor: i }), c.push(d);
|
|
2408
2423
|
}
|
|
@@ -2412,7 +2427,7 @@ class Ln {
|
|
|
2412
2427
|
* Add a clipping box from an object's bounding box with optional padding.
|
|
2413
2428
|
*/
|
|
2414
2429
|
addBoxFromObject(e, t, s = 0, n = {}) {
|
|
2415
|
-
const i = new
|
|
2430
|
+
const i = new X().setFromObject(t);
|
|
2416
2431
|
return i.expandByScalar(s), this.addBox(e, i, n);
|
|
2417
2432
|
}
|
|
2418
2433
|
/**
|
|
@@ -2452,7 +2467,7 @@ class Ln {
|
|
|
2452
2467
|
this.hideHelper(e);
|
|
2453
2468
|
const n = this.planes.get(e);
|
|
2454
2469
|
if (!n) return;
|
|
2455
|
-
const i = new
|
|
2470
|
+
const i = new Gt(n, t, new T(s).getHex());
|
|
2456
2471
|
i.name = e, this.helpers.set(e, i), this.scene.add(i);
|
|
2457
2472
|
}
|
|
2458
2473
|
/**
|
|
@@ -2478,7 +2493,7 @@ class Ln {
|
|
|
2478
2493
|
this.detach(), this.removeAll(), this.scene.remove(this.group);
|
|
2479
2494
|
}
|
|
2480
2495
|
}
|
|
2481
|
-
class
|
|
2496
|
+
class In {
|
|
2482
2497
|
scene;
|
|
2483
2498
|
measurements = /* @__PURE__ */ new Map();
|
|
2484
2499
|
_idCounter = 0;
|
|
@@ -2489,19 +2504,19 @@ class Rn {
|
|
|
2489
2504
|
* Measure distance between two points.
|
|
2490
2505
|
*/
|
|
2491
2506
|
measureDistance(e, t, s = {}) {
|
|
2492
|
-
const { lineColor: n = 16776960 } = s, i = new
|
|
2493
|
-
c.name =
|
|
2494
|
-
const l = new K().setFromPoints([i, r]), d = new
|
|
2507
|
+
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
|
+
c.name = a;
|
|
2509
|
+
const l = new K().setFromPoints([i, r]), d = new te({ color: n }), p = new se(l, d);
|
|
2495
2510
|
c.add(p), this.scene.add(c);
|
|
2496
2511
|
const u = {
|
|
2497
|
-
id:
|
|
2512
|
+
id: a,
|
|
2498
2513
|
type: "distance",
|
|
2499
|
-
value:
|
|
2514
|
+
value: o,
|
|
2500
2515
|
unit: "m",
|
|
2501
2516
|
points: [i, r],
|
|
2502
2517
|
object: c
|
|
2503
2518
|
};
|
|
2504
|
-
return this.measurements.set(
|
|
2519
|
+
return this.measurements.set(a, u), u;
|
|
2505
2520
|
}
|
|
2506
2521
|
/**
|
|
2507
2522
|
* Measure the area of a polygon defined by 3+ coplanar points.
|
|
@@ -2510,17 +2525,17 @@ class Rn {
|
|
|
2510
2525
|
const { lineColor: s = 65280 } = t;
|
|
2511
2526
|
if (e.length < 3)
|
|
2512
2527
|
throw new Error("MeasureTool.measureArea requires at least 3 points");
|
|
2513
|
-
const n = e.map((u) => new
|
|
2514
|
-
|
|
2515
|
-
const
|
|
2516
|
-
|
|
2528
|
+
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
|
+
o.name = r;
|
|
2530
|
+
const a = [...n, n[0]], c = new K().setFromPoints(a), l = new te({ color: s }), d = new se(c, l);
|
|
2531
|
+
o.add(d), this.scene.add(o);
|
|
2517
2532
|
const p = {
|
|
2518
2533
|
id: r,
|
|
2519
2534
|
type: "area",
|
|
2520
2535
|
value: i,
|
|
2521
2536
|
unit: "m²",
|
|
2522
2537
|
points: n,
|
|
2523
|
-
object:
|
|
2538
|
+
object: o
|
|
2524
2539
|
};
|
|
2525
2540
|
return this.measurements.set(r, p), p;
|
|
2526
2541
|
}
|
|
@@ -2528,17 +2543,17 @@ class Rn {
|
|
|
2528
2543
|
* Measure the angle between three points (vertex at the middle point).
|
|
2529
2544
|
*/
|
|
2530
2545
|
measureAngle(e, t, s, n = {}) {
|
|
2531
|
-
const { lineColor: i = 16746496 } = n, r = new
|
|
2532
|
-
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2546
|
+
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
|
+
m.name = u;
|
|
2548
|
+
const w = new K().setFromPoints([r, o, a]), C = new te({ color: i }), x = new se(w, C);
|
|
2549
|
+
m.add(x), this.scene.add(m);
|
|
2535
2550
|
const y = {
|
|
2536
2551
|
id: u,
|
|
2537
2552
|
type: "angle",
|
|
2538
2553
|
value: p,
|
|
2539
2554
|
unit: "°",
|
|
2540
|
-
points: [r,
|
|
2541
|
-
object:
|
|
2555
|
+
points: [r, o, a],
|
|
2556
|
+
object: m
|
|
2542
2557
|
};
|
|
2543
2558
|
return this.measurements.set(u, y), y;
|
|
2544
2559
|
}
|
|
@@ -2575,12 +2590,12 @@ class Rn {
|
|
|
2575
2590
|
* Calculate polygon area using cross product method (Newell's method).
|
|
2576
2591
|
*/
|
|
2577
2592
|
_calculatePolygonArea(e) {
|
|
2578
|
-
const t = e.length, s = new
|
|
2593
|
+
const t = e.length, s = new v();
|
|
2579
2594
|
for (let i = 0; i < t; i++) {
|
|
2580
|
-
const r = e[i],
|
|
2581
|
-
s.add(
|
|
2595
|
+
const r = e[i], o = e[(i + 1) % t], a = new v().crossVectors(r, o);
|
|
2596
|
+
s.add(a);
|
|
2582
2597
|
}
|
|
2583
|
-
const n = new
|
|
2598
|
+
const n = new v();
|
|
2584
2599
|
if (t >= 3) {
|
|
2585
2600
|
const i = e[1].clone().sub(e[0]), r = e[2].clone().sub(e[0]);
|
|
2586
2601
|
n.crossVectors(i, r).normalize();
|
|
@@ -2591,7 +2606,7 @@ class Rn {
|
|
|
2591
2606
|
this.removeAll();
|
|
2592
2607
|
}
|
|
2593
2608
|
}
|
|
2594
|
-
class
|
|
2609
|
+
class zn {
|
|
2595
2610
|
scene;
|
|
2596
2611
|
annotations = /* @__PURE__ */ new Map();
|
|
2597
2612
|
_idCounter = 0;
|
|
@@ -2613,7 +2628,7 @@ class In {
|
|
|
2613
2628
|
this.annotations.has(e) && this.remove(e);
|
|
2614
2629
|
const s = new R();
|
|
2615
2630
|
s.name = `annotation_${e}`;
|
|
2616
|
-
const n = new
|
|
2631
|
+
const n = new v(t.position.x, t.position.y, t.position.z);
|
|
2617
2632
|
s.position.copy(n);
|
|
2618
2633
|
const i = document.createElement("div");
|
|
2619
2634
|
if (i.innerHTML = t.content, i.style.cssText = `
|
|
@@ -2628,27 +2643,27 @@ class In {
|
|
|
2628
2643
|
for (const [c, l] of Object.entries(t.labelStyle))
|
|
2629
2644
|
l !== void 0 && (i.style[c] = l);
|
|
2630
2645
|
let r = null;
|
|
2631
|
-
const
|
|
2646
|
+
const o = t.labelOffset || { x: 0, y: 2, z: 0 };
|
|
2632
2647
|
if (t.showLeaderLine !== !1) {
|
|
2633
2648
|
const { lineColor: c = 16777215 } = t, l = new K().setFromPoints([
|
|
2634
|
-
new
|
|
2635
|
-
new
|
|
2636
|
-
]), d = new
|
|
2637
|
-
r = new
|
|
2649
|
+
new v(0, 0, 0),
|
|
2650
|
+
new v(o.x, o.y, o.z)
|
|
2651
|
+
]), d = new te({ color: c });
|
|
2652
|
+
r = new se(l, d), s.add(r);
|
|
2638
2653
|
}
|
|
2639
2654
|
if (this._createCSSObject) {
|
|
2640
2655
|
const c = this._createCSSObject(i);
|
|
2641
|
-
c.position.set(
|
|
2656
|
+
c.position.set(o.x, o.y, o.z), s.add(c);
|
|
2642
2657
|
}
|
|
2643
2658
|
this.scene.add(s);
|
|
2644
|
-
const
|
|
2659
|
+
const a = {
|
|
2645
2660
|
id: e,
|
|
2646
2661
|
options: t,
|
|
2647
2662
|
group: s,
|
|
2648
2663
|
labelElement: i,
|
|
2649
2664
|
line: r
|
|
2650
2665
|
};
|
|
2651
|
-
return this.annotations.set(e,
|
|
2666
|
+
return this.annotations.set(e, a), a;
|
|
2652
2667
|
}
|
|
2653
2668
|
/**
|
|
2654
2669
|
* Quick-add a text annotation.
|
|
@@ -2742,47 +2757,47 @@ class In {
|
|
|
2742
2757
|
this.removeAll();
|
|
2743
2758
|
}
|
|
2744
2759
|
}
|
|
2745
|
-
const
|
|
2746
|
-
window.__USPACE__ = { version:
|
|
2760
|
+
const Zs = "0.0.26";
|
|
2761
|
+
window.__USPACE__ = { version: Zs };
|
|
2747
2762
|
export {
|
|
2748
|
-
|
|
2749
|
-
|
|
2763
|
+
zn as AnnotationManager,
|
|
2764
|
+
Qe as BaseGroup,
|
|
2750
2765
|
G as BaseMesh,
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2766
|
+
Qs as BaseSprite,
|
|
2767
|
+
Dn as CSS2DObject,
|
|
2768
|
+
Un as CSS3DObject,
|
|
2769
|
+
Hn as CSS3DSprite,
|
|
2770
|
+
Es as CSSRenderer,
|
|
2771
|
+
xs as CameraControls,
|
|
2772
|
+
On as CircleMesh,
|
|
2773
|
+
Rn as ClippingTool,
|
|
2774
|
+
Xe as ExtrudeMesh,
|
|
2775
|
+
gs as InteractionEvent,
|
|
2776
|
+
ys as InteractionManager,
|
|
2777
|
+
Mn as LightManager,
|
|
2778
|
+
ce as MaterialEffects,
|
|
2779
|
+
In as MeasureTool,
|
|
2765
2780
|
ae as Model,
|
|
2766
2781
|
j as ModelLoaderManager,
|
|
2767
|
-
|
|
2782
|
+
ws as ObjectManager,
|
|
2768
2783
|
F as ObjectUtils,
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
+
Pn as PlaneMesh,
|
|
2785
|
+
En as Poi,
|
|
2786
|
+
vs as RenderPipeline,
|
|
2787
|
+
Ms as RoomEnvironment,
|
|
2788
|
+
Ws as SBMLoader,
|
|
2789
|
+
As as SBMXLoader,
|
|
2790
|
+
Cn as SceneManager,
|
|
2791
|
+
xn as Selection,
|
|
2792
|
+
qe as ShapeMesh,
|
|
2793
|
+
qs as SphereMesh,
|
|
2794
|
+
An as TSLEffects,
|
|
2795
|
+
Tn as TextureLoaderManager,
|
|
2796
|
+
_n as Topology,
|
|
2797
|
+
Oe as TubeMesh,
|
|
2798
|
+
Js as Tween,
|
|
2784
2799
|
Sn as Viewer,
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2800
|
+
Bn as reinterpretType,
|
|
2801
|
+
Ln as tweenAnimation,
|
|
2802
|
+
Zs as version
|
|
2788
2803
|
};
|