Source code for simvx.graphics.renderer.tile_types

"""Tilemap GPU instance layout: shared between Vulkan and WebGPU backends."""

import numpy as np

__all__ = ["TILE_INSTANCE_DTYPE"]

# Must match TileInstance in tilemap.vert (Vulkan) and tilemap.wgsl (WebGPU).
TILE_INSTANCE_DTYPE = np.dtype(
    [
        ("position", np.float32, 2),        # world position (x, y)
        ("tile_uv_offset", np.float32, 2),  # UV offset into tileset atlas
        ("tile_uv_size", np.float32, 2),    # UV size of one tile in atlas
        ("flip_h", np.uint32),              # horizontal flip flag
        ("flip_v", np.uint32),              # vertical flip flag
    ]
)