diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-29 18:59:39 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-29 18:59:39 +0200 |
commit | d9cf49f11a5767fab52994e5c38d58ba16b13af6 (patch) | |
tree | 0d9adf6eb81bc75f0c1aaf616efe554ff6c64b56 /draw/floor.cpp | |
parent | d309ed0b2ac06d7ba48322303d56bf39c8b57fe4 (diff) |
use vectors without open-coding vector ops
Suggested by mosra.
Diffstat (limited to 'draw/floor.cpp')
-rw-r--r-- | draw/floor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/draw/floor.cpp b/draw/floor.cpp index bfba0c00..444ee127 100644 --- a/draw/floor.cpp +++ b/draw/floor.cpp @@ -74,13 +74,9 @@ std::array<std::array<UnsignedShort, 6>, TILE_COUNT> floor_mesh::make_index_arra std::array<std::array<Vector3, 4>, TILE_COUNT> floor_mesh::make_position_array() { std::array<std::array<Vector3, 4>, TILE_COUNT> array; - constexpr float X = TILE_SIZE[0], Y = TILE_SIZE[1]; - for (std::size_t j = 0, k = 0; j < TILE_MAX_DIM; j++) - for (std::size_t i = 0; i < TILE_MAX_DIM; i++, k++) - { - Vector3 center {(float)(X*i), (float)(Y*j), 0}; - array[k] = { tile_atlas::floor_quad(center, {X, Y}) }; - } + for (std::uint8_t j = 0, k = 0; j < TILE_MAX_DIM; j++) + for (std::uint8_t i = 0; i < TILE_MAX_DIM; i++, k++) + array[k] = { tile_atlas::floor_quad(Vector3(i, j, 0) * TILE_SIZE, TILE_SIZE2) }; return array; } |