2024-07-29 12:21:39 +00:00
|
|
|
#ifndef CAMERA_H
|
|
|
|
#define CAMERA_H
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
|
2024-07-30 15:05:05 +00:00
|
|
|
/* TODO: make it cached */
|
|
|
|
/* for example, perspective matrix only needs recaluclation on FOV change */
|
|
|
|
|
2024-07-29 12:21:39 +00:00
|
|
|
/* first person camera class */
|
|
|
|
typedef struct camera {
|
2024-07-30 15:05:05 +00:00
|
|
|
t_fvec3 pos; /* eye position */
|
|
|
|
t_fvec3 target; /* normalized target vector */
|
|
|
|
t_fvec3 up; /* normalized up vector */
|
|
|
|
float fov; /* field of view, in radians */
|
2024-07-29 12:21:39 +00:00
|
|
|
} t_camera;
|
|
|
|
|
|
|
|
t_matrix4 camera_look_at(const t_camera *camera);
|
|
|
|
|
2024-07-30 15:05:05 +00:00
|
|
|
t_matrix4 camera_perspective(const t_camera *const camera);
|
|
|
|
|
2024-07-29 12:21:39 +00:00
|
|
|
#endif
|