melonjs 19.9.0 → 20.0.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 (286) hide show
  1. package/README.md +25 -14
  2. package/build/application/application.d.ts +70 -16
  3. package/build/application/application.d.ts.map +1 -1
  4. package/build/application/defaultApplicationSettings.d.ts +2 -2
  5. package/build/application/resize.d.ts.map +1 -1
  6. package/build/application/settings.d.ts +150 -53
  7. package/build/application/settings.d.ts.map +1 -1
  8. package/build/camera/camera2d.d.ts +1 -1
  9. package/build/camera/camera2d.d.ts.map +1 -1
  10. package/build/camera/camera3d.d.ts +13 -11
  11. package/build/camera/camera3d.d.ts.map +1 -1
  12. package/build/const.d.ts +55 -26
  13. package/build/const.d.ts.map +1 -1
  14. package/build/geometries/box3d.d.ts +156 -0
  15. package/build/geometries/box3d.d.ts.map +1 -0
  16. package/build/index.d.ts +33 -23
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +21696 -7831
  19. package/build/index.js.map +4 -4
  20. package/build/lang/deprecated.d.ts +4 -4
  21. package/build/lang/deprecated.d.ts.map +1 -1
  22. package/build/level/gltf/GLTFModel.d.ts +4 -0
  23. package/build/level/gltf/GLTFModel.d.ts.map +1 -1
  24. package/build/level/gltf/GLTFScene.d.ts +42 -6
  25. package/build/level/gltf/GLTFScene.d.ts.map +1 -1
  26. package/build/level/gltf/srgb.d.ts +20 -0
  27. package/build/level/gltf/srgb.d.ts.map +1 -0
  28. package/build/level/level.d.ts +21 -2
  29. package/build/level/level.d.ts.map +1 -1
  30. package/build/lighting/light3d.d.ts +61 -13
  31. package/build/lighting/light3d.d.ts.map +1 -1
  32. package/build/loader/loader.d.ts +49 -21
  33. package/build/loader/loader.d.ts.map +1 -1
  34. package/build/loader/parsers/gltf.d.ts.map +1 -1
  35. package/build/loader/parsers/mtl.d.ts +18 -0
  36. package/build/loader/parsers/mtl.d.ts.map +1 -1
  37. package/build/loader/parsers/obj.d.ts +49 -0
  38. package/build/loader/parsers/obj.d.ts.map +1 -1
  39. package/build/loader/parsers/pbr.d.ts +63 -0
  40. package/build/loader/parsers/pbr.d.ts.map +1 -0
  41. package/build/loader/parsers/shader.d.ts +32 -24
  42. package/build/loader/parsers/shader.d.ts.map +1 -1
  43. package/build/particles/particle.d.ts.map +1 -1
  44. package/build/particles/settings.d.ts +3 -1
  45. package/build/particles/settings.d.ts.map +1 -1
  46. package/build/physics/adapter.d.ts +12 -1
  47. package/build/physics/adapter.d.ts.map +1 -1
  48. package/build/physics/broadphase/octree.d.ts +35 -0
  49. package/build/physics/broadphase/octree.d.ts.map +1 -1
  50. package/build/physics/builtin/body.d.ts +123 -6
  51. package/build/physics/builtin/body.d.ts.map +1 -1
  52. package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
  53. package/build/physics/builtin/detector.d.ts +12 -0
  54. package/build/physics/builtin/detector.d.ts.map +1 -1
  55. package/build/physics/builtin/raycast.d.ts.map +1 -1
  56. package/build/physics/builtin/sat3d.d.ts +59 -0
  57. package/build/physics/builtin/sat3d.d.ts.map +1 -0
  58. package/build/physics/response.d.ts +32 -0
  59. package/build/physics/response.d.ts.map +1 -1
  60. package/build/physics/world.d.ts +1 -0
  61. package/build/physics/world.d.ts.map +1 -1
  62. package/build/renderable/container.d.ts +1 -0
  63. package/build/renderable/container.d.ts.map +1 -1
  64. package/build/renderable/entity/entity.d.ts.map +1 -1
  65. package/build/renderable/frameAnimation.d.ts.map +1 -1
  66. package/build/renderable/groundshadow.d.ts +92 -0
  67. package/build/renderable/groundshadow.d.ts.map +1 -0
  68. package/build/renderable/instanced_mesh.d.ts +286 -0
  69. package/build/renderable/instanced_mesh.d.ts.map +1 -0
  70. package/build/renderable/mesh.d.ts +242 -23
  71. package/build/renderable/mesh.d.ts.map +1 -1
  72. package/build/renderable/nineslicesprite.d.ts.map +1 -1
  73. package/build/renderable/renderable.d.ts +6 -4
  74. package/build/renderable/renderable.d.ts.map +1 -1
  75. package/build/renderable/sprite.d.ts +3 -1
  76. package/build/renderable/sprite.d.ts.map +1 -1
  77. package/build/renderable/sprite3d.d.ts +17 -6
  78. package/build/renderable/sprite3d.d.ts.map +1 -1
  79. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  80. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
  81. package/build/renderable/text/text.d.ts.map +1 -1
  82. package/build/state/stage.d.ts.map +1 -1
  83. package/build/system/device.d.ts +11 -40
  84. package/build/system/device.d.ts.map +1 -1
  85. package/build/system/platform.d.ts +0 -16
  86. package/build/system/platform.d.ts.map +1 -1
  87. package/build/utils/utils.d.ts +2 -0
  88. package/build/utils/utils.d.ts.map +1 -1
  89. package/build/video/canvas/canvas_renderer.d.ts +22 -16
  90. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  91. package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
  92. package/build/video/effects/blur.d.ts.map +1 -0
  93. package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
  94. package/build/video/effects/chromaticAberration.d.ts.map +1 -0
  95. package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
  96. package/build/video/effects/colorMatrix.d.ts.map +1 -0
  97. package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
  98. package/build/video/effects/desaturate.d.ts.map +1 -0
  99. package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
  100. package/build/video/effects/dissolve.d.ts.map +1 -0
  101. package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
  102. package/build/video/effects/dropShadow.d.ts.map +1 -0
  103. package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
  104. package/build/video/effects/flash.d.ts.map +1 -0
  105. package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
  106. package/build/video/effects/glow.d.ts.map +1 -0
  107. package/build/video/effects/glsl_realization.d.ts +18 -0
  108. package/build/video/effects/glsl_realization.d.ts.map +1 -0
  109. package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
  110. package/build/video/effects/hologram.d.ts.map +1 -0
  111. package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
  112. package/build/video/effects/invert.d.ts.map +1 -0
  113. package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
  114. package/build/video/effects/outline.d.ts.map +1 -0
  115. package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
  116. package/build/video/effects/pixelate.d.ts.map +1 -0
  117. package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
  118. package/build/video/effects/radialGradient.d.ts.map +1 -0
  119. package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
  120. package/build/video/effects/scanline.d.ts.map +1 -0
  121. package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
  122. package/build/video/effects/sepia.d.ts.map +1 -0
  123. package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
  124. package/build/video/effects/shadereffect.d.ts.map +1 -0
  125. package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
  126. package/build/video/effects/shine.d.ts.map +1 -0
  127. package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
  128. package/build/video/effects/tintPulse.d.ts.map +1 -0
  129. package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
  130. package/build/video/effects/vignette.d.ts.map +1 -0
  131. package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
  132. package/build/video/effects/wave.d.ts.map +1 -0
  133. package/build/video/effects/wgsl/layout.d.ts +28 -0
  134. package/build/video/effects/wgsl/layout.d.ts.map +1 -0
  135. package/build/video/effects/wgsl/parse.d.ts +9 -0
  136. package/build/video/effects/wgsl/parse.d.ts.map +1 -0
  137. package/build/video/effects/wgsl/scaffold.d.ts +43 -0
  138. package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
  139. package/build/video/effects/wgsl_realization.d.ts +83 -0
  140. package/build/video/effects/wgsl_realization.d.ts.map +1 -0
  141. package/build/video/gpu/batcher.d.ts +71 -0
  142. package/build/video/gpu/batcher.d.ts.map +1 -0
  143. package/build/video/gpu/instancerecord.d.ts +164 -0
  144. package/build/video/gpu/instancerecord.d.ts.map +1 -0
  145. package/build/video/gpu/meshchunk.d.ts +49 -0
  146. package/build/video/gpu/meshchunk.d.ts.map +1 -0
  147. package/build/video/gpu/meshvertex.d.ts +54 -0
  148. package/build/video/gpu/meshvertex.d.ts.map +1 -0
  149. package/build/video/gpu/primitives.d.ts +60 -0
  150. package/build/video/gpu/primitives.d.ts.map +1 -0
  151. package/build/video/gpu/quadcorners.d.ts +11 -0
  152. package/build/video/gpu/quadcorners.d.ts.map +1 -0
  153. package/build/video/gpu/textureslots.d.ts +122 -0
  154. package/build/video/gpu/textureslots.d.ts.map +1 -0
  155. package/build/video/gpu/texturestore.d.ts +139 -0
  156. package/build/video/gpu/texturestore.d.ts.map +1 -0
  157. package/build/video/gpu/topology.d.ts +43 -0
  158. package/build/video/gpu/topology.d.ts.map +1 -0
  159. package/build/video/gpu/vertexformat.d.ts +72 -0
  160. package/build/video/gpu/vertexformat.d.ts.map +1 -0
  161. package/build/video/gradient.d.ts +14 -5
  162. package/build/video/gradient.d.ts.map +1 -1
  163. package/build/video/renderer.d.ts +153 -8
  164. package/build/video/renderer.d.ts.map +1 -1
  165. package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
  166. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  167. package/build/video/rendertarget/render_target_pool.d.ts +2 -2
  168. package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
  169. package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
  170. package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
  171. package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
  172. package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
  173. package/build/video/texture/atlas.d.ts.map +1 -1
  174. package/build/video/texture/cache.d.ts +20 -2
  175. package/build/video/texture/cache.d.ts.map +1 -1
  176. package/build/video/texture/noise_texture2d.d.ts +2 -2
  177. package/build/video/utils/autodetect.d.ts.map +1 -1
  178. package/build/video/video.d.ts +1 -55
  179. package/build/video/video.d.ts.map +1 -1
  180. package/build/video/webgl/batchers/batcher.d.ts +132 -35
  181. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  182. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
  183. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
  184. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
  185. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  186. package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
  187. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  188. package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
  189. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  190. package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
  191. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
  192. package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
  193. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  194. package/build/video/webgl/buffer/index.d.ts +1 -1
  195. package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
  196. package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
  197. package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
  198. package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
  199. package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
  200. package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
  201. package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
  202. package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
  203. package/build/video/webgl/glshader.d.ts +101 -8
  204. package/build/video/webgl/glshader.d.ts.map +1 -1
  205. package/build/video/webgl/lighting/constants.d.ts +20 -8
  206. package/build/video/webgl/lighting/constants.d.ts.map +1 -1
  207. package/build/video/webgl/lighting/pack.d.ts +1 -1
  208. package/build/video/webgl/lighting/pack3d.d.ts +27 -11
  209. package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
  210. package/build/video/webgl/lighting/std140.d.ts +110 -0
  211. package/build/video/webgl/lighting/std140.d.ts.map +1 -0
  212. package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
  213. package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
  214. package/build/video/webgl/texture/store.d.ts +52 -0
  215. package/build/video/webgl/texture/store.d.ts.map +1 -0
  216. package/build/video/webgl/utils/maxtextures.d.ts +37 -0
  217. package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
  218. package/build/video/webgl/utils/samplercache.d.ts +69 -0
  219. package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
  220. package/build/video/webgl/utils/string.d.ts +16 -0
  221. package/build/video/webgl/utils/string.d.ts.map +1 -1
  222. package/build/video/webgl/utils/topology.d.ts +24 -0
  223. package/build/video/webgl/utils/topology.d.ts.map +1 -0
  224. package/build/video/webgl/utils/vertexformat.d.ts +27 -0
  225. package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
  226. package/build/video/webgl/webgl_renderer.d.ts +148 -30
  227. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  228. package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
  229. package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
  230. package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
  231. package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
  232. package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
  233. package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
  234. package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
  235. package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
  236. package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
  237. package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
  238. package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
  239. package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
  240. package/build/video/webgpu/buffer/arena.d.ts +64 -0
  241. package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
  242. package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
  243. package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
  244. package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
  245. package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
  246. package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
  247. package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
  248. package/build/video/webgpu/effect_binding.d.ts +17 -0
  249. package/build/video/webgpu/effect_binding.d.ts.map +1 -0
  250. package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
  251. package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
  252. package/build/video/webgpu/pipeline/cache.d.ts +173 -0
  253. package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
  254. package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
  255. package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
  256. package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
  257. package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
  258. package/build/video/webgpu/texture/compressed.d.ts +33 -0
  259. package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
  260. package/build/video/webgpu/texture/frametexture.d.ts +65 -0
  261. package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
  262. package/build/video/webgpu/texture/store.d.ts +149 -0
  263. package/build/video/webgpu/texture/store.d.ts.map +1 -0
  264. package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
  265. package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
  266. package/package.json +5 -5
  267. package/build/video/webgl/effects/blur.d.ts.map +0 -1
  268. package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
  269. package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
  270. package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
  271. package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
  272. package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
  273. package/build/video/webgl/effects/flash.d.ts.map +0 -1
  274. package/build/video/webgl/effects/glow.d.ts.map +0 -1
  275. package/build/video/webgl/effects/hologram.d.ts.map +0 -1
  276. package/build/video/webgl/effects/invert.d.ts.map +0 -1
  277. package/build/video/webgl/effects/outline.d.ts.map +0 -1
  278. package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
  279. package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
  280. package/build/video/webgl/effects/scanline.d.ts.map +0 -1
  281. package/build/video/webgl/effects/sepia.d.ts.map +0 -1
  282. package/build/video/webgl/effects/shine.d.ts.map +0 -1
  283. package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
  284. package/build/video/webgl/effects/vignette.d.ts.map +0 -1
  285. package/build/video/webgl/effects/wave.d.ts.map +0 -1
  286. package/build/video/webgl/shadereffect.d.ts.map +0 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ A modern & lightweight HTML5 game engine
