diff options
-rw-r--r-- | src/anim-atlas.hpp | 30 | ||||
-rw-r--r-- | src/chunk.hpp | 5 | ||||
-rw-r--r-- | src/scenery.hpp | 14 |
3 files changed, 45 insertions, 4 deletions
diff --git a/src/anim-atlas.hpp b/src/anim-atlas.hpp new file mode 100644 index 00000000..186715ab --- /dev/null +++ b/src/anim-atlas.hpp @@ -0,0 +1,30 @@ +#pragma once +#include "compat/defs.hpp" +#include "serialize/anim.hpp" +#include <Corrade/Containers/String.h> +#include <Magnum/GL/Texture.h> + + +namespace floormat { + +struct anim_atlas final +{ + anim_atlas(); + anim_atlas(StringView name, GL::Texture2D&& tex, Serialize::anim metadata) noexcept; + ~anim_atlas() noexcept; + + anim_atlas(anim_atlas&&) noexcept; + anim_atlas& operator=(anim_atlas&&) noexcept; + + StringView name() const noexcept; + GL::Texture2D texture() noexcept; + + fm_DECLARE_DELETED_COPY_ASSIGNMENT(anim_atlas); + +private: + GL::Texture2D _tex; + String _name; + Serialize::anim _anim; +}; + +} // namespace floormat diff --git a/src/chunk.hpp b/src/chunk.hpp index 8ea6a6dd..5472130d 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -1,12 +1,15 @@ #pragma once #include "tile.hpp" #include "tile-iterator.hpp" +#include "scenery.hpp" #include <type_traits> #include <array> #include <bitset> namespace floormat { +struct anim_atlas; + struct chunk final { friend struct tile_ref; @@ -37,7 +40,9 @@ struct chunk final private: std::array<std::shared_ptr<tile_atlas>, TILE_COUNT> _ground_atlases, _wall_north_atlases, _wall_west_atlases; + std::array<std::shared_ptr<anim_atlas>, TILE_COUNT> _scenery; std::array<variant_t, TILE_COUNT> _ground_variants = {}, _wall_north_variants = {}, _wall_west_variants = {}; + std::array< std::bitset<TILE_COUNT*2> _passability = {}; mutable bool _maybe_empty = true; }; diff --git a/src/scenery.hpp b/src/scenery.hpp index 7468cec2..4e362070 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -1,13 +1,19 @@ #pragma once #include "compat/integer-types.hpp" +#include <memory> namespace floormat { -using scenery_t = std::uint16_t; -using scenery_frame_t = std::uint8_t; +struct anim_atlas; -enum class scenery : scenery_t { - none, door_closed, door_empty, +struct scenery final +{ + enum class rotation : std::uint16_t { + N, NE, E, SE, S, SW, W, NW, + }; + + rotation r : 3 = rotation::N; + std::uint16_t frame : 13 = 0; }; } // namespace floormat |