X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FWorld.hpp;h=8754d3992e800f518dd9b5db021a8c997a80ec9b;hb=4727825186798902f68df5b99a6a32f0ef618454;hp=ab563a7fa9e1e964bb49b10dc16762f2b623a99e;hpb=4c34ddd7eeaa3cb71fc90bf76a0cd395682add66;p=blank.git diff --git a/src/world/World.hpp b/src/world/World.hpp index ab563a7..8754d39 100644 --- a/src/world/World.hpp +++ b/src/world/World.hpp @@ -49,7 +49,7 @@ public: bool Intersection( const Ray &, const glm::mat4 &M, - const Chunk::Pos &reference, + const ExactLocation::Coarse &reference, WorldCollision &); /// check if this ray hits an entity @@ -62,11 +62,16 @@ public: EntityCollision &); /// check if given entity intersects with the world -// bool Intersection(const Entity &e, std::vector &col) { -// return Intersection(e, e.GetState(), col); -// } bool Intersection(const Entity &e, const EntityState &, std::vector &); + /// check if given box (M * AABB) intersects with the world + /// M is assumed to be calculated in reference to given chunk coords + bool Intersection( + const AABB &box, + const glm::mat4 &M, + const glm::ivec3 &reference, + std::vector &); + const BlockTypeRegistry &BlockTypes() noexcept { return block_type; } ChunkStore &Chunks() noexcept { return chunks; } @@ -96,6 +101,7 @@ public: void Update(Entity &, float dt); void Render(Viewport &); + void RenderDebug(Viewport &); private: using EntityHandle = std::list::iterator; @@ -124,6 +130,14 @@ private: const EntityState & ); + /// calculate light direction and intensity at entity's location + void GetLight( + const Entity &entity, + glm::vec3 &direction, + glm::vec3 &color, + glm::vec3 &ambient + ); + private: Config config;