X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcontroller.hpp;h=7dd3d110181120b4f60ab5e4015d243dbc8a186a;hb=b368ecb2c0f34e27b1d3b97cceb218b554dee324;hp=013b3e4de3b82ef4e365f1667d9a102d70ac08c1;hpb=32a385382b73072438c99b533686a4bb9ba4742c;p=blank.git diff --git a/src/controller.hpp b/src/controller.hpp index 013b3e4..7dd3d11 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,34 +12,48 @@ namespace blank { class FPSController { public: - FPSController(); - ~FPSController(); + explicit FPSController(Entity &); - glm::mat4 Transform() const; + Ray Aim() const { 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 { return velocity; } + void Velocity(const glm::vec3 &vel) { 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; } + void Pitch(float p); + void RotatePitch(float delta); float Yaw() const { return yaw; } - void Yaw(float y) { yaw = y; } - void RotateYaw(float delta) { yaw += delta; } + void Yaw(float y); + void RotateYaw(float delta); void Update(int dt); private: + Entity &entity; + glm::vec3 velocity; - glm::vec3 position; + float pitch; float yaw; }; + +class RandomWalk { + +public: + explicit RandomWalk(Entity &); + + void Update(int dt); + +private: + Entity &entity; + + int time_left; + +}; + } #endif