Skip to content

Commit

Permalink
fix(tilemap): 🐛 Fix tileset rendering with no autotiles
Browse files Browse the repository at this point in the history
  • Loading branch information
melody-rs committed Sep 12, 2023
1 parent 8d2fc69 commit 46e451d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/graphics/primitives/tiles/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ impl Atlas {
autotiles[i]
.as_deref()
.map(image_cache::WgpuTexture::width)
.unwrap_or(0)
// Why unwrap with a width of 96? Even though the autotile doesn't exist, it still has an effective width on the atlas of one frame.
// Further rendering code breaks down with an autotile width of 0, anyway.
.unwrap_or(96)
/ 96
});

let autotile_width = autotile_frames
.iter()
.map(|f| f * AUTOTILE_FRAME_WIDTH)
.max()
.unwrap_or(0);
.unwrap_or(AUTOTILE_FRAME_WIDTH);

let render_state = &state!().render_state;
let mut encoder =
Expand Down

0 comments on commit 46e451d

Please sign in to comment.