melonjs 18.0.0 → 18.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 (215) hide show
  1. package/build/application/application.d.ts +33 -40
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/defaultApplicationSettings.d.ts +1 -1
  4. package/build/application/header.d.ts +3 -7
  5. package/build/application/header.d.ts.map +1 -1
  6. package/build/application/resize.d.ts +3 -4
  7. package/build/application/resize.d.ts.map +1 -1
  8. package/build/application/settings.d.ts +8 -3
  9. package/build/application/settings.d.ts.map +1 -1
  10. package/build/audio/audio.d.ts +179 -128
  11. package/build/audio/audio.d.ts.map +1 -1
  12. package/build/camera/camera2d.d.ts +194 -103
  13. package/build/camera/camera2d.d.ts.map +1 -1
  14. package/build/geometries/ellipse.d.ts +40 -4
  15. package/build/geometries/ellipse.d.ts.map +1 -1
  16. package/build/geometries/line.d.ts +2 -1
  17. package/build/geometries/line.d.ts.map +1 -1
  18. package/build/geometries/path2d.d.ts +39 -4
  19. package/build/geometries/path2d.d.ts.map +1 -1
  20. package/build/geometries/polygon.d.ts +6 -5
  21. package/build/geometries/polygon.d.ts.map +1 -1
  22. package/build/geometries/rectangle.d.ts +1 -0
  23. package/build/geometries/rectangle.d.ts.map +1 -1
  24. package/build/geometries/roundrect.d.ts +83 -17
  25. package/build/geometries/roundrect.d.ts.map +1 -1
  26. package/build/index.d.ts +18 -16
  27. package/build/index.d.ts.map +1 -1
  28. package/build/index.js +5283 -2234
  29. package/build/index.js.map +4 -4
  30. package/build/input/gamepad.d.ts +113 -61
  31. package/build/input/gamepad.d.ts.map +1 -1
  32. package/build/input/input.d.ts +3 -7
  33. package/build/input/input.d.ts.map +1 -1
  34. package/build/input/keyboard.d.ts +6 -0
  35. package/build/input/keyboard.d.ts.map +1 -1
  36. package/build/input/pointer.d.ts +25 -51
  37. package/build/input/pointer.d.ts.map +1 -1
  38. package/build/input/pointerevent.d.ts +51 -79
  39. package/build/input/pointerevent.d.ts.map +1 -1
  40. package/build/lang/console.d.ts.map +1 -1
  41. package/build/lang/deprecated.d.ts +27 -0
  42. package/build/lang/deprecated.d.ts.map +1 -1
  43. package/build/level/tiled/TMXGroup.d.ts +5 -0
  44. package/build/level/tiled/TMXGroup.d.ts.map +1 -1
  45. package/build/level/tiled/TMXLayer.d.ts +1 -0
  46. package/build/level/tiled/TMXLayer.d.ts.map +1 -1
  47. package/build/level/tiled/TMXObject.d.ts +21 -16
  48. package/build/level/tiled/TMXObject.d.ts.map +1 -1
  49. package/build/level/tiled/TMXTile.d.ts +16 -5
  50. package/build/level/tiled/TMXTile.d.ts.map +1 -1
  51. package/build/level/tiled/TMXTileMap.d.ts +16 -3
  52. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  53. package/build/level/tiled/TMXTileset.d.ts +138 -16
  54. package/build/level/tiled/TMXTileset.d.ts.map +1 -1
  55. package/build/level/tiled/TMXTilesetGroup.d.ts +1 -0
  56. package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -1
  57. package/build/level/tiled/TMXUtils.d.ts +29 -12
  58. package/build/level/tiled/TMXUtils.d.ts.map +1 -1
  59. package/build/level/tiled/constants.d.ts +1 -0
  60. package/build/level/tiled/constants.d.ts.map +1 -1
  61. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +2 -7
  62. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
  63. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +2 -1
  64. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
  65. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +42 -0
  66. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -0
  67. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +2 -7
  68. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
  69. package/build/level/tiled/renderer/TMXRenderer.d.ts +7 -0
  70. package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
  71. package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts +2 -1
  72. package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -1
  73. package/build/level/tiled/renderer/autodetect.d.ts +2 -1
  74. package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
  75. package/build/loader/loader.d.ts +39 -15
  76. package/build/loader/loader.d.ts.map +1 -1
  77. package/build/loader/loadingscreen.d.ts +8 -0
  78. package/build/loader/loadingscreen.d.ts.map +1 -1
  79. package/build/loader/parsers/compressed_textures/compressed_image.d.ts +44 -1
  80. package/build/loader/parsers/compressed_textures/compressed_image.d.ts.map +1 -1
  81. package/build/loader/parsers/compressed_textures/parseDDS.d.ts +7 -1
  82. package/build/loader/parsers/compressed_textures/parseDDS.d.ts.map +1 -1
  83. package/build/loader/parsers/compressed_textures/parseKTX.d.ts +7 -1
  84. package/build/loader/parsers/compressed_textures/parseKTX.d.ts.map +1 -1
  85. package/build/loader/parsers/compressed_textures/parseKTX2.d.ts +7 -1
  86. package/build/loader/parsers/compressed_textures/parseKTX2.d.ts.map +1 -1
  87. package/build/loader/parsers/compressed_textures/parsePKM.d.ts +7 -1
  88. package/build/loader/parsers/compressed_textures/parsePKM.d.ts.map +1 -1
  89. package/build/loader/parsers/compressed_textures/parsePVR.d.ts +7 -1
  90. package/build/loader/parsers/compressed_textures/parsePVR.d.ts.map +1 -1
  91. package/build/loader/parsers/fontface.d.ts +1 -1
  92. package/build/loader/parsers/fontface.d.ts.map +1 -1
  93. package/build/loader/parsers/image.d.ts +6 -1
  94. package/build/loader/parsers/image.d.ts.map +1 -1
  95. package/build/math/color.d.ts +2 -1
  96. package/build/math/color.d.ts.map +1 -1
  97. package/build/math/matrix2d.d.ts +1 -0
  98. package/build/math/matrix2d.d.ts.map +1 -1
  99. package/build/math/matrix3d.d.ts +1 -0
  100. package/build/math/matrix3d.d.ts.map +1 -1
  101. package/build/math/observableVector2d.d.ts +3 -2
  102. package/build/math/observableVector2d.d.ts.map +1 -1
  103. package/build/math/observableVector3d.d.ts +5 -4
  104. package/build/math/observableVector3d.d.ts.map +1 -1
  105. package/build/math/vector2d.d.ts +2 -1
  106. package/build/math/vector2d.d.ts.map +1 -1
  107. package/build/math/vector3d.d.ts +4 -3
  108. package/build/math/vector3d.d.ts.map +1 -1
  109. package/build/particles/emitter.d.ts +40 -122
  110. package/build/particles/emitter.d.ts.map +1 -1
  111. package/build/particles/particle.d.ts +2 -4
  112. package/build/particles/particle.d.ts.map +1 -1
  113. package/build/physics/body.d.ts +8 -7
  114. package/build/physics/body.d.ts.map +1 -1
  115. package/build/physics/bounds.d.ts +2 -1
  116. package/build/physics/bounds.d.ts.map +1 -1
  117. package/build/physics/detector.d.ts.map +1 -1
  118. package/build/physics/quadtree.d.ts +1 -0
  119. package/build/physics/quadtree.d.ts.map +1 -1
  120. package/build/physics/sat.d.ts.map +1 -1
  121. package/build/physics/world.d.ts +4 -3
  122. package/build/physics/world.d.ts.map +1 -1
  123. package/build/plugin/plugin.d.ts +36 -53
  124. package/build/plugin/plugin.d.ts.map +1 -1
  125. package/build/polyfill/ellipse.d.ts +2 -0
  126. package/build/polyfill/ellipse.d.ts.map +1 -0
  127. package/build/polyfill/index.d.ts +1 -0
  128. package/build/polyfill/index.d.ts.map +1 -1
  129. package/build/renderable/collectable.d.ts +1 -0
  130. package/build/renderable/collectable.d.ts.map +1 -1
  131. package/build/renderable/colorlayer.d.ts +3 -2
  132. package/build/renderable/colorlayer.d.ts.map +1 -1
  133. package/build/renderable/container.d.ts +19 -18
  134. package/build/renderable/container.d.ts.map +1 -1
  135. package/build/renderable/draggable.d.ts +1 -0
  136. package/build/renderable/draggable.d.ts.map +1 -1
  137. package/build/renderable/entity/entity.d.ts +141 -0
  138. package/build/renderable/entity/entity.d.ts.map +1 -1
  139. package/build/renderable/imagelayer.d.ts +3 -2
  140. package/build/renderable/imagelayer.d.ts.map +1 -1
  141. package/build/renderable/nineslicesprite.d.ts +4 -3
  142. package/build/renderable/nineslicesprite.d.ts.map +1 -1
  143. package/build/renderable/renderable.d.ts +42 -7
  144. package/build/renderable/renderable.d.ts.map +1 -1
  145. package/build/renderable/sprite.d.ts +7 -5
  146. package/build/renderable/sprite.d.ts.map +1 -1
  147. package/build/renderable/text/bitmaptext.d.ts +3 -2
  148. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  149. package/build/renderable/text/bitmaptextdata.d.ts +4 -0
  150. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
  151. package/build/renderable/text/text.d.ts +2 -1
  152. package/build/renderable/text/text.d.ts.map +1 -1
  153. package/build/renderable/trigger.d.ts +1 -0
  154. package/build/renderable/trigger.d.ts.map +1 -1
  155. package/build/renderable/ui/uibaseelement.d.ts +47 -33
  156. package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
  157. package/build/renderable/ui/uispriteelement.d.ts +54 -43
  158. package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
  159. package/build/renderable/ui/uitextbutton.d.ts +70 -75
  160. package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
  161. package/build/state/stage.d.ts +2 -1
  162. package/build/state/stage.d.ts.map +1 -1
  163. package/build/state/state.d.ts +93 -90
  164. package/build/state/state.d.ts.map +1 -1
  165. package/build/system/device.d.ts +33 -3
  166. package/build/system/device.d.ts.map +1 -1
  167. package/build/system/dom.d.ts +7 -0
  168. package/build/system/dom.d.ts.map +1 -1
  169. package/build/system/event.d.ts +2 -2
  170. package/build/system/event.d.ts.map +1 -1
  171. package/build/system/legacy_pool.d.ts.map +1 -1
  172. package/build/tweens/tween.d.ts +1 -0
  173. package/build/tweens/tween.d.ts.map +1 -1
  174. package/build/utils/array.d.ts +2 -2
  175. package/build/utils/decode.d.ts +35 -0
  176. package/build/utils/decode.d.ts.map +1 -0
  177. package/build/utils/function.d.ts +1 -1
  178. package/build/utils/function.d.ts.map +1 -1
  179. package/build/utils/utils.d.ts +1 -1
  180. package/build/utils/utils.d.ts.map +1 -1
  181. package/build/utils/xml.d.ts +21 -0
  182. package/build/utils/xml.d.ts.map +1 -0
  183. package/build/video/canvas/canvas_renderer.d.ts +42 -14
  184. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  185. package/build/video/renderer.d.ts +39 -8
  186. package/build/video/renderer.d.ts.map +1 -1
  187. package/build/video/renderstate.d.ts +85 -0
  188. package/build/video/renderstate.d.ts.map +1 -0
  189. package/build/video/rendertarget/canvasrendertarget.d.ts +1 -0
  190. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  191. package/build/video/texture/atlas.d.ts +44 -5
  192. package/build/video/texture/atlas.d.ts.map +1 -1
  193. package/build/video/texture/cache.d.ts +9 -0
  194. package/build/video/texture/cache.d.ts.map +1 -1
  195. package/build/video/texture/parser/texturepacker.d.ts.map +1 -1
  196. package/build/video/webgl/{compositors/compositor.d.ts → batchers/batcher.d.ts} +63 -30
  197. package/build/video/webgl/batchers/batcher.d.ts.map +1 -0
  198. package/build/video/webgl/{compositors/primitive_compositor.d.ts → batchers/primitive_batcher.d.ts} +10 -3
  199. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -0
  200. package/build/video/webgl/{compositors/quad_compositor.d.ts → batchers/quad_batcher.d.ts} +6 -5
  201. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -0
  202. package/build/video/webgl/buffer/index.d.ts +49 -0
  203. package/build/video/webgl/buffer/index.d.ts.map +1 -0
  204. package/build/video/webgl/buffer/vertex.d.ts +12 -19
  205. package/build/video/webgl/buffer/vertex.d.ts.map +1 -1
  206. package/build/video/webgl/glshader.d.ts +3 -2
  207. package/build/video/webgl/glshader.d.ts.map +1 -1
  208. package/build/video/webgl/shadereffect.d.ts +72 -0
  209. package/build/video/webgl/shadereffect.d.ts.map +1 -0
  210. package/build/video/webgl/webgl_renderer.d.ts +53 -69
  211. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  212. package/package.json +19 -13
  213. package/build/video/webgl/compositors/compositor.d.ts.map +0 -1
  214. package/build/video/webgl/compositors/primitive_compositor.d.ts.map +0 -1
  215. package/build/video/webgl/compositors/quad_compositor.d.ts.map +0 -1
