melonjs 19.5.0 → 19.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 (120) hide show
  1. package/README.md +5 -4
  2. package/build/application/application.d.ts +34 -2
  3. package/build/application/application.d.ts.map +1 -1
  4. package/build/application/settings.d.ts +37 -1
  5. package/build/application/settings.d.ts.map +1 -1
  6. package/build/camera/camera2d.d.ts +59 -7
  7. package/build/camera/camera2d.d.ts.map +1 -1
  8. package/build/camera/camera3d.d.ts +335 -0
  9. package/build/camera/camera3d.d.ts.map +1 -0
  10. package/build/camera/frustum.d.ts +162 -0
  11. package/build/camera/frustum.d.ts.map +1 -0
  12. package/build/const.d.ts +30 -3
  13. package/build/const.d.ts.map +1 -1
  14. package/build/geometries/sphere.d.ts +105 -0
  15. package/build/geometries/sphere.d.ts.map +1 -0
  16. package/build/index.d.ts +6 -4
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +27639 -24686
  19. package/build/index.js.map +4 -4
  20. package/build/input/keyboard.d.ts.map +1 -1
  21. package/build/input/pointerevent.d.ts.map +1 -1
  22. package/build/lang/deprecated.d.ts +18 -0
  23. package/build/lang/deprecated.d.ts.map +1 -1
  24. package/build/loader/loadingscreen.d.ts +8 -0
  25. package/build/loader/loadingscreen.d.ts.map +1 -1
  26. package/build/loader/parsers/mtl.d.ts.map +1 -1
  27. package/build/loader/parsers/obj.d.ts.map +1 -1
  28. package/build/math/color.d.ts +43 -5
  29. package/build/math/color.d.ts.map +1 -1
  30. package/build/math/math.d.ts +44 -0
  31. package/build/math/math.d.ts.map +1 -1
  32. package/build/math/observableVector2d.d.ts +14 -2
  33. package/build/math/observableVector2d.d.ts.map +1 -1
  34. package/build/math/observableVector3d.d.ts +14 -2
  35. package/build/math/observableVector3d.d.ts.map +1 -1
  36. package/build/math/vector2d.d.ts +16 -2
  37. package/build/math/vector2d.d.ts.map +1 -1
  38. package/build/math/vector3d.d.ts +16 -2
  39. package/build/math/vector3d.d.ts.map +1 -1
  40. package/build/particles/emitter.d.ts.map +1 -1
  41. package/build/physics/adapter.d.ts +77 -0
  42. package/build/physics/adapter.d.ts.map +1 -1
  43. package/build/physics/broadphase/aabb3d.d.ts +115 -0
  44. package/build/physics/broadphase/aabb3d.d.ts.map +1 -0
  45. package/build/physics/broadphase/broadphase.d.ts +74 -0
  46. package/build/physics/broadphase/broadphase.d.ts.map +1 -0
  47. package/build/physics/broadphase/factory.d.ts +30 -0
  48. package/build/physics/broadphase/factory.d.ts.map +1 -0
  49. package/build/physics/broadphase/octree.d.ts +325 -0
  50. package/build/physics/broadphase/octree.d.ts.map +1 -0
  51. package/build/physics/broadphase/quadtree.d.ts +184 -0
  52. package/build/physics/broadphase/quadtree.d.ts.map +1 -0
  53. package/build/physics/builtin/body.d.ts +7 -3
  54. package/build/physics/builtin/body.d.ts.map +1 -1
  55. package/build/physics/builtin/builtin-adapter.d.ts +6 -1
  56. package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
  57. package/build/physics/builtin/raycast.d.ts.map +1 -1
  58. package/build/physics/world.d.ts +15 -4
  59. package/build/physics/world.d.ts.map +1 -1
  60. package/build/renderable/container.d.ts +51 -5
  61. package/build/renderable/container.d.ts.map +1 -1
  62. package/build/renderable/mesh.d.ts +85 -10
  63. package/build/renderable/mesh.d.ts.map +1 -1
  64. package/build/renderable/renderable.d.ts +9 -4
  65. package/build/renderable/renderable.d.ts.map +1 -1
  66. package/build/state/stage.d.ts +8 -0
  67. package/build/state/stage.d.ts.map +1 -1
  68. package/build/state/state.d.ts.map +1 -1
  69. package/build/system/device.d.ts +196 -310
  70. package/build/system/device.d.ts.map +1 -1
  71. package/build/system/event.d.ts +49 -0
  72. package/build/system/event.d.ts.map +1 -1
  73. package/build/system/fullscreen.d.ts +16 -0
  74. package/build/system/fullscreen.d.ts.map +1 -0
  75. package/build/system/platform.d.ts +32 -4
  76. package/build/system/platform.d.ts.map +1 -1
  77. package/build/system/timer.d.ts.map +1 -1
  78. package/build/utils/function.d.ts +7 -1
  79. package/build/utils/function.d.ts.map +1 -1
  80. package/build/utils/types.d.ts +5 -0
  81. package/build/utils/types.d.ts.map +1 -1
  82. package/build/video/buffer/vertex.d.ts +19 -4
  83. package/build/video/buffer/vertex.d.ts.map +1 -1
  84. package/build/video/canvas/canvas_renderer.d.ts +4 -4
  85. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  86. package/build/video/canvas_factory.d.ts +25 -0
  87. package/build/video/canvas_factory.d.ts.map +1 -0
  88. package/build/video/renderer.d.ts +89 -15
  89. package/build/video/renderer.d.ts.map +1 -1
  90. package/build/video/renderstate.d.ts +12 -0
  91. package/build/video/renderstate.d.ts.map +1 -1
  92. package/build/video/rendertarget/rendertarget.d.ts +3 -1
  93. package/build/video/rendertarget/rendertarget.d.ts.map +1 -1
  94. package/build/video/texture/cache.d.ts +5 -0
  95. package/build/video/texture/cache.d.ts.map +1 -1
  96. package/build/video/texture/resource.d.ts +22 -14
  97. package/build/video/texture/resource.d.ts.map +1 -1
  98. package/build/video/video.d.ts +3 -1
  99. package/build/video/video.d.ts.map +1 -1
  100. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  101. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  102. package/build/video/webgl/batchers/material_batcher.d.ts +9 -0
  103. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  104. package/build/video/webgl/batchers/mesh_batcher.d.ts +45 -1
  105. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  106. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
  107. package/build/video/webgl/batchers/quad_batcher.d.ts +2 -2
  108. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  109. package/build/video/webgl/glshader.d.ts +46 -16
  110. package/build/video/webgl/glshader.d.ts.map +1 -1
  111. package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts.map +1 -1
  112. package/build/video/webgl/shadereffect.d.ts +23 -4
  113. package/build/video/webgl/shadereffect.d.ts.map +1 -1
  114. package/build/video/webgl/utils/uniforms.d.ts +8 -0
  115. package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
  116. package/build/video/webgl/webgl_renderer.d.ts +2 -2
  117. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  118. package/package.json +3 -2
  119. package/build/physics/builtin/quadtree.d.ts +0 -112
  120. package/build/physics/builtin/quadtree.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/rendertarget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACzC;;OAEG;IACK,KAAK,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACK,MAAM,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAEZ;;;OAGG;IACH,MAAM,IAAI,IAAI;IAEd;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAEpD;;OAEG;IACH,QAAQ,CAAC,KAAK,IAAI,IAAI;IAEtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CACpB,CAAC,CAAC,EAAE,MAAM,EACV,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACb,SAAS;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC3D;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;IAKrC;;;;;OAKG;IACH,SAAS,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAiBhE"}
