Skip to content

v19.0.0

Choose a tag to compare

@obiot obiot released this 14 Apr 10:00
· 165 commits to master since this release
a36a29f

What's New in melonJS 19.0.0

New Features

  • 3D mesh renderingMesh class for textured 3D triangle meshes with OBJ/MTL model loading, drawMesh() on both WebGL and Canvas renderers, Matrix3d.perspective() for perspective projection, mesh-to-canvas/ImageBitmap export and convex hull collision shapes
  • 15 built-in ShaderEffect presetsFlashEffect, OutlineEffect, GlowEffect, DesaturateEffect, PixelateEffect, BlurEffect, ChromaticAberrationEffect, DissolveEffect, DropShadowEffect, ScanlineEffect (with CRT curvature/vignette), TintPulseEffect, WaveEffect, InvertEffect, SepiaEffect, HologramEffect. All extend ShaderEffect with configurable uniforms.
  • Trail renderable — fading, tapering ribbons behind moving objects with auto-follow or manual point mode, color gradient, width curve, opacity, and blend mode support. Works on both WebGL and Canvas.
  • Gradient color samplingGradient.getColorAt(position, out) interpolates colors at any position along a gradient with float-space interpolation and lazy-parsed Color cache
  • Math utilitieslerpArray(values, position) for interpolating across evenly-spaced value arrays; computeVertexNormal(points, index, out) for perpendicular normals at polyline vertices
  • Vertex utilitiesnormalizeVertices(), projectVertices(), convexHull() for 3D vertex operations

Changed

  • BREAKING: Renderable.currentTransform is now a Matrix3d (was Matrix2d) — code accessing currentTransform.val indices must update: translation at [12],[13] (was [6],[7])
  • BREAKING: Matrix3d.scale(x, y, z) default z changed from 0 to 1 — prevents accidental Z-axis flattening
  • BREAKING: Text.draw() and BitmapText.draw() no longer accept text, x, y parameters — standalone draw removed (deprecated since 10.6.0)
  • BREAKING: Tween uses event-based lifecycle instead of adding to game.world. Public API unchanged.
  • BREAKING: depthTest application setting removed — GPU depth sorting is incompatible with 2D alpha blending. Depth testing remains available for 3D mesh rendering only.
  • BREAKING: UITextButton settings backgroundColor/hoverColor removed — use hoverOffColor/hoverOnColor
  • Container sortOn getter/setter with cached comparator function
  • customShader property moved to base Renderer class
  • exactOptionalPropertyTypes re-enabled for stricter TypeScript checking

Performance

  • Color hex conversion — pre-computed 256-entry lookup table replaces per-call nibble extraction + string concat
  • Color.toHex/toHex8 — read glArray directly, bypassing getter overhead
  • Gradient.getColorAt — float-space interpolation via toArray()/setFloat(), avoids int↔float round trips
  • Trail rendering — zero-allocation draw loop with pre-allocated normals, hoisted divisions, single-splice point expiry

Bug Fixes

  • Rect.setSize() now calls updateBounds() — fixes pointer event regression from July 2024 TS conversion
  • WebGL depth buffer correctly used for 3D mesh rendering
  • Canvas backface culling corrected for Y-flipped screen space
  • Canvas triangle seam expansion (0.5px) for anti-aliasing gaps

Dependencies

  • vite 8.0.3 → 8.0.8
  • esbuild 0.27.4 → 0.28.0
  • typescript-eslint 8.58.1 → 8.58.2
  • react 19.2.4 → 19.2.5, react-dom 19.2.4 → 19.2.5
  • typedoc 0.28.18 → 0.28.19
  • vite-plugin-glsl 1.5.6 → 1.6.0