diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 00:35:28 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 00:35:28 +0200 |
commit | e1d3607fb443109f1ae49a4765b9e2c5a7998a1b (patch) | |
tree | 2316f12a22d3bab259023597045e3cc650404f15 /src | |
parent | d748a3c14e4f5346bc8aff6882c1d082cf3fbd22 (diff) |
wip z level
Diffstat (limited to 'src')
-rw-r--r-- | src/camera-offset.cpp | 7 | ||||
-rw-r--r-- | src/global-coords.hpp | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp index 64e74068..d5073bef 100644 --- a/src/camera-offset.cpp +++ b/src/camera-offset.cpp @@ -10,9 +10,8 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun { fm_assert(shader.depth_offset() == 0.f); - constexpr auto chunk_size = TILE_MAX_DIM20d*dTILE_SIZE; - auto offset = _camera + tile_shader::project(Vector3d(c_.x, c_.y, 0) * chunk_size); - auto z = (int)(c_.z - chunk_z_min); + auto z = int{c_.z}; + auto offset = _camera + tile_shader::project((Vector3d(c_.x, c_.y, 0) * TILE_MAX_DIM20d + Vector3d(0, 0, z)) * dTILE_SIZE); auto pos = chunk_coords(c_) - first_; auto len = (last_ - first_) + Vector2i(1, 1); constexpr auto depth_start = -1 + 1.111e-16f; @@ -22,7 +21,7 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun z * (TILE_MAX_DIM+1); #if 0 - if (c_.z == 0) + if (c_ == chunk_coords_{} || c_ == chunk_coords_{0, -1, 1}) printf("c=(%2hd %2hd %2hhd) pos=(%2d %2d) len=(%d %d) --> %d\n", c_.x, c_.y, c_.z, pos.x(), pos.y(), len.x(), len.y(), depth); #endif diff --git a/src/global-coords.hpp b/src/global-coords.hpp index 737fc21b..d1fd2b8d 100644 --- a/src/global-coords.hpp +++ b/src/global-coords.hpp @@ -125,7 +125,7 @@ constexpr Vector2i global_coords::to_signed() const noexcept constexpr Vector3i global_coords::to_signed3() const noexcept { - return Vector3i(to_signed(), 0); + return Vector3i(to_signed(), z()); } constexpr global_coords global_coords::operator+(Vector2i vec) const noexcept |