1
+ {"version":3,"file":"rendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/rendertarget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACzC;;OAEG;IACK,KAAK,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACK,MAAM,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,IAAI,IAAI,IAAI;IAEZ;;;OAGG;IACH,MAAM,IAAI,IAAI;IAEd;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAEpD;;OAEG;IACH,QAAQ,CAAC,KAAK,IAAI,IAAI;IAEtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CACpB,CAAC,CAAC,EAAE,MAAM,EACV,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACb,SAAS;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC3D;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;IAKrC;;;;;OAKG;IACH,SAAS,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAiBhE"}
@@ -30,6 +30,11 @@ declare class TextureCache {
30
30
  resetUnitAssignments(): void;
31
31
  /**
32
32
  * @ignore
33
+ *
34
+ * Hot-path note: `getUnit` / `peekUnit` / `freeTextureUnit` are
35
+ * called per-texture per-draw, so the `(source, repeat)` lookup is
36
+ * inlined here rather than going through a helper that allocates a
37
+ * `{source, repeat}` object on every call.
33
38
  */
34
39
  freeTextureUnit(texture: any): void;
35
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAIA;;;GAGG;AACH;IACC;;OAEG;IACH,8CAUC;IARA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IACvB,qBAAsB;IACtB,oBAA0B;IAC1B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BAuBC;IAED;;;;OAIG;IACH,6BAOC;IAED;;OAEG;IACH,oCAQC;IAED;;OAEG;IACH,2BAMC;IAED;;;OAGG;IACH,4BAGC;IAED;;;OAGG;IACH,yCAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAQC;IAED;;OAEG;IACH,gCAcC;CACD;8BAzM6B,+BAA+B"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAeA;;;GAGG;AACH;IACC;;OAEG;IACH,8CAsBC;IApBA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IAavB,qBAAsB;IACtB,oBAA0B;IAC1B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BAsBC;IAED;;;;OAIG;IACH,6BAIC;IAED;;;;;;;OAOG;IACH,oCAaC;IAED;;OAEG;IACH,2BAYC;IAED;;;OAGG;IACH,4BAKC;IAED;;;OAGG;IACH,yCAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAaC;IAED;;OAEG;IACH,gCAcC;CACD;8BAlP6B,+BAA+B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A texture data source that knows how to upload itself to a WebGL
2
+ * A texture data source that knows how to upload itself to a GPU
3
3
  * texture. Subclasses provide the actual upload logic for their kind
4
4
  * of source (raw buffer, image, compressed data, etc.).
5
5
  *
@@ -8,13 +8,18 @@
8
8
  * shape (`sources`, `activeAtlas`, `getTexture()`, plus `width` /
9
9
  * `height` / `premultipliedAlpha` / `repeat` / `filter`) the cache
10
10
  * uses for unit allocation and the batcher uses for `boundTextures`
11
- * bookkeeping. The cache therefore owns every `gl.bindTexture` call,
11
+ * bookkeeping. The cache therefore owns every backend bind call,
12
12
  * which keeps the JS-side binding state in lockstep with the actual
13
- * GL state across all texture kinds — image atlases included.
13
+ * backend state across all texture kinds — image atlases included.
14
14
  *
15
- * Subclasses MUST implement `upload(gl, target)`. The framework calls
16
- * it once per texture on first use (and again on forced re-upload via
17
- * `batcher.uploadTexture(resource, w, h, true)`).
15
+ * Subclasses MUST implement `upload(context, target)`. The framework
16
+ * calls it once per texture on first use (and again on forced re-upload
17
+ * via `batcher.uploadTexture(resource, w, h, true)`). `context` is the
18
+ * renderer's backend context (the value returned by
19
+ * `renderer.getContext()`) — a `WebGLRenderingContext` /
20
+ * `WebGL2RenderingContext` today, the WebGPU equivalent once that
21
+ * renderer lands. The signature stays the same; each concrete
22
+ * subclass uses whatever the context happens to be.
18
23
  *
19
24
  * @category Rendering
20
25
  */
@@ -50,19 +55,22 @@ export class TextureResource {
50
55
  /**
51
56
  * Returns the upload "source" the batcher hands to `createTexture2D`.
52
57
  * For a resource this is the resource itself — `createTexture2D`
53
- * dispatches to `resource.upload(gl, target)`.
58
+ * dispatches to `resource.upload(context, target)`.
54
59
  * @ignore
55
60
  */
56
61
  getTexture(): this;
57
62
  /**
58
- * Issue the `gl.texImage2D` (or equivalent) call that uploads this
59
- * resource's data into the currently-bound `TEXTURE_2D` slot.
60
- * Subclasses MUST override.
63
+ * Issue the backend-specific upload call (`gl.texImage2D` on WebGL,
64
+ * the WebGPU equivalent once that renderer lands) that places this
65
+ * resource's data into the currently-bound texture slot. Subclasses
66
+ * MUST override.
61
67
  * @abstract
62
- * @param {WebGLRenderingContext|WebGL2RenderingContext} gl
63
- * @param {number} target - `gl.TEXTURE_2D` (or future cube-map targets)
68
+ * @param {WebGLRenderingContext|WebGL2RenderingContext} context - the
69
+ * renderer's backend context, as returned by `renderer.getContext()`
70
+ * @param {number} target - the target to upload into (`TEXTURE_2D` on
71
+ * WebGL today, the WebGPU equivalent once that lands)
64
72
  */
65
- upload(gl: WebGLRenderingContext | WebGL2RenderingContext, target: number): void;
73
+ upload(context: WebGLRenderingContext | WebGL2RenderingContext, target: number): void;
66
74
  }
