diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 02:47:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 02:47:34 +0200 |
commit | 386263c8c65ba140e85961775fb8858ed1e65bc4 (patch) | |
tree | 8bdb97bb15c1ea187b99e8a52e020cf532aef833 | |
parent | e1d3607fb443109f1ae49a4765b9e2c5a7998a1b (diff) |
a
-rw-r--r-- | main/draw.cpp | 6 | ||||
-rw-r--r-- | shaders/tile.hpp | 2 | ||||
-rw-r--r-- | src/camera-offset.cpp | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 409164c6..0e0f7c68 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -134,12 +134,12 @@ void main_impl::draw_world() noexcept for (int16_t y = maxy; y >= miny; y--) for (int16_t x = maxx; x >= minx; x--) { - const chunk_coords_ pos{x, y, z}; - auto* c_ = _world.at(pos); + const chunk_coords_ ch{x, y, z}; + auto* c_ = _world.at(ch); if (!c_) continue; auto& c = *c_; - const with_shifted_camera_offset o{_shader, pos, {minx, miny}, {maxx, maxy}}; + const with_shifted_camera_offset o{_shader, ch, {minx, miny}, {maxx, maxy}}; if (check_chunk_visible(_shader.camera_offset(), sz)) { _wall_mesh.draw(_shader, c); diff --git a/shaders/tile.hpp b/shaders/tile.hpp index 8c65b6fa..2eb3f0ca 100644 --- a/shaders/tile.hpp +++ b/shaders/tile.hpp @@ -39,7 +39,7 @@ struct tile_shader : GL::AbstractShaderProgram static constexpr Vector2s max_screen_tiles{16, 16}; static constexpr float depth_tile_size = 1/(double)(TILE_COUNT * max_screen_tiles.product()); - static constexpr float scenery_depth_offset = 0.25f, character_depth_offset = 0.25f, wall_depth_offset = 0.125f; + static constexpr float scenery_depth_offset = 0.25f, character_depth_offset = 0.25f, wall_depth_offset = 0; private: void _draw(); diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp index d5073bef..ad5c8818 100644 --- a/src/camera-offset.cpp +++ b/src/camera-offset.cpp @@ -16,9 +16,7 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun auto len = (last_ - first_) + Vector2i(1, 1); constexpr auto depth_start = -1 + 1.111e-16f; - int depth = TILE_MAX_DIM * pos.x() + - (int)TILE_COUNT * len.x() * pos.y() + - z * (TILE_MAX_DIM+1); + int depth = TILE_MAX_DIM * pos.x() + (int)TILE_COUNT * len.x() * pos.y(); #if 0 if (c_ == chunk_coords_{} || c_ == chunk_coords_{0, -1, 1}) |