summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-18 01:55:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-18 01:55:30 +0200
commitaebec6e9b095149252bf1e4642c211ae98efdf84 (patch)
treedfb9919de3fa8bb1a7ff99c9cb3fcbf17186e7c2 /src
parent2ce80cb4a85cc47dc10f0b70839b2d0f2381cca8 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/camera-offset.cpp5
-rw-r--r--src/camera-offset.hpp2
-rw-r--r--src/tile-defs.hpp1
3 files changed, 4 insertions, 4 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp
index 0bf51c3f..63de0b8b 100644
--- a/src/camera-offset.cpp
+++ b/src/camera-offset.cpp
@@ -12,11 +12,10 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, shor
_shader{shader},
_offset{shader.camera_offset()}
{
- const auto offset = _offset + tile_shader::project({float(x)*TILE_MAX_DIM*TILE_SIZE[0]*.5f,
- float(y)*TILE_MAX_DIM*TILE_SIZE[1]*.5f,
+ const auto offset = _offset + tile_shader::project({-double(x)*TILE_MAX_DIM*dTILE_SIZE[0],
+ double(y)*TILE_MAX_DIM*dTILE_SIZE[1],
0});
_shader.set_camera_offset(offset);
- ASSERT(std::abs(offset[0]) < 1 << 24 && std::abs(offset[1]) < 1 << 24);
}
with_shifted_camera_offset::~with_shifted_camera_offset()
diff --git a/src/camera-offset.hpp b/src/camera-offset.hpp
index 927d5693..07b9f398 100644
--- a/src/camera-offset.hpp
+++ b/src/camera-offset.hpp
@@ -12,7 +12,7 @@ struct with_shifted_camera_offset final
~with_shifted_camera_offset();
private:
tile_shader& _shader; // NOLINT
- Vector2 _offset;
+ Vector2d _offset;
};
} // namespace floormat
diff --git a/src/tile-defs.hpp b/src/tile-defs.hpp
index ec59e19f..df26fe8e 100644
--- a/src/tile-defs.hpp
+++ b/src/tile-defs.hpp
@@ -6,5 +6,6 @@ namespace floormat {
constexpr inline std::size_t TILE_MAX_DIM = 16;
constexpr inline std::size_t TILE_COUNT = TILE_MAX_DIM*TILE_MAX_DIM;
constexpr inline float TILE_SIZE[3] = { 128, 128, 384 };
+constexpr inline double dTILE_SIZE[3] = { 128, 128, 384 };
} // namespace floormat