summaryrefslogtreecommitdiffhomepage
path: root/src/chunk-walls.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-09 21:31:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-09 21:31:46 +0100
commit7d141e3d24140659d1762ea7d64a5d19351dce89 (patch)
tree52e2a3f95b9bf65cfe45b77612471aac7377d212 /src/chunk-walls.cpp
parentd77f718f1f44f410d312e1c7f95428b2d4629209 (diff)
a
Diffstat (limited to 'src/chunk-walls.cpp')
-rw-r--r--src/chunk-walls.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp
index aaba1201..8133f798 100644
--- a/src/chunk-walls.cpp
+++ b/src/chunk-walls.cpp
@@ -33,32 +33,6 @@ namespace {
using Wall::Group_;
using Wall::Direction_;
-// -----------------------
-
-constexpr Quads::quad get_corner(Direction_ D, Group_ G, float depth)
-{
- CORRADE_ASSUME(D < Direction_::COUNT);
- CORRADE_ASSUME(G < Group_::COUNT);
- constexpr Vector2 half_tile = TILE_SIZE2*.5f;
- constexpr float X = half_tile.x(), Y = half_tile.y(), Z = TILE_SIZE.z();
- const bool is_west = D == Wall::Direction_::W;
-
- if (!is_west)
- return {{
- {-X, -Y, 0 },
- {-X, -Y, Z },
- {-X - depth, -Y, 0 },
- {-X - depth, -Y, Z },
- }};
- else
- return {{
- {-X, -Y - depth, 0 },
- {-X, -Y - depth, Z },
- {-X, -Y, 0 },
- {-X, -Y, Z },
- }};
-}
-
constexpr Quads::quad get_quad(Direction_ D, Group_ G, float depth)
{
CORRADE_ASSUME(D < Direction_::COUNT);
@@ -126,14 +100,25 @@ constexpr Quads::quad get_quad(Direction_ D, Group_ G, float depth)
}};
}
case corner:
- return get_corner(D, G, depth);
+ if (!is_west)
+ return {{
+ {-X, -Y, 0 },
+ {-X, -Y, Z },
+ {-X - depth, -Y, 0 },
+ {-X - depth, -Y, Z },
+ }};
+ else
+ return {{
+ {-X, -Y - depth, 0 },
+ {-X, -Y - depth, Z },
+ {-X, -Y, 0 },
+ {-X, -Y, Z },
+ }};
}
std::unreachable();
fm_abort("invalid wall_atlas group '%d'", (int)G);
}
-// -----------------------
-
Array<Quads::indexes> make_indexes_()
{
auto array = Array<Quads::indexes>{NoInit, chunk::max_wall_quad_count };