1 #ifndef BLANK_WORLD_ENTITYSTATE_HPP_
2 #define BLANK_WORLD_ENTITYSTATE_HPP_
4 #include "../geometry/Location.hpp"
7 #include <glm/gtc/quaternion.hpp>
23 /// make sure pos.block is within chunk bounds
24 void AdjustPosition() noexcept;
25 /// make sure pitch and yaw are normalized
26 void AdjustHeading() noexcept;
28 /// get a position vector relative to the (0,0,0) chunk
29 glm::vec3 AbsolutePosition() const noexcept {
30 return pos.Absolute();
32 /// get a position vector relative to given reference chunk
33 glm::vec3 RelativePosition(const glm::ivec3 &reference) const noexcept {
34 return pos.Relative(reference).Absolute();
37 /// get the difference between this and the given position
38 glm::vec3 Diff(const EntityState &other) const noexcept {
39 return pos.Difference(other.pos).Absolute();
42 /// get entity state as a matrix tranform relative to given reference chunk
43 glm::mat4 Transform(const glm::ivec3 &reference) const noexcept;