@galacean/engine-design 1.1.0-beta.4 → 1.1.0-beta.43
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/package.json +2 -2
- package/types/IProgress.d.ts +15 -0
- package/types/input/IInputOptions.d.ts +21 -0
- package/types/input/index.d.ts +1 -0
- package/types/physics/joints/IHingeJoint.d.ts +1 -1
- package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +6 -0
- package/types/xr/IXRDevice.d.ts +31 -0
- package/types/xr/IXRFrame.d.ts +13 -0
- package/types/xr/IXRInputEvent.d.ts +17 -0
- package/types/xr/IXRPose.d.ts +14 -0
- package/types/xr/IXRSession.d.ts +91 -0
- package/types/xr/feature/IXRFeature.d.ts +39 -0
- package/types/xr/feature/IXRFeatureConfig.d.ts +7 -0
- package/types/xr/feature/IXRFeatureDescriptor.d.ts +7 -0
- package/types/xr/feature/IXRFeatureManager.d.ts +52 -0
- package/types/xr/feature/IXRHitResult.d.ts +17 -0
- package/types/xr/feature/IXRMovementTracking.d.ts +5 -0
- package/types/xr/feature/IXRMovementTrackingConfig.d.ts +8 -0
- package/types/xr/feature/IXRMovementTrackingDescriptor.d.ts +8 -0
- package/types/xr/feature/IXRPlatformFeature.d.ts +6 -0
- package/types/xr/feature/trackable/IXRReferenceImage.d.ts +13 -0
- package/types/xr/feature/trackable/IXRRequestTracking.d.ts +10 -0
- package/types/xr/feature/trackable/IXRRequestTrackingAnchor.d.ts +7 -0
- package/types/xr/feature/trackable/IXRRequestTrackingImage.d.ts +7 -0
- package/types/xr/feature/trackable/IXRTrackable.d.ts +14 -0
- package/types/xr/feature/trackable/IXRTrackableFeature.d.ts +40 -0
- package/types/xr/feature/trackable/IXRTrackablePlatformFeature.d.ts +35 -0
- package/types/xr/feature/trackable/IXRTracked.d.ts +12 -0
- package/types/xr/feature/trackable/IXRTrackedAnchor.d.ts +5 -0
- package/types/xr/feature/trackable/IXRTrackedImage.d.ts +6 -0
- package/types/xr/feature/trackable/IXRTrackedPlane.d.ts +6 -0
- package/types/xr/feature/trackable/anchor/IXRAnchorTracking.d.ts +5 -0
- package/types/xr/feature/trackable/anchor/IXRAnchorTrackingConfig.d.ts +9 -0
- package/types/xr/feature/trackable/anchor/IXRAnchorTrackingDescriptor.d.ts +9 -0
- package/types/xr/feature/trackable/anchor/IXRRequestAnchor.d.ts +7 -0
- package/types/xr/feature/trackable/anchor/IXRRequestAnchorTracking.d.ts +8 -0
- package/types/xr/feature/trackable/image/IXRImageTracking.d.ts +5 -0
- package/types/xr/feature/trackable/image/IXRImageTrackingConfig.d.ts +8 -0
- package/types/xr/feature/trackable/image/IXRImageTrackingDescriptor.d.ts +5 -0
- package/types/xr/feature/trackable/image/IXRReferenceImage.d.ts +8 -0
- package/types/xr/feature/trackable/image/IXRRequestImage.d.ts +6 -0
- package/types/xr/feature/trackable/image/IXRRequestImageTracking.d.ts +6 -0
- package/types/xr/feature/trackable/image/IXRTrackedImage.d.ts +8 -0
- package/types/xr/feature/trackable/plane/IXRPlaneTracking.d.ts +7 -0
- package/types/xr/feature/trackable/plane/IXRPlaneTrackingConfig.d.ts +8 -0
- package/types/xr/feature/trackable/plane/IXRPlaneTrackingDescriptor.d.ts +8 -0
- package/types/xr/feature/trackable/plane/IXRRequestPlane.d.ts +5 -0
- package/types/xr/feature/trackable/plane/IXRRequestPlaneTracking.d.ts +5 -0
- package/types/xr/feature/trackable/plane/IXRTrackedPlane.d.ts +16 -0
- package/types/xr/feature/trackable/request/IXRRequestTracking.d.ts +5 -0
- package/types/xr/feature/trackable/request/IXRRequestTrackingAnchor.d.ts +6 -0
- package/types/xr/feature/trackable/request/IXRRequestTrackingImage.d.ts +6 -0
- package/types/xr/feature/trackable/request/IXRRequestTrackingPlane.d.ts +5 -0
- package/types/xr/feature/trackable/tracked/IXRTracked.d.ts +14 -0
- package/types/xr/feature/trackable/tracked/IXRTrackedAnchor.d.ts +3 -0
- package/types/xr/feature/trackable/tracked/IXRTrackedImage.d.ts +4 -0
- package/types/xr/feature/trackable/tracked/IXRTrackedPlane.d.ts +6 -0
- package/types/xr/index.d.ts +18 -0
- package/types/xr/input/IXRCamera.d.ts +11 -0
- package/types/xr/input/IXRController.d.ts +8 -0
- package/types/xr/input/IXRInput.d.ts +6 -0
- package/types/xr/input/IXRInputManager.d.ts +10 -0
- package/types/xr/input/IXRPose.d.ts +14 -0
- package/types/xr/session/IXRSessionDescriptor.d.ts +10 -0
- package/types/xr/session/IXRSessionManager.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-design",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.43",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"types": "types/index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@galacean/engine-math": "1.1.0-beta.
|
|
17
|
+
"@galacean/engine-math": "1.1.0-beta.43"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"b:types": "tsc"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the input.
|
|
3
|
+
*/
|
|
4
|
+
export interface IInputOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The target element of the pointer event, defaults is the current canvas.
|
|
7
|
+
* @remarks
|
|
8
|
+
* @remarks: When setting the pointer target you need to specify:
|
|
9
|
+
* - Do not set window as target because window cannot listen to pointer leave event.
|
|
10
|
+
* - On mobile, pointer move may trigger the default slide event, thereby removing the point from the screen, so in most cases you need to set HtmlElement.style.touchAction = "none".
|
|
11
|
+
*/
|
|
12
|
+
pointerTarget?: Exclude<EventTarget, Window & typeof globalThis>;
|
|
13
|
+
/**
|
|
14
|
+
* The target element of the keyboard event, defaults is the window.
|
|
15
|
+
* @remarks
|
|
16
|
+
* If the type of listening target is `HtmlElement`, you need to set tabIndex to make the element focus.
|
|
17
|
+
*/
|
|
18
|
+
keyboardTarget?: EventTarget;
|
|
19
|
+
/** The target element of the wheel event, defaults is the current canvas. */
|
|
20
|
+
wheelTarget?: EventTarget;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IInputOptions } from "./IInputOptions";
|
|
@@ -19,7 +19,7 @@ export interface IHingeJoint extends IJoint {
|
|
|
19
19
|
/**
|
|
20
20
|
* The angular velocity of the joint in degrees per second.
|
|
21
21
|
*/
|
|
22
|
-
getVelocity(): Readonly<
|
|
22
|
+
getVelocity(): Readonly<number>;
|
|
23
23
|
/**
|
|
24
24
|
* Set a cone hard limit.
|
|
25
25
|
* @param lowerLimit The lower angle of the limit
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IHardwareRenderer } from "../renderingHardwareInterface";
|
|
2
|
+
import { IXRSession } from "./IXRSession";
|
|
3
|
+
import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
|
|
4
|
+
/**
|
|
5
|
+
* The interface of XR device.
|
|
6
|
+
*/
|
|
7
|
+
export interface IXRDevice {
|
|
8
|
+
/**
|
|
9
|
+
* Check if the specified session mode is supported.
|
|
10
|
+
* @param mode - The mode of the session.
|
|
11
|
+
*/
|
|
12
|
+
isSupportedSessionMode(mode: number): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Check if the specified feature is supported.
|
|
15
|
+
* @param mode - The type of the feature.
|
|
16
|
+
*/
|
|
17
|
+
isSupportedFeature(type: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get the platform feature instance of this device
|
|
20
|
+
* @param engine - The engine.
|
|
21
|
+
* @param type - The type of the feature.
|
|
22
|
+
*/
|
|
23
|
+
createPlatformFeature(type: number, ...args: any[]): IXRPlatformFeature;
|
|
24
|
+
/**
|
|
25
|
+
* Request a session.
|
|
26
|
+
* @param engine - The engine
|
|
27
|
+
* @param mode - The mode of the session
|
|
28
|
+
* @param platformFeatures - The requested platform features
|
|
29
|
+
*/
|
|
30
|
+
requestSession(rhi: IHardwareRenderer, mode: number, platformFeatures: IXRPlatformFeature[]): Promise<IXRSession>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IXRInput } from "./input/IXRInput";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface of XR frame.
|
|
4
|
+
* It can be understood as a snapshot of
|
|
5
|
+
* the information of each input in this frame.
|
|
6
|
+
*/
|
|
7
|
+
export interface IXRFrame {
|
|
8
|
+
/**
|
|
9
|
+
* Update xr input information.
|
|
10
|
+
* @param inputs - xr input
|
|
11
|
+
*/
|
|
12
|
+
updateInputs(inputs: IXRInput[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified XR input events.
|
|
3
|
+
*/
|
|
4
|
+
export interface IXRInputEvent {
|
|
5
|
+
/** Interaction type. */
|
|
6
|
+
targetRayMode: number;
|
|
7
|
+
/** Specific interactions. */
|
|
8
|
+
type: number;
|
|
9
|
+
/** Type of interactive input. */
|
|
10
|
+
input: number;
|
|
11
|
+
/** Touch id. (Meaningful when and only when targetRayMode is screen) */
|
|
12
|
+
id?: number;
|
|
13
|
+
/** X coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
|
|
14
|
+
x?: number;
|
|
15
|
+
/** Y coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
|
|
16
|
+
y?: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Matrix, Quaternion, Vector3 } from "@galacean/engine-math";
|
|
2
|
+
/**
|
|
3
|
+
* Data interface for describing gestures in the XR space.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRPose {
|
|
6
|
+
/** The position of the pose in XR space. */
|
|
7
|
+
position: Vector3;
|
|
8
|
+
/** The rotation of the pose in XR space. */
|
|
9
|
+
rotation: Quaternion;
|
|
10
|
+
/** The matrix of the pose in XR space. */
|
|
11
|
+
matrix?: Matrix;
|
|
12
|
+
/** The inverse matrix of the pose in XR space. */
|
|
13
|
+
inverseMatrix?: Matrix;
|
|
14
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { IXRFrame } from "./IXRFrame";
|
|
2
|
+
import { IXRInputEvent } from "./IXRInputEvent";
|
|
3
|
+
/**
|
|
4
|
+
* The base interface of XR session.
|
|
5
|
+
* Can be understood as an XR context.
|
|
6
|
+
*/
|
|
7
|
+
export interface IXRSession {
|
|
8
|
+
/**
|
|
9
|
+
* Returns the XR information of this frame.
|
|
10
|
+
*/
|
|
11
|
+
get frame(): IXRFrame;
|
|
12
|
+
/**
|
|
13
|
+
* Return the event received in this frame.
|
|
14
|
+
*/
|
|
15
|
+
get events(): IXRInputEvent[];
|
|
16
|
+
/**
|
|
17
|
+
* Returns the current frame rate.
|
|
18
|
+
*/
|
|
19
|
+
get frameRate(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the frame rate supported by the device.
|
|
22
|
+
*/
|
|
23
|
+
get supportedFrameRates(): Float32Array;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the device's default main framebuffer.
|
|
26
|
+
*/
|
|
27
|
+
get framebuffer(): WebGLFramebuffer;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the width of the device's default main framebuffer.
|
|
30
|
+
*/
|
|
31
|
+
get framebufferWidth(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the height of the device's default main framebuffer.
|
|
34
|
+
*/
|
|
35
|
+
get framebufferHeight(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Set fixed foveation for camera.
|
|
38
|
+
* @param value - The fixed foveation value
|
|
39
|
+
*/
|
|
40
|
+
setFixedFoveation(value: number): any;
|
|
41
|
+
/**
|
|
42
|
+
* Return fixed foveation of camera.
|
|
43
|
+
*/
|
|
44
|
+
getFixedFoveation(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Add event listener for XR session.
|
|
47
|
+
*/
|
|
48
|
+
addEventListener(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Remove event listener for XR session.
|
|
51
|
+
*/
|
|
52
|
+
removeEventListener(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Add exit listener for XR session.
|
|
55
|
+
* @param sessionExitCallBack - The exit listener
|
|
56
|
+
*/
|
|
57
|
+
setSessionExitCallBack(sessionExitCallBack: () => void): void;
|
|
58
|
+
/**
|
|
59
|
+
* Reset event flow.
|
|
60
|
+
*/
|
|
61
|
+
resetEvents(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Ends the xr session. Returns a promise which resolves when the
|
|
64
|
+
* session has been start.
|
|
65
|
+
*/
|
|
66
|
+
start(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Ends the xr session. Returns a promise which resolves when the
|
|
69
|
+
* session has been start.
|
|
70
|
+
*/
|
|
71
|
+
stop(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Ends the xr session. Returns a promise which resolves when the
|
|
74
|
+
* session has been shut down.
|
|
75
|
+
*/
|
|
76
|
+
end(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Schedules the specified method to be called the next time the user agent
|
|
79
|
+
* is working on rendering an animation frame for the WebXR device. Returns an
|
|
80
|
+
* integer value which can be used to identify the request for the purposes of
|
|
81
|
+
* canceling the callback using cancelAnimationFrame(). This method is comparable
|
|
82
|
+
* to the Window.requestAnimationFrame() method.
|
|
83
|
+
*/
|
|
84
|
+
requestAnimationFrame(callback: FrameRequestCallback): number;
|
|
85
|
+
/**
|
|
86
|
+
* Removes a callback from the animation frame painting callback from
|
|
87
|
+
* XRSession's set of animation frame rendering callbacks, given the
|
|
88
|
+
* identifying handle returned by a previous call to requestAnimationFrame().
|
|
89
|
+
*/
|
|
90
|
+
cancelAnimationFrame(id: number): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IXRPlatformFeature } from "./IXRPlatformFeature";
|
|
2
|
+
export interface IXRFeature {
|
|
3
|
+
/** @internal */
|
|
4
|
+
_platformFeature: IXRPlatformFeature;
|
|
5
|
+
/** Whether this feature enabled. */
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
_onEnable(): void;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
_onDisable(): void;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
_onUpdate(): void;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
_onDestroy(): void;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
_onSessionInit(): void;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
_onSessionStart(): void;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
_onSessionStop(): void;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
_onSessionExit(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
|
|
2
|
+
import { IXRFeature } from "./IXRFeature";
|
|
3
|
+
import { IXRSession } from "../IXRSession";
|
|
4
|
+
import { IXRFrame } from "../IXRFrame";
|
|
5
|
+
export interface IXRFeatureManager {
|
|
6
|
+
_platformFeature: IXRFeature;
|
|
7
|
+
/** The descriptor of the feature. */
|
|
8
|
+
descriptor: IXRFeatureDescriptor;
|
|
9
|
+
/** Whether this feature enabled. */
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether the feature is supported.
|
|
13
|
+
* @param descriptor - The descriptor of the feature
|
|
14
|
+
*/
|
|
15
|
+
isSupported(descriptor?: IXRFeatureDescriptor): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the feature.
|
|
18
|
+
*/
|
|
19
|
+
initialize(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Enable an instance of a feature.
|
|
22
|
+
*/
|
|
23
|
+
onEnable(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Disable an instance of a feature.
|
|
26
|
+
*/
|
|
27
|
+
onDisable(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Update an instance of a feature.
|
|
30
|
+
*/
|
|
31
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
32
|
+
/**
|
|
33
|
+
* Destroy an instance of a feature.
|
|
34
|
+
*/
|
|
35
|
+
onDestroy(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when the session is initialized.
|
|
38
|
+
*/
|
|
39
|
+
onSessionInit(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Called when session starts.
|
|
42
|
+
*/
|
|
43
|
+
onSessionStart(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when the session is stopped.
|
|
46
|
+
*/
|
|
47
|
+
onSessionStop(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when the session is destroyed.
|
|
50
|
+
*/
|
|
51
|
+
onSessionDestroy(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine-math";
|
|
2
|
+
/**
|
|
3
|
+
* XR hit result.
|
|
4
|
+
* It is the detection result returned by using XR HitTest feature.
|
|
5
|
+
*/
|
|
6
|
+
export interface IXRHitResult {
|
|
7
|
+
/** The position of the hit point. */
|
|
8
|
+
point: Vector3;
|
|
9
|
+
/** The normal of the hit point. */
|
|
10
|
+
normal: Vector3;
|
|
11
|
+
/** The distance from the origin of the ray to the hit point. */
|
|
12
|
+
distance: number;
|
|
13
|
+
/** The id of the hit tracked object, such as the id of IXRTrackedPlane. */
|
|
14
|
+
trackableId: number;
|
|
15
|
+
/** The type of tracked object detected, such as TrackableType.Plane */
|
|
16
|
+
trackableType: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An interface that defines a reference image.
|
|
3
|
+
*/
|
|
4
|
+
export interface IXRReferenceImage {
|
|
5
|
+
/** The name of the image. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The src of the image. */
|
|
8
|
+
src: string | HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas;
|
|
9
|
+
/** The width of the image in meters. */
|
|
10
|
+
physicalWidth: number;
|
|
11
|
+
/** The height of the image in meters. */
|
|
12
|
+
physicalHeight: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IXRTracked } from "./IXRTracked";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface for request tracking in XR.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRRequestTracking<T extends IXRTracked> {
|
|
6
|
+
/** The status of the current request tracking. */
|
|
7
|
+
state: number;
|
|
8
|
+
/** Tracked instances, make up from the tracking data returned by Session. */
|
|
9
|
+
tracked: T[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IXRPose } from "../../input/IXRPose";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface of XR trackable.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRTrackable {
|
|
6
|
+
/** Id of the trackable. */
|
|
7
|
+
id: number;
|
|
8
|
+
/** The pose of the trackable. */
|
|
9
|
+
pose: IXRPose;
|
|
10
|
+
/** The tracking state of the trackable. */
|
|
11
|
+
state: number;
|
|
12
|
+
/** The modified frame count of the trackable. */
|
|
13
|
+
frameCount: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IXRFrame } from "../../IXRFrame";
|
|
2
|
+
import { IXRSession } from "../../IXRSession";
|
|
3
|
+
import { IXRPlatformFeature } from "../IXRPlatformFeature";
|
|
4
|
+
import { IXRRequestTracking } from "./IXRRequestTracking";
|
|
5
|
+
import { IXRTracked } from "./IXRTracked";
|
|
6
|
+
export interface IXRTrackableFeature<TXRTracked extends IXRTracked, TXRRequestTracking extends IXRRequestTracking<TXRTracked>> extends IXRPlatformFeature {
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether request tracking can be modified after initialization.
|
|
9
|
+
*/
|
|
10
|
+
get canModifyRequestTrackingAfterInit(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize the feature.
|
|
13
|
+
* @param descriptor - The descriptor of the feature
|
|
14
|
+
*/
|
|
15
|
+
initialize(requestTrackings: TXRRequestTracking[]): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the tracked result.
|
|
18
|
+
* @param session - The XR session
|
|
19
|
+
* @param frame - The XR frame
|
|
20
|
+
* @param requestTrackings - The request trackings
|
|
21
|
+
*/
|
|
22
|
+
getTrackedResult(session: IXRSession, frame: IXRFrame, requestTrackings: TXRRequestTracking[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Check if the feature is available.
|
|
25
|
+
* @param session - The XR session
|
|
26
|
+
* @param frame - The XR frame
|
|
27
|
+
* @param requestTrackings - The request trackings
|
|
28
|
+
*/
|
|
29
|
+
checkAvailable(session: IXRSession, frame: IXRFrame, requestTrackings: TXRRequestTracking[]): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Called when request tracking is added.
|
|
32
|
+
* @param requestTracking - The request tracking
|
|
33
|
+
*/
|
|
34
|
+
onAddRequestTracking?(requestTracking: TXRRequestTracking): void;
|
|
35
|
+
/**
|
|
36
|
+
* Called when request tracking is removed.
|
|
37
|
+
* @param requestTracking - The request tracking
|
|
38
|
+
*/
|
|
39
|
+
onDeleteRequestTracking?(requestTracking: TXRRequestTracking): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IXRFrame } from "../../IXRFrame";
|
|
2
|
+
import { IXRSession } from "../../IXRSession";
|
|
3
|
+
import { IXRPlatformFeature } from "../IXRPlatformFeature";
|
|
4
|
+
import { IXRRequestTracking } from "./IXRRequestTracking";
|
|
5
|
+
import { IXRTracked } from "./IXRTracked";
|
|
6
|
+
export interface IXRTrackablePlatformFeature<T extends IXRTracked, K extends IXRRequestTracking<T>> extends IXRPlatformFeature {
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether request tracking can be modified after initialization.
|
|
9
|
+
*/
|
|
10
|
+
get canModifyRequestTrackingAfterInit(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Get the tracked result.
|
|
13
|
+
* @param session - The XR session
|
|
14
|
+
* @param frame - The XR frame
|
|
15
|
+
* @param requestTrackings - The request trackings
|
|
16
|
+
*/
|
|
17
|
+
getTrackedResult(session: IXRSession, frame: IXRFrame, requestTrackings: K[], generateTracked: () => T): void;
|
|
18
|
+
/**
|
|
19
|
+
* Check if the feature is available.
|
|
20
|
+
* @param session - The XR session
|
|
21
|
+
* @param frame - The XR frame
|
|
22
|
+
* @param requestTrackings - The request trackings
|
|
23
|
+
*/
|
|
24
|
+
checkAvailable(session: IXRSession, frame: IXRFrame, requestTrackings: K[]): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Called when request tracking is added.
|
|
27
|
+
* @param requestTracking - The request tracking
|
|
28
|
+
*/
|
|
29
|
+
onAddRequestTracking(requestTracking: K): void;
|
|
30
|
+
/**
|
|
31
|
+
* Called when request tracking is removed.
|
|
32
|
+
* @param requestTracking - The request tracking
|
|
33
|
+
*/
|
|
34
|
+
onDelRequestTracking(requestTracking: K): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IXRPose } from "../../IXRPose";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface of XR trackable.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRTracked {
|
|
6
|
+
/** The unique id of the trackable. */
|
|
7
|
+
id: number;
|
|
8
|
+
/** The pose of the trackable in XR space. */
|
|
9
|
+
pose: IXRPose;
|
|
10
|
+
/** The tracking state of the trackable. */
|
|
11
|
+
state: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IXRTrackableFeature } from "../IXRTrackableFeature";
|
|
2
|
+
import { IXRTracked } from "../IXRTracked";
|
|
3
|
+
import { IXRRequestAnchorTracking } from "./IXRRequestAnchorTracking";
|
|
4
|
+
export interface IXRAnchorTracking extends IXRTrackableFeature<IXRTracked, IXRRequestAnchorTracking> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IXRPose } from "../../../IXRPose";
|
|
2
|
+
import { IXRFeatureConfig } from "../../IXRFeatureConfig";
|
|
3
|
+
/**
|
|
4
|
+
* The config of XR anchor tracking.
|
|
5
|
+
*/
|
|
6
|
+
export interface IXRAnchorTrackingConfig extends IXRFeatureConfig {
|
|
7
|
+
/** Request tracking anchor. */
|
|
8
|
+
anchors: IXRPose[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor } from "../../IXRFeatureDescriptor";
|
|
2
|
+
import { IXRPose } from "../../../input/IXRPose";
|
|
3
|
+
/**
|
|
4
|
+
* The descriptor of XR anchor tracking.
|
|
5
|
+
*/
|
|
6
|
+
export interface IXRAnchorTrackingDescriptor extends IXRFeatureDescriptor {
|
|
7
|
+
/** Request tracking anchor. */
|
|
8
|
+
anchors?: IXRPose[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "@galacean/engine-math";
|
|
2
|
+
import { IXRRequestTracking } from "../IXRRequestTracking";
|
|
3
|
+
import { IXRTracked } from "../IXRTracked";
|
|
4
|
+
export interface IXRRequestAnchor extends IXRRequestTracking<IXRTracked> {
|
|
5
|
+
position: Vector3;
|
|
6
|
+
rotation: Quaternion;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IXRPose } from "../../../IXRPose";
|
|
2
|
+
import { IXRRequestTracking } from "../IXRRequestTracking";
|
|
3
|
+
import { IXRTracked } from "../IXRTracked";
|
|
4
|
+
export interface IXRRequestAnchorTracking extends IXRRequestTracking<IXRTracked> {
|
|
5
|
+
anchor: {
|
|
6
|
+
pose: IXRPose;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IXRTrackableFeature } from "../IXRTrackableFeature";
|
|
2
|
+
import { IXRRequestImageTracking } from "./IXRRequestImageTracking";
|
|
3
|
+
import { IXRTrackedImage } from "./IXRTrackedImage";
|
|
4
|
+
export interface IXRImageTracking extends IXRTrackableFeature<IXRTrackedImage, IXRRequestImageTracking> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IXRFeatureConfig } from "../../IXRFeatureConfig";
|
|
2
|
+
import { IXRReferenceImage } from "./IXRReferenceImage";
|
|
3
|
+
/**
|
|
4
|
+
* The config of XR image tracking.
|
|
5
|
+
*/
|
|
6
|
+
export interface IXRImageTrackingConfig extends IXRFeatureConfig {
|
|
7
|
+
images: IXRReferenceImage[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IXRRequestTracking } from "../IXRRequestTracking";
|
|
2
|
+
import { IXRReferenceImage } from "./IXRReferenceImage";
|
|
3
|
+
import { IXRTrackedImage } from "./IXRTrackedImage";
|
|
4
|
+
export interface IXRRequestImage extends IXRRequestTracking<IXRTrackedImage> {
|
|
5
|
+
image: IXRReferenceImage;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IXRRequestTracking } from "../IXRRequestTracking";
|
|
2
|
+
import { IXRReferenceImage } from "./IXRReferenceImage";
|
|
3
|
+
import { IXRTrackedImage } from "./IXRTrackedImage";
|
|
4
|
+
export interface IXRRequestImageTracking extends IXRRequestTracking<IXRTrackedImage> {
|
|
5
|
+
image: IXRReferenceImage;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IXRTracked } from "../IXRTracked";
|
|
2
|
+
import { IXRReferenceImage } from "./IXRReferenceImage";
|
|
3
|
+
export interface IXRTrackedImage extends IXRTracked {
|
|
4
|
+
/** The reference image which was used to detect this image in the environment. */
|
|
5
|
+
referenceImage: IXRReferenceImage;
|
|
6
|
+
/** The width of the image in meters in the physical world. */
|
|
7
|
+
measuredPhysicalWidth: number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IXRTrackableFeature } from "../IXRTrackableFeature";
|
|
2
|
+
import { IXRRequestPlaneTracking } from "./IXRRequestPlaneTracking";
|
|
3
|
+
import { IXRTrackedPlane } from "./IXRTrackedPlane";
|
|
4
|
+
export interface IXRPlaneTracking extends IXRTrackableFeature<IXRTrackedPlane, IXRRequestPlaneTracking> {
|
|
5
|
+
get detectionMode(): number;
|
|
6
|
+
set detectionMode(mode: number);
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Vector3 } from "@galacean/engine-math";
|
|
2
|
+
import { IXRTracked } from "../IXRTracked";
|
|
3
|
+
export interface IXRTrackedPlane extends IXRTracked {
|
|
4
|
+
/** Whether the detected plane is horizontal or vertical. */
|
|
5
|
+
planeMode: number;
|
|
6
|
+
/** The points that make up this plane.
|
|
7
|
+
* Note: These points are in the plane coordinate system,
|
|
8
|
+
* and their Y coordinates are all zero.
|
|
9
|
+
*/
|
|
10
|
+
polygon: Vector3[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether this frame changes the attributes of the plane.
|
|
13
|
+
* Note: Includes `polygon` but no `pose`.
|
|
14
|
+
*/
|
|
15
|
+
attributesDirty: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IXRPose } from "../../../input/IXRPose";
|
|
2
|
+
import { IXRTrackedAnchor } from "../tracked/IXRTrackedAnchor";
|
|
3
|
+
import { IXRRequestTracking } from "./IXRRequestTracking";
|
|
4
|
+
export interface IXRRequestTrackingAnchor extends IXRRequestTracking<IXRTrackedAnchor> {
|
|
5
|
+
pose: IXRPose;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IXRReferenceImage } from "../IXRReferenceImage";
|
|
2
|
+
import { IXRTrackedImage } from "../tracked/IXRTrackedImage";
|
|
3
|
+
import { IXRRequestTracking } from "./IXRRequestTracking";
|
|
4
|
+
export interface IXRRequestTrackingImage extends IXRRequestTracking<IXRTrackedImage> {
|
|
5
|
+
image: IXRReferenceImage;
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IXRPose } from "../../../input/IXRPose";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface of XR trackable.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRTracked {
|
|
6
|
+
/** Id of the trackable. */
|
|
7
|
+
id: number;
|
|
8
|
+
/** The pose of the trackable. */
|
|
9
|
+
pose: IXRPose;
|
|
10
|
+
/** The tracking state of the trackable. */
|
|
11
|
+
state: number;
|
|
12
|
+
/** The modified frame count of the trackable. */
|
|
13
|
+
frameCount: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
|
|
2
|
+
export type { IXRTrackablePlatformFeature } from "./feature/trackable/IXRTrackablePlatformFeature";
|
|
3
|
+
export type { IXRInputEvent } from "./IXRInputEvent";
|
|
4
|
+
export type { IXRPose } from "./IXRPose";
|
|
5
|
+
export type { IXRCamera } from "./input/IXRCamera";
|
|
6
|
+
export type { IXRController } from "./input/IXRController";
|
|
7
|
+
export type { IXRInput } from "./input/IXRInput";
|
|
8
|
+
export type { IXRRequestTracking } from "./feature/trackable/IXRRequestTracking";
|
|
9
|
+
export type { IXRTracked } from "./feature/trackable/IXRTracked";
|
|
10
|
+
export type { IXRRequestAnchor } from "./feature/trackable/anchor/IXRRequestAnchor";
|
|
11
|
+
export type { IXRReferenceImage } from "./feature/trackable/image/IXRReferenceImage";
|
|
12
|
+
export type { IXRRequestImage } from "./feature/trackable/image/IXRRequestImage";
|
|
13
|
+
export type { IXRTrackedImage } from "./feature/trackable/image/IXRTrackedImage";
|
|
14
|
+
export type { IXRRequestPlane } from "./feature/trackable/plane/IXRRequestPlane";
|
|
15
|
+
export type { IXRTrackedPlane } from "./feature/trackable/plane/IXRTrackedPlane";
|
|
16
|
+
export type { IXRDevice } from "./IXRDevice";
|
|
17
|
+
export type { IXRFrame } from "./IXRFrame";
|
|
18
|
+
export type { IXRSession } from "./IXRSession";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Matrix, Rect } from "@galacean/engine-math";
|
|
2
|
+
import { IXRInput } from "./IXRInput";
|
|
3
|
+
import { IXRPose } from "../IXRPose";
|
|
4
|
+
export interface IXRCamera extends IXRInput {
|
|
5
|
+
/** The pose of the camera in XR space. */
|
|
6
|
+
pose: IXRPose;
|
|
7
|
+
/** The viewport of the camera. */
|
|
8
|
+
viewport: Rect;
|
|
9
|
+
/** The projection matrix of the camera. */
|
|
10
|
+
projectionMatrix: Matrix;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IXRInput } from "./IXRInput";
|
|
2
|
+
import { IXRPose } from "../IXRPose";
|
|
3
|
+
export interface IXRController extends IXRInput {
|
|
4
|
+
/** The grip space pose of the controller in XR space. */
|
|
5
|
+
gripPose: IXRPose;
|
|
6
|
+
/** The target ray space pose of the controller in XR space. */
|
|
7
|
+
targetRayPose: IXRPose;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IXRInput } from "./IXRInput";
|
|
2
|
+
export interface IXRInputManager {
|
|
3
|
+
getInput(inputSource: number): IXRInput;
|
|
4
|
+
_onSessionInit(): void;
|
|
5
|
+
_onSessionStart(): void;
|
|
6
|
+
_onSessionStop(): void;
|
|
7
|
+
_onSessionDestroy(): void;
|
|
8
|
+
_onUpdate(): void;
|
|
9
|
+
_onDestroy(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Matrix, Quaternion, Vector3 } from "@galacean/engine-math";
|
|
2
|
+
/**
|
|
3
|
+
* Data interface for describing gestures in the XR space.
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRPose {
|
|
6
|
+
/** The position of the pose in XR space. */
|
|
7
|
+
position: Vector3;
|
|
8
|
+
/** The rotation of the pose in XR space. */
|
|
9
|
+
rotation: Quaternion;
|
|
10
|
+
/** The matrix of the pose in XR space. */
|
|
11
|
+
matrix?: Matrix;
|
|
12
|
+
/** The inverse matrix of the pose in XR space. */
|
|
13
|
+
inverseMatrix?: Matrix;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IXRFeatureConfig } from "../feature/IXRFeatureConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for XR session descriptors
|
|
4
|
+
*/
|
|
5
|
+
export interface IXRSessionDescriptor {
|
|
6
|
+
/** The type of XR session. */
|
|
7
|
+
mode: number;
|
|
8
|
+
/** Requested features. */
|
|
9
|
+
requestFeatures: IXRFeatureConfig[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor } from "../feature/IXRFeatureDescriptor";
|
|
2
|
+
export interface IXRSessionManager {
|
|
3
|
+
initialize(mode: number, requestFeatures: IXRFeatureDescriptor[]): Promise<void>;
|
|
4
|
+
start(): Promise<void>;
|
|
5
|
+
stop(): Promise<void>;
|
|
6
|
+
destroy(): Promise<void>;
|
|
7
|
+
}
|