@shopware-ag/dive 1.18.4 → 1.18.5-beta.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.
Files changed (139) hide show
  1. package/build/AR-B6LRgTEL.js +1482 -0
  2. package/build/AR-B6LRgTEL.js.map +1 -0
  3. package/build/AR-YJZL1lm5.cjs +170 -0
  4. package/build/AR-YJZL1lm5.cjs.map +1 -0
  5. package/build/dive-BmDCwQRo.js +24811 -0
  6. package/build/dive-BmDCwQRo.js.map +1 -0
  7. package/build/dive-C-5_QywE.cjs +3857 -0
  8. package/build/dive-C-5_QywE.cjs.map +1 -0
  9. package/build/dive.cjs +2 -4860
  10. package/build/dive.cjs.map +1 -1
  11. package/build/dive.d.ts +6 -1186
  12. package/build/dive.js +7 -4889
  13. package/build/dive.js.map +1 -1
  14. package/build/src/animation/AnimationSystem.d.ts +16 -0
  15. package/build/src/ar/AR.d.ts +21 -0
  16. package/build/src/ar/arquicklook/ARQuickLook.d.ts +8 -0
  17. package/build/src/ar/sceneviewer/SceneViewer.d.ts +7 -0
  18. package/build/src/ar/webxr/WebXR.d.ts +21 -0
  19. package/build/src/ar/webxr/controller/WebXRController.d.ts +46 -0
  20. package/build/src/ar/webxr/crosshair/WebXRCrosshair.d.ts +7 -0
  21. package/build/src/ar/webxr/origin/WebXROrigin.d.ts +31 -0
  22. package/build/src/ar/webxr/overlay/Overlay.d.ts +8 -0
  23. package/build/src/ar/webxr/raycaster/WebXRRaycaster.d.ts +40 -0
  24. package/build/src/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +15 -0
  25. package/build/src/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +12 -0
  26. package/build/src/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +73 -0
  27. package/build/src/axiscamera/AxisCamera.d.ts +18 -0
  28. package/build/src/camera/PerspectiveCamera.d.ts +20 -0
  29. package/build/src/com/Communication.d.ts +77 -0
  30. package/build/src/com/actions/camera/computeencompassingview.d.ts +9 -0
  31. package/build/src/com/actions/camera/getcameratransform.d.ts +9 -0
  32. package/build/src/com/actions/camera/movecamera.d.ts +15 -0
  33. package/build/src/com/actions/camera/resetcamera.d.ts +7 -0
  34. package/build/src/com/actions/camera/setcameralayer.d.ts +7 -0
  35. package/build/src/com/actions/camera/setcameratransform.d.ts +9 -0
  36. package/build/src/com/actions/camera/zoomcamera.d.ts +8 -0
  37. package/build/src/com/actions/index.d.ts +58 -0
  38. package/build/src/com/actions/media/generatemedia.d.ts +15 -0
  39. package/build/src/com/actions/object/addobject.d.ts +6 -0
  40. package/build/src/com/actions/object/deleteobject.d.ts +8 -0
  41. package/build/src/com/actions/object/deselectobject.d.ts +8 -0
  42. package/build/src/com/actions/object/getallobjects.d.ts +6 -0
  43. package/build/src/com/actions/object/getobjects.d.ts +8 -0
  44. package/build/src/com/actions/object/model/dropit.d.ts +7 -0
  45. package/build/src/com/actions/object/model/modelloaded.d.ts +7 -0
  46. package/build/src/com/actions/object/model/placeonfloor.d.ts +7 -0
  47. package/build/src/com/actions/object/selectobject.d.ts +8 -0
  48. package/build/src/com/actions/object/setparent.d.ts +13 -0
  49. package/build/src/com/actions/object/updateobject.d.ts +8 -0
  50. package/build/src/com/actions/scene/exportscene.d.ts +8 -0
  51. package/build/src/com/actions/scene/getallscenedata.d.ts +6 -0
  52. package/build/src/com/actions/scene/launchar.d.ts +6 -0
  53. package/build/src/com/actions/scene/setbackground.d.ts +7 -0
  54. package/build/src/com/actions/scene/updatescene.d.ts +11 -0
  55. package/build/src/com/actions/toolbox/select/setgizmomode.d.ts +7 -0
  56. package/build/src/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +5 -0
  57. package/build/src/com/actions/toolbox/transform/setgizmovisible.d.ts +5 -0
  58. package/build/src/com/actions/toolbox/usetool.d.ts +8 -0
  59. package/build/src/com/types/COMBaseEntity.d.ts +8 -0
  60. package/build/src/com/types/COMEntity.d.ts +6 -0
  61. package/build/src/com/types/COMEntityType.d.ts +1 -0
  62. package/build/src/com/types/COMGeometry.d.ts +7 -0
  63. package/build/src/com/types/COMGeometryType.d.ts +1 -0
  64. package/build/src/com/types/COMGroup.d.ts +8 -0
  65. package/build/src/com/types/COMLight.d.ts +10 -0
  66. package/build/src/com/types/COMMaterial.d.ts +11 -0
  67. package/build/src/com/types/COMModel.d.ts +11 -0
  68. package/build/src/com/types/COMPov.d.ts +7 -0
  69. package/build/src/com/types/COMPrimitive.d.ts +11 -0
  70. package/build/src/com/types/index.d.ts +11 -0
  71. package/build/src/constant/AxisHelperColors.d.ts +6 -0
  72. package/build/src/constant/GridColors.d.ts +2 -0
  73. package/build/src/constant/VisibilityLayerMask.d.ts +5 -0
  74. package/build/src/controls/OrbitControls.d.ts +38 -0
  75. package/build/src/dive.d.ts +64 -0
  76. package/build/src/events/EventExecutor.d.ts +5 -0
  77. package/build/src/exporters/usdz/USDZExporter.d.ts +15 -0
  78. package/build/src/gizmo/Gizmo.d.ts +27 -0
  79. package/build/src/gizmo/handles/AxisHandle.d.ts +30 -0
  80. package/build/src/gizmo/handles/RadialHandle.d.ts +30 -0
  81. package/build/src/gizmo/handles/ScaleHandle.d.ts +33 -0
  82. package/build/src/gizmo/plane/GizmoPlane.d.ts +12 -0
  83. package/build/src/gizmo/rotate/RotateGizmo.d.ts +17 -0
  84. package/build/src/gizmo/scale/ScaleGizmo.d.ts +20 -0
  85. package/build/src/gizmo/translate/TranslateGizmo.d.ts +17 -0
  86. package/build/src/grid/Grid.d.ts +10 -0
  87. package/build/src/group/Group.d.ts +23 -0
  88. package/build/src/helper/applyMixins/applyMixins.d.ts +8 -0
  89. package/build/src/helper/findInterface/findInterface.d.ts +2 -0
  90. package/build/src/helper/findSceneRecursive/findSceneRecursive.d.ts +9 -0
  91. package/build/src/helper/getObjectDelta/getObjectDelta.d.ts +4 -0
  92. package/build/src/helper/isInterface/implementsInterface.d.ts +2 -0
  93. package/build/src/info/Info.d.ts +39 -0
  94. package/build/src/interface/Draggable.d.ts +7 -0
  95. package/build/src/interface/Hoverable.d.ts +7 -0
  96. package/build/src/interface/Movable.d.ts +11 -0
  97. package/build/src/interface/Rotatable.d.ts +9 -0
  98. package/build/src/interface/Scalable.d.ts +9 -0
  99. package/build/src/interface/Selectable.d.ts +10 -0
  100. package/build/src/io/IO.d.ts +10 -0
  101. package/build/src/io/gltf/GLTFIO.d.ts +12 -0
  102. package/build/src/light/AmbientLight.d.ts +17 -0
  103. package/build/src/light/PointLight.d.ts +29 -0
  104. package/build/src/light/SceneLight.d.ts +18 -0
  105. package/build/src/loadingmanager/LoadingManager.d.ts +14 -0
  106. package/build/src/math/ceil/ceilExp.d.ts +1 -0
  107. package/build/src/math/degToRad/degToRad.d.ts +1 -0
  108. package/build/src/math/floor/floorExp.d.ts +1 -0
  109. package/build/src/math/helper/shift.d.ts +1 -0
  110. package/build/src/math/index.d.ts +18 -0
  111. package/build/src/math/radToDeg/radToDeg.d.ts +1 -0
  112. package/build/src/math/round/roundExp.d.ts +1 -0
  113. package/build/src/math/signedAngleTo/signedAngleTo.d.ts +9 -0
  114. package/build/src/math/toFixed/toFixedExp.d.ts +1 -0
  115. package/build/src/math/truncate/truncateExp.d.ts +1 -0
  116. package/build/src/mediacreator/MediaCreator.d.ts +17 -0
  117. package/build/src/model/Model.d.ts +21 -0
  118. package/build/src/node/Node.d.ts +24 -0
  119. package/build/src/primitive/Primitive.d.ts +28 -0
  120. package/build/src/primitive/floor/Floor.d.ts +14 -0
  121. package/build/src/renderer/Renderer.d.ts +69 -0
  122. package/build/src/scene/Scene.d.ts +46 -0
  123. package/build/src/scene/root/Root.d.ts +42 -0
  124. package/build/src/scene/xrroot/XRRoot.d.ts +17 -0
  125. package/build/src/scene/xrroot/xrlightroot/XRLightRoot.d.ts +13 -0
  126. package/build/src/toolbox/BaseTool.d.ts +48 -0
  127. package/build/src/toolbox/Toolbox.d.ts +31 -0
  128. package/build/src/toolbox/select/SelectTool.d.ts +26 -0
  129. package/build/src/toolbox/transform/TransformTool.d.ts +27 -0
  130. package/build/src/types/SceneData.d.ts +19 -0
  131. package/build/src/types/SceneObjects.d.ts +7 -0
  132. package/build/src/types/SceneType.d.ts +4 -0
  133. package/build/src/types/index.d.ts +4 -0
  134. package/package.json +9 -8
  135. package/src/camera/PerspectiveCamera.ts +1 -1
  136. package/src/com/Communication.ts +33 -8
  137. package/src/com/__test__/Communication.test.ts +2 -1
  138. package/src/dive.ts +0 -3
  139. package/build/dive.d.cts +0 -1186
