@vulfram/engine 0.14.8-alpha → 0.17.1-alpha
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/README.md +106 -0
- package/package.json +55 -4
- package/src/core.ts +14 -0
- package/src/ecs.ts +1 -0
- package/src/engine/api.ts +234 -23
- package/src/engine/bridge/dispatch.ts +265 -40
- package/src/engine/bridge/guards.ts +4 -1
- package/src/engine/bridge/protocol.ts +69 -52
- package/src/engine/ecs/index.ts +185 -42
- package/src/engine/state.ts +133 -2
- package/src/engine/systems/command-intent.ts +153 -3
- package/src/engine/systems/constraint-solve.ts +167 -0
- package/src/engine/systems/core-command-builder.ts +9 -268
- package/src/engine/systems/diagnostics.ts +20 -19
- package/src/engine/systems/index.ts +3 -1
- package/src/engine/systems/input-mirror.ts +101 -3
- package/src/engine/systems/resource-upload.ts +96 -44
- package/src/engine/systems/response-decode.ts +69 -15
- package/src/engine/systems/scene-sync.ts +306 -0
- package/src/engine/systems/ui-bridge.ts +360 -0
- package/src/engine/systems/utils.ts +43 -1
- package/src/engine/systems/world-lifecycle.ts +37 -102
- package/src/engine/window/manager.ts +168 -0
- package/src/engine/world/entities.ts +821 -78
- package/src/engine/world/mount.ts +174 -0
- package/src/engine/world/types.ts +71 -0
- package/src/engine/world/world-ui.ts +266 -0
- package/src/engine/world/world3d.ts +280 -0
- package/src/index.ts +30 -1
- package/src/mount.ts +2 -0
- package/src/types/cmds/audio.ts +73 -48
- package/src/types/cmds/camera.ts +12 -8
- package/src/types/cmds/environment.ts +9 -3
- package/src/types/cmds/geometry.ts +13 -14
- package/src/types/cmds/index.ts +198 -168
- package/src/types/cmds/light.ts +12 -11
- package/src/types/cmds/material.ts +9 -11
- package/src/types/cmds/model.ts +17 -15
- package/src/types/cmds/realm.ts +25 -0
- package/src/types/cmds/system.ts +19 -0
- package/src/types/cmds/target.ts +82 -0
- package/src/types/cmds/texture.ts +13 -3
- package/src/types/cmds/ui.ts +220 -0
- package/src/types/cmds/window.ts +41 -204
- package/src/types/events/index.ts +4 -1
- package/src/types/events/pointer.ts +42 -13
- package/src/types/events/system.ts +144 -30
- package/src/types/events/ui.ts +21 -0
- package/src/types/index.ts +1 -0
- package/src/types/json.ts +15 -0
- package/src/window.ts +8 -0
- package/src/world-ui.ts +2 -0
- package/src/world3d.ts +10 -0
- package/tsconfig.json +0 -29
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { createWorld3D as createWorld3DRaw } from '../api';
|
|
2
|
+
import type {
|
|
3
|
+
CameraProps,
|
|
4
|
+
GeometryProps,
|
|
5
|
+
LightProps,
|
|
6
|
+
MaterialProps,
|
|
7
|
+
ModelProps,
|
|
8
|
+
TagProps,
|
|
9
|
+
TextureProps,
|
|
10
|
+
TransformProps,
|
|
11
|
+
} from '../ecs';
|
|
12
|
+
import type {
|
|
13
|
+
CmdAudioListenerUpdateArgs,
|
|
14
|
+
CmdAudioResourceUpsertArgs,
|
|
15
|
+
CmdAudioSourceCreateArgs,
|
|
16
|
+
CmdAudioSourceTransportArgs,
|
|
17
|
+
} from '../../types/cmds/audio';
|
|
18
|
+
import type { EnvironmentConfig } from '../../types/cmds/environment';
|
|
19
|
+
import type { CmdGizmoDrawAabbArgs, CmdGizmoDrawLineArgs } from '../../types/cmds/gizmo';
|
|
20
|
+
import type { CmdPoseUpdateArgs } from '../../types/cmds/model';
|
|
21
|
+
import type { ShadowConfig } from '../../types/cmds/shadow';
|
|
22
|
+
import type { NotificationLevel } from '../../types/kinds';
|
|
23
|
+
import {
|
|
24
|
+
audioListenerUpdate as audioListenerUpdateRaw,
|
|
25
|
+
audioResourceCreate as audioResourceCreateRaw,
|
|
26
|
+
audioSourceCreate as audioSourceCreateRaw,
|
|
27
|
+
audioSourcePlay as audioSourcePlayRaw,
|
|
28
|
+
configureEnvironment as configureEnvironmentRaw,
|
|
29
|
+
configureShadows as configureShadowsRaw,
|
|
30
|
+
createCamera as createCameraRaw,
|
|
31
|
+
createEntity as createEntityRaw,
|
|
32
|
+
createGeometry as createGeometryRaw,
|
|
33
|
+
createLight as createLightRaw,
|
|
34
|
+
createMaterial as createMaterialRaw,
|
|
35
|
+
createModel as createModelRaw,
|
|
36
|
+
createTexture as createTextureRaw,
|
|
37
|
+
createTag as createTagRaw,
|
|
38
|
+
drawGizmoAabb as drawGizmoAabbRaw,
|
|
39
|
+
drawGizmoLine as drawGizmoLineRaw,
|
|
40
|
+
getModelId as getModelIdRaw,
|
|
41
|
+
getWindowSize as getWindowSizeRaw,
|
|
42
|
+
getWorldRealmId as getWorldRealmIdRaw,
|
|
43
|
+
isKeyPressed as isKeyPressedRaw,
|
|
44
|
+
isWindowCloseRequested as isWindowCloseRequestedRaw,
|
|
45
|
+
listCameras as listCamerasRaw,
|
|
46
|
+
listGeometries as listGeometriesRaw,
|
|
47
|
+
listLights as listLightsRaw,
|
|
48
|
+
listMaterials as listMaterialsRaw,
|
|
49
|
+
listModels as listModelsRaw,
|
|
50
|
+
listTextures as listTexturesRaw,
|
|
51
|
+
poseUpdate as poseUpdateRaw,
|
|
52
|
+
removeEntity as removeEntityRaw,
|
|
53
|
+
sendNotification as sendNotificationRaw,
|
|
54
|
+
setParent as setParentRaw,
|
|
55
|
+
updateTransform as updateTransformRaw,
|
|
56
|
+
} from './entities';
|
|
57
|
+
import type {
|
|
58
|
+
CommandId,
|
|
59
|
+
EntityId,
|
|
60
|
+
GeometryId,
|
|
61
|
+
MaterialId,
|
|
62
|
+
TextureId,
|
|
63
|
+
World3DId,
|
|
64
|
+
} from './types';
|
|
65
|
+
import {
|
|
66
|
+
asCommandId,
|
|
67
|
+
asEntityId,
|
|
68
|
+
asGeometryId,
|
|
69
|
+
asMaterialId,
|
|
70
|
+
asTextureId,
|
|
71
|
+
asWorld3DId,
|
|
72
|
+
asWorldNumber,
|
|
73
|
+
} from './types';
|
|
74
|
+
|
|
75
|
+
export type Create3DWorldOptions = {
|
|
76
|
+
outputSurfaceId?: number;
|
|
77
|
+
importance?: number;
|
|
78
|
+
cachePolicy?: number;
|
|
79
|
+
flags?: number;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type Create3DAudioSourceArgs = Omit<CmdAudioSourceCreateArgs, 'realmId' | 'modelId'>
|
|
83
|
+
& ({ modelId: number } | { entityId: EntityId });
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Creates a 3D world.
|
|
87
|
+
*
|
|
88
|
+
* The world is realm-backed internally, but realm details are hidden from this API.
|
|
89
|
+
* Use `Mount.mountWorld(...)` to present this world into one or more targets.
|
|
90
|
+
*/
|
|
91
|
+
export function create3DWorld(options?: Create3DWorldOptions): World3DId {
|
|
92
|
+
return asWorld3DId(createWorld3DRaw(options));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Creates an entity in a 3D world. */
|
|
96
|
+
export function create3DEntity(worldId: World3DId): EntityId {
|
|
97
|
+
return asEntityId(createEntityRaw(asWorldNumber(worldId)));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Removes an entity and all mirrored components from a 3D world. */
|
|
101
|
+
export function remove3DEntity(worldId: World3DId, entityId: EntityId): void {
|
|
102
|
+
removeEntityRaw(asWorldNumber(worldId), entityId as number);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Upserts camera component intent for an entity in a 3D world. */
|
|
106
|
+
export function create3DCamera(worldId: World3DId, entityId: EntityId, props: CameraProps): void {
|
|
107
|
+
createCameraRaw(asWorldNumber(worldId), entityId as number, props);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Upserts light component intent for an entity in a 3D world. */
|
|
111
|
+
export function create3DLight(worldId: World3DId, entityId: EntityId, props: LightProps): void {
|
|
112
|
+
createLightRaw(asWorldNumber(worldId), entityId as number, props);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Upserts model component intent for an entity in a 3D world. */
|
|
116
|
+
export function create3DModel(worldId: World3DId, entityId: EntityId, props: ModelProps): void {
|
|
117
|
+
createModelRaw(asWorldNumber(worldId), entityId as number, props);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Upserts transform component intent for an entity in a 3D world. */
|
|
121
|
+
export function update3DTransform(worldId: World3DId, entityId: EntityId, props: TransformProps): void {
|
|
122
|
+
updateTransformRaw(asWorldNumber(worldId), entityId as number, props);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Attaches or updates a tag component in a 3D world. */
|
|
126
|
+
export function create3DTag(worldId: World3DId, entityId: EntityId, props: TagProps): void {
|
|
127
|
+
createTagRaw(asWorldNumber(worldId), entityId as number, props);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Sets parent-child relationship between entities. */
|
|
131
|
+
export function set3DParent(worldId: World3DId, childEntityId: EntityId, parentEntityId: EntityId | null): void {
|
|
132
|
+
setParentRaw(asWorldNumber(worldId), childEntityId as number, parentEntityId as number | null);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Creates a material resource and returns its typed id. */
|
|
136
|
+
export function create3DMaterial(worldId: World3DId, props: MaterialProps): MaterialId {
|
|
137
|
+
return asMaterialId(createMaterialRaw(asWorldNumber(worldId), props));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Creates a geometry resource and returns its typed id. */
|
|
141
|
+
export function create3DGeometry(worldId: World3DId, props: GeometryProps): GeometryId {
|
|
142
|
+
return asGeometryId(createGeometryRaw(asWorldNumber(worldId), props));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Creates a texture resource and returns its typed id. */
|
|
146
|
+
export function create3DTexture(worldId: World3DId, props: TextureProps): TextureId {
|
|
147
|
+
return asTextureId(createTextureRaw(asWorldNumber(worldId), props));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Configures environment/post-processing for a 3D world. */
|
|
151
|
+
export function configure3DEnvironment(worldId: World3DId, config: EnvironmentConfig): void {
|
|
152
|
+
configureEnvironmentRaw(asWorldNumber(worldId), config);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Configures shadows for a 3D world. */
|
|
156
|
+
export function configure3DShadows(worldId: World3DId, config: ShadowConfig): void {
|
|
157
|
+
configureShadowsRaw(asWorldNumber(worldId), config);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Draws a debug line gizmo. */
|
|
161
|
+
export function draw3DGizmoLine(worldId: World3DId, args: CmdGizmoDrawLineArgs): void {
|
|
162
|
+
drawGizmoLineRaw(asWorldNumber(worldId), args);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Draws a debug axis-aligned bounding box gizmo. */
|
|
166
|
+
export function draw3DGizmoAabb(worldId: World3DId, args: CmdGizmoDrawAabbArgs): void {
|
|
167
|
+
drawGizmoAabbRaw(asWorldNumber(worldId), args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Updates pose data for XR/trackers. */
|
|
171
|
+
export function update3DPose(worldId: World3DId, args: CmdPoseUpdateArgs): CommandId {
|
|
172
|
+
return asCommandId(poseUpdateRaw(asWorldNumber(worldId), args));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Requests a model list from core for this world. */
|
|
176
|
+
export function list3DModels(worldId: World3DId): CommandId {
|
|
177
|
+
return asCommandId(listModelsRaw(asWorldNumber(worldId)));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Requests a material list from core for this world. */
|
|
181
|
+
export function list3DMaterials(worldId: World3DId): CommandId {
|
|
182
|
+
return asCommandId(listMaterialsRaw(asWorldNumber(worldId)));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Requests a texture list from core for this world. */
|
|
186
|
+
export function list3DTextures(worldId: World3DId): CommandId {
|
|
187
|
+
return asCommandId(listTexturesRaw(asWorldNumber(worldId)));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Requests a geometry list from core for this world. */
|
|
191
|
+
export function list3DGeometries(worldId: World3DId): CommandId {
|
|
192
|
+
return asCommandId(listGeometriesRaw(asWorldNumber(worldId)));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Requests a light list from core for this world. */
|
|
196
|
+
export function list3DLights(worldId: World3DId): CommandId {
|
|
197
|
+
return asCommandId(listLightsRaw(asWorldNumber(worldId)));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Requests a camera list from core for this world. */
|
|
201
|
+
export function list3DCameras(worldId: World3DId): CommandId {
|
|
202
|
+
return asCommandId(listCamerasRaw(asWorldNumber(worldId)));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Returns true while a key is pressed in this world input state. */
|
|
206
|
+
export function is3DKeyPressed(worldId: World3DId, keyCode: number): boolean {
|
|
207
|
+
return isKeyPressedRaw(asWorldNumber(worldId), keyCode);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Returns true when close was requested for this world's primary window. */
|
|
211
|
+
export function is3DWindowCloseRequested(worldId: World3DId): boolean {
|
|
212
|
+
return isWindowCloseRequestedRaw(asWorldNumber(worldId));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Returns current size for this world's primary window. */
|
|
216
|
+
export function get3DWindowSize(worldId: World3DId): [number, number] {
|
|
217
|
+
return getWindowSizeRaw(asWorldNumber(worldId));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Sends a host notification scoped to this world. */
|
|
221
|
+
export function send3DNotification(
|
|
222
|
+
worldId: World3DId,
|
|
223
|
+
args: { level: NotificationLevel; title: string; message: string },
|
|
224
|
+
): void {
|
|
225
|
+
sendNotificationRaw(asWorldNumber(worldId), args);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Updates audio listener parameters. */
|
|
229
|
+
export function update3DAudioListener(
|
|
230
|
+
worldId: World3DId,
|
|
231
|
+
args: CmdAudioListenerUpdateArgs,
|
|
232
|
+
): CommandId {
|
|
233
|
+
return asCommandId(audioListenerUpdateRaw(asWorldNumber(worldId), args));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Creates or updates an audio resource. */
|
|
237
|
+
export function create3DAudioResource(
|
|
238
|
+
worldId: World3DId,
|
|
239
|
+
args: CmdAudioResourceUpsertArgs,
|
|
240
|
+
): CommandId {
|
|
241
|
+
return asCommandId(audioResourceCreateRaw(asWorldNumber(worldId), args));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Creates an audio source with realm id resolved internally from world state. */
|
|
245
|
+
export function create3DAudioSource(
|
|
246
|
+
worldId: World3DId,
|
|
247
|
+
args: Create3DAudioSourceArgs,
|
|
248
|
+
): CommandId {
|
|
249
|
+
const rawWorldId = asWorldNumber(worldId);
|
|
250
|
+
const realmId = getWorldRealmIdRaw(rawWorldId);
|
|
251
|
+
if (realmId == null) {
|
|
252
|
+
throw new Error('World is not ready for audio source creation.');
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const modelId = 'modelId' in args
|
|
256
|
+
? args.modelId
|
|
257
|
+
: getModelIdRaw(rawWorldId, args.entityId as number);
|
|
258
|
+
if (modelId == null) {
|
|
259
|
+
throw new Error('Audio source entity has no resolved model yet.');
|
|
260
|
+
}
|
|
261
|
+
const baseArgs = 'modelId' in args
|
|
262
|
+
? args
|
|
263
|
+
: (({ entityId: _entityId, ...rest }) => rest)(args);
|
|
264
|
+
|
|
265
|
+
return asCommandId(
|
|
266
|
+
audioSourceCreateRaw(rawWorldId, {
|
|
267
|
+
...baseArgs,
|
|
268
|
+
modelId,
|
|
269
|
+
realmId,
|
|
270
|
+
}),
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Starts playback on an audio source. */
|
|
275
|
+
export function play3DAudioSource(
|
|
276
|
+
worldId: World3DId,
|
|
277
|
+
args: Omit<CmdAudioSourceTransportArgs, 'action'>,
|
|
278
|
+
): CommandId {
|
|
279
|
+
return asCommandId(audioSourcePlayRaw(asWorldNumber(worldId), args));
|
|
280
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
export { EngineError } from './engine/errors';
|
|
2
|
-
export * from './engine/api';
|
|
3
2
|
export * from './engine/ecs';
|
|
3
|
+
export * as Mount from './engine/world/mount';
|
|
4
|
+
export * as World3D from './engine/world/world3d';
|
|
5
|
+
export * as WorldUI from './engine/world/world-ui';
|
|
6
|
+
export {
|
|
7
|
+
disposeEngine,
|
|
8
|
+
initEngine,
|
|
9
|
+
registerComponent,
|
|
10
|
+
registerSystem,
|
|
11
|
+
tick,
|
|
12
|
+
uploadBuffer,
|
|
13
|
+
} from './engine/api';
|
|
14
|
+
export {
|
|
15
|
+
closeWindow,
|
|
16
|
+
createWindow,
|
|
17
|
+
focusWindow,
|
|
18
|
+
requestAttention,
|
|
19
|
+
updateWindow,
|
|
20
|
+
} from './engine/window/manager';
|
|
21
|
+
export type {
|
|
22
|
+
CommandId,
|
|
23
|
+
EntityId,
|
|
24
|
+
GeometryId,
|
|
25
|
+
MaterialId,
|
|
26
|
+
TargetId,
|
|
27
|
+
TextureId,
|
|
28
|
+
WindowId,
|
|
29
|
+
World3DId,
|
|
30
|
+
WorldId,
|
|
31
|
+
WorldUIId,
|
|
32
|
+
} from './engine/world/types';
|
|
4
33
|
export * as Types from './types';
|
|
5
34
|
export type {
|
|
6
35
|
BufferResult,
|
package/src/mount.ts
ADDED
package/src/types/cmds/audio.ts
CHANGED
|
@@ -19,13 +19,13 @@ export interface CmdAudioListenerUpdateArgs {
|
|
|
19
19
|
|
|
20
20
|
/** Command payload for binding the listener to a model. */
|
|
21
21
|
export interface CmdAudioListenerCreateArgs {
|
|
22
|
-
|
|
22
|
+
realmId: number;
|
|
23
23
|
modelId: number;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** Command payload for disposing the listener binding. */
|
|
27
27
|
export interface CmdAudioListenerDisposeArgs {
|
|
28
|
-
|
|
28
|
+
realmId: number;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface CmdResultAudioListenerCreate {
|
|
@@ -43,30 +43,26 @@ export interface CmdResultAudioListenerUpdate {
|
|
|
43
43
|
message: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
export
|
|
46
|
+
/** Upsert payload accepted by the core (`create` or `update`). */
|
|
47
|
+
export type CmdAudioListenerUpsertArgs =
|
|
48
|
+
| CmdAudioListenerCreateArgs
|
|
49
|
+
| CmdAudioListenerUpdateArgs;
|
|
50
|
+
|
|
51
|
+
/** Backward-compatible aliases. */
|
|
52
|
+
export type CmdResultAudioListenerUpsert = CmdResultAudioListenerUpdate;
|
|
53
|
+
|
|
54
|
+
/** Command payload for creating/updating an audio resource from uploaded bytes. */
|
|
55
|
+
export interface CmdAudioResourceUpsertArgs {
|
|
48
56
|
resourceId: number;
|
|
49
57
|
bufferId: number;
|
|
50
58
|
totalBytes?: number;
|
|
51
59
|
offsetBytes?: number;
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
export interface
|
|
62
|
+
export interface CmdResultAudioResourceUpsert {
|
|
55
63
|
success: boolean;
|
|
56
64
|
message: string;
|
|
57
65
|
pending: boolean;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Command payload for pushing a stream chunk. */
|
|
61
|
-
export interface CmdAudioResourcePushArgs {
|
|
62
|
-
resourceId: number;
|
|
63
|
-
bufferId: number;
|
|
64
|
-
offsetBytes: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface CmdResultAudioResourcePush {
|
|
68
|
-
success: boolean;
|
|
69
|
-
message: string;
|
|
70
66
|
receivedBytes: number;
|
|
71
67
|
totalBytes: number;
|
|
72
68
|
complete: boolean;
|
|
@@ -74,7 +70,7 @@ export interface CmdResultAudioResourcePush {
|
|
|
74
70
|
|
|
75
71
|
/** Command payload for creating a source bound to a model. */
|
|
76
72
|
export interface CmdAudioSourceCreateArgs {
|
|
77
|
-
|
|
73
|
+
realmId: number;
|
|
78
74
|
sourceId: number;
|
|
79
75
|
modelId: number;
|
|
80
76
|
position: [number, number, number];
|
|
@@ -93,12 +89,14 @@ export interface CmdResultAudioSourceCreate {
|
|
|
93
89
|
/** Command payload for updating source params. */
|
|
94
90
|
export interface CmdAudioSourceUpdateArgs {
|
|
95
91
|
sourceId: number;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
realmId?: number;
|
|
93
|
+
modelId?: number;
|
|
94
|
+
position?: [number, number, number];
|
|
95
|
+
velocity?: [number, number, number];
|
|
96
|
+
orientation?: [number, number, number, number];
|
|
97
|
+
gain?: number;
|
|
98
|
+
pitch?: number;
|
|
99
|
+
spatial?: AudioSpatialParams;
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
export interface CmdResultAudioSourceUpdate {
|
|
@@ -106,59 +104,86 @@ export interface CmdResultAudioSourceUpdate {
|
|
|
106
104
|
message: string;
|
|
107
105
|
}
|
|
108
106
|
|
|
109
|
-
/**
|
|
110
|
-
export
|
|
107
|
+
/** Upsert payload accepted by the core (`create` or `update`). */
|
|
108
|
+
export type CmdAudioSourceUpsertArgs =
|
|
109
|
+
| CmdAudioSourceCreateArgs
|
|
110
|
+
| CmdAudioSourceUpdateArgs;
|
|
111
|
+
|
|
112
|
+
/** Backward-compatible aliases. */
|
|
113
|
+
export type CmdResultAudioSourceUpsert = CmdResultAudioSourceUpdate;
|
|
114
|
+
|
|
115
|
+
export type AudioSourceTransportAction = 'play' | 'pause' | 'stop';
|
|
116
|
+
|
|
117
|
+
/** Command payload for playback transport control. */
|
|
118
|
+
export interface CmdAudioSourceTransportArgs {
|
|
111
119
|
sourceId: number;
|
|
112
|
-
|
|
120
|
+
action: AudioSourceTransportAction;
|
|
121
|
+
resourceId?: number;
|
|
113
122
|
timelineId?: number;
|
|
114
|
-
intensity
|
|
123
|
+
intensity?: number;
|
|
115
124
|
delayMs?: number;
|
|
116
|
-
mode
|
|
125
|
+
mode?: AudioPlayMode;
|
|
117
126
|
}
|
|
118
127
|
|
|
119
|
-
export interface
|
|
128
|
+
export interface CmdResultAudioSourceTransport {
|
|
120
129
|
success: boolean;
|
|
121
130
|
message: string;
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
/** Command payload for
|
|
125
|
-
export interface
|
|
133
|
+
/** Command payload for disposing a source. */
|
|
134
|
+
export interface CmdAudioSourceDisposeArgs {
|
|
126
135
|
sourceId: number;
|
|
127
|
-
timelineId?: number;
|
|
128
136
|
}
|
|
129
137
|
|
|
130
|
-
export interface
|
|
138
|
+
export interface CmdResultAudioSourceDispose {
|
|
131
139
|
success: boolean;
|
|
132
140
|
message: string;
|
|
133
141
|
}
|
|
134
142
|
|
|
135
|
-
/** Command payload for
|
|
136
|
-
export interface
|
|
137
|
-
|
|
138
|
-
timelineId?: number;
|
|
143
|
+
/** Command payload for disposing an audio resource. */
|
|
144
|
+
export interface CmdAudioResourceDisposeArgs {
|
|
145
|
+
resourceId: number;
|
|
139
146
|
}
|
|
140
147
|
|
|
141
|
-
export interface
|
|
148
|
+
export interface CmdResultAudioResourceDispose {
|
|
142
149
|
success: boolean;
|
|
143
150
|
message: string;
|
|
144
151
|
}
|
|
145
152
|
|
|
146
|
-
/** Command payload for
|
|
147
|
-
export interface
|
|
148
|
-
|
|
153
|
+
/** Command payload for listing current audio runtime state. */
|
|
154
|
+
export interface CmdAudioStateGetArgs {
|
|
155
|
+
includeListener?: boolean;
|
|
156
|
+
includeSources?: boolean;
|
|
157
|
+
includeStreams?: boolean;
|
|
149
158
|
}
|
|
150
159
|
|
|
151
|
-
export interface
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
export interface AudioListenerBindingState {
|
|
161
|
+
realmId: number;
|
|
162
|
+
modelId: number;
|
|
154
163
|
}
|
|
155
164
|
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
export interface AudioSourceStateEntry {
|
|
166
|
+
sourceId: number;
|
|
167
|
+
realmId?: number;
|
|
168
|
+
modelId?: number;
|
|
169
|
+
position: [number, number, number];
|
|
170
|
+
velocity: [number, number, number];
|
|
171
|
+
orientation: [number, number, number, number];
|
|
172
|
+
gain: number;
|
|
173
|
+
pitch: number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface AudioStreamStateEntry {
|
|
158
177
|
resourceId: number;
|
|
178
|
+
receivedBytes: number;
|
|
179
|
+
totalBytes: number;
|
|
180
|
+
complete: boolean;
|
|
159
181
|
}
|
|
160
182
|
|
|
161
|
-
export interface
|
|
183
|
+
export interface CmdResultAudioStateGet {
|
|
162
184
|
success: boolean;
|
|
163
185
|
message: string;
|
|
186
|
+
listener?: AudioListenerBindingState;
|
|
187
|
+
sources: AudioSourceStateEntry[];
|
|
188
|
+
streams: AudioStreamStateEntry[];
|
|
164
189
|
}
|
package/src/types/cmds/camera.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface ViewPosition {
|
|
|
15
15
|
|
|
16
16
|
/** Command payload for creating a camera. */
|
|
17
17
|
export interface CmdCameraCreateArgs {
|
|
18
|
+
realmId: number;
|
|
18
19
|
cameraId: number;
|
|
19
20
|
label?: string;
|
|
20
21
|
transform: number[]; // Mat4 (16 elements)
|
|
@@ -27,14 +28,9 @@ export interface CmdCameraCreateArgs {
|
|
|
27
28
|
orthoScale: number;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
/** Result payload for camera create. */
|
|
31
|
-
export interface CmdResultCameraCreate {
|
|
32
|
-
success: boolean;
|
|
33
|
-
message: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
31
|
/** Command payload for updating a camera. */
|
|
37
32
|
export interface CmdCameraUpdateArgs {
|
|
33
|
+
realmId: number;
|
|
38
34
|
cameraId: number;
|
|
39
35
|
label?: string;
|
|
40
36
|
transform?: number[];
|
|
@@ -47,14 +43,22 @@ export interface CmdCameraUpdateArgs {
|
|
|
47
43
|
orthoScale?: number;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
/** Result payload for camera
|
|
51
|
-
export interface
|
|
46
|
+
/** Result payload for camera upsert. */
|
|
47
|
+
export interface CmdResultCameraUpsert {
|
|
52
48
|
success: boolean;
|
|
53
49
|
message: string;
|
|
54
50
|
}
|
|
55
51
|
|
|
52
|
+
/** Upsert payload accepted by the core (`create` or `update`). */
|
|
53
|
+
export type CmdCameraUpsertArgs = CmdCameraCreateArgs | CmdCameraUpdateArgs;
|
|
54
|
+
|
|
55
|
+
/** Backward-compatible aliases. */
|
|
56
|
+
export type CmdResultCameraCreate = CmdResultCameraUpsert;
|
|
57
|
+
export type CmdResultCameraUpdate = CmdResultCameraUpsert;
|
|
58
|
+
|
|
56
59
|
/** Command payload for disposing a camera. */
|
|
57
60
|
export interface CmdCameraDisposeArgs {
|
|
61
|
+
realmId: number;
|
|
58
62
|
cameraId: number;
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -55,24 +55,30 @@ export interface PostProcessConfig {
|
|
|
55
55
|
export interface EnvironmentConfig {
|
|
56
56
|
msaa: MsaaConfig;
|
|
57
57
|
skybox: SkyboxConfig;
|
|
58
|
+
clearColor: [number, number, number, number];
|
|
58
59
|
post: PostProcessConfig;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/** Command payload for creating environment settings. */
|
|
62
63
|
export interface CmdEnvironmentCreateArgs {
|
|
63
|
-
|
|
64
|
+
environmentId: number;
|
|
64
65
|
config: EnvironmentConfig;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
/** Command payload for updating environment settings. */
|
|
68
69
|
export interface CmdEnvironmentUpdateArgs {
|
|
69
|
-
|
|
70
|
+
environmentId: number;
|
|
70
71
|
config: EnvironmentConfig;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
/** Upsert payload accepted by the core (`create` or `update`). */
|
|
75
|
+
export type CmdEnvironmentUpsertArgs =
|
|
76
|
+
| CmdEnvironmentCreateArgs
|
|
77
|
+
| CmdEnvironmentUpdateArgs;
|
|
78
|
+
|
|
73
79
|
/** Command payload for disposing environment settings. */
|
|
74
80
|
export interface CmdEnvironmentDisposeArgs {
|
|
75
|
-
|
|
81
|
+
environmentId: number;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
/** Result payload for environment commands. */
|
|
@@ -32,35 +32,35 @@ export interface GeometryPrimitiveEntry {
|
|
|
32
32
|
|
|
33
33
|
/** Command payload for creating geometry from buffers. */
|
|
34
34
|
export interface CmdGeometryCreateArgs {
|
|
35
|
-
windowId: number;
|
|
36
35
|
geometryId: number;
|
|
37
36
|
label?: string;
|
|
38
37
|
entries: GeometryPrimitiveEntry[];
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
/** Result payload for geometry create. */
|
|
42
|
-
export interface CmdResultGeometryCreate {
|
|
43
|
-
success: boolean;
|
|
44
|
-
message: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
40
|
/** Command payload for updating geometry buffers or label. */
|
|
48
41
|
export interface CmdGeometryUpdateArgs {
|
|
49
|
-
windowId: number;
|
|
50
42
|
geometryId: number;
|
|
51
43
|
label?: string;
|
|
52
|
-
entries
|
|
44
|
+
entries?: GeometryPrimitiveEntry[];
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
/** Result payload for geometry
|
|
56
|
-
export interface
|
|
47
|
+
/** Result payload for geometry upsert. */
|
|
48
|
+
export interface CmdResultGeometryUpsert {
|
|
57
49
|
success: boolean;
|
|
58
50
|
message: string;
|
|
59
51
|
}
|
|
60
52
|
|
|
53
|
+
/** Upsert payload accepted by the core (`create` or `update`). */
|
|
54
|
+
export type CmdGeometryUpsertArgs =
|
|
55
|
+
| CmdGeometryCreateArgs
|
|
56
|
+
| CmdGeometryUpdateArgs;
|
|
57
|
+
|
|
58
|
+
/** Backward-compatible aliases. */
|
|
59
|
+
export type CmdResultGeometryCreate = CmdResultGeometryUpsert;
|
|
60
|
+
export type CmdResultGeometryUpdate = CmdResultGeometryUpsert;
|
|
61
|
+
|
|
61
62
|
/** Command payload for disposing geometry. */
|
|
62
63
|
export interface CmdGeometryDisposeArgs {
|
|
63
|
-
windowId: number;
|
|
64
64
|
geometryId: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -121,11 +121,10 @@ export type PrimitiveOptions =
|
|
|
121
121
|
|
|
122
122
|
/** Command payload for creating a primitive geometry. */
|
|
123
123
|
export interface CmdPrimitiveGeometryCreateArgs {
|
|
124
|
-
windowId: number;
|
|
125
124
|
geometryId: number;
|
|
126
125
|
label?: string;
|
|
127
126
|
shape: PrimitiveShape;
|
|
128
|
-
options
|
|
127
|
+
options?: PrimitiveOptions;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
/** Result payload for primitive geometry create. */
|