@galacean/engine-core 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.
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/animation/AnimatorLayerMask.d.ts +45 -0
- package/types/animation/LayerPathMask.d.ts +16 -0
- package/types/xr/XRManager.d.ts +30 -34
- package/types/xr/feature/XRFeature.d.ts +60 -0
- package/types/xr/feature/XRFeatureManager.d.ts +4 -4
- package/types/xr/feature/XRFeatureType.d.ts +4 -6
- package/types/xr/feature/camera/XRCameraManager.d.ts +34 -0
- package/types/xr/feature/hitTest/TrackableType.d.ts +12 -0
- package/types/xr/feature/hitTest/XRHitTest.d.ts +41 -0
- package/types/xr/feature/hitTest/XRHitTestManager.d.ts +38 -0
- package/types/xr/feature/hitTest/XRHitTestType.d.ts +16 -0
- package/types/xr/feature/movementTracking/XRMovementTracking.d.ts +18 -0
- package/types/xr/feature/movementTracking/XRMovementTrackingManager.d.ts +10 -0
- package/types/xr/feature/movementTracking/XRMovementTrackingMode.d.ts +5 -0
- package/types/xr/feature/trackable/XRRequestTrackingState.d.ts +11 -0
- package/types/xr/feature/trackable/XRTrackableFeature.d.ts +44 -0
- package/types/xr/feature/trackable/XRTrackableManager.d.ts +41 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTracking.d.ts +29 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTrackingManager.d.ts +20 -0
- package/types/xr/feature/trackable/image/XRImageTracking.d.ts +40 -0
- package/types/xr/feature/trackable/image/XRImageTrackingManager.d.ts +31 -0
- package/types/xr/feature/trackable/image/XRReferenceImage.d.ts +11 -0
- package/types/xr/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
- package/types/xr/feature/trackable/plane/XRPlaneTracking.d.ts +20 -0
- package/types/xr/feature/trackable/plane/XRPlaneTrackingManager.d.ts +11 -0
- package/types/xr/index.d.ts +16 -6
- package/types/xr/input/XRCamera.d.ts +0 -2
- package/types/xr/input/XRController.d.ts +0 -2
- package/types/xr/input/XRInputEvent.d.ts +6 -3
- package/types/xr/input/XRInputEventType.d.ts +11 -0
- package/types/xr/input/XRInputManager.d.ts +0 -1
- package/types/xr/input/XRTargetRayMode.d.ts +12 -0
- package/types/xr/session/XRSessionManager.d.ts +4 -23
- package/types/xr/session/XRSessionMode.d.ts +8 -0
- package/types/2d/data/RenderData2D.d.ts +0 -1
- package/types/RenderPipeline/MeshRenderData.d.ts +0 -17
- package/types/RenderPipeline/MeshRenderElement.d.ts +0 -19
- package/types/RenderPipeline/SpriteElement.d.ts +0 -15
- package/types/RenderPipeline/SpriteMaskElement.d.ts +0 -12
- package/types/RenderPipeline/TextRenderElement.d.ts +0 -8
- package/types/SafeLoopArray.d.ts +0 -37
- package/types/asset/IRefObject.d.ts +0 -2
- package/types/asset/RefObject.d.ts +0 -27
- package/types/base/Event.d.ts +0 -24
- package/types/base/Util.d.ts +0 -14
- package/types/enums/DepthMode.d.ts +0 -8
- package/types/particle/ParticleData.d.ts +0 -1
- package/types/particle/ParticleMesh.d.ts +0 -289
- package/types/particle/ParticleShaderDeclaration.d.ts +0 -1
- package/types/particle/enum/ParticleAnimationRowMode.d.ts +0 -9
- package/types/particle/enum/ParticleAnimationType.d.ts +0 -9
- package/types/particle/enum/ParticleCurveMode.d.ts +0 -13
- package/types/particle/enum/ParticleGradientMode.d.ts +0 -13
- package/types/particle/enum/ParticleRenderMode.d.ts +0 -17
- package/types/particle/enum/ParticleScaleMode.d.ts +0 -11
- package/types/particle/enum/ParticleShapeMultiModeValue.d.ts +0 -9
- package/types/particle/enum/ParticleShapeType.d.ts +0 -15
- package/types/particle/enum/ParticleSimulationSpace.d.ts +0 -9
- package/types/particle/enum/index.d.ts +0 -9
- package/types/particle/module/Burst.d.ts +0 -38
- package/types/particle/module/ColorGradient.d.ts +0 -75
- package/types/particle/module/ColorOverLifetimeModule.d.ts +0 -20
- package/types/particle/module/EmissionModule.d.ts +0 -63
- package/types/particle/module/FrameOverTime.d.ts +0 -73
- package/types/particle/module/ParticleCurve.d.ts +0 -37
- package/types/particle/module/RotationOverLifetimeModule.d.ts +0 -21
- package/types/particle/module/RotationVelocityGradient.d.ts +0 -184
- package/types/particle/module/SizeGradient.d.ts +0 -151
- package/types/particle/module/SizeOverLifetimeModule.d.ts +0 -21
- package/types/particle/module/StartFrame.d.ts +0 -46
- package/types/particle/module/TextureSheetAnimationModule.d.ts +0 -37
- package/types/particle/module/VelocityGradient.d.ts +0 -110
- package/types/particle/module/VelocityOverLifetimeModule.d.ts +0 -22
- package/types/particle/module/index.d.ts +0 -15
- package/types/particle/module/shape/BaseShape.d.ts +0 -23
- package/types/particle/module/shape/BoxShape.d.ts +0 -12
- package/types/particle/module/shape/CircleShape.d.ts +0 -19
- package/types/particle/module/shape/ConeShape.d.ts +0 -27
- package/types/particle/module/shape/HemisphereShape.d.ts +0 -15
- package/types/particle/module/shape/ShapeUtils.d.ts +0 -1
- package/types/particle/module/shape/SphereShape.d.ts +0 -15
- package/types/particle/module/shape/index.d.ts +0 -5
- package/types/particle/moudules/Burst.d.ts +0 -33
- package/types/particle/moudules/Emission.d.ts +0 -63
- package/types/particle/moudules/ParticleCurve.d.ts +0 -11
- package/types/physics/PhysicsManager.d.ts +0 -76
- package/types/shadow/PipelinePass.d.ts +0 -16
- package/types/xr/IXRDevice.d.ts +0 -26
- package/types/xr/feature/XRPlatformFeature.d.ts +0 -17
- package/types/xr/session/XRSessionType.d.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-core",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"types/**/*"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@galacean/engine-math": "1.1.0-beta.
|
|
18
|
+
"@galacean/engine-math": "1.1.0-beta.23"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@galacean/engine-design": "1.1.0-beta.
|
|
21
|
+
"@galacean/engine-design": "1.1.0-beta.23"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Entity } from "../Entity";
|
|
2
|
+
import { LayerPathMask } from "./LayerPathMask";
|
|
3
|
+
/**
|
|
4
|
+
* AnimatorLayerMask is used to mask out certain entities from being animated by an AnimatorLayer.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AnimatorLayerMask {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an AnimatorLayerMask instance by specifying an entity.
|
|
9
|
+
* This will automatically add path masks for the entity and all its children.
|
|
10
|
+
* @param entity - The root entity to create path masks for
|
|
11
|
+
*/
|
|
12
|
+
static createByEntity(entity: Entity): AnimatorLayerMask;
|
|
13
|
+
private static _addPathMaskWithChildren;
|
|
14
|
+
private _pathMasks;
|
|
15
|
+
private _pathMaskMap;
|
|
16
|
+
/**
|
|
17
|
+
* The list of path masks.
|
|
18
|
+
*/
|
|
19
|
+
get pathMasks(): Readonly<LayerPathMask[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Adds a path mask to the AnimatorLayerMask, the root path is "".
|
|
22
|
+
* @param path - The path to add a mask for
|
|
23
|
+
* @returns The created or existing LayerPathMask
|
|
24
|
+
*/
|
|
25
|
+
addPathMask(path: string): LayerPathMask;
|
|
26
|
+
/**
|
|
27
|
+
* Removes a path mask from the AnimatorLayerMask.
|
|
28
|
+
* @param path - The path of the mask to remove
|
|
29
|
+
*/
|
|
30
|
+
removePathMask(path: any): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get a path mask based on the given path.
|
|
33
|
+
* @param path - The path of the mask to get
|
|
34
|
+
* @returns The LayerPathMask for the given path
|
|
35
|
+
*/
|
|
36
|
+
getPathMask(path: string): LayerPathMask;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the active state of a path mask.
|
|
39
|
+
* If recursive is true, it also sets the active state of all child path masks.
|
|
40
|
+
* @param path - The path of the mask to modify
|
|
41
|
+
* @param active - The active state to set
|
|
42
|
+
* @param withChildren - Whether to apply the active state recursively to child paths
|
|
43
|
+
*/
|
|
44
|
+
setPathMaskActive(path: string, active: boolean, withChildren?: boolean): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LayerPathMask represents a mask for a specific entity in an animation layer.
|
|
3
|
+
* It is used to control the animation whether to be applied to the entity or not.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LayerPathMask {
|
|
6
|
+
/**
|
|
7
|
+
* It identifies a particular entity in the hierarchy.
|
|
8
|
+
* Example: "arm/left/hand" could be a path to the left hand of a character.
|
|
9
|
+
*/
|
|
10
|
+
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* The active property is indicating whether the animation at this path is active or not.
|
|
13
|
+
* When true, the animation for this path is applied; when false, the animation for this path is ignored.
|
|
14
|
+
*/
|
|
15
|
+
active: boolean;
|
|
16
|
+
}
|
package/types/xr/XRManager.d.ts
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import { IXRFeatureDescriptor, IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
1
|
import { XRInputManager } from "./input/XRInputManager";
|
|
3
|
-
import { XRFeatureType } from "./feature/XRFeatureType";
|
|
4
2
|
import { XRSessionManager } from "./session/XRSessionManager";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { XRCameraManager } from "./feature/camera/XRCameraManager";
|
|
4
|
+
import { XRSessionMode } from "./session/XRSessionMode";
|
|
5
|
+
import { XRFeature } from "./feature/XRFeature";
|
|
6
|
+
import { IXRDevice } from "@galacean/engine-design/src/xr/IXRDevice";
|
|
8
7
|
import { Engine } from "../Engine";
|
|
9
8
|
import { Scene } from "../Scene";
|
|
10
9
|
import { Entity } from "../Entity";
|
|
11
|
-
type
|
|
12
|
-
type TXRFeatureManagerConstructor = new (engine: Engine) => TXRFeatureManager;
|
|
10
|
+
type TConstructor<T extends new (engine: Engine, ...args: any[]) => XRFeature> = T extends new (engine: Engine, ...args: infer P) => XRFeature ? P : never;
|
|
13
11
|
/**
|
|
14
12
|
* XRManager is the entry point of the XR system.
|
|
15
13
|
*/
|
|
16
14
|
export declare class XRManager {
|
|
17
|
-
/** Hardware adaptation for XR. */
|
|
18
|
-
xrDevice: IXRDevice;
|
|
19
15
|
/** Input manager for XR. */
|
|
20
16
|
inputManager: XRInputManager;
|
|
21
17
|
/** Session manager for XR. */
|
|
22
18
|
sessionManager: XRSessionManager;
|
|
19
|
+
/** Camera manager for XR. */
|
|
20
|
+
cameraManager: XRCameraManager;
|
|
23
21
|
private _engine;
|
|
24
22
|
private _scene;
|
|
25
23
|
private _origin;
|
|
26
|
-
private _features;
|
|
27
24
|
private _mode;
|
|
28
|
-
private
|
|
25
|
+
private _features;
|
|
29
26
|
/**
|
|
30
27
|
* The current xr scene.
|
|
31
28
|
*/
|
|
@@ -39,60 +36,59 @@ export declare class XRManager {
|
|
|
39
36
|
/**
|
|
40
37
|
* The current session mode( AR or VR ).
|
|
41
38
|
*/
|
|
42
|
-
get mode():
|
|
43
|
-
/**
|
|
44
|
-
* The requested features.
|
|
45
|
-
*/
|
|
46
|
-
get requestFeatures(): IXRFeatureDescriptor[];
|
|
39
|
+
get mode(): XRSessionMode;
|
|
47
40
|
/**
|
|
48
41
|
* Check if the specified mode is supported.
|
|
49
42
|
* @param mode - The mode to check
|
|
50
43
|
* @returns A promise that resolves if the mode is supported, otherwise rejects
|
|
51
44
|
*/
|
|
52
|
-
|
|
45
|
+
isSupportedSessionMode(mode: XRSessionMode): Promise<void>;
|
|
53
46
|
/**
|
|
54
47
|
* Check if the specified feature is supported.
|
|
55
48
|
* @param descriptors - The feature descriptor to check
|
|
56
49
|
* @returns A promise that resolves if the feature is supported, otherwise rejects
|
|
57
50
|
*/
|
|
58
|
-
isSupportedFeature(
|
|
51
|
+
isSupportedFeature<T extends XRFeature>(type: new (engine: Engine) => T): Promise<void>;
|
|
59
52
|
/**
|
|
60
|
-
*
|
|
53
|
+
* Add feature based on the xr feature type.
|
|
54
|
+
* @param type - The type of the feature
|
|
55
|
+
* @returns The feature which has been added
|
|
61
56
|
*/
|
|
62
|
-
|
|
57
|
+
addFeature<T extends new (engine: Engine, ...args: any[]) => XRFeature>(type: T, ...constructor: TConstructor<T>): XRFeature | null;
|
|
63
58
|
/**
|
|
64
|
-
* Get the
|
|
65
|
-
* @param type - The type of feature
|
|
66
|
-
* @returns
|
|
59
|
+
* Get feature which match the type.
|
|
60
|
+
* @param type - The type of the feature
|
|
61
|
+
* @returns The feature which match type
|
|
67
62
|
*/
|
|
68
|
-
getFeature<T extends
|
|
63
|
+
getFeature<T extends XRFeature>(type: new (engine: Engine, ...args: any[]) => T): T | null;
|
|
64
|
+
/**
|
|
65
|
+
* Disable all features.
|
|
66
|
+
*/
|
|
67
|
+
disableAllFeatures(): void;
|
|
69
68
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
72
|
-
* @param requestFeatures - The requested features
|
|
73
|
-
* @returns A promise that resolves if the session is initialized, otherwise rejects
|
|
69
|
+
* Enter the session.
|
|
70
|
+
* @returns A promise that resolves if the session is entered, otherwise rejects
|
|
74
71
|
*/
|
|
75
|
-
|
|
72
|
+
enterXR(mode: XRSessionMode): Promise<void>;
|
|
76
73
|
/**
|
|
77
|
-
*
|
|
74
|
+
* Exit the session.
|
|
78
75
|
* @returns A promise that resolves if the session is destroyed, otherwise rejects
|
|
79
76
|
*/
|
|
80
|
-
|
|
77
|
+
exitXR(): Promise<void>;
|
|
81
78
|
/**
|
|
82
79
|
* Start the session.
|
|
83
80
|
* @returns A promise that resolves if the session is started, otherwise rejects
|
|
84
81
|
*/
|
|
85
|
-
|
|
82
|
+
run(): Promise<void>;
|
|
86
83
|
/**
|
|
87
84
|
* Stop the session.
|
|
88
85
|
* @returns A promise that resolves if the session is stopped, otherwise rejects
|
|
89
86
|
*/
|
|
90
|
-
|
|
87
|
+
stop(): Promise<void>;
|
|
91
88
|
/**
|
|
92
89
|
* Destroy xr module.
|
|
93
90
|
*/
|
|
94
91
|
destroy(): void;
|
|
95
92
|
constructor(engine: Engine, xrDevice: IXRDevice);
|
|
96
93
|
}
|
|
97
|
-
export declare function registerXRFeatureManager(feature: XRFeatureType): (featureManagerConstructor: TXRFeatureManagerConstructor) => void;
|
|
98
94
|
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IXRFeatureConfig, IXRFeature, IXRPlatformFeature, IXRSession, IXRFrame } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../../Engine";
|
|
3
|
+
/**
|
|
4
|
+
* The base class of XR feature manager.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class XRFeature<TConfig extends IXRFeatureConfig = IXRFeatureConfig, TFeature extends IXRPlatformFeature = IXRPlatformFeature> implements IXRFeature {
|
|
7
|
+
protected _engine: Engine;
|
|
8
|
+
_platformFeature: TFeature;
|
|
9
|
+
protected _enabled: boolean;
|
|
10
|
+
protected _config: TConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether the feature is enabled.
|
|
13
|
+
*/
|
|
14
|
+
get enabled(): boolean;
|
|
15
|
+
set enabled(value: boolean);
|
|
16
|
+
/**
|
|
17
|
+
* Returns whether the feature is supported.
|
|
18
|
+
* @returns The promise of the feature
|
|
19
|
+
*/
|
|
20
|
+
isSupported(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the feature.
|
|
23
|
+
* @returns The promise of the feature
|
|
24
|
+
*/
|
|
25
|
+
initialize(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Called when be enabled.
|
|
28
|
+
*/
|
|
29
|
+
onEnable(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Called when be disabled.
|
|
32
|
+
*/
|
|
33
|
+
onDisable(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Called when xr frame is updated.
|
|
36
|
+
* @param session - The xr session
|
|
37
|
+
* @param frame - The xr frame
|
|
38
|
+
*/
|
|
39
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
40
|
+
/**
|
|
41
|
+
* Called when the session is initialized.
|
|
42
|
+
*/
|
|
43
|
+
onSessionInit(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when session starts.
|
|
46
|
+
*/
|
|
47
|
+
onSessionStart(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when the session is stopped.
|
|
50
|
+
*/
|
|
51
|
+
onSessionStop(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Called when the session is destroyed.
|
|
54
|
+
*/
|
|
55
|
+
onSessionDestroy(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Called when the xr module is destroyed.
|
|
58
|
+
*/
|
|
59
|
+
onDestroy(): void;
|
|
60
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IXRFeatureDescriptor, IXRFeatureManager,
|
|
1
|
+
import { IXRFeatureDescriptor, IXRFeatureManager, IXRFeature, IXRSession, IXRFrame } from "@galacean/engine-design";
|
|
2
2
|
import { Engine } from "../../Engine";
|
|
3
3
|
/**
|
|
4
4
|
* The base class of XR feature manager.
|
|
5
5
|
*/
|
|
6
|
-
export declare abstract class XRFeatureManager<TDescriptor extends IXRFeatureDescriptor = IXRFeatureDescriptor,
|
|
6
|
+
export declare abstract class XRFeatureManager<TDescriptor extends IXRFeatureDescriptor = IXRFeatureDescriptor, TFeature extends IXRFeature = IXRFeature> implements IXRFeatureManager {
|
|
7
7
|
protected _engine: Engine;
|
|
8
|
-
_platformFeature:
|
|
8
|
+
_platformFeature: TFeature;
|
|
9
9
|
protected _descriptor: TDescriptor;
|
|
10
10
|
protected _enabled: boolean;
|
|
11
11
|
/**
|
|
@@ -40,7 +40,7 @@ export declare abstract class XRFeatureManager<TDescriptor extends IXRFeatureDes
|
|
|
40
40
|
/**
|
|
41
41
|
* Called when xr frame is updated.
|
|
42
42
|
*/
|
|
43
|
-
onUpdate(): void;
|
|
43
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
44
44
|
/**
|
|
45
45
|
* Called when the session is initialized.
|
|
46
46
|
*/
|
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
export declare enum XRFeatureType {
|
|
5
5
|
/** Movement tracking */
|
|
6
6
|
MovementTracking = 0,
|
|
7
|
-
/** Control camera parameters such as focal length, etc.*/
|
|
8
|
-
CameraDevice = 1,
|
|
9
7
|
/** Anchor tracking */
|
|
10
|
-
AnchorTracking =
|
|
8
|
+
AnchorTracking = 1,
|
|
11
9
|
/** Image tracking */
|
|
12
|
-
ImageTracking =
|
|
10
|
+
ImageTracking = 2,
|
|
13
11
|
/** Plane tracking */
|
|
14
|
-
PlaneTracking =
|
|
12
|
+
PlaneTracking = 3,
|
|
15
13
|
/** Hit test */
|
|
16
|
-
HitTest =
|
|
14
|
+
HitTest = 4
|
|
17
15
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Camera } from "../../../Camera";
|
|
2
|
+
import { Engine } from "../../../Engine";
|
|
3
|
+
import { XRInputType } from "../../input/XRInputType";
|
|
4
|
+
/**
|
|
5
|
+
* The manager of XR camera.
|
|
6
|
+
*/
|
|
7
|
+
export declare class XRCameraManager {
|
|
8
|
+
private _engine;
|
|
9
|
+
/**
|
|
10
|
+
* Attach the camera to the specified input type(Camera, LeftCamera or RightCamera).
|
|
11
|
+
* The camera entity need to be moved to the XROrigin entity.
|
|
12
|
+
* @param type - The input type
|
|
13
|
+
* @param camera - The camera to be attached
|
|
14
|
+
*/
|
|
15
|
+
attachCamera(type: XRInputType.Camera | XRInputType.LeftCamera | XRInputType.RightCamera, camera: Camera): void;
|
|
16
|
+
/**
|
|
17
|
+
* Detach the camera from the specified input type.
|
|
18
|
+
* @param type - The input type
|
|
19
|
+
* @returns The camera that was detached
|
|
20
|
+
*/
|
|
21
|
+
detachCamera(type: XRInputType.Camera | XRInputType.LeftCamera | XRInputType.RightCamera): Camera;
|
|
22
|
+
/**
|
|
23
|
+
* Get the camera by the specified input type.
|
|
24
|
+
* @param type - The input type
|
|
25
|
+
* @returns The camera
|
|
26
|
+
*/
|
|
27
|
+
getCameraByType(type: XRInputType.Camera | XRInputType.LeftCamera | XRInputType.RightCamera): Camera;
|
|
28
|
+
/**
|
|
29
|
+
* Return fixed foveation of the camera.
|
|
30
|
+
*/
|
|
31
|
+
get fixedFoveation(): number;
|
|
32
|
+
set fixedFoveation(value: number);
|
|
33
|
+
constructor(_engine: Engine);
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IXRHitResult } from "@galacean/engine-design";
|
|
2
|
+
import { TrackableType } from "./TrackableType";
|
|
3
|
+
import { Ray } from "@galacean/engine-math";
|
|
4
|
+
import { XRFeature } from "../XRFeature";
|
|
5
|
+
import { Engine } from "../../../Engine";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of XR hit test.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRHitTest extends XRFeature {
|
|
10
|
+
private _xrCameraManager;
|
|
11
|
+
private _tempRay;
|
|
12
|
+
private _tempVec2;
|
|
13
|
+
private _tempVec30;
|
|
14
|
+
private _tempVec31;
|
|
15
|
+
private _tempVec32;
|
|
16
|
+
private _tempVec33;
|
|
17
|
+
private _tempVec34;
|
|
18
|
+
private _tempVec35;
|
|
19
|
+
/**
|
|
20
|
+
* Hit test.
|
|
21
|
+
* @param ray - The ray to test
|
|
22
|
+
* @param type - The type of hit test
|
|
23
|
+
* @returns The hit result
|
|
24
|
+
*/
|
|
25
|
+
hitTest(ray: Ray, type: TrackableType): IXRHitResult[];
|
|
26
|
+
/**
|
|
27
|
+
* Screen hit test.
|
|
28
|
+
* @param x - The x coordinate of the screen point (normalized)
|
|
29
|
+
* @param y - The y coordinate of the screen point (normalized)
|
|
30
|
+
* @param type - The type of hit test
|
|
31
|
+
* @returns The hit result
|
|
32
|
+
*/
|
|
33
|
+
screenHitTest(x: number, y: number, type: TrackableType): IXRHitResult[];
|
|
34
|
+
private _hitTest;
|
|
35
|
+
/**
|
|
36
|
+
* @param engine - The engine
|
|
37
|
+
*/
|
|
38
|
+
constructor(engine: Engine);
|
|
39
|
+
private _hitTestPlane;
|
|
40
|
+
private _checkPointerWithinPlane;
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRHitResult } from "@galacean/engine-design";
|
|
2
|
+
import { XRHitTestType } from "./XRHitTestType";
|
|
3
|
+
import { Ray } from "@galacean/engine-math";
|
|
4
|
+
import { XRFeatureManager } from "../XRFeatureManager";
|
|
5
|
+
export declare class XRHitTestManager extends XRFeatureManager {
|
|
6
|
+
private _tempRay;
|
|
7
|
+
private _tempVec2;
|
|
8
|
+
private _tempVec30;
|
|
9
|
+
private _tempVec31;
|
|
10
|
+
private _tempVec32;
|
|
11
|
+
private _tempVec33;
|
|
12
|
+
private _tempVec34;
|
|
13
|
+
private _tempVec35;
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether the feature is supported.
|
|
16
|
+
* @param descriptor - The descriptor of the feature
|
|
17
|
+
* @returns The promise of the feature
|
|
18
|
+
*/
|
|
19
|
+
isSupported(descriptor?: IXRFeatureDescriptor): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Hit test.
|
|
22
|
+
* @param ray - The ray to test
|
|
23
|
+
* @param type - The type of hit test
|
|
24
|
+
* @returns The hit result
|
|
25
|
+
*/
|
|
26
|
+
hitTest(ray: Ray, type: XRHitTestType): IXRHitResult[];
|
|
27
|
+
/**
|
|
28
|
+
* Screen hit test.
|
|
29
|
+
* @param x - The x coordinate of the screen point (normalized)
|
|
30
|
+
* @param y - The y coordinate of the screen point (normalized)
|
|
31
|
+
* @param type - The type of hit test
|
|
32
|
+
* @returns The hit result
|
|
33
|
+
*/
|
|
34
|
+
screenHitTest(x: number, y: number, type: XRHitTestType): IXRHitResult[];
|
|
35
|
+
private _hitTest;
|
|
36
|
+
private _hitTestPlane;
|
|
37
|
+
private _checkPointerWithinPlane;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for the types of hit test that can be performed.
|
|
3
|
+
* Note: currently only supports plane.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum XRHitTestType {
|
|
6
|
+
/** None */
|
|
7
|
+
None = 0,
|
|
8
|
+
/** Tracked plane. */
|
|
9
|
+
Plane = 1,
|
|
10
|
+
/** Tracked mesh. */
|
|
11
|
+
Mesh = 2,
|
|
12
|
+
/** Tracked anchor. */
|
|
13
|
+
Anchor = 4,
|
|
14
|
+
/** All tracked objects. */
|
|
15
|
+
All = 7
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IXRMovementTracking, IXRMovementTrackingConfig } from "@galacean/engine-design";
|
|
2
|
+
import { XRMovementTrackingMode } from "./XRMovementTrackingMode";
|
|
3
|
+
import { XRFeature } from "../XRFeature";
|
|
4
|
+
import { Engine } from "../../../Engine";
|
|
5
|
+
/**
|
|
6
|
+
* The manager of XR movement tracking.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRMovementTracking extends XRFeature<IXRMovementTrackingConfig, IXRMovementTracking> {
|
|
9
|
+
/**
|
|
10
|
+
* Get the tracking mode.
|
|
11
|
+
*/
|
|
12
|
+
get trackingMode(): XRMovementTrackingMode;
|
|
13
|
+
/**
|
|
14
|
+
* @param engine - The engine
|
|
15
|
+
* @param trackingMode - The tracking mode
|
|
16
|
+
*/
|
|
17
|
+
constructor(engine: Engine, trackingMode?: XRMovementTrackingMode);
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IXRMovementTracking, IXRMovementTrackingDescriptor } from "@galacean/engine-design";
|
|
2
|
+
import { XRMovementTrackingMode } from "./XRMovementTrackingMode";
|
|
3
|
+
import { XRFeatureManager } from "../XRFeatureManager";
|
|
4
|
+
export declare class XRMovementTrackingManager extends XRFeatureManager<IXRMovementTrackingDescriptor, IXRMovementTracking> {
|
|
5
|
+
/**
|
|
6
|
+
* Get the tracking mode.
|
|
7
|
+
*/
|
|
8
|
+
get trackingMode(): XRMovementTrackingMode;
|
|
9
|
+
set trackingMode(value: XRMovementTrackingMode);
|
|
10
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IXRFrame, IXRSession, IXRTracked, IXRFeatureConfig, IXRRequestTracking, IXRTrackableFeature } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackedUpdateFlag } from "../../input/XRTrackedUpdateFlag";
|
|
3
|
+
import { XRFeature } from "../XRFeature";
|
|
4
|
+
import { XRTrackingState } from "../../input/XRTrackingState";
|
|
5
|
+
import { XRSessionManager } from "../../session/XRSessionManager";
|
|
6
|
+
/**
|
|
7
|
+
* The base class of XR trackable manager.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class XRTrackableFeature<TDescriptor extends IXRFeatureConfig, TXRTracked extends IXRTracked, TXRRequestTracking extends IXRRequestTracking<TXRTracked>, TTrackableFeature extends IXRTrackableFeature<TXRTracked, TXRRequestTracking>> extends XRFeature<TDescriptor, TTrackableFeature> {
|
|
10
|
+
protected _sessionManager: XRSessionManager;
|
|
11
|
+
protected _requestTrackings: TXRRequestTracking[];
|
|
12
|
+
protected _trackedObjects: TXRTracked[];
|
|
13
|
+
protected _added: TXRTracked[];
|
|
14
|
+
protected _updated: TXRTracked[];
|
|
15
|
+
protected _removed: TXRTracked[];
|
|
16
|
+
protected _statusSnapshot: Record<number, XRTrackingState>;
|
|
17
|
+
private _trackedUpdateFlag;
|
|
18
|
+
/**
|
|
19
|
+
* Return Request tracking requirements.
|
|
20
|
+
*/
|
|
21
|
+
get requestTrackings(): readonly TXRRequestTracking[];
|
|
22
|
+
/**
|
|
23
|
+
* Returns the tracked objects.
|
|
24
|
+
*/
|
|
25
|
+
get trackedObjects(): readonly TXRTracked[];
|
|
26
|
+
/**
|
|
27
|
+
* Add a listening function to track changes.
|
|
28
|
+
* @param listener - The listening function
|
|
29
|
+
*/
|
|
30
|
+
addListener(listener: (type: XRTrackedUpdateFlag, param: readonly TXRTracked[]) => any): void;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a listening function to track changes.
|
|
33
|
+
* @param listener - The listening function
|
|
34
|
+
*/
|
|
35
|
+
removeListener(listener: (type: XRTrackedUpdateFlag, param: readonly TXRTracked[]) => any): void;
|
|
36
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
37
|
+
onSessionStop(): void;
|
|
38
|
+
onSessionDestroy(): void;
|
|
39
|
+
onDestroy(): void;
|
|
40
|
+
protected _addRequestTracking(requestTracking: TXRRequestTracking): void;
|
|
41
|
+
protected _removeRequestTracking(requestTracking: TXRRequestTracking): void;
|
|
42
|
+
protected _removeAllRequestTrackings(): void;
|
|
43
|
+
private _canModifyRequestTracking;
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRFrame, IXRRequestTracking, IXRSession, IXRTrackableFeature, IXRTracked } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackedUpdateFlag } from "../../input/XRTrackedUpdateFlag";
|
|
3
|
+
import { XRFeatureManager } from "../XRFeatureManager";
|
|
4
|
+
import { XRTrackingState } from "../../input/XRTrackingState";
|
|
5
|
+
/**
|
|
6
|
+
* The base class of XR trackable manager.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class XRTrackableManager<TDescriptor extends IXRFeatureDescriptor, TXRTracked extends IXRTracked, TXRRequestTracking extends IXRRequestTracking<TXRTracked>, TTrackableFeature extends IXRTrackableFeature<TXRTracked, TXRRequestTracking>> extends XRFeatureManager<TDescriptor, TTrackableFeature> {
|
|
9
|
+
protected _requestTrackings: TXRRequestTracking[];
|
|
10
|
+
protected _trackedObjects: TXRTracked[];
|
|
11
|
+
protected _added: TXRTracked[];
|
|
12
|
+
protected _updated: TXRTracked[];
|
|
13
|
+
protected _removed: TXRTracked[];
|
|
14
|
+
protected _statusSnapshot: Record<number, XRTrackingState>;
|
|
15
|
+
private _trackedUpdateFlag;
|
|
16
|
+
/**
|
|
17
|
+
* Return Request tracking requirements.
|
|
18
|
+
*/
|
|
19
|
+
get requestTrackings(): readonly TXRRequestTracking[];
|
|
20
|
+
/**
|
|
21
|
+
* Returns the tracked objects.
|
|
22
|
+
*/
|
|
23
|
+
get trackedObjects(): readonly TXRTracked[];
|
|
24
|
+
addRequestTracking(requestTracking: TXRRequestTracking): void;
|
|
25
|
+
removeRequestTracking(remove: TXRRequestTracking): void;
|
|
26
|
+
removeAllRequestTrackings(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Add a listening function to track changes.
|
|
29
|
+
* @param listener - The listening function
|
|
30
|
+
*/
|
|
31
|
+
addListener(listener: (type: XRTrackedUpdateFlag, param: readonly TXRTracked[]) => any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Remove a listening function to track changes.
|
|
34
|
+
* @param listener - The listening function
|
|
35
|
+
*/
|
|
36
|
+
removeListener(listener: (type: XRTrackedUpdateFlag, param: readonly TXRTracked[]) => any): void;
|
|
37
|
+
onUpdate(session: IXRSession, frame: IXRFrame): void;
|
|
38
|
+
onSessionStop(): void;
|
|
39
|
+
onSessionDestroy(): void;
|
|
40
|
+
onDestroy(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IXRPose, IXRTracked, IXRAnchorTracking, IXRAnchorTrackingConfig, IXRRequestAnchorTracking } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackableFeature } from "../XRTrackableFeature";
|
|
3
|
+
import { Engine } from "../../../../Engine";
|
|
4
|
+
/**
|
|
5
|
+
* The manager of XR anchor tracking.
|
|
6
|
+
*/
|
|
7
|
+
export declare class XRAnchorTracking extends XRTrackableFeature<IXRAnchorTrackingConfig, IXRTracked, IXRRequestAnchorTracking, IXRAnchorTracking> {
|
|
8
|
+
/**
|
|
9
|
+
* Add a tracking anchor.
|
|
10
|
+
* @param pose - The pose of anchor to be added
|
|
11
|
+
*/
|
|
12
|
+
addAnchor(pose: IXRPose): IXRRequestAnchorTracking;
|
|
13
|
+
/**
|
|
14
|
+
* Remove a tracking anchor.
|
|
15
|
+
* @param anchor - The anchor to be removed
|
|
16
|
+
*/
|
|
17
|
+
removeAnchor(anchor: IXRRequestAnchorTracking): void;
|
|
18
|
+
/**
|
|
19
|
+
* Remove all tracking anchors.
|
|
20
|
+
*/
|
|
21
|
+
removeAllAnchors(): void;
|
|
22
|
+
/**
|
|
23
|
+
* @param engine - The engine
|
|
24
|
+
* @param anchors - The anchors to be tracked
|
|
25
|
+
*/
|
|
26
|
+
constructor(engine: Engine, anchors?: IXRPose[]);
|
|
27
|
+
_generateConfig(): IXRAnchorTrackingConfig;
|
|
28
|
+
private _createRequestTracking;
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IXRPose, IXRTracked, IXRAnchorTracking, IXRRequestAnchorTracking, IXRAnchorTrackingDescriptor } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackableManager } from "../XRTrackableManager";
|
|
3
|
+
export declare class XRAnchorTrackingManager extends XRTrackableManager<IXRAnchorTrackingDescriptor, IXRTracked, IXRRequestAnchorTracking, IXRAnchorTracking> {
|
|
4
|
+
/**
|
|
5
|
+
* Add a tracking anchor.
|
|
6
|
+
* @param pose - The pose of anchor to be added
|
|
7
|
+
*/
|
|
8
|
+
addAnchor(pose: IXRPose): IXRRequestAnchorTracking;
|
|
9
|
+
/**
|
|
10
|
+
* Remove a tracking anchor.
|
|
11
|
+
* @param anchor - The anchor to be removed
|
|
12
|
+
*/
|
|
13
|
+
removeAnchor(anchor: IXRRequestAnchorTracking): void;
|
|
14
|
+
/**
|
|
15
|
+
* Remove all tracking anchors.
|
|
16
|
+
*/
|
|
17
|
+
removeAllAnchors(): void;
|
|
18
|
+
initialize(): Promise<void>;
|
|
19
|
+
private _createRequestTracking;
|
|
20
|
+
}
|