summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-01-28 18:51:30 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-01-28 18:51:30 +0000
commit235f128136c7c23a64fa5f0424edf05879b8ee9b (patch)
treef703d173de2e55fdbdf9723cc5993df63bcff200 /gfx
parentGenerate some random terrain with a water layer (diff)
downloadilt-235f128136c7c23a64fa5f0424edf05879b8ee9b.tar.bz2
ilt-235f128136c7c23a64fa5f0424edf05879b8ee9b.tar.xz
ilt-235f128136c7c23a64fa5f0424edf05879b8ee9b.zip
Input stack and logical split of camera controller
Diffstat (limited to 'gfx')
-rw-r--r--gfx/camera_controller.h14
-rw-r--r--gfx/gl/camera.cpp4
-rw-r--r--gfx/gl/camera.h5
3 files changed, 19 insertions, 4 deletions
diff --git a/gfx/camera_controller.h b/gfx/camera_controller.h
new file mode 100644
index 0000000..cdc70d2
--- /dev/null
+++ b/gfx/camera_controller.h
@@ -0,0 +1,14 @@
+#ifndef CAMERA_CONTROLLER_H
+#define CAMERA_CONTROLLER_H
+
+#include <game/worldobject.h>
+
+class Camera;
+class Shader;
+
+class CameraController : public WorldObject {
+public:
+ virtual void updateCamera(Camera *, Shader *) const = 0;
+};
+
+#endif
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp
index 2f48ca5..c98ff70 100644
--- a/gfx/gl/camera.cpp
+++ b/gfx/gl/camera.cpp
@@ -2,8 +2,8 @@
#include <glm/gtx/transform.hpp>
Camera::Camera(glm::vec3 pos, float fov, float aspect, float zNear, float zFar) :
- projection {glm::perspective(fov, aspect, zNear, zFar)}, pos {pos}, forward {0.0F, 0.0F, 1.0F}, up {0.0F, 1.0F,
- 0.0F}
+ pos {pos}, forward {0.0F, 0.0F, 1.0F}, up {0.0F, 1.0F, 0.0F}, projection {
+ glm::perspective(fov, aspect, zNear, zFar)}
{
}
diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h
index 90d88a3..3d8ece4 100644
--- a/gfx/gl/camera.h
+++ b/gfx/gl/camera.h
@@ -15,11 +15,12 @@ public:
void Pitch(float angle);
void RotateY(float angle);
-private:
- glm::mat4 projection;
glm::vec3 pos;
glm::vec3 forward;
glm::vec3 up;
+
+private:
+ glm::mat4 projection;
};
#endif