@galacean/engine-core 1.1.0-beta.19 → 1.1.0-beta.20
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 +174 -91
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +174 -91
- package/dist/module.js +174 -91
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +3 -0
- package/types/asset/AssetPromise.d.ts +1 -0
- package/types/mesh/SubModelMesh.d.ts +260 -0
- package/types/particle/modules/MainModule.d.ts +0 -1
- package/types/xr/IXRDevice.d.ts +26 -0
- package/types/xr/XRManager.d.ts +89 -24
- package/types/xr/XRModule.d.ts +126 -0
- package/types/xr/component/XRPoseDriver.d.ts +5 -5
- package/types/xr/component/XRTrackingMode.d.ts +15 -0
- package/types/xr/component/trackable/XRAnchor.d.ts +4 -0
- package/types/xr/component/trackable/XRImage.d.ts +6 -0
- package/types/xr/component/trackable/XRPlane.d.ts +7 -0
- package/types/xr/component/trackable/XRTracked.d.ts +13 -0
- 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/feature/camera/IXRCameraDescriptor.d.ts +7 -0
- package/types/xr/feature/camera/XRCameraManager.d.ts +35 -0
- package/types/xr/feature/camera/XRPlatformCamera.d.ts +5 -0
- package/types/xr/feature/hitTest/XRHItTestType.d.ts +16 -0
- package/types/xr/feature/hitTest/XRHitTestManager.d.ts +38 -0
- package/types/xr/feature/movementTracking/IXRMovementTrackingDescriptor.d.ts +9 -0
- package/types/xr/feature/movementTracking/XRMovementTrackingManager.d.ts +8 -0
- package/types/xr/feature/movementTracking/XRMovementTrackingMode.d.ts +5 -0
- package/types/xr/feature/movementTracking/XRPlatformMovementTracking.d.ts +10 -0
- package/types/xr/feature/trackable/XRRequestTrackingState.d.ts +11 -0
- package/types/xr/feature/trackable/XRTrackableManager.d.ts +41 -0
- package/types/xr/feature/trackable/XRTrackablePlatformFeature.d.ts +29 -0
- package/types/xr/feature/trackable/XRTracked.d.ts +9 -0
- package/types/xr/feature/trackable/XRTrackedUpdateFlag.d.ts +11 -0
- package/types/xr/feature/trackable/XRTrackingState.d.ts +11 -0
- package/types/xr/feature/trackable/anchor/IXRAnchorTrackingDescriptor.d.ts +8 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTrackingManager.d.ts +22 -0
- package/types/xr/feature/trackable/anchor/XRAnchorTrackingMode.d.ts +4 -0
- package/types/xr/feature/trackable/anchor/XRPlatformAnchorTracking.d.ts +12 -0
- package/types/xr/feature/trackable/anchor/XRRequestTrackingAnchor.d.ts +10 -0
- package/types/xr/feature/trackable/image/IXRImageTrackingDescriptor.d.ts +5 -0
- package/types/xr/feature/trackable/image/XRImageTrackingManager.d.ts +33 -0
- package/types/xr/feature/trackable/image/XRPlatformImageTracking.d.ts +14 -0
- package/types/xr/feature/trackable/image/XRReferenceImage.d.ts +14 -0
- package/types/xr/feature/trackable/image/XRRequestTrackingImage.d.ts +11 -0
- package/types/xr/feature/trackable/image/XRTrackedImage.d.ts +5 -0
- package/types/xr/feature/trackable/plane/IXRPlaneTrackingDescriptor.d.ts +9 -0
- package/types/xr/feature/trackable/plane/XRPlaneDetectionMode.d.ts +13 -0
- package/types/xr/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
- package/types/xr/feature/trackable/plane/XRPlaneTrackingManager.d.ts +14 -0
- package/types/xr/feature/trackable/plane/XRPlatformPlaneTracking.d.ts +11 -0
- package/types/xr/feature/trackable/plane/XRRequestTrackingPlane.d.ts +11 -0
- package/types/xr/feature/trackable/plane/XRTrackedPlane.d.ts +11 -0
- package/types/xr/index.d.ts +39 -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/XRInput.d.ts +14 -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 +58 -0
- package/types/xr/input/XRInputType.d.ts +23 -0
- package/types/xr/input/XRTargetRayMode.d.ts +12 -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/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.20",
|
|
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.20"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@galacean/engine-design": "1.1.0-beta.
|
|
21
|
+
"@galacean/engine-design": "1.1.0-beta.20"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssetType } from "../../asset/AssetType";
|
|
1
2
|
import { TextureFilterMode, TextureFormat, TextureWrapMode } from "../../texture";
|
|
2
3
|
/**
|
|
3
4
|
* The original data type of the atlas.
|
|
@@ -16,6 +17,8 @@ export interface AtlasConfig {
|
|
|
16
17
|
atlasItems: {
|
|
17
18
|
/** The url of the sub atlas. */
|
|
18
19
|
img: string;
|
|
20
|
+
/** Image type. */
|
|
21
|
+
type: AssetType;
|
|
19
22
|
/** Sprites contained in the sub atlas. */
|
|
20
23
|
sprites: AtlasSprite[];
|
|
21
24
|
}[];
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
|
|
2
|
+
import { Engine } from "../Engine";
|
|
3
|
+
import { Buffer } from "../graphic/Buffer";
|
|
4
|
+
import { Mesh } from "../graphic/Mesh";
|
|
5
|
+
import { VertexBufferBinding } from "../graphic/VertexBufferBinding";
|
|
6
|
+
import { VertexElement } from "../graphic/VertexElement";
|
|
7
|
+
import { BlendShape } from "./BlendShape";
|
|
8
|
+
import { VertexAttribute } from "./enums/VertexAttribute";
|
|
9
|
+
import { MeshTopology } from "../graphic/enums/MeshTopology";
|
|
10
|
+
/**
|
|
11
|
+
* Sub-model mesh.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SubModelMesh extends Mesh {
|
|
14
|
+
private static _tempVec0;
|
|
15
|
+
private static _tempVec1;
|
|
16
|
+
private static _tempVec2;
|
|
17
|
+
private static _tempVec3;
|
|
18
|
+
private static _tempVec4;
|
|
19
|
+
private _vertexCount;
|
|
20
|
+
private _vertexCountDirty;
|
|
21
|
+
private _dataVersionCounter;
|
|
22
|
+
private _positions;
|
|
23
|
+
private _normals;
|
|
24
|
+
private _colors;
|
|
25
|
+
private _tangents;
|
|
26
|
+
private _uv;
|
|
27
|
+
private _uv1;
|
|
28
|
+
private _uv2;
|
|
29
|
+
private _uv3;
|
|
30
|
+
private _uv4;
|
|
31
|
+
private _uv5;
|
|
32
|
+
private _uv6;
|
|
33
|
+
private _uv7;
|
|
34
|
+
private _boneWeights;
|
|
35
|
+
private _boneIndices;
|
|
36
|
+
private _advancedElementUpdateFlag;
|
|
37
|
+
private _advancedDataUpdateFlag;
|
|
38
|
+
private _advancedVertexDataVersions;
|
|
39
|
+
private _advancedDataSyncToBuffer;
|
|
40
|
+
private _internalVertexBufferStride;
|
|
41
|
+
private _internalVertexBufferCreatedInfo;
|
|
42
|
+
private _internalVertexElementsOffset;
|
|
43
|
+
private _internalVertexElementsFlags;
|
|
44
|
+
private _vertexBufferInfos;
|
|
45
|
+
private _indices;
|
|
46
|
+
private _indicesFormat;
|
|
47
|
+
private _indicesChangeFlag;
|
|
48
|
+
/** Start drawing offset. */
|
|
49
|
+
start: number;
|
|
50
|
+
/** Drawing count. */
|
|
51
|
+
count: number;
|
|
52
|
+
/** Drawing topology. */
|
|
53
|
+
topology: MeshTopology;
|
|
54
|
+
/**
|
|
55
|
+
* Vertex count of mesh.
|
|
56
|
+
*/
|
|
57
|
+
get vertexCount(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Vertex element collection.
|
|
60
|
+
*/
|
|
61
|
+
get vertexElements(): Readonly<VertexElement[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Vertex buffer binding collection.
|
|
64
|
+
*/
|
|
65
|
+
get vertexBufferBindings(): ReadonlyArray<VertexBufferBinding>;
|
|
66
|
+
/**
|
|
67
|
+
* BlendShapes of this ModelMesh.
|
|
68
|
+
*/
|
|
69
|
+
get blendShapes(): Readonly<BlendShape[]>;
|
|
70
|
+
/**
|
|
71
|
+
* BlendShape count of this ModelMesh.
|
|
72
|
+
*/
|
|
73
|
+
get blendShapeCount(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Create a model mesh.
|
|
76
|
+
* @param engine - Engine to which the mesh belongs
|
|
77
|
+
*/
|
|
78
|
+
constructor(engine: Engine);
|
|
79
|
+
/**
|
|
80
|
+
* Set positions for the mesh.
|
|
81
|
+
* @param positions - The positions for the mesh
|
|
82
|
+
*/
|
|
83
|
+
setPositions(positions: Vector3[] | null): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get positions for the mesh.
|
|
86
|
+
* @remarks Please call the setPositions() method after modification to ensure that the modification takes effect.
|
|
87
|
+
*/
|
|
88
|
+
getPositions(): Vector3[] | null;
|
|
89
|
+
/**
|
|
90
|
+
* Set per-vertex normals for the mesh.
|
|
91
|
+
* @param normals - The normals for the mesh
|
|
92
|
+
*/
|
|
93
|
+
setNormals(normals: Vector3[] | null): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get normals for the mesh.
|
|
96
|
+
* @remarks Please call the setNormals() method after modification to ensure that the modification takes effect.
|
|
97
|
+
*/
|
|
98
|
+
getNormals(): Vector3[] | null;
|
|
99
|
+
/**
|
|
100
|
+
* Set per-vertex colors for the mesh.
|
|
101
|
+
* @param colors - The colors for the mesh
|
|
102
|
+
*/
|
|
103
|
+
setColors(colors: Color[] | null): void;
|
|
104
|
+
/**
|
|
105
|
+
* Get colors for the mesh.
|
|
106
|
+
* @remarks Please call the setColors() method after modification to ensure that the modification takes effect.
|
|
107
|
+
*/
|
|
108
|
+
getColors(): Color[] | null;
|
|
109
|
+
/**
|
|
110
|
+
* Set per-vertex bone weights for the mesh.
|
|
111
|
+
* @param boneWeights - The bone weights for the mesh
|
|
112
|
+
*/
|
|
113
|
+
setBoneWeights(boneWeights: Vector4[] | null): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get bone weights for the mesh.
|
|
116
|
+
* @remarks Please call the setWeights() method after modification to ensure that the modification takes effect.
|
|
117
|
+
*/
|
|
118
|
+
getBoneWeights(): Vector4[] | null;
|
|
119
|
+
/**
|
|
120
|
+
* Set per-vertex bone indices for the mesh.
|
|
121
|
+
* @param boneIndices - The bone indices for the mesh
|
|
122
|
+
*/
|
|
123
|
+
setBoneIndices(boneIndices: Vector4[] | null): void;
|
|
124
|
+
/**
|
|
125
|
+
* Get bone indices for the mesh.
|
|
126
|
+
* @remarks Please call the setBoneIndices() method after modification to ensure that the modification takes effect.
|
|
127
|
+
*/
|
|
128
|
+
getBoneIndices(): Vector4[] | null;
|
|
129
|
+
/**
|
|
130
|
+
* Set per-vertex tangents for the mesh.
|
|
131
|
+
* @param tangents - The tangents for the mesh
|
|
132
|
+
*/
|
|
133
|
+
setTangents(tangents: Vector4[] | null): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get tangents for the mesh.
|
|
136
|
+
* @remarks Please call the setTangents() method after modification to ensure that the modification takes effect.
|
|
137
|
+
*/
|
|
138
|
+
getTangents(): Vector4[] | null;
|
|
139
|
+
/**
|
|
140
|
+
* Set per-vertex uv for the mesh.
|
|
141
|
+
* @param uv - The uv for the mesh
|
|
142
|
+
*/
|
|
143
|
+
setUVs(uv: Vector2[] | null): void;
|
|
144
|
+
/**
|
|
145
|
+
* Set per-vertex uv for the mesh by channelIndex.
|
|
146
|
+
* @param uv - The uv for the mesh
|
|
147
|
+
* @param channelIndex - The index of uv channels, in [0 ~ 7] range
|
|
148
|
+
*/
|
|
149
|
+
setUVs(uv: Vector2[] | null, channelIndex: number): void;
|
|
150
|
+
/**
|
|
151
|
+
* Get uv for the mesh.
|
|
152
|
+
* @remarks Please call the setUV() method after modification to ensure that the modification takes effect.
|
|
153
|
+
*/
|
|
154
|
+
getUVs(): Vector2[] | null;
|
|
155
|
+
/**
|
|
156
|
+
* Get uv for the mesh by channelIndex.
|
|
157
|
+
* @param channelIndex - The index of uv channels, in [0 ~ 7] range.
|
|
158
|
+
* @remarks Please call the setUV() method after modification to ensure that the modification takes effect.
|
|
159
|
+
*/
|
|
160
|
+
getUVs(channelIndex: number): Vector2[] | null;
|
|
161
|
+
/**
|
|
162
|
+
* Set indices for the mesh.
|
|
163
|
+
* @param indices - The indices for the mesh
|
|
164
|
+
*/
|
|
165
|
+
setIndices(indices: Uint8Array | Uint16Array | Uint32Array): void;
|
|
166
|
+
/**
|
|
167
|
+
* Get indices for the mesh.
|
|
168
|
+
*/
|
|
169
|
+
getIndices(): Uint8Array | Uint16Array | Uint32Array;
|
|
170
|
+
/**
|
|
171
|
+
* Set vertex elements.
|
|
172
|
+
* @param elements - Vertex element collection
|
|
173
|
+
*
|
|
174
|
+
* @remarks
|
|
175
|
+
* Call this method will clear the vertex data set by the setPositions(), setNormals(), setColors(), setBoneWeights(), setBoneIndices(), setTangents(), setUVs() methods.
|
|
176
|
+
*/
|
|
177
|
+
setVertexElements(elements: VertexElement[]): void;
|
|
178
|
+
/**
|
|
179
|
+
* Set vertex buffer binding.
|
|
180
|
+
* @param vertexBufferBinding - Vertex buffer binding
|
|
181
|
+
* @param index - Vertex buffer index, the default value is 0
|
|
182
|
+
*/
|
|
183
|
+
setVertexBufferBinding(vertexBufferBinding: VertexBufferBinding, index?: number): void;
|
|
184
|
+
/**
|
|
185
|
+
* Set vertex buffer binding.
|
|
186
|
+
* @param vertexBuffer - Vertex buffer
|
|
187
|
+
* @param stride - Vertex buffer data stride
|
|
188
|
+
* @param index - Vertex buffer index, the default value is 0
|
|
189
|
+
*/
|
|
190
|
+
setVertexBufferBinding(vertexBuffer: Buffer, stride: number, index?: number): void;
|
|
191
|
+
/**
|
|
192
|
+
* Set vertex buffer binding.
|
|
193
|
+
* @param vertexBufferBindings - Vertex buffer binding
|
|
194
|
+
* @param firstIndex - First vertex buffer index, the default value is 0
|
|
195
|
+
*/
|
|
196
|
+
setVertexBufferBindings(vertexBufferBindings: VertexBufferBinding[], firstIndex?: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Get `VertexElement` by attribute.
|
|
199
|
+
* @param attribute - Vertex attribute
|
|
200
|
+
* @returns Vertex element
|
|
201
|
+
*/
|
|
202
|
+
getVertexElement(attribute: VertexAttribute): VertexElement | null;
|
|
203
|
+
/**
|
|
204
|
+
* Add a BlendShape for this ModelMesh.
|
|
205
|
+
* @param blendShape - The BlendShape
|
|
206
|
+
*/
|
|
207
|
+
addBlendShape(blendShape: BlendShape): void;
|
|
208
|
+
/**
|
|
209
|
+
* Clear all BlendShapes.
|
|
210
|
+
*/
|
|
211
|
+
clearBlendShapes(): void;
|
|
212
|
+
/**
|
|
213
|
+
* Get name of BlendShape by given index.
|
|
214
|
+
* @param index - The index of BlendShape
|
|
215
|
+
* @returns The name of BlendShape
|
|
216
|
+
*/
|
|
217
|
+
getBlendShapeName(index: number): string;
|
|
218
|
+
/**
|
|
219
|
+
* Upload data to GPU set by `setPositions()`, `setNormals()`, `setColors()`, `setBoneWeights()`, `setBoneIndices()`, `setTangents()`, `setUVs()`, `setIndices()` methods.
|
|
220
|
+
* This method will be auto generate vertex element and vertex buffer binding if needed.
|
|
221
|
+
*
|
|
222
|
+
* @param releaseData - Whether to release the data cache, release data can reduce memory usage.
|
|
223
|
+
*/
|
|
224
|
+
uploadData(releaseData: boolean): void;
|
|
225
|
+
/**
|
|
226
|
+
* Calculate mesh tangent.
|
|
227
|
+
* @remark need to set positions(with or not with indices), normals, uv before calculation.
|
|
228
|
+
* @remark based on http://foundationsofgameenginedev.com/FGED2-sample.pdf
|
|
229
|
+
*/
|
|
230
|
+
calculateTangents(): void;
|
|
231
|
+
private _getVertexElementData;
|
|
232
|
+
private _beforeSetAdvancedVertexData;
|
|
233
|
+
private _updateAdvancedVertexDataMarks;
|
|
234
|
+
private _updateInternalVertexBuffer;
|
|
235
|
+
private _readVector2VertexData;
|
|
236
|
+
private _readVector3VertexData;
|
|
237
|
+
private _readVector4VertexData;
|
|
238
|
+
private _readColorVertexData;
|
|
239
|
+
private _readVertexData;
|
|
240
|
+
private _updateAdvancedVertexElement;
|
|
241
|
+
private _updateAdvancedVertexElements;
|
|
242
|
+
private _updateVertexElements;
|
|
243
|
+
private _writeVector2AdvancedVertexData;
|
|
244
|
+
private _writeVector3AdvancedVertexData;
|
|
245
|
+
private _writeVector4AdvancedVertexData;
|
|
246
|
+
private _writeColorAdvancedVertexData;
|
|
247
|
+
private _writeAdvancedVertexData;
|
|
248
|
+
private _updateAdvancedVertices;
|
|
249
|
+
private _getInternalVertexBufferIndex;
|
|
250
|
+
private _getAttributeFormat;
|
|
251
|
+
private _getAttributeByteLength;
|
|
252
|
+
private _releaseCache;
|
|
253
|
+
/** @deprecated */
|
|
254
|
+
private _accessible;
|
|
255
|
+
/**
|
|
256
|
+
* @deprecated
|
|
257
|
+
* Whether to access data of the mesh.
|
|
258
|
+
*/
|
|
259
|
+
get accessible(): boolean;
|
|
260
|
+
}
|
|
@@ -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
|
/**
|
|
@@ -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,96 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRFeature } 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 "@galacean/engine-design/src/xr/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, IXRFeature>;
|
|
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
|
+
/** Input manager for XR. */
|
|
18
|
+
inputManager: XRInputManager;
|
|
19
|
+
/** Session manager for XR. */
|
|
20
|
+
sessionManager: XRSessionManager;
|
|
11
21
|
private _engine;
|
|
12
|
-
private
|
|
22
|
+
private _scene;
|
|
23
|
+
private _origin;
|
|
13
24
|
private _features;
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
private _mode;
|
|
26
|
+
private _requestFeatures;
|
|
27
|
+
/**
|
|
28
|
+
* The current xr scene.
|
|
29
|
+
*/
|
|
30
|
+
get scene(): Scene;
|
|
31
|
+
set scene(value: Scene);
|
|
32
|
+
/**
|
|
33
|
+
* The current xr origin.
|
|
34
|
+
*/
|
|
35
|
+
get origin(): Entity;
|
|
36
|
+
set origin(value: Entity);
|
|
37
|
+
/**
|
|
38
|
+
* The current session mode( AR or VR ).
|
|
39
|
+
*/
|
|
40
|
+
get mode(): XRSessionType;
|
|
41
|
+
/**
|
|
42
|
+
* The requested features.
|
|
43
|
+
*/
|
|
44
|
+
get requestFeatures(): IXRFeatureDescriptor[];
|
|
45
|
+
/**
|
|
46
|
+
* Check if the specified mode is supported.
|
|
47
|
+
* @param mode - The mode to check
|
|
48
|
+
* @returns A promise that resolves if the mode is supported, otherwise rejects
|
|
49
|
+
*/
|
|
50
|
+
isSupported(mode: XRSessionType): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if the specified feature is supported.
|
|
53
|
+
* @param descriptors - The feature descriptor to check
|
|
54
|
+
* @returns A promise that resolves if the feature is supported, otherwise rejects
|
|
55
|
+
*/
|
|
56
|
+
isSupportedFeature(descriptors: IXRFeatureDescriptor | IXRFeatureDescriptor[]): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Disable all features.
|
|
59
|
+
*/
|
|
60
|
+
disableAllFeatures(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get the feature instance.
|
|
63
|
+
* @param type - The type of feature
|
|
64
|
+
* @returns The feature instance
|
|
65
|
+
*/
|
|
66
|
+
getFeature<T extends XRFeatureManager>(type: XRFeatureType): T;
|
|
67
|
+
/**
|
|
68
|
+
* Initialize the session.
|
|
69
|
+
* @param mode - The mode of the session
|
|
70
|
+
* @param requestFeatures - The requested features
|
|
71
|
+
* @returns A promise that resolves if the session is initialized, otherwise rejects
|
|
72
|
+
*/
|
|
73
|
+
initSession(mode: XRSessionType, requestFeatures?: IXRFeatureDescriptor[]): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Destroy the session.
|
|
76
|
+
* @returns A promise that resolves if the session is destroyed, otherwise rejects
|
|
77
|
+
*/
|
|
78
|
+
destroySession(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Start the session.
|
|
81
|
+
* @returns A promise that resolves if the session is started, otherwise rejects
|
|
82
|
+
*/
|
|
83
|
+
startSession(): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Stop the session.
|
|
86
|
+
* @returns A promise that resolves if the session is stopped, otherwise rejects
|
|
87
|
+
*/
|
|
88
|
+
stopSession(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Destroy xr module.
|
|
91
|
+
*/
|
|
27
92
|
destroy(): void;
|
|
28
|
-
constructor(engine: Engine,
|
|
93
|
+
constructor(engine: Engine, xrDevice: IXRDevice);
|
|
29
94
|
}
|
|
30
|
-
export declare function
|
|
95
|
+
export declare function registerXRFeatureManager(feature: XRFeatureType): (featureManagerConstructor: TXRFeatureManagerConstructor) => void;
|
|
31
96
|
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { IXRFeatureDescriptor, IXRPlatformFeature } from "@galacean/engine-design";
|
|
2
|
+
import { Engine } from "../Engine";
|
|
3
|
+
import { IXRDevice } from "./IXRDevice";
|
|
4
|
+
import { XRInputManager } from "./input/XRInputManager";
|
|
5
|
+
import { XRFeatureType } from "./feature/XRFeatureType";
|
|
6
|
+
import { XRSessionManager } from "./session/XRSessionManager";
|
|
7
|
+
import { XRSessionState } from "./session/XRSessionState";
|
|
8
|
+
import { XRSessionType } from "./session/XRSessionType";
|
|
9
|
+
import { XRFeatureManager } from "./feature/XRFeatureManager";
|
|
10
|
+
import { XRPlatformFeature } from "./feature/XRPlatformFeature";
|
|
11
|
+
import { Scene } from "../Scene";
|
|
12
|
+
import { Entity } from "../Entity";
|
|
13
|
+
import { Component } from "../Component";
|
|
14
|
+
type TXRFeatureManager = XRFeatureManager<IXRFeatureDescriptor, IXRPlatformFeature>;
|
|
15
|
+
type TXRFeatureManagerConstructor = new (engine: Engine) => TXRFeatureManager;
|
|
16
|
+
type TXRSessionStateChangeListener = (from: XRSessionState, to: XRSessionState) => void;
|
|
17
|
+
type TXRTrackedComponent = new (entity: Entity) => Component;
|
|
18
|
+
/**
|
|
19
|
+
* XRModule is the entry point of the XR system.
|
|
20
|
+
*/
|
|
21
|
+
export declare class XRModule {
|
|
22
|
+
/** Hardware adaptation for XR. */
|
|
23
|
+
xrDevice: IXRDevice;
|
|
24
|
+
/** Input manager for XR. */
|
|
25
|
+
inputManager: XRInputManager;
|
|
26
|
+
/** Session manager for XR. */
|
|
27
|
+
sessionManager: XRSessionManager;
|
|
28
|
+
private _engine;
|
|
29
|
+
private _scene;
|
|
30
|
+
private _origin;
|
|
31
|
+
private _features;
|
|
32
|
+
private _sessionState;
|
|
33
|
+
private _listeners;
|
|
34
|
+
private _mode;
|
|
35
|
+
private _requestFeatures;
|
|
36
|
+
/**
|
|
37
|
+
* The current xr scene.
|
|
38
|
+
*/
|
|
39
|
+
get scene(): Scene;
|
|
40
|
+
set scene(value: Scene);
|
|
41
|
+
/**
|
|
42
|
+
* The current xr origin.
|
|
43
|
+
*/
|
|
44
|
+
get origin(): Entity;
|
|
45
|
+
set origin(value: Entity);
|
|
46
|
+
/**
|
|
47
|
+
* The current session mode( AR or VR ).
|
|
48
|
+
*/
|
|
49
|
+
get mode(): XRSessionType;
|
|
50
|
+
/**
|
|
51
|
+
* The requested features.
|
|
52
|
+
*/
|
|
53
|
+
get requestFeatures(): IXRFeatureDescriptor[];
|
|
54
|
+
/**
|
|
55
|
+
* The current session state.
|
|
56
|
+
*/
|
|
57
|
+
get sessionState(): XRSessionState;
|
|
58
|
+
/**
|
|
59
|
+
* Check if the specified mode is supported.
|
|
60
|
+
* @param mode - The mode to check
|
|
61
|
+
* @returns A promise that resolves if the mode is supported, otherwise rejects
|
|
62
|
+
*/
|
|
63
|
+
isSupported(mode: XRSessionType): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Check if the specified feature is supported.
|
|
66
|
+
* @param descriptors - The feature descriptor to check
|
|
67
|
+
* @returns A promise that resolves if the feature is supported, otherwise rejects
|
|
68
|
+
*/
|
|
69
|
+
isSupportedFeature(descriptors: IXRFeatureDescriptor | IXRFeatureDescriptor[]): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Disable all features.
|
|
72
|
+
*/
|
|
73
|
+
disableAllFeatures(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Get the feature instance.
|
|
76
|
+
* @param type - The type of feature
|
|
77
|
+
* @returns The feature instance
|
|
78
|
+
*/
|
|
79
|
+
getFeature<T extends XRFeatureManager<IXRFeatureDescriptor, XRPlatformFeature>>(type: XRFeatureType): T;
|
|
80
|
+
/**
|
|
81
|
+
* Initialize the session.
|
|
82
|
+
* @param mode - The mode of the session
|
|
83
|
+
* @param requestFeatures - The requested features
|
|
84
|
+
* @returns A promise that resolves if the session is initialized, otherwise rejects
|
|
85
|
+
*/
|
|
86
|
+
initSession(mode: XRSessionType, requestFeatures?: IXRFeatureDescriptor[]): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy the session.
|
|
89
|
+
* @returns A promise that resolves if the session is destroyed, otherwise rejects
|
|
90
|
+
*/
|
|
91
|
+
destroySession(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Start the session.
|
|
94
|
+
* @returns A promise that resolves if the session is started, otherwise rejects
|
|
95
|
+
*/
|
|
96
|
+
startSession(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Stop the session.
|
|
99
|
+
* @returns A promise that resolves if the session is stopped, otherwise rejects
|
|
100
|
+
*/
|
|
101
|
+
stopSession(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Reset the session.
|
|
104
|
+
*/
|
|
105
|
+
destroy(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Add a session state change listener.
|
|
108
|
+
* @param listener - The listener to add
|
|
109
|
+
*/
|
|
110
|
+
addSessionStateChangeListener(listener: TXRSessionStateChangeListener): void;
|
|
111
|
+
/**
|
|
112
|
+
* Remove a session state change listener.
|
|
113
|
+
* @param listener - The listener to remove
|
|
114
|
+
*/
|
|
115
|
+
removeSessionStateChangeListener(listener: TXRSessionStateChangeListener): void;
|
|
116
|
+
/**
|
|
117
|
+
* Remove all session state change listeners.
|
|
118
|
+
*/
|
|
119
|
+
removeAllSessionStateChangeListener(): void;
|
|
120
|
+
constructor(engine: Engine, xrDevice: IXRDevice);
|
|
121
|
+
private _setSessionState;
|
|
122
|
+
private _dispatchSessionStateChange;
|
|
123
|
+
}
|
|
124
|
+
export declare function registerXRFeatureManager(feature: XRFeatureType): (featureManagerConstructor: TXRFeatureManagerConstructor) => void;
|
|
125
|
+
export declare function registerXRComponent(feature: XRFeatureType): (componentConstructor: TXRTrackedComponent) => void;
|
|
126
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Script } from "../../Script";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { XRTrackingMode } from "./XRTrackingMode";
|
|
3
|
+
import { XRInputType } from "../input/XRInputType";
|
|
4
4
|
export declare class XRPoseDriver extends Script {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private
|
|
5
|
+
type: XRInputType;
|
|
6
|
+
trackingMode: XRTrackingMode;
|
|
7
|
+
private _inputManager;
|
|
8
8
|
onLateUpdate(): void;
|
|
9
9
|
onAwake(): void;
|
|
10
10
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum of XR tracking mode.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum XRTrackingMode {
|
|
5
|
+
/** None */
|
|
6
|
+
None = 0,
|
|
7
|
+
/** Orientation only */
|
|
8
|
+
RotationOnly = 1,
|
|
9
|
+
/** Position only */
|
|
10
|
+
PositionOnly = 2,
|
|
11
|
+
/** Orientation and position */
|
|
12
|
+
RotationAndPosition = 3,
|
|
13
|
+
/** Auto ( RotationAndPosition ) */
|
|
14
|
+
Auto = 4
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IXRReferenceImage, IXRTrackedImage } from "@galacean/engine-design";
|
|
2
|
+
import { XRTracked } from "./XRTracked";
|
|
3
|
+
export declare class XRImage extends XRTracked<IXRTrackedImage> {
|
|
4
|
+
get referenceImage(): IXRReferenceImage;
|
|
5
|
+
get measuredWidthInMeters(): number;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IXRTrackedPlane } from "@galacean/engine-design";
|
|
2
|
+
import { XRTracked } from "./XRTracked";
|
|
3
|
+
import { Vector3 } from "@galacean/engine-math";
|
|
4
|
+
export declare class XRPlane extends XRTracked<IXRTrackedPlane> {
|
|
5
|
+
get polygon(): readonly Vector3[];
|
|
6
|
+
get orientation(): "horizontal" | "vertical";
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IXRTrackable } from "@galacean/engine-design";
|
|
2
|
+
import { Component } from "../../../Component";
|
|
3
|
+
import { XRTrackingState } from "../../feature/trackable/XRTrackingState";
|
|
4
|
+
export declare abstract class XRTracked<T extends IXRTrackable> extends Component {
|
|
5
|
+
protected _platformData: T;
|
|
6
|
+
protected _destroyOnRemoval: boolean;
|
|
7
|
+
get destroyOnRemoval(): boolean;
|
|
8
|
+
set destroyOnRemoval(value: boolean);
|
|
9
|
+
get trackableId(): number;
|
|
10
|
+
get trackingState(): XRTrackingState;
|
|
11
|
+
get platformData(): T;
|
|
12
|
+
set platformData(value: T);
|
|
13
|
+
}
|