X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunk.hpp;h=97765677e021be36cc0f863af7ca882b973c6820;hb=dcd54cacda98c2c0f7cf0c7a9131fb858d8ee10a;hp=67794145290ea8adcbaef3dc00618f0122cb93d6;hpb=efc3c1ba52cbe0fc9a4010c37c2d7c7020a0b481;p=blank.git diff --git a/src/world/Chunk.hpp b/src/world/Chunk.hpp index 6779414..9776567 100644 --- a/src/world/Chunk.hpp +++ b/src/world/Chunk.hpp @@ -5,10 +5,10 @@ #include "BlockTypeRegistry.hpp" #include "../geometry/Location.hpp" #include "../geometry/primitive.hpp" +#include "../graphics/glm.hpp" #include #include -#include #include @@ -55,6 +55,9 @@ public: pos.y >= 0 && pos.y < side && pos.z >= 0 && pos.z < side; } + static int ToIndex(const ExactLocation::Fine &pos) noexcept { + return ToIndex(RoughLocation::Fine(pos)); + } static constexpr int ToIndex(const RoughLocation::Fine &pos) noexcept { return pos.x + pos.y * side + pos.z * side * side; } @@ -178,7 +181,7 @@ public: const ExactLocation::Coarse &Position() const noexcept { return position; } glm::mat4 Transform(const ExactLocation::Coarse &offset) const noexcept { - return glm::translate((position - offset) * ExactLocation::Extent()); + return glm::translate(ExactLocation::Fine((position - offset) * ExactLocation::Extent())); } void *BlockData() noexcept { return &blocks[0]; }