@galacean/engine-design 0.0.0-experimental-double11.12 → 0.0.0-experimental-shaderlab.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-design",
3
- "version": "0.0.0-experimental-double11.12",
3
+ "version": "0.0.0-experimental-shaderlab.0",
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": "0.0.0-experimental-double11.12"
17
+ "@galacean/engine-math": "0.0.0-experimental-shaderlab.0"
18
18
  },
19
19
  "scripts": {
20
20
  "b:types": "tsc"
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hardware graphics API renderer.
3
+ */
4
+ export interface IHardwareRenderer {
5
+ [key: string]: any;
6
+ }
@@ -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,6 @@
1
+ /**
2
+ * The base interface of the platform feature.
3
+ * Responsible for the implementation of specific features of different XR backends.
4
+ */
5
+ export interface IXRPlatformFeature {
6
+ }
@@ -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,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,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
+ /**
2
+ * A reference image is an image to look for in the physical environment.
3
+ */
4
+ export interface IXRReferenceImage {
5
+ name: string;
6
+ imageSource: ImageBitmapSource;
7
+ physicalWidth: number;
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,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,5 @@
1
+ import { IXRRequestTracking } from "../IXRRequestTracking";
2
+ import { IXRTrackedPlane } from "./IXRTrackedPlane";
3
+ export interface IXRRequestPlane extends IXRRequestTracking<IXRTrackedPlane> {
4
+ detectionMode: number;
5
+ }
@@ -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,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,6 @@
1
+ export interface IXRInput {
2
+ /** The type of the input. */
3
+ type: number;
4
+ /** The tracking state of xr input. */
5
+ trackingState: number;
6
+ }