summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/camera-offset.cpp5
-rw-r--r--src/chunk-render.cpp2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp
index 88ebd0e4..f7cf23a4 100644
--- a/src/camera-offset.cpp
+++ b/src/camera-offset.cpp
@@ -14,8 +14,9 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun
const auto offset = _camera + tile_shader::project(Vector3d(c.x, c.y, 0) * chunk_size);
first.x -= 8; first.y -= 8; last.x += 8; last.y += 8; // Z levels
auto len_x = (float)(last.x - first.x), cx = (float)(c.x - first.x), cy = (float)(c.y - first.y);
- cx += c.z; cy += c.z;
- const float depth_offset = shader.depth_tile_size*(cy*TILE_MAX_DIM*len_x*TILE_MAX_DIM + cx*TILE_MAX_DIM);
+ //cx += c.z; cy += c.z;
+ float depth_offset = shader.depth_tile_size*(cy*TILE_MAX_DIM*len_x*TILE_MAX_DIM + cx*TILE_MAX_DIM);
+ depth_offset += tile_shader::depth_value(local_coords{1*c.z, 1*c.z});
_shader.set_camera_offset(offset, depth_offset);
}
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp
index 9e216e8d..8ec10610 100644
--- a/src/chunk-render.cpp
+++ b/src/chunk-render.cpp
@@ -71,7 +71,7 @@ GL::Mesh chunk::make_wall_mesh(size_t count)
const local_coords pos{i / 2u};
const auto center = Vector3(pos) * TILE_SIZE;
const auto quad = i & 1 ? atlas->wall_quad_W(center, TILE_SIZE) : atlas->wall_quad_N(center, TILE_SIZE);
- const float depth = tile_shader::depth_value(pos);
+ const float depth = tile_shader::depth_value(pos, tile_shader::wall_depth_offset);
const auto texcoords = atlas->texcoords_for_id(variant);
auto& v = vertexes[k];
for (auto j = 0uz; j < 4; j++)