17
17
  -------------------------------------------------------------------------------
18
18
  ![melonJS](https://melonjs.org/img/alex4-github.png)
19
19
 
20
- [melonJS](https://melonjs.org/) is an open-source 2.5D game engine designed for indie developers — perspective and orthogonal cameras, GPU-accelerated tilemap rendering, post-processing effects, custom shaders, 3D mesh support, polygon-accurate physics, modern Tiled workflows, and high performance. Runs on WebGL or Canvas2D with automatic fallback, tree-shakeable so you only pay for what you use, and the entire engine fits in ~150 KB minzipped of vanilla JS/TS with no toolchain lock-in. Built with ES6 classes and bundled with [esbuild](https://esbuild.github.io).
20
+ [melonJS](https://melonjs.org/) is an open-source 2.5D game engine designed for indie developers — perspective and orthogonal cameras, GPU-accelerated tilemap rendering, post-processing effects, custom shaders, 3D mesh support, polygon-accurate physics, modern Tiled workflows, and high performance. Runs on WebGPU, WebGL 2 or Canvas2D with automatic fallback, tree-shakeable so you only pay for what you use, and the entire engine fits in ~150 KB minzipped of vanilla JS/TS with no toolchain lock-in. Built with ES6 classes and bundled with [esbuild](https://esbuild.github.io).
21
21
 
22
22
  [melonJS](https://melonjs.org/) is licensed under the [MIT License](LICENSE.md) and actively maintained by the team at AltByte in Singapore.
23
23
 
@@ -28,11 +28,11 @@ melonJS is designed so you can **focus on making games, not on graphics plumbing
28
28
 
29
29
  - **[Canvas2D-inspired rendering API](https://github.com/melonjs/melonJS/wiki/Rendering-API)** — If you've used the HTML5 Canvas, you already know melonJS. The rendering API (`save`, `restore`, `translate`, `rotate`, `setColor`, `fillRect`, ...) follows the same familiar patterns — no render graphs, no shader pipelines, no instruction sets to learn.
30
30
 
31
- - **True renderer abstraction** — Write your game once, run it on WebGL or Canvas2D with zero code changes. The engine handles all GPU complexity behind a unified API, with automatic fallback when WebGL is not available. Designed to support future backends (WebGPU) without touching game code.
31
+ - **True renderer abstraction** — Write your game once, run it on WebGPU, WebGL 2 or Canvas2D with zero code changes. The engine handles all GPU complexity behind a unified API: the default `AUTO` mode tries WebGPU first at startup, falls back to WebGL 2 if that is unavailable, and ultimately to Canvas, and the entire feature set renders identically on both GPU backends.
32
32
 
33
33
  - **Complete engine, minimal footprint** — Physics, tilemaps, audio, input, cameras, tweens, particles, UI — a full game stack in a single tree-shakeable ES module. No dependency sprawl, no library stitching.
34
34
 
35
- - **Scenes, loaded in one call** — `level.load(name)` brings an authored scene straight into your world. [Tiled](https://www.mapeditor.org) is a first-class citizen for **2D** — orthogonal, isometric, hexagonal & staggered maps, animated tilesets, collision shapes, object properties, compressed formats, with GPU-accelerated tile rendering under WebGL 2 — and **glTF / GLB** is the equivalent for **3D scenes**: author in Blender (or any DCC tool), export a `.glb`, and the whole scene — meshes, materials, cameras, lights, and node animation — loads under a `Camera3d`, no per-mesh wiring. Animated models play back through the same animation API as a 2D `Sprite`.
35
+ - **Scenes, loaded in one call** — `level.load(name)` brings an authored scene straight into your world. [Tiled](https://www.mapeditor.org) is a first-class citizen for **2D** — orthogonal, isometric, hexagonal & staggered maps, animated tilesets, collision shapes, object properties, compressed formats, with GPU-accelerated tile rendering on the GPU backends — and **glTF / GLB** is the equivalent for **3D scenes**: author in Blender (or any DCC tool), export a `.glb`, and the whole scene — meshes, materials, cameras, lights, and node animation — loads under a `Camera3d`, no per-mesh wiring. Animated models play back through the same animation API as a 2D `Sprite`.
36
36
 
37
37
  - **Batteries included, hackable by design** — Get started in minutes with minimal setup. When you need to go deeper: ES6 classes throughout, a plugin system for engine extensions, and a clean architecture that's easy to extend without fighting the framework.
38
38
 
@@ -46,19 +46,24 @@ Compatibility
46
46
  - Compatible with all major browsers (Chrome, Safari, Firefox, Opera, Edge) and mobile devices
47
47
 
48
48
  Graphics
49
- - Fast WebGL renderer for desktop and mobile devices with fallback to Canvas rendering
50
- - Extensible batcher system for custom rendering pipelines
49
+ - Fast GPU renderers (WebGPU and WebGL 2) for desktop and mobile devices, with fallback to Canvas rendering
50
+ - Since 20.0 the aging WebGL 1 path is retired and WebGL 2 is the baseline; devices offering only WebGL 1 fall back to the Canvas renderer under `AUTO`
51
+ - Extensible batcher system for custom rendering pipelines, with backend-neutral vertex formats and draw topologies (declare a layout once, describe it to either GPU backend)
51
52
  - High DPI resolution & Canvas advanced auto scaling
52
53
  - Sprite with 9-slice scaling option and frame animation
53
- - Built-in effects such as tinting, masking, and CSS-style blend modes (normal, additive, multiply, screen, darken, lighten)
54
+ - Built-in effects such as tinting, masking, and CSS-style blend modes (normal, none, additive, multiply, screen, darken, lighten)
54
55
  - Standard spritesheet, single and multiple Packed Textures support
55
56
  - Compressed texture support (DDS, KTX, KTX2, PVR, PKM) with automatic format detection and fallback
57
+ - Hardware antialiasing (`antiAlias: true`) on both GPU backends — and it survives post-processing, since the offscreen targets a post-effect chain renders into are multisampled to match
56
58
  - Procedural noise textures: `Noise` (simplex/perlin/value/cellular, fBm / ridged / ping-pong fractal, domain warp; renderer-free and CPU-samplable for heightmaps, terrain, and spawn jitter) and `NoiseTexture2d` — bake a noise field into a sprite image, a `Gradient` color ramp, or a live-animated tangent-space normal map for lit water and surfaces; unified under a new `Texture2d` base alongside `TextureAtlas`
57
- - 3D mesh rendering with OBJ/MTL model loading, multi-material support, hardware depth testing, and perspective projection via `Camera3d` — ~30% faster mesh rendering with near-zero per-frame allocation (a re-drawn static mesh produces no GC garbage)
59
+ - 3D mesh rendering with OBJ/MTL model loading, multi-material support, hardware depth testing, and perspective projection via `Camera3d` — retained-mode geometry, uploaded to the GPU once and re-drawn from there, so moving, rotating, scaling or re-tinting a mesh costs no vertex upload and no per-vertex CPU work at all
60
+ - Mipmapped and anisotropically-filtered mesh textures on both GPU backends, so distant and grazing-angle geometry stops shimmering (opt out per mesh with `textureFilter: "nearest"` for crisp pixel-art models)
58
61
  - Lighting, in 2D and 3D:
59
62
  - **2D** — `Light2d` as a first-class `Renderable` (multiple dynamic lights, radial-gradient falloff, illumination-only mode, procedural rendering via `drawLight`), plus optional per-pixel normal-map shading on sprites for 3D-looking dynamic lights
60
- - **3D** — `Light3d` directional + ambient lights, added to the world like `Light2d` (half-Lambert diffuse + ambient fill, runtime-manipulable for day/night), auto-loaded from a glTF scene's authored sun
61
- - Built-in shader effects (Flash, Outline, Glow, Dissolve, CRT, Hologram, etc.) with multi-pass chaining via `postEffects`, plus custom shader support via `ShaderEffect` for per-sprite fragment effects (WebGL)
63
+ - **3D** — `Light3d` directional, point, spot and ambient lights, added to the world like `Light2d` (half-Lambert diffuse + ambient fill, quadratic falloff and cone angles on the punctual types, runtime-manipulable for day/night), auto-loaded from a glTF scene's authored suns and lamps
64
+ - up to **32 simultaneous lights** on either path, with light data travelling in a uniform buffer — a static light rig costs zero GPU state changes per frame
65
+ - Ground ("blob") shadows for 3D objects — **on by default** — so characters and props read as standing on the floor instead of hovering. An ellipse matching the caster's own footprint and rotation, shrinking and fading with height above the ground; one extra draw per object, and **one for an entire `InstancedMesh` scatter regardless of instance count**. Controllable per object, per glTF scene (`level.load(name, { castGroundShadow })`) or application-wide. Deliberately not shadow mapping: it answers "where is this standing", which is what a 2.5D scene needs
66
+ - Built-in shader effects (Flash, Outline, Glow, Dissolve, CRT, Hologram, etc.) with multi-pass chaining via `addPostEffect()`, plus custom shader support on both GPU backends: `ShaderEffect` for per-sprite fragment effects (GLSL and/or WGSL bodies) and complete custom mesh shader programs via `mesh.shader` (a dual-language `GLShader`: GLSL pair and/or WGSL module)
62
67
  - Trail renderable for fading, tapering ribbons behind moving objects (speed lines, sword slashes, magic trails)
63
68
  - System & Bitmap Text with built-in typewriter effect
64
69
  - Video sprite playback
@@ -98,7 +103,7 @@ UI
98
103
  Scenes
99
104
  - Load a scene in one call with `level.load(name)` — 2D Tiled maps and 3D glTF scenes alike, auto-registered on preload
100
105
  - [Tiled](https://www.mapeditor.org) map format [up to 1.12](https://doc.mapeditor.org/en/stable/reference/tmx-changelog/) built-in support for easy level design
101
- - **GPU-accelerated tile rendering** for orthogonal maps under WebGL 2 — each layer draws as a single quad with no per-tile loop, ~5–8× faster than the legacy CPU renderer on dense maps. Honors animated tiles, flip bits, per-layer opacity/tint/blend, and oversized bottom-aligned tiles; falls back transparently to the CPU renderer on isometric/staggered/hexagonal layers or non-WebGL-2 contexts
106
+ - **GPU-accelerated tile rendering** for orthogonal maps on the GPU backends (WebGL 2 and WebGPU) — each layer draws as a single quad with no per-tile loop, ~5–8× faster than the legacy CPU renderer on dense maps. Honors animated tiles, flip bits, per-layer opacity/tint/blend, and oversized bottom-aligned tiles; falls back transparently to the CPU renderer on isometric/staggered/hexagonal layers or under the Canvas renderer
102
107
  - Uncompressed and [compressed](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) Plain, Base64, CSV and JSON encoded XML tilemap loading
103
108
  - Orthogonal, Isometric, Hexagonal (both normal and staggered) and Oblique maps
104
109
  - Multiple layers with per-layer alpha, tinting and blend modes (multiple background/foreground, collision and Image layers)
@@ -116,7 +121,7 @@ Scenes
116
121
  - Shape based Tile collision support
117
122
  - glTF / GLB 3D scenes — load an authored 3D scene with `level.load(...)`, the same one call as a Tiled map
118
123
  - The whole scene loads at once — meshes, materials, cameras and lights — viewed under a `Camera3d`
119
- - Automatically lit by the scene's directional lights (the sun set up in the authoring tool)
124
+ - Automatically lit by the scene's authored lights — the sun plus any point/spot lamps set up in the authoring tool, each keeping its authored name so `getChildByName("Sun")` finds it for runtime tuning
120
125
  - Textured, solid-colored, and vertex-colored materials
121
126
  - Node animation — walk/idle/sprint characters, spinning pickups, doors, lifts — played through the same `setCurrentAnimation` / `play` / `pause` / `stop` API as a 2D `Sprite`
122
127
  - `.glb` and `.gltf` files, with embedded *or* external buffers & textures
@@ -128,7 +133,7 @@ Assets
128
133
  - Support for images, JSON, TMX/TSX, glTF / GLB 3D scenes, `.aseprite` / `.ase` binary, audio, video, binary and fonts
129
134
 
130
135
  Core
131
- - `Application` class as the modern entry point with built-in pause, resume, and `freeze()` (hit-stop) primitives
136
+ - `Application` class as the modern entry point — construct it, then `await app.init()` (asynchronous since 20.0, so the WebGPU device can be acquired) — with built-in pause, resume, and `freeze()` (hit-stop) primitives
132
137
  - A state manager (to easily manage loading, menu, options, in-game state)
133
138
  - Tween effects with multiple easing functions (Quadratic, Cubic, Elastic, Bounce, etc.) and Bezier/Catmull-Rom interpolation
134
139
  - Transition effects
@@ -179,9 +184,10 @@ Examples
179
184
  * [SVG Shapes](https://melonjs.github.io/melonJS/examples/#/svg-shapes) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/svgShapes))
180
185
  * [Graphics](https://melonjs.github.io/melonJS/examples/#/graphics) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/graphics))
181
186
  * [Hello World](https://melonjs.github.io/melonJS/examples/#/hello-world) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/helloWorld))
187
+ * [Hello WebGPU](https://melonjs.github.io/melonJS/examples/#/webgpu) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/webgpu)) — the WebGPU backend in action, with the renderer negotiation surfaced on screen
182
188
  * [Whac-A-Mole](https://melonjs.github.io/melonJS/examples/#/whac-a-mole) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/whac-a-mole))
183
189
  * [Compressed Textures](https://melonjs.github.io/melonJS/examples/#/compressed-textures) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/compressedTextures))
184
- * [Aquarium](https://melonjs.github.io/melonJS/examples/#/aquarium) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/aquarium)) — screen-space water refraction with `renderer.toFrameTexture()`: fish swim across a seabed, then a water surface captures the live frame on the GPU and re-samples it through a scrolling `NoiseTexture2d` flow map (the Godot `hint_screen_texture` / Unity `_CameraOpaqueTexture` pattern)
190
+ * [Aquarium](https://melonjs.github.io/melonJS/examples/#/aquarium) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/aquarium)) — screen-space water refraction with `renderer.toFrameTexture()`: fish swim across a seabed, then a water surface captures the live frame on the GPU and re-samples it through a scrolling `NoiseTexture2d` flow map (the standard screen-texture / opaque-frame-copy pattern)
185
191
  * [Heat Haze](https://melonjs.github.io/melonJS/examples/#/heat-haze) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/heatHaze)) — `renderer.toFrameTexture()` over a lit scene: normal-mapped tiles under a moving `Light2d`, distorted by a rising heat-haze that captures and ripples the lit frame
186
192
  * [3D Mesh](https://melonjs.github.io/melonJS/examples/#/mesh-3d) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/mesh3d))
187
193
  * [3D Mesh Material](https://melonjs.github.io/melonJS/examples/#/mesh-3d-material) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/mesh3dMaterial))
@@ -208,6 +214,9 @@ const app = new Application(1218, 562, {
208
214
  backgroundColor: "#202020",
209
215
  });
210
216
 
217
+ // initialize it (builds the renderer and appends the canvas)
218
+ await app.init();
219
+
211
220
  // set a gray background color
212
221
  app.world.backgroundColor.parseCSS("#202020");
213
222
 
@@ -223,6 +232,8 @@ app.world.addChild(new Text(609, 281, {
223
232
  ```
224
233
  > Simple hello world using melonJS
225
234
 
235
+ > **Note:** since version 20.0, `await app.init()` is **required** after constructing the `Application`. The WebGPU backend, which `AUTO` tries first on browsers that support it, acquires its GPU device asynchronously, so initialization had to become an async step; it resolves without suspending on the WebGL and Canvas backends. On 19.x the call is optional and this example works without it.
236
+
226
237
  Documentation
227
238
  -------------------------------------------------------------------------------
228
239
 
@@ -235,7 +246,7 @@ melonJS provides a plugin system allowing to extend the engine capabilities.
235
246
  Here is the list of official plugins maintained by the melonJS team:
236
247
  - [debug-plugin](https://github.com/melonjs/melonJS/tree/master/packages/debug-plugin) - a debug panel for inspecting game objects
237
248
  - [tiled-inflate-plugin](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) - enable loading and parsing of zlib, gzip and zstd compressed [Tiled](https://www.mapeditor.org/) maps
238
- - [spine-plugin](https://github.com/melonjs/melonJS/tree/master/packages/spine-plugin) - [Spine](http://esotericsoftware.com) runtime integration to render Spine skeletal animations
249
+ - [spine-plugin](https://github.com/melonjs/melonJS/tree/master/packages/spine-plugin) - [Spine](http://esotericsoftware.com) runtime integration to render Spine skeletal animations, with a dedicated batcher on each renderer (WebGPU, WebGL and Canvas)
239
250
  - [capacitor-plugin](https://github.com/melonjs/melonJS/tree/master/packages/capacitor-plugin) - bridges [Capacitor](https://capacitorjs.com/)'s native lifecycle (pause/resume, hardware back-button, orientation lock, splash) for melonJS games wrapped as iOS / Android apps
240
251
 
241
252
  If you wish to develop your own plugin, we also provide a [plugin template](https://github.com/melonjs/plugin-template) to help you get started.
@@ -4,11 +4,14 @@ import type Renderer from "./../video/renderer.js";
4
4
  import type { ApplicationSettings, ResolvedApplicationSettings } from "./settings.ts";
5
5
  /**
6
6
  * The Application class is the main entry point for creating a melonJS game.
7
- * It initializes the renderer, creates the game world and viewport, registers DOM event
8
- * listeners (resize, orientation, scroll), and starts the game loop.
7
+ * The constructor resolves the given settings, creates the game world and
8
+ * registers DOM event listeners (resize, orientation, scroll); you **MUST**
9
+ * then call (and await) {@link Application#init init}, which builds the
10
+ * renderer, appends the canvas to the parent element, and starts the game
11
+ * loop — without it the application has no renderer and displays nothing.
9
12
  *
10
13
  * The Application instance provides access to the core game systems:
11
- * - {@link Application#renderer renderer} — the active Canvas or WebGL renderer
14
+ * - {@link Application#renderer renderer} — the active Canvas, WebGL or (experimental) WebGPU renderer
12
15
  * - {@link Application#world world} — the root container for all game objects
13
16
  * - {@link Application#viewport viewport} — the default camera / viewport
14
17
  *
@@ -24,6 +27,9 @@ import type { ApplicationSettings, ResolvedApplicationSettings } from "./setting
24
27
  * renderer: 2, // AUTO
25
28
  * });
26
29
  *
30
+ * // build the renderer (mandatory — only suspends for WebGPU)
31
+ * await app.init();
32
+ *
27
33
  * // add objects to the world
28
34
  * app.world.addChild(new Sprite(0, 0, { image: "player" }));
29
35
  *
@@ -36,7 +42,7 @@ export default class Application {
36
42
  */
37
43
  parentElement: HTMLElement;
38
44
  /**
39
- * a reference to the active Canvas or WebGL renderer
45
+ * a reference to the active Canvas, WebGL or (experimental) WebGPU renderer
40
46
  */
41
47
  renderer: Renderer;
42
48
  /**
@@ -99,16 +105,49 @@ export default class Application {
99
105
  private _onResize?;
100
106
  private _onOrientationChange?;
101
107
  private _onScroll?;
108
+ private _doResize?;
109
+ private _resizeObserver;
110
+ private _destroyed;
111
+ /**
112
+ * Simulated time advanced by one logic step, in ms — what `world.update()`
113
+ * receives. Fixed at `1000 / world.fps` unless `timer.interpolation` is on,
114
+ * in which case it follows the real frame delta.
115
+ *
116
+ * Not to be confused with {@link Application#lastUpdateDelta}, which is how
117
+ * long that step actually took to compute.
118
+ */
102
119
  updateDelta: number;
103
120
  lastUpdateStart: number | null;
104
- updateAverageDelta: number;
105
121
  /**
106
- * Create and initialize a new melonJS Application.
107
- * This is the recommended way to start a melonJS game.
122
+ * Measured wall-clock cost of the most recent logic step, in ms
123
+ * (`performance.now()` taken either side of the world/stage update).
124
+ *
125
+ * Used by the fixed-timestep loop to avoid a spiral of death: the
126
+ * accumulator drains by at least this much, so a scene too heavy to
127
+ * simulate in real time slows down instead of locking up.
128
+ *
129
+ * Only the *last* step of a frame is recorded, so a frame that ran several
130
+ * catch-up steps reports less than its total update cost.
131
+ * Renamed from `updateAverageDelta` in 20.0.0.
132
+ * @since 20.0.0
133
+ */
134
+ lastUpdateDelta: number;
135
+ /**
136
+ * @deprecated since 20.0.0 — renamed to {@link Application#lastUpdateDelta}.
137
+ * The old name claimed an average that has not existed since 2015, when the
138
+ * exponential smoothing behind it was removed a day after being added.
139
+ */
140
+ get updateAverageDelta(): number;
141
+ set updateAverageDelta(value: number);
142
+ /**
143
+ * Create a new melonJS Application.
144
+ * Constructing the instance is only the first half of starting a game:
145
+ * you **MUST** then call (and await) {@link Application#init init} to
146
+ * build the renderer — an Application on which `init()` has not resolved
147
+ * has no `renderer`, no canvas, and cannot render anything.
108
148
  * @param width - The width of the canvas viewport
109
149
  * @param height - The height of the canvas viewport
110
150
  * @param options - The optional parameters for the application and default renderer
111
- * @throws {Error} Will throw an exception if it fails to instantiate a renderer
112
151
  * @example
113
152
  * const app = new Application(1024, 768, {
114
153
  * parent: "game-container",
@@ -116,17 +155,28 @@ export default class Application {
116
155
  * scaleMethod: "fit",
117
156
  * renderer: 2, // AUTO
118
157
  * });
158
+ * await app.init();
119
159
  */
120
- constructor(width: number, height: number, options?: Partial<ApplicationSettings> & {
121
- legacy?: boolean;
122
- });
160
+ constructor(width: number, height: number, options?: Partial<ApplicationSettings>);
123
161
  /**
124
- * init the game instance (create a physic world, update starting time, etc..)
125
- * @param width - The width of the canvas viewport
126
- * @param height - The height of the canvas viewport
127
- * @param options - The optional parameters for the application and default renderer
162
+ * Build the renderer and everything that depends on it — the canvas
163
+ * (appended to the parent element), the initial resize layout, and the
164
+ * console banner. Reads {@link Application#settings}, resolved by the
165
+ * constructor; it takes no arguments of its own.
166
+ *
167
+ * **Calling and awaiting this is mandatory** — it is the second half of
168
+ * every Application's start-up, not an optional step. It resolves
169
+ * synchronously for the Canvas and WebGL backends, which acquire their
170
+ * context without suspending — but WebGPU cannot, and an application
171
+ * whose `init()` has not resolved has no `renderer`.
172
+ * @throws {Error} if it fails to instantiate the requested renderer
173
+ * (e.g. `renderer: video.WEBGL` on a device with no WebGL 2 support)
174
+ * @returns resolves once the application is ready to use
175
+ * @example
176
+ * const app = new Application(640, 480, { parent: "screen" });
177
+ * await app.init();
128
178
  */
129
- init(width: number, height: number, options?: Partial<ApplicationSettings>): void;
179
+ init(): Promise<void>;
130
180
  /**
131
181
  * reset the game Object manager
132
182
  * destroy all current objects
@@ -210,6 +260,10 @@ export default class Application {
210
260
  * Destroy this application instance and release all associated resources.
211
261
  * Removes the canvas from the DOM, destroys the world, and unregisters
212
262
  * all event listeners.
263
+ *
264
+ * **Terminal**: a destroyed Application cannot be re-initialized —
265
+ * `init()` rejects afterwards (and an `init()` still in flight aborts).
266
+ * Construct a new Application to start again.
213
267
  * @param removeCanvas - if true, the canvas element is removed from the DOM (default: true)
214
268
  * @example
215
269
  * // clean up when done
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AA8BxC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAOnD,OAAO,KAAK,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,eAAe,CAAC;AAgEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC/B;;OAEG;IACH,aAAa,EAAG,WAAW,CAAC;IAE5B;;OAEG;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;OAEG;I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AG,IAAI;IAmE3C;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAInC;;;OAGG;IACH,MAAM,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,cAAc;IACd,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKzB,cAAc;IACd,OAAO,IAAI,IAAI;IASf,cAAc;IACd,QAAQ,IAAI,IAAI;IAShB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA+C1B;;OAEG;IACH,IAAI,IAAI,IAAI;CA0BZ;AAED;;;;;GAKG;AACH,eAAO,IAAI,IAAI,EAAE,WAAW,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,QAE9C"}
@@ -2,11 +2,12 @@ export declare const defaultApplicationSettings: {
2
2
  renderer: 2;
3
3
  scale: number;
4
4
  scaleMethod: "manual";
5
- preferWebGL1: false;
6
5
  powerPreference: "default";
7
6
  transparent: false;
8
7
  antiAlias: false;
9
8
  textureFilter: "auto";
9
+ maxTextures: "auto";
10
+ castGroundShadow: true;
10
11
  consoleHeader: true;
11
12
  blendMode: "normal";
12
13
  physic: "builtin";
@@ -15,7 +16,6 @@ export declare const defaultApplicationSettings: {
15
16
  highPrecisionShader: true;
16
17
  subPixel: false;
17
18
  verbose: false;
18
- legacy: false;
19
19
  backgroundColor: string;
20
20
  };
21
21
  //# sourceMappingURL=defaultApplicationSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/application/resize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAkChD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA4EhD"}
1
+ {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/application/resize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAkChD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAyGhD"}
@@ -6,9 +6,9 @@ import type Camera2d from "../camera/camera2d";
6
6
  import { RendererType } from "../const";
7
7
  import { PhysicsAdapter } from "../physics/adapter";
8
8
  import Renderer from "../video/renderer";
9
- import { Batcher } from "../video/webgl/batchers/batcher";
9
+ import { WebGLBatcher } from "../video/webgl/batchers/batcher.js";
10
10
  import { ScaleMethod } from "./scaleMethods";
11
- type BlendMode = "normal" | "multiply" | "lighter" | "additive" | "screen";
11
+ type BlendMode = "normal" | "multiply" | "lighter" | "additive" | "screen" | "darken" | "lighten" | "exclusion" | "none";
12
12
  /**
13
13
  * How the application's physics is configured.
14
14
  *
@@ -21,23 +21,31 @@ type BlendMode = "normal" | "multiply" | "lighter" | "additive" | "screen";
21
21
  type PhysicsType = "builtin" | "none" | PhysicsAdapter | {
22
22
  adapter: PhysicsAdapter;
23
23
  };
24
- type PowerPreference = "default" | "low-power";
24
+ type PowerPreference = "default" | "low-power" | "high-performance";
25
25
  export type ApplicationSettings = {
26
26
  /**
27
- * Renderer to use. Three built-in modes (constants from `me.video`):
28
- *
29
- * - {@link CANVAS} — HTML5 Canvas backend. No shader / mesh /
30
- * Camera3d support.
31
- * - {@link WEBGL} — **requires WebGL**. Throws at `new Application(...)`
32
- * time if WebGL is unavailable (driver-blocklisted GPU, perf-caveat
33
- * failure, etc.). Use this when your scene needs Camera3d, Mesh,
34
- * ShaderEffect, Light2d or GPU tilemap — you'd rather fail fast
35
- * than render a stuck blank canvas.
36
- * - {@link AUTO} — try WebGL, silently fall back to Canvas if
37
- * unavailable. Application construction always succeeds. The
38
- * WebGL-only subsystems (Camera3d, Mesh, ShaderEffect, Light2d,
39
- * GPU tilemap) silently stop working under the Canvas fallback —
40
- * if your scene depends on any of those, use `WEBGL` instead.
27
+ * Renderer to use. Four built-in modes (constants from `me.video`):
28
+ *
29
+ * - {@link AUTO} — negotiate the best available backend:
30
+ * **WebGPU → WebGL 2 → Canvas**. `await app.init()` always
31
+ * resolves under AUTO; the WebGPU attempt is a full adapter/device
32
+ * negotiation awaited inside `init()`, falling through to the
33
+ * synchronous candidates when it rejects. Under the Canvas tail the
34
+ * GPU-only subsystems (Camera3d, retained meshes, ShaderEffect,
35
+ * Light2d/Light3d shading, GPU tilemap) degrade or disable — gate on
36
+ * the renderer capability flags (`supportsDepthBuffer`,
37
+ * `shaderLanguage`, …) if your scene depends on them.
38
+ * - {@link WEBGPU} — require the WebGPU backend. `app.init()`
39
+ * **rejects** when no adapter/device can be acquired — it never
40
+ * substitutes another backend.
41
+ * - {@link WEBGL} — **requires WebGL 2** (the WebGL renderer is
42
+ * WebGL 2 only since 20.0). `app.init()` **rejects** if a WebGL 2
43
+ * context is unavailable (WebGL-1-only device, driver-blocklisted
44
+ * GPU, perf-caveat failure, etc.) — fail fast rather than render a
45
+ * stuck blank canvas.
46
+ * - {@link CANVAS} — the HTML5 Canvas backend. No programmable
47
+ * pipeline: no shaders/lighting, no Camera3d/depth path (meshes
48
+ * only render on the CPU-projected 2D-camera path).
41
49
  *
42
50
  * Or pass a custom `Renderer` subclass instance for full control.
43
51
  * @default AUTO
@@ -58,13 +66,20 @@ export type ApplicationSettings = {
58
66
  */
59
67
  scaleTarget: HTMLElement;
60
68
  /**
61
- * if true the renderer will only use WebGL 1
62
- * @default false
63
- */
64
- preferWebGL1: boolean;
65
- /**
66
- * a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context. To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
67
- * @default default
69
+ * A hint to the user agent about which GPU to use on multi-GPU systems
70
+ * (discrete vs integrated). Browsers generally favour the low-power GPU
71
+ * unless asked otherwise, to preserve battery life.
72
+ *
73
+ * - `"default"` — no hint; let the user agent decide.
74
+ * - `"low-power"` — prefer the integrated GPU.
75
+ * - `"high-performance"` — prefer the discrete GPU. Note that browsers
76
+ * only honour this for pages that handle context loss, since switching
77
+ * GPU can drop the context; melonJS registers those handlers itself,
78
+ * so the request is respected.
79
+ *
80
+ * The same hint (and the same values, minus `"default"`) is used by
81
+ * WebGPU's adapter request, so this setting is backend-neutral.
82
+ * @default "default"
68
83
  */
69
84
  powerPreference: PowerPreference;
70
85
  /**
@@ -73,14 +88,22 @@ export type ApplicationSettings = {
73
88
  */
74
89
  transparent: boolean;
75
90
  /**
76
- * whether to enable or not video scaling interpolation
91
+ * whether to enable or not video scaling interpolation.
92
+ * On the GPU backends this drives polygon-edge antialiasing (up to
93
+ * 4× MSAA) — on the canvas itself, and equally through post-effect
94
+ * chains, whose scene capture targets are multisampled to match, so
95
+ * adding a camera effect never switches edge smoothing off. Texture
96
+ * sampling smoothness is controlled separately by `textureFilter`.
97
+ * Multisampled capture targets cost GPU memory (roughly 30 bytes per
98
+ * pixel at 4×, ~55 MB at 1080p on WebGL) — with `antiAlias: false`
99
+ * no multisampled storage is ever allocated.
77
100
  * @default false
78
101
  */
79
102
  antiAlias: boolean;
80
103
  /**
81
104
  * Default texture magnification/minification filter, **decoupled from
82
- * `antiAlias`** (WebGL only — the 2D Canvas renderer has no per-texture
83
- * filtering and ignores this).
105
+ * `antiAlias`** (GPU backends — WebGL and WebGPU; the 2D Canvas
106
+ * renderer has no per-texture filtering and ignores this).
84
107
  *
85
108
  * `antiAlias` conflates two separate concerns: polygon-edge antialiasing
86
109
  * (MSAA) *and* texture sampling smoothness. This setting separates the
@@ -111,6 +134,73 @@ export type ApplicationSettings = {
111
134
  * });
112
135
  */
113
136
  textureFilter: "auto" | "nearest" | "linear";
137
+ /**
138
+ * How many texture units the WebGL multi-texture batchers may use
139
+ * ([#1585](https://github.com/melonjs/melonJS/issues/1585)).
140
+ *
141
+ * A batch can draw sprites from this many distinct textures before it has
142
+ * to flush and start over, so a scene with more textures in flight than
143
+ * this loses batching sharply. The pool used to be hardcoded to 16 — the
144
+ * WebGL 2 spec *floor* for `MAX_TEXTURE_IMAGE_UNITS`, and roughly half
145
+ * what current desktop and mobile hardware reports.
146
+ *
147
+ * - `"auto"` (default) — the device's reported limit, capped at 32.
148
+ * - a number — that many units, clamped to what the device actually has
149
+ * (asking for more than exists would fail to link the shader).
150
+ *
151
+ * Raising it costs fragment-shader compile time and register pressure,
152
+ * because the batcher's shader unrolls one sampler and one branch per
153
+ * unit. Lowering it is the escape hatch if a driver misbehaves on wide
154
+ * sampler ladders.
155
+ *
156
+ * **Read at initialization only** — the batchers compile their shaders
157
+ * against this value, so unlike `textureFilter` there is no runtime setter.
158
+ * WebGL only; the WebGPU backend sizes its own slot budget from its
159
+ * per-stage binding limits, and the Canvas renderer has no batching.
160
+ * @default "auto"
161
+ * @example
162
+ * // cap the pool on a device with a known-bad wide sampler ladder
163
+ * const app = new Application(1024, 768, {
164
+ * renderer: video.WEBGL,
165
+ * maxTextures: 16,
166
+ * });
167
+ */
168
+ maxTextures: "auto" | number;
169
+ /**
170
+ * whether 3D objects cast a soft "blob" shadow on the ground by default
171
+ * ([#1515](https://github.com/melonjs/melonJS/issues/1515)).
172
+ *
173
+ * A ground shadow is what stops a character or prop reading as *floating*
174
+ * in a 2.5D scene — it answers "where is this standing", not "where is the
175
+ * light". It is deliberately not a simulated shadow; see
176
+ * {@link Mesh#castGroundShadow}.
177
+ *
178
+ * This is the **default** for every {@link Mesh}, {@link Sprite3d} and
179
+ * {@link InstancedMesh}; each can override it with its own
180
+ * `castGroundShadow` (which wins), and {@link level.load} takes the same
181
+ * option for one glTF scene (which wins over this).
182
+ *
183
+ * Because it is a blanket opt-in, it skips meshes with **no vertical
184
+ * extent** — a flat plane lying on the floor *is* the floor, and shadowing
185
+ * it with itself would smear a blob across the whole ground. A per-object
186
+ * `castGroundShadow: true` bypasses that safeguard, being an explicit
187
+ * instruction.
188
+ *
189
+ * **On by default.** Requires a GPU backend *and* a {@link Camera3d}, so a
190
+ * 2D game is untouched whatever this says — the Canvas renderer has no
191
+ * depth buffer and the 2D-camera path draws none. Set it `false` to opt a
192
+ * 3D game out wholesale (a scene with baked lighting, or one bringing its
193
+ * own shadows, would otherwise get two).
194
+ * @default true
195
+ * @example
196
+ * // opt a 3D game out — e.g. its lighting is already baked into the models
197
+ * const app = new Application(1024, 768, {
198
+ * cameraClass: Camera3d,
199
+ * castGroundShadow: false,
200
+ * });
201
+ * await app.init();
202
+ */
203
+ castGroundShadow: boolean;
114
204
  /**
115
205
  * whether to display melonJS version and basic device information in the console
116
206
  * @default true
@@ -138,21 +228,30 @@ export type ApplicationSettings = {
138
228
  */
139
229
  physic: PhysicsType;
140
230
  /**
141
- * Enable the WebGL2 procedural shader path for orthogonal tile layers.
142
- * When `true` (default), eligible layers render via a single quad per
143
- * tileset + a fragment shader doing per-fragment GID lookup, bypassing
144
- * the per-tile draw loop entirely. Layers that don't qualify
145
- * (Canvas/WebGL1, non-orthogonal, collection-of-image tilesets,
146
- * tilerendersize "grid", non-zero tileoffset, oversampled beyond the
147
- * shader's overflow window) fall back to the legacy path automatically.
231
+ * Enable the GPU procedural shader path for orthogonal tile layers
232
+ * (backends advertising `renderer.supportsShaderTileLayers` — WebGL 2
233
+ * and WebGPU). When `true` (default), eligible layers render via a
234
+ * single quad per tileset + a fragment shader doing per-fragment GID
235
+ * lookup, bypassing the per-tile draw loop entirely. Layers that
236
+ * don't qualify (Canvas renderer, non-orthogonal,
237
+ * collection-of-image tilesets, tilerendersize "grid", non-zero
238
+ * tileoffset, oversampled beyond the shader's overflow window) fall
239
+ * back to the legacy path automatically.
148
240
  * Set to `false` to disable globally.
149
241
  * @default true
150
242
  */
151
243
  gpuTilemap: boolean;
152
244
  /**
153
- * if true, the renderer will fail if the browser reports a major performance caveat
154
- * (e.g. software WebGL). Set to false to allow WebGL on machines with
155
- * blocklisted GPU drivers or software renderers.
245
+ * If true, treat WebGL as unavailable when the browser warns that a
246
+ * context would perform dramatically worse than a native application
247
+ * (a software rasterizer, a blocklisted driver). Note this is stricter
248
+ * than the WebGL default, which is `false`.
249
+ *
250
+ * The WebGPU backend honors it too, by rejecting a fallback
251
+ * (software) adapter. The effect: under {@link AUTO} such a machine
252
+ * gets the Canvas renderer, and under {@link WEBGL} / {@link WEBGPU}
253
+ * `app.init()` rejects. Set to `false` to accept a software or
254
+ * blocklisted context instead.
156
255
  * @default true
157
256
  */
158
257
  failIfMajorPerformanceCaveat: boolean;
@@ -182,11 +281,6 @@ export type ApplicationSettings = {
182
281
  * @default false
183
282
  */
184
283
  verbose: boolean;
185
- /**
186
- * whether to enable legacy mode (enables deprecated `video.init()` entry point)
187
- * @default false
188
- */
189
- legacy: boolean;
190
284
  /**
191
285
  * the CSS background color of the parent element that holds the canvas.
192
286
  * Applied during initialization to prevent a white flash before the first render.
@@ -195,14 +289,17 @@ export type ApplicationSettings = {
195
289
  */
196
290
  backgroundColor: string;
197
291
  /**
198
- * a custom batcher class (WebGL only)
292
+ * a custom batcher class (extend the active backend's base:
293
+ * `WebGLBatcher` / `WebGPUBatcher`)
199
294
  * @deprecated since 18.1.0 — use `batcher` instead
200
295
  */
201
- compositor?: (new (renderer: any) => Batcher) | undefined;
296
+ compositor?: (new (renderer: any) => WebGLBatcher) | undefined;
202
297
  /**
203
- * a custom batcher class (WebGL only)
298
+ * a custom batcher class, riding the quad/primitive slots on either
299
+ * GPU backend — extend `WebGLBatcher` under WebGL, `WebGPUBatcher`
300
+ * under WebGPU (`addBatcher` rejects a wrong-backend class loudly)
204
301
  */
205
- batcher?: (new (renderer: any) => Batcher) | undefined;
302
+ batcher?: (new (renderer: any) => WebGLBatcher) | undefined;
206
303
  /**
207
304
  * Default camera class instantiated for any {@link Stage} that does not
208
305
  * explicitly provide its own cameras. Set to {@link Camera3d} to opt
@@ -212,14 +309,14 @@ export type ApplicationSettings = {
212
309
  * (e.g. the loader screen) explicitly use {@link Camera2d} regardless
213
310
  * of this setting.
214
311
  *
215
- * **WebGL requirement.** Camera classes whose
312
+ * **GPU-backend requirement.** Camera classes whose
216
313
  * `static defaultSortOn === "depth"` (Camera3d and any subclass) need
217
- * the WebGL renderer — perspective projection, depth attachment and
218
- * mesh draw all live in the WebGL backend. Pairing such a
219
- * `cameraClass` with `renderer: video.AUTO` on a system where AUTO
220
- * falls back to Canvas emits a `console.warn` at construction time
221
- * and produces a non-functional render. Use `renderer: video.WEBGL`
222
- * to get a hard throw instead.
314
+ * a renderer with a depth buffer (`renderer.supportsDepthBuffer` —
315
+ * WebGL 2 or WebGPU). Pairing such a `cameraClass` with
316
+ * `renderer: video.AUTO` on a system where AUTO falls back to Canvas
317
+ * emits a `console.warn` and produces a non-functional render. Pin
318
+ * `renderer: video.WEBGL` (or `WEBGPU`) to make `app.init()` reject
319
+ * instead.
223
320
  * @default Camera2d
224
321
  */
225
322
  cameraClass?: new (minX: number, minY: number, maxX: number, maxY: number) => Camera2d;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/application/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE3E;;;;;;;;GAQG;AACH,KAAK,WAAW,GACb,SAAS,GACT,MAAM,GACN,cAAc,GACd;IAAE,OAAO,EAAE,cAAc,CA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AO,EAAE,OAAO,CAAC;IAEjB;;;;;OAKG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,QAAQ,EAAE,GAAG,KAAK,YAAY,CAAC,GAAG,SAAS,CAAC;IAE/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,QAAQ,EAAE,GAAG,KAAK,YAAY,CAAC,GAAG,SAAS,CAAC;IAE5D;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,KACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,KACR,QAAQ,CAAC;CACd,GAAG,CACD;IACA;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAC;CACd,GACD;IACA,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;;OAGG;IACH,MAAM,EAAE,iBAAiB,CAAC;CACzB,CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -7,8 +7,8 @@ import { Vector3d } from "../math/vector3d.ts";
7
7
  import { Bounds } from "./../physics/bounds.ts";
8
8
  import type Container from "./../renderable/container.js";
9
9
  import Renderable from "./../renderable/renderable.js";
10
+ import ColorMatrixEffect from "./../video/effects/colorMatrix.js";
10
11
  import type Renderer from "./../video/renderer.js";
11
- import ColorMatrixEffect from "./../video/webgl/effects/colorMatrix.js";
12
12
  import type CameraEffect from "./effects/camera_effect.ts";
13
13
  /**
14
14
  * @import Entity from "./../renderable/entity/entity.js";