diff options
Diffstat (limited to 'src/extend/camera.h')
-rw-r--r-- | src/extend/camera.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/extend/camera.h b/src/extend/camera.h index e43efe6..98e3e5a 100644 --- a/src/extend/camera.h +++ b/src/extend/camera.h @@ -2,22 +2,22 @@ #define _SOFTSHADEROOM_CAMERA_H_ #include "../math/math.h" -#include "transform.h" -#include "../extern/wog.h" #include "../extern/wog.h" +#include "transform.h" #undef near #undef far -typedef struct { +// A unity editor style camera +typedef struct Camera { Transform transform; float fov, aspect, near, far; /*matrix*/ - Mat4 view_matrix; /*or WorldToCameraMatrix*/ - Mat4 proj_matrix; + Mat4 cached_view_matrix; /*or WorldToCameraMatrix*/ + Mat4 cached_proj_matrix; bool is_viewdirty, is_projdirty; /*operations*/ - float zoom_speed; + float zoom_speed; Vec2 rotate_sensitivity; Vec2 move_sensitivity; Euler euler; @@ -29,12 +29,16 @@ typedef struct { wog_Window* wnd; } Camera; -typedef struct CameraConfig { +typedef struct { + Vec3 position; + Euler euler; float fov, aspect, near, far; - Vec3 pos; + Vec2 rotate_sensitivity, move_sensitivity; + float zoom_speed; }CameraConfig; -void camera_init(Camera* cam, wog_Window* wnd); +Camera* camera_create(wog_Window* wnd, CameraConfig* config); +void camera_destroy(Camera* cam); void camera_setposition(float x, float y, float z); @@ -46,4 +50,6 @@ void camera_getmatrix(Mat4* view, Mat4* proj); void camera_getviewmatrix(Camera* cam, Mat4* view); void camera_getprojmatrix(Camera* cam, Mat4* proj); +void camera_ondraw(Camera* cam); + #endif
\ No newline at end of file |