@zylem/game-lib 0.6.0 → 0.6.3

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 (54) hide show
  1. package/README.md +9 -16
  2. package/dist/actions.d.ts +30 -21
  3. package/dist/actions.js +628 -145
  4. package/dist/actions.js.map +1 -1
  5. package/dist/behavior/platformer-3d.d.ts +296 -0
  6. package/dist/behavior/platformer-3d.js +518 -0
  7. package/dist/behavior/platformer-3d.js.map +1 -0
  8. package/dist/behavior/ricochet-2d.d.ts +274 -0
  9. package/dist/behavior/ricochet-2d.js +394 -0
  10. package/dist/behavior/ricochet-2d.js.map +1 -0
  11. package/dist/behavior/screen-wrap.d.ts +86 -0
  12. package/dist/behavior/screen-wrap.js +195 -0
  13. package/dist/behavior/screen-wrap.js.map +1 -0
  14. package/dist/behavior/thruster.d.ts +10 -0
  15. package/dist/behavior/thruster.js +234 -0
  16. package/dist/behavior/thruster.js.map +1 -0
  17. package/dist/behavior/world-boundary-2d.d.ts +141 -0
  18. package/dist/behavior/world-boundary-2d.js +181 -0
  19. package/dist/behavior/world-boundary-2d.js.map +1 -0
  20. package/dist/behavior-descriptor-BWNWmIjv.d.ts +142 -0
  21. package/dist/{blueprints-BOCc3Wve.d.ts → blueprints-BWGz8fII.d.ts} +2 -2
  22. package/dist/camera-B5e4c78l.d.ts +468 -0
  23. package/dist/camera.d.ts +3 -2
  24. package/dist/camera.js +962 -166
  25. package/dist/camera.js.map +1 -1
  26. package/dist/composition-DrzFrbqI.d.ts +218 -0
  27. package/dist/{core-CZhozNRH.d.ts → core-DAkskq6Y.d.ts} +97 -65
  28. package/dist/core.d.ts +12 -6
  29. package/dist/core.js +4449 -1052
  30. package/dist/core.js.map +1 -1
  31. package/dist/{entities-BAxfJOkk.d.ts → entities-DC9ce_vx.d.ts} +154 -45
  32. package/dist/entities.d.ts +5 -2
  33. package/dist/entities.js +2505 -722
  34. package/dist/entities.js.map +1 -1
  35. package/dist/entity-BpbZqg19.d.ts +1100 -0
  36. package/dist/entity-types-DAu8sGJH.d.ts +26 -0
  37. package/dist/global-change-Dc8uCKi2.d.ts +25 -0
  38. package/dist/main.d.ts +472 -29
  39. package/dist/main.js +11877 -6124
  40. package/dist/main.js.map +1 -1
  41. package/dist/{stage-types-CD21XoIU.d.ts → stage-types-BFsm3qsZ.d.ts} +255 -26
  42. package/dist/stage.d.ts +11 -6
  43. package/dist/stage.js +3462 -491
  44. package/dist/stage.js.map +1 -1
  45. package/dist/thruster-DhRaJnoL.d.ts +172 -0
  46. package/dist/world-Be5m1XC1.d.ts +31 -0
  47. package/package.json +21 -4
  48. package/dist/behaviors.d.ts +0 -106
  49. package/dist/behaviors.js +0 -398
  50. package/dist/behaviors.js.map +0 -1
  51. package/dist/camera-CpbDr4-V.d.ts +0 -116
  52. package/dist/entity-COvRtFNG.d.ts +0 -395
  53. package/dist/moveable-B_vyA6cw.d.ts +0 -67
  54. package/dist/transformable-CUhvyuYO.d.ts +0 -67
