diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk-render.cpp | 2 | ||||
-rw-r--r-- | src/chunk-scenery.cpp | 2 | ||||
-rw-r--r-- | src/scenery.cpp | 6 | ||||
-rw-r--r-- | src/tile-defs.hpp | 21 |
4 files changed, 15 insertions, 16 deletions
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index 94200239..9eba6446 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -69,7 +69,7 @@ auto chunk::ensure_wall_mesh() noexcept -> wall_mesh_tuple if (_wall_atlases[i]) wall_indexes[count++] = uint16_t(i); - std::sort(wall_indexes.begin(), wall_indexes.begin() + count, + std::sort(wall_indexes.data(), wall_indexes.data() + (ptrdiff_t)count, [this](uint16_t a, uint16_t b) { return _wall_atlases[a] < _wall_atlases[b]; }); diff --git a/src/chunk-scenery.cpp b/src/chunk-scenery.cpp index 7040c634..c13d3148 100644 --- a/src/chunk-scenery.cpp +++ b/src/chunk-scenery.cpp @@ -100,7 +100,7 @@ auto chunk::make_topo_sort_data(entity& e) -> topo_sort_data const auto bb_min = tile_shader::project(Vector3(Vector2(bb_min_[0], bb_max_[1]), 0)); const auto bb_max = tile_shader::project(Vector3(Vector2(bb_max_[0], bb_min_[1]), 0)); const auto bb_len = bb_max[0] - bb_min[0]; - if (bb_len >= 1 && f.size[0] > iTILE_SIZE[0]) + if (bb_len >= 1 && f.size[0] > uiTILE_SIZE[0]) { data.slope = (bb_max[1]-bb_min[1])/bb_len; data.mode = topo_sort_data::mode_static; diff --git a/src/scenery.cpp b/src/scenery.cpp index 9acc7944..ff78bfa8 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -77,8 +77,8 @@ Vector2 scenery::ordinal_offset(Vector2b offset) const { if (sc_type == scenery_type::door) { - constexpr auto off_closed_ = Vector2b(0, -iTILE_SIZE[1]/2+2); - constexpr auto off_opened_ = Vector2b(-iTILE_SIZE[0]+2, -iTILE_SIZE[1]/2+2); + constexpr auto off_closed_ = Vector2b(0, -bTILE_SIZE[1]/2+2); + constexpr auto off_opened_ = Vector2b(-bTILE_SIZE[0]+2, -bTILE_SIZE[1]/2+2); const auto off_closed = rotate_point(off_closed_, rotation::N, r); const auto off_opened = rotate_point(off_opened_, rotation::N, r); const auto vec = frame == atlas->info().nframes-1 ? off_closed : off_opened; @@ -93,7 +93,7 @@ Vector2 scenery::depth_offset() const Vector2 ret; if (sc_type == scenery_type::door) { - constexpr auto door_offset = Vector2b(-iTILE_SIZE[0], 0); + constexpr auto door_offset = Vector2b(-bTILE_SIZE[0], 0); const auto offset = rotate_point(door_offset, rotation::N, r); ret += Vector2(offset); } diff --git a/src/tile-defs.hpp b/src/tile-defs.hpp index b260fe8a..072935a8 100644 --- a/src/tile-defs.hpp +++ b/src/tile-defs.hpp @@ -5,17 +5,16 @@ namespace floormat { constexpr inline unsigned char TILE_MAX_DIM = 16; -constexpr inline size_t TILE_COUNT = TILE_MAX_DIM*TILE_MAX_DIM; +constexpr inline size_t TILE_COUNT = size_t{TILE_MAX_DIM}*size_t{TILE_MAX_DIM}; -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 sTILE_SIZE2 = Magnum::Math::Vector2<Short> { (Short)iTILE_SIZE[0], (Short)iTILE_SIZE[1] }; -constexpr inline auto usTILE_SIZE2 = Magnum::Math::Vector2<UnsignedShort> { (UnsignedShort)iTILE_SIZE[0], (UnsignedShort)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 }; +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 uiTILE_SIZE = Magnum::Math::Vector3<UnsignedInt> { iTILE_SIZE }; +constexpr inline auto bTILE_SIZE = Magnum::Math::Vector3<Byte> { iTILE_SIZE }; +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 TILE_SIZE20 = Magnum::Math::Vector3<float> { (float)iTILE_SIZE[0], (float)iTILE_SIZE[1], 0 }; } // namespace floormat |