melonjs 20.1.1 → 20.2.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 (40) hide show
  1. package/README.md +2 -2
  2. package/build/application/settings.d.ts +3 -2
  3. package/build/application/settings.d.ts.map +1 -1
  4. package/build/index.js +1304 -219
  5. package/build/index.js.map +4 -4
  6. package/build/input/pointerevent.d.ts.map +1 -1
  7. package/build/particles/emitter.d.ts +81 -3
  8. package/build/particles/emitter.d.ts.map +1 -1
  9. package/build/particles/particle.d.ts +62 -1
  10. package/build/particles/particle.d.ts.map +1 -1
  11. package/build/particles/settings.d.ts +50 -7
  12. package/build/particles/settings.d.ts.map +1 -1
  13. package/build/renderable/container.d.ts +10 -0
  14. package/build/renderable/container.d.ts.map +1 -1
  15. package/build/renderable/entity/entity.d.ts +10 -0
  16. package/build/renderable/entity/entity.d.ts.map +1 -1
  17. package/build/renderable/renderable.d.ts +106 -22
  18. package/build/renderable/renderable.d.ts.map +1 -1
  19. package/build/video/blendmodes.d.ts +107 -0
  20. package/build/video/blendmodes.d.ts.map +1 -0
  21. package/build/video/canvas/canvas_renderer.d.ts +28 -24
  22. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  23. package/build/video/effects/blendEffect.d.ts +57 -0
  24. package/build/video/effects/blendEffect.d.ts.map +1 -0
  25. package/build/video/renderer.d.ts +3 -4
  26. package/build/video/renderer.d.ts.map +1 -1
  27. package/build/video/rendertarget/canvasrendertarget.d.ts +1 -0
  28. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  29. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  30. package/build/video/webgl/glshader.d.ts.map +1 -1
  31. package/build/video/webgl/utils/program.d.ts.map +1 -1
  32. package/build/video/webgl/webgl_renderer.d.ts +116 -29
  33. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  34. package/build/video/webgpu/batchers/quad_batcher.d.ts +7 -0
  35. package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
  36. package/build/video/webgpu/pipeline/cache.d.ts +0 -9
  37. package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
  38. package/build/video/webgpu/webgpu_renderer.d.ts +100 -6
  39. package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
  40. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"pointerevent.d.ts","sourceRoot":"","sources":["../../src/input/pointerevent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAepD,OAAO,OAAO,MAAM,cAAc,CAAC;AAoBnC;;;GAGG;AACH,eAAO,IAAI,IAAI,EAAE,WAAW,CAAC;AAggB7B;;GAEG;AACH,eAAO,IAAI,kBAAkB,EAAE,WAAW,GAAG,IAAW,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,OAAiC,CAAC;AAExD;;GAEG;AACH,eAAO,IAAI,MAAM,EAAE,OAAe,CAAC;AAEnC;;;;GAIG;AACH,eAAO,IAAI,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;AAElD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAY1E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,iBAAiB,EAC1B,KAAK,CAAC,EAAE,MAAM,GACZ,IAAI,CAEN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAanD;AAED;;;;;GAKG;AACH,wBA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;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAY1E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,iBAAiB,EAC1B,KAAK,CAAC,EAAE,MAAM,GACZ,IAAI,CAEN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAanD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAGnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,oBAAoB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,GAC5C,IAAI,CAsCN;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,GAAG,EACX,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,GAC7C,IAAI,CAiCN;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAMzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAMzC"}
@@ -1,11 +1,56 @@
1
+ import { Matrix3d } from "../math/matrix3d.ts";
1
2
  import Container from "./../renderable/container.js";
3
+ import type CanvasRenderer from "../video/canvas/canvas_renderer.js";
2
4
  import CanvasRenderTarget from "../video/rendertarget/canvasrendertarget.js";
5
+ import type WebGLRenderer from "../video/webgl/webgl_renderer.js";
3
6
  import { type ParticleEmitterSettings } from "./settings.ts";
