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
39
40
41
42
43
44
45
46
47
|
#pragma once
#include <al/types.h>
enum {
CAMU_VIEW_NONE = 0,
CAMU_VIEW_AUTOFIT,
CAMU_VIEW_ZOOM,
CAMU_VIEW_DETACHED
};
enum {
CAMU_VIEW_ROTATION_0 = 0,
CAMU_VIEW_ROTATION_90,
CAMU_VIEW_ROTATION_180,
CAMU_VIEW_ROTATION_270,
CAMU_VIEW_ROTATION_360
};
enum {
CAMU_VR_DISABLED = 0,
CAMU_VR_180,
CAMU_VR_360
};
#define CAMU_DEFAULT_VIEW CAMU_VIEW_AUTOFIT
#define CAMU_DEFAULT_FOV 80.0
struct camu_view {
u8 mode;
u8 rotation;
u32 width;
u32 height;
s32 zindex;
f64 zoom;
f64 x_offset;
f64 y_offset;
f64 stretch;
f64 fov;
};
void camu_view_init(struct camu_view *view, u32 width, u32 height);
void camu_view_calculate(struct camu_view *view, u32 window_width, u32 window_height);
bool camu_view_zoom_simple(struct camu_view *view, u32 window_width, u32 window_height, f64 x, f64 y, f64 v);
bool camu_view_pan_simple(struct camu_view *view, u32 window_width, u32 window_height, f64 dx, f64 dy);
bool camu_view_zoom_fov(struct camu_view *view, f64 v);
|