oculus1

view src/vr.h @ 12:d797639e0234

moving on to the distortion... not correct yet
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 20 Sep 2013 10:14:29 +0300
parents b069a5c27388
children f3672317e5c2
line source
1 #ifndef VR_H_
2 #define VR_H_
4 /* VR mode init options */
5 enum vr_init_mode {
6 VR_INIT_NONE,
7 VR_INIT_OCULUS,
8 VR_INIT_STEREO
9 };
11 /* possible eye values */
12 enum {
13 VR_EYE_CENTER,
14 VR_EYE_LEFT,
15 VR_EYE_RIGHT
16 };
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 int vr_init(enum vr_init_mode mode);
23 void vr_shutdown(void);
25 int vr_get_width(void);
26 int vr_get_height(void);
28 float vr_get_fov(void);
29 float vr_get_aspect(void);
31 void vr_set_eyedist(float ipd);
32 float vr_get_eyedist(void);
34 /* expects an array of 4 barrel distortion coefficients:
35 * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6
36 */
37 void vr_set_distort(const float *coef);
38 void vr_get_distort(float *coef);
40 void vr_set_prediction_sec(float dt);
41 float vr_get_prediction_sec(void);
43 void vr_get_view_matrix(float *res, int eye);
44 void vr_get_proj_matrix(float *res, int eye);
46 /* expects an array of at least 3 floats (x, y, z, offset). */
47 void vr_get_translation(float *offs);
48 /* expects an array of at least 4 floats (x, y, z, w, quaternion). */
49 void vr_get_rotation(float *quat);
50 /* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
51 void vr_get_rotation_euler(float *euler);
53 /* OpenGL stuff */
54 void vr_draw_eye(unsigned int tex, int eye);
56 #ifdef __cplusplus
57 }
58 #endif
60 #endif /* VR_H_ */