summaryrefslogtreecommitdiff
path: root/platformer/src/camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'platformer/src/camera.h')
-rw-r--r--platformer/src/camera.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/platformer/src/camera.h b/platformer/src/camera.h
index ead4bc9..cdceaec 100644
--- a/platformer/src/camera.h
+++ b/platformer/src/camera.h
@@ -49,4 +49,21 @@
#ifndef CAMERA_H
#define CAMERA_H
+#include "controls.h"
+#include "math3d.h"
+
+typedef struct Camera {
+ Vec3 target; /* the smoothed point we look at (near the player) */
+ float yaw; /* orbit angle around the target, radians */
+ float pitch; /* angle above horizontal, radians */
+ float distance; /* meters from target */
+ Vec3 position; /* derived eye position (recomputed in camera_update) */
+} Camera;
+
+void camera_init(Camera *c, Vec3 follow_point);
+void camera_update(Camera *c, const Input *in, Vec3 follow_point, float dt);
+float camera_yaw(const Camera *c);
+Mat4 camera_view(const Camera *c);
+Mat4 camera_projection(const Camera *c, float aspect);
+
#endif /* CAMERA_H */