summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-29 18:59:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-29 18:59:39 +0200
commitd9cf49f11a5767fab52994e5c38d58ba16b13af6 (patch)
tree0d9adf6eb81bc75f0c1aaf616efe554ff6c64b56 /main
parentd309ed0b2ac06d7ba48322303d56bf39c8b57fe4 (diff)
use vectors without open-coding vector ops
Suggested by mosra.
Diffstat (limited to 'main')
-rw-r--r--main/draw.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/draw.cpp b/main/draw.cpp
index 33601c80..3b7c1c42 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -21,7 +21,7 @@ void main_impl::recalc_viewport(Vector2i size) noexcept
global_coords main_impl::pixel_to_tile(Vector2d position) const noexcept
{
- constexpr Vector2d pixel_size{dTILE_SIZE[0], dTILE_SIZE[1]};
+ constexpr Vector2d pixel_size(TILE_SIZE2);
constexpr Vector2d half{.5, .5};
const Vector2d px = position - Vector2d{windowSize()}*.5 - _shader.camera_offset()*.5;
const Vector2d vec = tile_shader::unproject(px) / pixel_size + half;
@@ -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[0]*TILE_MAX_DIM, dTILE_SIZE[1]*TILE_MAX_DIM, 0 };
+ constexpr Vector3d len = dTILE_SIZE * Vector3d(TILE_MAX_DIM, TILE_MAX_DIM, 0);
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)),