diff options
| -rw-r--r-- | main.cpp | 4 | ||||
| -rw-r--r-- | tile-atlas.cpp | 22 | ||||
| -rw-r--r-- | tile-atlas.hpp | 2 |
3 files changed, 2 insertions, 26 deletions
@@ -79,8 +79,8 @@ chunk app::make_test_chunk() { constexpr auto N = TILE_MAX_DIM; chunk c; - c.foreach_tile([&, this](tile& x, std::size_t k, local_coords) { - const auto& atlas = floor1; + c.foreach_tile([&, this](tile& x, std::size_t k, local_coords pt) { + const auto& atlas = pt.x > N/2 && pt.y >= N/2 ? floor2 : floor1; x.ground_image = { atlas, (std::uint8_t)(k % atlas->size()) }; }); c[{N/2 + 1, N/2}].wall_north = { wall1, 0 }; diff --git a/tile-atlas.cpp b/tile-atlas.cpp index e811ffc4..45b0bf5e 100644 --- a/tile-atlas.cpp +++ b/tile-atlas.cpp @@ -50,17 +50,6 @@ vertex_array_type tile_atlas::floor_quad(const Vector3 center, const Vector2 siz }}; } -vertex_array_type tile_atlas::wall_quad_E(const Vector3 center, const Vector3 size) -{ - float x = size[0]*.5f, y = size[1]*.5f, z = size[2]; - return {{ - { x + center[0], y + center[1], center[2] }, - { x + center[0], y + center[1], z + center[2] }, - {-x + center[0], y + center[1], center[2] }, - {-x + center[0], y + center[1], z + center[2] }, - }}; -} - vertex_array_type tile_atlas::wall_quad_N(const Vector3 center, const Vector3 size) { float x = size[0]*.5f, y = size[1]*.5f, z = size[2]; @@ -83,15 +72,4 @@ vertex_array_type tile_atlas::wall_quad_W(const Vector3 center, const Vector3 si }}; } -vertex_array_type tile_atlas::wall_quad_S(const Vector3 center, const Vector3 size) -{ - float x = size[0]*.5f, y = size[1]*.5f, z = size[2]; - return {{ - { x + center[0], -y + center[1], center[2] }, - { x + center[0], -y + center[1], z + center[2] }, - { x + center[0], y + center[1], center[2] }, - { x + center[0], y + center[1], z + center[2] }, - }}; -} - } // namespace Magnum::Examples diff --git a/tile-atlas.hpp b/tile-atlas.hpp index 01dfcb33..e1705d5f 100644 --- a/tile-atlas.hpp +++ b/tile-atlas.hpp @@ -12,8 +12,6 @@ struct tile_atlas final tile_atlas(const ImageView2D& img, Vector2i dims); std::array<Vector2, 4> texcoords_for_id(std::size_t id) const; static vertex_array_type floor_quad(Vector3 center, Vector2 size); - static vertex_array_type wall_quad_S(Vector3 center, Vector3 size); - static vertex_array_type wall_quad_E(Vector3 center, Vector3 size); static vertex_array_type wall_quad_N(Vector3 center, Vector3 size); static vertex_array_type wall_quad_W(Vector3 center, Vector3 size); static constexpr std::array<UnsignedShort, 6> indices(std::size_t N); |
