melonjs 19.7.1 → 19.9.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 (146) hide show
  1. package/README.md +21 -6
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/defaultApplicationSettings.d.ts +1 -0
  4. package/build/application/defaultApplicationSettings.d.ts.map +1 -1
  5. package/build/application/settings.d.ts +34 -0
  6. package/build/application/settings.d.ts.map +1 -1
  7. package/build/audio/audio.d.ts +1 -1
  8. package/build/audio/audio.d.ts.map +1 -1
  9. package/build/audio/backend.d.ts +21 -2
  10. package/build/audio/backend.d.ts.map +1 -1
  11. package/build/audio/playback.d.ts +8 -28
  12. package/build/audio/playback.d.ts.map +1 -1
  13. package/build/camera/camera3d.d.ts +49 -0
  14. package/build/camera/camera3d.d.ts.map +1 -1
  15. package/build/geometries/path2d.d.ts +188 -75
  16. package/build/geometries/path2d.d.ts.map +1 -1
  17. package/build/geometries/rectangle.d.ts.map +1 -1
  18. package/build/index.d.ts +11 -2
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +19170 -13625
  21. package/build/index.js.map +4 -4
  22. package/build/level/gltf/GLTFModel.d.ts +173 -0
  23. package/build/level/gltf/GLTFModel.d.ts.map +1 -0
  24. package/build/level/gltf/GLTFScene.d.ts +84 -0
  25. package/build/level/gltf/GLTFScene.d.ts.map +1 -0
  26. package/build/level/gltf/gltf_sampler.d.ts +49 -0
  27. package/build/level/gltf/gltf_sampler.d.ts.map +1 -0
  28. package/build/level/level.d.ts +7 -3
  29. package/build/level/level.d.ts.map +1 -1
  30. package/build/level/tiled/TMXTileMap.d.ts +5 -0
  31. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  32. package/build/{renderable → lighting}/light2d.d.ts +79 -78
  33. package/build/lighting/light2d.d.ts.map +1 -0
  34. package/build/lighting/light3d.d.ts +86 -0
  35. package/build/lighting/light3d.d.ts.map +1 -0
  36. package/build/loader/cache.d.ts +2 -0
  37. package/build/loader/cache.d.ts.map +1 -1
  38. package/build/loader/loader.d.ts +156 -8
  39. package/build/loader/loader.d.ts.map +1 -1
  40. package/build/loader/parsers/fetchdata.d.ts +14 -0
  41. package/build/loader/parsers/fetchdata.d.ts.map +1 -1
  42. package/build/loader/parsers/gltf.d.ts +71 -0
  43. package/build/loader/parsers/gltf.d.ts.map +1 -0
  44. package/build/loader/parsers/mtl.d.ts.map +1 -1
  45. package/build/loader/parsers/shader.d.ts +47 -0
  46. package/build/loader/parsers/shader.d.ts.map +1 -0
  47. package/build/loader/parsers/video.d.ts.map +1 -1
  48. package/build/math/color.d.ts.map +1 -1
  49. package/build/math/math.d.ts +2 -2
  50. package/build/math/matrix2d.d.ts.map +1 -1
  51. package/build/math/noise.d.ts +141 -0
  52. package/build/math/noise.d.ts.map +1 -0
  53. package/build/math/observableVector2d.d.ts +1 -1
  54. package/build/math/observableVector2d.d.ts.map +1 -1
  55. package/build/math/observableVector3d.d.ts +1 -1
  56. package/build/math/observableVector3d.d.ts.map +1 -1
  57. package/build/math/vector2d.d.ts +1 -1
  58. package/build/math/vector2d.d.ts.map +1 -1
  59. package/build/math/vector3d.d.ts +1 -1
  60. package/build/math/vector3d.d.ts.map +1 -1
  61. package/build/math/vertex.d.ts +25 -0
  62. package/build/math/vertex.d.ts.map +1 -1
  63. package/build/physics/adapter.d.ts +4 -3
  64. package/build/physics/adapter.d.ts.map +1 -1
  65. package/build/physics/broadphase/aabb3d.d.ts +23 -2
  66. package/build/physics/broadphase/aabb3d.d.ts.map +1 -1
  67. package/build/renderable/anchorPoint.d.ts +80 -0
  68. package/build/renderable/anchorPoint.d.ts.map +1 -0
  69. package/build/renderable/animation.d.ts +41 -0
  70. package/build/renderable/animation.d.ts.map +1 -0
  71. package/build/renderable/collectable.d.ts +7 -1
  72. package/build/renderable/collectable.d.ts.map +1 -1
  73. package/build/renderable/container.d.ts +0 -1
  74. package/build/renderable/container.d.ts.map +1 -1
  75. package/build/renderable/entity/entity.d.ts +5 -2
  76. package/build/renderable/entity/entity.d.ts.map +1 -1
  77. package/build/renderable/frameAnimation.d.ts +154 -0
  78. package/build/renderable/frameAnimation.d.ts.map +1 -0
  79. package/build/renderable/imagelayer.d.ts +5 -2
  80. package/build/renderable/imagelayer.d.ts.map +1 -1
  81. package/build/renderable/mesh.d.ts +175 -6
  82. package/build/renderable/mesh.d.ts.map +1 -1
  83. package/build/renderable/nineslicesprite.d.ts +5 -7
  84. package/build/renderable/nineslicesprite.d.ts.map +1 -1
  85. package/build/renderable/renderable.d.ts +28 -1
  86. package/build/renderable/renderable.d.ts.map +1 -1
  87. package/build/renderable/sprite.d.ts +84 -34
  88. package/build/renderable/sprite.d.ts.map +1 -1
  89. package/build/renderable/sprite3d.d.ts +350 -0
  90. package/build/renderable/sprite3d.d.ts.map +1 -0
  91. package/build/renderable/text/bitmaptext.d.ts +24 -12
  92. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  93. package/build/renderable/text/bitmaptextdata.d.ts +24 -1
  94. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
  95. package/build/renderable/text/text.d.ts +50 -12
  96. package/build/renderable/text/text.d.ts.map +1 -1
  97. package/build/state/stage.d.ts +20 -1
  98. package/build/state/stage.d.ts.map +1 -1
  99. package/build/system/event.d.ts +18 -2
  100. package/build/system/event.d.ts.map +1 -1
  101. package/build/video/buffer/vertex.d.ts +7 -0
  102. package/build/video/buffer/vertex.d.ts.map +1 -1
  103. package/build/video/canvas/canvas_renderer.d.ts +4 -0
  104. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  105. package/build/video/renderer.d.ts +62 -1
  106. package/build/video/renderer.d.ts.map +1 -1
  107. package/build/video/rendertarget/render_target_pool.d.ts +17 -6
  108. package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
  109. package/build/video/texture/atlas.d.ts +3 -2
  110. package/build/video/texture/atlas.d.ts.map +1 -1
  111. package/build/video/texture/cache.d.ts +55 -6
  112. package/build/video/texture/cache.d.ts.map +1 -1
  113. package/build/video/texture/frametexture.d.ts +73 -0
  114. package/build/video/texture/frametexture.d.ts.map +1 -0
  115. package/build/video/texture/noise_texture2d.d.ts +176 -0
  116. package/build/video/texture/noise_texture2d.d.ts.map +1 -0
  117. package/build/video/texture/parser/aseprite.d.ts.map +1 -1
  118. package/build/video/texture/texture2d.d.ts +83 -0
  119. package/build/video/texture/texture2d.d.ts.map +1 -0
  120. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  121. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +18 -0
  122. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -0
  123. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +30 -4
  124. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  125. package/build/video/webgl/batchers/material_batcher.d.ts +39 -3
  126. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  127. package/build/video/webgl/batchers/mesh_batcher.d.ts +52 -11
  128. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  129. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
  130. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  131. package/build/video/webgl/buffer/index.d.ts +13 -0
  132. package/build/video/webgl/buffer/index.d.ts.map +1 -1
  133. package/build/video/webgl/effects/hologram.d.ts +0 -5
  134. package/build/video/webgl/effects/hologram.d.ts.map +1 -1
  135. package/build/video/webgl/effects/shine.d.ts +1 -6
  136. package/build/video/webgl/effects/shine.d.ts.map +1 -1
  137. package/build/video/webgl/glshader.d.ts +29 -0
  138. package/build/video/webgl/glshader.d.ts.map +1 -1
  139. package/build/video/webgl/lighting/pack3d.d.ts +32 -0
  140. package/build/video/webgl/lighting/pack3d.d.ts.map +1 -0
  141. package/build/video/webgl/shadereffect.d.ts +183 -0
  142. package/build/video/webgl/shadereffect.d.ts.map +1 -1
  143. package/build/video/webgl/webgl_renderer.d.ts +59 -1
  144. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  145. package/package.json +5 -5
  146. package/build/renderable/light2d.d.ts.map +0 -1