@@ -5,13 +5,19 @@
5
5
  /**
6
6
  * A WebGL Compositor object. This class handles all of the WebGL state<br>
7
7
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
8
+ * @category Rendering
8
9
  */
9
- export default class PrimitiveCompositor extends Compositor {
10
+ export default class PrimitiveBatcher extends Batcher {
10
11
  /**
11
12
  * Initialize the compositor
12
13
  * @ignore
13
14
  */
14
15
  init(renderer: any): void;
16
+ /**
17
+ * the current line width applied to the shader uniform
18
+ * @ignore
19
+ */
20
+ currentLineWidth: any;
15
21
  /**
16
22
  * Draw an array of vertices
17
23
  * @param {GLenum} mode - primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
@@ -19,7 +25,8 @@ export default class PrimitiveCompositor extends Compositor {
19
25
  * @param {number} [vertexCount=verts.length] - amount of points defined in the points array
20
26
  */
21
27
  drawVertices(mode: GLenum, verts: Point[], vertexCount?: number): void;
28
+ #private;
22
29
  }
23
- import Compositor from "./compositor.js";
30
+ import { Batcher } from "./batcher.js";
24
31
  import type { Point } from "./../../../geometries/point.ts";
25
- //# sourceMappingURL=primitive_compositor.d.ts.map
32
+ //# sourceMappingURL=primitive_batcher.d.ts.map
@@ -0,0 +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,8 +1,9 @@
1
1
  /**
2
2
  * A WebGL Compositor object. This class handles all of the WebGL state<br>
3
3
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
4
+ * @category Rendering
4
5
  */
5
- export default class QuadCompositor extends Compositor {
6
+ export default class QuadBatcher extends Batcher {
6
7
  /**
7
8
  * Initialize the compositor
8
9
  * @ignore
@@ -25,9 +26,9 @@ export default class QuadCompositor extends Compositor {
25
26
  createTexture2D(unit: number, pixels?: (new (width?: number, height?: number) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string, w?: number, h?: number, premultipliedAlpha?: boolean, mipmap?: boolean, texture: any): WebGLTexture;
26
27
  /**
27
28
  * delete the given WebGL texture
28
- * @param {WebGLTexture} [texture] - a WebGL texture to delete
29
+ * @param {WebGLTexture|TextureAtlas} texture - a WebGL texture or TextureAtlas to delete
29
30
  */
30
- deleteTexture2D(texture?: WebGLTexture): void;
31
+ deleteTexture2D(texture: WebGLTexture | TextureAtlas): void;
31
32
  /**
32
33
  * returns the WebGL texture associated to the given texture unit
33
34
  * @param {number} unit - Texture unit to which a texture is bound
@@ -67,6 +68,6 @@ export default class QuadCompositor extends Compositor {
67
68
  */
68
69
  addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean): void;
69
70
  }
70
- import Compositor from "./compositor.js";
71
+ import { Batcher } from "./batcher.js";
71
72
  import type { TextureAtlas } from "./../../texture/atlas.js";
72
- //# sourceMappingURL=quad_compositor.d.ts.map
73
+ //# sourceMappingURL=quad_batcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BA8CC;IAdA,wBAA4B;IAC5B,iCAAuB;IAoFxB;;;;;;;;;;;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,iBACL,YAAY,CAyGxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAkBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;OAEG;IACH,kEAqBC;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,QAuCjB;CACD;wBA3ZuB,cAAc;kCAIP,0BAA0B"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * A WebGL Index Buffer object.
3
+ * Can be used for static patterns (e.g. quad indices) or dynamic indexed drawing.
4
+ * @ignore
5
+ */
6
+ export default class IndexBuffer {
7
+ /**
8
+ * @param {WebGLRenderingContext|WebGL2RenderingContext} gl - the WebGL context
9
+ * @param {number} maxIndices - maximum number of indices this buffer can hold
10
+ * @param {boolean} [useUint32=false] - use Uint32 indices (WebGL2) instead of Uint16 (WebGL1)
11
+ * @param {boolean} [dynamic=false] - if true, use STREAM_DRAW for frequent updates; if false, use STATIC_DRAW
12
+ */
13
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, maxIndices: number, useUint32?: boolean, dynamic?: boolean);
14
+ gl: WebGLRenderingContext | WebGL2RenderingContext;
15
+ dynamic: boolean;
16
+ type: 5123 | 5125;
17
+ data: Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>;
18
+ /**
19
+ * the current number of indices in the buffer
20
+ * @type {number}
21
+ */
22
+ length: number;
23
+ buffer: WebGLBuffer;
24
+ /**
25
+ * Fill the buffer with a repeating quad index pattern [0,1,2, 2,1,3, 4,5,6, ...]
26
+ * and upload as a static buffer.
27
+ * @param {number} maxQuads - number of quads to generate indices for
28
+ */
29
+ fillQuadPattern(maxQuads: number): void;
30
+ /**
31
+ * Reset the index count (for dynamic buffers)
32
+ */
33
+ clear(): void;
34
+ /**
35
+ * Add indices to the buffer, rebased by the given vertex offset
36
+ * @param {number[]} indices - source indices to add
37
+ * @param {number} vertexOffset - value to add to each index (vertex count at time of insertion)
38
+ */
39
+ add(indices: number[], vertexOffset: number): void;
40
+ /**
41
+ * Upload the current index data to the GPU (for dynamic buffers)
42
+ */
43
+ upload(): void;
44
+ /**
45
+ * bind this index buffer
46
+ */
47
+ bind(): void;
48
+ }
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/index.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;IACC;;;;;OAKG;IACH,gBALW,qBAAqB,GAAC,sBAAsB,cAC5C,MAAM,cACN,OAAO,YACP,OAAO,EAqBjB;IAlBA,mDAAY;IACZ,iBAAsB;IAGrB,kBAA2B;IAC3B,0DAAuC;IAMxC;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf,oBAA+B;IAGhC;;;;OAIG;IACH,0BAFW,MAAM,QAkBhB;IAED;;OAEG;IACH,cAEC;IAED;;;;OAIG;IACH,aAHW,MAAM,EAAE,gBACR,MAAM,QAOhB;IAED;;OAEG;IACH,eAOC;IAED;;OAEG;IACH,aAEC;CACD"}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * a Vertex Buffer object
2
+ * a fixed-size Vertex Buffer object.
3
+ * Compositors must check isFull() and flush before the buffer overflows.
3
4
  * @ignore
