@vulfram/engine 0.14.8-alpha → 0.19.2-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.
Files changed (63) hide show
  1. package/README.md +106 -0
  2. package/package.json +60 -4
  3. package/src/core.ts +14 -0
  4. package/src/ecs.ts +1 -0
  5. package/src/engine/api.ts +222 -24
  6. package/src/engine/bridge/dispatch.ts +260 -40
  7. package/src/engine/bridge/guards.ts +4 -1
  8. package/src/engine/bridge/protocol.ts +69 -52
  9. package/src/engine/ecs/components.ts +340 -0
  10. package/src/engine/ecs/index.ts +3 -518
  11. package/src/engine/ecs/intents.ts +184 -0
  12. package/src/engine/ecs/systems.ts +26 -0
  13. package/src/engine/intents/store.ts +72 -0
  14. package/src/engine/state.ts +136 -5
  15. package/src/engine/systems/command-intent.ts +159 -14
  16. package/src/engine/systems/constraint-solve.ts +167 -0
  17. package/src/engine/systems/core-command-builder.ts +9 -268
  18. package/src/engine/systems/diagnostics.ts +20 -29
  19. package/src/engine/systems/index.ts +3 -1
  20. package/src/engine/systems/input-mirror.ts +257 -21
  21. package/src/engine/systems/resource-upload.ts +108 -58
  22. package/src/engine/systems/response-decode.ts +86 -15
  23. package/src/engine/systems/scene-sync.ts +305 -0
  24. package/src/engine/systems/ui-bridge.ts +381 -0
  25. package/src/engine/systems/utils.ts +86 -1
  26. package/src/engine/systems/world-lifecycle.ts +43 -114
  27. package/src/engine/window/manager.ts +168 -0
  28. package/src/engine/world/entities.ts +998 -91
  29. package/src/engine/world/mount.ts +195 -0
  30. package/src/engine/world/types.ts +71 -0
  31. package/src/engine/world/world-ui.ts +313 -0
  32. package/src/engine/world/world3d.ts +529 -0
  33. package/src/helpers/collision.ts +487 -0
  34. package/src/helpers/index.ts +2 -0
  35. package/src/helpers/raycast.ts +442 -0
  36. package/src/index.ts +30 -1
  37. package/src/mount.ts +2 -0
  38. package/src/types/cmds/audio.ts +73 -48
  39. package/src/types/cmds/camera.ts +12 -8
  40. package/src/types/cmds/environment.ts +9 -3
  41. package/src/types/cmds/geometry.ts +15 -16
  42. package/src/types/cmds/index.ts +234 -162
  43. package/src/types/cmds/input.ts +39 -0
  44. package/src/types/cmds/light.ts +12 -11
  45. package/src/types/cmds/material.ts +19 -21
  46. package/src/types/cmds/model.ts +17 -15
  47. package/src/types/cmds/realm.ts +23 -0
  48. package/src/types/cmds/system.ts +29 -0
  49. package/src/types/cmds/target.ts +96 -0
  50. package/src/types/cmds/texture.ts +13 -3
  51. package/src/types/cmds/ui.ts +220 -0
  52. package/src/types/cmds/window.ts +41 -204
  53. package/src/types/events/index.ts +4 -1
  54. package/src/types/events/keyboard.ts +2 -2
  55. package/src/types/events/pointer.ts +85 -13
  56. package/src/types/events/system.ts +188 -30
  57. package/src/types/events/ui.ts +21 -0
  58. package/src/types/index.ts +1 -0
  59. package/src/types/json.ts +15 -0
  60. package/src/window.ts +8 -0
  61. package/src/world-ui.ts +2 -0
  62. package/src/world3d.ts +10 -0
  63. package/tsconfig.json +0 -29
@@ -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 update. */
51
- export interface CmdResultCameraUpdate {
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
- windowId: number;
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
- windowId: number;
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
- windowId: number;
81
+ environmentId: number;
76
82
  }
77
83
 
78
84
  /** Result payload for environment commands. */
@@ -8,7 +8,7 @@ export type GeometryPrimitiveType =
8
8
  | 'normal'
9
9
  | 'tangent'
10
10
  | 'color'
11
- | 'uv'
11
+ | 'u-v'
12
12
  | 'skin-joints'
13
13
  | 'skin-weights';
14
14
 
