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

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": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.21",
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.2"
17
+ "@galacean/engine-math": "1.1.0-beta.21"
18
18
  },
19
19
  "scripts": {
20
20
  "b:types": "tsc"
@@ -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<Vector3>;
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,2 @@
1
+ import { IShaderLab } from "./interface";
2
+ export { IShaderLab };
@@ -0,0 +1,54 @@
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 {};
@@ -0,0 +1,4 @@
1
+ import { IXRInput } from "./input/IXRInput";
2
+ export interface IXRFrame {
3
+ updateInputs(inputs: IXRInput[]): void;
4
+ }
@@ -0,0 +1,10 @@
1
+ export declare class IXRInputEvent {
2
+ targetRayMode: "gaze" | "tracked-pointer" | "screen";
3
+ type: "select" | "selectend" | "selectstart" | "squeeze" | "squeezeend" | "squeezestart";
4
+ input: number;
5
+ id?: number;
6
+ /** normalized */
7
+ x?: number;
8
+ /** normalized */
9
+ y?: number;
10
+ }
@@ -0,0 +1,44 @@
1
+ import { IXRFrame } from "./IXRFrame";
2
+ import { IXRInputEvent } from "./IXRInputEvent";
3
+ export interface IXRSession {
4
+ fixedFoveation: number;
5
+ get frame(): IXRFrame;
6
+ get events(): IXRInputEvent[];
7
+ get frameRate(): number;
8
+ get supportedFrameRates(): Float32Array;
9
+ get framebuffer(): WebGLFramebuffer;
10
+ get framebufferWidth(): number;
11
+ get framebufferHeight(): number;
12
+ addEventListener(): void;
13
+ removeEventListener(): void;
14
+ resetEvents(): void;
15
+ /**
16
+ * Ends the xr session. Returns a promise which resolves when the
17
+ * session has been start.
18
+ */
19
+ start(): Promise<void>;
20
+ /**
21
+ * Ends the xr session. Returns a promise which resolves when the
22
+ * session has been start.
23
+ */
24
+ stop(): Promise<void>;
25
+ /**
26
+ * Ends the xr session. Returns a promise which resolves when the
27
+ * session has been shut down.
28
+ */
29
+ end(): Promise<void>;
30
+ /**
31
+ * Schedules the specified method to be called the next time the user agent
32
+ * is working on rendering an animation frame for the WebXR device. Returns an
33
+ * integer value which can be used to identify the request for the purposes of
34
+ * canceling the callback using cancelAnimationFrame(). This method is comparable
35
+ * to the Window.requestAnimationFrame() method.
36
+ */
37
+ requestAnimationFrame(callback: FrameRequestCallback): number;
38
+ /**
39
+ * Removes a callback from the animation frame painting callback from
40
+ * XRSession's set of animation frame rendering callbacks, given the
41
+ * identifying handle returned by a previous call to requestAnimationFrame().
42
+ */
43
+ cancelAnimationFrame(id: number): void;
44
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Descriptors for XR features.
3
+ */
4
+ export interface IXRFeatureDescriptor {
5
+ /** The type of the feature. */
6
+ type: number;
7
+ }
@@ -0,0 +1,50 @@
1
+ import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
2
+ import { IXRPlatformFeature } from "./IXRPlatformFeature";
3
+ export interface IXRFeatureManager {
4
+ _platformFeature: IXRPlatformFeature;
5
+ /** The descriptor of the feature. */
6
+ descriptor: IXRFeatureDescriptor;
7
+ /** Whether this feature enabled. */
8
+ enabled: boolean;
9
+ /**
10
+ * Returns whether the feature is supported.
11
+ * @param descriptor - The descriptor of the feature
12
+ */
13
+ isSupported(descriptor?: IXRFeatureDescriptor): 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(): 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
+ }
@@ -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
+ hitId: number;
15
+ /** The type of tracked object detected, such as XRHitTestType.Plane */
16
+ hitType: number;
17
+ }
@@ -0,0 +1,41 @@
1
+ import { IXRFeatureDescriptor } from "./IXRFeatureDescriptor";
2
+ /**
3
+ * The base interface of the platform feature.
4
+ * Responsible for the implementation of specific features of different XR backends.
5
+ */
6
+ export interface IXRPlatformFeature {
7
+ /**
8
+ * Returns whether the feature is supported.
9
+ * @param descriptor - The descriptor of the feature
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;
41
+ }
@@ -0,0 +1,12 @@
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
+ /** Determines whether the specified request tracking are equals. */
11
+ equals(other: IXRRequestTracking<T>): boolean;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { IXRPose } from "../../input/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. */
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,11 @@
1
+ export type { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
2
+ export type { IXRFeatureManager } from "./feature/IXRFeatureManager";
3
+ export type { IXRFeatureDescriptor } from "./feature/IXRFeatureDescriptor";
4
+ export type { IXRHitResult } from "./feature/IXRHitResult";
5
+ export type { IXRInput } from "./input/IXRInput";
6
+ export type { IXRPose } from "./input/IXRPose";
7
+ export type { IXRRequestTracking } from "./feature/trackable/IXRRequestTracking";
8
+ export type { IXRTracked } from "./feature/trackable/IXRTracked";
9
+ export type { IXRFrame } from "./IXRFrame";
10
+ export type { IXRSession } from "./IXRSession";
11
+ export type { IXRInputEvent } from "./IXRInputEvent";
@@ -0,0 +1,11 @@
1
+ import { IXRPose } from "./IXRPose";
2
+ export interface IXRInput {
3
+ /** The type of the input. */
4
+ type: number;
5
+ /** The pose of the input. */
6
+ pose: IXRPose;
7
+ /** The tracking state of xr input. */
8
+ trackingState: number;
9
+ /** The update frame count of xr input. */
10
+ frameCount: number;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { Matrix, Quaternion, Vector3 } from "@galacean/engine-math";
2
+ /**
3
+ * Data interface for describing gestures in the XR world.
4
+ */
5
+ export interface IXRPose {
6
+ position: Vector3;
7
+ rotation: Quaternion;
8
+ matrix?: Matrix;
9
+ inverseMatrix?: Matrix;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { IXRFeatureDescriptor } from "../feature/IXRFeatureDescriptor";
2
+ export interface IXRSessionDescriptor {
3
+ mode: number;
4
+ requestFeatures: IXRFeatureDescriptor[];
5
+ }
@@ -1,4 +0,0 @@
1
- export interface IPlatformPrimitiveVertexBinding {
2
- draw(tech: any, subPrimitive: any): void;
3
- destroy(): void;
4
- }
@@ -1,10 +0,0 @@
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 {};
@@ -1,21 +0,0 @@
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
- }