X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunk.hpp;fp=src%2Fworld%2FChunk.hpp;h=7eceb980cb62d6c66918ae9b3eb7fa587416c2c3;hb=ed3bdc028edc0ecb5835d1c0bf18dbc59b342daf;hp=d0dcf9404219ba063f91fb9b2e5dced933df40e9;hpb=73d4dd2d78eda1e2f8889d1913a97a60cec86876;p=blank.git diff --git a/src/world/Chunk.hpp b/src/world/Chunk.hpp index d0dcf94..7eceb98 100644 --- a/src/world/Chunk.hpp +++ b/src/world/Chunk.hpp @@ -6,6 +6,7 @@ #include "../geometry/Location.hpp" #include "../geometry/primitive.hpp" +#include #include #include #include @@ -132,6 +133,9 @@ public: float GetVertexLight(const RoughLocation::Fine &, const BlockMesh::Position &, const EntityMesh::Normal &) const noexcept; + /// get gravity for one unit mass at given point + glm::vec3 GravityAt(const ExactLocation &) const noexcept; + bool Intersection( const Ray &ray, const ExactLocation::Coarse &reference, @@ -175,6 +179,10 @@ public: bool Lighted() const noexcept { return lighted; } void ScanLights(); + /// check for active blocks, should be called after + /// block data was modified by means other than SetBlock() + void ScanActive(); + void Ref() noexcept { ++ref_count; } void UnRef() noexcept { --ref_count; } bool Referenced() const noexcept { return ref_count > 0; } @@ -192,6 +200,8 @@ private: const BlockTypeRegistry *types; Chunk *neighbor[Block::FACE_COUNT]; + std::set gravity; + Block blocks[size]; unsigned char light[size]; bool generated;