diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 11:51:00 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-13 11:51:00 +0200 |
commit | 0409fbdd696780ee86f297283c70b63740dae8dc (patch) | |
tree | e839edd29f795f7a0a62ab034afc214b3ff70745 | |
parent | 56e34d8d3388432d342b0c4749cfe044367df668 (diff) |
z fix attempt
-rw-r--r-- | shaders/tile.cpp | 2 | ||||
-rw-r--r-- | shaders/tile.hpp | 4 | ||||
-rw-r--r-- | src/camera-offset.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/shaders/tile.cpp b/shaders/tile.cpp index 803165d5..9725c974 100644 --- a/shaders/tile.cpp +++ b/shaders/tile.cpp @@ -75,7 +75,7 @@ void tile_shader::_draw() float tile_shader::depth_value(const local_coords& xy, float offset) noexcept { - return (xy.to_index() + offset) * depth_tile_size; + return ((float)xy.x + (float)xy.y + offset) * depth_tile_size; } } // namespace floormat diff --git a/shaders/tile.hpp b/shaders/tile.hpp index 2eb3f0ca..47ec2f35 100644 --- a/shaders/tile.hpp +++ b/shaders/tile.hpp @@ -37,8 +37,8 @@ struct tile_shader : GL::AbstractShaderProgram template<typename T, typename... Xs> decltype(auto) draw(T&& mesh, Xs&&... xs); - static constexpr Vector2s max_screen_tiles{16, 16}; - static constexpr float depth_tile_size = 1/(double)(TILE_COUNT * max_screen_tiles.product()); + static constexpr Vector2s max_screen_tiles{32, 32}; + static constexpr float depth_tile_size = 1/(double)(TILE_MAX_DIM * 2 * max_screen_tiles.product()); static constexpr float scenery_depth_offset = 0.25f, character_depth_offset = 0.25f, wall_depth_offset = 0; private: diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp index ad5c8818..95933316 100644 --- a/src/camera-offset.cpp +++ b/src/camera-offset.cpp @@ -8,15 +8,15 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun _shader{shader}, _camera{shader.camera_offset()} { + (void)last_; fm_assert(shader.depth_offset() == 0.f); 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; - int depth = TILE_MAX_DIM * pos.x() + (int)TILE_COUNT * len.x() * pos.y(); + int depth = TILE_MAX_DIM*2 * pos.sum(); #if 0 if (c_ == chunk_coords_{} || c_ == chunk_coords_{0, -1, 1}) |