67
75
  /**
68
76
  * A texture sourced from a raw byte buffer. Used for synthesized
@@ -108,6 +116,6 @@ export class BufferTextureResource extends TextureResource {
108
116
  /** @type {string} */
109
117
  format: string;
110
118
  /** @ignore */
111
- upload(gl: any, target: any): void;
119
+ upload(context: any, target: any): void;
112
120
  }
113
121
  //# sourceMappingURL=resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/video/texture/resource.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IACC;;;;;;;;OAQG;IACH,qEAPG;QAAwB,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACY,kBAAkB;QAClB,MAAM;QACN,MAAM;KAElC,EAsBA;IAdA,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,sBAAsB;IACtB,oBADW,OAAO,CAC0B;IAC5C,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,+BAA+B;IAC/B,QADW,MAAM,GAAC,SAAS,CACP;IAGpB,2BAA2C;IAC3C,oBAA4B;IAG7B;;;;;OAKG;IACH,mBAEC;IAED;;;;;;;OAOG;IAEH,WAJW,qBAAqB,GAAC,sBAAsB,UAC5C,MAAM,QAKhB;CACD;AAED;;;;;;;;;;;;GAYG;AACH;IACC;;;;;;;;;;;;;;;;OAgBG;IACH,kBAhBW,eAAe,WAIvB;QAAyB,KAAK,EAAtB,MAAM;QACW,MAAM,EAAvB,MAAM;QACY,kBAAkB;QAClB,MAAM;QACN,MAAM;QACI,MAAM;KAM5C,EAOA;IAJA,8BAA8B;IAC9B,MADW,eAAe,CACV;IAChB,qBAAqB;IACrB,QADW,MAAM,CACsB;IAGxC,cAAc;IACd,mCAoCC;CACD"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/video/texture/resource.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;;;;;;;OAQG;IACH,qEAPG;QAAwB,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACY,kBAAkB;QAClB,MAAM;QACN,MAAM;KAElC,EAsBA;IAdA,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,sBAAsB;IACtB,oBADW,OAAO,CAC0B;IAC5C,qBAAqB;IACrB,QADW,MAAM,CACG;IACpB,+BAA+B;IAC/B,QADW,MAAM,GAAC,SAAS,CACP;IAGpB,2BAA2C;IAC3C,oBAA4B;IAG7B;;;;;OAKG;IACH,mBAEC;IAED;;;;;;;;;;OAUG;IAEH,gBANW,qBAAqB,GAAC,sBAAsB,UAE5C,MAAM,QAMhB;CACD;AAED;;;;;;;;;;;;GAYG;AACH;IACC;;;;;;;;;;;;;;;;OAgBG;IACH,kBAhBW,eAAe,WAIvB;QAAyB,KAAK,EAAtB,MAAM;QACW,MAAM,EAAvB,MAAM;QACY,kBAAkB;QAClB,MAAM;QACN,MAAM;QACI,MAAM;KAM5C,EAOA;IAJA,8BAA8B;IAC9B,MADW,eAAe,CACV;IAChB,qBAAqB;IACrB,QADW,MAAM,CACsB;IAGxC,cAAc;IACd,wCAoCC;CACD"}
@@ -26,12 +26,14 @@
26
26
  */
27
27
  export function init(width: number, height: number, options?: ApplicationSettings): boolean;
28
28
  /**
29
- * Create and return a new Canvas element
29
+ * Create and return a new Canvas element.
30
30
  * @memberof video
31
31
  * @param {number} width - width
32
32
  * @param {number} height - height
33
33
  * @param {boolean} [returnOffscreenCanvas=false] - will return an OffscreenCanvas if supported
34
34
  * @returns {HTMLCanvasElement|OffscreenCanvas} a new Canvas element of the given size
35
+ * @deprecated since 19.7.0 — use {@link Renderer.createCanvas} instead.
36
+ * @see Renderer.createCanvas
35
37
  */
36
38
  export function createCanvas(width: number, height: number, returnOffscreenCanvas?: boolean): HTMLCanvasElement | OffscreenCanvas;
