summaryrefslogtreecommitdiffstats
path: root/src/Section.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Section.hpp')
-rw-r--r--src/Section.hpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/Section.hpp b/src/Section.hpp
index dfa738a..bda3584 100644
--- a/src/Section.hpp
+++ b/src/Section.hpp
@@ -11,47 +11,45 @@
#include "Vector.hpp"
#include "Utility.hpp"
-struct PackedSection {
- Vector position;
-
- int bitsPerBlock;
-
- std::vector<unsigned short> palette;
-
- std::vector<long long> blocks;
+class Section {
+ std::vector<long long> block;
std::vector<unsigned char> light;
std::vector<unsigned char> sky;
-
- PackedSection(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock,
- std::vector<unsigned short> palette);
-
- PackedSection() = default;
-};
-
-class Section {
- std::vector<Block> blocks;
+ unsigned char bitsPerBlock;
+ std::vector<unsigned short> palette;
Vector worldPosition;
+ size_t hash;
+ void CalculateHash();
public:
+ Section(Vector pos, unsigned char bitsPerBlock, std::vector<unsigned short> palette, std::vector<long long> blockData, std::vector<unsigned char> lightData, std::vector<unsigned char> skyData);
- Section(PackedSection data);
+ Section();
~Section();
+ Section(const Section &other);
+
Section(Section &&other) noexcept;
- Block &GetBlock(Vector pos);
+ Section &operator=(Section other) noexcept;
- Block GetBlock(Vector pos) const;
+ BlockId GetBlockId(Vector pos) const;
- Section &operator=(Section other) noexcept;
+ unsigned char GetBlockLight(Vector pos);
- friend void swap(Section& lhs, Section& rhs) noexcept;
+ unsigned char GetBlockSkyLight(Vector pos);
- Section(const Section &other);
+ void SetBlockId(Vector pos, BlockId value);
+
+ void SetBlockLight(Vector pos, unsigned char value);
+
+ void SetBlockSkyLight(Vector pos, unsigned char value);
Vector GetPosition() const;
size_t GetHash() const;
+
+ friend void swap(Section& lhs, Section& rhs) noexcept;
}; \ No newline at end of file