@@ -19,7 +19,7 @@ export const GeometryPrimitiveType = {
19
19
  Normal: 'normal' as const,
20
20
  Tangent: 'tangent' as const,
21
21
  Color: 'color' as const,
22
- UV: 'uv' as const,
22
+ UV: 'u-v' as const,
23
23
  SkinJoints: 'skin-joints' as const,
24
24
  SkinWeights: 'skin-weights' as const,
25
25
  };
@@ -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: GeometryPrimitiveEntry[];
44
+ entries?: GeometryPrimitiveEntry[];
53
45
  }
54
46
 
55
- /** Result payload for geometry update. */
56
- export interface CmdResultGeometryUpdate {
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: PrimitiveOptions;
127
+ options?: PrimitiveOptions;
129
128
  }
130
129
 
131
130
  /** Result payload for primitive geometry create. */
@@ -1,108 +1,84 @@
1
- import * as Sys from './system';
2
- import * as Win from './window';
1
+ import * as Audio from './audio';
3
2
  import * as Cam from './camera';
4
- import * as Mod from './model';
3
+ import * as Env from './environment';
4
+ import * as Geo from './geometry';
5
+ import * as Giz from './gizmo';
6
+ import * as Input from './input';
5
7
  import * as Lite from './light';
6
8
  import * as Mat from './material';
9
+ import * as Mod from './model';
10
+ import * as Realm from './realm';
11
+ import * as Sys from './system';
12
+ import * as Target from './target';
7
13
  import * as Tex from './texture';
8
- import * as Geo from './geometry';
9
- import * as Shad from './shadow';
10
- import * as Giz from './gizmo';
11
- import * as Env from './environment';
12
- import * as Audio from './audio';
13
- import * as RenderGraph from './render-graph';
14
+ import * as Ui from './ui';
15
+ import * as Win from './window';
14
16
 
15
- export * from './system';
16
- export * from './window';
17
+ export * from './audio';
17
18
  export * from './camera';
18
- export * from './model';
19
- export * from './light';
20
- export * from './material';
21
- export * from './texture';
19
+ export * from './environment';
22
20
  export * from './geometry';
23
- export * from './shadow';
24
21
  export * from './gizmo';
25
- export * from './environment';
26
- export * from './audio';
22
+ export * from './input';
23
+ export * from './light';
24
+ export * from './material';
25
+ export * from './model';
26
+ export * from './realm';
27
27
  export * from './render-graph';
28
28
  export * from './resources';
29
+ export * from './shadow';
30
+ export * from './system';
31
+ export * from './target';
32
+ export * from './texture';
33
+ export * from './ui';
34
+ export * from './window';
29
35
 
30
- /** Discriminated union of all core commands. */
36
+ /**
37
+ * Discriminated union of all commands accepted by core.
38
+ *
39
+ * Routing convention:
40
+ * - world-scoped commands are dispatched through the world command queue
41
+ * - global commands are dispatched through the global command queue
42
+ */
31
43
  export type EngineCmd =
32
44
  | { type: 'cmd-notification-send'; content: Sys.CmdNotificationSendArgs }
33
45
  | {
34
- type: 'cmd-upload-buffer-discard-all';
35
- content: Sys.CmdUploadBufferDiscardAllArgs;
46
+ type: 'cmd-system-diagnostics-set';
47
+ content: Sys.CmdSystemDiagnosticsSetArgs;
36
48
  }
37
- | { type: 'cmd-window-create'; content: Win.CmdWindowCreateArgs }
38
- | { type: 'cmd-window-close'; content: Win.CmdWindowCloseArgs }
39
- | { type: 'cmd-window-set-title'; content: Win.CmdWindowSetTitleArgs }
40
- | { type: 'cmd-window-set-position'; content: Win.CmdWindowSetPositionArgs }
41
- | { type: 'cmd-window-get-position'; content: Win.CmdWindowGetPositionArgs }
42
- | { type: 'cmd-window-set-size'; content: Win.CmdWindowSetSizeArgs }
43
- | { type: 'cmd-window-get-size'; content: Win.CmdWindowGetSizeArgs }
44
49
  | {
45
- type: 'cmd-window-get-outer-size';
46
- content: Win.CmdWindowGetOuterSizeArgs;
50
+ type: 'cmd-system-build-version-get';
51
+ content: Sys.CmdSystemBuildVersionGetArgs;
47
52
  }
