libgoatvr

diff src/vr_libovr.c @ 21:7f9cc8a4d3a5

ported the libovr backend to 0.4.4
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 12 Jan 2015 07:16:39 +0200
parents 437fe32ac633
children d659cbedde1d
line diff
     1.1 --- a/src/vr_libovr.c	Sat Oct 11 07:18:07 2014 +0300
     1.2 +++ b/src/vr_libovr.c	Mon Jan 12 07:16:39 2015 +0200
     1.3 @@ -119,7 +119,7 @@
     1.4  
     1.5  	memset(&glcfg, 0, sizeof glcfg);
     1.6  	glcfg.OGL.Header.API = ovrRenderAPI_OpenGL;
     1.7 -	glcfg.OGL.Header.RTSize = hmd->Resolution;
     1.8 +	glcfg.OGL.Header.BackBufferSize = hmd->Resolution;
     1.9  	glcfg.OGL.Header.Multisample = 1;
    1.10  #ifdef WIN32
    1.11  	win = GetActiveWindow();
    1.12 @@ -137,7 +137,7 @@
    1.13  	}
    1.14  	ovrHmd_SetEnabledCaps(hmd, ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction);
    1.15  
    1.16 -	dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp |
    1.17 +	dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_TimeWarp |
    1.18  		ovrDistortionCap_Overdrive | ovrDistortionCap_NoRestore;
    1.19  
    1.20  	if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, dcaps, eye_fov, eye_render_desc)) {
    1.21 @@ -145,13 +145,13 @@
    1.22  	}
    1.23  
    1.24  	/* set the eye offset options */
    1.25 -	leye_offs[0] = eye_render_desc[ovrEye_Left].ViewAdjust.x;
    1.26 -	leye_offs[1] = eye_render_desc[ovrEye_Left].ViewAdjust.y;
    1.27 -	leye_offs[2] = eye_render_desc[ovrEye_Left].ViewAdjust.z;
    1.28 +	leye_offs[0] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.x;
    1.29 +	leye_offs[1] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.y;
    1.30 +	leye_offs[2] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.z;
    1.31  	set_option_vec(optdb, VR_LEYE_OFFSET, leye_offs);
    1.32 -	reye_offs[0] = eye_render_desc[ovrEye_Right].ViewAdjust.x;
    1.33 -	reye_offs[1] = eye_render_desc[ovrEye_Right].ViewAdjust.y;
    1.34 -	reye_offs[2] = eye_render_desc[ovrEye_Right].ViewAdjust.z;
    1.35 +	reye_offs[0] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.x;
    1.36 +	reye_offs[1] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.y;
    1.37 +	reye_offs[2] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.z;
    1.38  	set_option_vec(optdb, VR_REYE_OFFSET, reye_offs);
    1.39  
    1.40  #ifdef DISABLE_RETARDED_HEALTH_WARNING
    1.41 @@ -219,7 +219,7 @@
    1.42  	 * reuse the one we got last frame.
    1.43  	 */
    1.44  	if(inside_begin_end) {
    1.45 -		pose[eye] = ovrHmd_GetEyePose(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right);
    1.46 +		pose[eye] = ovrHmd_GetHmdPosePerEye(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right);
    1.47  	}
    1.48  
    1.49  	vec[0] = pose[eye].Position.x;
    1.50 @@ -237,7 +237,7 @@
    1.51  
    1.52  	/* same as above (translation) */
    1.53  	if(inside_begin_end) {
    1.54 -		pose[eye] = ovrHmd_GetEyePose(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right);
    1.55 +		pose[eye] = ovrHmd_GetHmdPosePerEye(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right);
    1.56  	}
    1.57  
    1.58  	quat[0] = pose[eye].Orientation.x;
    1.59 @@ -301,7 +301,7 @@
    1.60  	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texsz.h);
    1.61  
    1.62  	rect.Pos.x = (int)(umin * texsz.w);
    1.63 -	rect.Pos.y = (int)((vmin + 1.0 - vmax) * texsz.h);
    1.64 +	rect.Pos.y = (int)(vmin * texsz.h);
    1.65  	rect.Size.w = (int)((umax - umin) * texsz.w);
    1.66  	rect.Size.h = (int)((vmax - vmin) * texsz.h);
    1.67