blob: e647600d17d79322a6d31e17a6f1e4dc698a4554 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include <vector>
#include <map>
#include "Block.hpp"
#include "Vector.hpp"
class Section {
std::vector<long long> block;
std::vector<unsigned char> light;
std::vector<unsigned char> sky;
unsigned char bitsPerBlock;
std::vector<unsigned short> palette;
Vector worldPosition;
mutable size_t hash;
void CalculateHash() const;
std::map<Vector, BlockId> overrideList;
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();
~Section();
Section(const Section &other);
Section(Section &&other) noexcept;
Section &operator=(Section other) noexcept;
BlockId GetBlockId(Vector pos) const;
unsigned char GetBlockLight(Vector pos) const;
unsigned char GetBlockSkyLight(Vector pos) const;
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;
};
|