@galacean/engine-xr 1.6.8 → 1.6.10
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 +1630 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -0
- package/dist/browser.min.js.map +1 -0
- package/dist/main.js +1626 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +1598 -0
- package/dist/module.js.map +1 -0
- package/package.json +4 -4
- package/types/XRManagerExtended.d.ts +62 -0
- package/types/XRPose.d.ts +15 -0
- package/types/feature/XRFeature.d.ts +16 -0
- package/types/feature/XRFeatureType.d.ts +6 -0
- package/types/feature/camera/XRCameraManager.d.ts +26 -0
- package/types/feature/hitTest/TrackableType.d.ts +10 -0
- package/types/feature/hitTest/XRHitResult.d.ts +19 -0
- package/types/feature/hitTest/XRHitTest.d.ts +40 -0
- package/types/feature/trackable/XRRequestTracking.d.ts +1 -0
- package/types/feature/trackable/XRRequestTrackingState.d.ts +8 -0
- package/types/feature/trackable/XRTrackableFeature.d.ts +35 -0
- package/types/feature/trackable/XRTracked.d.ts +14 -0
- package/types/feature/trackable/anchor/XRAnchor.d.ts +6 -0
- package/types/feature/trackable/anchor/XRAnchorTracking.d.ts +38 -0
- package/types/feature/trackable/anchor/XRRequestAnchor.d.ts +16 -0
- package/types/feature/trackable/image/XRImageTracking.d.ts +25 -0
- package/types/feature/trackable/image/XRReferenceImage.d.ts +16 -0
- package/types/feature/trackable/image/XRRequestImage.d.ts +14 -0
- package/types/feature/trackable/image/XRTrackedImage.d.ts +12 -0
- package/types/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
- package/types/feature/trackable/plane/XRPlaneTracking.d.ts +24 -0
- package/types/feature/trackable/plane/XRRequestPlane.d.ts +13 -0
- package/types/feature/trackable/plane/XRTrackedPlane.d.ts +21 -0
- package/types/index.d.ts +32 -0
- package/types/input/XRCamera.d.ts +15 -0
- package/types/input/XRController.d.ts +38 -0
- package/types/input/XRInput.d.ts +8 -0
- package/types/input/XRInputButton.d.ts +19 -0
- package/types/input/XRInputEventType.d.ts +8 -0
- package/types/input/XRInputManager.d.ts +32 -0
- package/types/input/XRTargetRayMode.d.ts +5 -0
- package/types/input/XRTrackedInputDevice.d.ts +21 -0
- package/types/input/XRTrackingState.d.ts +11 -0
- package/types/loader/XRReferenceImageDecoder.d.ts +5 -0
- package/types/loader/XRReferenceImageLoader.d.ts +5 -0
- package/types/session/XRSessionManager.d.ts +56 -0
- package/types/session/XRSessionMode.d.ts +8 -0
- package/types/session/XRSessionState.d.ts +15 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IXRTrackablePlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackingState } from "../../input/XRTrackingState";
|
|
3
|
+
import { XRFeature } from "../XRFeature";
|
|
4
|
+
import { XRRequestTracking } from "./XRRequestTracking";
|
|
5
|
+
import { XRTracked } from "./XRTracked";
|
|
6
|
+
/**
|
|
7
|
+
* The base class of XR trackable manager.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class XRTrackableFeature<T extends XRTracked = XRTracked, K extends XRRequestTracking<T> = XRRequestTracking<T>> extends XRFeature<IXRTrackablePlatformFeature<T, K>> {
|
|
10
|
+
protected static _uuid: number;
|
|
11
|
+
protected _requestTrackings: K[];
|
|
12
|
+
protected _tracked: T[];
|
|
13
|
+
protected _added: T[];
|
|
14
|
+
protected _updated: T[];
|
|
15
|
+
protected _removed: T[];
|
|
16
|
+
protected _statusSnapshot: Record<number, XRTrackingState>;
|
|
17
|
+
private _listeners;
|
|
18
|
+
/**
|
|
19
|
+
* Add a listening function for tracked object changes.
|
|
20
|
+
* @param listener - The listening function
|
|
21
|
+
*/
|
|
22
|
+
addChangedListener(listener: (added: readonly T[], updated: readonly T[], removed: readonly T[]) => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Remove a listening function of tracked object changes.
|
|
25
|
+
* @param listener - The listening function
|
|
26
|
+
*/
|
|
27
|
+
removeChangedListener(listener: (added: readonly T[], updated: readonly T[], removed: readonly T[]) => void): void;
|
|
28
|
+
_onUpdate(): void;
|
|
29
|
+
_onSessionStop(): void;
|
|
30
|
+
_onSessionExit(): void;
|
|
31
|
+
protected _addRequestTracking(requestTracking: K): void;
|
|
32
|
+
protected _removeRequestTracking(requestTracking: K): void;
|
|
33
|
+
protected _removeAllRequestTrackings(): void;
|
|
34
|
+
protected abstract _generateTracked(): T;
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IXRTracked } from "@galacean/engine-design";
|
|
2
|
+
import { XRPose } from "../../XRPose";
|
|
3
|
+
import { XRTrackingState } from "../../input/XRTrackingState";
|
|
4
|
+
/**
|
|
5
|
+
* The base class of XR tracked object.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class XRTracked implements IXRTracked {
|
|
8
|
+
/** The unique id of the trackable. */
|
|
9
|
+
id: number;
|
|
10
|
+
/** The pose of the trackable in XR space. */
|
|
11
|
+
pose: XRPose;
|
|
12
|
+
/** The tracking state of the trackable. */
|
|
13
|
+
state: XRTrackingState;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
2
|
+
import { XRManagerExtended } from "../../../XRManagerExtended";
|
|
3
|
+
import { XRTrackableFeature } from "../XRTrackableFeature";
|
|
4
|
+
import { XRAnchor } from "./XRAnchor";
|
|
5
|
+
import { XRRequestAnchor } from "./XRRequestAnchor";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of XR anchor tracking.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRAnchorTracking extends XRTrackableFeature<XRAnchor, XRRequestAnchor> {
|
|
10
|
+
private _anchors;
|
|
11
|
+
/**
|
|
12
|
+
* The anchors to tracking.
|
|
13
|
+
*/
|
|
14
|
+
get trackingAnchors(): readonly XRAnchor[];
|
|
15
|
+
/**
|
|
16
|
+
* The tracked anchors.
|
|
17
|
+
*/
|
|
18
|
+
get trackedAnchors(): readonly XRAnchor[];
|
|
19
|
+
/**
|
|
20
|
+
* @param xrManager - The xr manager
|
|
21
|
+
*/
|
|
22
|
+
constructor(xrManager: XRManagerExtended);
|
|
23
|
+
/**
|
|
24
|
+
* Add a anchor in XR space.
|
|
25
|
+
* @param anchor - The anchor to be added
|
|
26
|
+
*/
|
|
27
|
+
addAnchor(position: Vector3, rotation: Quaternion): XRAnchor;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a anchor in XR space.
|
|
30
|
+
* @param anchor - The anchor to be removed
|
|
31
|
+
*/
|
|
32
|
+
removeAnchor(anchor: XRAnchor): void;
|
|
33
|
+
/**
|
|
34
|
+
* Remove all tracking anchors.
|
|
35
|
+
*/
|
|
36
|
+
clearAnchors(): void;
|
|
37
|
+
protected _generateTracked(): XRAnchor;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
2
|
+
import { IXRRequestAnchor } from "@galacean/engine-design";
|
|
3
|
+
import { XRRequestTracking } from "../XRRequestTracking";
|
|
4
|
+
import { XRAnchor } from "./XRAnchor";
|
|
5
|
+
/**
|
|
6
|
+
* The request anchor in XR space.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRRequestAnchor extends XRRequestTracking<XRAnchor> implements IXRRequestAnchor {
|
|
9
|
+
position: Vector3;
|
|
10
|
+
rotation: Quaternion;
|
|
11
|
+
/**
|
|
12
|
+
* @param position - Requests the position of the anchor to be added
|
|
13
|
+
* @param rotation - Requests the rotation of the anchor to be added
|
|
14
|
+
*/
|
|
15
|
+
constructor(position: Vector3, rotation: Quaternion);
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { XRManagerExtended } from "../../../XRManagerExtended";
|
|
2
|
+
import { XRTrackableFeature } from "../XRTrackableFeature";
|
|
3
|
+
import { XRReferenceImage } from "./XRReferenceImage";
|
|
4
|
+
import { XRRequestImage } from "./XRRequestImage";
|
|
5
|
+
import { XRTrackedImage } from "./XRTrackedImage";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of XR image tracking.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRImageTracking extends XRTrackableFeature<XRTrackedImage, XRRequestImage> {
|
|
10
|
+
private _trackingImages;
|
|
11
|
+
/**
|
|
12
|
+
* The image to tracking.
|
|
13
|
+
*/
|
|
14
|
+
get trackingImages(): readonly XRReferenceImage[];
|
|
15
|
+
/**
|
|
16
|
+
* The tracked images.
|
|
17
|
+
*/
|
|
18
|
+
get trackedImages(): readonly XRTrackedImage[];
|
|
19
|
+
/**
|
|
20
|
+
* @param xrManager - The xr manager
|
|
21
|
+
* @param trackingImages - The images to be tracked
|
|
22
|
+
*/
|
|
23
|
+
constructor(xrManager: XRManagerExtended, trackingImages: XRReferenceImage[]);
|
|
24
|
+
protected _generateTracked(): XRTrackedImage;
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IXRReferenceImage } from "@galacean/engine-design";
|
|
2
|
+
/**
|
|
3
|
+
* A reference image is an image to look for in the physical environment.
|
|
4
|
+
*/
|
|
5
|
+
export declare class XRReferenceImage implements IXRReferenceImage {
|
|
6
|
+
name: string;
|
|
7
|
+
imageSource: ImageBitmapSource;
|
|
8
|
+
physicalWidth: number;
|
|
9
|
+
/**
|
|
10
|
+
* Create a reference image.
|
|
11
|
+
* @param name - The name of the image to be tracked
|
|
12
|
+
* @param imageSource - The image to be tracked
|
|
13
|
+
* @param physicalWidth - The expected physical width measurement for the real-world image being tracked in meters
|
|
14
|
+
*/
|
|
15
|
+
constructor(name: string, imageSource: ImageBitmapSource, physicalWidth: number);
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IXRRequestImage } from "@galacean/engine-design";
|
|
2
|
+
import { XRRequestTracking } from "../XRRequestTracking";
|
|
3
|
+
import { XRReferenceImage } from "./XRReferenceImage";
|
|
4
|
+
import { XRTrackedImage } from "./XRTrackedImage";
|
|
5
|
+
/**
|
|
6
|
+
* The request image in XR space.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRRequestImage extends XRRequestTracking<XRTrackedImage> implements IXRRequestImage {
|
|
9
|
+
image: XRReferenceImage;
|
|
10
|
+
/**
|
|
11
|
+
* @param image - The image to be tracked
|
|
12
|
+
*/
|
|
13
|
+
constructor(image: XRReferenceImage);
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IXRTrackedImage } from "@galacean/engine-design";
|
|
2
|
+
import { XRTracked } from "../XRTracked";
|
|
3
|
+
import { XRReferenceImage } from "./XRReferenceImage";
|
|
4
|
+
/**
|
|
5
|
+
* A tracked image in XR space.
|
|
6
|
+
*/
|
|
7
|
+
export declare class XRTrackedImage extends XRTracked implements IXRTrackedImage {
|
|
8
|
+
/** The reference image which was used to detect this image in the environment. */
|
|
9
|
+
referenceImage: XRReferenceImage;
|
|
10
|
+
/** The width of the image in meters in the physical world. */
|
|
11
|
+
measuredPhysicalWidth: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { XRManagerExtended } from "../../../XRManagerExtended";
|
|
2
|
+
import { XRTrackableFeature } from "../XRTrackableFeature";
|
|
3
|
+
import { XRPlaneMode } from "./XRPlaneMode";
|
|
4
|
+
import { XRRequestPlane } from "./XRRequestPlane";
|
|
5
|
+
import { XRTrackedPlane } from "./XRTrackedPlane";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of plane tracking feature.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRPlaneTracking extends XRTrackableFeature<XRTrackedPlane, XRRequestPlane> {
|
|
10
|
+
/**
|
|
11
|
+
* The plane detection mode.
|
|
12
|
+
*/
|
|
13
|
+
get detectionMode(): XRPlaneMode;
|
|
14
|
+
/**
|
|
15
|
+
* The tracked planes.
|
|
16
|
+
*/
|
|
17
|
+
get trackedPlanes(): readonly XRTrackedPlane[];
|
|
18
|
+
/**
|
|
19
|
+
* @param xrManager - The xr manager
|
|
20
|
+
* @param detectionMode - The plane detection mode
|
|
21
|
+
*/
|
|
22
|
+
constructor(xrManager: XRManagerExtended, detectionMode?: XRPlaneMode);
|
|
23
|
+
protected _generateTracked(): XRTrackedPlane;
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IXRRequestPlane } from "@galacean/engine-design";
|
|
2
|
+
import { XRRequestTracking } from "../XRRequestTracking";
|
|
3
|
+
import { XRTrackedPlane } from "./XRTrackedPlane";
|
|
4
|
+
/**
|
|
5
|
+
* The request plane in XR space.
|
|
6
|
+
*/
|
|
7
|
+
export declare class XRRequestPlane extends XRRequestTracking<XRTrackedPlane> implements IXRRequestPlane {
|
|
8
|
+
detectionMode: number;
|
|
9
|
+
/**
|
|
10
|
+
* @param detectionMode - The plane detection mode
|
|
11
|
+
*/
|
|
12
|
+
constructor(detectionMode: number);
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine";
|
|
2
|
+
import { IXRTrackedPlane } from "@galacean/engine-design";
|
|
3
|
+
import { XRTracked } from "../XRTracked";
|
|
4
|
+
import { XRPlaneMode } from "./XRPlaneMode";
|
|
5
|
+
/**
|
|
6
|
+
* The tracked plane in XR space.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRTrackedPlane extends XRTracked implements IXRTrackedPlane {
|
|
9
|
+
/** Whether the detected plane is horizontal or vertical. */
|
|
10
|
+
planeMode: XRPlaneMode;
|
|
11
|
+
/** The points that make up this plane.
|
|
12
|
+
* Note: These points are in the plane coordinate system,
|
|
13
|
+
* and their Y coordinates are all zero.
|
|
14
|
+
*/
|
|
15
|
+
polygon: Vector3[];
|
|
16
|
+
/**
|
|
17
|
+
* Whether this frame changes the attributes of the plane.
|
|
18
|
+
* Note: Includes `polygon` but no `pose`.
|
|
19
|
+
*/
|
|
20
|
+
attributesDirty: boolean;
|
|
21
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "./XRManagerExtended";
|
|
2
|
+
export { XRPose } from "./XRPose";
|
|
3
|
+
export { XRFeature } from "./feature/XRFeature";
|
|
4
|
+
export { XRTrackableFeature } from "./feature/trackable/XRTrackableFeature";
|
|
5
|
+
export { XRTracked } from "./feature/trackable/XRTracked";
|
|
6
|
+
export { XRCameraManager } from "./feature/camera/XRCameraManager";
|
|
7
|
+
export { TrackableType } from "./feature/hitTest/TrackableType";
|
|
8
|
+
export { XRHitResult } from "./feature/hitTest/XRHitResult";
|
|
9
|
+
export { XRHitTest } from "./feature/hitTest/XRHitTest";
|
|
10
|
+
export { XRAnchor } from "./feature/trackable/anchor/XRAnchor";
|
|
11
|
+
export { XRAnchorTracking } from "./feature/trackable/anchor/XRAnchorTracking";
|
|
12
|
+
export { XRImageTracking } from "./feature/trackable/image/XRImageTracking";
|
|
13
|
+
export { XRReferenceImage } from "./feature/trackable/image/XRReferenceImage";
|
|
14
|
+
export { XRTrackedImage } from "./feature/trackable/image/XRTrackedImage";
|
|
15
|
+
export { XRPlaneMode } from "./feature/trackable/plane/XRPlaneMode";
|
|
16
|
+
export { XRPlaneTracking } from "./feature/trackable/plane/XRPlaneTracking";
|
|
17
|
+
export { XRTrackedPlane } from "./feature/trackable/plane/XRTrackedPlane";
|
|
18
|
+
export { XRCamera } from "./input/XRCamera";
|
|
19
|
+
export { XRController } from "./input/XRController";
|
|
20
|
+
export { XRInputButton } from "./input/XRInputButton";
|
|
21
|
+
export { XRInputManager } from "./input/XRInputManager";
|
|
22
|
+
export { XRTrackedInputDevice } from "./input/XRTrackedInputDevice";
|
|
23
|
+
export { XRTrackingState } from "./input/XRTrackingState";
|
|
24
|
+
export { XRSessionManager } from "./session/XRSessionManager";
|
|
25
|
+
export { XRSessionMode } from "./session/XRSessionMode";
|
|
26
|
+
export { XRSessionState } from "./session/XRSessionState";
|
|
27
|
+
export { XRFeatureType } from "./feature/XRFeatureType";
|
|
28
|
+
export { XRRequestTrackingState } from "./feature/trackable/XRRequestTrackingState";
|
|
29
|
+
export { XRInputEventType } from "./input/XRInputEventType";
|
|
30
|
+
export { XRTargetRayMode } from "./input/XRTargetRayMode";
|
|
31
|
+
export * from "./loader/XRReferenceImageDecoder";
|
|
32
|
+
export * from "./loader/XRReferenceImageLoader";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IXRCamera } from "@galacean/engine-design";
|
|
2
|
+
import { Matrix, Rect } from "@galacean/engine";
|
|
3
|
+
import { XRPose } from "../XRPose";
|
|
4
|
+
import { XRInput } from "./XRInput";
|
|
5
|
+
/**
|
|
6
|
+
* The XR camera.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRCamera extends XRInput implements IXRCamera {
|
|
9
|
+
/** The pose of the camera in XR space. */
|
|
10
|
+
pose: XRPose;
|
|
11
|
+
/** The viewport of the camera. */
|
|
12
|
+
viewport: Rect;
|
|
13
|
+
/** The projection matrix of the camera. */
|
|
14
|
+
projectionMatrix: Matrix;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IXRController } from "@galacean/engine-design";
|
|
2
|
+
import { XRPose } from "../XRPose";
|
|
3
|
+
import { XRInput } from "./XRInput";
|
|
4
|
+
import { XRInputButton } from "./XRInputButton";
|
|
5
|
+
/**
|
|
6
|
+
* The XR controller.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRController extends XRInput implements IXRController {
|
|
9
|
+
/** The grip space pose of the controller in XR space. */
|
|
10
|
+
gripPose: XRPose;
|
|
11
|
+
/** The target ray space pose of the controller in XR space. */
|
|
12
|
+
targetRayPose: XRPose;
|
|
13
|
+
/** The currently pressed buttons of this controller. */
|
|
14
|
+
pressedButtons: XRInputButton;
|
|
15
|
+
/** Record button lifted. */
|
|
16
|
+
down: XRInputButton;
|
|
17
|
+
/** Record button pressed. */
|
|
18
|
+
up: XRInputButton;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* Returns whether the button is pressed.
|
|
22
|
+
* @param button - The button to check
|
|
23
|
+
* @returns Whether the button is pressed
|
|
24
|
+
*/
|
|
25
|
+
isButtonDown(button: XRInputButton): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Returns whether the button is lifted.
|
|
28
|
+
* @param button - The button to check
|
|
29
|
+
* @returns Whether the button is lifted
|
|
30
|
+
*/
|
|
31
|
+
isButtonUp(button: XRInputButton): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns whether the button is held down.
|
|
34
|
+
* @param button - The button to check
|
|
35
|
+
* @returns Whether the button is held down
|
|
36
|
+
*/
|
|
37
|
+
isButtonHeldDown(button: XRInputButton): boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IXRInput } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackedInputDevice } from "./XRTrackedInputDevice";
|
|
3
|
+
import { XRTrackingState } from "./XRTrackingState";
|
|
4
|
+
export declare class XRInput implements IXRInput {
|
|
5
|
+
type: XRTrackedInputDevice;
|
|
6
|
+
/** The tracking state of xr input. */
|
|
7
|
+
trackingState: XRTrackingState;
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for XR input button.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRInputButton {
|
|
5
|
+
/** None */
|
|
6
|
+
None = 0,
|
|
7
|
+
/** Select */
|
|
8
|
+
Select = 1,
|
|
9
|
+
/** Select */
|
|
10
|
+
Trigger = 1,
|
|
11
|
+
/** Squeeze */
|
|
12
|
+
Squeeze = 2,
|
|
13
|
+
/** TouchPad */
|
|
14
|
+
TouchPad = 4,
|
|
15
|
+
/** A */
|
|
16
|
+
AButton = 8,
|
|
17
|
+
/** B */
|
|
18
|
+
BButton = 16
|
|
19
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { XRInput } from "./XRInput";
|
|
2
|
+
import { XRTrackedInputDevice } from "./XRTrackedInputDevice";
|
|
3
|
+
/**
|
|
4
|
+
* The manager of XR input.
|
|
5
|
+
*/
|
|
6
|
+
export declare class XRInputManager {
|
|
7
|
+
private _xrManager;
|
|
8
|
+
private _engine;
|
|
9
|
+
private _added;
|
|
10
|
+
private _removed;
|
|
11
|
+
private _trackedDevices;
|
|
12
|
+
private _statusSnapshot;
|
|
13
|
+
private _listeners;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the tracked device instance.
|
|
16
|
+
* @param type - The tracked input device type
|
|
17
|
+
* @returns The input instance
|
|
18
|
+
*/
|
|
19
|
+
getTrackedDevice<T extends XRInput>(type: XRTrackedInputDevice): T;
|
|
20
|
+
/**
|
|
21
|
+
* Add a listener for tracked device changes.
|
|
22
|
+
* @param listener - The listener to add
|
|
23
|
+
*/
|
|
24
|
+
addTrackedDeviceChangedListener(listener: (added: readonly XRInput[], removed: readonly XRInput[]) => void): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a listener of tracked device changes.
|
|
27
|
+
* @param listener - The listener to remove
|
|
28
|
+
*/
|
|
29
|
+
removeTrackedDeviceChangedListener(listener: (added: readonly XRInput[], removed: readonly XRInput[]) => void): void;
|
|
30
|
+
private _handleEvent;
|
|
31
|
+
private _makeUpPointerEvent;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerates some input devices that can be tracked.(including status, posture and other information)
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRTrackedInputDevice {
|
|
5
|
+
/** Controller */
|
|
6
|
+
Controller = 0,
|
|
7
|
+
/** Left controller */
|
|
8
|
+
LeftController = 1,
|
|
9
|
+
/** Right controller */
|
|
10
|
+
RightController = 2,
|
|
11
|
+
/** Camera */
|
|
12
|
+
Camera = 3,
|
|
13
|
+
/** Left camera */
|
|
14
|
+
LeftCamera = 4,
|
|
15
|
+
/** Right camera */
|
|
16
|
+
RightCamera = 5,
|
|
17
|
+
/** Head */
|
|
18
|
+
LeftHand = 6,
|
|
19
|
+
/** Right hand */
|
|
20
|
+
RightHand = 7
|
|
21
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AssetPromise, BufferReader, Engine } from "@galacean/engine";
|
|
2
|
+
import { XRReferenceImage } from "../feature/trackable/image/XRReferenceImage";
|
|
3
|
+
export declare class XRReferenceImageDecoder {
|
|
4
|
+
static decode(engine: Engine, bufferReader: BufferReader): AssetPromise<XRReferenceImage>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
|
|
2
|
+
import { XRReferenceImage } from "../feature/trackable/image/XRReferenceImage";
|
|
3
|
+
export declare class XRReferenceImageLoader extends Loader<XRReferenceImage> {
|
|
4
|
+
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<XRReferenceImage>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { XRSessionMode } from "./XRSessionMode";
|
|
2
|
+
import { XRSessionState } from "./XRSessionState";
|
|
3
|
+
/**
|
|
4
|
+
* XRSessionManager manages the life cycle of XR sessions.
|
|
5
|
+
*/
|
|
6
|
+
export declare class XRSessionManager {
|
|
7
|
+
private _xrManager;
|
|
8
|
+
private _engine;
|
|
9
|
+
private _mode;
|
|
10
|
+
private _state;
|
|
11
|
+
private _rhi;
|
|
12
|
+
private _raf;
|
|
13
|
+
private _caf;
|
|
14
|
+
private _listeners;
|
|
15
|
+
/**
|
|
16
|
+
* The current session mode( AR or VR ).
|
|
17
|
+
*/
|
|
18
|
+
get mode(): XRSessionMode;
|
|
19
|
+
/**
|
|
20
|
+
* Return the current session state.
|
|
21
|
+
*/
|
|
22
|
+
get state(): XRSessionState;
|
|
23
|
+
/**
|
|
24
|
+
* Return a list of supported frame rates.(only available in-session)
|
|
25
|
+
*/
|
|
26
|
+
get supportedFrameRate(): Float32Array;
|
|
27
|
+
/**
|
|
28
|
+
* Return the current frame rate as reported by the device.
|
|
29
|
+
*/
|
|
30
|
+
get frameRate(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the specified mode is supported.
|
|
33
|
+
* @param mode - The mode to check
|
|
34
|
+
* @returns A promise that resolves if the mode is supported, otherwise rejects
|
|
35
|
+
*/
|
|
36
|
+
isSupportedMode(mode: XRSessionMode): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Run the session.
|
|
39
|
+
*/
|
|
40
|
+
run(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Stop the session.
|
|
43
|
+
*/
|
|
44
|
+
stop(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Add a listening function for session state changes.
|
|
47
|
+
* @param listener - The listening function
|
|
48
|
+
*/
|
|
49
|
+
addStateChangedListener(listener: (state: XRSessionState) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Remove a listening function of session state changes.
|
|
52
|
+
* @param listener - The listening function
|
|
53
|
+
*/
|
|
54
|
+
removeStateChangedListener(listener: (state: XRSessionState) => void): void;
|
|
55
|
+
private _onSessionExit;
|
|
56
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state of an XRSession.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRSessionState {
|
|
5
|
+
/** Not initialized. */
|
|
6
|
+
None = 0,
|
|
7
|
+
/** Initializing session. */
|
|
8
|
+
Initializing = 1,
|
|
9
|
+
/** Initialized but not started. */
|
|
10
|
+
Initialized = 2,
|
|
11
|
+
/** Running. */
|
|
12
|
+
Running = 3,
|
|
13
|
+
/** Paused. */
|
|
14
|
+
Paused = 4
|
|
15
|
+
}
|