libgoatvr
changeset 11:34d4643d61f9
remove _opt suffix from vr_get_opt/vr_set_opt, and _OPT_from the predefined names
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 24 Sep 2014 10:18:42 +0300 |
parents | 61feb3661397 |
children | b536bd21b37f |
files | example/example.vcxproj example/src/main.c libgoatvr.def libgoatvr.sln src/vr.c src/vr.h src/vr_libovr.c |
diffstat | 7 files changed, 48 insertions(+), 40 deletions(-) [+] |
line diff
1.1 --- a/example/example.vcxproj Sat Sep 20 20:12:00 2014 +0300 1.2 +++ b/example/example.vcxproj Wed Sep 24 10:18:42 2014 +0300 1.3 @@ -53,11 +53,13 @@ 1.4 <Optimization>Disabled</Optimization> 1.5 <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> 1.6 <AdditionalIncludeDirectories>$(SolutionDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 1.7 + <DisableSpecificWarnings>4244</DisableSpecificWarnings> 1.8 </ClCompile> 1.9 <Link> 1.10 <SubSystem>Console</SubSystem> 1.11 <GenerateDebugInformation>true</GenerateDebugInformation> 1.12 <AdditionalDependencies>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</AdditionalDependencies> 1.13 + <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> 1.14 </Link> 1.15 </ItemDefinitionGroup> 1.16 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 1.17 @@ -70,6 +72,7 @@ 1.18 <IntrinsicFunctions>true</IntrinsicFunctions> 1.19 <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> 1.20 <AdditionalIncludeDirectories>$(SolutionDir)\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 1.21 + <DisableSpecificWarnings>4244</DisableSpecificWarnings> 1.22 </ClCompile> 1.23 <Link> 1.24 <SubSystem>Console</SubSystem> 1.25 @@ -77,6 +80,7 @@ 1.26 <EnableCOMDATFolding>true</EnableCOMDATFolding> 1.27 <OptimizeReferences>true</OptimizeReferences> 1.28 <AdditionalDependencies>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</AdditionalDependencies> 1.29 + <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> 1.30 </Link> 1.31 </ItemDefinitionGroup> 1.32 <ItemGroup>
2.1 --- a/example/src/main.c Sat Sep 20 20:12:00 2014 +0300 2.2 +++ b/example/src/main.c Wed Sep 24 10:18:42 2014 +0300 2.3 @@ -77,8 +77,8 @@ 2.4 } 2.5 2.6 /* resize our window to match the HMD resolution */ 2.7 - win_width = vr_get_opti(VR_OPT_DISPLAY_WIDTH); 2.8 - win_height = vr_get_opti(VR_OPT_DISPLAY_HEIGHT); 2.9 + win_width = vr_geti(VR_DISPLAY_WIDTH); 2.10 + win_height = vr_geti(VR_DISPLAY_HEIGHT); 2.11 if(!win_width || !win_height) { 2.12 SDL_GetWindowSize(win, &win_width, &win_height); 2.13 } else { 2.14 @@ -87,8 +87,8 @@ 2.15 } 2.16 2.17 /* and create a single render target texture to encompass both eyes */ 2.18 - fb_width = vr_get_opti(VR_OPT_LEYE_XRES) + vr_get_opti(VR_OPT_REYE_XRES); 2.19 - fb_height = vr_get_opti(VR_OPT_LEYE_YRES); /* assuming both are the same */ 2.20 + fb_width = vr_geti(VR_LEYE_XRES) + vr_geti(VR_REYE_XRES); 2.21 + fb_height = vr_geti(VR_LEYE_YRES); /* assuming both are the same */ 2.22 if(!fb_width || !fb_height) { 2.23 fb_width = win_width; 2.24 fb_height = win_height; 2.25 @@ -127,7 +127,7 @@ 2.26 * to the rift's part of the desktop before going fullscreen 2.27 */ 2.28 SDL_GetWindowPosition(win, &prev_x, &prev_y); 2.29 - SDL_SetWindowPosition(win, vr_get_opti(VR_OPT_WIN_XOFFS), vr_get_opti(VR_OPT_WIN_YOFFS)); 2.30 + SDL_SetWindowPosition(win, vr_geti(VR_WIN_XOFFS), vr_geti(VR_WIN_YOFFS)); 2.31 SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP); 2.32 } else { 2.33 /* return to windowed mode and move the window back to its original position */ 2.34 @@ -178,7 +178,7 @@ 2.35 vr_view_matrix(i, view_mat); 2.36 glLoadMatrixf(view_mat); 2.37 /* move the camera to the eye level of the user */ 2.38 - glTranslatef(0, -vr_get_optf(VR_OPT_EYE_HEIGHT), 0); 2.39 + glTranslatef(0, -vr_getf(VR_EYE_HEIGHT), 0); 2.40 2.41 /* finally draw the scene for this eye */ 2.42 draw_scene();
3.1 --- a/libgoatvr.def Sat Sep 20 20:12:00 2014 +0300 3.2 +++ b/libgoatvr.def Wed Sep 24 10:18:42 2014 +0300 3.3 @@ -9,10 +9,10 @@ 3.4 vr_use_module 3.5 vr_use_module_named 3.6 3.7 - vr_set_opti 3.8 - vr_set_optf 3.9 - vr_get_opti 3.10 - vr_get_optf 3.11 + vr_seti 3.12 + vr_setf 3.13 + vr_geti 3.14 + vr_getf 3.15 3.16 vr_view_translation 3.17 vr_view_rotation
4.1 --- a/libgoatvr.sln Sat Sep 20 20:12:00 2014 +0300 4.2 +++ b/libgoatvr.sln Wed Sep 24 10:18:42 2014 +0300 4.3 @@ -8,6 +8,10 @@ 4.4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgoatvr_static", "libgoatvr_static.vcxproj", "{DF0FC238-A249-432C-9163-3778DDE78A62}" 4.5 EndProject 4.6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{7A7B8D81-EB77-49DA-B68D-B117C0A4782B}" 4.7 + ProjectSection(ProjectDependencies) = postProject 4.8 + {DF0FC238-A249-432C-9163-3778DDE78A62} = {DF0FC238-A249-432C-9163-3778DDE78A62} 4.9 + {6AD69AF8-6F44-4D45-A59C-A7A07F6E1CE0} = {6AD69AF8-6F44-4D45-A59C-A7A07F6E1CE0} 4.10 + EndProjectSection 4.11 EndProject 4.12 Global 4.13 GlobalSection(SolutionConfigurationPlatforms) = preSolution
5.1 --- a/src/vr.c Sat Sep 20 20:12:00 2014 +0300 5.2 +++ b/src/vr.c Wed Sep 24 10:18:42 2014 +0300 5.3 @@ -36,8 +36,8 @@ 5.4 5.5 /* create the default options database */ 5.6 if(!defopt && (defopt = create_options())) { 5.7 - set_option_float(defopt, VR_OPT_EYE_HEIGHT, 1.675); 5.8 - set_option_float(defopt, VR_OPT_IPD, 0.064); 5.9 + set_option_float(defopt, VR_EYE_HEIGHT, 1.675); 5.10 + set_option_float(defopt, VR_IPD, 0.064); 5.11 } 5.12 5.13 if(vrm) { 5.14 @@ -115,7 +115,7 @@ 5.15 return -1; 5.16 } 5.17 5.18 -void vr_set_opti(const char *optname, int val) 5.19 +void vr_seti(const char *optname, int val) 5.20 { 5.21 if(vrm && vrm->set_option) { 5.22 vrm->set_option(optname, OTYPE_INT, &val); 5.23 @@ -124,7 +124,7 @@ 5.24 } 5.25 } 5.26 5.27 -void vr_set_optf(const char *optname, float val) 5.28 +void vr_setf(const char *optname, float val) 5.29 { 5.30 if(vrm && vrm->set_option) { 5.31 vrm->set_option(optname, OTYPE_FLOAT, &val); 5.32 @@ -133,7 +133,7 @@ 5.33 } 5.34 } 5.35 5.36 -int vr_get_opti(const char *optname) 5.37 +int vr_geti(const char *optname) 5.38 { 5.39 int res = 0; 5.40 5.41 @@ -143,7 +143,7 @@ 5.42 return res; 5.43 } 5.44 5.45 -float vr_get_optf(const char *optname) 5.46 +float vr_getf(const char *optname) 5.47 { 5.48 float res = 0.0f; 5.49
6.1 --- a/src/vr.h Sat Sep 20 20:12:00 2014 +0300 6.2 +++ b/src/vr.h Wed Sep 24 10:18:42 2014 +0300 6.3 @@ -2,17 +2,17 @@ 6.4 #define VR_H_ 6.5 6.6 /* unit: pixels */ 6.7 -#define VR_OPT_DISPLAY_WIDTH "display-xres" 6.8 -#define VR_OPT_DISPLAY_HEIGHT "display-yres" 6.9 -#define VR_OPT_LEYE_XRES "left-eye-xres" 6.10 -#define VR_OPT_LEYE_YRES "left-eye-yres" 6.11 -#define VR_OPT_REYE_XRES "right-eye-xres" 6.12 -#define VR_OPT_REYE_YRES "right-eye-yres" 6.13 -#define VR_OPT_WIN_XOFFS "win-xoffset" 6.14 -#define VR_OPT_WIN_YOFFS "win-yoffset" 6.15 +#define VR_DISPLAY_WIDTH "display-xres" 6.16 +#define VR_DISPLAY_HEIGHT "display-yres" 6.17 +#define VR_LEYE_XRES "left-eye-xres" 6.18 +#define VR_LEYE_YRES "left-eye-yres" 6.19 +#define VR_REYE_XRES "right-eye-xres" 6.20 +#define VR_REYE_YRES "right-eye-yres" 6.21 +#define VR_WIN_XOFFS "win-xoffset" 6.22 +#define VR_WIN_YOFFS "win-yoffset" 6.23 /* unit: meters */ 6.24 -#define VR_OPT_EYE_HEIGHT "eye-height" 6.25 -#define VR_OPT_IPD "ipd" 6.26 +#define VR_EYE_HEIGHT "eye-height" 6.27 +#define VR_IPD "ipd" 6.28 6.29 enum { 6.30 VR_EYE_LEFT, 6.31 @@ -32,10 +32,10 @@ 6.32 int vr_use_module(int idx); 6.33 int vr_use_module_named(const char *name); 6.34 6.35 -void vr_set_opti(const char *optname, int val); 6.36 -void vr_set_optf(const char *optname, float val); 6.37 -int vr_get_opti(const char *optname); 6.38 -float vr_get_optf(const char *optname); 6.39 +void vr_seti(const char *optname, int val); 6.40 +void vr_setf(const char *optname, float val); 6.41 +int vr_geti(const char *optname); 6.42 +float vr_getf(const char *optname); 6.43 6.44 int vr_view_translation(int eye, float *vec); 6.45 int vr_view_rotation(int eye, float *quat);
7.1 --- a/src/vr_libovr.c Sat Sep 20 20:12:00 2014 +0300 7.2 +++ b/src/vr_libovr.c Wed Sep 24 10:18:42 2014 +0300 7.3 @@ -82,16 +82,16 @@ 7.4 7.5 /* create the options database */ 7.6 if((optdb = create_options())) { 7.7 - set_option_int(optdb, VR_OPT_DISPLAY_WIDTH, hmd->Resolution.w); 7.8 - set_option_int(optdb, VR_OPT_DISPLAY_HEIGHT, hmd->Resolution.h); 7.9 - set_option_int(optdb, VR_OPT_LEYE_XRES, eye_res[0].w); 7.10 - set_option_int(optdb, VR_OPT_LEYE_YRES, eye_res[0].h); 7.11 - set_option_int(optdb, VR_OPT_REYE_XRES, eye_res[1].w); 7.12 - set_option_int(optdb, VR_OPT_REYE_YRES, eye_res[1].h); 7.13 - set_option_float(optdb, VR_OPT_EYE_HEIGHT, ovrHmd_GetFloat(hmd, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT)); 7.14 - set_option_float(optdb, VR_OPT_IPD, ovrHmd_GetFloat(hmd, OVR_KEY_IPD, OVR_DEFAULT_IPD)); 7.15 - set_option_int(optdb, VR_OPT_WIN_XOFFS, hmd->WindowsPos.x); 7.16 - set_option_int(optdb, VR_OPT_WIN_YOFFS, hmd->WindowsPos.y); 7.17 + set_option_int(optdb, VR_DISPLAY_WIDTH, hmd->Resolution.w); 7.18 + set_option_int(optdb, VR_DISPLAY_HEIGHT, hmd->Resolution.h); 7.19 + set_option_int(optdb, VR_LEYE_XRES, eye_res[0].w); 7.20 + set_option_int(optdb, VR_LEYE_YRES, eye_res[0].h); 7.21 + set_option_int(optdb, VR_REYE_XRES, eye_res[1].w); 7.22 + set_option_int(optdb, VR_REYE_YRES, eye_res[1].h); 7.23 + set_option_float(optdb, VR_EYE_HEIGHT, ovrHmd_GetFloat(hmd, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT)); 7.24 + set_option_float(optdb, VR_IPD, ovrHmd_GetFloat(hmd, OVR_KEY_IPD, OVR_DEFAULT_IPD)); 7.25 + set_option_int(optdb, VR_WIN_XOFFS, hmd->WindowsPos.x); 7.26 + set_option_int(optdb, VR_WIN_YOFFS, hmd->WindowsPos.y); 7.27 } 7.28 7.29 deferred_init_done = 0;