twn_draw.h: new camera api

This commit is contained in:
veclavtalica
2024-10-28 12:34:48 +03:00
parent 1d35a3859b
commit d11143ac86
7 changed files with 73 additions and 41 deletions

21
src/twn_camera_c.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef TWN_CAMERA_H
#define TWN_CAMERA_H
#include "twn_types.h"
/* TODO: make it cached? */
/* for example, perspective matrix only needs recaluclation on FOV change */
/* first person camera class */
typedef struct Camera {
Vec3 pos; /* eye position */
Vec3 target; /* normalized target vector */
Vec3 up; /* normalized up vector */
float fov; /* field of view, in radians */
} Camera;
Matrix4 camera_look_at(const Camera *camera);
Matrix4 camera_perspective(const Camera *const camera);
#endif