@@ -67,6 +67,8 @@ static const char * const k_pch_Sample_DistortionK1_Float = "DistortionK1";
6767static const char * const k_pch_Sample_DistortionK2_Float = " DistortionK2" ;
6868static const char * const k_pch_Sample_ZoomWidth_Float = " ZoomWidth" ;
6969static const char * const k_pch_Sample_ZoomHeight_Float = " ZoomHeight" ;
70+ static const char * const k_pch_Sample_DistanceBetweenEyes_Int32 = " DistanceBetweenEyes" ;
71+ static const char * const k_pch_Sample_ScreenOffsetX_Int32 = " ScreenOffsetX" ;
7072static const char * const k_pch_Sample_DebugMode_Bool = " DebugMode" ;
7173
7274#define FREETRACK_HEAP " FT_SharedMem"
@@ -121,7 +123,7 @@ FTData *FreeTrack;
121123bool HMDConnected = false ;
122124std::thread *pFTthread = NULL ;
123125
124- // FreeTrack implementation from https://github.com/opentrack/opentrack/tree/unstable/freetrackclient
126+ // FreeTrack implementation from OpenTrack ( https://github.com/opentrack/opentrack/tree/unstable/freetrackclient)
125127static BOOL impl_create_mapping (void )
126128{
127129 if (ipc_heap != NULL )
@@ -273,6 +275,8 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
273275 m_fDistortionK2 = vr::VRSettings ()->GetFloat (k_pch_Sample_Section, k_pch_Sample_DistortionK2_Float);
274276 m_fZoomWidth = vr::VRSettings ()->GetFloat (k_pch_Sample_Section, k_pch_Sample_ZoomWidth_Float);
275277 m_fZoomHeight = vr::VRSettings ()->GetFloat (k_pch_Sample_Section, k_pch_Sample_ZoomHeight_Float);
278+ m_nDistanceBetweenEyes = vr::VRSettings ()->GetFloat (k_pch_Sample_Section, k_pch_Sample_DistanceBetweenEyes_Int32);
279+ m_nScreenOffsetX = vr::VRSettings ()->GetFloat (k_pch_Sample_Section, k_pch_Sample_ScreenOffsetX_Int32);
276280 m_bDebugMode = vr::VRSettings ()->GetBool (k_pch_Sample_Section, k_pch_Sample_DebugMode_Bool);
277281
278282 // DriverLog( "driver_null: Serial Number: %s\n", m_sSerialNumber.c_str() );
@@ -317,7 +321,7 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
317321 // avoid "not fullscreen" warnings from vrmonitor
318322 vr::VRProperties ()->SetBoolProperty ( m_ulPropertyContainer, Prop_IsOnDesktop_Bool, false );
319323
320- // Debug mode activate Windowed Mode (borderless fullscreen) on "Headset Window" and you can move window to second screen with buttons (Shift + Win + Right or Left), but lock to 30 FPS
324+ // Debug mode activate Windowed Mode (borderless fullscreen), lock to 30 FPS
321325 vr::VRProperties ()->SetBoolProperty (m_ulPropertyContainer, Prop_DisplayDebugMode_Bool, m_bDebugMode);
322326 // Icons can be configured in code or automatically configured by an external file "drivername\resources\driver.vrresources".
323327 // Icon properties NOT configured in code (post Activate) are then auto-configured by the optional presence of a driver's "drivername\resources\driver.vrresources".
@@ -418,17 +422,17 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
418422
419423 virtual void GetEyeOutputViewport ( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight )
420424 {
421- *pnY = 0 ;
425+ *pnY = m_nScreenOffsetX ;
422426 *pnWidth = m_nWindowWidth / 2 ;
423427 *pnHeight = m_nWindowHeight;
424-
425- if ( eEye == Eye_Left )
428+
429+ if (eEye == Eye_Left)
426430 {
427- *pnX = 0 ;
431+ *pnX = m_nDistanceBetweenEyes ;
428432 }
429433 else
430434 {
431- *pnX = m_nWindowWidth / 2 ;
435+ *pnX = ( m_nWindowWidth / 2 ) - m_nDistanceBetweenEyes ;
432436 }
433437 }
434438
@@ -534,6 +538,8 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
534538 float m_fDistortionK2;
535539 float m_fZoomWidth;
536540 float m_fZoomHeight;
541+ int32_t m_nDistanceBetweenEyes;
542+ int32_t m_nScreenOffsetX;
537543 bool m_bDebugMode;
538544};
539545
0 commit comments