@zylem/game-lib 0.6.4 → 0.7.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 (122) hide show
  1. package/README.md +3 -1
  2. package/dist/actions.d.ts +255 -8
  3. package/dist/actions.js +1 -936
  4. package/dist/audio.d.ts +13 -0
  5. package/dist/audio.js +1 -0
  6. package/dist/base-node-life-cycle-CnJ-7zX-.d.ts +143 -0
  7. package/dist/behavior.d.ts +3 -0
  8. package/dist/behavior.js +1 -0
  9. package/dist/chunk-4QLJUQSJ.js +1 -0
  10. package/dist/chunk-73VZQZUL.js +1 -0
  11. package/dist/chunk-A34ZG3L4.js +1 -0
  12. package/dist/chunk-CDPY4VOQ.js +1 -0
  13. package/dist/chunk-DR6XXZE7.js +19 -0
  14. package/dist/chunk-FM5TBEPO.js +1 -0
  15. package/dist/chunk-G2IIMSUH.js +1 -0
  16. package/dist/chunk-MSC2BEO5.js +1 -0
  17. package/dist/chunk-NIH5CONO.js +1 -0
  18. package/dist/chunk-ONWXGBWB.js +1 -0
  19. package/dist/chunk-QEDQDR27.js +1 -0
  20. package/dist/chunk-QXVH6POE.js +1 -0
  21. package/dist/chunk-RXDTAWI2.js +29 -0
  22. package/dist/chunk-WKHW2QO2.js +1 -0
  23. package/dist/chunk-XRP4JJXL.js +1 -0
  24. package/dist/chunk-YHEWKN7N.js +1 -0
  25. package/dist/chunk-YHKXQ2ZN.js +1 -0
  26. package/dist/core.d.ts +206 -14
  27. package/dist/core.js +24 -12424
  28. package/dist/debug.d.ts +24 -0
  29. package/dist/debug.js +1 -0
  30. package/dist/default-controls-BGc61yYl.d.ts +111 -0
  31. package/dist/{entity-vj-HTjzU.d.ts → entity-DNkYKfdp.d.ts} +452 -578
  32. package/dist/entity-type-map-C94h2TDW.d.ts +781 -0
  33. package/dist/entity.d.ts +265 -0
  34. package/dist/entity.js +1 -0
  35. package/dist/events.d.ts +172 -0
  36. package/dist/events.js +1 -0
  37. package/dist/game-Cuj5gy7U.d.ts +1590 -0
  38. package/dist/game-default-PZLLHYL7.js +1 -0
  39. package/dist/game-interfaces-tfpM5NBk.d.ts +90 -0
  40. package/dist/globals.d.ts +104 -0
  41. package/dist/globals.js +1 -0
  42. package/dist/graphics.d.ts +83 -0
  43. package/dist/graphics.js +1 -0
  44. package/dist/input-ui.d.ts +34 -0
  45. package/dist/input-ui.js +1 -0
  46. package/dist/input.d.ts +72 -0
  47. package/dist/input.js +1 -0
  48. package/dist/material-Wz83vTTp.d.ts +151 -0
  49. package/dist/runtime.d.ts +433 -0
  50. package/dist/runtime.js +1 -0
  51. package/dist/web-components.d.ts +67 -0
  52. package/dist/web-components.js +9 -0
  53. package/dist/world-C9zdyl5d.d.ts +103 -0
  54. package/dist/{camera-4XO5gbQH.d.ts → zylem-stage-runtime-Cs-UDEVU.d.ts} +201 -329
  55. package/package.json +52 -63
  56. package/dist/actions.js.map +0 -1
  57. package/dist/behavior/jumper-2d.d.ts +0 -114
  58. package/dist/behavior/jumper-2d.js +0 -711
  59. package/dist/behavior/jumper-2d.js.map +0 -1
  60. package/dist/behavior/platformer-3d.d.ts +0 -296
  61. package/dist/behavior/platformer-3d.js +0 -761
  62. package/dist/behavior/platformer-3d.js.map +0 -1
  63. package/dist/behavior/ricochet-2d.d.ts +0 -275
  64. package/dist/behavior/ricochet-2d.js +0 -425
  65. package/dist/behavior/ricochet-2d.js.map +0 -1
  66. package/dist/behavior/ricochet-3d.d.ts +0 -117
  67. package/dist/behavior/ricochet-3d.js +0 -443
  68. package/dist/behavior/ricochet-3d.js.map +0 -1
  69. package/dist/behavior/screen-visibility.d.ts +0 -79
  70. package/dist/behavior/screen-visibility.js +0 -358
  71. package/dist/behavior/screen-visibility.js.map +0 -1
  72. package/dist/behavior/screen-wrap.d.ts +0 -87
  73. package/dist/behavior/screen-wrap.js +0 -246
  74. package/dist/behavior/screen-wrap.js.map +0 -1
  75. package/dist/behavior/shooter-2d.d.ts +0 -79
  76. package/dist/behavior/shooter-2d.js +0 -180
  77. package/dist/behavior/shooter-2d.js.map +0 -1
  78. package/dist/behavior/thruster.d.ts +0 -11
  79. package/dist/behavior/thruster.js +0 -292
  80. package/dist/behavior/thruster.js.map +0 -1
  81. package/dist/behavior/top-down-movement.d.ts +0 -56
  82. package/dist/behavior/top-down-movement.js +0 -125
  83. package/dist/behavior/top-down-movement.js.map +0 -1
  84. package/dist/behavior/world-boundary-2d.d.ts +0 -142
  85. package/dist/behavior/world-boundary-2d.js +0 -235
  86. package/dist/behavior/world-boundary-2d.js.map +0 -1
  87. package/dist/behavior/world-boundary-3d.d.ts +0 -76
  88. package/dist/behavior/world-boundary-3d.js +0 -274
  89. package/dist/behavior/world-boundary-3d.js.map +0 -1
  90. package/dist/behavior-descriptor-BXnVR8Ki.d.ts +0 -159
  91. package/dist/blueprints-DmbK2dki.d.ts +0 -26
  92. package/dist/camera.d.ts +0 -6
  93. package/dist/camera.js +0 -1993
  94. package/dist/camera.js.map +0 -1
  95. package/dist/composition-BASvMKrW.d.ts +0 -218
  96. package/dist/core-CARRaS55.d.ts +0 -541
  97. package/dist/core.js.map +0 -1
  98. package/dist/entities-ChFirVL9.d.ts +0 -410
  99. package/dist/entities.d.ts +0 -9
  100. package/dist/entities.js +0 -4986
  101. package/dist/entities.js.map +0 -1
  102. package/dist/entity-Bq_eNEDI.d.ts +0 -28
  103. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  104. package/dist/global-change-2JvMaz44.d.ts +0 -25
  105. package/dist/main.d.ts +0 -1353
  106. package/dist/main.js +0 -19525
  107. package/dist/main.js.map +0 -1
  108. package/dist/physics-pose-DCc4oE44.d.ts +0 -25
  109. package/dist/physics-protocol-BDD3P5W2.d.ts +0 -200
  110. package/dist/physics-worker.d.ts +0 -21
  111. package/dist/physics-worker.js +0 -306
  112. package/dist/physics-worker.js.map +0 -1
  113. package/dist/physics.d.ts +0 -205
  114. package/dist/physics.js +0 -577
  115. package/dist/physics.js.map +0 -1
  116. package/dist/stage-types-C19IhuzA.d.ts +0 -731
  117. package/dist/stage.d.ts +0 -52
  118. package/dist/stage.js +0 -8479
  119. package/dist/stage.js.map +0 -1
  120. package/dist/sync-state-machine-CZyspBpj.d.ts +0 -16
  121. package/dist/thruster-23lzoPZd.d.ts +0 -180
  122. package/dist/world-DfgxoNMt.d.ts +0 -105
