blob: 8227dbfdbc1efdbe54656ac5983b28bf4cd8b9e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef _SOFTSHADEROOM_CAMERA_H_
#define _SOFTSHADEROOM_CAMERA_H_
#include "../math/math.h"
#include "transform.h"
#include "../extern/wog.h"
#undef near
#undef far
typedef struct {
Transform transform;
float fov, aspect, near, far;
/*matrix*/
Mat4 view_matrix; /*or WorldToCameraMatrix*/
Mat4 proj_matrix;
bool is_viewdirty, is_projdirty;
/*operations*/
float zoom_speed;
} Camera;
typedef struct CameraConfig {
float fov, aspect, near, far;
Vec3 pos;
}CameraConfig;
void camera_init(Camera* cam);
void camera_setposition(float x, float y, float z);
void camera_onevent(Camera* cam, wog_Event* e);
void camera_getmatrix(Mat4* view, Mat4* proj);
void camera_getviewmatrix(Camera* cam, Mat4* view);
void camera_getprojmatrix(Camera* cam, Mat4* proj);
#endif
|