]> git.tdb.fi Git - libs/vr.git/blobdiff - source/oculusriftcombiner.cpp
Make the StereoCombiner information interface more flexible
[libs/vr.git] / source / oculusriftcombiner.cpp
index e6b2908655a9a5d08520124b29e0a7dcbfe3ab21..492f5fdbcb220ee40b5f73207fb0f7ee6a94a12c 100644 (file)
@@ -78,8 +78,6 @@ OculusRiftCombiner::OculusRiftCombiner(const OculusRiftDevice &d):
        right_mesh((GL::VERTEX2, GL::TEXCOORD2,0, GL::TEXCOORD2,1, GL::TEXCOORD2,2)),
        shprog(vs_source, fs_source)
 {
-       width_div = 2;
-
        const OculusRiftDevice::Private &dev_priv = device.get_private();
        ovrHmd hmd = dev_priv.ovr_hmd;
 
@@ -101,7 +99,10 @@ OculusRiftCombiner::OculusRiftCombiner(const OculusRiftDevice &d):
        create_distortion_mesh(right_mesh, hmd, ovrEye_Right, right_fov);
 
        ovrSizei tex_size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Left, left_fov, 1.0);
-       oversize = max(tex_size.w*2.0f/hmd->Resolution.w, tex_size.h*1.0f/hmd->Resolution.h);
+       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;
 
        shdata.uniform("texture", 0);