@galacean/engine-design 1.1.0-beta.21 → 1.1.0-beta.23

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.
Files changed (60) hide show
  1. package/package.json +2 -2
  2. package/types/IProgress.d.ts +15 -0
  3. package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +6 -0
  4. package/types/renderingHardwareInterface/IPlatformPrimitiveVertexBinding.d.ts +4 -0
  5. package/types/shader-lab/IRenderStateInfo.d.ts +10 -0
  6. package/types/shader-lab/interface.d.ts +21 -0
  7. package/types/xr/IXRDevice.d.ts +27 -0
  8. package/types/xr/IXRFrame.d.ts +9 -0
  9. package/types/xr/IXRInputEvent.d.ts +12 -5
  10. package/types/xr/IXRSession.d.ts +37 -0
  11. package/types/xr/feature/IXRFeature.d.ts +54 -0
  12. package/types/xr/feature/IXRFeatureConfig.d.ts +7 -0
  13. package/types/xr/feature/IXRFeatureManager.d.ts +5 -3
  14. package/types/xr/feature/IXRHitResult.d.ts +3 -3
  15. package/types/xr/feature/IXRMovementTracking.d.ts +5 -0
  16. package/types/xr/feature/IXRMovementTrackingConfig.d.ts +8 -0
  17. package/types/xr/feature/IXRMovementTrackingDescriptor.d.ts +8 -0
  18. package/types/xr/feature/IXRPlatformFeature.d.ts +2 -31
  19. package/types/xr/feature/trackable/IXRReferenceImage.d.ts +13 -0
  20. package/types/xr/feature/trackable/IXRRequestTracking.d.ts +0 -2
  21. package/types/xr/feature/trackable/IXRRequestTrackingAnchor.d.ts +7 -0
  22. package/types/xr/feature/trackable/IXRRequestTrackingImage.d.ts +7 -0
  23. package/types/xr/feature/trackable/IXRTrackable.d.ts +14 -0
  24. package/types/xr/feature/trackable/IXRTrackableFeature.d.ts +40 -0
  25. package/types/xr/feature/trackable/IXRTracked.d.ts +0 -2
  26. package/types/xr/feature/trackable/IXRTrackedAnchor.d.ts +5 -0
  27. package/types/xr/feature/trackable/IXRTrackedImage.d.ts +6 -0
  28. package/types/xr/feature/trackable/IXRTrackedPlane.d.ts +6 -0
  29. package/types/xr/feature/trackable/anchor/IXRAnchorTracking.d.ts +5 -0
  30. package/types/xr/feature/trackable/anchor/IXRAnchorTrackingConfig.d.ts +9 -0
  31. package/types/xr/feature/trackable/anchor/IXRAnchorTrackingDescriptor.d.ts +9 -0
  32. package/types/xr/feature/trackable/anchor/IXRRequestAnchorTracking.d.ts +6 -0
  33. package/types/xr/feature/trackable/image/IXRImageTracking.d.ts +5 -0
  34. package/types/xr/feature/trackable/image/IXRImageTrackingConfig.d.ts +8 -0
  35. package/types/xr/feature/trackable/image/IXRImageTrackingDescriptor.d.ts +5 -0
  36. package/types/xr/feature/trackable/image/IXRReferenceImage.d.ts +9 -0
  37. package/types/xr/feature/trackable/image/IXRRequestImageTracking.d.ts +6 -0
  38. package/types/xr/feature/trackable/image/IXRTrackedImage.d.ts +5 -0
  39. package/types/xr/feature/trackable/plane/IXRPlaneTracking.d.ts +7 -0
  40. package/types/xr/feature/trackable/plane/IXRPlaneTrackingConfig.d.ts +8 -0
  41. package/types/xr/feature/trackable/plane/IXRPlaneTrackingDescriptor.d.ts +8 -0
  42. package/types/xr/feature/trackable/plane/IXRRequestPlaneTracking.d.ts +5 -0
  43. package/types/xr/feature/trackable/plane/IXRTrackedPlane.d.ts +11 -0
  44. package/types/xr/feature/trackable/request/IXRRequestTracking.d.ts +5 -0
  45. package/types/xr/feature/trackable/request/IXRRequestTrackingAnchor.d.ts +6 -0
  46. package/types/xr/feature/trackable/request/IXRRequestTrackingImage.d.ts +6 -0
  47. package/types/xr/feature/trackable/request/IXRRequestTrackingPlane.d.ts +5 -0
  48. package/types/xr/feature/trackable/tracked/IXRTracked.d.ts +14 -0
  49. package/types/xr/feature/trackable/tracked/IXRTrackedAnchor.d.ts +3 -0
  50. package/types/xr/feature/trackable/tracked/IXRTrackedImage.d.ts +4 -0
  51. package/types/xr/feature/trackable/tracked/IXRTrackedPlane.d.ts +6 -0
  52. package/types/xr/index.d.ts +21 -3
  53. package/types/xr/input/IXRCamera.d.ts +8 -0
  54. package/types/xr/input/IXRController.d.ts +10 -0
  55. package/types/xr/input/IXRInput.d.ts +0 -2
  56. package/types/xr/input/IXRInputManager.d.ts +10 -0
  57. package/types/xr/session/IXRSessionDescriptor.d.ts +7 -2
  58. package/types/xr/session/IXRSessionManager.d.ts +7 -0
  59. package/types/shaderLab/index.d.ts +0 -2
  60. package/types/shaderLab/interface.d.ts +0 -54
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-design",
3
- "version": "1.1.0-beta.21",
3
+ "version": "1.1.0-beta.23",
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.21"
17
+ "@galacean/engine-math": "1.1.0-beta.23"
18
18
  },
