# HG changeset patch # User John Tsiombikas # Date 1411543122 -10800 # Node ID 34d4643d61f9af94004ed1ed6266ebe2dc00efcc # Parent 61feb366139718582b8a47cfa2bf55254725b7ba remove _opt suffix from vr_get_opt/vr_set_opt, and _OPT_from the predefined names diff -r 61feb3661397 -r 34d4643d61f9 example/example.vcxproj --- a/example/example.vcxproj Sat Sep 20 20:12:00 2014 +0300 +++ b/example/example.vcxproj Wed Sep 24 10:18:42 2014 +0300 @@ -53,11 +53,13 @@ Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) $(SolutionDir)\src;%(AdditionalIncludeDirectories) + 4244 Console true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libovr.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;glew32.lib;libgoatvr.lib + $(OutDir) @@ -70,6 +72,7 @@ true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) $(SolutionDir)\src;%(AdditionalIncludeDirectories) + 4244 Console @@ -77,6 +80,7 @@ true true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libovr.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;glew32.lib;libgoatvr.lib + $(OutDir) diff -r 61feb3661397 -r 34d4643d61f9 example/src/main.c --- a/example/src/main.c Sat Sep 20 20:12:00 2014 +0300 +++ b/example/src/main.c Wed Sep 24 10:18:42 2014 +0300 @@ -77,8 +77,8 @@ } /* resize our window to match the HMD resolution */ - win_width = vr_get_opti(VR_OPT_DISPLAY_WIDTH); - win_height = vr_get_opti(VR_OPT_DISPLAY_HEIGHT); + win_width = vr_geti(VR_DISPLAY_WIDTH); + win_height = vr_geti(VR_DISPLAY_HEIGHT); if(!win_width || !win_height) { SDL_GetWindowSize(win, &win_width, &win_height); } else { @@ -87,8 +87,8 @@ } /* and create a single render target texture to encompass both eyes */ - fb_width = vr_get_opti(VR_OPT_LEYE_XRES) + vr_get_opti(VR_OPT_REYE_XRES); - fb_height = vr_get_opti(VR_OPT_LEYE_YRES); /* assuming both are the same */ + fb_width = vr_geti(VR_LEYE_XRES) + vr_geti(VR_REYE_XRES); + fb_height = vr_geti(VR_LEYE_YRES); /* assuming both are the same */ if(!fb_width || !fb_height) { fb_width = win_width; fb_height = win_height; @@ -127,7 +127,7 @@ * to the rift's part of the desktop before going fullscreen */ SDL_GetWindowPosition(win, &prev_x, &prev_y); - SDL_SetWindowPosition(win, vr_get_opti(VR_OPT_WIN_XOFFS), vr_get_opti(VR_OPT_WIN_YOFFS)); + SDL_SetWindowPosition(win, vr_geti(VR_WIN_XOFFS), vr_geti(VR_WIN_YOFFS)); SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP); } else { /* return to windowed mode and move the window back to its original position */ @@ -178,7 +178,7 @@ vr_view_matrix(i, view_mat); glLoadMatrixf(view_mat); /* move the camera to the eye level of the user */ - glTranslatef(0, -vr_get_optf(VR_OPT_EYE_HEIGHT), 0); + glTranslatef(0, -vr_getf(VR_EYE_HEIGHT), 0); /* finally draw the scene for this eye */ draw_scene(); diff -r 61feb3661397 -r 34d4643d61f9 libgoatvr.def --- a/libgoatvr.def Sat Sep 20 20:12:00 2014 +0300 +++ b/libgoatvr.def Wed Sep 24 10:18:42 2014 +0300 @@ -9,10 +9,10 @@ vr_use_module vr_use_module_named - vr_set_opti - vr_set_optf - vr_get_opti - vr_get_optf + vr_seti + vr_setf + vr_geti + vr_getf vr_view_translation vr_view_rotation diff -r 61feb3661397 -r 34d4643d61f9 libgoatvr.sln --- a/libgoatvr.sln Sat Sep 20 20:12:00 2014 +0300 +++ b/libgoatvr.sln Wed Sep 24 10:18:42 2014 +0300 @@ -8,6 +8,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgoatvr_static", "libgoatvr_static.vcxproj", "{DF0FC238-A249-432C-9163-3778DDE78A62}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{7A7B8D81-EB77-49DA-B68D-B117C0A4782B}" + ProjectSection(ProjectDependencies) = postProject + {DF0FC238-A249-432C-9163-3778DDE78A62} = {DF0FC238-A249-432C-9163-3778DDE78A62} + {6AD69AF8-6F44-4D45-A59C-A7A07F6E1CE0} = {6AD69AF8-6F44-4D45-A59C-A7A07F6E1CE0} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff -r 61feb3661397 -r 34d4643d61f9 src/vr.c --- a/src/vr.c Sat Sep 20 20:12:00 2014 +0300 +++ b/src/vr.c Wed Sep 24 10:18:42 2014 +0300 @@ -36,8 +36,8 @@ /* create the default options database */ if(!defopt && (defopt = create_options())) { - set_option_float(defopt, VR_OPT_EYE_HEIGHT, 1.675); - set_option_float(defopt, VR_OPT_IPD, 0.064); + set_option_float(defopt, VR_EYE_HEIGHT, 1.675); + set_option_float(defopt, VR_IPD, 0.064); } if(vrm) { @@ -115,7 +115,7 @@ return -1; } -void vr_set_opti(const char *optname, int val) +void vr_seti(const char *optname, int val) { if(vrm && vrm->set_option) { vrm->set_option(optname, OTYPE_INT, &val); @@ -124,7 +124,7 @@ } } -void vr_set_optf(const char *optname, float val) +void vr_setf(const char *optname, float val) { if(vrm && vrm->set_option) { vrm->set_option(optname, OTYPE_FLOAT, &val); @@ -133,7 +133,7 @@ } } -int vr_get_opti(const char *optname) +int vr_geti(const char *optname) { int res = 0; @@ -143,7 +143,7 @@ return res; } -float vr_get_optf(const char *optname) +float vr_getf(const char *optname) { float res = 0.0f; diff -r 61feb3661397 -r 34d4643d61f9 src/vr.h --- a/src/vr.h Sat Sep 20 20:12:00 2014 +0300 +++ b/src/vr.h Wed Sep 24 10:18:42 2014 +0300 @@ -2,17 +2,17 @@ #define VR_H_ /* unit: pixels */ -#define VR_OPT_DISPLAY_WIDTH "display-xres" -#define VR_OPT_DISPLAY_HEIGHT "display-yres" -#define VR_OPT_LEYE_XRES "left-eye-xres" -#define VR_OPT_LEYE_YRES "left-eye-yres" -#define VR_OPT_REYE_XRES "right-eye-xres" -#define VR_OPT_REYE_YRES "right-eye-yres" -#define VR_OPT_WIN_XOFFS "win-xoffset" -#define VR_OPT_WIN_YOFFS "win-yoffset" +#define VR_DISPLAY_WIDTH "display-xres" +#define VR_DISPLAY_HEIGHT "display-yres" +#define VR_LEYE_XRES "left-eye-xres" +#define VR_LEYE_YRES "left-eye-yres" +#define VR_REYE_XRES "right-eye-xres" +#define VR_REYE_YRES "right-eye-yres" +#define VR_WIN_XOFFS "win-xoffset" +#define VR_WIN_YOFFS "win-yoffset" /* unit: meters */ -#define VR_OPT_EYE_HEIGHT "eye-height" -#define VR_OPT_IPD "ipd" +#define VR_EYE_HEIGHT "eye-height" +#define VR_IPD "ipd" enum { VR_EYE_LEFT, @@ -32,10 +32,10 @@ int vr_use_module(int idx); int vr_use_module_named(const char *name); -void vr_set_opti(const char *optname, int val); -void vr_set_optf(const char *optname, float val); -int vr_get_opti(const char *optname); -float vr_get_optf(const char *optname); +void vr_seti(const char *optname, int val); +void vr_setf(const char *optname, float val); +int vr_geti(const char *optname); +float vr_getf(const char *optname); int vr_view_translation(int eye, float *vec); int vr_view_rotation(int eye, float *quat); diff -r 61feb3661397 -r 34d4643d61f9 src/vr_libovr.c --- a/src/vr_libovr.c Sat Sep 20 20:12:00 2014 +0300 +++ b/src/vr_libovr.c Wed Sep 24 10:18:42 2014 +0300 @@ -82,16 +82,16 @@ /* create the options database */ if((optdb = create_options())) { - set_option_int(optdb, VR_OPT_DISPLAY_WIDTH, hmd->Resolution.w); - set_option_int(optdb, VR_OPT_DISPLAY_HEIGHT, hmd->Resolution.h); - set_option_int(optdb, VR_OPT_LEYE_XRES, eye_res[0].w); - set_option_int(optdb, VR_OPT_LEYE_YRES, eye_res[0].h); - set_option_int(optdb, VR_OPT_REYE_XRES, eye_res[1].w); - set_option_int(optdb, VR_OPT_REYE_YRES, eye_res[1].h); - set_option_float(optdb, VR_OPT_EYE_HEIGHT, ovrHmd_GetFloat(hmd, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT)); - set_option_float(optdb, VR_OPT_IPD, ovrHmd_GetFloat(hmd, OVR_KEY_IPD, OVR_DEFAULT_IPD)); - set_option_int(optdb, VR_OPT_WIN_XOFFS, hmd->WindowsPos.x); - set_option_int(optdb, VR_OPT_WIN_YOFFS, hmd->WindowsPos.y); + set_option_int(optdb, VR_DISPLAY_WIDTH, hmd->Resolution.w); + set_option_int(optdb, VR_DISPLAY_HEIGHT, hmd->Resolution.h); + set_option_int(optdb, VR_LEYE_XRES, eye_res[0].w); + set_option_int(optdb, VR_LEYE_YRES, eye_res[0].h); + set_option_int(optdb, VR_REYE_XRES, eye_res[1].w); + set_option_int(optdb, VR_REYE_YRES, eye_res[1].h); + set_option_float(optdb, VR_EYE_HEIGHT, ovrHmd_GetFloat(hmd, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT)); + set_option_float(optdb, VR_IPD, ovrHmd_GetFloat(hmd, OVR_KEY_IPD, OVR_DEFAULT_IPD)); + set_option_int(optdb, VR_WIN_XOFFS, hmd->WindowsPos.x); + set_option_int(optdb, VR_WIN_YOFFS, hmd->WindowsPos.y); } deferred_init_done = 0;