From 0446b46673f9b93322f54f2f1034e804a240f33e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 13 Nov 2022 08:15:08 +0100 Subject: chunk: assert that tile variant is valid at draw time --- src/chunk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/chunk.cpp b/src/chunk.cpp index 71378439..6a325125 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -63,7 +63,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple { const local_coords pos{i}; const auto quad = atlas->floor_quad(Vector3(pos.x, pos.y, 0) * TILE_SIZE, TILE_SIZE2); - const auto texcoords = atlas->texcoords_for_id(_ground_variants[i] % atlas->num_tiles()); + const auto texcoords = atlas->texcoords_for_id(_ground_variants[i]); const float depth = tile_shader::depth_value(pos); auto& v = vertexes[k]; for (std::size_t j = 0; j < 4; j++) @@ -106,7 +106,7 @@ auto chunk::ensure_wall_mesh() noexcept -> wall_mesh_tuple const auto center = Vector3(pos.x, pos.y, 0) * TILE_SIZE; const auto quad = i & 1 ? atlas->wall_quad_W(center, TILE_SIZE) : atlas->wall_quad_N(center, TILE_SIZE); const float depth = tile_shader::depth_value(pos); - const auto texcoords = atlas->texcoords_for_id(variant % atlas->num_tiles()); + const auto texcoords = atlas->texcoords_for_id(variant); auto& v = vertexes[k]; for (std::size_t j = 0; j < 4; j++) v[j] = { quad[j], texcoords[j], depth, }; -- cgit v1.2.3