Namespace in reactor_core_display.js

Tilemap.Layer

32 functions in 6 groups · hide internal

The Database: everything Core loads at boot.

Quick Reference

Setup & Creation 4

initialize() Sets up a new instance.
_ensureV8Quads() Ensure v8 quads.
_setupV8Backend() Setup v8 backend.
_createVao() Creates the vao.

Getting Information 1

size() Size.

Checks (True / False) 1

isReady() Whether it is ready.

Actions 8

_releaseV8Atlas() Releases the v8 atlas.
_destroyV8TexCache() v8 tile textures register on their (session-cached) source's resize listener list, so dropping the cache with…
_destroyV8Mesh() Destroy v8 mesh.
destroy() Destroy.
setBitmaps() Sets the bitmaps.
clear() Clear.
addRect() Adds the rect.
_addV8Tile() Adds the v8 tile.

Updating & Drawing 5

_paintV8Atlas() Paint v8 atlas.
_syncV8Backend() Sync v8 backend.
render() Render.
_updateIndexBuffer() Updates the index buffer each frame.
_updateVertexBuffer() Updates the vertex buffer each frame.

Other 13

_v8Stats() V8 stats.
_requestedV8Backend() Requested v8 backend.
_v8AtlasImages() V8 atlas images.
_packV8Atlas() Where each sheet goes.
_v8AtlasLayout() V8 atlas layout.
_acquireV8Atlas() Acquire v8 atlas.
_keepV8AtlasPixels() Once a frame per atlas user: lets the CPU copy go after the GPU holds the pixels, and draws it again when the…
_watchV8AtlasContext() A restored context uploads every texture again from its resource: each dropped atlas is drawn again first.
_unbindV8AtlasSource() The mesh pipe's shared shader keeps the last-drawn texture source in its resources (uTexture/uSampler) after…
_newV8Quads() Quad storage a tile mesh keeps between paints: arrays only grow, so a repaint allocates nothing.
_writeV8Quad() Quad n of a tile mesh: the corners and atlas UVs of one tile rect.
_publishV8Quads() Hands the written quads to the mesh: new arrays when they grew, otherwise an upload of the quads in use (and…
_switchV8ToSprites() Switch v8 to sprites.

Setup & Creation

initialize

method source
Tilemap.Layer.prototype.initialize()

Sets up a new instance.

_ensureV8Quads

static internal source
Tilemap.Layer._ensureV8Quads(quads, count)

Ensure v8 quads.

_setupV8Backend

method internal source
Tilemap.Layer.prototype._setupV8Backend(bitmaps)

Setup v8 backend.

_createVao

method internal source
Tilemap.Layer.prototype._createVao()

Creates the vao.

Getting Information

size

method source
Tilemap.Layer.prototype.size()

Size.

Checks (True / False)

isReady

method source
Tilemap.Layer.prototype.isReady()

Whether it is ready.

Actions

_releaseV8Atlas

static internal source
Tilemap.Layer._releaseV8Atlas(entry)

Releases the v8 atlas.

_destroyV8TexCache

method internal source
Tilemap.Layer.prototype._destroyV8TexCache()

v8 tile textures register on their (session-cached) source's resize listener list, so dropping the cache without destroying them retains every texture for the whole session — one leaked batch per map transfer.

_destroyV8Mesh

method internal source
Tilemap.Layer.prototype._destroyV8Mesh()

Destroy v8 mesh.

destroy

method source
Tilemap.Layer.prototype.destroy(options)

Destroy.

setBitmaps

method source
Tilemap.Layer.prototype.setBitmaps(bitmaps)

Sets the bitmaps.

clear

method source
Tilemap.Layer.prototype.clear()

Clear.

addRect

method source
Tilemap.Layer.prototype.addRect(setNumber, sx, sy, dx, dy, w, h)

Adds the rect.

_addV8Tile

method internal source
Tilemap.Layer.prototype._addV8Tile(setNumber, sx, sy, dx, dy, w, h)

Adds the v8 tile.

Updating & Drawing

_paintV8Atlas

static internal source
Tilemap.Layer._paintV8Atlas(entry)

Paint v8 atlas.

_syncV8Backend

method internal source
Tilemap.Layer.prototype._syncV8Backend()

Sync v8 backend.

render

method source
Tilemap.Layer.prototype.render(renderer)

Render.

_updateIndexBuffer

method internal source
Tilemap.Layer.prototype._updateIndexBuffer()

Updates the index buffer each frame.

_updateVertexBuffer

method internal source
Tilemap.Layer.prototype._updateVertexBuffer()

Updates the vertex buffer each frame.

Other

_v8Stats

static internal source
Tilemap.Layer._v8Stats()

V8 stats.

_requestedV8Backend

static internal source
Tilemap.Layer._requestedV8Backend()

Requested v8 backend.

_v8AtlasImages

static internal source
Tilemap.Layer._v8AtlasImages(bitmaps)

V8 atlas images.

_packV8Atlas

static internal source
Tilemap.Layer._packV8Atlas(images, maxSize)

Where each sheet goes.

Details

Where each sheet goes. Sheets fill columns as wide as the widest sheet, each placed in the shortest column, tallest sheets first; the column count that gives the smallest atlas within the GPU's texture limit wins. A 2x2 texel block under the shortest column holds the shadow colour. Areas a sheet does not cover are never sampled: a tile rect past its sheet's edge is clipped to it (_writeV8Quad), as the transparent margin of a fixed slot drew it.

_v8AtlasLayout

static internal source
Tilemap.Layer._v8AtlasLayout(images, maxSize)

V8 atlas layout.

_acquireV8Atlas

static internal source
Tilemap.Layer._acquireV8Atlas(bitmaps)

Acquire v8 atlas.

_keepV8AtlasPixels

static internal source
Tilemap.Layer._keepV8AtlasPixels(entry)

Once a frame per atlas user: lets the CPU copy go after the GPU holds the pixels, and draws it again when the GPU copy is gone (a lost context, or PIXI's texture GC), before the next draw uploads from it.

_watchV8AtlasContext

static internal source
Tilemap.Layer._watchV8AtlasContext()

A restored context uploads every texture again from its resource: each dropped atlas is drawn again first.

_unbindV8AtlasSource

static internal source
Tilemap.Layer._unbindV8AtlasSource(source)

The mesh pipe's shared shader keeps the last-drawn texture source in its resources (uTexture/uSampler) after the final draw, so destroying the atlas source while it is still bound makes every map transfer warn "[BindGroup] a 'textureSource' was destroyed while still bound to a shader".

Details

The mesh pipe's shared shader keeps the last-drawn texture source in its resources (uTexture/uSampler) after the final draw, so destroying the atlas source while it is still bound makes every map transfer warn "[BindGroup] a 'textureSource' was destroyed while still bound to a shader". Point those slots at the empty texture first. Every access is guarded: on a renderer without this shape nothing happens and the warning stays cosmetic (PIXI nulls the dead slot itself).

_newV8Quads

static internal source
Tilemap.Layer._newV8Quads()

Quad storage a tile mesh keeps between paints: arrays only grow, so a repaint allocates nothing.

Details

Quad storage a tile mesh keeps between paints: arrays only grow, so a repaint allocates nothing. Quads past the ones in use sit at one point (no area, nothing drawn) until written.

_writeV8Quad

static internal source
Tilemap.Layer._writeV8Quad(atlas, positions, uvs, n, setNumber, sx, sy, dx, dy, w, h)

Quad n of a tile mesh: the corners and atlas UVs of one tile rect.

Details

Quad n of a tile mesh: the corners and atlas UVs of one tile rect. The part of a rect past its sheet's edge is clipped off, so it draws as the transparent margin around a sheet did; a rect wholly past it is not drawn.

_publishV8Quads

static internal source
Tilemap.Layer._publishV8Quads(geometry, quads, count, grew)

Hands the written quads to the mesh: new arrays when they grew, otherwise an upload of the quads in use (and of any that just fell out of use).

_switchV8ToSprites

method internal source
Tilemap.Layer.prototype._switchV8ToSprites(reason)

Switch v8 to sprites.