@shopware-ag/dive 1.16.0 → 1.16.2
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/README.md +271 -40
- package/build/dive.cjs +575 -159
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +83 -57
- package/build/dive.d.ts +83 -57
- package/build/dive.js +614 -164
- package/build/dive.js.map +1 -1
- package/package.json +72 -60
- package/src/__test__/DIVE.test.ts +35 -31
- package/src/animation/AnimationSystem.ts +4 -4
- package/src/animation/__test__/AnimationSystem.test.ts +3 -3
- package/src/axiscamera/AxisCamera.ts +31 -11
- package/src/axiscamera/__test__/AxisCamera.test.ts +18 -10
- package/src/camera/PerspectiveCamera.ts +28 -13
- package/src/camera/__test__/PerspectiveCamera.test.ts +2 -2
- package/src/com/Communication.ts +282 -100
- package/src/com/__test__/Communication.test.ts +207 -141
- package/src/com/actions/camera/computeencompassingview.ts +8 -7
- package/src/com/actions/camera/getcameratransform.ts +8 -7
- package/src/com/actions/camera/movecamera.ts +16 -13
- package/src/com/actions/camera/resetcamera.ts +4 -3
- package/src/com/actions/camera/setcameralayer.ts +4 -3
- package/src/com/actions/camera/setcameratransform.ts +8 -7
- package/src/com/actions/camera/zoomcamera.ts +4 -3
- package/src/com/actions/index.ts +54 -54
- package/src/com/actions/media/generatemedia.ts +17 -13
- package/src/com/actions/object/addobject.ts +5 -4
- package/src/com/actions/object/deleteobject.ts +5 -4
- package/src/com/actions/object/deselectobject.ts +5 -4
- package/src/com/actions/object/getallobjects.ts +5 -4
- package/src/com/actions/object/getobjects.ts +5 -4
- package/src/com/actions/object/model/dropit.ts +4 -3
- package/src/com/actions/object/model/modelloaded.ts +4 -3
- package/src/com/actions/object/model/placeonfloor.ts +4 -3
- package/src/com/actions/object/selectobject.ts +5 -4
- package/src/com/actions/object/setparent.ts +8 -7
- package/src/com/actions/object/updateobject.ts +5 -4
- package/src/com/actions/scene/exportscene.ts +5 -4
- package/src/com/actions/scene/getallscenedata.ts +24 -18
- package/src/com/actions/scene/setbackground.ts +4 -3
- package/src/com/actions/scene/updatescene.ts +10 -9
- package/src/com/actions/toolbox/select/setgizmomode.ts +4 -3
- package/src/com/actions/toolbox/transform/setgizmovisible.ts +4 -3
- package/src/com/actions/toolbox/usetool.ts +5 -4
- package/src/com/types/COMBaseEntity.ts +2 -2
- package/src/com/types/COMEntity.ts +6 -6
- package/src/com/types/COMEntityType.ts +1 -1
- package/src/com/types/COMGeometry.ts +2 -2
- package/src/com/types/COMGroup.ts +3 -3
- package/src/com/types/COMLight.ts +3 -3
- package/src/com/types/COMMaterial.ts +2 -2
- package/src/com/types/COMModel.ts +4 -4
- package/src/com/types/COMPov.ts +3 -3
- package/src/com/types/COMPrimitive.ts +5 -5
- package/src/com/types/index.ts +10 -10
- package/src/constant/AxisHelperColors.ts +1 -1
- package/src/constant/GridColors.ts +1 -1
- package/src/controls/OrbitControls.ts +62 -29
- package/src/controls/__test__/OrbitControls.test.ts +133 -39
- package/src/dive.ts +82 -36
- package/src/gizmo/Gizmo.ts +21 -13
- package/src/gizmo/handles/AxisHandle.ts +40 -17
- package/src/gizmo/handles/RadialHandle.ts +39 -15
- package/src/gizmo/handles/ScaleHandle.ts +62 -25
- package/src/gizmo/plane/GizmoPlane.ts +5 -6
- package/src/gizmo/rotate/RotateGizmo.ts +58 -16
- package/src/gizmo/scale/ScaleGizmo.ts +37 -15
- package/src/gizmo/translate/TranslateGizmo.ts +34 -14
- package/src/grid/Grid.ts +13 -5
- package/src/grid/__test__/Grid.test.ts +5 -3
- package/src/group/Group.ts +9 -7
- package/src/group/__test__/Group.test.ts +8 -6
- package/src/helper/applyMixins/__test__/applyMixins.test.ts +9 -6
- package/src/helper/applyMixins/applyMixins.ts +6 -3
- package/src/helper/findInterface/__test__/findInterface.test.ts +28 -18
- package/src/helper/findInterface/findInterface.ts +7 -4
- package/src/helper/findSceneRecursive/__test__/findSceneRecursive.test.ts +1 -1
- package/src/helper/findSceneRecursive/findSceneRecursive.ts +1 -1
- package/src/helper/getObjectDelta/__test__/getObjectDelta.test.ts +43 -7
- package/src/helper/getObjectDelta/getObjectDelta.ts +13 -9
- package/src/helper/isInterface/__test__/implementsInterface.test.ts +1 -1
- package/src/helper/isInterface/implementsInterface.ts +6 -3
- package/src/info/Info.ts +20 -16
- package/src/info/__test__/Info.test.ts +67 -36
- package/src/interface/Draggable.ts +2 -2
- package/src/interface/Hoverable.ts +2 -2
- package/src/interface/Movable.ts +1 -1
- package/src/interface/Rotatable.ts +1 -1
- package/src/interface/Scalable.ts +1 -1
- package/src/io/IO.ts +21 -43
- package/src/io/__test__/IO.test.ts +16 -62
- package/src/io/gltf/GLTFIO.ts +34 -31
- package/src/io/gltf/__test__/GLTFIO.test.ts +88 -78
- package/src/light/PointLight.ts +42 -9
- package/src/light/SceneLight.ts +5 -5
- package/src/light/__test__/AmbientLight.test.ts +5 -4
- package/src/light/__test__/PointLight.test.ts +14 -10
- package/src/light/__test__/SceneLight.test.ts +19 -13
- package/src/loadingmanager/LoadingManager.ts +11 -6
- package/src/loadingmanager/__test__/LoadingManager.test.ts +14 -9
- package/src/math/__test__/DIVEMath.test.ts +1 -1
- package/src/math/ceil/__test__/ceilExp.test.ts +1 -1
- package/src/math/ceil/ceilExp.ts +2 -2
- package/src/math/floor/__test__/floorExp.test.ts +1 -1
- package/src/math/floor/floorExp.ts +2 -2
- package/src/math/helper/__test__/shift.test.ts +1 -1
- package/src/math/helper/shift.ts +1 -1
- package/src/math/index.ts +7 -7
- package/src/math/round/__test__/roundExp.test.ts +1 -1
- package/src/math/round/roundExp.ts +6 -3
- package/src/math/signedAngleTo/__test__/signedAngleTo.test.ts +10 -4
- package/src/math/signedAngleTo/signedAngleTo.ts +11 -4
- package/src/math/toFixed/__test__/toFixedExp.test.ts +9 -9
- package/src/math/toFixed/toFixedExp.ts +6 -3
- package/src/math/truncate/__test__/truncateExp.test.ts +1 -1
- package/src/math/truncate/truncateExp.ts +6 -3
- package/src/mediacreator/MediaCreator.ts +20 -10
- package/src/mediacreator/__test__/MediaCreator.test.ts +27 -12
- package/src/model/Model.ts +35 -7
- package/src/model/__test__/Model.test.ts +71 -44
- package/src/node/Node.ts +34 -12
- package/src/node/__test__/Node.test.ts +17 -13
- package/src/primitive/Primitive.ts +78 -13
- package/src/primitive/__test__/Primitive.test.ts +49 -38
- package/src/primitive/floor/Floor.ts +14 -3
- package/src/primitive/floor/__test__/Floor.test.ts +10 -4
- package/src/renderer/Renderer.ts +46 -15
- package/src/renderer/__test__/Renderer.test.ts +74 -24
- package/src/scene/Scene.ts +9 -3
- package/src/scene/__test__/Scene.test.ts +2 -2
- package/src/scene/root/Root.ts +142 -75
- package/src/scene/root/__test__/Root.test.ts +439 -111
- package/src/toolbox/BaseTool.ts +69 -33
- package/src/toolbox/Toolbox.ts +37 -17
- package/src/toolbox/__test__/BaseTool.test.ts +324 -160
- package/src/toolbox/__test__/Toolbox.test.ts +31 -14
- package/src/toolbox/select/SelectTool.ts +24 -19
- package/src/toolbox/select/__test__/SelectTool.test.ts +95 -59
- package/src/toolbox/transform/TransformTool.ts +40 -17
- package/src/toolbox/transform/__test__/TransformTool.test.ts +22 -15
- package/src/types/SceneObjects.ts +8 -8
- package/src/types/SceneType.ts +3 -3
- package/src/types/index.ts +3 -6
package/build/dive.js
CHANGED
|
@@ -147,12 +147,18 @@ var init_BaseTool = __esm({
|
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
149
|
this._lastPointerDown.copy(this._pointer);
|
|
150
|
-
this._draggable = findInterface(
|
|
150
|
+
this._draggable = findInterface(
|
|
151
|
+
(_a = this._intersects[0]) == null ? void 0 : _a.object,
|
|
152
|
+
"isDraggable"
|
|
153
|
+
) || null;
|
|
151
154
|
}
|
|
152
155
|
onDragStart(e) {
|
|
153
156
|
if (!this._draggable) return;
|
|
154
157
|
if (this._dragRaycastOnObjects !== null) {
|
|
155
|
-
this._intersects = this._raycaster.intersectObjects(
|
|
158
|
+
this._intersects = this._raycaster.intersectObjects(
|
|
159
|
+
this._dragRaycastOnObjects,
|
|
160
|
+
true
|
|
161
|
+
);
|
|
156
162
|
}
|
|
157
163
|
if (this._intersects.length === 0) return;
|
|
158
164
|
this._dragStart.copy(this._intersects[0].point.clone());
|
|
@@ -176,24 +182,32 @@ var init_BaseTool = __esm({
|
|
|
176
182
|
this._pointer.y = -(e.offsetY / this._canvas.clientHeight) * 2 + 1;
|
|
177
183
|
this._raycaster.setFromCamera(this._pointer, this._controller.object);
|
|
178
184
|
this._intersects = this.raycast(this._scene.children);
|
|
179
|
-
const hoverable = findInterface(
|
|
185
|
+
const hoverable = findInterface(
|
|
186
|
+
(_a = this._intersects[0]) == null ? void 0 : _a.object,
|
|
187
|
+
"isHoverable"
|
|
188
|
+
);
|
|
180
189
|
if (this._intersects[0] && hoverable) {
|
|
181
190
|
if (!this._hovered) {
|
|
182
|
-
if (hoverable.onPointerEnter)
|
|
191
|
+
if (hoverable.onPointerEnter)
|
|
192
|
+
hoverable.onPointerEnter(this._intersects[0]);
|
|
183
193
|
this._hovered = hoverable;
|
|
184
194
|
return;
|
|
185
195
|
}
|
|
186
196
|
if (this._hovered.uuid !== hoverable.uuid) {
|
|
187
|
-
if (this._hovered.onPointerLeave)
|
|
188
|
-
|
|
197
|
+
if (this._hovered.onPointerLeave)
|
|
198
|
+
this._hovered.onPointerLeave();
|
|
199
|
+
if (hoverable.onPointerEnter)
|
|
200
|
+
hoverable.onPointerEnter(this._intersects[0]);
|
|
189
201
|
this._hovered = hoverable;
|
|
190
202
|
return;
|
|
191
203
|
}
|
|
192
|
-
if (hoverable.onPointerOver)
|
|
204
|
+
if (hoverable.onPointerOver)
|
|
205
|
+
hoverable.onPointerOver(this._intersects[0]);
|
|
193
206
|
this._hovered = hoverable;
|
|
194
207
|
} else {
|
|
195
208
|
if (this._hovered) {
|
|
196
|
-
if (this._hovered.onPointerLeave)
|
|
209
|
+
if (this._hovered.onPointerLeave)
|
|
210
|
+
this._hovered.onPointerLeave();
|
|
197
211
|
}
|
|
198
212
|
this._hovered = null;
|
|
199
213
|
}
|
|
@@ -206,13 +220,19 @@ var init_BaseTool = __esm({
|
|
|
206
220
|
}
|
|
207
221
|
onDrag(e) {
|
|
208
222
|
if (this._dragRaycastOnObjects !== null) {
|
|
209
|
-
this._intersects = this._raycaster.intersectObjects(
|
|
223
|
+
this._intersects = this._raycaster.intersectObjects(
|
|
224
|
+
this._dragRaycastOnObjects,
|
|
225
|
+
true
|
|
226
|
+
);
|
|
210
227
|
}
|
|
211
228
|
const intersect = this._intersects[0];
|
|
212
229
|
if (!intersect) return;
|
|
213
230
|
this._dragCurrent.copy(intersect.point.clone());
|
|
214
231
|
this._dragEnd.copy(intersect.point.clone());
|
|
215
|
-
this._dragDelta.subVectors(
|
|
232
|
+
this._dragDelta.subVectors(
|
|
233
|
+
this._dragCurrent.clone(),
|
|
234
|
+
this._dragStart.clone()
|
|
235
|
+
);
|
|
216
236
|
if (this._draggable && this._draggable.onDrag) {
|
|
217
237
|
this._draggable.onDrag({
|
|
218
238
|
dragStart: this._dragStart,
|
|
@@ -250,7 +270,10 @@ var init_BaseTool = __esm({
|
|
|
250
270
|
if (intersect) {
|
|
251
271
|
this._dragEnd.copy(intersect.point.clone());
|
|
252
272
|
this._dragCurrent.copy(intersect.point.clone());
|
|
253
|
-
this._dragDelta.subVectors(
|
|
273
|
+
this._dragDelta.subVectors(
|
|
274
|
+
this._dragCurrent.clone(),
|
|
275
|
+
this._dragStart.clone()
|
|
276
|
+
);
|
|
254
277
|
}
|
|
255
278
|
if (this._draggable && this._draggable.onDragEnd) {
|
|
256
279
|
this._draggable.onDragEnd({
|
|
@@ -271,7 +294,8 @@ var init_BaseTool = __esm({
|
|
|
271
294
|
onWheel(e) {
|
|
272
295
|
}
|
|
273
296
|
raycast(objects) {
|
|
274
|
-
if (objects !== void 0)
|
|
297
|
+
if (objects !== void 0)
|
|
298
|
+
return this._raycaster.intersectObjects(objects, true).filter((i) => i.object.visible);
|
|
275
299
|
return this._raycaster.intersectObjects(this._scene.children, true).filter((i) => i.object.visible);
|
|
276
300
|
}
|
|
277
301
|
pointerWasDragged() {
|
|
@@ -294,22 +318,37 @@ var init_TransformTool = __esm({
|
|
|
294
318
|
super(scene, controller);
|
|
295
319
|
this.isTransformTool = true;
|
|
296
320
|
this.name = "DIVETransformTool";
|
|
297
|
-
this._gizmo = new TransformControls(
|
|
321
|
+
this._gizmo = new TransformControls(
|
|
322
|
+
this._controller.object,
|
|
323
|
+
this._controller.domElement
|
|
324
|
+
);
|
|
298
325
|
this._gizmo.mode = "translate";
|
|
299
326
|
this._gizmo.addEventListener("mouseDown", () => {
|
|
300
327
|
controller.enabled = false;
|
|
301
|
-
if (!implementsInterface(
|
|
328
|
+
if (!implementsInterface(
|
|
329
|
+
this._gizmo.object,
|
|
330
|
+
"isMovable"
|
|
331
|
+
))
|
|
332
|
+
return;
|
|
302
333
|
if (!this._gizmo.object.onMoveStart) return;
|
|
303
334
|
this._gizmo.object.onMoveStart();
|
|
304
335
|
});
|
|
305
336
|
this._gizmo.addEventListener("objectChange", () => {
|
|
306
|
-
if (!implementsInterface(
|
|
337
|
+
if (!implementsInterface(
|
|
338
|
+
this._gizmo.object,
|
|
339
|
+
"isMovable"
|
|
340
|
+
))
|
|
341
|
+
return;
|
|
307
342
|
if (!this._gizmo.object.onMove) return;
|
|
308
343
|
this._gizmo.object.onMove();
|
|
309
344
|
});
|
|
310
345
|
this._gizmo.addEventListener("mouseUp", () => {
|
|
311
346
|
controller.enabled = true;
|
|
312
|
-
if (!implementsInterface(
|
|
347
|
+
if (!implementsInterface(
|
|
348
|
+
this._gizmo.object,
|
|
349
|
+
"isMovable"
|
|
350
|
+
))
|
|
351
|
+
return;
|
|
313
352
|
if (!this._gizmo.object.onMoveEnd) return;
|
|
314
353
|
this._gizmo.object.onMoveEnd();
|
|
315
354
|
});
|
|
@@ -385,7 +424,10 @@ var init_SelectTool = __esm({
|
|
|
385
424
|
onClick(e) {
|
|
386
425
|
super.onClick(e);
|
|
387
426
|
const first = this._raycaster.intersectObjects(this._scene.Root.children, true).filter((intersect) => intersect.object.visible)[0];
|
|
388
|
-
const selectable = findInterface(
|
|
427
|
+
const selectable = findInterface(
|
|
428
|
+
first == null ? void 0 : first.object,
|
|
429
|
+
"isSelectable"
|
|
430
|
+
);
|
|
389
431
|
if (!first || !selectable) {
|
|
390
432
|
if (this._gizmo.object) {
|
|
391
433
|
this.Deselect(this._gizmo.object);
|
|
@@ -508,9 +550,15 @@ var init_GLTFIO = __esm({
|
|
|
508
550
|
}
|
|
509
551
|
Export(object, binary, onlyVisible) {
|
|
510
552
|
if (binary) {
|
|
511
|
-
return this._exporter.parseAsync(object, {
|
|
553
|
+
return this._exporter.parseAsync(object, {
|
|
554
|
+
binary,
|
|
555
|
+
onlyVisible
|
|
556
|
+
});
|
|
512
557
|
} else {
|
|
513
|
-
return this._exporter.parseAsync(object, {
|
|
558
|
+
return this._exporter.parseAsync(object, {
|
|
559
|
+
binary,
|
|
560
|
+
onlyVisible
|
|
561
|
+
});
|
|
514
562
|
}
|
|
515
563
|
}
|
|
516
564
|
};
|
|
@@ -578,7 +626,12 @@ var init_IO = __esm({
|
|
|
578
626
|
});
|
|
579
627
|
|
|
580
628
|
// src/renderer/Renderer.ts
|
|
581
|
-
import {
|
|
629
|
+
import {
|
|
630
|
+
MathUtils,
|
|
631
|
+
NoToneMapping,
|
|
632
|
+
PCFSoftShadowMap,
|
|
633
|
+
WebGLRenderer
|
|
634
|
+
} from "three";
|
|
582
635
|
var DIVERendererDefaultSettings = {
|
|
583
636
|
antialias: true,
|
|
584
637
|
alpha: true,
|
|
@@ -735,7 +788,14 @@ var DIVEAmbientLight = class extends Object3D {
|
|
|
735
788
|
};
|
|
736
789
|
|
|
737
790
|
// src/light/PointLight.ts
|
|
738
|
-
import {
|
|
791
|
+
import {
|
|
792
|
+
PointLight,
|
|
793
|
+
SphereGeometry,
|
|
794
|
+
MeshBasicMaterial,
|
|
795
|
+
Mesh,
|
|
796
|
+
FrontSide,
|
|
797
|
+
Object3D as Object3D3
|
|
798
|
+
} from "three";
|
|
739
799
|
|
|
740
800
|
// src/com/Communication.ts
|
|
741
801
|
init_SelectTool();
|
|
@@ -756,9 +816,15 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
756
816
|
_DIVECommunication.__instances.push(this);
|
|
757
817
|
}
|
|
758
818
|
static get(id) {
|
|
759
|
-
const fromComID = this.__instances.find(
|
|
819
|
+
const fromComID = this.__instances.find(
|
|
820
|
+
(instance) => instance.id === id
|
|
821
|
+
);
|
|
760
822
|
if (fromComID) return fromComID;
|
|
761
|
-
return this.__instances.find(
|
|
823
|
+
return this.__instances.find(
|
|
824
|
+
(instance) => Array.from(instance.registered.values()).find(
|
|
825
|
+
(object) => object.id === id
|
|
826
|
+
)
|
|
827
|
+
);
|
|
762
828
|
}
|
|
763
829
|
get id() {
|
|
764
830
|
return this._id;
|
|
@@ -766,7 +832,11 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
766
832
|
get mediaGenerator() {
|
|
767
833
|
if (!this._mediaGenerator) {
|
|
768
834
|
const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).DIVEMediaCreator;
|
|
769
|
-
this._mediaGenerator = new DIVEMediaCreator2(
|
|
835
|
+
this._mediaGenerator = new DIVEMediaCreator2(
|
|
836
|
+
this.renderer,
|
|
837
|
+
this.scene,
|
|
838
|
+
this.controller
|
|
839
|
+
);
|
|
770
840
|
}
|
|
771
841
|
return this._mediaGenerator;
|
|
772
842
|
}
|
|
@@ -778,7 +848,9 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
778
848
|
return this._io;
|
|
779
849
|
}
|
|
780
850
|
DestroyInstance() {
|
|
781
|
-
const existingIndex = _DIVECommunication.__instances.findIndex(
|
|
851
|
+
const existingIndex = _DIVECommunication.__instances.findIndex(
|
|
852
|
+
(entry) => entry.id === this.id
|
|
853
|
+
);
|
|
782
854
|
if (existingIndex === -1) return false;
|
|
783
855
|
_DIVECommunication.__instances.splice(existingIndex, 1);
|
|
784
856
|
return true;
|
|
@@ -787,107 +859,159 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
787
859
|
let returnValue = false;
|
|
788
860
|
switch (action) {
|
|
789
861
|
case "GET_ALL_SCENE_DATA": {
|
|
790
|
-
returnValue = this.getAllSceneData(
|
|
862
|
+
returnValue = this.getAllSceneData(
|
|
863
|
+
payload
|
|
864
|
+
);
|
|
791
865
|
break;
|
|
792
866
|
}
|
|
793
867
|
case "GET_ALL_OBJECTS": {
|
|
794
|
-
returnValue = this.getAllObjects(
|
|
868
|
+
returnValue = this.getAllObjects(
|
|
869
|
+
payload
|
|
870
|
+
);
|
|
795
871
|
break;
|
|
796
872
|
}
|
|
797
873
|
case "GET_OBJECTS": {
|
|
798
|
-
returnValue = this.getObjects(
|
|
874
|
+
returnValue = this.getObjects(
|
|
875
|
+
payload
|
|
876
|
+
);
|
|
799
877
|
break;
|
|
800
878
|
}
|
|
801
879
|
case "ADD_OBJECT": {
|
|
802
|
-
returnValue = this.addObject(
|
|
880
|
+
returnValue = this.addObject(
|
|
881
|
+
payload
|
|
882
|
+
);
|
|
803
883
|
break;
|
|
804
884
|
}
|
|
805
885
|
case "UPDATE_OBJECT": {
|
|
806
|
-
returnValue = this.updateObject(
|
|
886
|
+
returnValue = this.updateObject(
|
|
887
|
+
payload
|
|
888
|
+
);
|
|
807
889
|
break;
|
|
808
890
|
}
|
|
809
891
|
case "DELETE_OBJECT": {
|
|
810
|
-
returnValue = this.deleteObject(
|
|
892
|
+
returnValue = this.deleteObject(
|
|
893
|
+
payload
|
|
894
|
+
);
|
|
811
895
|
break;
|
|
812
896
|
}
|
|
813
897
|
case "SELECT_OBJECT": {
|
|
814
|
-
returnValue = this.selectObject(
|
|
898
|
+
returnValue = this.selectObject(
|
|
899
|
+
payload
|
|
900
|
+
);
|
|
815
901
|
break;
|
|
816
902
|
}
|
|
817
903
|
case "DESELECT_OBJECT": {
|
|
818
|
-
returnValue = this.deselectObject(
|
|
904
|
+
returnValue = this.deselectObject(
|
|
905
|
+
payload
|
|
906
|
+
);
|
|
819
907
|
break;
|
|
820
908
|
}
|
|
821
909
|
case "SET_BACKGROUND": {
|
|
822
|
-
returnValue = this.setBackground(
|
|
910
|
+
returnValue = this.setBackground(
|
|
911
|
+
payload
|
|
912
|
+
);
|
|
823
913
|
break;
|
|
824
914
|
}
|
|
825
915
|
case "DROP_IT": {
|
|
826
|
-
returnValue = this.dropIt(
|
|
916
|
+
returnValue = this.dropIt(
|
|
917
|
+
payload
|
|
918
|
+
);
|
|
827
919
|
break;
|
|
828
920
|
}
|
|
829
921
|
case "PLACE_ON_FLOOR": {
|
|
830
|
-
returnValue = this.placeOnFloor(
|
|
922
|
+
returnValue = this.placeOnFloor(
|
|
923
|
+
payload
|
|
924
|
+
);
|
|
831
925
|
break;
|
|
832
926
|
}
|
|
833
927
|
case "SET_CAMERA_TRANSFORM": {
|
|
834
|
-
returnValue = this.setCameraTransform(
|
|
928
|
+
returnValue = this.setCameraTransform(
|
|
929
|
+
payload
|
|
930
|
+
);
|
|
835
931
|
break;
|
|
836
932
|
}
|
|
837
933
|
case "GET_CAMERA_TRANSFORM": {
|
|
838
|
-
returnValue = this.getCameraTransform(
|
|
934
|
+
returnValue = this.getCameraTransform(
|
|
935
|
+
payload
|
|
936
|
+
);
|
|
839
937
|
break;
|
|
840
938
|
}
|
|
841
939
|
case "MOVE_CAMERA": {
|
|
842
|
-
returnValue = this.moveCamera(
|
|
940
|
+
returnValue = this.moveCamera(
|
|
941
|
+
payload
|
|
942
|
+
);
|
|
843
943
|
break;
|
|
844
944
|
}
|
|
845
945
|
case "RESET_CAMERA": {
|
|
846
|
-
returnValue = this.resetCamera(
|
|
946
|
+
returnValue = this.resetCamera(
|
|
947
|
+
payload
|
|
948
|
+
);
|
|
847
949
|
break;
|
|
848
950
|
}
|
|
849
951
|
case "COMPUTE_ENCOMPASSING_VIEW": {
|
|
850
|
-
returnValue = this.computeEncompassingView(
|
|
952
|
+
returnValue = this.computeEncompassingView(
|
|
953
|
+
payload
|
|
954
|
+
);
|
|
851
955
|
break;
|
|
852
956
|
}
|
|
853
957
|
case "SET_CAMERA_LAYER": {
|
|
854
|
-
returnValue = this.setCameraLayer(
|
|
958
|
+
returnValue = this.setCameraLayer(
|
|
959
|
+
payload
|
|
960
|
+
);
|
|
855
961
|
break;
|
|
856
962
|
}
|
|
857
963
|
case "ZOOM_CAMERA": {
|
|
858
|
-
returnValue = this.zoomCamera(
|
|
964
|
+
returnValue = this.zoomCamera(
|
|
965
|
+
payload
|
|
966
|
+
);
|
|
859
967
|
break;
|
|
860
968
|
}
|
|
861
969
|
case "SET_GIZMO_MODE": {
|
|
862
|
-
returnValue = this.setGizmoMode(
|
|
970
|
+
returnValue = this.setGizmoMode(
|
|
971
|
+
payload
|
|
972
|
+
);
|
|
863
973
|
break;
|
|
864
974
|
}
|
|
865
975
|
case "SET_GIZMO_VISIBILITY": {
|
|
866
|
-
returnValue = this.setGizmoVisibility(
|
|
976
|
+
returnValue = this.setGizmoVisibility(
|
|
977
|
+
payload
|
|
978
|
+
);
|
|
867
979
|
break;
|
|
868
980
|
}
|
|
869
981
|
case "USE_TOOL": {
|
|
870
|
-
returnValue = this.useTool(
|
|
982
|
+
returnValue = this.useTool(
|
|
983
|
+
payload
|
|
984
|
+
);
|
|
871
985
|
break;
|
|
872
986
|
}
|
|
873
987
|
case "MODEL_LOADED": {
|
|
874
|
-
returnValue = this.modelLoaded(
|
|
988
|
+
returnValue = this.modelLoaded(
|
|
989
|
+
payload
|
|
990
|
+
);
|
|
875
991
|
break;
|
|
876
992
|
}
|
|
877
993
|
case "UPDATE_SCENE": {
|
|
878
|
-
returnValue = this.updateScene(
|
|
994
|
+
returnValue = this.updateScene(
|
|
995
|
+
payload
|
|
996
|
+
);
|
|
879
997
|
break;
|
|
880
998
|
}
|
|
881
999
|
case "GENERATE_MEDIA": {
|
|
882
|
-
returnValue = this.generateMedia(
|
|
1000
|
+
returnValue = this.generateMedia(
|
|
1001
|
+
payload
|
|
1002
|
+
);
|
|
883
1003
|
break;
|
|
884
1004
|
}
|
|
885
1005
|
case "SET_PARENT": {
|
|
886
|
-
returnValue = this.setParent(
|
|
1006
|
+
returnValue = this.setParent(
|
|
1007
|
+
payload
|
|
1008
|
+
);
|
|
887
1009
|
break;
|
|
888
1010
|
}
|
|
889
1011
|
case "EXPORT_SCENE": {
|
|
890
|
-
returnValue = this.exportScene(
|
|
1012
|
+
returnValue = this.exportScene(
|
|
1013
|
+
payload
|
|
1014
|
+
);
|
|
891
1015
|
break;
|
|
892
1016
|
}
|
|
893
1017
|
}
|
|
@@ -900,7 +1024,9 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
900
1024
|
return () => {
|
|
901
1025
|
const listenerArray = this.listeners.get(type);
|
|
902
1026
|
if (!listenerArray) return false;
|
|
903
|
-
const existingIndex = listenerArray.findIndex(
|
|
1027
|
+
const existingIndex = listenerArray.findIndex(
|
|
1028
|
+
(entry) => entry === listener
|
|
1029
|
+
);
|
|
904
1030
|
if (existingIndex === -1) return false;
|
|
905
1031
|
listenerArray.splice(existingIndex, 1);
|
|
906
1032
|
return true;
|
|
@@ -923,11 +1049,21 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
923
1049
|
target: this.controller.target.clone()
|
|
924
1050
|
},
|
|
925
1051
|
spotmarks: [],
|
|
926
|
-
lights: Array.from(this.registered.values()).filter(
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1052
|
+
lights: Array.from(this.registered.values()).filter(
|
|
1053
|
+
(object) => object.entityType === "light"
|
|
1054
|
+
),
|
|
1055
|
+
objects: Array.from(this.registered.values()).filter(
|
|
1056
|
+
(object) => object.entityType === "model"
|
|
1057
|
+
),
|
|
1058
|
+
cameras: Array.from(this.registered.values()).filter(
|
|
1059
|
+
(object) => object.entityType === "pov"
|
|
1060
|
+
),
|
|
1061
|
+
primitives: Array.from(this.registered.values()).filter(
|
|
1062
|
+
(object) => object.entityType === "primitive"
|
|
1063
|
+
),
|
|
1064
|
+
groups: Array.from(this.registered.values()).filter(
|
|
1065
|
+
(object) => object.entityType === "group"
|
|
1066
|
+
)
|
|
931
1067
|
};
|
|
932
1068
|
Object.assign(payload, sceneData);
|
|
933
1069
|
return sceneData;
|
|
@@ -957,7 +1093,10 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
957
1093
|
if (!objectToUpdate) return false;
|
|
958
1094
|
this.registered.set(payload.id, merge(objectToUpdate, payload));
|
|
959
1095
|
const updatedObject = this.registered.get(payload.id);
|
|
960
|
-
this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), {
|
|
1096
|
+
this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), {
|
|
1097
|
+
id: updatedObject.id,
|
|
1098
|
+
entityType: updatedObject.entityType
|
|
1099
|
+
}));
|
|
961
1100
|
Object.assign(payload, updatedObject);
|
|
962
1101
|
return true;
|
|
963
1102
|
}
|
|
@@ -1035,7 +1174,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1035
1174
|
position = payload.position;
|
|
1036
1175
|
target = payload.target;
|
|
1037
1176
|
}
|
|
1038
|
-
this.controller.MoveTo(
|
|
1177
|
+
this.controller.MoveTo(
|
|
1178
|
+
position,
|
|
1179
|
+
target,
|
|
1180
|
+
payload.duration,
|
|
1181
|
+
payload.locked
|
|
1182
|
+
);
|
|
1039
1183
|
return true;
|
|
1040
1184
|
}
|
|
1041
1185
|
setCameraLayer(payload) {
|
|
@@ -1075,10 +1219,14 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1075
1219
|
}
|
|
1076
1220
|
updateScene(payload) {
|
|
1077
1221
|
if (payload.name !== void 0) this.scene.name = payload.name;
|
|
1078
|
-
if (payload.backgroundColor !== void 0)
|
|
1079
|
-
|
|
1080
|
-
if (payload.
|
|
1081
|
-
|
|
1222
|
+
if (payload.backgroundColor !== void 0)
|
|
1223
|
+
this.scene.SetBackground(payload.backgroundColor);
|
|
1224
|
+
if (payload.gridEnabled !== void 0)
|
|
1225
|
+
this.scene.Grid.SetVisibility(payload.gridEnabled);
|
|
1226
|
+
if (payload.floorEnabled !== void 0)
|
|
1227
|
+
this.scene.Floor.SetVisibility(payload.floorEnabled);
|
|
1228
|
+
if (payload.floorColor !== void 0)
|
|
1229
|
+
this.scene.Floor.SetColor(payload.floorColor);
|
|
1082
1230
|
payload.name = this.scene.name;
|
|
1083
1231
|
payload.backgroundColor = "#" + this.scene.background.getHexString();
|
|
1084
1232
|
payload.gridEnabled = this.scene.Grid.visible;
|
|
@@ -1096,7 +1244,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1096
1244
|
position = payload.position;
|
|
1097
1245
|
target = payload.target;
|
|
1098
1246
|
}
|
|
1099
|
-
payload.dataUri = this.mediaGenerator.GenerateMedia(
|
|
1247
|
+
payload.dataUri = this.mediaGenerator.GenerateMedia(
|
|
1248
|
+
position,
|
|
1249
|
+
target,
|
|
1250
|
+
payload.width,
|
|
1251
|
+
payload.height
|
|
1252
|
+
);
|
|
1100
1253
|
return true;
|
|
1101
1254
|
}
|
|
1102
1255
|
setParent(payload) {
|
|
@@ -1149,8 +1302,17 @@ var DIVEPointLight = class extends Object3D3 {
|
|
|
1149
1302
|
this.light.shadow.mapSize.height = 512;
|
|
1150
1303
|
this.add(this.light);
|
|
1151
1304
|
const geoSize = 0.1;
|
|
1152
|
-
const geometry = new SphereGeometry(
|
|
1153
|
-
|
|
1305
|
+
const geometry = new SphereGeometry(
|
|
1306
|
+
geoSize,
|
|
1307
|
+
geoSize * 320,
|
|
1308
|
+
geoSize * 320
|
|
1309
|
+
);
|
|
1310
|
+
const material = new MeshBasicMaterial({
|
|
1311
|
+
color: this.light.color,
|
|
1312
|
+
transparent: true,
|
|
1313
|
+
opacity: 0.8,
|
|
1314
|
+
side: FrontSide
|
|
1315
|
+
});
|
|
1154
1316
|
this.mesh = new Mesh(geometry, material);
|
|
1155
1317
|
this.mesh.layers.mask = UI_LAYER_MASK;
|
|
1156
1318
|
this.add(this.mesh);
|
|
@@ -1168,15 +1330,24 @@ var DIVEPointLight = class extends Object3D3 {
|
|
|
1168
1330
|
}
|
|
1169
1331
|
onMove() {
|
|
1170
1332
|
var _a;
|
|
1171
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1333
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1334
|
+
"UPDATE_OBJECT",
|
|
1335
|
+
{ id: this.userData.id, position: this.position }
|
|
1336
|
+
);
|
|
1172
1337
|
}
|
|
1173
1338
|
onSelect() {
|
|
1174
1339
|
var _a;
|
|
1175
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1340
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1341
|
+
"SELECT_OBJECT",
|
|
1342
|
+
{ id: this.userData.id }
|
|
1343
|
+
);
|
|
1176
1344
|
}
|
|
1177
1345
|
onDeselect() {
|
|
1178
1346
|
var _a;
|
|
1179
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1347
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1348
|
+
"DESELECT_OBJECT",
|
|
1349
|
+
{ id: this.userData.id }
|
|
1350
|
+
);
|
|
1180
1351
|
}
|
|
1181
1352
|
};
|
|
1182
1353
|
|
|
@@ -1262,22 +1433,44 @@ var DIVENode = class extends Object3D5 {
|
|
|
1262
1433
|
SetToWorldOrigin() {
|
|
1263
1434
|
var _a;
|
|
1264
1435
|
this.position.set(0, 0, 0);
|
|
1265
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1436
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1437
|
+
"UPDATE_OBJECT",
|
|
1438
|
+
{
|
|
1439
|
+
id: this.userData.id,
|
|
1440
|
+
position: this.position,
|
|
1441
|
+
rotation: this.rotation,
|
|
1442
|
+
scale: this.scale
|
|
1443
|
+
}
|
|
1444
|
+
);
|
|
1266
1445
|
}
|
|
1267
1446
|
onMove() {
|
|
1268
1447
|
var _a;
|
|
1269
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1448
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1449
|
+
"UPDATE_OBJECT",
|
|
1450
|
+
{
|
|
1451
|
+
id: this.userData.id,
|
|
1452
|
+
position: this.position,
|
|
1453
|
+
rotation: this.rotation,
|
|
1454
|
+
scale: this.scale
|
|
1455
|
+
}
|
|
1456
|
+
);
|
|
1270
1457
|
if (this.parent && "isDIVEGroup" in this.parent) {
|
|
1271
1458
|
this.parent.UpdateLineTo(this);
|
|
1272
1459
|
}
|
|
1273
1460
|
}
|
|
1274
1461
|
onSelect() {
|
|
1275
1462
|
var _a;
|
|
1276
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1463
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1464
|
+
"SELECT_OBJECT",
|
|
1465
|
+
{ id: this.userData.id }
|
|
1466
|
+
);
|
|
1277
1467
|
}
|
|
1278
1468
|
onDeselect() {
|
|
1279
1469
|
var _a;
|
|
1280
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1470
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1471
|
+
"DESELECT_OBJECT",
|
|
1472
|
+
{ id: this.userData.id }
|
|
1473
|
+
);
|
|
1281
1474
|
}
|
|
1282
1475
|
};
|
|
1283
1476
|
|
|
@@ -1348,20 +1541,36 @@ var DIVEModel = class extends DIVENode {
|
|
|
1348
1541
|
PlaceOnFloor() {
|
|
1349
1542
|
var _a;
|
|
1350
1543
|
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1351
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1544
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1545
|
+
"UPDATE_OBJECT",
|
|
1546
|
+
{
|
|
1547
|
+
id: this.userData.id,
|
|
1548
|
+
position: this.position,
|
|
1549
|
+
rotation: this.rotation,
|
|
1550
|
+
scale: this.scale
|
|
1551
|
+
}
|
|
1552
|
+
);
|
|
1352
1553
|
}
|
|
1353
1554
|
DropIt() {
|
|
1354
1555
|
var _a;
|
|
1355
1556
|
if (!this.parent) {
|
|
1356
|
-
console.warn(
|
|
1557
|
+
console.warn(
|
|
1558
|
+
"DIVEModel: DropIt() called on a model that is not in the scene.",
|
|
1559
|
+
this
|
|
1560
|
+
);
|
|
1357
1561
|
return;
|
|
1358
1562
|
}
|
|
1359
1563
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1360
|
-
const bbBottomCenter = this.localToWorld(
|
|
1564
|
+
const bbBottomCenter = this.localToWorld(
|
|
1565
|
+
this._boundingBox.getCenter(new Vector32()).multiply(this.scale)
|
|
1566
|
+
);
|
|
1361
1567
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1362
1568
|
const raycaster = new Raycaster2(bbBottomCenter, new Vector32(0, -1, 0));
|
|
1363
1569
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1364
|
-
const intersections = raycaster.intersectObjects(
|
|
1570
|
+
const intersections = raycaster.intersectObjects(
|
|
1571
|
+
findSceneRecursive(this).Root.children,
|
|
1572
|
+
true
|
|
1573
|
+
);
|
|
1365
1574
|
if (intersections.length > 0) {
|
|
1366
1575
|
const mesh = intersections[0].object;
|
|
1367
1576
|
mesh.geometry.computeBoundingBox();
|
|
@@ -1371,7 +1580,15 @@ var DIVEModel = class extends DIVENode {
|
|
|
1371
1580
|
const newPos = this.position.clone().setY(worldPos.y).sub(new Vector32(0, bottomY, 0));
|
|
1372
1581
|
this.position.copy(newPos);
|
|
1373
1582
|
if (this.position.y === oldPos.y) return;
|
|
1374
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1583
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1584
|
+
"UPDATE_OBJECT",
|
|
1585
|
+
{
|
|
1586
|
+
id: this.userData.id,
|
|
1587
|
+
position: this.position,
|
|
1588
|
+
rotation: this.rotation,
|
|
1589
|
+
scale: this.scale
|
|
1590
|
+
}
|
|
1591
|
+
);
|
|
1375
1592
|
}
|
|
1376
1593
|
}
|
|
1377
1594
|
};
|
|
@@ -1384,7 +1601,9 @@ var DIVELoadingManager = class {
|
|
|
1384
1601
|
this.progress = /* @__PURE__ */ new Map();
|
|
1385
1602
|
this.gltfloader = new GLTFLoader2();
|
|
1386
1603
|
this.dracoloader = new DRACOLoader();
|
|
1387
|
-
this.dracoloader.setDecoderPath(
|
|
1604
|
+
this.dracoloader.setDecoderPath(
|
|
1605
|
+
"https://www.gstatic.com/draco/v1/decoders/"
|
|
1606
|
+
);
|
|
1388
1607
|
this.gltfloader.setDRACOLoader(this.dracoloader);
|
|
1389
1608
|
}
|
|
1390
1609
|
LoadGLTF(uri) {
|
|
@@ -1409,7 +1628,18 @@ var DIVELoadingManager = class {
|
|
|
1409
1628
|
};
|
|
1410
1629
|
|
|
1411
1630
|
// src/primitive/Primitive.ts
|
|
1412
|
-
import {
|
|
1631
|
+
import {
|
|
1632
|
+
BoxGeometry,
|
|
1633
|
+
BufferGeometry,
|
|
1634
|
+
Color as Color4,
|
|
1635
|
+
ConeGeometry,
|
|
1636
|
+
CylinderGeometry,
|
|
1637
|
+
Mesh as Mesh3,
|
|
1638
|
+
MeshStandardMaterial as MeshStandardMaterial2,
|
|
1639
|
+
Raycaster as Raycaster3,
|
|
1640
|
+
SphereGeometry as SphereGeometry2,
|
|
1641
|
+
Vector3 as Vector33
|
|
1642
|
+
} from "three";
|
|
1413
1643
|
init_VisibilityLayerMask();
|
|
1414
1644
|
var DIVEPrimitive = class extends DIVENode {
|
|
1415
1645
|
constructor() {
|
|
@@ -1463,20 +1693,36 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1463
1693
|
PlaceOnFloor() {
|
|
1464
1694
|
var _a;
|
|
1465
1695
|
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1466
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1696
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1697
|
+
"UPDATE_OBJECT",
|
|
1698
|
+
{
|
|
1699
|
+
id: this.userData.id,
|
|
1700
|
+
position: this.position,
|
|
1701
|
+
rotation: this.rotation,
|
|
1702
|
+
scale: this.scale
|
|
1703
|
+
}
|
|
1704
|
+
);
|
|
1467
1705
|
}
|
|
1468
1706
|
DropIt() {
|
|
1469
1707
|
var _a;
|
|
1470
1708
|
if (!this.parent) {
|
|
1471
|
-
console.warn(
|
|
1709
|
+
console.warn(
|
|
1710
|
+
"DIVEPrimitive: DropIt() called on a model that is not in the scene.",
|
|
1711
|
+
this
|
|
1712
|
+
);
|
|
1472
1713
|
return;
|
|
1473
1714
|
}
|
|
1474
1715
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1475
|
-
const bbBottomCenter = this.localToWorld(
|
|
1716
|
+
const bbBottomCenter = this.localToWorld(
|
|
1717
|
+
this._boundingBox.getCenter(new Vector33()).multiply(this.scale)
|
|
1718
|
+
);
|
|
1476
1719
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1477
1720
|
const raycaster = new Raycaster3(bbBottomCenter, new Vector33(0, -1, 0));
|
|
1478
1721
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1479
|
-
const intersections = raycaster.intersectObjects(
|
|
1722
|
+
const intersections = raycaster.intersectObjects(
|
|
1723
|
+
findSceneRecursive(this).Root.children,
|
|
1724
|
+
true
|
|
1725
|
+
);
|
|
1480
1726
|
if (intersections.length > 0) {
|
|
1481
1727
|
const mesh = intersections[0].object;
|
|
1482
1728
|
mesh.geometry.computeBoundingBox();
|
|
@@ -1486,7 +1732,15 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1486
1732
|
const newPos = this.position.clone().setY(worldPos.y).sub(new Vector33(0, bottomY, 0));
|
|
1487
1733
|
this.position.copy(newPos);
|
|
1488
1734
|
if (this.position.y === oldPos.y) return;
|
|
1489
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1735
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1736
|
+
"UPDATE_OBJECT",
|
|
1737
|
+
{
|
|
1738
|
+
id: this.userData.id,
|
|
1739
|
+
position: this.position,
|
|
1740
|
+
rotation: this.rotation,
|
|
1741
|
+
scale: this.scale
|
|
1742
|
+
}
|
|
1743
|
+
);
|
|
1490
1744
|
}
|
|
1491
1745
|
}
|
|
1492
1746
|
assembleGeometry(geometry) {
|
|
@@ -1506,13 +1760,21 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1506
1760
|
case "plane":
|
|
1507
1761
|
return this.createPlaneGeometry(geometry);
|
|
1508
1762
|
default: {
|
|
1509
|
-
console.warn(
|
|
1763
|
+
console.warn(
|
|
1764
|
+
"DIVEPrimitive: Invalid geometry type:",
|
|
1765
|
+
geometry.name.toLowerCase()
|
|
1766
|
+
);
|
|
1510
1767
|
return new BufferGeometry();
|
|
1511
1768
|
}
|
|
1512
1769
|
}
|
|
1513
1770
|
}
|
|
1514
1771
|
createCylinderGeometry(geometry) {
|
|
1515
|
-
const geo = new CylinderGeometry(
|
|
1772
|
+
const geo = new CylinderGeometry(
|
|
1773
|
+
geometry.width / 2,
|
|
1774
|
+
geometry.width / 2,
|
|
1775
|
+
geometry.height,
|
|
1776
|
+
64
|
|
1777
|
+
);
|
|
1516
1778
|
geo.translate(0, geometry.height / 2, 0);
|
|
1517
1779
|
return geo;
|
|
1518
1780
|
}
|
|
@@ -1521,13 +1783,23 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1521
1783
|
return geo;
|
|
1522
1784
|
}
|
|
1523
1785
|
createPyramidGeometry(geometry) {
|
|
1524
|
-
const geo = new ConeGeometry(
|
|
1786
|
+
const geo = new ConeGeometry(
|
|
1787
|
+
geometry.width / 2,
|
|
1788
|
+
geometry.height,
|
|
1789
|
+
4,
|
|
1790
|
+
1,
|
|
1791
|
+
true
|
|
1792
|
+
);
|
|
1525
1793
|
geo.rotateY(Math.PI / 4);
|
|
1526
1794
|
geo.translate(0, geometry.height / 2, 0);
|
|
1527
1795
|
return geo;
|
|
1528
1796
|
}
|
|
1529
1797
|
createBoxGeometry(geometry) {
|
|
1530
|
-
const geo = new BoxGeometry(
|
|
1798
|
+
const geo = new BoxGeometry(
|
|
1799
|
+
geometry.width,
|
|
1800
|
+
geometry.height,
|
|
1801
|
+
geometry.depth
|
|
1802
|
+
);
|
|
1531
1803
|
geo.translate(0, geometry.height / 2, 0);
|
|
1532
1804
|
return geo;
|
|
1533
1805
|
}
|
|
@@ -1537,12 +1809,21 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1537
1809
|
return geo;
|
|
1538
1810
|
}
|
|
1539
1811
|
createWallGeometry(geometry) {
|
|
1540
|
-
const geo = new BoxGeometry(
|
|
1812
|
+
const geo = new BoxGeometry(
|
|
1813
|
+
geometry.width,
|
|
1814
|
+
geometry.height,
|
|
1815
|
+
geometry.depth || 0.05,
|
|
1816
|
+
16
|
|
1817
|
+
);
|
|
1541
1818
|
geo.translate(0, geometry.height / 2, 0);
|
|
1542
1819
|
return geo;
|
|
1543
1820
|
}
|
|
1544
1821
|
createPlaneGeometry(geometry) {
|
|
1545
|
-
const geo = new BoxGeometry(
|
|
1822
|
+
const geo = new BoxGeometry(
|
|
1823
|
+
geometry.width,
|
|
1824
|
+
geometry.height,
|
|
1825
|
+
geometry.depth
|
|
1826
|
+
);
|
|
1546
1827
|
geo.translate(0, geometry.height / 2, 0);
|
|
1547
1828
|
return geo;
|
|
1548
1829
|
}
|
|
@@ -1613,7 +1894,10 @@ var DIVEGroup = class extends DIVENode {
|
|
|
1613
1894
|
* Updates a line to the object.
|
|
1614
1895
|
*/
|
|
1615
1896
|
updateLineTo(line, object) {
|
|
1616
|
-
line.geometry.setFromPoints([
|
|
1897
|
+
line.geometry.setFromPoints([
|
|
1898
|
+
new Vector34(0, 0, 0),
|
|
1899
|
+
object.position.clone()
|
|
1900
|
+
]);
|
|
1617
1901
|
line.computeLineDistances();
|
|
1618
1902
|
}
|
|
1619
1903
|
// public SetBoundingBoxVisibility(visible: boolean): void {
|
|
@@ -1791,20 +2075,39 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1791
2075
|
break;
|
|
1792
2076
|
}
|
|
1793
2077
|
default: {
|
|
1794
|
-
console.warn(
|
|
2078
|
+
console.warn(
|
|
2079
|
+
`DIVERoot.updateLight: Unknown light type: ${light.type}`
|
|
2080
|
+
);
|
|
1795
2081
|
return;
|
|
1796
2082
|
}
|
|
1797
2083
|
}
|
|
1798
2084
|
sceneObject.userData.id = light.id;
|
|
1799
2085
|
this.add(sceneObject);
|
|
1800
2086
|
}
|
|
1801
|
-
if (light.name !== void 0 && light.name !== null)
|
|
1802
|
-
|
|
1803
|
-
if (light.
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2087
|
+
if (light.name !== void 0 && light.name !== null)
|
|
2088
|
+
sceneObject.name = light.name;
|
|
2089
|
+
if (light.position !== void 0 && light.position !== null)
|
|
2090
|
+
sceneObject.position.set(
|
|
2091
|
+
light.position.x,
|
|
2092
|
+
light.position.y,
|
|
2093
|
+
light.position.z
|
|
2094
|
+
);
|
|
2095
|
+
if (light.intensity !== void 0 && light.intensity !== null)
|
|
2096
|
+
sceneObject.SetIntensity(
|
|
2097
|
+
light.intensity
|
|
2098
|
+
);
|
|
2099
|
+
if (light.enabled !== void 0 && light.enabled !== null)
|
|
2100
|
+
sceneObject.SetEnabled(
|
|
2101
|
+
light.enabled
|
|
2102
|
+
);
|
|
2103
|
+
if (light.color !== void 0 && light.color !== null)
|
|
2104
|
+
sceneObject.SetColor(
|
|
2105
|
+
new Color5(light.color)
|
|
2106
|
+
);
|
|
2107
|
+
if (light.visible !== void 0 && light.visible !== null)
|
|
2108
|
+
sceneObject.visible = light.visible;
|
|
2109
|
+
if (light.parentId !== void 0)
|
|
2110
|
+
this.setParent(__spreadProps(__spreadValues({}, light), { parentId: light.parentId }));
|
|
1808
2111
|
}
|
|
1809
2112
|
updateModel(model) {
|
|
1810
2113
|
let sceneObject = this.GetSceneObject(model);
|
|
@@ -1818,16 +2121,25 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1818
2121
|
this.loadingManager.LoadGLTF(model.uri).then((gltf) => {
|
|
1819
2122
|
var _a;
|
|
1820
2123
|
sceneObject.SetModel(gltf);
|
|
1821
|
-
(_a = DIVECommunication.get(model.id)) == null ? void 0 : _a.PerformAction(
|
|
2124
|
+
(_a = DIVECommunication.get(model.id)) == null ? void 0 : _a.PerformAction(
|
|
2125
|
+
"MODEL_LOADED",
|
|
2126
|
+
{ id: model.id }
|
|
2127
|
+
);
|
|
1822
2128
|
});
|
|
1823
2129
|
}
|
|
1824
2130
|
if (model.name !== void 0) sceneObject.name = model.name;
|
|
1825
|
-
if (model.position !== void 0)
|
|
1826
|
-
|
|
1827
|
-
if (model.
|
|
1828
|
-
|
|
1829
|
-
if (model.
|
|
1830
|
-
|
|
2131
|
+
if (model.position !== void 0)
|
|
2132
|
+
sceneObject.SetPosition(model.position);
|
|
2133
|
+
if (model.rotation !== void 0)
|
|
2134
|
+
sceneObject.SetRotation(model.rotation);
|
|
2135
|
+
if (model.scale !== void 0)
|
|
2136
|
+
sceneObject.SetScale(model.scale);
|
|
2137
|
+
if (model.visible !== void 0)
|
|
2138
|
+
sceneObject.SetVisibility(model.visible);
|
|
2139
|
+
if (model.material !== void 0)
|
|
2140
|
+
sceneObject.SetMaterial(model.material);
|
|
2141
|
+
if (model.parentId !== void 0)
|
|
2142
|
+
this.setParent(__spreadProps(__spreadValues({}, model), { parentId: model.parentId }));
|
|
1831
2143
|
}
|
|
1832
2144
|
updatePrimitive(primitive) {
|
|
1833
2145
|
let sceneObject = this.GetSceneObject(primitive);
|
|
@@ -1838,13 +2150,20 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1838
2150
|
this.add(sceneObject);
|
|
1839
2151
|
}
|
|
1840
2152
|
if (primitive.name !== void 0) sceneObject.name = primitive.name;
|
|
1841
|
-
if (primitive.geometry !== void 0)
|
|
1842
|
-
|
|
1843
|
-
if (primitive.
|
|
1844
|
-
|
|
1845
|
-
if (primitive.
|
|
1846
|
-
|
|
1847
|
-
if (primitive.
|
|
2153
|
+
if (primitive.geometry !== void 0)
|
|
2154
|
+
sceneObject.SetGeometry(primitive.geometry);
|
|
2155
|
+
if (primitive.position !== void 0)
|
|
2156
|
+
sceneObject.SetPosition(primitive.position);
|
|
2157
|
+
if (primitive.rotation !== void 0)
|
|
2158
|
+
sceneObject.SetRotation(primitive.rotation);
|
|
2159
|
+
if (primitive.scale !== void 0)
|
|
2160
|
+
sceneObject.SetScale(primitive.scale);
|
|
2161
|
+
if (primitive.visible !== void 0)
|
|
2162
|
+
sceneObject.SetVisibility(primitive.visible);
|
|
2163
|
+
if (primitive.material !== void 0)
|
|
2164
|
+
sceneObject.SetMaterial(primitive.material);
|
|
2165
|
+
if (primitive.parentId !== void 0)
|
|
2166
|
+
this.setParent(__spreadProps(__spreadValues({}, primitive), { parentId: primitive.parentId }));
|
|
1848
2167
|
}
|
|
1849
2168
|
updateGroup(group) {
|
|
1850
2169
|
let sceneObject = this.GetSceneObject(group);
|
|
@@ -1855,17 +2174,25 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1855
2174
|
this.add(sceneObject);
|
|
1856
2175
|
}
|
|
1857
2176
|
if (group.name !== void 0) sceneObject.name = group.name;
|
|
1858
|
-
if (group.position !== void 0)
|
|
1859
|
-
|
|
1860
|
-
if (group.
|
|
1861
|
-
|
|
1862
|
-
if (group.
|
|
1863
|
-
|
|
2177
|
+
if (group.position !== void 0)
|
|
2178
|
+
sceneObject.SetPosition(group.position);
|
|
2179
|
+
if (group.rotation !== void 0)
|
|
2180
|
+
sceneObject.SetRotation(group.rotation);
|
|
2181
|
+
if (group.scale !== void 0)
|
|
2182
|
+
sceneObject.SetScale(group.scale);
|
|
2183
|
+
if (group.visible !== void 0)
|
|
2184
|
+
sceneObject.SetVisibility(group.visible);
|
|
2185
|
+
if (group.bbVisible !== void 0)
|
|
2186
|
+
sceneObject.SetLinesVisibility(group.bbVisible);
|
|
2187
|
+
if (group.parentId !== void 0)
|
|
2188
|
+
this.setParent(__spreadProps(__spreadValues({}, group), { parentId: group.parentId }));
|
|
1864
2189
|
}
|
|
1865
2190
|
deleteLight(light) {
|
|
1866
2191
|
const sceneObject = this.GetSceneObject(light);
|
|
1867
2192
|
if (!sceneObject) {
|
|
1868
|
-
console.warn(
|
|
2193
|
+
console.warn(
|
|
2194
|
+
`DIVERoot.deleteLight: Light with id ${light.id} not found`
|
|
2195
|
+
);
|
|
1869
2196
|
return;
|
|
1870
2197
|
}
|
|
1871
2198
|
this.detachTransformControls(sceneObject);
|
|
@@ -1874,7 +2201,9 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1874
2201
|
deleteModel(model) {
|
|
1875
2202
|
const sceneObject = this.GetSceneObject(model);
|
|
1876
2203
|
if (!sceneObject) {
|
|
1877
|
-
console.warn(
|
|
2204
|
+
console.warn(
|
|
2205
|
+
`DIVERoot.deleteModel: Model with id ${model.id} not found`
|
|
2206
|
+
);
|
|
1878
2207
|
return;
|
|
1879
2208
|
}
|
|
1880
2209
|
this.detachTransformControls(sceneObject);
|
|
@@ -1883,7 +2212,9 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1883
2212
|
deletePrimitive(primitive) {
|
|
1884
2213
|
const sceneObject = this.GetSceneObject(primitive);
|
|
1885
2214
|
if (!sceneObject) {
|
|
1886
|
-
console.warn(
|
|
2215
|
+
console.warn(
|
|
2216
|
+
`DIVERoot.deletePrimitive: Primitive with id ${primitive.id} not found`
|
|
2217
|
+
);
|
|
1887
2218
|
return;
|
|
1888
2219
|
}
|
|
1889
2220
|
this.detachTransformControls(sceneObject);
|
|
@@ -1892,7 +2223,9 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1892
2223
|
deleteGroup(group) {
|
|
1893
2224
|
const sceneObject = this.GetSceneObject(group);
|
|
1894
2225
|
if (!sceneObject) {
|
|
1895
|
-
console.warn(
|
|
2226
|
+
console.warn(
|
|
2227
|
+
`DIVERoot.deleteGroup: Group with id ${group.id} not found`
|
|
2228
|
+
);
|
|
1896
2229
|
return;
|
|
1897
2230
|
}
|
|
1898
2231
|
this.detachTransformControls(sceneObject);
|
|
@@ -1910,7 +2243,9 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1910
2243
|
const sceneObject = this.GetSceneObject(object);
|
|
1911
2244
|
if (!sceneObject) return;
|
|
1912
2245
|
if (object.parentId !== null) {
|
|
1913
|
-
const parent = this.GetSceneObject({
|
|
2246
|
+
const parent = this.GetSceneObject({
|
|
2247
|
+
id: object.parentId
|
|
2248
|
+
});
|
|
1914
2249
|
if (!parent) return;
|
|
1915
2250
|
parent.attach(sceneObject);
|
|
1916
2251
|
} else {
|
|
@@ -1928,7 +2263,6 @@ var DIVERoot = class extends Object3D6 {
|
|
|
1928
2263
|
if (object.parent !== null) {
|
|
1929
2264
|
return this.findScene(object.parent);
|
|
1930
2265
|
}
|
|
1931
|
-
;
|
|
1932
2266
|
return object;
|
|
1933
2267
|
}
|
|
1934
2268
|
};
|
|
@@ -1944,7 +2278,12 @@ var DIVEGrid = class extends Object3D7 {
|
|
|
1944
2278
|
constructor() {
|
|
1945
2279
|
super();
|
|
1946
2280
|
this.name = "Grid";
|
|
1947
|
-
const grid = new GridHelper(
|
|
2281
|
+
const grid = new GridHelper(
|
|
2282
|
+
100,
|
|
2283
|
+
100,
|
|
2284
|
+
GRID_CENTER_LINE_COLOR,
|
|
2285
|
+
GRID_SIDE_LINE_COLOR
|
|
2286
|
+
);
|
|
1948
2287
|
grid.material.depthTest = false;
|
|
1949
2288
|
grid.layers.mask = HELPER_LAYER_MASK;
|
|
1950
2289
|
this.add(grid);
|
|
@@ -1956,10 +2295,20 @@ var DIVEGrid = class extends Object3D7 {
|
|
|
1956
2295
|
|
|
1957
2296
|
// src/primitive/floor/Floor.ts
|
|
1958
2297
|
init_VisibilityLayerMask();
|
|
1959
|
-
import {
|
|
2298
|
+
import {
|
|
2299
|
+
Color as Color6,
|
|
2300
|
+
Mesh as Mesh4,
|
|
2301
|
+
MeshStandardMaterial as MeshStandardMaterial3,
|
|
2302
|
+
PlaneGeometry
|
|
2303
|
+
} from "three";
|
|
1960
2304
|
var DIVEFloor = class extends Mesh4 {
|
|
1961
2305
|
constructor() {
|
|
1962
|
-
super(
|
|
2306
|
+
super(
|
|
2307
|
+
new PlaneGeometry(1e4, 1e4),
|
|
2308
|
+
new MeshStandardMaterial3({
|
|
2309
|
+
color: new Color6(150 / 255, 150 / 255, 150 / 255)
|
|
2310
|
+
})
|
|
2311
|
+
);
|
|
1963
2312
|
this.isFloor = true;
|
|
1964
2313
|
this.name = "Floor";
|
|
1965
2314
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
@@ -2077,7 +2426,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
|
|
|
2077
2426
|
ZoomIn(by) {
|
|
2078
2427
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
2079
2428
|
const { minDistance, maxDistance } = this;
|
|
2080
|
-
this.minDistance = this.maxDistance = MathUtils2.clamp(
|
|
2429
|
+
this.minDistance = this.maxDistance = MathUtils2.clamp(
|
|
2430
|
+
this.getDistance() - zoomBy,
|
|
2431
|
+
minDistance + zoomBy,
|
|
2432
|
+
maxDistance - zoomBy
|
|
2433
|
+
);
|
|
2081
2434
|
this.update();
|
|
2082
2435
|
this.minDistance = minDistance;
|
|
2083
2436
|
this.maxDistance = maxDistance;
|
|
@@ -2085,7 +2438,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
|
|
|
2085
2438
|
ZoomOut(by) {
|
|
2086
2439
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
2087
2440
|
const { minDistance, maxDistance } = this;
|
|
2088
|
-
this.minDistance = this.maxDistance = MathUtils2.clamp(
|
|
2441
|
+
this.minDistance = this.maxDistance = MathUtils2.clamp(
|
|
2442
|
+
this.getDistance() + zoomBy,
|
|
2443
|
+
minDistance + zoomBy,
|
|
2444
|
+
maxDistance - zoomBy
|
|
2445
|
+
);
|
|
2089
2446
|
this.update();
|
|
2090
2447
|
this.minDistance = minDistance;
|
|
2091
2448
|
this.maxDistance = maxDistance;
|
|
@@ -2095,7 +2452,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
|
|
|
2095
2452
|
const toPosition = pos || this.object.position.clone();
|
|
2096
2453
|
const toTarget = target || this.target.clone();
|
|
2097
2454
|
this.stopRevertLast();
|
|
2098
|
-
if (!this.locked)
|
|
2455
|
+
if (!this.locked)
|
|
2456
|
+
this.last = {
|
|
2457
|
+
pos: this.object.position.clone(),
|
|
2458
|
+
target: this.target.clone()
|
|
2459
|
+
};
|
|
2099
2460
|
this.animating = duration > 0;
|
|
2100
2461
|
this.locked = lock;
|
|
2101
2462
|
this.enabled = false;
|
|
@@ -2139,7 +2500,10 @@ var DIVEToolbox = class {
|
|
|
2139
2500
|
get selectTool() {
|
|
2140
2501
|
if (!this._selectTool) {
|
|
2141
2502
|
const DIVESelectTool2 = (init_SelectTool(), __toCommonJS(SelectTool_exports)).DIVESelectTool;
|
|
2142
|
-
this._selectTool = new DIVESelectTool2(
|
|
2503
|
+
this._selectTool = new DIVESelectTool2(
|
|
2504
|
+
this._scene,
|
|
2505
|
+
this._controller
|
|
2506
|
+
);
|
|
2143
2507
|
}
|
|
2144
2508
|
return this._selectTool;
|
|
2145
2509
|
}
|
|
@@ -2198,16 +2562,40 @@ var DIVEToolbox = class {
|
|
|
2198
2562
|
(_a = this._activeTool) == null ? void 0 : _a.onWheel(e);
|
|
2199
2563
|
}
|
|
2200
2564
|
addEventListeners() {
|
|
2201
|
-
this._controller.domElement.addEventListener(
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2565
|
+
this._controller.domElement.addEventListener(
|
|
2566
|
+
"pointermove",
|
|
2567
|
+
(e) => this.onPointerMove(e)
|
|
2568
|
+
);
|
|
2569
|
+
this._controller.domElement.addEventListener(
|
|
2570
|
+
"pointerdown",
|
|
2571
|
+
(e) => this.onPointerDown(e)
|
|
2572
|
+
);
|
|
2573
|
+
this._controller.domElement.addEventListener(
|
|
2574
|
+
"pointerup",
|
|
2575
|
+
(e) => this.onPointerUp(e)
|
|
2576
|
+
);
|
|
2577
|
+
this._controller.domElement.addEventListener(
|
|
2578
|
+
"wheel",
|
|
2579
|
+
(e) => this.onWheel(e)
|
|
2580
|
+
);
|
|
2205
2581
|
}
|
|
2206
2582
|
removeEventListeners() {
|
|
2207
|
-
this._controller.domElement.removeEventListener(
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2583
|
+
this._controller.domElement.removeEventListener(
|
|
2584
|
+
"pointermove",
|
|
2585
|
+
(e) => this.onPointerMove(e)
|
|
2586
|
+
);
|
|
2587
|
+
this._controller.domElement.removeEventListener(
|
|
2588
|
+
"pointerdown",
|
|
2589
|
+
(e) => this.onPointerDown(e)
|
|
2590
|
+
);
|
|
2591
|
+
this._controller.domElement.removeEventListener(
|
|
2592
|
+
"pointerup",
|
|
2593
|
+
(e) => this.onPointerUp(e)
|
|
2594
|
+
);
|
|
2595
|
+
this._controller.domElement.removeEventListener(
|
|
2596
|
+
"wheel",
|
|
2597
|
+
(e) => this.onWheel(e)
|
|
2598
|
+
);
|
|
2211
2599
|
}
|
|
2212
2600
|
};
|
|
2213
2601
|
DIVEToolbox.DefaultTool = "select";
|
|
@@ -2234,7 +2622,13 @@ var DIVEAnimationSystem = class {
|
|
|
2234
2622
|
|
|
2235
2623
|
// src/axiscamera/AxisCamera.ts
|
|
2236
2624
|
init_VisibilityLayerMask();
|
|
2237
|
-
import {
|
|
2625
|
+
import {
|
|
2626
|
+
AxesHelper,
|
|
2627
|
+
Color as Color8,
|
|
2628
|
+
Matrix4,
|
|
2629
|
+
OrthographicCamera,
|
|
2630
|
+
Vector4
|
|
2631
|
+
} from "three";
|
|
2238
2632
|
import SpriteText from "three-spritetext";
|
|
2239
2633
|
|
|
2240
2634
|
// src/constant/AxisHelperColors.ts
|
|
@@ -2294,7 +2688,9 @@ var DIVEAxisCamera = class extends OrthographicCamera {
|
|
|
2294
2688
|
this._scene.remove(this);
|
|
2295
2689
|
}
|
|
2296
2690
|
SetFromCameraMatrix(matrix) {
|
|
2297
|
-
this.axesHelper.rotation.setFromRotationMatrix(
|
|
2691
|
+
this.axesHelper.rotation.setFromRotationMatrix(
|
|
2692
|
+
new Matrix4().extractRotation(matrix).invert()
|
|
2693
|
+
);
|
|
2298
2694
|
}
|
|
2299
2695
|
};
|
|
2300
2696
|
|
|
@@ -2329,7 +2725,10 @@ var getObjectDelta = (a, b) => {
|
|
|
2329
2725
|
}
|
|
2330
2726
|
const arrayDeltas = [];
|
|
2331
2727
|
bArray.forEach((entry, index) => {
|
|
2332
|
-
const inArrayDelta = getObjectDelta(
|
|
2728
|
+
const inArrayDelta = getObjectDelta(
|
|
2729
|
+
aArray[index],
|
|
2730
|
+
bArray[index]
|
|
2731
|
+
);
|
|
2333
2732
|
if (Object.keys(inArrayDelta).length) {
|
|
2334
2733
|
arrayDeltas.push(bArray[index]);
|
|
2335
2734
|
}
|
|
@@ -2345,7 +2744,10 @@ var getObjectDelta = (a, b) => {
|
|
|
2345
2744
|
delta = __spreadProps(__spreadValues({}, delta), { [key]: b[key] });
|
|
2346
2745
|
return;
|
|
2347
2746
|
}
|
|
2348
|
-
const objectDelta = getObjectDelta(
|
|
2747
|
+
const objectDelta = getObjectDelta(
|
|
2748
|
+
a[key],
|
|
2749
|
+
b[key]
|
|
2750
|
+
);
|
|
2349
2751
|
if (Object.keys(objectDelta).length) {
|
|
2350
2752
|
delta = __spreadProps(__spreadValues({}, delta), { [key]: objectDelta });
|
|
2351
2753
|
return;
|
|
@@ -2461,7 +2863,7 @@ DIVEInfo._supportsWebXR = null;
|
|
|
2461
2863
|
// package.json
|
|
2462
2864
|
var package_default = {
|
|
2463
2865
|
name: "@shopware-ag/dive",
|
|
2464
|
-
version: "1.16.
|
|
2866
|
+
version: "1.16.2",
|
|
2465
2867
|
description: "Shopware Spatial Framework",
|
|
2466
2868
|
type: "module",
|
|
2467
2869
|
main: "./build/dive.cjs",
|
|
@@ -2506,19 +2908,31 @@ var package_default = {
|
|
|
2506
2908
|
jest: "^29.7.0",
|
|
2507
2909
|
"jest-environment-jsdom": "^29.7.0",
|
|
2508
2910
|
jsdom: "^24.0.0",
|
|
2911
|
+
prettier: "^3.3.3",
|
|
2912
|
+
"prettier-plugin-multiline-arrays": "^3.0.6",
|
|
2509
2913
|
"ts-jest": "^29.1.2",
|
|
2510
2914
|
"ts-node": "^10.9.2",
|
|
2915
|
+
tsc: "^2.0.4",
|
|
2511
2916
|
tsup: "^8.0.2",
|
|
2512
2917
|
typescript: "^5.4.5",
|
|
2513
2918
|
"typescript-eslint": "^7.7.1"
|
|
2514
2919
|
},
|
|
2515
2920
|
scripts: {
|
|
2516
|
-
build: "tsup
|
|
2517
|
-
|
|
2921
|
+
build: "tsup",
|
|
2922
|
+
dev: "tsup --watch",
|
|
2518
2923
|
lint: "eslint",
|
|
2924
|
+
"lint:actions": "yarn lint:actions:transpile && yarn lint:actions:check && yarn lint:actions:cleanup",
|
|
2925
|
+
"lint:actions:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/lint/lint-actions.ts && mv ci/lint/lint-actions.js ci/lint/lint-actions.cjs",
|
|
2926
|
+
"lint:actions:check": "yarn node ci/lint/lint-actions.cjs",
|
|
2927
|
+
"lint:actions:cleanup": `node -e "require('fs').unlinkSync('ci/lint/lint-actions.cjs')"`,
|
|
2928
|
+
"prettier:check": "prettier --check .",
|
|
2929
|
+
"prettier:fix": "prettier --write .",
|
|
2519
2930
|
unit: "jest",
|
|
2520
2931
|
coverage: "jest --coverage",
|
|
2521
|
-
|
|
2932
|
+
"generate-readme": "yarn generate-readme:transpile && yarn generate-readme:write && yarn generate-readme:cleanup",
|
|
2933
|
+
"generate-readme:transpile": "yarn tsc --resolveJsonModule --esModuleInterop ci/readme/generate-readme.ts && mv ci/readme/generate-readme.js ci/readme/generate-readme.cjs",
|
|
2934
|
+
"generate-readme:write": "node ci/readme/generate-readme.cjs",
|
|
2935
|
+
"generate-readme:cleanup": `node -e "require('fs').unlinkSync('ci/readme/generate-readme.cjs')"`
|
|
2522
2936
|
}
|
|
2523
2937
|
};
|
|
2524
2938
|
|
|
@@ -2549,7 +2963,10 @@ function roundExponential(number, decimals = 0) {
|
|
|
2549
2963
|
|
|
2550
2964
|
// src/math/signedAngleTo/signedAngleTo.ts
|
|
2551
2965
|
function signedAngleTo(vecA, vecB, planeNormal) {
|
|
2552
|
-
return Math.atan2(
|
|
2966
|
+
return Math.atan2(
|
|
2967
|
+
vecA.clone().cross(vecB).dot(planeNormal),
|
|
2968
|
+
vecB.clone().dot(vecA)
|
|
2969
|
+
);
|
|
2553
2970
|
}
|
|
2554
2971
|
|
|
2555
2972
|
// src/math/toFixed/toFixedExp.ts
|
|
@@ -2607,7 +3024,10 @@ var DIVE = class _DIVE {
|
|
|
2607
3024
|
dive.Communication.PerformAction("PLACE_ON_FLOOR", {
|
|
2608
3025
|
id: modelid
|
|
2609
3026
|
});
|
|
2610
|
-
const transform = dive.Communication.PerformAction(
|
|
3027
|
+
const transform = dive.Communication.PerformAction(
|
|
3028
|
+
"COMPUTE_ENCOMPASSING_VIEW",
|
|
3029
|
+
{}
|
|
3030
|
+
);
|
|
2611
3031
|
dive.Communication.PerformAction("SET_CAMERA_TRANSFORM", {
|
|
2612
3032
|
position: transform.position,
|
|
2613
3033
|
target: transform.target
|
|
@@ -2645,16 +3065,25 @@ var DIVE = class _DIVE {
|
|
|
2645
3065
|
set Settings(settings) {
|
|
2646
3066
|
var _a;
|
|
2647
3067
|
const settingsDelta = getObjectDelta(this._settings, settings);
|
|
2648
|
-
if (settingsDelta.renderer)
|
|
3068
|
+
if (settingsDelta.renderer)
|
|
3069
|
+
this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2649
3070
|
if (settingsDelta.perspectiveCamera) {
|
|
2650
|
-
if (settingsDelta.perspectiveCamera.fov !== void 0)
|
|
2651
|
-
|
|
2652
|
-
if (settingsDelta.perspectiveCamera.
|
|
2653
|
-
|
|
3071
|
+
if (settingsDelta.perspectiveCamera.fov !== void 0)
|
|
3072
|
+
this.perspectiveCamera.fov = settingsDelta.perspectiveCamera.fov;
|
|
3073
|
+
if (settingsDelta.perspectiveCamera.near !== void 0)
|
|
3074
|
+
this.perspectiveCamera.near = settingsDelta.perspectiveCamera.near;
|
|
3075
|
+
if (settingsDelta.perspectiveCamera.far !== void 0)
|
|
3076
|
+
this.perspectiveCamera.far = settingsDelta.perspectiveCamera.far;
|
|
3077
|
+
this.perspectiveCamera.OnResize(
|
|
3078
|
+
this.renderer.domElement.width,
|
|
3079
|
+
this.renderer.domElement.height
|
|
3080
|
+
);
|
|
2654
3081
|
}
|
|
2655
3082
|
if (settingsDelta.orbitControls) {
|
|
2656
|
-
if (settingsDelta.orbitControls.enableDamping !== void 0)
|
|
2657
|
-
|
|
3083
|
+
if (settingsDelta.orbitControls.enableDamping !== void 0)
|
|
3084
|
+
this.orbitControls.enableDamping = settingsDelta.orbitControls.enableDamping;
|
|
3085
|
+
if (settingsDelta.orbitControls.dampingFactor !== void 0)
|
|
3086
|
+
this.orbitControls.dampingFactor = settingsDelta.orbitControls.dampingFactor;
|
|
2658
3087
|
}
|
|
2659
3088
|
if (settingsDelta.autoResize !== this._settings.autoResize) {
|
|
2660
3089
|
if (settingsDelta.autoResize) {
|
|
@@ -2664,7 +3093,11 @@ var DIVE = class _DIVE {
|
|
|
2664
3093
|
}
|
|
2665
3094
|
}
|
|
2666
3095
|
if (settingsDelta.displayAxes) {
|
|
2667
|
-
this.axisCamera = new DIVEAxisCamera(
|
|
3096
|
+
this.axisCamera = new DIVEAxisCamera(
|
|
3097
|
+
this.renderer,
|
|
3098
|
+
this.scene,
|
|
3099
|
+
this.orbitControls
|
|
3100
|
+
);
|
|
2668
3101
|
} else {
|
|
2669
3102
|
(_a = this.axisCamera) == null ? void 0 : _a.Dispose();
|
|
2670
3103
|
this.axisCamera = null;
|
|
@@ -2678,13 +3111,29 @@ var DIVE = class _DIVE {
|
|
|
2678
3111
|
this._height = 0;
|
|
2679
3112
|
this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2680
3113
|
this.scene = new DIVEScene();
|
|
2681
|
-
this.perspectiveCamera = new DIVEPerspectiveCamera(
|
|
3114
|
+
this.perspectiveCamera = new DIVEPerspectiveCamera(
|
|
3115
|
+
this._settings.perspectiveCamera
|
|
3116
|
+
);
|
|
2682
3117
|
this.animationSystem = new DIVEAnimationSystem(this.renderer);
|
|
2683
|
-
this.orbitControls = new DIVEOrbitControls(
|
|
3118
|
+
this.orbitControls = new DIVEOrbitControls(
|
|
3119
|
+
this.perspectiveCamera,
|
|
3120
|
+
this.renderer,
|
|
3121
|
+
this.animationSystem,
|
|
3122
|
+
this._settings.orbitControls
|
|
3123
|
+
);
|
|
2684
3124
|
this.toolbox = new DIVEToolbox(this.scene, this.orbitControls);
|
|
2685
|
-
this.communication = new DIVECommunication(
|
|
3125
|
+
this.communication = new DIVECommunication(
|
|
3126
|
+
this.renderer,
|
|
3127
|
+
this.scene,
|
|
3128
|
+
this.orbitControls,
|
|
3129
|
+
this.toolbox
|
|
3130
|
+
);
|
|
2686
3131
|
if (this._settings.displayAxes) {
|
|
2687
|
-
this.axisCamera = new DIVEAxisCamera(
|
|
3132
|
+
this.axisCamera = new DIVEAxisCamera(
|
|
3133
|
+
this.renderer,
|
|
3134
|
+
this.scene,
|
|
3135
|
+
this.orbitControls
|
|
3136
|
+
);
|
|
2688
3137
|
} else {
|
|
2689
3138
|
this.axisCamera = null;
|
|
2690
3139
|
}
|
|
@@ -2719,7 +3168,8 @@ var DIVE = class _DIVE {
|
|
|
2719
3168
|
const canvasWrapper = this.renderer.domElement.parentElement;
|
|
2720
3169
|
if (!canvasWrapper) return;
|
|
2721
3170
|
const { clientWidth, clientHeight } = canvasWrapper;
|
|
2722
|
-
if (clientWidth === this._width && clientHeight === this._height)
|
|
3171
|
+
if (clientWidth === this._width && clientHeight === this._height)
|
|
3172
|
+
return;
|
|
2723
3173
|
this.OnResize(clientWidth, clientHeight);
|
|
2724
3174
|
this._width = clientWidth;
|
|
2725
3175
|
this._height = clientHeight;
|