u-space 0.0.2 → 0.0.5
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 +1 -1
- package/dist/index.js +390 -351
- package/dist/plugins/u-manager/index.cjs +2 -2
- package/dist/plugins/u-manager/index.js +54 -43
- package/dist/src/objects/Model.d.ts +14 -1
- package/dist/src/objects/Poi.d.ts +4 -0
- package/dist/src/viewers/Viewer.d.ts +4 -0
- package/docs/api-objects.md +83 -3
- package/docs/api-plugins.md +9 -11
- package/docs/api-viewer.md +52 -4
- package/docs/examples-guide.md +14 -0
- package/docs/getting-started.md +1 -2
- package/docs/index.md +2 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Raycaster as me, Vector2 as
|
|
2
|
-
import { pass as
|
|
1
|
+
import { Raycaster as me, Vector2 as S, RenderPipeline as Ae, Sphere as ge, Box3 as fe, Spherical as T, Matrix4 as Re, Quaternion as _e, Vector4 as Ne, Vector3 as ee, MathUtils as Ue, PMREMGenerator as De, OrthographicCamera as $, TimestampQuery as je, Cache as ke, EventDispatcher as Ge, Timer as Fe, PerspectiveCamera as X, WebGPURenderer as He, PCFShadowMap as ze, AgXToneMapping as $e, Scene as We, Color as te, MeshStandardNodeMaterial as I, Loader as Qe, LoaderUtils as L, FileLoader as we, TextureLoader as ye, Group as Q, SRGBColorSpace as ve, RepeatWrapping as ne, BufferGeometry as Ke, BufferAttribute as ie, Mesh as F, FrontSide as Xe, BackSide as qe, DoubleSide as Ye, REVISION as re, CubeTextureLoader as Je, EquirectangularReflectionMapping as Ze, Sprite as Ve, AnimationMixer as et, LoopRepeat as tt, LoopOnce as st, SphereGeometry as nt, TubeGeometry as it, LineCurve3 as rt, CatmullRomCurve3 as at, SpriteNodeMaterial as ot, CanvasTexture as ct, ShapeGeometry as ht, Shape as be, ExtrudeGeometry as lt, PlaneGeometry as dt, CircleGeometry as pt } from "three/webgpu";
|
|
2
|
+
import { pass as Z, blendColor as ut, color as U, uv as ae, time as q, pow as Y, sin as oe, mix as J, mx_noise_float as ce, Fn as Te, userData as G, materialColor as he, select as V, materialOpacity as mt, vec3 as gt } from "three/tsl";
|
|
3
3
|
import Ce from "camera-controls";
|
|
4
|
-
import { RoomEnvironment as
|
|
5
|
-
import { ViewHelper as
|
|
4
|
+
import { RoomEnvironment as ft } from "three/addons/environments/RoomEnvironment.js";
|
|
5
|
+
import { ViewHelper as wt } from "three/addons/helpers/ViewHelper.js";
|
|
6
6
|
import { GLTFLoader as xe } from "three/addons/loaders/GLTFLoader.js";
|
|
7
|
-
import { FBXLoader as
|
|
8
|
-
import { OBJLoader as
|
|
9
|
-
import { STLLoader as
|
|
10
|
-
import { DRACOLoader as
|
|
11
|
-
import { KTX2Loader as
|
|
7
|
+
import { FBXLoader as yt } from "three/addons/loaders/FBXLoader.js";
|
|
8
|
+
import { OBJLoader as vt } from "three/addons/loaders/OBJLoader.js";
|
|
9
|
+
import { STLLoader as bt } from "three/addons/loaders/STLLoader.js";
|
|
10
|
+
import { DRACOLoader as Tt } from "three/addons/loaders/DRACOLoader.js";
|
|
11
|
+
import { KTX2Loader as Ct } from "three/addons/loaders/KTX2Loader.js";
|
|
12
12
|
import { MeshoptDecoder as le } from "three/addons/libs/meshopt_decoder.module.js";
|
|
13
|
-
import { HDRLoader as
|
|
14
|
-
import { clone as
|
|
15
|
-
import { Color as
|
|
16
|
-
import { Easing as d, Tween as
|
|
17
|
-
class
|
|
13
|
+
import { HDRLoader as xt } from "three/addons/loaders/HDRLoader.js";
|
|
14
|
+
import { clone as Mt } from "three/addons/utils/SkeletonUtils.js";
|
|
15
|
+
import { Color as D } from "three";
|
|
16
|
+
import { Easing as d, Tween as Et } from "three/addons/libs/tween.module.js";
|
|
17
|
+
class Ot {
|
|
18
18
|
/** The type of event (e.g., 'click', 'pointerdown'). */
|
|
19
19
|
type;
|
|
20
20
|
/** The original 3D object that triggered the event. */
|
|
@@ -42,15 +42,15 @@ class Ct {
|
|
|
42
42
|
return this._propagationStopped;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
class
|
|
45
|
+
class Pt {
|
|
46
46
|
domElement;
|
|
47
47
|
scene;
|
|
48
48
|
camera;
|
|
49
49
|
raycaster = new me();
|
|
50
|
-
pointer = new
|
|
50
|
+
pointer = new S();
|
|
51
51
|
hoveredObject = null;
|
|
52
52
|
pointerDownTime = 0;
|
|
53
|
-
pointerDownPos = new
|
|
53
|
+
pointerDownPos = new S();
|
|
54
54
|
clickTimer = null;
|
|
55
55
|
longPressThreshold = 500;
|
|
56
56
|
moveThreshold = 0.01;
|
|
@@ -86,15 +86,15 @@ class xt {
|
|
|
86
86
|
* Dispatches an event to the target object and bubbles up the parent chain.
|
|
87
87
|
*/
|
|
88
88
|
_dispatchToTarget(e, t, s, n) {
|
|
89
|
-
const i = new
|
|
89
|
+
const i = new Ot({
|
|
90
90
|
type: e,
|
|
91
91
|
target: t,
|
|
92
92
|
intersect: s,
|
|
93
93
|
originalEvent: n
|
|
94
94
|
});
|
|
95
|
-
let
|
|
96
|
-
for (;
|
|
97
|
-
i.currentTarget =
|
|
95
|
+
let r = t;
|
|
96
|
+
for (; r && !i.propagationStopped; )
|
|
97
|
+
i.currentTarget = r, r.dispatchEvent({ type: e, event: i }), r = r.parent;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Handles a DOM event by raycasting and dispatching to the first intersected object.
|
|
@@ -147,7 +147,7 @@ class xt {
|
|
|
147
147
|
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.hoveredObject = null;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
class
|
|
150
|
+
class St {
|
|
151
151
|
idMap = /* @__PURE__ */ new Map();
|
|
152
152
|
nameMap = /* @__PURE__ */ new Map();
|
|
153
153
|
typeMap = /* @__PURE__ */ new Map();
|
|
@@ -250,7 +250,7 @@ class Mt {
|
|
|
250
250
|
return this.allObjects.size;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
class
|
|
253
|
+
class Lt extends Ae {
|
|
254
254
|
scene;
|
|
255
255
|
camera;
|
|
256
256
|
currentOutputNode;
|
|
@@ -258,7 +258,7 @@ class Et extends Be {
|
|
|
258
258
|
#e;
|
|
259
259
|
constructor(...e) {
|
|
260
260
|
const [t, s, n] = e;
|
|
261
|
-
super(t), this.scene = s, this.camera = n, this.currentOutputNode =
|
|
261
|
+
super(t), this.scene = s, this.camera = n, this.currentOutputNode = Z(s, n), this.needsUpdateOutputNode = !0, this.#e = /* @__PURE__ */ new Set();
|
|
262
262
|
}
|
|
263
263
|
addOverlayPass(e) {
|
|
264
264
|
this.#e.add(e), this.needsUpdateOutputNode = !0;
|
|
@@ -273,31 +273,31 @@ class Et extends Be {
|
|
|
273
273
|
this.currentOutputNode.dispose(), this.currentOutputNode = e, this.needsUpdateOutputNode = !0;
|
|
274
274
|
}
|
|
275
275
|
resetCurrentOutputNode() {
|
|
276
|
-
this.currentOutputNode.dispose(), this.currentOutputNode =
|
|
276
|
+
this.currentOutputNode.dispose(), this.currentOutputNode = Z(this.scene, this.camera), this.needsUpdateOutputNode = !0;
|
|
277
277
|
}
|
|
278
278
|
#t() {
|
|
279
279
|
let e = this.currentOutputNode;
|
|
280
280
|
this.#e.size > 0 && this.#e.forEach((t) => {
|
|
281
|
-
e =
|
|
281
|
+
e = ut(e, t);
|
|
282
282
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
283
283
|
}
|
|
284
284
|
render() {
|
|
285
285
|
this.needsUpdateOutputNode && (this.#t(), this.needsUpdateOutputNode = !1), super.render();
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
const
|
|
289
|
-
Vector2:
|
|
290
|
-
Vector3:
|
|
288
|
+
const It = {
|
|
289
|
+
Vector2: S,
|
|
290
|
+
Vector3: ee,
|
|
291
291
|
Vector4: Ne,
|
|
292
292
|
Quaternion: _e,
|
|
293
293
|
Matrix4: Re,
|
|
294
|
-
Spherical:
|
|
295
|
-
Box3:
|
|
294
|
+
Spherical: T,
|
|
295
|
+
Box3: fe,
|
|
296
296
|
Sphere: ge,
|
|
297
297
|
Raycaster: me
|
|
298
298
|
};
|
|
299
|
-
Ce.install({ THREE:
|
|
300
|
-
class
|
|
299
|
+
Ce.install({ THREE: It });
|
|
300
|
+
class Bt extends Ce {
|
|
301
301
|
constructor(...e) {
|
|
302
302
|
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
303
303
|
}
|
|
@@ -305,62 +305,62 @@ class Pt extends Ce {
|
|
|
305
305
|
* Set absolute angle for azimuth to avoid spinning
|
|
306
306
|
*/
|
|
307
307
|
absoluteRotations() {
|
|
308
|
-
this.azimuthAngle =
|
|
308
|
+
this.azimuthAngle = At(this.azimuthAngle, 0);
|
|
309
309
|
}
|
|
310
310
|
async flyToBox(e, t = {}) {
|
|
311
311
|
if (e.isEmpty())
|
|
312
312
|
return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
|
|
313
313
|
this.absoluteRotations();
|
|
314
|
-
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover:
|
|
314
|
+
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, a = [];
|
|
315
315
|
if (s !== "current") {
|
|
316
|
-
const
|
|
317
|
-
|
|
316
|
+
const o = de[s.toUpperCase()] ?? de.FRONTTOP, h = o.theta, l = o.phi;
|
|
317
|
+
a.push(
|
|
318
318
|
this.fitToBox(e, n, {
|
|
319
319
|
paddingLeft: i,
|
|
320
320
|
paddingRight: i,
|
|
321
321
|
paddingTop: i,
|
|
322
322
|
paddingBottom: i,
|
|
323
|
-
cover:
|
|
323
|
+
cover: r
|
|
324
324
|
})
|
|
325
|
-
),
|
|
325
|
+
), a.push(this.rotateTo(h, l, n));
|
|
326
326
|
} else {
|
|
327
|
-
const
|
|
328
|
-
e.getBoundingSphere(
|
|
327
|
+
const o = new ge();
|
|
328
|
+
e.getBoundingSphere(o), o.radius += i, a.push(this.fitToSphere(o, n));
|
|
329
329
|
}
|
|
330
|
-
return await Promise.all(
|
|
330
|
+
return await Promise.all(a), !0;
|
|
331
331
|
}
|
|
332
332
|
async flyToObject(e, t = {}) {
|
|
333
|
-
const s = new
|
|
333
|
+
const s = new fe().setFromObject(e);
|
|
334
334
|
return this.flyToBox(s, t);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
const de = {
|
|
338
|
-
LEFT: new
|
|
339
|
-
RIGHT: new
|
|
340
|
-
FRONT: new
|
|
341
|
-
BACK: new
|
|
342
|
-
TOP: new
|
|
343
|
-
BOTTOM: new
|
|
344
|
-
FRONTTOP: new
|
|
345
|
-
BACKTOP: new
|
|
346
|
-
LEFTTOP: new
|
|
347
|
-
RIGHTTOP: new
|
|
348
|
-
LEFTFRONTTOP: new
|
|
349
|
-
RIGHTFRONTTOP: new
|
|
350
|
-
LEFTBACKTOP: new
|
|
351
|
-
RIGHTBACKTOP: new
|
|
338
|
+
LEFT: new T(0, Math.PI / 2, -Math.PI / 2),
|
|
339
|
+
RIGHT: new T(0, Math.PI / 2, Math.PI / 2),
|
|
340
|
+
FRONT: new T(0, Math.PI / 2, 0),
|
|
341
|
+
BACK: new T(0, Math.PI / 2, Math.PI),
|
|
342
|
+
TOP: new T(0, 0, 0),
|
|
343
|
+
BOTTOM: new T(0, Math.PI, 0),
|
|
344
|
+
FRONTTOP: new T(0, Math.PI / 4, 0),
|
|
345
|
+
BACKTOP: new T(0, Math.PI / 4, Math.PI),
|
|
346
|
+
LEFTTOP: new T(0, Math.PI / 4, -Math.PI / 2),
|
|
347
|
+
RIGHTTOP: new T(0, Math.PI / 4, Math.PI / 2),
|
|
348
|
+
LEFTFRONTTOP: new T(0, Math.PI / 4, -Math.PI / 4),
|
|
349
|
+
RIGHTFRONTTOP: new T(0, Math.PI / 4, Math.PI / 4),
|
|
350
|
+
LEFTBACKTOP: new T(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
351
|
+
RIGHTBACKTOP: new T(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
352
352
|
};
|
|
353
|
-
function
|
|
354
|
-
const t =
|
|
355
|
-
return
|
|
353
|
+
function At(c, e) {
|
|
354
|
+
const t = c - e;
|
|
355
|
+
return Ue.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
356
356
|
}
|
|
357
|
-
class
|
|
358
|
-
environment = new
|
|
357
|
+
class Rt {
|
|
358
|
+
environment = new ft();
|
|
359
359
|
renderer;
|
|
360
360
|
pmremGenerator;
|
|
361
361
|
envMap = null;
|
|
362
362
|
constructor(e) {
|
|
363
|
-
this.renderer = e, this.pmremGenerator = new
|
|
363
|
+
this.renderer = e, this.pmremGenerator = new De(e);
|
|
364
364
|
}
|
|
365
365
|
update() {
|
|
366
366
|
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
@@ -369,20 +369,20 @@ class Lt {
|
|
|
369
369
|
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const
|
|
373
|
-
class
|
|
372
|
+
const z = 128;
|
|
373
|
+
class _t extends wt {
|
|
374
374
|
viewer;
|
|
375
375
|
overlayPass;
|
|
376
376
|
constructor(e) {
|
|
377
377
|
super(e.camera, e.el), this.viewer = e;
|
|
378
|
-
const t = new
|
|
379
|
-
t.position.set(0, 0, 2), this.overlayPass =
|
|
378
|
+
const t = new $(-2, 2, 2, -2, 0, 4);
|
|
379
|
+
t.position.set(0, 0, 2), this.overlayPass = Z(this, t), this.setLabels("x", "y", "z");
|
|
380
380
|
}
|
|
381
381
|
_update = () => {
|
|
382
382
|
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
383
383
|
const e = this.location;
|
|
384
384
|
let t, s;
|
|
385
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth -
|
|
385
|
+
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - z - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - z - e.bottom, this.overlayPass.setViewport(t, s, z, z);
|
|
386
386
|
};
|
|
387
387
|
enable() {
|
|
388
388
|
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
@@ -391,7 +391,7 @@ class It extends ut {
|
|
|
391
391
|
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class Nt {
|
|
395
395
|
el;
|
|
396
396
|
renderer;
|
|
397
397
|
container;
|
|
@@ -406,9 +406,9 @@ class Bt {
|
|
|
406
406
|
this.el = e, this.renderer = t;
|
|
407
407
|
const s = document.createElement("div");
|
|
408
408
|
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;
|
|
409
|
-
function n(
|
|
410
|
-
const
|
|
411
|
-
return
|
|
409
|
+
function n(r, a = !0) {
|
|
410
|
+
const o = document.createElement("span");
|
|
411
|
+
return a && (o.style.marginLeft = "6px"), o.innerText = r, o;
|
|
412
412
|
}
|
|
413
413
|
function i() {
|
|
414
414
|
return document.createElement("br");
|
|
@@ -418,7 +418,7 @@ class Bt {
|
|
|
418
418
|
update() {
|
|
419
419
|
if (this._enabled) {
|
|
420
420
|
const { render: e } = this.renderer.info;
|
|
421
|
-
this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), this.renderer.resolveTimestampsAsync(
|
|
421
|
+
this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), this.renderer.resolveTimestampsAsync(je.RENDER).then((t) => {
|
|
422
422
|
this.timestampText.innerText = t?.toFixed(2) ?? "0";
|
|
423
423
|
});
|
|
424
424
|
}
|
|
@@ -433,8 +433,8 @@ class Bt {
|
|
|
433
433
|
this.disable();
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
|
|
437
|
-
class
|
|
436
|
+
ke.enabled = !0;
|
|
437
|
+
class Cs extends Ge {
|
|
438
438
|
el;
|
|
439
439
|
renderer;
|
|
440
440
|
scene;
|
|
@@ -450,11 +450,11 @@ class ys extends ke {
|
|
|
450
450
|
frameCount = 1;
|
|
451
451
|
frameloop = "demand";
|
|
452
452
|
constructor({ el: e, rendererOptions: t }) {
|
|
453
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new
|
|
453
|
+
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Nt(this.el, this.renderer), this.controls = new Bt(this.camera, this.renderer.domElement), this.renderPipeline = new Lt(this.renderer, this.scene, this.camera), this.timer = new Fe(), this.roomEnvironment = new Rt(this.renderer), this.interactionManager = new Pt(this.renderer.domElement, this.scene, this.camera), this.objectManager = new St(), this.viewerHelper = new _t(this), window.addEventListener("resize", this.onWindowResize);
|
|
454
454
|
}
|
|
455
455
|
onWindowResize = () => {
|
|
456
456
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
457
|
-
this.camera instanceof
|
|
457
|
+
this.camera instanceof X ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof $ && (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.render();
|
|
458
458
|
};
|
|
459
459
|
async init() {
|
|
460
460
|
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
@@ -463,7 +463,7 @@ class ys extends ke {
|
|
|
463
463
|
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
464
464
|
}
|
|
465
465
|
setCameraByType(e) {
|
|
466
|
-
e === "perspective" && !(this.camera instanceof
|
|
466
|
+
e === "perspective" && !(this.camera instanceof X) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof $) && this.setCamera(this.createOrthographicCamera());
|
|
467
467
|
}
|
|
468
468
|
render(e = 1) {
|
|
469
469
|
return this.frameCount += e, new Promise((t) => {
|
|
@@ -474,30 +474,32 @@ class ys extends ke {
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
animate = (e) => {
|
|
477
|
-
this.timer.update(e)
|
|
478
|
-
|
|
479
|
-
this.dispatchEvent({ type: "
|
|
477
|
+
this.timer.update(e);
|
|
478
|
+
const t = this.timer.getDelta();
|
|
479
|
+
this.dispatchEvent({ type: "beforeControlsUpdate", time: e, delta: t });
|
|
480
|
+
let s = this.controls.update(t);
|
|
481
|
+
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.info.update(), this.dispatchEvent({ type: "afterRender", time: e, delta: t }));
|
|
480
482
|
};
|
|
481
483
|
_initRenderer(e) {
|
|
482
|
-
const t = new
|
|
484
|
+
const t = new He({
|
|
483
485
|
logarithmicDepthBuffer: !0,
|
|
484
486
|
antialias: !1,
|
|
485
487
|
depth: !1,
|
|
486
488
|
trackTimestamp: !0,
|
|
487
489
|
...e
|
|
488
490
|
});
|
|
489
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type =
|
|
491
|
+
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = ze, t.toneMapping = $e, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
|
|
490
492
|
}
|
|
491
493
|
createScene() {
|
|
492
|
-
const e = new
|
|
493
|
-
return e.background = new
|
|
494
|
+
const e = new We();
|
|
495
|
+
return e.background = new te(0), e;
|
|
494
496
|
}
|
|
495
497
|
createPerspectiveCamera() {
|
|
496
|
-
const e = new
|
|
498
|
+
const e = new X(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
497
499
|
return e.position.setScalar(5), e;
|
|
498
500
|
}
|
|
499
501
|
createOrthographicCamera() {
|
|
500
|
-
const e = new
|
|
502
|
+
const e = new $(
|
|
501
503
|
-this.el.clientWidth / 2,
|
|
502
504
|
this.el.clientWidth / 2,
|
|
503
505
|
this.el.clientHeight / 2,
|
|
@@ -511,71 +513,71 @@ class ys extends ke {
|
|
|
511
513
|
this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
|
|
512
514
|
}
|
|
513
515
|
}
|
|
514
|
-
class
|
|
516
|
+
class Ut extends xe {
|
|
515
517
|
constructor(e) {
|
|
516
518
|
super(e);
|
|
517
519
|
}
|
|
518
520
|
parse(e, t, s, n) {
|
|
519
|
-
if (
|
|
520
|
-
const
|
|
521
|
-
return super.parse(
|
|
521
|
+
if (Dt(e.slice(0, 8)) === "SBMG----") {
|
|
522
|
+
const r = jt(e.slice(8));
|
|
523
|
+
return super.parse(r, t, s, n);
|
|
522
524
|
} else
|
|
523
525
|
return super.parse(e, t, s, n);
|
|
524
526
|
}
|
|
525
527
|
}
|
|
526
|
-
function
|
|
527
|
-
return new TextDecoder().decode(new Uint8Array(
|
|
528
|
+
function Dt(c) {
|
|
529
|
+
return new TextDecoder().decode(new Uint8Array(c));
|
|
528
530
|
}
|
|
529
|
-
function
|
|
530
|
-
const e = new DataView(
|
|
531
|
+
function jt(c) {
|
|
532
|
+
const e = new DataView(c);
|
|
531
533
|
for (let t = 0; t < e.byteLength; t++) {
|
|
532
534
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
533
535
|
e.setUint8(t, n);
|
|
534
536
|
}
|
|
535
537
|
return e.buffer;
|
|
536
538
|
}
|
|
537
|
-
const
|
|
538
|
-
function
|
|
539
|
-
let e =
|
|
540
|
-
const t = new Uint8Array(
|
|
541
|
-
if (Me.decode(t) !==
|
|
542
|
-
return
|
|
543
|
-
e +=
|
|
544
|
-
const n = new Uint8Array(
|
|
539
|
+
const kt = 8, Gt = 130, pe = 66, Ft = "SBK-----", Ht = "SBM-----", Me = new TextDecoder(), zt = new TextEncoder();
|
|
540
|
+
function $t(c) {
|
|
541
|
+
let e = kt;
|
|
542
|
+
const t = new Uint8Array(c, 0, e);
|
|
543
|
+
if (Me.decode(t) !== Ft)
|
|
544
|
+
return c;
|
|
545
|
+
e += Gt;
|
|
546
|
+
const n = new Uint8Array(c, 0, e);
|
|
545
547
|
if (n[40] === 1) {
|
|
546
|
-
const
|
|
548
|
+
const r = zt.encode(Ht), a = new Uint8Array([n[41]]), o = Wt(n), h = Qt(o);
|
|
547
549
|
let l = pe % h.length;
|
|
548
|
-
const
|
|
549
|
-
for (let
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
return
|
|
550
|
+
const p = e + pe, g = new Uint8Array(c, p), u = new Uint8Array(g.length);
|
|
551
|
+
for (let v = 0; v < g.length; v++)
|
|
552
|
+
u[v] = g[v] ^ h[l], l = (l + 1) % h.length;
|
|
553
|
+
const w = new Uint8Array(r.length + a.length + u.length);
|
|
554
|
+
return w.set(r), w.set(a, r.length), w.set(u, r.length + a.length), w.buffer;
|
|
553
555
|
}
|
|
554
556
|
}
|
|
555
|
-
function
|
|
557
|
+
function Wt(c) {
|
|
556
558
|
const e = new Uint8Array(128);
|
|
557
|
-
return e.set(
|
|
559
|
+
return e.set(c.slice(42, 74), 0), e.set(c.slice(74, 138), 32), e.set(c.slice(8, 40), 96), e;
|
|
558
560
|
}
|
|
559
|
-
function
|
|
561
|
+
function Qt(c) {
|
|
560
562
|
const e = new Uint8Array(64);
|
|
561
|
-
return e.set(
|
|
563
|
+
return e.set(c.slice(0, 8), 0), e.set(c.slice(24, 32), 8), e.set(c.slice(40, 56), 16), e.set(c.slice(64, 88), 32), e.set(c.slice(96, 104), 56), e;
|
|
562
564
|
}
|
|
563
|
-
const
|
|
564
|
-
const s =
|
|
565
|
+
const Kt = (c, e, t) => {
|
|
566
|
+
const s = c.buffer.slice(t, t + e);
|
|
565
567
|
let n = Me.decode(s);
|
|
566
568
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
567
|
-
},
|
|
568
|
-
const [s, n, i,
|
|
569
|
+
}, Xt = (c, e, t) => {
|
|
570
|
+
const [s, n, i, r, a] = e, o = t || r < 1;
|
|
569
571
|
return new I({
|
|
570
|
-
name:
|
|
571
|
-
color: new
|
|
572
|
-
opacity:
|
|
573
|
-
transparent:
|
|
572
|
+
name: c,
|
|
573
|
+
color: new te(s, n, i),
|
|
574
|
+
opacity: r,
|
|
575
|
+
transparent: o,
|
|
574
576
|
alphaTest: 0.01,
|
|
575
|
-
side:
|
|
577
|
+
side: a
|
|
576
578
|
});
|
|
577
|
-
},
|
|
578
|
-
class
|
|
579
|
+
}, qt = (c) => c?.toLowerCase().endsWith(".png") ?? !1;
|
|
580
|
+
class Yt {
|
|
579
581
|
data;
|
|
580
582
|
options;
|
|
581
583
|
textureLoader;
|
|
@@ -586,127 +588,127 @@ class Qt {
|
|
|
586
588
|
}
|
|
587
589
|
parse(e, t) {
|
|
588
590
|
let s = this.data;
|
|
589
|
-
const n =
|
|
591
|
+
const n = $t(this.data);
|
|
590
592
|
n && (s = n);
|
|
591
593
|
const i = new DataView(s);
|
|
592
|
-
let
|
|
593
|
-
const
|
|
594
|
-
|
|
594
|
+
let r = 8;
|
|
595
|
+
const a = i.getUint8(r);
|
|
596
|
+
r += 1, a === 1 ? this._parseV2(i, r, e) : a === 2 ? this._parseV2(i, r, e) : a === 3 ? this._parseV3(i, r, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${a}`));
|
|
595
597
|
}
|
|
596
598
|
_parseV2(e, t, s) {
|
|
597
|
-
const n = new
|
|
599
|
+
const n = new Q(), i = e.getUint16(t, this.littleEndian);
|
|
598
600
|
t += 2;
|
|
599
|
-
const
|
|
601
|
+
const r = e.getUint16(t, this.littleEndian);
|
|
600
602
|
t += 2;
|
|
601
|
-
for (let
|
|
602
|
-
const
|
|
603
|
+
for (let a = 0; a < i; ++a) {
|
|
604
|
+
const o = e.getUint16(t, this.littleEndian).toString();
|
|
603
605
|
t += 2, t += 4, t += 4, t += 4, t += 4;
|
|
604
606
|
const h = e.getFloat32(t, this.littleEndian);
|
|
605
607
|
t += 4;
|
|
606
608
|
const l = e.getFloat32(t, this.littleEndian);
|
|
607
609
|
t += 4;
|
|
608
|
-
const
|
|
610
|
+
const p = e.getFloat32(t, this.littleEndian);
|
|
609
611
|
t += 4;
|
|
610
|
-
const
|
|
612
|
+
const g = e.getFloat32(t, this.littleEndian);
|
|
611
613
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
612
|
-
let
|
|
613
|
-
t += 1,
|
|
614
|
-
const
|
|
614
|
+
let u = e.getUint8(t);
|
|
615
|
+
t += 1, u === 0 ? u = Xe : u === 1 ? u = qe : u === 2 && (u = Ye);
|
|
616
|
+
const w = e.getUint16(t, this.littleEndian);
|
|
615
617
|
t += 2;
|
|
616
|
-
const
|
|
617
|
-
if (t +=
|
|
618
|
-
const
|
|
619
|
-
this.materials.set(
|
|
620
|
-
|
|
618
|
+
const v = w > 0 ? Kt(e, w, t) : "";
|
|
619
|
+
if (t += w, !this.materials.has(o)) {
|
|
620
|
+
const b = Xt(o, [h, l, p, g, u], qt(v));
|
|
621
|
+
this.materials.set(o, b), v && this.options.path && this.textureLoader.load(L.resolveURL(v, this.options.path), (f) => {
|
|
622
|
+
f.colorSpace = ve, f.wrapS = ne, f.wrapT = ne, f.flipY = !1, f.anisotropy = 16, b.map = f;
|
|
621
623
|
});
|
|
622
624
|
}
|
|
623
625
|
}
|
|
624
|
-
for (let
|
|
625
|
-
const
|
|
626
|
+
for (let a = 0; a < r; ++a) {
|
|
627
|
+
const o = e.getUint16(t, this.littleEndian).toString();
|
|
626
628
|
t += 2;
|
|
627
629
|
const h = e.getUint16(t, this.littleEndian).toString();
|
|
628
630
|
t += 2;
|
|
629
|
-
const l = [],
|
|
630
|
-
if (t += 2, g > 0)
|
|
631
|
-
for (let m = 0; m < g; m++) {
|
|
632
|
-
const y = new J();
|
|
633
|
-
y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, y.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(y);
|
|
634
|
-
}
|
|
635
|
-
const w = e.getUint16(t, this.littleEndian);
|
|
631
|
+
const l = [], p = [], g = [], u = [], w = e.getUint16(t, this.littleEndian);
|
|
636
632
|
if (t += 2, w > 0)
|
|
637
|
-
for (let m = 0; m < w; m++)
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
if (t += 2, T > 0)
|
|
641
|
-
for (let m = 0; m < T; m++) {
|
|
642
|
-
const y = new P();
|
|
643
|
-
y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, u.push(y);
|
|
633
|
+
for (let m = 0; m < w; m++) {
|
|
634
|
+
const y = new ee();
|
|
635
|
+
y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, y.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(y);
|
|
644
636
|
}
|
|
645
637
|
const v = e.getUint16(t, this.littleEndian);
|
|
646
638
|
if (t += 2, v > 0)
|
|
647
|
-
for (let m = 0; m < v; m++)
|
|
639
|
+
for (let m = 0; m < v; m++)
|
|
640
|
+
t += 4, t += 4, t += 4;
|
|
641
|
+
const x = e.getUint16(t, this.littleEndian);
|
|
642
|
+
if (t += 2, x > 0)
|
|
643
|
+
for (let m = 0; m < x; m++) {
|
|
644
|
+
const y = new S();
|
|
645
|
+
y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, p.push(y);
|
|
646
|
+
}
|
|
647
|
+
const b = e.getUint16(t, this.littleEndian);
|
|
648
|
+
if (t += 2, b > 0)
|
|
649
|
+
for (let m = 0; m < b; m++) {
|
|
648
650
|
const y = e.getUint16(t, this.littleEndian);
|
|
649
651
|
t += 2;
|
|
650
652
|
const B = e.getUint16(t, this.littleEndian);
|
|
651
653
|
t += 2;
|
|
652
|
-
const
|
|
654
|
+
const A = e.getUint16(t, this.littleEndian);
|
|
653
655
|
t += 2;
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
+
const E = [y, B, A];
|
|
657
|
+
g.push(E), p.length > 0 && u.push([p[E[0]], p[E[1]], p[E[2]]]);
|
|
656
658
|
}
|
|
657
|
-
const
|
|
658
|
-
for (let m = 0; m <
|
|
659
|
-
const y =
|
|
660
|
-
|
|
661
|
-
let
|
|
662
|
-
const
|
|
663
|
-
|
|
659
|
+
const f = [], C = [];
|
|
660
|
+
for (let m = 0; m < g.length; m++) {
|
|
661
|
+
const y = g[m], B = l[y[0]], A = l[y[1]], E = l[y[2]];
|
|
662
|
+
f.push(...B.toArray(), ...A.toArray(), ...E.toArray());
|
|
663
|
+
let H = new S(), k = new S(), _ = new S();
|
|
664
|
+
const N = u[m];
|
|
665
|
+
N !== void 0 && (H = N[0], k = N[1], _ = N[2]), C.push(...H.toArray(), ...k.toArray(), ..._.toArray());
|
|
664
666
|
}
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
const m = new
|
|
668
|
-
m.name =
|
|
667
|
+
const O = new Float32Array(f), P = new Float32Array(C), M = new Ke();
|
|
668
|
+
if (O.length > 0 && M.setAttribute("position", new ie(O, 3)), P.length > 0 && M.setAttribute("uv", new ie(P, 2)), M.computeVertexNormals(), this.materials.has(h)) {
|
|
669
|
+
const m = new F(M, this.materials.get(h));
|
|
670
|
+
m.name = o, m.castShadow = !0, m.receiveShadow = !0, n.add(m);
|
|
669
671
|
}
|
|
670
672
|
}
|
|
671
673
|
s(n);
|
|
672
674
|
}
|
|
673
675
|
_parseV3(e, t, s) {
|
|
674
|
-
const n = new
|
|
676
|
+
const n = new Q();
|
|
675
677
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
676
678
|
}
|
|
677
679
|
}
|
|
678
|
-
class
|
|
680
|
+
class Jt extends Qe {
|
|
679
681
|
load(e, t, s, n) {
|
|
680
682
|
let i;
|
|
681
683
|
if (this.resourcePath !== "")
|
|
682
684
|
i = this.resourcePath;
|
|
683
685
|
else if (this.path !== "") {
|
|
684
|
-
const
|
|
685
|
-
i = L.resolveURL(
|
|
686
|
+
const o = L.extractUrlBase(e);
|
|
687
|
+
i = L.resolveURL(o, this.path);
|
|
686
688
|
} else
|
|
687
689
|
i = L.extractUrlBase(e);
|
|
688
690
|
this.manager.itemStart(e);
|
|
689
|
-
const
|
|
690
|
-
n ? n(
|
|
691
|
-
},
|
|
692
|
-
|
|
691
|
+
const r = (o) => {
|
|
692
|
+
n ? n(o) : console.error(o), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
693
|
+
}, a = new we(this.manager);
|
|
694
|
+
a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(
|
|
693
695
|
e,
|
|
694
|
-
(
|
|
696
|
+
(o) => {
|
|
695
697
|
try {
|
|
696
698
|
this.parse(
|
|
697
|
-
|
|
699
|
+
o,
|
|
698
700
|
i,
|
|
699
701
|
(h) => {
|
|
700
702
|
t(h), this.manager.itemEnd(e);
|
|
701
703
|
},
|
|
702
|
-
|
|
704
|
+
r
|
|
703
705
|
);
|
|
704
706
|
} catch (h) {
|
|
705
|
-
|
|
707
|
+
r(h);
|
|
706
708
|
}
|
|
707
709
|
},
|
|
708
710
|
s,
|
|
709
|
-
|
|
711
|
+
r
|
|
710
712
|
);
|
|
711
713
|
}
|
|
712
714
|
parse(e, t, s, n) {
|
|
@@ -715,7 +717,7 @@ class Kt extends We {
|
|
|
715
717
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
716
718
|
return;
|
|
717
719
|
}
|
|
718
|
-
new
|
|
720
|
+
new Yt(e, {
|
|
719
721
|
path: t,
|
|
720
722
|
crossOrigin: this.crossOrigin,
|
|
721
723
|
requestHeader: this.requestHeader,
|
|
@@ -739,19 +741,19 @@ class Kt extends We {
|
|
|
739
741
|
}
|
|
740
742
|
class R {
|
|
741
743
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
742
|
-
static fileLoader = new
|
|
743
|
-
static dracoLoader = new
|
|
744
|
+
static fileLoader = new we().setResponseType("arraybuffer");
|
|
745
|
+
static dracoLoader = new Tt().setDecoderPath(
|
|
744
746
|
`https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/draco/`
|
|
745
747
|
);
|
|
746
|
-
static ktx2Loader = new
|
|
748
|
+
static ktx2Loader = new Ct().setTranscoderPath(
|
|
747
749
|
`https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/basis/`
|
|
748
750
|
);
|
|
749
751
|
static gltfLoader = new xe().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
|
|
750
|
-
static sbmxLoader = new
|
|
751
|
-
static sbmLoader = new
|
|
752
|
-
static fbxLoader = new
|
|
753
|
-
static objLoader = new
|
|
754
|
-
static stlLoader = new
|
|
752
|
+
static sbmxLoader = new Ut().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
|
|
753
|
+
static sbmLoader = new Jt();
|
|
754
|
+
static fbxLoader = new yt();
|
|
755
|
+
static objLoader = new vt();
|
|
756
|
+
static stlLoader = new bt();
|
|
755
757
|
static setLoadingManager(e) {
|
|
756
758
|
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;
|
|
757
759
|
}
|
|
@@ -779,9 +781,11 @@ class R {
|
|
|
779
781
|
switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
|
|
780
782
|
case "gltf":
|
|
781
783
|
case "glb":
|
|
782
|
-
|
|
784
|
+
const i = await this.gltfLoader.parseAsync(n, L.extractUrlBase(e));
|
|
785
|
+
return i.scene.animations = i.animations, i.scene;
|
|
783
786
|
case "sbmx":
|
|
784
|
-
|
|
787
|
+
const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
|
|
788
|
+
return r.scene.animations = r.animations, r.scene;
|
|
785
789
|
case "sbm":
|
|
786
790
|
return await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
|
|
787
791
|
case "fbx":
|
|
@@ -790,8 +794,8 @@ class R {
|
|
|
790
794
|
const h = new TextDecoder().decode(n);
|
|
791
795
|
return this.objLoader.parse(h);
|
|
792
796
|
case "stl":
|
|
793
|
-
const
|
|
794
|
-
return new
|
|
797
|
+
const p = this.stlLoader.parse(n);
|
|
798
|
+
return new F(p, new I());
|
|
795
799
|
default:
|
|
796
800
|
throw new Error(`Unsupported model format: ${s}`);
|
|
797
801
|
}
|
|
@@ -808,10 +812,10 @@ class R {
|
|
|
808
812
|
}
|
|
809
813
|
}
|
|
810
814
|
}
|
|
811
|
-
class
|
|
815
|
+
class xs {
|
|
812
816
|
static textureLoader = new ye();
|
|
813
|
-
static hdrLoader = new
|
|
814
|
-
static cubeTextureLoader = new
|
|
817
|
+
static hdrLoader = new xt();
|
|
818
|
+
static cubeTextureLoader = new Je();
|
|
815
819
|
static setLoadingManager(e) {
|
|
816
820
|
this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
|
|
817
821
|
}
|
|
@@ -820,13 +824,13 @@ class vs {
|
|
|
820
824
|
}
|
|
821
825
|
static async loadAsyncHDR(e) {
|
|
822
826
|
const t = await this.hdrLoader.loadAsync(e);
|
|
823
|
-
return t.mapping =
|
|
827
|
+
return t.mapping = Ze, t;
|
|
824
828
|
}
|
|
825
829
|
static async loadAsyncCubeTexture(e, t) {
|
|
826
830
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
827
831
|
}
|
|
828
832
|
}
|
|
829
|
-
class
|
|
833
|
+
class j extends F {
|
|
830
834
|
isBaseMesh = !0;
|
|
831
835
|
type = "BaseMesh";
|
|
832
836
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -837,7 +841,7 @@ class U extends j {
|
|
|
837
841
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
838
842
|
}
|
|
839
843
|
}
|
|
840
|
-
class Ee extends
|
|
844
|
+
class Ee extends Q {
|
|
841
845
|
isBaseGroup = !0;
|
|
842
846
|
type = "BaseGroup";
|
|
843
847
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -848,7 +852,7 @@ class Ee extends z {
|
|
|
848
852
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
849
853
|
}
|
|
850
854
|
}
|
|
851
|
-
class
|
|
855
|
+
class Zt extends Ve {
|
|
852
856
|
isBaseSprite = !0;
|
|
853
857
|
type = "BaseSprite";
|
|
854
858
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -859,10 +863,13 @@ class Xt extends Ze {
|
|
|
859
863
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
860
864
|
}
|
|
861
865
|
}
|
|
862
|
-
class
|
|
866
|
+
class W extends Ee {
|
|
863
867
|
isModel = !0;
|
|
864
868
|
type = "Model";
|
|
865
869
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
870
|
+
mixer = null;
|
|
871
|
+
animations = [];
|
|
872
|
+
actions = /* @__PURE__ */ new Map();
|
|
866
873
|
constructor() {
|
|
867
874
|
super();
|
|
868
875
|
}
|
|
@@ -870,13 +877,37 @@ class H extends Ee {
|
|
|
870
877
|
const { url: t, cache: s = !0, persistent: n = !0 } = e;
|
|
871
878
|
try {
|
|
872
879
|
let i;
|
|
873
|
-
s ?
|
|
874
|
-
const
|
|
875
|
-
return this.add(
|
|
880
|
+
s ? W.memoryCache.has(t) ? i = W.memoryCache.get(t) : (i = R.loadAsync(t, { persistent: n }), W.memoryCache.set(t, i)) : i = R.loadAsync(t, { persistent: n });
|
|
881
|
+
const r = await i, a = Mt(r);
|
|
882
|
+
return this.add(a), a.animations && a.animations.length > 0 && (this.animations = a.animations, this.mixer = new et(a)), a;
|
|
876
883
|
} catch (i) {
|
|
877
884
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
878
885
|
}
|
|
879
886
|
}
|
|
887
|
+
playAnimation(e, t = {}) {
|
|
888
|
+
if (!this.mixer || this.animations.length === 0) return null;
|
|
889
|
+
const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished: r = !1 } = t;
|
|
890
|
+
let a;
|
|
891
|
+
if (e === void 0 ? a = this.animations[0] : typeof e == "number" ? a = this.animations[e] : a = this.animations.find((h) => h.name === e), !a)
|
|
892
|
+
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
893
|
+
let o = this.actions.get(a.name);
|
|
894
|
+
return o || (o = this.mixer.clipAction(a), this.actions.set(a.name, o)), o.setLoop(s ? tt : st, n), o.clampWhenFinished = r, o.timeScale = i, o.reset().play(), o;
|
|
895
|
+
}
|
|
896
|
+
playAllAnimations(e = {}) {
|
|
897
|
+
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
898
|
+
}
|
|
899
|
+
stopAnimation(e) {
|
|
900
|
+
if (!this.mixer) return;
|
|
901
|
+
if (e === void 0) {
|
|
902
|
+
this.mixer.stopAllAction();
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
let t;
|
|
906
|
+
typeof e == "number" ? t = this.animations[e]?.name : t = e, t && this.actions.get(t)?.stop();
|
|
907
|
+
}
|
|
908
|
+
updateAnimation(e) {
|
|
909
|
+
this.mixer?.update(e);
|
|
910
|
+
}
|
|
880
911
|
static clearMemoryCache() {
|
|
881
912
|
this.memoryCache.clear();
|
|
882
913
|
}
|
|
@@ -884,11 +915,11 @@ class H extends Ee {
|
|
|
884
915
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
885
916
|
}
|
|
886
917
|
}
|
|
887
|
-
class
|
|
918
|
+
class Vt extends j {
|
|
888
919
|
isSphereMesh = !0;
|
|
889
920
|
type = "SphereMesh";
|
|
890
921
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
891
|
-
super(), this.geometry = new
|
|
922
|
+
super(), this.geometry = new nt(
|
|
892
923
|
e?.radius,
|
|
893
924
|
e?.widthSegments,
|
|
894
925
|
e?.heightSegments,
|
|
@@ -899,11 +930,11 @@ class qt extends U {
|
|
|
899
930
|
), this.material = new I(t);
|
|
900
931
|
}
|
|
901
932
|
}
|
|
902
|
-
class ue extends
|
|
933
|
+
class ue extends j {
|
|
903
934
|
isTubeMesh = !0;
|
|
904
935
|
type = "TubeMesh";
|
|
905
936
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
906
|
-
super(), this.geometry = new
|
|
937
|
+
super(), this.geometry = new it(
|
|
907
938
|
e?.path,
|
|
908
939
|
e?.tubularSegments,
|
|
909
940
|
e?.radius,
|
|
@@ -912,7 +943,7 @@ class ue extends U {
|
|
|
912
943
|
), this.material = new I(t);
|
|
913
944
|
}
|
|
914
945
|
}
|
|
915
|
-
class
|
|
946
|
+
class Ms extends Ee {
|
|
916
947
|
isTopology = !0;
|
|
917
948
|
type = "Topology";
|
|
918
949
|
// Visuals
|
|
@@ -958,13 +989,13 @@ class bs extends Ee {
|
|
|
958
989
|
* @param bidirectional If true, adds the reverse edge as well. Default true.
|
|
959
990
|
*/
|
|
960
991
|
addEdge(e, t, s, n = !0) {
|
|
961
|
-
const i = this.nodes.get(e),
|
|
962
|
-
if (!i || !
|
|
992
|
+
const i = this.nodes.get(e), r = this.nodes.get(t);
|
|
993
|
+
if (!i || !r) {
|
|
963
994
|
console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
|
|
964
995
|
return;
|
|
965
996
|
}
|
|
966
|
-
const
|
|
967
|
-
this.getNeighbors(e)?.set(t,
|
|
997
|
+
const a = s ?? i.distanceTo(r);
|
|
998
|
+
this.getNeighbors(e)?.set(t, a), n && this.getNeighbors(t)?.set(e, a);
|
|
968
999
|
}
|
|
969
1000
|
/**
|
|
970
1001
|
* Remove an edge between two nodes.
|
|
@@ -982,41 +1013,41 @@ class bs extends Ee {
|
|
|
982
1013
|
if (!this.nodes.has(e) || !this.nodes.has(t))
|
|
983
1014
|
return console.warn("[Topology] Start or End node not found."), [];
|
|
984
1015
|
const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
985
|
-
for (const [
|
|
986
|
-
s.set(
|
|
1016
|
+
for (const [o] of this.nodes)
|
|
1017
|
+
s.set(o, 1 / 0), n.set(o, null), i.add(o);
|
|
987
1018
|
for (s.set(e, 0); i.size > 0; ) {
|
|
988
|
-
let
|
|
989
|
-
for (const
|
|
990
|
-
const
|
|
991
|
-
|
|
1019
|
+
let o = null, h = 1 / 0;
|
|
1020
|
+
for (const p of i) {
|
|
1021
|
+
const g = s.get(p);
|
|
1022
|
+
g < h && (h = g, o = p);
|
|
992
1023
|
}
|
|
993
|
-
if (
|
|
1024
|
+
if (o === null || o === t || h === 1 / 0)
|
|
994
1025
|
break;
|
|
995
|
-
i.delete(
|
|
996
|
-
const l = this.adjacencyMap?.get(
|
|
1026
|
+
i.delete(o);
|
|
1027
|
+
const l = this.adjacencyMap?.get(o);
|
|
997
1028
|
if (l)
|
|
998
|
-
for (const [
|
|
999
|
-
if (!i.has(
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1029
|
+
for (const [p, g] of l) {
|
|
1030
|
+
if (!i.has(p)) continue;
|
|
1031
|
+
const u = s.get(o) + g;
|
|
1032
|
+
u < s.get(p) && (s.set(p, u), n.set(p, o));
|
|
1002
1033
|
}
|
|
1003
1034
|
}
|
|
1004
|
-
const
|
|
1005
|
-
let
|
|
1035
|
+
const r = [];
|
|
1036
|
+
let a = t;
|
|
1006
1037
|
if (n.get(t) === null && e !== t)
|
|
1007
1038
|
return [];
|
|
1008
|
-
for (;
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1039
|
+
for (; a !== null; ) {
|
|
1040
|
+
const o = this.nodes.get(a);
|
|
1041
|
+
o && r.unshift(o), a = n.get(a) || null;
|
|
1011
1042
|
}
|
|
1012
|
-
return
|
|
1043
|
+
return r;
|
|
1013
1044
|
}
|
|
1014
1045
|
/**
|
|
1015
1046
|
* Renders the entire topology graph structure using TubeGeometry and Spheres.
|
|
1016
1047
|
*/
|
|
1017
1048
|
renderGraph() {
|
|
1018
|
-
this.clearGraph(), this.graphGroup = new
|
|
1019
|
-
const e = new
|
|
1049
|
+
this.clearGraph(), this.graphGroup = new Q();
|
|
1050
|
+
const e = new Vt({
|
|
1020
1051
|
geometryParameters: {
|
|
1021
1052
|
radius: this.parameters.nodeRadius,
|
|
1022
1053
|
widthSegments: 16,
|
|
@@ -1032,13 +1063,13 @@ class bs extends Ee {
|
|
|
1032
1063
|
});
|
|
1033
1064
|
const t = /* @__PURE__ */ new Set();
|
|
1034
1065
|
this.adjacencyMap.forEach((s, n) => {
|
|
1035
|
-
s.forEach((i,
|
|
1036
|
-
const
|
|
1037
|
-
if (t.has(
|
|
1038
|
-
t.add(
|
|
1039
|
-
const
|
|
1040
|
-
if (
|
|
1041
|
-
const l = new
|
|
1066
|
+
s.forEach((i, r) => {
|
|
1067
|
+
const a = [n, r].sort().join("-");
|
|
1068
|
+
if (t.has(a)) return;
|
|
1069
|
+
t.add(a);
|
|
1070
|
+
const o = this.nodes.get(n), h = this.nodes.get(r);
|
|
1071
|
+
if (o && h) {
|
|
1072
|
+
const l = new rt(o, h), p = new ue({
|
|
1042
1073
|
geometryParameters: {
|
|
1043
1074
|
path: l,
|
|
1044
1075
|
tubularSegments: 1,
|
|
@@ -1050,14 +1081,14 @@ class bs extends Ee {
|
|
|
1050
1081
|
color: this.parameters.edgeColor
|
|
1051
1082
|
}
|
|
1052
1083
|
});
|
|
1053
|
-
Object.assign(
|
|
1084
|
+
Object.assign(p.userData, { from: n, to: r, weight: i, type: "edge" }), this.graphGroup.add(p);
|
|
1054
1085
|
}
|
|
1055
1086
|
});
|
|
1056
1087
|
}), this.add(this.graphGroup);
|
|
1057
1088
|
}
|
|
1058
1089
|
clearGraph() {
|
|
1059
1090
|
this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
|
|
1060
|
-
e instanceof
|
|
1091
|
+
e instanceof F && (e.geometry.dispose(), e.material.dispose());
|
|
1061
1092
|
}), this.graphGroup = null);
|
|
1062
1093
|
}
|
|
1063
1094
|
/**
|
|
@@ -1065,7 +1096,7 @@ class bs extends Ee {
|
|
|
1065
1096
|
*/
|
|
1066
1097
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1067
1098
|
if (e.length < 2) return;
|
|
1068
|
-
const s = new
|
|
1099
|
+
const s = new at(e, !1, "catmullrom", 0), n = new ue({
|
|
1069
1100
|
geometryParameters: {
|
|
1070
1101
|
path: s,
|
|
1071
1102
|
tubularSegments: e.length * 10,
|
|
@@ -1091,9 +1122,9 @@ class bs extends Ee {
|
|
|
1091
1122
|
});
|
|
1092
1123
|
const t = [], s = /* @__PURE__ */ new Set();
|
|
1093
1124
|
return this.adjacencyMap.forEach((n, i) => {
|
|
1094
|
-
n.forEach((
|
|
1095
|
-
const
|
|
1096
|
-
s.has(
|
|
1125
|
+
n.forEach((r, a) => {
|
|
1126
|
+
const o = [i, a].sort().join("-");
|
|
1127
|
+
s.has(o) || (s.add(o), t.push({ from: i, to: a, weight: r }));
|
|
1097
1128
|
});
|
|
1098
1129
|
}), { nodes: e, edges: t };
|
|
1099
1130
|
}
|
|
@@ -1103,7 +1134,7 @@ class bs extends Ee {
|
|
|
1103
1134
|
*/
|
|
1104
1135
|
importData(e) {
|
|
1105
1136
|
this.clearGraph(), this.clearPaths(), this.nodes.clear(), this.adjacencyMap.clear(), Object.entries(e.nodes).forEach(([t, s]) => {
|
|
1106
|
-
this.addNode(t, new
|
|
1137
|
+
this.addNode(t, new ee(s.x, s.y, s.z));
|
|
1107
1138
|
}), e.edges.forEach(({ from: t, to: s, weight: n }) => {
|
|
1108
1139
|
this.addEdge(t, s, n);
|
|
1109
1140
|
}), this.renderGraph();
|
|
@@ -1115,7 +1146,7 @@ class bs extends Ee {
|
|
|
1115
1146
|
return this.adjacencyMap.get(e);
|
|
1116
1147
|
}
|
|
1117
1148
|
}
|
|
1118
|
-
class
|
|
1149
|
+
class Es extends Zt {
|
|
1119
1150
|
isPoi = !0;
|
|
1120
1151
|
type = "Poi";
|
|
1121
1152
|
parameters = {
|
|
@@ -1126,12 +1157,15 @@ class Ts extends Xt {
|
|
|
1126
1157
|
color: "#ffffff",
|
|
1127
1158
|
iconSize: 64,
|
|
1128
1159
|
padding: 10,
|
|
1129
|
-
backgroundColor: "rgba(0, 0, 0, 0
|
|
1160
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1130
1161
|
borderRadius: 8,
|
|
1131
|
-
textPosition: "right"
|
|
1162
|
+
textPosition: "right",
|
|
1163
|
+
scaleFactor: 0.01
|
|
1132
1164
|
};
|
|
1165
|
+
_canvas = document.createElement("canvas");
|
|
1166
|
+
_lastParametersJSON = "";
|
|
1133
1167
|
constructor(e = {}) {
|
|
1134
|
-
super(new
|
|
1168
|
+
super(new ot()), Object.assign(this.parameters, e), this.updateAsync();
|
|
1135
1169
|
}
|
|
1136
1170
|
/**
|
|
1137
1171
|
* Update the POI with new parameters
|
|
@@ -1139,90 +1173,95 @@ class Ts extends Xt {
|
|
|
1139
1173
|
*/
|
|
1140
1174
|
async updateAsync(e = {}) {
|
|
1141
1175
|
Object.assign(this.parameters, e);
|
|
1142
|
-
const t =
|
|
1143
|
-
if (
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
let
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1176
|
+
const t = JSON.stringify(this.parameters);
|
|
1177
|
+
if (t === this._lastParametersJSON) return;
|
|
1178
|
+
this._lastParametersJSON = t;
|
|
1179
|
+
const s = this._canvas, n = s.getContext("2d");
|
|
1180
|
+
if (!n) return;
|
|
1181
|
+
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
1182
|
+
let i = null;
|
|
1183
|
+
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
1184
|
+
const { text: r, fontSize: a, color: o, iconSize: h, padding: l, backgroundColor: p, borderRadius: g, textPosition: u, scaleFactor: w } = this.parameters, v = n.measureText(r), x = r ? v.width : 0, b = r ? a : 0;
|
|
1185
|
+
let f = 0, C = 0, O = 0, P = 0, M = 0, m = 0;
|
|
1186
|
+
const y = !!i, B = !!r;
|
|
1187
|
+
if (y && B)
|
|
1188
|
+
switch (u) {
|
|
1152
1189
|
case "top":
|
|
1153
|
-
|
|
1190
|
+
f = Math.max(h, x), C = h + l + b, M = (f - x) / 2, m = b / 2, O = (f - h) / 2, P = b + l;
|
|
1154
1191
|
break;
|
|
1155
1192
|
case "bottom":
|
|
1156
|
-
|
|
1193
|
+
f = Math.max(h, x), C = h + l + b, O = (f - h) / 2, P = 0, M = (f - x) / 2, m = h + l + b / 2;
|
|
1157
1194
|
break;
|
|
1158
1195
|
case "left":
|
|
1159
|
-
|
|
1196
|
+
f = h + l + x, C = Math.max(h, b), M = 0, m = C / 2, O = x + l, P = (C - h) / 2;
|
|
1160
1197
|
break;
|
|
1161
1198
|
default:
|
|
1162
|
-
|
|
1199
|
+
f = h + l + x, C = Math.max(h, b), O = 0, P = (C - h) / 2, M = h + l, m = C / 2;
|
|
1163
1200
|
break;
|
|
1164
1201
|
}
|
|
1165
|
-
else
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1202
|
+
else y ? (f = h, C = h, O = 0, P = 0) : B && (f = x, C = b, M = 0, m = b / 2);
|
|
1203
|
+
const A = f + l * 2, E = C + l * 2;
|
|
1204
|
+
if (s.width = A, s.height = E, n.font = `${a}px ${this.parameters.fontFamily}`, p && (n.fillStyle = p, this._drawRoundedRect(n, 0, 0, A, E, g), n.fill()), y && n.drawImage(i, O + l, P + l, h, h), B) {
|
|
1205
|
+
n.fillStyle = o;
|
|
1206
|
+
const _ = n.measureText(r), N = _.actualBoundingBoxAscent + _.actualBoundingBoxDescent, Be = _.actualBoundingBoxAscent - N / 2;
|
|
1207
|
+
n.textBaseline = "alphabetic", n.fillText(r, M + l, m + l + Be);
|
|
1208
|
+
}
|
|
1209
|
+
const H = this.material.map, k = new ct(s);
|
|
1210
|
+
k.colorSpace = ve, this.material.map = k, H?.dispose(), this.scale.set(A * w, E * w, 1);
|
|
1172
1211
|
}
|
|
1173
1212
|
_loadImage(e) {
|
|
1174
1213
|
return new Promise((t, s) => {
|
|
1175
1214
|
if (typeof e == "string") {
|
|
1176
1215
|
const n = new Image();
|
|
1177
|
-
n.crossOrigin = "Anonymous", n.onload = () => t(n), n.onerror = (
|
|
1216
|
+
n.crossOrigin = "Anonymous", n.onload = () => t(n), n.onerror = () => s(new Error(`Failed to load image: ${e}`)), n.src = e;
|
|
1178
1217
|
} else
|
|
1179
1218
|
t(e);
|
|
1180
1219
|
});
|
|
1181
1220
|
}
|
|
1182
|
-
_drawRoundedRect(e, t, s, n, i,
|
|
1183
|
-
e.beginPath(), e.moveTo(t +
|
|
1221
|
+
_drawRoundedRect(e, t, s, n, i, r) {
|
|
1222
|
+
e.beginPath(), e.moveTo(t + r, s), e.lineTo(t + n - r, s), e.quadraticCurveTo(t + n, s, t + n, s + r), e.lineTo(t + n, s + i - r), e.quadraticCurveTo(t + n, s + i, t + n - r, s + i), e.lineTo(t + r, s + i), e.quadraticCurveTo(t, s + i, t, s + i - r), e.lineTo(t, s + r), e.quadraticCurveTo(t, s, t + r, s), e.closePath();
|
|
1184
1223
|
}
|
|
1185
1224
|
dispose() {
|
|
1186
1225
|
this.material.map?.dispose(), this.material.dispose();
|
|
1187
1226
|
}
|
|
1188
1227
|
}
|
|
1189
|
-
class Oe extends
|
|
1228
|
+
class Oe extends j {
|
|
1190
1229
|
isShapeMesh = !0;
|
|
1191
1230
|
type = "ShapeMesh";
|
|
1192
1231
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1193
|
-
super(), this.geometry = new
|
|
1232
|
+
super(), this.geometry = new ht(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
1194
1233
|
}
|
|
1195
1234
|
static createFromPoints(e, t = {}) {
|
|
1196
1235
|
return new Oe({
|
|
1197
1236
|
...t,
|
|
1198
1237
|
geometryParameters: {
|
|
1199
1238
|
...t.geometryParameters,
|
|
1200
|
-
shape: new be(e.map((s) => new
|
|
1239
|
+
shape: new be(e.map((s) => new S(s.x, -s.z)))
|
|
1201
1240
|
}
|
|
1202
1241
|
});
|
|
1203
1242
|
}
|
|
1204
1243
|
}
|
|
1205
|
-
class Pe extends
|
|
1244
|
+
class Pe extends j {
|
|
1206
1245
|
isExtrudeMesh = !0;
|
|
1207
1246
|
type = "ExtrudeMesh";
|
|
1208
1247
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1209
|
-
super(), this.geometry = new
|
|
1248
|
+
super(), this.geometry = new lt(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
|
|
1210
1249
|
}
|
|
1211
1250
|
static createFromPoints(e, t = {}) {
|
|
1212
1251
|
return new Pe({
|
|
1213
1252
|
...t,
|
|
1214
1253
|
geometryParameters: {
|
|
1215
1254
|
...t.geometryParameters,
|
|
1216
|
-
shape: new be(e.map((s) => new
|
|
1255
|
+
shape: new be(e.map((s) => new S(s.x, -s.z)))
|
|
1217
1256
|
}
|
|
1218
1257
|
});
|
|
1219
1258
|
}
|
|
1220
1259
|
}
|
|
1221
|
-
class
|
|
1260
|
+
class Os extends j {
|
|
1222
1261
|
isPlaneMesh = !0;
|
|
1223
1262
|
type = "PlaneMesh";
|
|
1224
1263
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1225
|
-
super(), this.geometry = new
|
|
1264
|
+
super(), this.geometry = new dt(
|
|
1226
1265
|
e?.width,
|
|
1227
1266
|
e?.height,
|
|
1228
1267
|
e?.widthSegments,
|
|
@@ -1230,12 +1269,12 @@ class Cs extends U {
|
|
|
1230
1269
|
), this.material = new I(t);
|
|
1231
1270
|
}
|
|
1232
1271
|
}
|
|
1233
|
-
class
|
|
1272
|
+
class Ps extends j {
|
|
1234
1273
|
isCircleMesh = !0;
|
|
1235
1274
|
type = "CircleMesh";
|
|
1236
1275
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1237
1276
|
super(
|
|
1238
|
-
new
|
|
1277
|
+
new pt(
|
|
1239
1278
|
e?.radius,
|
|
1240
1279
|
e?.segments,
|
|
1241
1280
|
e?.thetaStart,
|
|
@@ -1245,21 +1284,21 @@ class xs extends U {
|
|
|
1245
1284
|
), this.geometry.rotateX(-Math.PI / 2);
|
|
1246
1285
|
}
|
|
1247
1286
|
}
|
|
1248
|
-
class
|
|
1287
|
+
class es {
|
|
1249
1288
|
static traverseMeshes(e, t) {
|
|
1250
1289
|
e.traverse((s) => {
|
|
1251
|
-
s instanceof
|
|
1290
|
+
s instanceof F && t(s);
|
|
1252
1291
|
});
|
|
1253
1292
|
}
|
|
1254
1293
|
}
|
|
1255
|
-
class
|
|
1294
|
+
class Ss {
|
|
1256
1295
|
static flow(e = {}) {
|
|
1257
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity:
|
|
1258
|
-
return
|
|
1296
|
+
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, a = U(new D(t)), o = U(new D(s)), h = ae().x.mul(i).sub(q.mul(n)), l = Y(oe(h).add(1).mul(0.5), r);
|
|
1297
|
+
return J(a, o, l);
|
|
1259
1298
|
}
|
|
1260
1299
|
static breathe(e = {}) {
|
|
1261
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e,
|
|
1262
|
-
return
|
|
1300
|
+
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = U(new D(t)), a = U(new D(s)), o = oe(q.mul(n)).add(1).mul(0.5), h = Y(o, i);
|
|
1301
|
+
return J(r, a, h);
|
|
1263
1302
|
}
|
|
1264
1303
|
static fluid(e = {}) {
|
|
1265
1304
|
const {
|
|
@@ -1267,22 +1306,22 @@ class Ms {
|
|
|
1267
1306
|
flowColor: s = 255,
|
|
1268
1307
|
speed: n = 1,
|
|
1269
1308
|
scale: i = 1,
|
|
1270
|
-
intensity:
|
|
1271
|
-
distortion:
|
|
1272
|
-
} = e,
|
|
1273
|
-
return
|
|
1309
|
+
intensity: r = 1,
|
|
1310
|
+
distortion: a = 0.5
|
|
1311
|
+
} = e, o = U(new D(t)), h = U(new D(s)), l = ae().mul(i), p = q.mul(n), g = ce(l.add(p), 1, 0), u = l.add(g.mul(a)), w = ce(u, 1, 0).add(1).mul(0.5), v = Y(w, r);
|
|
1312
|
+
return J(o, h, v);
|
|
1274
1313
|
}
|
|
1275
1314
|
}
|
|
1276
|
-
function
|
|
1315
|
+
function Ls(c) {
|
|
1277
1316
|
}
|
|
1278
|
-
const
|
|
1279
|
-
const
|
|
1280
|
-
return
|
|
1281
|
-
})(),
|
|
1282
|
-
const
|
|
1283
|
-
return
|
|
1317
|
+
const K = "uSpaceHighlight", se = `${K}/enabled`, Se = `${K}/opacity`, Le = `${K}/color`, Ie = `${K}/overwrite`, ts = Te(() => {
|
|
1318
|
+
const c = G(se, "uint"), e = G(Le, "uint"), t = G(Ie, "uint"), s = ns(e), n = he.mul(s), i = V(t.greaterThan(0), s, n);
|
|
1319
|
+
return V(c.greaterThan(0), i, he);
|
|
1320
|
+
})(), ss = Te(() => {
|
|
1321
|
+
const c = G(se, "uint"), e = G(Se, "float");
|
|
1322
|
+
return V(c.greaterThan(0), e, mt);
|
|
1284
1323
|
})();
|
|
1285
|
-
class
|
|
1324
|
+
class Is {
|
|
1286
1325
|
static highlight(e, t = {}) {
|
|
1287
1326
|
const s = Object.assign(
|
|
1288
1327
|
{
|
|
@@ -1293,18 +1332,18 @@ class Os {
|
|
|
1293
1332
|
},
|
|
1294
1333
|
t
|
|
1295
1334
|
);
|
|
1296
|
-
s.color = new
|
|
1297
|
-
n.userData[
|
|
1335
|
+
s.color = new te(s.color).getHex(), es.traverseMeshes(e, (n) => {
|
|
1336
|
+
n.userData[se] = s.enabled ? 1 : 0, n.userData[Se] = s.opacity, n.userData[Le] = s.color, n.userData[Ie] = s.overwrite ? 1 : 0;
|
|
1298
1337
|
const i = n.material;
|
|
1299
|
-
i && !Array.isArray(i) && (i.transparent = !0, i.colorNode =
|
|
1338
|
+
i && !Array.isArray(i) && (i.transparent = !0, i.colorNode = ts, i.opacityNode = ss, i.needsUpdate = !0);
|
|
1300
1339
|
});
|
|
1301
1340
|
}
|
|
1302
1341
|
}
|
|
1303
|
-
const
|
|
1304
|
-
const e =
|
|
1305
|
-
return
|
|
1342
|
+
const ns = (c) => {
|
|
1343
|
+
const e = c.shiftRight(16).bitAnd(255).toFloat().div(255), t = c.shiftRight(8).bitAnd(255).toFloat().div(255), s = c.bitAnd(255).toFloat().div(255);
|
|
1344
|
+
return gt(e, t, s);
|
|
1306
1345
|
};
|
|
1307
|
-
class
|
|
1346
|
+
class is extends Et {
|
|
1308
1347
|
viewer;
|
|
1309
1348
|
constructor(e, t) {
|
|
1310
1349
|
super(t), this.viewer = e;
|
|
@@ -1313,7 +1352,7 @@ class es extends Tt {
|
|
|
1313
1352
|
this.update(e) && this.viewer.render();
|
|
1314
1353
|
};
|
|
1315
1354
|
easingByMode(e) {
|
|
1316
|
-
const t =
|
|
1355
|
+
const t = rs[e];
|
|
1317
1356
|
return super.easing(t);
|
|
1318
1357
|
}
|
|
1319
1358
|
start(e, t) {
|
|
@@ -1323,21 +1362,21 @@ class es extends Tt {
|
|
|
1323
1362
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
1324
1363
|
}
|
|
1325
1364
|
}
|
|
1326
|
-
function
|
|
1327
|
-
return new Promise((
|
|
1328
|
-
const { duration:
|
|
1329
|
-
n?.(
|
|
1365
|
+
function Bs(c, e, t, s = {}, n, i) {
|
|
1366
|
+
return new Promise((r, a) => {
|
|
1367
|
+
const { duration: o = 1e3, delay: h = 0, repeat: l = !1, mode: p = "Linear.None", yoyo: g = !1 } = s, u = new is(c, e).to(t, o).easingByMode(p).delay(h).onUpdate((w) => {
|
|
1368
|
+
n?.(w, u);
|
|
1330
1369
|
}).onComplete(() => {
|
|
1331
|
-
|
|
1370
|
+
r();
|
|
1332
1371
|
}).onStop(() => {
|
|
1333
|
-
|
|
1372
|
+
a("animation stop");
|
|
1334
1373
|
}).onStart(() => {
|
|
1335
|
-
i?.(
|
|
1374
|
+
i?.(u);
|
|
1336
1375
|
});
|
|
1337
|
-
typeof l == "number" ?
|
|
1376
|
+
typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), g && u.repeatDelay(20), u.yoyo(g), u.start();
|
|
1338
1377
|
});
|
|
1339
1378
|
}
|
|
1340
|
-
const
|
|
1379
|
+
const rs = {
|
|
1341
1380
|
"Linear.None": d.Linear.None,
|
|
1342
1381
|
"Quadratic.In": d.Quadratic.In,
|
|
1343
1382
|
"Quadratic.Out": d.Quadratic.Out,
|
|
@@ -1372,31 +1411,31 @@ const ts = {
|
|
|
1372
1411
|
};
|
|
1373
1412
|
export {
|
|
1374
1413
|
Ee as BaseGroup,
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1414
|
+
j as BaseMesh,
|
|
1415
|
+
Zt as BaseSprite,
|
|
1416
|
+
Bt as CameraControls,
|
|
1417
|
+
Ps as CircleMesh,
|
|
1379
1418
|
Pe as ExtrudeMesh,
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1419
|
+
Ot as InteractionEvent,
|
|
1420
|
+
Pt as InteractionManager,
|
|
1421
|
+
Is as MaterialEffects,
|
|
1422
|
+
W as Model,
|
|
1384
1423
|
R as ModelLoaderManager,
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1424
|
+
St as ObjectManager,
|
|
1425
|
+
es as ObjectUtils,
|
|
1426
|
+
Os as PlaneMesh,
|
|
1427
|
+
Es as Poi,
|
|
1428
|
+
Rt as RoomEnvironment,
|
|
1429
|
+
Jt as SBMLoader,
|
|
1430
|
+
Ut as SBMXLoader,
|
|
1392
1431
|
Oe as ShapeMesh,
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1432
|
+
Vt as SphereMesh,
|
|
1433
|
+
Ss as TSLEffects,
|
|
1434
|
+
xs as TextureLoaderManager,
|
|
1435
|
+
Ms as Topology,
|
|
1397
1436
|
ue as TubeMesh,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1437
|
+
is as Tween,
|
|
1438
|
+
Cs as Viewer,
|
|
1439
|
+
Ls as reinterpretType,
|
|
1440
|
+
Bs as tweenAnimation
|
|
1402
1441
|
};
|