diff options
-rw-r--r-- | loader/error-tex.cpp | 15 | ||||
-rw-r--r-- | loader/impl.hpp | 5 | ||||
-rw-r--r-- | loader/loader.hpp | 2 | ||||
-rw-r--r-- | loader/texture.cpp | 7 | ||||
-rw-r--r-- | loader/wall-atlas.cpp | 6 | ||||
-rw-r--r-- | shaders/shader.vert | 2 | ||||
-rw-r--r-- | src/chunk-walls.cpp | 22 | ||||
-rw-r--r-- | src/chunk.cpp | 3 | ||||
-rw-r--r-- | src/chunk.hpp | 22 | ||||
-rw-r--r-- | src/dijkstra.cpp | 3 | ||||
-rw-r--r-- | src/quads.cpp | 2 | ||||
-rw-r--r-- | src/quads.hpp | 3 | ||||
-rw-r--r-- | src/tile-image.cpp | 37 | ||||
-rw-r--r-- | src/tile-image.hpp | 27 | ||||
-rw-r--r-- | src/tile.cpp | 28 | ||||
-rw-r--r-- | src/tile.hpp | 23 | ||||
-rw-r--r-- | src/wall-atlas.hpp | 10 | ||||
-rw-r--r-- | src/wall-defs.hpp | 13 |
18 files changed, 153 insertions, 77 deletions
diff --git a/loader/error-tex.cpp b/loader/error-tex.cpp new file mode 100644 index 00000000..4cc64f91 --- /dev/null +++ b/loader/error-tex.cpp @@ -0,0 +1,15 @@ +#include "impl.hpp" +#include <Magnum/Math/Vector4.h> +#include <Magnum/PixelFormat.h> +#include <Magnum/Trade/ImageData.h> + +namespace floormat::loader_detail { + +Trade::ImageData2D loader_impl::make_error_texture() +{ + static const Vector4ub data[] = { {255, 0, 255, 255} }; // magenta + return Trade::ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, {}, + Containers::arrayView(data, 1), {}, {}}; +} + +} // namespace floormat::loader_detail diff --git a/loader/impl.hpp b/loader/impl.hpp index 1ff3f421..a5a197c9 100644 --- a/loader/impl.hpp +++ b/loader/impl.hpp @@ -39,9 +39,10 @@ struct loader_impl final : loader_ // >-----> resources >-----> Optional<Utility::Resource> shader_res; - StringView shader(StringView filename) noexcept override; - Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) override; + + Trade::ImageData2D make_error_texture(); + Trade::ImageData2D texture(StringView prefix, StringView filename, bool fail_ok = true) noexcept(false) override; // >-----> walls >-----> struct wall_index { uint32_t val = (uint32_t)-1; }; diff --git a/loader/loader.hpp b/loader/loader.hpp index 072d0f06..ac99cfb5 100644 --- a/loader/loader.hpp +++ b/loader/loader.hpp @@ -27,7 +27,7 @@ struct wall_info; struct loader_ { virtual StringView shader(StringView filename) noexcept = 0; - virtual Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) = 0; + virtual Trade::ImageData2D texture(StringView prefix, StringView filename, bool fail_ok = true) noexcept(false) = 0; // todo remove Optional when wall_atlas is fully implemented -sh 20231122 virtual std::shared_ptr<class tile_atlas> tile_atlas(StringView filename, Vector2ub size, Optional<pass_mode> pass) noexcept(false) = 0; virtual std::shared_ptr<class tile_atlas> tile_atlas(StringView filename) noexcept(false) = 0; diff --git a/loader/texture.cpp b/loader/texture.cpp index 28b903c2..1e4ac709 100644 --- a/loader/texture.cpp +++ b/loader/texture.cpp @@ -12,7 +12,7 @@ namespace floormat::loader_detail { fm_noinline -Trade::ImageData2D loader_impl::texture(StringView prefix, StringView filename_) noexcept(false) +Trade::ImageData2D loader_impl::texture(StringView prefix, StringView filename_, bool fail_ok) noexcept(false) { ensure_plugins(); @@ -48,7 +48,10 @@ Trade::ImageData2D loader_impl::texture(StringView prefix, StringView filename_) const auto path = Path::currentDirectory(); buf[len] = '\0'; char errbuf[128]; - fm_throw("can't open image '{}' (cwd '{}'): {}"_cf, buf, path ? StringView{*path} : "(null)"_s, get_error_string(errbuf)); + if (!fail_ok) + fm_throw("can't open image '{}' (cwd '{}'): {}"_cf, buf, path ? StringView{*path} : "(null)"_s, get_error_string(errbuf)); + else + return make_error_texture(); } } // namespace floormat::loader_detail diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp index 1ba46ee7..1b10740c 100644 --- a/loader/wall-atlas.cpp +++ b/loader/wall-atlas.cpp @@ -24,15 +24,15 @@ using nlohmann::json; val = {}; val.name = j["name"]; fm_soft_assert(loader.check_atlas_name(val.name)); - if (j.contains("descr")) - val.descr = j["descr"]; + if (j.contains("description")) + val.descr = j["description"]; } [[maybe_unused]] static void to_json(json& j, const wall_info& val) { j["name"] = val.name; if (val.descr) - j["descr"] = val.descr; + j["description"] = val.descr; } } // namespace floormat diff --git a/shaders/shader.vert b/shaders/shader.vert index 88ed1e93..a2deda52 100644 --- a/shaders/shader.vert +++ b/shaders/shader.vert @@ -5,7 +5,7 @@ layout (location = 1) uniform vec3 offset; layout (location = 2) uniform vec4 tint; layout (location = 3) uniform bool enable_lightmap; -layout (location = 0) in vec4 position; +layout (location = 0) in vec4 position; // todo move depth to .w layout (location = 1) in vec2 texcoords; layout (location = 2) in vec2 light_coord; layout (location = 3) in float depth; diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp new file mode 100644 index 00000000..2c09a79d --- /dev/null +++ b/src/chunk-walls.cpp @@ -0,0 +1,22 @@ +#include "chunk.hpp" +#include "src/tile-bbox.hpp" +#include <Corrade/Containers/ArrayView.h> +#include <Corrade/Containers/PairStl.h> + +// +x +y +z +// +x +y -z +// -x -y +z +// -x +y -z + +namespace floormat { + +using Wall::Group_; + +// wall north +template<> auto chunk::make_wall_vertex_data<Group_::wall, false>(size_t tile, float depth) -> vertex +{ +} + + + +} // namespace floormat diff --git a/src/chunk.cpp b/src/chunk.cpp index 0b7c05b0..ca930777 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -26,7 +26,7 @@ bool chunk::empty(bool force) const noexcept if (!force && !_maybe_empty) return false; for (auto i = 0uz; i < TILE_COUNT; i++) - if (!_objects.empty() || _ground && _ground->_ground_atlases[i] || _walls && (_walls->_wall_atlases[i*2+0] || _walls->_wall_atlases[i*2+1])) + if (!_objects.empty() || _ground && _ground->_ground_atlases[i] || _walls && _walls->empty()) return _maybe_empty = false; if (!_objects.empty()) return false; @@ -34,7 +34,6 @@ bool chunk::empty(bool force) const noexcept } tile_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground ? _ground->_ground_atlases[i].get() : nullptr; } -tile_atlas* chunk::wall_atlas_at(size_t i) const noexcept { return _walls ? _walls->_wall_atlases[i].get() : nullptr; } tile_ref chunk::operator[](size_t idx) noexcept { return { *this, uint8_t(idx) }; } tile_proto chunk::operator[](size_t idx) const noexcept { return tile_proto(tile_ref { *const_cast<chunk*>(this), uint8_t(idx) }); } diff --git a/src/chunk.hpp b/src/chunk.hpp index a24957b1..e4db815d 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -4,6 +4,7 @@ #include "local-coords.hpp" #include "src/RTree.h" #include "global-coords.hpp" +#include "wall-defs.hpp" #include <type_traits> #include <array> #include <Corrade/Containers/Pointer.h> @@ -12,6 +13,7 @@ namespace floormat { class anim_atlas; +class wall_atlas; struct object; struct object_proto; class tile_iterator; @@ -98,7 +100,6 @@ struct chunk final ground_mesh_tuple ensure_ground_mesh() noexcept; tile_atlas* ground_atlas_at(size_t i) const noexcept; wall_mesh_tuple ensure_wall_mesh() noexcept; - tile_atlas* wall_atlas_at(size_t i) const noexcept; scenery_mesh_tuple ensure_scenery_mesh(scenery_scratch_buffers buffers) noexcept; scenery_mesh_tuple ensure_scenery_mesh() noexcept; @@ -116,18 +117,25 @@ struct chunk final const std::vector<std::shared_ptr<object>>& objects() const; private: - struct ground_stuff { + struct ground_stuff + { std::array<std::shared_ptr<tile_atlas>, TILE_COUNT> _ground_atlases; std::array<uint8_t, TILE_COUNT> ground_indexes = {}; std::array<variant_t, TILE_COUNT> _ground_variants = {}; }; - struct wall_stuff { - std::array<std::shared_ptr<tile_atlas>, TILE_COUNT*2> _wall_atlases; // todo make into vector - std::array<uint16_t, TILE_COUNT*2> wall_indexes = {}; - std::array<variant_t, TILE_COUNT*2> _wall_variants = {}; + struct wall_stuff + { + std::array<std::shared_ptr<wall_atlas>, 2*TILE_COUNT> atlases; + std::array<variant_t, 2*TILE_COUNT> variants; + std::array<uint8_t, TILE_COUNT> indexes_N, indexes_W; + size_t count_N = 0, count_W = 0; + + bool empty() const { return count_N == 0 && count_W == 0; } }; + template<Wall::Group_ G, bool IsWest> static vertex make_wall_vertex_data(size_t tile, float depth); + Pointer<ground_stuff> _ground; Pointer<wall_stuff> _walls; std::vector<std::shared_ptr<object>> _objects; @@ -142,7 +150,7 @@ private: _scenery_modified : 1 = true, _pass_modified : 1 = true, _teardown : 1 = false, - _objects_sorted : 1 = true; + _objects_sorted : 1 = true; void ensure_scenery_buffers(scenery_scratch_buffers bufs); static topo_sort_data make_topo_sort_data(object& e, uint32_t mesh_idx); diff --git a/src/dijkstra.cpp b/src/dijkstra.cpp index d49934a1..2ee12a23 100644 --- a/src/dijkstra.cpp +++ b/src/dijkstra.cpp @@ -371,8 +371,7 @@ struct astar::chunk_cache }(); static constexpr size_t rank = sizeof(dimensions)/sizeof(dimensions[0]); - struct index { uint32_t value = (uint32_t)value; }; - + struct index { uint32_t value = 0; }; std::array<index, size> indexes = {}; std::bitset<size> exists{false}; }; diff --git a/src/quads.cpp b/src/quads.cpp index 801c0448..7a4cef58 100644 --- a/src/quads.cpp +++ b/src/quads.cpp @@ -2,7 +2,7 @@ namespace floormat::Quads { -std::array<UnsignedShort, 6> quad_indexes(size_t N) +indexes quad_indexes(size_t N) { using u16 = UnsignedShort; return { /* 3--1 1 */ diff --git a/src/quads.hpp b/src/quads.hpp index 57492f35..1a788bd4 100644 --- a/src/quads.hpp +++ b/src/quads.hpp @@ -7,11 +7,12 @@ namespace floormat::Quads { using quad = std::array<Vector3, 4>; using texcoords = std::array<Vector2, 4>; +using indexes = std::array<UnsignedShort, 6>; quad floor_quad(Vector3 center, Vector2 size); quad wall_quad_N(Vector3 center, Vector3 size); quad wall_quad_W(Vector3 center, Vector3 size); -std::array<UnsignedShort, 6> quad_indexes(size_t N); +indexes quad_indexes(size_t N); texcoords texcoords_at(Vector2ui pos, Vector2ui size, Vector2ui image_size); } // namespace floormat::Quads diff --git a/src/tile-image.cpp b/src/tile-image.cpp index b10effe4..7bfea375 100644 --- a/src/tile-image.cpp +++ b/src/tile-image.cpp @@ -2,32 +2,43 @@ namespace floormat { -bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept +template<typename Atlas> bool image_proto_<Atlas>::operator==(const image_proto_<Atlas>& b) const noexcept = default; +template<typename Atlas> image_proto_<Atlas>::operator bool() const noexcept { return atlas != nullptr; } + +template<typename Atlas, typename Proto> +image_ref_<Atlas, Proto>::operator bool() const noexcept { - return a.atlas == b.atlas && a.variant == b.variant; + return atlas != nullptr; } -tile_image_proto::operator bool() const noexcept { return atlas != nullptr; } +template<typename Atlas, typename Proto> +image_ref_<Atlas, Proto>::image_ref_(const image_ref_<Atlas, Proto>& o) noexcept + : atlas{o.atlas}, variant{o.variant} +{} + +template<typename Atlas, typename Proto> +image_ref_<Atlas, Proto>::image_ref_(std::shared_ptr<Atlas>& atlas, variant_t& variant) noexcept + : atlas{atlas}, variant{variant} +{} -tile_image_ref::tile_image_ref(std::shared_ptr<tile_atlas>& atlas, variant_t& variant) noexcept : - atlas{atlas}, variant{variant} +template<typename Atlas, typename Proto> +image_ref_<Atlas, Proto>::operator Proto() const noexcept { + return { atlas, variant }; } -tile_image_ref& tile_image_ref::operator=(const tile_image_proto& proto) noexcept +template<typename Atlas, typename Proto> +image_ref_<Atlas, Proto>& image_ref_<Atlas, Proto>::operator=(const Proto& proto) noexcept { atlas = proto.atlas; variant = proto.variant; return *this; } -tile_image_ref::tile_image_ref(const tile_image_ref&) noexcept = default; - -tile_image_ref::operator tile_image_proto() const noexcept -{ - return { atlas, variant }; -} +template struct image_proto_<tile_atlas>; +template struct image_ref_<tile_atlas, tile_image_proto>; -tile_image_ref::operator bool() const noexcept { return atlas != nullptr; } +template struct image_proto_<wall_atlas>; +template struct image_ref_<wall_atlas, wall_image_proto>; } // namespace floormat diff --git a/src/tile-image.hpp b/src/tile-image.hpp index c93cc778..8b2c94e5 100644 --- a/src/tile-image.hpp +++ b/src/tile-image.hpp @@ -4,28 +4,37 @@ namespace floormat { class tile_atlas; +class wall_atlas; using variant_t = uint8_t; -struct tile_image_proto final +template<typename Atlas> +struct image_proto_ { - std::shared_ptr<tile_atlas> atlas; + std::shared_ptr<Atlas> atlas; variant_t variant = 0; - friend bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept; + bool operator==(const image_proto_<Atlas>& b) const noexcept; operator bool() const noexcept; }; -struct tile_image_ref final +template<typename Atlas, typename Proto> +struct image_ref_ final { - std::shared_ptr<tile_atlas>& atlas; + std::shared_ptr<Atlas>& atlas; variant_t& variant; - tile_image_ref(std::shared_ptr<tile_atlas>& atlas, variant_t& variant) noexcept; - tile_image_ref(const tile_image_ref&) noexcept; - tile_image_ref& operator=(const tile_image_proto& tile_image_proto) noexcept; - operator tile_image_proto() const noexcept; + image_ref_(std::shared_ptr<Atlas>& atlas, variant_t& variant) noexcept; + image_ref_(const image_ref_&) noexcept; + image_ref_& operator=(const Proto& proto) noexcept; + operator Proto() const noexcept; operator bool() const noexcept; }; +using tile_image_proto = image_proto_<tile_atlas>; +using tile_image_ref = image_ref_<tile_atlas, tile_image_proto>; + +using wall_image_proto = image_proto_<wall_atlas>; +using wall_image_ref = image_ref_<wall_atlas, wall_image_proto>; + } // namespace floormat diff --git a/src/tile.cpp b/src/tile.cpp index 53ae88b3..0a365f35 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -13,22 +13,22 @@ bool operator==(const tile_proto& a, const tile_proto& b) noexcept { }; tile_image_proto tile_proto::ground() const noexcept { return { ground_atlas, ground_variant }; } -tile_image_proto tile_proto::wall_north() const noexcept { return { wall_north_atlas, wall_north_variant }; } -tile_image_proto tile_proto::wall_west() const noexcept { return { wall_west_atlas, wall_west_variant }; } +wall_image_proto tile_proto::wall_north() const noexcept { return { wall_north_atlas, wall_north_variant }; } +wall_image_proto tile_proto::wall_west() const noexcept { return { wall_west_atlas, wall_west_variant }; } tile_ref::tile_ref(struct chunk& c, uint8_t i) noexcept : _chunk{&c}, i{i} {} std::shared_ptr<tile_atlas> tile_ref::ground_atlas() noexcept { return _chunk->_ground ? _chunk->_ground->_ground_atlases[i] : nullptr; } -std::shared_ptr<tile_atlas> tile_ref::wall_north_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->_wall_atlases[i*2+0] : nullptr; } -std::shared_ptr<tile_atlas> tile_ref::wall_west_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->_wall_atlases[i*2+1] : nullptr; } +std::shared_ptr<wall_atlas> tile_ref::wall_north_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; } +std::shared_ptr<wall_atlas> tile_ref::wall_west_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; } std::shared_ptr<const tile_atlas> tile_ref::ground_atlas() const noexcept { return _chunk->_ground ? _chunk->_ground->_ground_atlases[i] : nullptr; } -std::shared_ptr<const tile_atlas> tile_ref::wall_north_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->_wall_atlases[i*2+0] : nullptr; } -std::shared_ptr<const tile_atlas> tile_ref::wall_west_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->_wall_atlases[i*2+1] : nullptr; } +std::shared_ptr<const wall_atlas> tile_ref::wall_north_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; } +std::shared_ptr<const wall_atlas> tile_ref::wall_west_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; } tile_image_ref tile_ref::ground() noexcept { _chunk->ensure_alloc_ground(); return {_chunk->_ground->_ground_atlases[i], _chunk->_ground->_ground_variants[i] }; } -tile_image_ref tile_ref::wall_north() noexcept { _chunk->ensure_alloc_walls(); return {_chunk->_walls->_wall_atlases[i*2+0], _chunk->_walls->_wall_variants[i*2+0] }; } -tile_image_ref tile_ref::wall_west() noexcept { _chunk->ensure_alloc_walls(); return {_chunk->_walls->_wall_atlases[i*2+1], _chunk->_walls->_wall_variants[i*2+1] }; } +wall_image_ref tile_ref::wall_north() noexcept { _chunk->ensure_alloc_walls(); return {_chunk->_walls->atlases[i*2+0], _chunk->_walls->variants[i*2+0] }; } +wall_image_ref tile_ref::wall_west() noexcept { _chunk->ensure_alloc_walls(); return {_chunk->_walls->atlases[i*2+1], _chunk->_walls->variants[i*2+1] }; } tile_image_proto tile_ref::ground() const noexcept { @@ -36,16 +36,16 @@ tile_image_proto tile_ref::ground() const noexcept return { _chunk->_ground->_ground_atlases[i], _chunk->_ground->_ground_variants[i] }; } -tile_image_proto tile_ref::wall_north() const noexcept +wall_image_proto tile_ref::wall_north() const noexcept { _chunk->ensure_alloc_walls(); - return { _chunk->_walls->_wall_atlases[i*2+0], _chunk->_walls->_wall_variants[i*2+0] }; + return { _chunk->_walls->atlases[i*2+0], _chunk->_walls->variants[i*2+0] }; } -tile_image_proto tile_ref::wall_west() const noexcept +wall_image_proto tile_ref::wall_west() const noexcept { _chunk->ensure_alloc_walls(); - return { _chunk->_walls->_wall_atlases[i*2+1], _chunk->_walls->_wall_variants[i*2+1] }; + return { _chunk->_walls->atlases[i*2+1], _chunk->_walls->variants[i*2+1] }; } tile_ref::operator tile_proto() const noexcept @@ -53,8 +53,8 @@ tile_ref::operator tile_proto() const noexcept _chunk->ensure_alloc_ground(); _chunk->ensure_alloc_walls(); return { - _chunk->_ground->_ground_atlases[i], _chunk->_walls->_wall_atlases[i*2+0], _chunk->_walls->_wall_atlases[i*2+1], - _chunk->_ground->_ground_variants[i], _chunk->_walls->_wall_variants[i*2+0], _chunk->_walls->_wall_variants[i*2+1], + _chunk->_ground->_ground_atlases[i], _chunk->_walls->atlases[i*2+0], _chunk->_walls->atlases[i*2+1], + _chunk->_ground->_ground_variants[i], _chunk->_walls->variants[i*2+0], _chunk->_walls->variants[i*2+1], }; } diff --git a/src/tile.hpp b/src/tile.hpp index fbe2e93d..efdd331b 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -8,12 +8,13 @@ class anim_atlas; struct tile_proto final { - std::shared_ptr<tile_atlas> ground_atlas, wall_north_atlas, wall_west_atlas; + std::shared_ptr<tile_atlas> ground_atlas; + std::shared_ptr<wall_atlas> wall_north_atlas, wall_west_atlas; variant_t ground_variant = 0, wall_north_variant = 0, wall_west_variant = 0; tile_image_proto ground() const noexcept; - tile_image_proto wall_north() const noexcept; - tile_image_proto wall_west() const noexcept; + wall_image_proto wall_north() const noexcept; + wall_image_proto wall_west() const noexcept; friend bool operator==(const tile_proto& a, const tile_proto& b) noexcept; }; @@ -23,20 +24,20 @@ struct tile_ref final tile_ref(struct chunk& c, uint8_t i) noexcept; tile_image_ref ground() noexcept; - tile_image_ref wall_north() noexcept; - tile_image_ref wall_west() noexcept; + wall_image_ref wall_north() noexcept; + wall_image_ref wall_west() noexcept; tile_image_proto ground() const noexcept; - tile_image_proto wall_north() const noexcept; - tile_image_proto wall_west() const noexcept; + wall_image_proto wall_north() const noexcept; + wall_image_proto wall_west() const noexcept; std::shared_ptr<tile_atlas> ground_atlas() noexcept; - std::shared_ptr<tile_atlas> wall_north_atlas() noexcept; - std::shared_ptr<tile_atlas> wall_west_atlas() noexcept; + std::shared_ptr<wall_atlas> wall_north_atlas() noexcept; + std::shared_ptr<wall_atlas> wall_west_atlas() noexcept; std::shared_ptr<const tile_atlas> ground_atlas() const noexcept; - std::shared_ptr<const tile_atlas> wall_north_atlas() const noexcept; - std::shared_ptr<const tile_atlas> wall_west_atlas() const noexcept; + std::shared_ptr<const wall_atlas> wall_north_atlas() const noexcept; + std::shared_ptr<const wall_atlas> wall_west_atlas() const noexcept; explicit operator tile_proto() const noexcept; diff --git a/src/wall-atlas.hpp b/src/wall-atlas.hpp index f3b659a4..1a30adbe 100644 --- a/src/wall-atlas.hpp +++ b/src/wall-atlas.hpp @@ -2,6 +2,7 @@ #include "compat/defs.hpp" #include "src/rotation.hpp" #include "src/pass-mode.hpp" +#include "wall-defs.hpp" #include <array> #include <bitset> #include <vector> @@ -27,7 +28,7 @@ struct Group Vector2ui pixel_size; Color4 tint_mult{1,1,1,1}; Color3 tint_add; - uint8_t from_rotation = (uint8_t)-1; // applies only to images + uint8_t from_rotation = (uint8_t)-1; // applies only to images; todo remove it? bool mirrored : 1 = false, default_tint : 1 = true, is_defined : 1 = false; @@ -37,10 +38,6 @@ struct Group bool operator==(const Group&) const noexcept; }; -enum class Group_ : uint8_t { wall, overlay, side, top, corner_L, corner_R, COUNT }; - -enum class Direction_ : uint8_t { N, E, S, W, COUNT }; - struct Direction { using memfn_ptr = Group Direction::*; @@ -87,9 +84,6 @@ struct DirArrayIndex { namespace floormat { -constexpr inline auto Direction_COUNT = (size_t)Wall::Direction_::COUNT; -constexpr inline auto Group_COUNT = (size_t)Wall::Group_::COUNT; - struct wall_atlas_def final { bool operator==(const wall_atlas_def&) const noexcept; diff --git a/src/wall-defs.hpp b/src/wall-defs.hpp new file mode 100644 index 00000000..a9327d53 --- /dev/null +++ b/src/wall-defs.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "compat/integer-types.hpp" + +namespace floormat::Wall { + +enum class Group_ : uint8_t { wall, overlay, side, top, corner_L, corner_R, COUNT }; + +enum class Direction_ : uint8_t { N, E, S, W, COUNT }; + +constexpr inline auto Direction_COUNT = (size_t)Wall::Direction_::COUNT; +constexpr inline auto Group_COUNT = (size_t)Wall::Group_::COUNT; + +} // namespace floormat::Wall |