53
+ | { type: 'cmd-window-create'; content: Win.CmdWindowCreateArgs }
54
+ | { type: 'cmd-window-close'; content: Win.CmdWindowCloseArgs }
55
+ | { type: 'cmd-window-measurement'; content: Win.CmdWindowMeasurementArgs }
56
+ | { type: 'cmd-window-cursor'; content: Win.CmdWindowCursorArgs }
57
+ | { type: 'cmd-window-state'; content: Win.CmdWindowStateArgs }
48
58
  | {
49
- type: 'cmd-window-get-surface-size';
50
- content: Win.CmdWindowGetSurfaceSizeArgs;
51
- }
52
- | { type: 'cmd-window-set-state'; content: Win.CmdWindowSetStateArgs }
53
- | { type: 'cmd-window-get-state'; content: Win.CmdWindowGetStateArgs }
54
- | { type: 'cmd-window-set-icon'; content: Win.CmdWindowSetIconArgs }
55
- | {
56
- type: 'cmd-window-set-decorations';
57
- content: Win.CmdWindowSetDecorationsArgs;
58
- }
59
- | {
60
- type: 'cmd-window-has-decorations';
61
- content: Win.CmdWindowHasDecorationsArgs;
62
- }
63
- | { type: 'cmd-window-set-resizable'; content: Win.CmdWindowSetResizableArgs }
64
- | { type: 'cmd-window-is-resizable'; content: Win.CmdWindowIsResizableArgs }
65
- | {
66
- type: 'cmd-window-request-attention';
67
- content: Win.CmdWindowRequestAttentionArgs;
59
+ type: 'cmd-input-target-listener-upsert';
60
+ content: Input.CmdInputTargetListenerUpsertArgs;
68
61
  }
69
- | { type: 'cmd-window-focus'; content: Win.CmdWindowFocusArgs }
70
62
  | {
71
- type: 'cmd-window-set-cursor-visible';
72
- content: Win.CmdWindowSetCursorVisibleArgs;
63
+ type: 'cmd-input-target-listener-dispose';
64
+ content: Input.CmdInputTargetListenerDisposeArgs;
73
65
  }
74
66
  | {
75
- type: 'cmd-window-set-cursor-grab';
76
- content: Win.CmdWindowSetCursorGrabArgs;
67
+ type: 'cmd-input-target-listener-list';
68
+ content: Input.CmdInputTargetListenerListArgs;
77
69
  }
78
70
  | {
79
- type: 'cmd-window-set-cursor-icon';
80
- content: Win.CmdWindowSetCursorIconArgs;
71
+ type: 'cmd-upload-buffer-discard-all';
72
+ content: Sys.CmdUploadBufferDiscardAllArgs;
81
73
  }
82
- | { type: 'cmd-camera-create'; content: Cam.CmdCameraCreateArgs }
83
- | { type: 'cmd-camera-update'; content: Cam.CmdCameraUpdateArgs }
74
+ | { type: 'cmd-camera-upsert'; content: Cam.CmdCameraUpsertArgs }
84
75
  | { type: 'cmd-camera-dispose'; content: Cam.CmdCameraDisposeArgs }
76
+ | { type: 'cmd-model-upsert'; content: Mod.CmdModelUpsertArgs }
85
77
  | { type: 'cmd-pose-update'; content: Mod.CmdPoseUpdateArgs }
86
- | { type: 'cmd-audio-listener-update'; content: Audio.CmdAudioListenerUpdateArgs }
87
- | { type: 'cmd-audio-listener-create'; content: Audio.CmdAudioListenerCreateArgs }
88
- | { type: 'cmd-audio-listener-dispose'; content: Audio.CmdAudioListenerDisposeArgs }
89
- | { type: 'cmd-audio-resource-create'; content: Audio.CmdAudioResourceCreateArgs }
90
- | { type: 'cmd-audio-resource-push'; content: Audio.CmdAudioResourcePushArgs }
91
- | { type: 'cmd-audio-resource-dispose'; content: Audio.CmdAudioResourceDisposeArgs }
92
- | { type: 'cmd-audio-source-create'; content: Audio.CmdAudioSourceCreateArgs }
93
- | { type: 'cmd-audio-source-update'; content: Audio.CmdAudioSourceUpdateArgs }
94
- | { type: 'cmd-audio-source-play'; content: Audio.CmdAudioSourcePlayArgs }
95
- | { type: 'cmd-audio-source-pause'; content: Audio.CmdAudioSourcePauseArgs }
96
- | { type: 'cmd-audio-source-stop'; content: Audio.CmdAudioSourceStopArgs }
97
- | { type: 'cmd-audio-source-dispose'; content: Audio.CmdAudioSourceDisposeArgs }
98
- | { type: 'cmd-model-create'; content: Mod.CmdModelCreateArgs }
99
- | { type: 'cmd-model-update'; content: Mod.CmdModelUpdateArgs }
100
78
  | { type: 'cmd-model-dispose'; content: Mod.CmdModelDisposeArgs }
