small3dlib uint/magnolia / include / client / camera.h
 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 */
27MGVec3 camera_get_forward(const MGCamera* cam);
28
29/* get cameras right direction */
30MGVec3 camera_get_right(const MGCamera* cam);
31
32/* get cameras view matrix */
33MGMat4 camera_get_view(const MGCamera* cam);
34
35/* get cameras projection matrix */
36MGMat4 camera_get_proj(const MGCamera* cam, float aspect);
37
38#endif /* CLIENT_CAMERA_H */
39