oculus1

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/vr.h	Sat Sep 14 16:14:59 2013 +0300
     1.3 @@ -0,0 +1,57 @@
     1.4 +#ifndef VR_H_
     1.5 +#define VR_H_
     1.6 +
     1.7 +/* VR mode init options */
     1.8 +enum vr_init_mode {
     1.9 +	VR_INIT_NONE,
    1.10 +	VR_INIT_OCULUS,
    1.11 +	VR_INIT_STEREO
    1.12 +};
    1.13 +
    1.14 +/* possible eye values */
    1.15 +enum {
    1.16 +	VR_EYE_CENTER,
    1.17 +	VR_EYE_LEFT,
    1.18 +	VR_EYE_RIGHT
    1.19 +};
    1.20 +
    1.21 +#ifdef __cplusplus
    1.22 +extern "C" {
    1.23 +#endif
    1.24 +
    1.25 +int vr_init(enum vr_init_mode mode);
    1.26 +void vr_shutdown(void);
    1.27 +
    1.28 +void vr_set_fov(float fov);
    1.29 +float vr_get_fov(void);
    1.30 +
    1.31 +void vr_set_aspect(float aspect);
    1.32 +float vr_get_aspect(void);
    1.33 +
    1.34 +void vr_set_eyedist(float ipd);
    1.35 +float vr_get_eyedist(void);
    1.36 +
    1.37 +/* expects an array of 4 barrel distortion coefficients:
    1.38 + * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6
    1.39 + */
    1.40 +void vr_set_distort(const float *coef);
    1.41 +void vr_get_distort(float *coef);
    1.42 +
    1.43 +void vr_get_view_matrix(float *res, int eye);
    1.44 +void vr_get_proj_matrix(float *res, int eye);
    1.45 +
    1.46 +/* expects an array of at least 3 floats (x, y, z, offset). */
    1.47 +void vr_get_translation(float *offs);
    1.48 +/* expects an array of at least 4 floats (x, y, z, w, quaternion). */
    1.49 +void vr_get_rotation(float *quat);
    1.50 +/* expects an array of at least 3 floats (pitch, yaw, roll, angles). */
    1.51 +void vr_get_rotation_euler(float *euler);
    1.52 +
    1.53 +/* OpenGL stuff */
    1.54 +void vr_draw_eye(unsigned int tex, int eye);
    1.55 +
    1.56 +#ifdef __cplusplus
    1.57 +}
    1.58 +#endif
    1.59 +
    1.60 +#endif	/* VR_H_ */