@galacean/engine-xr 2.0.0-alpha.44 → 2.0.0-alpha.45
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/dist/browser.js +1 -8
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +1 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -8
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/XRManagerExtended.d.ts +75 -1
- package/types/feature/XRFeature.d.ts +38 -0
- package/types/feature/camera/XRCameraManager.d.ts +26 -1
- package/types/feature/trackable/XRRequestTracking.d.ts +11 -1
- package/types/input/XRCamera.d.ts +3 -1
- package/types/input/XRInput.d.ts +4 -0
- package/types/input/XRInputManager.d.ts +20 -1
- package/types/session/XRSessionManager.d.ts +38 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-xr",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.45",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"types/**/*"
|
|
28
28
|
],
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@galacean/engine-design": "2.0.0-alpha.
|
|
31
|
-
"@galacean/engine": "2.0.0-alpha.
|
|
30
|
+
"@galacean/engine-design": "2.0.0-alpha.45",
|
|
31
|
+
"@galacean/engine": "2.0.0-alpha.45"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@galacean/engine": "2.0.0-alpha.
|
|
34
|
+
"@galacean/engine": "2.0.0-alpha.45"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"b:types": "tsc"
|
|
@@ -1,9 +1,59 @@
|
|
|
1
|
-
import { Entity } from "@galacean/engine";
|
|
1
|
+
import { CameraClearFlags, CameraType, Engine, Entity, XRManager } from "@galacean/engine";
|
|
2
|
+
import { IXRDevice } from "@galacean/engine-design";
|
|
2
3
|
import { XRFeature } from "./feature/XRFeature";
|
|
4
|
+
import { XRFeatureType } from "./feature/XRFeatureType";
|
|
3
5
|
import { XRCameraManager } from "./feature/camera/XRCameraManager";
|
|
4
6
|
import { XRInputManager } from "./input/XRInputManager";
|
|
5
7
|
import { XRSessionManager } from "./session/XRSessionManager";
|
|
6
8
|
import { XRSessionMode } from "./session/XRSessionMode";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class XRManagerExtended extends XRManager {
|
|
13
|
+
/** @internal */
|
|
14
|
+
static _featureMap: Map<TFeatureConstructor<XRFeature>, XRFeatureType>;
|
|
15
|
+
inputManager: XRInputManager;
|
|
16
|
+
sessionManager: XRSessionManager;
|
|
17
|
+
cameraManager: XRCameraManager;
|
|
18
|
+
/** @internal */
|
|
19
|
+
_platformDevice: IXRDevice;
|
|
20
|
+
private _features;
|
|
21
|
+
private _origin;
|
|
22
|
+
get features(): XRFeature[];
|
|
23
|
+
get origin(): Entity;
|
|
24
|
+
set origin(value: Entity);
|
|
25
|
+
isSupportedFeature<T extends XRFeature>(feature: TFeatureConstructor<T>): boolean;
|
|
26
|
+
addFeature<T extends new (xrManager: XRManagerExtended, ...args: any[]) => XRFeature>(type: T, ...args: TFeatureConstructorArguments<T>): InstanceType<T> | null;
|
|
27
|
+
getFeature<T extends XRFeature>(type: TFeatureConstructor<T>): T | null;
|
|
28
|
+
enterXR(sessionMode: XRSessionMode, autoRun?: boolean): Promise<void>;
|
|
29
|
+
exitXR(): Promise<void>;
|
|
30
|
+
_initialize(engine: Engine, xrDevice: IXRDevice): void;
|
|
31
|
+
_update(): void;
|
|
32
|
+
_destroy(): void;
|
|
33
|
+
_getRequestAnimationFrame(): (callback: FrameRequestCallback) => number;
|
|
34
|
+
_getCancelAnimationFrame(): (id: number) => void;
|
|
35
|
+
_getCameraIgnoreClearFlags(type: CameraType): CameraClearFlags;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
_onSessionStop(): void;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
_onSessionInit(): void;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
_onSessionStart(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
_onSessionExit(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare function registerXRFeature<T extends XRFeature>(type: XRFeatureType): (feature: TFeatureConstructor<T>) => void;
|
|
7
57
|
type TFeatureConstructor<T extends XRFeature> = new (xrManager: XRManagerExtended, ...args: any[]) => T;
|
|
8
58
|
type TFeatureConstructorArguments<T extends new (xrManager: XRManagerExtended, ...args: any[]) => XRFeature> = T extends new (xrManager: XRManagerExtended, ...args: infer P) => XRFeature ? P : never;
|
|
9
59
|
declare module "@galacean/engine" {
|
|
@@ -53,6 +103,30 @@ declare module "@galacean/engine" {
|
|
|
53
103
|
* @returns A promise that resolves if the XR virtual world is destroyed, otherwise rejects
|
|
54
104
|
*/
|
|
55
105
|
exitXR(): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
_initialize(engine: Engine, xrDevice: IXRDevice): void;
|
|
110
|
+
/**
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
_getRequestAnimationFrame(): (callback: FrameRequestCallback) => number;
|
|
114
|
+
/**
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
_getCancelAnimationFrame(): (id: number) => void;
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
_getCameraIgnoreClearFlags(type: CameraType): CameraClearFlags;
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
_update(): void;
|
|
126
|
+
/**
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
_destroy(): void;
|
|
56
130
|
}
|
|
57
131
|
}
|
|
58
132
|
export {};
|
|
@@ -7,10 +7,48 @@ import { XRFeatureType } from "./XRFeatureType";
|
|
|
7
7
|
export declare abstract class XRFeature<T extends IXRPlatformFeature = IXRPlatformFeature> {
|
|
8
8
|
protected _xrManager: XRManagerExtended;
|
|
9
9
|
protected _type: XRFeatureType;
|
|
10
|
+
/** @internal */
|
|
11
|
+
_platformFeature: T;
|
|
10
12
|
protected _enabled: boolean;
|
|
11
13
|
/**
|
|
12
14
|
* Returns whether the feature is enabled.
|
|
13
15
|
*/
|
|
14
16
|
get enabled(): boolean;
|
|
15
17
|
set enabled(value: boolean);
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
constructor(_xrManager: XRManagerExtended, _type: XRFeatureType, ...args: any[]);
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
_onEnable(): void;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
_onDisable(): void;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
_onUpdate(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
_onSessionInit(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
_onSessionStart(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
_onSessionStop(): void;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
_onSessionExit(): void;
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
_onDestroy(): void;
|
|
16
54
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Camera } from "@galacean/engine";
|
|
1
|
+
import { Camera, CameraClearFlags, CameraType } from "@galacean/engine";
|
|
2
|
+
import { XRManagerExtended } from "../../XRManagerExtended";
|
|
2
3
|
import { XRTrackedInputDevice } from "../../input/XRTrackedInputDevice";
|
|
3
4
|
/**
|
|
4
5
|
* The manager of XR camera.
|
|
@@ -10,6 +11,10 @@ export declare class XRCameraManager {
|
|
|
10
11
|
*/
|
|
11
12
|
get fixedFoveation(): number;
|
|
12
13
|
set fixedFoveation(value: number);
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
constructor(_xrManager: XRManagerExtended);
|
|
13
18
|
/**
|
|
14
19
|
* Attach the camera to the specified input type(Camera, LeftCamera or RightCamera).
|
|
15
20
|
* The camera entity need to be moved to the XROrigin entity.
|
|
@@ -23,4 +28,24 @@ export declare class XRCameraManager {
|
|
|
23
28
|
* @returns The camera that was detached
|
|
24
29
|
*/
|
|
25
30
|
detachCamera(type: XRTrackedInputDevice.Camera | XRTrackedInputDevice.LeftCamera | XRTrackedInputDevice.RightCamera): Camera;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
_onSessionStart(): void;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
_onUpdate(): void;
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
_onSessionExit(): void;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
_getIgnoreClearFlags(cameraType: CameraType): CameraClearFlags;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
_onDestroy(): void;
|
|
26
51
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { XRRequestTrackingState } from "./XRRequestTrackingState";
|
|
2
|
+
import { XRTracked } from "./XRTracked";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class XRRequestTracking<T extends XRTracked> {
|
|
7
|
+
/** The status of the current request tracking. */
|
|
8
|
+
state: XRRequestTrackingState;
|
|
9
|
+
/** Tracked instances, make up from the tracking data returned by Session. */
|
|
10
|
+
tracked: T[];
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IXRCamera } from "@galacean/engine-design";
|
|
2
|
-
import { Matrix, Rect } from "@galacean/engine";
|
|
2
|
+
import { Matrix, Rect, Camera } from "@galacean/engine";
|
|
3
3
|
import { XRPose } from "../XRPose";
|
|
4
4
|
import { XRInput } from "./XRInput";
|
|
5
5
|
/**
|
|
@@ -12,4 +12,6 @@ export declare class XRCamera extends XRInput implements IXRCamera {
|
|
|
12
12
|
viewport: Rect;
|
|
13
13
|
/** The projection matrix of the camera. */
|
|
14
14
|
projectionMatrix: Matrix;
|
|
15
|
+
/** @internal */
|
|
16
|
+
_camera: Camera;
|
|
15
17
|
}
|
package/types/input/XRInput.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Signal } from "@galacean/engine";
|
|
1
|
+
import { Engine, Signal } from "@galacean/engine";
|
|
2
|
+
import { XRManagerExtended } from "../XRManagerExtended";
|
|
3
|
+
import { XRCamera } from "./XRCamera";
|
|
4
|
+
import { XRController } from "./XRController";
|
|
2
5
|
import { XRInput } from "./XRInput";
|
|
3
6
|
import { XRTrackedInputDevice } from "./XRTrackedInputDevice";
|
|
4
7
|
/**
|
|
@@ -9,16 +12,32 @@ export declare class XRInputManager {
|
|
|
9
12
|
private _engine;
|
|
10
13
|
/** Signal emitted when tracked devices change. */
|
|
11
14
|
readonly onTrackedDeviceChanged: Signal<[readonly XRInput[], readonly XRInput[]]>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
_cameras: XRCamera[];
|
|
17
|
+
/** @internal */
|
|
18
|
+
_controllers: XRController[];
|
|
12
19
|
private _added;
|
|
13
20
|
private _removed;
|
|
14
21
|
private _trackedDevices;
|
|
15
22
|
private _statusSnapshot;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
constructor(_xrManager: XRManagerExtended, _engine: Engine);
|
|
16
27
|
/**
|
|
17
28
|
* Returns the tracked device instance.
|
|
18
29
|
* @param type - The tracked input device type
|
|
19
30
|
* @returns The input instance
|
|
20
31
|
*/
|
|
21
32
|
getTrackedDevice<T extends XRInput>(type: XRTrackedInputDevice): T;
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
_onUpdate(): void;
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
_onDestroy(): void;
|
|
22
41
|
private _handleEvent;
|
|
23
42
|
private _makeUpPointerEvent;
|
|
24
43
|
/**
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Signal } from "@galacean/engine";
|
|
1
|
+
import { Engine, Signal } from "@galacean/engine";
|
|
2
|
+
import { IXRSession } from "@galacean/engine-design";
|
|
3
|
+
import { XRManagerExtended } from "../XRManagerExtended";
|
|
4
|
+
import { XRFeature } from "../feature/XRFeature";
|
|
2
5
|
import { XRSessionMode } from "./XRSessionMode";
|
|
3
6
|
import { XRSessionState } from "./XRSessionState";
|
|
4
7
|
/**
|
|
@@ -9,6 +12,8 @@ export declare class XRSessionManager {
|
|
|
9
12
|
private _engine;
|
|
10
13
|
/** Signal emitted when session state changes. */
|
|
11
14
|
readonly onStateChanged: Signal<[XRSessionState]>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
_platformSession: IXRSession;
|
|
12
17
|
private _mode;
|
|
13
18
|
private _state;
|
|
14
19
|
private _rhi;
|
|
@@ -30,6 +35,10 @@ export declare class XRSessionManager {
|
|
|
30
35
|
* Return the current frame rate as reported by the device.
|
|
31
36
|
*/
|
|
32
37
|
get frameRate(): number;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
constructor(_xrManager: XRManagerExtended, _engine: Engine);
|
|
33
42
|
/**
|
|
34
43
|
* Check if the specified mode is supported.
|
|
35
44
|
* @param mode - The mode to check
|
|
@@ -44,7 +53,35 @@ export declare class XRSessionManager {
|
|
|
44
53
|
* Stop the session.
|
|
45
54
|
*/
|
|
46
55
|
stop(): void;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
_setState(value: XRSessionState): void;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
_initialize(mode: XRSessionMode, features: XRFeature[]): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
_onUpdate(): void;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
_getRequestAnimationFrame(): (callback: FrameRequestCallback) => number;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
_getCancelAnimationFrame(): (id: number) => void;
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
_exit(): Promise<void>;
|
|
47
80
|
private _onSessionExit;
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
_onDestroy(): void;
|
|
48
85
|
/**
|
|
49
86
|
* Add a listening function for session state changes.
|
|
50
87
|
* @deprecated Use `onStateChanged.on(listener)` instead.
|