blecsd 0.1.0

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 (109) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +220 -0
  3. package/dist/3d/index.d.ts +5 -0
  4. package/dist/3d/index.js +1 -0
  5. package/dist/audio/index.d.ts +177 -0
  6. package/dist/audio/index.js +1 -0
  7. package/dist/border-D_Jb4ZJV.d.ts +257 -0
  8. package/dist/cell-DwIu2ryP.d.ts +505 -0
  9. package/dist/chunk-2UBBZFE4.js +1 -0
  10. package/dist/chunk-35LCBY6P.js +1 -0
  11. package/dist/chunk-3B7MIVW6.js +1 -0
  12. package/dist/chunk-3EGGGI5J.js +3 -0
  13. package/dist/chunk-4LWWONFK.js +1 -0
  14. package/dist/chunk-4X4N4HNQ.js +2 -0
  15. package/dist/chunk-5PELJRUQ.js +1 -0
  16. package/dist/chunk-AEJIX2MW.js +1 -0
  17. package/dist/chunk-AQ7LW75B.js +1 -0
  18. package/dist/chunk-AXZQAH4X.js +1 -0
  19. package/dist/chunk-B6Z2JFRY.js +1 -0
  20. package/dist/chunk-BCADUCOZ.js +1 -0
  21. package/dist/chunk-C5PCEQ6G.js +1 -0
  22. package/dist/chunk-CIK4AMUA.js +1 -0
  23. package/dist/chunk-DNRXW56C.js +1 -0
  24. package/dist/chunk-FC5FFAAC.js +12 -0
  25. package/dist/chunk-FGHEFXLK.js +1 -0
  26. package/dist/chunk-FYEBZAWN.js +1 -0
  27. package/dist/chunk-G7GIWWLE.js +1 -0
  28. package/dist/chunk-GYHI26UE.js +1 -0
  29. package/dist/chunk-H2YAOJDW.js +1 -0
  30. package/dist/chunk-J4JZ2NU2.js +1 -0
  31. package/dist/chunk-JKVHO4LH.js +1 -0
  32. package/dist/chunk-K2B2OXQ5.js +5 -0
  33. package/dist/chunk-K37L3G4Z.js +4 -0
  34. package/dist/chunk-KD55INV7.js +1 -0
  35. package/dist/chunk-KFAK4A3G.js +1 -0
  36. package/dist/chunk-LCN2ZITE.js +1 -0
  37. package/dist/chunk-LYSK5S63.js +1 -0
  38. package/dist/chunk-NZ55KBM6.js +1 -0
  39. package/dist/chunk-OMMJ7B5P.js +1 -0
  40. package/dist/chunk-OUXUPF3V.js +33 -0
  41. package/dist/chunk-OVT2PPGW.js +19 -0
  42. package/dist/chunk-P6CJO3BC.js +1 -0
  43. package/dist/chunk-PSXXMBVJ.js +1 -0
  44. package/dist/chunk-PXXGH3BV.js +1 -0
  45. package/dist/chunk-QIKIOVP2.js +1 -0
  46. package/dist/chunk-SHUC6JWA.js +1 -0
  47. package/dist/chunk-TDXJDLY6.js +6 -0
  48. package/dist/chunk-TWSWTBYL.js +1 -0
  49. package/dist/chunk-TYMY2TBR.js +3 -0
  50. package/dist/chunk-VNZ6CWJA.js +2 -0
  51. package/dist/chunk-VOCM5T2G.js +5 -0
  52. package/dist/chunk-W5OU7Z6J.js +1 -0
  53. package/dist/chunk-WNG4A3K7.js +4 -0
  54. package/dist/chunk-XQIGERNI.js +1 -0
  55. package/dist/chunk-XZA63ZPO.js +1 -0
  56. package/dist/chunk-YAMOSPWB.js +4 -0
  57. package/dist/chunk-YD6ULIUR.js +1 -0
  58. package/dist/chunk-Z4EZERNE.js +1 -0
  59. package/dist/cli/init.d.ts +86 -0
  60. package/dist/cli/init.js +179 -0
  61. package/dist/color-B78w3zH-.d.ts +79 -0
  62. package/dist/components/index.d.ts +10298 -0
  63. package/dist/components/index.js +1 -0
  64. package/dist/core/index.d.ts +6700 -0
  65. package/dist/core/index.js +1 -0
  66. package/dist/debug/index.d.ts +711 -0
  67. package/dist/debug/index.js +1 -0
  68. package/dist/doubleBuffer-CKQFmlPN.d.ts +95 -0
  69. package/dist/errors/index.d.ts +1110 -0
  70. package/dist/errors/index.js +1 -0
  71. package/dist/events-BbbxkgvX.d.ts +125 -0
  72. package/dist/game/index.d.ts +486 -0
  73. package/dist/game/index.js +1 -0
  74. package/dist/gameLoop-BIPW7-OY.d.ts +219 -0
  75. package/dist/index-zSGJ2eUk.d.ts +3156 -0
  76. package/dist/index.d.ts +246 -0
  77. package/dist/index.js +1 -0
  78. package/dist/input/index.d.ts +158 -0
  79. package/dist/input/index.js +1 -0
  80. package/dist/inputActions-CefRUBuT.d.ts +2637 -0
  81. package/dist/keyParser-Bwm8-l7v.d.ts +229 -0
  82. package/dist/mouseParser-Cfrbn3AX.d.ts +177 -0
  83. package/dist/parser-iMHmQuUh.d.ts +265 -0
  84. package/dist/program-BZaKqDKH.d.ts +141 -0
  85. package/dist/renderable-jTMOA-GK.d.ts +302 -0
  86. package/dist/scheduler-DcfoFuum.d.ts +86 -0
  87. package/dist/schemas/index.d.ts +936 -0
  88. package/dist/schemas/index.js +1 -0
  89. package/dist/systems/index.d.ts +4036 -0
  90. package/dist/systems/index.js +1 -0
  91. package/dist/terminal/index.d.ts +7357 -0
  92. package/dist/terminal/index.js +1 -0
  93. package/dist/terminus-14-bold-HWSPRLJD.js +1 -0
  94. package/dist/terminus-14-normal-T3SWMH4D.js +1 -0
  95. package/dist/tilemap-D1HJvKy3.d.ts +1211 -0
  96. package/dist/types-BcsvoKzf.d.ts +68 -0
  97. package/dist/utils/index.d.ts +6104 -0
  98. package/dist/utils/index.js +1 -0
  99. package/dist/viewport3d-xI33-_wq.d.ts +182 -0
  100. package/dist/virtualScrollback-DvZTRU8a.d.ts +274 -0
  101. package/dist/virtualViewport-Dx2iJliO.d.ts +2334 -0
  102. package/dist/virtualizedLineStore-DwPEvPkk.d.ts +297 -0
  103. package/dist/widgets/bigText.d.ts +230 -0
  104. package/dist/widgets/bigText.js +1 -0
  105. package/dist/widgets/fonts/index.d.ts +211 -0
  106. package/dist/widgets/fonts/index.js +1 -0
  107. package/dist/widgets/index.d.ts +8591 -0
  108. package/dist/widgets/index.js +1 -0
  109. package/package.json +213 -0