101
- | { type: 'cmd-light-create'; content: Lite.CmdLightCreateArgs }
102
- | { type: 'cmd-light-update'; content: Lite.CmdLightUpdateArgs }
79
+ | { type: 'cmd-light-upsert'; content: Lite.CmdLightUpsertArgs }
103
80
  | { type: 'cmd-light-dispose'; content: Lite.CmdLightDisposeArgs }
104
- | { type: 'cmd-material-create'; content: Mat.CmdMaterialCreateArgs }
105
- | { type: 'cmd-material-update'; content: Mat.CmdMaterialUpdateArgs }
81
+ | { type: 'cmd-material-upsert'; content: Mat.CmdMaterialUpsertArgs }
106
82
  | { type: 'cmd-material-dispose'; content: Mat.CmdMaterialDisposeArgs }
107
83
  | {
108
84
  type: 'cmd-texture-create-from-buffer';
@@ -113,18 +89,91 @@ export type EngineCmd =
113
89
  content: Tex.CmdTextureCreateSolidColorArgs;
114
90
  }
115
91
  | { type: 'cmd-texture-dispose'; content: Tex.CmdTextureDisposeArgs }
116
- | { type: 'cmd-geometry-create'; content: Geo.CmdGeometryCreateArgs }
117
- | { type: 'cmd-geometry-update'; content: Geo.CmdGeometryUpdateArgs }
92
+ | { type: 'cmd-texture-bind-target'; content: Tex.CmdTextureBindTargetArgs }
93
+ | {
94
+ type: 'cmd-audio-listener-upsert';
95
+ content: Audio.CmdAudioListenerUpsertArgs;
96
+ }
97
+ | {
98
+ type: 'cmd-audio-listener-dispose';
99
+ content: Audio.CmdAudioListenerDisposeArgs;
100
+ }
101
+ | {
102
+ type: 'cmd-audio-source-upsert';
103
+ content: Audio.CmdAudioSourceUpsertArgs;
104
+ }
105
+ | {
106
+ type: 'cmd-audio-resource-upsert';
107
+ content: Audio.CmdAudioResourceUpsertArgs;
108
+ }
109
+ | {
110
+ type: 'cmd-audio-source-transport';
111
+ content: Audio.CmdAudioSourceTransportArgs;
112
+ }
113
+ | { type: 'cmd-audio-state-get'; content: Audio.CmdAudioStateGetArgs }
114
+ | {
115
+ type: 'cmd-audio-source-dispose';
116
+ content: Audio.CmdAudioSourceDisposeArgs;
117
+ }
118
+ | {
119
+ type: 'cmd-audio-resource-dispose';
120
+ content: Audio.CmdAudioResourceDisposeArgs;
121
+ }
122
+ | { type: 'cmd-geometry-upsert'; content: Geo.CmdGeometryUpsertArgs }
118
123
  | { type: 'cmd-geometry-dispose'; content: Geo.CmdGeometryDisposeArgs }
119
124
  | {
120
125
  type: 'cmd-primitive-geometry-create';
121
126
  content: Geo.CmdPrimitiveGeometryCreateArgs;
122
127
  }
