+bool Chunk::Obstructed(int idx) const {
+ if (IsBorder(idx)) return false;
+
+ // not checking neighbor visibility here, so all
+ // invisible blocks must have their fill set to 6x false
+ // (the default, so should be okay)
+
+ const Block &right = blocks[idx + 1];
+ if (!Type(right).FaceFilled(right, Block::FACE_LEFT)) return false;
+
+ const Block &left = blocks[idx - 1];
+ if (!Type(left).FaceFilled(left, Block::FACE_RIGHT)) return false;
+
+ const Block &up = blocks[idx + Width()];
+ if (!Type(up).FaceFilled(up, Block::FACE_DOWN)) return false;
+
+ const Block &down = blocks[idx - Width()];
+ if (!Type(down).FaceFilled(down, Block::FACE_UP)) return false;
+
+ const Block &front = blocks[idx + Width() * Height()];
+ if (!Type(front).FaceFilled(front, Block::FACE_BACK)) return false;
+
+ const Block &back = blocks[idx - Width() * Height()];
+ if (!Type(back).FaceFilled(back, Block::FACE_FRONT)) return false;
+
+ return true;
+}
+
+glm::mat4 Chunk::ToTransform(int idx) const {
+ return glm::translate(glm::mat4(1.0f), ToCoords(idx)) * blocks[idx].Transform();
+}
+