bevy/release-content/release-notes/tilemap-chunk-rendering.md
Conner Petzold ebf6bf6ea9
TilemapChunk single quad; TileData (color/visibility) (#19924)
# Objective

- Use a single quad to render a TilemapChunk
- Add support for tile color and visibility

## Testing

- Tested using example -- there doesn't appear to be any visual tile
bleeding or rounding issues. Open to ideas on further testing
2025-07-17 19:37:40 +00:00

963 B

title authors pull_requests
Tilemap Chunk Rendering
@ConnerPetzold
@grind086
@IceSentry
18866

A performant way to render tilemap chunks has been added as the first building block to Bevy's tilemap support. You can render a chunk by supplying a tileset texture to the TilemapChunk component and tile data to TilemapChunkTileData. For each tile, TileData allows you to specify the index into the tileset, the visibility, and the color tint.

let chunk_size = UVec2::splat(64);
let tile_display_size = UVec2::splat(16);
let tile_data: Vec<Option<TileData>> = (0..chunk_size.element_product())
    .map(|_| rng.gen_range(0..5))
    .map(|i| {
        if i == 0 {
            None
        } else {
            Some(TileData::from_index(i - 1))
        }
    })
    .collect();

commands.spawn((
    TilemapChunk {
        chunk_size,
        tile_display_size,
        tileset,
    },
    TilemapChunkTileData(tile_data),
));