@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.d.cts
CHANGED
|
@@ -141,51 +141,58 @@ declare class DIVEOrbitControls extends OrbitControls {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
interface SET_BACKGROUND {
|
|
144
|
-
'
|
|
144
|
+
DESCRIPTION: 'Set the background color of the scene.';
|
|
145
|
+
PAYLOAD: {
|
|
145
146
|
color: string | number;
|
|
146
147
|
};
|
|
147
|
-
|
|
148
|
+
RETURN: boolean;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
interface RESET_CAMERA {
|
|
151
|
-
'
|
|
152
|
+
DESCRIPTION: 'Reset the camera to its initial position and rotation.';
|
|
153
|
+
PAYLOAD: {
|
|
152
154
|
duration: number;
|
|
153
155
|
};
|
|
154
|
-
|
|
156
|
+
RETURN: boolean;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
interface SET_CAMERA_LAYER {
|
|
158
|
-
'
|
|
160
|
+
DESCRIPTION: 'Sets the camera layer to a certain layer.';
|
|
161
|
+
PAYLOAD: {
|
|
159
162
|
layer: 'LIVE' | 'EDITOR';
|
|
160
163
|
};
|
|
161
|
-
|
|
164
|
+
RETURN: boolean;
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
interface ZOOM_CAMERA {
|
|
165
|
-
'
|
|
168
|
+
DESCRIPTION: 'Zooms the camera in or out by a certain amount.';
|
|
169
|
+
PAYLOAD: {
|
|
166
170
|
direction: 'IN' | 'OUT';
|
|
167
171
|
by: number;
|
|
168
172
|
};
|
|
169
|
-
|
|
173
|
+
RETURN: boolean;
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
interface SET_GIZMO_MODE {
|
|
173
|
-
|
|
177
|
+
DESCRIPTION: "Sets the gizmo's mode.";
|
|
178
|
+
PAYLOAD: {
|
|
174
179
|
mode: 'translate' | 'rotate' | 'scale';
|
|
175
180
|
};
|
|
176
|
-
|
|
181
|
+
RETURN: boolean;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
interface SET_CAMERA_TRANSFORM {
|
|
180
|
-
'
|
|
185
|
+
DESCRIPTION: 'Sets the camera position and target.';
|
|
186
|
+
PAYLOAD: {
|
|
181
187
|
position: Vector3Like;
|
|
182
188
|
target: Vector3Like;
|
|
183
189
|
};
|
|
184
|
-
|
|
190
|
+
RETURN: boolean;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
interface MOVE_CAMERA {
|
|
188
|
-
'
|
|
194
|
+
DESCRIPTION: 'Moves the camera to a new position and target.';
|
|
195
|
+
PAYLOAD: {
|
|
189
196
|
position: Vector3Like;
|
|
190
197
|
target: Vector3Like;
|
|
191
198
|
locked: boolean;
|
|
@@ -195,14 +202,15 @@ interface MOVE_CAMERA {
|
|
|
195
202
|
locked: boolean;
|
|
196
203
|
duration: number;
|
|
197
204
|
};
|
|
198
|
-
|
|
205
|
+
RETURN: boolean;
|
|
199
206
|
}
|
|
200
207
|
|
|
201
208
|
interface PLACE_ON_FLOOR {
|
|
202
|
-
'
|
|
209
|
+
DESCRIPTION: 'Places an object on the floor.';
|
|
210
|
+
PAYLOAD: {
|
|
203
211
|
id: string;
|
|
204
212
|
};
|
|
205
|
-
|
|
213
|
+
RETURN: boolean;
|
|
206
214
|
}
|
|
207
215
|
|
|
208
216
|
type COMEntityType = 'pov' | 'light' | 'model' | 'primitive' | 'group';
|
|
@@ -274,56 +282,64 @@ type COMGroup = COMBaseEntity & {
|
|
|
274
282
|
type COMEntity = COMPov | COMLight | COMModel | COMPrimitive | COMGroup;
|
|
275
283
|
|
|
276
284
|
interface GET_ALL_OBJECTS {
|
|
277
|
-
|
|
278
|
-
|
|
285
|
+
readonly DESCRIPTION: 'Retrieves all objects in the scene.';
|
|
286
|
+
PAYLOAD: Map<string, COMEntity>;
|
|
287
|
+
RETURN: Map<string, COMEntity>;
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
interface GET_OBJECTS {
|
|
282
|
-
'
|
|
291
|
+
DESCRIPTION: 'Returns a list of objects of given IDs.';
|
|
292
|
+
PAYLOAD: {
|
|
283
293
|
ids: string[];
|
|
284
294
|
};
|
|
285
|
-
|
|
295
|
+
RETURN: COMEntity[];
|
|
286
296
|
}
|
|
287
297
|
|
|
288
298
|
interface ADD_OBJECT {
|
|
289
|
-
'
|
|
290
|
-
|
|
299
|
+
DESCRIPTION: 'Adds an object to the scene.';
|
|
300
|
+
PAYLOAD: COMEntity;
|
|
301
|
+
RETURN: boolean;
|
|
291
302
|
}
|
|
292
303
|
|
|
293
304
|
interface DELETE_OBJECT {
|
|
294
|
-
|
|
305
|
+
DESCRIPTION: 'Deletes an object from the scene.';
|
|
306
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
295
307
|
id: string;
|
|
296
308
|
};
|
|
297
|
-
|
|
309
|
+
RETURN: boolean;
|
|
298
310
|
}
|
|
299
311
|
|
|
300
312
|
interface UPDATE_OBJECT {
|
|
301
|
-
|
|
313
|
+
DESCRIPTION: 'Updates an existing object.';
|
|
314
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
302
315
|
id: string;
|
|
303
316
|
};
|
|
304
|
-
|
|
317
|
+
RETURN: boolean;
|
|
305
318
|
}
|
|
306
319
|
|
|
307
320
|
interface MODEL_LOADED {
|
|
308
|
-
'
|
|
321
|
+
DESCRIPTION: 'Is triggered when a model is loaded.';
|
|
322
|
+
PAYLOAD: {
|
|
309
323
|
id: string;
|
|
310
324
|
};
|
|
311
|
-
|
|
325
|
+
RETURN: boolean;
|
|
312
326
|
}
|
|
313
327
|
|
|
314
328
|
interface UPDATE_SCENE {
|
|
315
|
-
'
|
|
329
|
+
DESCRIPTION: 'Updates global scene data.';
|
|
330
|
+
PAYLOAD: {
|
|
316
331
|
name?: string;
|
|
317
332
|
backgroundColor?: string | number;
|
|
318
333
|
gridEnabled?: boolean;
|
|
319
334
|
floorEnabled?: boolean;
|
|
320
335
|
floorColor?: string | number;
|
|
321
336
|
};
|
|
322
|
-
|
|
337
|
+
RETURN: boolean;
|
|
323
338
|
}
|
|
324
339
|
|
|
325
340
|
interface GENERATE_MEDIA {
|
|
326
|
-
'
|
|
341
|
+
DESCRIPTION: 'Generates a screenshot, stores it in a Blob and writes the URL into the payload.';
|
|
342
|
+
PAYLOAD: ({
|
|
327
343
|
position: Vector3Like;
|
|
328
344
|
target: Vector3Like;
|
|
329
345
|
} | {
|
|
@@ -333,7 +349,7 @@ interface GENERATE_MEDIA {
|
|
|
333
349
|
height: number;
|
|
334
350
|
dataUri: string;
|
|
335
351
|
};
|
|
336
|
-
|
|
352
|
+
RETURN: boolean;
|
|
337
353
|
}
|
|
338
354
|
|
|
339
355
|
type SceneData = {
|
|
@@ -353,47 +369,54 @@ type SceneData = {
|
|
|
353
369
|
primitives: COMPrimitive[];
|
|
354
370
|
};
|
|
355
371
|
interface GET_ALL_SCENE_DATA {
|
|
356
|
-
'
|
|
357
|
-
|
|
372
|
+
DESCRIPTION: 'Retrieves all current scene data.';
|
|
373
|
+
PAYLOAD: object;
|
|
374
|
+
RETURN: SceneData;
|
|
358
375
|
}
|
|
359
376
|
|
|
360
377
|
interface SELECT_OBJECT {
|
|
361
|
-
|
|
378
|
+
DESCRIPTION: 'Selects an existing object.';
|
|
379
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
362
380
|
id: string;
|
|
363
381
|
};
|
|
364
|
-
|
|
382
|
+
RETURN: boolean;
|
|
365
383
|
}
|
|
366
384
|
|
|
367
385
|
interface DESELECT_OBJECT {
|
|
368
|
-
|
|
386
|
+
DESCRIPTION: 'Deselects an existing object.';
|
|
387
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
369
388
|
id: string;
|
|
370
389
|
};
|
|
371
|
-
|
|
390
|
+
RETURN: boolean;
|
|
372
391
|
}
|
|
373
392
|
|
|
374
393
|
interface GET_CAMERA_TRANSFORM {
|
|
375
|
-
'
|
|
376
|
-
|
|
394
|
+
DESCRIPTION: 'Returns the current camera position and target.';
|
|
395
|
+
PAYLOAD: object;
|
|
396
|
+
RETURN: {
|
|
377
397
|
position: Vector3Like;
|
|
378
398
|
target: Vector3Like;
|
|
379
399
|
};
|
|
380
400
|
}
|
|
381
401
|
|
|
382
402
|
interface DROP_IT {
|
|
383
|
-
'
|
|
403
|
+
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
404
|
+
PAYLOAD: {
|
|
384
405
|
id: string;
|
|
385
406
|
};
|
|
386
|
-
|
|
407
|
+
RETURN: boolean;
|
|
387
408
|
}
|
|
388
409
|
|
|
389
410
|
interface SET_GIZMO_VISIBILITY {
|
|
390
|
-
|
|
391
|
-
|
|
411
|
+
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
412
|
+
PAYLOAD: boolean;
|
|
413
|
+
RETURN: boolean;
|
|
392
414
|
}
|
|
393
415
|
|
|
394
416
|
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
395
|
-
'
|
|
396
|
-
|
|
417
|
+
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
418
|
+
PAYLOAD: object;
|
|
419
|
+
RETURN: {
|
|
397
420
|
position: Vector3Like;
|
|
398
421
|
target: Vector3Like;
|
|
399
422
|
};
|
|
@@ -568,7 +591,7 @@ declare class DIVEPrimitive extends DIVENode {
|
|
|
568
591
|
type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
|
|
569
592
|
|
|
570
593
|
type DIVESceneFileType = {
|
|
571
|
-
|
|
594
|
+
glb: GLTF$1;
|
|
572
595
|
};
|
|
573
596
|
|
|
574
597
|
/**
|
|
@@ -796,32 +819,35 @@ declare class DIVEToolbox {
|
|
|
796
819
|
}
|
|
797
820
|
|
|
798
821
|
interface USE_TOOL {
|
|
799
|
-
'
|
|
822
|
+
DESCRIPTION: 'Activates a specific tool from the toolbox.';
|
|
823
|
+
PAYLOAD: {
|
|
800
824
|
tool: ToolType;
|
|
801
825
|
};
|
|
802
|
-
|
|
826
|
+
RETURN: boolean;
|
|
803
827
|
}
|
|
804
828
|
|
|
805
829
|
interface SET_PARENT {
|
|
806
|
-
'
|
|
830
|
+
DESCRIPTION: 'Attach an object to another object.';
|
|
831
|
+
PAYLOAD: {
|
|
807
832
|
object: Partial<COMEntity> & {
|
|
808
833
|
id: string;
|
|
809
834
|
};
|
|
810
|
-
parent: Partial<COMEntity> & {
|
|
835
|
+
parent: (Partial<COMEntity> & {
|
|
811
836
|
id: string;
|
|
812
|
-
} | null;
|
|
837
|
+
}) | null;
|
|
813
838
|
};
|
|
814
|
-
|
|
839
|
+
RETURN: boolean;
|
|
815
840
|
}
|
|
816
841
|
|
|
817
842
|
interface EXPORT_SCENE {
|
|
818
|
-
'
|
|
843
|
+
DESCRIPTION: 'Exports the current scene to a blob and returns the URL.';
|
|
844
|
+
PAYLOAD: {
|
|
819
845
|
type: keyof DIVESceneFileType;
|
|
820
846
|
};
|
|
821
|
-
|
|
847
|
+
RETURN: Promise<string | null>;
|
|
822
848
|
}
|
|
823
849
|
|
|
824
|
-
|
|
850
|
+
interface Actions {
|
|
825
851
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
826
852
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
827
853
|
GET_OBJECTS: GET_OBJECTS;
|
|
@@ -848,7 +874,7 @@ type Actions = {
|
|
|
848
874
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
849
875
|
SET_PARENT: SET_PARENT;
|
|
850
876
|
EXPORT_SCENE: EXPORT_SCENE;
|
|
851
|
-
}
|
|
877
|
+
}
|
|
852
878
|
|
|
853
879
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
854
880
|
type Unsubscribe = () => boolean;
|
package/build/dive.d.ts
CHANGED
|
@@ -141,51 +141,58 @@ declare class DIVEOrbitControls extends OrbitControls {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
interface SET_BACKGROUND {
|
|
144
|
-
'
|
|
144
|
+
DESCRIPTION: 'Set the background color of the scene.';
|
|
145
|
+
PAYLOAD: {
|
|
145
146
|
color: string | number;
|
|
146
147
|
};
|
|
147
|
-
|
|
148
|
+
RETURN: boolean;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
interface RESET_CAMERA {
|
|
151
|
-
'
|
|
152
|
+
DESCRIPTION: 'Reset the camera to its initial position and rotation.';
|
|
153
|
+
PAYLOAD: {
|
|
152
154
|
duration: number;
|
|
153
155
|
};
|
|
154
|
-
|
|
156
|
+
RETURN: boolean;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
interface SET_CAMERA_LAYER {
|
|
158
|
-
'
|
|
160
|
+
DESCRIPTION: 'Sets the camera layer to a certain layer.';
|
|
161
|
+
PAYLOAD: {
|
|
159
162
|
layer: 'LIVE' | 'EDITOR';
|
|
160
163
|
};
|
|
161
|
-
|
|
164
|
+
RETURN: boolean;
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
interface ZOOM_CAMERA {
|
|
165
|
-
'
|
|
168
|
+
DESCRIPTION: 'Zooms the camera in or out by a certain amount.';
|
|
169
|
+
PAYLOAD: {
|
|
166
170
|
direction: 'IN' | 'OUT';
|
|
167
171
|
by: number;
|
|
168
172
|
};
|
|
169
|
-
|
|
173
|
+
RETURN: boolean;
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
interface SET_GIZMO_MODE {
|
|
173
|
-
|
|
177
|
+
DESCRIPTION: "Sets the gizmo's mode.";
|
|
178
|
+
PAYLOAD: {
|
|
174
179
|
mode: 'translate' | 'rotate' | 'scale';
|
|
175
180
|
};
|
|
176
|
-
|
|
181
|
+
RETURN: boolean;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
interface SET_CAMERA_TRANSFORM {
|
|
180
|
-
'
|
|
185
|
+
DESCRIPTION: 'Sets the camera position and target.';
|
|
186
|
+
PAYLOAD: {
|
|
181
187
|
position: Vector3Like;
|
|
182
188
|
target: Vector3Like;
|
|
183
189
|
};
|
|
184
|
-
|
|
190
|
+
RETURN: boolean;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
interface MOVE_CAMERA {
|
|
188
|
-
'
|
|
194
|
+
DESCRIPTION: 'Moves the camera to a new position and target.';
|
|
195
|
+
PAYLOAD: {
|
|
189
196
|
position: Vector3Like;
|
|
190
197
|
target: Vector3Like;
|
|
191
198
|
locked: boolean;
|
|
@@ -195,14 +202,15 @@ interface MOVE_CAMERA {
|
|
|
195
202
|
locked: boolean;
|
|
196
203
|
duration: number;
|
|
197
204
|
};
|
|
198
|
-
|
|
205
|
+
RETURN: boolean;
|
|
199
206
|
}
|
|
200
207
|
|
|
201
208
|
interface PLACE_ON_FLOOR {
|
|
202
|
-
'
|
|
209
|
+
DESCRIPTION: 'Places an object on the floor.';
|
|
210
|
+
PAYLOAD: {
|
|
203
211
|
id: string;
|
|
204
212
|
};
|
|
205
|
-
|
|
213
|
+
RETURN: boolean;
|
|
206
214
|
}
|
|
207
215
|
|
|
208
216
|
type COMEntityType = 'pov' | 'light' | 'model' | 'primitive' | 'group';
|
|
@@ -274,56 +282,64 @@ type COMGroup = COMBaseEntity & {
|
|
|
274
282
|
type COMEntity = COMPov | COMLight | COMModel | COMPrimitive | COMGroup;
|
|
275
283
|
|
|
276
284
|
interface GET_ALL_OBJECTS {
|
|
277
|
-
|
|
278
|
-
|
|
285
|
+
readonly DESCRIPTION: 'Retrieves all objects in the scene.';
|
|
286
|
+
PAYLOAD: Map<string, COMEntity>;
|
|
287
|
+
RETURN: Map<string, COMEntity>;
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
interface GET_OBJECTS {
|
|
282
|
-
'
|
|
291
|
+
DESCRIPTION: 'Returns a list of objects of given IDs.';
|
|
292
|
+
PAYLOAD: {
|
|
283
293
|
ids: string[];
|
|
284
294
|
};
|
|
285
|
-
|
|
295
|
+
RETURN: COMEntity[];
|
|
286
296
|
}
|
|
287
297
|
|
|
288
298
|
interface ADD_OBJECT {
|
|
289
|
-
'
|
|
290
|
-
|
|
299
|
+
DESCRIPTION: 'Adds an object to the scene.';
|
|
300
|
+
PAYLOAD: COMEntity;
|
|
301
|
+
RETURN: boolean;
|
|
291
302
|
}
|
|
292
303
|
|
|
293
304
|
interface DELETE_OBJECT {
|
|
294
|
-
|
|
305
|
+
DESCRIPTION: 'Deletes an object from the scene.';
|
|
306
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
295
307
|
id: string;
|
|
296
308
|
};
|
|
297
|
-
|
|
309
|
+
RETURN: boolean;
|
|
298
310
|
}
|
|
299
311
|
|
|
300
312
|
interface UPDATE_OBJECT {
|
|
301
|
-
|
|
313
|
+
DESCRIPTION: 'Updates an existing object.';
|
|
314
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
302
315
|
id: string;
|
|
303
316
|
};
|
|
304
|
-
|
|
317
|
+
RETURN: boolean;
|
|
305
318
|
}
|
|
306
319
|
|
|
307
320
|
interface MODEL_LOADED {
|
|
308
|
-
'
|
|
321
|
+
DESCRIPTION: 'Is triggered when a model is loaded.';
|
|
322
|
+
PAYLOAD: {
|
|
309
323
|
id: string;
|
|
310
324
|
};
|
|
311
|
-
|
|
325
|
+
RETURN: boolean;
|
|
312
326
|
}
|
|
313
327
|
|
|
314
328
|
interface UPDATE_SCENE {
|
|
315
|
-
'
|
|
329
|
+
DESCRIPTION: 'Updates global scene data.';
|
|
330
|
+
PAYLOAD: {
|
|
316
331
|
name?: string;
|
|
317
332
|
backgroundColor?: string | number;
|
|
318
333
|
gridEnabled?: boolean;
|
|
319
334
|
floorEnabled?: boolean;
|
|
320
335
|
floorColor?: string | number;
|
|
321
336
|
};
|
|
322
|
-
|
|
337
|
+
RETURN: boolean;
|
|
323
338
|
}
|
|
324
339
|
|
|
325
340
|
interface GENERATE_MEDIA {
|
|
326
|
-
'
|
|
341
|
+
DESCRIPTION: 'Generates a screenshot, stores it in a Blob and writes the URL into the payload.';
|
|
342
|
+
PAYLOAD: ({
|
|
327
343
|
position: Vector3Like;
|
|
328
344
|
target: Vector3Like;
|
|
329
345
|
} | {
|
|
@@ -333,7 +349,7 @@ interface GENERATE_MEDIA {
|
|
|
333
349
|
height: number;
|
|
334
350
|
dataUri: string;
|
|
335
351
|
};
|
|
336
|
-
|
|
352
|
+
RETURN: boolean;
|
|
337
353
|
}
|
|
338
354
|
|
|
339
355
|
type SceneData = {
|
|
@@ -353,47 +369,54 @@ type SceneData = {
|
|
|
353
369
|
primitives: COMPrimitive[];
|
|
354
370
|
};
|
|
355
371
|
interface GET_ALL_SCENE_DATA {
|
|
356
|
-
'
|
|
357
|
-
|
|
372
|
+
DESCRIPTION: 'Retrieves all current scene data.';
|
|
373
|
+
PAYLOAD: object;
|
|
374
|
+
RETURN: SceneData;
|
|
358
375
|
}
|
|
359
376
|
|
|
360
377
|
interface SELECT_OBJECT {
|
|
361
|
-
|
|
378
|
+
DESCRIPTION: 'Selects an existing object.';
|
|
379
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
362
380
|
id: string;
|
|
363
381
|
};
|
|
364
|
-
|
|
382
|
+
RETURN: boolean;
|
|
365
383
|
}
|
|
366
384
|
|
|
367
385
|
interface DESELECT_OBJECT {
|
|
368
|
-
|
|
386
|
+
DESCRIPTION: 'Deselects an existing object.';
|
|
387
|
+
PAYLOAD: Partial<COMEntity> & {
|
|
369
388
|
id: string;
|
|
370
389
|
};
|
|
371
|
-
|
|
390
|
+
RETURN: boolean;
|
|
372
391
|
}
|
|
373
392
|
|
|
374
393
|
interface GET_CAMERA_TRANSFORM {
|
|
375
|
-
'
|
|
376
|
-
|
|
394
|
+
DESCRIPTION: 'Returns the current camera position and target.';
|
|
395
|
+
PAYLOAD: object;
|
|
396
|
+
RETURN: {
|
|
377
397
|
position: Vector3Like;
|
|
378
398
|
target: Vector3Like;
|
|
379
399
|
};
|
|
380
400
|
}
|
|
381
401
|
|
|
382
402
|
interface DROP_IT {
|
|
383
|
-
'
|
|
403
|
+
DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
|
|
404
|
+
PAYLOAD: {
|
|
384
405
|
id: string;
|
|
385
406
|
};
|
|
386
|
-
|
|
407
|
+
RETURN: boolean;
|
|
387
408
|
}
|
|
388
409
|
|
|
389
410
|
interface SET_GIZMO_VISIBILITY {
|
|
390
|
-
|
|
391
|
-
|
|
411
|
+
DESCRIPTION: "Sets the gizmo's visibility.";
|
|
412
|
+
PAYLOAD: boolean;
|
|
413
|
+
RETURN: boolean;
|
|
392
414
|
}
|
|
393
415
|
|
|
394
416
|
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
395
|
-
'
|
|
396
|
-
|
|
417
|
+
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
418
|
+
PAYLOAD: object;
|
|
419
|
+
RETURN: {
|
|
397
420
|
position: Vector3Like;
|
|
398
421
|
target: Vector3Like;
|
|
399
422
|
};
|
|
@@ -568,7 +591,7 @@ declare class DIVEPrimitive extends DIVENode {
|
|
|
568
591
|
type DIVESceneObject = DIVEModel | DIVEGroup | DIVEPrimitive | DIVEAmbientLight | DIVEPointLight | DIVESceneLight;
|
|
569
592
|
|
|
570
593
|
type DIVESceneFileType = {
|
|
571
|
-
|
|
594
|
+
glb: GLTF$1;
|
|
572
595
|
};
|
|
573
596
|
|
|
574
597
|
/**
|
|
@@ -796,32 +819,35 @@ declare class DIVEToolbox {
|
|
|
796
819
|
}
|
|
797
820
|
|
|
798
821
|
interface USE_TOOL {
|
|
799
|
-
'
|
|
822
|
+
DESCRIPTION: 'Activates a specific tool from the toolbox.';
|
|
823
|
+
PAYLOAD: {
|
|
800
824
|
tool: ToolType;
|
|
801
825
|
};
|
|
802
|
-
|
|
826
|
+
RETURN: boolean;
|
|
803
827
|
}
|
|
804
828
|
|
|
805
829
|
interface SET_PARENT {
|
|
806
|
-
'
|
|
830
|
+
DESCRIPTION: 'Attach an object to another object.';
|
|
831
|
+
PAYLOAD: {
|
|
807
832
|
object: Partial<COMEntity> & {
|
|
808
833
|
id: string;
|
|
809
834
|
};
|
|
810
|
-
parent: Partial<COMEntity> & {
|
|
835
|
+
parent: (Partial<COMEntity> & {
|
|
811
836
|
id: string;
|
|
812
|
-
} | null;
|
|
837
|
+
}) | null;
|
|
813
838
|
};
|
|
814
|
-
|
|
839
|
+
RETURN: boolean;
|
|
815
840
|
}
|
|
816
841
|
|
|
817
842
|
interface EXPORT_SCENE {
|
|
818
|
-
'
|
|
843
|
+
DESCRIPTION: 'Exports the current scene to a blob and returns the URL.';
|
|
844
|
+
PAYLOAD: {
|
|
819
845
|
type: keyof DIVESceneFileType;
|
|
820
846
|
};
|
|
821
|
-
|
|
847
|
+
RETURN: Promise<string | null>;
|
|
822
848
|
}
|
|
823
849
|
|
|
824
|
-
|
|
850
|
+
interface Actions {
|
|
825
851
|
GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
|
|
826
852
|
GET_ALL_OBJECTS: GET_ALL_OBJECTS;
|
|
827
853
|
GET_OBJECTS: GET_OBJECTS;
|
|
@@ -848,7 +874,7 @@ type Actions = {
|
|
|
848
874
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
849
875
|
SET_PARENT: SET_PARENT;
|
|
850
876
|
EXPORT_SCENE: EXPORT_SCENE;
|
|
851
|
-
}
|
|
877
|
+
}
|
|
852
878
|
|
|
853
879
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
854
880
|
type Unsubscribe = () => boolean;
|