X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fchunk.hpp;h=0b1e5bdec20f79f65971e23234a5d77e04cd2dfd;hb=e74f1ad236429f05db90c0ace825277e2a3fbc05;hp=840bac0f3caf312574ebb888998f5aeae29ea4ea;hpb=f90ec88e6728ce865bcf892c810a36abd90d9001;p=blank.git diff --git a/src/chunk.hpp b/src/chunk.hpp index 840bac0..0b1e5bd 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -116,6 +116,8 @@ public: int GetLight(const Pos &pos) const { return GetLight(ToIndex(pos)); } int GetLight(const Block::Pos &pos) const { return GetLight(ToIndex(pos)); } + float GetVertexLight(int index, const BlockModel::Position &, const BlockModel::Normal &) const; + bool Intersection( const Ray &ray, const glm::mat4 &M, @@ -146,13 +148,30 @@ private: Chunk *neighbor[Block::FACE_COUNT]; std::vector blocks; std::vector light; - Model model; + BlockModel model; Pos position; bool dirty; }; +struct BlockLookup { + + Chunk *chunk; + Chunk::Pos pos; + const Block *result; + + // resolve chunk/position/block from oob coordinates + // result will be nullptr if unsuccessful + BlockLookup(Chunk *c, const Chunk::Pos &p); + + // resolve chunk/position/block from ib coordinates and direction + // result will be nullptr if unsuccessful + BlockLookup(Chunk *c, const Chunk::Pos &p, Block::Face dir); + +}; + + class Generator; class ChunkLoader {