4
7
  /**
5
8
  * Particle Emitter Object.
9
+ *
10
+ * ### Blend modes
11
+ *
12
+ * An emitter draws no pixels of its own: every {@link Particle} is a
13
+ * renderable in its own right and carries its own blend mode. Assigning
14
+ * `emitter.blendMode` applies the mode to the particles — both the ones
15
+ * already alive and, through {@link ParticleEmitterSettings.blendMode}, the
16
+ * ones emitted afterwards. The change is picked up on the emitter's next
17
+ * `update`, so within the same frame.
18
+ *
19
+ * ```js
20
+ * emitter.blendMode = "overlay"; // live particles AND future ones
21
+ * ```
22
+ *
23
+ * ### Reference space
24
+ *
25
+ * A particle stores a position, and
26
+ * {@link ParticleEmitterSettings.referenceSpace} decides what that position is
27
+ * measured against. By default it is the emitter, so a moving emitter carries
28
+ * its whole cloud along — right for a flame or an aura, wrong for anything
29
+ * emitted and then abandoned. Set it to `"world"` and the position names a
30
+ * place in the level instead, so the emitter moves away and leaves the
31
+ * particles behind; that is a trail. Pass a {@link Container} to measure from
32
+ * something else entirely.
33
+ *
34
+ * Changing it at runtime — by assigning the property or through
35
+ * {@link ParticleEmitter#reset} — re-bases the particles already alive, so the
36
+ * cloud does not jump; only its subsequent motion changes.
37
+ *
38
+ * Two things are worth knowing before reaching for a non-local space. The
39
+ * emitter is treated as always visible while it has live particles, because
40
+ * otherwise a trail would vanish the moment the emitter that made it scrolled
41
+ * off-screen (the particles themselves are still culled individually). And
42
+ * `clipping` or a `backgroundColor` on the emitter would be applied in the
43
+ * emitter's own frame rather than the particles', so neither composes with
44
+ * this.
45
+ *
46
+ * ```js
47
+ * // exhaust that stays where it was emitted
48
+ * const emitter = new ParticleEmitter(x, y, { referenceSpace: "world" });
49
+ * ```
6
50
  * @category Particles
7
51
  */
