libgoatvr

diff src/vr.h @ 0:ded3d0a74e19

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 29 Aug 2014 03:45:25 +0300
parents
children 3d9ec6fe97d7
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/vr.h	Fri Aug 29 03:45:25 2014 +0300
     1.3 @@ -0,0 +1,61 @@
     1.4 +#ifndef VR_H_
     1.5 +#define VR_H_
     1.6 +
     1.7 +#define VR_OPT_DISPLAY_WIDTH	"display-xres"
     1.8 +#define VR_OPT_DISPLAY_HEIGHT	"display-yres"
     1.9 +#define VR_OPT_LEYE_XRES	"left-eye-xres"
    1.10 +#define VR_OPT_LEYE_YRES	"left-eye-yres"
    1.11 +#define VR_OPT_REYE_XRES	"right-eye-xres"
    1.12 +#define VR_OPT_REYE_YRES	"right-eye-yres"
    1.13 +#define VR_OPT_EYE_HEIGHT	"eye-height"
    1.14 +#define VR_OPT_IPD			"ipd"
    1.15 +#define VR_OPT_WIN_XOFFS	"win-xoffset"
    1.16 +#define VR_OPT_WIN_YOFFS	"win-yoffset"
    1.17 +
    1.18 +enum {
    1.19 +	VR_EYE_LEFT,
    1.20 +	VR_EYE_RIGHT
    1.21 +};
    1.22 +
    1.23 +#ifdef __cplusplus
    1.24 +extern "C" {
    1.25 +#endif
    1.26 +
    1.27 +int vr_init(void);
    1.28 +void vr_shutdown(void);
    1.29 +
    1.30 +int vr_module_count(void);
    1.31 +const char *vr_module_name(int idx);
    1.32 +
    1.33 +int vr_use_module(int idx);
    1.34 +int vr_use_module_named(const char *name);
    1.35 +
    1.36 +void vr_set_opti(const char *optname, int val);
    1.37 +void vr_set_optf(const char *optname, float val);
    1.38 +int vr_get_opti(const char *optname);
    1.39 +float vr_get_optf(const char *optname);
    1.40 +
    1.41 +int vr_view_translation(int eye, float *vec);
    1.42 +int vr_view_rotation(int eye, float *quat);
    1.43 +
    1.44 +/* returns non-zero if the active vr module provides this kind of matrix
    1.45 + * information, otherwise it returns zero, and sets mat to identity
    1.46 + */
    1.47 +int vr_view_matrix(int eye, float *mat);
    1.48 +int vr_proj_matrix(int eye, float znear, float zfar, float *mat);
    1.49 +
    1.50 +void vr_begin(int eye);
    1.51 +void vr_end(void);
    1.52 +int vr_swap_buffers(void);
    1.53 +
    1.54 +/* set the output texture or separate textures for each eye */
    1.55 +void vr_output_texture(unsigned int tex, float umin, float vmin, float umax, float vmax);
    1.56 +void vr_output_texture_eye(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax);
    1.57 +
    1.58 +void vr_recenter(void);
    1.59 +
    1.60 +#ifdef __cplusplus
    1.61 +}
    1.62 +#endif
    1.63 +
    1.64 +#endif	/* VR_H_ */