1 #ifndef BLANK_WORLD_ENTITYSTATE_HPP_
2 #define BLANK_WORLD_ENTITYSTATE_HPP_
7 #include <glm/gtc/quaternion.hpp>
22 /// make sure block_pos is within chunk bounds
23 void AdjustPosition() noexcept;
25 /// get a position vector relative to the (0,0,0) chunk
26 glm::vec3 AbsolutePosition() const noexcept {
27 return glm::vec3(chunk_pos * Chunk::Extent()) + block_pos;
29 /// get a position vector relative to given reference chunk
30 glm::vec3 RelativePosition(const glm::ivec3 &reference) const noexcept {
31 return glm::vec3((chunk_pos - reference) * Chunk::Extent()) + block_pos;
34 /// get the difference between this and the given position
35 glm::vec3 Diff(const EntityState &other) const noexcept {
36 return RelativePosition(other.chunk_pos) - other.block_pos;
39 /// get entity state as a matrix tranform relative to given reference chunk
40 glm::mat4 Transform(const glm::ivec3 &reference) const noexcept;