diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-07 09:05:18 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-07 09:05:18 +0200 |
commit | 100f35c5129b28c12aa776b5664a9e29f1f551bf (patch) | |
tree | fff276ba524144835edb48f4e58da5094b3cf15c /src/chunk-render.cpp | |
parent | 259219f76c49e6dee0ea7fa0ca09731354fc847f (diff) |
chunk: add hack to prevent character feet clipping
Diffstat (limited to 'src/chunk-render.cpp')
-rw-r--r-- | src/chunk-render.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index 281d7207..c163fd4d 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -48,6 +48,8 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple return _ground->_ground_atlases[a] < _ground->_ground_atlases[b]; }); + float hack_offset = _coord.z == 0 ? -1 : 0; + std::array<std::array<vertex, 4>, TILE_COUNT> vertexes; for (auto k = 0uz; k < count; k++) { @@ -56,7 +58,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple const local_coords pos{i}; const auto quad = atlas->floor_quad(Vector3(pos) * TILE_SIZE, TILE_SIZE2); const auto texcoords = atlas->texcoords_for_id(_ground->_ground_variants[i]); - const float depth = tile_shader::depth_value(pos, tile_shader::ground_depth_offset); + const float depth = tile_shader::depth_value(pos, tile_shader::ground_depth_offset + hack_offset); auto& v = vertexes[k]; for (auto j = 0uz; j < 4; j++) v[j] = { quad[j], texcoords[j], depth }; |