123
- | { type: 'cmd-environment-create'; content: Env.CmdEnvironmentCreateArgs }
124
- | { type: 'cmd-environment-update'; content: Env.CmdEnvironmentUpdateArgs }
125
- | { type: 'cmd-environment-dispose'; content: Env.CmdEnvironmentDisposeArgs }
126
- | { type: 'cmd-shadow-configure'; content: Shad.CmdShadowConfigureArgs }
127
- | { type: 'cmd-render-graph-set'; content: RenderGraph.CmdRenderGraphSetArgs }
128
+ | { type: 'cmd-environment-upsert'; content: Env.CmdEnvironmentUpsertArgs }
129
+ | {
130
+ type: 'cmd-environment-dispose';
131
+ content: Env.CmdEnvironmentDisposeArgs;
132
+ }
133
+ | { type: 'cmd-shadow-configure'; content: import('./shadow').CmdShadowConfigureArgs }
134
+ | { type: 'cmd-realm-create'; content: Realm.CmdRealmCreateArgs }
135
+ | { type: 'cmd-realm-dispose'; content: Realm.CmdRealmDisposeArgs }
136
+ | { type: 'cmd-target-upsert'; content: Target.CmdTargetUpsertArgs }
137
+ | {
138
+ type: 'cmd-target-measurement';
139
+ content: Target.CmdTargetMeasurementArgs;
140
+ }
141
+ | { type: 'cmd-target-dispose'; content: Target.CmdTargetDisposeArgs }
142
+ | {
143
+ type: 'cmd-target-layer-upsert';
144
+ content: Target.CmdTargetLayerUpsertArgs;
145
+ }
146
+ | {
147
+ type: 'cmd-target-layer-dispose';
148
+ content: Target.CmdTargetLayerDisposeArgs;
149
+ }
150
+ | { type: 'cmd-ui-theme-define'; content: Ui.CmdUiThemeDefineArgs }
151
+ | { type: 'cmd-ui-theme-dispose'; content: Ui.CmdUiThemeDisposeArgs }
152
+ | { type: 'cmd-ui-document-create'; content: Ui.CmdUiDocumentCreateArgs }
153
+ | { type: 'cmd-ui-document-dispose'; content: Ui.CmdUiDocumentDisposeArgs }
154
+ | { type: 'cmd-ui-document-set-rect'; content: Ui.CmdUiDocumentSetRectArgs }
155
+ | { type: 'cmd-ui-document-set-theme'; content: Ui.CmdUiDocumentSetThemeArgs }
156
+ | { type: 'cmd-ui-document-get-tree'; content: Ui.CmdUiDocumentGetTreeArgs }
157
+ | {
158
+ type: 'cmd-ui-document-get-layout-rects';
159
+ content: Ui.CmdUiDocumentGetLayoutRectsArgs;
160
+ }
161
+ | { type: 'cmd-ui-apply-ops'; content: Ui.CmdUiApplyOpsArgs }
162
+ | { type: 'cmd-ui-debug-set'; content: Ui.CmdUiDebugSetArgs }
163
+ | { type: 'cmd-ui-focus-set'; content: Ui.CmdUiFocusSetArgs }
164
+ | { type: 'cmd-ui-focus-get'; content: Ui.CmdUiFocusGetArgs }
165
+ | { type: 'cmd-ui-event-trace-set'; content: Ui.CmdUiEventTraceSetArgs }
166
+ | {
167
+ type: 'cmd-ui-image-create-from-buffer';
168
+ content: Ui.CmdUiImageCreateFromBufferArgs;
169
+ }
170
+ | { type: 'cmd-ui-image-dispose'; content: Ui.CmdUiImageDisposeArgs }
171
+ | { type: 'cmd-ui-clipboard-paste'; content: Ui.CmdUiClipboardPasteArgs }
172
+ | { type: 'cmd-ui-screenshot-reply'; content: Ui.CmdUiScreenshotReplyArgs }
173
+ | {
174
+ type: 'cmd-ui-access-kit-action-request';
175
+ content: Ui.CmdUiAccessKitActionRequestArgs;
176
+ }
128
177
  | { type: 'cmd-model-list'; content: Mod.CmdModelListArgs }
129
178
  | { type: 'cmd-material-list'; content: Mat.CmdMaterialListArgs }
130
179
  | { type: 'cmd-texture-list'; content: Tex.CmdTextureListArgs }
@@ -134,79 +183,46 @@ export type EngineCmd =
134
183
  | { type: 'cmd-gizmo-draw-line'; content: Giz.CmdGizmoDrawLineArgs }
135
184
  | { type: 'cmd-gizmo-draw-aabb'; content: Giz.CmdGizmoDrawAabbArgs };
136
185
 
137
- /** Discriminated union of all core command responses. */
186
+ /** Discriminated union of all command responses returned by core. */
138
187
  export type CommandResponse =
139
188
  | { type: 'notification-send'; content: Sys.CmdResultNotificationSend }
