#ifndef RENDER_CAMERA_H #define RENDER_CAMERA_H /* First-person camera (yaw/pitch in degrees). */ #include "math/linalg.h" typedef struct { Vec3 position; Vec3 front; Vec3 right; Vec3 up; float yaw; float pitch; float fov; float near_z; float far_z; float sway_yaw; /* degrees added to the view only (drunk wobble) */ float sway_pitch; float roll; /* degrees, tilts the view around its direction */ Mat4 view; Mat4 projection; } Camera; void Camera_init(Camera *cam, Vec3 position, float yaw, float pitch, float fov); /* Adds yaw/pitch (pitch clamped to +-89 degrees) and updates direction vectors. */ void Camera_rotate(Camera *cam, float yaw_delta, float pitch_delta); /* Rebuilds view and projection matrices. */ void Camera_updateMatrices(Camera *cam, float aspect); #endif /* RENDER_CAMERA_H */