19
19
  "scripts": {
20
20
  "b:types": "tsc"
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Progress interface.
3
+ */
4
+ export interface IProgress {
5
+ detail?: {
6
+ [key: string]: {
7
+ loaded: number;
8
+ total: number;
9
+ };
10
+ };
11
+ task: {
12
+ loaded: number;
13
+ total: number;
14
+ };
15
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hardware graphics API renderer.
3
+ */
4
+ export interface IHardwareRenderer {
5
+ [key: string]: any;
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface IPlatformPrimitiveVertexBinding {
2
+ draw(tech: any, subPrimitive: any): void;
3
+ destroy(): void;
4
+ }
@@ -0,0 +1,10 @@
1
+ interface IRenderStatePropertyItemInfo {
2
+ property: string;
3
+ value: any;
4
+ index?: number;
5
+ }
6
+ export interface IRenderStateInfo {
7
+ renderStateType: "BlendState" | "DepthState" | "StencilState" | "RasterState";
8
+ properties: Array<IRenderStatePropertyItemInfo>;
9
+ }
10
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shader lab interface.
3
+ */
4
+ export interface IShaderLab {
5
+ parseShader(shaderSource: string): IShaderInfo;
6
+ }
7
+ export interface IShaderInfo {
8
+ name: string;
9
+ subShaders: ISubShaderInfo[];
10
+ }
11
+ export interface ISubShaderInfo {
12
+ passes: IShaderPassInfo[];
13
+ tags?: Record<string, number | string | boolean>;
14
+ }
15
+ export interface IShaderPassInfo {
16
+ name: string;
17
+ vert: string;
18
+ frag: string;
19
+ tags?: Record<string, number | string | boolean>;
20
+ renderStates: Record<string, any>;
21
+ }
@@ -0,0 +1,27 @@
1
+ import { IHardwareRenderer } from "../renderingHardwareInterface";
2
+ import { IXRSession } from "./IXRSession";
3
+ import { IXRFeature } from "./feature/IXRFeature";
4
+ import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
5
+ /**
6
+ * The interface of XR device.
7
+ */
8
+ export interface IXRDevice {
9
+ /**
10
+ * Whether the device is supported.
11
+ * @param mode - The mode of the session.
12
+ */
13
+ isSupportedSessionMode(mode: number): Promise<void>;
14
+ /**
15
+ * Get the platform feature instance of this device
16
+ * @param engine - The engine.
17
+ * @param type - The type of the feature.
18
+ */
19
+ createFeature(type: number): IXRPlatformFeature;
20
+ /**
21
+ * Request a session.
22
+ * @param engine - The engine
23
+ * @param mode - The mode of the session
24
+ * @param requestFeatures - The requested features
25
+ */
26
+ requestSession(rhi: IHardwareRenderer, mode: number, requestFeatures: IXRFeature[]): Promise<IXRSession>;
27
+ }
@@ -1,4 +1,13 @@
1
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
+ */
2
7
  export interface IXRFrame {
8
+ /**
9
+ * Update xr input information.
10
+ * @param inputs - xr input
11
+ */
3
12
  updateInputs(inputs: IXRInput[]): void;
4
13
  }
@@ -1,10 +1,17 @@
1
- export declare class IXRInputEvent {
2
- targetRayMode: "gaze" | "tracked-pointer" | "screen";
3
- type: "select" | "selectend" | "selectstart" | "squeeze" | "squeezeend" | "squeezestart";
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. */
4
10
  input: number;
11
+ /** Touch id. (Meaningful when and only when targetRayMode is screen) */
5
12
  id?: number;
6
- /** normalized */
13
+ /** X coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
7
14
  x?: number;
8
- /** normalized */
15
+ /** Y coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
9
16
  y?: number;
10
17
  }
@@ -1,16 +1,53 @@
1
1
  import { IXRFrame } from "./IXRFrame";
2
2
  import { IXRInputEvent } from "./IXRInputEvent";
3
+ /**
4
+ * The base interface of XR session.
5
+ * Can be understood as an XR context.
6
+ */
3
7
  export interface IXRSession {
8
+ /**
9
+ * Fixed foveation for XR.
10
+ */
4
11
  fixedFoveation: number;
12
+ /**
13
+ * Returns the XR information of this frame.
14
+ */
5
15
  get frame(): IXRFrame;
16
+ /**
17
+ * Return the event received in this frame.
18
+ */
6
19
  get events(): IXRInputEvent[];
20
+ /**
21
+ * Returns the current frame rate.
22
+ */
7
23
  get frameRate(): number;
24
+ /**
25
+ * Returns the frame rate supported by the device.
26
+ */
8
27
  get supportedFrameRates(): Float32Array;
28
+ /**
29
+ * Returns the device's default main framebuffer.
30
+ */
9
31
  get framebuffer(): WebGLFramebuffer;
32
+ /**
33
+ * Returns the width of the device's default main framebuffer.
34
+ */
10
35
  get framebufferWidth(): number;
36
+ /**
37
+ * Returns the height of the device's default main framebuffer.
38
+ */
11
39
  get framebufferHeight(): number;
40
+ /**
41
+ * Add event listener for XR session.
42
+ */
12
43
  addEventListener(): void;
44
+ /**
45
+ * Remove event listener for XR session.
46
+ */
13
47
  removeEventListener(): void;
48
+ /**
49
+ * Reset event flow.
50
+ */
14
51
  resetEvents(): void;
15
52
  /**
16
53
  * Ends the xr session. Returns a promise which resolves when the
@@ -0,0 +1,54 @@
1
+ import { IXRFeatureConfig } from "./IXRFeatureConfig";
2
+ import { IXRPlatformFeature } from "./IXRPlatformFeature";
3
+ import { IXRSession } from "../IXRSession";
4
+ import { IXRFrame } from "../IXRFrame";
5
+ export interface IXRFeature {
6
+ /** @internal */
7
+ _platformFeature: IXRPlatformFeature;
8
+ /** Whether this feature enabled. */
9
+ enabled: boolean;
10
+ /**
11
+ * Returns whether the feature is supported.
12
+ */
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;
54
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The config of XR feature.
3
+ */
4
+ export interface IXRFeatureConfig {
5
+ /** The type of the feature. */
6
+ type: number;
7
+ }
@@ -1,7 +1,9 @@
1
1
  import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
2
- import { IXRPlatformFeature } from "./IXRPlatformFeature";
2
+ import { IXRFeature } from "./IXRFeature";
3
+ import { IXRSession } from "../IXRSession";
4
+ import { IXRFrame } from "../IXRFrame";
3
5
  export interface IXRFeatureManager {
4
- _platformFeature: IXRPlatformFeature;
6
+ _platformFeature: IXRFeature;
5
7
  /** The descriptor of the feature. */
6
8
  descriptor: IXRFeatureDescriptor;
7
9
  /** Whether this feature enabled. */
@@ -26,7 +28,7 @@ export interface IXRFeatureManager {
26
28
  /**
27
29
  * Update an instance of a feature.
28
30
  */
29
- onUpdate(): void;
31
+ onUpdate(session: IXRSession, frame: IXRFrame): void;
30
32
  /**
31
33
  * Destroy an instance of a feature.
32
34
  */
@@ -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
- hitId: number;
15
- /** The type of tracked object detected, such as XRHitTestType.Plane */
16
- hitType: number;
14
+ trackableId: number;
15
+ /** The type of tracked object detected, such as TrackableType.Plane */
16
+ trackableType: number;
17
17
  }
@@ -0,0 +1,5 @@
1
+ import { IXRPlatformFeature } from "./IXRPlatformFeature";
2
+ export interface IXRMovementTracking extends IXRPlatformFeature {
3
+ get trackingMode(): number;
4
+ set trackingMode(value: number);
5
+ }
@@ -0,0 +1,8 @@
1
+ import { IXRFeatureConfig } from "./IXRFeatureConfig";
2
+ /**
3
+ * The config of XR movement tracking.
4
+ */
5
+ export interface IXRMovementTrackingConfig extends IXRFeatureConfig {
6
+ /** The mode of movement tracking. */
7
+ mode: number;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
2
+ /**
3
+ * The descriptor of XR movement tracking.
4
+ */
5
+ export interface IXRMovementTrackingDescriptor extends IXRFeatureDescriptor {
6
+ /** The mode of movement tracking. */
7
+ mode: number;
8
+ }
@@ -1,4 +1,4 @@
1
- import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
1
+ import { IXRFeatureConfig } from "./IXRFeatureConfig";
2
2
  /**
3
3
  * The base interface of the platform feature.
4
4
  * Responsible for the implementation of specific features of different XR backends.
@@ -8,34 +8,5 @@ export interface IXRPlatformFeature {
8
8
  * Returns whether the feature is supported.
9
9
  * @param descriptor - The descriptor of the feature
10
10
  */
11
- _isSupported(descriptor: IXRFeatureDescriptor): Promise<void>;
12
- /**
13
- * Initialize the feature.
14
- * @param descriptor - The descriptor of the feature
15
- */
16
- _initialize(descriptor: IXRFeatureDescriptor): Promise<void>;
17
- /**
18
- * Called when the XR frame is updated.
19
- */
20
- _onUpdate(): void;
21
- /**
22
- * Called when the XR module is destroyed.
23
- */
24
- _onDestroy(): void;
25
- /**
26
- * Called when the session is initialized.
27
- */
28
- _onSessionInit(): void;
29
- /**
30
- * Called when session starts.
31
- */
32
- _onSessionStart(): void;
33
- /**
34
- * Called when the session is stopped.
35
- */
36
- _onSessionStop(): void;
37
- /**
38
- * Called when the session is destroyed.
39
- */
40
- _onSessionDestroy(): void;
11
+ isSupported(descriptor: IXRFeatureConfig): Promise<void>;
41
12
  }
@@ -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
+ }
@@ -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
  }
@@ -0,0 +1,7 @@
1
+ import { IXRPose } from "../../input/IXRPose";
2
+ import { IXRTrackedAnchor } from "./IXRTrackedAnchor";
3
+ export interface IXRRequestTrackingAnchor {
4
+ state: number;
5
+ pose: IXRPose;
6
+ trackedAnchor?: IXRTrackedAnchor;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { IXRReferenceImage } from "./IXRReferenceImage";
2
+ import { IXRTrackedImage } from "./IXRTrackedImage";
3
+ export interface IXRRequestTrackingImage {
4
+ state: number;
5
+ image: IXRReferenceImage;
6
+ trackedImage?: IXRTrackedImage;
7
+ }
@@ -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 { IXRPlatformFeature } from "../IXRPlatformFeature";
2
+ import { IXRTracked } from "./IXRTracked";
3
+ import { IXRSession } from "../../IXRSession";
4
+ import { IXRFrame } from "../../IXRFrame";
5
+ import { IXRRequestTracking } from "./IXRRequestTracking";
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
+ }
@@ -9,6 +9,4 @@ export interface IXRTracked {
9
9
  pose: IXRPose;
10
10
  /** The tracking state of the trackable. */
11
11
  state: number;
12
- /** The modified frame count of the trackable. */
13
- frameCount: number;
14
12
  }
@@ -0,0 +1,5 @@
1
+ import { IXRRequestTrackingAnchor } from "./IXRRequestTrackingAnchor";
2
+ import { IXRTrackable } from "./IXRTrackable";
3
+ export interface IXRTrackedAnchor extends IXRTrackable {
4
+ requestTracking: IXRRequestTrackingAnchor;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { IXRTrackable } from "./IXRTrackable";
2
+ import { IXRRequestTrackingImage } from "./IXRRequestTrackingImage";
3
+ export interface IXRTrackedImage extends IXRTrackable {
4
+ requestTracking: IXRRequestTrackingImage;
5
+ measuredWidthInMeters: number;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Vector3 } from "@galacean/engine-math";
2
+ import { IXRTrackable } from "./IXRTrackable";
3
+ export interface IXRTrackedPlane extends IXRTrackable {
4
+ orientation: "horizontal" | "vertical";
5
+ polygon: Vector3[];
6
+ }
@@ -0,0 +1,5 @@
1
+ import { IXRRequestAnchorTracking } from "./IXRRequestAnchorTracking";
2
+ import { IXRTrackableFeature } from "../IXRTrackableFeature";
3
+ import { IXRTracked } from "../IXRTracked";
4
+ export interface IXRAnchorTracking extends IXRTrackableFeature<IXRTracked, IXRRequestAnchorTracking> {
5
+ }
@@ -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,6 @@
1
+ import { IXRRequestTracking } from "../IXRRequestTracking";
2
+ import { IXRPose } from "../../../input/IXRPose";
3
+ import { IXRTracked } from "../IXRTracked";
4
+ export interface IXRRequestAnchorTracking extends IXRRequestTracking<IXRTracked> {
5
+ pose: IXRPose;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { IXRRequestImageTracking } from "./IXRRequestImageTracking";
2
+ import { IXRTrackableFeature } from "../IXRTrackableFeature";
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,5 @@
1
+ import { IXRFeatureDescriptor } from "../../IXRFeatureDescriptor";
2
+ import { IXRReferenceImage } from "./IXRReferenceImage";
3
+ export interface IXRImageTrackingDescriptor extends IXRFeatureDescriptor {
4
+ images?: IXRReferenceImage[];
5
+ }
@@ -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
+ }
@@ -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,5 @@
1
+ import { IXRTracked } from "../IXRTracked";
2
+ export interface IXRTrackedImage extends IXRTracked {
3
+ /** The width of the image in meters in the physical world. */
4
+ measuredWidthInMeters: number;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { IXRRequestPlaneTracking } from "./IXRRequestPlaneTracking";
2
+ import { IXRTrackableFeature } from "../IXRTrackableFeature";
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,8 @@
1
+ import { IXRFeatureConfig } from "../../IXRFeatureConfig";
2
+ /**
3
+ * The config of XR plane tracking.
4
+ */
5
+ export interface IXRPlaneTrackingConfig extends IXRFeatureConfig {
6
+ /** Rules for detecting planes. */
7
+ mode: number;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { IXRFeatureDescriptor } from "../../IXRFeatureDescriptor";
2
+ /**
3
+ * The descriptor of XR plane tracking.
4
+ */
5
+ export interface IXRPlaneTrackingDescriptor extends IXRFeatureDescriptor {
6
+ /** Rules for detecting planes. */
7
+ mode: number;
8
+ }
@@ -0,0 +1,5 @@
1
+ import { IXRRequestTracking } from "../IXRRequestTracking";
2
+ import { IXRTrackedPlane } from "./IXRTrackedPlane";
3
+ export interface IXRRequestPlaneTracking extends IXRRequestTracking<IXRTrackedPlane> {
4
+ detectionMode: number;
5
+ }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import { IXRTracked } from "../tracked/IXRTracked";
2
+ export interface IXRRequestTracking<T extends IXRTracked> {
3
+ state: number;
4
+ tracked: T[];
5
+ }
@@ -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,5 @@
1
+ import { IXRTrackedPlane } from "../tracked/IXRTrackedPlane";
2
+ import { IXRRequestTracking } from "./IXRRequestTracking";
3
+ export interface IXRRequestTrackingPlane extends IXRRequestTracking<IXRTrackedPlane> {
4
+ orientation: number;
5
+ }
@@ -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,3 @@
1
+ import { IXRTracked } from "./IXRTracked";
2
+ export interface IXRTrackedAnchor extends IXRTracked {
3
+ }
@@ -0,0 +1,4 @@
1
+ import { IXRTracked } from "./IXRTracked";
2
+ export interface IXRTrackedImage extends IXRTracked {
3
+ measuredWidthInMeters: number;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { Vector3 } from "@galacean/engine-math";
2
+ import { IXRTracked } from "./IXRTracked";
3
+ export interface IXRTrackedPlane extends IXRTracked {
4
+ orientation: "horizontal" | "vertical";
5
+ polygon: Vector3[];
6
+ }
@@ -1,11 +1,29 @@
1
1
  export type { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
2
- export type { IXRFeatureManager } from "./feature/IXRFeatureManager";
3
- export type { IXRFeatureDescriptor } from "./feature/IXRFeatureDescriptor";
2
+ export type { IXRFeature } from "./feature/IXRFeature";
3
+ export type { IXRFeatureConfig } from "./feature/IXRFeatureConfig";
4
+ export type { IXRMovementTracking } from "./feature/IXRMovementTracking";
4
5
  export type { IXRHitResult } from "./feature/IXRHitResult";
6
+ export type { IXRTrackableFeature } from "./feature/trackable/IXRTrackableFeature";
7
+ export type { IXRInputEvent } from "./IXRInputEvent";
5
8
  export type { IXRInput } from "./input/IXRInput";
6
9
  export type { IXRPose } from "./input/IXRPose";
10
+ export type { IXRController } from "./input/IXRController";
11
+ export type { IXRCamera } from "./input/IXRCamera";
7
12
  export type { IXRRequestTracking } from "./feature/trackable/IXRRequestTracking";
8
13
  export type { IXRTracked } from "./feature/trackable/IXRTracked";
14
+ export type { IXRImageTrackingConfig } from "./feature/trackable/image/IXRImageTrackingConfig";
15
+ export type { IXRTrackedImage } from "./feature/trackable/image/IXRTrackedImage";
16
+ export type { IXRImageTracking } from "./feature/trackable/image/IXRImageTracking";
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";
20
+ export type { IXRTrackedPlane } from "./feature/trackable/plane/IXRTrackedPlane";
21
+ export type { IXRPlaneTracking } from "./feature/trackable/plane/IXRPlaneTracking";
22
+ export type { IXRRequestPlaneTracking } from "./feature/trackable/plane/IXRRequestPlaneTracking";
23
+ export type { IXRAnchorTrackingConfig } from "./feature/trackable/anchor/IXRAnchorTrackingConfig";
24
+ export type { IXRAnchorTracking } from "./feature/trackable/anchor/IXRAnchorTracking";
25
+ export type { IXRRequestAnchorTracking } from "./feature/trackable/anchor/IXRRequestAnchorTracking";
26
+ export type { IXRMovementTrackingConfig } from "./feature/IXRMovementTrackingConfig";
27
+ export type { IXRDevice } from "./IXRDevice";
9
28
  export type { IXRFrame } from "./IXRFrame";
10
29
  export type { IXRSession } from "./IXRSession";
11
- 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
+ }
@@ -6,6 +6,4 @@ export interface IXRInput {
6
6
  pose: IXRPose;
7
7
  /** The tracking state of xr input. */
8
8
  trackingState: number;
9
- /** The update frame count of xr input. */
10
- frameCount: number;
11
9
  }
@@ -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
+ }
@@ -1,5 +1,10 @@
1
- import { IXRFeatureDescriptor } from "../feature/IXRFeatureDescriptor";
1
+ import { IXRFeatureConfig } from "../feature/IXRFeatureConfig";
2
+ /**
3
+ * Interface for XR session descriptors
4
+ */
2
5
  export interface IXRSessionDescriptor {
6
+ /** The type of XR session. */
3
7
  mode: number;
4
- requestFeatures: IXRFeatureDescriptor[];
8
+ /** Requested features. */
9
+ requestFeatures: IXRFeatureConfig[];
5
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
+ }
@@ -1,2 +0,0 @@
1
- import { IShaderLab } from "./interface";
2
- export { IShaderLab };
@@ -1,54 +0,0 @@
1
- import { AstNode } from "./astNode";
2
- import { IAstInfo, IPositionRange, IShaderAstContent } from "./astNode/types";
3
- export type DiagnosticSeverity = number;
4
- /**
5
- * Shader lab interface
6
- */
7
- export interface IShaderLab {
8
- /** */
9
- initialize(): Promise<void>;
10
- /**
11
- * parse galacean shader
12
- */
13
- parseShader(shaderCode: string): IShaderInfo;
14
- }
15
- export interface IDiagnostic {
16
- severity: DiagnosticSeverity;
17
- message: string;
18
- /**
19
- * The token which caused the parser error.
20
- */
21
- token: IPositionRange;
22
- }
23
- export interface IShaderMainFunction {
24
- type: "vert" | "frag";
25
- functionAst: IAstInfo;
26
- }
27
- interface IReference {
28
- referenced: boolean;
29
- }
30
- export interface IGlobal extends IReference {
31
- ast: AstNode;
32
- name: string;
33
- }
34
- export interface IShaderInfo {
35
- ast: AstNode<IShaderAstContent>;
36
- name: string;
37
- subShaders: Array<ISubShader>;
38
- editorProperties: Record<string, any>;
39
- diagnostics: Array<IDiagnostic>;
40
- }
41
- export interface ISubShader {
42
- name: string;
43
- passes: Array<IShaderPass>;
44
- tags?: Record<string, any>;
45
- }
46
- export interface IShaderPass {
47
- name: string;
48
- vert: string;
49
- frag: string;
50
- tags?: Record<string, any>;
51
- renderStates: IRenderState;
52
- }
53
- export declare type IRenderState = Record<string, any>;
54
- export {};