140
189
  | {
141
- type: 'upload-buffer-discard-all';
142
- content: Sys.CmdResultUploadBufferDiscardAll;
143
- }
144
- | { type: 'window-create'; content: Win.CmdResultWindowCreate }
145
- | { type: 'window-close'; content: Win.CmdResultWindowClose }
146
- | { type: 'window-set-title'; content: Win.CmdResultWindowSetTitle }
147
- | { type: 'window-set-position'; content: Win.CmdResultWindowSetPosition }
148
- | { type: 'window-get-position'; content: Win.CmdResultWindowGetPosition }
149
- | { type: 'window-set-size'; content: Win.CmdResultWindowSetSize }
150
- | { type: 'window-get-size'; content: Win.CmdResultWindowGetSize }
151
- | { type: 'window-get-outer-size'; content: Win.CmdResultWindowGetOuterSize }
152
- | {
153
- type: 'window-get-surface-size';
154
- content: Win.CmdResultWindowGetSurfaceSize;
190
+ type: 'system-diagnostics-set';
191
+ content: Sys.CmdResultSystemDiagnosticsSet;
155
192
  }
156
- | { type: 'window-set-state'; content: Win.CmdResultWindowSetState }
157
- | { type: 'window-get-state'; content: Win.CmdResultWindowGetState }
158
- | { type: 'window-set-icon'; content: Win.CmdResultWindowSetIcon }
159
193
  | {
160
- type: 'window-set-decorations';
161
- content: Win.CmdResultWindowSetDecorations;
194
+ type: 'system-build-version-get';
195
+ content: Sys.CmdResultSystemBuildVersionGet;
162
196
  }
197
+ | { type: 'window-create'; content: Win.CmdResultWindowCreate }
198
+ | { type: 'window-close'; content: Win.CmdResultWindowClose }
199
+ | { type: 'window-measurement'; content: Win.CmdResultWindowMeasurement }
200
+ | { type: 'window-cursor'; content: Win.CmdResultWindowCursor }
201
+ | { type: 'window-state'; content: Win.CmdResultWindowState }
163
202
  | {
164
- type: 'window-has-decorations';
165
- content: Win.CmdResultWindowHasDecorations;
166
- }
167
- | { type: 'window-set-resizable'; content: Win.CmdResultWindowSetResizable }
168
- | { type: 'window-is-resizable'; content: Win.CmdResultWindowIsResizable }
169
- | {
170
- type: 'window-request-attention';
171
- content: Win.CmdResultWindowRequestAttention;
203
+ type: 'input-target-listener-upsert';
204
+ content: Input.CmdResultInputTargetListenerUpsert;
172
205
  }
173
- | { type: 'window-focus'; content: Win.CmdResultWindowFocus }
174
206
  | {
175
- type: 'window-set-cursor-visible';
176
- content: Win.CmdResultWindowSetCursorVisible;
207
+ type: 'input-target-listener-dispose';
208
+ content: Input.CmdResultInputTargetListenerDispose;
177
209
  }
178
210
  | {
179
- type: 'window-set-cursor-grab';
180
- content: Win.CmdResultWindowSetCursorGrab;
211
+ type: 'input-target-listener-list';
212
+ content: Input.CmdResultInputTargetListenerList;
181
213
  }
182
214
  | {
183
- type: 'window-set-cursor-icon';
184
- content: Win.CmdResultWindowSetCursorIcon;
215
+ type: 'upload-buffer-discard-all';
216
+ content: Sys.CmdResultUploadBufferDiscardAll;
185
217
  }
186
- | { type: 'camera-create'; content: Cam.CmdResultCameraCreate }
187
- | { type: 'camera-update'; content: Cam.CmdResultCameraUpdate }
218
+ | { type: 'camera-upsert'; content: Cam.CmdResultCameraUpsert }
188
219
  | { type: 'camera-dispose'; content: Cam.CmdResultCameraDispose }
220
+ | { type: 'model-upsert'; content: Mod.CmdResultModelUpsert }
189
221
  | { type: 'pose-update'; content: Mod.CmdResultPoseUpdate }
190
- | { type: 'audio-listener-update'; content: Audio.CmdResultAudioListenerUpdate }
191
- | { type: 'audio-listener-create'; content: Audio.CmdResultAudioListenerCreate }
192
- | { type: 'audio-listener-dispose'; content: Audio.CmdResultAudioListenerDispose }
193
- | { type: 'audio-resource-create'; content: Audio.CmdResultAudioResourceCreate }
194
- | { type: 'audio-resource-push'; content: Audio.CmdResultAudioResourcePush }
195
- | { type: 'audio-resource-dispose'; content: Audio.CmdResultAudioResourceDispose }
196
- | { type: 'audio-source-create'; content: Audio.CmdResultAudioSourceCreate }
197
- | { type: 'audio-source-update'; content: Audio.CmdResultAudioSourceUpdate }
198
- | { type: 'audio-source-play'; content: Audio.CmdResultAudioSourcePlay }
199
- | { type: 'audio-source-pause'; content: Audio.CmdResultAudioSourcePause }
200
- | { type: 'audio-source-stop'; content: Audio.CmdResultAudioSourceStop }
201
- | { type: 'audio-source-dispose'; content: Audio.CmdResultAudioSourceDispose }
202
- | { type: 'model-create'; content: Mod.CmdResultModelCreate }
203
- | { type: 'model-update'; content: Mod.CmdResultModelUpdate }
204
222
  | { type: 'model-dispose'; content: Mod.CmdResultModelDispose }
