summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/camera-offset.cpp4
-rw-r--r--src/tile-defs.hpp18
2 files changed, 13 insertions, 9 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp
index 40bf66dd..f837fd1f 100644
--- a/src/camera-offset.cpp
+++ b/src/camera-offset.cpp
@@ -10,9 +10,7 @@ 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({double(x)*TILE_MAX_DIM*dTILE_SIZE[0],
- double(y)*TILE_MAX_DIM*dTILE_SIZE[1],
- 0});
+ const auto offset = _offset + tile_shader::project(Vector3d(x, y, 0) * TILE_MAX_DIM20d);
_shader.set_camera_offset(offset);
}
diff --git a/src/tile-defs.hpp b/src/tile-defs.hpp
index 51b04259..af0b0194 100644
--- a/src/tile-defs.hpp
+++ b/src/tile-defs.hpp
@@ -1,13 +1,19 @@
#pragma once
-#include <cstddef>
-#include <cstdint>
-#include <type_traits>
+#include "compat/integer-types.hpp"
+#include <Magnum/Math/Vector3.h>
namespace floormat {
-constexpr inline std::size_t TILE_MAX_DIM = 16;
+constexpr inline std::uint8_t TILE_MAX_DIM = 16;
constexpr inline std::size_t TILE_COUNT = TILE_MAX_DIM*TILE_MAX_DIM;
-constexpr inline float TILE_SIZE[3] = { 64, 64, 64 };
-constexpr inline double dTILE_SIZE[3] = { 64, 64, 64 };
+
+constexpr inline auto TILE_MAX_DIM20d = Magnum::Math::Vector3<double> { TILE_MAX_DIM, TILE_MAX_DIM, 0 };
+constexpr inline auto iTILE_SIZE = Magnum::Math::Vector3<int> { 64, 64, 64 };
+constexpr inline auto iTILE_SIZE2 = Magnum::Math::Vector2<int> { iTILE_SIZE[0], iTILE_SIZE[1] };
+constexpr inline auto TILE_SIZE = Magnum::Math::Vector3<float> { iTILE_SIZE };
+constexpr inline auto dTILE_SIZE = Magnum::Math::Vector3<double> { iTILE_SIZE };
+constexpr inline auto TILE_SIZE2 = Magnum::Math::Vector2<float> { iTILE_SIZE2 };
+constexpr inline auto dTILE_SIZE2 = Magnum::Math::Vector2<double> { TILE_SIZE2 };
+constexpr inline auto TILE_SIZE20 = Magnum::Math::Vector3<float> { (float)iTILE_SIZE[0], (float)iTILE_SIZE[1], 0 };
} // namespace floormat