summaryrefslogtreecommitdiffhomepage
path: root/src/tile-bbox.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-10 23:44:34 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-11 00:13:19 +0100
commit8858725782129203b14b214b57d6bb8a9adff37c (patch)
tree203bb49c0d09c40f37dff14b6c12761a56d53262 /src/tile-bbox.hpp
parentc70fcc94727fa21dd5024031610fb98858de4716 (diff)
fix wall bounding box
Diffstat (limited to 'src/tile-bbox.hpp')
-rw-r--r--src/tile-bbox.hpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/tile-bbox.hpp b/src/tile-bbox.hpp
index ba61f0bf..7f8a05b8 100644
--- a/src/tile-bbox.hpp
+++ b/src/tile-bbox.hpp
@@ -7,10 +7,6 @@
namespace floormat {
-namespace {
-constexpr float wall_depth = 8, wall_depth_2 = wall_depth*.5f;
-} // namespace
-
constexpr Vector2 tile_start(size_t k)
{
constexpr auto half_tile = Vector2(TILE_SIZE2)/2;
@@ -32,16 +28,16 @@ constexpr Pair<Vector2, Vector2> whole_tile(size_t k)
return { min, min + TILE_SIZE2, };
}
-constexpr Pair<Vector2, Vector2> wall_north(size_t k)
+constexpr Pair<Vector2, Vector2> wall_north(size_t k, float wall_depth)
{
- auto min = tile_start(k) - Vector2(0, wall_depth_2);
- return { min, min + Vector2(TILE_SIZE2[0], wall_depth), };
+ auto min = tile_start(k) - Vector2{0, wall_depth};
+ return { min, min + Vector2{TILE_SIZE2.x(), wall_depth}, };
}
-constexpr Pair<Vector2, Vector2> wall_west(size_t k)
+constexpr Pair<Vector2, Vector2> wall_west(size_t k, float wall_depth)
{
- auto min = tile_start(k) - Vector2(wall_depth_2, 0);
- return { min, min + Vector2(wall_depth, TILE_SIZE2[1]), };
+ auto min = tile_start(k) - Vector2{wall_depth, 0};
+ return { min, min + Vector2{wall_depth, TILE_SIZE2.y()}, };
}
} // namespace floormat