oculus1

view src/vr.h @ 1:e2f9e4603129

added LibOVR and started a simple vr wrapper.
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Sep 2013 16:14:59 +0300
parents
children b069a5c27388
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 void vr_set_fov(float fov);
26 float vr_get_fov(void);
28 void vr_set_aspect(float aspect);
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_get_view_matrix(float *res, int eye);
41 void vr_get_proj_matrix(float *res, int eye);
43 /* expects an array of at least 3 floats (x, y, z, offset). */
44 void vr_get_translation(float *offs);
45 /* expects an array of at least 4 floats (x, y, z, w, quaternion). */
46 void vr_get_rotation(float *quat);
47 /* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
48 void vr_get_rotation_euler(float *euler);
50 /* OpenGL stuff */
51 void vr_draw_eye(unsigned int tex, int eye);
53 #ifdef __cplusplus
54 }
55 #endif
57 #endif /* VR_H_ */