@@ -0,0 +1,781 @@
1
+ import { Sprite, Color, Object3D, ColorRepresentation, Light, Fog, FogExp2, Scene } from 'three';
2
+ import { G as GameEntity, I as GameEntityOptions, M as BaseNode } from './entity-DNkYKfdp.js';
3
+ import { a as Vec3Input, b as Vec2Input, T as TexturePath, M as MaterialOptions } from './material-Wz83vTTp.js';
4
+ import { S as SetupContext, f as UpdateContext, D as DestroyContext, C as CleanupContext } from './base-node-life-cycle-CnJ-7zX-.js';
5
+ import { C as CollisionHandlerDelegate } from './world-C9zdyl5d.js';
6
+ import { ParticleEmitterBehaviorOptions, ParticleEffectDefinition, ParticleEmitterHandle } from '@zylem/behaviors/particle-emitter';
7
+
8
+ type SpriteImage = {
9
+ name: string;
10
+ file: string;
11
+ };
12
+ type SpriteAnimation = {
13
+ name: string;
14
+ frames: string[];
15
+ speed: number | number[];
16
+ loop: boolean;
17
+ };
18
+ type ZylemSpriteOptions = GameEntityOptions & {
19
+ images?: SpriteImage[];
20
+ animations?: SpriteAnimation[];
21
+ size?: Vec3Input;
22
+ collisionSize?: Vec3Input;
23
+ };
24
+ declare const SPRITE_TYPE: unique symbol;
25
+ declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
26
+ static type: symbol;
27
+ protected sprites: Sprite[];
28
+ protected spriteMap: Map<string, number>;
29
+ protected currentSpriteIndex: number;
30
+ protected animations: Map<string, any>;
31
+ protected currentAnimation: any;
32
+ protected currentAnimationFrame: string;
33
+ protected currentAnimationIndex: number;
34
+ protected currentAnimationTime: number;
35
+ constructor(options?: ZylemSpriteOptions);
36
+ create(): this;
37
+ protected createSpritesFromImages(images: SpriteImage[]): void;
38
+ protected createAnimations(animations: SpriteAnimation[]): void;
39
+ setSprite(key: string): void;
40
+ setAnimation(name: string, delta: number): void;
41
+ private getCurrentRotationQuaternion;
42
+ private syncSpriteMaterials;
43
+ spriteSetup(_params: SetupContext<ZylemSpriteOptions>): void;
44
+ spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): void;
45
+ spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
46
+ buildInfo(): Record<string, any>;
47
+ }
48
+ type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
49
+ declare function createSprite(...args: Array<SpriteOptions>): ZylemSprite;
50
+
51
+ type ZylemSphereOptions = GameEntityOptions & {
52
+ radius?: number;
53
+ };
54
+ declare const SPHERE_TYPE: unique symbol;
55
+ declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
56
+ static type: symbol;
57
+ constructor(options?: ZylemSphereOptions);
58
+ buildInfo(): Record<string, any>;
59
+ }
60
+ type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
61
+ declare function createSphere(...args: Array<SphereOptions>): ZylemSphere;
62
+
63
+ type ZylemRectOptions = GameEntityOptions & {
64
+ width?: number;
65
+ height?: number;
66
+ fillColor?: Color | string | null;
67
+ strokeColor?: Color | string | null;
68
+ strokeWidth?: number;
69
+ radius?: number;
70
+ padding?: number;
71
+ stickToViewport?: boolean;
72
+ screenPosition?: Vec2Input;
73
+ zDistance?: number;
74
+ anchor?: Vec2Input;
75
+ bounds?: {
76
+ screen?: {
77
+ x: number;
78
+ y: number;
79
+ width: number;
80
+ height: number;
81
+ };
82
+ world?: {
83
+ left: number;
84
+ right: number;
85
+ top: number;
86
+ bottom: number;
87
+ z?: number;
88
+ };
89
+ };
90
+ };
91
+ declare const RECT_TYPE: unique symbol;
92
+ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
93
+ static type: symbol;
94
+ private _sprite;
95
+ private _mesh;
96
+ private _texture;
97
+ private _canvas;
98
+ private _ctx;
99
+ private _cameraRef;
100
+ private _lastCanvasW;
101
+ private _lastCanvasH;
102
+ constructor(options?: ZylemRectOptions);
103
+ private createSprite;
104
+ private redrawRect;
105
+ getWidth(): number;
106
+ getHeight(): number;
107
+ private roundedRectPath;
108
+ private toCssColor;
109
+ /**
110
+ * Get the viewport resolution from the renderer DOM element,
111
+ * falling back to the camera's screenResolution if the renderer
112
+ * is not available (e.g. when using the new RendererManager path).
113
+ */
114
+ private getResolution;
115
+ private rectSetup;
116
+ private rectUpdate;
117
+ private updateStickyTransform;
118
+ private worldToScreen;
119
+ private computeScreenBoundsFromOptions;
120
+ updateRect(options?: Partial<Pick<ZylemRectOptions, 'width' | 'height' | 'fillColor' | 'strokeColor' | 'strokeWidth' | 'radius'>>): void;
121
+ buildInfo(): Record<string, any>;
122
+ }
123
+ type RectOptions = BaseNode | Partial<ZylemRectOptions>;
124
+ declare function createRect(...args: Array<RectOptions>): ZylemRect;
125
+
126
+ type ZylemTextOptions = GameEntityOptions & {
127
+ text?: string;
128
+ fontFamily?: string;
129
+ fontSize?: number;
130
+ fontColor?: Color | string;
131
+ backgroundColor?: Color | string | null;
132
+ padding?: number;
133
+ stickToViewport?: boolean;
134
+ screenPosition?: Vec2Input;
135
+ zDistance?: number;
136
+ };
137
+ declare const TEXT_TYPE: unique symbol;
138
+ declare class ZylemText extends GameEntity<ZylemTextOptions> {
139
+ static type: symbol;
140
+ private _sprite;
141
+ private _texture;
142
+ private _canvas;
143
+ private _ctx;
144
+ private _cameraRef;
145
+ private _lastCanvasW;
146
+ private _lastCanvasH;
147
+ constructor(options?: ZylemTextOptions);
148
+ create(): this;
149
+ private createSprite;
150
+ private measureAndResizeCanvas;
151
+ private drawCenteredText;
152
+ private updateTexture;
153
+ private redrawText;
154
+ private toCssColor;
155
+ private textSetup;
156
+ private textUpdate;
157
+ private getResolution;
158
+ private getScreenPixels;
159
+ private computeWorldExtents;
160
+ private updateSpriteScale;
161
+ private updateWorldSpriteScale;
162
+ private updateStickyTransform;
163
+ updateText(_text: string): void;
164
+ buildInfo(): Record<string, any>;
165
+ /**
166
+ * Dispose of Three.js resources when the entity is destroyed.
167
+ */
168
+ private textDestroy;
169
+ }
170
+ type TextOptions = BaseNode | Partial<ZylemTextOptions>;
171
+ declare function createText(...args: Array<TextOptions>): ZylemText;
172
+
173
+ type ZylemBoxOptions = GameEntityOptions;
174
+ declare const BOX_TYPE: unique symbol;
175
+ declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
176
+ static type: symbol;
177
+ constructor(options?: ZylemBoxOptions);
178
+ buildInfo(): Record<string, any>;
179
+ }
180
+ type BoxOptions = BaseNode | Partial<ZylemBoxOptions>;
181
+ declare function createBox(...args: Array<BoxOptions>): ZylemBox;
182
+
183
+ type ZylemPlaneOptions = GameEntityOptions & {
184
+ tile?: Vec2Input;
185
+ repeat?: Vec2Input;
186
+ texture?: TexturePath;
187
+ /**
188
+ * Number of subdivisions per axis. Used for both X and Z unless
189
+ * `subdivisionsX` / `subdivisionsZ` are set, or a `heightMap` /
190
+ * `heightMap2D` is provided (in which case subdivisions are derived
191
+ * from the height data).
192
+ */
193
+ subdivisions?: number;
194
+ /** Subdivisions along the X axis (overrides `subdivisions`). */
195
+ subdivisionsX?: number;
196
+ /** Subdivisions along the Z axis (overrides `subdivisions`). */
197
+ subdivisionsZ?: number;
198
+ /**
199
+ * If true and no explicit heightmap is provided, each vertex gets a
200
+ * random height in `[0, 4 * heightScale]`.
201
+ */
202
+ randomizeHeight?: boolean;
203
+ /**
204
+ * Absolute heights along the X axis, one value per vertex-column
205
+ * (constant along Z). `length` defines the X vertex count, so
206
+ * `subdivisionsX` becomes `length - 1`. Values are absolute world-space
207
+ * heights above/below the plane (multiplied by `heightScale`, default 1).
208
+ *
209
+ * Example: `heightMap: [10, 1, -1, 10]` produces 4 X-columns with those
210
+ * absolute heights, forming ridges parallel to the Z axis.
211
+ *
212
+ * Takes precedence over `randomizeHeight`.
213
+ */
214
+ heightMap?: number[];
215
+ /**
216
+ * Absolute heights as a 2D grid, indexed `heightMap2D[z][x]`. The outer
217
+ * array's length defines the Z vertex count and each inner array's
218
+ * length defines the X vertex count (all rows must share the same X
219
+ * length). Values are absolute (multiplied by `heightScale`).
220
+ *
221
+ * Takes precedence over `heightMap` and `randomizeHeight`.
222
+ */
223
+ heightMap2D?: number[][];
224
+ /** Multiplier applied to heightmap / random heights (default 1). */
225
+ heightScale?: number;
226
+ };
227
+ declare const PLANE_TYPE: unique symbol;
228
+ declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
229
+ static type: symbol;
230
+ constructor(options?: ZylemPlaneOptions);
231
+ }
232
+ type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
233
+ declare function createPlane(...args: Array<PlaneOptions>): ZylemPlane;
234
+
235
+ type OnHeldParams = {
236
+ delta: number;
237
+ self: ZylemZone;
238
+ visitor: GameEntity<any>;
239
+ heldTime: number;
240
+ globals: any;
241
+ };
242
+ type OnEnterParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
243
+ type OnExitParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
244
+ type ZylemZoneOptions = GameEntityOptions & {
245
+ size?: Vec3Input;
246
+ static?: boolean;
247
+ onEnter?: (params: OnEnterParams) => void;
248
+ onHeld?: (params: OnHeldParams) => void;
249
+ onExit?: (params: OnExitParams) => void;
250
+ };
251
+ declare const ZONE_TYPE: unique symbol;
252
+ declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements CollisionHandlerDelegate {
253
+ static type: symbol;
254
+ private _enteredZone;
255
+ private _exitedZone;
256
+ private _zoneEntities;
257
+ constructor(options?: ZylemZoneOptions);
258
+ handlePostCollision({ delta }: {
259
+ delta: number;
260
+ }): boolean;
261
+ handleIntersectionEvent({ other, delta, }: {
262
+ other: any;
263
+ delta: number;
264
+ }): void;
265
+ onEnter(callback: (params: OnEnterParams) => void): this;
266
+ onHeld(callback: (params: OnHeldParams) => void): this;
267
+ onExit(callback: (params: OnExitParams) => void): this;
268
+ entered(other: any): void;
269
+ exited(delta: number, key: string): void;
270
+ held(delta: number, other: any): void;
271
+ }
272
+ type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
273
+ declare function createZone(...args: Array<ZoneOptions>): ZylemZone;
274
+
275
+ interface EntityLoaderDelegate {
276
+ /** Initiates loading (may be async internally, but call returns immediately) */
277
+ load(): void;
278
+ /** Returns data synchronously (may be null if still loading) */
279
+ data(): any;
280
+ }
281
+
282
+ type AnimationOptions = {
283
+ key: string;
284
+ pauseAtEnd?: boolean;
285
+ pauseAtPercentage?: number;
286
+ fadeToKey?: string;
287
+ fadeDuration?: number;
288
+ };
289
+
290
+ /**
291
+ * Interface for entities that provide custom debug information
292
+ */
293
+ interface DebugInfoProvider {
294
+ getDebugInfo(): Record<string, any>;
295
+ }
296
+
297
+ type AnimationObject = {
298
+ key?: string;
299
+ path: string;
300
+ };
301
+ type CollisionShapeType = 'capsule' | 'bounds' | 'trimesh' | 'model';
302
+ type ZylemActorOptions = GameEntityOptions & {
303
+ static?: boolean;
304
+ animations?: AnimationObject[];
305
+ models?: string[];
306
+ scale?: Vec3Input;
307
+ material?: MaterialOptions;
308
+ collisionShape?: CollisionShapeType;
309
+ /**
310
+ * Opt-in: also strip the root bone's Y translation track so the
311
+ * mixer never overrides the bind-pose hip Y. Useful when the
312
+ * actor is shown statically (e.g. a lobby preview) and you want
313
+ * to suppress the bind→animation Y "snap" at load time. Defaults
314
+ * to false because most FBX exports use the Y track as a
315
+ * hip-height calibration that the renderer needs to keep feet on
316
+ * the ground.
317
+ */
318
+ stripRootMotionY?: boolean;
319
+ };
320
+ declare const ACTOR_TYPE: unique symbol;
321
+ declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
322
+ static type: symbol;
323
+ private _object;
324
+ private _collisionSource;
325
+ private _animationDelegate;
326
+ private _modelFileNames;
327
+ private _assetLoader;
328
+ private _loadGeneration;
329
+ private _loadStatus;
330
+ controlledRotation: boolean;
331
+ hasWarnedDynamicTrimesh: boolean;
332
+ constructor(options?: ZylemActorOptions);
333
+ create(): this;
334
+ load(): void;
335
+ data(): any;
336
+ needsDeferredModelCollision(): boolean;
337
+ synchronizeRuntimeCollider(): void;
338
+ actorUpdate(params: UpdateContext<ZylemActorOptions>): void;
339
+ actorDestroy(): void;
340
+ _cleanup(params: CleanupContext<this>): void;
341
+ playAnimation(animationOptions: AnimationOptions): void;
342
+ get object(): Object3D | null;
343
+ get collisionSource(): Object3D | null;
344
+ getDebugInfo(): Record<string, any>;
345
+ private getResolvedCollisionShape;
346
+ private requiresLoadedCollisionSource;
347
+ private getRuntimeCollisionSource;
348
+ private getCollisionSourceSelection;
349
+ private disposeRuntimeState;
350
+ private loadModelsDeferred;
351
+ private applyMaterialOverrides;
352
+ /**
353
+ * Produce a cloned material with the requested color/opacity applied.
354
+ *
355
+ * Cloning preserves any textures (`map`, `normalMap`, `roughnessMap`, …)
356
+ * that came with the loaded model — colour acts as a multiplicative tint on
357
+ * top of them, matching standard PBR behaviour. We fall back to a fresh
358
+ * `MeshStandardMaterial` only when the source material has no `.color`
359
+ * field (e.g. custom `ShaderMaterial`).
360
+ */
361
+ private tintMaterial;
362
+ }
363
+ type ActorOptions = BaseNode | ZylemActorOptions;
364
+ declare function createActor(...args: Array<ActorOptions>): ZylemActor;
365
+
366
+ type ZylemDiskOptions = GameEntityOptions & {
367
+ innerRadius?: number;
368
+ outerRadius?: number;
369
+ thetaSegments?: number;
370
+ };
371
+ declare const DISK_TYPE: unique symbol;
372
+ declare class ZylemDisk extends GameEntity<ZylemDiskOptions> {
373
+ static type: symbol;
374
+ constructor(options?: ZylemDiskOptions);
375
+ buildInfo(): Record<string, any>;
376
+ }
377
+ type DiskOptions = BaseNode | Partial<ZylemDiskOptions>;
378
+ declare function createDisk(...args: Array<DiskOptions>): ZylemDisk;
379
+
380
+ type ZylemConeOptions = GameEntityOptions & {
381
+ /** Base radius of the cone */
382
+ radius?: number;
383
+ /** Height of the cone */
384
+ height?: number;
385
+ /** Number of radial segments (higher = smoother) */
386
+ radialSegments?: number;
387
+ };
388
+ declare const CONE_TYPE: unique symbol;
389
+ /**
390
+ * A cone entity with configurable radius, height, and radial segments.
391
+ * Uses a Rapier cone collider for physics.
392
+ */
393
+ declare class ZylemCone extends GameEntity<ZylemConeOptions> {
394
+ static type: symbol;
395
+ constructor(options?: ZylemConeOptions);
396
+ buildInfo(): Record<string, any>;
397
+ }
398
+ type ConeOptions = BaseNode | Partial<ZylemConeOptions>;
399
+ /**
400
+ * Create a cone entity.
401
+ * @param args Options or child nodes
402
+ */
403
+ declare function createCone(...args: Array<ConeOptions>): ZylemCone;
404
+
405
+ type ZylemPyramidOptions = GameEntityOptions & {
406
+ /** Base radius of the pyramid */
407
+ radius?: number;
408
+ /** Height of the pyramid */
409
+ height?: number;
410
+ };
411
+ declare const PYRAMID_TYPE: unique symbol;
412
+ /**
413
+ * A pyramid entity (4-sided cone).
414
+ * Uses ConeGeometry with 4 radial segments for the visual mesh
415
+ * and a Rapier cone collider for physics.
416
+ */
417
+ declare class ZylemPyramid extends GameEntity<ZylemPyramidOptions> {
418
+ static type: symbol;
419
+ constructor(options?: ZylemPyramidOptions);
420
+ buildInfo(): Record<string, any>;
421
+ }
422
+ type PyramidOptions = BaseNode | Partial<ZylemPyramidOptions>;
423
+ /**
424
+ * Create a pyramid entity.
425
+ * @param args Options or child nodes
426
+ */
427
+ declare function createPyramid(...args: Array<PyramidOptions>): ZylemPyramid;
428
+
429
+ type ZylemCylinderOptions = GameEntityOptions & {
430
+ /** Top radius of the cylinder */
431
+ radiusTop?: number;
432
+ /** Bottom radius of the cylinder */
433
+ radiusBottom?: number;
434
+ /** Height of the cylinder */
435
+ height?: number;
436
+ /** Number of radial segments (higher = smoother) */
437
+ radialSegments?: number;
438
+ };
439
+ declare const CYLINDER_TYPE: unique symbol;
440
+ /**
441
+ * A cylinder entity with configurable top/bottom radii, height, and segments.
442
+ * Uses a Rapier cylinder collider for physics.
443
+ */
444
+ declare class ZylemCylinder extends GameEntity<ZylemCylinderOptions> {
445
+ static type: symbol;
446
+ constructor(options?: ZylemCylinderOptions);
447
+ buildInfo(): Record<string, any>;
448
+ }
449
+ type CylinderOptions = BaseNode | Partial<ZylemCylinderOptions>;
450
+ /**
451
+ * Create a cylinder entity.
452
+ * @param args Options or child nodes
453
+ */
454
+ declare function createCylinder(...args: Array<CylinderOptions>): ZylemCylinder;
455
+
456
+ type ZylemPillOptions = GameEntityOptions & {
457
+ /** Radius of the capsule hemispheres */
458
+ radius?: number;
459
+ /** Length of the cylindrical middle section */
460
+ length?: number;
461
+ /** Number of cap segments (higher = smoother) */
462
+ capSegments?: number;
463
+ /** Number of radial segments (higher = smoother) */
464
+ radialSegments?: number;
465
+ };
466
+ declare const PILL_TYPE: unique symbol;
467
+ /**
468
+ * A pill/capsule entity with configurable radius and cylindrical length.
469
+ * Uses Three.js CapsuleGeometry for rendering and Rapier capsule collider for physics.
470
+ */
471
+ declare class ZylemPill extends GameEntity<ZylemPillOptions> {
472
+ static type: symbol;
473
+ constructor(options?: ZylemPillOptions);
474
+ buildInfo(): Record<string, any>;
475
+ }
476
+ type PillOptions = BaseNode | Partial<ZylemPillOptions>;
477
+ /**
478
+ * Create a pill (capsule) entity.
479
+ * @param args Options or child nodes
480
+ */
481
+ declare function createPill(...args: Array<PillOptions>): ZylemPill;
482
+
483
+ type ZylemParticleSystemOptions = GameEntityOptions & ParticleEmitterBehaviorOptions & {
484
+ preset?: ParticleEffectDefinition;
485
+ };
486
+ declare const PARTICLE_SYSTEM_TYPE: unique symbol;
487
+ declare class ZylemParticleSystem extends GameEntity<ZylemParticleSystemOptions> {
488
+ static type: symbol;
489
+ __zylemParticleSystemEntity: true;
490
+ private particleHandle;
491
+ constructor(options?: Partial<ZylemParticleSystemOptions>, initializeBehavior?: boolean);
492
+ private bindStandaloneTransforms;
493
+ private resolveParticleHandle;
494
+ play(): void;
495
+ stop(): void;
496
+ pause(): void;
497
+ restart(): void;
498
+ burst(): void;
499
+ isPlaying(): boolean;
500
+ getSystem(): ParticleEmitterHandle['getSystem'] extends () => infer T ? T : null;
501
+ buildInfo(): Record<string, string>;
502
+ }
503
+ declare function createParticleSystem(options?: Partial<ZylemParticleSystemOptions>): ZylemParticleSystem;
504
+
505
+ type Vec3 = {
506
+ x: number;
507
+ y: number;
508
+ z: number;
509
+ };
510
+ /**
511
+ * Shadow-camera / shadow-map options shared across the light types that
512
+ * support casting shadows (directional, point, spot).
513
+ *
514
+ * The orthographic frustum fields (`left` / `right` / `top` / `bottom`) only
515
+ * apply to directional lights -- TypeScript enforces this via the tagged
516
+ * union below -- but we keep a single shape for ergonomic reuse.
517
+ */
518
+ interface LightShadowOptions {
519
+ /** Shadow map resolution (square). Defaults: directional 2048, point/spot 1024. */
520
+ mapSize?: number;
521
+ /** Shadow camera near plane. Default 0.1. */
522
+ near?: number;
523
+ /** Shadow camera far plane. Default 500. */
524
+ far?: number;
525
+ /** Shadow bias (negative values can help acne). */
526
+ bias?: number;
527
+ /** PCF blur radius. */
528
+ radius?: number;
529
+ /** Directional-only: orthographic frustum left bound. Default -100. */
530
+ left?: number;
531
+ /** Directional-only: orthographic frustum right bound. Default 100. */
532
+ right?: number;
533
+ /** Directional-only: orthographic frustum top bound. Default 100. */
534
+ top?: number;
535
+ /** Directional-only: orthographic frustum bottom bound. Default -100. */
536
+ bottom?: number;
537
+ }
538
+ interface BaseLightOptions {
539
+ name?: string;
540
+ /** Light colour. Default `#ffffff`. */
541
+ color?: ColorRepresentation;
542
+ /** Scalar intensity multiplier. Default `1`. */
543
+ intensity?: number;
544
+ /** World-space position. Default `{0,0,0}`. Not meaningful for ambient. */
545
+ position?: Vec3;
546
+ }
547
+ interface AmbientLightOptions extends BaseLightOptions {
548
+ type: 'ambient';
549
+ }
550
+ interface HemisphereLightOptions extends BaseLightOptions {
551
+ type: 'hemisphere';
552
+ /** Sky colour. Falls back to `color` if omitted, else `#ffffff`. */
553
+ skyColor?: ColorRepresentation;
554
+ /** Ground colour. Default `#000000`. */
555
+ groundColor?: ColorRepresentation;
556
+ }
557
+ interface DirectionalLightOptions extends BaseLightOptions {
558
+ type: 'directional';
559
+ /** World-space point the light aims at. Default origin. */
560
+ target?: Vec3;
561
+ /** Enable shadow casting. Default `false`. */
562
+ castShadow?: boolean;
563
+ /** Shadow camera / map tuning. */
564
+ shadow?: LightShadowOptions;
565
+ }
566
+ interface PointLightOptions extends BaseLightOptions {
567
+ type: 'point';
568
+ /** Maximum range of the light (0 = infinite). */
569
+ distance?: number;
570
+ /** Physical falloff exponent. Default `2` (three.js default). */
571
+ decay?: number;
572
+ castShadow?: boolean;
573
+ /** Shadow options (directional-only frustum fields are ignored). */
574
+ shadow?: Omit<LightShadowOptions, 'left' | 'right' | 'top' | 'bottom'>;
575
+ }
576
+ interface SpotLightOptions extends BaseLightOptions {
577
+ type: 'spot';
578
+ /** World-space point the cone aims at. Default origin. */
579
+ target?: Vec3;
580
+ /** Maximum range of the light (0 = infinite). */
581
+ distance?: number;
582
+ /** Physical falloff exponent. Default `2`. */
583
+ decay?: number;
584
+ /** Cone angle in radians. Default `Math.PI / 3`. */
585
+ angle?: number;
586
+ /** Penumbra softness in `[0, 1]`. Default `0`. */
587
+ penumbra?: number;
588
+ castShadow?: boolean;
589
+ /** Shadow options (directional-only frustum fields are ignored). */
590
+ shadow?: Omit<LightShadowOptions, 'left' | 'right' | 'top' | 'bottom'>;
591
+ }
592
+ type ZylemLightOptions = AmbientLightOptions | HemisphereLightOptions | DirectionalLightOptions | PointLightOptions | SpotLightOptions;
593
+ declare const LIGHT_TYPE: unique symbol;
594
+ type ZylemLightGameOptions = ZylemLightOptions & GameEntityOptions;
595
+ /**
596
+ * `GameEntity` wrapper around a `THREE.Light` (plus its optional target) so
597
+ * lights can be added to a stage via the standard `stage.add(...)` pipeline.
598
+ *
599
+ * The underlying light lives inside `this.group` at the group's local origin,
600
+ * and the group's world position is set to `options.position` when the stage
601
+ * attaches the entity to the scene. For directional and spot lights, an
602
+ * optional target `Object3D` is added as a sibling inside the same group at a
603
+ * local offset of `target - position`, so moving the group also moves the
604
+ * aim point.
605
+ */
606
+ declare class ZylemLight extends GameEntity<ZylemLightGameOptions> {
607
+ static type: symbol;
608
+ /** The underlying THREE.js light instance. Populated in `create()`. */
609
+ light: Light | null;
610
+ /** The target `Object3D` for directional / spot lights, when configured. */
611
+ lightTarget: Object3D | null;
612
+ constructor(options: ZylemLightOptions);
613
+ create(): this;
614
+ /**
615
+ * Dispose the shadow map render target before delegating to the engine's
616
+ * standard cleanup (which removes the group from its parent scene).
617
+ */
618
+ protected _cleanup(params: CleanupContext<this>): void;
619
+ }
620
+ /**
621
+ * Create a light entity that can be added to a stage with `stage.add(...)`.
622
+ *
623
+ * The `type` discriminant narrows the accepted option keys, so TypeScript
624
+ * surfaces an error if you try to set, say, `angle` on an ambient light.
625
+ *
626
+ * @example
627
+ * ```ts
628
+ * stage.add(createLight({ type: 'ambient', intensity: 1.5 }));
629
+ * stage.add(createLight({
630
+ * type: 'directional',
631
+ * position: { x: 8, y: 12, z: 6 },
632
+ * target: { x: 0, y: 0, z: 0 },
633
+ * castShadow: true,
634
+ * }));
635
+ * ```
636
+ */
637
+ declare function createLight(options: ZylemLightOptions): ZylemLight;
638
+
639
+ /** Three.js fog model. Linear uses start/end; exp² uses density. */
640
+ type ZylemFogType = 'linear' | 'exp2';
641
+ /** Optional vertical falloff (a.k.a. ground/height fog). */
642
+ interface ZylemFogHeightOptions {
643
+ /** Master toggle. Defaults to `false`. */
644
+ enabled?: boolean;
645
+ /** World-space Y at which fog stops attenuating (becomes fully clear). */
646
+ level?: number;
647
+ /**
648
+ * Density falloff per world-unit beneath `level`. Higher values produce
649
+ * sharper transitions; values <= 0 disable the height contribution.
650
+ */
651
+ falloff?: number;
652
+ }
653
+ /**
654
+ * Optional 3D animated noise applied to fog density.
655
+ *
656
+ * Specifying a `noise` block enables noise modulation; omit it to disable.
657
+ */
658
+ interface ZylemFogNoiseOptions {
659
+ /** Spatial scale of the noise; lower = larger pockets of clearer / denser fog. */
660
+ scale?: number;
661
+ /** Modulation strength in `[0, 1]`. 0 = no effect, 1 = full ±100% modulation. */
662
+ strength?: number;
663
+ /** Animation speed (world-units per second of advect). */
664
+ speed?: number;
665
+ }
666
+ interface ZylemFogOptions {
667
+ /** Fog model. Default `'linear'`. */
668
+ type?: ZylemFogType;
669
+ /** Fog colour. Default `'#9aa3ad'` (neutral grey). */
670
+ color?: ColorRepresentation;
671
+ /** Exp² density coefficient. Only used when `type === 'exp2'`. Default `0.015`. */
672
+ density?: number;
673
+ /** Linear-fog start distance. Only used when `type === 'linear'`. Default `10`. */
674
+ start?: number;
675
+ /** Linear-fog end distance. Only used when `type === 'linear'`. Default `250`. */
676
+ end?: number;
677
+ /** Optional vertical falloff. Disabled by default. */
678
+ height?: ZylemFogHeightOptions;
679
+ /** Optional 3D animated noise. Disabled by default. */
680
+ noise?: ZylemFogNoiseOptions;
681
+ /** Display name (mostly for debug overlays). */
682
+ name?: string;
683
+ }
684
+ declare const FOG_TYPE: unique symbol;
685
+ type ZylemFogGameOptions = ZylemFogOptions & GameEntityOptions;
686
+ /**
687
+ * `GameEntity` that owns a Three.js fog instance plus optional height /
688
+ * noise modulators.
689
+ *
690
+ * Why not just expose `scene.fog` directly? Modelling fog as an entity:
691
+ * - Keeps stage authoring uniform with lights, particles, etc.
692
+ * - Gives a natural hook for cleanup when the stage tears down.
693
+ * - Allows multiple stages / loads to swap fog cleanly via the existing
694
+ * entity lifecycle, including the wasm-runtime-managed stages.
695
+ *
696
+ * The entity attaches a tiny empty {@link Group} to the scene so that the
697
+ * standard {@link GameEntity#_cleanup} pathway removes it from its parent
698
+ * during destroy; the actual fog effect is wired up via
699
+ * {@link attachToScene} which is invoked by `ZylemScene.addEntityGroup`.
700
+ */
701
+ declare class ZylemFog extends GameEntity<ZylemFogGameOptions> {
702
+ static type: symbol;
703
+ /** The underlying Three.js fog instance. Populated in `create()`. */
704
+ threeFog: Fog | FogExp2 | null;
705
+ /** Scene the fog is currently attached to (null when detached). */
706
+ private attachedScene;
707
+ private readonly patcher;
708
+ private patcherEnabled;
709
+ constructor(options?: ZylemFogOptions);
710
+ create(): this;
711
+ /**
712
+ * Hook into the host scene: stamp `scene.fog` and -- if height / noise
713
+ * are enabled -- start patching the scene's materials.
714
+ *
715
+ * Called by `ZylemScene.addEntityGroup` once it has identified this
716
+ * entity as a fog entity.
717
+ *
718
+ * @param scene The Three.js scene that will host the fog.
719
+ */
720
+ attachToScene(scene: Scene): void;
721
+ /**
722
+ * Per-frame tick. The base `GameEntity._update` is invoked first (so
723
+ * user `onUpdate` callbacks still run), then the patcher advances its
724
+ * time uniform and picks up any newly-spawned materials.
725
+ */
726
+ _update(params: UpdateContext<this>): void;
727
+ protected _cleanup(params: CleanupContext<this>): void;
728
+ private resolveUniformValues;
729
+ }
730
+ /**
731
+ * Create a fog entity that can be added to a stage with `stage.add(...)`.
732
+ *
733
+ * @example
734
+ * Default greyish fog -- no arguments needed:
735
+ * ```ts
736
+ * stage.add(createFog());
737
+ * ```
738
+ *
739
+ * @example
740
+ * Exp² fog with animated, ground-hugging haze:
741
+ * ```ts
742
+ * stage.add(createFog({
743
+ * type: 'exp2',
744
+ * color: '#aabbcc',
745
+ * density: 0.015,
746
+ * height: { enabled: true, level: 5, falloff: 0.2 },
747
+ * noise: { scale: 0.05, strength: 0.15, speed: 0.1 },
748
+ * }));
749
+ * ```
750
+ */
751
+ declare function createFog(options?: ZylemFogOptions): ZylemFog;
752
+
753
+ /**
754
+ * Maps entity type symbols to their class types.
755
+ * Used by getEntityByName to infer return types.
756
+ */
757
+ interface EntityTypeMap {
758
+ [SPRITE_TYPE]: ZylemSprite;
759
+ [SPHERE_TYPE]: ZylemSphere;
760
+ [RECT_TYPE]: ZylemRect;
761
+ [TEXT_TYPE]: ZylemText;
762
+ [BOX_TYPE]: ZylemBox;
763
+ [PLANE_TYPE]: ZylemPlane;
764
+ [ZONE_TYPE]: ZylemZone;
765
+ [ACTOR_TYPE]: ZylemActor;
766
+ [DISK_TYPE]: ZylemDisk;
767
+ [CONE_TYPE]: ZylemCone;
768
+ [PYRAMID_TYPE]: ZylemPyramid;
769
+ [CYLINDER_TYPE]: ZylemCylinder;
770
+ [PILL_TYPE]: ZylemPill;
771
+ [PARTICLE_SYSTEM_TYPE]: ZylemParticleSystem;
772
+ [LIGHT_TYPE]: ZylemLight;
773
+ [FOG_TYPE]: ZylemFog;
774
+ }
775
+ /**
776
+ * Type helper: if T is a known type symbol, return the mapped entity type.
777
+ * Otherwise return BaseNode.
778
+ */
779
+ type EntityForType<T> = T extends keyof EntityTypeMap ? EntityTypeMap[T] : BaseNode;
780
+
781
+ export { type AmbientLightOptions as $, ACTOR_TYPE as A, BOX_TYPE as B, type CollisionShapeType as C, DISK_TYPE as D, createPyramid as E, ZylemPyramid as F, PYRAMID_TYPE as G, createCylinder as H, ZylemCylinder as I, CYLINDER_TYPE as J, createPill as K, ZylemPill as L, PILL_TYPE as M, createParticleSystem as N, type OnHeldParams as O, PLANE_TYPE as P, ZylemParticleSystem as Q, RECT_TYPE as R, SPHERE_TYPE as S, TEXT_TYPE as T, PARTICLE_SYSTEM_TYPE as U, type ZylemParticleSystemOptions as V, createLight as W, ZylemLight as X, LIGHT_TYPE as Y, ZylemBox as Z, type ZylemLightOptions as _, createSphere as a, type HemisphereLightOptions as a0, type DirectionalLightOptions as a1, type PointLightOptions as a2, type SpotLightOptions as a3, type LightShadowOptions as a4, createFog as a5, ZylemFog as a6, FOG_TYPE as a7, type ZylemFogOptions as a8, type ZylemFogType as a9, type ZylemFogHeightOptions as aa, type ZylemFogNoiseOptions as ab, type EntityTypeMap as ac, type EntityForType as ad, ZylemSphere as b, createBox as c, createSprite as d, ZylemSprite as e, SPRITE_TYPE as f, type SpriteImage as g, type SpriteAnimation as h, createPlane as i, ZylemPlane as j, createZone as k, ZylemZone as l, ZONE_TYPE as m, type OnEnterParams as n, type OnExitParams as o, createActor as p, ZylemActor as q, createText as r, ZylemText as s, createRect as t, ZylemRect as u, createDisk as v, ZylemDisk as w, createCone as x, ZylemCone as y, CONE_TYPE as z };