diff options
author | chai <chaifix@163.com> | 2020-02-22 23:33:06 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-02-22 23:33:06 +0800 |
commit | b656c9415a8e7e3b5b7d8bf1f3c8a5444f830c79 (patch) | |
tree | f4f0578d58e5f12b00d2753efef83aaedc03137e /src/extend/camera.h | |
parent | 9c89460e136ed6c6c43704d9a3a15105e0f006b0 (diff) |
*misc
Diffstat (limited to 'src/extend/camera.h')
-rw-r--r-- | src/extend/camera.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/extend/camera.h b/src/extend/camera.h index 2b7afa5..8227dbf 100644 --- a/src/extend/camera.h +++ b/src/extend/camera.h @@ -2,18 +2,37 @@ #define _SOFTSHADEROOM_CAMERA_H_ #include "../math/math.h" +#include "transform.h" +#include "../extern/wog.h" -typedef struct Camera { - Vec3 front; +#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; -void camera_onmousemove(float x, float y); -void camera_onleftdown(); -void camera_onleftup(); -void camera_onrightdown(); -void camera_onrightup(); -void camera_onscroll(int amount); +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
\ No newline at end of file |