From 04ab1a3420b46af046a898ee5510e0d9b25ed24c Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sun, 27 Aug 2017 20:24:28 +0500 Subject: 2017-08-27 --- src/Section.hpp | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'src/Section.hpp') 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 palette; - - std::vector blocks; +class Section { + std::vector block; std::vector light; std::vector sky; - - PackedSection(Vector position, byte *dataBlocks, size_t dataBlocksLength, byte *dataLight, byte *dataSky, byte bitsPerBlock, - std::vector palette); - - PackedSection() = default; -}; - -class Section { - std::vector blocks; + unsigned char bitsPerBlock; + std::vector palette; Vector worldPosition; + size_t hash; + void CalculateHash(); public: + Section(Vector pos, unsigned char bitsPerBlock, std::vector palette, std::vector blockData, std::vector lightData, std::vector 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 -- cgit v1.2.3