From: Mikko Rasa Date: Mon, 22 Dec 2014 23:18:03 +0000 (+0200) Subject: Have the device optionally initialize certain parameters of StereoView X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d8b7f621f37d8bcad572b06f7288084b5ad6eb8c;p=libs%2Fvr.git Have the device optionally initialize certain parameters of StereoView --- diff --git a/source/displaydevice.h b/source/displaydevice.h index 8bd960d..b309a83 100644 --- a/source/displaydevice.h +++ b/source/displaydevice.h @@ -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; }; diff --git a/source/oculusriftdevice.cpp b/source/oculusriftdevice.cpp index 9857f78..f521a0e 100644 --- a/source/oculusriftdevice.cpp +++ b/source/oculusriftdevice.cpp @@ -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); diff --git a/source/oculusriftdevice.h b/source/oculusriftdevice.h index 41b721e..ecff70e 100644 --- a/source/oculusriftdevice.h +++ b/source/oculusriftdevice.h @@ -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; }; diff --git a/source/stereoview.cpp b/source/stereoview.cpp index dd825ed..4586f29 100644 --- a/source/stereoview.cpp +++ b/source/stereoview.cpp @@ -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)