]> git.localhorst.tv Git - blank.git/commitdiff
fix error in border block calculation
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 13 Mar 2015 17:55:03 +0000 (18:55 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 13 Mar 2015 19:00:19 +0000 (20:00 +0100)
src/block.hpp
src/chunk.hpp

index a142a96256e285e3acfca5b6848e04df00e4ebc0..3ccd74f71937f523473536910d1a28d4cfaf964b 100644 (file)
@@ -61,6 +61,7 @@ struct BlockType {
 
        bool visible;
 
+       // FIXME: fill faces don't respect block orientation
        struct Faces {
                bool up;
                bool down;
index 19f5c07ea31f453b0b10573342c8bebe7f44dc04..ae773657ad3a6925f20556c7b922bf5428bde770 100644 (file)
@@ -55,10 +55,12 @@ public:
 
        static constexpr bool IsBorder(int idx) {
                return
-                       idx < Width() * Height() ||
-                       (idx / Width()) % Height() == 0 ||
-                       (idx / Width()) % Height() == Height() - 1 ||
-                       (idx / (Width() * Height())) == Depth() - 1;
+                       idx < Width() * Height() ||                    // low Z plane
+                       idx % Width() == 0 ||                          // low X plane
+                       (idx / (Width() * Height())) == Depth() - 1 || // high Z plane
+                       idx % Width() == Width() - 1 ||                // high X plane
+                       (idx / Width()) % Height() == 0 ||             // low Y plane
+                       (idx / Width()) % Height() == Height() - 1;    // high Y plane
        }
 
        // check if block at given index is completely enclosed (and therefore invisible)