@galacean/engine-core 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/dist/main.js +7720 -7225
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +7720 -7225
- package/dist/module.js +7710 -7227
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +3 -0
- package/types/2d/enums/SpriteModifyFlags.d.ts +2 -1
- package/types/Background.d.ts +8 -0
- package/types/Component.d.ts +1 -1
- package/types/DisorderedArray.d.ts +1 -1
- package/types/RenderPipeline/MeshRenderElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteMaskElement.d.ts +3 -1
- package/types/RenderPipeline/TextRenderElement.d.ts +3 -1
- package/types/Scene.d.ts +6 -0
- package/types/asset/AssetPromise.d.ts +1 -0
- package/types/asset/ResourceManager.d.ts +0 -1
- package/types/enums/DepthMode.d.ts +8 -0
- package/types/lighting/DirectLight.d.ts +8 -1
- package/types/lighting/Light.d.ts +0 -4
- package/types/lighting/LightManager.d.ts +7 -0
- package/types/lighting/PointLight.d.ts +9 -1
- package/types/lighting/SpotLight.d.ts +12 -1
- package/types/mesh/SkinnedMeshRenderer.d.ts +1 -1
- package/types/particle/ParticleGenerator.d.ts +0 -2
- package/types/particle/enum/ParticleShapeType.d.ts +1 -1
- package/types/particle/index.d.ts +10 -0
- package/types/particle/module/shape/BaseShape.d.ts +4 -7
- package/types/particle/module/shape/BoxShape.d.ts +3 -11
- package/types/particle/module/shape/CircleShape.d.ts +1 -9
- package/types/particle/module/shape/ConeShape.d.ts +1 -9
- package/types/particle/module/shape/HemisphereShape.d.ts +1 -9
- package/types/particle/module/shape/SphereShape.d.ts +1 -9
- package/types/particle/modules/EmissionModule.d.ts +0 -1
- package/types/particle/modules/MainModule.d.ts +7 -6
- package/types/particle/modules/ParticleGeneratorModule.d.ts +0 -1
- package/types/particle/modules/RotationOverLifetimeModule.d.ts +1 -1
- package/types/particle/modules/TextureSheetAnimationModule.d.ts +0 -4
- package/types/particle/moudules/Burst.d.ts +12 -4
- package/types/particle/moudules/Emission.d.ts +27 -11
- package/types/particle/moudules/ParticleCurve.d.ts +1 -17
- package/types/physics/Collider.d.ts +3 -1
- package/types/physics/PhysicsManager.d.ts +2 -4
- package/types/physics/PhysicsMaterial.d.ts +1 -0
- package/types/physics/joint/HingeJoint.d.ts +1 -1
- package/types/physics/joint/Joint.d.ts +4 -3
- package/types/physics/shape/ColliderShape.d.ts +2 -1
- package/types/physics/shape/SphereColliderShape.d.ts +1 -0
- package/types/shader/Shader.d.ts +1 -1
- package/types/xr/IXRDevice.d.ts +26 -0
- package/types/xr/XRManager.d.ts +91 -24
- package/types/xr/feature/XRFeatureManager.d.ts +65 -0
- package/types/xr/feature/XRFeatureType.d.ts +17 -0
- package/types/xr/feature/XRPlatformFeature.d.ts +17 -0
- package/types/xr/index.d.ts +16 -18
- package/types/xr/input/XRCamera.d.ts +28 -0
- package/types/xr/input/XRController.d.ts +38 -0
- package/types/xr/input/XRControllerPoseMode.d.ts +9 -0
- package/types/xr/input/XRInputButton.d.ts +19 -0
- package/types/xr/input/XRInputEvent.d.ts +21 -0
- package/types/xr/input/XRInputManager.d.ts +58 -0
- package/types/xr/input/XRInputType.d.ts +23 -0
- package/types/xr/input/XRTrackedUpdateFlag.d.ts +11 -0
- package/types/xr/input/XRTrackingState.d.ts +11 -0
- package/types/xr/session/XRSessionManager.d.ts +76 -0
- package/types/xr/session/XRSessionState.d.ts +13 -0
- package/types/xr/session/XRSessionType.d.ts +7 -0
- package/types/RenderPipeline/RenderElementX.d.ts +0 -12
- package/types/Ticker.d.ts +0 -30
- package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +0 -1
- package/types/graphic/PrimitiveVertexBinding.d.ts +0 -1
- package/types/particle/ParticleShaderMacro.d.ts +0 -1
- package/types/particle/ParticleShaderProperty.d.ts +0 -1
- package/types/particle/ParticleSystem.d.ts +0 -41
- package/types/particle/ParticleVertexElements.d.ts +0 -1
- package/types/particle/ParticleVertexUtils.d.ts +0 -1
- package/types/particle/modules/ShapeModule.d.ts +0 -9
- package/types/particle/modules/shape/enums/ParticleShapeMultiModeValue.d.ts +0 -9
- package/types/particle/moudules/EmissionModule.d.ts +0 -49
- package/types/particle/moudules/MainModule.d.ts +0 -59
- package/types/particle/moudules/ParticleGradient.d.ts +0 -28
- package/types/particle/moudules/ShapeModule.d.ts +0 -7
- package/types/particle/moudules/shape/BaseShape.d.ts +0 -28
- package/types/particle/moudules/shape/BoxShape.d.ts +0 -20
- package/types/particle/moudules/shape/CircleShape.d.ts +0 -27
- package/types/particle/moudules/shape/ConeShape.d.ts +0 -35
- package/types/particle/moudules/shape/HemisphereShape.d.ts +0 -23
- package/types/particle/moudules/shape/ShapeUtils.d.ts +0 -1
- package/types/particle/moudules/shape/SphereShape.d.ts +0 -23
- package/types/particle/moudules/shape/enums/ParticleShapeMultiModeValue.d.ts +0 -9
- package/types/particle/moudules/shape/enums/ParticleShapeType.d.ts +0 -15
- package/types/particle/moudules/shape/index.d.ts +0 -5
- package/types/utils/BoolUpdateFlag.d.ts +0 -12
- package/types/utils/DisorderedArray.d.ts +0 -18
- package/types/utils/UpdateFlag.d.ts +0 -20
- package/types/utils/UpdateFlagManager.d.ts +0 -1
- package/types/utils/Utils.d.ts +0 -31
- package/types/xr/component/XRPoseDriver.d.ts +0 -10
- package/types/xr/data/XRCamera.d.ts +0 -6
- package/types/xr/data/XRDevice.d.ts +0 -9
- package/types/xr/data/XRHandle.d.ts +0 -10
- package/types/xr/enum/EnumXRButton.d.ts +0 -5
- package/types/xr/enum/EnumXRDevicePhase.d.ts +0 -4
- package/types/xr/enum/EnumXRFeature.d.ts +0 -9
- package/types/xr/enum/EnumXRInputSource.d.ts +0 -8
- package/types/xr/enum/EnumXRMode.d.ts +0 -7
- package/types/xr/enum/EnumXRSubsystem.d.ts +0 -4
- package/types/xr/enum/EnumXRTrackingMode.d.ts +0 -7
- package/types/xr/feature/XRCameraManager.d.ts +0 -21
- package/types/xr/feature/XRFeature.d.ts +0 -29
- package/types/xr/feature/XRImageTrackManager.d.ts +0 -10
- package/types/xr/feature/XRInputManager.d.ts +0 -16
- package/types/xr/provider/XRProvider.d.ts +0 -19
- package/types/xr/subsystem/XRInputSubsystem.d.ts +0 -5
- package/types/xr/subsystem/XRSubsystem.d.ts +0 -30
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
import { IClone } from "@galacean/engine-design";
|
|
2
1
|
import { ParticleCurveMode } from "../enums/ParticleCurveMode";
|
|
3
2
|
/**
|
|
4
3
|
* Particle curve.
|
|
5
4
|
*/
|
|
6
|
-
export declare class ParticleCurve
|
|
5
|
+
export declare class ParticleCurve {
|
|
7
6
|
/** The curve mode. */
|
|
8
7
|
mode: ParticleCurveMode;
|
|
9
8
|
constant: number;
|
|
10
9
|
constantMin: number;
|
|
11
10
|
constantMax: number;
|
|
12
|
-
/**
|
|
13
|
-
* Query the curve value at the specified time.
|
|
14
|
-
* @param time - Normalized time at which to evaluate the curve, Valid when `mode` is set to `Curve` or `TwoCurves`
|
|
15
|
-
* @param lerpFactor - Lerp factor between two constants or curves, Valid when `mode` is set to `TwoConstants` or `TwoCurves`
|
|
16
|
-
* @returns - The result curve value
|
|
17
|
-
*/
|
|
18
|
-
evaluate(time: number, lerpFactor: number): number;
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
cloneTo(destEmission: ParticleCurve): void;
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
clone(): ParticleCurve;
|
|
27
11
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BoolUpdateFlag } from "../BoolUpdateFlag";
|
|
2
2
|
import { Component } from "../Component";
|
|
3
3
|
import { ColliderShape } from "./shape/ColliderShape";
|
|
4
|
+
import { ICustomClone } from "../clone/ComponentCloner";
|
|
4
5
|
/**
|
|
5
6
|
* Base class for all colliders.
|
|
6
7
|
* @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
|
|
7
8
|
*/
|
|
8
|
-
export declare class Collider extends Component {
|
|
9
|
+
export declare class Collider extends Component implements ICustomClone {
|
|
9
10
|
protected _updateFlag: BoolUpdateFlag;
|
|
10
11
|
protected _shapes: ColliderShape[];
|
|
11
12
|
/**
|
|
@@ -26,4 +27,5 @@ export declare class Collider extends Component {
|
|
|
26
27
|
* Remove all shape attached.
|
|
27
28
|
*/
|
|
28
29
|
clearShapes(): void;
|
|
30
|
+
protected _addPhysicsShape(shape: ColliderShape): void;
|
|
29
31
|
}
|
|
@@ -9,7 +9,6 @@ export declare class PhysicsManager {
|
|
|
9
9
|
private static _collision;
|
|
10
10
|
private _engine;
|
|
11
11
|
private _restTime;
|
|
12
|
-
private _fixedTimeStep;
|
|
13
12
|
private _colliders;
|
|
14
13
|
private _gravity;
|
|
15
14
|
private _nativePhysicsManager;
|
|
@@ -20,14 +19,13 @@ export declare class PhysicsManager {
|
|
|
20
19
|
private _onTriggerEnter;
|
|
21
20
|
private _onTriggerExit;
|
|
22
21
|
private _onTriggerStay;
|
|
22
|
+
/** The fixed time step in seconds at which physics are performed. */
|
|
23
|
+
fixedTimeStep: number;
|
|
23
24
|
/**
|
|
24
25
|
* The gravity of physics scene.
|
|
25
26
|
*/
|
|
26
27
|
get gravity(): Vector3;
|
|
27
28
|
set gravity(value: Vector3);
|
|
28
|
-
/** The fixed time step in seconds at which physics are performed. */
|
|
29
|
-
get fixedTimeStep(): number;
|
|
30
|
-
set fixedTimeStep(value: number);
|
|
31
29
|
constructor(engine: Engine);
|
|
32
30
|
/**
|
|
33
31
|
* Casts a ray through the Scene and returns the first hit.
|
|
@@ -28,7 +28,7 @@ export declare class HingeJoint extends Joint {
|
|
|
28
28
|
/**
|
|
29
29
|
* The angular velocity of the joint in degrees per second.
|
|
30
30
|
*/
|
|
31
|
-
get velocity(): Readonly<
|
|
31
|
+
get velocity(): Readonly<number>;
|
|
32
32
|
/**
|
|
33
33
|
* Enables the joint's limits. Disabled by default.
|
|
34
34
|
*/
|
|
@@ -3,13 +3,14 @@ import { Vector3 } from "@galacean/engine-math";
|
|
|
3
3
|
import { Component } from "../../Component";
|
|
4
4
|
import { Entity } from "../../Entity";
|
|
5
5
|
import { Collider } from "../Collider";
|
|
6
|
+
import { ICustomClone } from "../../clone/ComponentCloner";
|
|
6
7
|
/**
|
|
7
8
|
* A base class providing common functionality for joints.
|
|
8
9
|
* @decorator `@dependentComponents(Collider, DependentMode.CheckOnly)`
|
|
9
10
|
*/
|
|
10
|
-
export declare class Joint extends Component {
|
|
11
|
-
protected
|
|
12
|
-
protected
|
|
11
|
+
export declare class Joint extends Component implements ICustomClone {
|
|
12
|
+
protected _colliderInfo: JointColliderInfo;
|
|
13
|
+
protected _connectedColliderInfo: JointColliderInfo;
|
|
13
14
|
protected _nativeJoint: IJoint;
|
|
14
15
|
private _force;
|
|
15
16
|
private _torque;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PhysicsMaterial } from "../PhysicsMaterial";
|
|
2
2
|
import { Vector3 } from "@galacean/engine-math";
|
|
3
3
|
import { Collider } from "../Collider";
|
|
4
|
+
import { ICustomClone } from "../../clone/ComponentCloner";
|
|
4
5
|
/**
|
|
5
6
|
* Abstract class for collider shapes.
|
|
6
7
|
*/
|
|
7
|
-
export declare abstract class ColliderShape {
|
|
8
|
+
export declare abstract class ColliderShape implements ICustomClone {
|
|
8
9
|
private static _idGenerator;
|
|
9
10
|
protected _id: number;
|
|
10
11
|
protected _material: PhysicsMaterial;
|
package/types/shader/Shader.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class Shader {
|
|
|
19
19
|
* // Import shaderLab
|
|
20
20
|
* import { ShaderLab } from "@galacean/engine-shader-lab";
|
|
21
21
|
* // Create engine with shaderLab
|
|
22
|
-
* const engine = await WebGLEngine.create({ canvas: "canvas", new ShaderLab() });
|
|
22
|
+
* const engine = await WebGLEngine.create({ canvas: "canvas", shader: new ShaderLab() });
|
|
23
23
|
* ...
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IXRSession, IXRFeatureDescriptor, IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../Engine";
|
|
3
|
+
import { XRSessionType } from "./session/XRSessionType";
|
|
4
|
+
/**
|
|
5
|
+
* The interface of XR device.
|
|
6
|
+
*/
|
|
7
|
+
export interface IXRDevice {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the device is supported.
|
|
10
|
+
* @param mode - The mode of the session.
|
|
11
|
+
*/
|
|
12
|
+
isSupported(mode: XRSessionType): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the platform feature instance of this device
|
|
15
|
+
* @param engine - The engine.
|
|
16
|
+
* @param type - The type of the feature.
|
|
17
|
+
*/
|
|
18
|
+
createPlatformFeature(engine: Engine, type: number): IXRPlatformFeature;
|
|
19
|
+
/**
|
|
20
|
+
* Request a session.
|
|
21
|
+
* @param engine - The engine
|
|
22
|
+
* @param mode - The mode of the session
|
|
23
|
+
* @param requestFeatures - The requested features
|
|
24
|
+
*/
|
|
25
|
+
requestSession(engine: Engine, mode: XRSessionType, requestFeatures: IXRFeatureDescriptor[]): Promise<IXRSession>;
|
|
26
|
+
}
|
package/types/xr/XRManager.d.ts
CHANGED
|
@@ -1,31 +1,98 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { XRInputManager } from "./input/XRInputManager";
|
|
3
|
+
import { XRFeatureType } from "./feature/XRFeatureType";
|
|
4
|
+
import { XRSessionManager } from "./session/XRSessionManager";
|
|
5
|
+
import { XRSessionType } from "./session/XRSessionType";
|
|
6
|
+
import { XRFeatureManager } from "./feature/XRFeatureManager";
|
|
7
|
+
import { IXRDevice } from "./IXRDevice";
|
|
1
8
|
import { Engine } from "../Engine";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type FeatureConstructor = new (engine: Engine) => XRFeature;
|
|
9
|
+
import { Scene } from "../Scene";
|
|
10
|
+
import { Entity } from "../Entity";
|
|
11
|
+
type TXRFeatureManager = XRFeatureManager<IXRFeatureDescriptor, IXRPlatformFeature>;
|
|
12
|
+
type TXRFeatureManagerConstructor = new (engine: Engine) => TXRFeatureManager;
|
|
13
|
+
/**
|
|
14
|
+
* XRManager is the entry point of the XR system.
|
|
15
|
+
*/
|
|
10
16
|
export declare class XRManager {
|
|
17
|
+
/** Hardware adaptation for XR. */
|
|
18
|
+
xrDevice: IXRDevice;
|
|
19
|
+
/** Input manager for XR. */
|
|
20
|
+
inputManager: XRInputManager;
|
|
21
|
+
/** Session manager for XR. */
|
|
22
|
+
sessionManager: XRSessionManager;
|
|
11
23
|
private _engine;
|
|
12
|
-
private
|
|
24
|
+
private _scene;
|
|
25
|
+
private _origin;
|
|
13
26
|
private _features;
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
private _mode;
|
|
28
|
+
private _requestFeatures;
|
|
29
|
+
/**
|
|
30
|
+
* The current xr scene.
|
|
31
|
+
*/
|
|
32
|
+
get scene(): Scene;
|
|
33
|
+
set scene(value: Scene);
|
|
34
|
+
/**
|
|
35
|
+
* The current xr origin.
|
|
36
|
+
*/
|
|
37
|
+
get origin(): Entity;
|
|
38
|
+
set origin(value: Entity);
|
|
39
|
+
/**
|
|
40
|
+
* The current session mode( AR or VR ).
|
|
41
|
+
*/
|
|
42
|
+
get mode(): XRSessionType;
|
|
43
|
+
/**
|
|
44
|
+
* The requested features.
|
|
45
|
+
*/
|
|
46
|
+
get requestFeatures(): IXRFeatureDescriptor[];
|
|
47
|
+
/**
|
|
48
|
+
* Check if the specified mode is supported.
|
|
49
|
+
* @param mode - The mode to check
|
|
50
|
+
* @returns A promise that resolves if the mode is supported, otherwise rejects
|
|
51
|
+
*/
|
|
52
|
+
isSupported(mode: XRSessionType): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Check if the specified feature is supported.
|
|
55
|
+
* @param descriptors - The feature descriptor to check
|
|
56
|
+
* @returns A promise that resolves if the feature is supported, otherwise rejects
|
|
57
|
+
*/
|
|
58
|
+
isSupportedFeature(descriptors: IXRFeatureDescriptor | IXRFeatureDescriptor[]): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Disable all features.
|
|
61
|
+
*/
|
|
62
|
+
disableAllFeatures(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get the feature instance.
|
|
65
|
+
* @param type - The type of feature
|
|
66
|
+
* @returns The feature instance
|
|
67
|
+
*/
|
|
68
|
+
getFeature<T extends XRFeatureManager>(type: XRFeatureType): T;
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the session.
|
|
71
|
+
* @param mode - The mode of the session
|
|
72
|
+
* @param requestFeatures - The requested features
|
|
73
|
+
* @returns A promise that resolves if the session is initialized, otherwise rejects
|
|
74
|
+
*/
|
|
75
|
+
initSession(mode: XRSessionType, requestFeatures?: IXRFeatureDescriptor[]): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Destroy the session.
|
|
78
|
+
* @returns A promise that resolves if the session is destroyed, otherwise rejects
|
|
79
|
+
*/
|
|
80
|
+
destroySession(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Start the session.
|
|
83
|
+
* @returns A promise that resolves if the session is started, otherwise rejects
|
|
84
|
+
*/
|
|
85
|
+
startSession(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Stop the session.
|
|
88
|
+
* @returns A promise that resolves if the session is stopped, otherwise rejects
|
|
89
|
+
*/
|
|
90
|
+
stopSession(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Destroy xr module.
|
|
93
|
+
*/
|
|
27
94
|
destroy(): void;
|
|
28
|
-
constructor(engine: Engine,
|
|
95
|
+
constructor(engine: Engine, xrDevice: IXRDevice);
|
|
29
96
|
}
|
|
30
|
-
export declare function
|
|
97
|
+
export declare function registerXRFeatureManager(feature: XRFeatureType): (featureManagerConstructor: TXRFeatureManagerConstructor) => void;
|
|
31
98
|
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRFeatureManager, IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../../Engine";
|
|
3
|
+
/**
|
|
4
|
+
* The base class of XR feature manager.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class XRFeatureManager<TDescriptor extends IXRFeatureDescriptor = IXRFeatureDescriptor, TPlatformFeature extends IXRPlatformFeature = IXRPlatformFeature> implements IXRFeatureManager {
|
|
7
|
+
protected _engine: Engine;
|
|
8
|
+
_platformFeature: TPlatformFeature;
|
|
9
|
+
protected _descriptor: TDescriptor;
|
|
10
|
+
protected _enabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Return the descriptor of the feature.
|
|
13
|
+
*/
|
|
14
|
+
get descriptor(): TDescriptor;
|
|
15
|
+
set descriptor(value: TDescriptor);
|
|
16
|
+
/**
|
|
17
|
+
* Returns whether the feature is enabled.
|
|
18
|
+
*/
|
|
19
|
+
get enabled(): boolean;
|
|
20
|
+
set enabled(value: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* Returns whether the feature is supported.
|
|
23
|
+
* @param descriptor - The descriptor of the feature
|
|
24
|
+
* @returns The promise of the feature
|
|
25
|
+
*/
|
|
26
|
+
isSupported(descriptor?: IXRFeatureDescriptor): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize the feature.
|
|
29
|
+
* @returns The promise of the feature
|
|
30
|
+
*/
|
|
31
|
+
initialize(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Called when be enabled.
|
|
34
|
+
*/
|
|
35
|
+
onEnable(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when be disabled.
|
|
38
|
+
*/
|
|
39
|
+
onDisable(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Called when xr frame is updated.
|
|
42
|
+
*/
|
|
43
|
+
onUpdate(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when the session is initialized.
|
|
46
|
+
*/
|
|
47
|
+
onSessionInit(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when session starts.
|
|
50
|
+
*/
|
|
51
|
+
onSessionStart(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Called when the session is stopped.
|
|
54
|
+
*/
|
|
55
|
+
onSessionStop(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Called when the session is destroyed.
|
|
58
|
+
*/
|
|
59
|
+
onSessionDestroy(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Called when the xr module is destroyed.
|
|
62
|
+
*/
|
|
63
|
+
onDestroy(): void;
|
|
64
|
+
constructor(_engine: Engine);
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for XR feature type.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRFeatureType {
|
|
5
|
+
/** Movement tracking */
|
|
6
|
+
MovementTracking = 0,
|
|
7
|
+
/** Control camera parameters such as focal length, etc.*/
|
|
8
|
+
CameraDevice = 1,
|
|
9
|
+
/** Anchor tracking */
|
|
10
|
+
AnchorTracking = 2,
|
|
11
|
+
/** Image tracking */
|
|
12
|
+
ImageTracking = 3,
|
|
13
|
+
/** Plane tracking */
|
|
14
|
+
PlaneTracking = 4,
|
|
15
|
+
/** Hit test */
|
|
16
|
+
HitTest = 5
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IXRPlatformFeature, IXRFeatureDescriptor } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../../Engine";
|
|
3
|
+
/**
|
|
4
|
+
* The base class of XR platform feature.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class XRPlatformFeature implements IXRPlatformFeature {
|
|
7
|
+
protected _engine: Engine;
|
|
8
|
+
constructor(engine: Engine);
|
|
9
|
+
_isSupported(descriptor: IXRFeatureDescriptor): Promise<void>;
|
|
10
|
+
_initialize(descriptor?: IXRFeatureDescriptor): Promise<void>;
|
|
11
|
+
_onUpdate(): void;
|
|
12
|
+
_onDestroy(): void;
|
|
13
|
+
_onSessionInit(): void;
|
|
14
|
+
_onSessionStart(): void;
|
|
15
|
+
_onSessionStop(): void;
|
|
16
|
+
_onSessionDestroy(): void;
|
|
17
|
+
}
|
package/types/xr/index.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
export { XRManager,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export { XRCamera } from "./data/XRCamera";
|
|
18
|
-
export { XRHandle } from "./data/XRHandle";
|
|
1
|
+
export { XRManager, registerXRFeatureManager } from "./XRManager";
|
|
2
|
+
export type { IXRDevice } from "./IXRDevice";
|
|
3
|
+
export { XRPlatformFeature } from "./feature/XRPlatformFeature";
|
|
4
|
+
export { XRFeatureType } from "./feature/XRFeatureType";
|
|
5
|
+
export { XRFeatureManager } from "./feature/XRFeatureManager";
|
|
6
|
+
export { XRTrackingState } from "./input/XRTrackingState";
|
|
7
|
+
export { XRInputManager } from "./input/XRInputManager";
|
|
8
|
+
export { XRInputButton } from "./input/XRInputButton";
|
|
9
|
+
export { XRInputEvent } from "./input/XRInputEvent";
|
|
10
|
+
export { XRController } from "./input/XRController";
|
|
11
|
+
export { XRInputType } from "./input/XRInputType";
|
|
12
|
+
export { XRCamera } from "./input/XRCamera";
|
|
13
|
+
export { XRTrackedUpdateFlag } from "./input/XRTrackedUpdateFlag";
|
|
14
|
+
export { XRSessionManager } from "./session/XRSessionManager";
|
|
15
|
+
export { XRSessionType } from "./session/XRSessionType";
|
|
16
|
+
export { XRSessionState } from "./session/XRSessionState";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Matrix, Rect } from "@galacean/engine-math";
|
|
2
|
+
import { Camera } from "../../Camera";
|
|
3
|
+
import { IXRInput, IXRPose } from "@galacean/engine-design";
|
|
4
|
+
import { XRInputType } from "./XRInputType";
|
|
5
|
+
import { XRTrackingState } from "./XRTrackingState";
|
|
6
|
+
/**
|
|
7
|
+
* The XR camera.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRCamera implements IXRInput {
|
|
10
|
+
type: XRInputType;
|
|
11
|
+
/** The update frame count of xr input. */
|
|
12
|
+
frameCount: number;
|
|
13
|
+
/** The tracking state of xr input. */
|
|
14
|
+
trackingState: XRTrackingState;
|
|
15
|
+
/** The viewport of the camera. */
|
|
16
|
+
viewport: Rect;
|
|
17
|
+
/** The projection matrix of the camera. */
|
|
18
|
+
projectionMatrix: Matrix;
|
|
19
|
+
/** The associated virtual camera. */
|
|
20
|
+
camera: Camera;
|
|
21
|
+
/** The pose of the input. */
|
|
22
|
+
protected _pose: IXRPose;
|
|
23
|
+
/**
|
|
24
|
+
* Return the pose of the input.
|
|
25
|
+
*/
|
|
26
|
+
get pose(): IXRPose;
|
|
27
|
+
constructor(type: XRInputType);
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { XRControllerPoseMode } from "./XRControllerPoseMode";
|
|
2
|
+
import { DisorderedArray } from "../../DisorderedArray";
|
|
3
|
+
import { IXRInput, IXRPose } from "@galacean/engine-design";
|
|
4
|
+
import { XRInputButton } from "./XRInputButton";
|
|
5
|
+
import { XRInputType } from "./XRInputType";
|
|
6
|
+
import { XRTrackingState } from "./XRTrackingState";
|
|
7
|
+
/**
|
|
8
|
+
* The XR controller.
|
|
9
|
+
*/
|
|
10
|
+
export declare class XRController implements IXRInput {
|
|
11
|
+
type: XRInputType;
|
|
12
|
+
/** The update frame count of xr input. */
|
|
13
|
+
frameCount: number;
|
|
14
|
+
/** The tracking state of xr input. */
|
|
15
|
+
trackingState: XRTrackingState;
|
|
16
|
+
/** The currently pressed buttons of this controller. */
|
|
17
|
+
pressedButtons: XRInputButton;
|
|
18
|
+
/** Record button lifted. */
|
|
19
|
+
upMap: number[];
|
|
20
|
+
/** Record button pressed. */
|
|
21
|
+
downMap: number[];
|
|
22
|
+
/** Record button lifted in the current frame. */
|
|
23
|
+
upList: DisorderedArray<XRInputButton>;
|
|
24
|
+
/** Record button pressed in the current frame. */
|
|
25
|
+
downList: DisorderedArray<XRInputButton>;
|
|
26
|
+
/** the pose mode of the controller. (Default is Grip) */
|
|
27
|
+
poseMode: XRControllerPoseMode;
|
|
28
|
+
/** The grip space pose of the controller. */
|
|
29
|
+
gripPose: IXRPose;
|
|
30
|
+
/** The target ray space pose of the controller. */
|
|
31
|
+
targetRayPose: IXRPose;
|
|
32
|
+
protected _pose: IXRPose;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the pose of the controller.
|
|
35
|
+
*/
|
|
36
|
+
get pose(): IXRPose;
|
|
37
|
+
constructor(type: XRInputType);
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for XR input button.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRInputButton {
|
|
5
|
+
/** None */
|
|
6
|
+
None = 0,
|
|
7
|
+
/** Select */
|
|
8
|
+
Select = 1,
|
|
9
|
+
/** Select */
|
|
10
|
+
Trigger = 1,
|
|
11
|
+
/** Squeeze */
|
|
12
|
+
Squeeze = 2,
|
|
13
|
+
/** TouchPad */
|
|
14
|
+
TouchPad = 4,
|
|
15
|
+
/** A */
|
|
16
|
+
AButton = 8,
|
|
17
|
+
/** B */
|
|
18
|
+
BButton = 16
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { XRInputType } from "./XRInputType";
|
|
2
|
+
/**
|
|
3
|
+
* XR interaction events.
|
|
4
|
+
*/
|
|
5
|
+
export declare class XRInputEvent {
|
|
6
|
+
/**
|
|
7
|
+
* TargetRayMode indicates the method by which the target ray for
|
|
8
|
+
* the input source should be generated and how it should be presented to the user.
|
|
9
|
+
*/
|
|
10
|
+
targetRayMode: "gaze" | "tracked-pointer" | "screen";
|
|
11
|
+
/** The type of input event. */
|
|
12
|
+
type: "select" | "selectend" | "selectstart" | "squeeze" | "squeezeend" | "squeezestart";
|
|
13
|
+
/** The type of input. */
|
|
14
|
+
input: XRInputType;
|
|
15
|
+
/** The unique ID of the touch point. (Appears only when targetRayMode is screen.)*/
|
|
16
|
+
id?: number;
|
|
17
|
+
/** The coordinate x on the screen. (Appears only when targetRayMode is screen.)*/
|
|
18
|
+
x?: number;
|
|
19
|
+
/** The coordinate y on the screen. (Appears only when targetRayMode is screen.) */
|
|
20
|
+
y?: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IXRInput, IXRSession } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../../Engine";
|
|
3
|
+
import { XRController } from "./XRController";
|
|
4
|
+
import { XRInputType } from "./XRInputType";
|
|
5
|
+
import { UpdateFlagManager } from "../../UpdateFlagManager";
|
|
6
|
+
import { XRTrackingState } from "./XRTrackingState";
|
|
7
|
+
import { XRTrackedUpdateFlag } from "./XRTrackedUpdateFlag";
|
|
8
|
+
/**
|
|
9
|
+
* The manager of XR input.
|
|
10
|
+
*/
|
|
11
|
+
export declare class XRInputManager {
|
|
12
|
+
protected _engine: Engine;
|
|
13
|
+
protected _session: IXRSession;
|
|
14
|
+
protected _inputs: IXRInput[];
|
|
15
|
+
protected _controllers: XRController[];
|
|
16
|
+
protected _added: IXRInput[];
|
|
17
|
+
protected _updated: IXRInput[];
|
|
18
|
+
protected _removed: IXRInput[];
|
|
19
|
+
protected _statusSnapshot: XRTrackingState[];
|
|
20
|
+
protected _trackingUpdate: UpdateFlagManager;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the input instance.
|
|
23
|
+
* @param type - The input type
|
|
24
|
+
* @returns The input instance
|
|
25
|
+
*/
|
|
26
|
+
getInput<T extends IXRInput>(type: XRInputType): T;
|
|
27
|
+
/**
|
|
28
|
+
* Add a listener to the input update event.
|
|
29
|
+
* @param listener - The listener to add
|
|
30
|
+
*/
|
|
31
|
+
addListener(listener: (type: XRTrackedUpdateFlag, param: readonly IXRInput[]) => any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Remove a listener from the input update event.
|
|
34
|
+
* @param listener - The listener to remove
|
|
35
|
+
*/
|
|
36
|
+
removeListener(listener: (type: XRTrackedUpdateFlag, param: readonly IXRInput[]) => any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Returns whether the button is pressed.
|
|
39
|
+
* @param button - The button to check
|
|
40
|
+
* @returns Whether the button is pressed
|
|
41
|
+
*/
|
|
42
|
+
isButtonDown(button: number, out: XRController[]): XRController[];
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether the button is lifted.
|
|
45
|
+
* @param button - The button to check
|
|
46
|
+
* @returns Whether the button is lifted
|
|
47
|
+
*/
|
|
48
|
+
isButtonUp(button: number, out: XRController[]): XRController[];
|
|
49
|
+
/**
|
|
50
|
+
* Returns whether the button is held down.
|
|
51
|
+
* @param button - The button to check
|
|
52
|
+
* @returns Whether the button is held down
|
|
53
|
+
*/
|
|
54
|
+
isButtonHeldDown(button: number, out: XRController[]): XRController[];
|
|
55
|
+
constructor(engine: Engine);
|
|
56
|
+
private _handleEvent;
|
|
57
|
+
private _makeUpPointerEvent;
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for XR input type.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRInputType {
|
|
5
|
+
/** Controller */
|
|
6
|
+
Controller = 0,
|
|
7
|
+
/** Left controller */
|
|
8
|
+
LeftController = 1,
|
|
9
|
+
/** Right controller */
|
|
10
|
+
RightController = 2,
|
|
11
|
+
/** Camera */
|
|
12
|
+
Camera = 3,
|
|
13
|
+
/** Left camera */
|
|
14
|
+
LeftCamera = 4,
|
|
15
|
+
/** Right camera */
|
|
16
|
+
RightCamera = 5,
|
|
17
|
+
/** Head */
|
|
18
|
+
LeftHand = 6,
|
|
19
|
+
/** Right hand */
|
|
20
|
+
RightHand = 7,
|
|
21
|
+
/** Length of input type */
|
|
22
|
+
Length = 8
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for XR tracked update flag.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRTrackedUpdateFlag {
|
|
5
|
+
/** The object that was not tracked in the previous frame was tracked in this frame. */
|
|
6
|
+
Added = 0,
|
|
7
|
+
/** Both the previous frame and this frame are tracked */
|
|
8
|
+
Updated = 1,
|
|
9
|
+
/** The object that was tracked in the previous frame is not tracked in this frame. */
|
|
10
|
+
Removed = 2
|
|
11
|
+
}
|