205
- | { type: 'light-create'; content: Lite.CmdResultLightCreate }
206
- | { type: 'light-update'; content: Lite.CmdResultLightUpdate }
223
+ | { type: 'light-upsert'; content: Lite.CmdResultLightUpsert }
207
224
  | { type: 'light-dispose'; content: Lite.CmdResultLightDispose }
208
- | { type: 'material-create'; content: Mat.CmdResultMaterialCreate }
209
- | { type: 'material-update'; content: Mat.CmdResultMaterialUpdate }
225
+ | { type: 'material-upsert'; content: Mat.CmdResultMaterialUpsert }
210
226
  | { type: 'material-dispose'; content: Mat.CmdResultMaterialDispose }
211
227
  | {
212
228
  type: 'texture-create-from-buffer';
@@ -217,18 +233,88 @@ export type CommandResponse =
217
233
  content: Tex.CmdResultTextureCreateSolidColor;
218
234
  }
219
235
  | { type: 'texture-dispose'; content: Tex.CmdResultTextureDispose }
220
- | { type: 'geometry-create'; content: Geo.CmdResultGeometryCreate }
221
- | { type: 'geometry-update'; content: Geo.CmdResultGeometryUpdate }
236
+ | { type: 'texture-bind-target'; content: Tex.CmdResultTextureBindTarget }
237
+ | {
238
+ type: 'audio-listener-upsert';
239
+ content: Audio.CmdResultAudioListenerUpsert;
240
+ }
241
+ | {
242
+ type: 'audio-listener-dispose';
243
+ content: Audio.CmdResultAudioListenerDispose;
244
+ }
245
+ | {
246
+ type: 'audio-source-upsert';
247
+ content: Audio.CmdResultAudioSourceUpsert;
248
+ }
249
+ | {
250
+ type: 'audio-resource-upsert';
251
+ content: Audio.CmdResultAudioResourceUpsert;
252
+ }
253
+ | {
254
+ type: 'audio-source-transport';
255
+ content: Audio.CmdResultAudioSourceTransport;
256
+ }
257
+ | { type: 'audio-state-get'; content: Audio.CmdResultAudioStateGet }
258
+ | {
259
+ type: 'audio-source-dispose';
260
+ content: Audio.CmdResultAudioSourceDispose;
261
+ }
262
+ | {
263
+ type: 'audio-resource-dispose';
264
+ content: Audio.CmdResultAudioResourceDispose;
265
+ }
266
+ | { type: 'geometry-upsert'; content: Geo.CmdResultGeometryUpsert }
222
267
  | { type: 'geometry-dispose'; content: Geo.CmdResultGeometryDispose }
223
268
  | {
224
269
  type: 'primitive-geometry-create';
225
270
  content: Geo.CmdResultPrimitiveGeometryCreate;
226
271
  }
227
- | { type: 'environment-create'; content: Env.CmdResultEnvironment }
228
- | { type: 'environment-update'; content: Env.CmdResultEnvironment }
272
+ | { type: 'environment-upsert'; content: Env.CmdResultEnvironment }
229
273
  | { type: 'environment-dispose'; content: Env.CmdResultEnvironment }
