@vulfram/engine 0.5.6-alpha → 0.14.8-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/package.json +3 -3
- package/src/engine/api.ts +2 -3
- package/src/engine/bridge/protocol.ts +8 -6
- package/src/engine/ecs/index.ts +3 -1
- package/src/engine/systems/core-command-builder.ts +6 -3
- package/src/engine/systems/world-lifecycle.ts +36 -2
- package/src/engine/world/entities.ts +155 -0
- package/src/types/cmds/audio.ts +164 -0
- package/src/types/cmds/camera.ts +6 -5
- package/src/types/cmds/environment.ts +38 -1
- package/src/types/cmds/geometry.ts +5 -2
- package/src/types/cmds/index.ts +41 -0
- package/src/types/cmds/light.ts +5 -2
- package/src/types/cmds/material.ts +5 -2
- package/src/types/cmds/model.ts +24 -2
- package/src/types/cmds/render-graph.ts +49 -0
- package/src/types/cmds/resources.ts +4 -0
- package/src/types/cmds/shadow.ts +7 -7
- package/src/types/cmds/system.ts +10 -0
- package/src/types/cmds/texture.ts +6 -2
- package/src/types/cmds/window.ts +1 -1
- package/src/types/events/system.ts +30 -1
- package/src/types/kinds.ts +3 -0
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulfram/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.8-alpha",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vulfram/transport-types": "^0.2.
|
|
9
|
+
"@vulfram/transport-types": "^0.2.3",
|
|
10
10
|
"gl-matrix": "^3.4.4",
|
|
11
11
|
"glob": "^13.0.0",
|
|
12
12
|
"msgpackr": "^1.11.8"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@types/bun": "^1.3.
|
|
15
|
+
"@types/bun": "^1.3.8"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/src/engine/api.ts
CHANGED
|
@@ -131,15 +131,14 @@ function uploadTypeToId(type: UploadType): number {
|
|
|
131
131
|
export function uploadBuffer(
|
|
132
132
|
bufferId: number,
|
|
133
133
|
type: UploadType,
|
|
134
|
-
data: Uint8Array
|
|
134
|
+
data: Uint8Array,
|
|
135
135
|
): void {
|
|
136
136
|
requireInitialized();
|
|
137
137
|
const transport = engineState.transport!;
|
|
138
|
-
const bufferData = data instanceof Uint8Array ? Buffer.from(data) : data;
|
|
139
138
|
const result = transport.vulframUploadBuffer(
|
|
140
139
|
bufferId,
|
|
141
140
|
uploadTypeToId(type),
|
|
142
|
-
|
|
141
|
+
data,
|
|
143
142
|
);
|
|
144
143
|
if (result !== 0) {
|
|
145
144
|
throw new EngineError(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Packr, Unpackr } from 'msgpackr';
|
|
2
|
+
import type { TransportBuffer } from '@vulfram/transport-types';
|
|
2
3
|
import type {
|
|
3
4
|
CommandResponseEnvelope,
|
|
4
5
|
EngineCmdEnvelope,
|
|
@@ -47,17 +48,18 @@ const unpackr = new Unpackr({ useRecords: false });
|
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* Minimal Command Payload Requirement:
|
|
50
|
-
*
|
|
51
|
-
*
|
|
51
|
+
* Most scene/window commands include a `windowId` so the Core can route them
|
|
52
|
+
* to the correct world/surface. Some commands (e.g. camera update or global
|
|
53
|
+
* maintenance commands) are window-agnostic.
|
|
52
54
|
*/
|
|
53
55
|
export interface BaseCommandArgs {
|
|
54
56
|
windowId: number;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
|
-
* Serializes a batch of commands into a
|
|
60
|
+
* Serializes a batch of commands into a byte buffer ready for vulframSendQueue.
|
|
59
61
|
*/
|
|
60
|
-
export function serializeBatch(batch: CoreCommandBatch):
|
|
62
|
+
export function serializeBatch(batch: CoreCommandBatch): TransportBuffer {
|
|
61
63
|
if (engineState.flags.debugEnabled) {
|
|
62
64
|
const types = batch.map((cmd) => cmd.type);
|
|
63
65
|
const hasModel =
|
|
@@ -115,7 +117,7 @@ export function serializeBatch(batch: CoreCommandBatch): Buffer {
|
|
|
115
117
|
* Deserializes responses from vulframReceiveQueue.
|
|
116
118
|
*/
|
|
117
119
|
export function deserializeResponses(
|
|
118
|
-
buffer:
|
|
120
|
+
buffer: TransportBuffer,
|
|
119
121
|
): CommandResponseEnvelope[] {
|
|
120
122
|
if (buffer.length === 0) return [];
|
|
121
123
|
return unpackr.unpack(buffer);
|
|
@@ -124,7 +126,7 @@ export function deserializeResponses(
|
|
|
124
126
|
/**
|
|
125
127
|
* Deserializes events from vulframReceiveEvents.
|
|
126
128
|
*/
|
|
127
|
-
export function deserializeEvents(buffer:
|
|
129
|
+
export function deserializeEvents(buffer: TransportBuffer): EngineEvent[] {
|
|
128
130
|
if (buffer.length === 0) return [];
|
|
129
131
|
return unpackr.unpack(buffer);
|
|
130
132
|
}
|
package/src/engine/ecs/index.ts
CHANGED
|
@@ -114,6 +114,8 @@ export interface ModelProps {
|
|
|
114
114
|
materialId?: number;
|
|
115
115
|
castShadow?: boolean;
|
|
116
116
|
receiveShadow?: boolean;
|
|
117
|
+
castOutline?: boolean;
|
|
118
|
+
outlineColor?: [number, number, number, number];
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
/**
|
|
@@ -356,7 +358,7 @@ export interface WindowProps {
|
|
|
356
358
|
decorations?: boolean;
|
|
357
359
|
cursorVisible?: boolean;
|
|
358
360
|
cursorGrab?: CursorGrabMode;
|
|
359
|
-
icon?:
|
|
361
|
+
icon?: number;
|
|
360
362
|
cursorIcon?: CursorIcon;
|
|
361
363
|
}
|
|
362
364
|
|
|
@@ -23,6 +23,8 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
23
23
|
const transform = getEntityTransformMatrix(world, intent.entityId);
|
|
24
24
|
const castShadow = intent.props.castShadow ?? true;
|
|
25
25
|
const receiveShadow = intent.props.receiveShadow ?? true;
|
|
26
|
+
const castOutline = intent.props.castOutline ?? false;
|
|
27
|
+
const outlineColor = intent.props.outlineColor ?? ([0, 0, 0, 0] as const);
|
|
26
28
|
|
|
27
29
|
enqueueCommand(context.worldId, 'cmd-model-create', {
|
|
28
30
|
windowId: context.worldId,
|
|
@@ -33,6 +35,8 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
33
35
|
layerMask: 0x7fffffff,
|
|
34
36
|
castShadow,
|
|
35
37
|
receiveShadow,
|
|
38
|
+
castOutline,
|
|
39
|
+
outlineColor: [...outlineColor] as [number, number, number, number],
|
|
36
40
|
});
|
|
37
41
|
|
|
38
42
|
let store = world.components.get(intent.entityId);
|
|
@@ -47,6 +51,8 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
47
51
|
materialId: intent.props.materialId,
|
|
48
52
|
castShadow: intent.props.castShadow ?? true,
|
|
49
53
|
receiveShadow: intent.props.receiveShadow ?? true,
|
|
54
|
+
castOutline,
|
|
55
|
+
outlineColor: [...outlineColor] as [number, number, number, number],
|
|
50
56
|
skipUpdate: true,
|
|
51
57
|
});
|
|
52
58
|
|
|
@@ -56,7 +62,6 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
56
62
|
const transform = getEntityTransformMatrix(world, intent.entityId);
|
|
57
63
|
|
|
58
64
|
enqueueCommand(context.worldId, 'cmd-camera-create', {
|
|
59
|
-
windowId: context.worldId,
|
|
60
65
|
cameraId,
|
|
61
66
|
label: `Cam ${cameraId}`,
|
|
62
67
|
kind: intent.props.kind ?? ('perspective' as CameraKind),
|
|
@@ -190,7 +195,6 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
190
195
|
camera.skipUpdate = false;
|
|
191
196
|
} else {
|
|
192
197
|
enqueueCommand(context.worldId, 'cmd-camera-update', {
|
|
193
|
-
windowId: context.worldId,
|
|
194
198
|
cameraId: camera.id,
|
|
195
199
|
transform: matrixArray,
|
|
196
200
|
});
|
|
@@ -227,7 +231,6 @@ export const CoreCommandBuilderSystem: System = (world, context) => {
|
|
|
227
231
|
} else if (intent.componentType === 'Camera') {
|
|
228
232
|
const cameraComp = comp as CameraComponent;
|
|
229
233
|
enqueueCommand(context.worldId, 'cmd-camera-dispose', {
|
|
230
|
-
windowId: context.worldId,
|
|
231
234
|
cameraId: cameraComp.id,
|
|
232
235
|
});
|
|
233
236
|
} else if (intent.componentType === 'Light') {
|
|
@@ -87,7 +87,7 @@ export const WorldLifecycleSystem: System = (world, context) => {
|
|
|
87
87
|
if (p.icon !== undefined) {
|
|
88
88
|
enqueueCommand(context.worldId, 'cmd-window-set-icon', {
|
|
89
89
|
windowId: context.worldId,
|
|
90
|
-
|
|
90
|
+
bufferId: p.icon,
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
if (p.cursorIcon !== undefined) {
|
|
@@ -119,9 +119,43 @@ export const WorldLifecycleSystem: System = (world, context) => {
|
|
|
119
119
|
mode: config.skybox.mode,
|
|
120
120
|
intensity: config.skybox.intensity,
|
|
121
121
|
rotation: config.skybox.rotation,
|
|
122
|
-
|
|
122
|
+
groundColor: toVec3(config.skybox.groundColor),
|
|
123
|
+
horizonColor: toVec3(config.skybox.horizonColor),
|
|
124
|
+
skyColor: toVec3(config.skybox.skyColor),
|
|
123
125
|
cubemapTextureId: config.skybox.cubemapTextureId ?? null,
|
|
124
126
|
},
|
|
127
|
+
post: {
|
|
128
|
+
filterEnabled: config.post.filterEnabled,
|
|
129
|
+
filterExposure: config.post.filterExposure,
|
|
130
|
+
filterGamma: config.post.filterGamma,
|
|
131
|
+
filterSaturation: config.post.filterSaturation,
|
|
132
|
+
filterContrast: config.post.filterContrast,
|
|
133
|
+
filterVignette: config.post.filterVignette,
|
|
134
|
+
filterGrain: config.post.filterGrain,
|
|
135
|
+
filterChromaticAberration: config.post.filterChromaticAberration,
|
|
136
|
+
filterBlur: config.post.filterBlur,
|
|
137
|
+
filterSharpen: config.post.filterSharpen,
|
|
138
|
+
filterTonemapMode: config.post.filterTonemapMode,
|
|
139
|
+
outlineEnabled: config.post.outlineEnabled,
|
|
140
|
+
outlineStrength: config.post.outlineStrength,
|
|
141
|
+
outlineThreshold: config.post.outlineThreshold,
|
|
142
|
+
outlineWidth: config.post.outlineWidth,
|
|
143
|
+
outlineQuality: config.post.outlineQuality,
|
|
144
|
+
filterPosterizeSteps: config.post.filterPosterizeSteps,
|
|
145
|
+
cellShading: config.post.cellShading,
|
|
146
|
+
ssaoEnabled: config.post.ssaoEnabled,
|
|
147
|
+
ssaoStrength: config.post.ssaoStrength,
|
|
148
|
+
ssaoRadius: config.post.ssaoRadius,
|
|
149
|
+
ssaoBias: config.post.ssaoBias,
|
|
150
|
+
ssaoPower: config.post.ssaoPower,
|
|
151
|
+
ssaoBlurRadius: config.post.ssaoBlurRadius,
|
|
152
|
+
ssaoBlurDepthThreshold: config.post.ssaoBlurDepthThreshold,
|
|
153
|
+
bloomEnabled: config.post.bloomEnabled,
|
|
154
|
+
bloomThreshold: config.post.bloomThreshold,
|
|
155
|
+
bloomKnee: config.post.bloomKnee,
|
|
156
|
+
bloomIntensity: config.post.bloomIntensity,
|
|
157
|
+
bloomScatter: config.post.bloomScatter,
|
|
158
|
+
},
|
|
125
159
|
};
|
|
126
160
|
enqueueCommand(context.worldId, 'cmd-environment-update', {
|
|
127
161
|
windowId: context.worldId,
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import type { ShadowConfig } from '../../types/cmds/shadow';
|
|
2
2
|
import type { EnvironmentConfig } from '../../types/cmds/environment';
|
|
3
|
+
import type {
|
|
4
|
+
CmdAudioListenerCreateArgs,
|
|
5
|
+
CmdAudioListenerDisposeArgs,
|
|
6
|
+
CmdAudioListenerUpdateArgs,
|
|
7
|
+
CmdAudioResourceCreateArgs,
|
|
8
|
+
CmdAudioResourceDisposeArgs,
|
|
9
|
+
CmdAudioResourcePushArgs,
|
|
10
|
+
CmdAudioSourceCreateArgs,
|
|
11
|
+
CmdAudioSourceDisposeArgs,
|
|
12
|
+
CmdAudioSourcePauseArgs,
|
|
13
|
+
CmdAudioSourcePlayArgs,
|
|
14
|
+
CmdAudioSourceStopArgs,
|
|
15
|
+
CmdAudioSourceUpdateArgs,
|
|
16
|
+
} from '../../types/cmds/audio';
|
|
17
|
+
import type { CmdPoseUpdateArgs } from '../../types/cmds/model';
|
|
3
18
|
import type { NotificationLevel, UserAttentionType } from '../../types/kinds';
|
|
4
19
|
import { getWorldOrThrow, requireInitialized } from '../bridge/guards';
|
|
20
|
+
import { enqueueCommand } from '../bridge/dispatch';
|
|
5
21
|
import type {
|
|
6
22
|
CameraProps,
|
|
7
23
|
CreateWindowProps,
|
|
@@ -29,6 +45,145 @@ export function emitIntent(worldId: number, intent: Intent): void {
|
|
|
29
45
|
world.pendingIntents.push(intent);
|
|
30
46
|
}
|
|
31
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Returns the core model ID for an entity, if available.
|
|
50
|
+
*/
|
|
51
|
+
export function getModelId(worldId: number, entityId: number): number | null {
|
|
52
|
+
requireInitialized();
|
|
53
|
+
const world = getWorldOrThrow(worldId);
|
|
54
|
+
const store = world.components.get(entityId);
|
|
55
|
+
if (!store) return null;
|
|
56
|
+
const model = store.get('Model') as { id: number } | undefined;
|
|
57
|
+
return model?.id ?? null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Sends an audio listener update command.
|
|
62
|
+
*/
|
|
63
|
+
export function audioListenerUpdate(
|
|
64
|
+
worldId: number,
|
|
65
|
+
args: CmdAudioListenerUpdateArgs,
|
|
66
|
+
): number {
|
|
67
|
+
return enqueueCommand(worldId, 'cmd-audio-listener-update', args);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Binds the audio listener to a model.
|
|
72
|
+
*/
|
|
73
|
+
export function audioListenerCreate(
|
|
74
|
+
worldId: number,
|
|
75
|
+
args: CmdAudioListenerCreateArgs,
|
|
76
|
+
): number {
|
|
77
|
+
return enqueueCommand(worldId, 'cmd-audio-listener-create', args);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Disposes the audio listener binding.
|
|
82
|
+
*/
|
|
83
|
+
export function audioListenerDispose(
|
|
84
|
+
worldId: number,
|
|
85
|
+
args: CmdAudioListenerDisposeArgs,
|
|
86
|
+
): number {
|
|
87
|
+
return enqueueCommand(worldId, 'cmd-audio-listener-dispose', args);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates an audio resource from an uploaded buffer.
|
|
92
|
+
*/
|
|
93
|
+
export function audioResourceCreate(
|
|
94
|
+
worldId: number,
|
|
95
|
+
args: CmdAudioResourceCreateArgs,
|
|
96
|
+
): number {
|
|
97
|
+
return enqueueCommand(worldId, 'cmd-audio-resource-create', args);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Pushes a chunk into a streaming audio resource.
|
|
102
|
+
*/
|
|
103
|
+
export function audioResourcePush(
|
|
104
|
+
worldId: number,
|
|
105
|
+
args: CmdAudioResourcePushArgs,
|
|
106
|
+
): number {
|
|
107
|
+
return enqueueCommand(worldId, 'cmd-audio-resource-push', args);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Disposes an audio resource.
|
|
112
|
+
*/
|
|
113
|
+
export function audioResourceDispose(
|
|
114
|
+
worldId: number,
|
|
115
|
+
args: CmdAudioResourceDisposeArgs,
|
|
116
|
+
): number {
|
|
117
|
+
return enqueueCommand(worldId, 'cmd-audio-resource-dispose', args);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates an audio source bound to a model.
|
|
122
|
+
*/
|
|
123
|
+
export function audioSourceCreate(
|
|
124
|
+
worldId: number,
|
|
125
|
+
args: CmdAudioSourceCreateArgs,
|
|
126
|
+
): number {
|
|
127
|
+
return enqueueCommand(worldId, 'cmd-audio-source-create', args);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Updates an audio source.
|
|
132
|
+
*/
|
|
133
|
+
export function audioSourceUpdate(
|
|
134
|
+
worldId: number,
|
|
135
|
+
args: CmdAudioSourceUpdateArgs,
|
|
136
|
+
): number {
|
|
137
|
+
return enqueueCommand(worldId, 'cmd-audio-source-update', args);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Starts playback for an audio source.
|
|
142
|
+
*/
|
|
143
|
+
export function audioSourcePlay(
|
|
144
|
+
worldId: number,
|
|
145
|
+
args: CmdAudioSourcePlayArgs,
|
|
146
|
+
): number {
|
|
147
|
+
return enqueueCommand(worldId, 'cmd-audio-source-play', args);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Pauses playback for an audio source.
|
|
152
|
+
*/
|
|
153
|
+
export function audioSourcePause(
|
|
154
|
+
worldId: number,
|
|
155
|
+
args: CmdAudioSourcePauseArgs,
|
|
156
|
+
): number {
|
|
157
|
+
return enqueueCommand(worldId, 'cmd-audio-source-pause', args);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Stops playback for an audio source.
|
|
162
|
+
*/
|
|
163
|
+
export function audioSourceStop(
|
|
164
|
+
worldId: number,
|
|
165
|
+
args: CmdAudioSourceStopArgs,
|
|
166
|
+
): number {
|
|
167
|
+
return enqueueCommand(worldId, 'cmd-audio-source-stop', args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Disposes an audio source.
|
|
172
|
+
*/
|
|
173
|
+
export function audioSourceDispose(
|
|
174
|
+
worldId: number,
|
|
175
|
+
args: CmdAudioSourceDisposeArgs,
|
|
176
|
+
): number {
|
|
177
|
+
return enqueueCommand(worldId, 'cmd-audio-source-dispose', args);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Updates a model pose (skinning) using an uploaded matrices buffer.
|
|
182
|
+
*/
|
|
183
|
+
export function poseUpdate(worldId: number, args: CmdPoseUpdateArgs): number {
|
|
184
|
+
return enqueueCommand(worldId, 'cmd-pose-update', args);
|
|
185
|
+
}
|
|
186
|
+
|
|
32
187
|
/**
|
|
33
188
|
* Emits an intent to create a window in the core.
|
|
34
189
|
*/
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { AudioPlayMode } from '../kinds';
|
|
2
|
+
|
|
3
|
+
export interface AudioSpatialParams {
|
|
4
|
+
minDistance: number;
|
|
5
|
+
maxDistance: number;
|
|
6
|
+
rolloff: number;
|
|
7
|
+
coneInner: number;
|
|
8
|
+
coneOuter: number;
|
|
9
|
+
coneOuterGain: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Command payload for updating the listener transform explicitly. */
|
|
13
|
+
export interface CmdAudioListenerUpdateArgs {
|
|
14
|
+
position: [number, number, number];
|
|
15
|
+
velocity: [number, number, number];
|
|
16
|
+
forward: [number, number, number];
|
|
17
|
+
up: [number, number, number];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Command payload for binding the listener to a model. */
|
|
21
|
+
export interface CmdAudioListenerCreateArgs {
|
|
22
|
+
windowId: number;
|
|
23
|
+
modelId: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Command payload for disposing the listener binding. */
|
|
27
|
+
export interface CmdAudioListenerDisposeArgs {
|
|
28
|
+
windowId: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CmdResultAudioListenerCreate {
|
|
32
|
+
success: boolean;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface CmdResultAudioListenerDispose {
|
|
37
|
+
success: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface CmdResultAudioListenerUpdate {
|
|
42
|
+
success: boolean;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Command payload for creating an audio resource from uploaded bytes. */
|
|
47
|
+
export interface CmdAudioResourceCreateArgs {
|
|
48
|
+
resourceId: number;
|
|
49
|
+
bufferId: number;
|
|
50
|
+
totalBytes?: number;
|
|
51
|
+
offsetBytes?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface CmdResultAudioResourceCreate {
|
|
55
|
+
success: boolean;
|
|
56
|
+
message: string;
|
|
57
|
+
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
|
+
receivedBytes: number;
|
|
71
|
+
totalBytes: number;
|
|
72
|
+
complete: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Command payload for creating a source bound to a model. */
|
|
76
|
+
export interface CmdAudioSourceCreateArgs {
|
|
77
|
+
windowId: number;
|
|
78
|
+
sourceId: number;
|
|
79
|
+
modelId: number;
|
|
80
|
+
position: [number, number, number];
|
|
81
|
+
velocity: [number, number, number];
|
|
82
|
+
orientation: [number, number, number, number];
|
|
83
|
+
gain: number;
|
|
84
|
+
pitch: number;
|
|
85
|
+
spatial: AudioSpatialParams;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface CmdResultAudioSourceCreate {
|
|
89
|
+
success: boolean;
|
|
90
|
+
message: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Command payload for updating source params. */
|
|
94
|
+
export interface CmdAudioSourceUpdateArgs {
|
|
95
|
+
sourceId: number;
|
|
96
|
+
position: [number, number, number];
|
|
97
|
+
velocity: [number, number, number];
|
|
98
|
+
orientation: [number, number, number, number];
|
|
99
|
+
gain: number;
|
|
100
|
+
pitch: number;
|
|
101
|
+
spatial: AudioSpatialParams;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface CmdResultAudioSourceUpdate {
|
|
105
|
+
success: boolean;
|
|
106
|
+
message: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Command payload for starting playback. */
|
|
110
|
+
export interface CmdAudioSourcePlayArgs {
|
|
111
|
+
sourceId: number;
|
|
112
|
+
resourceId: number;
|
|
113
|
+
timelineId?: number;
|
|
114
|
+
intensity: number;
|
|
115
|
+
delayMs?: number;
|
|
116
|
+
mode: AudioPlayMode;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface CmdResultAudioSourcePlay {
|
|
120
|
+
success: boolean;
|
|
121
|
+
message: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Command payload for pausing playback. */
|
|
125
|
+
export interface CmdAudioSourcePauseArgs {
|
|
126
|
+
sourceId: number;
|
|
127
|
+
timelineId?: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface CmdResultAudioSourcePause {
|
|
131
|
+
success: boolean;
|
|
132
|
+
message: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Command payload for stopping playback. */
|
|
136
|
+
export interface CmdAudioSourceStopArgs {
|
|
137
|
+
sourceId: number;
|
|
138
|
+
timelineId?: number;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface CmdResultAudioSourceStop {
|
|
142
|
+
success: boolean;
|
|
143
|
+
message: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Command payload for disposing a source. */
|
|
147
|
+
export interface CmdAudioSourceDisposeArgs {
|
|
148
|
+
sourceId: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface CmdResultAudioSourceDispose {
|
|
152
|
+
success: boolean;
|
|
153
|
+
message: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Command payload for disposing an audio resource. */
|
|
157
|
+
export interface CmdAudioResourceDisposeArgs {
|
|
158
|
+
resourceId: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface CmdResultAudioResourceDispose {
|
|
162
|
+
success: boolean;
|
|
163
|
+
message: string;
|
|
164
|
+
}
|
package/src/types/cmds/camera.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CameraKind } from '../kinds';
|
|
2
|
+
import type { ResourceEntry } from './resources';
|
|
2
3
|
|
|
3
4
|
/** Viewport value expressed as relative (0..1) or absolute pixels. */
|
|
4
5
|
export interface ViewValue {
|
|
@@ -14,7 +15,6 @@ export interface ViewPosition {
|
|
|
14
15
|
|
|
15
16
|
/** Command payload for creating a camera. */
|
|
16
17
|
export interface CmdCameraCreateArgs {
|
|
17
|
-
windowId: number;
|
|
18
18
|
cameraId: number;
|
|
19
19
|
label?: string;
|
|
20
20
|
transform: number[]; // Mat4 (16 elements)
|
|
@@ -35,8 +35,8 @@ export interface CmdResultCameraCreate {
|
|
|
35
35
|
|
|
36
36
|
/** Command payload for updating a camera. */
|
|
37
37
|
export interface CmdCameraUpdateArgs {
|
|
38
|
-
windowId: number;
|
|
39
38
|
cameraId: number;
|
|
39
|
+
label?: string;
|
|
40
40
|
transform?: number[];
|
|
41
41
|
kind?: CameraKind;
|
|
42
42
|
flags?: number;
|
|
@@ -55,7 +55,6 @@ export interface CmdResultCameraUpdate {
|
|
|
55
55
|
|
|
56
56
|
/** Command payload for disposing a camera. */
|
|
57
57
|
export interface CmdCameraDisposeArgs {
|
|
58
|
-
windowId: number;
|
|
59
58
|
cameraId: number;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -66,11 +65,13 @@ export interface CmdResultCameraDispose {
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
/** Command payload for listing cameras. */
|
|
69
|
-
export interface CmdCameraListArgs {
|
|
68
|
+
export interface CmdCameraListArgs {
|
|
69
|
+
windowId: number;
|
|
70
|
+
}
|
|
70
71
|
|
|
71
72
|
/** Result payload for camera list. */
|
|
72
73
|
export interface CmdResultCameraList {
|
|
73
74
|
success: boolean;
|
|
74
75
|
message: string;
|
|
75
|
-
|
|
76
|
+
cameras: ResourceEntry[];
|
|
76
77
|
}
|
|
@@ -11,14 +11,51 @@ export interface SkyboxConfig {
|
|
|
11
11
|
mode: SkyboxMode;
|
|
12
12
|
intensity: number;
|
|
13
13
|
rotation: number;
|
|
14
|
-
|
|
14
|
+
groundColor: [number, number, number];
|
|
15
|
+
horizonColor: [number, number, number];
|
|
16
|
+
skyColor: [number, number, number];
|
|
15
17
|
cubemapTextureId?: number | null;
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
/** Post-processing configuration. */
|
|
21
|
+
export interface PostProcessConfig {
|
|
22
|
+
filterEnabled: boolean;
|
|
23
|
+
filterExposure: number;
|
|
24
|
+
filterGamma: number;
|
|
25
|
+
filterSaturation: number;
|
|
26
|
+
filterContrast: number;
|
|
27
|
+
filterVignette: number;
|
|
28
|
+
filterGrain: number;
|
|
29
|
+
filterChromaticAberration: number;
|
|
30
|
+
filterBlur: number;
|
|
31
|
+
filterSharpen: number;
|
|
32
|
+
filterTonemapMode: number;
|
|
33
|
+
outlineEnabled: boolean;
|
|
34
|
+
outlineStrength: number;
|
|
35
|
+
outlineThreshold: number;
|
|
36
|
+
outlineWidth: number;
|
|
37
|
+
outlineQuality: number;
|
|
38
|
+
filterPosterizeSteps: number;
|
|
39
|
+
cellShading: boolean;
|
|
40
|
+
ssaoEnabled: boolean;
|
|
41
|
+
ssaoStrength: number;
|
|
42
|
+
ssaoRadius: number;
|
|
43
|
+
ssaoBias: number;
|
|
44
|
+
ssaoPower: number;
|
|
45
|
+
ssaoBlurRadius: number;
|
|
46
|
+
ssaoBlurDepthThreshold: number;
|
|
47
|
+
bloomEnabled: boolean;
|
|
48
|
+
bloomThreshold: number;
|
|
49
|
+
bloomKnee: number;
|
|
50
|
+
bloomIntensity: number;
|
|
51
|
+
bloomScatter: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
18
54
|
/** Environment configuration for a window. */
|
|
19
55
|
export interface EnvironmentConfig {
|
|
20
56
|
msaa: MsaaConfig;
|
|
21
57
|
skybox: SkyboxConfig;
|
|
58
|
+
post: PostProcessConfig;
|
|
22
59
|
}
|
|
23
60
|
|
|
24
61
|
/** Command payload for creating environment settings. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrimitiveShape } from '../kinds';
|
|
2
|
+
import type { ResourceEntry } from './resources';
|
|
2
3
|
|
|
3
4
|
/** Primitive attribute semantic identifiers. */
|
|
4
5
|
export type GeometryPrimitiveType =
|
|
@@ -134,11 +135,13 @@ export interface CmdResultPrimitiveGeometryCreate {
|
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
/** Command payload for listing geometry resources. */
|
|
137
|
-
export interface CmdGeometryListArgs {
|
|
138
|
+
export interface CmdGeometryListArgs {
|
|
139
|
+
windowId: number;
|
|
140
|
+
}
|
|
138
141
|
|
|
139
142
|
/** Result payload for geometry list. */
|
|
140
143
|
export interface CmdResultGeometryList {
|
|
141
144
|
success: boolean;
|
|
142
145
|
message: string;
|
|
143
|
-
|
|
146
|
+
geometries: ResourceEntry[];
|
|
144
147
|
}
|
package/src/types/cmds/index.ts
CHANGED
|
@@ -9,6 +9,8 @@ import * as Geo from './geometry';
|
|
|
9
9
|
import * as Shad from './shadow';
|
|
10
10
|
import * as Giz from './gizmo';
|
|
11
11
|
import * as Env from './environment';
|
|
12
|
+
import * as Audio from './audio';
|
|
13
|
+
import * as RenderGraph from './render-graph';
|
|
12
14
|
|
|
13
15
|
export * from './system';
|
|
14
16
|
export * from './window';
|
|
@@ -21,10 +23,17 @@ export * from './geometry';
|
|
|
21
23
|
export * from './shadow';
|
|
22
24
|
export * from './gizmo';
|
|
23
25
|
export * from './environment';
|
|
26
|
+
export * from './audio';
|
|
27
|
+
export * from './render-graph';
|
|
28
|
+
export * from './resources';
|
|
24
29
|
|
|
25
30
|
/** Discriminated union of all core commands. */
|
|
26
31
|
export type EngineCmd =
|
|
27
32
|
| { type: 'cmd-notification-send'; content: Sys.CmdNotificationSendArgs }
|
|
33
|
+
| {
|
|
34
|
+
type: 'cmd-upload-buffer-discard-all';
|
|
35
|
+
content: Sys.CmdUploadBufferDiscardAllArgs;
|
|
36
|
+
}
|
|
28
37
|
| { type: 'cmd-window-create'; content: Win.CmdWindowCreateArgs }
|
|
29
38
|
| { type: 'cmd-window-close'; content: Win.CmdWindowCloseArgs }
|
|
30
39
|
| { type: 'cmd-window-set-title'; content: Win.CmdWindowSetTitleArgs }
|
|
@@ -73,6 +82,19 @@ export type EngineCmd =
|
|
|
73
82
|
| { type: 'cmd-camera-create'; content: Cam.CmdCameraCreateArgs }
|
|
74
83
|
| { type: 'cmd-camera-update'; content: Cam.CmdCameraUpdateArgs }
|
|
75
84
|
| { type: 'cmd-camera-dispose'; content: Cam.CmdCameraDisposeArgs }
|
|
85
|
+
| { 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 }
|
|
76
98
|
| { type: 'cmd-model-create'; content: Mod.CmdModelCreateArgs }
|
|
77
99
|
| { type: 'cmd-model-update'; content: Mod.CmdModelUpdateArgs }
|
|
78
100
|
| { type: 'cmd-model-dispose'; content: Mod.CmdModelDisposeArgs }
|
|
@@ -102,6 +124,7 @@ export type EngineCmd =
|
|
|
102
124
|
| { type: 'cmd-environment-update'; content: Env.CmdEnvironmentUpdateArgs }
|
|
103
125
|
| { type: 'cmd-environment-dispose'; content: Env.CmdEnvironmentDisposeArgs }
|
|
104
126
|
| { type: 'cmd-shadow-configure'; content: Shad.CmdShadowConfigureArgs }
|
|
127
|
+
| { type: 'cmd-render-graph-set'; content: RenderGraph.CmdRenderGraphSetArgs }
|
|
105
128
|
| { type: 'cmd-model-list'; content: Mod.CmdModelListArgs }
|
|
106
129
|
| { type: 'cmd-material-list'; content: Mat.CmdMaterialListArgs }
|
|
107
130
|
| { type: 'cmd-texture-list'; content: Tex.CmdTextureListArgs }
|
|
@@ -114,6 +137,10 @@ export type EngineCmd =
|
|
|
114
137
|
/** Discriminated union of all core command responses. */
|
|
115
138
|
export type CommandResponse =
|
|
116
139
|
| { type: 'notification-send'; content: Sys.CmdResultNotificationSend }
|
|
140
|
+
| {
|
|
141
|
+
type: 'upload-buffer-discard-all';
|
|
142
|
+
content: Sys.CmdResultUploadBufferDiscardAll;
|
|
143
|
+
}
|
|
117
144
|
| { type: 'window-create'; content: Win.CmdResultWindowCreate }
|
|
118
145
|
| { type: 'window-close'; content: Win.CmdResultWindowClose }
|
|
119
146
|
| { type: 'window-set-title'; content: Win.CmdResultWindowSetTitle }
|
|
@@ -159,6 +186,19 @@ export type CommandResponse =
|
|
|
159
186
|
| { type: 'camera-create'; content: Cam.CmdResultCameraCreate }
|
|
160
187
|
| { type: 'camera-update'; content: Cam.CmdResultCameraUpdate }
|
|
161
188
|
| { type: 'camera-dispose'; content: Cam.CmdResultCameraDispose }
|
|
189
|
+
| { 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 }
|
|
162
202
|
| { type: 'model-create'; content: Mod.CmdResultModelCreate }
|
|
163
203
|
| { type: 'model-update'; content: Mod.CmdResultModelUpdate }
|
|
164
204
|
| { type: 'model-dispose'; content: Mod.CmdResultModelDispose }
|
|
@@ -188,6 +228,7 @@ export type CommandResponse =
|
|
|
188
228
|
| { type: 'environment-update'; content: Env.CmdResultEnvironment }
|
|
189
229
|
| { type: 'environment-dispose'; content: Env.CmdResultEnvironment }
|
|
190
230
|
| { type: 'shadow-configure'; content: Shad.CmdResultShadowConfigure }
|
|
231
|
+
| { type: 'render-graph-set'; content: RenderGraph.CmdResultRenderGraphSet }
|
|
191
232
|
| { type: 'model-list'; content: Mod.CmdResultModelList }
|
|
192
233
|
| { type: 'material-list'; content: Mat.CmdResultMaterialList }
|
|
193
234
|
| { type: 'texture-list'; content: Tex.CmdResultTextureList }
|
package/src/types/cmds/light.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LightKind } from '../kinds';
|
|
2
|
+
import type { ResourceEntry } from './resources';
|
|
2
3
|
|
|
3
4
|
/** Command payload for creating a light. */
|
|
4
5
|
export interface CmdLightCreateArgs {
|
|
@@ -59,11 +60,13 @@ export interface CmdResultLightDispose {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/** Command payload for listing lights. */
|
|
62
|
-
export interface CmdLightListArgs {
|
|
63
|
+
export interface CmdLightListArgs {
|
|
64
|
+
windowId: number;
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
/** Result payload for light list. */
|
|
65
68
|
export interface CmdResultLightList {
|
|
66
69
|
success: boolean;
|
|
67
70
|
message: string;
|
|
68
|
-
|
|
71
|
+
lights: ResourceEntry[];
|
|
69
72
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MaterialKind, TransparencyMode, SamplerMode } from '../kinds';
|
|
2
|
+
import type { ResourceEntry } from './resources';
|
|
2
3
|
|
|
3
4
|
/** Standard material options. */
|
|
4
5
|
export interface StandardOptions {
|
|
@@ -88,11 +89,13 @@ export interface CmdResultMaterialDispose {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
/** Command payload for listing materials. */
|
|
91
|
-
export interface CmdMaterialListArgs {
|
|
92
|
+
export interface CmdMaterialListArgs {
|
|
93
|
+
windowId: number;
|
|
94
|
+
}
|
|
92
95
|
|
|
93
96
|
/** Result payload for material list. */
|
|
94
97
|
export interface CmdResultMaterialList {
|
|
95
98
|
success: boolean;
|
|
96
99
|
message: string;
|
|
97
|
-
|
|
100
|
+
materials: ResourceEntry[];
|
|
98
101
|
}
|
package/src/types/cmds/model.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ResourceEntry } from './resources';
|
|
2
|
+
|
|
1
3
|
/** Command payload for creating a model. */
|
|
2
4
|
export interface CmdModelCreateArgs {
|
|
3
5
|
windowId: number ;
|
|
@@ -9,6 +11,8 @@ export interface CmdModelCreateArgs {
|
|
|
9
11
|
layerMask: number;
|
|
10
12
|
castShadow: boolean;
|
|
11
13
|
receiveShadow: boolean;
|
|
14
|
+
castOutline: boolean;
|
|
15
|
+
outlineColor: [number, number, number, number];
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
/** Result payload for model create. */
|
|
@@ -28,6 +32,8 @@ export interface CmdModelUpdateArgs {
|
|
|
28
32
|
layerMask?: number;
|
|
29
33
|
castShadow?: boolean;
|
|
30
34
|
receiveShadow?: boolean;
|
|
35
|
+
castOutline?: boolean;
|
|
36
|
+
outlineColor?: [number, number, number, number];
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
/** Result payload for model update. */
|
|
@@ -36,6 +42,20 @@ export interface CmdResultModelUpdate {
|
|
|
36
42
|
message: string;
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
/** Command payload for updating a model pose (skinning). */
|
|
46
|
+
export interface CmdPoseUpdateArgs {
|
|
47
|
+
windowId: number;
|
|
48
|
+
modelId: number;
|
|
49
|
+
boneCount: number;
|
|
50
|
+
matricesBufferId: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Result payload for pose update. */
|
|
54
|
+
export interface CmdResultPoseUpdate {
|
|
55
|
+
success: boolean;
|
|
56
|
+
message: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
/** Command payload for disposing a model. */
|
|
40
60
|
export interface CmdModelDisposeArgs {
|
|
41
61
|
windowId: number ;
|
|
@@ -49,11 +69,13 @@ export interface CmdResultModelDispose {
|
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
/** Command payload for listing models. */
|
|
52
|
-
export interface CmdModelListArgs {
|
|
72
|
+
export interface CmdModelListArgs {
|
|
73
|
+
windowId: number;
|
|
74
|
+
}
|
|
53
75
|
|
|
54
76
|
/** Result payload for model list. */
|
|
55
77
|
export interface CmdResultModelList {
|
|
56
78
|
success: boolean;
|
|
57
79
|
message: string;
|
|
58
|
-
|
|
80
|
+
models: ResourceEntry[];
|
|
59
81
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type LogicalId = string | number;
|
|
2
|
+
|
|
3
|
+
export type RenderGraphResourceKind = 'texture' | 'buffer' | 'attachment';
|
|
4
|
+
|
|
5
|
+
export type RenderGraphLifetime = 'frame' | 'persistent';
|
|
6
|
+
|
|
7
|
+
export type RenderGraphEdgeReason = 'read-after-write' | 'write-after-read';
|
|
8
|
+
|
|
9
|
+
export type RenderGraphValue = boolean | number | string;
|
|
10
|
+
|
|
11
|
+
export interface RenderGraphResource {
|
|
12
|
+
resId: LogicalId;
|
|
13
|
+
kind?: RenderGraphResourceKind;
|
|
14
|
+
lifetime?: RenderGraphLifetime;
|
|
15
|
+
aliasGroup?: LogicalId | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface RenderGraphNode {
|
|
19
|
+
nodeId: LogicalId;
|
|
20
|
+
passId: string;
|
|
21
|
+
inputs?: LogicalId[];
|
|
22
|
+
outputs?: LogicalId[];
|
|
23
|
+
params?: Record<string, RenderGraphValue>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface RenderGraphEdge {
|
|
27
|
+
fromNodeId: LogicalId;
|
|
28
|
+
toNodeId: LogicalId;
|
|
29
|
+
reason?: RenderGraphEdgeReason;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RenderGraphDesc {
|
|
33
|
+
graphId: LogicalId;
|
|
34
|
+
nodes: RenderGraphNode[];
|
|
35
|
+
edges: RenderGraphEdge[];
|
|
36
|
+
resources?: RenderGraphResource[];
|
|
37
|
+
fallback?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CmdRenderGraphSetArgs {
|
|
41
|
+
windowId: number;
|
|
42
|
+
graph: RenderGraphDesc;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CmdResultRenderGraphSet {
|
|
46
|
+
success: boolean;
|
|
47
|
+
fallbackUsed: boolean;
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
package/src/types/cmds/shadow.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** Shadow rendering configuration. */
|
|
2
2
|
export interface ShadowConfig {
|
|
3
|
-
tileResolution
|
|
4
|
-
atlasTilesW
|
|
5
|
-
atlasTilesH
|
|
6
|
-
atlasLayers
|
|
7
|
-
virtualGridSize
|
|
8
|
-
smoothing
|
|
9
|
-
normalBias
|
|
3
|
+
tileResolution?: number;
|
|
4
|
+
atlasTilesW?: number;
|
|
5
|
+
atlasTilesH?: number;
|
|
6
|
+
atlasLayers?: number;
|
|
7
|
+
virtualGridSize?: number;
|
|
8
|
+
smoothing?: number;
|
|
9
|
+
normalBias?: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/** Command payload for shadow configuration. */
|
package/src/types/cmds/system.ts
CHANGED
|
@@ -13,3 +13,13 @@ export interface CmdNotificationSendArgs {
|
|
|
13
13
|
export interface CmdResultNotificationSend {
|
|
14
14
|
success: boolean;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/** Command payload for discarding all pending upload buffers. */
|
|
18
|
+
export interface CmdUploadBufferDiscardAllArgs {}
|
|
19
|
+
|
|
20
|
+
/** Result payload for upload discard all. */
|
|
21
|
+
export interface CmdResultUploadBufferDiscardAll {
|
|
22
|
+
success: boolean;
|
|
23
|
+
discardedCount: number;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextureCreateMode } from '../kinds';
|
|
2
|
+
import type { ResourceEntry } from './resources';
|
|
2
3
|
|
|
3
4
|
/** Options for forward atlas texture packing. */
|
|
4
5
|
export interface ForwardAtlasOptions {
|
|
@@ -21,6 +22,7 @@ export interface CmdTextureCreateFromBufferArgs {
|
|
|
21
22
|
export interface CmdResultTextureCreateFromBuffer {
|
|
22
23
|
success: boolean;
|
|
23
24
|
message: string;
|
|
25
|
+
pending: boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/** Command payload for creating a solid color texture. */
|
|
@@ -53,11 +55,13 @@ export interface CmdResultTextureDispose {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/** Command payload for listing textures. */
|
|
56
|
-
export interface CmdTextureListArgs {
|
|
58
|
+
export interface CmdTextureListArgs {
|
|
59
|
+
windowId: number;
|
|
60
|
+
}
|
|
57
61
|
|
|
58
62
|
/** Result payload for texture list. */
|
|
59
63
|
export interface CmdResultTextureList {
|
|
60
64
|
success: boolean;
|
|
61
65
|
message: string;
|
|
62
|
-
|
|
66
|
+
textures: ResourceEntry[];
|
|
63
67
|
}
|
package/src/types/cmds/window.ts
CHANGED
|
@@ -146,7 +146,7 @@ export interface CmdResultWindowGetState {
|
|
|
146
146
|
/** Command payload for setting window icon. */
|
|
147
147
|
export interface CmdWindowSetIconArgs {
|
|
148
148
|
windowId: number;
|
|
149
|
-
|
|
149
|
+
bufferId: number; // Buffer ID pointing to an image
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/** Result payload for window icon update. */
|
|
@@ -3,6 +3,29 @@ export interface SystemEventOnNotificationData {
|
|
|
3
3
|
id: string;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
/** Payload for async texture decode completion. */
|
|
7
|
+
export interface SystemEventTextureReadyData {
|
|
8
|
+
window_id: number;
|
|
9
|
+
texture_id: number;
|
|
10
|
+
success: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Payload for async audio decode completion. */
|
|
15
|
+
export interface SystemEventAudioReadyData {
|
|
16
|
+
resource_id: number;
|
|
17
|
+
success: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Payload for audio stream progress. */
|
|
22
|
+
export interface SystemEventAudioStreamProgressData {
|
|
23
|
+
resource_id: number;
|
|
24
|
+
received_bytes: number;
|
|
25
|
+
total_bytes: number;
|
|
26
|
+
complete: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
6
29
|
/** Discriminated union of system-level events. */
|
|
7
30
|
export type SystemEvent =
|
|
8
31
|
| { event: 'on-resume' }
|
|
@@ -10,4 +33,10 @@ export type SystemEvent =
|
|
|
10
33
|
| { event: 'on-memory-warning' }
|
|
11
34
|
| { event: 'on-exit' }
|
|
12
35
|
| { event: 'on-notification-clicked'; data: SystemEventOnNotificationData }
|
|
13
|
-
| { event: 'on-notification-dismissed'; data: SystemEventOnNotificationData }
|
|
36
|
+
| { event: 'on-notification-dismissed'; data: SystemEventOnNotificationData }
|
|
37
|
+
| { event: 'texture-ready'; data: SystemEventTextureReadyData }
|
|
38
|
+
| { event: 'audio-ready'; data: SystemEventAudioReadyData }
|
|
39
|
+
| {
|
|
40
|
+
event: 'audio-stream-progress';
|
|
41
|
+
data: SystemEventAudioStreamProgressData;
|
|
42
|
+
};
|
package/src/types/kinds.ts
CHANGED