@galfus/transport-node 0.0.0-stage → 0.31.1-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1835 @@
1
+ /* Automatically generated by Galfus Engine codegen. Do not edit directly. */
2
+ import { existsSync } from 'fs';
3
+ import { dirname, resolve } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { ViewportRect } from '@galfus/transport-types';
6
+ import type {
7
+ AnimationEvent,
8
+ AnimationTarget,
9
+ AnimValue,
10
+ BufferDesc,
11
+ Camera2DDesc,
12
+ Camera3DDesc,
13
+ CameraLookAt3D,
14
+ CameraLookAt3DStateDesc,
15
+ EnvironmentRealm3DDesc,
16
+ GalfusEngine,
17
+ GamepadInfo,
18
+ GpuTextureDesc,
19
+ InstancedModel3DDesc,
20
+ InvocationDesc,
21
+ InvocationFilter,
22
+ Light2DDesc,
23
+ Light3DDesc,
24
+ Material2DDesc,
25
+ Material3DDesc,
26
+ Model3DDesc,
27
+ MultiverseSchedule,
28
+ ParticleEmitter2DDesc,
29
+ ParticleEmitter3DDesc,
30
+ PathCommand,
31
+ PathFollowConfig,
32
+ PathFollowState,
33
+ PlatformCapabilities,
34
+ PlatformEvent,
35
+ Portal3DDesc,
36
+ Shadow2DConfigDesc,
37
+ Shape2DDesc,
38
+ SpatialAudio,
39
+ Sprite2DDesc,
40
+ Svg2DDesc,
41
+ SvgElementRectResult,
42
+ SvgTextLayoutResult,
43
+ TargetDesc,
44
+ TargetTextureBinding,
45
+ TextureUpdateDesc,
46
+ Transform2D,
47
+ Transform2DDesc,
48
+ Transform3D,
49
+ Transform3DDesc,
50
+ TransitionConfig,
51
+ TransitionState,
52
+ WindowConfig
53
+ } from '@galfus/transport-types';
54
+ export type {
55
+ AnimValue,
56
+ AnimationEvent,
57
+ AnimationTarget,
58
+ BufferDesc,
59
+ Camera2DDesc,
60
+ Camera3DDesc,
61
+ CameraLookAt3D,
62
+ CameraLookAt3DStateDesc,
63
+ EnvironmentRealm3DDesc,
64
+ GalfusEngine,
65
+ GamepadInfo,
66
+ GpuTextureDesc,
67
+ InstancedModel3DDesc,
68
+ InvocationDesc,
69
+ InvocationFilter,
70
+ Light2DDesc,
71
+ Light3DDesc,
72
+ Material2DDesc,
73
+ Material3DDesc,
74
+ Model3DDesc,
75
+ MultiverseSchedule,
76
+ ParticleEmitter2DDesc,
77
+ ParticleEmitter3DDesc,
78
+ PathCommand,
79
+ PathFollowConfig,
80
+ PathFollowState,
81
+ PlatformCapabilities,
82
+ PlatformEvent,
83
+ Portal3DDesc,
84
+ Shadow2DConfigDesc,
85
+ Shape2DDesc,
86
+ SpatialAudio,
87
+ Sprite2DDesc,
88
+ Svg2DDesc,
89
+ SvgElementRectResult,
90
+ SvgTextLayoutResult,
91
+ TargetDesc,
92
+ TargetTextureBinding,
93
+ TextureUpdateDesc,
94
+ Transform2D,
95
+ Transform2DDesc,
96
+ Transform3D,
97
+ Transform3DDesc,
98
+ TransitionConfig,
99
+ TransitionState,
100
+ WindowConfig
101
+ };
102
+ export { ViewportRect };
103
+
104
+ import { getArtifactFileName, resolveNativePlatform } from '@galfus/transport-types';
105
+
106
+ function locateAddon(): string {
107
+ const platform = resolveNativePlatform();
108
+ const filename = getArtifactFileName('napi', platform);
109
+ const baseDir =
110
+ typeof import.meta.dir === 'string' ? import.meta.dir : dirname(fileURLToPath(import.meta.url));
111
+ const localDistPath = resolve(baseDir, '../../dist', platform, filename);
112
+ if (existsSync(localDistPath)) {
113
+ return localDistPath;
114
+ }
115
+ throw new Error(
116
+ `[GalfusNode] Node-API addon not found for platform "${platform}" at: ${localDistPath}. Please run "bun run host:sync" to build it.`
117
+ );
118
+ }
119
+
120
+ export class GalfusError extends Error {
121
+ constructor(message: string) {
122
+ super(message);
123
+ this.name = 'GalfusError';
124
+ }
125
+ }
126
+
127
+ export class GalfusNode implements GalfusEngine {
128
+ private _addon: any;
129
+
130
+ constructor(customPath?: string) {
131
+ const path = customPath ?? locateAddon();
132
+ const mod: { exports: any } = { exports: {} };
133
+ process.dlopen(mod, path);
134
+ this._addon = mod.exports;
135
+ }
136
+
137
+ getLastError(): string {
138
+ return typeof this._addon.getLastError === 'function' ? this._addon.getLastError() : '';
139
+ }
140
+
141
+ /** Initializes the global platform coordinator. */
142
+ platformInit(): void {
143
+ if (typeof this._addon.platformInit !== 'function') {
144
+ throw new GalfusError('Node-API method not implemented: platformInit');
145
+ }
146
+ this._addon.platformInit();
147
+ }
148
+
149
+ /** Initializes the global platform coordinator in headless mode. */
150
+ platformInitHeadless(): void {
151
+ if (typeof this._addon.platformInitHeadless !== 'function') {
152
+ throw new GalfusError('Node-API method not implemented: platformInitHeadless');
153
+ }
154
+ this._addon.platformInitHeadless();
155
+ }
156
+
157
+ /** Shuts down and cleans up the platform coordinator. */
158
+ platformShutdown(): void {
159
+ if (typeof this._addon.platformShutdown !== 'function') {
160
+ throw new GalfusError('Node-API method not implemented: platformShutdown');
161
+ }
162
+ this._addon.platformShutdown();
163
+ }
164
+
165
+ /** Retrieves platform environment capabilities as structured data. */
166
+ platformGetCapabilities(): PlatformCapabilities {
167
+ if (typeof this._addon.platformGetCapabilities !== 'function') {
168
+ throw new GalfusError('Node-API method not implemented: platformGetCapabilities');
169
+ }
170
+ return this._addon.platformGetCapabilities();
171
+ }
172
+
173
+ /** Creates a new window or binds a surface from a configuration. */
174
+ windowCreate(config: WindowConfig | string): number {
175
+ if (typeof this._addon.windowCreate !== 'function') {
176
+ throw new GalfusError('Node-API method not implemented: windowCreate');
177
+ }
178
+ return this._addon.windowCreate(typeof config === 'string' ? JSON.parse(config) : config);
179
+ }
180
+
181
+ /** Closes and destroys a window by its logical ID. */
182
+ windowClose(windowId: number): void {
183
+ if (typeof this._addon.windowClose !== 'function') {
184
+ throw new GalfusError('Node-API method not implemented: windowClose');
185
+ }
186
+ this._addon.windowClose(windowId);
187
+ }
188
+
189
+ /** Updates the title bar of a window. */
190
+ windowSetTitle(windowId: number, title: string): void {
191
+ if (typeof this._addon.windowSetTitle !== 'function') {
192
+ throw new GalfusError('Node-API method not implemented: windowSetTitle');
193
+ }
194
+ this._addon.windowSetTitle(windowId, title);
195
+ }
196
+
197
+ /** Requests keyboard focus for a window input surface. */
198
+ windowRequestInputFocus(windowId: number): void {
199
+ if (typeof this._addon.windowRequestInputFocus !== 'function') {
200
+ throw new GalfusError('Node-API method not implemented: windowRequestInputFocus');
201
+ }
202
+ this._addon.windowRequestInputFocus(windowId);
203
+ }
204
+
205
+ /** Configures whether a focused browser window captures Tab key navigation. */
206
+ windowSetTabCapture(windowId: number, enabled: number): void {
207
+ if (typeof this._addon.windowSetTabCapture !== 'function') {
208
+ throw new GalfusError('Node-API method not implemented: windowSetTabCapture');
209
+ }
210
+ this._addon.windowSetTabCapture(windowId, enabled);
211
+ }
212
+
213
+ /** Enables or disables input method composition for a window. */
214
+ windowSetImeAllowed(windowId: number, allowed: number): void {
215
+ if (typeof this._addon.windowSetImeAllowed !== 'function') {
216
+ throw new GalfusError('Node-API method not implemented: windowSetImeAllowed');
217
+ }
218
+ this._addon.windowSetImeAllowed(windowId, allowed);
219
+ }
220
+
221
+ /** Sets the input method candidate area in physical window pixels. */
222
+ windowSetImeCursorArea(
223
+ windowId: number,
224
+ x: number,
225
+ y: number,
226
+ width: number,
227
+ height: number
228
+ ): void {
229
+ if (typeof this._addon.windowSetImeCursorArea !== 'function') {
230
+ throw new GalfusError('Node-API method not implemented: windowSetImeCursorArea');
231
+ }
232
+ this._addon.windowSetImeCursorArea(windowId, x, y, width, height);
233
+ }
234
+
235
+ /** Updates the cursor grab mode (0: None, 1: Confined, 2: Locked). */
236
+ windowSetCursorGrab(windowId: number, mode: number): void {
237
+ if (typeof this._addon.windowSetCursorGrab !== 'function') {
238
+ throw new GalfusError('Node-API method not implemented: windowSetCursorGrab');
239
+ }
240
+ this._addon.windowSetCursorGrab(windowId, mode);
241
+ }
242
+
243
+ /** Updates the visual appearance icon of the cursor. */
244
+ windowSetCursorIcon(windowId: number, icon: number): void {
245
+ if (typeof this._addon.windowSetCursorIcon !== 'function') {
246
+ throw new GalfusError('Node-API method not implemented: windowSetCursorIcon');
247
+ }
248
+ this._addon.windowSetCursorIcon(windowId, icon);
249
+ }
250
+
251
+ /** Sets the visual application icon of a window using raw encoded image bytes (ICO, PNG, WebP, JPEG). */
252
+ windowSetIcon(windowId: number, data: any, dataLen: number): void {
253
+ if (typeof this._addon.windowSetIcon !== 'function') {
254
+ throw new GalfusError('Node-API method not implemented: windowSetIcon');
255
+ }
256
+ this._addon.windowSetIcon(windowId, data, dataLen);
257
+ }
258
+
259
+ /** Pumps platform input events into a fixed-layout batch; its pointers expire on release or shutdown. */
260
+ platformPumpEvents(): PlatformEvent[] {
261
+ if (typeof this._addon.platformPumpEvents !== 'function') {
262
+ throw new GalfusError('Node-API method not implemented: platformPumpEvents');
263
+ }
264
+ return this._addon.platformPumpEvents();
265
+ }
266
+
267
+ /** Releases an event batch and invalidates its native pointer ranges. */
268
+ platformReleaseEventBatch(batchId: number): void {
269
+ if (typeof this._addon.platformReleaseEventBatch !== 'function') {
270
+ throw new GalfusError('Node-API method not implemented: platformReleaseEventBatch');
271
+ }
272
+ this._addon.platformReleaseEventBatch(batchId);
273
+ }
274
+
275
+ /** Retrieves all currently connected gamepads and their capabilities. */
276
+ gamepadGetConnected(): GamepadInfo[] {
277
+ if (typeof this._addon.gamepadGetConnected !== 'function') {
278
+ throw new GalfusError('Node-API method not implemented: gamepadGetConnected');
279
+ }
280
+ return this._addon.gamepadGetConnected();
281
+ }
282
+
283
+ /** Triggers rumble vibration on a connected gamepad. */
284
+ gamepadSetRumble(
285
+ gamepadId: number,
286
+ strongMagnitude: number,
287
+ weakMagnitude: number,
288
+ durationMs: number
289
+ ): void {
290
+ if (typeof this._addon.gamepadSetRumble !== 'function') {
291
+ throw new GalfusError('Node-API method not implemented: gamepadSetRumble');
292
+ }
293
+ this._addon.gamepadSetRumble(gamepadId, strongMagnitude, weakMagnitude, durationMs);
294
+ }
295
+
296
+ /** Loads raw audio data bytes (WAV, MP3, OGG, FLAC) from memory under a host logical ID. */
297
+ audioLoadSound(soundId: number, data: any, dataLen: number): void {
298
+ if (typeof this._addon.audioLoadSound !== 'function') {
299
+ throw new GalfusError('Node-API method not implemented: audioLoadSound');
300
+ }
301
+ this._addon.audioLoadSound(soundId, data, dataLen);
302
+ }
303
+
304
+ /** Plays a registered sound resource and returns its controllable voice ID. */
305
+ audioPlaySound(
306
+ soundId: number,
307
+ volume: number,
308
+ panning: number,
309
+ speed: number,
310
+ looping: boolean
311
+ ): number {
312
+ if (typeof this._addon.audioPlaySound !== 'function') {
313
+ throw new GalfusError('Node-API method not implemented: audioPlaySound');
314
+ }
315
+ return this._addon.audioPlaySound(soundId, volume, panning, speed, looping);
316
+ }
317
+
318
+ /** Plays a spatial sound and returns its controllable voice ID. */
319
+ audioPlaySoundSpatial(soundId: number, spatial: SpatialAudio): number {
320
+ if (typeof this._addon.audioPlaySoundSpatial !== 'function') {
321
+ throw new GalfusError('Node-API method not implemented: audioPlaySoundSpatial');
322
+ }
323
+ return this._addon.audioPlaySoundSpatial(soundId, spatial);
324
+ }
325
+
326
+ /** Updates spatial positioning of an active sound voice relative to a listener ear. */
327
+ audioUpdateSoundSpatial(voiceId: number, spatial: SpatialAudio): void {
328
+ if (typeof this._addon.audioUpdateSoundSpatial !== 'function') {
329
+ throw new GalfusError('Node-API method not implemented: audioUpdateSoundSpatial');
330
+ }
331
+ this._addon.audioUpdateSoundSpatial(voiceId, spatial);
332
+ }
333
+
334
+ /** Pauses a playing sound voice. */
335
+ audioPauseSound(voiceId: number): void {
336
+ if (typeof this._addon.audioPauseSound !== 'function') {
337
+ throw new GalfusError('Node-API method not implemented: audioPauseSound');
338
+ }
339
+ this._addon.audioPauseSound(voiceId);
340
+ }
341
+
342
+ /** Resumes a paused sound voice. */
343
+ audioResumeSound(voiceId: number): void {
344
+ if (typeof this._addon.audioResumeSound !== 'function') {
345
+ throw new GalfusError('Node-API method not implemented: audioResumeSound');
346
+ }
347
+ this._addon.audioResumeSound(voiceId);
348
+ }
349
+
350
+ /** Stops a playing or paused sound voice. */
351
+ audioStopSound(voiceId: number): void {
352
+ if (typeof this._addon.audioStopSound !== 'function') {
353
+ throw new GalfusError('Node-API method not implemented: audioStopSound');
354
+ }
355
+ this._addon.audioStopSound(voiceId);
356
+ }
357
+
358
+ /** Updates the volume of an active sound voice. */
359
+ audioSetVolume(voiceId: number, volume: number): void {
360
+ if (typeof this._addon.audioSetVolume !== 'function') {
361
+ throw new GalfusError('Node-API method not implemented: audioSetVolume');
362
+ }
363
+ this._addon.audioSetVolume(voiceId, volume);
364
+ }
365
+
366
+ /** Updates the panning of an active sound voice. */
367
+ audioSetPanning(voiceId: number, panning: number): void {
368
+ if (typeof this._addon.audioSetPanning !== 'function') {
369
+ throw new GalfusError('Node-API method not implemented: audioSetPanning');
370
+ }
371
+ this._addon.audioSetPanning(voiceId, panning);
372
+ }
373
+
374
+ /** Unloads a registered sound resource from memory. */
375
+ audioUnloadSound(soundId: number): void {
376
+ if (typeof this._addon.audioUnloadSound !== 'function') {
377
+ throw new GalfusError('Node-API method not implemented: audioUnloadSound');
378
+ }
379
+ this._addon.audioUnloadSound(soundId);
380
+ }
381
+
382
+ /** Reads the physical inner size (width, height) of a Platform window into two uint32 out pointers. */
383
+ platformGetWindowSizeRaw(windowId: number, outWidth: any, outHeight: any): void {
384
+ if (typeof this._addon.platformGetWindowSizeRaw !== 'function') {
385
+ throw new GalfusError('Node-API method not implemented: platformGetWindowSizeRaw');
386
+ }
387
+ this._addon.platformGetWindowSizeRaw(windowId, outWidth, outHeight);
388
+ }
389
+
390
+ /** Attaches a platform window to the Multiverse context for surface rendering. */
391
+ multiverseAttachWindow(windowId: number): void {
392
+ if (typeof this._addon.multiverseAttachWindow !== 'function') {
393
+ throw new GalfusError('Node-API method not implemented: multiverseAttachWindow');
394
+ }
395
+ this._addon.multiverseAttachWindow(windowId);
396
+ }
397
+
398
+ /** Registers a new Target in the Multiverse using a TargetDesc descriptor. */
399
+ multiverseCreateTarget(targetId: number, desc: TargetDesc | string): void {
400
+ if (typeof this._addon.multiverseCreateTarget !== 'function') {
401
+ throw new GalfusError('Node-API method not implemented: multiverseCreateTarget');
402
+ }
403
+ this._addon.multiverseCreateTarget(
404
+ targetId,
405
+ typeof desc === 'string' ? JSON.parse(desc) : desc
406
+ );
407
+ }
408
+
409
+ /** Destroys a Target in the Multiverse. */
410
+ multiverseDestroyTarget(targetId: number): void {
411
+ if (typeof this._addon.multiverseDestroyTarget !== 'function') {
412
+ throw new GalfusError('Node-API method not implemented: multiverseDestroyTarget');
413
+ }
414
+ this._addon.multiverseDestroyTarget(targetId);
415
+ }
416
+
417
+ /** Registers a solid color test Realm in the Multiverse. */
418
+ multiverseRegisterColorRealm(realmId: number, r: number, g: number, b: number, a: number): void {
419
+ if (typeof this._addon.multiverseRegisterColorRealm !== 'function') {
420
+ throw new GalfusError('Node-API method not implemented: multiverseRegisterColorRealm');
421
+ }
422
+ this._addon.multiverseRegisterColorRealm(realmId, r, g, b, a);
423
+ }
424
+
425
+ /** Unregisters a Realm from the Multiverse. */
426
+ multiverseUnregisterRealm(realmId: number): void {
427
+ if (typeof this._addon.multiverseUnregisterRealm !== 'function') {
428
+ throw new GalfusError('Node-API method not implemented: multiverseUnregisterRealm');
429
+ }
430
+ this._addon.multiverseUnregisterRealm(realmId);
431
+ }
432
+
433
+ /** Registers a custom WGSL post-processing shader with an ID. */
434
+ multiverseRegisterShader(shaderId: number, source: string): void {
435
+ if (typeof this._addon.multiverseRegisterShader !== 'function') {
436
+ throw new GalfusError('Node-API method not implemented: multiverseRegisterShader');
437
+ }
438
+ this._addon.multiverseRegisterShader(shaderId, source);
439
+ }
440
+
441
+ /** Creates an Invocation in the Multiverse linking a Realm to a Target. */
442
+ multiverseCreateInvocation(invocationId: number, desc: InvocationDesc | string): void {
443
+ if (typeof this._addon.multiverseCreateInvocation !== 'function') {
444
+ throw new GalfusError('Node-API method not implemented: multiverseCreateInvocation');
445
+ }
446
+ this._addon.multiverseCreateInvocation(
447
+ invocationId,
448
+ typeof desc === 'string' ? JSON.parse(desc) : desc
449
+ );
450
+ }
451
+
452
+ /** Destroys an Invocation in the Multiverse. */
453
+ multiverseDestroyInvocation(invocationId: number): void {
454
+ if (typeof this._addon.multiverseDestroyInvocation !== 'function') {
455
+ throw new GalfusError('Node-API method not implemented: multiverseDestroyInvocation');
456
+ }
457
+ this._addon.multiverseDestroyInvocation(invocationId);
458
+ }
459
+
460
+ /** Enables or disables an Invocation in the Multiverse. */
461
+ multiverseSetInvocationEnabled(invocationId: number, enabled: boolean): void {
462
+ if (typeof this._addon.multiverseSetInvocationEnabled !== 'function') {
463
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationEnabled');
464
+ }
465
+ this._addon.multiverseSetInvocationEnabled(invocationId, enabled);
466
+ }
467
+
468
+ /** Updates the presentation order of an Invocation. */
469
+ multiverseSetInvocationZIndex(invocationId: number, zIndex: number): void {
470
+ if (typeof this._addon.multiverseSetInvocationZIndex !== 'function') {
471
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationZIndex');
472
+ }
473
+ this._addon.multiverseSetInvocationZIndex(invocationId, zIndex);
474
+ }
475
+
476
+ /** Updates the viewport rectangle of an existing Invocation. */
477
+ multiverseSetInvocationViewport(invocationId: number, viewport: ViewportRect | string): void {
478
+ if (typeof this._addon.multiverseSetInvocationViewport !== 'function') {
479
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationViewport');
480
+ }
481
+ this._addon.multiverseSetInvocationViewport(
482
+ invocationId,
483
+ typeof viewport === 'string' ? JSON.parse(viewport) : viewport
484
+ );
485
+ }
486
+
487
+ /** Updates the post-process filter chain for an Invocation. */
488
+ multiverseSetInvocationFilters(invocationId: number, filters: InvocationFilter[] | string): void {
489
+ if (typeof this._addon.multiverseSetInvocationFilters !== 'function') {
490
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationFilters');
491
+ }
492
+ this._addon.multiverseSetInvocationFilters(
493
+ invocationId,
494
+ typeof filters === 'string' ? JSON.parse(filters) : filters
495
+ );
496
+ }
497
+
498
+ /** Updates the clear color of an Invocation. */
499
+ multiverseSetInvocationClearColor(
500
+ invocationId: number,
501
+ r: number,
502
+ g: number,
503
+ b: number,
504
+ a: number,
505
+ hasClear: boolean
506
+ ): void {
507
+ if (typeof this._addon.multiverseSetInvocationClearColor !== 'function') {
508
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationClearColor');
509
+ }
510
+ this._addon.multiverseSetInvocationClearColor(invocationId, r, g, b, a, hasClear);
511
+ }
512
+
513
+ /** Updates the camera slot bound to an existing Invocation. */
514
+ multiverseSetInvocationCameraSlot(
515
+ invocationId: number,
516
+ cameraSlot: number,
517
+ hasSlot: boolean
518
+ ): void {
519
+ if (typeof this._addon.multiverseSetInvocationCameraSlot !== 'function') {
520
+ throw new GalfusError('Node-API method not implemented: multiverseSetInvocationCameraSlot');
521
+ }
522
+ this._addon.multiverseSetInvocationCameraSlot(invocationId, cameraSlot, hasSlot);
523
+ }
524
+
525
+ /** Binds a Target output texture to a Realm input slot. */
526
+ multiverseBindTargetTexture(binding: TargetTextureBinding | string): void {
527
+ if (typeof this._addon.multiverseBindTargetTexture !== 'function') {
528
+ throw new GalfusError('Node-API method not implemented: multiverseBindTargetTexture');
529
+ }
530
+ this._addon.multiverseBindTargetTexture(
531
+ typeof binding === 'string' ? JSON.parse(binding) : binding
532
+ );
533
+ }
534
+
535
+ /** Unbinds a Target texture from a Realm input slot. */
536
+ multiverseUnbindTargetTexture(realmId: number, slot: string): void {
537
+ if (typeof this._addon.multiverseUnbindTargetTexture !== 'function') {
538
+ throw new GalfusError('Node-API method not implemented: multiverseUnbindTargetTexture');
539
+ }
540
+ this._addon.multiverseUnbindTargetTexture(realmId, slot);
541
+ }
542
+
543
+ /** Updates the size of a window Target (e.g. on window resize). */
544
+ multiverseUpdateWindowSize(windowId: number, width: number, height: number): void {
545
+ if (typeof this._addon.multiverseUpdateWindowSize !== 'function') {
546
+ throw new GalfusError('Node-API method not implemented: multiverseUpdateWindowSize');
547
+ }
548
+ this._addon.multiverseUpdateWindowSize(windowId, width, height);
549
+ }
550
+
551
+ /** Resolves and returns the Multiverse execution schedule as structured data. */
552
+ multiverseResolve(): MultiverseSchedule {
553
+ if (typeof this._addon.multiverseResolve !== 'function') {
554
+ throw new GalfusError('Node-API method not implemented: multiverseResolve');
555
+ }
556
+ return this._addon.multiverseResolve();
557
+ }
558
+
559
+ /** Dispatches the Multiverse schedule for a frame. */
560
+ multiverseDispatch(frameId: number, deltaTime: number): void {
561
+ if (typeof this._addon.multiverseDispatch !== 'function') {
562
+ throw new GalfusError('Node-API method not implemented: multiverseDispatch');
563
+ }
564
+ this._addon.multiverseDispatch(frameId, deltaTime);
565
+ }
566
+
567
+ /** Clears all entities, materials, and scene resources in a Realm without unregistering it. */
568
+ realmClear(realmId: number): void {
569
+ if (typeof this._addon.realmClear !== 'function') {
570
+ throw new GalfusError('Node-API method not implemented: realmClear');
571
+ }
572
+ this._addon.realmClear(realmId);
573
+ }
574
+
575
+ /** Destroys a Realm, frees all internal GPU resources, and unregisters it from the Multiverse. */
576
+ realmDestroy(realmId: number): void {
577
+ if (typeof this._addon.realmDestroy !== 'function') {
578
+ throw new GalfusError('Node-API method not implemented: realmDestroy');
579
+ }
580
+ this._addon.realmDestroy(realmId);
581
+ }
582
+
583
+ /** Reads the resolved size (width, height) of a Multiverse Target into two uint32 out pointers. */
584
+ multiverseGetTargetSizeRaw(targetId: number, outWidth: any, outHeight: any): void {
585
+ if (typeof this._addon.multiverseGetTargetSizeRaw !== 'function') {
586
+ throw new GalfusError('Node-API method not implemented: multiverseGetTargetSizeRaw');
587
+ }
588
+ this._addon.multiverseGetTargetSizeRaw(targetId, outWidth, outHeight);
589
+ }
590
+
591
+ /** Sets the global Anti-Aliasing mode for the Multiverse. */
592
+ multiverseSetAntiAliasing(mode: string): void {
593
+ if (typeof this._addon.multiverseSetAntiAliasing !== 'function') {
594
+ throw new GalfusError('Node-API method not implemented: multiverseSetAntiAliasing');
595
+ }
596
+ this._addon.multiverseSetAntiAliasing(mode);
597
+ }
598
+
599
+ /** Gets the current global Anti-Aliasing mode of the Multiverse. */
600
+ multiverseGetAntiAliasing(): string {
601
+ if (typeof this._addon.multiverseGetAntiAliasing !== 'function') {
602
+ throw new GalfusError('Node-API method not implemented: multiverseGetAntiAliasing');
603
+ }
604
+ return this._addon.multiverseGetAntiAliasing();
605
+ }
606
+
607
+ /** Allocates and initializes a shared GPU texture under a host logical ID with raw pixel bytes. */
608
+ resourceCreateTexture(
609
+ textureId: number,
610
+ desc: GpuTextureDesc | string,
611
+ data: any,
612
+ dataLen: number
613
+ ): void {
614
+ if (typeof this._addon.resourceCreateTexture !== 'function') {
615
+ throw new GalfusError('Node-API method not implemented: resourceCreateTexture');
616
+ }
617
+ this._addon.resourceCreateTexture(
618
+ textureId,
619
+ typeof desc === 'string' ? JSON.parse(desc) : desc,
620
+ data,
621
+ dataLen
622
+ );
623
+ }
624
+
625
+ /** Updates a sub-rectangle of an existing logical texture with raw pixel bytes. */
626
+ resourceUpdateTexture(
627
+ textureId: number,
628
+ rect: TextureUpdateDesc | string,
629
+ data: any,
630
+ dataLen: number
631
+ ): void {
632
+ if (typeof this._addon.resourceUpdateTexture !== 'function') {
633
+ throw new GalfusError('Node-API method not implemented: resourceUpdateTexture');
634
+ }
635
+ this._addon.resourceUpdateTexture(
636
+ textureId,
637
+ typeof rect === 'string' ? JSON.parse(rect) : rect,
638
+ data,
639
+ dataLen
640
+ );
641
+ }
642
+
643
+ /** Disposes a shared logical texture from GPU memory. */
644
+ resourceDisposeTexture(textureId: number): void {
645
+ if (typeof this._addon.resourceDisposeTexture !== 'function') {
646
+ throw new GalfusError('Node-API method not implemented: resourceDisposeTexture');
647
+ }
648
+ this._addon.resourceDisposeTexture(textureId);
649
+ }
650
+
651
+ /** Allocates and initializes a shared GPU buffer under a host logical ID with raw byte contents. */
652
+ resourceCreateBuffer(
653
+ bufferId: number,
654
+ desc: BufferDesc | string,
655
+ data: any,
656
+ dataLen: number
657
+ ): void {
658
+ if (typeof this._addon.resourceCreateBuffer !== 'function') {
659
+ throw new GalfusError('Node-API method not implemented: resourceCreateBuffer');
660
+ }
661
+ this._addon.resourceCreateBuffer(
662
+ bufferId,
663
+ typeof desc === 'string' ? JSON.parse(desc) : desc,
664
+ data,
665
+ dataLen
666
+ );
667
+ }
668
+
669
+ /** Updates byte contents of an existing logical buffer at a given offset with raw byte contents. */
670
+ resourceUpdateBuffer(bufferId: number, offset: number, data: any, dataLen: number): void {
671
+ if (typeof this._addon.resourceUpdateBuffer !== 'function') {
672
+ throw new GalfusError('Node-API method not implemented: resourceUpdateBuffer');
673
+ }
674
+ this._addon.resourceUpdateBuffer(bufferId, offset, data, dataLen);
675
+ }
676
+
677
+ /** Disposes a shared logical buffer from GPU memory. */
678
+ resourceDisposeBuffer(bufferId: number): void {
679
+ if (typeof this._addon.resourceDisposeBuffer !== 'function') {
680
+ throw new GalfusError('Node-API method not implemented: resourceDisposeBuffer');
681
+ }
682
+ this._addon.resourceDisposeBuffer(bufferId);
683
+ }
684
+
685
+ /** Creates and registers a new 3D Realm in the Multiverse. */
686
+ realm3dCreate(realmId: number): void {
687
+ if (typeof this._addon.realm3dCreate !== 'function') {
688
+ throw new GalfusError('Node-API method not implemented: realm3dCreate');
689
+ }
690
+ this._addon.realm3dCreate(realmId);
691
+ }
692
+
693
+ /** Destroys and unregisters a 3D Realm from the Multiverse. */
694
+ realm3dDestroy(realmId: number): void {
695
+ if (typeof this._addon.realm3dDestroy !== 'function') {
696
+ throw new GalfusError('Node-API method not implemented: realm3dDestroy');
697
+ }
698
+ this._addon.realm3dDestroy(realmId);
699
+ }
700
+
701
+ /** Registers or updates a 3D Camera with its spatial Transform in the 3D Realm. */
702
+ realm3dCreateCamera(
703
+ realmId: number,
704
+ cameraId: number,
705
+ camera: Camera3DDesc | string,
706
+ transform: Transform3DDesc | string
707
+ ): void {
708
+ if (typeof this._addon.realm3dCreateCamera !== 'function') {
709
+ throw new GalfusError('Node-API method not implemented: realm3dCreateCamera');
710
+ }
711
+ this._addon.realm3dCreateCamera(
712
+ realmId,
713
+ cameraId,
714
+ typeof camera === 'string' ? JSON.parse(camera) : camera,
715
+ typeof transform === 'string' ? JSON.parse(transform) : transform
716
+ );
717
+ }
718
+
719
+ /** Updates the transform of an existing Camera in the 3D Realm. */
720
+ realm3dSetCameraTransform(realmId: number, cameraId: number, transform: Transform3D): void {
721
+ if (typeof this._addon.realm3dSetCameraTransform !== 'function') {
722
+ throw new GalfusError('Node-API method not implemented: realm3dSetCameraTransform');
723
+ }
724
+ this._addon.realm3dSetCameraTransform(realmId, cameraId, transform);
725
+ }
726
+
727
+ /** Sets the optional world-space look-at point and up direction of an existing 3D Camera. */
728
+ realm3dSetCameraLookAt(realmId: number, cameraId: number, lookAt: CameraLookAt3D): void {
729
+ if (typeof this._addon.realm3dSetCameraLookAt !== 'function') {
730
+ throw new GalfusError('Node-API method not implemented: realm3dSetCameraLookAt');
731
+ }
732
+ this._addon.realm3dSetCameraLookAt(realmId, cameraId, lookAt);
733
+ }
734
+
735
+ /** Gets the current optional look-at configuration of an existing 3D Camera. */
736
+ realm3dGetCameraLookAt(realmId: number, cameraId: number): CameraLookAt3DStateDesc {
737
+ if (typeof this._addon.realm3dGetCameraLookAt !== 'function') {
738
+ throw new GalfusError('Node-API method not implemented: realm3dGetCameraLookAt');
739
+ }
740
+ return this._addon.realm3dGetCameraLookAt(realmId, cameraId);
741
+ }
742
+
743
+ /** Clears the optional look-at configuration of an existing 3D Camera. */
744
+ realm3dClearCameraLookAt(realmId: number, cameraId: number): void {
745
+ if (typeof this._addon.realm3dClearCameraLookAt !== 'function') {
746
+ throw new GalfusError('Node-API method not implemented: realm3dClearCameraLookAt');
747
+ }
748
+ this._addon.realm3dClearCameraLookAt(realmId, cameraId);
749
+ }
750
+
751
+ /** Registers or updates 3D geometry from canonical binary vertex and index buffers. */
752
+ realm3dCreateGeometry(
753
+ realmId: number,
754
+ geometryId: number,
755
+ topology: number,
756
+ vertexData: Uint8Array,
757
+ vertexDataLen: number,
758
+ indices: Uint32Array,
759
+ indexCount: number
760
+ ): void {
761
+ if (typeof this._addon.realm3dCreateGeometry !== 'function') {
762
+ throw new GalfusError('Node-API method not implemented: realm3dCreateGeometry');
763
+ }
764
+ this._addon.realm3dCreateGeometry(
765
+ realmId,
766
+ geometryId,
767
+ topology,
768
+ vertexData,
769
+ vertexDataLen,
770
+ indices,
771
+ indexCount
772
+ );
773
+ }
774
+
775
+ /** Uploads target-major packed MorphVertex3D records (48 bytes each) for an existing geometry. */
776
+ realm3dSetGeometryMorphTargets(
777
+ realmId: number,
778
+ geometryId: number,
779
+ targetData: Uint8Array,
780
+ targetDataLen: number,
781
+ targetCount: number
782
+ ): void {
783
+ if (typeof this._addon.realm3dSetGeometryMorphTargets !== 'function') {
784
+ throw new GalfusError('Node-API method not implemented: realm3dSetGeometryMorphTargets');
785
+ }
786
+ this._addon.realm3dSetGeometryMorphTargets(
787
+ realmId,
788
+ geometryId,
789
+ targetData,
790
+ targetDataLen,
791
+ targetCount
792
+ );
793
+ }
794
+
795
+ /** Creates a cube primitive centered at the origin. */
796
+ realm3dCreateCube(realmId: number, geometryId: number, size: number): void {
797
+ if (typeof this._addon.realm3dCreateCube !== 'function') {
798
+ throw new GalfusError('Node-API method not implemented: realm3dCreateCube');
799
+ }
800
+ this._addon.realm3dCreateCube(realmId, geometryId, size);
801
+ }
802
+
803
+ /** Creates a horizontal plane primitive centered at the origin. */
804
+ realm3dCreatePlane(realmId: number, geometryId: number, width: number, depth: number): void {
805
+ if (typeof this._addon.realm3dCreatePlane !== 'function') {
806
+ throw new GalfusError('Node-API method not implemented: realm3dCreatePlane');
807
+ }
808
+ this._addon.realm3dCreatePlane(realmId, geometryId, width, depth);
809
+ }
810
+
811
+ /** Creates a vertical quad primitive centered at the origin and facing +Z. */
812
+ realm3dCreateQuad(realmId: number, geometryId: number, width: number, height: number): void {
813
+ if (typeof this._addon.realm3dCreateQuad !== 'function') {
814
+ throw new GalfusError('Node-API method not implemented: realm3dCreateQuad');
815
+ }
816
+ this._addon.realm3dCreateQuad(realmId, geometryId, width, height);
817
+ }
818
+
819
+ /** Creates a UV sphere primitive centered at the origin. */
820
+ realm3dCreateSphere(
821
+ realmId: number,
822
+ geometryId: number,
823
+ radius: number,
824
+ rings: number,
825
+ sectors: number
826
+ ): void {
827
+ if (typeof this._addon.realm3dCreateSphere !== 'function') {
828
+ throw new GalfusError('Node-API method not implemented: realm3dCreateSphere');
829
+ }
830
+ this._addon.realm3dCreateSphere(realmId, geometryId, radius, rings, sectors);
831
+ }
832
+
833
+ /** Creates a cylinder primitive centered at the origin along the Y axis. */
834
+ realm3dCreateCylinder(
835
+ realmId: number,
836
+ geometryId: number,
837
+ radius: number,
838
+ height: number,
839
+ sectors: number
840
+ ): void {
841
+ if (typeof this._addon.realm3dCreateCylinder !== 'function') {
842
+ throw new GalfusError('Node-API method not implemented: realm3dCreateCylinder');
843
+ }
844
+ this._addon.realm3dCreateCylinder(realmId, geometryId, radius, height, sectors);
845
+ }
846
+
847
+ /** Creates a capsule primitive centered at the origin along the Y axis. */
848
+ realm3dCreateCapsule(
849
+ realmId: number,
850
+ geometryId: number,
851
+ radius: number,
852
+ cylinderHeight: number,
853
+ rings: number,
854
+ sectors: number
855
+ ): void {
856
+ if (typeof this._addon.realm3dCreateCapsule !== 'function') {
857
+ throw new GalfusError('Node-API method not implemented: realm3dCreateCapsule');
858
+ }
859
+ this._addon.realm3dCreateCapsule(realmId, geometryId, radius, cylinderHeight, rings, sectors);
860
+ }
861
+
862
+ /** Creates a pyramid primitive centered at the origin with its apex on +Y. */
863
+ realm3dCreatePyramid(
864
+ realmId: number,
865
+ geometryId: number,
866
+ width: number,
867
+ depth: number,
868
+ height: number
869
+ ): void {
870
+ if (typeof this._addon.realm3dCreatePyramid !== 'function') {
871
+ throw new GalfusError('Node-API method not implemented: realm3dCreatePyramid');
872
+ }
873
+ this._addon.realm3dCreatePyramid(realmId, geometryId, width, depth, height);
874
+ }
875
+
876
+ /** Creates a torus primitive centered at the origin in the XZ plane. */
877
+ realm3dCreateTorus(
878
+ realmId: number,
879
+ geometryId: number,
880
+ majorRadius: number,
881
+ minorRadius: number,
882
+ majorSegments: number,
883
+ minorSegments: number
884
+ ): void {
885
+ if (typeof this._addon.realm3dCreateTorus !== 'function') {
886
+ throw new GalfusError('Node-API method not implemented: realm3dCreateTorus');
887
+ }
888
+ this._addon.realm3dCreateTorus(
889
+ realmId,
890
+ geometryId,
891
+ majorRadius,
892
+ minorRadius,
893
+ majorSegments,
894
+ minorSegments
895
+ );
896
+ }
897
+
898
+ /** Registers or updates a 3D Material in the 3D Realm. */
899
+ realm3dCreateMaterial(
900
+ realmId: number,
901
+ materialId: number,
902
+ material: Material3DDesc | string
903
+ ): void {
904
+ if (typeof this._addon.realm3dCreateMaterial !== 'function') {
905
+ throw new GalfusError('Node-API method not implemented: realm3dCreateMaterial');
906
+ }
907
+ this._addon.realm3dCreateMaterial(
908
+ realmId,
909
+ materialId,
910
+ typeof material === 'string' ? JSON.parse(material) : material
911
+ );
912
+ }
913
+
914
+ /** Registers or updates a 3D Model instance in the 3D Realm. */
915
+ realm3dCreateModel(
916
+ realmId: number,
917
+ modelId: number,
918
+ model: Model3DDesc | string,
919
+ transform: Transform3DDesc | string
920
+ ): void {
921
+ if (typeof this._addon.realm3dCreateModel !== 'function') {
922
+ throw new GalfusError('Node-API method not implemented: realm3dCreateModel');
923
+ }
924
+ this._addon.realm3dCreateModel(
925
+ realmId,
926
+ modelId,
927
+ typeof model === 'string' ? JSON.parse(model) : model,
928
+ typeof transform === 'string' ? JSON.parse(transform) : transform
929
+ );
930
+ }
931
+
932
+ /** Updates the transform of an existing Model instance in the 3D Realm. */
933
+ realm3dSetModelTransform(realmId: number, modelId: number, transform: Transform3D): void {
934
+ if (typeof this._addon.realm3dSetModelTransform !== 'function') {
935
+ throw new GalfusError('Node-API method not implemented: realm3dSetModelTransform');
936
+ }
937
+ this._addon.realm3dSetModelTransform(realmId, modelId, transform);
938
+ }
939
+
940
+ /** Registers or updates an Instanced 3D Model in the 3D Realm. */
941
+ realm3dCreateInstancedModel(
942
+ realmId: number,
943
+ instancedModelId: number,
944
+ model: InstancedModel3DDesc | string
945
+ ): void {
946
+ if (typeof this._addon.realm3dCreateInstancedModel !== 'function') {
947
+ throw new GalfusError('Node-API method not implemented: realm3dCreateInstancedModel');
948
+ }
949
+ this._addon.realm3dCreateInstancedModel(
950
+ realmId,
951
+ instancedModelId,
952
+ typeof model === 'string' ? JSON.parse(model) : model
953
+ );
954
+ }
955
+
956
+ /** Uploads packed instance data: 32 f32 values per instance. */
957
+ realm3dSetInstancedModelData(
958
+ realmId: number,
959
+ instancedModelId: number,
960
+ data: Float32Array,
961
+ floatCount: number
962
+ ): void {
963
+ if (typeof this._addon.realm3dSetInstancedModelData !== 'function') {
964
+ throw new GalfusError('Node-API method not implemented: realm3dSetInstancedModelData');
965
+ }
966
+ this._addon.realm3dSetInstancedModelData(realmId, instancedModelId, data, floatCount);
967
+ }
968
+
969
+ /** Uploads the current f32 blend weights for an existing model. */
970
+ realm3dSetModelMorphWeights(
971
+ realmId: number,
972
+ modelId: number,
973
+ weights: Float32Array,
974
+ weightCount: number
975
+ ): void {
976
+ if (typeof this._addon.realm3dSetModelMorphWeights !== 'function') {
977
+ throw new GalfusError('Node-API method not implemented: realm3dSetModelMorphWeights');
978
+ }
979
+ this._addon.realm3dSetModelMorphWeights(realmId, modelId, weights, weightCount);
980
+ }
981
+
982
+ /** Uploads the f32 blend weights shared by every instance in an instanced model batch. */
983
+ realm3dSetInstancedModelMorphWeights(
984
+ realmId: number,
985
+ instancedModelId: number,
986
+ weights: Float32Array,
987
+ weightCount: number
988
+ ): void {
989
+ if (typeof this._addon.realm3dSetInstancedModelMorphWeights !== 'function') {
990
+ throw new GalfusError(
991
+ 'Node-API method not implemented: realm3dSetInstancedModelMorphWeights'
992
+ );
993
+ }
994
+ this._addon.realm3dSetInstancedModelMorphWeights(
995
+ realmId,
996
+ instancedModelId,
997
+ weights,
998
+ weightCount
999
+ );
1000
+ }
1001
+
1002
+ /** Registers or updates a 3D Light in the 3D Realm. */
1003
+ realm3dCreateLight(
1004
+ realmId: number,
1005
+ lightId: number,
1006
+ light: Light3DDesc | string,
1007
+ transform: Transform3DDesc | string
1008
+ ): void {
1009
+ if (typeof this._addon.realm3dCreateLight !== 'function') {
1010
+ throw new GalfusError('Node-API method not implemented: realm3dCreateLight');
1011
+ }
1012
+ this._addon.realm3dCreateLight(
1013
+ realmId,
1014
+ lightId,
1015
+ typeof light === 'string' ? JSON.parse(light) : light,
1016
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1017
+ );
1018
+ }
1019
+
1020
+ /** Updates the transform of an existing Light in the 3D Realm. */
1021
+ realm3dSetLightTransform(realmId: number, lightId: number, transform: Transform3D): void {
1022
+ if (typeof this._addon.realm3dSetLightTransform !== 'function') {
1023
+ throw new GalfusError('Node-API method not implemented: realm3dSetLightTransform');
1024
+ }
1025
+ this._addon.realm3dSetLightTransform(realmId, lightId, transform);
1026
+ }
1027
+
1028
+ /** Sets global atmospheric environment properties for the 3D Realm. */
1029
+ realm3dSetEnvironment(realmId: number, environment: EnvironmentRealm3DDesc | string): void {
1030
+ if (typeof this._addon.realm3dSetEnvironment !== 'function') {
1031
+ throw new GalfusError('Node-API method not implemented: realm3dSetEnvironment');
1032
+ }
1033
+ this._addon.realm3dSetEnvironment(
1034
+ realmId,
1035
+ typeof environment === 'string' ? JSON.parse(environment) : environment
1036
+ );
1037
+ }
1038
+
1039
+ /** Uploads packed 4x4 bone matrices for a model in the 3D Realm. */
1040
+ realm3dUpdateBones(
1041
+ realmId: number,
1042
+ modelId: number,
1043
+ data: Float32Array,
1044
+ floatCount: number
1045
+ ): void {
1046
+ if (typeof this._addon.realm3dUpdateBones !== 'function') {
1047
+ throw new GalfusError('Node-API method not implemented: realm3dUpdateBones');
1048
+ }
1049
+ this._addon.realm3dUpdateBones(realmId, modelId, data, floatCount);
1050
+ }
1051
+
1052
+ /** Queues a 3D debug line segment between start and end with an RGBA color. */
1053
+ realm3dDrawLine(
1054
+ realmId: number,
1055
+ x0: number,
1056
+ y0: number,
1057
+ z0: number,
1058
+ x1: number,
1059
+ y1: number,
1060
+ z1: number,
1061
+ r: number,
1062
+ g: number,
1063
+ b: number,
1064
+ a: number
1065
+ ): void {
1066
+ if (typeof this._addon.realm3dDrawLine !== 'function') {
1067
+ throw new GalfusError('Node-API method not implemented: realm3dDrawLine');
1068
+ }
1069
+ this._addon.realm3dDrawLine(realmId, x0, y0, z0, x1, y1, z1, r, g, b, a);
1070
+ }
1071
+
1072
+ /** Queues a 3D debug Axis-Aligned Bounding Box (AABB) wireframe. */
1073
+ realm3dDrawAabb(
1074
+ realmId: number,
1075
+ minX: number,
1076
+ minY: number,
1077
+ minZ: number,
1078
+ maxX: number,
1079
+ maxY: number,
1080
+ maxZ: number,
1081
+ r: number,
1082
+ g: number,
1083
+ b: number,
1084
+ a: number
1085
+ ): void {
1086
+ if (typeof this._addon.realm3dDrawAabb !== 'function') {
1087
+ throw new GalfusError('Node-API method not implemented: realm3dDrawAabb');
1088
+ }
1089
+ this._addon.realm3dDrawAabb(realmId, minX, minY, minZ, maxX, maxY, maxZ, r, g, b, a);
1090
+ }
1091
+
1092
+ /** Clears any queued debug gizmos in the 3D Realm. */
1093
+ realm3dClearGizmos(realmId: number): void {
1094
+ if (typeof this._addon.realm3dClearGizmos !== 'function') {
1095
+ throw new GalfusError('Node-API method not implemented: realm3dClearGizmos');
1096
+ }
1097
+ this._addon.realm3dClearGizmos(realmId);
1098
+ }
1099
+
1100
+ /** Creates or updates a 3D particle emitter entity with an initial transform. */
1101
+ realm3dCreateParticleEmitter(
1102
+ realmId: number,
1103
+ emitterId: number,
1104
+ emitter: ParticleEmitter3DDesc | string,
1105
+ transform: Transform3DDesc | string
1106
+ ): void {
1107
+ if (typeof this._addon.realm3dCreateParticleEmitter !== 'function') {
1108
+ throw new GalfusError('Node-API method not implemented: realm3dCreateParticleEmitter');
1109
+ }
1110
+ this._addon.realm3dCreateParticleEmitter(
1111
+ realmId,
1112
+ emitterId,
1113
+ typeof emitter === 'string' ? JSON.parse(emitter) : emitter,
1114
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1115
+ );
1116
+ }
1117
+
1118
+ /** Updates the spatial transform of an existing 3D particle emitter. */
1119
+ realm3dSetParticleEmitterTransform(
1120
+ realmId: number,
1121
+ emitterId: number,
1122
+ transform: Transform3D
1123
+ ): void {
1124
+ if (typeof this._addon.realm3dSetParticleEmitterTransform !== 'function') {
1125
+ throw new GalfusError('Node-API method not implemented: realm3dSetParticleEmitterTransform');
1126
+ }
1127
+ this._addon.realm3dSetParticleEmitterTransform(realmId, emitterId, transform);
1128
+ }
1129
+
1130
+ /** Triggers an immediate burst of particles from an existing 3D emitter. */
1131
+ realm3dParticleEmitterBurst(realmId: number, emitterId: number, count: number): void {
1132
+ if (typeof this._addon.realm3dParticleEmitterBurst !== 'function') {
1133
+ throw new GalfusError('Node-API method not implemented: realm3dParticleEmitterBurst');
1134
+ }
1135
+ this._addon.realm3dParticleEmitterBurst(realmId, emitterId, count);
1136
+ }
1137
+
1138
+ /** Destroys an existing 3D particle emitter entity. */
1139
+ realm3dDestroyParticleEmitter(realmId: number, emitterId: number): void {
1140
+ if (typeof this._addon.realm3dDestroyParticleEmitter !== 'function') {
1141
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyParticleEmitter');
1142
+ }
1143
+ this._addon.realm3dDestroyParticleEmitter(realmId, emitterId);
1144
+ }
1145
+
1146
+ /** Registers or updates a 3D optical portal or planar mirror. */
1147
+ realm3dCreatePortal(realmId: number, portalId: number, portal: Portal3DDesc | string): void {
1148
+ if (typeof this._addon.realm3dCreatePortal !== 'function') {
1149
+ throw new GalfusError('Node-API method not implemented: realm3dCreatePortal');
1150
+ }
1151
+ this._addon.realm3dCreatePortal(
1152
+ realmId,
1153
+ portalId,
1154
+ typeof portal === 'string' ? JSON.parse(portal) : portal
1155
+ );
1156
+ }
1157
+
1158
+ /** Sets whether an existing 3D portal or mirror is active. */
1159
+ realm3dSetPortalActive(realmId: number, portalId: number, active: boolean): void {
1160
+ if (typeof this._addon.realm3dSetPortalActive !== 'function') {
1161
+ throw new GalfusError('Node-API method not implemented: realm3dSetPortalActive');
1162
+ }
1163
+ this._addon.realm3dSetPortalActive(realmId, portalId, active);
1164
+ }
1165
+
1166
+ /** Destroys an existing 3D portal or mirror. */
1167
+ realm3dDestroyPortal(realmId: number, portalId: number): void {
1168
+ if (typeof this._addon.realm3dDestroyPortal !== 'function') {
1169
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyPortal');
1170
+ }
1171
+ this._addon.realm3dDestroyPortal(realmId, portalId);
1172
+ }
1173
+
1174
+ /** Destroys an existing 3D camera entity. */
1175
+ realm3dDestroyCamera(realmId: number, cameraId: number): void {
1176
+ if (typeof this._addon.realm3dDestroyCamera !== 'function') {
1177
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyCamera');
1178
+ }
1179
+ this._addon.realm3dDestroyCamera(realmId, cameraId);
1180
+ }
1181
+
1182
+ /** Destroys an existing 3D material entity. */
1183
+ realm3dDestroyMaterial(realmId: number, materialId: number): void {
1184
+ if (typeof this._addon.realm3dDestroyMaterial !== 'function') {
1185
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyMaterial');
1186
+ }
1187
+ this._addon.realm3dDestroyMaterial(realmId, materialId);
1188
+ }
1189
+
1190
+ /** Destroys an existing 3D geometry entity. */
1191
+ realm3dDestroyGeometry(realmId: number, geometryId: number): void {
1192
+ if (typeof this._addon.realm3dDestroyGeometry !== 'function') {
1193
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyGeometry');
1194
+ }
1195
+ this._addon.realm3dDestroyGeometry(realmId, geometryId);
1196
+ }
1197
+
1198
+ /** Destroys an existing 3D model entity. */
1199
+ realm3dDestroyModel(realmId: number, modelId: number): void {
1200
+ if (typeof this._addon.realm3dDestroyModel !== 'function') {
1201
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyModel');
1202
+ }
1203
+ this._addon.realm3dDestroyModel(realmId, modelId);
1204
+ }
1205
+
1206
+ /** Destroys an existing 3D instanced model entity. */
1207
+ realm3dDestroyInstancedModel(realmId: number, instancedModelId: number): void {
1208
+ if (typeof this._addon.realm3dDestroyInstancedModel !== 'function') {
1209
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyInstancedModel');
1210
+ }
1211
+ this._addon.realm3dDestroyInstancedModel(realmId, instancedModelId);
1212
+ }
1213
+
1214
+ /** Destroys an existing 3D light entity. */
1215
+ realm3dDestroyLight(realmId: number, lightId: number): void {
1216
+ if (typeof this._addon.realm3dDestroyLight !== 'function') {
1217
+ throw new GalfusError('Node-API method not implemented: realm3dDestroyLight');
1218
+ }
1219
+ this._addon.realm3dDestroyLight(realmId, lightId);
1220
+ }
1221
+
1222
+ /** Reads the transform of an existing Model instance. */
1223
+ realm3dGetModelTransform(realmId: number, modelId: number): Transform3D {
1224
+ if (typeof this._addon.realm3dGetModelTransform !== 'function') {
1225
+ throw new GalfusError('Node-API method not implemented: realm3dGetModelTransform');
1226
+ }
1227
+ return this._addon.realm3dGetModelTransform(realmId, modelId);
1228
+ }
1229
+
1230
+ /** Reads the transform of an existing Camera instance. */
1231
+ realm3dGetCameraTransform(realmId: number, cameraId: number): Transform3D {
1232
+ if (typeof this._addon.realm3dGetCameraTransform !== 'function') {
1233
+ throw new GalfusError('Node-API method not implemented: realm3dGetCameraTransform');
1234
+ }
1235
+ return this._addon.realm3dGetCameraTransform(realmId, cameraId);
1236
+ }
1237
+
1238
+ /** Reads the world-space bounding box (min, max) of a 3D model into two 3-float out buffers. */
1239
+ realm3dGetModelAabbRaw(realmId: number, modelId: number, outMin: any, outMax: any): void {
1240
+ if (typeof this._addon.realm3dGetModelAabbRaw !== 'function') {
1241
+ throw new GalfusError('Node-API method not implemented: realm3dGetModelAabbRaw');
1242
+ }
1243
+ this._addon.realm3dGetModelAabbRaw(realmId, modelId, outMin, outMax);
1244
+ }
1245
+
1246
+ /** Creates and registers a new 2D Realm in the Multiverse. */
1247
+ realm2dCreate(realmId: number): void {
1248
+ if (typeof this._addon.realm2dCreate !== 'function') {
1249
+ throw new GalfusError('Node-API method not implemented: realm2dCreate');
1250
+ }
1251
+ this._addon.realm2dCreate(realmId);
1252
+ }
1253
+
1254
+ /** Destroys and unregisters a 2D Realm from the Multiverse. */
1255
+ realm2dDestroy(realmId: number): void {
1256
+ if (typeof this._addon.realm2dDestroy !== 'function') {
1257
+ throw new GalfusError('Node-API method not implemented: realm2dDestroy');
1258
+ }
1259
+ this._addon.realm2dDestroy(realmId);
1260
+ }
1261
+
1262
+ /** Creates or updates a 2D camera with an initial transform. */
1263
+ realm2dCreateCamera(
1264
+ realmId: number,
1265
+ cameraId: number,
1266
+ camera: Camera2DDesc | string,
1267
+ transform: Transform2DDesc | string
1268
+ ): void {
1269
+ if (typeof this._addon.realm2dCreateCamera !== 'function') {
1270
+ throw new GalfusError('Node-API method not implemented: realm2dCreateCamera');
1271
+ }
1272
+ this._addon.realm2dCreateCamera(
1273
+ realmId,
1274
+ cameraId,
1275
+ typeof camera === 'string' ? JSON.parse(camera) : camera,
1276
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1277
+ );
1278
+ }
1279
+
1280
+ /** Updates the spatial transform of an existing 2D camera. */
1281
+ realm2dSetCameraTransform(realmId: number, cameraId: number, transform: Transform2D): void {
1282
+ if (typeof this._addon.realm2dSetCameraTransform !== 'function') {
1283
+ throw new GalfusError('Node-API method not implemented: realm2dSetCameraTransform');
1284
+ }
1285
+ this._addon.realm2dSetCameraTransform(realmId, cameraId, transform);
1286
+ }
1287
+
1288
+ /** Creates or updates a 2D material definition. */
1289
+ realm2dCreateMaterial(
1290
+ realmId: number,
1291
+ materialId: number,
1292
+ material: Material2DDesc | string
1293
+ ): void {
1294
+ if (typeof this._addon.realm2dCreateMaterial !== 'function') {
1295
+ throw new GalfusError('Node-API method not implemented: realm2dCreateMaterial');
1296
+ }
1297
+ this._addon.realm2dCreateMaterial(
1298
+ realmId,
1299
+ materialId,
1300
+ typeof material === 'string' ? JSON.parse(material) : material
1301
+ );
1302
+ }
1303
+
1304
+ /** Creates or updates a 2D instanced sprite with an initial transform. */
1305
+ realm2dCreateSprite(
1306
+ realmId: number,
1307
+ spriteId: number,
1308
+ sprite: Sprite2DDesc | string,
1309
+ transform: Transform2DDesc | string
1310
+ ): void {
1311
+ if (typeof this._addon.realm2dCreateSprite !== 'function') {
1312
+ throw new GalfusError('Node-API method not implemented: realm2dCreateSprite');
1313
+ }
1314
+ this._addon.realm2dCreateSprite(
1315
+ realmId,
1316
+ spriteId,
1317
+ typeof sprite === 'string' ? JSON.parse(sprite) : sprite,
1318
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1319
+ );
1320
+ }
1321
+
1322
+ /** Updates the spatial transform of an existing 2D sprite. */
1323
+ realm2dSetSpriteTransform(realmId: number, spriteId: number, transform: Transform2D): void {
1324
+ if (typeof this._addon.realm2dSetSpriteTransform !== 'function') {
1325
+ throw new GalfusError('Node-API method not implemented: realm2dSetSpriteTransform');
1326
+ }
1327
+ this._addon.realm2dSetSpriteTransform(realmId, spriteId, transform);
1328
+ }
1329
+
1330
+ /** Creates or updates a 2D vector shape (Rectangle, Circle, Polygon) with an initial transform. */
1331
+ realm2dCreateShape(
1332
+ realmId: number,
1333
+ shapeId: number,
1334
+ shape: Shape2DDesc | string,
1335
+ transform: Transform2DDesc | string
1336
+ ): void {
1337
+ if (typeof this._addon.realm2dCreateShape !== 'function') {
1338
+ throw new GalfusError('Node-API method not implemented: realm2dCreateShape');
1339
+ }
1340
+ this._addon.realm2dCreateShape(
1341
+ realmId,
1342
+ shapeId,
1343
+ typeof shape === 'string' ? JSON.parse(shape) : shape,
1344
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1345
+ );
1346
+ }
1347
+
1348
+ /** Updates the spatial transform of an existing 2D shape. */
1349
+ realm2dSetShapeTransform(realmId: number, shapeId: number, transform: Transform2D): void {
1350
+ if (typeof this._addon.realm2dSetShapeTransform !== 'function') {
1351
+ throw new GalfusError('Node-API method not implemented: realm2dSetShapeTransform');
1352
+ }
1353
+ this._addon.realm2dSetShapeTransform(realmId, shapeId, transform);
1354
+ }
1355
+
1356
+ /** Creates or updates a 2D point light with an initial transform. */
1357
+ realm2dCreateLight(
1358
+ realmId: number,
1359
+ lightId: number,
1360
+ light: Light2DDesc | string,
1361
+ transform: Transform2DDesc | string
1362
+ ): void {
1363
+ if (typeof this._addon.realm2dCreateLight !== 'function') {
1364
+ throw new GalfusError('Node-API method not implemented: realm2dCreateLight');
1365
+ }
1366
+ this._addon.realm2dCreateLight(
1367
+ realmId,
1368
+ lightId,
1369
+ typeof light === 'string' ? JSON.parse(light) : light,
1370
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1371
+ );
1372
+ }
1373
+
1374
+ /** Updates the spatial transform of an existing 2D light. */
1375
+ realm2dSetLightTransform(realmId: number, lightId: number, transform: Transform2D): void {
1376
+ if (typeof this._addon.realm2dSetLightTransform !== 'function') {
1377
+ throw new GalfusError('Node-API method not implemented: realm2dSetLightTransform');
1378
+ }
1379
+ this._addon.realm2dSetLightTransform(realmId, lightId, transform);
1380
+ }
1381
+
1382
+ /** Updates global 2D polar shadow parameters. */
1383
+ realm2dSetShadowConfig(realmId: number, config: Shadow2DConfigDesc | string): void {
1384
+ if (typeof this._addon.realm2dSetShadowConfig !== 'function') {
1385
+ throw new GalfusError('Node-API method not implemented: realm2dSetShadowConfig');
1386
+ }
1387
+ this._addon.realm2dSetShadowConfig(
1388
+ realmId,
1389
+ typeof config === 'string' ? JSON.parse(config) : config
1390
+ );
1391
+ }
1392
+
1393
+ /** Creates or updates a 2D particle emitter entity with an initial transform. */
1394
+ realm2dCreateParticleEmitter(
1395
+ realmId: number,
1396
+ emitterId: number,
1397
+ emitter: ParticleEmitter2DDesc | string,
1398
+ transform: Transform2DDesc | string
1399
+ ): void {
1400
+ if (typeof this._addon.realm2dCreateParticleEmitter !== 'function') {
1401
+ throw new GalfusError('Node-API method not implemented: realm2dCreateParticleEmitter');
1402
+ }
1403
+ this._addon.realm2dCreateParticleEmitter(
1404
+ realmId,
1405
+ emitterId,
1406
+ typeof emitter === 'string' ? JSON.parse(emitter) : emitter,
1407
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1408
+ );
1409
+ }
1410
+
1411
+ /** Updates the spatial transform of an existing 2D particle emitter. */
1412
+ realm2dSetParticleEmitterTransform(
1413
+ realmId: number,
1414
+ emitterId: number,
1415
+ transform: Transform2D
1416
+ ): void {
1417
+ if (typeof this._addon.realm2dSetParticleEmitterTransform !== 'function') {
1418
+ throw new GalfusError('Node-API method not implemented: realm2dSetParticleEmitterTransform');
1419
+ }
1420
+ this._addon.realm2dSetParticleEmitterTransform(realmId, emitterId, transform);
1421
+ }
1422
+
1423
+ /** Triggers an immediate burst of particles from an existing 2D emitter. */
1424
+ realm2dParticleEmitterBurst(realmId: number, emitterId: number, count: number): void {
1425
+ if (typeof this._addon.realm2dParticleEmitterBurst !== 'function') {
1426
+ throw new GalfusError('Node-API method not implemented: realm2dParticleEmitterBurst');
1427
+ }
1428
+ this._addon.realm2dParticleEmitterBurst(realmId, emitterId, count);
1429
+ }
1430
+
1431
+ /** Destroys an existing 2D particle emitter entity. */
1432
+ realm2dDestroyParticleEmitter(realmId: number, emitterId: number): void {
1433
+ if (typeof this._addon.realm2dDestroyParticleEmitter !== 'function') {
1434
+ throw new GalfusError('Node-API method not implemented: realm2dDestroyParticleEmitter');
1435
+ }
1436
+ this._addon.realm2dDestroyParticleEmitter(realmId, emitterId);
1437
+ }
1438
+
1439
+ /** Destroys an existing 2D camera entity. */
1440
+ realm2dDestroyCamera(realmId: number, cameraId: number): void {
1441
+ if (typeof this._addon.realm2dDestroyCamera !== 'function') {
1442
+ throw new GalfusError('Node-API method not implemented: realm2dDestroyCamera');
1443
+ }
1444
+ this._addon.realm2dDestroyCamera(realmId, cameraId);
1445
+ }
1446
+
1447
+ /** Destroys an existing 2D material entity. */
1448
+ realm2dDestroyMaterial(realmId: number, materialId: number): void {
1449
+ if (typeof this._addon.realm2dDestroyMaterial !== 'function') {
1450
+ throw new GalfusError('Node-API method not implemented: realm2dDestroyMaterial');
1451
+ }
1452
+ this._addon.realm2dDestroyMaterial(realmId, materialId);
1453
+ }
1454
+
1455
+ /** Destroys an existing 2D sprite entity. */
1456
+ realm2dDestroySprite(realmId: number, spriteId: number): void {
1457
+ if (typeof this._addon.realm2dDestroySprite !== 'function') {
1458
+ throw new GalfusError('Node-API method not implemented: realm2dDestroySprite');
1459
+ }
1460
+ this._addon.realm2dDestroySprite(realmId, spriteId);
1461
+ }
1462
+
1463
+ /** Destroys an existing 2D shape entity. */
1464
+ realm2dDestroyShape(realmId: number, shapeId: number): void {
1465
+ if (typeof this._addon.realm2dDestroyShape !== 'function') {
1466
+ throw new GalfusError('Node-API method not implemented: realm2dDestroyShape');
1467
+ }
1468
+ this._addon.realm2dDestroyShape(realmId, shapeId);
1469
+ }
1470
+
1471
+ /** Destroys an existing 2D light entity. */
1472
+ realm2dDestroyLight(realmId: number, lightId: number): void {
1473
+ if (typeof this._addon.realm2dDestroyLight !== 'function') {
1474
+ throw new GalfusError('Node-API method not implemented: realm2dDestroyLight');
1475
+ }
1476
+ this._addon.realm2dDestroyLight(realmId, lightId);
1477
+ }
1478
+
1479
+ /** Reads the transform of an existing Sprite instance. */
1480
+ realm2dGetSpriteTransform(realmId: number, spriteId: number): Transform2D {
1481
+ if (typeof this._addon.realm2dGetSpriteTransform !== 'function') {
1482
+ throw new GalfusError('Node-API method not implemented: realm2dGetSpriteTransform');
1483
+ }
1484
+ return this._addon.realm2dGetSpriteTransform(realmId, spriteId);
1485
+ }
1486
+
1487
+ /** Reads the transform of an existing Camera instance. */
1488
+ realm2dGetCameraTransform(realmId: number, cameraId: number): Transform2D {
1489
+ if (typeof this._addon.realm2dGetCameraTransform !== 'function') {
1490
+ throw new GalfusError('Node-API method not implemented: realm2dGetCameraTransform');
1491
+ }
1492
+ return this._addon.realm2dGetCameraTransform(realmId, cameraId);
1493
+ }
1494
+
1495
+ /** Creates or updates a 2D SVG vector entity with an initial transform. */
1496
+ realm2dCreateSvg(
1497
+ realmId: number,
1498
+ svgId: number,
1499
+ svg: Svg2DDesc | string,
1500
+ transform: Transform2DDesc | string
1501
+ ): void {
1502
+ if (typeof this._addon.realm2dCreateSvg !== 'function') {
1503
+ throw new GalfusError('Node-API method not implemented: realm2dCreateSvg');
1504
+ }
1505
+ this._addon.realm2dCreateSvg(
1506
+ realmId,
1507
+ svgId,
1508
+ typeof svg === 'string' ? JSON.parse(svg) : svg,
1509
+ typeof transform === 'string' ? JSON.parse(transform) : transform
1510
+ );
1511
+ }
1512
+
1513
+ /** Reads the geometric bounds of an SVG element. */
1514
+ realm2dGetSvgElementRect(
1515
+ realmId: number,
1516
+ svgId: number,
1517
+ elementId: string
1518
+ ): SvgElementRectResult {
1519
+ if (typeof this._addon.realm2dGetSvgElementRect !== 'function') {
1520
+ throw new GalfusError('Node-API method not implemented: realm2dGetSvgElementRect');
1521
+ }
1522
+ return this._addon.realm2dGetSvgElementRect(realmId, svgId, elementId);
1523
+ }
1524
+
1525
+ /** Reads the shaped text clusters of an SVG text element. */
1526
+ realm2dGetSvgTextLayout(realmId: number, svgId: number, elementId: string): SvgTextLayoutResult {
1527
+ if (typeof this._addon.realm2dGetSvgTextLayout !== 'function') {
1528
+ throw new GalfusError('Node-API method not implemented: realm2dGetSvgTextLayout');
1529
+ }
1530
+ return this._addon.realm2dGetSvgTextLayout(realmId, svgId, elementId);
1531
+ }
1532
+
1533
+ /** Replaces the complete source XML markup string of an existing SVG entity. */
1534
+ realm2dSetSvgSource(realmId: number, svgId: number, source: string): void {
1535
+ if (typeof this._addon.realm2dSetSvgSource !== 'function') {
1536
+ throw new GalfusError('Node-API method not implemented: realm2dSetSvgSource');
1537
+ }
1538
+ this._addon.realm2dSetSvgSource(realmId, svgId, source);
1539
+ }
1540
+
1541
+ /** Sets or overwrites an XML attribute on the matching element ID in the SVG. */
1542
+ realm2dSetSvgAttribute(
1543
+ realmId: number,
1544
+ svgId: number,
1545
+ elementId: string,
1546
+ name: string,
1547
+ value: string
1548
+ ): void {
1549
+ if (typeof this._addon.realm2dSetSvgAttribute !== 'function') {
1550
+ throw new GalfusError('Node-API method not implemented: realm2dSetSvgAttribute');
1551
+ }
1552
+ this._addon.realm2dSetSvgAttribute(realmId, svgId, elementId, name, value);
1553
+ }
1554
+
1555
+ /** Removes an XML attribute from the matching element ID in the SVG. */
1556
+ realm2dRemoveSvgAttribute(realmId: number, svgId: number, elementId: string, name: string): void {
1557
+ if (typeof this._addon.realm2dRemoveSvgAttribute !== 'function') {
1558
+ throw new GalfusError('Node-API method not implemented: realm2dRemoveSvgAttribute');
1559
+ }
1560
+ this._addon.realm2dRemoveSvgAttribute(realmId, svgId, elementId, name);
1561
+ }
1562
+
1563
+ /** Updates the inner text content of the matching element ID in the SVG. */
1564
+ realm2dSetSvgText(realmId: number, svgId: number, elementId: string, text: string): void {
1565
+ if (typeof this._addon.realm2dSetSvgText !== 'function') {
1566
+ throw new GalfusError('Node-API method not implemented: realm2dSetSvgText');
1567
+ }
1568
+ this._addon.realm2dSetSvgText(realmId, svgId, elementId, text);
1569
+ }
1570
+
1571
+ /** Updates the spatial transform of an existing SVG entity. */
1572
+ realm2dSetSvgTransform(realmId: number, svgId: number, transform: Transform2D): void {
1573
+ if (typeof this._addon.realm2dSetSvgTransform !== 'function') {
1574
+ throw new GalfusError('Node-API method not implemented: realm2dSetSvgTransform');
1575
+ }
1576
+ this._addon.realm2dSetSvgTransform(realmId, svgId, transform);
1577
+ }
1578
+
1579
+ /** Reads the transform of an existing SVG entity. */
1580
+ realm2dGetSvgTransform(realmId: number, svgId: number): Transform2D {
1581
+ if (typeof this._addon.realm2dGetSvgTransform !== 'function') {
1582
+ throw new GalfusError('Node-API method not implemented: realm2dGetSvgTransform');
1583
+ }
1584
+ return this._addon.realm2dGetSvgTransform(realmId, svgId);
1585
+ }
1586
+
1587
+ /** Destroys an existing 2D SVG entity. */
1588
+ realm2dDestroySvg(realmId: number, svgId: number): void {
1589
+ if (typeof this._addon.realm2dDestroySvg !== 'function') {
1590
+ throw new GalfusError('Node-API method not implemented: realm2dDestroySvg');
1591
+ }
1592
+ this._addon.realm2dDestroySvg(realmId, svgId);
1593
+ }
1594
+
1595
+ /** Registers raw TTF/OTF font binary data from memory (zero filesystem access). Returns the detected font family name. */
1596
+ realm2dLoadFontData(realmId: number, data: any, dataLen: number): string {
1597
+ if (typeof this._addon.realm2dLoadFontData !== 'function') {
1598
+ throw new GalfusError('Node-API method not implemented: realm2dLoadFontData');
1599
+ }
1600
+ return this._addon.realm2dLoadFontData(realmId, data, dataLen);
1601
+ }
1602
+
1603
+ /** Creates a new property transition with an initial value and timing configuration. */
1604
+ animationCreateTransition(
1605
+ transitionId: number,
1606
+ initialValue: AnimValue | string,
1607
+ config?: TransitionConfig | string
1608
+ ): void {
1609
+ if (typeof this._addon.animationCreateTransition !== 'function') {
1610
+ throw new GalfusError('Node-API method not implemented: animationCreateTransition');
1611
+ }
1612
+ this._addon.animationCreateTransition(
1613
+ transitionId,
1614
+ typeof initialValue === 'string' ? JSON.parse(initialValue) : initialValue,
1615
+ typeof config === 'string' ? JSON.parse(config) : config
1616
+ );
1617
+ }
1618
+
1619
+ /** Binds an existing transition to a realm entity or multiverse property target. */
1620
+ animationBindTarget(transitionId: number, target: AnimationTarget | string): void {
1621
+ if (typeof this._addon.animationBindTarget !== 'function') {
1622
+ throw new GalfusError('Node-API method not implemented: animationBindTarget');
1623
+ }
1624
+ this._addon.animationBindTarget(
1625
+ transitionId,
1626
+ typeof target === 'string' ? JSON.parse(target) : target
1627
+ );
1628
+ }
1629
+
1630
+ /** Unbinds a target from a transition and releases its property lock. */
1631
+ animationUnbindTarget(transitionId: number): void {
1632
+ if (typeof this._addon.animationUnbindTarget !== 'function') {
1633
+ throw new GalfusError('Node-API method not implemented: animationUnbindTarget');
1634
+ }
1635
+ this._addon.animationUnbindTarget(transitionId);
1636
+ }
1637
+
1638
+ /** Triggers a smooth transition from the live value towards a new target value. */
1639
+ animationTransitionTo(
1640
+ transitionId: number,
1641
+ targetValue: AnimValue | string,
1642
+ config?: TransitionConfig | string
1643
+ ): void {
1644
+ if (typeof this._addon.animationTransitionTo !== 'function') {
1645
+ throw new GalfusError('Node-API method not implemented: animationTransitionTo');
1646
+ }
1647
+ this._addon.animationTransitionTo(
1648
+ transitionId,
1649
+ typeof targetValue === 'string' ? JSON.parse(targetValue) : targetValue,
1650
+ typeof config === 'string' ? JSON.parse(config) : config
1651
+ );
1652
+ }
1653
+
1654
+ /** Fast-path helper creating a scalar transition. */
1655
+ animationCreateScalarTransition(
1656
+ transitionId: number,
1657
+ initialScalar: number,
1658
+ duration: number,
1659
+ delay: number,
1660
+ easingId: number
1661
+ ): void {
1662
+ if (typeof this._addon.animationCreateScalarTransition !== 'function') {
1663
+ throw new GalfusError('Node-API method not implemented: animationCreateScalarTransition');
1664
+ }
1665
+ this._addon.animationCreateScalarTransition(
1666
+ transitionId,
1667
+ initialScalar,
1668
+ duration,
1669
+ delay,
1670
+ easingId
1671
+ );
1672
+ }
1673
+
1674
+ /** Fast-path helper smoothly transitioning a scalar property. */
1675
+ animationTransitionToScalar(
1676
+ transitionId: number,
1677
+ targetScalar: number,
1678
+ duration: number,
1679
+ delay: number,
1680
+ easingId: number
1681
+ ): void {
1682
+ if (typeof this._addon.animationTransitionToScalar !== 'function') {
1683
+ throw new GalfusError('Node-API method not implemented: animationTransitionToScalar');
1684
+ }
1685
+ this._addon.animationTransitionToScalar(transitionId, targetScalar, duration, delay, easingId);
1686
+ }
1687
+
1688
+ /** Fast-path transitioning a 3D Transform from 10 raw floats (pos, quat, scale). */
1689
+ animationTransitionToTransform3d(
1690
+ transitionId: number,
1691
+ floats: any,
1692
+ duration: number,
1693
+ delay: number,
1694
+ easingId: number
1695
+ ): void {
1696
+ if (typeof this._addon.animationTransitionToTransform3d !== 'function') {
1697
+ throw new GalfusError('Node-API method not implemented: animationTransitionToTransform3d');
1698
+ }
1699
+ this._addon.animationTransitionToTransform3d(transitionId, floats, duration, delay, easingId);
1700
+ }
1701
+
1702
+ /** Fast-path transitioning a 2D Transform from 6 raw floats (pos, rot, scale, z_layer). */
1703
+ animationTransitionToTransform2d(
1704
+ transitionId: number,
1705
+ floats: any,
1706
+ duration: number,
1707
+ delay: number,
1708
+ easingId: number
1709
+ ): void {
1710
+ if (typeof this._addon.animationTransitionToTransform2d !== 'function') {
1711
+ throw new GalfusError('Node-API method not implemented: animationTransitionToTransform2d');
1712
+ }
1713
+ this._addon.animationTransitionToTransform2d(transitionId, floats, duration, delay, easingId);
1714
+ }
1715
+
1716
+ /** Queries the current playback status and progress of a transition. */
1717
+ animationGetState(transitionId: number): TransitionState {
1718
+ if (typeof this._addon.animationGetState !== 'function') {
1719
+ throw new GalfusError('Node-API method not implemented: animationGetState');
1720
+ }
1721
+ return this._addon.animationGetState(transitionId);
1722
+ }
1723
+
1724
+ /** Queries the current evaluated value of a transition. */
1725
+ animationGetValue(transitionId: number): AnimValue {
1726
+ if (typeof this._addon.animationGetValue !== 'function') {
1727
+ throw new GalfusError('Node-API method not implemented: animationGetValue');
1728
+ }
1729
+ return this._addon.animationGetValue(transitionId);
1730
+ }
1731
+
1732
+ /** Destroys an animation transition by ID. */
1733
+ animationDestroyTransition(transitionId: number): void {
1734
+ if (typeof this._addon.animationDestroyTransition !== 'function') {
1735
+ throw new GalfusError('Node-API method not implemented: animationDestroyTransition');
1736
+ }
1737
+ this._addon.animationDestroyTransition(transitionId);
1738
+ }
1739
+
1740
+ /** Advances all active animation transitions by dt seconds and applies updates to Multiverse. */
1741
+ animationStep(dt: number): void {
1742
+ if (typeof this._addon.animationStep !== 'function') {
1743
+ throw new GalfusError('Node-API method not implemented: animationStep');
1744
+ }
1745
+ this._addon.animationStep(dt);
1746
+ }
1747
+
1748
+ /** Drains and returns all queued animation lifecycle events. */
1749
+ animationPumpEvents(): AnimationEvent[] {
1750
+ if (typeof this._addon.animationPumpEvents !== 'function') {
1751
+ throw new GalfusError('Node-API method not implemented: animationPumpEvents');
1752
+ }
1753
+ return this._addon.animationPumpEvents();
1754
+ }
1755
+
1756
+ /** Writes directly to a custom animation channel. */
1757
+ animationSetCustomChannel(channelId: number, value: AnimValue | string): void {
1758
+ if (typeof this._addon.animationSetCustomChannel !== 'function') {
1759
+ throw new GalfusError('Node-API method not implemented: animationSetCustomChannel');
1760
+ }
1761
+ this._addon.animationSetCustomChannel(
1762
+ channelId,
1763
+ typeof value === 'string' ? JSON.parse(value) : value
1764
+ );
1765
+ }
1766
+
1767
+ /** Reads directly from a custom animation channel. */
1768
+ animationGetCustomChannel(channelId: number): AnimValue {
1769
+ if (typeof this._addon.animationGetCustomChannel !== 'function') {
1770
+ throw new GalfusError('Node-API method not implemented: animationGetCustomChannel');
1771
+ }
1772
+ return this._addon.animationGetCustomChannel(channelId);
1773
+ }
1774
+
1775
+ /** Creates a new path follower traversing a declarative SVG-like path. */
1776
+ animationCreatePathFollow(
1777
+ pathId: number,
1778
+ commands: PathCommand[] | string,
1779
+ config?: PathFollowConfig | string
1780
+ ): void {
1781
+ if (typeof this._addon.animationCreatePathFollow !== 'function') {
1782
+ throw new GalfusError('Node-API method not implemented: animationCreatePathFollow');
1783
+ }
1784
+ this._addon.animationCreatePathFollow(
1785
+ pathId,
1786
+ typeof commands === 'string' ? JSON.parse(commands) : commands,
1787
+ typeof config === 'string' ? JSON.parse(config) : config
1788
+ );
1789
+ }
1790
+
1791
+ /** Binds a path follower to an entity property target with conflict locking. */
1792
+ animationBindPathFollowTarget(pathId: number, target: AnimationTarget | string): void {
1793
+ if (typeof this._addon.animationBindPathFollowTarget !== 'function') {
1794
+ throw new GalfusError('Node-API method not implemented: animationBindPathFollowTarget');
1795
+ }
1796
+ this._addon.animationBindPathFollowTarget(
1797
+ pathId,
1798
+ typeof target === 'string' ? JSON.parse(target) : target
1799
+ );
1800
+ }
1801
+
1802
+ /** Unbinds a target from a path follower and releases its property lock. */
1803
+ animationUnbindPathFollowTarget(pathId: number): void {
1804
+ if (typeof this._addon.animationUnbindPathFollowTarget !== 'function') {
1805
+ throw new GalfusError('Node-API method not implemented: animationUnbindPathFollowTarget');
1806
+ }
1807
+ this._addon.animationUnbindPathFollowTarget(pathId);
1808
+ }
1809
+
1810
+ /** Destroys a path follower by ID. */
1811
+ animationDestroyPathFollow(pathId: number): void {
1812
+ if (typeof this._addon.animationDestroyPathFollow !== 'function') {
1813
+ throw new GalfusError('Node-API method not implemented: animationDestroyPathFollow');
1814
+ }
1815
+ this._addon.animationDestroyPathFollow(pathId);
1816
+ }
1817
+
1818
+ /** Queries the current playback status and progress of a path follower. */
1819
+ animationGetPathFollowState(pathId: number): PathFollowState {
1820
+ if (typeof this._addon.animationGetPathFollowState !== 'function') {
1821
+ throw new GalfusError('Node-API method not implemented: animationGetPathFollowState');
1822
+ }
1823
+ return this._addon.animationGetPathFollowState(pathId);
1824
+ }
1825
+
1826
+ /** Reads the inner physical size [width, height] of a Platform window. */
1827
+ windowGetSize(windowId: number): [number, number] {
1828
+ return this._addon.windowGetSize(windowId);
1829
+ }
1830
+
1831
+ /** Reads the inner physical size [width, height] of a Platform window (alias for windowGetSize). */
1832
+ platformGetWindowSize(windowId: number): [number, number] {
1833
+ return this.windowGetSize(windowId);
1834
+ }
1835
+ }