230
- | { type: 'shadow-configure'; content: Shad.CmdResultShadowConfigure }
231
- | { type: 'render-graph-set'; content: RenderGraph.CmdResultRenderGraphSet }
274
+ | {
275
+ type: 'shadow-configure';
276
+ content: import('./shadow').CmdResultShadowConfigure;
277
+ }
278
+ | { type: 'realm-create'; content: Realm.CmdResultRealmCreate }
279
+ | { type: 'realm-dispose'; content: Realm.CmdResultRealmDispose }
280
+ | { type: 'target-upsert'; content: Target.CmdResultTargetUpsert }
281
+ | {
282
+ type: 'target-measurement';
283
+ content: Target.CmdResultTargetMeasurement;
284
+ }
285
+ | { type: 'target-dispose'; content: Target.CmdResultTargetDispose }
286
+ | {
287
+ type: 'target-layer-upsert';
288
+ content: Target.CmdResultTargetLayerUpsert;
289
+ }
290
+ | {
291
+ type: 'target-layer-dispose';
292
+ content: Target.CmdResultTargetLayerDispose;
293
+ }
294
+ | { type: 'ui-theme-define'; content: Ui.CmdResultUiThemeDefine }
295
+ | { type: 'ui-theme-dispose'; content: Ui.CmdResultUiThemeDispose }
296
+ | { type: 'ui-document-create'; content: Ui.CmdResultUiDocumentCreate }
297
+ | { type: 'ui-document-dispose'; content: Ui.CmdResultUiDocumentDispose }
298
+ | { type: 'ui-document-set-rect'; content: Ui.CmdResultUiDocumentSetRect }
299
+ | { type: 'ui-document-set-theme'; content: Ui.CmdResultUiDocumentSetTheme }
300
+ | { type: 'ui-document-get-tree'; content: Ui.CmdResultUiDocumentGetTree }
301
+ | {
302
+ type: 'ui-document-get-layout-rects';
303
+ content: Ui.CmdResultUiDocumentGetLayoutRects;
304
+ }
305
+ | { type: 'ui-apply-ops'; content: Ui.CmdResultUiApplyOps }
306
+ | { type: 'ui-debug-set'; content: Ui.CmdResultUiDebugSet }
307
+ | { type: 'ui-focus-set'; content: Ui.CmdResultUiFocusSet }
308
+ | { type: 'ui-focus-get'; content: Ui.CmdResultUiFocusGet }
309
+ | { type: 'ui-event-trace-set'; content: Ui.CmdResultUiEventTraceSet }
310
+ | {
311
+ type: 'ui-image-create-from-buffer';
312
+ content: Ui.CmdResultUiImageCreateFromBuffer;
313
+ }
314
+ | { type: 'ui-image-dispose'; content: Ui.CmdResultUiImageDispose }
315
+ | { type: 'ui-clipboard-paste'; content: Ui.CmdResultUiInputEvent }
316
+ | { type: 'ui-screenshot-reply'; content: Ui.CmdResultUiInputEvent }
317
+ | { type: 'ui-access-kit-action-request'; content: Ui.CmdResultUiInputEvent }
232
318
  | { type: 'model-list'; content: Mod.CmdResultModelList }
233
319
  | { type: 'material-list'; content: Mat.CmdResultMaterialList }
234
320
  | { type: 'texture-list'; content: Tex.CmdResultTextureList }
@@ -238,35 +324,21 @@ export type CommandResponse =
238
324
  | { type: 'gizmo-draw-line'; content: Giz.CmdResultGizmoDraw }
239
325
  | { type: 'gizmo-draw-aabb'; content: Giz.CmdResultGizmoDraw };
240
326
 
241
- /** Envelope used when batching commands to the core. */
327
+ /** Command envelope used in batched transport payloads. */
242
328
  export interface EngineCmdEnvelope {
243
329
  id: number;
244
330
  type: EngineCmd['type'];
245
331
  content: EngineCmd['content'];
246
332
  }
247
333
 
248
- /** Envelope used when decoding responses from the core. */
334
+ /** Response envelope returned by queue polling and routed by command id. */
249
335
  export interface CommandResponseEnvelope {
250
336
  id: number;
251
337
  type: CommandResponse['type'];
252
338
  content: CommandResponse['content'];
253
339
  }
254
340
 
255
- /** Batch of commands sent in a single tick. */
341
+ /** Batched commands payload sent to transport. */
256
342
  export type EngineBatchCmds = EngineCmdEnvelope[];
257
-
258
- /** Batch of responses received from the core. */
343
+ /** Batched responses payload decoded from transport. */
259
344
  export type EngineBatchResponses = CommandResponseEnvelope[];
260
-
261
- /** Result codes returned by core entrypoints. */
262
- export enum VulframResult {
263
- Success = 0,
264
- UnknownError = 1,
265
- NotInitialized = 2,
266
- AlreadyInitialized = 3,
267
- WrongThread = 4,
268
- CmdInvalidMessagePackError = 5,
269
- BufferNotFound = 6,
270
- BufferIdCollision = 7,
271
- InvalidUploadType = 8,
272
- }