Implemented vsync tick for event loops
This commit is contained in:
+216
-207
@@ -495,7 +495,7 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
|||||||
SLOT( OnTimeoutPumpEvents() ) );
|
SLOT( OnTimeoutPumpEvents() ) );
|
||||||
|
|
||||||
// was m_pPumpEventsTimer->setInterval( 20 );
|
// was m_pPumpEventsTimer->setInterval( 20 );
|
||||||
m_pPumpEventsTimer->setInterval( 5 );
|
m_pPumpEventsTimer->setInterval( 1 );
|
||||||
|
|
||||||
m_pPumpEventsTimer->start();
|
m_pPumpEventsTimer->start();
|
||||||
|
|
||||||
@@ -580,226 +580,235 @@ QPoint OverlayController::getMousePositionForEvent( vr::VREvent_Mouse_t mouse )
|
|||||||
|
|
||||||
void OverlayController::OnTimeoutPumpEvents()
|
void OverlayController::OnTimeoutPumpEvents()
|
||||||
{
|
{
|
||||||
if ( !vr::VRSystem() )
|
vr::VRSystem()->GetTimeSinceLastVsync( nullptr, &m_currentFrame );
|
||||||
return;
|
|
||||||
|
|
||||||
vr::VREvent_t vrEvent;
|
if ( m_currentFrame > m_lastFrame )
|
||||||
bool chaperoneDataAlreadyUpdated = false;
|
|
||||||
while ( pollNextEvent( m_ulOverlayHandle, &vrEvent ) )
|
|
||||||
{
|
{
|
||||||
switch ( vrEvent.eventType )
|
if ( !vr::VRSystem() )
|
||||||
{
|
|
||||||
case vr::VREvent_MouseMove:
|
|
||||||
{
|
|
||||||
QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse );
|
|
||||||
if ( ptNewMouse != m_ptLastMouse )
|
|
||||||
{
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseMove,
|
|
||||||
ptNewMouse,
|
|
||||||
m_pWindow->mapToGlobal( ptNewMouse ),
|
|
||||||
Qt::NoButton,
|
|
||||||
m_lastMouseButtons,
|
|
||||||
0 );
|
|
||||||
m_ptLastMouse = ptNewMouse;
|
|
||||||
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
|
||||||
OnRenderRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_MouseButtonDown:
|
|
||||||
{
|
|
||||||
QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse );
|
|
||||||
Qt::MouseButton button
|
|
||||||
= vrEvent.data.mouse.button == vr::VRMouseButton_Right
|
|
||||||
? Qt::RightButton
|
|
||||||
: Qt::LeftButton;
|
|
||||||
m_lastMouseButtons |= button;
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseButtonPress,
|
|
||||||
ptNewMouse,
|
|
||||||
m_pWindow->mapToGlobal( ptNewMouse ),
|
|
||||||
button,
|
|
||||||
m_lastMouseButtons,
|
|
||||||
0 );
|
|
||||||
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_MouseButtonUp:
|
|
||||||
{
|
|
||||||
QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse );
|
|
||||||
Qt::MouseButton button
|
|
||||||
= vrEvent.data.mouse.button == vr::VRMouseButton_Right
|
|
||||||
? Qt::RightButton
|
|
||||||
: Qt::LeftButton;
|
|
||||||
m_lastMouseButtons &= ~button;
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseButtonRelease,
|
|
||||||
ptNewMouse,
|
|
||||||
m_pWindow->mapToGlobal( ptNewMouse ),
|
|
||||||
button,
|
|
||||||
m_lastMouseButtons,
|
|
||||||
0 );
|
|
||||||
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_Scroll:
|
|
||||||
{
|
|
||||||
// Wheel speed is defined as 1/8 of a degree
|
|
||||||
QWheelEvent wheelEvent(
|
|
||||||
m_ptLastMouse,
|
|
||||||
m_pWindow->mapToGlobal( m_ptLastMouse ),
|
|
||||||
QPoint(),
|
|
||||||
QPoint( vrEvent.data.scroll.xdelta * 360.0f * 8.0f,
|
|
||||||
vrEvent.data.scroll.ydelta * 360.0f * 8.0f ),
|
|
||||||
0,
|
|
||||||
Qt::Vertical,
|
|
||||||
m_lastMouseButtons,
|
|
||||||
0 );
|
|
||||||
QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_OverlayShown:
|
|
||||||
{
|
|
||||||
m_pWindow->update();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_Quit:
|
|
||||||
{
|
|
||||||
LOG( INFO ) << "Received quit request.";
|
|
||||||
vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some time
|
|
||||||
// just in case
|
|
||||||
m_moveCenterTabController.reset();
|
|
||||||
m_chaperoneTabController.shutdown();
|
|
||||||
Shutdown();
|
|
||||||
QApplication::exit();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_DashboardActivated:
|
vr::VREvent_t vrEvent;
|
||||||
{
|
bool chaperoneDataAlreadyUpdated = false;
|
||||||
LOG( DEBUG ) << "Dashboard activated";
|
while ( pollNextEvent( m_ulOverlayHandle, &vrEvent ) )
|
||||||
m_dashboardVisible = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_DashboardDeactivated:
|
|
||||||
{
|
|
||||||
LOG( DEBUG ) << "Dashboard deactivated";
|
|
||||||
m_dashboardVisible = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case vr::VREvent_KeyboardDone:
|
|
||||||
{
|
|
||||||
char keyboardBuffer[1024];
|
|
||||||
vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 );
|
|
||||||
emit keyBoardInputSignal( QString( keyboardBuffer ),
|
|
||||||
vrEvent.data.keyboard.uUserValue );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Multiple ChaperoneUniverseHasChanged are often emitted at the same
|
|
||||||
// time (some with a little bit of delay) There is no sure way to
|
|
||||||
// recognize redundant events, we can only exclude redundant events
|
|
||||||
// during the same call of OnTimeoutPumpEvents()
|
|
||||||
// INFO Removed logging on play space mover for possible crashing
|
|
||||||
// issues.
|
|
||||||
case vr::VREvent_ChaperoneUniverseHasChanged:
|
|
||||||
case vr::VREvent_ChaperoneDataHasChanged:
|
|
||||||
{
|
|
||||||
if ( !chaperoneDataAlreadyUpdated )
|
|
||||||
{
|
|
||||||
// LOG(INFO) << "Re-loading chaperone data ...";
|
|
||||||
m_chaperoneUtils.loadChaperoneData();
|
|
||||||
// LOG(INFO) << "Found " << m_chaperoneUtils.quadsCount() << "
|
|
||||||
// chaperone quads."; if
|
|
||||||
// (m_chaperoneUtils.isChaperoneWellFormed()) { LOG(INFO) <<
|
|
||||||
// "Chaperone data seems to be well-formed.";
|
|
||||||
//} else {
|
|
||||||
// LOG(INFO) << "Chaperone data is NOT well-formed.";
|
|
||||||
//}
|
|
||||||
chaperoneDataAlreadyUpdated = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vr::TrackedDevicePose_t devicePoses[vr::k_unMaxTrackedDeviceCount];
|
|
||||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
|
||||||
vr::TrackingUniverseStanding,
|
|
||||||
0.0f,
|
|
||||||
devicePoses,
|
|
||||||
vr::k_unMaxTrackedDeviceCount );
|
|
||||||
|
|
||||||
// HMD/Controller Velocities
|
|
||||||
auto leftId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
|
||||||
vr::TrackedControllerRole_LeftHand );
|
|
||||||
float leftSpeed = 0.0f;
|
|
||||||
if ( leftId != vr::k_unTrackedDeviceIndexInvalid
|
|
||||||
&& devicePoses[leftId].bPoseIsValid
|
|
||||||
&& devicePoses[leftId].eTrackingResult
|
|
||||||
== vr::TrackingResult_Running_OK )
|
|
||||||
{
|
|
||||||
auto& vel = devicePoses[leftId].vVelocity.v;
|
|
||||||
leftSpeed
|
|
||||||
= std::sqrt( vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2] );
|
|
||||||
}
|
|
||||||
auto rightId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
|
||||||
vr::TrackedControllerRole_RightHand );
|
|
||||||
auto rightSpeed = 0.0f;
|
|
||||||
if ( rightId != vr::k_unTrackedDeviceIndexInvalid
|
|
||||||
&& devicePoses[rightId].bPoseIsValid
|
|
||||||
&& devicePoses[rightId].eTrackingResult
|
|
||||||
== vr::TrackingResult_Running_OK )
|
|
||||||
{
|
|
||||||
auto& vel = devicePoses[rightId].vVelocity.v;
|
|
||||||
rightSpeed
|
|
||||||
= std::sqrt( vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2] );
|
|
||||||
}
|
|
||||||
auto hmdSpeed = 0.0f;
|
|
||||||
if ( devicePoses[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid
|
|
||||||
&& devicePoses[vr::k_unTrackedDeviceIndex_Hmd].eTrackingResult
|
|
||||||
== vr::TrackingResult_Running_OK )
|
|
||||||
{
|
|
||||||
auto& vel = devicePoses[vr::k_unTrackedDeviceIndex_Hmd].vVelocity.v;
|
|
||||||
hmdSpeed
|
|
||||||
= std::sqrt( vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2] );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_fixFloorTabController.eventLoopTick( devicePoses );
|
|
||||||
m_statisticsTabController.eventLoopTick(
|
|
||||||
devicePoses, leftSpeed, rightSpeed );
|
|
||||||
m_moveCenterTabController.eventLoopTick(
|
|
||||||
vr::VRCompositor()->GetTrackingSpace(), devicePoses );
|
|
||||||
m_steamVRTabController.eventLoopTick();
|
|
||||||
m_chaperoneTabController.eventLoopTick(
|
|
||||||
devicePoses, leftSpeed, rightSpeed, hmdSpeed );
|
|
||||||
m_settingsTabController.eventLoopTick();
|
|
||||||
m_reviveTabController.eventLoopTick();
|
|
||||||
m_audioTabController.eventLoopTick();
|
|
||||||
m_utilitiesTabController.eventLoopTick();
|
|
||||||
m_accessibilityTabController.eventLoopTick(
|
|
||||||
vr::VRCompositor()->GetTrackingSpace() );
|
|
||||||
|
|
||||||
if ( m_ulOverlayThumbnailHandle != vr::k_ulOverlayHandleInvalid )
|
|
||||||
{
|
|
||||||
while ( vr::VROverlay()->PollNextOverlayEvent(
|
|
||||||
m_ulOverlayThumbnailHandle, &vrEvent, sizeof( vrEvent ) ) )
|
|
||||||
{
|
{
|
||||||
switch ( vrEvent.eventType )
|
switch ( vrEvent.eventType )
|
||||||
{
|
{
|
||||||
|
case vr::VREvent_MouseMove:
|
||||||
|
{
|
||||||
|
QPoint ptNewMouse
|
||||||
|
= getMousePositionForEvent( vrEvent.data.mouse );
|
||||||
|
if ( ptNewMouse != m_ptLastMouse )
|
||||||
|
{
|
||||||
|
QMouseEvent mouseEvent(
|
||||||
|
QEvent::MouseMove,
|
||||||
|
ptNewMouse,
|
||||||
|
m_pWindow->mapToGlobal( ptNewMouse ),
|
||||||
|
Qt::NoButton,
|
||||||
|
m_lastMouseButtons,
|
||||||
|
0 );
|
||||||
|
m_ptLastMouse = ptNewMouse;
|
||||||
|
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
||||||
|
OnRenderRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_MouseButtonDown:
|
||||||
|
{
|
||||||
|
QPoint ptNewMouse
|
||||||
|
= getMousePositionForEvent( vrEvent.data.mouse );
|
||||||
|
Qt::MouseButton button
|
||||||
|
= vrEvent.data.mouse.button == vr::VRMouseButton_Right
|
||||||
|
? Qt::RightButton
|
||||||
|
: Qt::LeftButton;
|
||||||
|
m_lastMouseButtons |= button;
|
||||||
|
QMouseEvent mouseEvent( QEvent::MouseButtonPress,
|
||||||
|
ptNewMouse,
|
||||||
|
m_pWindow->mapToGlobal( ptNewMouse ),
|
||||||
|
button,
|
||||||
|
m_lastMouseButtons,
|
||||||
|
0 );
|
||||||
|
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_MouseButtonUp:
|
||||||
|
{
|
||||||
|
QPoint ptNewMouse
|
||||||
|
= getMousePositionForEvent( vrEvent.data.mouse );
|
||||||
|
Qt::MouseButton button
|
||||||
|
= vrEvent.data.mouse.button == vr::VRMouseButton_Right
|
||||||
|
? Qt::RightButton
|
||||||
|
: Qt::LeftButton;
|
||||||
|
m_lastMouseButtons &= ~button;
|
||||||
|
QMouseEvent mouseEvent( QEvent::MouseButtonRelease,
|
||||||
|
ptNewMouse,
|
||||||
|
m_pWindow->mapToGlobal( ptNewMouse ),
|
||||||
|
button,
|
||||||
|
m_lastMouseButtons,
|
||||||
|
0 );
|
||||||
|
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_Scroll:
|
||||||
|
{
|
||||||
|
// Wheel speed is defined as 1/8 of a degree
|
||||||
|
QWheelEvent wheelEvent(
|
||||||
|
m_ptLastMouse,
|
||||||
|
m_pWindow->mapToGlobal( m_ptLastMouse ),
|
||||||
|
QPoint(),
|
||||||
|
QPoint( vrEvent.data.scroll.xdelta * 360.0f * 8.0f,
|
||||||
|
vrEvent.data.scroll.ydelta * 360.0f * 8.0f ),
|
||||||
|
0,
|
||||||
|
Qt::Vertical,
|
||||||
|
m_lastMouseButtons,
|
||||||
|
0 );
|
||||||
|
QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case vr::VREvent_OverlayShown:
|
case vr::VREvent_OverlayShown:
|
||||||
{
|
{
|
||||||
m_pWindow->update();
|
m_pWindow->update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_Quit:
|
||||||
|
{
|
||||||
|
LOG( INFO ) << "Received quit request.";
|
||||||
|
vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some
|
||||||
|
// time just in case
|
||||||
|
m_moveCenterTabController.reset();
|
||||||
|
m_chaperoneTabController.shutdown();
|
||||||
|
Shutdown();
|
||||||
|
QApplication::exit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_DashboardActivated:
|
||||||
|
{
|
||||||
|
LOG( DEBUG ) << "Dashboard activated";
|
||||||
|
m_dashboardVisible = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_DashboardDeactivated:
|
||||||
|
{
|
||||||
|
LOG( DEBUG ) << "Dashboard deactivated";
|
||||||
|
m_dashboardVisible = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_KeyboardDone:
|
||||||
|
{
|
||||||
|
char keyboardBuffer[1024];
|
||||||
|
vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 );
|
||||||
|
emit keyBoardInputSignal( QString( keyboardBuffer ),
|
||||||
|
vrEvent.data.keyboard.uUserValue );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Multiple ChaperoneUniverseHasChanged are often emitted at the
|
||||||
|
// same time (some with a little bit of delay) There is no sure way
|
||||||
|
// to recognize redundant events, we can only exclude redundant
|
||||||
|
// events during the same call of OnTimeoutPumpEvents() INFO Removed
|
||||||
|
// logging on play space mover for possible crashing issues.
|
||||||
|
case vr::VREvent_ChaperoneUniverseHasChanged:
|
||||||
|
case vr::VREvent_ChaperoneDataHasChanged:
|
||||||
|
{
|
||||||
|
if ( !chaperoneDataAlreadyUpdated )
|
||||||
|
{
|
||||||
|
// LOG(INFO) << "Re-loading chaperone data ...";
|
||||||
|
m_chaperoneUtils.loadChaperoneData();
|
||||||
|
// LOG(INFO) << "Found " << m_chaperoneUtils.quadsCount() <<
|
||||||
|
// " chaperone quads."; if
|
||||||
|
// (m_chaperoneUtils.isChaperoneWellFormed()) { LOG(INFO) <<
|
||||||
|
// "Chaperone data seems to be well-formed.";
|
||||||
|
//} else {
|
||||||
|
// LOG(INFO) << "Chaperone data is NOT well-formed.";
|
||||||
|
//}
|
||||||
|
chaperoneDataAlreadyUpdated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vr::TrackedDevicePose_t devicePoses[vr::k_unMaxTrackedDeviceCount];
|
||||||
|
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||||
|
vr::TrackingUniverseStanding,
|
||||||
|
0.0f,
|
||||||
|
devicePoses,
|
||||||
|
vr::k_unMaxTrackedDeviceCount );
|
||||||
|
|
||||||
|
// HMD/Controller Velocities
|
||||||
|
auto leftId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||||
|
vr::TrackedControllerRole_LeftHand );
|
||||||
|
float leftSpeed = 0.0f;
|
||||||
|
if ( leftId != vr::k_unTrackedDeviceIndexInvalid
|
||||||
|
&& devicePoses[leftId].bPoseIsValid
|
||||||
|
&& devicePoses[leftId].eTrackingResult
|
||||||
|
== vr::TrackingResult_Running_OK )
|
||||||
|
{
|
||||||
|
auto& vel = devicePoses[leftId].vVelocity.v;
|
||||||
|
leftSpeed = std::sqrt( vel[0] * vel[0] + vel[1] * vel[1]
|
||||||
|
+ vel[2] * vel[2] );
|
||||||
|
}
|
||||||
|
auto rightId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||||
|
vr::TrackedControllerRole_RightHand );
|
||||||
|
auto rightSpeed = 0.0f;
|
||||||
|
if ( rightId != vr::k_unTrackedDeviceIndexInvalid
|
||||||
|
&& devicePoses[rightId].bPoseIsValid
|
||||||
|
&& devicePoses[rightId].eTrackingResult
|
||||||
|
== vr::TrackingResult_Running_OK )
|
||||||
|
{
|
||||||
|
auto& vel = devicePoses[rightId].vVelocity.v;
|
||||||
|
rightSpeed = std::sqrt( vel[0] * vel[0] + vel[1] * vel[1]
|
||||||
|
+ vel[2] * vel[2] );
|
||||||
|
}
|
||||||
|
auto hmdSpeed = 0.0f;
|
||||||
|
if ( devicePoses[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid
|
||||||
|
&& devicePoses[vr::k_unTrackedDeviceIndex_Hmd].eTrackingResult
|
||||||
|
== vr::TrackingResult_Running_OK )
|
||||||
|
{
|
||||||
|
auto& vel = devicePoses[vr::k_unTrackedDeviceIndex_Hmd].vVelocity.v;
|
||||||
|
hmdSpeed = std::sqrt( vel[0] * vel[0] + vel[1] * vel[1]
|
||||||
|
+ vel[2] * vel[2] );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_moveCenterTabController.eventLoopTick(
|
||||||
|
vr::VRCompositor()->GetTrackingSpace(), devicePoses );
|
||||||
|
m_utilitiesTabController.eventLoopTick();
|
||||||
|
m_fixFloorTabController.eventLoopTick( devicePoses );
|
||||||
|
m_statisticsTabController.eventLoopTick(
|
||||||
|
devicePoses, leftSpeed, rightSpeed );
|
||||||
|
m_steamVRTabController.eventLoopTick();
|
||||||
|
m_chaperoneTabController.eventLoopTick(
|
||||||
|
devicePoses, leftSpeed, rightSpeed, hmdSpeed );
|
||||||
|
m_settingsTabController.eventLoopTick();
|
||||||
|
m_reviveTabController.eventLoopTick();
|
||||||
|
m_audioTabController.eventLoopTick();
|
||||||
|
m_accessibilityTabController.eventLoopTick(
|
||||||
|
vr::VRCompositor()->GetTrackingSpace() );
|
||||||
|
|
||||||
|
if ( m_ulOverlayThumbnailHandle != vr::k_ulOverlayHandleInvalid )
|
||||||
|
{
|
||||||
|
while ( vr::VROverlay()->PollNextOverlayEvent(
|
||||||
|
m_ulOverlayThumbnailHandle, &vrEvent, sizeof( vrEvent ) ) )
|
||||||
|
{
|
||||||
|
switch ( vrEvent.eventType )
|
||||||
|
{
|
||||||
|
case vr::VREvent_OverlayShown:
|
||||||
|
{
|
||||||
|
m_pWindow->update();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_lastFrame = m_currentFrame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ private:
|
|||||||
QSoundEffect m_focusChangedSoundEffect;
|
QSoundEffect m_focusChangedSoundEffect;
|
||||||
QSoundEffect m_alarm01SoundEffect;
|
QSoundEffect m_alarm01SoundEffect;
|
||||||
|
|
||||||
|
uint64_t m_currentFrame = 0;
|
||||||
|
uint64_t m_lastFrame = 0;
|
||||||
|
|
||||||
public: // I know it's an ugly hack to make them public to enable external
|
public: // I know it's an ugly hack to make them public to enable external
|
||||||
// access, but I am too lazy to implement getters.
|
// access, but I am too lazy to implement getters.
|
||||||
SteamVRTabController m_steamVRTabController;
|
SteamVRTabController m_steamVRTabController;
|
||||||
|
|||||||
@@ -415,7 +415,11 @@ MyStackViewPage {
|
|||||||
reloadChaperoneProfiles()
|
reloadChaperoneProfiles()
|
||||||
reloadSteamVRProfiles()
|
reloadSteamVRProfiles()
|
||||||
reloadPttProfiles()
|
reloadPttProfiles()
|
||||||
summaryVersionText.text = applicationVersion
|
|
||||||
|
// REVERT TO THIS LATER: summaryVersionText.text = applicationVersion
|
||||||
|
// TEMP VERSION:
|
||||||
|
summaryVersionText.text = "Alpha-Kung v1.3"
|
||||||
|
|
||||||
if (MoveCenterTabController.trackingUniverse === 0) {
|
if (MoveCenterTabController.trackingUniverse === 0) {
|
||||||
summaryPlaySpaceModeText.text = "Sitting"
|
summaryPlaySpaceModeText.text = "Sitting"
|
||||||
} else if (MoveCenterTabController.trackingUniverse === 1) {
|
} else if (MoveCenterTabController.trackingUniverse === 1) {
|
||||||
|
|||||||
@@ -116,9 +116,12 @@ void AccessibilityTabController::eventLoopTick(
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 151 )
|
||||||
{
|
{
|
||||||
setTrackingUniverse( ( int ) universe );
|
if ( parent->isDashboardVisible() )
|
||||||
|
{
|
||||||
|
setTrackingUniverse( ( int ) universe );
|
||||||
|
}
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void AudioTabController::eventLoopTick()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 89 )
|
||||||
{
|
{
|
||||||
if ( m_micProximitySensorCanMute )
|
if ( m_micProximitySensorCanMute )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -649,66 +649,72 @@ void ChaperoneTabController::eventLoopTick(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 101 )
|
||||||
{
|
{
|
||||||
vr::EVRSettingsError vrSettingsError;
|
if ( parent->isDashboardVisible() )
|
||||||
float vis = vr::VRSettings()->GetInt32(
|
|
||||||
vr::k_pch_CollisionBounds_Section,
|
|
||||||
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
|
|
||||||
&vrSettingsError );
|
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
|
||||||
{
|
{
|
||||||
LOG( WARNING ) << "Could not read \""
|
vr::EVRSettingsError vrSettingsError;
|
||||||
<< vr::k_pch_CollisionBounds_ColorGammaA_Int32
|
float vis = vr::VRSettings()->GetInt32(
|
||||||
<< "\" setting: "
|
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
|
||||||
vrSettingsError );
|
|
||||||
}
|
|
||||||
setBoundsVisibility( vis / 255.0f );
|
|
||||||
if ( m_chaperoneVelocityModifierCurrent == 1.0f )
|
|
||||||
{
|
|
||||||
auto fd = vr::VRSettings()->GetFloat(
|
|
||||||
vr::k_pch_CollisionBounds_Section,
|
vr::k_pch_CollisionBounds_Section,
|
||||||
vr::k_pch_CollisionBounds_FadeDistance_Float,
|
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
|
||||||
&vrSettingsError );
|
&vrSettingsError );
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
{
|
{
|
||||||
LOG( WARNING )
|
LOG( WARNING )
|
||||||
<< "Could not read \""
|
<< "Could not read \""
|
||||||
<< vr::k_pch_CollisionBounds_FadeDistance_Float
|
<< vr::k_pch_CollisionBounds_ColorGammaA_Int32
|
||||||
<< "\" setting: "
|
<< "\" setting: "
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
vrSettingsError );
|
vrSettingsError );
|
||||||
}
|
}
|
||||||
setFadeDistance( fd );
|
setBoundsVisibility( vis / 255.0f );
|
||||||
|
if ( m_chaperoneVelocityModifierCurrent == 1.0f )
|
||||||
|
{
|
||||||
|
auto fd = vr::VRSettings()->GetFloat(
|
||||||
|
vr::k_pch_CollisionBounds_Section,
|
||||||
|
vr::k_pch_CollisionBounds_FadeDistance_Float,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
LOG( WARNING )
|
||||||
|
<< "Could not read \""
|
||||||
|
<< vr::k_pch_CollisionBounds_FadeDistance_Float
|
||||||
|
<< "\" setting: "
|
||||||
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
|
vrSettingsError );
|
||||||
|
}
|
||||||
|
setFadeDistance( fd );
|
||||||
|
}
|
||||||
|
auto cm = vr::VRSettings()->GetBool(
|
||||||
|
vr::k_pch_CollisionBounds_Section,
|
||||||
|
vr::k_pch_CollisionBounds_CenterMarkerOn_Bool,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
LOG( WARNING )
|
||||||
|
<< "Could not read \""
|
||||||
|
<< vr::k_pch_CollisionBounds_CenterMarkerOn_Bool
|
||||||
|
<< "\" setting: "
|
||||||
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
|
vrSettingsError );
|
||||||
|
}
|
||||||
|
setCenterMarker( cm );
|
||||||
|
auto ps = vr::VRSettings()->GetBool(
|
||||||
|
vr::k_pch_CollisionBounds_Section,
|
||||||
|
vr::k_pch_CollisionBounds_PlaySpaceOn_Bool,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
LOG( WARNING )
|
||||||
|
<< "Could not read \""
|
||||||
|
<< vr::k_pch_CollisionBounds_PlaySpaceOn_Bool
|
||||||
|
<< "\" setting: "
|
||||||
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
|
vrSettingsError );
|
||||||
|
}
|
||||||
|
setPlaySpaceMarker( ps );
|
||||||
|
updateHeight( getBoundsMaxY() );
|
||||||
}
|
}
|
||||||
auto cm = vr::VRSettings()->GetBool(
|
|
||||||
vr::k_pch_CollisionBounds_Section,
|
|
||||||
vr::k_pch_CollisionBounds_CenterMarkerOn_Bool,
|
|
||||||
&vrSettingsError );
|
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
LOG( WARNING ) << "Could not read \""
|
|
||||||
<< vr::k_pch_CollisionBounds_CenterMarkerOn_Bool
|
|
||||||
<< "\" setting: "
|
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
|
||||||
vrSettingsError );
|
|
||||||
}
|
|
||||||
setCenterMarker( cm );
|
|
||||||
auto ps = vr::VRSettings()->GetBool(
|
|
||||||
vr::k_pch_CollisionBounds_Section,
|
|
||||||
vr::k_pch_CollisionBounds_PlaySpaceOn_Bool,
|
|
||||||
&vrSettingsError );
|
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
LOG( WARNING ) << "Could not read \""
|
|
||||||
<< vr::k_pch_CollisionBounds_PlaySpaceOn_Bool
|
|
||||||
<< "\" setting: "
|
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
|
||||||
vrSettingsError );
|
|
||||||
}
|
|
||||||
setPlaySpaceMarker( ps );
|
|
||||||
updateHeight( getBoundsMaxY() );
|
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -604,9 +604,12 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
vr::ETrackingUniverseOrigin universe,
|
vr::ETrackingUniverseOrigin universe,
|
||||||
vr::TrackedDevicePose_t* devicePoses )
|
vr::TrackedDevicePose_t* devicePoses )
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= 100 )
|
if ( settingsUpdateCounter >= 149 )
|
||||||
{
|
{
|
||||||
setTrackingUniverse( int( universe ) );
|
if ( parent->isDashboardVisible() )
|
||||||
|
{
|
||||||
|
setTrackingUniverse( int( universe ) );
|
||||||
|
}
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -309,153 +309,168 @@ void ReviveTabController::eventLoopTick()
|
|||||||
if ( m_isOverlayInstalled
|
if ( m_isOverlayInstalled
|
||||||
|| parent->m_settingsTabController.forceRevivePage() )
|
|| parent->m_settingsTabController.forceRevivePage() )
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 139 )
|
||||||
{
|
{
|
||||||
|
if ( parent->isDashboardVisible() )
|
||||||
|
{
|
||||||
|
vr::EVRSettingsError vrSettingsError;
|
||||||
|
|
||||||
|
float valuef
|
||||||
|
= vr::VRSettings()->GetFloat( section_revive,
|
||||||
|
key_pixelsPerDisplayPixel,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
if ( valuef == 0.0 )
|
||||||
|
{
|
||||||
|
setPixelsPerDisplayPixelOverrideEnabled( false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPixelsPerDisplayPixelOverrideEnabled( true );
|
||||||
|
setPixelsPerDisplayPixelOverride( valuef );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int valuei = vr::VRSettings()->GetInt32(
|
||||||
|
section_revive, key_toggleGrip, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setGripButtonMode( valuei );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool valueb = vr::VRSettings()->GetBool(
|
||||||
|
section_revive, key_triggerAsGrip, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTriggerAsGrip( valueb );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_toggleDelay, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setToggleDelay( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_thumbDeadzone, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setThumbDeadzone( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_thumbSensitivity, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setThumbRange( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchPitch, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchPitch( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchYaw, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchYaw( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchRoll, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchRoll( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchX, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchX( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchY, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchY( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_touchZ, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setTouchZ( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_playerHeight, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setPiPlayerHeight( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
valuef = vr::VRSettings()->GetFloat(
|
||||||
|
section_revive, key_eyeHeight, &vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setPiEyeHeight( valuef );
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[1024];
|
||||||
|
vr::VRSettings()->GetString( section_revive,
|
||||||
|
key_piUser,
|
||||||
|
buffer,
|
||||||
|
1024,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setPiUsername( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
vr::VRSettings()->GetString( section_revive,
|
||||||
|
key_piName,
|
||||||
|
buffer,
|
||||||
|
1024,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
setPiName( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
vr::VRSettings()->GetString( section_revive,
|
||||||
|
key_piGender,
|
||||||
|
buffer,
|
||||||
|
1024,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError == vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
if ( QString( buffer ).compare( "male",
|
||||||
|
Qt::CaseInsensitive )
|
||||||
|
== 0 )
|
||||||
|
{
|
||||||
|
valuei = 1;
|
||||||
|
}
|
||||||
|
else if ( QString( buffer ).compare( "female",
|
||||||
|
Qt::CaseInsensitive )
|
||||||
|
== 0 )
|
||||||
|
{
|
||||||
|
valuei = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valuei = 0;
|
||||||
|
}
|
||||||
|
setPiGender( valuei );
|
||||||
|
}
|
||||||
|
}
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
vr::EVRSettingsError vrSettingsError;
|
|
||||||
|
|
||||||
float valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_pixelsPerDisplayPixel, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
if ( valuef == 0.0 )
|
|
||||||
{
|
|
||||||
setPixelsPerDisplayPixelOverrideEnabled( false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setPixelsPerDisplayPixelOverrideEnabled( true );
|
|
||||||
setPixelsPerDisplayPixelOverride( valuef );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int valuei = vr::VRSettings()->GetInt32(
|
|
||||||
section_revive, key_toggleGrip, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setGripButtonMode( valuei );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool valueb = vr::VRSettings()->GetBool(
|
|
||||||
section_revive, key_triggerAsGrip, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTriggerAsGrip( valueb );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_toggleDelay, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setToggleDelay( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_thumbDeadzone, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setThumbDeadzone( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_thumbSensitivity, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setThumbRange( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchPitch, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchPitch( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchYaw, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchYaw( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchRoll, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchRoll( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchX, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchX( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchY, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchY( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_touchZ, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setTouchZ( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_playerHeight, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setPiPlayerHeight( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
valuef = vr::VRSettings()->GetFloat(
|
|
||||||
section_revive, key_eyeHeight, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setPiEyeHeight( valuef );
|
|
||||||
}
|
|
||||||
|
|
||||||
char buffer[1024];
|
|
||||||
vr::VRSettings()->GetString(
|
|
||||||
section_revive, key_piUser, buffer, 1024, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setPiUsername( buffer );
|
|
||||||
}
|
|
||||||
|
|
||||||
vr::VRSettings()->GetString(
|
|
||||||
section_revive, key_piName, buffer, 1024, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
setPiName( buffer );
|
|
||||||
}
|
|
||||||
|
|
||||||
vr::VRSettings()->GetString(
|
|
||||||
section_revive, key_piGender, buffer, 1024, &vrSettingsError );
|
|
||||||
if ( vrSettingsError == vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
if ( QString( buffer ).compare( "male", Qt::CaseInsensitive )
|
|
||||||
== 0 )
|
|
||||||
{
|
|
||||||
valuei = 1;
|
|
||||||
}
|
|
||||||
else if ( QString( buffer ).compare( "female",
|
|
||||||
Qt::CaseInsensitive )
|
|
||||||
== 0 )
|
|
||||||
{
|
|
||||||
valuei = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
valuei = 0;
|
|
||||||
}
|
|
||||||
setPiGender( valuei );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ void SettingsTabController::initStage2( OverlayController* var_parent,
|
|||||||
|
|
||||||
void SettingsTabController::eventLoopTick()
|
void SettingsTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 157 )
|
||||||
{
|
{
|
||||||
setAutoStartEnabled( vr::VRApplications()->GetApplicationAutoLaunch(
|
if ( parent->isDashboardVisible() )
|
||||||
OverlayController::applicationKey ) );
|
{
|
||||||
|
setAutoStartEnabled( vr::VRApplications()->GetApplicationAutoLaunch(
|
||||||
|
OverlayController::applicationKey ) );
|
||||||
|
}
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,82 +22,88 @@ void SteamVRTabController::initStage2( OverlayController* var_parent,
|
|||||||
|
|
||||||
void SteamVRTabController::eventLoopTick()
|
void SteamVRTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= 50 )
|
if ( settingsUpdateCounter >= 97 )
|
||||||
{
|
{
|
||||||
vr::EVRSettingsError vrSettingsError;
|
if ( parent->isDashboardVisible() )
|
||||||
// checks supersampling override and resynchs if necessry
|
|
||||||
// also prints error if can't find.
|
|
||||||
auto sso = vr::VRSettings()->GetBool(
|
|
||||||
vr::k_pch_SteamVR_Section,
|
|
||||||
vr::k_pch_SteamVR_SupersampleManualOverride_Bool,
|
|
||||||
&vrSettingsError );
|
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
|
||||||
{
|
{
|
||||||
LOG( WARNING ) << "Could not read \""
|
vr::EVRSettingsError vrSettingsError;
|
||||||
<< vr::k_pch_SteamVR_SupersampleManualOverride_Bool
|
// checks supersampling override and resynchs if necessry
|
||||||
<< "\" setting: "
|
// also prints error if can't find.
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
auto sso = vr::VRSettings()->GetBool(
|
||||||
vrSettingsError );
|
vr::k_pch_SteamVR_Section,
|
||||||
}
|
vr::k_pch_SteamVR_SupersampleManualOverride_Bool,
|
||||||
setAllowSupersampleOverride( sso );
|
&vrSettingsError );
|
||||||
// checks supersampling and re-synchs if necessary
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
auto ss = vr::VRSettings()->GetFloat(
|
|
||||||
vr::k_pch_SteamVR_Section,
|
|
||||||
vr::k_pch_SteamVR_SupersampleScale_Float,
|
|
||||||
&vrSettingsError );
|
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
|
||||||
{
|
|
||||||
LOG( WARNING ) << "Could not read \""
|
|
||||||
<< vr::k_pch_SteamVR_SupersampleScale_Float
|
|
||||||
<< "\" setting: "
|
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
|
||||||
vrSettingsError );
|
|
||||||
if ( m_superSampling != 1.0 )
|
|
||||||
{
|
{
|
||||||
LOG( DEBUG ) << "OpenVR returns an error and we have a custom "
|
LOG( WARNING )
|
||||||
"supersampling value: "
|
<< "Could not read \""
|
||||||
<< m_superSampling;
|
<< vr::k_pch_SteamVR_SupersampleManualOverride_Bool
|
||||||
setSuperSampling( 1.0 );
|
<< "\" setting: "
|
||||||
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
|
vrSettingsError );
|
||||||
}
|
}
|
||||||
}
|
setAllowSupersampleOverride( sso );
|
||||||
else if ( m_superSampling != ss )
|
// checks supersampling and re-synchs if necessary
|
||||||
{
|
auto ss = vr::VRSettings()->GetFloat(
|
||||||
LOG( DEBUG ) << "OpenVR reports a changed supersampling value: "
|
vr::k_pch_SteamVR_Section,
|
||||||
<< m_superSampling << " => " << ss;
|
vr::k_pch_SteamVR_SupersampleScale_Float,
|
||||||
setSuperSampling( ss );
|
&vrSettingsError );
|
||||||
}
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
// checks if Supersampling filter is on and changes if it has been
|
{
|
||||||
// changed elsewhere
|
LOG( WARNING )
|
||||||
auto sf = vr::VRSettings()->GetBool(
|
<< "Could not read \""
|
||||||
vr::k_pch_SteamVR_Section,
|
<< vr::k_pch_SteamVR_SupersampleScale_Float
|
||||||
vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
|
<< "\" setting: "
|
||||||
&vrSettingsError );
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
vrSettingsError );
|
||||||
{
|
if ( m_superSampling != 1.0 )
|
||||||
LOG( WARNING ) << "Could not read \""
|
{
|
||||||
<< vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
|
LOG( DEBUG )
|
||||||
<< "\" setting: "
|
<< "OpenVR returns an error and we have a custom "
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
"supersampling value: "
|
||||||
vrSettingsError );
|
<< m_superSampling;
|
||||||
}
|
setSuperSampling( 1.0 );
|
||||||
setAllowSupersampleFiltering( sf );
|
}
|
||||||
|
}
|
||||||
|
else if ( m_superSampling != ss )
|
||||||
|
{
|
||||||
|
LOG( DEBUG ) << "OpenVR reports a changed supersampling value: "
|
||||||
|
<< m_superSampling << " => " << ss;
|
||||||
|
setSuperSampling( ss );
|
||||||
|
}
|
||||||
|
// checks if Supersampling filter is on and changes if it has been
|
||||||
|
// changed elsewhere
|
||||||
|
auto sf = vr::VRSettings()->GetBool(
|
||||||
|
vr::k_pch_SteamVR_Section,
|
||||||
|
vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
|
||||||
|
&vrSettingsError );
|
||||||
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
|
{
|
||||||
|
LOG( WARNING )
|
||||||
|
<< "Could not read \""
|
||||||
|
<< vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
|
||||||
|
<< "\" setting: "
|
||||||
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
|
vrSettingsError );
|
||||||
|
}
|
||||||
|
setAllowSupersampleFiltering( sf );
|
||||||
|
|
||||||
// Checks if Motion smoothing setting can be read and synchs adv
|
// Checks if Motion smoothing setting can be read and synchs adv
|
||||||
// settings to steamvr/openvr
|
// settings to steamvr/openvr
|
||||||
auto ms
|
auto ms = vr::VRSettings()->GetBool(
|
||||||
= vr::VRSettings()->GetBool( vr::k_pch_SteamVR_Section,
|
vr::k_pch_SteamVR_Section,
|
||||||
vr::k_pch_SteamVR_MotionSmoothing_Bool,
|
vr::k_pch_SteamVR_MotionSmoothing_Bool,
|
||||||
&vrSettingsError );
|
&vrSettingsError );
|
||||||
if ( vrSettingsError != vr::VRSettingsError_None )
|
if ( vrSettingsError != vr::VRSettingsError_None )
|
||||||
{
|
{
|
||||||
LOG( WARNING ) << "Could not read \""
|
LOG( WARNING )
|
||||||
<< vr::k_pch_SteamVR_MotionSmoothing_Bool
|
<< "Could not read \""
|
||||||
<< "\" setting: "
|
<< vr::k_pch_SteamVR_MotionSmoothing_Bool << "\" setting: "
|
||||||
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
|
||||||
vrSettingsError );
|
vrSettingsError );
|
||||||
|
}
|
||||||
|
setMotionSmoothing( ms );
|
||||||
}
|
}
|
||||||
setMotionSmoothing( ms );
|
|
||||||
|
|
||||||
settingsUpdateCounter = 0;
|
settingsUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ vr::VROverlayHandle_t createBatteryOverlay( vr::TrackedDeviceIndex_t index )
|
|||||||
|
|
||||||
void UtilitiesTabController::eventLoopTick()
|
void UtilitiesTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= 10 )
|
if ( settingsUpdateCounter >= 19 )
|
||||||
{
|
{
|
||||||
vr::VROverlayHandle_t pOverlayHandle;
|
vr::VROverlayHandle_t pOverlayHandle;
|
||||||
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
|
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
|
||||||
|
|||||||
Reference in New Issue
Block a user