From 28f5a46ba0058752d4e92cc66e0260f4ed2b8cf3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 5 Nov 2022 16:56:15 +0100 Subject: scenery atlas stub --- src/anim-atlas.hpp | 30 ++++++++++++++++++++++++++++++ src/chunk.hpp | 5 +++++ src/scenery.hpp | 14 ++++++++++---- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 src/anim-atlas.hpp 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 +#include + + +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 #include #include namespace floormat { +struct anim_atlas; + struct chunk final { friend struct tile_ref; @@ -37,7 +40,9 @@ struct chunk final private: std::array, TILE_COUNT> _ground_atlases, _wall_north_atlases, _wall_west_atlases; + std::array, TILE_COUNT> _scenery; std::array _ground_variants = {}, _wall_north_variants = {}, _wall_west_variants = {}; + std::array< std::bitset _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 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 -- cgit v1.2.3