# HG changeset patch # User John Tsiombikas # Date 1447279022 -7200 # Node ID 3698f7b31ee61a0a5516db1fe6c86dfbdc3d773a # Parent c994aa032e3c7470728b73bc818504e71cbfb379 foo diff -r c994aa032e3c -r 3698f7b31ee6 include/goatvr.h --- a/include/goatvr.h Thu Nov 05 07:25:36 2015 +0200 +++ b/include/goatvr.h Wed Nov 11 23:57:02 2015 +0200 @@ -1,8 +1,22 @@ #ifndef GOATVR_H_ #define GOATVR_H_ +enum { + GVR_EYE_CENTER, + GVR_EYE_LEFT, + GVR_EYE_RIGHT +}; + int gvr_init(void); -void gvr_cleanup(void); +void gvr_shutdown(void); + +/* ---- VR backend module management ---- */ +int gvr_module_count(void); +char *gvr_module_name(int idx); +int gvr_module_available(int idx); + +int gvr_active_module(void); +int gvr_use_module(int idx); /* Enter VR rendering mode. GoatVR will assume control of your output, go fullscreen, * reposition your window to show up on the VR device, or whatever is needed depending @@ -24,7 +38,6 @@ unsigned int gvr_get_fbo_depth(void); /* ---- tracking ---- */ - int gvr_position(float *vec, int track_id); int gvr_rotation(float *quat, int track_id); int gvr_matrix(float *mat, int track_id); @@ -32,4 +45,15 @@ int gvr_view_matrix(float *mat, int eye); /* equivalent to inverse of gvr_matrix(mat, eye) */ int gvr_proj_matrix(float *mat, int eye, float znear, float zfar); +/* ---- options and parameters ---- */ + +/* set fov in degrees, for backends which do not dictate an fov (mostly for fallback) */ +void gvr_set_fov(float fov); +float gvr_get_fov(void); /* might be approximate fov */ + +void gvr_set_eye_height(void); /* override eye height */ +float gvr_get_eye_height(void); +void gvr_set_ipd(void); /* override ipd */ +float gvr_get_ipd(void); + #endif /* GOATVR_H_ */ diff -r c994aa032e3c -r 3698f7b31ee6 src/module.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/module.h Wed Nov 11 23:57:02 2015 +0200 @@ -0,0 +1,24 @@ +#ifndef MODULE_H_ +#define MODULE_H_ + +#include "rtarg.h" + +struct module { + char *name; + void *data; + + int (*init)(struct module*); + void (*shutdown)(struct module*); + + void (*enter_vr)(struct module*); + void (*leave_vr)(struct module*); + + void (*begin)(struct module*, int); + void (*end)(struct module*); + void (*present)(struct module*); + + struct render_target *(*get_rtarg)(struct module*); + +}; + +#endif /* MODULE_H_ */ diff -r c994aa032e3c -r 3698f7b31ee6 src/rtarg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/rtarg.h Wed Nov 11 23:57:02 2015 +0200 @@ -0,0 +1,17 @@ +#ifndef RTARG_H_ +#define RTARG_H_ + +struct eye_viewport { + int x, y, width, height; +}; + +struct render_target { + unsigned int fbo; + unsigned int color, depth; + int width, height; + int tex_width, tex_height; + + struct eye_viewport eyevp[2]; +}; + +#endif /* RTARG_H_ */