37
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/video/video.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,4BAvBW,MAAM,UACN,MAAM,YACN,mBAAmB,GACjB,OAAO,CAyCnB;AAED;;;;;;;GAOG;AACH,oCALW,MAAM,UACN,MAAM,0BACN,OAAO,GACL,iBAAiB,GAAC,eAAe,CA0B7C;AAED;;;;;;GAMG;AACH,6BAJa,WAAW,CAMvB;AA3GD;;;;;;GAMG;AACH,qBAJU,cAAc,GAAC,aAAa,CAIX"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/video/video.js"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,4BAvBW,MAAM,UACN,MAAM,YACN,mBAAmB,GACjB,OAAO,CAyCnB;AAED;;;;;;;;;GASG;AACH,oCAPW,MAAM,UACN,MAAM,0BACN,OAAO,GACL,iBAAiB,GAAC,eAAe,CAO7C;AAED;;;;;;GAMG;AACH,6BAJa,WAAW,CAMvB;AAxFD;;;;;;GAMG;AACH,qBAJU,cAAc,GAAC,aAAa,CAIX"}
@@ -1 +1 @@
1
- {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,eAaC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QA8BlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAyEhB;CACD;;qBA7YoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
1
+ {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,eAaC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QA8BlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAgFhB;CACD;;qBApZoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAoEE;;;;;;OAMG;IACH,6GAAmD;IAEnD;;;;OAIG;IACH,uHAAkC;IAElC,gCAAoB;IACpB,+BAA4B;IAK7B;;;;;OAKG;IACH,2BAOC;IAsBD;;;;;;;;;;;;;;OAcG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAgBA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAahB;IAED;;;;;;;;;;OAUG;IACH,uBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAiBhB;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAbW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,cACP,gBAAgB,GAAC,iBAAiB,GAAC,IAAI,QA0EjD;CAwDD;wBAtXoC,mBAAmB;kCAIzB,0BAA0B"}
1
+ {"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAsEE;;;;;;OAMG;IACH,6GAAmD;IAEnD;;;;OAIG;IACH,uHAAkC;IAElC,gCAAoB;IACpB,+BAA4B;IAK7B;;;;;OAKG;IACH,2BAOC;IAsBD;;;;;;;;;;;;;;OAcG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAgBA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAahB;IAED;;;;;;;;;;OAUG;IACH,uBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAiBhB;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAbW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,cACP,gBAAgB,GAAC,iBAAiB,GAAC,IAAI,QAkHjD;CA0DD;wBAlaoC,mBAAmB;kCAIzB,0BAA0B"}
@@ -18,6 +18,15 @@ export class MaterialBatcher extends Batcher {
18
18
  * @ignore
19
19
  */
20
20
  boundTextures: any[] | undefined;
21
+ _onCacheReset: (() => void) | null | undefined;
22
+ /**
23
+ * Free resources used by the batcher. Currently unsubscribes the
24
+ * texture-cache-reset listener so a discarded batcher doesn't keep
25
+ * accumulating handlers (relevant on context loss / renderer
26
+ * teardown).
27
+ * @ignore
28
+ */
29
+ destroy(): void;
21
30
  /**
22
31
  * Create a WebGL texture from an image
23
32
  * @param {number} unit - Destination texture unit
@@ -1 +1 @@
1
- {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IA0BxB;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CAqJxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAiBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;;;;;;;;OASG;IACH,uBARW,YAAY,GAAC,eAAe,MAC5B,MAAM,MAGN,MAAM,UACN,OAAO,UACP,OAAO,OAiDjB;CACD;wBA/VuB,cAAc;kCAIP,0BAA0B"}
1
+ {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IAsBtB,+CAIC;IAKH;;;;;;OAMG;IACH,gBAKC;IAmBD;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CA0JxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QA+BnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;;;;;;;;OASG;IACH,uBARW,YAAY,GAAC,eAAe,MAC5B,MAAM,MAGN,MAAM,UACN,OAAO,UACP,OAAO,OAiDjB;CACD;wBAtZuB,cAAc;kCAIP,0BAA0B"}
@@ -1,6 +1,26 @@
1
1
  /**
2
2
  * A WebGL Batcher for rendering textured triangle meshes.
3
3
  * Uses indexed drawing to efficiently render arbitrary triangle geometry.
4
+ *
5
+ * Owns mesh-mode GL state ownership (since 19.7 / #1468):
6
+ *
7
+ * - {@link MeshBatcher#bind} enters mesh mode — enables `DEPTH_TEST` +
8
+ * `LEQUAL` + `depthMask`, disables `BLEND`, and runs a one-shot
9
+ * `clearDepth(1.0) + clear(DEPTH_BUFFER_BIT)` if the active target's
10
+ * depth attachment is still dirty. Subsequent mesh draws against the
11
+ * same target rely on the accumulated depth buffer.
12
+ * - {@link MeshBatcher#unbind} exits mesh mode — restores non-mesh
13
+ * defaults (`BLEND` on, `DEPTH_TEST` off, `depthMask` false) that the
14
+ * 2D rendering paths assume.
15
+ * - Subscribes to {@link event.RENDER_TARGET_CHANGED} (emitted by the
16
+ * renderer at frame-start `clear()`, non-camera FBO bind, post-effect
17
+ * FBO unbind) to re-arm the lazy depth clear whenever the active
18
+ * framebuffer's attachments change identity.
19
+ *
20
+ * The WebGLRenderer doesn't know any of this — `setBatcher("mesh")` calls
21
+ * `bind()` and the batcher sets up its own pass. Same lifecycle ports
22
+ * cleanly to a future WebGPU renderer: `bind()` becomes "begin a
23
+ * depth-enabled `RenderPassEncoder`", `unbind()` ends it.
4
24
  * @category Rendering
5
25
  */
6
26
  export default class MeshBatcher extends MaterialBatcher {
@@ -10,7 +30,31 @@ export default class MeshBatcher extends MaterialBatcher {
10
30
  */
11
31
  init(renderer: any): void;
12
32
  /**
13
- * Add a textured mesh to the batch
33
+ * Tracks whether the active framebuffer's depth attachment still
34
+ * needs a clear before this batcher's next draw. Flipped to
35
+ * `true` by the `RENDER_TARGET_CHANGED` listener installed
36
+ * below (frame start, post-effect FBO bind/unbind), back to
37
+ * `false` by the first `bind()` of the new target after the
38
+ * lazy clear runs. Lifts depth clearing from per-mesh (legacy)
39
+ * to per-target — same model Three.js uses. The GPU's `LEQUAL`
40
+ * depth test then resolves inter-mesh occlusion per pixel
41
+ * against the accumulated buffer.
42
+ * @ignore
43
+ */
44
+ _depthDirty: boolean | undefined;
45
+ _onTargetChanged: (() => void) | null | undefined;
46
+ /**
47
+ * Add a textured mesh to the batch. When the mesh has a
48
+ * `vertexColors` array (multi-material OBJ + bound MTL), each
49
+ * vertex's `aColor` attribute comes from that buffer instead of
50
+ * the shared `tint` argument — so multi-material rendering needs
51
+ * no extra draw calls per material vs single-material (large
52
+ * meshes still get chunked across multiple flushes to fit the
53
+ * vertex/index buffer limits — same behavior as single-material).
54
+ * The shared `tint` is then multiplied into each vertex color
55
+ * CPU-side (via `mulPackedARGB`, before `pushMesh`), preserving
56
+ * runtime flash / fade / team-color effects — the mesh shader
57
+ * itself just does `texture * aColor`, no extra uniform.
14
58
  * @param {object} mesh - a Mesh object with vertices, uvs, indices, and texture properties
15
59
  * @param {number} tint - tint color in UINT32 (argb) format
16
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BA+BC;IAED;;;;OAIG;IACH,cAHW,MAAM,QACN,MAAM,QA4EhB;CACD;gCAhI+B,uBAAuB"}
1
+ {"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;;OAGG;IACH,0BAuEC;IA1BA;;;;;;;;;;;OAWG;IACH,iCAAuB;IAStB,kDAEC;IA4DH;;;;;;;;;;;;;;OAcG;IACH,cAHW,MAAM,QACN,MAAM,QAuFhB;CACD;gCAtS+B,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/primitive_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAoCC;IALA;;;OAGG;IACH,sBAAyB;IA0B1B;;;;;OAKG;IACH,mBAJW,MAAM,SACN,KAAK,EAAE,gBACP,MAAM,QA2DhB;;CA0ED;wBAvNuB,cAAc;2BAId,gCAAgC"}
1
+ {"version":3,"file":"primitive_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/primitive_batcher.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAsCC;IALA;;;OAGG;IACH,sBAAyB;IA0B1B;;;;;OAKG;IACH,mBAJW,MAAM,SACN,KAAK,EAAE,gBACP,MAAM,QAqEhB;;CAuFD;wBAhPuB,cAAc;2BAId,gCAAgC"}
@@ -2,7 +2,7 @@
2
2
  * additional import for TypeScript
3
3
  * @import {TextureAtlas} from "./../../texture/atlas.js";
4
4
  */
5
- export const V_ARRAY: Vector2d[];
5
+ export const V_ARRAY: Vector3d[];
6
6
  /**
7
7
  * A WebGL Compositor object. This class handles all of the WebGL state<br>
8
8
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
@@ -76,7 +76,7 @@ export default class QuadBatcher extends MaterialBatcher {
76
76
  */
77
77
  addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean): void;
78
78
  }
79
- import { Vector2d } from "../../../math/vector2d.ts";
79
+ import { Vector3d } from "../../../math/vector3d.ts";
80
80
  import { MaterialBatcher } from "./material_batcher.js";
81
81
  import type { TextureAtlas } from "./../../texture/atlas.js";
82
82
  //# sourceMappingURL=quad_batcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAMH,iCAKE;AAEF;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAwDC;IAvDA;;;;OAIG;IACH,qCAA0D;IAyC1D;;;;;OAKG;IACH,qCAA2B;IAK5B;;;;OAIG;IACH,0BAQC;IAED;;;;OAIG;IACH,0BAIC;IAED;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAoDD;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QAoD/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAqDjB;CACD;yBApTwB,2BAA2B;gCAIpB,uBAAuB;kCAIxB,0BAA0B"}
1
+ {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAUH,iCAKE;AAEF;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BA0DC;IAzDA;;;;OAIG;IACH,qCAA0D;IA2C1D;;;;;OAKG;IACH,qCAA2B;IAK5B;;;;OAIG;IACH,0BAQC;IAED;;;;OAIG;IACH,0BAIC;IAED;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAyDD;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QAyD/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QA2DjB;CACD;yBA1UwB,2BAA2B;gCAIpB,uBAAuB;kCAIxB,0BAA0B"}
@@ -37,30 +37,57 @@ export default class GLShader {
37
37
  */
38
38
  gl: WebGLRenderingContext;
39
39
  /**
40
- * the vertex shader source code
41
- * @type {string}
40
+ * `true` once {@link destroy} has been called. After this flag is
41
+ * `true`, every method on the shader is a silent no-op — callers
42
+ * holding a stale reference (e.g. a still-registered update loop)
43
+ * do not crash the frame.
44
+ * @type {boolean}
45
+ * @readonly
42
46
  */
43
- vertex: string;
47
+ readonly destroyed: boolean;
44
48
  /**
45
- * the fragment shader source code
46
- * @type {string}
49
+ * `true` while the WebGL context is lost (and until it's
50
+ * restored). The GL program/attributes/uniforms are released
51
+ * during the suspended window but the shader source code is
52
+ * preserved so {@link _onContextRestored} can rebuild the
53
+ * program against the new context. User code generally doesn't
54
+ * read this — methods short-circuit internally — but it's
55
+ * available for diagnostic / debug-plugin tooling.
56
+ * @type {boolean}
57
+ * @readonly
47
58
  */
48
- fragment: string;
59
+ readonly suspended: boolean;
60
+ _sourceVertex: string;
61
+ _sourceFragment: string;
62
+ _precision: string | undefined;
63
+ _uniformCache: any;
64
+ program: WebGLProgram;
65
+ uniforms: object;
66
+ attributes: number[];
49
67
  /**
50
- * the location attributes of the shader
51
- * @type {GLint[]}
68
+ * (Re)compile the shader program against `this.gl` from the
69
+ * preserved source. Called from the constructor and from
70
+ * {@link _onContextRestored}. Replays any cached uniform values
71
+ * against the freshly-extracted uniforms proxy.
72
+ * @private
52
73
  */
53
- attributes: GLint[];
74
+ private _compile;
75
+ vertex: any;
76
+ fragment: any;
54
77
  /**
55
- * a reference to the shader program (once compiled)
56
- * @type {WebGLProgram}
78
+ * Handler for {@link ONCONTEXT_LOST}. Tears down the GL program
79
+ * but preserves the shader source + cached uniform values so the
80
+ * shader can be transparently rebuilt on context restore.
81
+ * @private
57
82
  */
58
- program: WebGLProgram;
83
+ private _onContextLost;
59
84
  /**
60
- * the uniforms of the shader
61
- * @type {object}
85
+ * Handler for {@link ONCONTEXT_RESTORED}. Re-compiles and
86
+ * re-links the shader against the new GL context, then replays
87
+ * any cached uniform values via {@link _compile}.
88
+ * @private
62
89
  */
63
- uniforms: object;
90
+ private _onContextRestored;
64
91
  /**
65
92
  * Installs this shader program as part of current rendering state
66
93
  */
@@ -87,7 +114,10 @@ export default class GLShader {
87
114
  */
88
115
  setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], stride: number): void;
89
116
  /**
90
- * destroy this shader objects resources (program, attributes, uniforms)
117
+ * destroy this shader objects resources (program, attributes, uniforms).
118
+ * Idempotent — calling destroy twice (or after a context-lost suspend)
119
+ * is safe. Unsubscribes from the renderer's context lost / restored
120
+ * events so a destroyed shader is never automatically resurrected.
91
121
  */
92
122
  destroy(): void;
93
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;OAGG;IACH,QAFU,MAAM,CAKf;IAED;;;OAGG;IACH,UAFU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,KAAK,EAAE,CAEiC;IAElD;;;OAGG;IACH,SAFU,YAAY,CAOrB;IAED;;;OAGG;IACH,UAFU,MAAM,CAE8B;IAM/C;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CASjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QAiB7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAmBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
1
+ {"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;;;;;OAOG;IACH,oBAHU,OAAO,CAGK;IAEtB;;;;;;;;;;OAUG;IACH,oBAHU,OAAO,CAGK;IAGtB,sBAA2B;IAC3B,wBAA+B;IAC/B,+BAA2B;IAG3B,mBAAwC;IAKvC,sBAAmB;IACnB,iBAAoB;IACpB,qBAAsB;IASxB;;;;;;OAMG;IACH,iBA0CC;IAzCA,YAGC;IACD,cAGC;IAoCF;;;;;OAKG;IACH,uBAgBC;IAED;;;;;OAKG;IACH,2BAMC;IAED;;OAEG;IACH,aAKC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CAYjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QA0C7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,gBA2BC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"orthogonal.d.ts","sourceRoot":"","sources":["../../../../../src/video/webgl/renderers/tmxlayer/orthogonal.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;OAEG;IACH,sBAFW,aAAa,EAkCvB;IA/BA,wBAAwB;IACxB,0BAAqB;IAUrB,iBAKC;IAMD,yBAA0B;IAI1B,2BAA4B;IAG5B,+BAA8B;IAC9B,+BAA8B;IAG/B;;;;;OAKG;IACH,cAyBC;IAED;;;;;;;;;OASG;IACH,eAIC;IAED;;;;;;;;OAQG;IACH,eAMC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gCANW,MAAM,aACN,MAAM,GAEJ;QAAC,QAAQ,EAAE,qBAAqB,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC;QAC3D,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,GAAC,SAAS,CA+ChD;IAED;;;;OAIG;IACH,oBAHW,QAAQ,GACN,qBAAqB,CA6BjC;IAED;;;;OAIG;IACH,YAHW,QAAQ,QACR,MAAM,QA0JhB;CACD;8CA1Y4C,yBAAyB;qBAPjD,mBAAmB;sCADF,8BAA8B;yCAO5B,qCAAqC"}
1
+ {"version":3,"file":"orthogonal.d.ts","sourceRoot":"","sources":["../../../../../src/video/webgl/renderers/tmxlayer/orthogonal.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;OAEG;IACH,sBAFW,aAAa,EAkCvB;IA/BA,wBAAwB;IACxB,0BAAqB;IAUrB,iBAKC;IAMD,yBAA0B;IAI1B,2BAA4B;IAG5B,+BAA8B;IAC9B,+BAA8B;IAG/B;;;;;OAKG;IACH,cAiCC;IAED;;;;;;;;;OASG;IACH,eAIC;IAED;;;;;;;;OAQG;IACH,eAMC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gCANW,MAAM,aACN,MAAM,GAEJ;QAAC,QAAQ,EAAE,qBAAqB,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC;QAC3D,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,GAAC,SAAS,CA+ChD;IAED;;;;OAIG;IACH,oBAHW,QAAQ,GACN,qBAAqB,CA6BjC;IAED;;;;OAIG;IACH,YAHW,QAAQ,QACR,MAAM,QA0JhB;CACD;8CAlZ4C,yBAAyB;qBAPjD,mBAAmB;sCADF,8BAA8B;yCAO5B,qCAAqC"}
@@ -35,12 +35,29 @@ export default class ShaderEffect {
35
35
  */
36
36
  constructor(renderer: WebGLRenderer | CanvasRenderer, fragmentBody: string, precision?: string);
37
37
  /**
38
- * whether this effect is active (false in Canvas mode)
38
+ * whether this effect is active (false in Canvas mode, false after
39
+ * {@link destroy}, and false while the WebGL context is suspended
40
+ * between an `ONCONTEXT_LOST` and the matching `ONCONTEXT_RESTORED`
41
+ * event).
39
42
  * @type {boolean}
40
43
  */
41
44
  enabled: boolean;
45
+ /**
46
+ * `true` once {@link destroy} has been called. Distinct from
47
+ * `enabled` — which also toggles transiently across a context
48
+ * lost / restored cycle — to give callers a stable signal for
49
+ * "this effect has been explicitly released."
50
+ * @type {boolean}
51
+ * @readonly
52
+ */
53
+ readonly destroyed: boolean;
42
54
  /** @ignore */
43
55
  _shader: GLShader | undefined;
56
+ /** @private */
57
+ private _onContextLost;
58
+ _enabledBeforeSuspend: boolean | undefined;
59
+ /** @private */
60
+ private _onContextRestored;
44
61
  /**
45
62
  * Set the uniform to the given value
46
63
  * @param {string} name - the uniform name
@@ -56,15 +73,17 @@ export default class ShaderEffect {
56
73
  /** @ignore */
57
74
  get program(): WebGLProgram | null;
58
75
  /** @ignore */
59
- get vertex(): string | null;
76
+ get vertex(): any;
60
77
  /** @ignore */
61
- get fragment(): string | null;
78
+ get fragment(): any;
62
79
  /** @ignore */
63
80
  get attributes(): {};
64
81
  /** @ignore */
65
82
  get uniforms(): object;
66
83
  /**
67
- * destroy this shader effect
84
+ * destroy this shader effect. Idempotent — calling destroy twice
85
+ * is safe. Unsubscribes from the renderer's context-lost / restored
86
+ * events so a destroyed effect is not auto-reactivated.
68
87
  */
69
88
  destroy(): void;
70
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shadereffect.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/shadereffect.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAOC;;;;;;OAMG;IACH,sBANW,aAAa,GAAC,cAAc,gBAC5B,MAAM,cAGN,MAAM,EAsChB;IAjDD;;;OAGG;IACH,SAFU,OAAO,CAED;IAqCf,cAAc;IACd,8BAKC;IAIF;;;;OAIG;IACH,iBAHW,MAAM,SACN,MAAM,GAAC,YAAY,QAM7B;IAED,cAAc;IACd,aAIC;IAED,cAAc;IACd,qCAEC;IAED,cAAc;IACd,iEAIC;IAED,cAAc;IACd,mCAEC;IAED,cAAc;IACd,4BAEC;IAED,cAAc;IACd,8BAEC;IAED,cAAc;IACd,qBAEC;IAED,cAAc;IACd,uBAEC;IAED;;OAEG;IACH,gBAKC;CACD;qBAlJoB,eAAe"}
1
+ {"version":3,"file":"shadereffect.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/shadereffect.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAoBC;;;;;;OAMG;IACH,sBANW,aAAa,GAAC,cAAc,gBAC5B,MAAM,cAGN,MAAM,EAkChB;IA1DD;;;;;;OAMG;IACH,SAFU,OAAO,CAED;IAEhB;;;;;;;OAOG;IACH,oBAHU,OAAO,CAGC;IA6BjB,cAAc;IACd,8BAKC;IAQF,eAAe;IACf,uBAOC;IAFA,2CAAyC;IAI1C,eAAe;IACf,2BAQC;IAED;;;;OAIG;IACH,iBAHW,MAAM,SACN,MAAM,GAAC,YAAY,QAM7B;IAED,cAAc;IACd,aAIC;IAED,cAAc;IACd,qCAEC;IAED,cAAc;IACd,iEAIC;IAED,cAAc;IACd,mCAEC;IAED,cAAc;IACd,kBAEC;IAED,cAAc;IACd,oBAEC;IAED,cAAc;IACd,qBAEC;IAED,cAAc;IACd,uBAEC;IAED;;;;OAIG;IACH,gBAiBC;CACD;qBA9LoB,eAAe"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Capture the current value into the cache slot so future `setUniform`
3
+ * calls can short-circuit. Reuses the existing slot (and its allocation)
4
+ * when the length matches — only a length change or a first capture
5
+ * allocates a fresh array.
6
+ * @ignore
7
+ */
8
+ export function captureValue(prev: any, val: any): any;
1
9
  /**
2
10
  * Build the `uniforms` proxy object for a compiled shader program.
3
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/uniforms.js"],"names":[],"mappings":"AA0FA;;;;;;;;;;;;;;;GAeG;AACH,0DAmEC"}
1
+ {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/uniforms.js"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,uDAoBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,0DAmEC"}
@@ -127,7 +127,7 @@ export default class WebGLRenderer extends Renderer {
127
127
  /**
128
128
  * Create a pattern with the specified repetition
129
129
  * @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - Source image to be used as the pattern's image
130
- * @param {string} repeat - Define how the pattern should be repeated
130
+ * @param {string} [repeat="no-repeat"] - Define how the pattern should be repeated. One of `"repeat"` / `"repeat-x"` / `"repeat-y"` / `"no-repeat"`.
131
131
  * @returns {TextureAtlas} the patterned texture created
132
132
  * @see ImageLayer#repeat
133
133
  * @example
@@ -136,7 +136,7 @@ export default class WebGLRenderer extends Renderer {
136
136
  * let vertical = renderer.createPattern(image, "repeat-y");
137
137
  * let basic = renderer.createPattern(image, "no-repeat");
138
138
  */
139
- createPattern(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, repeat: string): TextureAtlas;
139
+ createPattern(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, repeat?: string): TextureAtlas;
140
140
  _lightUniformsScratch: import("./lighting/pack.ts").LightUniformScratch | undefined;
141
141
  /**
142
142
  * Lazy-init a shared 1×1 white `TextureAtlas` used as the source
@@ -1 +1 @@
1
- {"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AAsDA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAYnC;;;;OAIG;IACH,wBAHU,QAAQ,CAG0B;IAS5C;;;;;OAKG;IACH,UAHU,MAAM,CAGO;IAEvB;;;OAGG;IACH,cAFU,WAAW,CAEqB;IAE1C;;;;OAIG;IACH,sBAHU,MAAM,CAGwD;IAExE;;;;OAIG;IACH,iBAHU,MAAM,CAMf;IAED;;;OAGG;IACH;;;QAEE;IAIF,kBAA6B;IAG7B,kBAAoB;IAGpB,sBAA4B;IAE5B;;;;OAIG;IACH,kB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B;IAED;;;;OAIG;IACH,oBAHW,OAAO,SACP,OAAO,QAkDjB;IAED;;;OAGG;IACH,kBAFW,OAAO,QAuDjB;IAuED;;;;;;;;OAQG;IACH,mBAPW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,MAAM,SACN,OAAO,QAWjB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,MAAM,QA4FhB;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,aAHW,MAAM,KACN,MAAM,QAIhB;IAgED;;;;;;;;;OASG;IACH,gBAPW,QAAQ,GAAC,QAAQ,GAAC,MAAM,KACxB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAKhB;IAED;;;;;;;;;OASG;IACH,aAPW,QAAQ,GAAC,QAAQ,GAAC,MAAM,KACxB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAmChB;IAiBD;;;;;;;;;;OAUG;IACH,YALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QA+EhB;IAED;;;;;;;OAOG;IACH,eAHW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QA6CjB;;CAcD;qBAn3EoB,kBAAkB;yBAXd,wBAAwB;uBAC1B,yBAAyB;6BAsCtB,uBAAuB;yBAxBxB,uBAAuB;iCAUf,6BAA6B;6BAXpB,uBAAuB;0CAavB,oCAAoC;sBA7B7C,uBAAuB;0BAkCjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
1
+ {"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AAuDA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1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BAxBxB,uBAAuB;iCAUf,6BAA6B;6BAXpB,uBAAuB;0CAavB,oCAAoC;sBA9B7C,uBAAuB;0BAmCjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "19.5.0",
3
+ "version": "19.7.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "type": "module",
@@ -80,10 +80,11 @@
80
80
  "lint": "eslint src tests",
81
81
  "build": "pnpm lint && tsx scripts/build.js && pnpm types",
82
82
  "dist": "pnpm clean && pnpm lint && pnpm vitest run && pnpm build && pnpm doc && cp ../../README.md .",
83
+ "dist:publish": "pnpm clean && pnpm lint && pnpm build && pnpm doc && cp ../../README.md .",
83
84
  "doc": "typedoc src/index.ts --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false",
84
85
  "doc:watch": "typedoc src/index.ts --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
85
86
  "serve": "serve docs",
86
- "prepublishOnly": "pnpm dist",
87
+ "prepublishOnly": "pnpm dist:publish",
87
88
  "clean": "tsx scripts/clean.ts",
88
89
  "types": "tsc --project tsconfig.build.json",
89
90
  "test:types": "tsc"
@@ -1,112 +0,0 @@
1
- /**
2
- * a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
3
- * @category Physics
4
- * @see game.world.broadphase
5
- */
6
- export default class QuadTree {
7
- /**
8
- * @param {World} world - the physic world this QuadTree belongs to
9
- * @param {Bounds} bounds - bounds of the node
10
- * @param {number} [max_objects=4] - max objects a node can hold before splitting into 4 subnodes
11
- * @param {number} [max_levels=4] - total max levels inside root Quadtree
12
- * @param {number} [level] - deepth level, required for subnodes
13
- */
14
- constructor(world: World, bounds: Bounds, max_objects?: number, max_levels?: number, level?: number);
15
- world: World;
16
- bounds: Bounds;
17
- max_objects: number;
18
- max_levels: number;
19
- level: number;
20
- objects: any[];
21
- nodes: any[];
22
- /**
23
- * Total number of objects in this subtree (this node's own
24
- * `objects` plus every descendant's). Maintained by `insert`
25
- * and `remove` so `isPrunable` / `hasChildren` are O(1) reads
26
- * instead of O(tree-size) walks. Reset to 0 in `clear`.
27
- * @ignore
28
- */
29
- _subtreeCount: number;
30
- /**
31
- * Root-only scratch array reused across `retrieve` calls to
32
- * avoid allocating a fresh array per pointer event / per
33
- * narrow-phase query. Only the root allocates one; recursive
34
- * subnode calls receive the array via the `result` arg.
35
- * @ignore
36
- */
37
- _retrieveScratch: never[] | null;
38
- split(): void;
39
- getIndex(item: any): number;
40
- /**
41
- * Insert the given object container into the node.
42
- * @param {Container} container - group of objects to be added
43
- */
44
- insertContainer(container: Container): void;
45
- /**
46
- * Insert the given object into the node. If the node
47
- * exceeds the capacity, it will split and add all
48
- * objects to their corresponding subnodes.
49
- * @param {object} item - object to be added
50
- */
51
- insert(item: object): void;
52
- /**
53
- * Recursively remove the given container and its descendants from
54
- * the quadtree. Mirrors `insertContainer` so the broadphase can be
55
- * kept in sync when a subtree is detached via
56
- * `Container.removeChildNow` between two `world.update()` rebuilds
57
- * (pointer events fire async in that window and would otherwise
58
- * hit destroyed renderables).
59
- * @param {Container} container - group of objects to be removed
60
- */
61
- removeContainer(container: Container): void;
62
- /**
63
- * Return all objects that could collide with the given object.
64
- *
65
- * **Re-entrancy contract:** when called with no explicit `result`
66
- * argument, this method reuses a single root-level scratch array to
67
- * avoid per-frame allocations. The returned reference is therefore
68
- * **not safe to retain** past the next `retrieve()` call, AND it is
69
- * **not safe to issue another scratch-mode `retrieve()` while iterating
70
- * the previous result** — the second call clears the scratch and
71
- * refills it, corrupting the outer iteration. In-engine callers
72
- * (`pointerevent.ts`, `detector.js`) iterate synchronously and never
73
- * recurse into `retrieve()`, so they're fine. User-facing portable
74
- * APIs (`adapter.queryAABB`, `adapter.raycast`) pass their own array
75
- * via the `result` parameter, which bypasses the scratch entirely
76
- * and is safe to call from inside collision handlers.
77
- *
78
- * @param {object} item - object to be checked against
79
- * @param {object} [fn] - a sorting function for the returned array
80
- * @param {object[]} [result] - optional caller-supplied result array.
81
- * Pass an explicit (typically empty) array to sidestep the shared
82
- * scratch — required for re-entrancy safety.
83
- * @returns {object[]} array with all detected objects
84
- */
85
- retrieve(item: object, fn?: object, result?: object[]): object[];
86
- /**
87
- * Remove the given item from the quadtree.
88
- * (this function won't recalculate the impacted node)
89
- * @param {object} item - object to be removed
90
- * @returns {boolean} true if the item was found and removed.
91
- */
92
- remove(item: object): boolean;
93
- /**
94
- * return true if the node is prunable
95
- * @returns {boolean} true if the node is prunable
96
- */
97
- isPrunable(): boolean;
98
- /**
99
- * return true if the node has any children
100
- * @returns {boolean} true if the node has any children
101
- */
102
- hasChildren(): boolean;
103
- /**
104
- * clear the quadtree
105
- * @param {Bounds} [bounds=this.bounds] - the bounds to be cleared
106
- */
107
- clear(bounds?: Bounds): void;
108
- }
109
- import type World from "../world.js";
110
- import type { Bounds } from "../bounds.ts";
111
- import type Container from "../../renderable/container.js";
112
- //# sourceMappingURL=quadtree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quadtree.d.ts","sourceRoot":"","sources":["../../../src/physics/builtin/quadtree.js"],"names":[],"mappings":"AA2DA;;;;GAIG;AACH;IACC;;;;;;OAMG;IACH,mBANW,KAAK,UACL,MAAM,gBACN,MAAM,eACN,MAAM,UACN,MAAM,EA+BhB;IA5BA,aAAkB;IAClB,eAAoB;IAEpB,oBAA8B;IAC9B,mBAA4B;IAE5B,cAAkB;IAElB,eAAiB;IACjB,aAAe;IAEf;;;;;;OAMG;IACH,sBAAsB;IAEtB;;;;;;OAMG;IACH,iCAA+C;IAMhD,cA8DC;IAOD,4BA+CC;IAED;;;OAGG;IACH,2BAFW,SAAS,QA2BnB;IAED;;;;;OAKG;IACH,aAFW,MAAM,QA+ChB;IAED;;;;;;;;OAQG;IACH,2BAFW,SAAS,QAuBnB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,eAPW,MAAM,OACN,MAAM,WACN,MAAM,EAAE,GAGN,MAAM,EAAE,CAwCpB;IAED;;;;;OAKG;IACH,aAHW,MAAM,GACJ,OAAO,CAsEnB;IAED;;;OAGG;IACH,cAFa,OAAO,CAMnB;IAED;;;OAGG;IACH,eAFa,OAAO,CAOnB;IAED;;;OAGG;IACH,eAFW,MAAM,QAwBhB;CACD;uBA5gBqB,aAAa;4BAEV,cAAc;2BADb,+BAA+B"}