@galacean/engine-core 1.1.0-beta.9 → 1.2.0-alpha.1
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 +17413 -16437
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +17413 -16437
- package/dist/module.js +20381 -19408
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +5 -0
- package/types/2d/enums/SpriteModifyFlags.d.ts +2 -1
- package/types/2d/text/TextRenderer.d.ts +1 -0
- package/types/Camera.d.ts +1 -1
- package/types/Canvas.d.ts +14 -5
- package/types/Component.d.ts +2 -0
- package/types/ComponentsManager.d.ts +3 -0
- package/types/DisorderedArray.d.ts +1 -0
- package/types/Engine.d.ts +6 -2
- package/types/Entity.d.ts +1 -0
- package/types/RenderPipeline/BasicRenderPipeline.d.ts +3 -1
- package/types/RenderPipeline/RenderQueue.d.ts +0 -7
- package/types/Scene.d.ts +9 -2
- package/types/SystemInfo.d.ts +2 -0
- package/types/Utils.d.ts +1 -0
- package/types/animation/AnimationClip.d.ts +32 -4
- package/types/animation/AnimationClipCurveBinding.d.ts +12 -2
- package/types/animation/AnimatorControllerLayer.d.ts +3 -0
- package/types/animation/AnimatorLayerMask.d.ts +45 -0
- package/types/animation/Keyframe.d.ts +1 -1
- package/types/animation/LayerPathMask.d.ts +16 -0
- package/types/animation/animationCurve/AnimationStringCurve.d.ts +7 -0
- package/types/animation/animationCurve/index.d.ts +1 -0
- package/types/animation/index.d.ts +1 -0
- package/types/asset/AssetPromise.d.ts +10 -4
- package/types/asset/ReferResource.d.ts +3 -2
- package/types/asset/ResourceManager.d.ts +0 -1
- package/types/index.d.ts +3 -1
- package/types/lighting/Light.d.ts +0 -1
- package/types/lighting/LightManager.d.ts +0 -1
- package/types/material/PBRMaterial.d.ts +23 -0
- package/types/mesh/PrimitiveMesh.d.ts +22 -0
- package/types/mesh/SkinnedMeshRenderer.d.ts +1 -1
- package/types/particle/modules/EmissionModule.d.ts +0 -1
- package/types/particle/modules/MainModule.d.ts +0 -1
- package/types/particle/modules/ParticleGradient.d.ts +38 -18
- package/types/renderingHardwareInterface/index.d.ts +0 -1
- package/types/shader/Shader.d.ts +16 -3
- package/types/xr/XRManager.d.ts +3 -29
- package/types/xr/XRPose.d.ts +15 -0
- package/types/xr/feature/XRFeature.d.ts +13 -26
- package/types/xr/feature/XRFeatureManager.d.ts +65 -0
- package/types/xr/feature/XRFeatureType.d.ts +13 -0
- package/types/xr/feature/camera/XRCameraManager.d.ts +26 -0
- package/types/xr/feature/hitTest/TrackableType.d.ts +10 -0
- package/types/xr/feature/hitTest/XRHitResult.d.ts +19 -0
- package/types/xr/feature/hitTest/XRHitTest.d.ts +39 -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 +38 -0
- package/types/xr/feature/trackable/XRTrackableManager.d.ts +41 -0
- package/types/xr/feature/trackable/anchor/XRAnchor.d.ts +6 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTracking.d.ts +37 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTrackingManager.d.ts +20 -0
- package/types/xr/feature/trackable/anchor/XRRequestAnchor.d.ts +15 -0
- package/types/xr/feature/trackable/image/XRImageTracking.d.ts +24 -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/image/XRRequestImage.d.ts +13 -0
- package/types/xr/feature/trackable/image/XRTrackedImage.d.ts +8 -0
- package/types/xr/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
- package/types/xr/feature/trackable/plane/XRPlaneTracking.d.ts +23 -0
- package/types/xr/feature/trackable/plane/XRPlaneTrackingManager.d.ts +11 -0
- package/types/xr/feature/trackable/plane/XRRequestPlane.d.ts +12 -0
- package/types/xr/feature/trackable/plane/XRTrackedPlane.d.ts +20 -0
- package/types/xr/index.d.ts +25 -18
- package/types/xr/input/XRCamera.d.ts +15 -0
- package/types/xr/input/XRController.d.ts +38 -0
- package/types/xr/input/XRControllerPoseMode.d.ts +9 -0
- package/types/xr/input/XRInput.d.ts +8 -0
- package/types/xr/input/XRInputButton.d.ts +19 -0
- package/types/xr/input/XRInputEvent.d.ts +24 -0
- package/types/xr/input/XRInputEventType.d.ts +11 -0
- package/types/xr/input/XRInputManager.d.ts +31 -0
- package/types/xr/input/XRInputType.d.ts +23 -0
- package/types/xr/input/XRTargetRayMode.d.ts +12 -0
- package/types/xr/input/XRTrackedInputDevice.d.ts +21 -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 +45 -0
- package/types/xr/session/XRSessionMode.d.ts +8 -0
- package/types/xr/session/XRSessionState.d.ts +13 -0
- package/types/RenderPipeline/MeshRenderElement.d.ts +0 -19
- package/types/RenderPipeline/RenderElementX.d.ts +0 -12
- 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/Ticker.d.ts +0 -30
- 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/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/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/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 -26
- package/types/particle/module/shape/BoxShape.d.ts +0 -20
- package/types/particle/module/shape/CircleShape.d.ts +0 -27
- package/types/particle/module/shape/ConeShape.d.ts +0 -35
- package/types/particle/module/shape/HemisphereShape.d.ts +0 -23
- package/types/particle/module/shape/ShapeUtils.d.ts +0 -1
- package/types/particle/module/shape/SphereShape.d.ts +0 -23
- package/types/particle/module/shape/index.d.ts +0 -5
- package/types/particle/modules/ShapeModule.d.ts +0 -9
- package/types/particle/modules/shape/enums/ParticleShapeMultiModeValue.d.ts +0 -9
- package/types/particle/moudules/Burst.d.ts +0 -25
- package/types/particle/moudules/Emission.d.ts +0 -47
- package/types/particle/moudules/EmissionModule.d.ts +0 -49
- package/types/particle/moudules/MainModule.d.ts +0 -59
- package/types/particle/moudules/ParticleCurve.d.ts +0 -27
- 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/shadow/PipelinePass.d.ts +0 -16
- 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/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
- /package/types/{2d/data/RenderData2D.d.ts → enums/CameraType.d.ts} +0 -0
- /package/types/{animation/internal/AnimationCurveOwnerLayerData.d.ts → xr/feature/trackable/XRRequestTracking.d.ts} +0 -0
- /package/types/{graphic/PrimitiveVertexBinding.d.ts → xr/feature/trackable/XRTracked.d.ts} +0 -0
|
@@ -54,7 +54,6 @@ export declare class MainModule implements ICustomClone {
|
|
|
54
54
|
scalingMode: ParticleScaleMode;
|
|
55
55
|
/** If set to true, the Particle Generator automatically begins to play on startup. */
|
|
56
56
|
playOnEnabled: boolean;
|
|
57
|
-
private _maxParticles;
|
|
58
57
|
private _generator;
|
|
59
58
|
private _gravity;
|
|
60
59
|
/**
|
|
@@ -63,32 +63,52 @@ export declare class ParticleGradient {
|
|
|
63
63
|
setKeys(colorKeys: GradientColorKey[], alphaKeys: GradientAlphaKey[]): void;
|
|
64
64
|
private _addKey;
|
|
65
65
|
private _removeKey;
|
|
66
|
+
private _setColorTypeArrayDirty;
|
|
67
|
+
private _setAlphaTypeArrayDirty;
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
70
|
* The color key of the particle gradient.
|
|
69
71
|
*/
|
|
70
72
|
export declare class GradientColorKey {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
time: number
|
|
78
|
-
/**
|
|
79
|
-
|
|
73
|
+
private _time;
|
|
74
|
+
private _color;
|
|
75
|
+
/**
|
|
76
|
+
* The key time.
|
|
77
|
+
*/
|
|
78
|
+
get time(): number;
|
|
79
|
+
set time(value: number);
|
|
80
|
+
/**
|
|
81
|
+
* The key color.
|
|
82
|
+
*/
|
|
83
|
+
get color(): Color;
|
|
84
|
+
set color(value: Color);
|
|
85
|
+
/**
|
|
86
|
+
* Constructor of GradientColorKey.
|
|
87
|
+
* @param time - The time of the gradient colorKey
|
|
88
|
+
* @param color - The alpha component of the gradient colorKey
|
|
89
|
+
*/
|
|
90
|
+
constructor(time: number, color: Color);
|
|
80
91
|
}
|
|
81
92
|
/**
|
|
82
93
|
* The alpha key of the particle gradient.
|
|
83
94
|
*/
|
|
84
95
|
export declare class GradientAlphaKey {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
time: number
|
|
92
|
-
/**
|
|
93
|
-
|
|
96
|
+
private _time;
|
|
97
|
+
private _alpha;
|
|
98
|
+
/**
|
|
99
|
+
* The key time.
|
|
100
|
+
*/
|
|
101
|
+
get time(): number;
|
|
102
|
+
set time(value: number);
|
|
103
|
+
/**
|
|
104
|
+
* The key alpha.
|
|
105
|
+
*/
|
|
106
|
+
get alpha(): number;
|
|
107
|
+
set alpha(value: number);
|
|
108
|
+
/**
|
|
109
|
+
* Constructor of GradientAlphaKey.
|
|
110
|
+
* @param time - The time of the gradient alpha key
|
|
111
|
+
* @param alpha - The alpha component of the gradient alpha key
|
|
112
|
+
*/
|
|
113
|
+
constructor(time: number, alpha: number);
|
|
94
114
|
}
|
package/types/shader/Shader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Engine } from "../Engine";
|
|
2
|
+
import { IReferable } from "../asset/IReferable";
|
|
2
3
|
import { ShaderMacro } from "./ShaderMacro";
|
|
3
4
|
import { ShaderPass } from "./ShaderPass";
|
|
4
5
|
import { ShaderProperty } from "./ShaderProperty";
|
|
@@ -6,7 +7,7 @@ import { SubShader } from "./SubShader";
|
|
|
6
7
|
/**
|
|
7
8
|
* Shader for rendering.
|
|
8
9
|
*/
|
|
9
|
-
export declare class Shader {
|
|
10
|
+
export declare class Shader implements IReferable {
|
|
10
11
|
readonly name: string;
|
|
11
12
|
private static _shaderMap;
|
|
12
13
|
/**
|
|
@@ -19,7 +20,7 @@ export declare class Shader {
|
|
|
19
20
|
* // Import shaderLab
|
|
20
21
|
* import { ShaderLab } from "@galacean/engine-shader-lab";
|
|
21
22
|
* // Create engine with shaderLab
|
|
22
|
-
* const engine = await WebGLEngine.create({ canvas: "canvas", new ShaderLab() });
|
|
23
|
+
* const engine = await WebGLEngine.create({ canvas: "canvas", shader: new ShaderLab() });
|
|
23
24
|
* ...
|
|
24
25
|
* ```
|
|
25
26
|
*
|
|
@@ -57,11 +58,18 @@ export declare class Shader {
|
|
|
57
58
|
* @param name - Name of the shader
|
|
58
59
|
*/
|
|
59
60
|
static find(name: string): Shader;
|
|
61
|
+
private static _applyConstRenderStates;
|
|
62
|
+
private _refCount;
|
|
63
|
+
private _destroyed;
|
|
60
64
|
private _subShaders;
|
|
61
65
|
/**
|
|
62
66
|
* Sub shaders of the shader.
|
|
63
67
|
*/
|
|
64
68
|
get subShaders(): ReadonlyArray<SubShader>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether it has been destroyed.
|
|
71
|
+
*/
|
|
72
|
+
get destroyed(): boolean;
|
|
65
73
|
private constructor();
|
|
66
74
|
/**
|
|
67
75
|
* Compile shader variant by macro name list.
|
|
@@ -74,7 +82,12 @@ export declare class Shader {
|
|
|
74
82
|
* @returns Is the compiled shader variant valid
|
|
75
83
|
*/
|
|
76
84
|
compileVariant(engine: Engine, macros: string[]): boolean;
|
|
77
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Destroy the shader.
|
|
87
|
+
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
88
|
+
* @returns Whether the release was successful.
|
|
89
|
+
*/
|
|
90
|
+
destroy(force?: boolean): boolean;
|
|
78
91
|
/**
|
|
79
92
|
* @deprecated Please use `ShaderMacro.getByName` instead
|
|
80
93
|
*
|
package/types/xr/XRManager.d.ts
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { EnumXRTrackingMode } from "./enum/EnumXRTrackingMode";
|
|
5
|
-
import { XRFeature } from "./feature/XRFeature";
|
|
6
|
-
import { EnumXRSubsystem } from "./enum/EnumXRSubsystem";
|
|
7
|
-
import { XRProvider } from "./provider/XRProvider";
|
|
8
|
-
import { XRSubsystem } from "./subsystem/XRSubsystem";
|
|
9
|
-
type FeatureConstructor = new (engine: Engine) => XRFeature;
|
|
1
|
+
/**
|
|
2
|
+
* XRManager located in the main package, its implementation logic is XRManagerExtended in the sub-package engine-xr.
|
|
3
|
+
*/
|
|
10
4
|
export declare class XRManager {
|
|
11
|
-
private _engine;
|
|
12
|
-
private _provider;
|
|
13
|
-
private _features;
|
|
14
|
-
private _subsystems;
|
|
15
|
-
private _isPaused;
|
|
16
|
-
isSupportedMode(mode: EnumXRMode): Promise<void>;
|
|
17
|
-
isSupportedTrackingMode(mode: EnumXRTrackingMode): Promise<void>;
|
|
18
|
-
isSupportedFeature(feature: EnumXRFeature): Promise<void>;
|
|
19
|
-
getFeature<T extends XRFeature>(feature: EnumXRFeature): T;
|
|
20
|
-
enableFeature(feature: EnumXRFeature): void;
|
|
21
|
-
disableFeature(feature: EnumXRFeature): void;
|
|
22
|
-
getSubsystem<T extends XRSubsystem>(subsystem: EnumXRSubsystem): T;
|
|
23
|
-
initialize(mode: EnumXRMode, trackingMode: EnumXRTrackingMode, requestFeatures?: EnumXRFeature[]): Promise<void>;
|
|
24
|
-
start(): Promise<void>;
|
|
25
|
-
pause(): void;
|
|
26
|
-
resume(): void;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
constructor(engine: Engine, type: new (engine: Engine) => XRProvider);
|
|
29
5
|
}
|
|
30
|
-
export declare function registerFeature(feature: EnumXRFeature, dependentSubsystem?: EnumXRSubsystem[]): (featureConstructor: FeatureConstructor) => void;
|
|
31
|
-
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IXRPose } from "@galacean/engine-design";
|
|
2
|
+
import { Matrix, Quaternion, Vector3 } from "@galacean/engine-math";
|
|
3
|
+
/**
|
|
4
|
+
* Data for describing pose in the XR space.
|
|
5
|
+
*/
|
|
6
|
+
export declare class XRPose implements IXRPose {
|
|
7
|
+
/** The position of the pose in XR space. */
|
|
8
|
+
position: Vector3;
|
|
9
|
+
/** The rotation of the pose in XR space. */
|
|
10
|
+
rotation: Quaternion;
|
|
11
|
+
/** The matrix of the pose in XR space. */
|
|
12
|
+
matrix: Matrix;
|
|
13
|
+
/** The inverse matrix of the pose in XR space. */
|
|
14
|
+
inverseMatrix: Matrix;
|
|
15
|
+
}
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { XRManager } from "../XRManager";
|
|
3
|
+
import { XRFeatureType } from "./XRFeatureType";
|
|
4
|
+
/**
|
|
5
|
+
* The base class of XR feature manager.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class XRFeature<T extends IXRPlatformFeature = IXRPlatformFeature> {
|
|
8
|
+
protected _xrManager: XRManager;
|
|
9
|
+
protected _type: XRFeatureType;
|
|
10
|
+
protected _enabled: boolean;
|
|
4
11
|
/**
|
|
5
|
-
*
|
|
6
|
-
* This method needs to be override.
|
|
7
|
-
* @returns
|
|
12
|
+
* Returns whether the feature is enabled.
|
|
8
13
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Disable an instance of a feature.
|
|
12
|
-
* This method needs to be override.
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
onDisable(): void;
|
|
16
|
-
/**
|
|
17
|
-
* Update an instance of a feature.
|
|
18
|
-
* This method needs to be override.
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
onUpdate(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Destroy an instance of a feature.
|
|
24
|
-
* This method needs to be override.
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
onDestroy(): void;
|
|
28
|
-
constructor(engine: Engine);
|
|
14
|
+
get enabled(): boolean;
|
|
15
|
+
set enabled(value: boolean);
|
|
29
16
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRFeatureManager, IXRFeature, 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 XRFeatureManager<TDescriptor extends IXRFeatureDescriptor = IXRFeatureDescriptor, TFeature extends IXRFeature = IXRFeature> implements IXRFeatureManager {
|
|
7
|
+
protected _engine: Engine;
|
|
8
|
+
_platformFeature: TFeature;
|
|
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(session: IXRSession, frame: IXRFrame): 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,26 @@
|
|
|
1
|
+
import { Camera } from "../../../Camera";
|
|
2
|
+
import { XRTrackedInputDevice } from "../../input/XRTrackedInputDevice";
|
|
3
|
+
/**
|
|
4
|
+
* The manager of XR camera.
|
|
5
|
+
*/
|
|
6
|
+
export declare class XRCameraManager {
|
|
7
|
+
private _xrManager;
|
|
8
|
+
/**
|
|
9
|
+
* The fixed foveation of the camera.
|
|
10
|
+
*/
|
|
11
|
+
get fixedFoveation(): number;
|
|
12
|
+
set fixedFoveation(value: number);
|
|
13
|
+
/**
|
|
14
|
+
* Attach the camera to the specified input type(Camera, LeftCamera or RightCamera).
|
|
15
|
+
* The camera entity need to be moved to the XROrigin entity.
|
|
16
|
+
* @param type - The input type
|
|
17
|
+
* @param camera - The camera to be attached
|
|
18
|
+
*/
|
|
19
|
+
attachCamera(type: XRTrackedInputDevice.Camera | XRTrackedInputDevice.LeftCamera | XRTrackedInputDevice.RightCamera, camera: Camera): void;
|
|
20
|
+
/**
|
|
21
|
+
* Detach the camera from the specified input type.
|
|
22
|
+
* @param type - The input type
|
|
23
|
+
* @returns The camera that was detached
|
|
24
|
+
*/
|
|
25
|
+
detachCamera(type: XRTrackedInputDevice.Camera | XRTrackedInputDevice.LeftCamera | XRTrackedInputDevice.RightCamera): Camera;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IXRTracked } from "@galacean/engine-design";
|
|
2
|
+
import { Vector3 } from "@galacean/engine-math";
|
|
3
|
+
import { TrackableType } from "./TrackableType";
|
|
4
|
+
/**
|
|
5
|
+
* XR hit result.
|
|
6
|
+
* It is the detection result returned by using XR HitTest feature.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XRHitResult {
|
|
9
|
+
/** The position of the hit point. */
|
|
10
|
+
point: Vector3;
|
|
11
|
+
/** The normal of the hit point. */
|
|
12
|
+
normal: Vector3;
|
|
13
|
+
/** The distance from the origin of the ray to the hit point. */
|
|
14
|
+
distance: number;
|
|
15
|
+
/** The hit tracked object, such as IXRTrackedPlane. */
|
|
16
|
+
trackedObject: IXRTracked;
|
|
17
|
+
/** The type of tracked object detected, such as TrackableType.Plane */
|
|
18
|
+
trackableType: TrackableType;
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Ray } from "@galacean/engine-math";
|
|
2
|
+
import { XRManager } from "../../XRManager";
|
|
3
|
+
import { XRFeature } from "../XRFeature";
|
|
4
|
+
import { TrackableType } from "./TrackableType";
|
|
5
|
+
import { XRHitResult } from "./XRHitResult";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of XR hit test.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRHitTest extends XRFeature {
|
|
10
|
+
private _tempRay;
|
|
11
|
+
private _tempVec2;
|
|
12
|
+
private _tempVec30;
|
|
13
|
+
private _tempVec31;
|
|
14
|
+
private _tempVec32;
|
|
15
|
+
private _tempVec33;
|
|
16
|
+
private _tempVec34;
|
|
17
|
+
private _tempVec35;
|
|
18
|
+
/**
|
|
19
|
+
* @param xrManager - The xr manager
|
|
20
|
+
*/
|
|
21
|
+
constructor(xrManager: XRManager);
|
|
22
|
+
/**
|
|
23
|
+
* Hit test.
|
|
24
|
+
* @param ray - The ray to test
|
|
25
|
+
* @param type - The type of hit test
|
|
26
|
+
* @returns The hit result
|
|
27
|
+
*/
|
|
28
|
+
hitTest(ray: Ray, type: TrackableType): XRHitResult[];
|
|
29
|
+
/**
|
|
30
|
+
* Screen hit test.
|
|
31
|
+
* @param x - The x coordinate of the screen point (normalized)
|
|
32
|
+
* @param y - The y coordinate of the screen point (normalized)
|
|
33
|
+
* @param type - The type of hit test
|
|
34
|
+
* @returns The hit result
|
|
35
|
+
*/
|
|
36
|
+
screenHitTest(x: number, y: number, type: TrackableType): XRHitResult[];
|
|
37
|
+
private _hitTestPlane;
|
|
38
|
+
private _checkPointerWithinPlane;
|
|
39
|
+
}
|
|
@@ -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 { XRManager } from "../../XRManager";
|
|
2
|
+
import { XRFeature } from "../XRFeature";
|
|
3
|
+
import { XRMovementTrackingMode } from "./XRMovementTrackingMode";
|
|
4
|
+
/**
|
|
5
|
+
* The manager of XR movement tracking.
|
|
6
|
+
*/
|
|
7
|
+
export declare class XRMovementTracking extends XRFeature {
|
|
8
|
+
private _trackingMode;
|
|
9
|
+
/**
|
|
10
|
+
* Get the tracking mode.
|
|
11
|
+
*/
|
|
12
|
+
get trackingMode(): XRMovementTrackingMode;
|
|
13
|
+
/**
|
|
14
|
+
* @param xrManager - The xr manager
|
|
15
|
+
* @param trackingMode - The tracking mode
|
|
16
|
+
*/
|
|
17
|
+
constructor(xrManager: XRManager, 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,38 @@
|
|
|
1
|
+
import { IXRTrackablePlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { XRTrackingState } from "../../input/XRTrackingState";
|
|
3
|
+
import { XRFeature } from "../XRFeature";
|
|
4
|
+
import { XRRequestTracking } from "./XRRequestTracking";
|
|
5
|
+
import { XRTracked } from "./XRTracked";
|
|
6
|
+
/**
|
|
7
|
+
* The base class of XR trackable manager.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class XRTrackableFeature<T extends XRTracked, K extends XRRequestTracking<T>> extends XRFeature<IXRTrackablePlatformFeature<T, K>> {
|
|
10
|
+
protected _requestTrackings: K[];
|
|
11
|
+
protected _tracked: T[];
|
|
12
|
+
protected _added: T[];
|
|
13
|
+
protected _updated: T[];
|
|
14
|
+
protected _removed: T[];
|
|
15
|
+
protected _statusSnapshot: Record<number, XRTrackingState>;
|
|
16
|
+
private _listeners;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the tracked objects.
|
|
19
|
+
*/
|
|
20
|
+
get tracked(): readonly T[];
|
|
21
|
+
/**
|
|
22
|
+
* Add a listening function for tracked object changes.
|
|
23
|
+
* @param listener - The listening function
|
|
24
|
+
*/
|
|
25
|
+
addChangedListener(listener: (added: readonly T[], updated: readonly T[], removed: readonly T[]) => void): void;
|
|
26
|
+
/**
|
|
27
|
+
* Remove a listening function of tracked object changes.
|
|
28
|
+
* @param listener - The listening function
|
|
29
|
+
*/
|
|
30
|
+
removeChangedListener(listener: (added: readonly T[], updated: readonly T[], removed: readonly T[]) => void): void;
|
|
31
|
+
_onUpdate(): void;
|
|
32
|
+
_onSessionStop(): void;
|
|
33
|
+
_onSessionExit(): void;
|
|
34
|
+
_onDestroy(): void;
|
|
35
|
+
protected _addRequestTracking(requestTracking: K): void;
|
|
36
|
+
protected _removeRequestTracking(requestTracking: K): void;
|
|
37
|
+
protected _removeAllRequestTrackings(): void;
|
|
38
|
+
}
|
|
@@ -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,37 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "@galacean/engine-math";
|
|
2
|
+
import { XRManager } from "../../../XRManager";
|
|
3
|
+
import { XRTrackableFeature } from "../XRTrackableFeature";
|
|
4
|
+
import { XRAnchor } from "./XRAnchor";
|
|
5
|
+
import { XRRequestAnchor } from "./XRRequestAnchor";
|
|
6
|
+
/**
|
|
7
|
+
* The manager of XR anchor tracking.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XRAnchorTracking extends XRTrackableFeature<XRAnchor, XRRequestAnchor> {
|
|
10
|
+
private _anchors;
|
|
11
|
+
/**
|
|
12
|
+
* The anchors to tracking.
|
|
13
|
+
*/
|
|
14
|
+
get trackingAnchors(): readonly XRAnchor[];
|
|
15
|
+
/**
|
|
16
|
+
* The tracked anchors.
|
|
17
|
+
*/
|
|
18
|
+
get trackedAnchors(): readonly XRAnchor[];
|
|
19
|
+
/**
|
|
20
|
+
* @param xrManager - The xr manager
|
|
21
|
+
*/
|
|
22
|
+
constructor(xrManager: XRManager);
|
|
23
|
+
/**
|
|
24
|
+
* Add a anchor in XR space.
|
|
25
|
+
* @param anchor - The anchor to be added
|
|
26
|
+
*/
|
|
27
|
+
addAnchor(position: Vector3, rotation: Quaternion): XRAnchor;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a anchor in XR space.
|
|
30
|
+
* @param anchor - The anchor to be removed
|
|
31
|
+
*/
|
|
32
|
+
removeAnchor(anchor: XRAnchor): void;
|
|
33
|
+
/**
|
|
34
|
+
* Remove all tracking anchors.
|
|
35
|
+
*/
|
|
36
|
+
clearAnchors(): void;
|
|
37
|
+
}
|