libgoatvr
view src/vr.h @ 33:1102327fe85f
added red-cyan anaglyph fallback drawing
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 30 Oct 2015 06:34:00 +0200 |
parents | 7eea82cea9d2 |
children |
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_RENDER_XRES "render-xres" /* VR_LEYE_XRES + VR_REYE_XRES */
12 #define VR_RENDER_YRES "render-yres" /* max(VR_LEYE_YRES, VR_REYE_YRES) */
13 #define VR_WIN_XOFFS "win-xoffset"
14 #define VR_WIN_YOFFS "win-yoffset"
15 #define VR_RENDER_RES_SCALE "render-res-scale" /* default 1 */
16 /* unit: meters */
17 #define VR_EYE_HEIGHT "eye-height"
18 #define VR_IPD "ipd"
19 #define VR_LEYE_OFFSET "left-eye-offset" /* stereo offset from center of the head */
20 #define VR_REYE_OFFSET "right-eye-offset" /* stereo offset from center of the head */
21 /* misc options */
22 #define VR_NULL_STEREO_SBS "null-stereo-sbs" /* bool, default 0: draw side-by-side */
23 #define VR_NULL_STEREO_GL "null-stereo-gl" /* bool, default 0: use quad-buffer stereo */
24 #define VR_NULL_STEREO_REDCYAN "null-stereo-redcyan" /* bool, default 0: draw red-cyan anaglyph stereo */
26 enum {
27 VR_EYE_LEFT,
28 VR_EYE_RIGHT
29 };
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 int vr_init(void);
36 void vr_shutdown(void);
38 int vr_module_count(void);
39 const char *vr_module_name(int idx);
41 int vr_use_module(int idx);
42 int vr_use_module_named(const char *name);
44 void vr_seti(const char *optname, int val);
45 void vr_setf(const char *optname, float val);
46 int vr_geti(const char *optname);
47 float vr_getf(const char *optname);
48 float *vr_getfv(const char *optname, float *res);
49 /* variants of the get functions, with an additional "default value"
50 * argument, which is returned if the requested option is missing
51 */
52 int vr_geti_def(const char *optname, int def_val);
53 float vr_getf_def(const char *optname, float def_val);
55 int vr_view_translation(int eye, float *vec);
56 int vr_view_rotation(int eye, float *quat);
58 /* returns non-zero if the active vr module provides this kind of matrix
59 * information, otherwise it returns zero, and sets mat to identity
60 */
61 int vr_view_matrix(int eye, float *mat);
62 int vr_proj_matrix(int eye, float znear, float zfar, float *mat);
64 void vr_begin(int eye);
65 void vr_end(void);
66 int vr_swap_buffers(void);
68 /* set the output texture or separate textures for each eye */
69 void vr_output_texture(unsigned int tex, float umin, float vmin, float umax, float vmax);
70 void vr_output_texture_eye(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax);
72 void vr_recenter(void);
74 #ifdef __cplusplus
75 }
76 #endif
78 #endif /* VR_H_ */