-void OculusRiftCombiner::update_parameters()
-{
- left_shdata.uniform4("distortion", distortion);
- left_shdata.uniform4("chromatic", chromatic);
- right_shdata.uniform4("distortion", distortion);
- right_shdata.uniform4("chromatic", chromatic);
-
- // Set lens center positions, in output texture coordinates
- left_shdata.uniform("lens_center", 1.0f-lens_separation, 0.5);
- right_shdata.uniform("lens_center", lens_separation, 0.5);
-
- /* Compute distance between eye and lens centers, in sampling texture
- coordinates. */
- float eye_offset = distort((eye_separation-lens_separation)*2);
- left_shdata.uniform("eye_center", -eye_offset, 0.0f);
- right_shdata.uniform("eye_center", eye_offset, 0.0f);
-
- /* Determine the necessary scaling factor to avoid quality degradation in
- the center of the screen. */
- float horiz_oversize = distort((fill_factor-lens_separation)*2)-eye_offset;
- float vert_oversize = distort(1.25f*fill_factor)/(1.25f*fill_factor);
- oversize = min(horiz_oversize, vert_oversize);
-
- left_shdata.uniform("scale", 2.0f, 2.5f, oversize);
- right_shdata.uniform("scale", 2.0f, 2.5f, oversize);
-
- fov = Geometry::atan(oversize*0.625f/view_distance)*2.0f;
-}
+ ovrSizei tex_size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Left, left_fov, 1.0);
+ width_factor = tex_size.w*1.0f/hmd->Resolution.w;
+ height_factor = tex_size.h*1.0f/hmd->Resolution.h;
+ float aspect = (inner+outer)/(vertical*2);
+ aspect_factor = aspect*hmd->Resolution.h/hmd->Resolution.w;