4
5
  */
5
6
  export default class VertexArrayBuffer {
6
- constructor(vertex_size: any, vertex_per_obj: any);
7
+ constructor(vertexSize: any, maxVertex: any);
7
8
  vertexSize: any;
8
- objSize: any;
9
- maxVertex: number;
9
+ maxVertex: any;
10
10
  vertexCount: number;
11
11
  buffer: ArrayBuffer;
12
12
  bufferF32: Float32Array<ArrayBuffer>;
@@ -20,17 +20,20 @@ export default class VertexArrayBuffer {
20
20
  * return true if full
21
21
  * @ignore
22
22
  */
23
- isFull(vertex?: any): boolean;
23
+ isFull(vertex: any): boolean;
24
24
  /**
25
- * resize the vertex buffer, retaining its original contents
25
+ * push a new vertex to the buffer (quad format: x, y, u, v, tint)
26
26
  * @ignore
27
27
  */
28
- resize(vertexCount: any): this;
28
+ push(x: any, y: any, u: any, v: any, tint: any): this;
29
29
  /**
30
- * push a new vertex to the buffer
30
+ * push a new vertex with all-float data to the buffer
31
+ * @param {ArrayLike<number>} data - float values for one vertex
32
+ * @param {number} srcOffset - start index in the source data
33
+ * @param {number} count - number of floats to copy (should equal vertexSize)
31
34
  * @ignore
32
35
  */
33
- push(x: any, y: any, u: any, v: any, tint: any): this;
36
+ pushFloats(data: ArrayLike<number>, srcOffset: number, count: number): this;
34
37
  /**
35
38
  * return a reference to the data in Float32 format
36
39
  * @ignore
@@ -41,15 +44,5 @@ export default class VertexArrayBuffer {
41
44
  * @ignore
42
45
  */
43
46
  toUint32(begin: any, end: any): Uint32Array<ArrayBuffer>;
44
- /**
45
- * return the size of the vertex in vertex
46
- * @ignore
47
- */
48
- length(): number;
49
- /**
50
- * return true if empty
51
- * @ignore
52
- */
53
- isEmpty(): boolean;
54
47
  }
55
48
  //# sourceMappingURL=vertex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;IACC,mDAiBC;IAfA,gBAA6B;IAE7B,aAA6B;IAE7B,kBAAoB;IAEpB,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAG9C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,8BAEC;IAED;;;OAGG;IACH,+BAoBC;IAED;;;OAGG;IACH,sDAsBC;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,mBAEC;CACD"}
1
+ {"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;IACC,6CAeC;IAbA,gBAA4B;IAE5B,eAA0B;IAE1B,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAG9C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,sDAYC;IAED;;;;;;OAMG;IACH,iBALW,SAAS,CAAC,MAAM,CAAC,aACjB,MAAM,SACN,MAAM,QAahB;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;CACD"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * a base GL Shader object
3
+ * @category Rendering
3
4
  */
4
5
  export default class GLShader {
5
6
  /**
@@ -82,9 +83,9 @@ export default class GLShader {
82
83
  * activate the given vertex attribute for this shader
83
84
  * @param {WebGLRenderingContext} gl - the current WebGL rendering context
84
85
  * @param {object[]} attributes - an array of vertex attributes
85
- * @param {number} vertexByteSize - the size of a single vertex in bytes
86
+ * @param {number} stride - the size of a single vertex in bytes
86
87
  */
87
- setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], vertexByteSize: number): void;
88
+ setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], stride: number): void;
88
89
  /**
89
90
  * destroy this shader objects resources (program, attributes, uniforms)
90
91
  */
