2024-09-16 06:07:01 +00:00
|
|
|
#ifndef TWN_CAMERA_H
|
|
|
|
#define TWN_CAMERA_H
|
2024-07-29 12:21:39 +00:00
|
|
|
|
2024-10-12 18:16:25 +00:00
|
|
|
#include "twn_types.h"
|
2024-09-16 06:07:01 +00:00
|
|
|
#include "twn_engine_api.h"
|
2024-07-29 12:21:39 +00:00
|
|
|
|
2024-09-16 06:07:01 +00:00
|
|
|
/* TODO: make it cached? */
|
2024-07-30 15:05:05 +00:00
|
|
|
/* for example, perspective matrix only needs recaluclation on FOV change */
|
|
|
|
|
2024-07-29 12:21:39 +00:00
|
|
|
/* first person camera class */
|
2024-09-23 17:43:16 +00:00
|
|
|
typedef struct Camera {
|
|
|
|
Vec3 pos; /* eye position */
|
|
|
|
Vec3 target; /* normalized target vector */
|
|
|
|
Vec3 up; /* normalized up vector */
|
2024-07-30 21:18:01 +00:00
|
|
|
float fov; /* field of view, in radians */
|
2024-09-23 17:43:16 +00:00
|
|
|
} Camera;
|
2024-07-29 12:21:39 +00:00
|
|
|
|
2024-09-23 17:43:16 +00:00
|
|
|
TWN_API Matrix4 camera_look_at(const Camera *camera);
|
2024-07-29 12:21:39 +00:00
|
|
|
|
2024-09-23 17:43:16 +00:00
|
|
|
TWN_API Matrix4 camera_perspective(const Camera *const camera);
|
2024-07-30 15:05:05 +00:00
|
|
|
|
2024-07-29 12:21:39 +00:00
|
|
|
#endif
|