summaryrefslogtreecommitdiffstats
path: root/src/Section.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Section.hpp')
-rw-r--r--src/Section.hpp38
1 files changed, 22 insertions, 16 deletions
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<unsigned short> m_palette;
- byte *m_dataBlocks = nullptr;
- size_t m_dataBlocksLen;
- byte *m_dataLight = nullptr;
- byte *m_dataSkyLight = nullptr;
- byte m_bitsPerBlock = 0;
- std::vector<Block> m_blocks;
- std::condition_variable parseWaiter;
+struct PackedSection {
+ Vector position;
+
+ int bitsPerBlock;
+
+ std::vector<unsigned short> palette;
+
+ std::vector<unsigned char> blocks;
+ std::vector<unsigned char> light;
+ std::vector<unsigned char> sky;
- Section();
+ PackedSection(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
+ std::vector<unsigned short> palette);
+};
+
+class Section {
+ std::vector<Block> blocks;
Vector worldPosition;
public:
- void Parse();
-
- Section(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
- std::vector<unsigned short> 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