From c869ce688e7bde9fc12bd95e4de992ebf5f1362e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 29 Oct 2022 19:19:43 +0200 Subject: more vector bonanza --- draw/wall.cpp | 8 ++++---- main/draw.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/draw/wall.cpp b/draw/wall.cpp index ae2e848c..4602453d 100644 --- a/draw/wall.cpp +++ b/draw/wall.cpp @@ -78,11 +78,11 @@ std::array, wall_mesh::COUNT> wall_mesh::make_index std::array, wall_mesh::COUNT> wall_mesh::make_position_array() { std::array, COUNT> array; - for (std::size_t j = 0; j < TILE_MAX_DIM; j++) - for (std::size_t i = 0; i < TILE_MAX_DIM; i++) + for (std::uint8_t j = 0; j < TILE_MAX_DIM; j++) + for (std::uint8_t i = 0; i < TILE_MAX_DIM; i++) { - const auto idx = (j*TILE_MAX_DIM + i) * 2; - const auto center = Vector3((float)i, (float)j, 0) * TILE_SIZE; + const std::size_t idx = (j*TILE_MAX_DIM + i) * 2u; + const auto center = Vector3(i, j, 0) * TILE_SIZE; array[idx + 0] = tile_atlas::wall_quad_N(center, TILE_SIZE); array[idx + 1] = tile_atlas::wall_quad_W(center, TILE_SIZE); } diff --git a/main/draw.cpp b/main/draw.cpp index 3b7c1c42..0607c244 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -77,7 +77,7 @@ void main_impl::draw_world() noexcept bool main_impl::check_chunk_visible(const Vector2d& offset, const Vector2i& size) noexcept { - constexpr Vector3d len = dTILE_SIZE * Vector3d(TILE_MAX_DIM, TILE_MAX_DIM, 0); + constexpr Vector3d len = dTILE_SIZE * TILE_MAX_DIM20d; enum : std::size_t { x, y, }; constexpr Vector2d p00 = tile_shader::project(Vector3d(0, 0, 0)), p10 = tile_shader::project(Vector3d(len[x], 0, 0)), -- cgit v1.2.3