Skip to content

LittleJS 1.29.0 - Normal Maps and Decals

Latest

Choose a tag to compare

@KilledByAPixel KilledByAPixel released this 02 Nov 02:35
· 3 commits to main since this release

New Demos

  • Normal Maps - Balls and bevelled tiles that catch a light following the mouse, with a sun on Space and the wheel raising the light
  • Decals - Paint trails and splats drawn into a canvas layer on the GPU, click to splat

New Changes

  • 2D normal maps: give an object a normalMap and turn on lightSystem.normalMaps, and every light shades it from its height above the scene, the sun too; turned, mirrored and animated sprites shade as they should
  • Draw into a CanvasLayer in world space with drawRect and drawTile, for decals, paint or fog of war with no tile grid, and scroll(offset) moves the layer through the world while what is drawn stays put
  • Tile layers draw themselves: a new layer draws on its first render with no redraw() needed, and a cell changed with setData shows on the next render
  • textureInfo.updateData uploads only part of a texture, for a texture the game changes every frame
  • cameraShake(amount, direction) can shake along one axis, vec2(0, 1) for a heavy landing
  • FirstPersonCamera3D works on a gamepad and the touch gamepad: left stick moves, right stick looks
  • randPick(items) and randWeighted(items, weights) pick from an array or a Set, with seeded versions on RandomGenerator
  • setMouseScreenTransform makes clicks land on a curved screen, with postProcessCurveMouse for postProcessCurve
  • touchGamepadButtonPos(button) says where a touch gamepad button is, to draw an icon in it
  • soundPauseWhenBlurred pauses sound while the window has no focus
  • A 3D Shader can set its own depth with viewProjection
  • Much more precise TypeScript types: particle effects, the 3D level format and Tiled maps are typed, from 203 any down to 86

Breaking Changes

  • setData and clearData with no redraw argument now draw the cell on the next render; a game that paints its own cells over the tiles passes false
  • A turned or mirrored TileLayer's drawRect and drawTile now land where they show in the world

Fixes

  • tileInfo.frame, and so SpriteAnimation, carries on to the next row of the sheet instead of asserting
  • The touch gamepad keeps working when the browser refuses its pointer capture, and a camera with lockPointer no longer locks on a phone
  • engineStep under a timeScale other than 1 runs the right number of updates from its first frame

Check out the latest on GitHub to see everything we've been working on!

lightNormalMaps decals