simvx.graphics.renderer.tilemap_pass¶
GPU-batched TileMap renderer: single draw call per layer via instanced SSBO quads.
Module Contents¶
Classes¶
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_passdefaults toengine.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).
- 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 totile_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.
submissionsdefaults to the liveself._submissionslist (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.