oculus1

annotate 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
rev   line source
nuclear@1 1 #ifndef VR_H_
nuclear@1 2 #define VR_H_
nuclear@1 3
nuclear@1 4 /* VR mode init options */
nuclear@1 5 enum vr_init_mode {
nuclear@1 6 VR_INIT_NONE,
nuclear@1 7 VR_INIT_OCULUS,
nuclear@1 8 VR_INIT_STEREO
nuclear@1 9 };
nuclear@1 10
nuclear@1 11 /* possible eye values */
nuclear@1 12 enum {
nuclear@1 13 VR_EYE_CENTER,
nuclear@1 14 VR_EYE_LEFT,
nuclear@1 15 VR_EYE_RIGHT
nuclear@1 16 };
nuclear@1 17
nuclear@1 18 #ifdef __cplusplus
nuclear@1 19 extern "C" {
nuclear@1 20 #endif
nuclear@1 21
nuclear@1 22 int vr_init(enum vr_init_mode mode);
nuclear@1 23 void vr_shutdown(void);
nuclear@1 24
nuclear@1 25 void vr_set_fov(float fov);
nuclear@1 26 float vr_get_fov(void);
nuclear@1 27
nuclear@1 28 void vr_set_aspect(float aspect);
nuclear@1 29 float vr_get_aspect(void);
nuclear@1 30
nuclear@1 31 void vr_set_eyedist(float ipd);
nuclear@1 32 float vr_get_eyedist(void);
nuclear@1 33
nuclear@1 34 /* expects an array of 4 barrel distortion coefficients:
nuclear@1 35 * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6
nuclear@1 36 */
nuclear@1 37 void vr_set_distort(const float *coef);
nuclear@1 38 void vr_get_distort(float *coef);
nuclear@1 39
nuclear@1 40 void vr_get_view_matrix(float *res, int eye);
nuclear@1 41 void vr_get_proj_matrix(float *res, int eye);
nuclear@1 42
nuclear@1 43 /* expects an array of at least 3 floats (x, y, z, offset). */
nuclear@1 44 void vr_get_translation(float *offs);
nuclear@1 45 /* expects an array of at least 4 floats (x, y, z, w, quaternion). */
nuclear@1 46 void vr_get_rotation(float *quat);
nuclear@1 47 /* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
nuclear@1 48 void vr_get_rotation_euler(float *euler);
nuclear@1 49
nuclear@1 50 /* OpenGL stuff */
nuclear@1 51 void vr_draw_eye(unsigned int tex, int eye);
nuclear@1 52
nuclear@1 53 #ifdef __cplusplus
nuclear@1 54 }
nuclear@1 55 #endif
nuclear@1 56
nuclear@1 57 #endif /* VR_H_ */