summaryrefslogtreecommitdiffstats
path: root/src/RendererSectionData.hpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-12-25 07:20:36 +0100
committerLaG1924 <lag1924@gmail.com>2021-12-25 07:20:36 +0100
commit749e24c0ca1ea5d1d3166ce52ca98601135e0bcc (patch)
tree1c8a6c6a20f23f95d82b6792530ade91bc4303e4 /src/RendererSectionData.hpp
parentAdded per vertex lighting (diff)
downloadAltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar.gz
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar.bz2
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar.lz
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar.xz
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.tar.zst
AltCraft-749e24c0ca1ea5d1d3166ce52ca98601135e0bcc.zip
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;