X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcontroller.hpp;h=f674e23df9a0a9375c14bc56838acf8279881594;hb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;hp=f636bcdccd15bc64339a287044a32cabae9fc45a;hpb=6af76d9e1a6499ebdab405c1d679d24b9e19fded;p=blank.git diff --git a/src/controller.hpp b/src/controller.hpp index f636bcd..f674e23 100644 --- a/src/controller.hpp +++ b/src/controller.hpp @@ -1,6 +1,9 @@ #ifndef BLANK_CONTROLLER_HPP_ #define BLANK_CONTROLLER_HPP_ +#include "entity.hpp" +#include "geometry.hpp" + #include @@ -9,33 +12,48 @@ namespace blank { class FPSController { public: - FPSController(); + explicit FPSController(Entity &) noexcept; - glm::mat4 Transform() const; + Ray Aim() const noexcept { return entity.Aim(entity.ChunkCoords()); } - void Velocity(glm::vec3 vel) { velocity = vel; } - void OrientationVelocity(const glm::vec3 &vel); - void Position(glm::vec3 pos) { position = pos; } - void Move(glm::vec3 delta) { position += delta; } + const glm::vec3 &Velocity() const noexcept { return velocity; } + void Velocity(const glm::vec3 &vel) noexcept { velocity = vel; } // all angles in radians (full circle = 2π) - float Pitch() const { return pitch; } - void Pitch(float p) { pitch = p; } - void RotatePitch(float delta) { pitch += delta; } - float Yaw() const { return yaw; } - void Yaw(float y) { yaw = y; } - void RotateYaw(float delta) { yaw += delta; } + float Pitch() const noexcept { return pitch; } + void Pitch(float p) noexcept; + void RotatePitch(float delta) noexcept; + float Yaw() const noexcept { return yaw; } + void Yaw(float y) noexcept; + void RotateYaw(float delta) noexcept; - void Update(int dt); + void Update(int dt) noexcept; private: + Entity &entity; + glm::vec3 velocity; - glm::vec3 position; + float pitch; float yaw; }; + +class RandomWalk { + +public: + explicit RandomWalk(Entity &) noexcept; + + void Update(int dt) noexcept; + +private: + Entity &entity; + + int time_left; + +}; + } #endif