]> git.localhorst.tv Git - blank.git/blobdiff - src/controller.hpp
begun block lighting implementation
[blank.git] / src / controller.hpp
index 853eeff3bd244603727866d03df28f0f858621b7..7dd3d110181120b4f60ab5e4015d243dbc8a186a 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef BLANK_CONTROLLER_HPP_
 #define BLANK_CONTROLLER_HPP_
 
+#include "entity.hpp"
 #include "geometry.hpp"
 
-#include <SDL.h>
 #include <glm/glm.hpp>
 
 
@@ -12,15 +12,12 @@ namespace blank {
 class FPSController {
 
 public:
-       FPSController();
+       explicit FPSController(Entity &);
 
-       const glm::mat4 &Transform() const;
-       Ray Aim() const;
+       Ray Aim() const { return entity.Aim(entity.ChunkCoords()); }
 
-       void Velocity(glm::vec3 vel) { velocity = vel; dirty = true; }
-       void OrientationVelocity(const glm::vec3 &vel);
-       void Position(glm::vec3 pos) { position = pos; dirty = true; }
-       void Move(glm::vec3 delta) { Position(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; }
@@ -30,25 +27,30 @@ public:
        void Yaw(float y);
        void RotateYaw(float delta);
 
-       void HandleKeyboard(const SDL_KeyboardEvent &);
-       void HandleMouse(const SDL_MouseMotionEvent &);
-
        void Update(int dt);
 
 private:
+       Entity &entity;
+
        glm::vec3 velocity;
-       glm::vec3 position;
+
        float pitch;
        float yaw;
 
-       mutable glm::mat4 transform;
-       mutable bool dirty;
+};
+
+
+class RandomWalk {
 
-       float move_velocity;
-       float pitch_sensitivity;
-       float yaw_sensitivity;
+public:
+       explicit RandomWalk(Entity &);
+
+       void Update(int dt);
+
+private:
+       Entity &entity;
 
-       bool front, back, left, right, up, down;
+       int time_left;
 
 };