1 #ifndef BLOBS_CREATURE_SITUATION_HPP_
2 #define BLOBS_CREATURE_SITUATION_HPP_
4 #include "../math/glm.hpp"
23 // face direction, normalized
26 const glm::dvec3 &pos = glm::dvec3(0.0),
27 const glm::dvec3 &vel = glm::dvec3(0.0),
28 const glm::dvec3 &dir = glm::dvec3(0.0, 0.0, -1.0))
29 : pos(pos), vel(vel), dir(dir) { }
37 const glm::dvec3 &vel = glm::dvec3(0.0),
38 const glm::dvec3 &acc = glm::dvec3(0.0))
39 : vel(vel), acc(acc) { }
46 Situation(const Situation &) = delete;
47 Situation &operator =(const Situation &) = delete;
49 Situation(Situation &&) = delete;
50 Situation &operator =(Situation &&) = delete;
53 bool OnPlanet() const noexcept;
54 world::Planet &GetPlanet() const noexcept { return *planet; }
55 bool OnSurface() const noexcept;
56 const glm::dvec3 &Position() const noexcept { return state.pos; }
57 world::Tile &GetTile() const noexcept;
58 const world::TileType &GetTileType() const noexcept;
60 void SetState(const State &s) noexcept { state = s; }
61 const State &GetState() const noexcept { return state; }
63 const glm::dvec3 &Velocity() const noexcept { return state.vel; }
64 bool Moving() const noexcept { return glm::length2(state.vel) > 0.00001; }
65 void Move(const glm::dvec3 &dp) noexcept;
66 void Accelerate(const glm::dvec3 &dv) noexcept;
67 void EnforceConstraints(State &) noexcept;
68 void CheckWrap() noexcept;
70 void Heading(const glm::dvec3 &h) noexcept { state.dir = h; }
71 const glm::dvec3 &Heading() const noexcept { return state.dir; }
73 void SetPlanetSurface(world::Planet &, const glm::dvec3 &pos) noexcept;
76 world::Planet *planet;