@@ -1 +1 @@
1
- {"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;GAEG;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,QAe7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,kBACR,MAAM,QAsBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
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,QAsBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * A simplified shader class for applying custom fragment effects to renderables.
3
+ * Only requires a fragment `apply()` function — the vertex shader, uniforms, and
4
+ * texture sampling boilerplate are handled automatically.
5
+ * In Canvas mode, the shader is silently disabled (all methods become no-ops).
6
+ * @category Rendering
7
+ * @example
8
+ * // create a grayscale effect
9
+ * mySprite.shader = new ShaderEffect(renderer, `
10
+ * vec4 apply(vec4 color, vec2 uv) {
11
+ * float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114));
12
+ * return vec4(vec3(gray), color.a);
13
+ * }
14
+ * `);
15
+ * @example
16
+ * // create an effect with a custom uniform
17
+ * const pulse = new ShaderEffect(renderer, `
18
+ * uniform float uTime;
19
+ * vec4 apply(vec4 color, vec2 uv) {
20
+ * float brightness = 0.8 + 0.2 * sin(uTime * 3.0);
21
+ * return vec4(color.rgb * brightness, color.a);
22
+ * }
23
+ * `);
24
+ * mySprite.shader = pulse;
25
+ * // update the uniform each frame
26
+ * pulse.setUniform("uTime", time);
27
+ */
28
+ export default class ShaderEffect {
29
+ /**
30
+ * @param {WebGLRenderer|CanvasRenderer} renderer - the current renderer instance
31
+ * @param {string} fragmentBody - GLSL code containing a `vec4 apply(vec4 color, vec2 uv)` function
32
+ * that receives the sampled pixel color and UV coordinates, and returns the modified color.
33
+ * You can declare additional `uniform` variables before the `apply()` function.
34
+ * @param {string} [precision=auto detected] - float precision ('lowp', 'mediump' or 'highp')
35
+ */
36
+ constructor(renderer: WebGLRenderer | CanvasRenderer, fragmentBody: string, precision?: string);
37
+ /**
38
+ * whether this effect is active (false in Canvas mode)
39
+ * @type {boolean}
40
+ */
41
+ enabled: boolean;
42
+ /** @ignore */
43
+ _shader: GLShader | undefined;
44
+ /**
45
+ * Set the uniform to the given value
46
+ * @param {string} name - the uniform name
47
+ * @param {object|Float32Array} value - the value to assign to that uniform
48
+ */
49
+ setUniform(name: string, value: object | Float32Array): void;
50
+ /** @ignore */
51
+ bind(): void;
52
+ /** @ignore */
53
+ getAttribLocation(name: any): number;
54
+ /** @ignore */
55
+ setVertexAttributes(gl: any, attributes: any, stride: any): void;
56
+ /** @ignore */
57
+ get program(): WebGLProgram | null;
58
+ /** @ignore */
59
+ get vertex(): string | null;
60
+ /** @ignore */
61
+ get fragment(): string | null;
62
+ /** @ignore */
63
+ get attributes(): {};
64
+ /** @ignore */
65
+ get uniforms(): object;
66
+ /**
67
+ * destroy this shader effect
68
+ */
69
+ destroy(): void;
70
+ }
71
+ import GLShader from "./glshader.js";
72
+ //# sourceMappingURL=shadereffect.d.ts.map
@@ -0,0 +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,EAiChB;IA5CD;;;OAGG;IACH,SAFU,OAAO,CAED;IAqCf,cAAc;IACd,8BAAyE;IAI1E;;;;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;qBA7IoB,eAAe"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * a WebGL renderer object
3
+ * @category Rendering
3
4
  */
4
5
  export default class WebGLRenderer extends Renderer {
5
6
  /**
@@ -9,13 +10,6 @@ export default class WebGLRenderer extends Renderer {
9
10
  * @readonly
10
11
  */
11
12
  readonly GPUVendor: string;
12
- /**
13
- * The renderer string of the underlying graphics driver.
14
- * @type {string}
15
- * @default undefined
16
- * @readonly
17
- */
18
- readonly GPURenderer: string;
19
13
  /**
20
14
  * The WebGL context
21
15
  * @name gl
@@ -23,12 +17,9 @@ export default class WebGLRenderer extends Renderer {
23
17
  */
24
18
  gl: WebGLRenderingContext;
25
19
  /**
26
- * sets or returns the thickness of lines for shape drawing (limited to strokeLine, strokePolygon and strokeRect)
20
+ * sets or returns the thickness of lines for shape drawing
27
21
  * @type {number}
28
22
  * @default 1
29
- * @see WebGLRenderer#strokeLine
30
- * @see WebGLRenderer#strokePolygon
31
- * @see WebGLRenderer#strokeRect
32
23
  */
33
24
  lineWidth: number;
34
25
  /**
@@ -50,41 +41,35 @@ export default class WebGLRenderer extends Renderer {
50
41
  */
51
42
  readonly maxTextures: number;
52
43
  /**
44
+ * reusable scratch array for fillRect (2 triangles = 6 vertices)
53
45
  * @ignore
54
46
  */
55
- _colorStack: any[];
56
- /**
57
- * @ignore
58
- */
59
- _matrixStack: any[];
60
- /**
61
- * @ignore
62
- */
63
- _scissorStack: any[];
64
- /**
65
- * @ignore
66
- */
67
- _blendStack: any[];
47
+ _rectTriangles: {
48
+ x: number;
49
+ y: number;
50
+ }[];
51
+ _polyVerts: any[];
68
52
  /**
69
53
  * The current transformation matrix used for transformations on the overall scene
54
+ * (alias to renderState.currentTransform for backward compatibility)
70
55
  * @type {Matrix2d}
71
56
  */
72
57
  currentTransform: Matrix2d;
73
58
  /**
74
- * The current compositor used by the renderer
75
- * @type {Compositor}
59
+ * The current batcher used by the renderer
60
+ * @type {Batcher}
76
61
  */
77
- currentCompositor: Compositor;
62
+ currentBatcher: Batcher;
78
63
  /**
79
64
  * a reference to the current shader program used by the renderer
80
65
  * @type {WebGLProgram}
81
66
  */
82
67
  currentProgram: WebGLProgram;
83
68
  /**
84
- * The list of active compositors
85
- * @type {Map<Compositor>}
69
+ * The list of active batchers
70
+ * @type {Map<Batcher>}
86
71
  */
87
- compositors: Map<Compositor, any>;
72
+ batchers: Map<Batcher, any>;
88
73
  depthTest: any;
89
74
  customShader: any;
90
75
  cache: TextureCache;
@@ -95,30 +80,19 @@ export default class WebGLRenderer extends Renderer {
95
80
  */
96
81
  get WebGLVersion(): number;
97
82
  /**
98
- * return the list of supported compressed texture formats
99
- * @return {Object}
100
- */
101
- getSupportedCompressedTextureFormats(): Object;
102
- /**
103
- * return true if the given compressed texture format is supported
104
- * @param {Number} format
105
- * @returns
106
- */
107
- hasSupportedCompressedFormats(format: number): boolean;
108
- /**
109
- * add a new compositor to this renderer
110
- * @param {Compositor} compositor - a compositor instance
111
- * @param {string} name - a name uniquely identifying this compositor
112
- * @param {boolean} [activate=false] - true if the given compositor should be set as the active one
83
+ * add a new batcher to this renderer
84
+ * @param {Batcher} batcher - a batcher instance
85
+ * @param {string} name - a name uniquely identifying this batcher
86
+ * @param {boolean} [activate=false] - true if the given batcher should be set as the active one
113
87
  */
114
- addCompositor(compositor: Compositor, name?: string, activate?: boolean): void;
88
+ addBatcher(batcher: Batcher, name?: string, activate?: boolean): void;
115
89
  /**
116
- * set the active compositor for this renderer
117
- * @param {string} name - a compositor name
118
- * @param {GLShader} [shader] - an optional shader program to be used, instead of the default one, when activating the compositor
119
- * @returns {Compositor} an instance to the current active compositor
90
+ * set the active batcher for this renderer
91
+ * @param {string} name - a batcher name
92
+ * @param {GLShader} [shader] - an optional shader program to be used, instead of the default one, when activating the batcher
93
+ * @returns {Batcher} an instance to the current active batcher
120
94
  */
121
- setCompositor(name?: string, shader?: GLShader): Compositor;
95
+ setBatcher(name?: string, shader?: GLShader): Batcher;
122
96
  /**
123
97
  * Reset the gl transform to identity
124
98
  */
@@ -160,7 +134,7 @@ export default class WebGLRenderer extends Renderer {
160
134
  clearRect(x: number, y: number, width: number, height: number): void;
161
135
  /**
162
136
  * Draw an image to the gl context
163
- * @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - An element to draw into the context.
137
+ * @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame|CompressedImage} image - An element to draw into the context.
164
138
  * @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
165
139
  * @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
166
140
  * @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
@@ -177,7 +151,7 @@ export default class WebGLRenderer extends Renderer {
177
151
  * // Clip the image and position the clipped part on the canvas:
178
152
  * renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
179
153
  */
180
- drawImage(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
154
+ drawImage(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame | CompressedImage, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
181
155
  /**
182
156
  * Draw a pattern within the given rectangle.
183
157
  * @param {TextureAtlas} pattern - Pattern object
@@ -254,21 +228,30 @@ export default class WebGLRenderer extends Renderer {
254
228
  */
255
229
  getContext(): WebGLRenderingContext;
256
230
  /**
257
- * set a blend mode for the given context. <br>
258
- * Supported blend mode between Canvas and WebGL remderer : <br>
259
- * - "normal" : this is the default mode and draws new content on top of the existing content <br>
260
- * <img src="../images/normal-blendmode.png" width="510"/> <br>
261
- * - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
262
- * <img src="../images/multiply-blendmode.png" width="510"/> <br>
263
- * - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
264
- * <img src="../images/lighter-blendmode.png" width="510"/> <br>
265
- * - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
266
- * <img src="../images/screen-blendmode.png" width="510"/> <br>
231
+ * set the current blend mode for this renderer. <br>
232
+ * All renderers support: <br>
233
+ * - "normal" : draws new content on top of the existing content <br>
234
+ * <img src="../images/normal-blendmode.png" width="180"/> <br>
235
+ * - "add", "additive", or "lighter" : color values are added together <br>
236
+ * <img src="../images/add-blendmode.png" width="180"/> <br>
237
+ * - "multiply" : pixels are multiplied, resulting in a darker picture <br>
238
+ * <img src="../images/multiply-blendmode.png" width="180"/> <br>
239
+ * - "screen" : pixels are inverted, multiplied, and inverted again (opposite of multiply) <br>
240
+ * <img src="../images/screen-blendmode.png" width="180"/> <br>
241
+ * WebGL2 additionally supports: <br>
242
+ * - "darken" : retains the darkest pixels of both layers <br>
243
+ * <img src="../images/darken-blendmode.png" width="180"/> <br>
244
+ * - "lighten" : retains the lightest pixels of both layers <br>
245
+ * <img src="../images/lighten-blendmode.png" width="180"/> <br>
246
+ * Other CSS blend modes ("overlay", "color-dodge", "color-burn", "hard-light", "soft-light",
247
+ * "difference", "exclusion") may be supported by the Canvas renderer (browser-dependent)
248
+ * and will always fall back to "normal" in WebGL. <br>
267
249
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
268
- * @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter", "additive", "screen"
269
- * @param {WebGLRenderingContext} [gl] - a WebGL context
250
+ * @param {string} [mode="normal"] - blend mode
251
+ * @param {boolean} [premultipliedAlpha=true] - whether textures use premultiplied alpha (affects source blend factor)
252
+ * @returns {string} the blend mode actually applied (may differ if the requested mode is unsupported)
270
253
  */
271
- setBlendMode(mode?: string, gl?: WebGLRenderingContext): void;
254
+ setBlendMode(mode?: string, premultipliedAlpha?: boolean): string;
272
255
  /**
273
256
  * restores the most recently saved renderer state by popping the top entry in the drawing state stack
274
257
  * @example
@@ -440,7 +423,7 @@ export default class WebGLRenderer extends Renderer {
440
423
  */
441
424
  strokePoint(x: number, y: number): void;
442
425
  /**
443
- * Draw a a point at the specified coordinates
426
+ * Draw a point at the specified coordinates
444
427
  * @param {number} x - x axis of the coordinate for the point.
445
428
  * @param {number} y - y axis of the coordinate for the point.
446
429
  */
@@ -494,10 +477,11 @@ export default class WebGLRenderer extends Renderer {
494
477
  * @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
495
478
  */
496
479
  setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse, invert?: boolean): void;
480
+ #private;
497
481
  }
498
482
  import Renderer from "./../renderer.js";
499
- import { Matrix2d } from "../../math/matrix2d.ts";
500
- import type Compositor from "./compositors/compositor.js";
483
+ import type { Matrix2d } from "../../math/matrix2d.ts";
484
+ import type { Batcher } from "./batchers/batcher.js";
501
485
  import TextureCache from "./../texture/cache.js";
502
486
  import { TextureAtlas } from "./../texture/atlas.js";
503
487
  import { Color } from "./../../math/color.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AA+BA;;GAEG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAE1B;;;;;OAKG;IACH,sBAJU,MAAM,CAIY;IAE5B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAEnC;;;;;;;OAOG;IACH,WANU,MAAM,CAME;IAElB;;;;;OAKG;IACH,UAHU,MAAM,CAGO;IAEvB;;;OAGG;IACH,cAFU,WAAW,CAEqB;IAE1C;;;;OAIG;IACH,sBAHU,MAAM,CAGwD;IAExE;;OAEG;IACH,mBAAqB;IAErB;;OAEG;IACH,oBAAsB;IAEtB;;OAEG;IACH,qBAAuB;IAEvB;;OAEG;IACH,mBAAqB;IAErB;;;OAGG;IACH,kBAFU,QAAQ,CAEoB;IAEtC;;;OAGG;IACH,mBAFU,UAAU,CAEc;IAElC;;;OAGG;IACH,gBAFU,YAAY,CAES;IAE/B;;;OAGG;IACH,kCAA4B;IAiB5B,eAAkC;IA8BlC,kBAA6B;IAG7B,oBAA+C;IAwChD;;;;OAIG;IACH,oBAHU,MAAM,CAKf;IAED;;;OAG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ACN,OAAO,QA0BjB;IAED;;;;;;OAMG;IACH,YALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAIhB;IAED;;;;;;;;OAQG;IACH,mBAPW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,MAAM,SACN,OAAO,QAcjB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,eAHW,MAAM,KACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,aAHW,MAAM,KACN,MAAM,QAIhB;IAED;;;;;;;;;OASG;IACH,gBAPW,QAAQ,GAAC,MAAM,KACf,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAKhB;IAED;;;;;;;;;OASG;IACH,aAPW,QAAQ,GAAC,MAAM,KACf,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAehB;IAED;;;;OAIG;IACH,aAHW,MAAM,KACN,MAAM,QAWhB;IAED;;;;;;;;;;OAUG;IACH,YALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QA6ChB;IAED;;;;;;;OAOG;IACH,eAHW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QAmCjB;CAcD;qBAvzCoB,kBAAkB;yBARA,wBAAwB;4BAuBpC,6BAA6B;yBAb/B,uBAAuB;6BADN,uBAAuB;sBAXhC,uBAAuB;0BAmBjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B"}
1
+ {"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AA+BA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAEnC;;;;OAIG;IACH,WAH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AcD;qBApgDoB,kBAAkB;8BAcZ,wBAAwB;6BAEzB,uBAAuB;yBAdxB,uBAAuB;6BADN,uBAAuB;sBAVhC,uBAAuB;0BAkBjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B"}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "18.0.0",
3
+ "version": "18.2.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "type": "module",
7
+ "sideEffects": [
8
+ "./src/polyfill/**"
9
+ ],
7
10
  "keywords": [
8
11
  "2D",
9
12
  "HTML5",
@@ -35,11 +38,15 @@
35
38
  "author": "Olivier Biot (AltByte Pte Ltd)",
36
39
  "funding": "https://github.com/sponsors/melonjs",
37
40
  "engines": {
38
- "node": ">= 20"
41
+ "node": "^20.19.0 || >=22.12.0"
39
42
  },
40
43
  "types": "./build/index.d.ts",
44
+ "module": "./build/index.js",
41
45
  "exports": {
42
- ".": "./build/index.js"
46
+ ".": {
47
+ "types": "./build/index.d.ts",
48
+ "import": "./build/index.js"
49
+ }
43
50
  },
44
51
  "files": [
45
52
  "build",
@@ -53,7 +60,7 @@
53
60
  },
54
61
  "devDependencies": {
55
62
  "@types/howler": "^2.2.12",
56
- "@types/node": "^25.4.0",
63
+ "@types/node": "^25.5.0",
57
64
  "concurrently": "^9.2.1",
58
65
  "del-cli": "^7.0.0",
59
66
  "esbuild": "^0.27.3",
@@ -62,24 +69,23 @@
62
69
  "tsx": "^4.21.0",
63
70
  "type-fest": "^5.4.3",
64
71
  "typedoc": "^0.28.16",
65
- "typedoc-plugin-missing-exports": "^4.1.2",
66
72
  "typescript": "^5.9.3",
67
- "vite": "~7.3.1",
68
- "vite-plugin-glsl": "workspace:^"
73
+ "vite": "^8.0.0",
74
+ "vite-plugin-glsl": "^1.5.6"
69
75
  },
70
76
  "scripts": {
71
77
  "dev": "concurrently --raw \"pnpm build:watch\" \"pnpm tsc:watch\" \"pnpm doc:watch\"",
72
78
  "tsc:watch": "tsc --project tsconfig.build.json --watch --noUnusedParameters false --noUnusedLocals false --preserveWatchOutput",
73
79
  "build:watch": "tsx scripts/build.js watch",
74
- "build": "tsx scripts/build.js && pnpm types",
75
- "dist": "pnpm clean && pnpm vitest run && pnpm build && pnpm doc",
76
- "doc": "typedoc src/index.js --plugin typedoc-plugin-missing-exports --tsconfig tsconfig.build.json",
77
- "doc:watch": "typedoc src/index.js --plugin typedoc-plugin-missing-exports --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
80
+ "lint": "eslint src tests",
81
+ "build": "pnpm lint && tsx scripts/build.js && pnpm types",
82
+ "dist": "pnpm clean && pnpm lint && pnpm vitest run && pnpm build && pnpm doc",
83
+ "doc": "typedoc src/index.js --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false",
84
+ "doc:watch": "typedoc src/index.js --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
78
85
  "serve": "serve docs",
79
86
  "prepublishOnly": "pnpm dist",
80
87
  "clean": "tsx scripts/clean.js",
81
88
  "types": "tsc --project tsconfig.build.json",
82
89
  "test:types": "tsc"
83
- },
84
- "packageManager": "pnpm@9.5.0"
90
+ }
85
91
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"compositor.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/compositors/compositor.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;GAEG;AACH;IACC;;;;;;;;;;;;OAYG;IACH,sBAZW,aAAa,YAErB;QAA2B,SAAS,EACpC;YAAmC,IAAI,EAA/B,MAAM;YACqB,IAAI,EAA/B,MAAM;YACqB,IAAI,EAA/B,MAAM;YACsB,UAAU,EAAtC,OAAO;YACoB,MAAM,EAAjC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SAChB;KAAA,EAGA;IAED;;;OAGG;IACH,yCA0FC;IAxFA,cAAwB;IAGxB,QAAqB;IAGrB,WAAkC;IAGlC,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,mCAAuB;IAEvB;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAiCvB;;;OAGG;IACH,cAMC;IAED;;OAEG;IACH,aAIC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QAYlB;IAED;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QAqChB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAgChB;CACD;qBA3PoB,gBAAgB;8BADP,qBAAqB;8BAMxB,2BAA2B;+BADxB,wBAAwB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"primitive_compositor.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/compositors/primitive_compositor.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;GAGG;AACH;IACC;;;OAGG;IACH,0BAuBC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,SACN,KAAK,EAAE,gBACP,MAAM,QAkChB;CACD;uBAhFsB,iBAAiB;2BAIhB,gCAAgC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quad_compositor.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/compositors/quad_compositor.js"],"names":[],"mappings":"AAmBA;;;GAGG;AACH;IACC;;;OAGG;IACH,0BAkCC;IAFA,wBAA4B;IAC5B,iCAAuB;IAoBxB;;;;;;;;;;;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,iBACL,YAAY,CAsFxB;IAED;;;OAGG;IACH,0BAFW,YAAY,QAKtB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;OAEG;IACH,kEAqBC;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,QAoCjB;CACD;uBAvTsB,iBAAiB;kCAIT,0BAA0B"}