X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FWorld.hpp;h=8754d3992e800f518dd9b5db021a8c997a80ec9b;hb=3b2fe22c33074664b0c4f24be374e4e6c1c0ed2f;hp=c24ccf327f4a21a848a5f6db1dc4616be3aea192;hpb=8639a90bcbcd045c57cd489f02a25e0df4236deb;p=blank.git diff --git a/src/world/World.hpp b/src/world/World.hpp index c24ccf3..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; } @@ -85,14 +90,18 @@ public: /// returs an existing entity if ID is already taken Entity &ForceAddEntity(std::uint32_t id); + std::list &Players() noexcept { return players; } const std::list &Players() const noexcept { return players; } std::list &Entities() noexcept { return entities; } const std::list &Entities() const noexcept { return entities; } + // dt in ms void Update(int dt); + // dt in s void Update(Entity &, float dt); void Render(Viewport &); + void RenderDebug(Viewport &); private: using EntityHandle = std::list::iterator; @@ -121,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;