@shopware-ag/dive 2.1.2 → 2.2.1
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/build/chunks/{AssetCache-nWe2kXVH.mjs → AssetCache-B-m6VZSR.mjs} +1 -1
- package/build/chunks/{AssetCache-TvwR2H4n.cjs → AssetCache-udwfFvkY.cjs} +1 -1
- package/build/chunks/{AssetLoader-BUfmW1RY.mjs → AssetLoader-DCLXUeFD.mjs} +2 -2
- package/build/chunks/{AssetLoader-CX9EEQuM.cjs → AssetLoader-DL8Fd2Vp.cjs} +1 -1
- package/build/chunks/{FileTypes-BIdZgVcQ.mjs → FileTypes-CjmCMP7P.mjs} +349 -338
- package/build/chunks/FileTypes-DWBc6D11.cjs +29 -0
- package/build/chunks/{SelectTool-LE2592aq.cjs → SelectTool-204u2Sqa.cjs} +1 -1
- package/build/chunks/{SelectTool-CwQY2P8A.mjs → SelectTool-aH-q193I.mjs} +1 -1
- package/build/components/model/Model.d.ts +2 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +1 -1
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +2 -2
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +1 -1
- package/build/chunks/FileTypes-CfyYHJWw.cjs +0 -29
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (
|
|
4
|
-
import { WebGLRenderer as
|
|
5
|
-
import { P as
|
|
6
|
-
import
|
|
7
|
-
class
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var tt = (o, s, t) => s in o ? j(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
+
var i = (o, s, t) => tt(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { WebGLRenderer as et, PCFSoftShadowMap as it, PCFShadowMap as st, BasicShadowMap as at, MathUtils as x, Object3D as f, AmbientLight as nt, PointLight as rt, SphereGeometry as R, MeshBasicMaterial as H, FrontSide as Y, Mesh as M, HemisphereLight as ot, DirectionalLight as ht, Vector3 as h, Box3 as w, Quaternion as k, Box3Helper as lt, Sphere as dt, MeshStandardMaterial as A, Raycaster as ct, CylinderGeometry as ut, BufferGeometry as W, BufferAttribute as z, BoxGeometry as I, ConeGeometry as pt, LineDashedMaterial as mt, Line as _t, PlaneGeometry as gt, Color as _, GridHelper as ft, Scene as wt, TOUCH as m, MOUSE as p, EventDispatcher as yt, Spherical as B, Vector2 as c, AxesHelper as bt, Matrix4 as Dt, OrthographicCamera as Et, Vector4 as St } from "three";
|
|
5
|
+
import { P as g, U as Pt, H as vt, C as y, a as xt, D as G } from "./PerspectiveCamera-8tnOn5YS.mjs";
|
|
6
|
+
import T from "three-spritetext";
|
|
7
|
+
class Mt {
|
|
8
8
|
constructor() {
|
|
9
9
|
i(this, "isDIVEClock", !0);
|
|
10
10
|
i(this, "_lastTime", 0);
|
|
@@ -36,7 +36,7 @@ class Lt {
|
|
|
36
36
|
this._lastTime = s, this._tickers.forEach((e) => e.tick(t)), requestAnimationFrame(this._tick.bind(this));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const Z = {
|
|
40
40
|
canvas: void 0,
|
|
41
41
|
antialias: !0,
|
|
42
42
|
alpha: !0,
|
|
@@ -48,13 +48,13 @@ const U = {
|
|
|
48
48
|
shadows: !0,
|
|
49
49
|
shadowQuality: "high"
|
|
50
50
|
};
|
|
51
|
-
class
|
|
51
|
+
class N {
|
|
52
52
|
constructor(s, t, e) {
|
|
53
53
|
i(this, "isDIVERenderer", !0);
|
|
54
54
|
i(this, "_webglrenderer");
|
|
55
55
|
i(this, "_settings");
|
|
56
56
|
this._scene = s, this._camera = t, this._settings = {
|
|
57
|
-
...
|
|
57
|
+
...Z,
|
|
58
58
|
...e ?? {}
|
|
59
59
|
}, this._webglrenderer = this._createWebGLRenderer();
|
|
60
60
|
}
|
|
@@ -77,20 +77,20 @@ class H {
|
|
|
77
77
|
this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = this._createWebGLRenderer();
|
|
78
78
|
}
|
|
79
79
|
_createWebGLRenderer() {
|
|
80
|
-
const s = new
|
|
81
|
-
return s.shadowMap.enabled = this._settings.shadows, s.shadowMap.type = this._settings.shadowQuality === "high" ?
|
|
80
|
+
const s = new et(this._settings);
|
|
81
|
+
return s.shadowMap.enabled = this._settings.shadows, s.shadowMap.type = this._settings.shadowQuality === "high" ? it : this._settings.shadowQuality === "medium" ? st : at, s.setPixelRatio(window.devicePixelRatio), s;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const te =
|
|
85
|
-
class
|
|
84
|
+
const te = N;
|
|
85
|
+
class Lt {
|
|
86
86
|
constructor(s, t) {
|
|
87
87
|
i(this, "isDIVEResizeManager", !0);
|
|
88
88
|
i(this, "_resizeObserver");
|
|
89
89
|
i(this, "_width", 0);
|
|
90
90
|
i(this, "_height", 0);
|
|
91
91
|
this._renderer = s, this._camera = t, this._resizeObserver = new ResizeObserver((e) => {
|
|
92
|
-
const a = e[0], { width: n, height:
|
|
93
|
-
n === this._width &&
|
|
92
|
+
const a = e[0], { width: n, height: r } = a.contentRect;
|
|
93
|
+
n === this._width && r === this._height || (this._renderer.onResize(n, r), this._camera.onResize(n, r), this._width = n, this._height = r);
|
|
94
94
|
}), this._observeCanvas(this._renderer.canvas);
|
|
95
95
|
}
|
|
96
96
|
setCanvas(s) {
|
|
@@ -111,18 +111,18 @@ class xt {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class F {
|
|
115
115
|
constructor(s, t, e) {
|
|
116
116
|
i(this, "isDIVEView", !0);
|
|
117
|
-
i(this, "uuid",
|
|
117
|
+
i(this, "uuid", x.generateUUID());
|
|
118
118
|
i(this, "_paused", !1);
|
|
119
119
|
i(this, "_renderer");
|
|
120
120
|
i(this, "_resizeManager");
|
|
121
|
-
this._scene = s, this._camera = t, this._settings = e, this._renderer = new
|
|
121
|
+
this._scene = s, this._camera = t, this._settings = e, this._renderer = new N(
|
|
122
122
|
this._scene,
|
|
123
123
|
this._camera,
|
|
124
124
|
this._settings
|
|
125
|
-
), this._resizeManager = new
|
|
125
|
+
), this._resizeManager = new Lt(
|
|
126
126
|
this._renderer,
|
|
127
127
|
this._camera
|
|
128
128
|
);
|
|
@@ -159,14 +159,14 @@ class O {
|
|
|
159
159
|
this._paused = !1;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
class It extends
|
|
162
|
+
class It extends f {
|
|
163
163
|
constructor() {
|
|
164
164
|
super();
|
|
165
165
|
i(this, "isDIVELight", !0);
|
|
166
166
|
i(this, "isDIVEAmbientLight", !0);
|
|
167
167
|
i(this, "isSelectable", !0);
|
|
168
168
|
i(this, "_light");
|
|
169
|
-
this.name = "DIVEAmbientLight", this._light = new
|
|
169
|
+
this.name = "DIVEAmbientLight", this._light = new nt(16777215, 1), this._light.layers.mask = g, this.add(this._light);
|
|
170
170
|
}
|
|
171
171
|
setColor(t) {
|
|
172
172
|
this._light.color = t;
|
|
@@ -178,7 +178,7 @@ class It extends w {
|
|
|
178
178
|
this._light.visible = t;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
class Tt extends
|
|
181
|
+
class Tt extends f {
|
|
182
182
|
constructor() {
|
|
183
183
|
super();
|
|
184
184
|
i(this, "isDIVELight", !0);
|
|
@@ -188,18 +188,18 @@ class Tt extends w {
|
|
|
188
188
|
i(this, "gizmo", null);
|
|
189
189
|
i(this, "light");
|
|
190
190
|
i(this, "mesh");
|
|
191
|
-
this.name = "DIVEPointLight", this.light = new
|
|
192
|
-
const t = 0.1, e = new
|
|
191
|
+
this.name = "DIVEPointLight", this.light = new rt(16777215, 1), this.light.layers.mask = g, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
192
|
+
const t = 0.1, e = new R(
|
|
193
193
|
t,
|
|
194
194
|
t * 320,
|
|
195
195
|
t * 320
|
|
196
|
-
), a = new
|
|
196
|
+
), a = new H({
|
|
197
197
|
color: this.light.color,
|
|
198
198
|
transparent: !0,
|
|
199
199
|
opacity: 0.8,
|
|
200
|
-
side:
|
|
200
|
+
side: Y
|
|
201
201
|
});
|
|
202
|
-
this.mesh = new
|
|
202
|
+
this.mesh = new M(e, a), this.mesh.layers.mask = Pt, this.add(this.mesh);
|
|
203
203
|
}
|
|
204
204
|
setColor(t) {
|
|
205
205
|
this.light.color = t, this.mesh.material.color = t;
|
|
@@ -236,7 +236,7 @@ class Tt extends w {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class kt extends f {
|
|
240
240
|
constructor() {
|
|
241
241
|
super();
|
|
242
242
|
i(this, "isDIVELight", !0);
|
|
@@ -244,7 +244,7 @@ class Mt extends w {
|
|
|
244
244
|
i(this, "isSelectable", !0);
|
|
245
245
|
i(this, "_hemiLight");
|
|
246
246
|
i(this, "_dirLight");
|
|
247
|
-
this.name = "DIVESceneLight", this._hemiLight = new
|
|
247
|
+
this.name = "DIVESceneLight", this._hemiLight = new ot(16777215, 16777215, 2), this._hemiLight.layers.mask = g, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new ht(16777215, 3), this._dirLight.layers.mask = g, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
248
248
|
const t = 5;
|
|
249
249
|
this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
250
250
|
}
|
|
@@ -258,8 +258,8 @@ class Mt extends w {
|
|
|
258
258
|
this._hemiLight.visible = t, this._dirLight.visible = t;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
class
|
|
261
|
+
const X = (o) => o.parent ? X(o.parent) : o;
|
|
262
|
+
class C extends f {
|
|
263
263
|
constructor() {
|
|
264
264
|
super();
|
|
265
265
|
i(this, "isSelectable", !0);
|
|
@@ -268,7 +268,7 @@ class k extends w {
|
|
|
268
268
|
i(this, "gizmo", null);
|
|
269
269
|
i(this, "_positionWorldBuffer");
|
|
270
270
|
i(this, "_boundingBox");
|
|
271
|
-
this.layers.mask =
|
|
271
|
+
this.layers.mask = g, this._positionWorldBuffer = new h(), this._boundingBox = new w();
|
|
272
272
|
}
|
|
273
273
|
setPosition(t) {
|
|
274
274
|
if (!this.parent) {
|
|
@@ -329,10 +329,139 @@ class k extends w {
|
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
class
|
|
332
|
+
class V extends C {
|
|
333
|
+
/**
|
|
334
|
+
* Creates a new BoundingBox instance for the specified 3D object.
|
|
335
|
+
*
|
|
336
|
+
* The constructor computes both a bounding box and bounding sphere for the given object.
|
|
337
|
+
* It handles complex objects with multiple meshes and nested transformations.
|
|
338
|
+
*
|
|
339
|
+
* @param object - The 3D object to compute bounding volumes for
|
|
340
|
+
* @param axisAligned - Whether to create an axis-aligned bounding box (true) or oriented bounding box (false). Defaults to false.
|
|
341
|
+
* @param wireframeColor - The color for the wireframe helpers. Can be a hex number or ColorRepresentation. Defaults to green (0x00ff00).
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* // Create an oriented bounding box (aligned with object's rotation)
|
|
346
|
+
* const obb = new BoundingBox(mesh, false, 0x00ff00);
|
|
347
|
+
*
|
|
348
|
+
* // Create an axis-aligned bounding box (aligned with world coordinates)
|
|
349
|
+
* const aabb = new BoundingBox(mesh, true, 0xff0000);
|
|
350
|
+
*
|
|
351
|
+
* // Use default green color
|
|
352
|
+
* const defaultBox = new BoundingBox(mesh);
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
constructor(t, e = !1, a = 65280) {
|
|
356
|
+
super();
|
|
357
|
+
/** The computed bounding box (Box3) */
|
|
358
|
+
i(this, "_box");
|
|
359
|
+
/** The computed bounding sphere (Sphere) */
|
|
360
|
+
i(this, "_sphere");
|
|
361
|
+
/** The center point of the bounding box */
|
|
362
|
+
i(this, "_center");
|
|
363
|
+
/** The radius of the bounding sphere */
|
|
364
|
+
i(this, "_radius");
|
|
365
|
+
/** Visual helper for the bounding box wireframe */
|
|
366
|
+
i(this, "_boxHelper");
|
|
367
|
+
/** Visual helper for the bounding sphere wireframe */
|
|
368
|
+
i(this, "_sphereHelper");
|
|
369
|
+
/** The dimensions (width, height, depth) of the bounding box */
|
|
370
|
+
i(this, "_size");
|
|
371
|
+
const n = new w();
|
|
372
|
+
e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
|
|
373
|
+
if (l.isMesh) {
|
|
374
|
+
const d = l, u = d.geometry.clone();
|
|
375
|
+
u.applyMatrix4(d.matrixWorld);
|
|
376
|
+
const D = d.getWorldQuaternion(new k()).invert();
|
|
377
|
+
u.applyQuaternion(D), u.computeBoundingBox(), u.boundingBox && n.union(u.boundingBox);
|
|
378
|
+
}
|
|
379
|
+
})), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new lt(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new dt()), this._radius = this._sphere.radius;
|
|
380
|
+
const r = new R(this._radius, 32, 32);
|
|
381
|
+
r.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new M(
|
|
382
|
+
r,
|
|
383
|
+
new H({ color: a, wireframe: !0 })
|
|
384
|
+
), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Gets the computed bounding box.
|
|
388
|
+
* @returns The Box3 instance representing the bounding box
|
|
389
|
+
*/
|
|
390
|
+
get box() {
|
|
391
|
+
return this._box;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Gets the computed bounding sphere.
|
|
395
|
+
* @returns The Sphere instance representing the bounding sphere
|
|
396
|
+
*/
|
|
397
|
+
get sphere() {
|
|
398
|
+
return this._sphere;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Gets the center point of the bounding box.
|
|
402
|
+
* @returns A Vector3 representing the center coordinates
|
|
403
|
+
*/
|
|
404
|
+
get center() {
|
|
405
|
+
return this._center;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Gets the radius of the bounding sphere.
|
|
409
|
+
* @returns The radius as a number
|
|
410
|
+
*/
|
|
411
|
+
get radius() {
|
|
412
|
+
return this._radius;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Gets the dimensions of the bounding box.
|
|
416
|
+
* @returns A Vector3 representing width, height, and depth
|
|
417
|
+
*/
|
|
418
|
+
get size() {
|
|
419
|
+
return this._size;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Sets the visibility of the bounding box wireframe helper.
|
|
423
|
+
*
|
|
424
|
+
* @param visible - Whether the box helper should be visible
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```typescript
|
|
428
|
+
* const boundingBox = new BoundingBox(mesh);
|
|
429
|
+
*
|
|
430
|
+
* // Show the bounding box wireframe
|
|
431
|
+
* boundingBox.setBoxHelperVisible(true);
|
|
432
|
+
*
|
|
433
|
+
* // Hide the bounding box wireframe
|
|
434
|
+
* boundingBox.setBoxHelperVisible(false);
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
setBoxHelperVisible(t) {
|
|
438
|
+
this._boxHelper.visible = t;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Sets the visibility of the bounding sphere wireframe helper.
|
|
442
|
+
*
|
|
443
|
+
* @param visible - Whether the sphere helper should be visible
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```typescript
|
|
447
|
+
* const boundingBox = new BoundingBox(mesh);
|
|
448
|
+
*
|
|
449
|
+
* // Show the bounding sphere wireframe
|
|
450
|
+
* boundingBox.setSphereHelperVisible(true);
|
|
451
|
+
*
|
|
452
|
+
* // Hide the bounding sphere wireframe
|
|
453
|
+
* boundingBox.setSphereHelperVisible(false);
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
setSphereHelperVisible(t) {
|
|
457
|
+
this._sphereHelper.visible = t;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
class q extends C {
|
|
333
461
|
constructor() {
|
|
334
462
|
super();
|
|
335
463
|
i(this, "isDIVEModel", !0);
|
|
464
|
+
i(this, "_gltf", null);
|
|
336
465
|
i(this, "_mesh", null);
|
|
337
466
|
i(this, "_material", null);
|
|
338
467
|
i(this, "_assetLoader", null);
|
|
@@ -344,34 +473,36 @@ class W extends k {
|
|
|
344
473
|
async setFromURL(t) {
|
|
345
474
|
const a = await (await this._getAssetLoader()).load(t);
|
|
346
475
|
return this.setFromGLTF(a), import("../plugins/state/index.mjs").then(({ State: n }) => {
|
|
347
|
-
var
|
|
348
|
-
(
|
|
476
|
+
var r;
|
|
477
|
+
(r = n.get(this.userData.id)) == null || r.performAction("MODEL_LOADED", {
|
|
349
478
|
id: this.userData.id
|
|
350
479
|
});
|
|
351
480
|
}), this;
|
|
352
481
|
}
|
|
353
482
|
setFromGLTF(t) {
|
|
354
|
-
return this.clear(), this._boundingBox.makeEmpty(), t.traverse((e) => {
|
|
483
|
+
return this.clear(), this._boundingBox.makeEmpty(), this._gltf = t, this._gltf.name = "GLTF", this._gltf.traverse((e) => {
|
|
355
484
|
e.castShadow = !0, e.receiveShadow = !0, e.layers.mask = this.layers.mask, this._boundingBox.expandByObject(e), !this._mesh && "isMesh" in e && (this._mesh = e, this._material ? this._mesh.material = this._material : this._material = e.material);
|
|
356
|
-
}), this.add(
|
|
485
|
+
}), this.add(this._gltf), this;
|
|
357
486
|
}
|
|
358
487
|
setMaterial(t) {
|
|
359
|
-
this._material || (this._material = new
|
|
488
|
+
this._material || (this._material = new A()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
360
489
|
}
|
|
361
490
|
placeOnFloor() {
|
|
362
|
-
|
|
363
|
-
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
491
|
+
this.updateWorldMatrix(!0, !0);
|
|
492
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new w();
|
|
493
|
+
this.children.forEach((r) => {
|
|
494
|
+
r instanceof V || a.expandByObject(r, !0);
|
|
495
|
+
});
|
|
496
|
+
const n = -a.min.y;
|
|
497
|
+
Math.abs(n) < 1e-9 || (t.y += n, t.y !== e.y && (this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: r }) => {
|
|
498
|
+
var l;
|
|
499
|
+
(l = r.get(this.userData.id)) == null || l.performAction("UPDATE_OBJECT", {
|
|
369
500
|
id: this.userData.id,
|
|
370
501
|
position: t,
|
|
371
502
|
rotation: this.rotation,
|
|
372
503
|
scale: this.scale
|
|
373
504
|
});
|
|
374
|
-
}));
|
|
505
|
+
}), this.onMove()));
|
|
375
506
|
}
|
|
376
507
|
dropIt() {
|
|
377
508
|
if (!this.parent) {
|
|
@@ -381,36 +512,45 @@ class W extends k {
|
|
|
381
512
|
);
|
|
382
513
|
return;
|
|
383
514
|
}
|
|
384
|
-
const t = this.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
515
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new w();
|
|
516
|
+
this.children.forEach((d) => {
|
|
517
|
+
d instanceof V || a.expandByObject(d, !0);
|
|
518
|
+
});
|
|
519
|
+
const n = a.getCenter(new h());
|
|
520
|
+
n.y = a.min.y;
|
|
521
|
+
const r = new ct(n, new h(0, -1, 0));
|
|
522
|
+
r.layers.mask = g;
|
|
523
|
+
const l = r.intersectObjects(
|
|
524
|
+
X(this).root.children,
|
|
392
525
|
!0
|
|
393
526
|
);
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
527
|
+
if (l.length > 0) {
|
|
528
|
+
const d = l[0].object, E = new w().setFromObject(d).max.y - a.min.y;
|
|
529
|
+
if (Math.abs(E) < 1e-9 || (t.y += E, t.y === e.y)) return;
|
|
530
|
+
this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: L }) => {
|
|
531
|
+
var S;
|
|
532
|
+
(S = L.get(this.userData.id)) == null || S.performAction("UPDATE_OBJECT", {
|
|
533
|
+
id: this.userData.id,
|
|
534
|
+
position: t,
|
|
535
|
+
rotation: this.rotation,
|
|
536
|
+
scale: this.scale
|
|
537
|
+
});
|
|
538
|
+
}), this.onMove();
|
|
539
|
+
} else
|
|
540
|
+
this.placeOnFloor();
|
|
401
541
|
}
|
|
402
542
|
}
|
|
403
|
-
class
|
|
543
|
+
class Vt extends q {
|
|
404
544
|
constructor() {
|
|
405
545
|
super();
|
|
406
546
|
i(this, "isDIVEPrimitive", !0);
|
|
407
547
|
i(this, "_mesh");
|
|
408
548
|
i(this, "_material");
|
|
409
|
-
this._mesh = new
|
|
549
|
+
this._mesh = new M(), this._mesh.name = "PrimitiveMesh", this._mesh.layers.mask = g, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this.add(this._mesh), this._material = new A(), this._mesh.material = this._material;
|
|
410
550
|
}
|
|
411
551
|
setGeometry(t) {
|
|
412
552
|
const e = this.assembleGeometry(t);
|
|
413
|
-
e && (this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
|
|
553
|
+
e && (e.computeVertexNormals(), e.computeBoundingBox(), e.computeBoundingSphere(), this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
|
|
414
554
|
}
|
|
415
555
|
assembleGeometry(t) {
|
|
416
556
|
switch (this._material.flatShading = !1, t.name.toLowerCase()) {
|
|
@@ -437,7 +577,7 @@ class kt extends W {
|
|
|
437
577
|
}
|
|
438
578
|
}
|
|
439
579
|
createCylinderGeometry(t) {
|
|
440
|
-
const e = new
|
|
580
|
+
const e = new ut(
|
|
441
581
|
t.width / 2,
|
|
442
582
|
t.width / 2,
|
|
443
583
|
t.height,
|
|
@@ -446,7 +586,7 @@ class kt extends W {
|
|
|
446
586
|
return e.translate(0, t.height / 2, 0), e;
|
|
447
587
|
}
|
|
448
588
|
createSphereGeometry(t) {
|
|
449
|
-
return new
|
|
589
|
+
return new R(t.width / 2, 256, 256);
|
|
450
590
|
}
|
|
451
591
|
createPyramidGeometry(t) {
|
|
452
592
|
const e = new Float32Array([
|
|
@@ -488,14 +628,14 @@ class kt extends W {
|
|
|
488
628
|
3,
|
|
489
629
|
4,
|
|
490
630
|
0
|
|
491
|
-
]), n = new
|
|
631
|
+
]), n = new W();
|
|
492
632
|
return n.setAttribute(
|
|
493
633
|
"position",
|
|
494
|
-
new
|
|
495
|
-
), n.setIndex(new
|
|
634
|
+
new z(e, 3)
|
|
635
|
+
), n.setIndex(new z(a, 1)), n;
|
|
496
636
|
}
|
|
497
637
|
createBoxGeometry(t) {
|
|
498
|
-
const e = new
|
|
638
|
+
const e = new I(
|
|
499
639
|
t.width,
|
|
500
640
|
t.height,
|
|
501
641
|
t.depth
|
|
@@ -503,11 +643,11 @@ class kt extends W {
|
|
|
503
643
|
return e.translate(0, t.height / 2, 0), e;
|
|
504
644
|
}
|
|
505
645
|
createConeGeometry(t) {
|
|
506
|
-
const e = new
|
|
646
|
+
const e = new pt(t.width / 2, t.height, 256);
|
|
507
647
|
return e.translate(0, t.height / 2, 0), e;
|
|
508
648
|
}
|
|
509
649
|
createWallGeometry(t) {
|
|
510
|
-
const e = new
|
|
650
|
+
const e = new I(
|
|
511
651
|
t.width,
|
|
512
652
|
t.height,
|
|
513
653
|
t.depth || 0.05,
|
|
@@ -516,7 +656,7 @@ class kt extends W {
|
|
|
516
656
|
return e.translate(0, t.height / 2, 0), e;
|
|
517
657
|
}
|
|
518
658
|
createPlaneGeometry(t) {
|
|
519
|
-
const e = new
|
|
659
|
+
const e = new I(
|
|
520
660
|
t.width,
|
|
521
661
|
t.height,
|
|
522
662
|
t.depth
|
|
@@ -524,7 +664,7 @@ class kt extends W {
|
|
|
524
664
|
return e.translate(0, t.height / 2, 0), e;
|
|
525
665
|
}
|
|
526
666
|
}
|
|
527
|
-
class
|
|
667
|
+
class Rt extends C {
|
|
528
668
|
// lines to children
|
|
529
669
|
constructor() {
|
|
530
670
|
super();
|
|
@@ -578,11 +718,11 @@ class Vt extends k {
|
|
|
578
718
|
* Creates a line for visualization.
|
|
579
719
|
*/
|
|
580
720
|
createLine() {
|
|
581
|
-
const t = new
|
|
721
|
+
const t = new W(), e = new mt({
|
|
582
722
|
color: 6710886,
|
|
583
723
|
dashSize: 0.05,
|
|
584
724
|
gapSize: 0.025
|
|
585
|
-
}), a = new
|
|
725
|
+
}), a = new _t(t, e);
|
|
586
726
|
return a.visible = !1, a;
|
|
587
727
|
}
|
|
588
728
|
/**
|
|
@@ -643,37 +783,37 @@ class Vt extends k {
|
|
|
643
783
|
// this._boxMesh.visible = true;
|
|
644
784
|
// }
|
|
645
785
|
}
|
|
646
|
-
class
|
|
786
|
+
class At extends M {
|
|
647
787
|
constructor() {
|
|
648
|
-
const t = new
|
|
788
|
+
const t = new gt(1, 1);
|
|
649
789
|
t.scale(1e3, 1e3, 1), t.rotateX(-Math.PI / 2);
|
|
650
|
-
const e = new
|
|
651
|
-
color: new
|
|
652
|
-
side:
|
|
790
|
+
const e = new A({
|
|
791
|
+
color: new _(16777215),
|
|
792
|
+
side: Y
|
|
653
793
|
});
|
|
654
794
|
super(t, e);
|
|
655
795
|
i(this, "isDIVEFloor", !0);
|
|
656
|
-
this.name = "Floor", this.layers.mask =
|
|
796
|
+
this.name = "Floor", this.layers.mask = g, this.receiveShadow = !0;
|
|
657
797
|
}
|
|
658
798
|
setVisibility(t) {
|
|
659
799
|
this.visible = t;
|
|
660
800
|
}
|
|
661
801
|
setColor(t) {
|
|
662
|
-
this.material.color = new
|
|
802
|
+
this.material.color = new _(t);
|
|
663
803
|
}
|
|
664
804
|
}
|
|
665
|
-
class
|
|
805
|
+
class Ct extends f {
|
|
666
806
|
constructor() {
|
|
667
807
|
super();
|
|
668
808
|
i(this, "isDIVERoot", !0);
|
|
669
809
|
i(this, "_floor");
|
|
670
|
-
this.name = "Root", this._floor = new
|
|
810
|
+
this.name = "Root", this._floor = new At(), this.add(this._floor);
|
|
671
811
|
}
|
|
672
812
|
get floor() {
|
|
673
813
|
return this._floor;
|
|
674
814
|
}
|
|
675
815
|
computeSceneBB() {
|
|
676
|
-
const t = new
|
|
816
|
+
const t = new w();
|
|
677
817
|
return this.children.forEach((e) => {
|
|
678
818
|
"isDIVEFloor" in e || e.traverse((a) => {
|
|
679
819
|
"isObject3D" in a && t.expandByObject(a);
|
|
@@ -698,7 +838,7 @@ class At extends w {
|
|
|
698
838
|
case "light": {
|
|
699
839
|
switch (t.type) {
|
|
700
840
|
case "scene": {
|
|
701
|
-
e = new
|
|
841
|
+
e = new kt();
|
|
702
842
|
break;
|
|
703
843
|
}
|
|
704
844
|
case "ambient": {
|
|
@@ -718,15 +858,15 @@ class At extends w {
|
|
|
718
858
|
break;
|
|
719
859
|
}
|
|
720
860
|
case "model": {
|
|
721
|
-
e = new
|
|
861
|
+
e = new q(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
|
|
722
862
|
break;
|
|
723
863
|
}
|
|
724
864
|
case "primitive": {
|
|
725
|
-
e = new
|
|
865
|
+
e = new Vt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
|
|
726
866
|
break;
|
|
727
867
|
}
|
|
728
868
|
case "group": {
|
|
729
|
-
e = new
|
|
869
|
+
e = new Rt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
|
|
730
870
|
break;
|
|
731
871
|
}
|
|
732
872
|
default:
|
|
@@ -807,7 +947,7 @@ class At extends w {
|
|
|
807
947
|
e.position.x,
|
|
808
948
|
e.position.y,
|
|
809
949
|
e.position.z
|
|
810
|
-
), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new
|
|
950
|
+
), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new _(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
811
951
|
}
|
|
812
952
|
_updateModel(t, e) {
|
|
813
953
|
e.uri !== void 0 && t.setFromURL(e.uri), e.name !== void 0 && (t.name = e.name), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.material !== void 0 && t.setMaterial(e.material), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
|
|
@@ -854,39 +994,39 @@ class At extends w {
|
|
|
854
994
|
return t.parent !== null ? this._findScene(t.parent) : t;
|
|
855
995
|
}
|
|
856
996
|
}
|
|
857
|
-
const
|
|
858
|
-
class
|
|
997
|
+
const Ot = "#888888", zt = "#dddddd";
|
|
998
|
+
class Bt extends f {
|
|
859
999
|
constructor() {
|
|
860
1000
|
super(), this.name = "Grid";
|
|
861
|
-
const s = new
|
|
1001
|
+
const s = new ft(
|
|
862
1002
|
100,
|
|
863
1003
|
100,
|
|
864
|
-
|
|
865
|
-
|
|
1004
|
+
Ot,
|
|
1005
|
+
zt
|
|
866
1006
|
);
|
|
867
|
-
s.material.depthTest = !1, s.layers.mask =
|
|
1007
|
+
s.material.depthTest = !1, s.layers.mask = vt, this.add(s);
|
|
868
1008
|
}
|
|
869
1009
|
setVisibility(s) {
|
|
870
1010
|
this.visible = s;
|
|
871
1011
|
}
|
|
872
1012
|
}
|
|
873
|
-
const
|
|
1013
|
+
const v = {
|
|
874
1014
|
displayFloor: !1,
|
|
875
1015
|
displayGrid: !1,
|
|
876
1016
|
backgroundColor: "#ffffff"
|
|
877
1017
|
};
|
|
878
|
-
class
|
|
1018
|
+
class Gt extends wt {
|
|
879
1019
|
constructor(t) {
|
|
880
1020
|
super();
|
|
881
1021
|
i(this, "isDIVEScene", !0);
|
|
882
1022
|
i(this, "_root");
|
|
883
1023
|
i(this, "_grid");
|
|
884
|
-
this.background = new
|
|
885
|
-
(t == null ? void 0 : t.backgroundColor) ??
|
|
886
|
-
), this._root = new
|
|
887
|
-
(t == null ? void 0 : t.displayFloor) ??
|
|
888
|
-
), this.add(this._root), this._grid = new
|
|
889
|
-
(t == null ? void 0 : t.displayGrid) ??
|
|
1024
|
+
this.background = new _(
|
|
1025
|
+
(t == null ? void 0 : t.backgroundColor) ?? v.backgroundColor
|
|
1026
|
+
), this._root = new Ct(), this._root.floor.setVisibility(
|
|
1027
|
+
(t == null ? void 0 : t.displayFloor) ?? v.displayFloor
|
|
1028
|
+
), this.add(this._root), this._grid = new Bt(), this._grid.setVisibility(
|
|
1029
|
+
(t == null ? void 0 : t.displayGrid) ?? v.displayGrid
|
|
890
1030
|
), this.add(this._grid);
|
|
891
1031
|
}
|
|
892
1032
|
get root() {
|
|
@@ -896,13 +1036,13 @@ class Bt extends _t {
|
|
|
896
1036
|
return this._grid;
|
|
897
1037
|
}
|
|
898
1038
|
setBackground(t) {
|
|
899
|
-
this.background = new
|
|
1039
|
+
this.background = new _(t);
|
|
900
1040
|
}
|
|
901
1041
|
computeSceneBB() {
|
|
902
1042
|
return this._root.computeSceneBB();
|
|
903
1043
|
}
|
|
904
1044
|
}
|
|
905
|
-
const
|
|
1045
|
+
const Ft = {
|
|
906
1046
|
enableDamping: !0,
|
|
907
1047
|
dampingFactor: 0.05,
|
|
908
1048
|
enabled: !0,
|
|
@@ -937,10 +1077,10 @@ const Gt = {
|
|
|
937
1077
|
RIGHT: p.PAN
|
|
938
1078
|
},
|
|
939
1079
|
touches: {
|
|
940
|
-
ONE:
|
|
941
|
-
TWO:
|
|
1080
|
+
ONE: m.ROTATE,
|
|
1081
|
+
TWO: m.DOLLY_PAN
|
|
942
1082
|
}
|
|
943
|
-
}, b = class b extends
|
|
1083
|
+
}, b = class b extends yt {
|
|
944
1084
|
constructor(t, e, a) {
|
|
945
1085
|
super();
|
|
946
1086
|
// public API
|
|
@@ -983,28 +1123,28 @@ const Gt = {
|
|
|
983
1123
|
MIDDLE: p.DOLLY,
|
|
984
1124
|
RIGHT: p.PAN
|
|
985
1125
|
});
|
|
986
|
-
i(this, "touches", { ONE:
|
|
1126
|
+
i(this, "touches", { ONE: m.ROTATE, TWO: m.DOLLY_PAN });
|
|
987
1127
|
i(this, "target0");
|
|
988
1128
|
i(this, "position0");
|
|
989
1129
|
i(this, "zoom0");
|
|
990
|
-
i(this, "uuid",
|
|
1130
|
+
i(this, "uuid", x.generateUUID());
|
|
991
1131
|
// private state
|
|
992
1132
|
i(this, "state", -1);
|
|
993
1133
|
i(this, "EPS", 1e-6);
|
|
994
|
-
i(this, "spherical", new
|
|
995
|
-
i(this, "sphericalDelta", new
|
|
1134
|
+
i(this, "spherical", new B());
|
|
1135
|
+
i(this, "sphericalDelta", new B());
|
|
996
1136
|
i(this, "scale", 1);
|
|
997
1137
|
i(this, "panOffset", new h());
|
|
998
1138
|
i(this, "zoomChanged", !1);
|
|
999
|
-
i(this, "rotateStart", new
|
|
1000
|
-
i(this, "rotateEnd", new
|
|
1001
|
-
i(this, "rotateDelta", new
|
|
1002
|
-
i(this, "panStart", new
|
|
1003
|
-
i(this, "panEnd", new
|
|
1004
|
-
i(this, "panDelta", new
|
|
1005
|
-
i(this, "dollyStart", new
|
|
1006
|
-
i(this, "dollyEnd", new
|
|
1007
|
-
i(this, "dollyDelta", new
|
|
1139
|
+
i(this, "rotateStart", new c());
|
|
1140
|
+
i(this, "rotateEnd", new c());
|
|
1141
|
+
i(this, "rotateDelta", new c());
|
|
1142
|
+
i(this, "panStart", new c());
|
|
1143
|
+
i(this, "panEnd", new c());
|
|
1144
|
+
i(this, "panDelta", new c());
|
|
1145
|
+
i(this, "dollyStart", new c());
|
|
1146
|
+
i(this, "dollyEnd", new c());
|
|
1147
|
+
i(this, "dollyDelta", new c());
|
|
1008
1148
|
i(this, "pointers", []);
|
|
1009
1149
|
i(this, "pointerPositions", {});
|
|
1010
1150
|
// for update() function
|
|
@@ -1012,7 +1152,7 @@ const Gt = {
|
|
|
1012
1152
|
i(this, "quat");
|
|
1013
1153
|
i(this, "quatInverse");
|
|
1014
1154
|
i(this, "lastPosition", new h());
|
|
1015
|
-
i(this, "lastQuaternion", new
|
|
1155
|
+
i(this, "lastQuaternion", new k());
|
|
1016
1156
|
i(this, "lastTarget", new h());
|
|
1017
1157
|
i(this, "panLeft", (() => {
|
|
1018
1158
|
const t = new h();
|
|
@@ -1096,11 +1236,11 @@ const Gt = {
|
|
|
1096
1236
|
switch (this.trackPointer(t), this.pointers.length) {
|
|
1097
1237
|
case 1:
|
|
1098
1238
|
switch (this.touches.ONE) {
|
|
1099
|
-
case
|
|
1239
|
+
case m.ROTATE:
|
|
1100
1240
|
if (this.enableRotate === !1) return;
|
|
1101
1241
|
this.handleTouchStartRotate(t), this.state = 3;
|
|
1102
1242
|
break;
|
|
1103
|
-
case
|
|
1243
|
+
case m.PAN:
|
|
1104
1244
|
if (this.enablePan === !1) return;
|
|
1105
1245
|
this.handleTouchStartPan(t), this.state = 4;
|
|
1106
1246
|
break;
|
|
@@ -1110,12 +1250,12 @@ const Gt = {
|
|
|
1110
1250
|
break;
|
|
1111
1251
|
case 2:
|
|
1112
1252
|
switch (this.touches.TWO) {
|
|
1113
|
-
case
|
|
1253
|
+
case m.DOLLY_PAN:
|
|
1114
1254
|
if (this.enableZoom === !1 && this.enablePan === !1)
|
|
1115
1255
|
return;
|
|
1116
1256
|
this.handleTouchStartDollyPan(t), this.state = 5;
|
|
1117
1257
|
break;
|
|
1118
|
-
case
|
|
1258
|
+
case m.DOLLY_ROTATE:
|
|
1119
1259
|
if (this.enableZoom === !1 && this.enableRotate === !1)
|
|
1120
1260
|
return;
|
|
1121
1261
|
this.handleTouchStartDollyRotate(t), this.state = 6;
|
|
@@ -1177,7 +1317,7 @@ const Gt = {
|
|
|
1177
1317
|
i(this, "onContextMenu", (t) => {
|
|
1178
1318
|
this.enabled !== !1 && t.preventDefault();
|
|
1179
1319
|
});
|
|
1180
|
-
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new
|
|
1320
|
+
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new k().setFromUnitVectors(
|
|
1181
1321
|
t.up,
|
|
1182
1322
|
new h(0, 1, 0)
|
|
1183
1323
|
), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((n) => this.addEventListeners(n)), this.update();
|
|
@@ -1235,14 +1375,14 @@ const Gt = {
|
|
|
1235
1375
|
this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...t);
|
|
1236
1376
|
}
|
|
1237
1377
|
computeEncompassingView(t, e = 0) {
|
|
1238
|
-
const a = t.center,
|
|
1378
|
+
const a = t.center, r = t.sphere.radius, l = this.object.fov * (Math.PI / 180), d = this.object.aspect, u = l / 2, D = Math.atan(Math.tan(u) * d), E = r / Math.sin(u), L = r / Math.sin(D), S = Math.max(E, L) * (1 + e), O = this.object.position.clone().sub(this.target).normalize(), $ = O.length() > 1e-3 ? O : new h(0, 0, 1);
|
|
1239
1379
|
return {
|
|
1240
|
-
position: a.clone().add(
|
|
1380
|
+
position: a.clone().add($.multiplyScalar(S)),
|
|
1241
1381
|
target: a
|
|
1242
1382
|
};
|
|
1243
1383
|
}
|
|
1244
1384
|
focusObject(t, e = 0) {
|
|
1245
|
-
const a = new
|
|
1385
|
+
const a = new V(t), n = this.computeEncompassingView(a, e);
|
|
1246
1386
|
this.object.position.copy(n.position), this.target.copy(n.target), this.update();
|
|
1247
1387
|
}
|
|
1248
1388
|
zoomIn(t) {
|
|
@@ -1292,8 +1432,8 @@ const Gt = {
|
|
|
1292
1432
|
pan(t, e, a) {
|
|
1293
1433
|
const n = new h();
|
|
1294
1434
|
if ("isPerspectiveCamera" in this.object) {
|
|
1295
|
-
const
|
|
1296
|
-
n.copy(
|
|
1435
|
+
const r = this.object.position;
|
|
1436
|
+
n.copy(r).sub(this.target);
|
|
1297
1437
|
let l = n.length();
|
|
1298
1438
|
l *= Math.tan(
|
|
1299
1439
|
this.object.fov / 2 * Math.PI / 180
|
|
@@ -1389,8 +1529,8 @@ const Gt = {
|
|
|
1389
1529
|
}
|
|
1390
1530
|
}
|
|
1391
1531
|
handleTouchStartDolly(t) {
|
|
1392
|
-
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY,
|
|
1393
|
-
this.dollyStart.set(0,
|
|
1532
|
+
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, r = Math.sqrt(a * a + n * n);
|
|
1533
|
+
this.dollyStart.set(0, r);
|
|
1394
1534
|
}
|
|
1395
1535
|
handleTouchStartDollyPan(t) {
|
|
1396
1536
|
this.enableZoom && this.handleTouchStartDolly(t), this.enablePan && this.handleTouchStartPan(t);
|
|
@@ -1402,8 +1542,8 @@ const Gt = {
|
|
|
1402
1542
|
if (this.pointers.length === 1)
|
|
1403
1543
|
this.rotateEnd.set(t.pageX, t.pageY);
|
|
1404
1544
|
else {
|
|
1405
|
-
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX),
|
|
1406
|
-
this.rotateEnd.set(n,
|
|
1545
|
+
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), r = 0.5 * (t.pageY + a.pageY);
|
|
1546
|
+
this.rotateEnd.set(n, r);
|
|
1407
1547
|
}
|
|
1408
1548
|
const e = t.currentTarget;
|
|
1409
1549
|
this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed), this.rotateLeft(
|
|
@@ -1416,15 +1556,15 @@ const Gt = {
|
|
|
1416
1556
|
if (this.pointers.length === 1)
|
|
1417
1557
|
this.panEnd.set(t.pageX, t.pageY);
|
|
1418
1558
|
else {
|
|
1419
|
-
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX),
|
|
1420
|
-
this.panEnd.set(n,
|
|
1559
|
+
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), r = 0.5 * (t.pageY + a.pageY);
|
|
1560
|
+
this.panEnd.set(n, r);
|
|
1421
1561
|
}
|
|
1422
1562
|
const e = t.currentTarget;
|
|
1423
1563
|
this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed), this.pan(this.panDelta.x, this.panDelta.y, e), this.panStart.copy(this.panEnd);
|
|
1424
1564
|
}
|
|
1425
1565
|
handleTouchMoveDolly(t) {
|
|
1426
|
-
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY,
|
|
1427
|
-
this.dollyEnd.set(0,
|
|
1566
|
+
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, r = Math.sqrt(a * a + n * n);
|
|
1567
|
+
this.dollyEnd.set(0, r), this.dollyDelta.set(
|
|
1428
1568
|
0,
|
|
1429
1569
|
Math.pow(this.dollyEnd.y / this.dollyStart.y, this.zoomSpeed)
|
|
1430
1570
|
), this.dollyOut(this.dollyDelta.y), this.dollyStart.copy(this.dollyEnd);
|
|
@@ -1448,7 +1588,7 @@ const Gt = {
|
|
|
1448
1588
|
}
|
|
1449
1589
|
trackPointer(t) {
|
|
1450
1590
|
let e = this.pointerPositions[t.pointerId];
|
|
1451
|
-
e === void 0 && (e = new
|
|
1591
|
+
e === void 0 && (e = new c(), this.pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
|
|
1452
1592
|
}
|
|
1453
1593
|
getSecondPointer(t) {
|
|
1454
1594
|
return this.pointers[0].pointerId === t.pointerId ? this.pointers[1] : this.pointers[0];
|
|
@@ -1460,39 +1600,39 @@ const Gt = {
|
|
|
1460
1600
|
}
|
|
1461
1601
|
};
|
|
1462
1602
|
i(b, "DEFAULT_ZOOM_FACTOR", 1);
|
|
1463
|
-
let
|
|
1464
|
-
class
|
|
1603
|
+
let U = b;
|
|
1604
|
+
class Ut extends f {
|
|
1465
1605
|
constructor() {
|
|
1466
1606
|
super();
|
|
1467
1607
|
i(this, "_axesHelper");
|
|
1468
|
-
this._axesHelper = new
|
|
1469
|
-
new
|
|
1470
|
-
new
|
|
1471
|
-
new
|
|
1608
|
+
this._axesHelper = new bt(0.5), this._axesHelper.layers.mask = y, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
|
|
1609
|
+
new _(Zt),
|
|
1610
|
+
new _(Nt),
|
|
1611
|
+
new _(Xt)
|
|
1472
1612
|
);
|
|
1473
|
-
const t = new
|
|
1613
|
+
const t = new T("X", 0.2, K), e = new T("Y", 0.2, Q), a = new T("Z", 0.2, J);
|
|
1474
1614
|
t.layers.mask = y, e.layers.mask = y, a.layers.mask = y, t.position.set(0.7, 0, 0), e.position.set(0, 0.7, 0), a.position.set(0, 0, 0.7), this._axesHelper.add(t), this._axesHelper.add(e), this._axesHelper.add(a);
|
|
1475
1615
|
}
|
|
1476
1616
|
setFromCameraMatrix(t) {
|
|
1477
1617
|
this._axesHelper.rotation.setFromRotationMatrix(
|
|
1478
|
-
new
|
|
1618
|
+
new Dt().extractRotation(t).invert()
|
|
1479
1619
|
);
|
|
1480
1620
|
}
|
|
1481
1621
|
}
|
|
1482
|
-
class
|
|
1622
|
+
class Ht {
|
|
1483
1623
|
constructor(s, t, e) {
|
|
1484
|
-
i(this, "uuid",
|
|
1624
|
+
i(this, "uuid", x.generateUUID());
|
|
1485
1625
|
i(this, "_axes");
|
|
1486
1626
|
i(this, "_orthographicCamera");
|
|
1487
|
-
i(this, "_restoreViewport", new
|
|
1488
|
-
this._renderer = s, this._scene = t, this._camera = e, this._orthographicCamera = new
|
|
1627
|
+
i(this, "_restoreViewport", new St());
|
|
1628
|
+
this._renderer = s, this._scene = t, this._camera = e, this._orthographicCamera = new Et(
|
|
1489
1629
|
-1,
|
|
1490
1630
|
1,
|
|
1491
1631
|
1,
|
|
1492
1632
|
-1,
|
|
1493
1633
|
0.1,
|
|
1494
1634
|
100
|
|
1495
|
-
), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new
|
|
1635
|
+
), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new Ut(), this._scene.add(this._axes);
|
|
1496
1636
|
}
|
|
1497
1637
|
tick() {
|
|
1498
1638
|
const s = this._scene.background;
|
|
@@ -1505,7 +1645,7 @@ class Ut {
|
|
|
1505
1645
|
this._scene.remove(this._axes), this._scene.remove(this._orthographicCamera);
|
|
1506
1646
|
}
|
|
1507
1647
|
}
|
|
1508
|
-
const
|
|
1648
|
+
const Yt = `
|
|
1509
1649
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
1510
1650
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
1511
1651
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -1540,18 +1680,18 @@ window.DIVE = {
|
|
|
1540
1680
|
return window.DIVE.instances[0];
|
|
1541
1681
|
}
|
|
1542
1682
|
};
|
|
1543
|
-
const
|
|
1683
|
+
const P = {
|
|
1544
1684
|
autoStart: !0,
|
|
1545
1685
|
displayAxes: !1,
|
|
1546
|
-
...
|
|
1547
|
-
...
|
|
1548
|
-
...
|
|
1549
|
-
...
|
|
1686
|
+
...v,
|
|
1687
|
+
...xt,
|
|
1688
|
+
...Z,
|
|
1689
|
+
...Ft
|
|
1550
1690
|
};
|
|
1551
|
-
class
|
|
1691
|
+
class Wt {
|
|
1552
1692
|
constructor(s) {
|
|
1553
1693
|
// descriptive members
|
|
1554
|
-
i(this, "_instanceId",
|
|
1694
|
+
i(this, "_instanceId", x.generateUUID());
|
|
1555
1695
|
i(this, "_settings");
|
|
1556
1696
|
i(this, "_views");
|
|
1557
1697
|
i(this, "_mainView");
|
|
@@ -1559,25 +1699,25 @@ class Yt {
|
|
|
1559
1699
|
i(this, "_clock");
|
|
1560
1700
|
i(this, "orientationDisplay");
|
|
1561
1701
|
this._settings = {
|
|
1562
|
-
...
|
|
1702
|
+
...P,
|
|
1563
1703
|
...s ?? {}
|
|
1564
|
-
}, this._clock = new
|
|
1565
|
-
(s == null ? void 0 : s.backgroundColor) ??
|
|
1704
|
+
}, this._clock = new Mt(), this._scene = new Gt(), this.scene.setBackground(
|
|
1705
|
+
(s == null ? void 0 : s.backgroundColor) ?? P.backgroundColor
|
|
1566
1706
|
), this.scene.grid.setVisibility(
|
|
1567
|
-
(s == null ? void 0 : s.displayGrid) ??
|
|
1707
|
+
(s == null ? void 0 : s.displayGrid) ?? P.displayGrid
|
|
1568
1708
|
), this.scene.root.floor.setVisibility(
|
|
1569
|
-
(s == null ? void 0 : s.displayFloor) ??
|
|
1709
|
+
(s == null ? void 0 : s.displayFloor) ?? P.displayFloor
|
|
1570
1710
|
);
|
|
1571
|
-
const t = new
|
|
1711
|
+
const t = new F(
|
|
1572
1712
|
this._scene,
|
|
1573
|
-
new
|
|
1713
|
+
new G(),
|
|
1574
1714
|
this._settings
|
|
1575
1715
|
);
|
|
1576
|
-
this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new
|
|
1716
|
+
this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new Ht(
|
|
1577
1717
|
this.mainView.renderer,
|
|
1578
1718
|
this.scene,
|
|
1579
1719
|
this.mainView.camera
|
|
1580
|
-
), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.1
|
|
1720
|
+
), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.2.1 initialized successfully!"), console.log(Yt), window.DIVE.instances.push(this);
|
|
1581
1721
|
}
|
|
1582
1722
|
/**
|
|
1583
1723
|
* @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
|
|
@@ -1639,9 +1779,9 @@ class Yt {
|
|
|
1639
1779
|
});
|
|
1640
1780
|
}
|
|
1641
1781
|
createView(s) {
|
|
1642
|
-
const t = new
|
|
1782
|
+
const t = new F(
|
|
1643
1783
|
this._scene,
|
|
1644
|
-
s ?? new
|
|
1784
|
+
s ?? new G(),
|
|
1645
1785
|
{
|
|
1646
1786
|
...this._settings,
|
|
1647
1787
|
canvas: void 0
|
|
@@ -1654,136 +1794,7 @@ class Yt {
|
|
|
1654
1794
|
this._views = this._views.filter((t) => t !== s), this._clock.removeTicker(s), this._mainView === s && (this._mainView = this._views[0]), s.dispose();
|
|
1655
1795
|
}
|
|
1656
1796
|
}
|
|
1657
|
-
const ee =
|
|
1658
|
-
class Xt extends k {
|
|
1659
|
-
/**
|
|
1660
|
-
* Creates a new BoundingBox instance for the specified 3D object.
|
|
1661
|
-
*
|
|
1662
|
-
* The constructor computes both a bounding box and bounding sphere for the given object.
|
|
1663
|
-
* It handles complex objects with multiple meshes and nested transformations.
|
|
1664
|
-
*
|
|
1665
|
-
* @param object - The 3D object to compute bounding volumes for
|
|
1666
|
-
* @param axisAligned - Whether to create an axis-aligned bounding box (true) or oriented bounding box (false). Defaults to false.
|
|
1667
|
-
* @param wireframeColor - The color for the wireframe helpers. Can be a hex number or ColorRepresentation. Defaults to green (0x00ff00).
|
|
1668
|
-
*
|
|
1669
|
-
* @example
|
|
1670
|
-
* ```typescript
|
|
1671
|
-
* // Create an oriented bounding box (aligned with object's rotation)
|
|
1672
|
-
* const obb = new BoundingBox(mesh, false, 0x00ff00);
|
|
1673
|
-
*
|
|
1674
|
-
* // Create an axis-aligned bounding box (aligned with world coordinates)
|
|
1675
|
-
* const aabb = new BoundingBox(mesh, true, 0xff0000);
|
|
1676
|
-
*
|
|
1677
|
-
* // Use default green color
|
|
1678
|
-
* const defaultBox = new BoundingBox(mesh);
|
|
1679
|
-
* ```
|
|
1680
|
-
*/
|
|
1681
|
-
constructor(t, e = !1, a = 65280) {
|
|
1682
|
-
super();
|
|
1683
|
-
/** The computed bounding box (Box3) */
|
|
1684
|
-
i(this, "_box");
|
|
1685
|
-
/** The computed bounding sphere (Sphere) */
|
|
1686
|
-
i(this, "_sphere");
|
|
1687
|
-
/** The center point of the bounding box */
|
|
1688
|
-
i(this, "_center");
|
|
1689
|
-
/** The radius of the bounding sphere */
|
|
1690
|
-
i(this, "_radius");
|
|
1691
|
-
/** Visual helper for the bounding box wireframe */
|
|
1692
|
-
i(this, "_boxHelper");
|
|
1693
|
-
/** Visual helper for the bounding sphere wireframe */
|
|
1694
|
-
i(this, "_sphereHelper");
|
|
1695
|
-
/** The dimensions (width, height, depth) of the bounding box */
|
|
1696
|
-
i(this, "_size");
|
|
1697
|
-
const n = new T();
|
|
1698
|
-
e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
|
|
1699
|
-
if (l.isMesh) {
|
|
1700
|
-
const c = l, d = c.geometry.clone();
|
|
1701
|
-
d.applyMatrix4(c.matrixWorld);
|
|
1702
|
-
const m = c.getWorldQuaternion(new x()).invert();
|
|
1703
|
-
d.applyQuaternion(m), d.computeBoundingBox(), d.boundingBox && n.union(d.boundingBox);
|
|
1704
|
-
}
|
|
1705
|
-
})), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new Dt(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new Et()), this._radius = this._sphere.radius;
|
|
1706
|
-
const o = new I(this._radius, 32, 32);
|
|
1707
|
-
o.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new P(
|
|
1708
|
-
o,
|
|
1709
|
-
new B({ color: a, wireframe: !0 })
|
|
1710
|
-
), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
|
|
1711
|
-
}
|
|
1712
|
-
/**
|
|
1713
|
-
* Gets the computed bounding box.
|
|
1714
|
-
* @returns The Box3 instance representing the bounding box
|
|
1715
|
-
*/
|
|
1716
|
-
get box() {
|
|
1717
|
-
return this._box;
|
|
1718
|
-
}
|
|
1719
|
-
/**
|
|
1720
|
-
* Gets the computed bounding sphere.
|
|
1721
|
-
* @returns The Sphere instance representing the bounding sphere
|
|
1722
|
-
*/
|
|
1723
|
-
get sphere() {
|
|
1724
|
-
return this._sphere;
|
|
1725
|
-
}
|
|
1726
|
-
/**
|
|
1727
|
-
* Gets the center point of the bounding box.
|
|
1728
|
-
* @returns A Vector3 representing the center coordinates
|
|
1729
|
-
*/
|
|
1730
|
-
get center() {
|
|
1731
|
-
return this._center;
|
|
1732
|
-
}
|
|
1733
|
-
/**
|
|
1734
|
-
* Gets the radius of the bounding sphere.
|
|
1735
|
-
* @returns The radius as a number
|
|
1736
|
-
*/
|
|
1737
|
-
get radius() {
|
|
1738
|
-
return this._radius;
|
|
1739
|
-
}
|
|
1740
|
-
/**
|
|
1741
|
-
* Gets the dimensions of the bounding box.
|
|
1742
|
-
* @returns A Vector3 representing width, height, and depth
|
|
1743
|
-
*/
|
|
1744
|
-
get size() {
|
|
1745
|
-
return this._size;
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* Sets the visibility of the bounding box wireframe helper.
|
|
1749
|
-
*
|
|
1750
|
-
* @param visible - Whether the box helper should be visible
|
|
1751
|
-
*
|
|
1752
|
-
* @example
|
|
1753
|
-
* ```typescript
|
|
1754
|
-
* const boundingBox = new BoundingBox(mesh);
|
|
1755
|
-
*
|
|
1756
|
-
* // Show the bounding box wireframe
|
|
1757
|
-
* boundingBox.setBoxHelperVisible(true);
|
|
1758
|
-
*
|
|
1759
|
-
* // Hide the bounding box wireframe
|
|
1760
|
-
* boundingBox.setBoxHelperVisible(false);
|
|
1761
|
-
* ```
|
|
1762
|
-
*/
|
|
1763
|
-
setBoxHelperVisible(t) {
|
|
1764
|
-
this._boxHelper.visible = t;
|
|
1765
|
-
}
|
|
1766
|
-
/**
|
|
1767
|
-
* Sets the visibility of the bounding sphere wireframe helper.
|
|
1768
|
-
*
|
|
1769
|
-
* @param visible - Whether the sphere helper should be visible
|
|
1770
|
-
*
|
|
1771
|
-
* @example
|
|
1772
|
-
* ```typescript
|
|
1773
|
-
* const boundingBox = new BoundingBox(mesh);
|
|
1774
|
-
*
|
|
1775
|
-
* // Show the bounding sphere wireframe
|
|
1776
|
-
* boundingBox.setSphereHelperVisible(true);
|
|
1777
|
-
*
|
|
1778
|
-
* // Hide the bounding sphere wireframe
|
|
1779
|
-
* boundingBox.setSphereHelperVisible(false);
|
|
1780
|
-
* ```
|
|
1781
|
-
*/
|
|
1782
|
-
setSphereHelperVisible(t) {
|
|
1783
|
-
this._sphereHelper.visible = t;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
const qt = {
|
|
1797
|
+
const ee = Wt, K = "#c20017", Q = "#00ab26", J = "#0081d4", Zt = K, Nt = Q, Xt = J, qt = {
|
|
1787
1798
|
glb: {
|
|
1788
1799
|
key: "glb",
|
|
1789
1800
|
extension: "glb"
|
|
@@ -1797,44 +1808,44 @@ const qt = {
|
|
|
1797
1808
|
extension: "usdz"
|
|
1798
1809
|
}
|
|
1799
1810
|
}, ie = Object.values(qt).map(
|
|
1800
|
-
(
|
|
1811
|
+
(o) => o.extension
|
|
1801
1812
|
);
|
|
1802
1813
|
export {
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
D,
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1814
|
+
Zt as A,
|
|
1815
|
+
C as B,
|
|
1816
|
+
Vt as C,
|
|
1817
|
+
P as D,
|
|
1818
|
+
Ct as E,
|
|
1819
|
+
V as F,
|
|
1820
|
+
Ot as G,
|
|
1821
|
+
X as H,
|
|
1811
1822
|
qt as I,
|
|
1812
|
-
|
|
1823
|
+
Ft as O,
|
|
1813
1824
|
ie as S,
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1825
|
+
U as a,
|
|
1826
|
+
Ht as b,
|
|
1827
|
+
Ut as c,
|
|
1828
|
+
Wt as d,
|
|
1829
|
+
kt as e,
|
|
1830
|
+
q as f,
|
|
1831
|
+
Nt as g,
|
|
1832
|
+
Xt as h,
|
|
1822
1833
|
ee as i,
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1834
|
+
Mt as j,
|
|
1835
|
+
Z as k,
|
|
1836
|
+
N as l,
|
|
1826
1837
|
te as m,
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
+
Lt as n,
|
|
1839
|
+
v as o,
|
|
1840
|
+
Gt as p,
|
|
1841
|
+
F as q,
|
|
1842
|
+
K as r,
|
|
1843
|
+
Q as s,
|
|
1844
|
+
J as t,
|
|
1845
|
+
zt as u,
|
|
1846
|
+
At as v,
|
|
1847
|
+
Bt as w,
|
|
1848
|
+
Rt as x,
|
|
1838
1849
|
It as y,
|
|
1839
1850
|
Tt as z
|
|
1840
1851
|
};
|