libgoatvr

view src/vr.h @ 13:e4c5c9c0b6f6

added vr_get?_def functions which allow a default to be specified
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 25 Sep 2014 07:23:18 +0300
parents 34d4643d61f9
children 27fcd4c2969d
line source
1 #ifndef VR_H_
2 #define VR_H_
4 /* unit: pixels */
5 #define VR_DISPLAY_WIDTH "display-xres"
6 #define VR_DISPLAY_HEIGHT "display-yres"
7 #define VR_LEYE_XRES "left-eye-xres"
8 #define VR_LEYE_YRES "left-eye-yres"
9 #define VR_REYE_XRES "right-eye-xres"
10 #define VR_REYE_YRES "right-eye-yres"
11 #define VR_WIN_XOFFS "win-xoffset"
12 #define VR_WIN_YOFFS "win-yoffset"
13 /* unit: meters */
14 #define VR_EYE_HEIGHT "eye-height"
15 #define VR_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_seti(const char *optname, int val);
36 void vr_setf(const char *optname, float val);
37 int vr_geti(const char *optname);
38 float vr_getf(const char *optname);
39 /* variants of the get functions, with an additional "default value"
40 * argument, which is returned if the requested option is missing
41 */
42 int vr_geti_def(const char *optname, int def_val);
43 float vr_getf_def(const char *optname, float def_val);
45 int vr_view_translation(int eye, float *vec);
46 int vr_view_rotation(int eye, float *quat);
48 /* returns non-zero if the active vr module provides this kind of matrix
49 * information, otherwise it returns zero, and sets mat to identity
50 */
51 int vr_view_matrix(int eye, float *mat);
52 int vr_proj_matrix(int eye, float znear, float zfar, float *mat);
54 void vr_begin(int eye);
55 void vr_end(void);
56 int vr_swap_buffers(void);
58 /* set the output texture or separate textures for each eye */
59 void vr_output_texture(unsigned int tex, float umin, float vmin, float umax, float vmax);
60 void vr_output_texture_eye(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax);
62 void vr_recenter(void);
64 #ifdef __cplusplus
65 }
66 #endif
68 #endif /* VR_H_ */