package/README.md CHANGED
@@ -32,7 +32,7 @@ melonJS is designed so you can **focus on making games, not on graphics plumbing
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
- - **Tiled as a first-class citizen** — Deep [Tiled](https://www.mapeditor.org) integration built into the core: orthogonal, isometric, hexagonal and staggered maps, animated tilesets, collision shapes, object properties, compressed formats — all parsed and rendered natively, with GPU-accelerated tile rendering for orthogonal maps under WebGL 2.
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`.
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
 
@@ -49,12 +49,15 @@ Graphics
49
49
  - Fast WebGL renderer for desktop and mobile devices with fallback to Canvas rendering
50
50
  - Extensible batcher system for custom rendering pipelines
51
51
  - High DPI resolution & Canvas advanced auto scaling
52
- - Sprite with 9-slice scaling option, frame animation, and optional per-pixel normal-map shading for 3D-looking dynamic lights
52
+ - Sprite with 9-slice scaling option and frame animation
53
53
  - Built-in effects such as tinting, masking, and CSS-style blend modes (normal, additive, multiply, screen, darken, lighten)
54
54
  - Standard spritesheet, single and multiple Packed Textures support
55
55
  - Compressed texture support (DDS, KTX, KTX2, PVR, PKM) with automatic format detection and fallback
56
- - 3D mesh rendering with OBJ/MTL model loading, multi-material support, hardware depth testing, and perspective projection via `Camera3d`
57
- - `Light2d` as a first-class `Renderable` — multiple dynamic lights, radial-gradient falloff, illumination-only mode, and procedural rendering via `drawLight`
56
+ - 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)
58
+ - Lighting, in 2D and 3D:
59
+ - **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
58
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)
59
62
  - Trail renderable for fading, tapering ribbons behind moving objects (speed lines, sword slashes, magic trails)
60
63
  - System & Bitmap Text with built-in typewriter effect
@@ -92,7 +95,8 @@ UI
92
95
  - `Draggable` / `DropTarget` for drag-and-drop with configurable overlap or contains-check
93
96
  - `UITextButton` text button with hover, press, and key-bind support — built on `BitmapText`
94
97
 
95
- Level Editor
98
+ Scenes
99
+ - Load a scene in one call with `level.load(name)` — 2D Tiled maps and 3D glTF scenes alike, auto-registered on preload
96
100
  - [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
97
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
98
102
  - Uncompressed and [compressed](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) Plain, Base64, CSV and JSON encoded XML tilemap loading
@@ -110,11 +114,18 @@ Level Editor
110
114
  - Dynamic Layer and Object/Group ordering
111
115
  - Dynamic Entity loading via an extensible object factory registry — register custom handlers for any Tiled class name without modifying engine code
112
116
  - Shape based Tile collision support
117
+ - glTF / GLB 3D scenes — load an authored 3D scene with `level.load(...)`, the same one call as a Tiled map
118
+ - 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)
120
+ - Textured, solid-colored, and vertex-colored materials
121
+ - Node animation — walk/idle/sprint characters, spinning pickups, doors, lifts — played through the same `setCurrentAnimation` / `play` / `pause` / `stop` API as a 2D `Sprite`
122
+ - `.glb` and `.gltf` files, with embedded *or* external buffers & textures
123
+ - Works with any glTF authoring tool (Blender, Maya, 3ds Max, Cinema 4D, …)
113
124
 
114
125
  Assets
115
126
  - Asynchronous asset loading with progress tracking
116
127
  - A fully customizable preloader
117
- - Support for images, JSON, TMX/TSX, `.aseprite` / `.ase` binary, audio, video, binary and fonts
128
+ - Support for images, JSON, TMX/TSX, glTF / GLB 3D scenes, `.aseprite` / `.ase` binary, audio, video, binary and fonts
118
129
 
119
130
  Core
120
131
  - `Application` class as the modern entry point with built-in pause, resume, and `freeze()` (hit-stop) primitives
@@ -170,9 +181,13 @@ Examples
170
181
  * [Hello World](https://melonjs.github.io/melonJS/examples/#/hello-world) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/helloWorld))
171
182
  * [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))
172
183
  * [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)
185
+ * [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
173
186
  * [3D Mesh](https://melonjs.github.io/melonJS/examples/#/mesh-3d) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/mesh3d))
174
187
  * [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))
175
188
  * [AfterBurner Clone](https://melonjs.github.io/melonJS/examples/#/after-burner) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/afterBurner)) — `Camera3d` + 3D Mesh arcade shooter
189
+ * [glTF Scene](https://melonjs.github.io/melonJS/examples/#/gltf) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/gltf)) — a Blender-authored, lit 3D scene loaded with `level.load`
190
+ * [glTF Animated Model](https://melonjs.github.io/melonJS/examples/#/gltf-character) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/gltf)) — a rigged character (Kenney Blocky Characters) with node animation, driven by the Sprite-aligned `setCurrentAnimation` / `play` / `pause` / `stop` API
176
191
  * [Trail](https://melonjs.github.io/melonJS/examples/#/trail) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/trail))
177
192
  * [Shader Effects](https://melonjs.github.io/melonJS/examples/#/shader-effects) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/shaderEffects))
178
193
  * [Spine](https://melonjs.github.io/melonJS/examples/#/spine) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/spine))
@@ -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;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAG,KAAK,CAAC;IAEd;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAG,2BAA2B,CAAC;IAEvC;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAGpB,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,EAAE,OAAO,CAAC;IAGv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AAgB,cAAc,CAAC,GAAG,EAAE,WAAW,QAE9C"}
@@ -6,6 +6,7 @@ export declare const defaultApplicationSettings: {
6
6
  powerPreference: "default";
7
7
  transparent: false;
8
8
  antiAlias: false;
9
+ textureFilter: "auto";
9
10
  consoleHeader: true;
10
11
  blendMode: "normal";
11
12
  physic: "builtin";
@@ -1 +1 @@
1
- {"version":3,"file":"defaultApplicationSettings.d.ts","sourceRoot":"","sources":["../../src/application/defaultApplicationSettings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;CAkBC,CAAC"}
1
+ {"version":3,"file":"defaultApplicationSettings.d.ts","sourceRoot":"","sources":["../../src/application/defaultApplicationSettings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;CAmBC,CAAC"}
@@ -77,6 +77,40 @@ export type ApplicationSettings = {
77
77
  * @default false
78
78
  */
79
79
  antiAlias: boolean;
80
+ /**
81
+ * Default texture magnification/minification filter, **decoupled from
82
+ * `antiAlias`** (WebGL only — the 2D Canvas renderer has no per-texture
83
+ * filtering and ignores this).
84
+ *
85
+ * `antiAlias` conflates two separate concerns: polygon-edge antialiasing
86
+ * (MSAA) *and* texture sampling smoothness. This setting separates the
87
+ * texture half out, so you can choose them independently — e.g. smooth
88
+ * textures with no MSAA, or crisp pixel-art textures *with* MSAA edges.
89
+ *
90
+ * - `"auto"` (default) — follow `antiAlias` (`linear` when `true`, `nearest`
91
+ * when `false`): unchanged behavior.
92
+ * - `"nearest"` — crisp/pixelated upscaling, regardless of `antiAlias`.
93
+ * - `"linear"` — smooth, regardless of `antiAlias`.
94
+ *
95
+ * This is the **default** for every texture; a {@link Mesh} can still override
96
+ * it per-mesh via its own `textureFilter` setting (which wins).
97
+ * @default "auto"
98
+ * @example
99
+ * // smooth textures but NO polygon-edge MSAA
100
+ * const app = new Application(1024, 768, {
101
+ * renderer: video.WEBGL,
102
+ * antiAlias: false, // MSAA off
103
+ * textureFilter: "linear", // textures still filtered smooth
104
+ * });
105
+ *
106
+ * // crisp pixel-art textures WITH MSAA-smoothed edges
107
+ * new Application(1024, 768, {
108
+ * renderer: video.WEBGL,
109
+ * antiAlias: true, // MSAA on
110
+ * textureFilter: "nearest", // textures stay crisp
111
+ * });
112
+ */
113
+ textureFilter: "auto" | "nearest" | "linear";
80
114
  /**
81
115
  * whether to display melonJS version and basic device information in the console
82
116
  * @default true
@@ -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,CAAA;CAAE,CAAC;AAE/B,KAAK,eAAe,GAAG,SAAS,GAAG,WAAW,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG;IACjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,EAAE,YAAY,GAAG,QAAQ,CAAC;IAElC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC;IAEzB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IAC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;;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"}
@@ -14,7 +14,7 @@
14
14
  * This file owns the remaining lifecycle / track / mix / unload
15
15
  * helpers, plus the barrel re-exports that compose the namespace.
16
16
  */
17
- export { getAudioContext, getMasterGain, stopOnAudioError, } from "./backend.ts";
17
+ export { getAudioContext, getMasterGain, setStopOnAudioError, stopOnAudioError, } from "./backend.ts";
18
18
  export { fade, load, orientation, panner, pause, play, position, rate, resume, seek, stereo, stop, } from "./playback.ts";
19
19
  export { noise, tone } from "./procedural.ts";
20
20
  export type { LoadSettings, NoiseFilter, NoiseOptions, PannerAttributes, SoundAsset, ToneOptions, } from "./types.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/audio/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAeH,OAAO,EACN,eAAe,EACf,aAAa,EACb,gBAAgB,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,MAAM,EACN,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,EACN,IAAI,GACJ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE9C,YAAY,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,WAAW,GACX,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,MAAM,GAAE,MAAc,GAAG,O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,IAAI,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CACnB,UAAU,EAAE,MAAM,EAClB,EAAE,CAAC,EAAE,MAAM,EACX,UAAU,GAAE,OAAc,GACxB,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAE9B;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAgBlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAMhC"}
@@ -15,9 +15,26 @@ import { Howl } from "howler";
15
15
  *
16
16
  * When `true`, melonJS throws an exception and aborts loading.
17
17
  * When `false`, melonJS disables sound and logs a warning to the console.
18
+ *
19
+ * Read-only through the `me.audio` namespace (module namespace properties
20
+ * can't be assigned) — change it with {@link setStopOnAudioError}.
18
21
  * @default true
22
+ * @see setStopOnAudioError
19
23
  */
20
24
  export declare let stopOnAudioError: boolean;
25
+ /**
26
+ * Set the {@link stopOnAudioError} flag — whether an audio clip that still
27
+ * fails after its retries throws (aborting loading) or just disables sound
28
+ * with a console warning. This setter is the supported way to change the
29
+ * flag: assigning `me.audio.stopOnAudioError = false` directly throws a
30
+ * TypeError, because module namespace properties are read-only.
31
+ * @param value - `true` to throw on a failed load, `false` to disable sound instead
32
+ * @example
33
+ * // don't abort the whole game when audio fails to load
34
+ * me.audio.setStopOnAudioError(false);
35
+ * @category Audio
36
+ */
37
+ export declare function setStopOnAudioError(value: boolean): void;
21
38
  /**
22
39
  * Cross-module mutable state. A single object so multiple consumers
23
40
  * can read and mutate the same fields without the "ESM `let` exports
@@ -29,14 +46,16 @@ export declare let stopOnAudioError: boolean;
29
46
  * even though the type signature wouldn't normally admit it.
30
47
  * - `currentTrackId` — the name of the currently-playing track managed
31
48
  * by the `playTrack` / `stopTrack` helpers.
32
- * - `retryCounter` — retry counter for `soundLoadError`'s back-off.
49
+ * - `retryCounters` — per-sound retry counters for `soundLoadError`'s
50
+ * back-off, keyed by sound name (a single shared counter let parallel
51
+ * loads steal each other's retry budget).
33
52
  * - `audioExts` — the active list of audio formats set by `init`.
34
53
  * @ignore
35
54
  */
36
55
  export declare const state: {
37
56
  tracks: Record<string, Howl | undefined>;
38
57
  currentTrackId: string | null;
39
- retryCounter: number;
58
+ retryCounters: Record<string, number>;
40
59
  audioExts: string[];
41
60
  };
42
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/audio/backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAU,MAAM,QAAQ,CAAC;AAEtC;;;;;;GAMG;AAEH,eAAO,IAAI,gBAAgB,EAAE,OAAc,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;YACH,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC;oBACtB,MAAM,GAAG,IAAI;;eAEpB,MAAM,EAAE;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAC1B,YAAY,MAAM,EAClB,aAAa,MAAM,IAAI,EACvB,cAAa,OAAc,KACzB,IAeF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,YAAY,GA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CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAmBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,IAAI,QAAQ,GAAG,IAAI,CAS/C;AAUD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAKvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO/C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
@@ -56,34 +56,14 @@ export declare function play(sound_name: string, loop?: boolean, onend?: (() =>
56
56
  * @category Audio
57
57
  */
58
58
  export declare function fade(sound_name: string, from: number, to: number, duration: number, id?: number): void;
59
- /**
60
- * Get or set the playback position of a sound.
61
- * @param sound_name - Audio clip name (case-sensitive).
62
- * @param args - Optional seek position in seconds, optionally followed
63
- * by the sound instance ID.
64
- * @returns The current seek position when no extra arguments are given.
65
- * @example
66
- * // read the current position of the background music
67
- * let current_pos = me.audio.seek("dst-gameforest");
68
- * // rewind the background music to the beginning
69
- * me.audio.seek("dst-gameforest", 0);
70
- * @category Audio
71
- */
72
- export declare function seek(sound_name: string, ...args: number[]): number;
73
- /**
74
- * Get or set the playback rate of a sound.
75
- * @param sound_name - Audio clip name (case-sensitive).
76
- * @param args - Optional playback rate (`0.5..4.0`, where `1.0` is
77
- * normal speed), optionally followed by the sound instance ID.
78
- * @returns The current playback rate when no extra arguments are given.
79
- * @example
80
- * // read the current playback rate
81
- * let rate = me.audio.rate("dst-gameforest");
82
- * // speed it up 2×
83
- * me.audio.rate("dst-gameforest", 2.0);
84
- * @category Audio
85
- */
86
- export declare function rate(sound_name: string, ...args: number[]): number;
59
+ /** @inheritDoc */
60
+ export declare function seek(sound_name: string): number;
61
+ /** @inheritDoc */
62
+ export declare function seek(sound_name: string, seek: number, id?: number): void;
63
+ /** @inheritDoc */
64
+ export declare function rate(sound_name: string): number;
65
+ /** @inheritDoc */
66
+ export declare function rate(sound_name: string, rate: number, id?: number): void;
87
67
  /** @inheritDoc */
88
68
  export declare function stereo(sound_name: string): number;
89
69
  /** @inheritDoc */
@@ -1 +1 @@
1
- {"version":3,"file":"playback.d.ts","sourceRoot":"","sources":["../../src/audio/playback.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CACnB,KAAK,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,EACrB,SAAS,CAAC,EAAE,MAAM,IAAI,EACtB,QAAQ,GAAE,YAAiB,GACzB,MAAM,CAqCR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,OAAe,EACrB,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,EAC3B,MAAM,CAAC,EAAE,MAAM,GACb,MAAM,CAgBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,MAAM,GACT,IAAI,CAEN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM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EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAS3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE3D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CA4B5D"}
@@ -1,4 +1,5 @@
1
1
  import type { ObservableVector3d } from "../math/observableVector3d.ts";
2
+ import { Vector2d } from "../math/vector2d.ts";
2
3
  import { Vector3d } from "../math/vector3d.ts";
3
4
  import type Container from "./../renderable/container.js";
4
5
  import type Renderable from "./../renderable/renderable.js";
@@ -155,6 +156,37 @@ export default class Camera3d extends Camera2d {
155
156
  * @returns this camera (chainable)
156
157
  */
157
158
  setClipPlanes(near: number, far: number): this;
159
+ /**
160
+ * Write the camera's world-space orientation basis into the given vectors:
161
+ * `right` (camera local +X), `up` (+Y), and `forward` (+Z — the direction the
162
+ * camera looks). Derived from `yaw` / `pitch` (the inverse of the view
163
+ * rotation), so they update as the camera turns. Handy for orienting
164
+ * camera-facing geometry — e.g. {@link Sprite3d} billboards.
165
+ * @param right - receives the right axis (unit)
166
+ * @param up - receives the up axis (unit)
167
+ * @param forward - receives the forward / look axis (unit)
168
+ * @returns this camera, for chaining
169
+ */
170
+ getBasis(right: Vector3d, up: Vector3d, forward: Vector3d): this;
171
+ /**
172
+ * The camera's world-space right axis (unit). See {@link Camera3d#getBasis}.
173
+ * @param out - vector to write into (returned)
174
+ * @returns `out`
175
+ */
176
+ getRight(out: Vector3d): Vector3d;
177
+ /**
178
+ * The camera's world-space up axis (unit). See {@link Camera3d#getBasis}.
179
+ * @param out - vector to write into (returned)
180
+ * @returns `out`
181
+ */
182
+ getUp(out: Vector3d): Vector3d;
183
+ /**
184
+ * The camera's world-space forward / look axis (unit). See
185
+ * {@link Camera3d#getBasis}.
186
+ * @param out - vector to write into (returned)
187
+ * @returns `out`
188
+ */
189
+ getForward(out: Vector3d): Vector3d;
158
190
  /**
159
191
  * Rebuild the projection matrix from the frustum. Called by the
160
192
  * base `Camera2d` constructor and by `resize()`. Camera3d's
@@ -323,6 +355,23 @@ export default class Camera3d extends Camera2d {
323
355
  * @ignore
324
356
  */
325
357
  update(dt?: number): boolean;
358
+ /**
359
+ * Project a world-space point to 2D screen (canvas pixel) coordinates
360
+ * through this camera's view + perspective projection (perspective divide
361
+ * included). The origin is top-left with **y down**, matching where
362
+ * geometry at `world` rasterizes and the engine's 2D draw space — so the
363
+ * result can be fed straight to the 2D draw API (HUD pinned to a 3D object,
364
+ * picking, debug overlays such as the 3D bounding-box wireframe).
365
+ *
366
+ * **Returns `null` when the point is at or behind the camera** (clip
367
+ * `w ≤ 0`) — projecting it would yield a mirrored/degenerate pixel, so
368
+ * callers (e.g. a debug wireframe) can skip it cleanly instead of drawing
369
+ * garbage. Otherwise returns the screen-space pixel coordinates.
370
+ * @param world - the world-space point to project
371
+ * @param [out] - optional Vector2d to receive the result (allocated if omitted)
372
+ * @returns the screen-space pixel coordinates, or `null` if behind the camera
373
+ */
374
+ worldToScreen(world: Vector3d, out?: Vector2d): Vector2d | null;
326
375
  /**
327
376
  * Recompute the frustum's six bounding planes from the current
328
377
  * `projectionMatrix × viewMatrix` (the world → clip matrix).
@@ -1 +1 @@
1
- {"version":3,"file":"camera3d.d.ts","sourceRoot":"","sources":["../../src/camera/camera3d.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,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