@@ -0,0 +1,16 @@
1
+ import { Tween } from '@tweenjs/tween.js';
2
+ import { DIVERenderer } from '../renderer/Renderer';
3
+ /**
4
+ * Updates all animations.
5
+ * DIVE uses Tween.js to handle animations.
6
+ *
7
+ * @module
8
+ */
9
+ export declare class DIVEAnimationSystem {
10
+ private _renderer;
11
+ private _rendererCallbackId;
12
+ constructor(renderer: DIVERenderer);
13
+ Dispose(): void;
14
+ Update(): void;
15
+ Animate<T extends object>(object: T): Tween<T>;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { DIVEScene } from '../scene/Scene';
2
+ import { DIVERenderer } from '../renderer/Renderer';
3
+ import { default as DIVEOrbitControls } from '../controls/OrbitControls';
4
+ export type DIVEAROptions = {
5
+ arPlacement: 'horizontal' | 'vertical';
6
+ arScale: 'auto' | 'fixed';
7
+ /**
8
+ * experimental, currently deactivated
9
+ */
10
+ useWebXR: false;
11
+ };
12
+ export declare class DIVEAR {
13
+ private _renderer;
14
+ private _scene;
15
+ private _controller;
16
+ constructor(renderer: DIVERenderer, scene: DIVEScene, controller: DIVEOrbitControls);
17
+ Launch(options?: DIVEAROptions): Promise<void>;
18
+ private tryARQuickLook;
19
+ private tryWebXR;
20
+ private trySceneViewer;
21
+ }
@@ -0,0 +1,8 @@
1
+ import { DIVEScene } from '../../scene/Scene';
2
+ import { DIVEAROptions } from '../AR';
3
+ export declare class DIVEARQuickLook {
4
+ private static _usdzExporter;
5
+ static Launch(scene: DIVEScene, options?: DIVEAROptions): Promise<void>;
6
+ private static extractModels;
7
+ private static launchARFromNode;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { DIVEScene } from '../../scene/Scene';
2
+ import { DIVEAROptions } from '../AR';
3
+ export declare class DIVESceneViewer {
4
+ static Launch(scene: DIVEScene, options?: DIVEAROptions): void;
5
+ private static launchSceneViewer;
6
+ private static findSceneViewerSrc;
7
+ }
@@ -0,0 +1,21 @@
1
+ import { default as DIVEOrbitControls } from '../../controls/OrbitControls';
2
+ import { DIVERenderer } from '../../renderer/Renderer';
3
+ import { DIVEScene } from '../../scene/Scene';
4
+ export declare class DIVEWebXR {
5
+ private static _renderer;
6
+ private static _scene;
7
+ private static _controller;
8
+ private static _cameraPosition;
9
+ private static _cameraTarget;
10
+ private static _renderCallbackId;
11
+ private static _session;
12
+ private static _referenceSpaceType;
13
+ private static _overlay;
14
+ private static _options;
15
+ private static _xrController;
16
+ static Launch(renderer: DIVERenderer, scene: DIVEScene, controller: DIVEOrbitControls): Promise<void>;
17
+ static Update(_time: DOMHighResTimeStamp, frame: XRFrame): void;
18
+ static End(): void;
19
+ private static _onSessionStarted;
20
+ private static _onSessionEnded;
21
+ }
@@ -0,0 +1,46 @@
1
+ import { Object3D } from 'three';
2
+ import { DIVERenderer } from '../../../renderer/Renderer';
3
+ import { DIVEScene } from '../../../scene/Scene';
4
+ export declare class DIVEWebXRController extends Object3D {
5
+ private _renderer;
6
+ private _scene;
7
+ private _session;
8
+ private _frameBuffer;
9
+ private _xrRaycaster;
10
+ private _origin;
11
+ private _crosshair;
12
+ private _touchscreenControls;
13
+ private _handNodeInitialPosition;
14
+ private _xrCamera;
15
+ private _placed;
16
+ private _grabbedObject;
17
+ private _arHitPosition;
18
+ private _arHitQuaternion;
19
+ private _arHitScale;
20
+ private _initialObjectPosition;
21
+ private _initialRaycastHit;
22
+ private _deltaRaycastHit;
23
+ private _touchQuaterion;
24
+ private _touchScale;
25
+ private _scaleThreshold;
26
+ constructor(session: XRSession, renderer: DIVERenderer, scene: DIVEScene);
27
+ Init(): Promise<this>;
28
+ Dispose(): void;
29
+ Update(frame: XRFrame): void;
30
+ private updateHandNode;
31
+ private initOrigin;
32
+ private placeObjects;
33
+ private updateObject;
34
+ private onTouchStart;
35
+ private onTouchMove;
36
+ private onTouchEnd;
37
+ private _startTouchQuaternion;
38
+ private onRotateStart;
39
+ private onRotateMove;
40
+ private _startTouchScale;
41
+ private onPinchStart;
42
+ private onPinchMove;
43
+ private prepareScene;
44
+ private restoreScene;
45
+ private initRaycaster;
46
+ }
@@ -0,0 +1,7 @@
1
+ import { Mesh, Object3D } from 'three';
2
+ export declare class DIVEWebXRCrosshair extends Object3D {
3
+ set mesh(mesh: Mesh | undefined);
4
+ constructor(mesh?: Mesh);
5
+ UseDefaultMesh(): void;
6
+ UpdateFromPose(pose: XRPose): void;
7
+ }
@@ -0,0 +1,31 @@
1
+ import { Matrix4, Quaternion, Vector3 } from 'three';
2
+ import { DIVERenderer } from '../../../renderer/Renderer';
3
+ export declare class DIVEWebXROrigin {
4
+ private _renderer;
5
+ private _session;
6
+ private _requesting;
7
+ private _initialized;
8
+ private _referenceSpaceBuffer;
9
+ private _hitTestSource;
10
+ private _entityTypes;
11
+ private _hitTestResultBuffer;
12
+ private _raycastHitCounter;
13
+ private _originSet;
14
+ private _originSetResolve;
15
+ get originSet(): Promise<void>;
16
+ private _matrix;
17
+ get matrix(): Matrix4;
18
+ private set matrix(value);
19
+ private _position;
20
+ get position(): Vector3;
21
+ private _quaternion;
22
+ get quaternion(): Quaternion;
23
+ private _scale;
24
+ get scale(): Vector3;
25
+ constructor(session: XRSession, renderer: DIVERenderer, entityTypes?: XRHitTestTrackableType[]);
26
+ Init(): Promise<this>;
27
+ Dispose(): void;
28
+ Update(frame: XRFrame): void;
29
+ private onHitFound;
30
+ private onHitLost;
31
+ }
@@ -0,0 +1,8 @@
1
+ export declare class Overlay {
2
+ private _element;
3
+ get Element(): HTMLDivElement;
4
+ private _closeButton;
5
+ get CloseButton(): SVGSVGElement;
6
+ constructor();
7
+ private createCloseButton;
8
+ }
@@ -0,0 +1,40 @@
1
+ import { Matrix4, Mesh, Vector3 } from 'three';
2
+ import { DIVERenderer } from '../../../renderer/Renderer';
3
+ import { DIVEScene } from '../../../scene/Scene';
4
+ import { DIVEEventExecutor } from '../../../events/EventExecutor';
5
+ /**
6
+ * object is undefined when AR world is hit.
7
+ */
8
+ export type DIVEHitResult = {
9
+ point: Vector3;
10
+ matrix: Matrix4;
11
+ object?: Mesh;
12
+ };
13
+ export type DIVEWebXRRaycasterEvents = {
14
+ AR_HIT_FOUND: {
15
+ hit: DIVEHitResult;
16
+ };
17
+ AR_HIT_LOST: undefined;
18
+ SCENE_HIT_FOUND: {
19
+ hit: DIVEHitResult;
20
+ };
21
+ SCENE_HIT_LOST: undefined;
22
+ };
23
+ export declare class DIVEWebXRRaycaster extends DIVEEventExecutor<DIVEWebXRRaycasterEvents> {
24
+ private _session;
25
+ private _initialized;
26
+ private _threeRaycaster;
27
+ private _arRaycaster;
28
+ private _arHitResultBuffer;
29
+ private _sceneHitResultBuffer;
30
+ private _hasHit;
31
+ constructor(session: XRSession, renderer: DIVERenderer, scene: DIVEScene);
32
+ Dispose(): void;
33
+ Init(): Promise<this>;
34
+ GetARIntersections(frame: XRFrame): DIVEHitResult[];
35
+ GetSceneIntersections(): DIVEHitResult[];
36
+ private onARHitFound;
37
+ private onARHitLost;
38
+ private onSceneHitFound;
39
+ private onSceneHitLost;
40
+ }
@@ -0,0 +1,15 @@
1
+ import { DIVERenderer } from '../../../../renderer/Renderer';
2
+ import { DIVEHitResult } from '../WebXRRaycaster';
3
+ export declare class DIVEWebXRRaycasterAR {
4
+ private _session;
5
+ private _renderer;
6
+ private _transientHitTestSource;
7
+ private _referenceSpaceBuffer;
8
+ private _requesting;
9
+ private _initialized;
10
+ private _hitMatrixBuffer;
11
+ constructor(session: XRSession, renderer: DIVERenderer);
12
+ Dispose(): void;
13
+ Init(): Promise<this>;
14
+ GetIntersections(frame: XRFrame): DIVEHitResult[];
15
+ }
@@ -0,0 +1,12 @@
1
+ import { DIVERenderer } from '../../../../renderer/Renderer';
2
+ import { DIVEScene } from '../../../../scene/Scene';
3
+ import { DIVEHitResult } from '../WebXRRaycaster';
4
+ export declare class DIVEWebXRRaycasterTHREE {
5
+ private _renderer;
6
+ private _scene;
7
+ private _controller;
8
+ private _raycaster;
9
+ constructor(renderer: DIVERenderer, scene: DIVEScene);
10
+ Init(): Promise<this>;
11
+ GetIntersections(): DIVEHitResult[];
12
+ }
@@ -0,0 +1,73 @@
1
+ import { Vector2 } from 'three';
2
+ import { DIVEEventExecutor } from '../../../events/EventExecutor';
3
+ export type DIVETouchscreenEvents = {
4
+ TOUCH_START: {
5
+ touches: {
6
+ current: Vector2;
7
+ }[];
8
+ touchCount: number;
9
+ };
10
+ TOUCH_MOVE: {
11
+ touches: {
12
+ current: Vector2;
13
+ delta: Vector2;
14
+ }[];
15
+ touchCount: number;
16
+ };
17
+ TOUCH_END: {
18
+ touches: {
19
+ current: Vector2;
20
+ }[];
21
+ touchCount: number;
22
+ };
23
+ ROTATE_START: {
24
+ current: number;
25
+ };
26
+ ROTATE_MOVE: {
27
+ current: number;
28
+ delta: number;
29
+ };
30
+ ROTATE_END: {
31
+ current: number;
32
+ };
33
+ PINCH_START: {
34
+ current: number;
35
+ };
36
+ PINCH_MOVE: {
37
+ current: number;
38
+ delta: number;
39
+ };
40
+ PINCH_END: {
41
+ current: number;
42
+ };
43
+ };
44
+ export declare class DIVEWebXRTouchscreenControls extends DIVEEventExecutor<DIVETouchscreenEvents> {
45
+ private _session;
46
+ private _touchCount;
47
+ private _touches;
48
+ private _handleRotateStarted;
49
+ private _handleRotateMoved;
50
+ private _handleRotateEnded;
51
+ private _startAngle;
52
+ private _lastAngle;
53
+ private _angleDelta;
54
+ private _handlePinchStarted;
55
+ private _handlePinchMoved;
56
+ private _handlePinchEnded;
57
+ private _scaleDistanceStart;
58
+ private _currentDistance;
59
+ private _deltaDistance;
60
+ constructor(session: XRSession);
61
+ Dispose(): void;
62
+ private onTouchStart;
63
+ private onTouchMove;
64
+ private onTouchEnd;
65
+ private onSessionSelectStart;
66
+ private onSessionSelectEnd;
67
+ private handleRotateStart;
68
+ private handleRotateMoved;
69
+ private handleRotateEnded;
70
+ private handlePinchStart;
71
+ private handlePinchMoved;
72
+ private handlePinchEnded;
73
+ }
@@ -0,0 +1,18 @@
1
+ import { Matrix4, OrthographicCamera } from 'three';
2
+ import { DIVERenderer } from '../renderer/Renderer.ts';
3
+ import { DIVEScene } from '../scene/Scene.ts';
4
+ import { default as DIVEOrbitControls } from '../controls/OrbitControls.ts';
5
+ /**
6
+ * Shows the scene axes in the bottom left corner of the screen.
7
+ *
8
+ * @module
9
+ */
10
+ export default class DIVEAxisCamera extends OrthographicCamera {
11
+ private axesHelper;
12
+ private _renderer;
13
+ private _scene;
14
+ private _renderCallbackId;
15
+ constructor(renderer: DIVERenderer, scene: DIVEScene, controls: DIVEOrbitControls);
16
+ Dispose(): void;
17
+ SetFromCameraMatrix(matrix: Matrix4): void;
18
+ }
@@ -0,0 +1,20 @@
1
+ import { PerspectiveCamera } from 'three';
2
+ export type DIVEPerspectiveCameraSettings = {
3
+ fov: number;
4
+ near: number;
5
+ far: number;
6
+ };
7
+ export declare const DIVEPerspectiveCameraDefaultSettings: DIVEPerspectiveCameraSettings;
8
+ /**
9
+ * A Perspective camera. Can change the layer mask to show different objects.
10
+ *
11
+ * @module
12
+ */
13
+ export default class DIVEPerspectiveCamera extends PerspectiveCamera {
14
+ static readonly EDITOR_VIEW_LAYER_MASK: number;
15
+ static readonly LIVE_VIEW_LAYER_MASK = 16;
16
+ onSetCameraLayer: (mask: number) => void;
17
+ constructor(settings?: Partial<DIVEPerspectiveCameraSettings>);
18
+ OnResize(width: number, height: number): void;
19
+ SetCameraLayer(layer: 'LIVE' | 'EDITOR'): void;
20
+ }
@@ -0,0 +1,77 @@
1
+ import { Actions } from './actions/index.ts';
2
+ import { DIVEScene } from '../scene/Scene.ts';
3
+ import { default as DIVEToolbox } from '../toolbox/Toolbox.ts';
4
+ import { default as DIVEOrbitControls } from '../controls/OrbitControls.ts';
5
+ import { DIVERenderer } from '../renderer/Renderer.ts';
6
+ type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
7
+ type Unsubscribe = () => boolean;
8
+ /**
9
+ * Main class for communicating with DIVE.
10
+ *
11
+ * You can subscribe to actions and perform them from outside and inside DIVE.
12
+ *
13
+ * ```ts
14
+ * import { DIVE } from "@shopware-ag/dive";
15
+ *
16
+ * const dive = new DIVE();
17
+ *
18
+ * dive.Communication.Subscribe('GET_ALL_SCENE_DATA', () => {
19
+ * // do something
20
+ * }));
21
+ *
22
+ * dive.Communication.PerformAction('GET_ALL_SCENE_DATA', {});
23
+ * ```
24
+ *
25
+ * @module
26
+ */
27
+ export declare class DIVECommunication {
28
+ private static __instances;
29
+ static get(id: string): DIVECommunication | undefined;
30
+ private _id;
31
+ get id(): string;
32
+ private renderer;
33
+ private scene;
34
+ private controller;
35
+ private toolbox;
36
+ private _mediaGenerator;
37
+ private get mediaGenerator();
38
+ private _io;
39
+ private get io();
40
+ private _ar;
41
+ private get ar();
42
+ private registered;
43
+ private listeners;
44
+ constructor(renderer: DIVERenderer, scene: DIVEScene, controls: DIVEOrbitControls, toolbox: DIVEToolbox);
45
+ DestroyInstance(): boolean;
46
+ PerformAction<Action extends keyof Actions>(action: Action, payload: Actions[Action]['PAYLOAD']): Actions[Action]['RETURN'];
47
+ Subscribe<Action extends keyof Actions>(type: Action, listener: EventListener<Action>): Unsubscribe;
48
+ private dispatch;
49
+ private getAllSceneData;
50
+ private getAllObjects;
51
+ private getObjects;
52
+ private addObject;
53
+ private updateObject;
54
+ private deleteObject;
55
+ private selectObject;
56
+ private deselectObject;
57
+ private setBackground;
58
+ private dropIt;
59
+ private placeOnFloor;
60
+ private setCameraTransform;
61
+ private getCameraTransform;
62
+ private moveCamera;
63
+ private setCameraLayer;
64
+ private resetCamera;
65
+ private computeEncompassingView;
66
+ private zoomCamera;
67
+ private setGizmoMode;
68
+ private setGizmoVisibility;
69
+ private setGizmoScaleLinked;
70
+ private useTool;
71
+ private modelLoaded;
72
+ private updateScene;
73
+ private generateMedia;
74
+ private setParent;
75
+ private exportScene;
76
+ }
77
+ export type { Actions } from './actions/index.ts';
@@ -0,0 +1,9 @@
1
+ import { Vector3Like } from 'three';
2
+ export default interface COMPUTE_ENCOMPASSING_VIEW {
3
+ DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
4
+ PAYLOAD: object;
5
+ RETURN: {
6
+ position: Vector3Like;
7
+ target: Vector3Like;
8
+ };
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Vector3Like } from 'three';
2
+ export default interface GET_CAMERA_TRANSFORM {
3
+ DESCRIPTION: 'Returns the current camera position and target.';
4
+ PAYLOAD: object;
5
+ RETURN: {
6
+ position: Vector3Like;
7
+ target: Vector3Like;
8
+ };
9
+ }
@@ -0,0 +1,15 @@
1
+ import { Vector3Like } from 'three';
2
+ export default interface MOVE_CAMERA {
3
+ DESCRIPTION: 'Moves the camera to a new position and target.';
4
+ PAYLOAD: {
5
+ position: Vector3Like;
6
+ target: Vector3Like;
7
+ locked: boolean;
8
+ duration: number;
9
+ } | {
10
+ id: string;
11
+ locked: boolean;
12
+ duration: number;
13
+ };
14
+ RETURN: boolean;
15
+ }
@@ -0,0 +1,7 @@
1
+ export default interface RESET_CAMERA {
2
+ DESCRIPTION: 'Reset the camera to its initial position and rotation.';
3
+ PAYLOAD: {
4
+ duration: number;
5
+ };
6
+ RETURN: boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ export default interface SET_CAMERA_LAYER {
2
+ DESCRIPTION: 'Sets the camera layer to a certain layer.';
3
+ PAYLOAD: {
4
+ layer: 'LIVE' | 'EDITOR';
5
+ };
6
+ RETURN: boolean;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { Vector3Like } from 'three';
2
+ export default interface SET_CAMERA_TRANSFORM {
3
+ DESCRIPTION: 'Sets the camera position and target.';
4
+ PAYLOAD: {
5
+ position: Vector3Like;
6
+ target: Vector3Like;
7
+ };
8
+ RETURN: boolean;
9
+ }
@@ -0,0 +1,8 @@
1
+ export default interface ZOOM_CAMERA {
2
+ DESCRIPTION: 'Zooms the camera in or out by a certain amount.';
3
+ PAYLOAD: {
4
+ direction: 'IN' | 'OUT';
5
+ by: number;
6
+ };
7
+ RETURN: boolean;
8
+ }
@@ -0,0 +1,58 @@
1
+ import { default as SET_BACKGROUND } from './scene/setbackground.ts';
2
+ import { default as RESET_CAMERA } from './camera/resetcamera.ts';
3
+ import { default as SET_CAMERA_LAYER } from './camera/setcameralayer.ts';
4
+ import { default as ZOOM_CAMERA } from './camera/zoomcamera.ts';
5
+ import { default as SET_GIZMO_MODE } from './toolbox/select/setgizmomode.ts';
6
+ import { default as SET_CAMERA_TRANSFORM } from './camera/setcameratransform.ts';
7
+ import { default as MOVE_CAMERA } from './camera/movecamera.ts';
8
+ import { default as PLACE_ON_FLOOR } from './object/model/placeonfloor.ts';
9
+ import { default as GET_ALL_OBJECTS } from './object/getallobjects.ts';
10
+ import { default as GET_OBJECTS } from './object/getobjects.ts';
11
+ import { default as ADD_OBJECT } from './object/addobject.ts';
12
+ import { default as DELETE_OBJECT } from './object/deleteobject.ts';
13
+ import { default as UPDATE_OBJECT } from './object/updateobject.ts';
14
+ import { default as MODEL_LOADED } from './object/model/modelloaded.ts';
15
+ import { default as UPDATE_SCENE } from './scene/updatescene.ts';
16
+ import { default as GENERATE_MEDIA } from './media/generatemedia.ts';
17
+ import { default as GET_ALL_SCENE_DATA } from './scene/getallscenedata.ts';
18
+ import { default as SELECT_OBJECT } from './object/selectobject.ts';
19
+ import { default as DESELECT_OBJECT } from './object/deselectobject.ts';
20
+ import { default as GET_CAMERA_TRANSFORM } from './camera/getcameratransform.ts';
21
+ import { default as DROP_IT } from './object/model/dropit.ts';
22
+ import { default as SET_GIZMO_VISIBILITY } from './toolbox/transform/setgizmovisible.js';
23
+ import { default as SET_GIZMO_SCALE_LINKED } from './toolbox/transform/setgizmoscalelinked.ts';
24
+ import { default as COMPUTE_ENCOMPASSING_VIEW } from './camera/computeencompassingview.ts';
25
+ import { default as USE_TOOL } from './toolbox/usetool.ts';
26
+ import { default as SET_PARENT } from './object/setparent.ts';
27
+ import { default as EXPORT_SCENE } from './scene/exportscene.ts';
28
+ import { default as LAUNCH_AR } from './scene/launchar.ts';
29
+ export interface Actions {
30
+ GET_ALL_SCENE_DATA: GET_ALL_SCENE_DATA;
31
+ GET_ALL_OBJECTS: GET_ALL_OBJECTS;
32
+ GET_OBJECTS: GET_OBJECTS;
33
+ ADD_OBJECT: ADD_OBJECT;
34
+ UPDATE_OBJECT: UPDATE_OBJECT;
35
+ DELETE_OBJECT: DELETE_OBJECT;
36
+ SELECT_OBJECT: SELECT_OBJECT;
37
+ DESELECT_OBJECT: DESELECT_OBJECT;
38
+ SET_BACKGROUND: SET_BACKGROUND;
39
+ DROP_IT: DROP_IT;
40
+ PLACE_ON_FLOOR: PLACE_ON_FLOOR;
41
+ SET_CAMERA_TRANSFORM: SET_CAMERA_TRANSFORM;
42
+ GET_CAMERA_TRANSFORM: GET_CAMERA_TRANSFORM;
43
+ MOVE_CAMERA: MOVE_CAMERA;
44
+ RESET_CAMERA: RESET_CAMERA;
45
+ COMPUTE_ENCOMPASSING_VIEW: COMPUTE_ENCOMPASSING_VIEW;
46
+ SET_CAMERA_LAYER: SET_CAMERA_LAYER;
47
+ ZOOM_CAMERA: ZOOM_CAMERA;
48
+ SET_GIZMO_MODE: SET_GIZMO_MODE;
49
+ SET_GIZMO_VISIBILITY: SET_GIZMO_VISIBILITY;
50
+ SET_GIZMO_SCALE_LINKED: SET_GIZMO_SCALE_LINKED;
51
+ USE_TOOL: USE_TOOL;
52
+ MODEL_LOADED: MODEL_LOADED;
53
+ UPDATE_SCENE: UPDATE_SCENE;
54
+ GENERATE_MEDIA: GENERATE_MEDIA;
55
+ SET_PARENT: SET_PARENT;
56
+ EXPORT_SCENE: EXPORT_SCENE;
57
+ LAUNCH_AR: LAUNCH_AR;
58
+ }
@@ -0,0 +1,15 @@
1
+ import { Vector3Like } from 'three';
2
+ export default interface GENERATE_MEDIA {
3
+ DESCRIPTION: 'Generates a screenshot, stores it in a Blob and writes the URL into the payload.';
4
+ PAYLOAD: ({
5
+ position: Vector3Like;
6
+ target: Vector3Like;
7
+ } | {
8
+ id: string;
9
+ }) & {
10
+ width: number;
11
+ height: number;
12
+ dataUri: string;
13
+ };
14
+ RETURN: boolean;
15
+ }
@@ -0,0 +1,6 @@
1
+ import { COMEntity } from '../../types';
2
+ export default interface ADD_OBJECT {
3
+ DESCRIPTION: 'Adds an object to the scene.';
4
+ PAYLOAD: COMEntity;
5
+ RETURN: boolean;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { COMEntity } from '../../types';
2
+ export default interface DELETE_OBJECT {
3
+ DESCRIPTION: 'Deletes an object from the scene.';
4
+ PAYLOAD: Partial<COMEntity> & {
5
+ id: string;
6
+ };
7
+ RETURN: boolean;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { COMEntity } from '../../types';
2
+ export default interface DESELECT_OBJECT {
3
+ DESCRIPTION: 'Deselects an existing object.';
4
+ PAYLOAD: Partial<COMEntity> & {
5
+ id: string;
6
+ };
7
+ RETURN: boolean;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { COMEntity } from '../../types';
2
+ export default interface GET_ALL_OBJECTS {
3
+ readonly DESCRIPTION: 'Retrieves all objects in the scene.';
4
+ PAYLOAD: Map<string, COMEntity>;
5
+ RETURN: Map<string, COMEntity>;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { COMEntity } from '../../types';
2
+ export default interface GET_OBJECTS {
3
+ DESCRIPTION: 'Returns a list of objects of given IDs.';
4
+ PAYLOAD: {
5
+ ids: string[];
6
+ };
7
+ RETURN: COMEntity[];
8
+ }
@@ -0,0 +1,7 @@
1
+ export default interface DROP_IT {
2
+ DESCRIPTION: 'Places an object on top of an underlying object or the floor.';
3
+ PAYLOAD: {
4
+ id: string;
5
+ };
6
+ RETURN: boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ export default interface MODEL_LOADED {
2
+ DESCRIPTION: 'Is triggered when a model is loaded.';
3
+ PAYLOAD: {
4
+ id: string;
5
+ };
6
+ RETURN: boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ export default interface PLACE_ON_FLOOR {
2
+ DESCRIPTION: 'Places an object on the floor.';
3
+ PAYLOAD: {
4
+ id: string;
5
+ };
6
+ RETURN: boolean;
7
+ }