X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FEntity.hpp;h=25818c6f3da5666b671666a600ace04a9552e093;hb=aefc5482b27e3d259b6c9f3f1e4cdd9ef2e6a8d2;hp=a5723f43b6cd6afb85b9e959d9ec23fbf9cb2aac;hpb=5998b18978bd8e7a0c9deb516474634e1d3521c9;p=blank.git diff --git a/src/world/Entity.hpp b/src/world/Entity.hpp index a5723f4..25818c6 100644 --- a/src/world/Entity.hpp +++ b/src/world/Entity.hpp @@ -38,11 +38,19 @@ public: void Velocity(const glm::vec3 &) noexcept; const Block::Pos &Position() const noexcept { return position; } + void Position(const Chunk::Pos &, const Block::Pos &) noexcept; void Position(const Block::Pos &) noexcept; void Move(const glm::vec3 &delta) noexcept; const Chunk::Pos ChunkCoords() const noexcept { return chunk; } + glm::vec3 AbsolutePosition() const noexcept { + return glm::vec3(chunk * Chunk::Extent()) + position; + } + glm::vec3 AbsoluteDifference(const Entity &other) const noexcept { + return glm::vec3((chunk - other.chunk) * Chunk::Extent()) + position - other.position; + } + const glm::quat &AngularVelocity() const noexcept { return angular_velocity; } void AngularVelocity(const glm::quat &) noexcept; @@ -53,6 +61,9 @@ public: glm::mat4 Transform(const Chunk::Pos &chunk_offset) const noexcept; Ray Aim(const Chunk::Pos &chunk_offset) const noexcept; + void Remove() noexcept { remove = true; } + bool CanRemove() const noexcept { return remove; } + void Update(int dt) noexcept; void Draw() noexcept; @@ -73,6 +84,7 @@ private: glm::mat4 rotation; bool world_collision; + bool remove; };