Skip to content

v19.9.0

Latest

Choose a tag to compare

@github-actions github-actions released this 14 Jul 04:23
41b1c7b

What's New

Shader effects made easy. Effects that used to demand WebGL expertise, like a pond rippling with the scene reflected in it, heat haze, or frosted glass, now take a few lines of shader code: the engine hands your effect the screen behind it and the right coordinates, animated noise textures come built-in, and shaders preload like any other asset. See the new Water Overworld example for all of it in action, and the updated Shader Effects wiki guide.

New Features

  • Shader builtins: screen_texture / screen_uv / noise_uv — annotate a sampler with : screen_texture and the engine keeps it filled with the screen behind the object; screen_uv / noise_uv are free varyings for screen-space and frame-local (atlas-independent) coordinates. No JS plumbing, fully backward compatible (design and demo scene contributed by @Vareniel)
  • renderer.toFrameTexture() — GPU capture of everything drawn so far, as a live Texture2d for shader input (initial approach contributed by @Vareniel)
  • Shader preloading — the "shader" asset type compiles GLSL at load time; loader.getShader() returns the shared instance (clone() for per-renderable uniforms). A {vertex, fragment} pair compiles into a raw GLShader for Mesh / custom-batcher shaders
  • ShaderEffect.setTexture(name, image[, repeat]) — bind extra sampler2D textures (noise, masks, LUTs) to an effect (thanks @Vareniel)
  • ShaderEffect.setTime(seconds) and a shared flag on ShaderEffect / GLShader for effects reused across renderables
  • Procedural noise: Noise + NoiseTexture2d — deterministic CPU-samplable coherent noise (simplex / perlin / value / cellular, fractal layering, domain warp), bakeable as grayscale, a color ramp, or an animated normal map
  • Anchor-point presets + Sprite3d anchor supportanchorPoint: "bottom", "top-left", … uniformly across every renderable; Sprite3d gains the same key, vertex-baked and runtime-mutable (thanks @asadullahbro)
  • Holes & compound paths in Path2D / SVG fills — inner sub-paths render as holes (donuts, letter counters) under both renderers
  • BMFont XML support for BitmapText — the AngelCode XML flavour loads directly, auto-detected
  • Texture2d base class — renderables accept any texture asset directly as image

Bug Fixes

  • Asset loading over the file: protocol works again (Cordova/Capacitor APK) — fetchData falls back to XHR where fetch() refuses file:// (thanks @Vareniel)
  • Loader: unloadAll() no longer throws on fontfaces or leaks videos; load() no longer mutates the caller's asset descriptor; video preloading no longer hangs on autoplay-restricted browsers or forces anonymous CORS; compressed-texture loading no longer crashes on devices missing a compression family
  • Audio batch: preload/retry/unload lifecycle fixes and honest getter/setter types across seek, rate, position, stereo, resume, getCurrentTrack
  • Texture atlas batch: aseprite trim/rotation/pivot and per-frame durations are honored; coordinate-alias cache, video regions, padded spritesheets, and malformed-atlas validation all fixed
  • WebGL batcher batch: texture-unit collisions (lit normal maps, re-uploads, post-effect unit 0), oversized primitive shapes, GPU texture/buffer leaks, and multi-renderer state crosstalk all fixed
  • Rendering: nested multi-effect post-effects no longer crash; gradient fills respect inverted/nested masks; disableScissor() flushes; WebGL clearRect() erases; Canvas clipRect() honors transforms; large pos.z sort keys no longer clip-cull sprites (19.7 regression)
  • Geometry/math: Path2D arcs connect per spec; Rect edge/vertex fixes; moveTowards() lands exactly; Matrix2d 6-argument form fixed; CSS color keyword table spec-validated
  • NineSliceSprite keeps its expanded size when animated (thanks @NemoStein); Text generic CSS font families render correctly

Compatibility

No breaking changes — everything additive / back-compatible.

Install

npm install melonjs@19.9.0

Full details in the CHANGELOG.