nuclear@0: #ifndef VR_H_ nuclear@0: #define VR_H_ nuclear@0: nuclear@8: /* unit: pixels */ nuclear@11: #define VR_DISPLAY_WIDTH "display-xres" nuclear@11: #define VR_DISPLAY_HEIGHT "display-yres" nuclear@11: #define VR_LEYE_XRES "left-eye-xres" nuclear@11: #define VR_LEYE_YRES "left-eye-yres" nuclear@11: #define VR_REYE_XRES "right-eye-xres" nuclear@11: #define VR_REYE_YRES "right-eye-yres" nuclear@16: #define VR_RENDER_XRES "render-xres" /* VR_LEYE_XRES + VR_REYE_XRES */ nuclear@16: #define VR_RENDER_YRES "render-yres" /* max(VR_LEYE_YRES, VR_REYE_YRES) */ nuclear@11: #define VR_WIN_XOFFS "win-xoffset" nuclear@11: #define VR_WIN_YOFFS "win-yoffset" nuclear@16: #define VR_RENDER_RES_SCALE "render-res-scale" /* default 1 */ nuclear@8: /* unit: meters */ nuclear@11: #define VR_EYE_HEIGHT "eye-height" nuclear@11: #define VR_IPD "ipd" nuclear@19: #define VR_LEYE_OFFSET "left-eye-offset" /* stereo offset from center of the head */ nuclear@19: #define VR_REYE_OFFSET "right-eye-offset" /* stereo offset from center of the head */ nuclear@17: /* misc options */ nuclear@32: #define VR_NULL_STEREO_SBS "null-stereo-sbs" /* bool, default 0: draw side-by-side */ nuclear@32: #define VR_NULL_STEREO_GL "null-stereo-gl" /* bool, default 0: use quad-buffer stereo */ nuclear@0: nuclear@0: enum { nuclear@0: VR_EYE_LEFT, nuclear@0: VR_EYE_RIGHT nuclear@0: }; nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: int vr_init(void); nuclear@0: void vr_shutdown(void); nuclear@0: nuclear@0: int vr_module_count(void); nuclear@0: const char *vr_module_name(int idx); nuclear@0: nuclear@0: int vr_use_module(int idx); nuclear@0: int vr_use_module_named(const char *name); nuclear@0: nuclear@11: void vr_seti(const char *optname, int val); nuclear@11: void vr_setf(const char *optname, float val); nuclear@11: int vr_geti(const char *optname); nuclear@11: float vr_getf(const char *optname); nuclear@19: float *vr_getfv(const char *optname, float *res); nuclear@12: /* variants of the get functions, with an additional "default value" nuclear@12: * argument, which is returned if the requested option is missing nuclear@12: */ nuclear@12: int vr_geti_def(const char *optname, int def_val); nuclear@12: float vr_getf_def(const char *optname, float def_val); nuclear@0: nuclear@0: int vr_view_translation(int eye, float *vec); nuclear@0: int vr_view_rotation(int eye, float *quat); nuclear@0: nuclear@0: /* returns non-zero if the active vr module provides this kind of matrix nuclear@0: * information, otherwise it returns zero, and sets mat to identity nuclear@0: */ nuclear@0: int vr_view_matrix(int eye, float *mat); nuclear@0: int vr_proj_matrix(int eye, float znear, float zfar, float *mat); nuclear@0: nuclear@0: void vr_begin(int eye); nuclear@0: void vr_end(void); nuclear@0: int vr_swap_buffers(void); nuclear@0: nuclear@0: /* set the output texture or separate textures for each eye */ nuclear@0: void vr_output_texture(unsigned int tex, float umin, float vmin, float umax, float vmax); nuclear@0: void vr_output_texture_eye(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax); nuclear@0: nuclear@0: void vr_recenter(void); nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: #endif /* VR_H_ */