pelican-engine 0.0.0-stage → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/AGENTS.md +147 -0
  2. package/LICENSE +22 -0
  3. package/README.md +129 -2
  4. package/distribution.json +197 -0
  5. package/docs/AI-WORKFLOW.md +517 -0
  6. package/docs/ARCHITECTURE.md +268 -0
  7. package/docs/CAPABILITIES.md +264 -0
  8. package/docs/DECISIONS.md +107 -0
  9. package/docs/M3-USAGE.md +192 -0
  10. package/docs/PELICAN-MIGRATION.md +38 -0
  11. package/docs/RENDER-BACKENDS.md +50 -0
  12. package/docs/ROADMAP.md +239 -0
  13. package/docs/THIRD-PARTY-NOTICES.md +151 -0
  14. package/docs/api/REFERENCE.md +1435 -0
  15. package/docs/api/index.json +1139 -0
  16. package/docs/npm/DISTRIBUTION.md +130 -0
  17. package/docs/npm/GAME-AUTHOR.md +147 -0
  18. package/engine.manifest.json +15 -0
  19. package/lib/assets/audio.js +67 -0
  20. package/lib/assets/errors.js +36 -0
  21. package/lib/assets/glb.js +277 -0
  22. package/lib/assets/index.js +53 -0
  23. package/lib/assets/jpeg.js +199 -0
  24. package/lib/assets/model.js +558 -0
  25. package/lib/assets/optimize.js +95 -0
  26. package/lib/assets/texture.js +187 -0
  27. package/lib/compiler/distribution.js +17 -0
  28. package/lib/compiler/extract.js +425 -0
  29. package/lib/compiler/graph.js +366 -0
  30. package/lib/compiler/index.js +574 -0
  31. package/lib/compiler/normalize.js +1194 -0
  32. package/lib/compiler/source-map.js +25 -0
  33. package/lib/compiler/types.js +2 -0
  34. package/lib/compiler/version.js +93 -0
  35. package/lib/experiments/simulation/index.js +2 -0
  36. package/lib/experiments/simulation/math.js +41 -0
  37. package/lib/experiments/simulation/probe.js +215 -0
  38. package/lib/experiments/simulation/scenes.js +192 -0
  39. package/lib/experiments/simulation/solver.js +346 -0
  40. package/lib/experiments/simulation/types.js +1 -0
  41. package/lib/experiments/world/adapters.js +30 -0
  42. package/lib/experiments/world/geometry.js +180 -0
  43. package/lib/experiments/world/index.js +2 -0
  44. package/lib/experiments/world/probe.js +288 -0
  45. package/lib/experiments/world/types.js +1 -0
  46. package/lib/experiments/world/world.js +599 -0
  47. package/lib/navigation/index.js +157 -0
  48. package/lib/physics/index.js +909 -0
  49. package/lib/protocol/index.js +92 -0
  50. package/lib/renderer/acceleration.js +609 -0
  51. package/lib/renderer/browser.js +2015 -0
  52. package/lib/renderer/bsdf.js +260 -0
  53. package/lib/renderer/checkpoint.js +88 -0
  54. package/lib/renderer/compute-executor.js +1034 -0
  55. package/lib/renderer/compute-texture-assets.js +49 -0
  56. package/lib/renderer/compute-view-contract.js +1 -0
  57. package/lib/renderer/denoiser.js +361 -0
  58. package/lib/renderer/dielectric.js +360 -0
  59. package/lib/renderer/embedded-image-pixels.js +368 -0
  60. package/lib/renderer/emissive-lights.js +67 -0
  61. package/lib/renderer/environment-importance.js +55 -0
  62. package/lib/renderer/environment.js +346 -0
  63. package/lib/renderer/gameplay.js +464 -0
  64. package/lib/renderer/geometry.js +103 -0
  65. package/lib/renderer/graph-expressions.js +485 -0
  66. package/lib/renderer/graph-tsl.js +141 -0
  67. package/lib/renderer/graph.js +214 -0
  68. package/lib/renderer/managed-texture-sampling.js +29 -0
  69. package/lib/renderer/material-graphs.js +297 -0
  70. package/lib/renderer/medium.js +348 -0
  71. package/lib/renderer/models.js +1053 -0
  72. package/lib/renderer/motion-shader.js +40 -0
  73. package/lib/renderer/path-shader.js +196 -0
  74. package/lib/renderer/pathtrace.js +324 -0
  75. package/lib/renderer/postprocess-contract.js +1 -0
  76. package/lib/renderer/postprocess.js +494 -0
  77. package/lib/renderer/render-buffers.js +132 -0
  78. package/lib/renderer/render-textures.js +155 -0
  79. package/lib/renderer/startup.js +50 -0
  80. package/lib/renderer/surface-capture.js +199 -0
  81. package/lib/renderer/surface-gpu.js +270 -0
  82. package/lib/renderer/surface-motion.js +84 -0
  83. package/lib/renderer/surface-ray-shader.js +91 -0
  84. package/lib/renderer/surface-shader.js +88 -0
  85. package/lib/renderer/surface-tracer.js +1720 -0
  86. package/lib/renderer/surface.js +1425 -0
  87. package/lib/renderer/temporal-filter.js +512 -0
  88. package/lib/renderer/texture-pixels.js +207 -0
  89. package/lib/renderer/traversal-nodes.js +54 -0
  90. package/lib/renderer/ui.js +446 -0
  91. package/lib/renderer/vertex-bounds.js +127 -0
  92. package/lib/renderer/vertex-contract.js +1 -0
  93. package/lib/renderer/vertex-graphs.js +197 -0
  94. package/lib/renderer/volume-shader.js +50 -0
  95. package/lib/runtime/compute-contract.js +1 -0
  96. package/lib/runtime/compute-service.js +674 -0
  97. package/lib/runtime/contracts.js +1 -0
  98. package/lib/runtime/error.js +37 -0
  99. package/lib/runtime/events.js +189 -0
  100. package/lib/runtime/game-services.js +772 -0
  101. package/lib/runtime/host.js +839 -0
  102. package/lib/runtime/material-parameters.js +145 -0
  103. package/lib/runtime/plugins.js +1 -0
  104. package/lib/runtime/postprocess-contract.js +1 -0
  105. package/lib/runtime/postprocess.js +189 -0
  106. package/lib/runtime/prefabs.js +13 -0
  107. package/lib/runtime/random.js +88 -0
  108. package/lib/runtime/render-buffer-contract.js +1 -0
  109. package/lib/runtime/render-buffers.js +243 -0
  110. package/lib/runtime/render-capabilities.js +17 -0
  111. package/lib/runtime/render-settings.js +249 -0
  112. package/lib/runtime/render-texture-contract.js +1 -0
  113. package/lib/runtime/render-textures.js +271 -0
  114. package/lib/runtime/resources.js +648 -0
  115. package/lib/runtime/scheduler.js +765 -0
  116. package/lib/runtime/storage.js +169 -0
  117. package/lib/runtime/world.js +594 -0
  118. package/lib/schema/index.js +24 -0
  119. package/lib/sdk/graph-values.js +16 -0
  120. package/lib/sdk/index.d.ts +800 -0
  121. package/lib/sdk/index.js +82 -0
  122. package/lib/tools/api-index.js +113 -0
  123. package/lib/tools/browser-session.js +89 -0
  124. package/lib/tools/cli.js +513 -0
  125. package/lib/tools/compress-dist.js +59 -0
  126. package/lib/tools/control-client.js +153 -0
  127. package/lib/tools/control-server.js +633 -0
  128. package/lib/tools/diagnostic-code.js +3 -0
  129. package/lib/tools/doctor.js +496 -0
  130. package/lib/tools/npm/browser-cli.js +6 -0
  131. package/lib/tools/npm/entry.js +40 -0
  132. package/lib/tools/npm/layout.js +195 -0
  133. package/lib/tools/setup.js +153 -0
  134. package/licenses/@dimforge/rapier2d-compat/LICENSE +201 -0
  135. package/licenses/@dimforge/rapier3d-compat/LICENSE +201 -0
  136. package/licenses/@gltf-transform/core/LICENSE.md +21 -0
  137. package/licenses/@gltf-transform/extensions/LICENSE.md +21 -0
  138. package/licenses/@gltf-transform/functions/LICENSE.md +21 -0
  139. package/licenses/@img/colour/LICENSE.md +82 -0
  140. package/licenses/@img/sharp-win32-x64/LICENSE +191 -0
  141. package/licenses/@oxc-project/types/LICENSE +22 -0
  142. package/licenses/@rolldown/pluginutils/LICENSE +21 -0
  143. package/licenses/@tweenjs/tween.js/LICENSE +23 -0
  144. package/licenses/@types/ndarray/LICENSE +21 -0
  145. package/licenses/@types/node/LICENSE +21 -0
  146. package/licenses/@types/stats.js/LICENSE +21 -0
  147. package/licenses/@types/three/@dimforge/rapier3d-compat/LICENSE +201 -0
  148. package/licenses/@types/three/LICENSE +21 -0
  149. package/licenses/@types/webxr/LICENSE +21 -0
  150. package/licenses/@webgpu/types/LICENSE +26 -0
  151. package/licenses/THIRD-PARTY-NOTICES.md +139 -0
  152. package/licenses/cwise-compiler/LICENSE +22 -0
  153. package/licenses/detect-libc/LICENSE +201 -0
  154. package/licenses/esbuild/LICENSE.md +21 -0
  155. package/licenses/fast-png/LICENSE +21 -0
  156. package/licenses/fdir/LICENSE +7 -0
  157. package/licenses/fflate/LICENSE +21 -0
  158. package/licenses/iobuffer/LICENSE +22 -0
  159. package/licenses/iota-array/LICENSE +22 -0
  160. package/licenses/is-buffer/LICENSE +21 -0
  161. package/licenses/ktx-parse/LICENSE +21 -0
  162. package/licenses/lightningcss/LICENSE +373 -0
  163. package/licenses/lightningcss-win32-x64-msvc/LICENSE +373 -0
  164. package/licenses/meshoptimizer/LICENSE.md +21 -0
  165. package/licenses/nanoid/LICENSE +20 -0
  166. package/licenses/ndarray/LICENSE +22 -0
  167. package/licenses/ndarray-lanczos/LICENSE +21 -0
  168. package/licenses/ndarray-ops/LICENSE +22 -0
  169. package/licenses/ndarray-pixels/LICENSE +21 -0
  170. package/licenses/ngraph.path/LICENSE +21 -0
  171. package/licenses/picocolors/LICENSE +15 -0
  172. package/licenses/picomatch/LICENSE +21 -0
  173. package/licenses/playwright/LICENSE +202 -0
  174. package/licenses/playwright/NOTICE +5 -0
  175. package/licenses/playwright-core/LICENSE +202 -0
  176. package/licenses/playwright-core/NOTICE +5 -0
  177. package/licenses/postcss/LICENSE +20 -0
  178. package/licenses/prettier/LICENSE +7 -0
  179. package/licenses/property-graph/LICENSE +21 -0
  180. package/licenses/rolldown/LICENSE +25 -0
  181. package/licenses/semver/LICENSE +15 -0
  182. package/licenses/sharp/LICENSE +191 -0
  183. package/licenses/source-map-js/LICENSE +28 -0
  184. package/licenses/three/LICENSE +21 -0
  185. package/licenses/tinyglobby/LICENSE +21 -0
  186. package/licenses/tsx/LICENSE +21 -0
  187. package/licenses/typescript/LICENSE.txt +55 -0
  188. package/licenses/undici-types/LICENSE +21 -0
  189. package/licenses/uniq/LICENSE +22 -0
  190. package/licenses/vite/LICENSE.md +2084 -0
  191. package/package.json +49 -4
  192. package/web/index.html +34 -0
