goatvr1

changeset 1:3698f7b31ee6 tip

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 11 Nov 2015 23:57:02 +0200
parents c994aa032e3c
children
files include/goatvr.h src/module.h src/rtarg.h
diffstat 3 files changed, 67 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/include/goatvr.h	Thu Nov 05 07:25:36 2015 +0200
     1.2 +++ b/include/goatvr.h	Wed Nov 11 23:57:02 2015 +0200
     1.3 @@ -1,8 +1,22 @@
     1.4  #ifndef GOATVR_H_
     1.5  #define GOATVR_H_
     1.6  
     1.7 +enum {
     1.8 +	GVR_EYE_CENTER,
     1.9 +	GVR_EYE_LEFT,
    1.10 +	GVR_EYE_RIGHT
    1.11 +};
    1.12 +
    1.13  int gvr_init(void);
    1.14 -void gvr_cleanup(void);
    1.15 +void gvr_shutdown(void);
    1.16 +
    1.17 +/* ---- VR backend module management ---- */
    1.18 +int gvr_module_count(void);
    1.19 +char *gvr_module_name(int idx);
    1.20 +int gvr_module_available(int idx);
    1.21 +
    1.22 +int gvr_active_module(void);
    1.23 +int gvr_use_module(int idx);
    1.24  
    1.25  /* Enter VR rendering mode. GoatVR will assume control of your output, go fullscreen,
    1.26   * reposition your window to show up on the VR device, or whatever is needed depending
    1.27 @@ -24,7 +38,6 @@
    1.28  unsigned int gvr_get_fbo_depth(void);
    1.29  
    1.30  /* ---- tracking ---- */
    1.31 -
    1.32  int gvr_position(float *vec, int track_id);
    1.33  int gvr_rotation(float *quat, int track_id);
    1.34  int gvr_matrix(float *mat, int track_id);
    1.35 @@ -32,4 +45,15 @@
    1.36  int gvr_view_matrix(float *mat, int eye); /* equivalent to inverse of gvr_matrix(mat, eye) */
    1.37  int gvr_proj_matrix(float *mat, int eye, float znear, float zfar);
    1.38  
    1.39 +/* ---- options and parameters ---- */
    1.40 +
    1.41 +/* set fov in degrees, for backends which do not dictate an fov (mostly for fallback) */
    1.42 +void gvr_set_fov(float fov);
    1.43 +float gvr_get_fov(void);	/* might be approximate fov */
    1.44 +
    1.45 +void gvr_set_eye_height(void);		/* override eye height */
    1.46 +float gvr_get_eye_height(void);
    1.47 +void gvr_set_ipd(void);				/* override ipd */
    1.48 +float gvr_get_ipd(void);
    1.49 +
    1.50  #endif	/* GOATVR_H_ */
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/module.h	Wed Nov 11 23:57:02 2015 +0200
     2.3 @@ -0,0 +1,24 @@
     2.4 +#ifndef MODULE_H_
     2.5 +#define MODULE_H_
     2.6 +
     2.7 +#include "rtarg.h"
     2.8 +
     2.9 +struct module {
    2.10 +	char *name;
    2.11 +	void *data;
    2.12 +
    2.13 +	int (*init)(struct module*);
    2.14 +	void (*shutdown)(struct module*);
    2.15 +
    2.16 +	void (*enter_vr)(struct module*);
    2.17 +	void (*leave_vr)(struct module*);
    2.18 +
    2.19 +	void (*begin)(struct module*, int);
    2.20 +	void (*end)(struct module*);
    2.21 +	void (*present)(struct module*);
    2.22 +
    2.23 +	struct render_target *(*get_rtarg)(struct module*);
    2.24 +
    2.25 +};
    2.26 +
    2.27 +#endif	/* MODULE_H_ */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/rtarg.h	Wed Nov 11 23:57:02 2015 +0200
     3.3 @@ -0,0 +1,17 @@
     3.4 +#ifndef RTARG_H_
     3.5 +#define RTARG_H_
     3.6 +
     3.7 +struct eye_viewport {
     3.8 +	int x, y, width, height;
     3.9 +};
    3.10 +
    3.11 +struct render_target {
    3.12 +	unsigned int fbo;
    3.13 +	unsigned int color, depth;
    3.14 +	int width, height;
    3.15 +	int tex_width, tex_height;
    3.16 +
    3.17 +	struct eye_viewport eyevp[2];
    3.18 +};
    3.19 +
    3.20 +#endif	/* RTARG_H_ */