townengine/include/twn_camera.h

23 lines
615 B
C
Raw Normal View History

#ifndef TWN_CAMERA_H
#define TWN_CAMERA_H
#include "twn_util.h"
#include "twn_engine_api.h"
/* TODO: make it cached? */
2024-07-30 15:05:05 +00:00
/* for example, perspective matrix only needs recaluclation on FOV change */
/* 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 */
2024-07-30 21:18:01 +00:00
float fov; /* field of view, in radians */
} t_camera;
TWN_API t_matrix4 camera_look_at(const t_camera *camera);
TWN_API t_matrix4 camera_perspective(const t_camera *const camera);
2024-07-30 15:05:05 +00:00
#endif