X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FBlock.hpp;h=5f52d173882903af05a8346561842d0f77006f52;hb=57f4a76edbfd6c2b6077047e9fba31788d161b44;hp=74af3e4ab4bbf025e342674e6bc7eff986bf2d7a;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/world/Block.hpp b/src/world/Block.hpp index 74af3e4..5f52d17 100644 --- a/src/world/Block.hpp +++ b/src/world/Block.hpp @@ -1,6 +1,7 @@ #ifndef BLANK_WORLD_BLOCK_HPP_ #define BLANK_WORLD_BLOCK_HPP_ +#include #include @@ -65,7 +66,7 @@ struct Block { } } - static glm::tvec3 FaceNormal(Face face) noexcept { + static glm::ivec3 FaceNormal(Face face) noexcept { return face2normal[face]; } @@ -98,7 +99,7 @@ struct Block { value |= Mask(f); } void Unset(Face f) { - value |= ~Mask(f); + value &= ~Mask(f); } void Clear() { @@ -124,12 +125,24 @@ struct Block { }; private: - static const glm::tvec3 face2normal[6]; + static const glm::ivec3 face2normal[6]; static const glm::mat4 orient2transform[ORIENT_COUNT]; static const Face orient2face[ORIENT_COUNT][FACE_COUNT]; }; +inline bool operator ==(const Block &a, const Block &b) { + return a.type == b.type && a.orient == b.orient; +} + +inline bool operator !=(const Block &a, const Block &b) { + return !(a == b); +} + +std::ostream &operator <<(std::ostream &, const Block &); +std::ostream &operator <<(std::ostream &, const Block::Face &); +std::ostream &operator <<(std::ostream &, const Block::Turn &); + } #endif