libgoatvr
diff src/vr_libovr.c @ 15:27fcd4c2969d
added VR_EYE_RES_SCALE option
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 25 Sep 2014 08:50:50 +0300 |
parents | 604a9a0a8c37 |
children | b2d902fff68d |
line diff
1.1 --- a/src/vr_libovr.c Thu Sep 25 07:52:49 2014 +0300 1.2 +++ b/src/vr_libovr.c Thu Sep 25 08:50:50 2014 +0300 1.3 @@ -91,6 +91,7 @@ 1.4 set_option_int(optdb, VR_LEYE_YRES, eye_res[0].h); 1.5 set_option_int(optdb, VR_REYE_XRES, eye_res[1].w); 1.6 set_option_int(optdb, VR_REYE_YRES, eye_res[1].h); 1.7 + set_option_float(optdb, VR_EYE_RES_SCALE, 1.0); 1.8 set_option_float(optdb, VR_EYE_HEIGHT, ovrHmd_GetFloat(hmd, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT)); 1.9 set_option_float(optdb, VR_IPD, ovrHmd_GetFloat(hmd, OVR_KEY_IPD, OVR_DEFAULT_IPD)); 1.10 set_option_int(optdb, VR_WIN_XOFFS, hmd->WindowsPos.x); 1.11 @@ -152,15 +153,30 @@ 1.12 1.13 static int set_option(const char *opt, enum opt_type type, void *valp) 1.14 { 1.15 + float fval; 1.16 + 1.17 switch(type) { 1.18 case OTYPE_INT: 1.19 + fval = (float)*(int*)valp; 1.20 set_option_int(optdb, opt, *(int*)valp); 1.21 break; 1.22 1.23 case OTYPE_FLOAT: 1.24 - set_option_float(optdb, opt, *(float*)valp); 1.25 + fval = *(float*)valp; 1.26 + set_option_float(optdb, opt, fval); 1.27 break; 1.28 } 1.29 + 1.30 + if(hmd && strcmp(opt, VR_EYE_RES_SCALE) == 0) { 1.31 + eye_res[0] = ovrHmd_GetFovTextureSize(hmd, ovrEye_Left, eye_fov[0], fval); 1.32 + eye_res[1] = ovrHmd_GetFovTextureSize(hmd, ovrEye_Right, eye_fov[1], fval); 1.33 + 1.34 + set_option_int(optdb, VR_LEYE_XRES, eye_res[0].w); 1.35 + set_option_int(optdb, VR_LEYE_YRES, eye_res[0].h); 1.36 + set_option_int(optdb, VR_REYE_XRES, eye_res[1].w); 1.37 + set_option_int(optdb, VR_REYE_YRES, eye_res[1].h); 1.38 + } 1.39 + 1.40 return 0; 1.41 } 1.42