static constexpr to constexpr changes
static constexpr to constexpr changes for update counters and invalid quaternions and radians conversion
This commit is contained in:
+15
-14
@@ -44,6 +44,21 @@
|
|||||||
// application namespace
|
// application namespace
|
||||||
namespace advsettings
|
namespace advsettings
|
||||||
{
|
{
|
||||||
|
// These counters set timing for refreshing settings changes in tab ui
|
||||||
|
// SettingsUpdateCounter values are set as prime numbers to reduce overlap
|
||||||
|
// of simultaneous settings updates.
|
||||||
|
// Actual rates of updates are counter * vsync (~11ms)
|
||||||
|
// Values chosen based on update speed priority
|
||||||
|
// Avoid setting values to the same numbers.
|
||||||
|
constexpr int k_accessibilitySettingsUpdateCounter = 151;
|
||||||
|
constexpr int k_audioSettingsUpdateCounter = 89;
|
||||||
|
constexpr int k_chaperoneSettingsUpdateCounter = 101;
|
||||||
|
constexpr int k_moveCenterSettingsUpdateCounter = 149;
|
||||||
|
constexpr int k_reviveSettingsUpdateCounter = 139;
|
||||||
|
constexpr int k_settingsTabSettingsUpdateCounter = 157;
|
||||||
|
constexpr int k_steamVrSettingsUpdateCounter = 97;
|
||||||
|
constexpr int k_utilitiesSettingsUpdateCounter = 19;
|
||||||
|
|
||||||
class OverlayController : public QObject
|
class OverlayController : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -55,20 +70,6 @@ public:
|
|||||||
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
static constexpr const char* applicationKey = "matzman666.AdvancedSettings";
|
||||||
static constexpr const char* applicationDisplayName = "Advanced Settings";
|
static constexpr const char* applicationDisplayName = "Advanced Settings";
|
||||||
static constexpr const char* applicationVersionString = "v2.8.0-dev";
|
static constexpr const char* applicationVersionString = "v2.8.0-dev";
|
||||||
// These counters set timing for refreshing settings changes in tab ui
|
|
||||||
// SettingsUpdateCounter values are set as prime numbers to reduce overlap
|
|
||||||
// of simultaneous settings updates.
|
|
||||||
// Actual rates of updates are counter * vsync (~11ms)
|
|
||||||
// Values chosen based on update speed priority
|
|
||||||
// Avoid setting values to the same numbers.
|
|
||||||
static constexpr int k_accessibilitySettingsUpdateCounter = 151;
|
|
||||||
static constexpr int k_audioSettingsUpdateCounter = 89;
|
|
||||||
static constexpr int k_chaperoneSettingsUpdateCounter = 101;
|
|
||||||
static constexpr int k_moveCenterSettingsUpdateCounter = 149;
|
|
||||||
static constexpr int k_reviveSettingsUpdateCounter = 139;
|
|
||||||
static constexpr int k_settingsTabSettingsUpdateCounter = 157;
|
|
||||||
static constexpr int k_steamVrSettingsUpdateCounter = 97;
|
|
||||||
static constexpr int k_utilitiesSettingsUpdateCounter = 19;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid;
|
vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void AccessibilityTabController::eventLoopTick(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( settingsUpdateCounter >= parent->k_accessibilitySettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_accessibilitySettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ void AudioTabController::eventLoopTick()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( settingsUpdateCounter >= parent->k_audioSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_audioSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( m_micProximitySensorCanMute )
|
if ( m_micProximitySensorCanMute )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ void ChaperoneTabController::eventLoopTick(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( settingsUpdateCounter >= parent->k_chaperoneSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_chaperoneSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -862,7 +862,7 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
vr::ETrackingUniverseOrigin universe,
|
vr::ETrackingUniverseOrigin universe,
|
||||||
vr::TrackedDevicePose_t* devicePoses )
|
vr::TrackedDevicePose_t* devicePoses )
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= parent->k_moveCenterSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_moveCenterSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
@@ -899,7 +899,7 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
|
|
||||||
// Get rotation change of hmd
|
// Get rotation change of hmd
|
||||||
// Checking if set to -1000.0 placeholder for invalid hmd pose.
|
// Checking if set to -1000.0 placeholder for invalid hmd pose.
|
||||||
if ( m_lastHmdQuaternion.w < -900.0 )
|
if ( m_lastHmdQuaternion.w < k_quaternionUnderIsInvalidValueThreshold )
|
||||||
{
|
{
|
||||||
m_lastHmdQuaternion = m_hmdQuaternion;
|
m_lastHmdQuaternion = m_hmdQuaternion;
|
||||||
}
|
}
|
||||||
@@ -932,27 +932,9 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// set lastHmdQuaternion.w to placeholder -1000.0 for invalid
|
// set lastHmdQuaternion.w to placeholder -1000.0 for invalid
|
||||||
m_lastHmdQuaternion.w = -1000.0;
|
m_lastHmdQuaternion.w = k_quaternionInvalidValue;
|
||||||
} // END of hmd rotation stats tracking
|
} // END of hmd rotation stats tracking
|
||||||
|
|
||||||
/*
|
|
||||||
if ( m_activeMoveHand == vr::TrackedControllerRole_Invalid )
|
|
||||||
{
|
|
||||||
emit offsetXChanged( m_offsetX );
|
|
||||||
emit offsetYChanged( m_offsetY );
|
|
||||||
emit offsetZChanged( m_offsetZ );
|
|
||||||
|
|
||||||
// Set lastHandQuaternion.w to placeholder value for invalid
|
|
||||||
(-1000.0)
|
|
||||||
// when we release move shortcut.
|
|
||||||
if ( m_rotateHand )
|
|
||||||
{
|
|
||||||
lastHandQuaternion.w = -1000.0;
|
|
||||||
}
|
|
||||||
m_lastMoveHand = m_activeMoveHand;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
auto moveHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
auto moveHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||||
m_activeDragHand );
|
m_activeDragHand );
|
||||||
auto rotateHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
auto rotateHandId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||||
@@ -1063,9 +1045,7 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
{
|
{
|
||||||
if ( m_lastRotateHand != vr::TrackedControllerRole_Invalid )
|
if ( m_lastRotateHand != vr::TrackedControllerRole_Invalid )
|
||||||
{
|
{
|
||||||
// Set lastHandQuaternion.w to placeholder value for invalid
|
m_lastHandQuaternion.w = k_quaternionInvalidValue;
|
||||||
// (-1000.0)
|
|
||||||
m_lastHandQuaternion.w = -1000.0;
|
|
||||||
}
|
}
|
||||||
m_lastRotateHand = m_activeTurnHand;
|
m_lastRotateHand = m_activeTurnHand;
|
||||||
}
|
}
|
||||||
@@ -1101,8 +1081,9 @@ void MoveCenterTabController::eventLoopTick(
|
|||||||
if ( m_lastRotateHand == m_activeTurnHand )
|
if ( m_lastRotateHand == m_activeTurnHand )
|
||||||
{
|
{
|
||||||
// Get rotation change of hand.
|
// Get rotation change of hand.
|
||||||
// Checking if set to -1000.0 placeholder for invalid hand.
|
// Checking if m_lastHandQuaternion is invalid
|
||||||
if ( m_lastHandQuaternion.w < -900.0 )
|
if ( m_lastHandQuaternion.w
|
||||||
|
< k_quaternionUnderIsInvalidValueThreshold )
|
||||||
{
|
{
|
||||||
m_lastHandQuaternion = m_handQuaternion;
|
m_lastHandQuaternion = m_handQuaternion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ class QQuickWindow;
|
|||||||
namespace advsettings
|
namespace advsettings
|
||||||
{
|
{
|
||||||
// forward declaration
|
// forward declaration
|
||||||
|
constexpr double k_centidegreesToRadians = M_PI / 18000.0;
|
||||||
|
constexpr double k_radiansToCentidegrees = 18000.0 / M_PI;
|
||||||
|
constexpr double k_quaternionInvalidValue = -1000.0;
|
||||||
|
constexpr double k_quaternionUnderIsInvalidValueThreshold = -900.0;
|
||||||
|
|
||||||
class OverlayController;
|
class OverlayController;
|
||||||
|
|
||||||
class MoveCenterTabController : public QObject
|
class MoveCenterTabController : public QObject
|
||||||
@@ -66,10 +71,12 @@ private:
|
|||||||
bool m_lockZToggle = false;
|
bool m_lockZToggle = false;
|
||||||
std::chrono::system_clock::time_point lastMoveButtonClick[2];
|
std::chrono::system_clock::time_point lastMoveButtonClick[2];
|
||||||
// Set lastHandQuaternion.w to -1000.0 when last hand is invalid.
|
// Set lastHandQuaternion.w to -1000.0 when last hand is invalid.
|
||||||
vr::HmdQuaternion_t m_lastHandQuaternion = { -1000.0, 0.0, 0.0, 0.0 };
|
vr::HmdQuaternion_t m_lastHandQuaternion
|
||||||
|
= { k_quaternionInvalidValue, 0.0, 0.0, 0.0 };
|
||||||
vr::HmdQuaternion_t m_handQuaternion;
|
vr::HmdQuaternion_t m_handQuaternion;
|
||||||
// Set lastHmdQuaternion.w to -1000.0 when last hmd pose is invalid.
|
// Set lastHmdQuaternion.w to -1000.0 when last hmd pose is invalid.
|
||||||
vr::HmdQuaternion_t m_lastHmdQuaternion = { -1000.0, 0.0, 0.0, 0.0 };
|
vr::HmdQuaternion_t m_lastHmdQuaternion
|
||||||
|
= { k_quaternionInvalidValue, 0.0, 0.0, 0.0 };
|
||||||
vr::HmdQuaternion_t m_hmdQuaternion;
|
vr::HmdQuaternion_t m_hmdQuaternion;
|
||||||
double m_hmdYawTotal = 0.0;
|
double m_hmdYawTotal = 0.0;
|
||||||
vr::ETrackedControllerRole m_activeDragHand
|
vr::ETrackedControllerRole m_activeDragHand
|
||||||
@@ -89,8 +96,6 @@ private:
|
|||||||
bool m_overrideLeftHandTurnPressed = false;
|
bool m_overrideLeftHandTurnPressed = false;
|
||||||
bool m_overrideRightHandTurnPressed = false;
|
bool m_overrideRightHandTurnPressed = false;
|
||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
static constexpr double k_centidegreesToRadians = M_PI / 18000.0;
|
|
||||||
static constexpr double k_radiansToCentidegrees = 18000.0 / M_PI;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initStage1();
|
void initStage1();
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ void ReviveTabController::eventLoopTick()
|
|||||||
if ( m_isOverlayInstalled
|
if ( m_isOverlayInstalled
|
||||||
|| parent->m_settingsTabController.forceRevivePage() )
|
|| parent->m_settingsTabController.forceRevivePage() )
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= parent->k_reviveSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_reviveSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void SettingsTabController::initStage2( OverlayController* var_parent,
|
|||||||
|
|
||||||
void SettingsTabController::eventLoopTick()
|
void SettingsTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= parent->k_settingsTabSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_settingsTabSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void SteamVRTabController::initStage2( OverlayController* var_parent,
|
|||||||
|
|
||||||
void SteamVRTabController::eventLoopTick()
|
void SteamVRTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= parent->k_steamVrSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_steamVrSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
if ( parent->isDashboardVisible() )
|
if ( parent->isDashboardVisible() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ vr::VROverlayHandle_t createBatteryOverlay( vr::TrackedDeviceIndex_t index )
|
|||||||
|
|
||||||
void UtilitiesTabController::eventLoopTick()
|
void UtilitiesTabController::eventLoopTick()
|
||||||
{
|
{
|
||||||
if ( settingsUpdateCounter >= parent->k_utilitiesSettingsUpdateCounter )
|
if ( settingsUpdateCounter >= k_utilitiesSettingsUpdateCounter )
|
||||||
{
|
{
|
||||||
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