Each chunk gets its own <canvas> element of size chunkSize × chunkSize, registered with Phaser's TextureManager via addCanvas,
and shown by a Phaser Image GameObject placed at the chunk's world
position. Repaints update the canvas's ImageData and call
texture.refresh() so the GPU re-uploads the changed pixels.
One canvas per chunk (rather than a single world-spanning canvas)
keeps each upload bounded to chunk size — chunks that are clean don't
pay any GPU cost. The cost is N extra Phaser Image game objects, one
per chunk; for the v1 default of 32 chunks per typical world this is
negligible.
Destroys every game object and texture this renderer owns.
Returns void
repaintAll
repaintAll(): void
Forcibly repaints every chunk regardless of dirty flag.
Returns void
repaintDirty
repaintDirty(): number
Re-paints every chunk whose visualDirty flag is set, then clears
the flag. Call from the scene's update() (or a postUpdate
hook); cheap when nothing is dirty.
Per-chunk canvas-backed terrain renderer.
Each chunk gets its own
<canvas>element of sizechunkSize × chunkSize, registered with Phaser's TextureManager viaaddCanvas, and shown by a PhaserImageGameObject placed at the chunk's world position. Repaints update the canvas'sImageDataand calltexture.refresh()so the GPU re-uploads the changed pixels.One canvas per chunk (rather than a single world-spanning canvas) keeps each upload bounded to chunk size — chunks that are clean don't pay any GPU cost. The cost is N extra Phaser Image game objects, one per chunk; for the v1 default of 32 chunks per typical world this is negligible.