diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-08 11:12:50 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-08 11:12:50 +0200 |
| commit | d1984938e4f0cbc24b7b8cc6e219fa873d39418a (patch) | |
| tree | d00c6cf0ba66c3285d145527360a0e3aeaef6671 /src/camera-offset.cpp | |
| parent | d17ed6b4ba01a73d33e3ff3ca8f0f6fb25259223 (diff) | |
a
Diffstat (limited to 'src/camera-offset.cpp')
| -rw-r--r-- | src/camera-offset.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp index bf700138..88ebd0e4 100644 --- a/src/camera-offset.cpp +++ b/src/camera-offset.cpp @@ -4,16 +4,17 @@ namespace floormat { -with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chunk_coords c, chunk_coords first, chunk_coords last) : +with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chunk_coords_ c, chunk_coords first, chunk_coords last) : _shader{shader}, _camera{shader.camera_offset()} { fm_assert(shader.depth_offset() == 0.f); constexpr auto chunk_size = TILE_MAX_DIM20d*dTILE_SIZE; - const auto offset = _camera + tile_shader::project(Vector3d(c) * chunk_size); + 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 - const auto len_x = (float)(last.x - first.x), cx = (float)(c.x - first.x), cy = (float)(c.y - first.y); + 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); _shader.set_camera_offset(offset, depth_offset); |