8
52
  export default class ParticleEmitter extends Container {
53
+ #private;
9
54
  /**
10
55
  * the current (active) emitter settings (with defaults merged in)
11
56
  */
@@ -37,6 +82,19 @@ export default class ParticleEmitter extends Container {
37
82
  * @ignore
38
83
  */
39
84
  _deltaInv: number;
85
+ /**
86
+ * Maps an emitter-local spawn point into the reference frame the particles
87
+ * live in, so a particle is BORN where the emitter is even though its
88
+ * position is thereafter measured from somewhere else. `undefined` in
89
+ * local mode, where the two frames coincide and no mapping is needed.
90
+ *
91
+ * Held per emitter (not a module scratch) because particles read it during
92
+ * their own reset, after `addParticles` has computed it. One matrix per
93
+ * emitter that actually uses a non-local space — emitters are few, unlike
94
+ * particles, which allocate nothing.
95
+ * @ignore
96
+ */
97
+ _spawnMap: Matrix3d | undefined;
40
98
  /**
41
99
  * @param x - x position of the particle emitter
42
100
  * @param y - y position of the particle emitter
@@ -68,11 +126,21 @@ export default class ParticleEmitter extends Container {
68
126
  * app.world.removeChild(emitter);
69
127
  */
70
128
  constructor(x: number, y: number, settings?: Partial<ParticleEmitterSettings>);
129
+ reset(settings?: Partial<ParticleEmitterSettings>): void;
71
130
  /**
72
- * Reset the emitter with particle emitter settings.
73
- * @param settings - object with emitter settings. See {@link ParticleEmitterSettings}
131
+ * What a particle's position is measured against — see
132
+ * {@link ParticleEmitterSettings.referenceSpace}.
133
+ *
134
+ * Assigning this re-bases every particle already alive into the new frame,
135
+ * so nothing jumps: the cloud stays exactly where it is on screen and only
136
+ * its subsequent motion differs. Passing it through
137
+ * {@link ParticleEmitter#reset} does the same.
138
+ * @default "local"
139
+ * @example
140
+ * emitter.referenceSpace = "world"; // start leaving a trail
74
141
  */
75
- reset(settings?: Partial<ParticleEmitterSettings>): void;
142
+ get referenceSpace(): "local" | "world" | Container;
143
+ set referenceSpace(space: "local" | "world" | Container);
76
144
  /**
77
145
  * returns a random point on the x axis within the bounds of this emitter
78
146
  * @returns a random x position within the emitter bounds
@@ -83,6 +151,16 @@ export default class ParticleEmitter extends Container {
83
151
  * @returns a random y position within the emitter bounds
84
152
  */
85
153
  getRandomPointY(): number;
154
+ /**
155
+ * Draw the particles in their reference frame rather than the emitter's.
156
+ *
157
+ * The correction goes in before `super.draw()` because that is where the
158
+ * child walk happens; translations and the correction compose, and in
159
+ * local mode there is no correction and this is the inherited path
160
+ * untouched.
161
+ * @ignore
162
+ */
163
+ draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Parameters<Container["draw"]>[1]): void;
86
164
  /** @ignore */
87
165
  addParticles(count: number): void;
88
166
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/particles/emitter.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAErD,OAAO,kBAAkB,MAAM,6CAA6C,CAAC;AAE7E,OAA+B,EAC9B,KAAK,uBAAuB,EAC5B,MAAM,eAAe,CAAC;AAmCvB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;IACrD;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAC;IAElC,cAAc;IACd,OAAO,EAAE,OAAO,CAAC;IAEjB,cAAc;IACd,eAAe,EAAE,MAAM,CAAC;IAExB,cAAc;IACd,cAAc,EAAE,MAAM,CAAC;IAEvB,cAAc;IACd,QAAQ,EAAE,OAAO,CAAC;IAElB,cAAc;IACd,YAAY,EAAE,MAAM,CAAC;IAErB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IAEZ,cAAc;IACd,gBAAgB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAEjD;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;gBAEF,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,GAAE,OAAO,CAAC,uBAAuB,CAAM;IAoChD;;;OAGG;IACM,KAAK,CAAC,QAAQ,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAAG,IAAI;IAqCrE;;;OAGG;IACH,eAAe,IAAI,M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
1
2
  import { Vector2d } from "../math/vector2d.ts";
2
3
  import Renderable from "../renderable/renderable.js";
3
4
  import CanvasRenderer from "../video/canvas/canvas_renderer.js";
@@ -8,6 +9,7 @@ import ParticleEmitter from "./emitter.ts";
8
9
  * @category Particles
9
10
  */
10
11
  export default class Particle extends Renderable {
12
+ #private;
11
13
  vel: Vector2d;
12
14
  image: HTMLCanvasElement | HTMLImageElement;
13
15
  life: number;
@@ -18,7 +20,6 @@ export default class Particle extends Renderable {
18
20
  wind: number;
19
21
  followTrajectory: boolean;
20
22
  onlyInViewport: boolean;
21
- accurateBounds: boolean;
22
23
  _deltaInv: number;
23
24
  _halfW: number;
24
25
  _halfH: number;
@@ -28,6 +29,26 @@ export default class Particle extends Renderable {
28
29
  * @param emitter - the particle emitter
29
30
  */
30
31
  constructor(emitter: ParticleEmitter);
32
+ /**
33
+ * Whether the bounds need recomputing before anyone reads them.
34
+ *
35
+ * A `Renderable` refreshes its bounds eagerly, from a callback fired on
36
+ * every `pos` assignment. That is the right trade for a scene object, and
37
+ * the wrong one for a particle: `update()` writes `pos.x` and `pos.y`
38
+ * separately, so the callback fires TWICE per particle per frame, and both
39
+ * runs happen before `currentTransform` is rebuilt — deriving bounds from
40
+ * the previous frame's matrix and then throwing that away. Measured, the
41
+ * redundant pass was about two thirds of the whole particle update loop.
42
+ *
43
+ * So a particle invalidates instead of recomputing, and pays once, on
44
+ * read, for particles something actually looks at.
45
+ *
46
+ * Deliberately not a `#private` field: `updateBounds()` is reached from the
47
+ * base constructor chain (`Polygon.setVertices`) before a subclass's field
48
+ * initializers have run, and writing an undeclared private field throws.
49
+ * @ignore
50
+ */
51
+ _boundsDirty: boolean;
31
52
  /**
32
53
  * @ignore
33
54
  */
@@ -39,6 +60,46 @@ export default class Particle extends Renderable {
39
60
  * @param dt - time since the last update in milliseconds
40
61
  */
41
62
  update(dt: number): boolean;
63
+ /**
64
+ * `autoTransform` is off (see `onResetEvent`), so the base `preDraw` will
65
+ * not apply the matrix — append it here instead, unconjugated. Appending
66
+ * after `super` rather than splicing into it is order-equivalent for a
67
+ * particle specifically: no flip, no mask, and the anchor is zeroed, so
68
+ * nothing the base method emits interacts with this.
69
+ * @ignore
70
+ */
71
+ preDraw(renderer: CanvasRenderer | WebGLRenderer): void;
72
+ /**
73
+ * `currentTransform` already places the particle, so the frame it
74
+ * produces is positioned — only the ancestors' contribution is still
75
+ * missing. The base implementation would add this particle's own `pos` on
76
+ * top of a matrix that already contains it, counting it twice.
77
+ * @ignore
78
+ */
79
+ /**
80
+ * Bounds are recomputed here rather than when `pos` moves, so a particle
81
+ * nothing looks at this frame pays nothing at all.
82
+ *
83
+ * `updateBounds()` deliberately keeps its eager contract — a caller that
84
+ * asks for a recompute, such as {@link Container} aggregating child bounds
85
+ * under `enableChildBoundsUpdate`, still gets fresh values back.
86
+ * @ignore
87
+ */
88
+ getBounds(): Bounds;
89
+ updateBounds(absolute?: boolean): any;
90
+ /**
91
+ * A particle is positioned within its reference frame, which is not
92
+ * necessarily its parent — so summing up the ancestor chain, as the base
93
+ * implementation does, would measure from the wrong place.
94
+ * @ignore
95
+ */
96
+ getAbsolutePosition(): any;
97
+ /**
98
+ * With the placement in `currentTransform` and `autoTransform` off, the
99
+ * base composition would describe a transform this class never applies.
100
+ * @ignore
101
+ */
102
+ getLocalTransform(out: Matrix3d): Matrix3d;
42
103
  /**
43
104
  * @ignore
44
105
  */
@@ -1 +1 @@
1
- {"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/particles/particle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB,CAAC;AAG7D,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAErD,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,aAAa,MAAM,kCAAkC,CAAC;AAC7D,OAAO,eAAe,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC/C,GAAG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AgB,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;gBACS,OAAO,EAAE,eAAe;IAiBpC;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,UAAQ;IAEpB;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,GAAE,OAAe;IA2HnE;;;;;OAKG;IACM,MAAM,CAAC,EAAE,EAAE,MAAM;IA0G1B;;;;;;;OAOG;IACM,OAAO,CAAC,QAAQ,EAAE,cAAc,GAAG,aAAa;IAOzD;;;;;;OAMG;IACH;;;;;;;;OAQG;IACM,SAAS;IAQT,YAAY,CAAC,QAAQ,UAAO;IAkDrC;;;;;OAKG;IACM,mBAAmB;IAiB5B;;;;OAIG;IACM,iBAAiB,CAAC,GAAG,EAAE,QAAQ;IAIxC;;OAEG;IACM,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,aAAa;CAMtD;AAED,eAAO,MAAM,YAAY,wEAWxB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type Container from "../renderable/container.js";
1
2
  import type ParticleEmitter from "./emitter.ts";
2
3
  /**
3
4
  * Configuration shape for {@link ParticleEmitter}.
@@ -129,9 +130,13 @@ export interface ParticleEmitterSettings {
129
130
  /**
130
131
  * Blend mode applied when rendering particles. If different than "normal",
131
132
  * supersedes the `textureAdditive` setting.
133
+ *
134
+ * Each particle copies this when it is BORN, so changing it here affects
135
+ * particles emitted from that point on. To change the mode of particles
136
+ * already alive as well, assign {@link ParticleEmitter#blendMode} instead —
137
+ * it updates this setting and every live particle together.
132
138
  * @default "normal"
133
- * @see {@link CanvasRenderer#setBlendMode}
134
- * @see {@link WebGLRenderer#setBlendMode}
139
+ * @see {@link CanvasRenderer#setBlendMode} for the full list of modes
135
140
  */
136
141
  blendMode: string;
137
142
  /**
@@ -146,6 +151,40 @@ export interface ParticleEmitterSettings {
146
151
  * @default false
147
152
  */
148
153
  floating: boolean;
154
+ /**
155
+ * What a particle's position is measured against.
156
+ *
157
+ * A particle stores a position, and this decides what that position is
158
+ * relative to. The difference is whether an effect is *attached* to the
159
+ * emitter or *emitted and abandoned* by it.
160
+ *
161
+ * | value | measured from | use |
162
+ * | --- | --- | --- |
163
+ * | `"local"` | the emitter | a flame, an aura, anything welded on |
164
+ * | `"world"` | the container the emitter sits in | trails, smoke, exhaust, dust |
165
+ * | a {@link Container} | that container | a moving frame of reference |
166
+ *
167
+ * With `"local"` a moving emitter drags its whole cloud along, because a
168
+ * particle's stored position never named a place in the level — it meant
169
+ * "this far from my emitter". With `"world"` the position is a place, so
170
+ * the emitter moves away and leaves the particles behind; only newly
171
+ * emitted ones appear at the new location. Passing a `Container` measures
172
+ * from that instead, for the case where the right frame is neither: snow
173
+ * drifting inside a moving carriage travels with the carriage without
174
+ * being welded to the vent that emits it.
175
+ *
176
+ * `"world"` resolves to the emitter's parent container rather than the
177
+ * root, so a level that moves carries its own trails with it. Pass the
178
+ * container explicitly if you want a different one.
179
+ *
180
+ * Changing this at runtime re-bases the particles already alive, so
181
+ * nothing jumps — only their subsequent motion differs.
182
+ * @default "local"
183
+ * @example
184
+ * // exhaust that stays where it was emitted
185
+ * const emitter = new ParticleEmitter(x, y, { referenceSpace: "world" });
186
+ */
187
+ referenceSpace: "local" | "world" | Container;
149
188
  /**
150
189
  * Maximum number of particles launched each tick (stream mode only).
151
190
  * @default 10
@@ -169,12 +208,16 @@ export interface ParticleEmitterSettings {
169
208
  */
170
209
  framesToSkip: number;
171
210
  /**
172
- * When `true`, each particle refreshes its bounding box every frame so the
173
- * hitbox tracks the visual exactly (useful for debug visualization or
174
- * collision queries). When `false` (default), bounds reflect the previous
175
- * frame's transform — sufficient for viewport culling and significantly
176
- * cheaper at high particle counts.
211
+ * No longer has any effect, and kept only so existing configurations keep
212
+ * working.
213
+ *
214
+ * It used to trade hitbox accuracy for speed, because bounds were
215
+ * recomputed eagerly on every position write — twice per particle per
216
+ * frame, from a transform that had not been rebuilt yet. Particles now
217
+ * invalidate on write and recompute once on read, so the bounds a reader
218
+ * gets are always current.
177
219
  * @default false
220
+ * @deprecated since 20.2.0 — bounds are always up to date; remove it
178
221
  */
179
222
  accurateBounds: boolean;
180
223
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/particles/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,cAAc,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAExD;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,WAAW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,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IAE9C;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC1D;AAED;;;GAGG;AACH,QAAA,MAAM,8BAA8B,EAAE,uBAkCrC,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
@@ -369,6 +369,16 @@ export default class Container extends Renderable {
369
369
  * @ignore
370
370
  */
371
371
  _sortY(a: any, b: any): number;
372
+ /**
373
+ * A container additionally offsets its children by its own position — the
374
+ * `translate()` at the top of {@link Container#draw} — which is what makes
375
+ * a child's coordinates mean "relative to my parent" rather than naming a
376
+ * place in the world. A leaf renderable has no such term.
377
+ * @protected
378
+ * @param {Matrix3d} out - matrix to write into
379
+ * @returns {Matrix3d} `out`, for chaining
380
+ */
381
+ protected getLocalTransform(out: Matrix3d): Matrix3d;
372
382
  }
373
383
  import Renderable from "./renderable.js";
374
384
  import type { Color } from "./../math/color.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EA+GjB;IAxGA;;;OAGG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;OAGG;IACH,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,GAAC,UAAU,GAAC,eAAe,GAAC,UAAU,GAAC,UAAU,aAAS,aAAa,GAAC,eAAe,GAAC,YAAY,GAAC,IAAI,GAAC,UAAU,QAapL;IAED;;;OAGG;IACH,oBAFW,UAAU,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GAAC,OAAO,GAAC,SAAS,GAAC,UAAU,GAAC,eAAe,GAAC,UAAU,GAAC,UAAU,aAAS,aAAa,GAAC,eAAe,GAAC,YAAY,GAAC,IAAI,GAAC,UAAU,QAiBpL;IAED;;;OAGG;IACH,iBAFW,OAAO,QA8BjB;IAED;;;;;;;;OAQG;IACH,oBAFW,OAAO,QAoBjB;IAgBD;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,sCAEC;IAED;;;;;;;;;;;;;;;OAeG;IACH,mCAiBC;IAED;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,+BAEC;CA2LD;uBA9vCsB,iBAAiB;2BAyGhB,oBAAoB;wBACrB,oBAAoB;wBACpB,aAAa;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;+BAEd,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;4BACxB,wBAAwB"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EA+GjB;IAxGA;;;OAGG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;OAGG;IACH,4BAAyB;IAEzB;;;;;OAKG;IACH,SAHU,MAAM,CAGE;IAClB,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OA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AI,GAAC,UAAU,QAapL;IAED;;;OAGG;IACH,oBAFW,UAAU,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GAAC,OAAO,GAAC,SAAS,GAAC,UAAU,GAAC,eAAe,GAAC,UAAU,GAAC,UAAU,aAAS,aAAa,GAAC,eAAe,GAAC,YAAY,GAAC,IAAI,GAAC,UAAU,QAiBpL;IAED;;;OAGG;IACH,iBAFW,OAAO,QA8BjB;IAED;;;;;;;;OAQG;IACH,oBAFW,OAAO,QAoBjB;IAgBD;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,sCAEC;IAED;;;;;;;;;;;;;;;OAeG;IACH,mCAiBC;IAED;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,+BAEC;IA8FD;;;;;;;;OAQG;IACH,iCAHW,QAAQ,GACN,QAAQ,CAMpB;CA+FD;uBA7wCsB,iBAAiB;2BAyGhB,oBAAoB;wBACrB,oBAAoB;wBACpB,aAAa;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;+BAEd,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;4BACxB,wBAAwB"}
@@ -220,6 +220,16 @@ export default class Entity extends Renderable {
220
220
  */
221
221
  onBodyUpdate(): void;
222
222
  preDraw(renderer: any): void;
223
+ /**
224
+ * An entity replaces {@link Renderable#preDraw} wholesale — no flip, no
225
+ * conjugation, no anchor offset, just its position biased by the body
226
+ * bounds — so the inherited composition would describe a transform this
227
+ * class never applies. Mirrors the `preDraw` above instead.
228
+ * @protected
229
+ * @param {Matrix3d} out - matrix to write into
230
+ * @returns {Matrix3d} `out`, for chaining
231
+ */
232
+ protected getLocalTransform(out: Matrix3d): Matrix3d;
223
233
  /**
224
234
  * onDeactivateEvent Notification function
225
235
  */
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/renderable/entity/entity.js"],"names":[],"mappings":"AAQA;;;;;;;;IAQI;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6IG;AACH;IACC,mCAAkC;IAElC;;;;;;;;;;;;;;;;;OAiBG;IACH,eAjBW,MAAM,KACN,MAAM,YAGd;QAAyB,KAAK,EAAtB,MAAM;QACW,MAAM,EAAvB,MAAM;QACY,IAAI;QACJ,EAAE;QACI,KAAK;QACkB,WAAW,GAA1D,MAAM,GAAC,QAAQ,GAAC;YAAC,CAAC,EAAC,MAAM,CAAC;YAAA,CAAC,EAAC,MAAM,CAAA;SAAC;QACjB,UAAU;QACV,WAAW;QACX,IAAI;QACJ,aAAa;QACc,MAAM;KAC3D,EA0FF;IA9EA;;;OAGG;IACH,gBAAkB;IAqFnB,sBAPU,UAAU,EAmBnB;IArBD;;;OAGG;IAEH,kBAHU,UAAU,CAKnB;IAnDA;;;OAGG;IACH,IAFU,MAAM,CAEW;IAE3B;;;;OAIG;IACH,OAFU,OAAO,CAEA;IAwDlB,cAAc;IACd,yBAKC;IAED;;;;OAIG;IACH,wBAHW,OAAO,GACL,MAAM,CA0BlB;IAED;;OAEG;IACH,qBAEC;IAED,6BAkBC;IAsCD;;OAEG;IACH,0BAIC;CACD;uBA/YsB,kBAAkB;4BAQhB,2BAA2B;0BAH7B,iCAAiC;6BAE9B,6BAA6B;0BAHhC,4BAA4B;6BAEzB,+BAA+B"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/renderable/entity/entity.js"],"names":[],"mappings":"AAQA;;;;;;;;IAQI;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6IG;AACH;IACC,mCAAkC;IAElC;;;;;;;;;;;;;;;;;OAiBG;IACH,eAjBW,MAAM,KACN,MAAM,YAGd;QAAyB,KAAK,EAAtB,MAAM;QACW,MAAM,EAAvB,MAAM;QACY,IAAI;QACJ,EAAE;QACI,KAAK;QACkB,WAAW,GAA1D,MAAM,GAAC,QAAQ,GAAC;YAAC,CAAC,EAAC,MAAM,CAAC;YAAA,CAAC,EAAC,MAAM,CAAA;SAAC;QACjB,UAAU;QACV,WAAW;QACX,IAAI;QACJ,aAAa;QACc,MAAM;KAC3D,EA0FF;IA9EA;;;OAGG;IACH,gBAAkB;IAqFnB,sBAPU,UAAU,EAmBnB;IArBD;;;OAGG;IAEH,kBAHU,UAAU,CAKnB;IAnDA;;;OAGG;IACH,IAFU,MAAM,CAEW;IAE3B;;;;OAIG;IACH,OAFU,OAAO,CAEA;IAwDlB,cAAc;IACd,yBAKC;IAED;;;;OAIG;IACH,wBAHW,OAAO,GACL,MAAM,CA0BlB;IAED;;OAEG;IACH,qBAEC;IAED,6BAkBC;IAED;;;;;;;;OAQG;IACH,iCAHW,QAAQ,GACN,QAAQ,CAgBpB;IAsCD;;OAEG;IACH,0BAIC;CACD;uBAxasB,kBAAkB;4BAQhB,2BAA2B;0BAH7B,iCAAiC;6BAE9B,6BAA6B;0BAHhC,4BAA4B;6BAEzB,+BAA+B"}
@@ -1,17 +1,3 @@
1
- /**
2
- * additional import for TypeScript
3
- * @import {Matrix3d} from "../math/matrix3d.ts";
4
- * @import Entity from "./entity/entity.js";
5
- * @import Container from "./container.js";
6
- * @import {Line} from "./../geometries/line.ts";
7
- * @import {Ellipse} from "./../geometries/ellipse.ts";
8
- * @import {Polygon} from "../geometries/polygon.ts";
9
- * @import {RoundRect} from "./../geometries/roundrect.ts";
10
- * @import Application from "./../application/application.ts";
11
- * @import CanvasRenderer from "./../video/canvas/canvas_renderer.js";
12
- * @import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
13
- * @import ResponseObject from "./../physics/response.js";
14
- **/
15
1
  /**
16
2
  * A base class for renderable objects.
17
3
  * @category Game Objects
@@ -261,7 +247,9 @@ export default class Renderable extends Rect {
261
247
  */
262
248
  _postEffectManaged: boolean;
263
249
  /**
264
- * the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
250
+ * the blend mode to be applied to this renderable — any of the modes
251
+ * listed on {@link CanvasRenderer#setBlendMode}, honoured identically by
252
+ * every renderer
265
253
  * @type {string}
266
254
  * @default "normal"
267
255
  * @see CanvasRenderer#setBlendMode
@@ -503,15 +491,111 @@ export default class Renderable extends Rect {
503
491
  */
504
492
  updateBounds(absolute?: boolean): Bounds;
505
493
  /**
506
- * return the renderable absolute position in the game world. The
507
- * returned vector is a {@link Vector3d} so the z component is summed
508
- * across the ancestor chain too — important for {@link Camera3d}'s
509
- * frustum culling, which previously read `obj.depth` (local
510
- * `pos.z`) and mis-culled children nested under a container with
511
- * its own non-zero depth.
512
- * @returns {Vector3d}
494
+ * Where this renderable IS in the game world — its own `pos` plus every
495
+ * ancestor's, as a {@link Vector3d} so the z component is summed across
496
+ * the chain too (important for {@link Camera3d}'s frustum culling, which
497
+ * previously read `obj.depth` — local `pos.z` — and mis-culled children
498
+ * nested under a container with its own non-zero depth).
499
+ *
500
+ * **Reach for this** for anything positional: culling, distance checks,
501
+ * hit tests, placing one renderable relative to another. It is cheap, and
502
+ * it is what the engine's own culling uses.
503
+ *
504
+ * **Reach for {@link Renderable#getWorldTransform} instead** when a
505
+ * position is not enough — when rotation, scale or flip along the ancestor
506
+ * chain matters, or when you need to map an arbitrary point rather than
507
+ * just the origin. This method sums translations only, so under a rotated
508
+ * or scaled ancestor it reports where the renderable's *pivot* is and
509
+ * nothing about how its content is oriented.
510
+ *
511
+ * Note the two also frame the question differently. This one is "where am
512
+ * I"; `getWorldTransform()` is "what space is my content drawn in". For a
513
+ * {@link Container} those coincide, because a container offsets its
514
+ * children by its own position. For a leaf they differ by exactly that
515
+ * position, which a leaf applies inside its own `draw()`.
516
+ *
517
+ * The returned vector is pooled and reused — copy it if you need to hold
518
+ * onto the value across another call.
519
+ * @returns {Vector3d} this renderable's absolute position
520
+ * @see Renderable#getWorldTransform
513
521
  */
514
522
  getAbsolutePosition(): Vector3d;
523
+ /**
524
+ * The transform this renderable interposes between its ancestor's frame
525
+ * and the frame its own content is drawn in — a mirror of what
526
+ * {@link Renderable#preDraw} applies to the renderer, as a matrix.
527
+ *
528
+ * **This is not {@link Renderable#currentTransform}.** A renderable's
529
+ * placement is split across two members: `pos` holds where it is, and
530
+ * `currentTransform` holds only what `rotate()` / `scale()` / `translate()`
531
+ * accumulate — it never contains the position. `preDraw` composes the two
532
+ * by conjugation, so a rotation pivots about the renderable's position
533
+ * rather than the origin. On a renderable you never rotated,
534
+ * `currentTransform` is therefore the *identity* and says nothing about
535
+ * where its content lands, while this method returns the translation that
536
+ * actually places it.
537
+ *
538
+ * {@link Container} extends this with the offset it applies to its
539
+ * children, which a leaf renderable does not have: a leaf's own `draw()`
540
+ * places itself from `pos`.
541
+ * @protected
542
+ * @param {Matrix3d} out - matrix to write into; nothing is stored on the
543
+ * renderable itself, so callers own the lifetime
544
+ * @returns {Matrix3d} `out`, for chaining
545
+ * @see Renderable#getWorldTransform
546
+ */
547
+ protected getLocalTransform(out: Matrix3d): Matrix3d;
548
+ /**
549
+ * The space this renderable's content is drawn IN, as a matrix — the full
550
+ * form of {@link Renderable#getAbsolutePosition}, which sums positions up
551
+ * the ancestor chain and therefore cannot represent the rotation, scale or
552
+ * flip accumulated along the way.
553
+ *
554
+ * **Reach for `getAbsolutePosition()` instead** for ordinary positional
555
+ * work — culling, distance checks, hit tests. It is cheaper and it is what
556
+ * the engine culls with. **Use this** when a position is not enough:
557
+ *
558
+ * - an ancestor is rotated or scaled, so a translation cannot describe the
559
+ * result
560
+ * - you need to map an arbitrary point, not just the origin — a corner, a
561
+ * click position, one renderable's coordinates into another's space
562
+ * - you need to compose or invert the transform (`inv(A) · B` converts
563
+ * between two frames, which is how `ParticleEmitter.referenceSpace`
564
+ * measures particles against a container that is not their parent)
565
+ *
566
+ * The two also frame the question differently, and it shows on a leaf.
567
+ * `getAbsolutePosition()` is "where am I"; this is "what space is my
568
+ * content drawn in". For a {@link Container} those coincide, because a
569
+ * container offsets its children by its own position. For a leaf they
570
+ * differ by exactly that position, which a leaf applies inside its own
571
+ * `draw()`. So with no rotation, scale or flip anywhere, a container's
572
+ * translation column equals its `getAbsolutePosition()` while a leaf's
573
+ * equals its PARENT's.
574
+ *
575
+ * The walk stops at a `floating` ancestor, because a floating renderable
576
+ * draws in screen space: {@link Container#draw} resets the transform
577
+ * outright for those, so the chain genuinely ends there rather than
578
+ * continuing to the root.
579
+ *
580
+ * The camera needs no special handling — {@link Camera2d} folds its view
581
+ * transform into the root container's `currentTransform`, so it is picked
582
+ * up like any other level.
583
+ * @param {Matrix3d} out - matrix to write into; nothing is stored on the
584
+ * renderable itself, so callers own the lifetime
585
+ * @returns {Matrix3d} `out`, for chaining
586
+ * @see Renderable#getAbsolutePosition
587
+ * @example
588
+ * // map a point from one renderable's space into another's
589
+ * const from = a.getWorldTransform(new Matrix3d());
590
+ * const into = b.getWorldTransform(new Matrix3d()).invert();
591
+ * const point = new Vector2d(10, 20); // in a's space
592
+ * from.apply(point); // -> world
593
+ * into.apply(point); // -> b's space
594
+ * @example
595
+ * // just need to know where something is? use the cheaper call
596
+ * const where = renderable.getAbsolutePosition();
597
+ */
598
+ getWorldTransform(out: Matrix3d): Matrix3d;
515
599
  /**
516
600
  * Prepare the rendering context before drawing (automatically called by melonJS).
517
601
  * This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
@@ -1 +1 @@
1
- {"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;IAaI;AAEJ;;;GAGG;AACH;IAkBG,iBAAmB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,GAC1B,UAAU,CAgBtB;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,MACN,QAAQ,GACN,UAAU,CAStB;IAED;;;;;;;;;;OAUG;IACH,SALW,MAAM,MACN,MAAM,MACN,MAAM,GACJ,UAAU,CAOtB;IAED;;;;OAIG;IACH,UAHW,QAAQ,GACN,UAAU,CAKtB;IAED;;;;;;OAMG;IACH,aALW,MAAM,MACN,MAAM,MACN,MAAM,GACJ,UAAU,CAOtB;IAED;;;;OAIG;IAEH,WAJW,MAAM,GACJ,OAAO,CAKnB;IAED;;;;OAIG;IACH,wBAHW,OAAO,GACL,MAAM,CAwClB;IAED;;;;;;;;OAQG;IACH,uBAFa,QAAQ,CAYpB;IAED;;;;;;OAMG;IACH,kBAFW,cAAc,GAAC,aAAa,QA2EtC;IAED;;;;;;;;;;;;OAYG;IAEH,eAJW,cAAc,GAAC,aAAa,aAC5B,QAAQ,QAKlB;IAED;;;;;OAKG;IACH,mBAFW,cAAc,GAAC,aAAa,QAqBtC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,0CAZa,OAAO,CAoBnB;IAkCD;;;OAGG;IACH,8BA6DC;IAED;;;;;;OAMG;IACH,yBAFc,GAAC,EAAA,QAId;IAED;;;;;;;OAOG;IACH,0BAFc,GAAC,EAAA,QAId;IAED;;;;;;OAMG;IACH,4BAFc,GAAC,EAAA,QAId;CACD;qBA7oCoB,8BAA8B;gCADnB,kCAAkC;yBAKzC,qBAAqB;2BAWpB,gBAAgB;wBADnB,oBAAoB;+BAKf,8BAA8B;6BADhC,0BAA0B;0BAF7B,yBAAyB;6BACtB,4BAA4B;6BAG1B,iCAAiC;gCAC9B,sCAAsC;+BACvC,oCAAoC"}
1
+ {"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"AAyCA;;;GAGG;AACH;IAkBG,iBAAmB;IAGpB;;;;;;;;;;;;;;;OAeG;IACH,aAHU,eAAe,C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