package/dist/behaviors.js DELETED
@@ -1,398 +0,0 @@
1
- // src/lib/actions/behaviors/boundaries/boundary.ts
2
- var defaultBoundaryOptions = {
3
- boundaries: {
4
- top: 0,
5
- bottom: 0,
6
- left: 0,
7
- right: 0
8
- },
9
- stopMovement: true
10
- };
11
- function boundary2d(options = {}) {
12
- return {
13
- type: "update",
14
- handler: (updateContext) => {
15
- _boundary2d(updateContext, options);
16
- }
17
- };
18
- }
19
- function _boundary2d(updateContext, options) {
20
- const { me: entity } = updateContext;
21
- const { boundaries, onBoundary } = {
22
- ...defaultBoundaryOptions,
23
- ...options
24
- };
25
- const position = entity.getPosition();
26
- if (!position) return;
27
- let boundariesHit = { top: false, bottom: false, left: false, right: false };
28
- if (position.x <= boundaries.left) {
29
- boundariesHit.left = true;
30
- } else if (position.x >= boundaries.right) {
31
- boundariesHit.right = true;
32
- }
33
- if (position.y <= boundaries.bottom) {
34
- boundariesHit.bottom = true;
35
- } else if (position.y >= boundaries.top) {
36
- boundariesHit.top = true;
37
- }
38
- const stopMovement = options.stopMovement ?? true;
39
- if (stopMovement && boundariesHit) {
40
- const velocity = entity.getVelocity() ?? { x: 0, y: 0, z: 0 };
41
- let { x: newX, y: newY } = velocity;
42
- if (velocity?.y < 0 && boundariesHit.bottom) {
43
- newY = 0;
44
- } else if (velocity?.y > 0 && boundariesHit.top) {
45
- newY = 0;
46
- }
47
- if (velocity?.x < 0 && boundariesHit.left) {
48
- newX = 0;
49
- } else if (velocity?.x > 0 && boundariesHit.right) {
50
- newX = 0;
51
- }
52
- entity.moveXY(newX, newY);
53
- }
54
- if (onBoundary && boundariesHit) {
55
- onBoundary({
56
- me: entity,
57
- boundary: boundariesHit,
58
- position: { x: position.x, y: position.y, z: position.z },
59
- updateContext
60
- });
61
- }
62
- }
63
-
64
- // src/lib/collision/collision-builder.ts
65
- import { ActiveCollisionTypes, ColliderDesc, RigidBodyDesc, RigidBodyType, Vector3 } from "@dimforge/rapier3d-compat";
66
- var typeToGroup = /* @__PURE__ */ new Map();
67
- var nextGroupId = 0;
68
- function getOrCreateCollisionGroupId(type) {
69
- let groupId = typeToGroup.get(type);
70
- if (groupId === void 0) {
71
- groupId = nextGroupId++ % 16;
72
- typeToGroup.set(type, groupId);
73
- }
74
- return groupId;
75
- }
76
-
77
- // src/lib/collision/utils.ts
78
- function matchesCollisionSelector(other, selector) {
79
- if (!selector) return true;
80
- const otherName = other.name ?? "";
81
- if ("name" in selector) {
82
- const sel = selector.name;
83
- if (sel instanceof RegExp) {
84
- return sel.test(otherName);
85
- } else if (Array.isArray(sel)) {
86
- return sel.some((s) => s === otherName);
87
- } else {
88
- return otherName === sel;
89
- }
90
- } else if ("mask" in selector) {
91
- const m = selector.mask;
92
- if (m instanceof RegExp) {
93
- const type = other.collisionType ?? "";
94
- return m.test(type);
95
- } else {
96
- const type = other.collisionType ?? "";
97
- const gid = getOrCreateCollisionGroupId(type);
98
- return (m & 1 << gid) !== 0;
99
- }
100
- } else if ("test" in selector) {
101
- return !!selector.test(other);
102
- }
103
- return true;
104
- }
105
-
106
- // src/lib/actions/behaviors/ricochet/ricochet-2d-collision.ts
107
- function ricochet2DCollision(options = {}, callback) {
108
- return {
109
- type: "collision",
110
- handler: (collisionContext) => {
111
- _handleRicochet2DCollision(collisionContext, options, callback);
112
- }
113
- };
114
- }
115
- function _handleRicochet2DCollision(collisionContext, options, callback) {
116
- const { entity, other } = collisionContext;
117
- const self = entity;
118
- if (other.collider?.isSensor()) return;
119
- const {
120
- minSpeed = 2,
121
- maxSpeed = 20,
122
- separation = 0,
123
- collisionWith = void 0
124
- } = {
125
- ...options
126
- };
127
- const reflectionMode = options?.reflectionMode ?? "angled";
128
- const maxAngleDeg = options?.maxAngleDeg ?? 60;
129
- const speedUpFactor = options?.speedUpFactor ?? 1.05;
130
- const minOffsetForAngle = options?.minOffsetForAngle ?? 0.15;
131
- const centerRetentionFactor = options?.centerRetentionFactor ?? 0.5;
132
- if (!matchesCollisionSelector(other, collisionWith)) return;
133
- const selfPos = self.getPosition();
134
- const otherPos = other.body?.translation();
135
- const vel = self.getVelocity();
136
- if (!selfPos || !otherPos || !vel) return;
137
- let newVelX = vel.x;
138
- let newVelY = vel.y;
139
- let newX = selfPos.x;
140
- let newY = selfPos.y;
141
- const dx = selfPos.x - otherPos.x;
142
- const dy = selfPos.y - otherPos.y;
143
- let extentX = null;
144
- let extentY = null;
145
- const colliderShape = other.collider?.shape;
146
- if (colliderShape) {
147
- if (colliderShape.halfExtents) {
148
- extentX = Math.abs(colliderShape.halfExtents.x ?? colliderShape.halfExtents[0] ?? null);
149
- extentY = Math.abs(colliderShape.halfExtents.y ?? colliderShape.halfExtents[1] ?? null);
150
- }
151
- if ((extentX == null || extentY == null) && typeof colliderShape.radius === "number") {
152
- extentX = extentX ?? Math.abs(colliderShape.radius);
153
- extentY = extentY ?? Math.abs(colliderShape.radius);
154
- }
155
- }
156
- if ((extentX == null || extentY == null) && typeof other.collider?.halfExtents === "function") {
157
- const he = other.collider.halfExtents();
158
- if (he) {
159
- extentX = extentX ?? Math.abs(he.x);
160
- extentY = extentY ?? Math.abs(he.y);
161
- }
162
- }
163
- if ((extentX == null || extentY == null) && typeof other.collider?.radius === "function") {
164
- const r = other.collider.radius();
165
- if (typeof r === "number") {
166
- extentX = extentX ?? Math.abs(r);
167
- extentY = extentY ?? Math.abs(r);
168
- }
169
- }
170
- let relX = 0;
171
- let relY = 0;
172
- if (extentX && extentY) {
173
- relX = clamp(dx / extentX, -1, 1);
174
- relY = clamp(dy / extentY, -1, 1);
175
- } else {
176
- relX = Math.sign(dx);
177
- relY = Math.sign(dy);
178
- }
179
- let bounceVertical = Math.abs(dy) >= Math.abs(dx);
180
- let selfExtentX = null;
181
- let selfExtentY = null;
182
- const selfShape = self.collider?.shape;
183
- if (selfShape) {
184
- if (selfShape.halfExtents) {
185
- selfExtentX = Math.abs(selfShape.halfExtents.x ?? selfShape.halfExtents[0] ?? null);
186
- selfExtentY = Math.abs(selfShape.halfExtents.y ?? selfShape.halfExtents[1] ?? null);
187
- }
188
- if ((selfExtentX == null || selfExtentY == null) && typeof selfShape.radius === "number") {
189
- selfExtentX = selfExtentX ?? Math.abs(selfShape.radius);
190
- selfExtentY = selfExtentY ?? Math.abs(selfShape.radius);
191
- }
192
- }
193
- if ((selfExtentX == null || selfExtentY == null) && typeof self.collider?.halfExtents === "function") {
194
- const heS = self.collider.halfExtents();
195
- if (heS) {
196
- selfExtentX = selfExtentX ?? Math.abs(heS.x);
197
- selfExtentY = selfExtentY ?? Math.abs(heS.y);
198
- }
199
- }
200
- if ((selfExtentX == null || selfExtentY == null) && typeof self.collider?.radius === "function") {
201
- const rS = self.collider.radius();
202
- if (typeof rS === "number") {
203
- selfExtentX = selfExtentX ?? Math.abs(rS);
204
- selfExtentY = selfExtentY ?? Math.abs(rS);
205
- }
206
- }
207
- if (extentX != null && extentY != null && selfExtentX != null && selfExtentY != null) {
208
- const penX = selfExtentX + extentX - Math.abs(dx);
209
- const penY = selfExtentY + extentY - Math.abs(dy);
210
- if (!Number.isNaN(penX) && !Number.isNaN(penY)) {
211
- bounceVertical = penY <= penX;
212
- }
213
- }
214
- let usedAngleDeflection = false;
215
- if (bounceVertical) {
216
- const resolvedY = (extentY ?? 0) + (selfExtentY ?? 0) + separation;
217
- newY = otherPos.y + (dy > 0 ? resolvedY : -resolvedY);
218
- newX = selfPos.x;
219
- const isHorizontalPaddle = extentX != null && extentY != null && extentX > extentY;
220
- if (isHorizontalPaddle && reflectionMode === "angled") {
221
- const maxAngleRad = maxAngleDeg * Math.PI / 180;
222
- const deadzone = Math.max(0, Math.min(1, minOffsetForAngle));
223
- const clampedOffsetX = clamp(relX, -1, 1);
224
- const absOff = Math.abs(clampedOffsetX);
225
- const baseSpeed = Math.sqrt(vel.x * vel.x + vel.y * vel.y);
226
- const speed = clamp(baseSpeed * speedUpFactor, minSpeed, maxSpeed);
227
- if (absOff > deadzone) {
228
- const t = (absOff - deadzone) / (1 - deadzone);
229
- const angle = Math.sign(clampedOffsetX) * (t * maxAngleRad);
230
- const cosA = Math.cos(angle);
231
- const sinA = Math.sin(angle);
232
- const vy = Math.abs(speed * cosA);
233
- const vx = speed * sinA;
234
- newVelY = dy > 0 ? vy : -vy;
235
- newVelX = vx;
236
- } else {
237
- const vx = vel.x * centerRetentionFactor;
238
- const vyMagSquared = Math.max(0, speed * speed - vx * vx);
239
- const vy = Math.sqrt(vyMagSquared);
240
- newVelY = dy > 0 ? vy : -vy;
241
- newVelX = vx;
242
- }
243
- usedAngleDeflection = true;
244
- } else {
245
- newVelY = dy > 0 ? Math.abs(vel.y) : -Math.abs(vel.y);
246
- if (reflectionMode === "simple") usedAngleDeflection = true;
247
- }
248
- } else {
249
- const resolvedX = (extentX ?? 0) + (selfExtentX ?? 0) + separation;
250
- newX = otherPos.x + (dx > 0 ? resolvedX : -resolvedX);
251
- newY = selfPos.y;
252
- if (reflectionMode === "angled") {
253
- const maxAngleRad = maxAngleDeg * Math.PI / 180;
254
- const deadzone = Math.max(0, Math.min(1, minOffsetForAngle));
255
- const clampedOffsetY = clamp(relY, -1, 1);
256
- const absOff = Math.abs(clampedOffsetY);
257
- const baseSpeed = Math.sqrt(vel.x * vel.x + vel.y * vel.y);
258
- const speed = clamp(baseSpeed * speedUpFactor, minSpeed, maxSpeed);
259
- if (absOff > deadzone) {
260
- const t = (absOff - deadzone) / (1 - deadzone);
261
- const angle = Math.sign(clampedOffsetY) * (t * maxAngleRad);
262
- const cosA = Math.cos(angle);
263
- const sinA = Math.sin(angle);
264
- const vx = Math.abs(speed * cosA);
265
- const vy = speed * sinA;
266
- newVelX = dx > 0 ? vx : -vx;
267
- newVelY = vy;
268
- } else {
269
- const vy = vel.y * centerRetentionFactor;
270
- const vxMagSquared = Math.max(0, speed * speed - vy * vy);
271
- const vx = Math.sqrt(vxMagSquared);
272
- newVelX = dx > 0 ? vx : -vx;
273
- newVelY = vy;
274
- }
275
- usedAngleDeflection = true;
276
- } else {
277
- newVelX = dx > 0 ? Math.abs(vel.x) : -Math.abs(vel.x);
278
- newVelY = vel.y;
279
- usedAngleDeflection = true;
280
- }
281
- }
282
- if (!usedAngleDeflection) {
283
- const additionBaseX = Math.abs(newVelX);
284
- const additionBaseY = Math.abs(newVelY);
285
- const addX = Math.sign(relX) * Math.abs(relX) * additionBaseX;
286
- const addY = Math.sign(relY) * Math.abs(relY) * additionBaseY;
287
- newVelX += addX;
288
- newVelY += addY;
289
- }
290
- const currentSpeed = Math.sqrt(newVelX * newVelX + newVelY * newVelY);
291
- if (currentSpeed > 0) {
292
- const targetSpeed = clamp(currentSpeed, minSpeed, maxSpeed);
293
- if (targetSpeed !== currentSpeed) {
294
- const scale = targetSpeed / currentSpeed;
295
- newVelX *= scale;
296
- newVelY *= scale;
297
- }
298
- }
299
- if (newX !== selfPos.x || newY !== selfPos.y) {
300
- self.setPosition(newX, newY, selfPos.z);
301
- self.moveXY(newVelX, newVelY);
302
- if (callback) {
303
- const velocityAfter = self.getVelocity();
304
- if (velocityAfter) {
305
- callback({
306
- position: { x: newX, y: newY, z: selfPos.z },
307
- ...collisionContext
308
- });
309
- }
310
- }
311
- }
312
- }
313
-
314
- // src/lib/actions/behaviors/ricochet/ricochet.ts
315
- function clamp(value, min, max) {
316
- return Math.max(min, Math.min(max, value));
317
- }
318
-
319
- // src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.ts
320
- function ricochet2DInBounds(options = {}, callback) {
321
- return {
322
- type: "update",
323
- handler: (updateContext) => {
324
- _handleRicochet2DInBounds(updateContext, options, callback);
325
- }
326
- };
327
- }
328
- function _handleRicochet2DInBounds(updateContext, options, callback) {
329
- const { me } = updateContext;
330
- const {
331
- restitution = 0,
332
- minSpeed = 2,
333
- maxSpeed = 20,
334
- boundaries = { top: 5, bottom: -5, left: -6.5, right: 6.5 },
335
- separation = 0
336
- } = { ...options };
337
- const position = me.getPosition();
338
- const velocity = me.getVelocity();
339
- if (!position || !velocity) return;
340
- let newVelX = velocity.x;
341
- let newVelY = velocity.y;
342
- let newX = position.x;
343
- let newY = position.y;
344
- let ricochetBoundary = null;
345
- if (position.x <= boundaries.left) {
346
- newVelX = Math.abs(velocity.x);
347
- newX = boundaries.left + separation;
348
- ricochetBoundary = "left";
349
- } else if (position.x >= boundaries.right) {
350
- newVelX = -Math.abs(velocity.x);
351
- newX = boundaries.right - separation;
352
- ricochetBoundary = "right";
353
- }
354
- if (position.y <= boundaries.bottom) {
355
- newVelY = Math.abs(velocity.y);
356
- newY = boundaries.bottom + separation;
357
- ricochetBoundary = "bottom";
358
- } else if (position.y >= boundaries.top) {
359
- newVelY = -Math.abs(velocity.y);
360
- newY = boundaries.top - separation;
361
- ricochetBoundary = "top";
362
- }
363
- const currentSpeed = Math.sqrt(newVelX * newVelX + newVelY * newVelY);
364
- if (currentSpeed > 0) {
365
- const targetSpeed = clamp(currentSpeed, minSpeed, maxSpeed);
366
- if (targetSpeed !== currentSpeed) {
367
- const scale = targetSpeed / currentSpeed;
368
- newVelX *= scale;
369
- newVelY *= scale;
370
- }
371
- }
372
- if (restitution) {
373
- newVelX *= restitution;
374
- newVelY *= restitution;
375
- }
376
- if (newX !== position.x || newY !== position.y) {
377
- me.setPosition(newX, newY, position.z);
378
- me.moveXY(newVelX, newVelY);
379
- if (callback && ricochetBoundary) {
380
- const velocityAfter = me.getVelocity();
381
- if (velocityAfter) {
382
- callback({
383
- boundary: ricochetBoundary,
384
- position: { x: newX, y: newY, z: position.z },
385
- velocityBefore: velocity,
386
- velocityAfter,
387
- ...updateContext
388
- });
389
- }
390
- }
391
- }
392
- }
393
- export {
394
- boundary2d,
395
- ricochet2DCollision,
396
- ricochet2DInBounds
397
- };
398
- //# sourceMappingURL=behaviors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/actions/behaviors/boundaries/boundary.ts","../src/lib/collision/collision-builder.ts","../src/lib/collision/utils.ts","../src/lib/actions/behaviors/ricochet/ricochet-2d-collision.ts","../src/lib/actions/behaviors/ricochet/ricochet.ts","../src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.ts"],"sourcesContent":["import { UpdateContext } from \"../../../core/base-node-life-cycle\";\nimport { MoveableEntity } from \"../../capabilities/moveable\";\nimport { Vector } from \"@dimforge/rapier3d-compat\";\nimport { BehaviorCallbackType } from \"../../../entities/entity\";\n\nexport interface BoundaryEvent {\n\tme: MoveableEntity;\n\tboundary: BoundaryHits;\n\tposition: Vector;\n\tupdateContext: UpdateContext<MoveableEntity>;\n}\n\nexport interface BoundaryOptions {\n\tboundaries: {\n\t\ttop: number;\n\t\tbottom: number;\n\t\tleft: number;\n\t\tright: number;\n\t};\n\tonBoundary?: (event: BoundaryEvent) => void;\n\tstopMovement?: boolean;\n}\n\nconst defaultBoundaryOptions: BoundaryOptions = {\n\tboundaries: {\n\t\ttop: 0,\n\t\tbottom: 0,\n\t\tleft: 0,\n\t\tright: 0\n\t},\n\tstopMovement: true\n};\n\n/**\n * Checks if the entity has hit a boundary and stops its movement if it has\n * \n * @param options Configuration options for the boundary behavior\n * @param options.boundaries The boundaries of the stage\n * @param options.onBoundary A callback function that is called when the entity hits a boundary\n * @param options.stopMovement Whether to stop the entity's movement when it hits a boundary\n * @returns A behavior callback with type 'update' and a handler function\n */\nexport function boundary2d(\n\toptions: Partial<BoundaryOptions> = {}\n): { type: BehaviorCallbackType; handler: (ctx: UpdateContext<MoveableEntity>) => void } {\n\treturn {\n\t\ttype: 'update' as BehaviorCallbackType,\n\t\thandler: (updateContext: UpdateContext<MoveableEntity>) => {\n\t\t\t_boundary2d(updateContext, options);\n\t\t}\n\t};\n}\n\ntype BoundaryHit = 'top' | 'bottom' | 'left' | 'right';\n\ntype BoundaryHits = Record<BoundaryHit, boolean>;\n\nfunction _boundary2d(updateContext: UpdateContext<MoveableEntity>, options: Partial<BoundaryOptions>) {\n\tconst { me: entity } = updateContext;\n\tconst { boundaries, onBoundary } = {\n\t\t...defaultBoundaryOptions,\n\t\t...options\n\t};\n\n\tconst position = entity.getPosition();\n\tif (!position) return;\n\n\tlet boundariesHit: BoundaryHits = { top: false, bottom: false, left: false, right: false };\n\n\tif (position.x <= boundaries.left) {\n\t\tboundariesHit.left = true;\n\t} else if (position.x >= boundaries.right) {\n\t\tboundariesHit.right = true;\n\t}\n\n\tif (position.y <= boundaries.bottom) {\n\t\tboundariesHit.bottom = true;\n\t} else if (position.y >= boundaries.top) {\n\t\tboundariesHit.top = true;\n\t}\n\n\tconst stopMovement = options.stopMovement ?? true;\n\tif (stopMovement && boundariesHit) {\n\t\tconst velocity = entity.getVelocity() ?? { x: 0, y: 0, z: 0 };\n\t\tlet { x: newX, y: newY } = velocity;\n\t\tif (velocity?.y < 0 && boundariesHit.bottom) {\n\t\t\tnewY = 0;\n\t\t} else if (velocity?.y > 0 && boundariesHit.top) {\n\t\t\tnewY = 0;\n\t\t}\n\t\tif (velocity?.x < 0 && boundariesHit.left) {\n\t\t\tnewX = 0;\n\t\t} else if (velocity?.x > 0 && boundariesHit.right) {\n\t\t\tnewX = 0;\n\t\t}\n\t\tentity.moveXY(newX, newY);\n\t}\n\tif (onBoundary && boundariesHit) {\n\t\tonBoundary({\n\t\t\tme: entity,\n\t\t\tboundary: boundariesHit,\n\t\t\tposition: { x: position.x, y: position.y, z: position.z },\n\t\t\tupdateContext\n\t\t});\n\t}\n}","import { ActiveCollisionTypes, ColliderDesc, RigidBodyDesc, RigidBodyType, Vector3 } from \"@dimforge/rapier3d-compat\";\nimport { Vec3 } from \"../core/vector\";\n\n/**\n * Options for configuring entity collision behavior.\n */\nexport interface CollisionOptions {\n\tstatic?: boolean;\n\tsensor?: boolean;\n\tsize?: Vector3;\n\tposition?: Vector3;\n\tcollisionType?: string;\n\tcollisionFilter?: string[];\n}\n\nconst typeToGroup = new Map<string, number>();\nlet nextGroupId = 0;\n\nexport function getOrCreateCollisionGroupId(type: string): number {\n\tlet groupId = typeToGroup.get(type);\n\tif (groupId === undefined) {\n\t\tgroupId = nextGroupId++ % 16;\n\t\ttypeToGroup.set(type, groupId);\n\t}\n\treturn groupId;\n}\n\nexport function createCollisionFilter(allowedTypes: string[]): number {\n\tlet filter = 0;\n\tallowedTypes.forEach(type => {\n\t\tconst groupId = getOrCreateCollisionGroupId(type);\n\t\tfilter |= (1 << groupId);\n\t});\n\treturn filter;\n}\n\nexport class CollisionBuilder {\n\tstatic: boolean = false;\n\tsensor: boolean = false;\n\tgravity: Vec3 = new Vector3(0, 0, 0);\n\n\tbuild(options: Partial<CollisionOptions>): [RigidBodyDesc, ColliderDesc] {\n\t\tconst bodyDesc = this.bodyDesc({\n\t\t\tisDynamicBody: !this.static\n\t\t});\n\t\tconst collider = this.collider(options);\n\t\tconst type = options.collisionType;\n\t\tif (type) {\n\t\t\tlet groupId = getOrCreateCollisionGroupId(type);\n\t\t\tlet filter = 0b1111111111111111;\n\t\t\tif (options.collisionFilter) {\n\t\t\t\tfilter = createCollisionFilter(options.collisionFilter);\n\t\t\t}\n\t\t\tcollider.setCollisionGroups((groupId << 16) | filter);\n\t\t}\n\t\tconst { KINEMATIC_FIXED, DEFAULT } = ActiveCollisionTypes;\n\t\tcollider.activeCollisionTypes = (this.sensor) ? KINEMATIC_FIXED : DEFAULT;\n\t\treturn [bodyDesc, collider];\n\t}\n\n\twithCollision(collisionOptions: Partial<CollisionOptions>): this {\n\t\tthis.sensor = collisionOptions?.sensor ?? this.sensor;\n\t\tthis.static = collisionOptions?.static ?? this.static;\n\t\treturn this;\n\t}\n\n\tcollider(options: CollisionOptions): ColliderDesc {\n\t\tconst size = options.size ?? new Vector3(1, 1, 1);\n\t\tconst half = { x: size.x / 2, y: size.y / 2, z: size.z / 2 };\n\t\tlet colliderDesc = ColliderDesc.cuboid(half.x, half.y, half.z);\n\t\treturn colliderDesc;\n\t}\n\n\tbodyDesc({ isDynamicBody = true }): RigidBodyDesc {\n\t\tconst type = isDynamicBody ? RigidBodyType.Dynamic : RigidBodyType.Fixed;\n\t\tconst bodyDesc = new RigidBodyDesc(type)\n\t\t\t.setTranslation(0, 0, 0)\n\t\t\t.setGravityScale(1.0)\n\t\t\t.setCanSleep(false)\n\t\t\t.setCcdEnabled(true);\n\t\treturn bodyDesc;\n\t}\n}","import type { GameEntity } from \"../entities/entity\";\nimport { getOrCreateCollisionGroupId } from \"./collision-builder\";\n\n/**\n * A branded bitmask representing a set of collision types.\n */\nexport type CollisionMask = number & { readonly __brand: \"CollisionMask\" };\n\nexport type NameSelector = string | string[] | RegExp;\n\nexport type CollisionSelector =\n\t| { name: NameSelector }\n\t| { mask: CollisionMask | RegExp }\n\t| { test: (other: GameEntity<any>) => boolean };\n\n/**\n * Returns true if the `other` entity matches the provided selector.\n */\nexport function matchesCollisionSelector(other: GameEntity<any>, selector?: CollisionSelector): boolean {\n\tif (!selector) return true;\n\tconst otherName = other.name ?? '';\n\tif ('name' in selector) {\n\t\tconst sel = selector.name as NameSelector;\n\t\tif (sel instanceof RegExp) {\n\t\t\treturn sel.test(otherName);\n\t\t} else if (Array.isArray(sel)) {\n\t\t\treturn sel.some(s => s === otherName);\n\t\t} else {\n\t\t\treturn otherName === sel;\n\t\t}\n\t} else if ('mask' in selector) {\n\t\tconst m = selector.mask as CollisionMask | RegExp;\n\t\tif (m instanceof RegExp) {\n\t\t\tconst type = other.collisionType ?? '';\n\t\t\treturn m.test(type);\n\t\t} else {\n\t\t\tconst type = other.collisionType ?? '';\n\t\t\tconst gid = getOrCreateCollisionGroupId(type);\n\t\t\treturn ((m as number) & (1 << gid)) !== 0;\n\t\t}\n\t} else if ('test' in selector) {\n\t\treturn !!selector.test(other);\n\t}\n\treturn true;\n}\n","import { CollisionContext, GameEntity } from '../../../entities/entity';\nimport { MoveableEntity } from '../../capabilities/moveable';\nimport { matchesCollisionSelector } from '../../../collision/utils';\nimport { Ricochet2DCollisionOptions, clamp, Ricochet2DCollisionCallback } from './ricochet';\n\n/**\n * Behavior for ricocheting an entity off other objects in 2D\n */\nexport function ricochet2DCollision(\n\toptions: Partial<Ricochet2DCollisionOptions> = {},\n\tcallback?: Ricochet2DCollisionCallback\n): { type: 'collision'; handler: (ctx: CollisionContext<MoveableEntity, GameEntity<any>>) => void } {\n\treturn {\n\t\ttype: 'collision',\n\t\thandler: (collisionContext: CollisionContext<MoveableEntity, GameEntity<any>>) => {\n\t\t\t_handleRicochet2DCollision(collisionContext, options, callback);\n\t\t},\n\t};\n}\n\nfunction _handleRicochet2DCollision(\n\tcollisionContext: CollisionContext<MoveableEntity, GameEntity<any>>,\n\toptions: Partial<Ricochet2DCollisionOptions>,\n\tcallback?: Ricochet2DCollisionCallback\n) {\n\tconst { entity, other } = collisionContext;\n\tconst self = entity as unknown as GameEntity<any> & MoveableEntity;\n\tif (other.collider?.isSensor()) return;\n\n\tconst {\n\t\tminSpeed = 2,\n\t\tmaxSpeed = 20,\n\t\tseparation = 0,\n\t\tcollisionWith = undefined,\n\t} = {\n\t\t...options,\n\t} as Ricochet2DCollisionOptions;\n\tconst reflectionMode: 'simple' | 'angled' = (options as any)?.reflectionMode ?? 'angled';\n\tconst maxAngleDeg = (options as any)?.maxAngleDeg ?? 60;\n\tconst speedUpFactor = (options as any)?.speedUpFactor ?? 1.05;\n\tconst minOffsetForAngle = (options as any)?.minOffsetForAngle ?? 0.15; // 0..1\n\tconst centerRetentionFactor = (options as any)?.centerRetentionFactor ?? 0.5; // keep some Y on center hits\n\n\tif (!matchesCollisionSelector(other, collisionWith)) return;\n\n\tconst selfPos = self.getPosition();\n\tconst otherPos = other.body?.translation();\n\tconst vel = self.getVelocity();\n\tif (!selfPos || !otherPos || !vel) return;\n\n\tlet newVelX = vel.x;\n\tlet newVelY = vel.y;\n\tlet newX = selfPos.x;\n\tlet newY = selfPos.y;\n\n\tconst dx = selfPos.x - otherPos.x;\n\tconst dy = selfPos.y - otherPos.y;\n\n\tlet extentX: number | null = null;\n\tlet extentY: number | null = null;\n\tconst colliderShape: any = other.collider?.shape as any;\n\tif (colliderShape) {\n\t\tif (colliderShape.halfExtents) {\n\t\t\textentX = Math.abs(colliderShape.halfExtents.x ?? colliderShape.halfExtents[0] ?? null);\n\t\t\textentY = Math.abs(colliderShape.halfExtents.y ?? colliderShape.halfExtents[1] ?? null);\n\t\t}\n\t\tif ((extentX == null || extentY == null) && (typeof colliderShape.radius === 'number')) {\n\t\t\textentX = extentX ?? Math.abs(colliderShape.radius);\n\t\t\textentY = extentY ?? Math.abs(colliderShape.radius);\n\t\t}\n\t}\n\tif ((extentX == null || extentY == null) && typeof (other.collider as any)?.halfExtents === 'function') {\n\t\tconst he = (other.collider as any).halfExtents();\n\t\tif (he) {\n\t\t\textentX = extentX ?? Math.abs(he.x);\n\t\t\textentY = extentY ?? Math.abs(he.y);\n\t\t}\n\t}\n\tif ((extentX == null || extentY == null) && typeof (other.collider as any)?.radius === 'function') {\n\t\tconst r = (other.collider as any).radius();\n\t\tif (typeof r === 'number') {\n\t\t\textentX = extentX ?? Math.abs(r);\n\t\t\textentY = extentY ?? Math.abs(r);\n\t\t}\n\t}\n\n\tlet relX = 0;\n\tlet relY = 0;\n\tif (extentX && extentY) {\n\t\trelX = clamp(dx / extentX, -1, 1);\n\t\trelY = clamp(dy / extentY, -1, 1);\n\t} else {\n\t\trelX = Math.sign(dx);\n\t\trelY = Math.sign(dy);\n\t}\n\tlet bounceVertical = Math.abs(dy) >= Math.abs(dx);\n\n\tlet selfExtentX: number | null = null;\n\tlet selfExtentY: number | null = null;\n\tconst selfShape: any = self.collider?.shape as any;\n\tif (selfShape) {\n\t\tif (selfShape.halfExtents) {\n\t\t\tselfExtentX = Math.abs(selfShape.halfExtents.x ?? selfShape.halfExtents[0] ?? null);\n\t\t\tselfExtentY = Math.abs(selfShape.halfExtents.y ?? selfShape.halfExtents[1] ?? null);\n\t\t}\n\t\tif ((selfExtentX == null || selfExtentY == null) && (typeof selfShape.radius === 'number')) {\n\t\t\tselfExtentX = selfExtentX ?? Math.abs(selfShape.radius);\n\t\t\tselfExtentY = selfExtentY ?? Math.abs(selfShape.radius);\n\t\t}\n\t}\n\tif ((selfExtentX == null || selfExtentY == null) && typeof (self.collider as any)?.halfExtents === 'function') {\n\t\tconst heS = (self.collider as any).halfExtents();\n\t\tif (heS) {\n\t\t\tselfExtentX = selfExtentX ?? Math.abs(heS.x);\n\t\t\tselfExtentY = selfExtentY ?? Math.abs(heS.y);\n\t\t}\n\t}\n\tif ((selfExtentX == null || selfExtentY == null) && typeof (self.collider as any)?.radius === 'function') {\n\t\tconst rS = (self.collider as any).radius();\n\t\tif (typeof rS === 'number') {\n\t\t\tselfExtentX = selfExtentX ?? Math.abs(rS);\n\t\t\tselfExtentY = selfExtentY ?? Math.abs(rS);\n\t\t}\n\t}\n\n\tif (extentX != null && extentY != null && selfExtentX != null && selfExtentY != null) {\n\t\tconst penX = (selfExtentX + extentX) - Math.abs(dx);\n\t\tconst penY = (selfExtentY + extentY) - Math.abs(dy);\n\t\tif (!Number.isNaN(penX) && !Number.isNaN(penY)) {\n\t\t\tbounceVertical = penY <= penX;\n\t\t}\n\t}\n\n\tlet usedAngleDeflection = false;\n\tif (bounceVertical) {\n\t\tconst resolvedY = (extentY ?? 0) + (selfExtentY ?? 0) + separation;\n\t\tnewY = otherPos.y + (dy > 0 ? resolvedY : -resolvedY);\n\t\tnewX = selfPos.x;\n\n\t\tconst isHorizontalPaddle = extentX != null && extentY != null && extentX > extentY;\n\t\tif (isHorizontalPaddle && reflectionMode === 'angled') {\n\t\t\tconst maxAngleRad = (maxAngleDeg * Math.PI) / 180;\n\t\t\tconst deadzone = Math.max(0, Math.min(1, minOffsetForAngle));\n\t\t\tconst clampedOffsetX = clamp(relX, -1, 1);\n\t\t\tconst absOff = Math.abs(clampedOffsetX);\n\t\t\tconst baseSpeed = Math.sqrt(vel.x * vel.x + vel.y * vel.y);\n\t\t\tconst speed = clamp(baseSpeed * speedUpFactor, minSpeed, maxSpeed);\n\t\t\tif (absOff > deadzone) {\n\t\t\t\tconst t = (absOff - deadzone) / (1 - deadzone);\n\t\t\t\tconst angle = Math.sign(clampedOffsetX) * (t * maxAngleRad);\n\t\t\t\tconst cosA = Math.cos(angle);\n\t\t\t\tconst sinA = Math.sin(angle);\n\t\t\t\tconst vy = Math.abs(speed * cosA);\n\t\t\t\tconst vx = speed * sinA;\n\t\t\t\tnewVelY = dy > 0 ? vy : -vy;\n\t\t\t\tnewVelX = vx;\n\t\t\t} else {\n\t\t\t\tconst vx = vel.x * centerRetentionFactor;\n\t\t\t\tconst vyMagSquared = Math.max(0, speed * speed - vx * vx);\n\t\t\t\tconst vy = Math.sqrt(vyMagSquared);\n\t\t\t\tnewVelY = dy > 0 ? vy : -vy;\n\t\t\t\tnewVelX = vx;\n\t\t\t}\n\t\t\tusedAngleDeflection = true;\n\t\t} else {\n\t\t\t// Simple vertical reflection (or non-paddle surface)\n\t\t\tnewVelY = dy > 0 ? Math.abs(vel.y) : -Math.abs(vel.y);\n\t\t\tif (reflectionMode === 'simple') usedAngleDeflection = true;\n\t\t}\n\t} else {\n\t\tconst resolvedX = (extentX ?? 0) + (selfExtentX ?? 0) + separation;\n\t\tnewX = otherPos.x + (dx > 0 ? resolvedX : -resolvedX);\n\t\tnewY = selfPos.y;\n\n\t\tif (reflectionMode === 'angled') {\n\t\t\tconst maxAngleRad = (maxAngleDeg * Math.PI) / 180;\n\t\t\tconst deadzone = Math.max(0, Math.min(1, minOffsetForAngle));\n\t\t\tconst clampedOffsetY = clamp(relY, -1, 1);\n\t\t\tconst absOff = Math.abs(clampedOffsetY);\n\t\t\tconst baseSpeed = Math.sqrt(vel.x * vel.x + vel.y * vel.y);\n\t\t\tconst speed = clamp(baseSpeed * speedUpFactor, minSpeed, maxSpeed);\n\t\t\tif (absOff > deadzone) {\n\t\t\t\tconst t = (absOff - deadzone) / (1 - deadzone);\n\t\t\t\tconst angle = Math.sign(clampedOffsetY) * (t * maxAngleRad);\n\t\t\t\tconst cosA = Math.cos(angle);\n\t\t\t\tconst sinA = Math.sin(angle);\n\t\t\t\tconst vx = Math.abs(speed * cosA);\n\t\t\t\tconst vy = speed * sinA;\n\t\t\t\tnewVelX = dx > 0 ? vx : -vx;\n\t\t\t\tnewVelY = vy;\n\t\t\t} else {\n\t\t\t\tconst vy = vel.y * centerRetentionFactor;\n\t\t\t\tconst vxMagSquared = Math.max(0, speed * speed - vy * vy);\n\t\t\t\tconst vx = Math.sqrt(vxMagSquared);\n\t\t\t\tnewVelX = dx > 0 ? vx : -vx;\n\t\t\t\tnewVelY = vy;\n\t\t\t}\n\t\t\tusedAngleDeflection = true;\n\t\t} else {\n\t\t\tnewVelX = dx > 0 ? Math.abs(vel.x) : -Math.abs(vel.x);\n\t\t\tnewVelY = vel.y;\n\t\t\tusedAngleDeflection = true;\n\t\t}\n\t}\n\n\tif (!usedAngleDeflection) {\n\t\tconst additionBaseX = Math.abs(newVelX);\n\t\tconst additionBaseY = Math.abs(newVelY);\n\t\tconst addX = Math.sign(relX) * Math.abs(relX) * additionBaseX;\n\t\tconst addY = Math.sign(relY) * Math.abs(relY) * additionBaseY;\n\t\tnewVelX += addX;\n\t\tnewVelY += addY;\n\t}\n\tconst currentSpeed = Math.sqrt(newVelX * newVelX + newVelY * newVelY);\n\tif (currentSpeed > 0) {\n\t\tconst targetSpeed = clamp(currentSpeed, minSpeed, maxSpeed);\n\t\tif (targetSpeed !== currentSpeed) {\n\t\t\tconst scale = targetSpeed / currentSpeed;\n\t\t\tnewVelX *= scale;\n\t\t\tnewVelY *= scale;\n\t\t}\n\t}\n\n\tif (newX !== selfPos.x || newY !== selfPos.y) {\n\t\tself.setPosition(newX, newY, selfPos.z);\n\t\tself.moveXY(newVelX, newVelY);\n\t\tif (callback) {\n\t\t\tconst velocityAfter = self.getVelocity();\n\t\t\tif (velocityAfter) {\n\t\t\t\tcallback({\n\t\t\t\t\tposition: { x: newX, y: newY, z: selfPos.z },\n\t\t\t\t\t...collisionContext,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}","import { Vector } from '@dimforge/rapier3d-compat';\nimport { MoveableEntity } from '../../capabilities/moveable';\nimport { CollisionContext, GameEntity } from '../../../entities/entity';\nimport { UpdateContext } from '../../../core/base-node-life-cycle';\nimport { CollisionSelector } from '../../../collision/utils';\n\nexport interface RicochetEvent extends Partial<UpdateContext<MoveableEntity>> {\n\tboundary?: 'top' | 'bottom' | 'left' | 'right';\n\tposition: Vector;\n\tvelocityBefore: Vector;\n\tvelocityAfter: Vector;\n}\n\nexport interface RicochetCollisionEvent extends CollisionContext<MoveableEntity, GameEntity<any>> {\n\tposition: Vector;\n}\n\nexport interface Ricochet2DInBoundsOptions {\n\trestitution?: number;\n\tminSpeed?: number;\n\tmaxSpeed?: number;\n\tboundaries: {\n\t\ttop: number;\n\t\tbottom: number;\n\t\tleft: number;\n\t\tright: number;\n\t};\n\tseparation?: number;\n}\n\nexport interface Ricochet2DCollisionOptions {\n\trestitution?: number;\n\tminSpeed?: number;\n\tmaxSpeed?: number;\n\tseparation?: number;\n\tcollisionWith?: CollisionSelector;\n\t/**\n\t * Choose between simple axis inversion or angled (paddle-style) reflection.\n\t * Defaults to 'angled'.\n\t */\n\treflectionMode?: 'simple' | 'angled';\n}\n\nexport type Ricochet2DCallback = (event: RicochetEvent) => void;\nexport type Ricochet2DCollisionCallback = (event: RicochetCollisionEvent) => void;\n\nexport function clamp(value: number, min: number, max: number): number {\n\treturn Math.max(min, Math.min(max, value));\n}\n\nexport { ricochet2DInBounds } from './ricochet-2d-in-bounds';\nexport { ricochet2DCollision } from './ricochet-2d-collision';","import { UpdateContext } from '../../../core/base-node-life-cycle';\nimport { MoveableEntity } from '../../capabilities/moveable';\nimport { Ricochet2DInBoundsOptions, Ricochet2DCallback, clamp } from './ricochet';\nimport { BehaviorCallbackType } from '../../../entities/entity';\n\n/**\n * Behavior for ricocheting an entity within fixed 2D boundaries\n */\nexport function ricochet2DInBounds(\n\toptions: Partial<Ricochet2DInBoundsOptions> = {},\n\tcallback?: Ricochet2DCallback\n): { type: BehaviorCallbackType; handler: (ctx: UpdateContext<MoveableEntity>) => void } {\n\treturn {\n\t\ttype: 'update' as BehaviorCallbackType,\n\t\thandler: (updateContext: UpdateContext<MoveableEntity>) => {\n\t\t\t_handleRicochet2DInBounds(updateContext, options, callback);\n\t\t},\n\t};\n}\n\nfunction _handleRicochet2DInBounds(\n\tupdateContext: UpdateContext<MoveableEntity>,\n\toptions: Partial<Ricochet2DInBoundsOptions>,\n\tcallback?: Ricochet2DCallback\n) {\n\tconst { me } = updateContext;\n\tconst {\n\t\trestitution = 0,\n\t\tminSpeed = 2,\n\t\tmaxSpeed = 20,\n\t\tboundaries = { top: 5, bottom: -5, left: -6.5, right: 6.5 },\n\t\tseparation = 0.0\n\t} = { ...options } as Ricochet2DInBoundsOptions;\n\n\tconst position = me.getPosition();\n\tconst velocity = me.getVelocity();\n\tif (!position || !velocity) return;\n\n\tlet newVelX = velocity.x;\n\tlet newVelY = velocity.y;\n\tlet newX = position.x;\n\tlet newY = position.y;\n\tlet ricochetBoundary: 'top' | 'bottom' | 'left' | 'right' | null = null;\n\n\tif (position.x <= boundaries.left) {\n\t\tnewVelX = Math.abs(velocity.x);\n\t\tnewX = boundaries.left + separation;\n\t\tricochetBoundary = 'left';\n\t} else if (position.x >= boundaries.right) {\n\t\tnewVelX = -Math.abs(velocity.x);\n\t\tnewX = boundaries.right - separation;\n\t\tricochetBoundary = 'right';\n\t}\n\n\tif (position.y <= boundaries.bottom) {\n\t\tnewVelY = Math.abs(velocity.y);\n\t\tnewY = boundaries.bottom + separation;\n\t\tricochetBoundary = 'bottom';\n\t} else if (position.y >= boundaries.top) {\n\t\tnewVelY = -Math.abs(velocity.y);\n\t\tnewY = boundaries.top - separation;\n\t\tricochetBoundary = 'top';\n\t}\n\n\tconst currentSpeed = Math.sqrt(newVelX * newVelX + newVelY * newVelY);\n\tif (currentSpeed > 0) {\n\t\tconst targetSpeed = clamp(currentSpeed, minSpeed, maxSpeed);\n\t\tif (targetSpeed !== currentSpeed) {\n\t\t\tconst scale = targetSpeed / currentSpeed;\n\t\t\tnewVelX *= scale;\n\t\t\tnewVelY *= scale;\n\t\t}\n\t}\n\n\tif (restitution) {\n\t\tnewVelX *= restitution;\n\t\tnewVelY *= restitution;\n\t}\n\n\tif (newX !== position.x || newY !== position.y) {\n\t\tme.setPosition(newX, newY, position.z);\n\t\tme.moveXY(newVelX, newVelY);\n\n\t\tif (callback && ricochetBoundary) {\n\t\t\tconst velocityAfter = me.getVelocity();\n\t\t\tif (velocityAfter) {\n\t\t\t\tcallback({\n\t\t\t\t\tboundary: ricochetBoundary,\n\t\t\t\t\tposition: { x: newX, y: newY, z: position.z },\n\t\t\t\t\tvelocityBefore: velocity,\n\t\t\t\t\tvelocityAfter,\n\t\t\t\t\t...updateContext,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}"],"mappings":";AAuBA,IAAM,yBAA0C;AAAA,EAC/C,YAAY;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACR;AAAA,EACA,cAAc;AACf;AAWO,SAAS,WACf,UAAoC,CAAC,GACmD;AACxF,SAAO;AAAA,IACN,MAAM;AAA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uBAAmB;AAAA,EACpB;AAEA,MAAI,SAAS,KAAK,WAAW,QAAQ;AACpC,cAAU,KAAK,IAAI,SAAS,CAAC;AAC7B,WAAO,WAAW,SAAS;AAC3B,uBAAmB;AAAA,EACpB,WAAW,SAAS,KAAK,WAAW,KAAK;AACxC,cAAU,CAAC,KAAK,IAAI,SAAS,CAAC;AAC9B,WAAO,WAAW,MAAM;AACxB,uBAAmB;AAAA,EACpB;AAEA,QAAM,eAAe,KAAK,KAAK,UAAU,UAAU,UAAU,OAAO;AACpE,MAAI,eAAe,GAAG;AACrB,UAAM,cAAc,MAAM,cAAc,UAAU,QAAQ;AAC1D,QAAI,gBAAgB,cAAc;AACjC,YAAM,QAAQ,cAAc;AAC5B,iBAAW;AACX,iBAAW;AAAA,IACZ;AAAA,EACD;AAEA,MAAI,aAAa;AAChB,eAAW;AACX,eAAW;AAAA,EACZ;AAEA,MAAI,SAAS,SAAS,KAAK,SAAS,SAAS,GAAG;AAC/C,OAAG,YAAY,MAAM,MAAM,SAAS,CAAC;AACrC,OAAG,OAAO,SAAS,OAAO;AAE1B,QAAI,YAAY,kBAAkB;AACjC,YAAM,gBAAgB,GAAG,YAAY;AACrC,UAAI,eAAe;AAClB,iBAAS;AAAA,UACR,UAAU;AAAA,UACV,UAAU,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE;AAAA,UAC5C,gBAAgB;AAAA,UAChB;AAAA,UACA,GAAG;AAAA,QACJ,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
@@ -1,116 +0,0 @@
1
- import { Object3D, Camera, Vector2, WebGLRenderer, Scene, Vector3 } from 'three';
2
- import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
3
- import { S as StageEntity } from './entity-Bq_eNEDI.js';
4
-
5
- declare const Perspectives: {
6
- readonly FirstPerson: "first-person";
7
- readonly ThirdPerson: "third-person";
8
- readonly Isometric: "isometric";
9
- readonly Flat2D: "flat-2d";
10
- readonly Fixed2D: "fixed-2d";
11
- };
12
- type PerspectiveType = (typeof Perspectives)[keyof typeof Perspectives];
13
-
14
- interface CameraDebugState {
15
- enabled: boolean;
16
- selected: string[];
17
- }
18
- interface CameraDebugDelegate {
19
- subscribe(listener: (state: CameraDebugState) => void): () => void;
20
- resolveTarget(uuid: string): Object3D | null;
21
- }
22
-
23
- /**
24
- * Interface for perspective-specific camera controllers
25
- */
26
- interface PerspectiveController {
27
- setup(params: {
28
- screenResolution: Vector2;
29
- renderer: WebGLRenderer;
30
- scene: Scene;
31
- camera: ZylemCamera;
32
- }): void;
33
- update(delta: number): void;
34
- resize(width: number, height: number): void;
35
- }
36
- declare class ZylemCamera {
37
- cameraRig: Object3D | null;
38
- camera: Camera;
39
- screenResolution: Vector2;
40
- renderer: WebGLRenderer;
41
- composer: EffectComposer;
42
- _perspective: PerspectiveType;
43
- target: StageEntity | null;
44
- sceneRef: Scene | null;
45
- frustumSize: number;
46
- perspectiveController: PerspectiveController | null;
47
- private orbitController;
48
- constructor(perspective: PerspectiveType, screenResolution: Vector2, frustumSize?: number);
49
- /**
50
- * Setup the camera with a scene
51
- */
52
- setup(scene: Scene): Promise<void>;
53
- /**
54
- * Update camera and render
55
- */
56
- update(delta: number): void;
57
- /**
58
- * Check if debug mode is active (orbit controls taking over camera)
59
- */
60
- isDebugModeActive(): boolean;
61
- /**
62
- * Dispose renderer, composer, controls, and detach from scene
63
- */
64
- destroy(): void;
65
- /**
66
- * Attach a delegate to react to debug state changes.
67
- */
68
- setDebugDelegate(delegate: CameraDebugDelegate | null): void;
69
- /**
70
- * Resize camera and renderer
71
- */
72
- resize(width: number, height: number): void;
73
- /**
74
- * Update renderer pixel ratio (DPR)
75
- */
76
- setPixelRatio(dpr: number): void;
77
- /**
78
- * Create camera based on perspective type
79
- */
80
- private createCameraForPerspective;
81
- /**
82
- * Initialize perspective-specific controller
83
- */
84
- private initializePerspectiveController;
85
- private createThirdPersonCamera;
86
- private createFirstPersonCamera;
87
- private createIsometricCamera;
88
- private createFlat2DCamera;
89
- private createFixed2DCamera;
90
- private moveCamera;
91
- move(position: Vector3): void;
92
- rotate(pitch: number, yaw: number, roll: number): void;
93
- /**
94
- * Check if this perspective type needs a camera rig
95
- */
96
- private needsRig;
97
- /**
98
- * Get the DOM element for the renderer
99
- */
100
- getDomElement(): HTMLCanvasElement;
101
- }
102
-
103
- interface CameraOptions {
104
- perspective?: PerspectiveType;
105
- position?: Vector3;
106
- target?: Vector3;
107
- zoom?: number;
108
- screenResolution?: Vector2;
109
- }
110
- declare class CameraWrapper {
111
- cameraRef: ZylemCamera;
112
- constructor(camera: ZylemCamera);
113
- }
114
- declare function camera(options: CameraOptions): CameraWrapper;
115
-
116
- export { type CameraDebugDelegate as C, type PerspectiveType as P, ZylemCamera as Z, Perspectives as a, type CameraDebugState as b, camera as c, CameraWrapper as d };