@@ -0,0 +1,1435 @@
1
+ # pelican 0.3.1 API 索引
2
+
3
+ Installed declarations: `lib/sdk/index.d.ts` (relative to the package root).
4
+ The signatures below come from the same public SDK source as repository games.
5
+ Source-file paths and line numbers are build-time provenance only; TypeScript source is not shipped.
6
+
7
+ 由公开 SDK 源码生成。签名以源码和 TypeScript 检查为准,不在文档维护第二套声明。
8
+
9
+ ## SDK_VERSION
10
+
11
+ 来源:`packages/sdk/src/index.ts:2`
12
+
13
+ ```ts
14
+ SDK_VERSION = "0.3.1"
15
+ ```
16
+
17
+ ## Vec2
18
+
19
+ 来源:`packages/sdk/src/index.ts:3`
20
+
21
+ ```ts
22
+ export type Vec2 = readonly [number, number];
23
+ ```
24
+
25
+ ## Vec3
26
+
27
+ 来源:`packages/sdk/src/index.ts:4`
28
+
29
+ ```ts
30
+ export type Vec3 = readonly [number, number, number];
31
+ ```
32
+
33
+ ## Vec4
34
+
35
+ 来源:`packages/sdk/src/index.ts:5`
36
+
37
+ ```ts
38
+ export type Vec4 = readonly [number, number, number, number];
39
+ ```
40
+
41
+ ## Transform
42
+
43
+ 来源:`packages/sdk/src/index.ts:6`
44
+
45
+ ```ts
46
+ export interface Transform {
47
+ position: Vec3;
48
+ rotation: Vec3;
49
+ scale: Vec3;
50
+ }
51
+ ```
52
+
53
+ ## TransformPatch
54
+
55
+ 来源:`packages/sdk/src/index.ts:11`
56
+
57
+ ```ts
58
+ export type TransformPatch = Partial<Transform>;
59
+ ```
60
+
61
+ ## Field
62
+
63
+ 来源:`packages/sdk/src/index.ts:12`
64
+
65
+ ```ts
66
+ export type Field =
67
+ | { type: "number"; default: number }
68
+ | { type: "boolean"; default: boolean }
69
+ | { type: "string"; default: string }
70
+ | { type: "vec3"; default: Vec3 };
71
+ ```
72
+
73
+ ## ComponentSchema
74
+
75
+ 来源:`packages/sdk/src/index.ts:17`
76
+
77
+ ```ts
78
+ export type ComponentSchema = Readonly<Record<string, Field>>;
79
+ ```
80
+
81
+ ## ComponentDefinition
82
+
83
+ 来源:`packages/sdk/src/index.ts:18`
84
+
85
+ ```ts
86
+ export interface ComponentDefinition<
87
+ S extends ComponentSchema = ComponentSchema,
88
+ > {
89
+ readonly kind: "component";
90
+ readonly id: string;
91
+ readonly schema: S;
92
+ }
93
+ ```
94
+
95
+ ## ComponentValue
96
+
97
+ 来源:`packages/sdk/src/index.ts:25`
98
+
99
+ ```ts
100
+ export type ComponentValue<S extends ComponentSchema> = {
101
+ -readonly [K in keyof S]: S[K]["type"] extends "number"
102
+ ? number
103
+ : S[K]["type"] extends "boolean"
104
+ ? boolean
105
+ : S[K]["type"] extends "vec3"
106
+ ? Vec3
107
+ : string;
108
+ };
109
+ ```
110
+
111
+ ## ComponentData
112
+
113
+ 来源:`packages/sdk/src/index.ts:34`
114
+
115
+ ```ts
116
+ export type ComponentData = Record<string, number | boolean | string | Vec3>;
117
+ ```
118
+
119
+ ## ComponentInstance
120
+
121
+ 来源:`packages/sdk/src/index.ts:35`
122
+
123
+ ```ts
124
+ export interface ComponentInstance {
125
+ component: ComponentDefinition | string;
126
+ value?: ComponentData;
127
+ }
128
+ ```
129
+
130
+ ## EngineFacade
131
+
132
+ 来源:`packages/sdk/src/index.ts:39`
133
+
134
+ ```ts
135
+ export interface EngineFacade {
136
+ getTransform(id: string): Transform;
137
+ setTransform(id: string, patch: TransformPatch): void;
138
+ getComponent<S extends ComponentSchema>(
139
+ id: string,
140
+ component: ComponentDefinition<S>,
141
+ ): ComponentValue<S>;
142
+ getComponent(id: string, component: string): ComponentData;
143
+ setComponent<S extends ComponentSchema>(
144
+ id: string,
145
+ component: ComponentDefinition<S>,
146
+ value: Partial<ComponentValue<S>>,
147
+ ): void;
148
+ setComponent(id: string, component: string, value: ComponentData): void;
149
+ query(component: ComponentDefinition | string): readonly string[];
150
+ /** Compiler/host integration. Game systems are scheduled by the engine, not by game code. */
151
+ runGameSystems?(systems: readonly SystemDefinition[], dt: number): void;
152
+ configureGameSystems?(systems: readonly SystemDefinition[]): void;
153
+ }
154
+ ```
155
+
156
+ ## EntityHandle
157
+
158
+ 来源:`packages/sdk/src/index.ts:58`
159
+
160
+ ```ts
161
+ export interface EntityHandle {
162
+ readonly world: number;
163
+ readonly index: number;
164
+ readonly generation: number;
165
+ }
166
+ ```
167
+
168
+ ## EntityRef
169
+
170
+ 来源:`packages/sdk/src/index.ts:63`
171
+
172
+ ```ts
173
+ export type EntityRef = string | EntityHandle;
174
+ ```
175
+
176
+ ## SpawnInput
177
+
178
+ 来源:`packages/sdk/src/index.ts:64`
179
+
180
+ ```ts
181
+ export interface SpawnInput {
182
+ id: string;
183
+ prefab?: string;
184
+ parent?: string;
185
+ transform?: TransformPatch;
186
+ components?: Record<string, ComponentData>;
187
+ }
188
+ ```
189
+
190
+ ## EntityCommands
191
+
192
+ 来源:`packages/sdk/src/index.ts:71`
193
+
194
+ ```ts
195
+ export interface EntityCommands {
196
+ resolve(id: string): EntityHandle;
197
+ isAlive(entity: EntityRef): boolean;
198
+ getTransform(entity: EntityRef): Transform;
199
+ setTransform(entity: EntityRef, patch: TransformPatch): void;
200
+ getComponent(entity: EntityRef, component: string): ComponentData;
201
+ setComponent(
202
+ entity: EntityRef,
203
+ component: string,
204
+ patch: ComponentData,
205
+ ): void;
206
+ /** Structural changes become visible at the engine's next command-commit boundary. */
207
+ spawn(input: SpawnInput): void;
208
+ destroy(entity: EntityRef): void;
209
+ addComponent(
210
+ entity: EntityRef,
211
+ component: string,
212
+ data?: ComponentData,
213
+ ): void;
214
+ removeComponent(entity: EntityRef, component: string): void;
215
+ }
216
+ ```
217
+
218
+ ## GameEvent
219
+
220
+ 来源:`packages/sdk/src/index.ts:92`
221
+
222
+ ```ts
223
+ export interface GameEvent {
224
+ readonly type: string;
225
+ readonly tick: number;
226
+ readonly sequence: number;
227
+ readonly payload: unknown;
228
+ }
229
+ ```
230
+
231
+ ## SystemContext
232
+
233
+ 来源:`packages/sdk/src/index.ts:98`
234
+
235
+ ```ts
236
+ export interface SystemContext extends EngineFacade {
237
+ readonly time: {
238
+ readonly tick: number;
239
+ readonly elapsed: number;
240
+ readonly fixedDt: number;
241
+ };
242
+ readonly entities: EntityCommands;
243
+ random(): number;
244
+ emit(type: string, payload: unknown): void;
245
+ events(type?: string): readonly GameEvent[];
246
+ readonly input: InputService;
247
+ readonly physics: PhysicsService;
248
+ readonly animation: AnimationService;
249
+ readonly camera: CameraService;
250
+ readonly ui: UIService;
251
+ readonly audio: AudioService;
252
+ readonly storage: StorageService;
253
+ readonly scenes: SceneService;
254
+ readonly render: RenderService;
255
+ readonly compute: ComputeService;
256
+ readonly navigation: NavigationService;
257
+ }
258
+ ```
259
+
260
+ ## NavigationCell
261
+
262
+ 来源:`packages/sdk/src/index.ts:123`
263
+
264
+ ```ts
265
+ export interface NavigationCell { readonly x: number; readonly y: number }
266
+ ```
267
+
268
+ ## NavigationGrid
269
+
270
+ 来源:`packages/sdk/src/index.ts:124`
271
+
272
+ ```ts
273
+ export interface NavigationGrid {
274
+ readonly id: string;
275
+ readonly owner: string;
276
+ readonly width: number;
277
+ readonly height: number;
278
+ readonly blocked?: readonly NavigationCell[];
279
+ /** Maximum distinct search cells, including endpoints; defaults to 65536. Raising it increases memory and CPU use. */
280
+ readonly searchCellBudget?: number;
281
+ }
282
+ ```
283
+
284
+ ## NavigationService
285
+
286
+ 来源:`packages/sdk/src/index.ts:133`
287
+
288
+ ```ts
289
+ export interface NavigationService {
290
+ createGrid(grid: NavigationGrid): void;
291
+ /** Returns a detached description, including the current blocked cells. */
292
+ getGrid(id: string): NavigationGrid;
293
+ isBlocked(id: string, cell: NavigationCell): boolean;
294
+ setBlocked(id: string, cell: NavigationCell, blocked: boolean): void;
295
+ findPath(id: string, start: NavigationCell, end: NavigationCell): readonly NavigationCell[];
296
+ destroyGrid(id: string): void;
297
+ destroyOwner(owner: string): void;
298
+ }
299
+ ```
300
+
301
+ ## RenderMode
302
+
303
+ 来源:`packages/sdk/src/index.ts:143`
304
+
305
+ ```ts
306
+ export type RenderMode = "raster" | "hybrid" | "path";
307
+ ```
308
+
309
+ ## RenderCapabilities
310
+
311
+ 来源:`packages/sdk/src/index.ts:144`
312
+
313
+ ```ts
314
+ export interface RenderCapabilities {
315
+ backend: "webgpu" | "webgl2" | "uninitialized";
316
+ compute: boolean;
317
+ availableModes: readonly RenderMode[];
318
+ }
319
+ ```
320
+
321
+ ## RenderSettings
322
+
323
+ 来源:`packages/sdk/src/index.ts:149`
324
+
325
+ ```ts
326
+ export interface RenderSettings {
327
+ mode: RenderMode;
328
+ samplesPerFrame: number;
329
+ maxBounces: number;
330
+ denoise: boolean;
331
+ denoiseIterations: number;
332
+ exposure: number;
333
+ directLighting: boolean;
334
+ indirectLighting: boolean;
335
+ debug: "beauty" | "albedo" | "normal" | "depth" | "samples";
336
+ }
337
+ ```
338
+
339
+ ## RenderService
340
+
341
+ 来源:`packages/sdk/src/index.ts:160`
342
+
343
+ ```ts
344
+ export interface RenderService {
345
+ configure(settings: Partial<RenderSettings>): void;
346
+ state(): Readonly<RenderSettings>;
347
+ capabilities(): Readonly<RenderCapabilities>;
348
+ setMaterialParameter(material: string, name: string, value: GraphValue): void;
349
+ materialParameters(material: string): Readonly<Record<string, GraphValue>>;
350
+ readonly effects: PostProcessService;
351
+ readonly buffers: RenderBufferBindings;
352
+ readonly textures: RenderTextureBindings;
353
+ }
354
+ ```
355
+
356
+ ## MaterialBufferInput
357
+
358
+ 来源:`packages/sdk/src/index.ts:170`
359
+
360
+ ```ts
361
+ export interface MaterialBufferInput {
362
+ /** Shared slot declaration for material and postprocess graphs. */
363
+ name: string;
364
+ type: GraphType;
365
+ /** Optional initial logical compute-buffer ID. */
366
+ buffer?: string;
367
+ /** Optional exact element count required by this slot. */
368
+ count?: number;
369
+ }
370
+ ```
371
+
372
+ ## RenderBufferReference
373
+
374
+ 来源:`packages/sdk/src/index.ts:179`
375
+
376
+ ```ts
377
+ export interface RenderBufferReference {
378
+ id: string;
379
+ type: GraphType;
380
+ count: number;
381
+ }
382
+ ```
383
+
384
+ ## RenderBufferBindings
385
+
386
+ 来源:`packages/sdk/src/index.ts:184`
387
+
388
+ ```ts
389
+ export interface RenderBufferBindings {
390
+ bind(target: string, name: string, buffer: ComputeBufferHandle): void;
391
+ unbind(target: string, name: string): void;
392
+ state(target: string): Readonly<Record<string, RenderBufferReference>>;
393
+ }
394
+ ```
395
+
396
+ ## MaterialTextureInput
397
+
398
+ 来源:`packages/sdk/src/index.ts:189`
399
+
400
+ ```ts
401
+ export interface MaterialTextureInput extends ComputeTextureBinding {
402
+ /** Initial managed texture ID; asset import uses computeTextures/createTexture. */
403
+ texture?: string;
404
+ width?: number;
405
+ height?: number;
406
+ }
407
+ ```
408
+
409
+ ## RenderTextureReference
410
+
411
+ 来源:`packages/sdk/src/index.ts:195`
412
+
413
+ ```ts
414
+ export interface RenderTextureReference extends ComputeTextureSize {
415
+ id: string;
416
+ format: "rgba32float";
417
+ }
418
+ ```
419
+
420
+ ## RenderTextureBindings
421
+
422
+ 来源:`packages/sdk/src/index.ts:199`
423
+
424
+ ```ts
425
+ export interface RenderTextureBindings {
426
+ bind(target: string, name: string, texture: ComputeTextureHandle): void;
427
+ unbind(target: string, name: string): void;
428
+ state(target: string): Readonly<Record<string, RenderTextureReference>>;
429
+ }
430
+ ```
431
+
432
+ ## PostProcessState
433
+
434
+ 来源:`packages/sdk/src/index.ts:204`
435
+
436
+ ```ts
437
+ export interface PostProcessState {
438
+ id: string;
439
+ enabled: boolean;
440
+ parameters: Readonly<Record<string, GraphValue>>;
441
+ }
442
+ ```
443
+
444
+ ## PostProcessService
445
+
446
+ 来源:`packages/sdk/src/index.ts:209`
447
+
448
+ ```ts
449
+ export interface PostProcessService {
450
+ /** Compute-buffer slots declared by definePostProcess, addressed by pass ID. */
451
+ readonly buffers: RenderBufferBindings;
452
+ readonly textures: RenderTextureBindings;
453
+ configure(id: string, settings: { enabled: boolean }): void;
454
+ state(id: string): Readonly<PostProcessState>;
455
+ setParameter(id: string, name: string, value: GraphValue): void;
456
+ /** Clears temporal effect images; it does not modify game or trace accumulation state. */
457
+ resetHistory(id?: string): void;
458
+ }
459
+ ```
460
+
461
+ ## ComputeBufferHandle
462
+
463
+ 来源:`packages/sdk/src/index.ts:219`
464
+
465
+ ```ts
466
+ export interface ComputeBufferHandle {
467
+ readonly owner: number;
468
+ readonly index: number;
469
+ readonly generation: number;
470
+ }
471
+ ```
472
+
473
+ ## ComputeTaskHandle
474
+
475
+ 来源:`packages/sdk/src/index.ts:224`
476
+
477
+ ```ts
478
+ export interface ComputeTaskHandle {
479
+ readonly owner: number;
480
+ readonly id: number;
481
+ }
482
+ ```
483
+
484
+ ## ComputeBufferInput
485
+
486
+ 来源:`packages/sdk/src/index.ts:228`
487
+
488
+ ```ts
489
+ export interface ComputeBufferInput {
490
+ id: string;
491
+ type: GraphType;
492
+ count: number;
493
+ data?: readonly GraphValue[];
494
+ }
495
+ ```
496
+
497
+ ## ComputeTextureHandle
498
+
499
+ 来源:`packages/sdk/src/index.ts:234`
500
+
501
+ ```ts
502
+ export interface ComputeTextureHandle {
503
+ readonly owner: number;
504
+ readonly index: number;
505
+ readonly generation: number;
506
+ readonly kind: "texture";
507
+ }
508
+ ```
509
+
510
+ ## ComputeTextureSize
511
+
512
+ 来源:`packages/sdk/src/index.ts:240`
513
+
514
+ ```ts
515
+ export interface ComputeTextureSize {
516
+ width: number;
517
+ height: number;
518
+ }
519
+ ```
520
+
521
+ ## ComputeTextureDataInput
522
+
523
+ 来源:`packages/sdk/src/index.ts:244`
524
+
525
+ ```ts
526
+ export interface ComputeTextureDataInput extends ComputeTextureSize {
527
+ id: string;
528
+ /** Linear rgba32float texels in row-major order, without color-space conversion. */
529
+ data?: readonly Vec4[];
530
+ asset?: never;
531
+ }
532
+ ```
533
+
534
+ ## ComputeTextureAssetInput
535
+
536
+ 来源:`packages/sdk/src/index.ts:250`
537
+
538
+ ```ts
539
+ export interface ComputeTextureAssetInput {
540
+ id: string;
541
+ asset: AssetDefinition | string;
542
+ width?: never;
543
+ height?: never;
544
+ data?: never;
545
+ }
546
+ ```
547
+
548
+ ## ComputeTextureInput
549
+
550
+ 来源:`packages/sdk/src/index.ts:257`
551
+
552
+ ```ts
553
+ export type ComputeTextureInput = ComputeTextureDataInput | ComputeTextureAssetInput;
554
+ ```
555
+
556
+ ## ComputeTextureBinding
557
+
558
+ 来源:`packages/sdk/src/index.ts:258`
559
+
560
+ ```ts
561
+ export interface ComputeTextureBinding {
562
+ name: string;
563
+ filter?: "nearest" | "linear";
564
+ wrapU?: "clamp" | "repeat" | "mirror";
565
+ wrapV?: "clamp" | "repeat" | "mirror";
566
+ }
567
+ ```
568
+
569
+ ## ComputeDispatchInput
570
+
571
+ 来源:`packages/sdk/src/index.ts:264`
572
+
573
+ ```ts
574
+ export interface ComputeDispatchInput {
575
+ output: ComputeBufferHandle | ComputeTextureHandle;
576
+ /** Handles capture dispatch-time data; task bindings consume that exact successful output revision. */
577
+ bindings?: Readonly<Record<string, ComputeBufferHandle | { task: ComputeTaskHandle }>>;
578
+ /** Named sampled rgba32float textures; task bindings capture that exact texture result. */
579
+ textures?: Readonly<Record<string, ComputeTextureHandle | { task: ComputeTaskHandle }>>;
580
+ /** Ordering only. It never silently refreshes ordinary handle bindings. */
581
+ after?: readonly ComputeTaskHandle[];
582
+ parameters?: Readonly<Record<string, GraphValue>>;
583
+ /** Fixed simulation time by default, not wall-clock time. */
584
+ time?: number;
585
+ }
586
+ ```
587
+
588
+ ## ComputeTaskState
589
+
590
+ 来源:`packages/sdk/src/index.ts:276`
591
+
592
+ ```ts
593
+ export interface ComputeTaskState {
594
+ status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
595
+ error?: { code: string; message: string; remediation: string };
596
+ }
597
+ ```
598
+
599
+ ## ComputeService
600
+
601
+ 来源:`packages/sdk/src/index.ts:280`
602
+
603
+ ```ts
604
+ export interface ComputeService {
605
+ createTexture(input: ComputeTextureInput): ComputeTextureHandle;
606
+ resolveTexture(id: string): ComputeTextureHandle;
607
+ describeTexture(texture: ComputeTextureHandle): Readonly<ComputeTextureSize & { id: string; format: "rgba32float"; revision: number }>;
608
+ readTexture(texture: ComputeTextureHandle): readonly Vec4[];
609
+ writeTexture(texture: ComputeTextureHandle, data: readonly Vec4[], region?: ComputeTextureSize & { x: number; y: number }): void;
610
+ releaseTexture(texture: ComputeTextureHandle): void;
611
+ createBuffer(input: ComputeBufferInput): ComputeBufferHandle;
612
+ resolve(id: string): ComputeBufferHandle;
613
+ describeBuffer(buffer: ComputeBufferHandle): Readonly<{ id: string; type: GraphType; count: number; revision: number }>;
614
+ /** Last committed GPU result; detached CPU data, never a GPU object. */
615
+ readBuffer(buffer: ComputeBufferHandle): readonly GraphValue[];
616
+ writeBuffer(buffer: ComputeBufferHandle, values: readonly GraphValue[], offset?: number): void;
617
+ releaseBuffer(buffer: ComputeBufferHandle): void;
618
+ dispatch(kernel: ComputeDefinition | string, input: ComputeDispatchInput): ComputeTaskHandle;
619
+ task(task: ComputeTaskHandle): Readonly<ComputeTaskState>;
620
+ tasks(): readonly { handle: ComputeTaskHandle; state: ComputeTaskState }[];
621
+ cancel(task: ComputeTaskHandle): void;
622
+ releaseTask(task: ComputeTaskHandle): void;
623
+ }
624
+ ```
625
+
626
+ ## InputService
627
+
628
+ 来源:`packages/sdk/src/index.ts:300`
629
+
630
+ ```ts
631
+ export interface InputService {
632
+ held(action: string): boolean;
633
+ pressed(action: string): boolean;
634
+ released(action: string): boolean;
635
+ axis(negative: string, positive: string): number;
636
+ }
637
+ ```
638
+
639
+ ## PhysicsService
640
+
641
+ 来源:`packages/sdk/src/index.ts:306`
642
+
643
+ ```ts
644
+ export interface PhysicsService {
645
+ moveCharacter(entity: string, displacement: Vec3): void;
646
+ grounded(entity: string): boolean;
647
+ velocity(entity: string): Vec3;
648
+ setVelocity(entity: string, velocity: Vec3): void;
649
+ impulse(entity: string, impulse: Vec3): void;
650
+ /** Angular velocity in world-space radians per second. */
651
+ angularVelocity(entity: string): Vec3;
652
+ setAngularVelocity(entity: string, velocity: Vec3): void;
653
+ /** Instantaneous world-space angular impulse, in angular-momentum units. */
654
+ torqueImpulse(entity: string, impulse: Vec3): void;
655
+ /** Apply world-space impulse at a world-space point, changing linear and angular motion. */
656
+ impulseAtPoint(entity: string, impulse: Vec3, point: Vec3): void;
657
+ raycast(
658
+ origin: Vec3,
659
+ direction: Vec3,
660
+ maxDistance: number,
661
+ options?: { exclude?: readonly string[]; includeTriggers?: boolean },
662
+ ): { entity: string; distance: number; point: Vec3; normal: Vec3 } | null;
663
+ }
664
+ ```
665
+
666
+ ## AnimationService
667
+
668
+ 来源:`packages/sdk/src/index.ts:326`
669
+
670
+ ```ts
671
+ export interface AnimationService {
672
+ play(
673
+ entity: string,
674
+ clip: string,
675
+ options?: { fade?: number; speed?: number; loop?: boolean },
676
+ ): void;
677
+ state(entity: string): {
678
+ clip: string | null;
679
+ time: number;
680
+ playing: boolean;
681
+ };
682
+ }
683
+ ```
684
+
685
+ ## CameraService
686
+
687
+ 来源:`packages/sdk/src/index.ts:338`
688
+
689
+ ```ts
690
+ export interface CameraService {
691
+ follow(
692
+ entity: string,
693
+ options?: {
694
+ distance?: number;
695
+ height?: number;
696
+ lookHeight?: number;
697
+ yaw?: number;
698
+ smoothing?: number;
699
+ },
700
+ ): void;
701
+ orbit(yaw: number): void;
702
+ }
703
+ ```
704
+
705
+ ## UIService
706
+
707
+ 来源:`packages/sdk/src/index.ts:351`
708
+
709
+ ```ts
710
+ export interface UIService {
711
+ setText(id: string, text: string): void;
712
+ setProgress(id: string, value: number): void;
713
+ setVisible(id: string, visible: boolean): void;
714
+ }
715
+ ```
716
+
717
+ ## AudioService
718
+
719
+ 来源:`packages/sdk/src/index.ts:356`
720
+
721
+ ```ts
722
+ export interface AudioService {
723
+ play(
724
+ id: string,
725
+ options?: { volume?: number; loop?: boolean; entity?: string; bus?: string; priority?: number },
726
+ ): string;
727
+ stop(voice: string): void;
728
+ /** Pause/resume are idempotent; an unknown valid voice id is a no-op. Playback time follows fixed simulation ticks, even while audio is locked. */
729
+ pause(voice: string): void;
730
+ resume(voice: string): void;
731
+ volume(value: number): void;
732
+ /** Set a declared bus gain, independently of master and voice gain. */
733
+ busVolume(id: string, value: number): void;
734
+ /** Fade a declared bus over fixed-tick seconds; busVolume or another fade replaces it. */
735
+ fadeBus(id: string, target: number, duration: number): void;
736
+ }
737
+ ```
738
+
739
+ ## StorageService
740
+
741
+ 来源:`packages/sdk/src/index.ts:371`
742
+
743
+ ```ts
744
+ export interface StorageService {
745
+ save(slot: string): void;
746
+ load(slot: string): void;
747
+ status(): {
748
+ state: "idle" | "saving" | "loading" | "saved" | "loaded" | "failed";
749
+ slot: string | null;
750
+ error: string | null;
751
+ };
752
+ }
753
+ ```
754
+
755
+ ## SceneService
756
+
757
+ 来源:`packages/sdk/src/index.ts:380`
758
+
759
+ ```ts
760
+ export interface SceneService {
761
+ current(): string;
762
+ load(id: string): void;
763
+ }
764
+ ```
765
+
766
+ ## ModelDefinition
767
+
768
+ 来源:`packages/sdk/src/index.ts:384`
769
+
770
+ ```ts
771
+ export interface ModelDefinition {
772
+ /** Optional whole-model material override; omitted keeps the asset's original materials. */
773
+ material?: MaterialDefinition | string;
774
+ /** Replace all asset material slots with the given exact material name. Mutually exclusive with material. */
775
+ materialSlots?: Record<string, MaterialDefinition | string>;
776
+ castShadow?: boolean;
777
+ receiveShadow?: boolean;
778
+ asset: AssetDefinition | string;
779
+ scale?: number;
780
+ offset?: Vec3;
781
+ rotation?: Vec3;
782
+ animation?: { clip: string; speed?: number; loop?: boolean };
783
+ }
784
+ ```
785
+
786
+ ## RigidBodyDefinition
787
+
788
+ 来源:`packages/sdk/src/index.ts:397`
789
+
790
+ ```ts
791
+ export interface RigidBodyDefinition {
792
+ type: "fixed" | "dynamic" | "kinematic";
793
+ collider: {
794
+ shape: "box" | "sphere" | "capsule";
795
+ size?: Vec3;
796
+ radius?: number;
797
+ halfHeight?: number;
798
+ offset?: Vec3;
799
+ };
800
+ mass?: number;
801
+ friction?: number;
802
+ restitution?: number;
803
+ trigger?: boolean;
804
+ }
805
+ ```
806
+
807
+ ## CharacterDefinition
808
+
809
+ 来源:`packages/sdk/src/index.ts:411`
810
+
811
+ ```ts
812
+ export interface CharacterDefinition {
813
+ radius: number;
814
+ height: number;
815
+ speed: number;
816
+ jumpSpeed?: number;
817
+ /** Downward acceleration magnitude in world units/s^2; defaults to 9.81. Scene.gravity is a signed vector. */
818
+ gravity?: number;
819
+ }
820
+ ```
821
+
822
+ ## UIElementDefinition
823
+
824
+ 来源:`packages/sdk/src/index.ts:419`
825
+
826
+ ```ts
827
+ export interface UIElementDefinition {
828
+ id: string;
829
+ kind: "text" | "bar" | "button" | "input";
830
+ text?: string;
831
+ value?: number;
832
+ visible?: boolean;
833
+ anchor?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center";
834
+ x?: number;
835
+ y?: number;
836
+ width?: number;
837
+ color?: string;
838
+ world?: { entity: string; offset?: Vec3; occlude?: boolean };
839
+ }
840
+ ```
841
+
842
+ ## SoundDefinition
843
+
844
+ 来源:`packages/sdk/src/index.ts:432`
845
+
846
+ ```ts
847
+ export interface SoundDefinition {
848
+ id: string;
849
+ asset: AssetDefinition | string;
850
+ volume?: number;
851
+ loop?: boolean;
852
+ bus?: string;
853
+ }
854
+ ```
855
+
856
+ ## AudioBusDefinition
857
+
858
+ 来源:`packages/sdk/src/index.ts:439`
859
+
860
+ ```ts
861
+ export interface AudioBusDefinition {
862
+ id: string;
863
+ volume?: number;
864
+ }
865
+ ```
866
+
867
+ ## SYSTEM_PHASES
868
+
869
+ 来源:`packages/sdk/src/index.ts:443`
870
+
871
+ ```ts
872
+ SYSTEM_PHASES = [
873
+ "input",
874
+ "prePhysics",
875
+ "physics",
876
+ "postPhysics",
877
+ "update",
878
+ "presentation",
879
+ ] as const
880
+ ```
881
+
882
+ ## SystemPhase
883
+
884
+ 来源:`packages/sdk/src/index.ts:451`
885
+
886
+ ```ts
887
+ export type SystemPhase = (typeof SYSTEM_PHASES)[number];
888
+ ```
889
+
890
+ ## Geometry
891
+
892
+ 来源:`packages/sdk/src/index.ts:452`
893
+
894
+ ```ts
895
+ export type Geometry =
896
+ | { kind: "box"; size?: Vec3 }
897
+ | { kind: "sphere"; radius?: number; segments?: number }
898
+ | { kind: "plane"; size?: readonly [number, number] };
899
+ ```
900
+
901
+ ## GRAPH_TYPES
902
+
903
+ 来源:`packages/sdk/src/index.ts:456`
904
+
905
+ ```ts
906
+ GRAPH_TYPES = ["float", "vec2", "vec3", "vec4", "bool"] as const
907
+ ```
908
+
909
+ ## GraphType
910
+
911
+ 来源:`packages/sdk/src/index.ts:457`
912
+
913
+ ```ts
914
+ export type GraphType = typeof GRAPH_TYPES[number];
915
+ ```
916
+
917
+ ## GraphValue
918
+
919
+ 来源:`packages/sdk/src/index.ts:458`
920
+
921
+ ```ts
922
+ export type GraphValue = number | boolean | Vec2 | Vec3 | Vec4;
923
+ ```
924
+
925
+ ## GraphParameter
926
+
927
+ 来源:`packages/sdk/src/index.ts:459`
928
+
929
+ ```ts
930
+ export interface GraphParameter {
931
+ name: string;
932
+ type: GraphType;
933
+ default: GraphValue;
934
+ }
935
+ ```
936
+
937
+ ## GRAPH_INPUT_TYPES
938
+
939
+ 来源:`packages/sdk/src/index.ts:464`
940
+
941
+ ```ts
942
+ GRAPH_INPUT_TYPES = {
943
+ uv: "vec2", uv1: "vec2", positionWorld: "vec3", normalWorld: "vec3",
944
+ viewDirectionWorld: "vec3", vertexColor: "vec4", index: "float",
945
+ screenSize: "vec2", texelSize: "vec2",
946
+ pixelCoord: "vec2", outputSize: "vec2",
947
+ positionLocal: "vec3", normalLocal: "vec3", vertexIndex: "float", instanceIndex: "float",
948
+ } as const
949
+ ```
950
+
951
+ ## GraphInputName
952
+
953
+ 来源:`packages/sdk/src/index.ts:471`
954
+
955
+ ```ts
956
+ export type GraphInputName = keyof typeof GRAPH_INPUT_TYPES;
957
+ ```
958
+
959
+ ## GRAPH_OPERATIONS
960
+
961
+ 来源:`packages/sdk/src/index.ts:472`
962
+
963
+ ```ts
964
+ GRAPH_OPERATIONS = {
965
+ unary: ["sin", "cos", "abs", "floor", "ceil", "fract", "negate", "saturate", "normalize", "length", "safeSqrt"] as const,
966
+ binary: ["add", "subtract", "multiply", "safeDivide", "min", "max", "dot", "cross", "step", "lessThan", "lessEqual", "greaterThan", "greaterEqual", "equal", "and", "or"] as const,
967
+ ternary: ["mix", "clamp", "smoothstep", "select"] as const,
968
+ } as const
969
+ ```
970
+
971
+ ## GraphNode
972
+
973
+ 来源:`packages/sdk/src/index.ts:477`
974
+
975
+ ```ts
976
+ export type GraphNode =
977
+ | { id: string; op: "float"; value: number }
978
+ | { id: string; op: "bool"; value: boolean }
979
+ | { id: string; op: "vec2"; value: Vec2 }
980
+ | { id: string; op: "vec3"; value: Vec3 }
981
+ | { id: string; op: "vec4"; value: Vec4 }
982
+ | { id: string; op: "time" }
983
+ | { id: string; op: "input"; name: GraphInputName }
984
+ | { id: string; op: "parameter"; name: string }
985
+ | { id: string; op: typeof GRAPH_OPERATIONS.unary[number] | "not"; inputs: readonly [string] }
986
+ | { id: string; op: typeof GRAPH_OPERATIONS.binary[number]; inputs: readonly [string, string] }
987
+ | { id: string; op: typeof GRAPH_OPERATIONS.ternary[number]; inputs: readonly [string, string, string] }
988
+ | { id: string; op: "compose2"; inputs: readonly [string, string] }
989
+ | { id: string; op: "compose3"; inputs: readonly [string, string, string] }
990
+ | { id: string; op: "compose4"; inputs: readonly [string, string, string, string] }
991
+ | { id: string; op: "swizzle"; inputs: readonly [string]; components: string }
992
+ | { id: string; op: "sampleTexture"; inputs: readonly [string]; texture: AssetDefinition | string }
993
+ | { id: string; op: "readBuffer"; inputs: readonly [string]; buffer: string }
994
+ | { id: string; op: "sampleFrame"; inputs: readonly [string]; channel: string }
995
+ | { id: string; op: "sampleHistory"; inputs: readonly [string]; channel: string };
996
+ ```
997
+
998
+ ## Graph
999
+
1000
+ 来源:`packages/sdk/src/index.ts:497`
1001
+
1002
+ ```ts
1003
+ export interface Graph {
1004
+ nodes: readonly GraphNode[];
1005
+ output: string;
1006
+ parameters?: readonly GraphParameter[];
1007
+ }
1008
+ ```
1009
+
1010
+ ## MaterialGraphs
1011
+
1012
+ 来源:`packages/sdk/src/index.ts:502`
1013
+
1014
+ ```ts
1015
+ export interface MaterialGraphs {
1016
+ baseColor?: Graph;
1017
+ emissive?: Graph;
1018
+ roughness?: Graph;
1019
+ metalness?: Graph;
1020
+ opacity?: Graph;
1021
+ /** Absolute, unsided world-space normal; engine applies material boundary orientation. */
1022
+ normalWorld?: Graph;
1023
+ }
1024
+ ```
1025
+
1026
+ ## VertexGraphs
1027
+
1028
+ 来源:`packages/sdk/src/index.ts:511`
1029
+
1030
+ ```ts
1031
+ export interface VertexGraphs {
1032
+ /** Absolute object-local position after built-in morph, skin and instance transforms. */
1033
+ position?: Graph;
1034
+ /** Unsided object-local normal in the same domain; zero keeps the normalized input normal. */
1035
+ normal?: Graph;
1036
+ }
1037
+ ```
1038
+
1039
+ ## MaterialInput
1040
+
1041
+ 来源:`packages/sdk/src/index.ts:517`
1042
+
1043
+ ```ts
1044
+ export interface MaterialInput {
1045
+ id: string;
1046
+ color?: string;
1047
+ roughness?: number;
1048
+ metalness?: number;
1049
+ texture?: AssetDefinition | string;
1050
+ graph?: Graph;
1051
+ graphs?: MaterialGraphs;
1052
+ vertex?: VertexGraphs;
1053
+ buffers?: readonly MaterialBufferInput[];
1054
+ textures?: readonly MaterialTextureInput[];
1055
+ emissive?: string;
1056
+ emissiveIntensity?: number;
1057
+ opacity?: number;
1058
+ alphaTest?: number;
1059
+ side?: "front" | "back" | "double";
1060
+ /** Closed-volume dielectric fraction; opacity remains independent stochastic coverage. */
1061
+ transmission?: number;
1062
+ ior?: number;
1063
+ /** Nontransmissive dielectric specular strength in [0,1]. Defaults to 1. */
1064
+ specularIntensity?: number;
1065
+ /** Nontransmissive dielectric specular color, a hex or named sRGB color. Defaults to white. */
1066
+ specularColor?: string;
1067
+ attenuationColor?: string;
1068
+ /** World-space distance for Beer absorption; omitted means no absorption. */
1069
+ attenuationDistance?: number;
1070
+ }
1071
+ ```
1072
+
1073
+ ## MaterialDefinition
1074
+
1075
+ 来源:`packages/sdk/src/index.ts:544`
1076
+
1077
+ ```ts
1078
+ export interface MaterialDefinition extends MaterialInput {
1079
+ readonly kind: "material";
1080
+ }
1081
+ ```
1082
+
1083
+ ## PostProcessInput
1084
+
1085
+ 来源:`packages/sdk/src/index.ts:547`
1086
+
1087
+ ```ts
1088
+ export interface PostProcessInput {
1089
+ id: string;
1090
+ buffers?: readonly MaterialBufferInput[];
1091
+ textures?: readonly MaterialTextureInput[];
1092
+ /** Linear HDR vec4 output. Frame channels: scene.color, scene.normal, scene.depth, or an earlier pass ID. */
1093
+ graph: Graph;
1094
+ enabled?: boolean;
1095
+ }
1096
+ ```
1097
+
1098
+ ## PostProcessDefinition
1099
+
1100
+ 来源:`packages/sdk/src/index.ts:555`
1101
+
1102
+ ```ts
1103
+ export interface PostProcessDefinition extends PostProcessInput {
1104
+ readonly kind: "postprocess";
1105
+ }
1106
+ ```
1107
+
1108
+ ## ComputeInput
1109
+
1110
+ 来源:`packages/sdk/src/index.ts:558`
1111
+
1112
+ ```ts
1113
+ export interface ComputeInput {
1114
+ id: string;
1115
+ graph: Graph;
1116
+ outputType: GraphType;
1117
+ count: number;
1118
+ workgroupSize?: number;
1119
+ buffers?: readonly { name: string; type: GraphType }[];
1120
+ textures?: readonly ComputeTextureBinding[];
1121
+ }
1122
+ ```
1123
+
1124
+ ## ComputeDefinition
1125
+
1126
+ 来源:`packages/sdk/src/index.ts:567`
1127
+
1128
+ ```ts
1129
+ export interface ComputeDefinition extends ComputeInput {
1130
+ readonly kind: "compute";
1131
+ }
1132
+ ```
1133
+
1134
+ ## AssetInput
1135
+
1136
+ 来源:`packages/sdk/src/index.ts:570`
1137
+
1138
+ ```ts
1139
+ export interface AssetInput {
1140
+ id: string;
1141
+ path: string;
1142
+ type: "texture" | "binary" | "model" | "audio";
1143
+ source?: string;
1144
+ license?: string;
1145
+ attribution?: string;
1146
+ /** Texture imports only; defaults to sRGB color. Data/normal/ORM textures use linear. */
1147
+ colorSpace?: "srgb" | "linear";
1148
+ }
1149
+ ```
1150
+
1151
+ ## AssetDefinition
1152
+
1153
+ 来源:`packages/sdk/src/index.ts:580`
1154
+
1155
+ ```ts
1156
+ export interface AssetDefinition extends AssetInput {
1157
+ readonly kind: "asset";
1158
+ }
1159
+ ```
1160
+
1161
+ ## MeshDefinition
1162
+
1163
+ 来源:`packages/sdk/src/index.ts:583`
1164
+
1165
+ ```ts
1166
+ export interface MeshDefinition {
1167
+ geometry: Geometry;
1168
+ material: MaterialDefinition | string;
1169
+ castShadow?: boolean;
1170
+ receiveShadow?: boolean;
1171
+ }
1172
+ ```
1173
+
1174
+ ## LightDefinition
1175
+
1176
+ 来源:`packages/sdk/src/index.ts:589`
1177
+
1178
+ ```ts
1179
+ export interface LightDefinition {
1180
+ kind: "directional" | "point";
1181
+ color?: string;
1182
+ intensity?: number;
1183
+ castShadow?: boolean;
1184
+ target?: Vec3;
1185
+ shadow?: {
1186
+ mapSize?: number;
1187
+ extent?: number;
1188
+ bias?: number;
1189
+ normalBias?: number;
1190
+ near?: number;
1191
+ far?: number;
1192
+ };
1193
+ }
1194
+ ```
1195
+
1196
+ ## EntityInput
1197
+
1198
+ 来源:`packages/sdk/src/index.ts:604`
1199
+
1200
+ ```ts
1201
+ export interface EntityInput {
1202
+ id: string;
1203
+ prefab?: PrefabDefinition | string;
1204
+ parent?: string;
1205
+ transform?: TransformPatch;
1206
+ mesh?: MeshDefinition;
1207
+ light?: LightDefinition;
1208
+ model?: ModelDefinition;
1209
+ rigidBody?: RigidBodyDefinition;
1210
+ character?: CharacterDefinition;
1211
+ components?: readonly ComponentInstance[];
1212
+ }
1213
+ ```
1214
+
1215
+ ## PrefabInput
1216
+
1217
+ 来源:`packages/sdk/src/index.ts:616`
1218
+
1219
+ ```ts
1220
+ export interface PrefabInput extends Omit<EntityInput, "prefab" | "parent"> {
1221
+ extends?: PrefabDefinition | string;
1222
+ }
1223
+ ```
1224
+
1225
+ ## PrefabDefinition
1226
+
1227
+ 来源:`packages/sdk/src/index.ts:619`
1228
+
1229
+ ```ts
1230
+ export interface PrefabDefinition extends PrefabInput {
1231
+ readonly kind: "prefab";
1232
+ }
1233
+ ```
1234
+
1235
+ ## SceneInput
1236
+
1237
+ 来源:`packages/sdk/src/index.ts:622`
1238
+
1239
+ ```ts
1240
+ export interface SceneInput {
1241
+ id: string;
1242
+ camera?: {
1243
+ position: Vec3;
1244
+ target: Vec3;
1245
+ fov?: number;
1246
+ near?: number;
1247
+ far?: number;
1248
+ };
1249
+ environment?: {
1250
+ background?: string;
1251
+ ambientIntensity?: number;
1252
+ lighting?: "none" | "studio";
1253
+ };
1254
+ follow?: {
1255
+ entity: string;
1256
+ distance?: number;
1257
+ height?: number;
1258
+ lookHeight?: number;
1259
+ yaw?: number;
1260
+ smoothing?: number;
1261
+ };
1262
+ gravity?: Vec3;
1263
+ entities: readonly EntityInput[];
1264
+ }
1265
+ ```
1266
+
1267
+ ## SceneDefinition
1268
+
1269
+ 来源:`packages/sdk/src/index.ts:647`
1270
+
1271
+ ```ts
1272
+ export interface SceneDefinition extends SceneInput {
1273
+ readonly kind: "scene";
1274
+ }
1275
+ ```
1276
+
1277
+ ## SystemInput
1278
+
1279
+ 来源:`packages/sdk/src/index.ts:650`
1280
+
1281
+ ```ts
1282
+ export interface SystemInput {
1283
+ id: string;
1284
+ phase?: SystemPhase;
1285
+ before?: readonly string[];
1286
+ after?: readonly string[];
1287
+ reads?: readonly string[];
1288
+ writes?: readonly string[];
1289
+ structural?: boolean;
1290
+ run: (engine: SystemContext, dt: number) => void;
1291
+ }
1292
+ ```
1293
+
1294
+ ## SystemDefinition
1295
+
1296
+ 来源:`packages/sdk/src/index.ts:660`
1297
+
1298
+ ```ts
1299
+ export interface SystemDefinition extends SystemInput {
1300
+ readonly kind: "system";
1301
+ }
1302
+ ```
1303
+
1304
+ ## GameInput
1305
+
1306
+ 来源:`packages/sdk/src/index.ts:663`
1307
+
1308
+ ```ts
1309
+ export interface GameInput {
1310
+ id: string;
1311
+ scene: SceneDefinition;
1312
+ systems?: readonly SystemDefinition[];
1313
+ components?: readonly ComponentDefinition[];
1314
+ prefabs?: readonly PrefabDefinition[];
1315
+ materials?: readonly MaterialDefinition[];
1316
+ computes?: readonly ComputeDefinition[];
1317
+ computeBuffers?: readonly ComputeBufferInput[];
1318
+ computeTextures?: readonly ComputeTextureInput[];
1319
+ assets?: readonly AssetDefinition[];
1320
+ scenes?: readonly SceneDefinition[];
1321
+ input?: Readonly<Record<string, readonly string[]>>;
1322
+ ui?: readonly UIElementDefinition[];
1323
+ sounds?: readonly SoundDefinition[];
1324
+ audioBuses?: readonly AudioBusDefinition[];
1325
+ render?: Partial<RenderSettings>;
1326
+ postProcesses?: readonly PostProcessDefinition[];
1327
+ }
1328
+ ```
1329
+
1330
+ ## GameDefinition
1331
+
1332
+ 来源:`packages/sdk/src/index.ts:682`
1333
+
1334
+ ```ts
1335
+ export interface GameDefinition extends GameInput {
1336
+ readonly kind: "game";
1337
+ }
1338
+ ```
1339
+
1340
+ ## GameInstance
1341
+
1342
+ 来源:`packages/sdk/src/index.ts:685`
1343
+
1344
+ ```ts
1345
+ export interface GameInstance {
1346
+ update(dt: number): void;
1347
+ dispose(): void;
1348
+ }
1349
+ ```
1350
+
1351
+ ## defineComponent
1352
+
1353
+ 来源:`packages/sdk/src/index.ts:689`
1354
+
1355
+ ```ts
1356
+ export function defineComponent<const S extends ComponentSchema>(input: {
1357
+ id: string;
1358
+ schema: S;
1359
+ }): ComponentDefinition<S>;
1360
+ ```
1361
+
1362
+ ## defineMaterial
1363
+
1364
+ 来源:`packages/sdk/src/index.ts:695`
1365
+
1366
+ ```ts
1367
+ export function defineMaterial(input: MaterialInput): MaterialDefinition;
1368
+ ```
1369
+
1370
+ ## definePostProcess
1371
+
1372
+ 来源:`packages/sdk/src/index.ts:698`
1373
+
1374
+ ```ts
1375
+ export function definePostProcess(input: PostProcessInput): PostProcessDefinition;
1376
+ ```
1377
+
1378
+ ## defineCompute
1379
+
1380
+ 来源:`packages/sdk/src/index.ts:701`
1381
+
1382
+ ```ts
1383
+ export function defineCompute(input: ComputeInput): ComputeDefinition;
1384
+ ```
1385
+
1386
+ ## defineAsset
1387
+
1388
+ 来源:`packages/sdk/src/index.ts:704`
1389
+
1390
+ ```ts
1391
+ export function defineAsset(input: AssetInput): AssetDefinition;
1392
+ ```
1393
+
1394
+ ## definePrefab
1395
+
1396
+ 来源:`packages/sdk/src/index.ts:707`
1397
+
1398
+ ```ts
1399
+ export function definePrefab(input: PrefabInput): PrefabDefinition;
1400
+ ```
1401
+
1402
+ ## defineScene
1403
+
1404
+ 来源:`packages/sdk/src/index.ts:710`
1405
+
1406
+ ```ts
1407
+ export function defineScene(input: SceneInput): SceneDefinition;
1408
+ ```
1409
+
1410
+ ## defineSystem
1411
+
1412
+ 来源:`packages/sdk/src/index.ts:713`
1413
+
1414
+ ```ts
1415
+ export function defineSystem(input: SystemInput): SystemDefinition;
1416
+ ```
1417
+
1418
+ ## defineGame
1419
+
1420
+ 来源:`packages/sdk/src/index.ts:716`
1421
+
1422
+ ```ts
1423
+ export function defineGame(input: GameInput): GameDefinition;
1424
+ ```
1425
+
1426
+ ## instantiateGame
1427
+
1428
+ 来源:`packages/sdk/src/index.ts:720`
1429
+
1430
+ ```ts
1431
+ export function instantiateGame(
1432
+ game: GameDefinition,
1433
+ engine: EngineFacade,
1434
+ ): GameInstance;
1435
+ ```