simvx.graphics.renderer.tilemap_pass

GPU-batched TileMap renderer: single draw call per layer via instanced SSBO quads.

Module Contents

Classes

TileMapPass

Renders tilemap layers as instanced quads via SSBO.

Data

API

simvx.graphics.renderer.tilemap_pass.__all__

[‘TILE_INSTANCE_DTYPE’, ‘TileMapPass’]

simvx.graphics.renderer.tilemap_pass.log

‘getLogger(…)’

simvx.graphics.renderer.tilemap_pass.MAX_TILES

65536

class simvx.graphics.renderer.tilemap_pass.TileMapPass(engine: Any)[source]

Renders tilemap layers as instanced quads via SSBO.

Each layer is submitted as a contiguous block of tile instances. All layers share a single SSBO upload; each layer draws with an offset.

Initialization

setup(render_pass: Any = None) None[source]

Create GPU resources: SSBO, pipeline, descriptors.

render_pass defaults to engine.render_pass; pass an HDR pass when the pipeline will be bound inside the post-process offscreen pass.

rebuild_pipeline(render_pass: Any) None[source]

Recreate the tilemap pipeline against a different render pass (e.g. HDR).

begin_frame() None[source]

Clear per-frame submissions.

submit_layer(tile_data: numpy.ndarray, tileset_texture_id: int, tile_size: tuple[float, float], colours: numpy.ndarray | None = None, *, layer_id: int | None = None, version: int | None = None) None[source]

Queue a tile layer for rendering.

Args: tile_data: Structured array with TILE_INSTANCE_DTYPE. tileset_texture_id: Bindless texture index for the tileset atlas. tile_size: (width, height) of each tile in world units. colours: Optional (N, 4) float32 RGBA tints parallel to tile_data; None (the common case) leaves the layer untinted (white) and uploads no colour bytes. layer_id, version: Retention hints from the scene adapter (the source layer’s identity + packed-buffer version). The desktop pass skips the SSBO re-upload by array identity (the adapter hands back the SAME cached array for an unchanged layer), so it ignores these; they exist so this signature matches the web backend’s, whose REUSE wire keys on them.

render(cmd: Any, view_matrix: numpy.ndarray, extent: tuple[int, int], submissions: list[tuple[numpy.ndarray, int, tuple[float, float], numpy.ndarray | None]] | None = None) None[source]

Record draw commands for all queued tile layers.

submissions defaults to the live self._submissions list (the synchronous path). In pipelined mode the render thread passes the packet’s OWNED tilemap snapshot so it never reads the live list the main thread is concurrently rebuilding.

cleanup() None[source]

Destroy all GPU resources.