@@ -0,0 +1,3156 @@
1
+ import { z } from 'zod';
2
+ import { W as World, E as Entity, S as System } from './types-BcsvoKzf.js';
3
+ import { A as Animation3DConfig, C as Camera3DConfig, M as Material3DConfig, a as MouseInteraction3DConfig, T as Transform3DConfig, V as Viewport3DConfig, b as Animation3DConfigSchema, c as Camera3DConfigSchema, d as Material3DConfigSchema, e as MouseInteraction3DConfigSchema, f as Transform3DConfigSchema, g as Viewport3DConfigSchema, h as Viewport3DWidgetConfig, i as Viewport3DWidgetConfigSchema } from './viewport3d-xI33-_wq.js';
4
+
5
+ /**
6
+ * Zod schemas for 3D renderer backend configuration.
7
+ *
8
+ * @module 3d/schemas/backends
9
+ */
10
+
11
+ /**
12
+ * Supported backend rendering types.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const type = BackendTypeSchema.parse('braille'); // Valid
17
+ * BackendTypeSchema.parse('invalid'); // Throws
18
+ * ```
19
+ */
20
+ declare const BackendTypeSchema: z.ZodEnum<{
21
+ braille: "braille";
22
+ halfblock: "halfblock";
23
+ sextant: "sextant";
24
+ sixel: "sixel";
25
+ kitty: "kitty";
26
+ }>;
27
+ type BackendType = z.infer<typeof BackendTypeSchema>;
28
+ /**
29
+ * Capabilities descriptor for a rendering backend.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const caps = BackendCapabilitiesSchema.parse({
34
+ * maxColors: 2,
35
+ * supportsAlpha: false,
36
+ * pixelsPerCellX: 2,
37
+ * pixelsPerCellY: 4,
38
+ * supportsAnimation: false,
39
+ * requiresEscapeSequences: false,
40
+ * });
41
+ * ```
42
+ */
43
+ declare const BackendCapabilitiesSchema: z.ZodObject<{
44
+ maxColors: z.ZodNumber;
45
+ supportsAlpha: z.ZodBoolean;
46
+ pixelsPerCellX: z.ZodNumber;
47
+ pixelsPerCellY: z.ZodNumber;
48
+ supportsAnimation: z.ZodBoolean;
49
+ requiresEscapeSequences: z.ZodBoolean;
50
+ }, z.core.$strip>;
51
+ type BackendCapabilities = z.infer<typeof BackendCapabilitiesSchema>;
52
+ /**
53
+ * A single encoded terminal cell for cell-based backends.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const cell = EncodedCellSchema.parse({ x: 0, y: 0, char: '⠿', fg: 0xffffff, bg: 0x000000 });
58
+ * ```
59
+ */
60
+ declare const EncodedCellSchema: z.ZodObject<{
61
+ x: z.ZodNumber;
62
+ y: z.ZodNumber;
63
+ char: z.ZodString;
64
+ fg: z.ZodNumber;
65
+ bg: z.ZodNumber;
66
+ }, z.core.$strip>;
67
+ type EncodedCell = z.infer<typeof EncodedCellSchema>;
68
+ /**
69
+ * Output from a renderer backend encode pass.
70
+ *
71
+ * Cell-based backends (braille, halfblock, sextant) produce `cells`.
72
+ * Escape-based backends (sixel, kitty) produce `escape` strings.
73
+ * At least one of `cells` or `escape` must be present.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * // Cell-based output
78
+ * const cellOutput: EncodedOutput = { cells: [{ x: 0, y: 0, char: '⠿', fg: 0xffffff, bg: 0 }] };
79
+ *
80
+ * // Escape-based output
81
+ * const escapeOutput: EncodedOutput = { escape: '\x1bPq...', cursorX: 0, cursorY: 0 };
82
+ * ```
83
+ */
84
+ declare const EncodedOutputSchema: z.ZodObject<{
85
+ cells: z.ZodOptional<z.ZodArray<z.ZodObject<{
86
+ x: z.ZodNumber;
87
+ y: z.ZodNumber;
88
+ char: z.ZodString;
89
+ fg: z.ZodNumber;
90
+ bg: z.ZodNumber;
91
+ }, z.core.$strip>>>;
92
+ escape: z.ZodOptional<z.ZodString>;
93
+ cursorX: z.ZodOptional<z.ZodNumber>;
94
+ cursorY: z.ZodOptional<z.ZodNumber>;
95
+ }, z.core.$strip>;
96
+ type EncodedOutput = z.infer<typeof EncodedOutputSchema>;
97
+ /**
98
+ * Backend selection: a specific type or 'auto' for capability-based detection.
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const sel = BackendSelectionSchema.parse('auto'); // Valid
103
+ * const sel2 = BackendSelectionSchema.parse('sixel'); // Valid
104
+ * ```
105
+ */
106
+ declare const BackendSelectionSchema: z.ZodUnion<readonly [z.ZodEnum<{
107
+ braille: "braille";
108
+ halfblock: "halfblock";
109
+ sextant: "sextant";
110
+ sixel: "sixel";
111
+ kitty: "kitty";
112
+ }>, z.ZodLiteral<"auto">]>;
113
+ type BackendSelection = z.infer<typeof BackendSelectionSchema>;
114
+ /**
115
+ * Configuration for the braille rendering backend.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const config = BrailleConfigSchema.parse({ threshold: 64, colorMode: 'dominant' });
120
+ * ```
121
+ */
122
+ declare const BrailleConfigSchema: z.ZodObject<{
123
+ threshold: z.ZodDefault<z.ZodNumber>;
124
+ colorMode: z.ZodDefault<z.ZodEnum<{
125
+ average: "average";
126
+ dominant: "dominant";
127
+ brightness: "brightness";
128
+ }>>;
129
+ backgroundColor: z.ZodDefault<z.ZodNumber>;
130
+ }, z.core.$strip>;
131
+ type BrailleConfig = z.input<typeof BrailleConfigSchema>;
132
+ /**
133
+ * Configuration for the half-block rendering backend.
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * const config = HalfBlockConfigSchema.parse({});
138
+ * ```
139
+ */
140
+ declare const HalfBlockConfigSchema: z.ZodObject<{
141
+ backgroundColor: z.ZodDefault<z.ZodNumber>;
142
+ }, z.core.$strip>;
143
+ type HalfBlockConfig = z.input<typeof HalfBlockConfigSchema>;
144
+ /**
145
+ * Configuration for the sextant rendering backend.
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const config = SextantConfigSchema.parse({ threshold: 100 });
150
+ * ```
151
+ */
152
+ declare const SextantConfigSchema: z.ZodObject<{
153
+ threshold: z.ZodDefault<z.ZodNumber>;
154
+ backgroundColor: z.ZodDefault<z.ZodNumber>;
155
+ }, z.core.$strip>;
156
+ type SextantConfig = z.input<typeof SextantConfigSchema>;
157
+ /**
158
+ * Configuration for the sixel rendering backend.
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const config = SixelConfigSchema.parse({ maxColors: 64 });
163
+ * ```
164
+ */
165
+ declare const SixelConfigSchema: z.ZodObject<{
166
+ maxColors: z.ZodDefault<z.ZodNumber>;
167
+ rleEnabled: z.ZodDefault<z.ZodBoolean>;
168
+ }, z.core.$strip>;
169
+ type SixelConfig = z.input<typeof SixelConfigSchema>;
170
+ /**
171
+ * Configuration for the Kitty Graphics Protocol rendering backend.
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const config = KittyConfigSchema.parse({ imageId: 42 });
176
+ * ```
177
+ */
178
+ declare const KittyConfigSchema: z.ZodObject<{
179
+ imageId: z.ZodDefault<z.ZodNumber>;
180
+ chunkSize: z.ZodDefault<z.ZodNumber>;
181
+ }, z.core.$strip>;
182
+ type KittyConfig = z.input<typeof KittyConfigSchema>;
183
+ /**
184
+ * Backend selection preferences for auto-detection.
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * const pref = BackendPreferenceSchema.parse({ preferred: 'auto', fallback: 'braille' });
189
+ * ```
190
+ */
191
+ declare const BackendPreferenceSchema: z.ZodObject<{
192
+ preferred: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
193
+ braille: "braille";
194
+ halfblock: "halfblock";
195
+ sextant: "sextant";
196
+ sixel: "sixel";
197
+ kitty: "kitty";
198
+ }>, z.ZodLiteral<"auto">]>>;
199
+ fallback: z.ZodDefault<z.ZodEnum<{
200
+ braille: "braille";
201
+ halfblock: "halfblock";
202
+ sextant: "sextant";
203
+ sixel: "sixel";
204
+ kitty: "kitty";
205
+ }>>;
206
+ forceBackend: z.ZodDefault<z.ZodBoolean>;
207
+ }, z.core.$strip>;
208
+ type BackendPreference = z.input<typeof BackendPreferenceSchema>;
209
+
210
+ /**
211
+ * Zod schemas for the pixel rasterizer subsystem.
212
+ * @module 3d/schemas/rasterizer
213
+ */
214
+
215
+ /**
216
+ * Configuration for creating a pixel framebuffer.
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * const config = PixelBufferConfigSchema.parse({ width: 400, height: 200 });
221
+ * ```
222
+ */
223
+ declare const PixelBufferConfigSchema: z.ZodObject<{
224
+ width: z.ZodNumber;
225
+ height: z.ZodNumber;
226
+ enableDepthBuffer: z.ZodDefault<z.ZodBoolean>;
227
+ }, z.core.$strip>;
228
+ type PixelBufferConfig = z.input<typeof PixelBufferConfigSchema>;
229
+ /**
230
+ * An RGBA color with components in the range [0, 255].
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * const red = RGBAColorSchema.parse({ r: 255, g: 0, b: 0 });
235
+ * // red.a defaults to 255
236
+ * ```
237
+ */
238
+ /**
239
+ * A line endpoint with position, optional depth, and color.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * const endpoint = LineEndpointSchema.parse({ x: 10, y: 20, r: 255, g: 0, b: 0 });
244
+ * ```
245
+ */
246
+ declare const LineEndpointSchema: z.ZodObject<{
247
+ x: z.ZodNumber;
248
+ y: z.ZodNumber;
249
+ depth: z.ZodOptional<z.ZodNumber>;
250
+ r: z.ZodNumber;
251
+ g: z.ZodNumber;
252
+ b: z.ZodNumber;
253
+ a: z.ZodDefault<z.ZodNumber>;
254
+ }, z.core.$strip>;
255
+ type LineEndpoint = z.input<typeof LineEndpointSchema>;
256
+ declare const RGBAColorSchema: z.ZodObject<{
257
+ r: z.ZodNumber;
258
+ g: z.ZodNumber;
259
+ b: z.ZodNumber;
260
+ a: z.ZodDefault<z.ZodNumber>;
261
+ }, z.core.$strip>;
262
+ type RGBAColor = z.infer<typeof RGBAColorSchema>;
263
+ /**
264
+ * A triangle vertex with position, depth, and color.
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * const vertex = TriangleVertexSchema.parse({ x: 10, y: 20, depth: 0.5, r: 255, g: 0, b: 0 });
269
+ * ```
270
+ */
271
+ declare const TriangleVertexSchema: z.ZodObject<{
272
+ x: z.ZodNumber;
273
+ y: z.ZodNumber;
274
+ depth: z.ZodNumber;
275
+ r: z.ZodNumber;
276
+ g: z.ZodNumber;
277
+ b: z.ZodNumber;
278
+ a: z.ZodDefault<z.ZodNumber>;
279
+ }, z.core.$strip>;
280
+ type TriangleVertex = z.input<typeof TriangleVertexSchema>;
281
+ /**
282
+ * A directional light source for flat shading.
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * const light = DirectionalLightSchema.parse({
287
+ * direction: [0, -1, 0],
288
+ * intensity: 0.8,
289
+ * });
290
+ * ```
291
+ */
292
+ declare const DirectionalLightSchema: z.ZodObject<{
293
+ direction: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
294
+ intensity: z.ZodDefault<z.ZodNumber>;
295
+ color: z.ZodOptional<z.ZodObject<{
296
+ r: z.ZodNumber;
297
+ g: z.ZodNumber;
298
+ b: z.ZodNumber;
299
+ a: z.ZodDefault<z.ZodNumber>;
300
+ }, z.core.$strip>>;
301
+ }, z.core.$strip>;
302
+ type DirectionalLight = z.input<typeof DirectionalLightSchema>;
303
+ /**
304
+ * An ambient light for baseline illumination.
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const ambient = AmbientLightSchema.parse({ intensity: 0.2 });
309
+ * ```
310
+ */
311
+ declare const AmbientLightSchema: z.ZodObject<{
312
+ intensity: z.ZodDefault<z.ZodNumber>;
313
+ color: z.ZodOptional<z.ZodObject<{
314
+ r: z.ZodNumber;
315
+ g: z.ZodNumber;
316
+ b: z.ZodNumber;
317
+ a: z.ZodDefault<z.ZodNumber>;
318
+ }, z.core.$strip>>;
319
+ }, z.core.$strip>;
320
+ type AmbientLight = z.input<typeof AmbientLightSchema>;
321
+
322
+ /**
323
+ * RGBA pixel framebuffer with optional depth buffer for 3D rasterization.
324
+ *
325
+ * All backends consume this intermediate format. The rasterizer writes to it,
326
+ * and encoding backends read from it to produce terminal output.
327
+ *
328
+ * @module 3d/rasterizer/pixelBuffer
329
+ */
330
+
331
+ /**
332
+ * An RGBA pixel framebuffer with optional depth buffer.
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * const fb = createPixelFramebuffer({ width: 400, height: 200 });
337
+ * setPixel(fb, 10, 20, { r: 255, g: 0, b: 0, a: 255 });
338
+ * const pixel = getPixel(fb, 10, 20);
339
+ * ```
340
+ */
341
+ interface PixelFramebuffer {
342
+ readonly width: number;
343
+ readonly height: number;
344
+ readonly colorBuffer: Uint8ClampedArray;
345
+ readonly depthBuffer: Float32Array | null;
346
+ }
347
+ /**
348
+ * Create a new pixel framebuffer. Config is validated via Zod.
349
+ *
350
+ * @param config - Buffer dimensions and depth buffer toggle
351
+ * @returns A new framebuffer with cleared color and depth buffers
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * const fb = createPixelFramebuffer({ width: 400, height: 200, enableDepthBuffer: true });
356
+ * ```
357
+ */
358
+ declare function createPixelFramebuffer(config: PixelBufferConfig): PixelFramebuffer;
359
+ /**
360
+ * Clear the framebuffer to a solid color and reset depth values.
361
+ * Mutates the framebuffer in place for performance (hot path).
362
+ *
363
+ * @param fb - Framebuffer to clear
364
+ * @param color - Clear color (defaults to transparent black)
365
+ * @param depth - Clear depth value (defaults to 1.0, far plane)
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * clearFramebuffer(fb, { r: 0, g: 0, b: 0, a: 255 });
370
+ * ```
371
+ */
372
+ declare function clearFramebuffer(fb: PixelFramebuffer, color?: RGBAColor, depth?: number): void;
373
+ /**
374
+ * Check if coordinates are within framebuffer bounds.
375
+ *
376
+ * @param fb - Framebuffer to check against
377
+ * @param x - X coordinate
378
+ * @param y - Y coordinate
379
+ * @returns True if (x, y) is within bounds
380
+ *
381
+ * @example
382
+ * ```typescript
383
+ * if (isInBounds(fb, x, y)) {
384
+ * setPixel(fb, x, y, color);
385
+ * }
386
+ * ```
387
+ */
388
+ declare function isInBounds(fb: PixelFramebuffer, x: number, y: number): boolean;
389
+ /**
390
+ * Get the RGBA color at the specified pixel. Returns a copy.
391
+ * Returns transparent black for out-of-bounds coordinates.
392
+ *
393
+ * @param fb - Framebuffer to read from
394
+ * @param x - X coordinate
395
+ * @param y - Y coordinate
396
+ * @returns RGBA color at the pixel
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * const color = getPixel(fb, 10, 20);
401
+ * console.log(color.r, color.g, color.b, color.a);
402
+ * ```
403
+ */
404
+ declare function getPixel(fb: PixelFramebuffer, x: number, y: number): RGBAColor;
405
+ /**
406
+ * Set the RGBA color at the specified pixel. Bounds-checked (no-op if out of bounds).
407
+ *
408
+ * @param fb - Framebuffer to write to
409
+ * @param x - X coordinate
410
+ * @param y - Y coordinate
411
+ * @param color - RGBA color to set
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * setPixel(fb, 10, 20, { r: 255, g: 0, b: 0, a: 255 });
416
+ * ```
417
+ */
418
+ declare function setPixel(fb: PixelFramebuffer, x: number, y: number, color: RGBAColor): void;
419
+ /**
420
+ * Set pixel color without bounds checking. Use only in inner loops where
421
+ * bounds have already been verified.
422
+ *
423
+ * @param fb - Framebuffer to write to
424
+ * @param x - X coordinate (must be in bounds)
425
+ * @param y - Y coordinate (must be in bounds)
426
+ * @param r - Red component (0-255)
427
+ * @param g - Green component (0-255)
428
+ * @param b - Blue component (0-255)
429
+ * @param a - Alpha component (0-255)
430
+ *
431
+ * @example
432
+ * ```typescript
433
+ * // Only use when bounds are guaranteed
434
+ * if (isInBounds(fb, x, y)) {
435
+ * setPixelUnsafe(fb, x, y, 255, 0, 0, 255);
436
+ * }
437
+ * ```
438
+ */
439
+ declare function setPixelUnsafe(fb: PixelFramebuffer, x: number, y: number, r: number, g: number, b: number, a: number): void;
440
+ /**
441
+ * Get the depth value at the specified pixel.
442
+ * Returns 1.0 (far plane) for out-of-bounds or if no depth buffer exists.
443
+ *
444
+ * @param fb - Framebuffer to read from
445
+ * @param x - X coordinate
446
+ * @param y - Y coordinate
447
+ * @returns Depth value at the pixel (0.0 = near, 1.0 = far)
448
+ *
449
+ * @example
450
+ * ```typescript
451
+ * const depth = getDepth(fb, 10, 20);
452
+ * ```
453
+ */
454
+ declare function getDepth(fb: PixelFramebuffer, x: number, y: number): number;
455
+ /**
456
+ * Test if a pixel passes the depth test (closer than current depth) and
457
+ * update the depth buffer if it passes.
458
+ *
459
+ * @param fb - Framebuffer with depth buffer
460
+ * @param x - X coordinate
461
+ * @param y - Y coordinate
462
+ * @param depth - Depth value to test (0.0 = near, 1.0 = far)
463
+ * @returns True if the depth test passed and the value was written
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * if (testAndSetDepth(fb, x, y, 0.5)) {
468
+ * setPixelUnsafe(fb, x, y, 255, 0, 0, 255);
469
+ * }
470
+ * ```
471
+ */
472
+ declare function testAndSetDepth(fb: PixelFramebuffer, x: number, y: number, depth: number): boolean;
473
+ /**
474
+ * Fill a rectangular region with a solid color. Clips to framebuffer bounds.
475
+ *
476
+ * @param fb - Framebuffer to write to
477
+ * @param x - Left edge X coordinate
478
+ * @param y - Top edge Y coordinate
479
+ * @param w - Width of the rectangle
480
+ * @param h - Height of the rectangle
481
+ * @param color - Fill color
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * fillRect(fb, 10, 10, 50, 30, { r: 0, g: 255, b: 0, a: 255 });
486
+ * ```
487
+ */
488
+ declare function fillRect(fb: PixelFramebuffer, x: number, y: number, w: number, h: number, color: RGBAColor): void;
489
+
490
+ /**
491
+ * Renderer backend interface and supporting types.
492
+ *
493
+ * All backends implement RendererBackend, converting a PixelFramebuffer
494
+ * into terminal output (either cells for cell-based backends or escape
495
+ * sequences for pixel-protocol backends).
496
+ *
497
+ * @module 3d/backends/types
498
+ */
499
+
500
+ /**
501
+ * Interface that all renderer backends must implement.
502
+ *
503
+ * Cell-based backends (braille, halfblock, sextant) return `cells` in their
504
+ * EncodedOutput. Escape-based backends (sixel, kitty) return `escape` strings.
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * const backend: RendererBackend = createBrailleBackend();
509
+ * const dims = backend.getPixelDimensions(60, 20);
510
+ * const fb = createPixelFramebuffer({ width: dims.width, height: dims.height });
511
+ * // ... rasterize to fb ...
512
+ * const output = backend.encode(fb, 0, 0);
513
+ * ```
514
+ */
515
+ interface RendererBackend {
516
+ /** The backend type identifier. */
517
+ readonly type: BackendType;
518
+ /** Capabilities descriptor for this backend. */
519
+ readonly capabilities: BackendCapabilities;
520
+ /**
521
+ * Encode a pixel framebuffer into terminal output.
522
+ *
523
+ * @param framebuffer - The pixel buffer to encode
524
+ * @param screenX - Terminal column offset for output placement
525
+ * @param screenY - Terminal row offset for output placement
526
+ * @returns Encoded output (cells or escape sequences)
527
+ */
528
+ encode(framebuffer: PixelFramebuffer, screenX: number, screenY: number): EncodedOutput;
529
+ /**
530
+ * Calculate pixel dimensions for a given terminal cell region.
531
+ *
532
+ * @param cellWidth - Number of terminal columns
533
+ * @param cellHeight - Number of terminal rows
534
+ * @returns Pixel dimensions the framebuffer should be created with
535
+ */
536
+ getPixelDimensions(cellWidth: number, cellHeight: number): {
537
+ width: number;
538
+ height: number;
539
+ };
540
+ }
541
+
542
+ /**
543
+ * Braille-dot rendering backend.
544
+ *
545
+ * Maps 2x4 pixel blocks to Unicode braille characters (U+2800-U+28FF).
546
+ * Each terminal cell represents 8 pixels, giving ~2x density horizontally
547
+ * and ~4x density vertically. This is the universal fallback backend
548
+ * that works on virtually all Unicode terminals.
549
+ *
550
+ * Dot numbering follows the Unicode braille standard:
551
+ * ```
552
+ * [0] [3] bit 0 bit 3
553
+ * [1] [4] bit 1 bit 4
554
+ * [2] [5] bit 2 bit 5
555
+ * [6] [7] bit 6 bit 7
556
+ * ```
557
+ *
558
+ * @module 3d/backends/braille
559
+ */
560
+
561
+ /**
562
+ * Create a braille rendering backend.
563
+ *
564
+ * @param config - Optional braille configuration
565
+ * @returns A RendererBackend that encodes pixels as braille characters
566
+ *
567
+ * @example
568
+ * ```typescript
569
+ * const backend = createBrailleBackend({ threshold: 64 });
570
+ * const dims = backend.getPixelDimensions(80, 24);
571
+ * // dims = { width: 160, height: 96 }
572
+ * ```
573
+ */
574
+ declare function createBrailleBackend(config?: BrailleConfig): RendererBackend;
575
+
576
+ /**
577
+ * Backend auto-detection.
578
+ *
579
+ * Selects the best rendering backend based on terminal capabilities,
580
+ * integrating with the existing TerminalCapabilities negotiation system.
581
+ *
582
+ * Priority order: kitty > sixel > sextant > halfblock > braille
583
+ *
584
+ * @module 3d/backends/detection
585
+ */
586
+
587
+ /**
588
+ * Simplified terminal capabilities relevant to backend selection.
589
+ * This matches a subset of the full TerminalCapabilities interface
590
+ * from src/terminal/capabilities/negotiation.ts.
591
+ */
592
+ interface GraphicsCapabilities {
593
+ /** Graphics protocol: 'kitty', 'sixel', 'iterm2', 'none', or false. */
594
+ readonly graphics: string | false;
595
+ /** Whether the terminal supports true 24-bit color. */
596
+ readonly truecolor: boolean;
597
+ }
598
+ /**
599
+ * Create a RendererBackend by explicit type.
600
+ *
601
+ * @param type - The backend type to create
602
+ * @returns A new RendererBackend of the specified type
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * const backend = createBackendByType('braille');
607
+ * ```
608
+ */
609
+ declare function createBackendByType(type: BackendType): RendererBackend;
610
+ /**
611
+ * Detect the best available rendering backend based on terminal capabilities.
612
+ *
613
+ * Priority: kitty > sixel > sextant (if truecolor) > halfblock (if truecolor) > braille
614
+ *
615
+ * @param capabilities - Terminal graphics capabilities
616
+ * @param preference - Optional backend selection preferences
617
+ * @returns The best available RendererBackend
618
+ *
619
+ * @example
620
+ * ```typescript
621
+ * // Auto-detect best backend
622
+ * const backend = detectBestBackend({ graphics: 'kitty', truecolor: true });
623
+ *
624
+ * // Force a specific backend
625
+ * const braille = detectBestBackend(
626
+ * { graphics: 'kitty', truecolor: true },
627
+ * { preferred: 'braille', forceBackend: true },
628
+ * );
629
+ * ```
630
+ */
631
+ declare function detectBestBackend(capabilities: GraphicsCapabilities, preference?: BackendPreference): RendererBackend;
632
+
633
+ /**
634
+ * Half-block rendering backend.
635
+ *
636
+ * Maps 1x2 pixel blocks using upper/lower half-block characters.
637
+ * Each terminal cell represents 2 pixels vertically, with independent
638
+ * foreground and background colors for true 2-color-per-cell rendering.
639
+ *
640
+ * Characters used:
641
+ * - U+2580 (upper half block): top pixel as fg, bottom pixel as bg
642
+ * - U+2584 (lower half block): bottom pixel as fg, top pixel as bg
643
+ * - U+2588 (full block): both pixels same color, that color as fg
644
+ * - Space: both pixels are background color
645
+ *
646
+ * @module 3d/backends/halfblock
647
+ */
648
+
649
+ /**
650
+ * Create a half-block rendering backend.
651
+ *
652
+ * @param config - Optional half-block configuration
653
+ * @returns A RendererBackend that encodes pixels as half-block characters
654
+ *
655
+ * @example
656
+ * ```typescript
657
+ * const backend = createHalfBlockBackend();
658
+ * const dims = backend.getPixelDimensions(80, 24);
659
+ * // dims = { width: 80, height: 48 }
660
+ * ```
661
+ */
662
+ declare function createHalfBlockBackend(config?: HalfBlockConfig): RendererBackend;
663
+
664
+ /**
665
+ * Kitty Graphics Protocol rendering backend.
666
+ *
667
+ * Encodes pixel data as Kitty graphics protocol escape sequences,
668
+ * supporting true-color RGBA with alpha transparency.
669
+ *
670
+ * Protocol format:
671
+ * ```
672
+ * ESC _G <key>=<value>,...; <base64 payload> ESC \
673
+ * ```
674
+ *
675
+ * Key parameters:
676
+ * - `a=t` - transmit image data (upload only, no display)
677
+ * - `a=T` - transmit and display image data
678
+ * - `a=p` - display (put) image
679
+ * - `a=d` - delete image
680
+ * - `f=32` - RGBA pixel format
681
+ * - `s=<width>` - image width in pixels
682
+ * - `v=<height>` - image height in pixels
683
+ * - `i=<id>` - image ID for reuse
684
+ * - `m=0|1` - 0 = last chunk, 1 = more chunks follow
685
+ *
686
+ * @module 3d/backends/kitty
687
+ */
688
+
689
+ /**
690
+ * Create a Kitty Graphics Protocol rendering backend.
691
+ *
692
+ * @param config - Optional kitty configuration
693
+ * @returns A RendererBackend that encodes pixels as kitty graphics escape sequences
694
+ *
695
+ * @example
696
+ * ```typescript
697
+ * const backend = createKittyBackend({ imageId: 1 });
698
+ * const output = backend.encode(framebuffer, 0, 0);
699
+ * process.stdout.write(output.escape);
700
+ * ```
701
+ */
702
+ declare function createKittyBackend(config?: KittyConfig): RendererBackend;
703
+
704
+ /**
705
+ * Sextant rendering backend.
706
+ *
707
+ * Maps 2x3 pixel blocks to Unicode 13 legacy computing sextant characters
708
+ * (U+1FB00-U+1FB3B). Each terminal cell represents 6 pixels, offering a
709
+ * middle ground between braille (2x4, 1 fg color) and half-block (1x2, 2 colors).
710
+ *
711
+ * Dot numbering:
712
+ * ```
713
+ * [0] [1]
714
+ * [2] [3]
715
+ * [4] [5]
716
+ * ```
717
+ *
718
+ * Pattern mapping:
719
+ * - Pattern 0 (all off): space character
720
+ * - Patterns 1-62: U+1FB00 + (pattern - 1)
721
+ * - Pattern 63 (all on): U+2588 (full block)
722
+ *
723
+ * Requires Unicode 13+ support in the terminal.
724
+ *
725
+ * @module 3d/backends/sextant
726
+ */
727
+
728
+ /**
729
+ * Create a sextant rendering backend.
730
+ *
731
+ * @param config - Optional sextant configuration
732
+ * @returns A RendererBackend that encodes pixels as sextant characters
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * const backend = createSextantBackend({ threshold: 100 });
737
+ * const dims = backend.getPixelDimensions(80, 24);
738
+ * // dims = { width: 160, height: 72 }
739
+ * ```
740
+ */
741
+ declare function createSextantBackend(config?: SextantConfig): RendererBackend;
742
+
743
+ /**
744
+ * Sixel (DEC bitmap) rendering backend.
745
+ *
746
+ * Encodes pixel data as DCS (Device Control String) sixel sequences.
747
+ * Sixel images are encoded in 6-pixel-tall horizontal bands, with color
748
+ * palette selection and run-length encoding for compression.
749
+ *
750
+ * Protocol format:
751
+ * ```
752
+ * ESC P q <palette> <data> ESC \
753
+ * ```
754
+ *
755
+ * Palette entry: `#<n>;2;<r%>;<g%>;<b%>`
756
+ * Data per band: `#<color><sixel chars>$` ($ = carriage return within band)
757
+ * Band separator: `-` (newline, advances 6 pixels down)
758
+ *
759
+ * @module 3d/backends/sixel
760
+ */
761
+
762
+ /**
763
+ * Create a sixel rendering backend.
764
+ *
765
+ * @param config - Optional sixel configuration
766
+ * @returns A RendererBackend that encodes pixels as sixel escape sequences
767
+ *
768
+ * @example
769
+ * ```typescript
770
+ * const backend = createSixelBackend({ maxColors: 64 });
771
+ * const output = backend.encode(framebuffer, 0, 0);
772
+ * process.stdout.write(output.escape);
773
+ * ```
774
+ */
775
+ declare function createSixelBackend(config?: SixelConfig): RendererBackend;
776
+
777
+ /**
778
+ * SoA component for 3D animation (continuous rotation, orbital movement).
779
+ *
780
+ * @module 3d/components/animation3d
781
+ */
782
+
783
+ /**
784
+ * Structure-of-Arrays animation component.
785
+ * Supports continuous rotation and orbital movement around a center point.
786
+ *
787
+ * @example
788
+ * ```typescript
789
+ * Animation3D.rotateSpeedY[eid] = Math.PI; // 180 degrees per second
790
+ * ```
791
+ */
792
+ declare const Animation3D: {
793
+ /** Rotation speed around X axis in radians per second. */
794
+ rotateSpeedX: Float32Array<ArrayBuffer>;
795
+ /** Rotation speed around Y axis in radians per second. */
796
+ rotateSpeedY: Float32Array<ArrayBuffer>;
797
+ /** Rotation speed around Z axis in radians per second. */
798
+ rotateSpeedZ: Float32Array<ArrayBuffer>;
799
+ /** X component of orbit center point. */
800
+ orbitCenterX: Float32Array<ArrayBuffer>;
801
+ /** Y component of orbit center point. */
802
+ orbitCenterY: Float32Array<ArrayBuffer>;
803
+ /** Z component of orbit center point. */
804
+ orbitCenterZ: Float32Array<ArrayBuffer>;
805
+ /** Orbit speed in radians per second. */
806
+ orbitSpeed: Float32Array<ArrayBuffer>;
807
+ /** Distance from orbit center. */
808
+ orbitRadius: Float32Array<ArrayBuffer>;
809
+ /** Current orbit angle in radians. */
810
+ orbitAngle: Float32Array<ArrayBuffer>;
811
+ /** Whether orbiting is enabled (0 = no, 1 = yes). */
812
+ orbitEnabled: Uint8Array<ArrayBuffer>;
813
+ };
814
+ /**
815
+ * Data returned from getAnimation3D.
816
+ */
817
+ interface Animation3DData {
818
+ readonly rotateSpeedX: number;
819
+ readonly rotateSpeedY: number;
820
+ readonly rotateSpeedZ: number;
821
+ readonly orbitCenterX: number;
822
+ readonly orbitCenterY: number;
823
+ readonly orbitCenterZ: number;
824
+ readonly orbitSpeed: number;
825
+ readonly orbitRadius: number;
826
+ readonly orbitAngle: number;
827
+ readonly orbitEnabled: boolean;
828
+ }
829
+ /**
830
+ * Set animation properties on an entity. Config is validated via Zod.
831
+ *
832
+ * @param world - ECS world
833
+ * @param eid - Entity ID
834
+ * @param config - Animation configuration
835
+ * @returns The entity ID for chaining
836
+ *
837
+ * @example
838
+ * ```typescript
839
+ * setAnimation3D(world, eid, { rotateSpeed: { y: Math.PI } });
840
+ * ```
841
+ */
842
+ declare function setAnimation3D(world: World, eid: Entity, config: Animation3DConfig): Entity;
843
+ /**
844
+ * Get animation data for an entity.
845
+ *
846
+ * @param world - ECS world
847
+ * @param eid - Entity ID
848
+ * @returns Animation data or undefined if component missing
849
+ */
850
+ declare function getAnimation3D(world: World, eid: Entity): Animation3DData | undefined;
851
+
852
+ /**
853
+ * SoA component for 3D cameras.
854
+ *
855
+ * @module 3d/components/camera3d
856
+ */
857
+
858
+ /**
859
+ * Structure-of-Arrays 3D camera component.
860
+ * Stores projection parameters and cached matrices.
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * Camera3D.fov[eid] = Math.PI / 3;
865
+ * ```
866
+ */
867
+ declare const Camera3D: {
868
+ fov: Float32Array<ArrayBuffer>;
869
+ near: Float32Array<ArrayBuffer>;
870
+ far: Float32Array<ArrayBuffer>;
871
+ aspect: Float32Array<ArrayBuffer>;
872
+ /** 0 = perspective, 1 = orthographic */
873
+ projectionMode: Uint8Array<ArrayBuffer>;
874
+ /** Cached projection matrix (16 floats per entity) */
875
+ projMatrix: Float32Array<ArrayBuffer>;
876
+ /** Cached view matrix (16 floats per entity) */
877
+ viewMatrix: Float32Array<ArrayBuffer>;
878
+ dirty: Uint8Array<ArrayBuffer>;
879
+ };
880
+ /**
881
+ * Data returned from getCamera3D.
882
+ */
883
+ interface Camera3DData {
884
+ readonly fov: number;
885
+ readonly near: number;
886
+ readonly far: number;
887
+ readonly aspect: number;
888
+ readonly projectionMode: 'perspective' | 'orthographic';
889
+ }
890
+ /**
891
+ * Set camera properties on an entity. Config is validated via Zod.
892
+ *
893
+ * @param world - ECS world
894
+ * @param eid - Entity ID
895
+ * @param config - Camera configuration
896
+ * @returns The entity ID for chaining
897
+ *
898
+ * @example
899
+ * ```typescript
900
+ * setCamera3D(world, eid, { fov: Math.PI / 3, near: 0.1, far: 100 });
901
+ * ```
902
+ */
903
+ declare function setCamera3D(world: World, eid: Entity, config: Camera3DConfig): Entity;
904
+ /**
905
+ * Get camera data for an entity.
906
+ *
907
+ * @param world - ECS world
908
+ * @param eid - Entity ID
909
+ * @returns Camera data or undefined if component missing
910
+ */
911
+ declare function getCamera3D(world: World, eid: Entity): Camera3DData | undefined;
912
+ /**
913
+ * Get the cached projection matrix for a camera entity.
914
+ *
915
+ * @param eid - Entity ID
916
+ * @returns 16-element Float32Array view
917
+ */
918
+ declare function getProjMatrix(eid: Entity): Float32Array;
919
+ /**
920
+ * Get the cached view matrix for a camera entity.
921
+ *
922
+ * @param eid - Entity ID
923
+ * @returns 16-element Float32Array view
924
+ */
925
+ declare function getViewMatrix(eid: Entity): Float32Array;
926
+
927
+ /**
928
+ * SoA component for 3D materials.
929
+ *
930
+ * @module 3d/components/material
931
+ */
932
+
933
+ /**
934
+ * Structure-of-Arrays material component.
935
+ * Controls how meshes are rendered (wireframe, filled, colors, culling).
936
+ *
937
+ * @example
938
+ * ```typescript
939
+ * Material3D.wireColor[eid] = 0x00ff00;
940
+ * ```
941
+ */
942
+ declare const Material3D: {
943
+ wireColor: Uint32Array<ArrayBuffer>;
944
+ fillColor: Uint32Array<ArrayBuffer>;
945
+ /** 0 = wireframe, 1 = filled, 2 = both */
946
+ renderMode: Uint8Array<ArrayBuffer>;
947
+ backfaceCull: Uint8Array<ArrayBuffer>;
948
+ flatShading: Uint8Array<ArrayBuffer>;
949
+ antiAlias: Uint8Array<ArrayBuffer>;
950
+ };
951
+ /**
952
+ * Data returned from getMaterial3D.
953
+ */
954
+ interface Material3DData {
955
+ readonly wireColor: number;
956
+ readonly fillColor: number;
957
+ readonly renderMode: 'wireframe' | 'filled' | 'both';
958
+ readonly backfaceCull: boolean;
959
+ readonly flatShading: boolean;
960
+ readonly antiAlias: boolean;
961
+ }
962
+ /**
963
+ * Set material properties on an entity. Config is validated via Zod.
964
+ *
965
+ * @param world - ECS world
966
+ * @param eid - Entity ID
967
+ * @param config - Material configuration
968
+ * @returns The entity ID for chaining
969
+ *
970
+ * @example
971
+ * ```typescript
972
+ * setMaterial3D(world, eid, { wireColor: 0x00ff00, renderMode: 'wireframe' });
973
+ * ```
974
+ */
975
+ declare function setMaterial3D(world: World, eid: Entity, config: Material3DConfig): Entity;
976
+ /**
977
+ * Get material data for an entity.
978
+ *
979
+ * @param world - ECS world
980
+ * @param eid - Entity ID
981
+ * @returns Material data or undefined if component missing
982
+ */
983
+ declare function getMaterial3D(world: World, eid: Entity): Material3DData | undefined;
984
+
985
+ /**
986
+ * Mesh component and meshStore side-car for 3D geometry data.
987
+ *
988
+ * The Mesh component is a lightweight SoA marker that links an entity to
989
+ * its geometry via a mesh ID. The actual vertex/face data lives in the
990
+ * meshStore Map (side-car pattern, like spriteStore).
991
+ *
992
+ * @module 3d/components/mesh
993
+ */
994
+
995
+ /**
996
+ * SoA mesh component. Links entities to geometry data in meshStore.
997
+ *
998
+ * @example
999
+ * ```typescript
1000
+ * Mesh.meshId[eid] = registeredId;
1001
+ * ```
1002
+ */
1003
+ declare const Mesh: {
1004
+ /** ID referencing meshStore data */
1005
+ meshId: Uint32Array<ArrayBuffer>;
1006
+ };
1007
+ /**
1008
+ * Geometry data stored in the mesh store.
1009
+ * Vertex positions and face indices in typed arrays.
1010
+ */
1011
+ interface MeshData {
1012
+ readonly name: string;
1013
+ /** Flat array of vertex positions: [x0, y0, z0, x1, y1, z1, ...] */
1014
+ readonly vertices: Float32Array;
1015
+ /** Number of vertices (vertices.length / 3) */
1016
+ readonly vertexCount: number;
1017
+ /** Face indices as flat array of triangles: [i0, i1, i2, i3, i4, i5, ...] */
1018
+ readonly indices: Uint32Array;
1019
+ /** Number of triangles (indices.length / 3) */
1020
+ readonly triangleCount: number;
1021
+ /** Optional vertex normals: [nx0, ny0, nz0, nx1, ny1, nz1, ...] */
1022
+ readonly normals?: Float32Array;
1023
+ }
1024
+ /**
1025
+ * Register mesh geometry data and return an ID.
1026
+ *
1027
+ * @param name - Descriptive name for the mesh
1028
+ * @param vertices - Flat array of vertex positions [x, y, z, ...]
1029
+ * @param indices - Triangle indices [i0, i1, i2, ...]
1030
+ * @param normals - Optional vertex normals
1031
+ * @returns Unique mesh ID
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * const cubeId = registerMesh('cube',
1036
+ * new Float32Array([-1,-1,-1, 1,-1,-1, ...]),
1037
+ * new Uint32Array([0,1,2, 0,2,3, ...]),
1038
+ * );
1039
+ * ```
1040
+ */
1041
+ declare function registerMesh(name: string, vertices: Float32Array, indices: Uint32Array, normals?: Float32Array): number;
1042
+ /**
1043
+ * Create a mesh from arrays of vertex objects and polygon face indices.
1044
+ * Automatically triangulates quads and larger polygons using fan triangulation.
1045
+ *
1046
+ * @param name - Descriptive name
1047
+ * @param vertexPositions - Array of {x, y, z} objects
1048
+ * @param faces - Array of polygon index arrays (e.g., [[0,1,2,3], [4,5,6,7]])
1049
+ * @returns Unique mesh ID
1050
+ *
1051
+ * @example
1052
+ * ```typescript
1053
+ * const cubeId = createMeshFromArrays('cube',
1054
+ * [{ x: -1, y: -1, z: -1 }, { x: 1, y: -1, z: -1 }, ...],
1055
+ * [[0, 1, 2, 3], [4, 5, 6, 7], ...],
1056
+ * );
1057
+ * ```
1058
+ */
1059
+ declare function createMeshFromArrays(name: string, vertexPositions: ReadonlyArray<{
1060
+ readonly x: number;
1061
+ readonly y: number;
1062
+ readonly z: number;
1063
+ }>, faces: ReadonlyArray<ReadonlyArray<number>>): number;
1064
+ /**
1065
+ * Get mesh data by ID.
1066
+ *
1067
+ * @param meshId - Mesh ID from registerMesh or createMeshFromArrays
1068
+ * @returns MeshData or undefined if not found
1069
+ */
1070
+ declare function getMeshData(meshId: number): MeshData | undefined;
1071
+ /**
1072
+ * Remove mesh data from the store.
1073
+ *
1074
+ * @param meshId - Mesh ID to remove
1075
+ * @returns True if the mesh was found and removed
1076
+ */
1077
+ declare function unregisterMesh(meshId: number): boolean;
1078
+ /**
1079
+ * Set a mesh component on an entity, linking it to registered geometry.
1080
+ *
1081
+ * @param world - ECS world
1082
+ * @param eid - Entity ID
1083
+ * @param meshId - Registered mesh ID
1084
+ * @returns The entity ID for chaining
1085
+ *
1086
+ * @example
1087
+ * ```typescript
1088
+ * const cubeId = registerMesh('cube', vertices, indices);
1089
+ * setMesh(world, eid, cubeId);
1090
+ * ```
1091
+ */
1092
+ declare function setMesh(world: World, eid: Entity, meshId: number): Entity;
1093
+ /**
1094
+ * Get the mesh ID for an entity.
1095
+ *
1096
+ * @param world - ECS world
1097
+ * @param eid - Entity ID
1098
+ * @returns Mesh ID or undefined if component missing
1099
+ */
1100
+ declare function getMesh(world: World, eid: Entity): number | undefined;
1101
+ /**
1102
+ * Get the total number of registered meshes.
1103
+ */
1104
+ declare function getMeshCount(): number;
1105
+ /**
1106
+ * Clear all registered meshes. Useful for testing.
1107
+ */
1108
+ declare function clearMeshStore(): void;
1109
+
1110
+ /**
1111
+ * SoA component for mouse-based 3D camera interaction.
1112
+ *
1113
+ * Stores per-entity configuration for camera rotation (drag) and zoom (scroll).
1114
+ * Works with the mouseInteraction3DSystem to apply accumulated mouse input
1115
+ * to the camera's Transform3D component.
1116
+ *
1117
+ * @module 3d/components/mouseInteraction3d
1118
+ */
1119
+
1120
+ /**
1121
+ * Structure-of-Arrays mouse interaction component.
1122
+ * Stores sensitivity, zoom bounds, and accumulated mouse state.
1123
+ *
1124
+ * @example
1125
+ * ```typescript
1126
+ * MouseInteraction3D.rotationSensitivity[eid] = 0.005;
1127
+ * ```
1128
+ */
1129
+ declare const MouseInteraction3D: {
1130
+ /** Radians per pixel of mouse movement for rotation. */
1131
+ rotationSensitivity: Float32Array<ArrayBuffer>;
1132
+ /** Units per scroll tick for zoom. */
1133
+ zoomSensitivity: Float32Array<ArrayBuffer>;
1134
+ /** Minimum zoom distance (camera distance from target). */
1135
+ zoomMin: Float32Array<ArrayBuffer>;
1136
+ /** Maximum zoom distance (camera distance from target). */
1137
+ zoomMax: Float32Array<ArrayBuffer>;
1138
+ /** Whether to invert the Y axis (0 = no, 1 = yes). */
1139
+ invertY: Uint8Array<ArrayBuffer>;
1140
+ /** Current camera distance (used for zoom). */
1141
+ distance: Float32Array<ArrayBuffer>;
1142
+ /** Accumulated X rotation from mouse drag (yaw). */
1143
+ yaw: Float32Array<ArrayBuffer>;
1144
+ /** Accumulated Y rotation from mouse drag (pitch). */
1145
+ pitch: Float32Array<ArrayBuffer>;
1146
+ };
1147
+ /**
1148
+ * Data returned from getMouseInteraction3D.
1149
+ */
1150
+ interface MouseInteraction3DData {
1151
+ readonly rotationSensitivity: number;
1152
+ readonly zoomSensitivity: number;
1153
+ readonly zoomMin: number;
1154
+ readonly zoomMax: number;
1155
+ readonly invertY: boolean;
1156
+ readonly distance: number;
1157
+ readonly yaw: number;
1158
+ readonly pitch: number;
1159
+ }
1160
+ /**
1161
+ * Accumulated mouse input for a single frame.
1162
+ * Fed to the system via mouseInputStore.
1163
+ */
1164
+ interface MouseDragInput {
1165
+ /** Horizontal pixel delta from mouse drag. */
1166
+ readonly dx: number;
1167
+ /** Vertical pixel delta from mouse drag. */
1168
+ readonly dy: number;
1169
+ }
1170
+ /**
1171
+ * Per-frame mouse input for the interaction system.
1172
+ * Store accumulated drag and scroll events here before running the system.
1173
+ */
1174
+ declare const mouseInputStore: Map<number, {
1175
+ dragDx: number;
1176
+ dragDy: number;
1177
+ scrollDelta: number;
1178
+ }>;
1179
+ /**
1180
+ * Clear accumulated mouse input. Call after the system processes input each frame.
1181
+ */
1182
+ declare function clearMouseInputStore(): void;
1183
+ /**
1184
+ * Feed mouse drag input for a viewport entity.
1185
+ * Accumulates across multiple events within a frame.
1186
+ *
1187
+ * @param viewportEid - Viewport entity to apply drag to
1188
+ * @param dx - Horizontal pixel delta
1189
+ * @param dy - Vertical pixel delta
1190
+ *
1191
+ * @example
1192
+ * ```typescript
1193
+ * feedMouseDrag(viewportEid, event.movementX, event.movementY);
1194
+ * ```
1195
+ */
1196
+ declare function feedMouseDrag(viewportEid: Entity, dx: number, dy: number): void;
1197
+ /**
1198
+ * Feed mouse scroll input for a viewport entity.
1199
+ * Accumulates across multiple events within a frame.
1200
+ *
1201
+ * @param viewportEid - Viewport entity to apply scroll to
1202
+ * @param delta - Scroll delta (positive = zoom out, negative = zoom in)
1203
+ *
1204
+ * @example
1205
+ * ```typescript
1206
+ * feedMouseScroll(viewportEid, event.deltaY > 0 ? 1 : -1);
1207
+ * ```
1208
+ */
1209
+ declare function feedMouseScroll(viewportEid: Entity, delta: number): void;
1210
+ /**
1211
+ * Enable mouse interaction on a camera entity.
1212
+ * Config is validated via Zod. Sets initial distance from the camera's current Z position.
1213
+ *
1214
+ * @param world - ECS world
1215
+ * @param eid - Camera entity ID
1216
+ * @param config - Mouse interaction configuration
1217
+ * @param initialDistance - Initial camera distance from target (defaults to 5)
1218
+ * @returns The entity ID for chaining
1219
+ *
1220
+ * @example
1221
+ * ```typescript
1222
+ * enableMouseInteraction(world, cameraEid, { rotationSensitivity: 0.005 });
1223
+ * ```
1224
+ */
1225
+ declare function enableMouseInteraction(world: World, eid: Entity, config?: MouseInteraction3DConfig, initialDistance?: number): Entity;
1226
+ /**
1227
+ * Disable mouse interaction on a camera entity.
1228
+ *
1229
+ * @param world - ECS world
1230
+ * @param eid - Camera entity ID
1231
+ */
1232
+ declare function disableMouseInteraction(world: World, eid: Entity): void;
1233
+ /**
1234
+ * Get mouse interaction data for an entity.
1235
+ *
1236
+ * @param world - ECS world
1237
+ * @param eid - Entity ID
1238
+ * @returns Mouse interaction data or undefined if component missing
1239
+ */
1240
+ declare function getMouseInteraction3D(world: World, eid: Entity): MouseInteraction3DData | undefined;
1241
+
1242
+ /**
1243
+ * SoA component for 3D transforms: translation, rotation, scale, world matrix.
1244
+ *
1245
+ * @module 3d/components/transform3d
1246
+ */
1247
+
1248
+ /**
1249
+ * Structure-of-Arrays 3D transform component.
1250
+ * Stores local transform (translation, rotation, scale), computed world matrix,
1251
+ * and a dirty flag for incremental recomputation.
1252
+ *
1253
+ * @example
1254
+ * ```typescript
1255
+ * Transform3D.tx[eid] = 5.0;
1256
+ * Transform3D.dirty[eid] = 1;
1257
+ * ```
1258
+ */
1259
+ declare const Transform3D: {
1260
+ tx: Float32Array<ArrayBuffer>;
1261
+ ty: Float32Array<ArrayBuffer>;
1262
+ tz: Float32Array<ArrayBuffer>;
1263
+ rx: Float32Array<ArrayBuffer>;
1264
+ ry: Float32Array<ArrayBuffer>;
1265
+ rz: Float32Array<ArrayBuffer>;
1266
+ sx: Float32Array<ArrayBuffer>;
1267
+ sy: Float32Array<ArrayBuffer>;
1268
+ sz: Float32Array<ArrayBuffer>;
1269
+ worldMatrix: Float32Array<ArrayBuffer>;
1270
+ dirty: Uint8Array<ArrayBuffer>;
1271
+ };
1272
+ /**
1273
+ * Data returned from getTransform3D.
1274
+ */
1275
+ interface Transform3DData {
1276
+ readonly tx: number;
1277
+ readonly ty: number;
1278
+ readonly tz: number;
1279
+ readonly rx: number;
1280
+ readonly ry: number;
1281
+ readonly rz: number;
1282
+ readonly sx: number;
1283
+ readonly sy: number;
1284
+ readonly sz: number;
1285
+ }
1286
+ /**
1287
+ * Set a 3D transform on an entity. Config is validated via Zod.
1288
+ * Adds the component if not already present. Sets dirty flag.
1289
+ *
1290
+ * @param world - ECS world
1291
+ * @param eid - Entity ID
1292
+ * @param config - Transform configuration
1293
+ * @returns The entity ID for chaining
1294
+ *
1295
+ * @example
1296
+ * ```typescript
1297
+ * setTransform3D(world, eid, { tx: 0, ty: 1, tz: -5, ry: Math.PI / 4 });
1298
+ * ```
1299
+ */
1300
+ declare function setTransform3D(world: World, eid: Entity, config: Transform3DConfig): Entity;
1301
+ /**
1302
+ * Get the transform data for an entity.
1303
+ *
1304
+ * @param world - ECS world
1305
+ * @param eid - Entity ID
1306
+ * @returns Transform data or undefined if component missing
1307
+ *
1308
+ * @example
1309
+ * ```typescript
1310
+ * const transform = getTransform3D(world, eid);
1311
+ * if (transform) console.log(transform.tx, transform.ty, transform.tz);
1312
+ * ```
1313
+ */
1314
+ declare function getTransform3D(world: World, eid: Entity): Transform3DData | undefined;
1315
+ /**
1316
+ * Set the translation of an entity. Marks dirty.
1317
+ *
1318
+ * @param world - ECS world
1319
+ * @param eid - Entity ID
1320
+ * @param x - X translation
1321
+ * @param y - Y translation
1322
+ * @param z - Z translation
1323
+ * @returns The entity ID for chaining
1324
+ */
1325
+ declare function setTranslation(world: World, eid: Entity, x: number, y: number, z: number): Entity;
1326
+ /**
1327
+ * Set the rotation of an entity (Euler angles in radians). Marks dirty.
1328
+ *
1329
+ * @param world - ECS world
1330
+ * @param eid - Entity ID
1331
+ * @param rx - Rotation around X axis
1332
+ * @param ry - Rotation around Y axis
1333
+ * @param rz - Rotation around Z axis
1334
+ * @returns The entity ID for chaining
1335
+ */
1336
+ declare function setRotation(world: World, eid: Entity, rx: number, ry: number, rz: number): Entity;
1337
+ /**
1338
+ * Set the scale of an entity. Marks dirty.
1339
+ *
1340
+ * @param world - ECS world
1341
+ * @param eid - Entity ID
1342
+ * @param sx - X scale
1343
+ * @param sy - Y scale
1344
+ * @param sz - Z scale
1345
+ * @returns The entity ID for chaining
1346
+ */
1347
+ declare function setScale(world: World, eid: Entity, sx: number, sy: number, sz: number): Entity;
1348
+ /**
1349
+ * Get the world matrix for an entity as a Float32Array subarray view.
1350
+ *
1351
+ * @param eid - Entity ID
1352
+ * @returns 16-element Float32Array view into the worldMatrix
1353
+ *
1354
+ * @example
1355
+ * ```typescript
1356
+ * const matrix = getWorldMatrix(eid);
1357
+ * // matrix is a live view; changes to worldMatrix are reflected
1358
+ * ```
1359
+ */
1360
+ declare function getWorldMatrix(eid: Entity): Float32Array;
1361
+ /**
1362
+ * Mark an entity's transform as dirty (needs world matrix recomputation).
1363
+ *
1364
+ * @param eid - Entity ID
1365
+ */
1366
+ declare function markDirty(eid: Entity): void;
1367
+ /**
1368
+ * Check if an entity's transform is dirty.
1369
+ *
1370
+ * @param eid - Entity ID
1371
+ * @returns True if the transform needs recomputation
1372
+ */
1373
+ declare function isDirty(eid: Entity): boolean;
1374
+
1375
+ /**
1376
+ * SoA component for 3D viewports.
1377
+ *
1378
+ * A viewport defines a rectangular screen region that renders
1379
+ * a 3D scene from a camera's perspective using a specific backend.
1380
+ *
1381
+ * @module 3d/components/viewport3d
1382
+ */
1383
+
1384
+ /**
1385
+ * Structure-of-Arrays viewport component.
1386
+ * Defines a screen region for 3D rendering.
1387
+ *
1388
+ * @example
1389
+ * ```typescript
1390
+ * Viewport3D.left[eid] = 5;
1391
+ * Viewport3D.width[eid] = 80;
1392
+ * ```
1393
+ */
1394
+ declare const Viewport3D: {
1395
+ left: Uint16Array<ArrayBuffer>;
1396
+ top: Uint16Array<ArrayBuffer>;
1397
+ width: Uint16Array<ArrayBuffer>;
1398
+ height: Uint16Array<ArrayBuffer>;
1399
+ /** Entity ID of the camera to render from */
1400
+ cameraEntity: Uint32Array<ArrayBuffer>;
1401
+ /** Backend type: 0=auto, 1=braille, 2=halfblock, 3=sextant, 4=sixel, 5=kitty */
1402
+ backendType: Uint8Array<ArrayBuffer>;
1403
+ /** Computed pixel width (depends on backend cell size) */
1404
+ pixelWidth: Uint16Array<ArrayBuffer>;
1405
+ /** Computed pixel height (depends on backend cell size) */
1406
+ pixelHeight: Uint16Array<ArrayBuffer>;
1407
+ };
1408
+ /**
1409
+ * Data returned from getViewport3D.
1410
+ */
1411
+ interface Viewport3DData {
1412
+ readonly left: number;
1413
+ readonly top: number;
1414
+ readonly width: number;
1415
+ readonly height: number;
1416
+ readonly cameraEntity: number;
1417
+ readonly backendType: 'auto' | 'braille' | 'halfblock' | 'sextant' | 'sixel' | 'kitty';
1418
+ readonly pixelWidth: number;
1419
+ readonly pixelHeight: number;
1420
+ }
1421
+ /**
1422
+ * Set viewport properties on an entity. Config is validated via Zod.
1423
+ *
1424
+ * @param world - ECS world
1425
+ * @param eid - Entity ID
1426
+ * @param config - Viewport configuration
1427
+ * @returns The entity ID for chaining
1428
+ *
1429
+ * @example
1430
+ * ```typescript
1431
+ * setViewport3D(world, eid, {
1432
+ * left: 5, top: 2, width: 60, height: 20,
1433
+ * cameraEntity: cameraEid,
1434
+ * });
1435
+ * ```
1436
+ */
1437
+ declare function setViewport3D(world: World, eid: Entity, config: Viewport3DConfig): Entity;
1438
+ /**
1439
+ * Get viewport data for an entity.
1440
+ *
1441
+ * @param world - ECS world
1442
+ * @param eid - Entity ID
1443
+ * @returns Viewport data or undefined if component missing
1444
+ */
1445
+ declare function getViewport3D(world: World, eid: Entity): Viewport3DData | undefined;
1446
+
1447
+ /**
1448
+ * Zod schemas for 3D model loading and mesh primitives.
1449
+ * @module 3d/schemas/model
1450
+ */
1451
+
1452
+ /**
1453
+ * Options for loading an OBJ file.
1454
+ */
1455
+ declare const ObjLoadOptionsSchema: z.ZodObject<{
1456
+ name: z.ZodString;
1457
+ flipYZ: z.ZodDefault<z.ZodBoolean>;
1458
+ scale: z.ZodDefault<z.ZodNumber>;
1459
+ centerOrigin: z.ZodDefault<z.ZodBoolean>;
1460
+ }, z.core.$strip>;
1461
+ type ObjLoadOptions = z.input<typeof ObjLoadOptionsSchema>;
1462
+ /**
1463
+ * Options for creating a cube mesh primitive.
1464
+ */
1465
+ declare const CubeMeshOptionsSchema: z.ZodObject<{
1466
+ size: z.ZodDefault<z.ZodNumber>;
1467
+ name: z.ZodDefault<z.ZodString>;
1468
+ }, z.core.$strip>;
1469
+ type CubeMeshOptions = z.input<typeof CubeMeshOptionsSchema>;
1470
+ /**
1471
+ * Options for creating a sphere mesh primitive.
1472
+ */
1473
+ declare const SphereMeshOptionsSchema: z.ZodObject<{
1474
+ radius: z.ZodDefault<z.ZodNumber>;
1475
+ widthSegments: z.ZodDefault<z.ZodNumber>;
1476
+ heightSegments: z.ZodDefault<z.ZodNumber>;
1477
+ name: z.ZodDefault<z.ZodString>;
1478
+ }, z.core.$strip>;
1479
+ type SphereMeshOptions = z.input<typeof SphereMeshOptionsSchema>;
1480
+ /**
1481
+ * Options for creating a plane mesh primitive.
1482
+ */
1483
+ declare const PlaneMeshOptionsSchema: z.ZodObject<{
1484
+ width: z.ZodDefault<z.ZodNumber>;
1485
+ height: z.ZodDefault<z.ZodNumber>;
1486
+ widthSegments: z.ZodDefault<z.ZodNumber>;
1487
+ heightSegments: z.ZodDefault<z.ZodNumber>;
1488
+ name: z.ZodDefault<z.ZodString>;
1489
+ }, z.core.$strip>;
1490
+ type PlaneMeshOptions = z.input<typeof PlaneMeshOptionsSchema>;
1491
+ /**
1492
+ * Options for creating a cylinder mesh primitive.
1493
+ */
1494
+ declare const CylinderMeshOptionsSchema: z.ZodObject<{
1495
+ radiusTop: z.ZodDefault<z.ZodNumber>;
1496
+ radiusBottom: z.ZodDefault<z.ZodNumber>;
1497
+ height: z.ZodDefault<z.ZodNumber>;
1498
+ segments: z.ZodDefault<z.ZodNumber>;
1499
+ name: z.ZodDefault<z.ZodString>;
1500
+ }, z.core.$strip>;
1501
+ type CylinderMeshOptions = z.input<typeof CylinderMeshOptionsSchema>;
1502
+
1503
+ /**
1504
+ * Types for 3D model loaders.
1505
+ * @module 3d/loaders/types
1506
+ */
1507
+ /**
1508
+ * A parsed vertex position.
1509
+ */
1510
+ interface ObjVertex {
1511
+ readonly x: number;
1512
+ readonly y: number;
1513
+ readonly z: number;
1514
+ }
1515
+ /**
1516
+ * A parsed face with vertex, normal, and texcoord indices.
1517
+ */
1518
+ interface ObjFace {
1519
+ readonly vertexIndices: ReadonlyArray<number>;
1520
+ readonly normalIndices?: ReadonlyArray<number>;
1521
+ readonly texCoordIndices?: ReadonlyArray<number>;
1522
+ }
1523
+ /**
1524
+ * A named group within an OBJ file.
1525
+ */
1526
+ interface ObjGroup {
1527
+ readonly name: string;
1528
+ readonly startFace: number;
1529
+ }
1530
+ /**
1531
+ * Result of parsing an OBJ file.
1532
+ */
1533
+ interface ObjParseResult {
1534
+ readonly vertices: ReadonlyArray<ObjVertex>;
1535
+ readonly normals: ReadonlyArray<ObjVertex>;
1536
+ readonly texCoords: ReadonlyArray<{
1537
+ readonly u: number;
1538
+ readonly v: number;
1539
+ }>;
1540
+ readonly faces: ReadonlyArray<ObjFace>;
1541
+ readonly groups: ReadonlyArray<ObjGroup>;
1542
+ }
1543
+
1544
+ /**
1545
+ * Wavefront OBJ file parser and loader.
1546
+ *
1547
+ * Parses OBJ text into vertex/face data and loads it into meshStore.
1548
+ *
1549
+ * @module 3d/loaders/obj
1550
+ */
1551
+
1552
+ /**
1553
+ * Parse a Wavefront OBJ file from a text string.
1554
+ *
1555
+ * Supports: v (vertex), vn (normal), vt (texcoord), f (face), g/o (group/object).
1556
+ * Face formats: f v, f v/vt, f v/vt/vn, f v//vn.
1557
+ * OBJ indices are 1-based and converted to 0-based.
1558
+ * Negative indices are supported (relative to end of vertex list).
1559
+ *
1560
+ * @param source - OBJ file content as string
1561
+ * @returns Parsed result with vertices, normals, texCoords, faces, and groups
1562
+ *
1563
+ * @example
1564
+ * ```typescript
1565
+ * const result = parseObj(`
1566
+ * v 0 0 0
1567
+ * v 1 0 0
1568
+ * v 0 1 0
1569
+ * f 1 2 3
1570
+ * `);
1571
+ * // result.vertices.length === 3
1572
+ * // result.faces.length === 1
1573
+ * ```
1574
+ */
1575
+ declare function parseObj(source: string): ObjParseResult;
1576
+ /**
1577
+ * Compute the axis-aligned bounding box of vertices.
1578
+ *
1579
+ * @param vertices - Array of vertex positions
1580
+ * @returns Bounding box with min, max, and center
1581
+ *
1582
+ * @example
1583
+ * ```typescript
1584
+ * const bbox = computeBoundingBox(vertices);
1585
+ * console.log(bbox.center);
1586
+ * ```
1587
+ */
1588
+ declare function computeBoundingBox(vertices: ReadonlyArray<ObjVertex>): {
1589
+ min: ObjVertex;
1590
+ max: ObjVertex;
1591
+ center: ObjVertex;
1592
+ };
1593
+ /**
1594
+ * Parse an OBJ file and load it into meshStore.
1595
+ * Applies optional transforms (flip, scale, center).
1596
+ *
1597
+ * @param source - OBJ file content as string
1598
+ * @param options - Load options (validated via Zod)
1599
+ * @returns Mesh ID in meshStore
1600
+ *
1601
+ * @example
1602
+ * ```typescript
1603
+ * const meshId = loadObjAsMesh(objText, { name: 'teapot', scale: 0.5 });
1604
+ * ```
1605
+ */
1606
+ declare function loadObjAsMesh(source: string, options: ObjLoadOptions): number;
1607
+
1608
+ /**
1609
+ * Zod validation schemas for 3D math types.
1610
+ * @module 3d/schemas/math
1611
+ */
1612
+
1613
+ /**
1614
+ * Vec3 as a tuple of 3 numbers.
1615
+ */
1616
+ declare const Vec3Schema: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1617
+ /**
1618
+ * Vec3 input that accepts either tuple or object form.
1619
+ * Use at API boundaries to be flexible with user input.
1620
+ */
1621
+ declare const Vec3InputSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
1622
+ x: z.ZodNumber;
1623
+ y: z.ZodNumber;
1624
+ z: z.ZodNumber;
1625
+ }, z.core.$strip>]>;
1626
+ type Vec3Input = z.infer<typeof Vec3InputSchema>;
1627
+ /**
1628
+ * Mat4 must be a Float32Array of exactly 16 elements (column-major).
1629
+ */
1630
+ declare const Mat4Schema: z.ZodCustom<Float32Array<ArrayBuffer>, Float32Array<ArrayBuffer>>;
1631
+ /**
1632
+ * Euler angles in radians for rotation.
1633
+ */
1634
+ declare const EulerAnglesSchema: z.ZodObject<{
1635
+ x: z.ZodNumber;
1636
+ y: z.ZodNumber;
1637
+ z: z.ZodNumber;
1638
+ }, z.core.$strip>;
1639
+ type EulerAngles = z.infer<typeof EulerAnglesSchema>;
1640
+ /**
1641
+ * Perspective projection configuration.
1642
+ */
1643
+ declare const PerspectiveConfigSchema: z.ZodObject<{
1644
+ fov: z.ZodNumber;
1645
+ aspect: z.ZodNumber;
1646
+ near: z.ZodNumber;
1647
+ far: z.ZodNumber;
1648
+ }, z.core.$strip>;
1649
+ type PerspectiveConfig = z.infer<typeof PerspectiveConfigSchema>;
1650
+ /**
1651
+ * Orthographic projection configuration.
1652
+ */
1653
+ declare const OrthographicConfigSchema: z.ZodObject<{
1654
+ left: z.ZodNumber;
1655
+ right: z.ZodNumber;
1656
+ bottom: z.ZodNumber;
1657
+ top: z.ZodNumber;
1658
+ near: z.ZodNumber;
1659
+ far: z.ZodNumber;
1660
+ }, z.core.$strip>;
1661
+ type OrthographicConfig = z.infer<typeof OrthographicConfigSchema>;
1662
+ /**
1663
+ * Viewport transform configuration (NDC to pixel coords).
1664
+ */
1665
+ declare const ViewportConfigSchema: z.ZodObject<{
1666
+ x: z.ZodNumber;
1667
+ y: z.ZodNumber;
1668
+ width: z.ZodNumber;
1669
+ height: z.ZodNumber;
1670
+ }, z.core.$strip>;
1671
+ type ViewportConfig = z.infer<typeof ViewportConfigSchema>;
1672
+ /**
1673
+ * 2D clip rectangle for Cohen-Sutherland clipping.
1674
+ */
1675
+ declare const ClipRectSchema: z.ZodObject<{
1676
+ xMin: z.ZodNumber;
1677
+ xMax: z.ZodNumber;
1678
+ yMin: z.ZodNumber;
1679
+ yMax: z.ZodNumber;
1680
+ }, z.core.$strip>;
1681
+ type ClipRect = z.infer<typeof ClipRectSchema>;
1682
+
1683
+ /**
1684
+ * Vec3 operations on Float32Array for the 3D pipeline.
1685
+ * All functions are pure: they return new arrays and never mutate inputs.
1686
+ * @module 3d/math/vec3
1687
+ */
1688
+ /**
1689
+ * A 3D vector stored as Float32Array of length 3: [x, y, z].
1690
+ */
1691
+ type Vec3 = Float32Array;
1692
+ /**
1693
+ * Create a Vec3 from x, y, z components.
1694
+ *
1695
+ * @param x - X component
1696
+ * @param y - Y component
1697
+ * @param z - Z component
1698
+ * @returns A new Vec3
1699
+ *
1700
+ * @example
1701
+ * ```typescript
1702
+ * const v = vec3(1, 2, 3);
1703
+ * // v[0] === 1, v[1] === 2, v[2] === 3
1704
+ * ```
1705
+ */
1706
+ declare function vec3(x: number, y: number, z: number): Vec3;
1707
+ /**
1708
+ * Create a Vec3 from a number array, validated via Zod.
1709
+ * Use at API boundaries where input is untrusted.
1710
+ *
1711
+ * @param arr - Array of exactly 3 numbers
1712
+ * @returns A new Vec3
1713
+ * @throws ZodError if input is not a valid 3-element number tuple
1714
+ *
1715
+ * @example
1716
+ * ```typescript
1717
+ * const v = vec3FromArray([1, 2, 3]); // OK
1718
+ * vec3FromArray([1, 2]); // throws ZodError
1719
+ * ```
1720
+ */
1721
+ declare function vec3FromArray(arr: readonly number[]): Vec3;
1722
+ /**
1723
+ * Add two vectors: a + b.
1724
+ *
1725
+ * @param a - First vector
1726
+ * @param b - Second vector
1727
+ * @returns A new Vec3 containing the sum
1728
+ *
1729
+ * @example
1730
+ * ```typescript
1731
+ * const sum = vec3Add(vec3(1, 0, 0), vec3(0, 1, 0));
1732
+ * // sum = [1, 1, 0]
1733
+ * ```
1734
+ */
1735
+ declare function vec3Add(a: Vec3, b: Vec3): Vec3;
1736
+ /**
1737
+ * Subtract two vectors: a - b.
1738
+ *
1739
+ * @param a - First vector
1740
+ * @param b - Second vector
1741
+ * @returns A new Vec3 containing the difference
1742
+ *
1743
+ * @example
1744
+ * ```typescript
1745
+ * const diff = vec3Sub(vec3(3, 2, 1), vec3(1, 1, 1));
1746
+ * // diff = [2, 1, 0]
1747
+ * ```
1748
+ */
1749
+ declare function vec3Sub(a: Vec3, b: Vec3): Vec3;
1750
+ /**
1751
+ * Scale a vector by a scalar: v * s.
1752
+ *
1753
+ * @param v - Vector to scale
1754
+ * @param s - Scalar multiplier
1755
+ * @returns A new scaled Vec3
1756
+ *
1757
+ * @example
1758
+ * ```typescript
1759
+ * const doubled = vec3Scale(vec3(1, 2, 3), 2);
1760
+ * // doubled = [2, 4, 6]
1761
+ * ```
1762
+ */
1763
+ declare function vec3Scale(v: Vec3, s: number): Vec3;
1764
+ /**
1765
+ * Dot product of two vectors.
1766
+ *
1767
+ * @param a - First vector
1768
+ * @param b - Second vector
1769
+ * @returns The scalar dot product
1770
+ *
1771
+ * @example
1772
+ * ```typescript
1773
+ * const d = vec3Dot(vec3(1, 0, 0), vec3(0, 1, 0));
1774
+ * // d === 0 (perpendicular vectors)
1775
+ * ```
1776
+ */
1777
+ declare function vec3Dot(a: Vec3, b: Vec3): number;
1778
+ /**
1779
+ * Cross product of two vectors: a x b.
1780
+ *
1781
+ * @param a - First vector
1782
+ * @param b - Second vector
1783
+ * @returns A new Vec3 perpendicular to both inputs
1784
+ *
1785
+ * @example
1786
+ * ```typescript
1787
+ * const up = vec3Cross(vec3(1, 0, 0), vec3(0, 1, 0));
1788
+ * // up = [0, 0, 1] (right-hand rule)
1789
+ * ```
1790
+ */
1791
+ declare function vec3Cross(a: Vec3, b: Vec3): Vec3;
1792
+ /**
1793
+ * Squared length of a vector. Avoids sqrt when only comparing magnitudes.
1794
+ *
1795
+ * @param v - Vector
1796
+ * @returns The squared length
1797
+ *
1798
+ * @example
1799
+ * ```typescript
1800
+ * const lenSq = vec3LengthSq(vec3(3, 4, 0));
1801
+ * // lenSq === 25
1802
+ * ```
1803
+ */
1804
+ declare function vec3LengthSq(v: Vec3): number;
1805
+ /**
1806
+ * Length (magnitude) of a vector.
1807
+ *
1808
+ * @param v - Vector
1809
+ * @returns The length
1810
+ *
1811
+ * @example
1812
+ * ```typescript
1813
+ * const len = vec3Length(vec3(3, 4, 0));
1814
+ * // len === 5
1815
+ * ```
1816
+ */
1817
+ declare function vec3Length(v: Vec3): number;
1818
+ /**
1819
+ * Normalize a vector to unit length.
1820
+ * Returns a zero vector if input length is zero.
1821
+ *
1822
+ * @param v - Vector to normalize
1823
+ * @returns A new unit-length Vec3
1824
+ *
1825
+ * @example
1826
+ * ```typescript
1827
+ * const unit = vec3Normalize(vec3(3, 0, 0));
1828
+ * // unit = [1, 0, 0]
1829
+ * ```
1830
+ */
1831
+ declare function vec3Normalize(v: Vec3): Vec3;
1832
+ /**
1833
+ * Linearly interpolate between two vectors.
1834
+ *
1835
+ * @param a - Start vector (t=0)
1836
+ * @param b - End vector (t=1)
1837
+ * @param t - Interpolation factor, clamped to [0, 1]
1838
+ * @returns A new interpolated Vec3
1839
+ *
1840
+ * @example
1841
+ * ```typescript
1842
+ * const mid = vec3Lerp(vec3(0, 0, 0), vec3(10, 10, 10), 0.5);
1843
+ * // mid = [5, 5, 5]
1844
+ * ```
1845
+ */
1846
+ declare function vec3Lerp(a: Vec3, b: Vec3, t: number): Vec3;
1847
+ /**
1848
+ * Negate a vector: -v.
1849
+ *
1850
+ * @param v - Vector to negate
1851
+ * @returns A new negated Vec3
1852
+ *
1853
+ * @example
1854
+ * ```typescript
1855
+ * const neg = vec3Negate(vec3(1, -2, 3));
1856
+ * // neg = [-1, 2, -3]
1857
+ * ```
1858
+ */
1859
+ declare function vec3Negate(v: Vec3): Vec3;
1860
+ /**
1861
+ * Distance between two points.
1862
+ *
1863
+ * @param a - First point
1864
+ * @param b - Second point
1865
+ * @returns The Euclidean distance
1866
+ *
1867
+ * @example
1868
+ * ```typescript
1869
+ * const d = vec3Distance(vec3(0, 0, 0), vec3(3, 4, 0));
1870
+ * // d === 5
1871
+ * ```
1872
+ */
1873
+ declare function vec3Distance(a: Vec3, b: Vec3): number;
1874
+ /**
1875
+ * Check if two vectors are approximately equal within an epsilon.
1876
+ *
1877
+ * @param a - First vector
1878
+ * @param b - Second vector
1879
+ * @param epsilon - Maximum allowed difference per component (default 1e-6)
1880
+ * @returns True if all components are within epsilon
1881
+ *
1882
+ * @example
1883
+ * ```typescript
1884
+ * vec3Equals(vec3(1, 0, 0), vec3(1.0000001, 0, 0)); // true
1885
+ * vec3Equals(vec3(1, 0, 0), vec3(2, 0, 0)); // false
1886
+ * ```
1887
+ */
1888
+ declare function vec3Equals(a: Vec3, b: Vec3, epsilon?: number): boolean;
1889
+ /**
1890
+ * Create a zero vector [0, 0, 0].
1891
+ *
1892
+ * @returns A new zero Vec3
1893
+ */
1894
+ declare function vec3Zero(): Vec3;
1895
+
1896
+ /**
1897
+ * Mat4 (4x4 matrix) operations on Float32Array(16) in column-major order.
1898
+ * All functions are pure: they return new arrays and never mutate inputs.
1899
+ * Column-major layout: element at [row][col] = arr[col * 4 + row].
1900
+ * @module 3d/math/mat4
1901
+ */
1902
+
1903
+ /**
1904
+ * A 4x4 matrix stored as Float32Array of length 16 in column-major order.
1905
+ */
1906
+ type Mat4 = Float32Array;
1907
+ /**
1908
+ * Create a new identity matrix.
1909
+ *
1910
+ * @returns A new 4x4 identity matrix
1911
+ *
1912
+ * @example
1913
+ * ```typescript
1914
+ * const m = mat4Identity();
1915
+ * // Diagonal is 1, rest is 0
1916
+ * ```
1917
+ */
1918
+ declare function mat4Identity(): Mat4;
1919
+ /**
1920
+ * Multiply two 4x4 matrices: a * b.
1921
+ *
1922
+ * @param a - Left matrix
1923
+ * @param b - Right matrix
1924
+ * @returns A new Mat4 containing the product
1925
+ *
1926
+ * @example
1927
+ * ```typescript
1928
+ * const result = mat4Multiply(mat4Identity(), someMatrix);
1929
+ * // result equals someMatrix (identity * M = M)
1930
+ * ```
1931
+ */
1932
+ declare function mat4Multiply(a: Mat4, b: Mat4): Mat4;
1933
+ /**
1934
+ * Apply translation to a matrix: m * T(x, y, z).
1935
+ *
1936
+ * @param m - Input matrix
1937
+ * @param x - X translation
1938
+ * @param y - Y translation
1939
+ * @param z - Z translation
1940
+ * @returns A new translated Mat4
1941
+ *
1942
+ * @example
1943
+ * ```typescript
1944
+ * const moved = mat4Translate(mat4Identity(), 10, 5, -3);
1945
+ * ```
1946
+ */
1947
+ declare function mat4Translate(m: Mat4, x: number, y: number, z: number): Mat4;
1948
+ /**
1949
+ * Apply rotation around X axis.
1950
+ *
1951
+ * @param m - Input matrix
1952
+ * @param radians - Rotation angle in radians
1953
+ * @returns A new rotated Mat4
1954
+ *
1955
+ * @example
1956
+ * ```typescript
1957
+ * const rotated = mat4RotateX(mat4Identity(), Math.PI / 4);
1958
+ * ```
1959
+ */
1960
+ declare function mat4RotateX(m: Mat4, radians: number): Mat4;
1961
+ /**
1962
+ * Apply rotation around Y axis.
1963
+ *
1964
+ * @param m - Input matrix
1965
+ * @param radians - Rotation angle in radians
1966
+ * @returns A new rotated Mat4
1967
+ *
1968
+ * @example
1969
+ * ```typescript
1970
+ * const rotated = mat4RotateY(mat4Identity(), Math.PI / 2);
1971
+ * ```
1972
+ */
1973
+ declare function mat4RotateY(m: Mat4, radians: number): Mat4;
1974
+ /**
1975
+ * Apply rotation around Z axis.
1976
+ *
1977
+ * @param m - Input matrix
1978
+ * @param radians - Rotation angle in radians
1979
+ * @returns A new rotated Mat4
1980
+ *
1981
+ * @example
1982
+ * ```typescript
1983
+ * const rotated = mat4RotateZ(mat4Identity(), Math.PI);
1984
+ * ```
1985
+ */
1986
+ declare function mat4RotateZ(m: Mat4, radians: number): Mat4;
1987
+ /**
1988
+ * Apply non-uniform scale to a matrix.
1989
+ *
1990
+ * @param m - Input matrix
1991
+ * @param sx - X scale factor
1992
+ * @param sy - Y scale factor
1993
+ * @param sz - Z scale factor
1994
+ * @returns A new scaled Mat4
1995
+ *
1996
+ * @example
1997
+ * ```typescript
1998
+ * const scaled = mat4Scale(mat4Identity(), 2, 2, 2);
1999
+ * ```
2000
+ */
2001
+ declare function mat4Scale(m: Mat4, sx: number, sy: number, sz: number): Mat4;
2002
+ /**
2003
+ * Transpose a 4x4 matrix (swap rows and columns).
2004
+ *
2005
+ * @param m - Input matrix
2006
+ * @returns A new transposed Mat4
2007
+ *
2008
+ * @example
2009
+ * ```typescript
2010
+ * const t = mat4Transpose(someMatrix);
2011
+ * ```
2012
+ */
2013
+ declare function mat4Transpose(m: Mat4): Mat4;
2014
+ /**
2015
+ * Compute the determinant of a 4x4 matrix.
2016
+ *
2017
+ * @param m - Input matrix
2018
+ * @returns The determinant value
2019
+ *
2020
+ * @example
2021
+ * ```typescript
2022
+ * const det = mat4Determinant(mat4Identity());
2023
+ * // det === 1
2024
+ * ```
2025
+ */
2026
+ declare function mat4Determinant(m: Mat4): number;
2027
+ /**
2028
+ * Invert a 4x4 matrix. Returns null if the matrix is singular.
2029
+ *
2030
+ * @param m - Input matrix
2031
+ * @returns A new inverted Mat4 or null if singular
2032
+ *
2033
+ * @example
2034
+ * ```typescript
2035
+ * const inv = mat4Invert(someMatrix);
2036
+ * if (inv) {
2037
+ * // mat4Multiply(someMatrix, inv) ~= identity
2038
+ * }
2039
+ * ```
2040
+ */
2041
+ declare function mat4Invert(m: Mat4): Mat4 | null;
2042
+ /**
2043
+ * Transform a 3D point by a 4x4 matrix (w=1, applies translation).
2044
+ *
2045
+ * @param m - Transformation matrix
2046
+ * @param v - 3D point
2047
+ * @returns A new transformed Vec3
2048
+ *
2049
+ * @example
2050
+ * ```typescript
2051
+ * const moved = mat4TransformVec3(mat4Translate(mat4Identity(), 5, 0, 0), vec3(0, 0, 0));
2052
+ * // moved = [5, 0, 0]
2053
+ * ```
2054
+ */
2055
+ declare function mat4TransformVec3(m: Mat4, v: Vec3): Vec3;
2056
+ /**
2057
+ * Transform a 3D direction by a 4x4 matrix (w=0, ignores translation).
2058
+ *
2059
+ * @param m - Transformation matrix
2060
+ * @param v - 3D direction
2061
+ * @returns A new transformed Vec3
2062
+ *
2063
+ * @example
2064
+ * ```typescript
2065
+ * const dir = mat4TransformDirection(mat4RotateY(mat4Identity(), Math.PI/2), vec3(1, 0, 0));
2066
+ * // dir ~ [0, 0, -1]
2067
+ * ```
2068
+ */
2069
+ declare function mat4TransformDirection(m: Mat4, v: Vec3): Vec3;
2070
+ /**
2071
+ * Build a 4x4 matrix from translation, euler rotation (XYZ order), and scale.
2072
+ *
2073
+ * @param translation - Translation vector
2074
+ * @param rotation - Euler angles in radians (applied as X, then Y, then Z)
2075
+ * @param scale - Scale vector
2076
+ * @returns A new Mat4 combining TRS
2077
+ *
2078
+ * @example
2079
+ * ```typescript
2080
+ * const m = mat4FromTRS(vec3(10, 0, -5), vec3(0, Math.PI/4, 0), vec3(1, 1, 1));
2081
+ * ```
2082
+ */
2083
+ declare function mat4FromTRS(translation: Vec3, rotation: Vec3, scale: Vec3): Mat4;
2084
+ /**
2085
+ * Check if a Mat4 is approximately the identity matrix.
2086
+ *
2087
+ * @param m - Matrix to check
2088
+ * @param epsilon - Maximum allowed difference per element (default 1e-6)
2089
+ * @returns True if the matrix is approximately identity
2090
+ */
2091
+ declare function mat4IsIdentity(m: Mat4, epsilon?: number): boolean;
2092
+ /**
2093
+ * Check if two Mat4 matrices are approximately equal.
2094
+ *
2095
+ * @param a - First matrix
2096
+ * @param b - Second matrix
2097
+ * @param epsilon - Maximum allowed difference per element (default 1e-5)
2098
+ * @returns True if all elements are within epsilon
2099
+ */
2100
+ declare function mat4Equals(a: Mat4, b: Mat4, epsilon?: number): boolean;
2101
+
2102
+ /**
2103
+ * Cohen-Sutherland line clipping and view frustum culling.
2104
+ * @module 3d/math/clipping
2105
+ */
2106
+
2107
+ /**
2108
+ * Result of a line clipping operation.
2109
+ */
2110
+ interface ClippedLine {
2111
+ readonly x0: number;
2112
+ readonly y0: number;
2113
+ readonly x1: number;
2114
+ readonly y1: number;
2115
+ }
2116
+ /**
2117
+ * A frustum plane defined by normal and distance from origin.
2118
+ */
2119
+ interface FrustumPlane {
2120
+ readonly normal: Vec3;
2121
+ readonly distance: number;
2122
+ }
2123
+ /**
2124
+ * Compute the 4-bit Cohen-Sutherland outcode for a point relative to a clip rectangle.
2125
+ *
2126
+ * @param x - Point X coordinate
2127
+ * @param y - Point Y coordinate
2128
+ * @param rect - Clip rectangle
2129
+ * @returns 4-bit outcode
2130
+ *
2131
+ * @example
2132
+ * ```typescript
2133
+ * const code = computeOutcode(5, 5, { xMin: 0, xMax: 10, yMin: 0, yMax: 10 });
2134
+ * // code === 0 (inside)
2135
+ * ```
2136
+ */
2137
+ declare function computeOutcode(x: number, y: number, rect: ClipRect): number;
2138
+ /**
2139
+ * Clip a 2D line segment to a rectangle using Cohen-Sutherland algorithm.
2140
+ * Returns null if the line is entirely outside.
2141
+ *
2142
+ * @param x0 - Start X
2143
+ * @param y0 - Start Y
2144
+ * @param x1 - End X
2145
+ * @param y1 - End Y
2146
+ * @param rect - Clip rectangle
2147
+ * @returns Clipped line endpoints or null if fully outside
2148
+ *
2149
+ * @example
2150
+ * ```typescript
2151
+ * const result = clipLine(-5, 5, 15, 5, { xMin: 0, xMax: 10, yMin: 0, yMax: 10 });
2152
+ * // result = { x0: 0, y0: 5, x1: 10, y1: 5 }
2153
+ * ```
2154
+ */
2155
+ declare function clipLine(x0: number, y0: number, x1: number, y1: number, rect: ClipRect): ClippedLine | null;
2156
+ /**
2157
+ * Extract 6 frustum planes from a combined view-projection matrix.
2158
+ * Plane normals point inward (toward the visible region).
2159
+ *
2160
+ * @param viewProj - Combined view-projection matrix
2161
+ * @returns Array of 6 frustum planes: [left, right, bottom, top, near, far]
2162
+ *
2163
+ * @example
2164
+ * ```typescript
2165
+ * const planes = extractFrustumPlanes(vpMatrix);
2166
+ * ```
2167
+ */
2168
+ declare function extractFrustumPlanes(viewProj: Mat4): FrustumPlane[];
2169
+ /**
2170
+ * Test if a point is inside all frustum planes.
2171
+ *
2172
+ * @param point - 3D point to test
2173
+ * @param planes - Array of frustum planes (normals point inward)
2174
+ * @returns True if the point is inside the frustum
2175
+ *
2176
+ * @example
2177
+ * ```typescript
2178
+ * const inside = isPointInFrustum(vec3(0, 0, -5), frustumPlanes);
2179
+ * ```
2180
+ */
2181
+ declare function isPointInFrustum(point: Vec3, planes: readonly FrustumPlane[]): boolean;
2182
+ /**
2183
+ * Test if a bounding sphere intersects or is inside the frustum.
2184
+ *
2185
+ * @param center - Sphere center
2186
+ * @param radius - Sphere radius
2187
+ * @param planes - Frustum planes
2188
+ * @returns True if the sphere is at least partially inside
2189
+ *
2190
+ * @example
2191
+ * ```typescript
2192
+ * const visible = isSphereInFrustum(vec3(0, 0, -5), 2.0, frustumPlanes);
2193
+ * ```
2194
+ */
2195
+ declare function isSphereInFrustum(center: Vec3, radius: number, planes: readonly FrustumPlane[]): boolean;
2196
+
2197
+ /**
2198
+ * Camera projection matrices and viewport transforms.
2199
+ * @module 3d/math/projection
2200
+ */
2201
+
2202
+ /**
2203
+ * Build a perspective projection matrix.
2204
+ * Validated via PerspectiveConfigSchema at call time.
2205
+ *
2206
+ * @param config - Perspective configuration (fov, aspect, near, far)
2207
+ * @returns A new perspective projection Mat4
2208
+ *
2209
+ * @example
2210
+ * ```typescript
2211
+ * const proj = perspectiveMatrix({ fov: Math.PI / 3, aspect: 16/9, near: 0.1, far: 100 });
2212
+ * ```
2213
+ */
2214
+ declare function perspectiveMatrix(config: PerspectiveConfig): Mat4;
2215
+ /**
2216
+ * Build an orthographic projection matrix.
2217
+ * Validated via OrthographicConfigSchema at call time.
2218
+ *
2219
+ * @param config - Orthographic bounds
2220
+ * @returns A new orthographic projection Mat4
2221
+ *
2222
+ * @example
2223
+ * ```typescript
2224
+ * const proj = orthographicMatrix({ left: -10, right: 10, bottom: -10, top: 10, near: 0.1, far: 100 });
2225
+ * ```
2226
+ */
2227
+ declare function orthographicMatrix(config: OrthographicConfig): Mat4;
2228
+ /**
2229
+ * Build a view matrix (camera looking at target).
2230
+ *
2231
+ * @param eye - Camera position
2232
+ * @param target - Point the camera looks at
2233
+ * @param up - Up direction vector
2234
+ * @returns A new view Mat4
2235
+ *
2236
+ * @example
2237
+ * ```typescript
2238
+ * const view = lookAt(vec3(0, 0, 5), vec3(0, 0, 0), vec3(0, 1, 0));
2239
+ * ```
2240
+ */
2241
+ declare function lookAt(eye: Vec3, target: Vec3, up: Vec3): Mat4;
2242
+ /**
2243
+ * Projected screen coordinates from viewport transform.
2244
+ */
2245
+ interface ScreenCoord {
2246
+ readonly x: number;
2247
+ readonly y: number;
2248
+ readonly depth: number;
2249
+ }
2250
+ /**
2251
+ * Create a viewport transform function that maps NDC [-1,1] to pixel coordinates.
2252
+ * Validated via ViewportConfigSchema at call time.
2253
+ *
2254
+ * @param config - Viewport rectangle
2255
+ * @returns A function that transforms NDC coordinates to screen pixel coordinates
2256
+ *
2257
+ * @example
2258
+ * ```typescript
2259
+ * const transform = viewportTransform({ x: 0, y: 0, width: 160, height: 96 });
2260
+ * const screen = transform(vec3(0, 0, 0.5)); // center of viewport
2261
+ * ```
2262
+ */
2263
+ declare function viewportTransform(config: ViewportConfig): (ndc: Vec3) => ScreenCoord;
2264
+ /**
2265
+ * Project a 3D vertex through an MVP matrix to NDC coordinates.
2266
+ *
2267
+ * @param mvp - Model-View-Projection matrix
2268
+ * @param vertex - 3D vertex position
2269
+ * @returns NDC coordinates (x, y in [-1,1], z = depth)
2270
+ *
2271
+ * @example
2272
+ * ```typescript
2273
+ * const ndc = projectVertex(mvpMatrix, vec3(0, 0, -5));
2274
+ * ```
2275
+ */
2276
+ declare function projectVertex(mvp: Mat4, vertex: Vec3): Vec3;
2277
+ /**
2278
+ * Unproject a screen position back to world coordinates.
2279
+ *
2280
+ * @param invMvp - Inverse of the MVP matrix
2281
+ * @param screenPos - Screen position as Vec3 (x, y in viewport pixels, z = depth 0..1)
2282
+ * @param viewport - Viewport configuration
2283
+ * @returns World-space Vec3 or null if unproject fails
2284
+ *
2285
+ * @example
2286
+ * ```typescript
2287
+ * const worldPos = unprojectVertex(invMvp, vec3(80, 48, 0.5), { x: 0, y: 0, width: 160, height: 96 });
2288
+ * ```
2289
+ */
2290
+ declare function unprojectVertex(invMvp: Mat4, screenPos: Vec3, viewport: ViewportConfig): Vec3 | null;
2291
+ /**
2292
+ * Build an MVP matrix from model, view, and projection matrices.
2293
+ *
2294
+ * @param model - Model (world) matrix
2295
+ * @param view - View (camera) matrix
2296
+ * @param projection - Projection matrix
2297
+ * @returns Combined MVP matrix
2298
+ */
2299
+ declare function buildMVP(model: Mat4, view: Mat4, projection: Mat4): Mat4;
2300
+
2301
+ /**
2302
+ * Bresenham line drawing with color and depth interpolation.
2303
+ *
2304
+ * @module 3d/rasterizer/line
2305
+ */
2306
+
2307
+ /**
2308
+ * Draw a solid-color line using Bresenham's algorithm.
2309
+ * No depth testing. Pixels outside the framebuffer are skipped.
2310
+ *
2311
+ * @param fb - Framebuffer to draw into
2312
+ * @param x0 - Start X coordinate
2313
+ * @param y0 - Start Y coordinate
2314
+ * @param x1 - End X coordinate
2315
+ * @param y1 - End Y coordinate
2316
+ * @param r - Red component (0-255)
2317
+ * @param g - Green component (0-255)
2318
+ * @param b - Blue component (0-255)
2319
+ * @param a - Alpha component (0-255, defaults to 255)
2320
+ *
2321
+ * @example
2322
+ * ```typescript
2323
+ * drawLine(fb, 0, 0, 100, 50, 255, 255, 255);
2324
+ * ```
2325
+ */
2326
+ declare function drawLine(fb: PixelFramebuffer, x0: number, y0: number, x1: number, y1: number, r: number, g: number, b: number, a?: number): void;
2327
+ /**
2328
+ * Draw a line with linear depth interpolation and depth testing.
2329
+ * Uses a single color from p0. Pixels that fail the depth test are skipped.
2330
+ *
2331
+ * @param fb - Framebuffer to draw into (must have depth buffer)
2332
+ * @param p0 - Start endpoint with position, color, and depth
2333
+ * @param p1 - End endpoint with position and depth
2334
+ *
2335
+ * @example
2336
+ * ```typescript
2337
+ * drawLineDepth(fb,
2338
+ * { x: 0, y: 0, depth: 0.2, r: 255, g: 0, b: 0 },
2339
+ * { x: 100, y: 50, depth: 0.8, r: 255, g: 0, b: 0 },
2340
+ * );
2341
+ * ```
2342
+ */
2343
+ declare function drawLineDepth(fb: PixelFramebuffer, p0: LineEndpoint, p1: LineEndpoint): void;
2344
+ /**
2345
+ * Draw a line with both color and depth interpolation.
2346
+ * Color is linearly interpolated between endpoints.
2347
+ *
2348
+ * @param fb - Framebuffer to draw into (must have depth buffer for depth testing)
2349
+ * @param p0 - Start endpoint with position, color, and depth
2350
+ * @param p1 - End endpoint with position, color, and depth
2351
+ *
2352
+ * @example
2353
+ * ```typescript
2354
+ * drawLineColor(fb,
2355
+ * { x: 0, y: 0, depth: 0.2, r: 255, g: 0, b: 0 },
2356
+ * { x: 100, y: 50, depth: 0.8, r: 0, g: 0, b: 255 },
2357
+ * );
2358
+ * ```
2359
+ */
2360
+ declare function drawLineColor(fb: PixelFramebuffer, p0: LineEndpoint, p1: LineEndpoint): void;
2361
+
2362
+ /**
2363
+ * Wu's anti-aliased line drawing algorithm.
2364
+ *
2365
+ * Produces smoother lines by drawing two pixels per step with
2366
+ * fractional intensity. Best results on sixel/kitty backends
2367
+ * where subpixel rendering is available.
2368
+ *
2369
+ * @module 3d/rasterizer/lineAA
2370
+ */
2371
+
2372
+ /**
2373
+ * Blend a color with an existing pixel at the given intensity.
2374
+ * Uses alpha blending: result = existing * (1 - intensity) + new * intensity.
2375
+ *
2376
+ * @param fb - Framebuffer to read/write
2377
+ * @param x - X coordinate
2378
+ * @param y - Y coordinate
2379
+ * @param r - Red component (0-255)
2380
+ * @param g - Green component (0-255)
2381
+ * @param b - Blue component (0-255)
2382
+ * @param a - Alpha component (0-255)
2383
+ * @param intensity - Blend intensity (0.0 = fully transparent, 1.0 = fully opaque)
2384
+ *
2385
+ * @example
2386
+ * ```typescript
2387
+ * blendPixel(fb, 10, 20, 255, 255, 255, 255, 0.5);
2388
+ * ```
2389
+ */
2390
+ declare function blendPixel(fb: PixelFramebuffer, x: number, y: number, r: number, g: number, b: number, a: number, intensity: number): void;
2391
+ /**
2392
+ * Draw an anti-aliased line using Wu's algorithm.
2393
+ * Draws two pixels per column/row step with fractional intensity
2394
+ * for smooth appearance.
2395
+ *
2396
+ * @param fb - Framebuffer to draw into
2397
+ * @param x0 - Start X coordinate
2398
+ * @param y0 - Start Y coordinate
2399
+ * @param x1 - End X coordinate
2400
+ * @param y1 - End Y coordinate
2401
+ * @param r - Red component (0-255)
2402
+ * @param g - Green component (0-255)
2403
+ * @param b - Blue component (0-255)
2404
+ * @param a - Alpha component (0-255, defaults to 255)
2405
+ *
2406
+ * @example
2407
+ * ```typescript
2408
+ * drawLineAA(fb, 0, 0, 100, 30, 255, 255, 255);
2409
+ * ```
2410
+ */
2411
+ declare function drawLineAA(fb: PixelFramebuffer, x0: number, y0: number, x1: number, y1: number, r: number, g: number, b: number, a?: number): void;
2412
+
2413
+ /**
2414
+ * Flat shading for 3D face rendering.
2415
+ *
2416
+ * Computes face normals and applies directional + ambient lighting
2417
+ * to produce a single color per face.
2418
+ *
2419
+ * @module 3d/rasterizer/shading
2420
+ */
2421
+
2422
+ /**
2423
+ * Compute the face normal of a triangle from its three vertices.
2424
+ * The normal is computed as the normalized cross product of two edges.
2425
+ *
2426
+ * @param v0 - First vertex
2427
+ * @param v1 - Second vertex
2428
+ * @param v2 - Third vertex
2429
+ * @returns Normalized face normal vector
2430
+ *
2431
+ * @example
2432
+ * ```typescript
2433
+ * import { vec3 } from '../math/vec3';
2434
+ * const normal = computeFaceNormal(vec3(0,0,0), vec3(1,0,0), vec3(0,1,0));
2435
+ * // normal ~ (0, 0, 1) for CCW triangle in XY plane
2436
+ * ```
2437
+ */
2438
+ declare function computeFaceNormal(v0: Vec3, v1: Vec3, v2: Vec3): Vec3;
2439
+ /**
2440
+ * Compute flat shading color given a face normal, light, and base color.
2441
+ *
2442
+ * Uses Lambert's cosine law: diffuse = max(0, dot(normal, -lightDir)).
2443
+ * Final color = (ambient + diffuse) * baseColor, clamped to [0, 255].
2444
+ *
2445
+ * @param normal - Normalized face normal
2446
+ * @param light - Directional light source
2447
+ * @param ambient - Ambient light
2448
+ * @param baseColor - Base material color
2449
+ * @returns Shaded RGBA color
2450
+ *
2451
+ * @example
2452
+ * ```typescript
2453
+ * const color = computeFlatShading(
2454
+ * faceNormal,
2455
+ * { direction: [0, -1, 0], intensity: 1.0 },
2456
+ * { intensity: 0.1 },
2457
+ * { r: 200, g: 100, b: 50, a: 255 },
2458
+ * );
2459
+ * ```
2460
+ */
2461
+ declare function computeFlatShading(normal: Vec3, light: DirectionalLight, ambient: AmbientLight, baseColor: RGBAColor): RGBAColor;
2462
+ /**
2463
+ * Convenience function: compute face normal and apply flat shading in one call.
2464
+ *
2465
+ * @param v0 - First vertex
2466
+ * @param v1 - Second vertex
2467
+ * @param v2 - Third vertex
2468
+ * @param light - Directional light source
2469
+ * @param ambient - Ambient light
2470
+ * @param baseColor - Base material color
2471
+ * @returns Shaded RGBA color for the face
2472
+ *
2473
+ * @example
2474
+ * ```typescript
2475
+ * import { vec3 } from '../math/vec3';
2476
+ * const color = shadeFace(
2477
+ * vec3(0,0,0), vec3(1,0,0), vec3(0,1,0),
2478
+ * { direction: [0, 0, -1], intensity: 1.0 },
2479
+ * { intensity: 0.1 },
2480
+ * { r: 200, g: 100, b: 50, a: 255 },
2481
+ * );
2482
+ * ```
2483
+ */
2484
+ declare function shadeFace(v0: Vec3, v1: Vec3, v2: Vec3, light: DirectionalLight, ambient: AmbientLight, baseColor: RGBAColor): RGBAColor;
2485
+
2486
+ /**
2487
+ * Scanline triangle rasterizer with depth buffer and color interpolation.
2488
+ *
2489
+ * @module 3d/rasterizer/triangle
2490
+ */
2491
+
2492
+ /**
2493
+ * Bounding box for a triangle.
2494
+ */
2495
+ interface TriangleBBox {
2496
+ readonly minX: number;
2497
+ readonly minY: number;
2498
+ readonly maxX: number;
2499
+ readonly maxY: number;
2500
+ }
2501
+ /**
2502
+ * Compute the signed 2x area of a triangle.
2503
+ * Positive = counter-clockwise (front-facing), negative = clockwise (back-facing).
2504
+ *
2505
+ * @param v0 - First vertex
2506
+ * @param v1 - Second vertex
2507
+ * @param v2 - Third vertex
2508
+ * @returns Signed 2x area
2509
+ *
2510
+ * @example
2511
+ * ```typescript
2512
+ * const area = triangleArea2(
2513
+ * { x: 0, y: 0 },
2514
+ * { x: 10, y: 0 },
2515
+ * { x: 0, y: 10 },
2516
+ * );
2517
+ * // area = 100 (CCW, front-facing)
2518
+ * ```
2519
+ */
2520
+ declare function triangleArea2(v0: {
2521
+ readonly x: number;
2522
+ readonly y: number;
2523
+ }, v1: {
2524
+ readonly x: number;
2525
+ readonly y: number;
2526
+ }, v2: {
2527
+ readonly x: number;
2528
+ readonly y: number;
2529
+ }): number;
2530
+ /**
2531
+ * Compute the axis-aligned bounding box of a triangle.
2532
+ *
2533
+ * @param v0 - First vertex
2534
+ * @param v1 - Second vertex
2535
+ * @param v2 - Third vertex
2536
+ * @returns Bounding box
2537
+ *
2538
+ * @example
2539
+ * ```typescript
2540
+ * const bbox = triangleBoundingBox(v0, v1, v2);
2541
+ * ```
2542
+ */
2543
+ declare function triangleBoundingBox(v0: {
2544
+ readonly x: number;
2545
+ readonly y: number;
2546
+ }, v1: {
2547
+ readonly x: number;
2548
+ readonly y: number;
2549
+ }, v2: {
2550
+ readonly x: number;
2551
+ readonly y: number;
2552
+ }): TriangleBBox;
2553
+ /**
2554
+ * Fill a triangle with per-vertex color and depth interpolation.
2555
+ * Uses scanline rasterization with top-left fill rule.
2556
+ * Skips degenerate triangles (area < 0.5).
2557
+ *
2558
+ * @param fb - Framebuffer to draw into
2559
+ * @param v0 - First vertex
2560
+ * @param v1 - Second vertex
2561
+ * @param v2 - Third vertex
2562
+ *
2563
+ * @example
2564
+ * ```typescript
2565
+ * fillTriangle(fb,
2566
+ * { x: 10, y: 0, depth: 0.5, r: 255, g: 0, b: 0 },
2567
+ * { x: 0, y: 20, depth: 0.5, r: 0, g: 255, b: 0 },
2568
+ * { x: 20, y: 20, depth: 0.5, r: 0, g: 0, b: 255 },
2569
+ * );
2570
+ * ```
2571
+ */
2572
+ declare function fillTriangle(fb: PixelFramebuffer, v0: TriangleVertex, v1: TriangleVertex, v2: TriangleVertex): void;
2573
+ /**
2574
+ * Fill a triangle with a single flat color and depth interpolation.
2575
+ * Faster than fillTriangle when per-vertex color is not needed.
2576
+ *
2577
+ * @param fb - Framebuffer to draw into
2578
+ * @param v0 - First vertex
2579
+ * @param v1 - Second vertex
2580
+ * @param v2 - Third vertex
2581
+ * @param color - Flat fill color
2582
+ *
2583
+ * @example
2584
+ * ```typescript
2585
+ * fillTriangleFlat(fb,
2586
+ * { x: 10, y: 0, depth: 0.5, r: 0, g: 0, b: 0 },
2587
+ * { x: 0, y: 20, depth: 0.5, r: 0, g: 0, b: 0 },
2588
+ * { x: 20, y: 20, depth: 0.5, r: 0, g: 0, b: 0 },
2589
+ * { r: 255, g: 128, b: 64, a: 255 },
2590
+ * );
2591
+ * ```
2592
+ */
2593
+ declare function fillTriangleFlat(fb: PixelFramebuffer, v0: TriangleVertex, v1: TriangleVertex, v2: TriangleVertex, color: RGBAColor): void;
2594
+
2595
+ /**
2596
+ * Convenience functions for creating common 3D mesh primitives.
2597
+ *
2598
+ * @module 3d/stores/primitives
2599
+ */
2600
+
2601
+ /**
2602
+ * Create a cube mesh centered at the origin.
2603
+ *
2604
+ * @param options - Cube configuration (validated via Zod)
2605
+ * @returns Mesh ID in meshStore
2606
+ *
2607
+ * @example
2608
+ * ```typescript
2609
+ * const cubeId = createCubeMesh({ size: 2 });
2610
+ * ```
2611
+ */
2612
+ declare function createCubeMesh(options?: CubeMeshOptions): number;
2613
+ /**
2614
+ * Create a UV sphere mesh centered at the origin.
2615
+ *
2616
+ * @param options - Sphere configuration (validated via Zod)
2617
+ * @returns Mesh ID in meshStore
2618
+ *
2619
+ * @example
2620
+ * ```typescript
2621
+ * const sphereId = createSphereMesh({ radius: 2, widthSegments: 32 });
2622
+ * ```
2623
+ */
2624
+ declare function createSphereMesh(options?: SphereMeshOptions): number;
2625
+ /**
2626
+ * Create a plane mesh in the XZ plane centered at the origin.
2627
+ *
2628
+ * @param options - Plane configuration (validated via Zod)
2629
+ * @returns Mesh ID in meshStore
2630
+ *
2631
+ * @example
2632
+ * ```typescript
2633
+ * const planeId = createPlaneMesh({ width: 10, height: 10 });
2634
+ * ```
2635
+ */
2636
+ declare function createPlaneMesh(options?: PlaneMeshOptions): number;
2637
+ /**
2638
+ * Create a cylinder mesh centered at the origin.
2639
+ * If one radius is 0, creates a cone shape.
2640
+ *
2641
+ * @param options - Cylinder configuration (validated via Zod)
2642
+ * @returns Mesh ID in meshStore
2643
+ *
2644
+ * @example
2645
+ * ```typescript
2646
+ * const cylinderId = createCylinderMesh({ segments: 32 });
2647
+ * const coneId = createCylinderMesh({ radiusTop: 0, radiusBottom: 1 });
2648
+ * ```
2649
+ */
2650
+ declare function createCylinderMesh(options?: CylinderMeshOptions): number;
2651
+
2652
+ /**
2653
+ * 3D animation system: applies continuous rotation and orbital movement
2654
+ * to entities with Animation3D + Transform3D components.
2655
+ *
2656
+ * Runs in the ANIMATION phase before sceneGraphSystem picks up dirty flags.
2657
+ *
2658
+ * @module 3d/systems/animation3dSystem
2659
+ */
2660
+
2661
+ /**
2662
+ * Animation3D system. Updates Transform3D rotation and position based on
2663
+ * Animation3D parameters and elapsed time.
2664
+ *
2665
+ * For each entity with both Animation3D and Transform3D:
2666
+ * - Adds rotateSpeed * dt to current rotation axes
2667
+ * - If orbiting: updates orbit angle and computes position on circle
2668
+ * - Marks Transform3D as dirty so sceneGraphSystem recomputes the world matrix
2669
+ *
2670
+ * @param world - ECS world
2671
+ * @returns The world (unmodified reference)
2672
+ *
2673
+ * @example
2674
+ * ```typescript
2675
+ * import { animation3DSystem } from 'blecsd/3d/systems';
2676
+ *
2677
+ * // Each frame:
2678
+ * animation3DSystem(world); // Updates rotations/orbits
2679
+ * sceneGraphSystem(world); // Recomputes world matrices
2680
+ * ```
2681
+ */
2682
+ declare const animation3DSystem: System;
2683
+
2684
+ /**
2685
+ * Mouse interaction system for 3D camera control.
2686
+ *
2687
+ * Processes accumulated mouse drag and scroll input to rotate and zoom
2688
+ * the camera. Works with entities that have both MouseInteraction3D and
2689
+ * Transform3D components (typically camera entities).
2690
+ *
2691
+ * The system reads from mouseInputStore (fed by feedMouseDrag/feedMouseScroll)
2692
+ * and updates the camera's Transform3D position based on spherical coordinates
2693
+ * (yaw, pitch, distance from origin).
2694
+ *
2695
+ * Run this system BEFORE sceneGraphSystem so that updated camera positions
2696
+ * are picked up in the same frame.
2697
+ *
2698
+ * @module 3d/systems/mouseInteraction3dSystem
2699
+ */
2700
+
2701
+ /**
2702
+ * Mouse interaction 3D system. Processes accumulated mouse input and applies
2703
+ * camera rotation (drag) and zoom (scroll) to the camera's Transform3D.
2704
+ *
2705
+ * For each viewport with mouse input:
2706
+ * 1. Looks up the camera entity from Viewport3D.cameraEntity
2707
+ * 2. If the camera has MouseInteraction3D, applies drag to yaw/pitch
2708
+ * 3. Applies scroll to distance (clamped by zoomMin/zoomMax)
2709
+ * 4. Converts spherical coordinates (yaw, pitch, distance) to Cartesian (tx, ty, tz)
2710
+ * 5. Sets camera rotation to look at origin (rx = -pitch, ry = -yaw)
2711
+ * 6. Marks Transform3D as dirty
2712
+ *
2713
+ * After processing, clears the mouseInputStore.
2714
+ *
2715
+ * @param world - ECS world
2716
+ * @returns The world (unmodified reference)
2717
+ *
2718
+ * @example
2719
+ * ```typescript
2720
+ * import { mouseInteraction3DSystem } from 'blecsd/3d/systems';
2721
+ * import { feedMouseDrag, feedMouseScroll } from 'blecsd/3d/components';
2722
+ *
2723
+ * // On mouse drag event:
2724
+ * feedMouseDrag(viewportEid, deltaX, deltaY);
2725
+ *
2726
+ * // On scroll event:
2727
+ * feedMouseScroll(viewportEid, scrollTicks);
2728
+ *
2729
+ * // Each frame:
2730
+ * mouseInteraction3DSystem(world); // Applies input to camera
2731
+ * sceneGraphSystem(world); // Recomputes world matrices
2732
+ * ```
2733
+ */
2734
+ declare const mouseInteraction3DSystem: System;
2735
+
2736
+ /**
2737
+ * Projection system: builds view/projection matrices from Camera3D,
2738
+ * then projects mesh vertices to 2D screen coordinates.
2739
+ *
2740
+ * For each Viewport3D entity:
2741
+ * 1. Gets the camera entity and builds view/projection matrices
2742
+ * 2. For each entity with Mesh + Transform3D, projects vertices to screen space
2743
+ * 3. Stores results in projectionStore for use by rasterSystem
2744
+ *
2745
+ * @module 3d/systems/projectionSystem
2746
+ */
2747
+
2748
+ /**
2749
+ * A single projected vertex in screen space.
2750
+ */
2751
+ interface ProjectedVertex {
2752
+ readonly x: number;
2753
+ readonly y: number;
2754
+ readonly depth: number;
2755
+ readonly visible: boolean;
2756
+ }
2757
+ /**
2758
+ * Projection results for a single mesh entity within a viewport.
2759
+ */
2760
+ interface MeshProjection {
2761
+ readonly meshEid: Entity;
2762
+ readonly projectedVertices: ReadonlyArray<ProjectedVertex>;
2763
+ readonly triangleIndices: Uint32Array;
2764
+ readonly mvpMatrix: Mat4;
2765
+ }
2766
+ /**
2767
+ * Projection results for a viewport.
2768
+ */
2769
+ interface ViewportProjection {
2770
+ readonly viewportEid: Entity;
2771
+ readonly cameraEid: Entity;
2772
+ readonly meshes: ReadonlyArray<MeshProjection>;
2773
+ readonly vpMatrix: Mat4;
2774
+ readonly pixelWidth: number;
2775
+ readonly pixelHeight: number;
2776
+ }
2777
+ /**
2778
+ * Per-frame projection store. Cleared and rebuilt each frame by the projection system.
2779
+ * Keyed by viewport entity ID.
2780
+ */
2781
+ declare const projectionStore: Map<number, ViewportProjection>;
2782
+ /**
2783
+ * Clear the projection store. Useful for testing.
2784
+ */
2785
+ declare function clearProjectionStore(): void;
2786
+ declare const projectionSystem: System;
2787
+
2788
+ /**
2789
+ * Raster system: draws wireframe edges and/or filled triangles to a PixelFramebuffer.
2790
+ *
2791
+ * Reads projected vertex data from projectionStore and Material settings to
2792
+ * determine rendering mode (wireframe, filled, or both). Produces a
2793
+ * PixelFramebuffer per viewport stored in framebufferStore.
2794
+ *
2795
+ * @module 3d/systems/rasterSystem
2796
+ */
2797
+
2798
+ /**
2799
+ * Per-viewport framebuffer store. Created/resized as needed by the raster system.
2800
+ */
2801
+ declare const framebufferStore: Map<number, PixelFramebuffer>;
2802
+ /**
2803
+ * Clear the framebuffer store. Useful for testing.
2804
+ */
2805
+ declare function clearFramebufferStore(): void;
2806
+ declare const rasterSystem: System;
2807
+
2808
+ /**
2809
+ * Scene graph system: computes world matrices from local transforms and parent hierarchy.
2810
+ *
2811
+ * Processes all entities with Transform3D that are dirty, composing local TRS
2812
+ * (translation, rotation, scale) into a world matrix. For entities with parents,
2813
+ * the world matrix is the product of the parent's world matrix and the local matrix.
2814
+ *
2815
+ * @module 3d/systems/sceneGraphSystem
2816
+ */
2817
+
2818
+ /**
2819
+ * Scene graph system that computes world matrices from Transform3D + Hierarchy.
2820
+ *
2821
+ * Processing order: depth-first, parent before children.
2822
+ * Only dirty entities and their descendants are recomputed.
2823
+ *
2824
+ * @param world - ECS world
2825
+ * @returns The world (unmodified reference)
2826
+ *
2827
+ * @example
2828
+ * ```typescript
2829
+ * import { sceneGraphSystem } from 'blecsd/3d/systems';
2830
+ *
2831
+ * // Run manually
2832
+ * sceneGraphSystem(world);
2833
+ *
2834
+ * // Or register with scheduler
2835
+ * registerSceneGraphSystem(scheduler);
2836
+ * ```
2837
+ */
2838
+ declare const sceneGraphSystem: System;
2839
+
2840
+ /**
2841
+ * Viewport output system: encodes PixelFramebuffer via the selected backend
2842
+ * and stores the encoded result for consumption by the rendering pipeline.
2843
+ *
2844
+ * For cell-based backends (braille, halfblock, sextant): produces cell arrays
2845
+ * that can be written to a ScreenBuffer via setCell().
2846
+ *
2847
+ * For escape-based backends (sixel, kitty): produces raw escape sequences
2848
+ * that can be written directly to the terminal output stream.
2849
+ *
2850
+ * @module 3d/systems/viewportOutputSystem
2851
+ */
2852
+
2853
+ /**
2854
+ * Per-viewport cached backend instances. Created on first use and reused
2855
+ * until the viewport's backend type changes.
2856
+ */
2857
+ declare const backendStore: Map<number, RendererBackend>;
2858
+ /**
2859
+ * Per-viewport encoded output from the last frame.
2860
+ * Consumers read this to write cells to ScreenBuffer or escape sequences to terminal.
2861
+ */
2862
+ declare const outputStore: Map<number, ViewportOutput>;
2863
+ /**
2864
+ * Encoded output for a viewport, including positioning information.
2865
+ */
2866
+ interface ViewportOutput {
2867
+ /** The viewport entity this output belongs to. */
2868
+ readonly viewportEid: Entity;
2869
+ /** Screen column position (viewport left). */
2870
+ readonly screenX: number;
2871
+ /** Screen row position (viewport top). */
2872
+ readonly screenY: number;
2873
+ /** The backend that produced this output. */
2874
+ readonly backendType: string;
2875
+ /** The encoded output (cells and/or escape sequences). */
2876
+ readonly encoded: EncodedOutput;
2877
+ }
2878
+ /**
2879
+ * Clear the backend store. Useful for testing.
2880
+ */
2881
+ declare function clearBackendStore(): void;
2882
+ /**
2883
+ * Clear the output store. Useful for testing.
2884
+ */
2885
+ declare function clearOutputStore(): void;
2886
+ /**
2887
+ * Viewport output system. Encodes per-viewport framebuffers via their
2888
+ * selected backend and stores the result in outputStore.
2889
+ *
2890
+ * Runs after rasterSystem in the RENDER phase.
2891
+ *
2892
+ * @param world - ECS world
2893
+ * @returns The world (unmodified reference)
2894
+ *
2895
+ * @example
2896
+ * ```typescript
2897
+ * import { viewportOutputSystem, outputStore } from 'blecsd/3d/systems';
2898
+ *
2899
+ * viewportOutputSystem(world);
2900
+ *
2901
+ * for (const [vpEid, output] of outputStore) {
2902
+ * if (output.encoded.cells) {
2903
+ * for (const cell of output.encoded.cells) {
2904
+ * setCell(buffer, cell.x, cell.y, createCell(cell.char, cell.fg, cell.bg));
2905
+ * }
2906
+ * }
2907
+ * if (output.encoded.escape) {
2908
+ * process.stdout.write(output.encoded.escape);
2909
+ * }
2910
+ * }
2911
+ * ```
2912
+ */
2913
+ declare const viewportOutputSystem: System;
2914
+
2915
+ /**
2916
+ * 3D rendering subsystem for blECSd.
2917
+ *
2918
+ * Provides a complete 3D pipeline: math, rasterization, ECS components/systems,
2919
+ * renderer backends, and mesh loading/primitives.
2920
+ *
2921
+ * @module 3d
2922
+ */
2923
+
2924
+ type index_AmbientLight = AmbientLight;
2925
+ declare const index_AmbientLightSchema: typeof AmbientLightSchema;
2926
+ declare const index_Animation3D: typeof Animation3D;
2927
+ declare const index_Animation3DConfig: typeof Animation3DConfig;
2928
+ declare const index_Animation3DConfigSchema: typeof Animation3DConfigSchema;
2929
+ type index_Animation3DData = Animation3DData;
2930
+ type index_BackendCapabilities = BackendCapabilities;
2931
+ declare const index_BackendCapabilitiesSchema: typeof BackendCapabilitiesSchema;
2932
+ type index_BackendPreference = BackendPreference;
2933
+ declare const index_BackendPreferenceSchema: typeof BackendPreferenceSchema;
2934
+ type index_BackendSelection = BackendSelection;
2935
+ declare const index_BackendSelectionSchema: typeof BackendSelectionSchema;
2936
+ type index_BackendType = BackendType;
2937
+ declare const index_BackendTypeSchema: typeof BackendTypeSchema;
2938
+ type index_BrailleConfig = BrailleConfig;
2939
+ declare const index_BrailleConfigSchema: typeof BrailleConfigSchema;
2940
+ declare const index_Camera3D: typeof Camera3D;
2941
+ declare const index_Camera3DConfig: typeof Camera3DConfig;
2942
+ declare const index_Camera3DConfigSchema: typeof Camera3DConfigSchema;
2943
+ type index_Camera3DData = Camera3DData;
2944
+ type index_ClipRect = ClipRect;
2945
+ declare const index_ClipRectSchema: typeof ClipRectSchema;
2946
+ type index_ClippedLine = ClippedLine;
2947
+ type index_CubeMeshOptions = CubeMeshOptions;
2948
+ declare const index_CubeMeshOptionsSchema: typeof CubeMeshOptionsSchema;
2949
+ type index_CylinderMeshOptions = CylinderMeshOptions;
2950
+ declare const index_CylinderMeshOptionsSchema: typeof CylinderMeshOptionsSchema;
2951
+ type index_DirectionalLight = DirectionalLight;
2952
+ declare const index_DirectionalLightSchema: typeof DirectionalLightSchema;
2953
+ type index_EncodedCell = EncodedCell;
2954
+ declare const index_EncodedCellSchema: typeof EncodedCellSchema;
2955
+ type index_EncodedOutput = EncodedOutput;
2956
+ declare const index_EncodedOutputSchema: typeof EncodedOutputSchema;
2957
+ type index_EulerAngles = EulerAngles;
2958
+ declare const index_EulerAnglesSchema: typeof EulerAnglesSchema;
2959
+ type index_FrustumPlane = FrustumPlane;
2960
+ type index_GraphicsCapabilities = GraphicsCapabilities;
2961
+ type index_HalfBlockConfig = HalfBlockConfig;
2962
+ declare const index_HalfBlockConfigSchema: typeof HalfBlockConfigSchema;
2963
+ type index_KittyConfig = KittyConfig;
2964
+ declare const index_KittyConfigSchema: typeof KittyConfigSchema;
2965
+ type index_LineEndpoint = LineEndpoint;
2966
+ declare const index_LineEndpointSchema: typeof LineEndpointSchema;
2967
+ type index_Mat4 = Mat4;
2968
+ declare const index_Mat4Schema: typeof Mat4Schema;
2969
+ declare const index_Material3D: typeof Material3D;
2970
+ declare const index_Material3DConfig: typeof Material3DConfig;
2971
+ declare const index_Material3DConfigSchema: typeof Material3DConfigSchema;
2972
+ type index_Material3DData = Material3DData;
2973
+ declare const index_Mesh: typeof Mesh;
2974
+ type index_MeshData = MeshData;
2975
+ type index_MeshProjection = MeshProjection;
2976
+ type index_MouseDragInput = MouseDragInput;
2977
+ declare const index_MouseInteraction3D: typeof MouseInteraction3D;
2978
+ declare const index_MouseInteraction3DConfig: typeof MouseInteraction3DConfig;
2979
+ declare const index_MouseInteraction3DConfigSchema: typeof MouseInteraction3DConfigSchema;
2980
+ type index_MouseInteraction3DData = MouseInteraction3DData;
2981
+ type index_ObjFace = ObjFace;
2982
+ type index_ObjGroup = ObjGroup;
2983
+ type index_ObjLoadOptions = ObjLoadOptions;
2984
+ declare const index_ObjLoadOptionsSchema: typeof ObjLoadOptionsSchema;
2985
+ type index_ObjParseResult = ObjParseResult;
2986
+ type index_ObjVertex = ObjVertex;
2987
+ type index_OrthographicConfig = OrthographicConfig;
2988
+ declare const index_OrthographicConfigSchema: typeof OrthographicConfigSchema;
2989
+ type index_PerspectiveConfig = PerspectiveConfig;
2990
+ declare const index_PerspectiveConfigSchema: typeof PerspectiveConfigSchema;
2991
+ type index_PixelBufferConfig = PixelBufferConfig;
2992
+ declare const index_PixelBufferConfigSchema: typeof PixelBufferConfigSchema;
2993
+ type index_PixelFramebuffer = PixelFramebuffer;
2994
+ type index_PlaneMeshOptions = PlaneMeshOptions;
2995
+ declare const index_PlaneMeshOptionsSchema: typeof PlaneMeshOptionsSchema;
2996
+ type index_ProjectedVertex = ProjectedVertex;
2997
+ type index_RGBAColor = RGBAColor;
2998
+ declare const index_RGBAColorSchema: typeof RGBAColorSchema;
2999
+ type index_RendererBackend = RendererBackend;
3000
+ type index_ScreenCoord = ScreenCoord;
3001
+ type index_SextantConfig = SextantConfig;
3002
+ declare const index_SextantConfigSchema: typeof SextantConfigSchema;
3003
+ type index_SixelConfig = SixelConfig;
3004
+ declare const index_SixelConfigSchema: typeof SixelConfigSchema;
3005
+ type index_SphereMeshOptions = SphereMeshOptions;
3006
+ declare const index_SphereMeshOptionsSchema: typeof SphereMeshOptionsSchema;
3007
+ declare const index_Transform3D: typeof Transform3D;
3008
+ declare const index_Transform3DConfig: typeof Transform3DConfig;
3009
+ declare const index_Transform3DConfigSchema: typeof Transform3DConfigSchema;
3010
+ type index_Transform3DData = Transform3DData;
3011
+ type index_TriangleBBox = TriangleBBox;
3012
+ type index_TriangleVertex = TriangleVertex;
3013
+ declare const index_TriangleVertexSchema: typeof TriangleVertexSchema;
3014
+ type index_Vec3 = Vec3;
3015
+ type index_Vec3Input = Vec3Input;
3016
+ declare const index_Vec3InputSchema: typeof Vec3InputSchema;
3017
+ declare const index_Vec3Schema: typeof Vec3Schema;
3018
+ declare const index_Viewport3D: typeof Viewport3D;
3019
+ declare const index_Viewport3DConfig: typeof Viewport3DConfig;
3020
+ declare const index_Viewport3DConfigSchema: typeof Viewport3DConfigSchema;
3021
+ type index_Viewport3DData = Viewport3DData;
3022
+ declare const index_Viewport3DWidgetConfig: typeof Viewport3DWidgetConfig;
3023
+ declare const index_Viewport3DWidgetConfigSchema: typeof Viewport3DWidgetConfigSchema;
3024
+ type index_ViewportConfig = ViewportConfig;
3025
+ declare const index_ViewportConfigSchema: typeof ViewportConfigSchema;
3026
+ type index_ViewportOutput = ViewportOutput;
3027
+ type index_ViewportProjection = ViewportProjection;
3028
+ declare const index_animation3DSystem: typeof animation3DSystem;
3029
+ declare const index_backendStore: typeof backendStore;
3030
+ declare const index_blendPixel: typeof blendPixel;
3031
+ declare const index_buildMVP: typeof buildMVP;
3032
+ declare const index_clearBackendStore: typeof clearBackendStore;
3033
+ declare const index_clearFramebuffer: typeof clearFramebuffer;
3034
+ declare const index_clearFramebufferStore: typeof clearFramebufferStore;
3035
+ declare const index_clearMeshStore: typeof clearMeshStore;
3036
+ declare const index_clearMouseInputStore: typeof clearMouseInputStore;
3037
+ declare const index_clearOutputStore: typeof clearOutputStore;
3038
+ declare const index_clearProjectionStore: typeof clearProjectionStore;
3039
+ declare const index_clipLine: typeof clipLine;
3040
+ declare const index_computeBoundingBox: typeof computeBoundingBox;
3041
+ declare const index_computeFaceNormal: typeof computeFaceNormal;
3042
+ declare const index_computeFlatShading: typeof computeFlatShading;
3043
+ declare const index_computeOutcode: typeof computeOutcode;
3044
+ declare const index_createBackendByType: typeof createBackendByType;
3045
+ declare const index_createBrailleBackend: typeof createBrailleBackend;
3046
+ declare const index_createCubeMesh: typeof createCubeMesh;
3047
+ declare const index_createCylinderMesh: typeof createCylinderMesh;
3048
+ declare const index_createHalfBlockBackend: typeof createHalfBlockBackend;
3049
+ declare const index_createKittyBackend: typeof createKittyBackend;
3050
+ declare const index_createMeshFromArrays: typeof createMeshFromArrays;
3051
+ declare const index_createPixelFramebuffer: typeof createPixelFramebuffer;
3052
+ declare const index_createPlaneMesh: typeof createPlaneMesh;
3053
+ declare const index_createSextantBackend: typeof createSextantBackend;
3054
+ declare const index_createSixelBackend: typeof createSixelBackend;
3055
+ declare const index_createSphereMesh: typeof createSphereMesh;
3056
+ declare const index_detectBestBackend: typeof detectBestBackend;
3057
+ declare const index_disableMouseInteraction: typeof disableMouseInteraction;
3058
+ declare const index_drawLine: typeof drawLine;
3059
+ declare const index_drawLineAA: typeof drawLineAA;
3060
+ declare const index_drawLineColor: typeof drawLineColor;
3061
+ declare const index_drawLineDepth: typeof drawLineDepth;
3062
+ declare const index_enableMouseInteraction: typeof enableMouseInteraction;
3063
+ declare const index_extractFrustumPlanes: typeof extractFrustumPlanes;
3064
+ declare const index_feedMouseDrag: typeof feedMouseDrag;
3065
+ declare const index_feedMouseScroll: typeof feedMouseScroll;
3066
+ declare const index_fillRect: typeof fillRect;
3067
+ declare const index_fillTriangle: typeof fillTriangle;
3068
+ declare const index_fillTriangleFlat: typeof fillTriangleFlat;
3069
+ declare const index_framebufferStore: typeof framebufferStore;
3070
+ declare const index_getAnimation3D: typeof getAnimation3D;
3071
+ declare const index_getCamera3D: typeof getCamera3D;
3072
+ declare const index_getDepth: typeof getDepth;
3073
+ declare const index_getMaterial3D: typeof getMaterial3D;
3074
+ declare const index_getMesh: typeof getMesh;
3075
+ declare const index_getMeshCount: typeof getMeshCount;
3076
+ declare const index_getMeshData: typeof getMeshData;
3077
+ declare const index_getMouseInteraction3D: typeof getMouseInteraction3D;
3078
+ declare const index_getPixel: typeof getPixel;
3079
+ declare const index_getProjMatrix: typeof getProjMatrix;
3080
+ declare const index_getTransform3D: typeof getTransform3D;
3081
+ declare const index_getViewMatrix: typeof getViewMatrix;
3082
+ declare const index_getViewport3D: typeof getViewport3D;
3083
+ declare const index_getWorldMatrix: typeof getWorldMatrix;
3084
+ declare const index_isDirty: typeof isDirty;
3085
+ declare const index_isInBounds: typeof isInBounds;
3086
+ declare const index_isPointInFrustum: typeof isPointInFrustum;
3087
+ declare const index_isSphereInFrustum: typeof isSphereInFrustum;
3088
+ declare const index_loadObjAsMesh: typeof loadObjAsMesh;
3089
+ declare const index_lookAt: typeof lookAt;
3090
+ declare const index_markDirty: typeof markDirty;
3091
+ declare const index_mat4Determinant: typeof mat4Determinant;
3092
+ declare const index_mat4Equals: typeof mat4Equals;
3093
+ declare const index_mat4FromTRS: typeof mat4FromTRS;
3094
+ declare const index_mat4Identity: typeof mat4Identity;
3095
+ declare const index_mat4Invert: typeof mat4Invert;
3096
+ declare const index_mat4IsIdentity: typeof mat4IsIdentity;
3097
+ declare const index_mat4Multiply: typeof mat4Multiply;
3098
+ declare const index_mat4RotateX: typeof mat4RotateX;
3099
+ declare const index_mat4RotateY: typeof mat4RotateY;
3100
+ declare const index_mat4RotateZ: typeof mat4RotateZ;
3101
+ declare const index_mat4Scale: typeof mat4Scale;
3102
+ declare const index_mat4TransformDirection: typeof mat4TransformDirection;
3103
+ declare const index_mat4TransformVec3: typeof mat4TransformVec3;
3104
+ declare const index_mat4Translate: typeof mat4Translate;
3105
+ declare const index_mat4Transpose: typeof mat4Transpose;
3106
+ declare const index_mouseInputStore: typeof mouseInputStore;
3107
+ declare const index_mouseInteraction3DSystem: typeof mouseInteraction3DSystem;
3108
+ declare const index_orthographicMatrix: typeof orthographicMatrix;
3109
+ declare const index_outputStore: typeof outputStore;
3110
+ declare const index_parseObj: typeof parseObj;
3111
+ declare const index_perspectiveMatrix: typeof perspectiveMatrix;
3112
+ declare const index_projectVertex: typeof projectVertex;
3113
+ declare const index_projectionStore: typeof projectionStore;
3114
+ declare const index_projectionSystem: typeof projectionSystem;
3115
+ declare const index_rasterSystem: typeof rasterSystem;
3116
+ declare const index_registerMesh: typeof registerMesh;
3117
+ declare const index_sceneGraphSystem: typeof sceneGraphSystem;
3118
+ declare const index_setAnimation3D: typeof setAnimation3D;
3119
+ declare const index_setCamera3D: typeof setCamera3D;
3120
+ declare const index_setMaterial3D: typeof setMaterial3D;
3121
+ declare const index_setMesh: typeof setMesh;
3122
+ declare const index_setPixel: typeof setPixel;
3123
+ declare const index_setPixelUnsafe: typeof setPixelUnsafe;
3124
+ declare const index_setRotation: typeof setRotation;
3125
+ declare const index_setScale: typeof setScale;
3126
+ declare const index_setTransform3D: typeof setTransform3D;
3127
+ declare const index_setTranslation: typeof setTranslation;
3128
+ declare const index_setViewport3D: typeof setViewport3D;
3129
+ declare const index_shadeFace: typeof shadeFace;
3130
+ declare const index_testAndSetDepth: typeof testAndSetDepth;
3131
+ declare const index_triangleArea2: typeof triangleArea2;
3132
+ declare const index_triangleBoundingBox: typeof triangleBoundingBox;
3133
+ declare const index_unprojectVertex: typeof unprojectVertex;
3134
+ declare const index_unregisterMesh: typeof unregisterMesh;
3135
+ declare const index_vec3: typeof vec3;
3136
+ declare const index_vec3Add: typeof vec3Add;
3137
+ declare const index_vec3Cross: typeof vec3Cross;
3138
+ declare const index_vec3Distance: typeof vec3Distance;
3139
+ declare const index_vec3Dot: typeof vec3Dot;
3140
+ declare const index_vec3Equals: typeof vec3Equals;
3141
+ declare const index_vec3FromArray: typeof vec3FromArray;
3142
+ declare const index_vec3Length: typeof vec3Length;
3143
+ declare const index_vec3LengthSq: typeof vec3LengthSq;
3144
+ declare const index_vec3Lerp: typeof vec3Lerp;
3145
+ declare const index_vec3Negate: typeof vec3Negate;
3146
+ declare const index_vec3Normalize: typeof vec3Normalize;
3147
+ declare const index_vec3Scale: typeof vec3Scale;
3148
+ declare const index_vec3Sub: typeof vec3Sub;
3149
+ declare const index_vec3Zero: typeof vec3Zero;
3150
+ declare const index_viewportOutputSystem: typeof viewportOutputSystem;
3151
+ declare const index_viewportTransform: typeof viewportTransform;
3152
+ declare namespace index {
3153
+ export { type index_AmbientLight as AmbientLight, index_AmbientLightSchema as AmbientLightSchema, index_Animation3D as Animation3D, index_Animation3DConfig as Animation3DConfig, index_Animation3DConfigSchema as Animation3DConfigSchema, type index_Animation3DData as Animation3DData, type index_BackendCapabilities as BackendCapabilities, index_BackendCapabilitiesSchema as BackendCapabilitiesSchema, type index_BackendPreference as BackendPreference, index_BackendPreferenceSchema as BackendPreferenceSchema, type index_BackendSelection as BackendSelection, index_BackendSelectionSchema as BackendSelectionSchema, type index_BackendType as BackendType, index_BackendTypeSchema as BackendTypeSchema, type index_BrailleConfig as BrailleConfig, index_BrailleConfigSchema as BrailleConfigSchema, index_Camera3D as Camera3D, index_Camera3DConfig as Camera3DConfig, index_Camera3DConfigSchema as Camera3DConfigSchema, type index_Camera3DData as Camera3DData, type index_ClipRect as ClipRect, index_ClipRectSchema as ClipRectSchema, type index_ClippedLine as ClippedLine, type index_CubeMeshOptions as CubeMeshOptions, index_CubeMeshOptionsSchema as CubeMeshOptionsSchema, type index_CylinderMeshOptions as CylinderMeshOptions, index_CylinderMeshOptionsSchema as CylinderMeshOptionsSchema, type index_DirectionalLight as DirectionalLight, index_DirectionalLightSchema as DirectionalLightSchema, type index_EncodedCell as EncodedCell, index_EncodedCellSchema as EncodedCellSchema, type index_EncodedOutput as EncodedOutput, index_EncodedOutputSchema as EncodedOutputSchema, type index_EulerAngles as EulerAngles, index_EulerAnglesSchema as EulerAnglesSchema, type index_FrustumPlane as FrustumPlane, type index_GraphicsCapabilities as GraphicsCapabilities, type index_HalfBlockConfig as HalfBlockConfig, index_HalfBlockConfigSchema as HalfBlockConfigSchema, type index_KittyConfig as KittyConfig, index_KittyConfigSchema as KittyConfigSchema, type index_LineEndpoint as LineEndpoint, index_LineEndpointSchema as LineEndpointSchema, type index_Mat4 as Mat4, index_Mat4Schema as Mat4Schema, index_Material3D as Material3D, index_Material3DConfig as Material3DConfig, index_Material3DConfigSchema as Material3DConfigSchema, type index_Material3DData as Material3DData, index_Mesh as Mesh, type index_MeshData as MeshData, type index_MeshProjection as MeshProjection, type index_MouseDragInput as MouseDragInput, index_MouseInteraction3D as MouseInteraction3D, index_MouseInteraction3DConfig as MouseInteraction3DConfig, index_MouseInteraction3DConfigSchema as MouseInteraction3DConfigSchema, type index_MouseInteraction3DData as MouseInteraction3DData, type index_ObjFace as ObjFace, type index_ObjGroup as ObjGroup, type index_ObjLoadOptions as ObjLoadOptions, index_ObjLoadOptionsSchema as ObjLoadOptionsSchema, type index_ObjParseResult as ObjParseResult, type index_ObjVertex as ObjVertex, type index_OrthographicConfig as OrthographicConfig, index_OrthographicConfigSchema as OrthographicConfigSchema, type index_PerspectiveConfig as PerspectiveConfig, index_PerspectiveConfigSchema as PerspectiveConfigSchema, type index_PixelBufferConfig as PixelBufferConfig, index_PixelBufferConfigSchema as PixelBufferConfigSchema, type index_PixelFramebuffer as PixelFramebuffer, type index_PlaneMeshOptions as PlaneMeshOptions, index_PlaneMeshOptionsSchema as PlaneMeshOptionsSchema, type index_ProjectedVertex as ProjectedVertex, type index_RGBAColor as RGBAColor, index_RGBAColorSchema as RGBAColorSchema, type index_RendererBackend as RendererBackend, type index_ScreenCoord as ScreenCoord, type index_SextantConfig as SextantConfig, index_SextantConfigSchema as SextantConfigSchema, type index_SixelConfig as SixelConfig, index_SixelConfigSchema as SixelConfigSchema, type index_SphereMeshOptions as SphereMeshOptions, index_SphereMeshOptionsSchema as SphereMeshOptionsSchema, index_Transform3D as Transform3D, index_Transform3DConfig as Transform3DConfig, index_Transform3DConfigSchema as Transform3DConfigSchema, type index_Transform3DData as Transform3DData, type index_TriangleBBox as TriangleBBox, type index_TriangleVertex as TriangleVertex, index_TriangleVertexSchema as TriangleVertexSchema, type index_Vec3 as Vec3, type index_Vec3Input as Vec3Input, index_Vec3InputSchema as Vec3InputSchema, index_Vec3Schema as Vec3Schema, index_Viewport3D as Viewport3D, index_Viewport3DConfig as Viewport3DConfig, index_Viewport3DConfigSchema as Viewport3DConfigSchema, type index_Viewport3DData as Viewport3DData, index_Viewport3DWidgetConfig as Viewport3DWidgetConfig, index_Viewport3DWidgetConfigSchema as Viewport3DWidgetConfigSchema, type index_ViewportConfig as ViewportConfig, index_ViewportConfigSchema as ViewportConfigSchema, type index_ViewportOutput as ViewportOutput, type index_ViewportProjection as ViewportProjection, index_animation3DSystem as animation3DSystem, index_backendStore as backendStore, index_blendPixel as blendPixel, index_buildMVP as buildMVP, index_clearBackendStore as clearBackendStore, index_clearFramebuffer as clearFramebuffer, index_clearFramebufferStore as clearFramebufferStore, index_clearMeshStore as clearMeshStore, index_clearMouseInputStore as clearMouseInputStore, index_clearOutputStore as clearOutputStore, index_clearProjectionStore as clearProjectionStore, index_clipLine as clipLine, index_computeBoundingBox as computeBoundingBox, index_computeFaceNormal as computeFaceNormal, index_computeFlatShading as computeFlatShading, index_computeOutcode as computeOutcode, index_createBackendByType as createBackendByType, index_createBrailleBackend as createBrailleBackend, index_createCubeMesh as createCubeMesh, index_createCylinderMesh as createCylinderMesh, index_createHalfBlockBackend as createHalfBlockBackend, index_createKittyBackend as createKittyBackend, index_createMeshFromArrays as createMeshFromArrays, index_createPixelFramebuffer as createPixelFramebuffer, index_createPlaneMesh as createPlaneMesh, index_createSextantBackend as createSextantBackend, index_createSixelBackend as createSixelBackend, index_createSphereMesh as createSphereMesh, index_detectBestBackend as detectBestBackend, index_disableMouseInteraction as disableMouseInteraction, index_drawLine as drawLine, index_drawLineAA as drawLineAA, index_drawLineColor as drawLineColor, index_drawLineDepth as drawLineDepth, index_enableMouseInteraction as enableMouseInteraction, index_extractFrustumPlanes as extractFrustumPlanes, index_feedMouseDrag as feedMouseDrag, index_feedMouseScroll as feedMouseScroll, index_fillRect as fillRect, index_fillTriangle as fillTriangle, index_fillTriangleFlat as fillTriangleFlat, index_framebufferStore as framebufferStore, index_getAnimation3D as getAnimation3D, index_getCamera3D as getCamera3D, index_getDepth as getDepth, index_getMaterial3D as getMaterial3D, index_getMesh as getMesh, index_getMeshCount as getMeshCount, index_getMeshData as getMeshData, index_getMouseInteraction3D as getMouseInteraction3D, index_getPixel as getPixel, index_getProjMatrix as getProjMatrix, index_getTransform3D as getTransform3D, index_getViewMatrix as getViewMatrix, index_getViewport3D as getViewport3D, index_getWorldMatrix as getWorldMatrix, index_isDirty as isDirty, index_isInBounds as isInBounds, index_isPointInFrustum as isPointInFrustum, index_isSphereInFrustum as isSphereInFrustum, index_loadObjAsMesh as loadObjAsMesh, index_lookAt as lookAt, index_markDirty as markDirty, index_mat4Determinant as mat4Determinant, index_mat4Equals as mat4Equals, index_mat4FromTRS as mat4FromTRS, index_mat4Identity as mat4Identity, index_mat4Invert as mat4Invert, index_mat4IsIdentity as mat4IsIdentity, index_mat4Multiply as mat4Multiply, index_mat4RotateX as mat4RotateX, index_mat4RotateY as mat4RotateY, index_mat4RotateZ as mat4RotateZ, index_mat4Scale as mat4Scale, index_mat4TransformDirection as mat4TransformDirection, index_mat4TransformVec3 as mat4TransformVec3, index_mat4Translate as mat4Translate, index_mat4Transpose as mat4Transpose, index_mouseInputStore as mouseInputStore, index_mouseInteraction3DSystem as mouseInteraction3DSystem, index_orthographicMatrix as orthographicMatrix, index_outputStore as outputStore, index_parseObj as parseObj, index_perspectiveMatrix as perspectiveMatrix, index_projectVertex as projectVertex, index_projectionStore as projectionStore, index_projectionSystem as projectionSystem, index_rasterSystem as rasterSystem, index_registerMesh as registerMesh, index_sceneGraphSystem as sceneGraphSystem, index_setAnimation3D as setAnimation3D, index_setCamera3D as setCamera3D, index_setMaterial3D as setMaterial3D, index_setMesh as setMesh, index_setPixel as setPixel, index_setPixelUnsafe as setPixelUnsafe, index_setRotation as setRotation, index_setScale as setScale, index_setTransform3D as setTransform3D, index_setTranslation as setTranslation, index_setViewport3D as setViewport3D, index_shadeFace as shadeFace, index_testAndSetDepth as testAndSetDepth, index_triangleArea2 as triangleArea2, index_triangleBoundingBox as triangleBoundingBox, index_unprojectVertex as unprojectVertex, index_unregisterMesh as unregisterMesh, index_vec3 as vec3, index_vec3Add as vec3Add, index_vec3Cross as vec3Cross, index_vec3Distance as vec3Distance, index_vec3Dot as vec3Dot, index_vec3Equals as vec3Equals, index_vec3FromArray as vec3FromArray, index_vec3Length as vec3Length, index_vec3LengthSq as vec3LengthSq, index_vec3Lerp as vec3Lerp, index_vec3Negate as vec3Negate, index_vec3Normalize as vec3Normalize, index_vec3Scale as vec3Scale, index_vec3Sub as vec3Sub, index_vec3Zero as vec3Zero, index_viewportOutputSystem as viewportOutputSystem, index_viewportTransform as viewportTransform };
3154
+ }
3155
+
3156
+ export { ObjLoadOptionsSchema as $, type AmbientLight as A, type BackendCapabilities as B, Camera3D as C, type DirectionalLight as D, type EncodedCell as E, EulerAnglesSchema as F, type FrustumPlane as G, type GraphicsCapabilities as H, type HalfBlockConfig as I, HalfBlockConfigSchema as J, type KittyConfig as K, KittyConfigSchema as L, type LineEndpoint as M, LineEndpointSchema as N, type Mat4 as O, Mat4Schema as P, Material3D as Q, type Material3DData as R, Mesh as S, type MeshData as T, type MeshProjection as U, type MouseDragInput as V, MouseInteraction3D as W, type MouseInteraction3DData as X, type ObjFace as Y, type ObjGroup as Z, type ObjLoadOptions as _, AmbientLightSchema as a, createSixelBackend as a$, type ObjParseResult as a0, type ObjVertex as a1, type OrthographicConfig as a2, OrthographicConfigSchema as a3, type PerspectiveConfig as a4, PerspectiveConfigSchema as a5, type PixelBufferConfig as a6, PixelBufferConfigSchema as a7, type PixelFramebuffer as a8, type PlaneMeshOptions as a9, type ViewportProjection as aA, animation3DSystem as aB, backendStore as aC, blendPixel as aD, buildMVP as aE, clearBackendStore as aF, clearFramebuffer as aG, clearFramebufferStore as aH, clearMeshStore as aI, clearMouseInputStore as aJ, clearOutputStore as aK, clearProjectionStore as aL, clipLine as aM, computeBoundingBox as aN, computeFaceNormal as aO, computeFlatShading as aP, computeOutcode as aQ, createBackendByType as aR, createBrailleBackend as aS, createCubeMesh as aT, createCylinderMesh as aU, createHalfBlockBackend as aV, createKittyBackend as aW, createMeshFromArrays as aX, createPixelFramebuffer as aY, createPlaneMesh as aZ, createSextantBackend as a_, PlaneMeshOptionsSchema as aa, type ProjectedVertex as ab, type RGBAColor as ac, RGBAColorSchema as ad, type RendererBackend as ae, type ScreenCoord as af, type SextantConfig as ag, SextantConfigSchema as ah, type SixelConfig as ai, SixelConfigSchema as aj, type SphereMeshOptions as ak, SphereMeshOptionsSchema as al, Transform3D as am, type Transform3DData as an, type TriangleBBox as ao, type TriangleVertex as ap, TriangleVertexSchema as aq, type Vec3 as ar, type Vec3Input as as, Vec3InputSchema as at, Vec3Schema as au, Viewport3D as av, type Viewport3DData as aw, type ViewportConfig as ax, ViewportConfigSchema as ay, type ViewportOutput as az, Animation3D as b, setAnimation3D as b$, createSphereMesh as b0, detectBestBackend as b1, disableMouseInteraction as b2, drawLine as b3, drawLineAA as b4, drawLineColor as b5, drawLineDepth as b6, enableMouseInteraction as b7, extractFrustumPlanes as b8, feedMouseDrag as b9, mat4Determinant as bA, mat4Equals as bB, mat4FromTRS as bC, mat4Identity as bD, mat4Invert as bE, mat4IsIdentity as bF, mat4Multiply as bG, mat4RotateX as bH, mat4RotateY as bI, mat4RotateZ as bJ, mat4Scale as bK, mat4TransformDirection as bL, mat4TransformVec3 as bM, mat4Translate as bN, mat4Transpose as bO, mouseInputStore as bP, mouseInteraction3DSystem as bQ, orthographicMatrix as bR, outputStore as bS, parseObj as bT, perspectiveMatrix as bU, projectVertex as bV, projectionStore as bW, projectionSystem as bX, rasterSystem as bY, registerMesh as bZ, sceneGraphSystem as b_, feedMouseScroll as ba, fillRect as bb, fillTriangle as bc, fillTriangleFlat as bd, framebufferStore as be, getAnimation3D as bf, getCamera3D as bg, getDepth as bh, getMaterial3D as bi, getMesh as bj, getMeshCount as bk, getMeshData as bl, getMouseInteraction3D as bm, getPixel as bn, getProjMatrix as bo, getTransform3D as bp, getViewMatrix as bq, getViewport3D as br, getWorldMatrix as bs, isDirty as bt, isInBounds as bu, isPointInFrustum as bv, isSphereInFrustum as bw, loadObjAsMesh as bx, lookAt as by, markDirty as bz, type Animation3DData as c, setCamera3D as c0, setMaterial3D as c1, setMesh as c2, setPixel as c3, setPixelUnsafe as c4, setRotation as c5, setScale as c6, setTransform3D as c7, setTranslation as c8, setViewport3D as c9, shadeFace as ca, testAndSetDepth as cb, triangleArea2 as cc, triangleBoundingBox as cd, unprojectVertex as ce, unregisterMesh as cf, vec3 as cg, vec3Add as ch, vec3Cross as ci, vec3Distance as cj, vec3Dot as ck, vec3Equals as cl, vec3FromArray as cm, vec3Length as cn, vec3LengthSq as co, vec3Lerp as cp, vec3Negate as cq, vec3Normalize as cr, vec3Scale as cs, vec3Sub as ct, vec3Zero as cu, viewportOutputSystem as cv, viewportTransform as cw, BackendCapabilitiesSchema as d, type BackendPreference as e, BackendPreferenceSchema as f, type BackendSelection as g, BackendSelectionSchema as h, index as i, type BackendType as j, BackendTypeSchema as k, type BrailleConfig as l, BrailleConfigSchema as m, type Camera3DData as n, type ClipRect as o, ClipRectSchema as p, type ClippedLine as q, type CubeMeshOptions as r, CubeMeshOptionsSchema as s, type CylinderMeshOptions as t, CylinderMeshOptionsSchema as u, DirectionalLightSchema as v, EncodedCellSchema as w, type EncodedOutput as x, EncodedOutputSchema as y, type EulerAngles as z };