@galacean/engine-design 1.1.0-beta.20 → 1.1.0-beta.22
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/xr/IXRDevice.d.ts +4 -4
- package/types/xr/feature/IXRFeature.d.ts +49 -7
- package/types/xr/feature/IXRFeatureConfig.d.ts +7 -0
- package/types/xr/feature/IXRFeatureManager.d.ts +1 -1
- package/types/xr/feature/IXRHitResult.d.ts +3 -3
- package/types/xr/feature/IXRMovementTracking.d.ts +2 -2
- 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 +10 -9
- package/types/xr/feature/trackable/IXRRequestTracking.d.ts +0 -2
- package/types/xr/feature/trackable/IXRTrackableFeature.d.ts +28 -4
- package/types/xr/feature/trackable/IXRTracked.d.ts +0 -2
- 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/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 +9 -0
- package/types/xr/feature/trackable/image/IXRRequestImageTracking.d.ts +2 -1
- 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/IXRRequestPlaneTracking.d.ts +1 -0
- package/types/xr/feature/trackable/plane/IXRTrackedPlane.d.ts +1 -1
- package/types/xr/index.d.ts +11 -4
- package/types/xr/input/IXRCamera.d.ts +8 -0
- package/types/xr/input/IXRController.d.ts +10 -0
- package/types/xr/input/IXRInput.d.ts +0 -2
- package/types/xr/session/IXRSessionDescriptor.d.ts +2 -2
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.22",
|
|
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.22"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"b:types": "tsc"
|
package/types/xr/IXRDevice.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IHardwareRenderer } from "../renderingHardwareInterface";
|
|
2
2
|
import { IXRSession } from "./IXRSession";
|
|
3
3
|
import { IXRFeature } from "./feature/IXRFeature";
|
|
4
|
-
import {
|
|
4
|
+
import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
|
|
5
5
|
/**
|
|
6
6
|
* The interface of XR device.
|
|
7
7
|
*/
|
|
@@ -10,18 +10,18 @@ export interface IXRDevice {
|
|
|
10
10
|
* Whether the device is supported.
|
|
11
11
|
* @param mode - The mode of the session.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
isSupportedSessionMode(mode: number): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the platform feature instance of this device
|
|
16
16
|
* @param engine - The engine.
|
|
17
17
|
* @param type - The type of the feature.
|
|
18
18
|
*/
|
|
19
|
-
createFeature(type: number):
|
|
19
|
+
createFeature(type: number): IXRPlatformFeature;
|
|
20
20
|
/**
|
|
21
21
|
* Request a session.
|
|
22
22
|
* @param engine - The engine
|
|
23
23
|
* @param mode - The mode of the session
|
|
24
24
|
* @param requestFeatures - The requested features
|
|
25
25
|
*/
|
|
26
|
-
requestSession(rhi: IHardwareRenderer, mode: number, requestFeatures:
|
|
26
|
+
requestSession(rhi: IHardwareRenderer, mode: number, requestFeatures: IXRFeature[]): Promise<IXRSession>;
|
|
27
27
|
}
|
|
@@ -1,12 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
1
|
+
import { IXRFeatureConfig } from "./IXRFeatureConfig";
|
|
2
|
+
import { IXRPlatformFeature } from "./IXRPlatformFeature";
|
|
3
|
+
import { IXRSession } from "../IXRSession";
|
|
4
|
+
import { IXRFrame } from "../IXRFrame";
|
|
6
5
|
export interface IXRFeature {
|
|
6
|
+
/** @internal */
|
|
7
|
+
_platformFeature: IXRPlatformFeature;
|
|
8
|
+
/** Whether this feature enabled. */
|
|
9
|
+
enabled: boolean;
|
|
7
10
|
/**
|
|
8
11
|
* Returns whether the feature is supported.
|
|
9
|
-
* @param descriptor - The descriptor of the feature
|
|
10
12
|
*/
|
|
11
|
-
isSupported(
|
|
13
|
+
isSupported(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize the feature.
|
|
16
|
+
*/
|
|
17
|
+
initialize(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Enable an instance of a feature.
|
|
20
|
+
*/
|
|
21
|
+
onEnable(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Disable an instance of a feature.
|
|
24
|
+
*/
|
|
25
|
+
onDisable(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Update an instance of a feature.
|
|
28
|
+
*/
|
|
29
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
30
|
+
/**
|
|
31
|
+
* Destroy an instance of a feature.
|
|
32
|
+
*/
|
|
33
|
+
onDestroy(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Called when the session is initialized.
|
|
36
|
+
*/
|
|
37
|
+
onSessionInit(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Called when session starts.
|
|
40
|
+
*/
|
|
41
|
+
onSessionStart(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Called when the session is stopped.
|
|
44
|
+
*/
|
|
45
|
+
onSessionStop(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Called when the session is destroyed.
|
|
48
|
+
*/
|
|
49
|
+
onSessionDestroy(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Generate the config of the feature.
|
|
52
|
+
*/
|
|
53
|
+
_generateConfig(): IXRFeatureConfig;
|
|
12
54
|
}
|
|
@@ -3,7 +3,7 @@ import { IXRFeature } from "./IXRFeature";
|
|
|
3
3
|
import { IXRSession } from "../IXRSession";
|
|
4
4
|
import { IXRFrame } from "../IXRFrame";
|
|
5
5
|
export interface IXRFeatureManager {
|
|
6
|
-
|
|
6
|
+
_platformFeature: IXRFeature;
|
|
7
7
|
/** The descriptor of the feature. */
|
|
8
8
|
descriptor: IXRFeatureDescriptor;
|
|
9
9
|
/** Whether this feature enabled. */
|
|
@@ -11,7 +11,7 @@ export interface IXRHitResult {
|
|
|
11
11
|
/** The distance from the origin of the ray to the hit point. */
|
|
12
12
|
distance: number;
|
|
13
13
|
/** The id of the hit tracked object, such as the id of IXRTrackedPlane. */
|
|
14
|
-
|
|
15
|
-
/** The type of tracked object detected, such as
|
|
16
|
-
|
|
14
|
+
trackableId: number;
|
|
15
|
+
/** The type of tracked object detected, such as TrackableType.Plane */
|
|
16
|
+
trackableType: number;
|
|
17
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface IXRMovementTracking extends
|
|
1
|
+
import { IXRPlatformFeature } from "./IXRPlatformFeature";
|
|
2
|
+
export interface IXRMovementTracking extends IXRPlatformFeature {
|
|
3
3
|
get trackingMode(): number;
|
|
4
4
|
set trackingMode(value: number);
|
|
5
5
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IXRFeatureConfig } from "./IXRFeatureConfig";
|
|
2
|
+
/**
|
|
3
|
+
* The base interface of the platform feature.
|
|
4
|
+
* Responsible for the implementation of specific features of different XR backends.
|
|
5
|
+
*/
|
|
2
6
|
export interface IXRPlatformFeature {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
_onSessionStart(): void;
|
|
9
|
-
_onSessionStop(): void;
|
|
10
|
-
_onSessionDestroy(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the feature is supported.
|
|
9
|
+
* @param descriptor - The descriptor of the feature
|
|
10
|
+
*/
|
|
11
|
+
isSupported(descriptor: IXRFeatureConfig): Promise<void>;
|
|
11
12
|
}
|
|
@@ -7,6 +7,4 @@ export interface IXRRequestTracking<T extends IXRTracked> {
|
|
|
7
7
|
state: number;
|
|
8
8
|
/** Tracked instances, make up from the tracking data returned by Session. */
|
|
9
9
|
tracked: T[];
|
|
10
|
-
/** Determines whether the specified request tracking are equals. */
|
|
11
|
-
equals(other: IXRRequestTracking<T>): boolean;
|
|
12
10
|
}
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IXRPlatformFeature } from "../IXRPlatformFeature";
|
|
2
2
|
import { IXRTracked } from "./IXRTracked";
|
|
3
3
|
import { IXRSession } from "../../IXRSession";
|
|
4
4
|
import { IXRFrame } from "../../IXRFrame";
|
|
5
5
|
import { IXRRequestTracking } from "./IXRRequestTracking";
|
|
6
|
-
export interface IXRTrackableFeature<TXRTracked extends IXRTracked, TXRRequestTracking extends IXRRequestTracking<TXRTracked>> extends
|
|
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;
|
|
7
11
|
/**
|
|
8
12
|
* Initialize the feature.
|
|
9
13
|
* @param descriptor - The descriptor of the feature
|
|
10
14
|
*/
|
|
11
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
|
+
*/
|
|
12
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
|
+
*/
|
|
13
29
|
checkAvailable(session: IXRSession, frame: IXRFrame, requestTrackings: TXRRequestTracking[]): boolean;
|
|
14
|
-
|
|
15
|
-
|
|
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;
|
|
16
40
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IXRFeatureConfig } from "../../IXRFeatureConfig";
|
|
2
|
+
import { IXRPose } from "../../../input/IXRPose";
|
|
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,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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reference image is an image to look for in the physical environment.
|
|
3
|
+
*/
|
|
4
|
+
export interface IXRReferenceImage {
|
|
5
|
+
name: string;
|
|
6
|
+
src: string | HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas;
|
|
7
|
+
physicalWidth: number;
|
|
8
|
+
physicalHeight: number;
|
|
9
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IXRRequestTracking } from "../IXRRequestTracking";
|
|
2
|
+
import { IXRReferenceImage } from "./IXRReferenceImage";
|
|
2
3
|
import { IXRTrackedImage } from "./IXRTrackedImage";
|
|
3
4
|
export interface IXRRequestImageTracking extends IXRRequestTracking<IXRTrackedImage> {
|
|
4
|
-
image:
|
|
5
|
+
image: IXRReferenceImage;
|
|
5
6
|
}
|
|
@@ -2,7 +2,7 @@ import { Vector3 } from "@galacean/engine-math";
|
|
|
2
2
|
import { IXRTracked } from "../IXRTracked";
|
|
3
3
|
export interface IXRTrackedPlane extends IXRTracked {
|
|
4
4
|
/** Whether the detected plane is horizontal or vertical. */
|
|
5
|
-
|
|
5
|
+
planeMode: number;
|
|
6
6
|
/** The points that make up this plane.
|
|
7
7
|
* Note: These points are in the plane coordinate system,
|
|
8
8
|
* and their Y coordinates are all zero.
|
package/types/xr/index.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
export type { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
|
|
1
2
|
export type { IXRFeature } from "./feature/IXRFeature";
|
|
2
|
-
export type {
|
|
3
|
-
export type { IXRFeatureDescriptor } from "./feature/IXRFeatureDescriptor";
|
|
3
|
+
export type { IXRFeatureConfig } from "./feature/IXRFeatureConfig";
|
|
4
4
|
export type { IXRMovementTracking } from "./feature/IXRMovementTracking";
|
|
5
5
|
export type { IXRHitResult } from "./feature/IXRHitResult";
|
|
6
6
|
export type { IXRTrackableFeature } from "./feature/trackable/IXRTrackableFeature";
|
|
7
|
-
export type {
|
|
7
|
+
export type { IXRInputEvent } from "./IXRInputEvent";
|
|
8
8
|
export type { IXRInput } from "./input/IXRInput";
|
|
9
9
|
export type { IXRPose } from "./input/IXRPose";
|
|
10
|
+
export type { IXRController } from "./input/IXRController";
|
|
11
|
+
export type { IXRCamera } from "./input/IXRCamera";
|
|
10
12
|
export type { IXRRequestTracking } from "./feature/trackable/IXRRequestTracking";
|
|
11
13
|
export type { IXRTracked } from "./feature/trackable/IXRTracked";
|
|
14
|
+
export type { IXRImageTrackingConfig } from "./feature/trackable/image/IXRImageTrackingConfig";
|
|
12
15
|
export type { IXRTrackedImage } from "./feature/trackable/image/IXRTrackedImage";
|
|
13
16
|
export type { IXRImageTracking } from "./feature/trackable/image/IXRImageTracking";
|
|
14
17
|
export type { IXRRequestImageTracking } from "./feature/trackable/image/IXRRequestImageTracking";
|
|
18
|
+
export type { IXRReferenceImage } from "./feature/trackable/image/IXRReferenceImage";
|
|
19
|
+
export type { IXRPlaneTrackingConfig } from "./feature/trackable/plane/IXRPlaneTrackingConfig";
|
|
15
20
|
export type { IXRTrackedPlane } from "./feature/trackable/plane/IXRTrackedPlane";
|
|
16
21
|
export type { IXRPlaneTracking } from "./feature/trackable/plane/IXRPlaneTracking";
|
|
17
22
|
export type { IXRRequestPlaneTracking } from "./feature/trackable/plane/IXRRequestPlaneTracking";
|
|
23
|
+
export type { IXRAnchorTrackingConfig } from "./feature/trackable/anchor/IXRAnchorTrackingConfig";
|
|
18
24
|
export type { IXRAnchorTracking } from "./feature/trackable/anchor/IXRAnchorTracking";
|
|
19
25
|
export type { IXRRequestAnchorTracking } from "./feature/trackable/anchor/IXRRequestAnchorTracking";
|
|
26
|
+
export type { IXRMovementTrackingConfig } from "./feature/IXRMovementTrackingConfig";
|
|
27
|
+
export type { IXRDevice } from "./IXRDevice";
|
|
20
28
|
export type { IXRFrame } from "./IXRFrame";
|
|
21
29
|
export type { IXRSession } from "./IXRSession";
|
|
22
|
-
export type { IXRInputEvent } from "./IXRInputEvent";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Matrix, Rect } from "@galacean/engine-math";
|
|
2
|
+
import { IXRInput } from "./IXRInput";
|
|
3
|
+
export interface IXRCamera extends IXRInput {
|
|
4
|
+
/** The viewport of the camera. */
|
|
5
|
+
viewport: Rect;
|
|
6
|
+
/** The projection matrix of the camera. */
|
|
7
|
+
projectionMatrix: Matrix;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IXRInput } from "./IXRInput";
|
|
2
|
+
import { IXRPose } from "./IXRPose";
|
|
3
|
+
export interface IXRController extends IXRInput {
|
|
4
|
+
/** the pose mode of the controller. (Default is Grip) */
|
|
5
|
+
poseMode: number;
|
|
6
|
+
/** The grip space pose of the controller. */
|
|
7
|
+
gripPose: IXRPose;
|
|
8
|
+
/** The target ray space pose of the controller. */
|
|
9
|
+
targetRayPose: IXRPose;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IXRFeatureConfig } from "../feature/IXRFeatureConfig";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for XR session descriptors
|
|
4
4
|
*/
|
|
@@ -6,5 +6,5 @@ export interface IXRSessionDescriptor {
|
|
|
6
6
|
/** The type of XR session. */
|
|
7
7
|
mode: number;
|
|
8
8
|
/** Requested features. */
|
|
9
|
-
requestFeatures:
|
|
9
|
+
requestFeatures: IXRFeatureConfig[];
|
|
10
10
|
}
|