Skip to content

Commit 2b26297

Browse files
committed
Update release notes
1 parent 8d45a64 commit 2b26297

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

release-content/release-notes/tilemap-chunk-rendering.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,28 @@ authors: ["@ConnerPetzold", "@grind086", "@IceSentry"]
44
pull_requests: [18866]
55
---
66

7-
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 the indices into that tileset for each tile to `TilemapChunkIndices`.
7+
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.
88

99
```rust
1010
let chunk_size = UVec2::splat(64);
11-
let tile_size = UVec2::splat(16);
12-
let indices: Vec<Option<u32>> = (0..chunk_size.x * chunk_size.y)
11+
let tile_display_size = UVec2::splat(16);
12+
let tile_data: Vec<Option<TileData>> = (0..chunk_size.element_product())
1313
.map(|_| rng.gen_range(0..5))
14-
.map(|i| if i == 0 { None } else { Some(i - 1) })
14+
.map(|i| {
15+
if i == 0 {
16+
None
17+
} else {
18+
Some(TileData::from_index(i - 1))
19+
}
20+
})
1521
.collect();
1622

1723
commands.spawn((
1824
TilemapChunk {
1925
chunk_size,
20-
tile_size,
26+
tile_display_size,
2127
tileset,
2228
},
23-
TilemapChunkIndices(indices),
29+
TilemapChunkTileData(tile_data),
2430
));
2531
```

0 commit comments

Comments
 (0)