1#ifndef CLIENT_CAMERA_H
2#define CLIENT_CAMERA_H
3
4#include "mgmath.h"
5
6typedef struct {
7 MGVec3 pos;
8
9 float yaw;
10 float pitch;
11
12 float fov;
13 float near; /* near plane */
14 float far; /* far plane */
15} MGCamera;
16
17/* initialise camera at `pos` */
18void camera_init(MGCamera* cam, MGVec3 pos);
19
20/* move camera by offset */
21void camera_move(MGCamera* cam, MGVec3 offset);
22
23/* rotate camera by pitch and yaw deltas */
24void camera_rotate(MGCamera* cam, float dyaw, float dpitch);
25
26/* get cameras forward direction
27 returns normalized forward vector */
28MGVec3 camera_get_forward(const MGCamera* cam);
29
30/* get cameras right direction
31 returns normalized right vector */
32MGVec3 camera_get_right(const MGCamera* cam);
33
34/* get cameras view matrix
35 returns view matrix */
36MGMat4 camera_get_view(const MGCamera* cam);
37
38/* get cameras projection matrix
39 returns projection matrix */
40MGMat4 camera_get_proj(const MGCamera* cam, float aspect);
41
42#endif /* CLIENT_CAMERA_H */