]> git.localhorst.tv Git - blank.git/commitdiff
rename model -> controller
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 13 Feb 2015 09:04:39 +0000 (10:04 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 13 Feb 2015 09:04:39 +0000 (10:04 +0100)
src/app.hpp
src/camera.cpp
src/camera.hpp
src/controller.cpp [new file with mode: 0644]
src/controller.hpp [new file with mode: 0644]
src/model.cpp [deleted file]
src/model.hpp [deleted file]

index c5a5098578c306a951c79d0157af6b7ce15c648b..d949567347f336e978fd62d7f15a1871140b49a1 100644 (file)
@@ -5,8 +5,8 @@
 #include <glm/gtc/matrix_transform.hpp>
 
 #include "camera.hpp"
+#include "controller.hpp"
 #include "init.hpp"
-#include "model.hpp"
 #include "shader.hpp"
 
 
@@ -42,7 +42,7 @@ private:
        float yaw_sensitivity;
 
        Camera cam;
-       Model model;
+       FPSController model;
 
        GLuint vtx_buf;
        GLuint mvp_handle;
index 239ddb2b429887ada5970dbe560acbfc14e003a6..8a3a8a1bfe3b7559b8d4c1cd42ee8c4adaa85933 100644 (file)
@@ -7,7 +7,7 @@
 namespace blank {
 
 Camera::Camera()
-: Model()
+: FPSController()
 , fov(45.0f)
 , aspect(1.0f)
 , near_clip(0.1f)
@@ -53,7 +53,7 @@ void Camera::Clip(float near, float far) {
 
 
 void Camera::Update(int dt) {
-       Model::Update(dt);
+       FPSController::Update(dt);
        vp = projection * glm::inverse(Transform());
 }
 
index 1ab086aeb66d257ac3c773f0cf1ae37dc30f6042..33c69d373fd3327dea38e4cbc92ba9b29e7cfce4 100644 (file)
@@ -3,13 +3,13 @@
 
 #include <glm/glm.hpp>
 
-#include "model.hpp"
+#include "controller.hpp"
 
 
 namespace blank {
 
 class Camera
-: public Model {
+: public FPSController {
 
 public:
        Camera();
diff --git a/src/controller.cpp b/src/controller.cpp
new file mode 100644 (file)
index 0000000..19adf1b
--- /dev/null
@@ -0,0 +1,32 @@
+#include "controller.hpp"
+
+#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtx/euler_angles.hpp>
+#include <glm/gtx/transform.hpp>
+
+
+namespace blank {
+
+FPSController::FPSController()
+: velocity(0, 0, 0)
+, position(0, 0, 0)
+, pitch(0)
+, yaw(0) {
+
+}
+
+FPSController::~FPSController() {
+
+}
+
+
+glm::mat4 FPSController::Transform() const {
+       return glm::translate(position) * glm::eulerAngleYX(yaw, pitch);
+}
+
+
+void FPSController::Update(int dt) {
+       position += velocity * float(dt);
+}
+
+}
diff --git a/src/controller.hpp b/src/controller.hpp
new file mode 100644 (file)
index 0000000..8b2cd4e
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BLANK_CONTROLLER_HPP_
+#define BLANK_CONTROLLER_HPP_
+
+#include <glm/glm.hpp>
+
+
+namespace blank {
+
+class FPSController {
+
+public:
+       FPSController();
+       ~FPSController();
+
+       glm::mat4 Transform() const;
+
+       void Velocity(glm::vec3 vel) { velocity = vel; }
+       void Position(glm::vec3 pos) { position = pos; }
+       void Move(glm::vec3 delta) { position += delta; }
+
+       // 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; }
+
+       void Update(int dt);
+
+private:
+       glm::vec3 velocity;
+       glm::vec3 position;
+       float pitch;
+       float yaw;
+
+};
+
+}
+
+#endif
diff --git a/src/model.cpp b/src/model.cpp
deleted file mode 100644 (file)
index 7335ed9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "model.hpp"
-
-#include <glm/gtc/matrix_transform.hpp>
-#include <glm/gtx/euler_angles.hpp>
-#include <glm/gtx/transform.hpp>
-
-
-namespace blank {
-
-Model::Model()
-: velocity(0, 0, 0)
-, position(0, 0, 0)
-, pitch(0)
-, yaw(0) {
-
-}
-
-Model::~Model() {
-
-}
-
-
-glm::mat4 Model::Transform() const {
-       return glm::translate(position) * glm::eulerAngleYX(yaw, pitch);
-}
-
-
-void Model::Update(int dt) {
-       position += velocity * float(dt);
-}
-
-}
diff --git a/src/model.hpp b/src/model.hpp
deleted file mode 100644 (file)
index b2a6e21..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef BLANK_MODEL_HPP_
-#define BLANK_MODEL_HPP_
-
-#include <glm/glm.hpp>
-
-
-namespace blank {
-
-class Model {
-
-public:
-       Model();
-       ~Model();
-
-       glm::mat4 Transform() const;
-
-       void Velocity(glm::vec3 vel) { velocity = vel; }
-       void Position(glm::vec3 pos) { position = pos; }
-       void Move(glm::vec3 delta) { position += delta; }
-
-       // 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; }
-
-       void Update(int dt);
-
-private:
-       glm::vec3 velocity;
-       glm::vec3 position;
-       float pitch;
-       float yaw;
-
-};
-
-}
-
-#endif