libgoatvr

view src/vr.h @ 8:3d9ec6fe97d7

- added distortion mesh generation for the OpenHMD module (unfinished) - changed internal implementation function naming to use the vrimp_ prefix - added an opengl helper function to load extension entry points
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 20 Sep 2014 13:22:53 +0300
parents ded3d0a74e19
children 34d4643d61f9
line source
1 #ifndef VR_H_
2 #define VR_H_
4 /* unit: pixels */
5 #define VR_OPT_DISPLAY_WIDTH "display-xres"
6 #define VR_OPT_DISPLAY_HEIGHT "display-yres"
7 #define VR_OPT_LEYE_XRES "left-eye-xres"
8 #define VR_OPT_LEYE_YRES "left-eye-yres"
9 #define VR_OPT_REYE_XRES "right-eye-xres"
10 #define VR_OPT_REYE_YRES "right-eye-yres"
11 #define VR_OPT_WIN_XOFFS "win-xoffset"
12 #define VR_OPT_WIN_YOFFS "win-yoffset"
13 /* unit: meters */
14 #define VR_OPT_EYE_HEIGHT "eye-height"
15 #define VR_OPT_IPD "ipd"
17 enum {
18 VR_EYE_LEFT,
19 VR_EYE_RIGHT
20 };
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 int vr_init(void);
27 void vr_shutdown(void);
29 int vr_module_count(void);
30 const char *vr_module_name(int idx);
32 int vr_use_module(int idx);
33 int vr_use_module_named(const char *name);
35 void vr_set_opti(const char *optname, int val);
36 void vr_set_optf(const char *optname, float val);
37 int vr_get_opti(const char *optname);
38 float vr_get_optf(const char *optname);
40 int vr_view_translation(int eye, float *vec);
41 int vr_view_rotation(int eye, float *quat);
43 /* returns non-zero if the active vr module provides this kind of matrix
44 * information, otherwise it returns zero, and sets mat to identity
45 */
46 int vr_view_matrix(int eye, float *mat);
47 int vr_proj_matrix(int eye, float znear, float zfar, float *mat);
49 void vr_begin(int eye);
50 void vr_end(void);
51 int vr_swap_buffers(void);
53 /* set the output texture or separate textures for each eye */
54 void vr_output_texture(unsigned int tex, float umin, float vmin, float umax, float vmax);
55 void vr_output_texture_eye(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax);
57 void vr_recenter(void);
59 #ifdef __cplusplus
60 }
61 #endif
63 #endif /* VR_H_ */