goat3dgfx
diff src/vr.h @ 11:d061fe1a31ec
compile vr source files or not
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 24 Nov 2013 14:00:14 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/vr.h Sun Nov 24 14:00:14 2013 +0200 1.3 @@ -0,0 +1,63 @@ 1.4 +#ifndef GOAT3DGFX_VR_H_ 1.5 +#define GOAT3DGFX_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 +const char *vr_get_display_name(void); 1.29 +void vr_get_display_pos(int *xptr, int *yptr); 1.30 + 1.31 +int vr_get_width(void); 1.32 +int vr_get_height(void); 1.33 + 1.34 +float vr_get_fov(void); 1.35 +float vr_get_aspect(void); 1.36 + 1.37 +void vr_set_eyedist(float ipd); 1.38 +float vr_get_eyedist(void); 1.39 + 1.40 +/* expects an array of 4 barrel distortion coefficients: 1.41 + * polar scale: k_0 + k_1 r^2 + k_2 r^4 + k_3 r^6 1.42 + */ 1.43 +void vr_set_distort(const float *coef); 1.44 +void vr_get_distort(float *coef); 1.45 + 1.46 +void vr_set_prediction_sec(float dt); 1.47 +float vr_get_prediction_sec(void); 1.48 + 1.49 +void vr_get_view_matrix(float *res, int eye); 1.50 +void vr_get_proj_matrix(float *res, int eye); 1.51 + 1.52 +/* expects an array of at least 3 floats (x, y, z, offset). */ 1.53 +void vr_get_translation(float *offs); 1.54 +/* expects an array of at least 4 floats (x, y, z, w, quaternion). */ 1.55 +void vr_get_rotation(float *quat); 1.56 +/* expects an array of at least 3 floats (pitch, yaw, roll, angles). */ 1.57 +void vr_get_rotation_euler(float *euler); 1.58 + 1.59 +/* OpenGL stuff */ 1.60 +void vr_draw_eye(int eye, unsigned int tex, float tex_scale_x, float tex_scale_y); 1.61 + 1.62 +#ifdef __cplusplus 1.63 +} 1.64 +#endif 1.65 + 1.66 +#endif /* GOAT3DGFX_VR_H_ */