summaryrefslogtreecommitdiffstats
path: root/src/RendererSectionData.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/RendererSectionData.hpp')
-rw-r--r--src/RendererSectionData.hpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/src/RendererSectionData.hpp b/src/RendererSectionData.hpp
index efc6cad..9eb99ad 100644
--- a/src/RendererSectionData.hpp
+++ b/src/RendererSectionData.hpp
@@ -11,17 +11,45 @@
class World;
struct BlockLightness {
- unsigned char face[FaceDirection::none] = { 0,0,0,0,0,0 };
+ uint8_t face[FaceDirection::none + 1] = { 0,0,0,0,0,0 };
+ uint8_t self = 0;
};
struct SectionsData {
- Section section;
- Section west;
- Section east;
- Section top;
- Section bottom;
- Section north;
- Section south;
+ Section data[3][3][3];
+
+ const Section& GetSection(Vector& pos) const {
+ size_t x = 1, y = 1, z = 1;
+ while (true) {
+ if (pos.x < 0) {
+ x--;
+ pos.x += 16;
+ }
+ else if (pos.x > 15) {
+ x++;
+ pos.x -= 16;
+ }
+ else if (pos.y < 0) {
+ y--;
+ pos.y += 16;
+ }
+ else if (pos.y > 15) {
+ y++;
+ pos.y -= 16;
+ }
+ else if (pos.z < 0) {
+ z--;
+ pos.z += 16;
+ }
+ else if (pos.z > 15) {
+ z++;
+ pos.z -= 16;
+ }
+ else
+ break;
+ }
+ return data[x][y][z];
+ }
BlockId GetBlockId(const Vector &pos) const;