@shopware-ag/dive 1.16.25 → 1.16.26-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.
- package/build/dive.cjs +1656 -203
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +50 -8
- package/build/dive.d.ts +50 -8
- package/build/dive.js +1623 -159
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/ar/AR.ts +164 -0
- package/src/ar/arquicklook/ARQuickLook.ts +42 -0
- package/src/ar/webxr/WebXR.ts +176 -0
- package/src/ar/webxr/controller/WebXRController.ts +334 -0
- package/src/ar/webxr/crosshair/WebXRCrosshair.ts +35 -0
- package/src/ar/webxr/origin/WebXROrigin.ts +191 -0
- package/src/ar/webxr/overlay/Overlay.ts +50 -0
- package/src/ar/webxr/raycaster/WebXRRaycaster.ts +131 -0
- package/src/ar/webxr/raycaster/ar/WebXRRaycasterAR.ts +102 -0
- package/src/ar/webxr/raycaster/three/WebXRRaycasterTHREE.ts +49 -0
- package/src/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.ts +356 -0
- package/src/axiscamera/AxisCamera.ts +4 -4
- package/src/axiscamera/__test__/AxisCamera.test.ts +4 -0
- package/src/com/Communication.ts +17 -0
- package/src/com/__test__/Communication.test.ts +1 -1
- package/src/com/actions/index.ts +2 -0
- package/src/dive.ts +55 -9
- package/src/events/EventExecutor.ts +35 -0
- package/src/helper/findSceneRecursive/findSceneRecursive.ts +2 -2
- package/src/info/Info.ts +37 -1
- package/src/info/__test__/Info.test.ts +45 -5
- package/src/mediacreator/MediaCreator.ts +4 -4
- package/src/mediacreator/__test__/MediaCreator.test.ts +7 -2
- package/src/renderer/Renderer.ts +21 -11
- package/src/renderer/__test__/Renderer.test.ts +19 -1
- package/src/scene/Scene.ts +35 -12
- package/src/scene/__test__/Scene.test.ts +39 -5
- package/src/scene/root/Root.ts +1 -0
- package/src/scene/xrroot/XRRoot.ts +56 -0
- package/src/scene/xrroot/xrlightroot/XRLightRoot.ts +80 -0
- package/src/toolbox/BaseTool.ts +9 -3
- package/src/toolbox/Toolbox.ts +1 -1
- package/src/toolbox/__test__/Toolbox.test.ts +1 -1
- package/src/toolbox/select/SelectTool.ts +1 -1
- package/src/toolbox/select/__test__/SelectTool.test.ts +1 -1
- package/src/toolbox/transform/TransformTool.ts +4 -4
- package/src/toolbox/transform/__test__/TransformTool.test.ts +2 -4
package/build/dive.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
4
|
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
5
5
|
import { TransformControls as TransformControls$1, GLTF } from 'three/examples/jsm/Addons.js';
|
|
6
|
-
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons';
|
|
7
6
|
import { GLTF as GLTF$1 } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
8
7
|
|
|
9
8
|
type DIVERendererSettings = {
|
|
@@ -15,6 +14,7 @@ type DIVERendererSettings = {
|
|
|
15
14
|
toneMapping: ToneMapping;
|
|
16
15
|
canvas?: HTMLCanvasElement;
|
|
17
16
|
};
|
|
17
|
+
type DIVERenderCallback = (time: DOMHighResTimeStamp, frame: XRFrame) => void;
|
|
18
18
|
/**
|
|
19
19
|
* A changed version of the WebGLRenderer.
|
|
20
20
|
*
|
|
@@ -40,7 +40,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
40
40
|
* @param callback Executed before rendering.
|
|
41
41
|
* @returns uuid to remove the callback.
|
|
42
42
|
*/
|
|
43
|
-
AddPreRenderCallback(callback:
|
|
43
|
+
AddPreRenderCallback(callback: DIVERenderCallback): string;
|
|
44
44
|
/**
|
|
45
45
|
* Removes a callback from the render loop before actual render call.
|
|
46
46
|
* @param uuid of callback to remove.
|
|
@@ -52,7 +52,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
52
52
|
* @param callback Executed after rendering.
|
|
53
53
|
* @returns uuid to remove the callback.
|
|
54
54
|
*/
|
|
55
|
-
AddPostRenderCallback(callback:
|
|
55
|
+
AddPostRenderCallback(callback: DIVERenderCallback): string;
|
|
56
56
|
/**
|
|
57
57
|
* Removes a callback from the render loop after actual render call.
|
|
58
58
|
* @param uuid of callback to remove.
|
|
@@ -669,6 +669,30 @@ declare class DIVEFloor extends Mesh {
|
|
|
669
669
|
SetColor(color: ColorRepresentation): void;
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
declare class DIVEXRLightRoot extends Object3D {
|
|
673
|
+
private _scene;
|
|
674
|
+
private _xrLight;
|
|
675
|
+
private _lightRoot;
|
|
676
|
+
constructor(scene: DIVEScene);
|
|
677
|
+
InitLightEstimation(renderer: DIVERenderer): void;
|
|
678
|
+
DisposeLightEstimation(): void;
|
|
679
|
+
private onEstimationStart;
|
|
680
|
+
private onEstimationEnd;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
declare class DIVEXRRoot extends Object3D {
|
|
684
|
+
private _xrLightRoot;
|
|
685
|
+
private _xrModelRoot;
|
|
686
|
+
private _xrHandNode;
|
|
687
|
+
get XRModelRoot(): DIVERoot;
|
|
688
|
+
get XRLightRoot(): DIVEXRLightRoot;
|
|
689
|
+
get XRHandNode(): Object3D;
|
|
690
|
+
private _xrShadowPlane;
|
|
691
|
+
constructor(scene: DIVEScene);
|
|
692
|
+
InitLightEstimation(renderer: DIVERenderer): void;
|
|
693
|
+
DisposeLightEstimation(): void;
|
|
694
|
+
}
|
|
695
|
+
|
|
672
696
|
/**
|
|
673
697
|
* A basic scene class.
|
|
674
698
|
*
|
|
@@ -677,13 +701,17 @@ declare class DIVEFloor extends Mesh {
|
|
|
677
701
|
* @module
|
|
678
702
|
*/
|
|
679
703
|
declare class DIVEScene extends Scene {
|
|
680
|
-
private
|
|
681
|
-
private
|
|
682
|
-
private
|
|
704
|
+
private _root;
|
|
705
|
+
private _floor;
|
|
706
|
+
private _grid;
|
|
683
707
|
get Root(): DIVERoot;
|
|
708
|
+
private _xrRoot;
|
|
709
|
+
get XRRoot(): DIVEXRRoot;
|
|
684
710
|
get Floor(): DIVEFloor;
|
|
685
711
|
get Grid(): DIVEGrid;
|
|
686
712
|
constructor();
|
|
713
|
+
InitXR(renderer: DIVERenderer): void;
|
|
714
|
+
DisposeXR(): void;
|
|
687
715
|
SetBackground(color: ColorRepresentation): void;
|
|
688
716
|
ComputeSceneBB(): Box3;
|
|
689
717
|
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
@@ -783,7 +811,7 @@ declare abstract class DIVEBaseTool {
|
|
|
783
811
|
*/
|
|
784
812
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
785
813
|
readonly isTransformTool: boolean;
|
|
786
|
-
protected _gizmo: TransformControls
|
|
814
|
+
protected _gizmo: TransformControls;
|
|
787
815
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
788
816
|
Activate(): void;
|
|
789
817
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
@@ -891,6 +919,7 @@ interface Actions {
|
|
|
891
919
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
892
920
|
SET_PARENT: SET_PARENT;
|
|
893
921
|
EXPORT_SCENE: EXPORT_SCENE;
|
|
922
|
+
LAUNCH_AR: any;
|
|
894
923
|
}
|
|
895
924
|
|
|
896
925
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
@@ -927,6 +956,8 @@ declare class DIVECommunication {
|
|
|
927
956
|
private get mediaGenerator();
|
|
928
957
|
private _io;
|
|
929
958
|
private get io();
|
|
959
|
+
private _ar;
|
|
960
|
+
private get ar();
|
|
930
961
|
private registered;
|
|
931
962
|
private listeners;
|
|
932
963
|
constructor(renderer: DIVERenderer, scene: DIVEScene, controls: DIVEOrbitControls, toolbox: DIVEToolbox);
|
|
@@ -962,8 +993,15 @@ declare class DIVECommunication {
|
|
|
962
993
|
private exportScene;
|
|
963
994
|
}
|
|
964
995
|
|
|
996
|
+
declare enum WebXRUnsupportedReason {
|
|
997
|
+
'UNKNWON_ERROR' = 0,
|
|
998
|
+
'NO_HTTPS' = 1,
|
|
999
|
+
'IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE' = 2,
|
|
1000
|
+
'AR_SESSION_NOT_ALLOWED' = 3
|
|
1001
|
+
}
|
|
965
1002
|
declare class DIVEInfo {
|
|
966
1003
|
private static _supportsWebXR;
|
|
1004
|
+
private static _webXRUnsupportedReason;
|
|
967
1005
|
/**
|
|
968
1006
|
*
|
|
969
1007
|
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
@@ -973,6 +1011,10 @@ declare class DIVEInfo {
|
|
|
973
1011
|
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
974
1012
|
*/
|
|
975
1013
|
static GetSupportsWebXR(): Promise<boolean>;
|
|
1014
|
+
/**
|
|
1015
|
+
* @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported nor not has been checked yet.
|
|
1016
|
+
*/
|
|
1017
|
+
static GetWebXRUnsupportedReason(): WebXRUnsupportedReason | null;
|
|
976
1018
|
/**
|
|
977
1019
|
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
978
1020
|
*/
|
|
@@ -1056,7 +1098,7 @@ declare const DIVEDefaultSettings: DIVESettings;
|
|
|
1056
1098
|
* @module
|
|
1057
1099
|
*/
|
|
1058
1100
|
declare class DIVE {
|
|
1059
|
-
static QuickView(uri: string): DIVE;
|
|
1101
|
+
static QuickView(uri: string, settings?: Partial<DIVESettings>): DIVE;
|
|
1060
1102
|
private _settings;
|
|
1061
1103
|
private _resizeObserverId;
|
|
1062
1104
|
private _width;
|
package/build/dive.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
|
3
3
|
import { Tween } from '@tweenjs/tween.js';
|
|
4
4
|
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
5
5
|
import { TransformControls as TransformControls$1, GLTF } from 'three/examples/jsm/Addons.js';
|
|
6
|
-
import { TransformControls as TransformControls$2 } from 'three/examples/jsm/Addons';
|
|
7
6
|
import { GLTF as GLTF$1 } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
8
7
|
|
|
9
8
|
type DIVERendererSettings = {
|
|
@@ -15,6 +14,7 @@ type DIVERendererSettings = {
|
|
|
15
14
|
toneMapping: ToneMapping;
|
|
16
15
|
canvas?: HTMLCanvasElement;
|
|
17
16
|
};
|
|
17
|
+
type DIVERenderCallback = (time: DOMHighResTimeStamp, frame: XRFrame) => void;
|
|
18
18
|
/**
|
|
19
19
|
* A changed version of the WebGLRenderer.
|
|
20
20
|
*
|
|
@@ -40,7 +40,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
40
40
|
* @param callback Executed before rendering.
|
|
41
41
|
* @returns uuid to remove the callback.
|
|
42
42
|
*/
|
|
43
|
-
AddPreRenderCallback(callback:
|
|
43
|
+
AddPreRenderCallback(callback: DIVERenderCallback): string;
|
|
44
44
|
/**
|
|
45
45
|
* Removes a callback from the render loop before actual render call.
|
|
46
46
|
* @param uuid of callback to remove.
|
|
@@ -52,7 +52,7 @@ declare class DIVERenderer extends WebGLRenderer {
|
|
|
52
52
|
* @param callback Executed after rendering.
|
|
53
53
|
* @returns uuid to remove the callback.
|
|
54
54
|
*/
|
|
55
|
-
AddPostRenderCallback(callback:
|
|
55
|
+
AddPostRenderCallback(callback: DIVERenderCallback): string;
|
|
56
56
|
/**
|
|
57
57
|
* Removes a callback from the render loop after actual render call.
|
|
58
58
|
* @param uuid of callback to remove.
|
|
@@ -669,6 +669,30 @@ declare class DIVEFloor extends Mesh {
|
|
|
669
669
|
SetColor(color: ColorRepresentation): void;
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
declare class DIVEXRLightRoot extends Object3D {
|
|
673
|
+
private _scene;
|
|
674
|
+
private _xrLight;
|
|
675
|
+
private _lightRoot;
|
|
676
|
+
constructor(scene: DIVEScene);
|
|
677
|
+
InitLightEstimation(renderer: DIVERenderer): void;
|
|
678
|
+
DisposeLightEstimation(): void;
|
|
679
|
+
private onEstimationStart;
|
|
680
|
+
private onEstimationEnd;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
declare class DIVEXRRoot extends Object3D {
|
|
684
|
+
private _xrLightRoot;
|
|
685
|
+
private _xrModelRoot;
|
|
686
|
+
private _xrHandNode;
|
|
687
|
+
get XRModelRoot(): DIVERoot;
|
|
688
|
+
get XRLightRoot(): DIVEXRLightRoot;
|
|
689
|
+
get XRHandNode(): Object3D;
|
|
690
|
+
private _xrShadowPlane;
|
|
691
|
+
constructor(scene: DIVEScene);
|
|
692
|
+
InitLightEstimation(renderer: DIVERenderer): void;
|
|
693
|
+
DisposeLightEstimation(): void;
|
|
694
|
+
}
|
|
695
|
+
|
|
672
696
|
/**
|
|
673
697
|
* A basic scene class.
|
|
674
698
|
*
|
|
@@ -677,13 +701,17 @@ declare class DIVEFloor extends Mesh {
|
|
|
677
701
|
* @module
|
|
678
702
|
*/
|
|
679
703
|
declare class DIVEScene extends Scene {
|
|
680
|
-
private
|
|
681
|
-
private
|
|
682
|
-
private
|
|
704
|
+
private _root;
|
|
705
|
+
private _floor;
|
|
706
|
+
private _grid;
|
|
683
707
|
get Root(): DIVERoot;
|
|
708
|
+
private _xrRoot;
|
|
709
|
+
get XRRoot(): DIVEXRRoot;
|
|
684
710
|
get Floor(): DIVEFloor;
|
|
685
711
|
get Grid(): DIVEGrid;
|
|
686
712
|
constructor();
|
|
713
|
+
InitXR(renderer: DIVERenderer): void;
|
|
714
|
+
DisposeXR(): void;
|
|
687
715
|
SetBackground(color: ColorRepresentation): void;
|
|
688
716
|
ComputeSceneBB(): Box3;
|
|
689
717
|
GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & {
|
|
@@ -783,7 +811,7 @@ declare abstract class DIVEBaseTool {
|
|
|
783
811
|
*/
|
|
784
812
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
785
813
|
readonly isTransformTool: boolean;
|
|
786
|
-
protected _gizmo: TransformControls
|
|
814
|
+
protected _gizmo: TransformControls;
|
|
787
815
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
788
816
|
Activate(): void;
|
|
789
817
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
@@ -891,6 +919,7 @@ interface Actions {
|
|
|
891
919
|
GENERATE_MEDIA: GENERATE_MEDIA;
|
|
892
920
|
SET_PARENT: SET_PARENT;
|
|
893
921
|
EXPORT_SCENE: EXPORT_SCENE;
|
|
922
|
+
LAUNCH_AR: any;
|
|
894
923
|
}
|
|
895
924
|
|
|
896
925
|
type EventListener<Action extends keyof Actions> = (payload: Actions[Action]['PAYLOAD']) => void;
|
|
@@ -927,6 +956,8 @@ declare class DIVECommunication {
|
|
|
927
956
|
private get mediaGenerator();
|
|
928
957
|
private _io;
|
|
929
958
|
private get io();
|
|
959
|
+
private _ar;
|
|
960
|
+
private get ar();
|
|
930
961
|
private registered;
|
|
931
962
|
private listeners;
|
|
932
963
|
constructor(renderer: DIVERenderer, scene: DIVEScene, controls: DIVEOrbitControls, toolbox: DIVEToolbox);
|
|
@@ -962,8 +993,15 @@ declare class DIVECommunication {
|
|
|
962
993
|
private exportScene;
|
|
963
994
|
}
|
|
964
995
|
|
|
996
|
+
declare enum WebXRUnsupportedReason {
|
|
997
|
+
'UNKNWON_ERROR' = 0,
|
|
998
|
+
'NO_HTTPS' = 1,
|
|
999
|
+
'IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE' = 2,
|
|
1000
|
+
'AR_SESSION_NOT_ALLOWED' = 3
|
|
1001
|
+
}
|
|
965
1002
|
declare class DIVEInfo {
|
|
966
1003
|
private static _supportsWebXR;
|
|
1004
|
+
private static _webXRUnsupportedReason;
|
|
967
1005
|
/**
|
|
968
1006
|
*
|
|
969
1007
|
* @returns The system the user is using. Possible values are "Android", "iOS", "Windows", "MacOS", "Linux" or "Unknown".
|
|
@@ -973,6 +1011,10 @@ declare class DIVEInfo {
|
|
|
973
1011
|
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
974
1012
|
*/
|
|
975
1013
|
static GetSupportsWebXR(): Promise<boolean>;
|
|
1014
|
+
/**
|
|
1015
|
+
* @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported nor not has been checked yet.
|
|
1016
|
+
*/
|
|
1017
|
+
static GetWebXRUnsupportedReason(): WebXRUnsupportedReason | null;
|
|
976
1018
|
/**
|
|
977
1019
|
* @returns A boolean indicating whether the user's device supports AR Quick Look.
|
|
978
1020
|
*/
|
|
@@ -1056,7 +1098,7 @@ declare const DIVEDefaultSettings: DIVESettings;
|
|
|
1056
1098
|
* @module
|
|
1057
1099
|
*/
|
|
1058
1100
|
declare class DIVE {
|
|
1059
|
-
static QuickView(uri: string): DIVE;
|
|
1101
|
+
static QuickView(uri: string, settings?: Partial<DIVESettings>): DIVE;
|
|
1060
1102
|
private _settings;
|
|
1061
1103
|
private _resizeObserverId;
|
|
1062
1104
|
private _width;
|