]> git.tdb.fi Git - libs/vr.git/commitdiff
Have the device optionally initialize certain parameters of StereoView
authorMikko Rasa <tdb@tdb.fi>
Mon, 22 Dec 2014 23:18:03 +0000 (01:18 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 22 Dec 2014 23:18:03 +0000 (01:18 +0200)
source/displaydevice.h
source/oculusriftdevice.cpp
source/oculusriftdevice.h
source/stereoview.cpp

index 8bd960d741bbe1938ab47d98f876579be4d06b79..b309a8341bd1f01afafe7c8f54ec1c3af3654e12 100644 (file)
@@ -8,6 +8,7 @@ namespace VR {
 
 class HeadTrackingCamera;
 class StereoCombiner;
+class StereoView;
 
 class DisplayDevice
 {
@@ -16,6 +17,7 @@ protected:
 public:
        virtual ~DisplayDevice() { }
 
+       virtual void configure_view(StereoView &) const = 0;
        virtual HeadTrackingCamera *create_camera(const GL::Camera &) const = 0;
        virtual StereoCombiner *create_combiner() const = 0;
 };
index 9857f78f2f3c7eb933fde613c211a6ba3af268d0..f521a0e18ba86ec423022526806968fca65933b6 100644 (file)
@@ -1,5 +1,6 @@
 #include "oculusriftdevice.h"
 #include "oculusriftdevice_private.h"
+#include "stereoview.h"
 
 using namespace std;
 
@@ -33,6 +34,13 @@ OculusRiftDevice::~OculusRiftDevice()
                ovr_Shutdown();
 }
 
+void OculusRiftDevice::configure_view(StereoView &view) const
+{
+       ovrEyeRenderDesc left_desc = ovrHmd_GetRenderDesc(priv->ovr_hmd, ovrEye_Left, priv->ovr_hmd->DefaultEyeFov[ovrEye_Left]);
+       ovrEyeRenderDesc right_desc = ovrHmd_GetRenderDesc(priv->ovr_hmd, ovrEye_Right, priv->ovr_hmd->DefaultEyeFov[ovrEye_Left]);
+       view.set_eye_spacing(left_desc.HmdToEyeViewOffset.x-right_desc.HmdToEyeViewOffset.x);
+}
+
 OculusRiftCamera *OculusRiftDevice::create_camera(const GL::Camera &bc) const
 {
        return new OculusRiftCamera(*this, bc);
index 41b721e3e940a771c7148a10b24f86e584a0bbff..ecff70ea4401a8a26cafed39e6f5458b7da104b0 100644 (file)
@@ -24,6 +24,7 @@ public:
 
        const Private &get_private() const { return *priv; }
 
+       virtual void configure_view(StereoView &) const;
        virtual OculusRiftCamera *create_camera(const GL::Camera &) const;
        virtual OculusRiftCombiner *create_combiner() const;
 };
index dd825ed1f276839cb76c614215ca15b1d4776a55..4586f29d97ee7966ab1fa9104c6c5ed762637ede 100644 (file)
@@ -15,7 +15,7 @@ StereoView::StereoView(unsigned w, unsigned h, const GL::Camera &c, const GL::Re
        combiner(0)
 {
        set_combiner(m);
-       set_eye_spacing(0.07);
+       set_eye_spacing(0.064);
 }
 
 void StereoView::set_combiner(const StereoCombiner &c)