From a2fe2786682e626dae25db2d375280c83b615796 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 18 Aug 2017 20:13:01 +0500 Subject: 2017-08-18 --- src/Section.hpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/Section.hpp') diff --git a/src/Section.hpp b/src/Section.hpp index f40fdf9..5422cf3 100644 --- a/src/Section.hpp +++ b/src/Section.hpp @@ -15,37 +15,43 @@ const int SECTION_WIDTH = 16; const int SECTION_LENGTH = 16; const int SECTION_HEIGHT = 16; -class Section { - std::vector m_palette; - byte *m_dataBlocks = nullptr; - size_t m_dataBlocksLen; - byte *m_dataLight = nullptr; - byte *m_dataSkyLight = nullptr; - byte m_bitsPerBlock = 0; - std::vector m_blocks; - std::condition_variable parseWaiter; +struct PackedSection { + Vector position; + + int bitsPerBlock; + + std::vector palette; + + std::vector blocks; + std::vector light; + std::vector sky; - Section(); + PackedSection(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock, + std::vector palette); +}; + +class Section { + std::vector blocks; Vector worldPosition; public: - void Parse(); - - Section(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock, - std::vector palette); + + Section(PackedSection data); ~Section(); Block &GetBlock(Vector pos); + Block GetBlock(Vector pos) const; + Section &operator=(Section other); friend void swap(Section &a, Section &b); Section(const Section &other); - Vector GetPosition(); + Vector GetPosition() const; - size_t GetHash(); + size_t GetHash() const; }; \ No newline at end of file -- cgit v1.2.3