From 23ef8bc20310bdfad52b07a3f1e4e61c98896841 Mon Sep 17 00:00:00 2001 From: Schark Date: Wed, 23 Sep 2026 23:40:11 -0400 Subject: Working demogit add README.md src/ --- platformer/src/camera.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'platformer/src/camera.h') 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 */ -- cgit v1.2.3-18-g5258