@shopware-ag/dive 1.16.0 → 1.16.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/README.md +77 -40
- package/build/dive.cjs +564 -156
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +55 -55
- package/build/dive.d.ts +55 -55
- package/build/dive.js +603 -161
- package/build/dive.js.map +1 -1
- package/package.json +64 -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 +7 -7
- package/src/com/actions/camera/getcameratransform.ts +7 -7
- package/src/com/actions/camera/movecamera.ts +15 -13
- package/src/com/actions/camera/resetcamera.ts +3 -3
- package/src/com/actions/camera/setcameralayer.ts +3 -3
- package/src/com/actions/camera/setcameratransform.ts +7 -7
- package/src/com/actions/camera/zoomcamera.ts +3 -3
- package/src/com/actions/index.ts +52 -52
- package/src/com/actions/media/generatemedia.ts +16 -13
- package/src/com/actions/object/addobject.ts +4 -4
- package/src/com/actions/object/deleteobject.ts +4 -4
- package/src/com/actions/object/deselectobject.ts +4 -4
- package/src/com/actions/object/getallobjects.ts +4 -4
- package/src/com/actions/object/getobjects.ts +4 -4
- package/src/com/actions/object/model/dropit.ts +3 -3
- package/src/com/actions/object/model/modelloaded.ts +3 -3
- package/src/com/actions/object/model/placeonfloor.ts +3 -3
- package/src/com/actions/object/selectobject.ts +4 -4
- package/src/com/actions/object/setparent.ts +7 -7
- package/src/com/actions/object/updateobject.ts +4 -4
- package/src/com/actions/scene/exportscene.ts +4 -4
- package/src/com/actions/scene/getallscenedata.ts +23 -18
- package/src/com/actions/scene/setbackground.ts +3 -3
- package/src/com/actions/scene/updatescene.ts +9 -9
- package/src/com/actions/toolbox/select/setgizmomode.ts +3 -3
- package/src/com/actions/toolbox/transform/setgizmovisible.ts +3 -3
- package/src/com/actions/toolbox/usetool.ts +4 -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.cjs
CHANGED
|
@@ -158,12 +158,18 @@ var init_BaseTool = __esm({
|
|
|
158
158
|
break;
|
|
159
159
|
}
|
|
160
160
|
this._lastPointerDown.copy(this._pointer);
|
|
161
|
-
this._draggable = findInterface(
|
|
161
|
+
this._draggable = findInterface(
|
|
162
|
+
(_a = this._intersects[0]) == null ? void 0 : _a.object,
|
|
163
|
+
"isDraggable"
|
|
164
|
+
) || null;
|
|
162
165
|
}
|
|
163
166
|
onDragStart(e) {
|
|
164
167
|
if (!this._draggable) return;
|
|
165
168
|
if (this._dragRaycastOnObjects !== null) {
|
|
166
|
-
this._intersects = this._raycaster.intersectObjects(
|
|
169
|
+
this._intersects = this._raycaster.intersectObjects(
|
|
170
|
+
this._dragRaycastOnObjects,
|
|
171
|
+
true
|
|
172
|
+
);
|
|
167
173
|
}
|
|
168
174
|
if (this._intersects.length === 0) return;
|
|
169
175
|
this._dragStart.copy(this._intersects[0].point.clone());
|
|
@@ -187,24 +193,32 @@ var init_BaseTool = __esm({
|
|
|
187
193
|
this._pointer.y = -(e.offsetY / this._canvas.clientHeight) * 2 + 1;
|
|
188
194
|
this._raycaster.setFromCamera(this._pointer, this._controller.object);
|
|
189
195
|
this._intersects = this.raycast(this._scene.children);
|
|
190
|
-
const hoverable = findInterface(
|
|
196
|
+
const hoverable = findInterface(
|
|
197
|
+
(_a = this._intersects[0]) == null ? void 0 : _a.object,
|
|
198
|
+
"isHoverable"
|
|
199
|
+
);
|
|
191
200
|
if (this._intersects[0] && hoverable) {
|
|
192
201
|
if (!this._hovered) {
|
|
193
|
-
if (hoverable.onPointerEnter)
|
|
202
|
+
if (hoverable.onPointerEnter)
|
|
203
|
+
hoverable.onPointerEnter(this._intersects[0]);
|
|
194
204
|
this._hovered = hoverable;
|
|
195
205
|
return;
|
|
196
206
|
}
|
|
197
207
|
if (this._hovered.uuid !== hoverable.uuid) {
|
|
198
|
-
if (this._hovered.onPointerLeave)
|
|
199
|
-
|
|
208
|
+
if (this._hovered.onPointerLeave)
|
|
209
|
+
this._hovered.onPointerLeave();
|
|
210
|
+
if (hoverable.onPointerEnter)
|
|
211
|
+
hoverable.onPointerEnter(this._intersects[0]);
|
|
200
212
|
this._hovered = hoverable;
|
|
201
213
|
return;
|
|
202
214
|
}
|
|
203
|
-
if (hoverable.onPointerOver)
|
|
215
|
+
if (hoverable.onPointerOver)
|
|
216
|
+
hoverable.onPointerOver(this._intersects[0]);
|
|
204
217
|
this._hovered = hoverable;
|
|
205
218
|
} else {
|
|
206
219
|
if (this._hovered) {
|
|
207
|
-
if (this._hovered.onPointerLeave)
|
|
220
|
+
if (this._hovered.onPointerLeave)
|
|
221
|
+
this._hovered.onPointerLeave();
|
|
208
222
|
}
|
|
209
223
|
this._hovered = null;
|
|
210
224
|
}
|
|
@@ -217,13 +231,19 @@ var init_BaseTool = __esm({
|
|
|
217
231
|
}
|
|
218
232
|
onDrag(e) {
|
|
219
233
|
if (this._dragRaycastOnObjects !== null) {
|
|
220
|
-
this._intersects = this._raycaster.intersectObjects(
|
|
234
|
+
this._intersects = this._raycaster.intersectObjects(
|
|
235
|
+
this._dragRaycastOnObjects,
|
|
236
|
+
true
|
|
237
|
+
);
|
|
221
238
|
}
|
|
222
239
|
const intersect = this._intersects[0];
|
|
223
240
|
if (!intersect) return;
|
|
224
241
|
this._dragCurrent.copy(intersect.point.clone());
|
|
225
242
|
this._dragEnd.copy(intersect.point.clone());
|
|
226
|
-
this._dragDelta.subVectors(
|
|
243
|
+
this._dragDelta.subVectors(
|
|
244
|
+
this._dragCurrent.clone(),
|
|
245
|
+
this._dragStart.clone()
|
|
246
|
+
);
|
|
227
247
|
if (this._draggable && this._draggable.onDrag) {
|
|
228
248
|
this._draggable.onDrag({
|
|
229
249
|
dragStart: this._dragStart,
|
|
@@ -261,7 +281,10 @@ var init_BaseTool = __esm({
|
|
|
261
281
|
if (intersect) {
|
|
262
282
|
this._dragEnd.copy(intersect.point.clone());
|
|
263
283
|
this._dragCurrent.copy(intersect.point.clone());
|
|
264
|
-
this._dragDelta.subVectors(
|
|
284
|
+
this._dragDelta.subVectors(
|
|
285
|
+
this._dragCurrent.clone(),
|
|
286
|
+
this._dragStart.clone()
|
|
287
|
+
);
|
|
265
288
|
}
|
|
266
289
|
if (this._draggable && this._draggable.onDragEnd) {
|
|
267
290
|
this._draggable.onDragEnd({
|
|
@@ -282,7 +305,8 @@ var init_BaseTool = __esm({
|
|
|
282
305
|
onWheel(e) {
|
|
283
306
|
}
|
|
284
307
|
raycast(objects) {
|
|
285
|
-
if (objects !== void 0)
|
|
308
|
+
if (objects !== void 0)
|
|
309
|
+
return this._raycaster.intersectObjects(objects, true).filter((i) => i.object.visible);
|
|
286
310
|
return this._raycaster.intersectObjects(this._scene.children, true).filter((i) => i.object.visible);
|
|
287
311
|
}
|
|
288
312
|
pointerWasDragged() {
|
|
@@ -305,22 +329,37 @@ var init_TransformTool = __esm({
|
|
|
305
329
|
super(scene, controller);
|
|
306
330
|
this.isTransformTool = true;
|
|
307
331
|
this.name = "DIVETransformTool";
|
|
308
|
-
this._gizmo = new import_Addons.TransformControls(
|
|
332
|
+
this._gizmo = new import_Addons.TransformControls(
|
|
333
|
+
this._controller.object,
|
|
334
|
+
this._controller.domElement
|
|
335
|
+
);
|
|
309
336
|
this._gizmo.mode = "translate";
|
|
310
337
|
this._gizmo.addEventListener("mouseDown", () => {
|
|
311
338
|
controller.enabled = false;
|
|
312
|
-
if (!implementsInterface(
|
|
339
|
+
if (!implementsInterface(
|
|
340
|
+
this._gizmo.object,
|
|
341
|
+
"isMovable"
|
|
342
|
+
))
|
|
343
|
+
return;
|
|
313
344
|
if (!this._gizmo.object.onMoveStart) return;
|
|
314
345
|
this._gizmo.object.onMoveStart();
|
|
315
346
|
});
|
|
316
347
|
this._gizmo.addEventListener("objectChange", () => {
|
|
317
|
-
if (!implementsInterface(
|
|
348
|
+
if (!implementsInterface(
|
|
349
|
+
this._gizmo.object,
|
|
350
|
+
"isMovable"
|
|
351
|
+
))
|
|
352
|
+
return;
|
|
318
353
|
if (!this._gizmo.object.onMove) return;
|
|
319
354
|
this._gizmo.object.onMove();
|
|
320
355
|
});
|
|
321
356
|
this._gizmo.addEventListener("mouseUp", () => {
|
|
322
357
|
controller.enabled = true;
|
|
323
|
-
if (!implementsInterface(
|
|
358
|
+
if (!implementsInterface(
|
|
359
|
+
this._gizmo.object,
|
|
360
|
+
"isMovable"
|
|
361
|
+
))
|
|
362
|
+
return;
|
|
324
363
|
if (!this._gizmo.object.onMoveEnd) return;
|
|
325
364
|
this._gizmo.object.onMoveEnd();
|
|
326
365
|
});
|
|
@@ -396,7 +435,10 @@ var init_SelectTool = __esm({
|
|
|
396
435
|
onClick(e) {
|
|
397
436
|
super.onClick(e);
|
|
398
437
|
const first = this._raycaster.intersectObjects(this._scene.Root.children, true).filter((intersect) => intersect.object.visible)[0];
|
|
399
|
-
const selectable = findInterface(
|
|
438
|
+
const selectable = findInterface(
|
|
439
|
+
first == null ? void 0 : first.object,
|
|
440
|
+
"isSelectable"
|
|
441
|
+
);
|
|
400
442
|
if (!first || !selectable) {
|
|
401
443
|
if (this._gizmo.object) {
|
|
402
444
|
this.Deselect(this._gizmo.object);
|
|
@@ -519,9 +561,15 @@ var init_GLTFIO = __esm({
|
|
|
519
561
|
}
|
|
520
562
|
Export(object, binary, onlyVisible) {
|
|
521
563
|
if (binary) {
|
|
522
|
-
return this._exporter.parseAsync(object, {
|
|
564
|
+
return this._exporter.parseAsync(object, {
|
|
565
|
+
binary,
|
|
566
|
+
onlyVisible
|
|
567
|
+
});
|
|
523
568
|
} else {
|
|
524
|
-
return this._exporter.parseAsync(object, {
|
|
569
|
+
return this._exporter.parseAsync(object, {
|
|
570
|
+
binary,
|
|
571
|
+
onlyVisible
|
|
572
|
+
});
|
|
525
573
|
}
|
|
526
574
|
}
|
|
527
575
|
};
|
|
@@ -778,9 +826,15 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
778
826
|
_DIVECommunication.__instances.push(this);
|
|
779
827
|
}
|
|
780
828
|
static get(id) {
|
|
781
|
-
const fromComID = this.__instances.find(
|
|
829
|
+
const fromComID = this.__instances.find(
|
|
830
|
+
(instance) => instance.id === id
|
|
831
|
+
);
|
|
782
832
|
if (fromComID) return fromComID;
|
|
783
|
-
return this.__instances.find(
|
|
833
|
+
return this.__instances.find(
|
|
834
|
+
(instance) => Array.from(instance.registered.values()).find(
|
|
835
|
+
(object) => object.id === id
|
|
836
|
+
)
|
|
837
|
+
);
|
|
784
838
|
}
|
|
785
839
|
get id() {
|
|
786
840
|
return this._id;
|
|
@@ -788,7 +842,11 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
788
842
|
get mediaGenerator() {
|
|
789
843
|
if (!this._mediaGenerator) {
|
|
790
844
|
const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).DIVEMediaCreator;
|
|
791
|
-
this._mediaGenerator = new DIVEMediaCreator2(
|
|
845
|
+
this._mediaGenerator = new DIVEMediaCreator2(
|
|
846
|
+
this.renderer,
|
|
847
|
+
this.scene,
|
|
848
|
+
this.controller
|
|
849
|
+
);
|
|
792
850
|
}
|
|
793
851
|
return this._mediaGenerator;
|
|
794
852
|
}
|
|
@@ -800,7 +858,9 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
800
858
|
return this._io;
|
|
801
859
|
}
|
|
802
860
|
DestroyInstance() {
|
|
803
|
-
const existingIndex = _DIVECommunication.__instances.findIndex(
|
|
861
|
+
const existingIndex = _DIVECommunication.__instances.findIndex(
|
|
862
|
+
(entry) => entry.id === this.id
|
|
863
|
+
);
|
|
804
864
|
if (existingIndex === -1) return false;
|
|
805
865
|
_DIVECommunication.__instances.splice(existingIndex, 1);
|
|
806
866
|
return true;
|
|
@@ -809,107 +869,159 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
809
869
|
let returnValue = false;
|
|
810
870
|
switch (action) {
|
|
811
871
|
case "GET_ALL_SCENE_DATA": {
|
|
812
|
-
returnValue = this.getAllSceneData(
|
|
872
|
+
returnValue = this.getAllSceneData(
|
|
873
|
+
payload
|
|
874
|
+
);
|
|
813
875
|
break;
|
|
814
876
|
}
|
|
815
877
|
case "GET_ALL_OBJECTS": {
|
|
816
|
-
returnValue = this.getAllObjects(
|
|
878
|
+
returnValue = this.getAllObjects(
|
|
879
|
+
payload
|
|
880
|
+
);
|
|
817
881
|
break;
|
|
818
882
|
}
|
|
819
883
|
case "GET_OBJECTS": {
|
|
820
|
-
returnValue = this.getObjects(
|
|
884
|
+
returnValue = this.getObjects(
|
|
885
|
+
payload
|
|
886
|
+
);
|
|
821
887
|
break;
|
|
822
888
|
}
|
|
823
889
|
case "ADD_OBJECT": {
|
|
824
|
-
returnValue = this.addObject(
|
|
890
|
+
returnValue = this.addObject(
|
|
891
|
+
payload
|
|
892
|
+
);
|
|
825
893
|
break;
|
|
826
894
|
}
|
|
827
895
|
case "UPDATE_OBJECT": {
|
|
828
|
-
returnValue = this.updateObject(
|
|
896
|
+
returnValue = this.updateObject(
|
|
897
|
+
payload
|
|
898
|
+
);
|
|
829
899
|
break;
|
|
830
900
|
}
|
|
831
901
|
case "DELETE_OBJECT": {
|
|
832
|
-
returnValue = this.deleteObject(
|
|
902
|
+
returnValue = this.deleteObject(
|
|
903
|
+
payload
|
|
904
|
+
);
|
|
833
905
|
break;
|
|
834
906
|
}
|
|
835
907
|
case "SELECT_OBJECT": {
|
|
836
|
-
returnValue = this.selectObject(
|
|
908
|
+
returnValue = this.selectObject(
|
|
909
|
+
payload
|
|
910
|
+
);
|
|
837
911
|
break;
|
|
838
912
|
}
|
|
839
913
|
case "DESELECT_OBJECT": {
|
|
840
|
-
returnValue = this.deselectObject(
|
|
914
|
+
returnValue = this.deselectObject(
|
|
915
|
+
payload
|
|
916
|
+
);
|
|
841
917
|
break;
|
|
842
918
|
}
|
|
843
919
|
case "SET_BACKGROUND": {
|
|
844
|
-
returnValue = this.setBackground(
|
|
920
|
+
returnValue = this.setBackground(
|
|
921
|
+
payload
|
|
922
|
+
);
|
|
845
923
|
break;
|
|
846
924
|
}
|
|
847
925
|
case "DROP_IT": {
|
|
848
|
-
returnValue = this.dropIt(
|
|
926
|
+
returnValue = this.dropIt(
|
|
927
|
+
payload
|
|
928
|
+
);
|
|
849
929
|
break;
|
|
850
930
|
}
|
|
851
931
|
case "PLACE_ON_FLOOR": {
|
|
852
|
-
returnValue = this.placeOnFloor(
|
|
932
|
+
returnValue = this.placeOnFloor(
|
|
933
|
+
payload
|
|
934
|
+
);
|
|
853
935
|
break;
|
|
854
936
|
}
|
|
855
937
|
case "SET_CAMERA_TRANSFORM": {
|
|
856
|
-
returnValue = this.setCameraTransform(
|
|
938
|
+
returnValue = this.setCameraTransform(
|
|
939
|
+
payload
|
|
940
|
+
);
|
|
857
941
|
break;
|
|
858
942
|
}
|
|
859
943
|
case "GET_CAMERA_TRANSFORM": {
|
|
860
|
-
returnValue = this.getCameraTransform(
|
|
944
|
+
returnValue = this.getCameraTransform(
|
|
945
|
+
payload
|
|
946
|
+
);
|
|
861
947
|
break;
|
|
862
948
|
}
|
|
863
949
|
case "MOVE_CAMERA": {
|
|
864
|
-
returnValue = this.moveCamera(
|
|
950
|
+
returnValue = this.moveCamera(
|
|
951
|
+
payload
|
|
952
|
+
);
|
|
865
953
|
break;
|
|
866
954
|
}
|
|
867
955
|
case "RESET_CAMERA": {
|
|
868
|
-
returnValue = this.resetCamera(
|
|
956
|
+
returnValue = this.resetCamera(
|
|
957
|
+
payload
|
|
958
|
+
);
|
|
869
959
|
break;
|
|
870
960
|
}
|
|
871
961
|
case "COMPUTE_ENCOMPASSING_VIEW": {
|
|
872
|
-
returnValue = this.computeEncompassingView(
|
|
962
|
+
returnValue = this.computeEncompassingView(
|
|
963
|
+
payload
|
|
964
|
+
);
|
|
873
965
|
break;
|
|
874
966
|
}
|
|
875
967
|
case "SET_CAMERA_LAYER": {
|
|
876
|
-
returnValue = this.setCameraLayer(
|
|
968
|
+
returnValue = this.setCameraLayer(
|
|
969
|
+
payload
|
|
970
|
+
);
|
|
877
971
|
break;
|
|
878
972
|
}
|
|
879
973
|
case "ZOOM_CAMERA": {
|
|
880
|
-
returnValue = this.zoomCamera(
|
|
974
|
+
returnValue = this.zoomCamera(
|
|
975
|
+
payload
|
|
976
|
+
);
|
|
881
977
|
break;
|
|
882
978
|
}
|
|
883
979
|
case "SET_GIZMO_MODE": {
|
|
884
|
-
returnValue = this.setGizmoMode(
|
|
980
|
+
returnValue = this.setGizmoMode(
|
|
981
|
+
payload
|
|
982
|
+
);
|
|
885
983
|
break;
|
|
886
984
|
}
|
|
887
985
|
case "SET_GIZMO_VISIBILITY": {
|
|
888
|
-
returnValue = this.setGizmoVisibility(
|
|
986
|
+
returnValue = this.setGizmoVisibility(
|
|
987
|
+
payload
|
|
988
|
+
);
|
|
889
989
|
break;
|
|
890
990
|
}
|
|
891
991
|
case "USE_TOOL": {
|
|
892
|
-
returnValue = this.useTool(
|
|
992
|
+
returnValue = this.useTool(
|
|
993
|
+
payload
|
|
994
|
+
);
|
|
893
995
|
break;
|
|
894
996
|
}
|
|
895
997
|
case "MODEL_LOADED": {
|
|
896
|
-
returnValue = this.modelLoaded(
|
|
998
|
+
returnValue = this.modelLoaded(
|
|
999
|
+
payload
|
|
1000
|
+
);
|
|
897
1001
|
break;
|
|
898
1002
|
}
|
|
899
1003
|
case "UPDATE_SCENE": {
|
|
900
|
-
returnValue = this.updateScene(
|
|
1004
|
+
returnValue = this.updateScene(
|
|
1005
|
+
payload
|
|
1006
|
+
);
|
|
901
1007
|
break;
|
|
902
1008
|
}
|
|
903
1009
|
case "GENERATE_MEDIA": {
|
|
904
|
-
returnValue = this.generateMedia(
|
|
1010
|
+
returnValue = this.generateMedia(
|
|
1011
|
+
payload
|
|
1012
|
+
);
|
|
905
1013
|
break;
|
|
906
1014
|
}
|
|
907
1015
|
case "SET_PARENT": {
|
|
908
|
-
returnValue = this.setParent(
|
|
1016
|
+
returnValue = this.setParent(
|
|
1017
|
+
payload
|
|
1018
|
+
);
|
|
909
1019
|
break;
|
|
910
1020
|
}
|
|
911
1021
|
case "EXPORT_SCENE": {
|
|
912
|
-
returnValue = this.exportScene(
|
|
1022
|
+
returnValue = this.exportScene(
|
|
1023
|
+
payload
|
|
1024
|
+
);
|
|
913
1025
|
break;
|
|
914
1026
|
}
|
|
915
1027
|
}
|
|
@@ -922,7 +1034,9 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
922
1034
|
return () => {
|
|
923
1035
|
const listenerArray = this.listeners.get(type);
|
|
924
1036
|
if (!listenerArray) return false;
|
|
925
|
-
const existingIndex = listenerArray.findIndex(
|
|
1037
|
+
const existingIndex = listenerArray.findIndex(
|
|
1038
|
+
(entry) => entry === listener
|
|
1039
|
+
);
|
|
926
1040
|
if (existingIndex === -1) return false;
|
|
927
1041
|
listenerArray.splice(existingIndex, 1);
|
|
928
1042
|
return true;
|
|
@@ -945,11 +1059,21 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
945
1059
|
target: this.controller.target.clone()
|
|
946
1060
|
},
|
|
947
1061
|
spotmarks: [],
|
|
948
|
-
lights: Array.from(this.registered.values()).filter(
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1062
|
+
lights: Array.from(this.registered.values()).filter(
|
|
1063
|
+
(object) => object.entityType === "light"
|
|
1064
|
+
),
|
|
1065
|
+
objects: Array.from(this.registered.values()).filter(
|
|
1066
|
+
(object) => object.entityType === "model"
|
|
1067
|
+
),
|
|
1068
|
+
cameras: Array.from(this.registered.values()).filter(
|
|
1069
|
+
(object) => object.entityType === "pov"
|
|
1070
|
+
),
|
|
1071
|
+
primitives: Array.from(this.registered.values()).filter(
|
|
1072
|
+
(object) => object.entityType === "primitive"
|
|
1073
|
+
),
|
|
1074
|
+
groups: Array.from(this.registered.values()).filter(
|
|
1075
|
+
(object) => object.entityType === "group"
|
|
1076
|
+
)
|
|
953
1077
|
};
|
|
954
1078
|
Object.assign(payload, sceneData);
|
|
955
1079
|
return sceneData;
|
|
@@ -979,7 +1103,10 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
979
1103
|
if (!objectToUpdate) return false;
|
|
980
1104
|
this.registered.set(payload.id, (0, import_lodash.merge)(objectToUpdate, payload));
|
|
981
1105
|
const updatedObject = this.registered.get(payload.id);
|
|
982
|
-
this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), {
|
|
1106
|
+
this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), {
|
|
1107
|
+
id: updatedObject.id,
|
|
1108
|
+
entityType: updatedObject.entityType
|
|
1109
|
+
}));
|
|
983
1110
|
Object.assign(payload, updatedObject);
|
|
984
1111
|
return true;
|
|
985
1112
|
}
|
|
@@ -1057,7 +1184,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1057
1184
|
position = payload.position;
|
|
1058
1185
|
target = payload.target;
|
|
1059
1186
|
}
|
|
1060
|
-
this.controller.MoveTo(
|
|
1187
|
+
this.controller.MoveTo(
|
|
1188
|
+
position,
|
|
1189
|
+
target,
|
|
1190
|
+
payload.duration,
|
|
1191
|
+
payload.locked
|
|
1192
|
+
);
|
|
1061
1193
|
return true;
|
|
1062
1194
|
}
|
|
1063
1195
|
setCameraLayer(payload) {
|
|
@@ -1097,10 +1229,14 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1097
1229
|
}
|
|
1098
1230
|
updateScene(payload) {
|
|
1099
1231
|
if (payload.name !== void 0) this.scene.name = payload.name;
|
|
1100
|
-
if (payload.backgroundColor !== void 0)
|
|
1101
|
-
|
|
1102
|
-
if (payload.
|
|
1103
|
-
|
|
1232
|
+
if (payload.backgroundColor !== void 0)
|
|
1233
|
+
this.scene.SetBackground(payload.backgroundColor);
|
|
1234
|
+
if (payload.gridEnabled !== void 0)
|
|
1235
|
+
this.scene.Grid.SetVisibility(payload.gridEnabled);
|
|
1236
|
+
if (payload.floorEnabled !== void 0)
|
|
1237
|
+
this.scene.Floor.SetVisibility(payload.floorEnabled);
|
|
1238
|
+
if (payload.floorColor !== void 0)
|
|
1239
|
+
this.scene.Floor.SetColor(payload.floorColor);
|
|
1104
1240
|
payload.name = this.scene.name;
|
|
1105
1241
|
payload.backgroundColor = "#" + this.scene.background.getHexString();
|
|
1106
1242
|
payload.gridEnabled = this.scene.Grid.visible;
|
|
@@ -1118,7 +1254,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
1118
1254
|
position = payload.position;
|
|
1119
1255
|
target = payload.target;
|
|
1120
1256
|
}
|
|
1121
|
-
payload.dataUri = this.mediaGenerator.GenerateMedia(
|
|
1257
|
+
payload.dataUri = this.mediaGenerator.GenerateMedia(
|
|
1258
|
+
position,
|
|
1259
|
+
target,
|
|
1260
|
+
payload.width,
|
|
1261
|
+
payload.height
|
|
1262
|
+
);
|
|
1122
1263
|
return true;
|
|
1123
1264
|
}
|
|
1124
1265
|
setParent(payload) {
|
|
@@ -1171,8 +1312,17 @@ var DIVEPointLight = class extends import_three5.Object3D {
|
|
|
1171
1312
|
this.light.shadow.mapSize.height = 512;
|
|
1172
1313
|
this.add(this.light);
|
|
1173
1314
|
const geoSize = 0.1;
|
|
1174
|
-
const geometry = new import_three5.SphereGeometry(
|
|
1175
|
-
|
|
1315
|
+
const geometry = new import_three5.SphereGeometry(
|
|
1316
|
+
geoSize,
|
|
1317
|
+
geoSize * 320,
|
|
1318
|
+
geoSize * 320
|
|
1319
|
+
);
|
|
1320
|
+
const material = new import_three5.MeshBasicMaterial({
|
|
1321
|
+
color: this.light.color,
|
|
1322
|
+
transparent: true,
|
|
1323
|
+
opacity: 0.8,
|
|
1324
|
+
side: import_three5.FrontSide
|
|
1325
|
+
});
|
|
1176
1326
|
this.mesh = new import_three5.Mesh(geometry, material);
|
|
1177
1327
|
this.mesh.layers.mask = UI_LAYER_MASK;
|
|
1178
1328
|
this.add(this.mesh);
|
|
@@ -1190,15 +1340,24 @@ var DIVEPointLight = class extends import_three5.Object3D {
|
|
|
1190
1340
|
}
|
|
1191
1341
|
onMove() {
|
|
1192
1342
|
var _a;
|
|
1193
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1343
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1344
|
+
"UPDATE_OBJECT",
|
|
1345
|
+
{ id: this.userData.id, position: this.position }
|
|
1346
|
+
);
|
|
1194
1347
|
}
|
|
1195
1348
|
onSelect() {
|
|
1196
1349
|
var _a;
|
|
1197
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1350
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1351
|
+
"SELECT_OBJECT",
|
|
1352
|
+
{ id: this.userData.id }
|
|
1353
|
+
);
|
|
1198
1354
|
}
|
|
1199
1355
|
onDeselect() {
|
|
1200
1356
|
var _a;
|
|
1201
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1357
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1358
|
+
"DESELECT_OBJECT",
|
|
1359
|
+
{ id: this.userData.id }
|
|
1360
|
+
);
|
|
1202
1361
|
}
|
|
1203
1362
|
};
|
|
1204
1363
|
|
|
@@ -1284,22 +1443,44 @@ var DIVENode = class extends import_three7.Object3D {
|
|
|
1284
1443
|
SetToWorldOrigin() {
|
|
1285
1444
|
var _a;
|
|
1286
1445
|
this.position.set(0, 0, 0);
|
|
1287
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1446
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1447
|
+
"UPDATE_OBJECT",
|
|
1448
|
+
{
|
|
1449
|
+
id: this.userData.id,
|
|
1450
|
+
position: this.position,
|
|
1451
|
+
rotation: this.rotation,
|
|
1452
|
+
scale: this.scale
|
|
1453
|
+
}
|
|
1454
|
+
);
|
|
1288
1455
|
}
|
|
1289
1456
|
onMove() {
|
|
1290
1457
|
var _a;
|
|
1291
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1458
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1459
|
+
"UPDATE_OBJECT",
|
|
1460
|
+
{
|
|
1461
|
+
id: this.userData.id,
|
|
1462
|
+
position: this.position,
|
|
1463
|
+
rotation: this.rotation,
|
|
1464
|
+
scale: this.scale
|
|
1465
|
+
}
|
|
1466
|
+
);
|
|
1292
1467
|
if (this.parent && "isDIVEGroup" in this.parent) {
|
|
1293
1468
|
this.parent.UpdateLineTo(this);
|
|
1294
1469
|
}
|
|
1295
1470
|
}
|
|
1296
1471
|
onSelect() {
|
|
1297
1472
|
var _a;
|
|
1298
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1473
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1474
|
+
"SELECT_OBJECT",
|
|
1475
|
+
{ id: this.userData.id }
|
|
1476
|
+
);
|
|
1299
1477
|
}
|
|
1300
1478
|
onDeselect() {
|
|
1301
1479
|
var _a;
|
|
1302
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1480
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1481
|
+
"DESELECT_OBJECT",
|
|
1482
|
+
{ id: this.userData.id }
|
|
1483
|
+
);
|
|
1303
1484
|
}
|
|
1304
1485
|
};
|
|
1305
1486
|
|
|
@@ -1370,20 +1551,36 @@ var DIVEModel = class extends DIVENode {
|
|
|
1370
1551
|
PlaceOnFloor() {
|
|
1371
1552
|
var _a;
|
|
1372
1553
|
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1373
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1554
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1555
|
+
"UPDATE_OBJECT",
|
|
1556
|
+
{
|
|
1557
|
+
id: this.userData.id,
|
|
1558
|
+
position: this.position,
|
|
1559
|
+
rotation: this.rotation,
|
|
1560
|
+
scale: this.scale
|
|
1561
|
+
}
|
|
1562
|
+
);
|
|
1374
1563
|
}
|
|
1375
1564
|
DropIt() {
|
|
1376
1565
|
var _a;
|
|
1377
1566
|
if (!this.parent) {
|
|
1378
|
-
console.warn(
|
|
1567
|
+
console.warn(
|
|
1568
|
+
"DIVEModel: DropIt() called on a model that is not in the scene.",
|
|
1569
|
+
this
|
|
1570
|
+
);
|
|
1379
1571
|
return;
|
|
1380
1572
|
}
|
|
1381
1573
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1382
|
-
const bbBottomCenter = this.localToWorld(
|
|
1574
|
+
const bbBottomCenter = this.localToWorld(
|
|
1575
|
+
this._boundingBox.getCenter(new import_three8.Vector3()).multiply(this.scale)
|
|
1576
|
+
);
|
|
1383
1577
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1384
1578
|
const raycaster = new import_three8.Raycaster(bbBottomCenter, new import_three8.Vector3(0, -1, 0));
|
|
1385
1579
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1386
|
-
const intersections = raycaster.intersectObjects(
|
|
1580
|
+
const intersections = raycaster.intersectObjects(
|
|
1581
|
+
findSceneRecursive(this).Root.children,
|
|
1582
|
+
true
|
|
1583
|
+
);
|
|
1387
1584
|
if (intersections.length > 0) {
|
|
1388
1585
|
const mesh = intersections[0].object;
|
|
1389
1586
|
mesh.geometry.computeBoundingBox();
|
|
@@ -1393,7 +1590,15 @@ var DIVEModel = class extends DIVENode {
|
|
|
1393
1590
|
const newPos = this.position.clone().setY(worldPos.y).sub(new import_three8.Vector3(0, bottomY, 0));
|
|
1394
1591
|
this.position.copy(newPos);
|
|
1395
1592
|
if (this.position.y === oldPos.y) return;
|
|
1396
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1593
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1594
|
+
"UPDATE_OBJECT",
|
|
1595
|
+
{
|
|
1596
|
+
id: this.userData.id,
|
|
1597
|
+
position: this.position,
|
|
1598
|
+
rotation: this.rotation,
|
|
1599
|
+
scale: this.scale
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1397
1602
|
}
|
|
1398
1603
|
}
|
|
1399
1604
|
};
|
|
@@ -1406,7 +1611,9 @@ var DIVELoadingManager = class {
|
|
|
1406
1611
|
this.progress = /* @__PURE__ */ new Map();
|
|
1407
1612
|
this.gltfloader = new import_Addons2.GLTFLoader();
|
|
1408
1613
|
this.dracoloader = new import_Addons2.DRACOLoader();
|
|
1409
|
-
this.dracoloader.setDecoderPath(
|
|
1614
|
+
this.dracoloader.setDecoderPath(
|
|
1615
|
+
"https://www.gstatic.com/draco/v1/decoders/"
|
|
1616
|
+
);
|
|
1410
1617
|
this.gltfloader.setDRACOLoader(this.dracoloader);
|
|
1411
1618
|
}
|
|
1412
1619
|
LoadGLTF(uri) {
|
|
@@ -1485,20 +1692,36 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1485
1692
|
PlaceOnFloor() {
|
|
1486
1693
|
var _a;
|
|
1487
1694
|
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1488
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1695
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1696
|
+
"UPDATE_OBJECT",
|
|
1697
|
+
{
|
|
1698
|
+
id: this.userData.id,
|
|
1699
|
+
position: this.position,
|
|
1700
|
+
rotation: this.rotation,
|
|
1701
|
+
scale: this.scale
|
|
1702
|
+
}
|
|
1703
|
+
);
|
|
1489
1704
|
}
|
|
1490
1705
|
DropIt() {
|
|
1491
1706
|
var _a;
|
|
1492
1707
|
if (!this.parent) {
|
|
1493
|
-
console.warn(
|
|
1708
|
+
console.warn(
|
|
1709
|
+
"DIVEPrimitive: DropIt() called on a model that is not in the scene.",
|
|
1710
|
+
this
|
|
1711
|
+
);
|
|
1494
1712
|
return;
|
|
1495
1713
|
}
|
|
1496
1714
|
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1497
|
-
const bbBottomCenter = this.localToWorld(
|
|
1715
|
+
const bbBottomCenter = this.localToWorld(
|
|
1716
|
+
this._boundingBox.getCenter(new import_three9.Vector3()).multiply(this.scale)
|
|
1717
|
+
);
|
|
1498
1718
|
bbBottomCenter.y = bottomY + this.position.y;
|
|
1499
1719
|
const raycaster = new import_three9.Raycaster(bbBottomCenter, new import_three9.Vector3(0, -1, 0));
|
|
1500
1720
|
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1501
|
-
const intersections = raycaster.intersectObjects(
|
|
1721
|
+
const intersections = raycaster.intersectObjects(
|
|
1722
|
+
findSceneRecursive(this).Root.children,
|
|
1723
|
+
true
|
|
1724
|
+
);
|
|
1502
1725
|
if (intersections.length > 0) {
|
|
1503
1726
|
const mesh = intersections[0].object;
|
|
1504
1727
|
mesh.geometry.computeBoundingBox();
|
|
@@ -1508,7 +1731,15 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1508
1731
|
const newPos = this.position.clone().setY(worldPos.y).sub(new import_three9.Vector3(0, bottomY, 0));
|
|
1509
1732
|
this.position.copy(newPos);
|
|
1510
1733
|
if (this.position.y === oldPos.y) return;
|
|
1511
|
-
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1734
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction(
|
|
1735
|
+
"UPDATE_OBJECT",
|
|
1736
|
+
{
|
|
1737
|
+
id: this.userData.id,
|
|
1738
|
+
position: this.position,
|
|
1739
|
+
rotation: this.rotation,
|
|
1740
|
+
scale: this.scale
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1512
1743
|
}
|
|
1513
1744
|
}
|
|
1514
1745
|
assembleGeometry(geometry) {
|
|
@@ -1528,13 +1759,21 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1528
1759
|
case "plane":
|
|
1529
1760
|
return this.createPlaneGeometry(geometry);
|
|
1530
1761
|
default: {
|
|
1531
|
-
console.warn(
|
|
1762
|
+
console.warn(
|
|
1763
|
+
"DIVEPrimitive: Invalid geometry type:",
|
|
1764
|
+
geometry.name.toLowerCase()
|
|
1765
|
+
);
|
|
1532
1766
|
return new import_three9.BufferGeometry();
|
|
1533
1767
|
}
|
|
1534
1768
|
}
|
|
1535
1769
|
}
|
|
1536
1770
|
createCylinderGeometry(geometry) {
|
|
1537
|
-
const geo = new import_three9.CylinderGeometry(
|
|
1771
|
+
const geo = new import_three9.CylinderGeometry(
|
|
1772
|
+
geometry.width / 2,
|
|
1773
|
+
geometry.width / 2,
|
|
1774
|
+
geometry.height,
|
|
1775
|
+
64
|
|
1776
|
+
);
|
|
1538
1777
|
geo.translate(0, geometry.height / 2, 0);
|
|
1539
1778
|
return geo;
|
|
1540
1779
|
}
|
|
@@ -1543,13 +1782,23 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1543
1782
|
return geo;
|
|
1544
1783
|
}
|
|
1545
1784
|
createPyramidGeometry(geometry) {
|
|
1546
|
-
const geo = new import_three9.ConeGeometry(
|
|
1785
|
+
const geo = new import_three9.ConeGeometry(
|
|
1786
|
+
geometry.width / 2,
|
|
1787
|
+
geometry.height,
|
|
1788
|
+
4,
|
|
1789
|
+
1,
|
|
1790
|
+
true
|
|
1791
|
+
);
|
|
1547
1792
|
geo.rotateY(Math.PI / 4);
|
|
1548
1793
|
geo.translate(0, geometry.height / 2, 0);
|
|
1549
1794
|
return geo;
|
|
1550
1795
|
}
|
|
1551
1796
|
createBoxGeometry(geometry) {
|
|
1552
|
-
const geo = new import_three9.BoxGeometry(
|
|
1797
|
+
const geo = new import_three9.BoxGeometry(
|
|
1798
|
+
geometry.width,
|
|
1799
|
+
geometry.height,
|
|
1800
|
+
geometry.depth
|
|
1801
|
+
);
|
|
1553
1802
|
geo.translate(0, geometry.height / 2, 0);
|
|
1554
1803
|
return geo;
|
|
1555
1804
|
}
|
|
@@ -1559,12 +1808,21 @@ var DIVEPrimitive = class extends DIVENode {
|
|
|
1559
1808
|
return geo;
|
|
1560
1809
|
}
|
|
1561
1810
|
createWallGeometry(geometry) {
|
|
1562
|
-
const geo = new import_three9.BoxGeometry(
|
|
1811
|
+
const geo = new import_three9.BoxGeometry(
|
|
1812
|
+
geometry.width,
|
|
1813
|
+
geometry.height,
|
|
1814
|
+
geometry.depth || 0.05,
|
|
1815
|
+
16
|
|
1816
|
+
);
|
|
1563
1817
|
geo.translate(0, geometry.height / 2, 0);
|
|
1564
1818
|
return geo;
|
|
1565
1819
|
}
|
|
1566
1820
|
createPlaneGeometry(geometry) {
|
|
1567
|
-
const geo = new import_three9.BoxGeometry(
|
|
1821
|
+
const geo = new import_three9.BoxGeometry(
|
|
1822
|
+
geometry.width,
|
|
1823
|
+
geometry.height,
|
|
1824
|
+
geometry.depth
|
|
1825
|
+
);
|
|
1568
1826
|
geo.translate(0, geometry.height / 2, 0);
|
|
1569
1827
|
return geo;
|
|
1570
1828
|
}
|
|
@@ -1635,7 +1893,10 @@ var DIVEGroup = class extends DIVENode {
|
|
|
1635
1893
|
* Updates a line to the object.
|
|
1636
1894
|
*/
|
|
1637
1895
|
updateLineTo(line, object) {
|
|
1638
|
-
line.geometry.setFromPoints([
|
|
1896
|
+
line.geometry.setFromPoints([
|
|
1897
|
+
new import_three10.Vector3(0, 0, 0),
|
|
1898
|
+
object.position.clone()
|
|
1899
|
+
]);
|
|
1639
1900
|
line.computeLineDistances();
|
|
1640
1901
|
}
|
|
1641
1902
|
// public SetBoundingBoxVisibility(visible: boolean): void {
|
|
@@ -1813,20 +2074,39 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1813
2074
|
break;
|
|
1814
2075
|
}
|
|
1815
2076
|
default: {
|
|
1816
|
-
console.warn(
|
|
2077
|
+
console.warn(
|
|
2078
|
+
`DIVERoot.updateLight: Unknown light type: ${light.type}`
|
|
2079
|
+
);
|
|
1817
2080
|
return;
|
|
1818
2081
|
}
|
|
1819
2082
|
}
|
|
1820
2083
|
sceneObject.userData.id = light.id;
|
|
1821
2084
|
this.add(sceneObject);
|
|
1822
2085
|
}
|
|
1823
|
-
if (light.name !== void 0 && light.name !== null)
|
|
1824
|
-
|
|
1825
|
-
if (light.
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
2086
|
+
if (light.name !== void 0 && light.name !== null)
|
|
2087
|
+
sceneObject.name = light.name;
|
|
2088
|
+
if (light.position !== void 0 && light.position !== null)
|
|
2089
|
+
sceneObject.position.set(
|
|
2090
|
+
light.position.x,
|
|
2091
|
+
light.position.y,
|
|
2092
|
+
light.position.z
|
|
2093
|
+
);
|
|
2094
|
+
if (light.intensity !== void 0 && light.intensity !== null)
|
|
2095
|
+
sceneObject.SetIntensity(
|
|
2096
|
+
light.intensity
|
|
2097
|
+
);
|
|
2098
|
+
if (light.enabled !== void 0 && light.enabled !== null)
|
|
2099
|
+
sceneObject.SetEnabled(
|
|
2100
|
+
light.enabled
|
|
2101
|
+
);
|
|
2102
|
+
if (light.color !== void 0 && light.color !== null)
|
|
2103
|
+
sceneObject.SetColor(
|
|
2104
|
+
new import_three11.Color(light.color)
|
|
2105
|
+
);
|
|
2106
|
+
if (light.visible !== void 0 && light.visible !== null)
|
|
2107
|
+
sceneObject.visible = light.visible;
|
|
2108
|
+
if (light.parentId !== void 0)
|
|
2109
|
+
this.setParent(__spreadProps(__spreadValues({}, light), { parentId: light.parentId }));
|
|
1830
2110
|
}
|
|
1831
2111
|
updateModel(model) {
|
|
1832
2112
|
let sceneObject = this.GetSceneObject(model);
|
|
@@ -1840,16 +2120,25 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1840
2120
|
this.loadingManager.LoadGLTF(model.uri).then((gltf) => {
|
|
1841
2121
|
var _a;
|
|
1842
2122
|
sceneObject.SetModel(gltf);
|
|
1843
|
-
(_a = DIVECommunication.get(model.id)) == null ? void 0 : _a.PerformAction(
|
|
2123
|
+
(_a = DIVECommunication.get(model.id)) == null ? void 0 : _a.PerformAction(
|
|
2124
|
+
"MODEL_LOADED",
|
|
2125
|
+
{ id: model.id }
|
|
2126
|
+
);
|
|
1844
2127
|
});
|
|
1845
2128
|
}
|
|
1846
2129
|
if (model.name !== void 0) sceneObject.name = model.name;
|
|
1847
|
-
if (model.position !== void 0)
|
|
1848
|
-
|
|
1849
|
-
if (model.
|
|
1850
|
-
|
|
1851
|
-
if (model.
|
|
1852
|
-
|
|
2130
|
+
if (model.position !== void 0)
|
|
2131
|
+
sceneObject.SetPosition(model.position);
|
|
2132
|
+
if (model.rotation !== void 0)
|
|
2133
|
+
sceneObject.SetRotation(model.rotation);
|
|
2134
|
+
if (model.scale !== void 0)
|
|
2135
|
+
sceneObject.SetScale(model.scale);
|
|
2136
|
+
if (model.visible !== void 0)
|
|
2137
|
+
sceneObject.SetVisibility(model.visible);
|
|
2138
|
+
if (model.material !== void 0)
|
|
2139
|
+
sceneObject.SetMaterial(model.material);
|
|
2140
|
+
if (model.parentId !== void 0)
|
|
2141
|
+
this.setParent(__spreadProps(__spreadValues({}, model), { parentId: model.parentId }));
|
|
1853
2142
|
}
|
|
1854
2143
|
updatePrimitive(primitive) {
|
|
1855
2144
|
let sceneObject = this.GetSceneObject(primitive);
|
|
@@ -1860,13 +2149,20 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1860
2149
|
this.add(sceneObject);
|
|
1861
2150
|
}
|
|
1862
2151
|
if (primitive.name !== void 0) sceneObject.name = primitive.name;
|
|
1863
|
-
if (primitive.geometry !== void 0)
|
|
1864
|
-
|
|
1865
|
-
if (primitive.
|
|
1866
|
-
|
|
1867
|
-
if (primitive.
|
|
1868
|
-
|
|
1869
|
-
if (primitive.
|
|
2152
|
+
if (primitive.geometry !== void 0)
|
|
2153
|
+
sceneObject.SetGeometry(primitive.geometry);
|
|
2154
|
+
if (primitive.position !== void 0)
|
|
2155
|
+
sceneObject.SetPosition(primitive.position);
|
|
2156
|
+
if (primitive.rotation !== void 0)
|
|
2157
|
+
sceneObject.SetRotation(primitive.rotation);
|
|
2158
|
+
if (primitive.scale !== void 0)
|
|
2159
|
+
sceneObject.SetScale(primitive.scale);
|
|
2160
|
+
if (primitive.visible !== void 0)
|
|
2161
|
+
sceneObject.SetVisibility(primitive.visible);
|
|
2162
|
+
if (primitive.material !== void 0)
|
|
2163
|
+
sceneObject.SetMaterial(primitive.material);
|
|
2164
|
+
if (primitive.parentId !== void 0)
|
|
2165
|
+
this.setParent(__spreadProps(__spreadValues({}, primitive), { parentId: primitive.parentId }));
|
|
1870
2166
|
}
|
|
1871
2167
|
updateGroup(group) {
|
|
1872
2168
|
let sceneObject = this.GetSceneObject(group);
|
|
@@ -1877,17 +2173,25 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1877
2173
|
this.add(sceneObject);
|
|
1878
2174
|
}
|
|
1879
2175
|
if (group.name !== void 0) sceneObject.name = group.name;
|
|
1880
|
-
if (group.position !== void 0)
|
|
1881
|
-
|
|
1882
|
-
if (group.
|
|
1883
|
-
|
|
1884
|
-
if (group.
|
|
1885
|
-
|
|
2176
|
+
if (group.position !== void 0)
|
|
2177
|
+
sceneObject.SetPosition(group.position);
|
|
2178
|
+
if (group.rotation !== void 0)
|
|
2179
|
+
sceneObject.SetRotation(group.rotation);
|
|
2180
|
+
if (group.scale !== void 0)
|
|
2181
|
+
sceneObject.SetScale(group.scale);
|
|
2182
|
+
if (group.visible !== void 0)
|
|
2183
|
+
sceneObject.SetVisibility(group.visible);
|
|
2184
|
+
if (group.bbVisible !== void 0)
|
|
2185
|
+
sceneObject.SetLinesVisibility(group.bbVisible);
|
|
2186
|
+
if (group.parentId !== void 0)
|
|
2187
|
+
this.setParent(__spreadProps(__spreadValues({}, group), { parentId: group.parentId }));
|
|
1886
2188
|
}
|
|
1887
2189
|
deleteLight(light) {
|
|
1888
2190
|
const sceneObject = this.GetSceneObject(light);
|
|
1889
2191
|
if (!sceneObject) {
|
|
1890
|
-
console.warn(
|
|
2192
|
+
console.warn(
|
|
2193
|
+
`DIVERoot.deleteLight: Light with id ${light.id} not found`
|
|
2194
|
+
);
|
|
1891
2195
|
return;
|
|
1892
2196
|
}
|
|
1893
2197
|
this.detachTransformControls(sceneObject);
|
|
@@ -1896,7 +2200,9 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1896
2200
|
deleteModel(model) {
|
|
1897
2201
|
const sceneObject = this.GetSceneObject(model);
|
|
1898
2202
|
if (!sceneObject) {
|
|
1899
|
-
console.warn(
|
|
2203
|
+
console.warn(
|
|
2204
|
+
`DIVERoot.deleteModel: Model with id ${model.id} not found`
|
|
2205
|
+
);
|
|
1900
2206
|
return;
|
|
1901
2207
|
}
|
|
1902
2208
|
this.detachTransformControls(sceneObject);
|
|
@@ -1905,7 +2211,9 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1905
2211
|
deletePrimitive(primitive) {
|
|
1906
2212
|
const sceneObject = this.GetSceneObject(primitive);
|
|
1907
2213
|
if (!sceneObject) {
|
|
1908
|
-
console.warn(
|
|
2214
|
+
console.warn(
|
|
2215
|
+
`DIVERoot.deletePrimitive: Primitive with id ${primitive.id} not found`
|
|
2216
|
+
);
|
|
1909
2217
|
return;
|
|
1910
2218
|
}
|
|
1911
2219
|
this.detachTransformControls(sceneObject);
|
|
@@ -1914,7 +2222,9 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1914
2222
|
deleteGroup(group) {
|
|
1915
2223
|
const sceneObject = this.GetSceneObject(group);
|
|
1916
2224
|
if (!sceneObject) {
|
|
1917
|
-
console.warn(
|
|
2225
|
+
console.warn(
|
|
2226
|
+
`DIVERoot.deleteGroup: Group with id ${group.id} not found`
|
|
2227
|
+
);
|
|
1918
2228
|
return;
|
|
1919
2229
|
}
|
|
1920
2230
|
this.detachTransformControls(sceneObject);
|
|
@@ -1932,7 +2242,9 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1932
2242
|
const sceneObject = this.GetSceneObject(object);
|
|
1933
2243
|
if (!sceneObject) return;
|
|
1934
2244
|
if (object.parentId !== null) {
|
|
1935
|
-
const parent = this.GetSceneObject({
|
|
2245
|
+
const parent = this.GetSceneObject({
|
|
2246
|
+
id: object.parentId
|
|
2247
|
+
});
|
|
1936
2248
|
if (!parent) return;
|
|
1937
2249
|
parent.attach(sceneObject);
|
|
1938
2250
|
} else {
|
|
@@ -1950,7 +2262,6 @@ var DIVERoot = class extends import_three11.Object3D {
|
|
|
1950
2262
|
if (object.parent !== null) {
|
|
1951
2263
|
return this.findScene(object.parent);
|
|
1952
2264
|
}
|
|
1953
|
-
;
|
|
1954
2265
|
return object;
|
|
1955
2266
|
}
|
|
1956
2267
|
};
|
|
@@ -1966,7 +2277,12 @@ var DIVEGrid = class extends import_three12.Object3D {
|
|
|
1966
2277
|
constructor() {
|
|
1967
2278
|
super();
|
|
1968
2279
|
this.name = "Grid";
|
|
1969
|
-
const grid = new import_three12.GridHelper(
|
|
2280
|
+
const grid = new import_three12.GridHelper(
|
|
2281
|
+
100,
|
|
2282
|
+
100,
|
|
2283
|
+
GRID_CENTER_LINE_COLOR,
|
|
2284
|
+
GRID_SIDE_LINE_COLOR
|
|
2285
|
+
);
|
|
1970
2286
|
grid.material.depthTest = false;
|
|
1971
2287
|
grid.layers.mask = HELPER_LAYER_MASK;
|
|
1972
2288
|
this.add(grid);
|
|
@@ -1981,7 +2297,12 @@ var import_three13 = require("three");
|
|
|
1981
2297
|
init_VisibilityLayerMask();
|
|
1982
2298
|
var DIVEFloor = class extends import_three13.Mesh {
|
|
1983
2299
|
constructor() {
|
|
1984
|
-
super(
|
|
2300
|
+
super(
|
|
2301
|
+
new import_three13.PlaneGeometry(1e4, 1e4),
|
|
2302
|
+
new import_three13.MeshStandardMaterial({
|
|
2303
|
+
color: new import_three13.Color(150 / 255, 150 / 255, 150 / 255)
|
|
2304
|
+
})
|
|
2305
|
+
);
|
|
1985
2306
|
this.isFloor = true;
|
|
1986
2307
|
this.name = "Floor";
|
|
1987
2308
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
@@ -2099,7 +2420,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
2099
2420
|
ZoomIn(by) {
|
|
2100
2421
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
2101
2422
|
const { minDistance, maxDistance } = this;
|
|
2102
|
-
this.minDistance = this.maxDistance = import_three15.MathUtils.clamp(
|
|
2423
|
+
this.minDistance = this.maxDistance = import_three15.MathUtils.clamp(
|
|
2424
|
+
this.getDistance() - zoomBy,
|
|
2425
|
+
minDistance + zoomBy,
|
|
2426
|
+
maxDistance - zoomBy
|
|
2427
|
+
);
|
|
2103
2428
|
this.update();
|
|
2104
2429
|
this.minDistance = minDistance;
|
|
2105
2430
|
this.maxDistance = maxDistance;
|
|
@@ -2107,7 +2432,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
2107
2432
|
ZoomOut(by) {
|
|
2108
2433
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
2109
2434
|
const { minDistance, maxDistance } = this;
|
|
2110
|
-
this.minDistance = this.maxDistance = import_three15.MathUtils.clamp(
|
|
2435
|
+
this.minDistance = this.maxDistance = import_three15.MathUtils.clamp(
|
|
2436
|
+
this.getDistance() + zoomBy,
|
|
2437
|
+
minDistance + zoomBy,
|
|
2438
|
+
maxDistance - zoomBy
|
|
2439
|
+
);
|
|
2111
2440
|
this.update();
|
|
2112
2441
|
this.minDistance = minDistance;
|
|
2113
2442
|
this.maxDistance = maxDistance;
|
|
@@ -2117,7 +2446,11 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
2117
2446
|
const toPosition = pos || this.object.position.clone();
|
|
2118
2447
|
const toTarget = target || this.target.clone();
|
|
2119
2448
|
this.stopRevertLast();
|
|
2120
|
-
if (!this.locked)
|
|
2449
|
+
if (!this.locked)
|
|
2450
|
+
this.last = {
|
|
2451
|
+
pos: this.object.position.clone(),
|
|
2452
|
+
target: this.target.clone()
|
|
2453
|
+
};
|
|
2121
2454
|
this.animating = duration > 0;
|
|
2122
2455
|
this.locked = lock;
|
|
2123
2456
|
this.enabled = false;
|
|
@@ -2161,7 +2494,10 @@ var DIVEToolbox = class {
|
|
|
2161
2494
|
get selectTool() {
|
|
2162
2495
|
if (!this._selectTool) {
|
|
2163
2496
|
const DIVESelectTool2 = (init_SelectTool(), __toCommonJS(SelectTool_exports)).DIVESelectTool;
|
|
2164
|
-
this._selectTool = new DIVESelectTool2(
|
|
2497
|
+
this._selectTool = new DIVESelectTool2(
|
|
2498
|
+
this._scene,
|
|
2499
|
+
this._controller
|
|
2500
|
+
);
|
|
2165
2501
|
}
|
|
2166
2502
|
return this._selectTool;
|
|
2167
2503
|
}
|
|
@@ -2220,16 +2556,40 @@ var DIVEToolbox = class {
|
|
|
2220
2556
|
(_a = this._activeTool) == null ? void 0 : _a.onWheel(e);
|
|
2221
2557
|
}
|
|
2222
2558
|
addEventListeners() {
|
|
2223
|
-
this._controller.domElement.addEventListener(
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2559
|
+
this._controller.domElement.addEventListener(
|
|
2560
|
+
"pointermove",
|
|
2561
|
+
(e) => this.onPointerMove(e)
|
|
2562
|
+
);
|
|
2563
|
+
this._controller.domElement.addEventListener(
|
|
2564
|
+
"pointerdown",
|
|
2565
|
+
(e) => this.onPointerDown(e)
|
|
2566
|
+
);
|
|
2567
|
+
this._controller.domElement.addEventListener(
|
|
2568
|
+
"pointerup",
|
|
2569
|
+
(e) => this.onPointerUp(e)
|
|
2570
|
+
);
|
|
2571
|
+
this._controller.domElement.addEventListener(
|
|
2572
|
+
"wheel",
|
|
2573
|
+
(e) => this.onWheel(e)
|
|
2574
|
+
);
|
|
2227
2575
|
}
|
|
2228
2576
|
removeEventListeners() {
|
|
2229
|
-
this._controller.domElement.removeEventListener(
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2577
|
+
this._controller.domElement.removeEventListener(
|
|
2578
|
+
"pointermove",
|
|
2579
|
+
(e) => this.onPointerMove(e)
|
|
2580
|
+
);
|
|
2581
|
+
this._controller.domElement.removeEventListener(
|
|
2582
|
+
"pointerdown",
|
|
2583
|
+
(e) => this.onPointerDown(e)
|
|
2584
|
+
);
|
|
2585
|
+
this._controller.domElement.removeEventListener(
|
|
2586
|
+
"pointerup",
|
|
2587
|
+
(e) => this.onPointerUp(e)
|
|
2588
|
+
);
|
|
2589
|
+
this._controller.domElement.removeEventListener(
|
|
2590
|
+
"wheel",
|
|
2591
|
+
(e) => this.onWheel(e)
|
|
2592
|
+
);
|
|
2233
2593
|
}
|
|
2234
2594
|
};
|
|
2235
2595
|
DIVEToolbox.DefaultTool = "select";
|
|
@@ -2316,7 +2676,9 @@ var DIVEAxisCamera = class extends import_three16.OrthographicCamera {
|
|
|
2316
2676
|
this._scene.remove(this);
|
|
2317
2677
|
}
|
|
2318
2678
|
SetFromCameraMatrix(matrix) {
|
|
2319
|
-
this.axesHelper.rotation.setFromRotationMatrix(
|
|
2679
|
+
this.axesHelper.rotation.setFromRotationMatrix(
|
|
2680
|
+
new import_three16.Matrix4().extractRotation(matrix).invert()
|
|
2681
|
+
);
|
|
2320
2682
|
}
|
|
2321
2683
|
};
|
|
2322
2684
|
|
|
@@ -2351,7 +2713,10 @@ var getObjectDelta = (a, b) => {
|
|
|
2351
2713
|
}
|
|
2352
2714
|
const arrayDeltas = [];
|
|
2353
2715
|
bArray.forEach((entry, index) => {
|
|
2354
|
-
const inArrayDelta = getObjectDelta(
|
|
2716
|
+
const inArrayDelta = getObjectDelta(
|
|
2717
|
+
aArray[index],
|
|
2718
|
+
bArray[index]
|
|
2719
|
+
);
|
|
2355
2720
|
if (Object.keys(inArrayDelta).length) {
|
|
2356
2721
|
arrayDeltas.push(bArray[index]);
|
|
2357
2722
|
}
|
|
@@ -2367,7 +2732,10 @@ var getObjectDelta = (a, b) => {
|
|
|
2367
2732
|
delta = __spreadProps(__spreadValues({}, delta), { [key]: b[key] });
|
|
2368
2733
|
return;
|
|
2369
2734
|
}
|
|
2370
|
-
const objectDelta = getObjectDelta(
|
|
2735
|
+
const objectDelta = getObjectDelta(
|
|
2736
|
+
a[key],
|
|
2737
|
+
b[key]
|
|
2738
|
+
);
|
|
2371
2739
|
if (Object.keys(objectDelta).length) {
|
|
2372
2740
|
delta = __spreadProps(__spreadValues({}, delta), { [key]: objectDelta });
|
|
2373
2741
|
return;
|
|
@@ -2483,7 +2851,7 @@ DIVEInfo._supportsWebXR = null;
|
|
|
2483
2851
|
// package.json
|
|
2484
2852
|
var package_default = {
|
|
2485
2853
|
name: "@shopware-ag/dive",
|
|
2486
|
-
version: "1.16.
|
|
2854
|
+
version: "1.16.1",
|
|
2487
2855
|
description: "Shopware Spatial Framework",
|
|
2488
2856
|
type: "module",
|
|
2489
2857
|
main: "./build/dive.cjs",
|
|
@@ -2528,6 +2896,8 @@ var package_default = {
|
|
|
2528
2896
|
jest: "^29.7.0",
|
|
2529
2897
|
"jest-environment-jsdom": "^29.7.0",
|
|
2530
2898
|
jsdom: "^24.0.0",
|
|
2899
|
+
prettier: "^3.3.3",
|
|
2900
|
+
"prettier-plugin-multiline-arrays": "^3.0.6",
|
|
2531
2901
|
"ts-jest": "^29.1.2",
|
|
2532
2902
|
"ts-node": "^10.9.2",
|
|
2533
2903
|
tsup: "^8.0.2",
|
|
@@ -2538,6 +2908,8 @@ var package_default = {
|
|
|
2538
2908
|
build: "tsup && yarn genmd",
|
|
2539
2909
|
watch: "tsup --watch",
|
|
2540
2910
|
lint: "eslint",
|
|
2911
|
+
"prettier-check": "prettier --check .",
|
|
2912
|
+
"prettier-fix": "prettier --write .",
|
|
2541
2913
|
unit: "jest",
|
|
2542
2914
|
coverage: "jest --coverage",
|
|
2543
2915
|
genmd: "node ./scripts/genmd.js"
|
|
@@ -2571,7 +2943,10 @@ function roundExponential(number, decimals = 0) {
|
|
|
2571
2943
|
|
|
2572
2944
|
// src/math/signedAngleTo/signedAngleTo.ts
|
|
2573
2945
|
function signedAngleTo(vecA, vecB, planeNormal) {
|
|
2574
|
-
return Math.atan2(
|
|
2946
|
+
return Math.atan2(
|
|
2947
|
+
vecA.clone().cross(vecB).dot(planeNormal),
|
|
2948
|
+
vecB.clone().dot(vecA)
|
|
2949
|
+
);
|
|
2575
2950
|
}
|
|
2576
2951
|
|
|
2577
2952
|
// src/math/toFixed/toFixedExp.ts
|
|
@@ -2629,7 +3004,10 @@ var DIVE = class _DIVE {
|
|
|
2629
3004
|
dive.Communication.PerformAction("PLACE_ON_FLOOR", {
|
|
2630
3005
|
id: modelid
|
|
2631
3006
|
});
|
|
2632
|
-
const transform = dive.Communication.PerformAction(
|
|
3007
|
+
const transform = dive.Communication.PerformAction(
|
|
3008
|
+
"COMPUTE_ENCOMPASSING_VIEW",
|
|
3009
|
+
{}
|
|
3010
|
+
);
|
|
2633
3011
|
dive.Communication.PerformAction("SET_CAMERA_TRANSFORM", {
|
|
2634
3012
|
position: transform.position,
|
|
2635
3013
|
target: transform.target
|
|
@@ -2667,16 +3045,25 @@ var DIVE = class _DIVE {
|
|
|
2667
3045
|
set Settings(settings) {
|
|
2668
3046
|
var _a;
|
|
2669
3047
|
const settingsDelta = getObjectDelta(this._settings, settings);
|
|
2670
|
-
if (settingsDelta.renderer)
|
|
3048
|
+
if (settingsDelta.renderer)
|
|
3049
|
+
this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2671
3050
|
if (settingsDelta.perspectiveCamera) {
|
|
2672
|
-
if (settingsDelta.perspectiveCamera.fov !== void 0)
|
|
2673
|
-
|
|
2674
|
-
if (settingsDelta.perspectiveCamera.
|
|
2675
|
-
|
|
3051
|
+
if (settingsDelta.perspectiveCamera.fov !== void 0)
|
|
3052
|
+
this.perspectiveCamera.fov = settingsDelta.perspectiveCamera.fov;
|
|
3053
|
+
if (settingsDelta.perspectiveCamera.near !== void 0)
|
|
3054
|
+
this.perspectiveCamera.near = settingsDelta.perspectiveCamera.near;
|
|
3055
|
+
if (settingsDelta.perspectiveCamera.far !== void 0)
|
|
3056
|
+
this.perspectiveCamera.far = settingsDelta.perspectiveCamera.far;
|
|
3057
|
+
this.perspectiveCamera.OnResize(
|
|
3058
|
+
this.renderer.domElement.width,
|
|
3059
|
+
this.renderer.domElement.height
|
|
3060
|
+
);
|
|
2676
3061
|
}
|
|
2677
3062
|
if (settingsDelta.orbitControls) {
|
|
2678
|
-
if (settingsDelta.orbitControls.enableDamping !== void 0)
|
|
2679
|
-
|
|
3063
|
+
if (settingsDelta.orbitControls.enableDamping !== void 0)
|
|
3064
|
+
this.orbitControls.enableDamping = settingsDelta.orbitControls.enableDamping;
|
|
3065
|
+
if (settingsDelta.orbitControls.dampingFactor !== void 0)
|
|
3066
|
+
this.orbitControls.dampingFactor = settingsDelta.orbitControls.dampingFactor;
|
|
2680
3067
|
}
|
|
2681
3068
|
if (settingsDelta.autoResize !== this._settings.autoResize) {
|
|
2682
3069
|
if (settingsDelta.autoResize) {
|
|
@@ -2686,7 +3073,11 @@ var DIVE = class _DIVE {
|
|
|
2686
3073
|
}
|
|
2687
3074
|
}
|
|
2688
3075
|
if (settingsDelta.displayAxes) {
|
|
2689
|
-
this.axisCamera = new DIVEAxisCamera(
|
|
3076
|
+
this.axisCamera = new DIVEAxisCamera(
|
|
3077
|
+
this.renderer,
|
|
3078
|
+
this.scene,
|
|
3079
|
+
this.orbitControls
|
|
3080
|
+
);
|
|
2690
3081
|
} else {
|
|
2691
3082
|
(_a = this.axisCamera) == null ? void 0 : _a.Dispose();
|
|
2692
3083
|
this.axisCamera = null;
|
|
@@ -2700,13 +3091,29 @@ var DIVE = class _DIVE {
|
|
|
2700
3091
|
this._height = 0;
|
|
2701
3092
|
this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2702
3093
|
this.scene = new DIVEScene();
|
|
2703
|
-
this.perspectiveCamera = new DIVEPerspectiveCamera(
|
|
3094
|
+
this.perspectiveCamera = new DIVEPerspectiveCamera(
|
|
3095
|
+
this._settings.perspectiveCamera
|
|
3096
|
+
);
|
|
2704
3097
|
this.animationSystem = new DIVEAnimationSystem(this.renderer);
|
|
2705
|
-
this.orbitControls = new DIVEOrbitControls(
|
|
3098
|
+
this.orbitControls = new DIVEOrbitControls(
|
|
3099
|
+
this.perspectiveCamera,
|
|
3100
|
+
this.renderer,
|
|
3101
|
+
this.animationSystem,
|
|
3102
|
+
this._settings.orbitControls
|
|
3103
|
+
);
|
|
2706
3104
|
this.toolbox = new DIVEToolbox(this.scene, this.orbitControls);
|
|
2707
|
-
this.communication = new DIVECommunication(
|
|
3105
|
+
this.communication = new DIVECommunication(
|
|
3106
|
+
this.renderer,
|
|
3107
|
+
this.scene,
|
|
3108
|
+
this.orbitControls,
|
|
3109
|
+
this.toolbox
|
|
3110
|
+
);
|
|
2708
3111
|
if (this._settings.displayAxes) {
|
|
2709
|
-
this.axisCamera = new DIVEAxisCamera(
|
|
3112
|
+
this.axisCamera = new DIVEAxisCamera(
|
|
3113
|
+
this.renderer,
|
|
3114
|
+
this.scene,
|
|
3115
|
+
this.orbitControls
|
|
3116
|
+
);
|
|
2710
3117
|
} else {
|
|
2711
3118
|
this.axisCamera = null;
|
|
2712
3119
|
}
|
|
@@ -2741,7 +3148,8 @@ var DIVE = class _DIVE {
|
|
|
2741
3148
|
const canvasWrapper = this.renderer.domElement.parentElement;
|
|
2742
3149
|
if (!canvasWrapper) return;
|
|
2743
3150
|
const { clientWidth, clientHeight } = canvasWrapper;
|
|
2744
|
-
if (clientWidth === this._width && clientHeight === this._height)
|
|
3151
|
+
if (clientWidth === this._width && clientHeight === this._height)
|
|
3152
|
+
return;
|
|
2745
3153
|
this.OnResize(clientWidth, clientHeight);
|
|
2746
3154
|
this._width = clientWidth;
|
|
2747
3155
|
this._height = clientHeight;
|