Merge pull request #71 from OpenVR-Advanced-Settings/alpha-kung

Alpha kung merge (new playspace rotation feature)
This commit is contained in:
Kung-vr
2019-01-31 04:12:39 +09:00
committed by GitHub
21 changed files with 1560 additions and 773 deletions
+65 -2
View File
@@ -7,7 +7,7 @@
namespace input namespace input
{ {
/*! /*!
Wrapper around the IVRInput GetAnalogActionData with error handling. Wrapper around the IVRInput GetDigitalActionData with error handling.
The struct is created and zero initalized in this function instead of being The struct is created and zero initalized in this function instead of being
passed as reference since the size is currently only 28 bytes, and currently passed as reference since the size is currently only 28 bytes, and currently
@@ -129,7 +129,27 @@ SteamIVRInput::SteamIVRInput()
ActionType::Digital ), ActionType::Digital ),
m_pausePlayTrack( input_strings::k_actionPausePlayTrack, m_pausePlayTrack( input_strings::k_actionPausePlayTrack,
ActionType::Digital ), ActionType::Digital ),
m_stopTrack( input_strings::k_actionStopTrack, ActionType::Digital ) m_stopTrack( input_strings::k_actionStopTrack, ActionType::Digital ),
m_leftHandRoomTurn( input_strings::k_actionLeftHandRoomTurn,
ActionType::Digital ),
m_rightHandRoomTurn( input_strings::k_actionRightHandRoomTurn,
ActionType::Digital ),
m_leftHandRoomDrag( input_strings::k_actionLeftHandRoomDrag,
ActionType::Digital ),
m_rightHandRoomDrag( input_strings::k_actionRightHandRoomDrag,
ActionType::Digital ),
m_optionalOverrideLeftHandRoomTurn(
input_strings::k_actionOptionalOverrideLeftHandRoomTurn,
ActionType::Digital ),
m_optionalOverrideRightHandRoomTurn(
input_strings::k_actionOptionalOverrideRightHandRoomTurn,
ActionType::Digital ),
m_optionalOverrideLeftHandRoomDrag(
input_strings::k_actionOptionalOverrideLeftHandRoomDrag,
ActionType::Digital ),
m_optionalOverrideRightHandRoomDrag(
input_strings::k_actionOptionalOverrideRightHandRoomDrag,
ActionType::Digital )
{ {
m_activeActionSet.ulActionSet = m_mainSet.handle(); m_activeActionSet.ulActionSet = m_mainSet.handle();
m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle; m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle;
@@ -179,6 +199,49 @@ bool SteamIVRInput::stopSong()
return isDigitalActionActivatedOnce( m_stopTrack ); return isDigitalActionActivatedOnce( m_stopTrack );
} }
bool SteamIVRInput::leftHandRoomTurn()
{
return isDigitalActionActivatedConstant( m_leftHandRoomTurn );
}
bool SteamIVRInput::rightHandRoomTurn()
{
return isDigitalActionActivatedConstant( m_rightHandRoomTurn );
}
bool SteamIVRInput::leftHandRoomDrag()
{
return isDigitalActionActivatedConstant( m_leftHandRoomDrag );
}
bool SteamIVRInput::rightHandRoomDrag()
{
return isDigitalActionActivatedConstant( m_rightHandRoomDrag );
}
bool SteamIVRInput::optionalOverrideLeftHandRoomTurn()
{
return isDigitalActionActivatedConstant(
m_optionalOverrideLeftHandRoomTurn );
}
bool SteamIVRInput::optionalOverrideRightHandRoomTurn()
{
return isDigitalActionActivatedConstant(
m_optionalOverrideRightHandRoomTurn );
}
bool SteamIVRInput::optionalOverrideLeftHandRoomDrag()
{
return isDigitalActionActivatedConstant(
m_optionalOverrideLeftHandRoomDrag );
}
bool SteamIVRInput::optionalOverrideRightHandRoomDrag()
{
return isDigitalActionActivatedConstant(
m_optionalOverrideRightHandRoomDrag );
}
/*! /*!
Updates the active action set(s). Updates the active action set(s).
Should be called every frame, or however often you want the input system to Should be called every frame, or however often you want the input system to
+35
View File
@@ -40,6 +40,14 @@ public:
bool previousSong(); bool previousSong();
bool pausePlaySong(); bool pausePlaySong();
bool stopSong(); bool stopSong();
bool leftHandRoomTurn();
bool rightHandRoomTurn();
bool leftHandRoomDrag();
bool rightHandRoomDrag();
bool optionalOverrideLeftHandRoomTurn();
bool optionalOverrideRightHandRoomTurn();
bool optionalOverrideLeftHandRoomDrag();
bool optionalOverrideRightHandRoomDrag();
// Destructor. There are no terminating calls for the IVRInput API, so it // Destructor. There are no terminating calls for the IVRInput API, so it
// is left blank. // is left blank.
@@ -69,6 +77,16 @@ private:
Action m_previousTrack; Action m_previousTrack;
Action m_pausePlayTrack; Action m_pausePlayTrack;
Action m_stopTrack; Action m_stopTrack;
// Room bindings
Action m_leftHandRoomTurn;
Action m_rightHandRoomTurn;
Action m_leftHandRoomDrag;
Action m_rightHandRoomDrag;
Action m_optionalOverrideLeftHandRoomTurn;
Action m_optionalOverrideRightHandRoomTurn;
Action m_optionalOverrideLeftHandRoomDrag;
Action m_optionalOverrideRightHandRoomDrag;
}; };
/*! /*!
@@ -83,6 +101,23 @@ namespace input_strings
constexpr auto k_actionPausePlayTrack = "/actions/main/in/PausePlayTrack"; constexpr auto k_actionPausePlayTrack = "/actions/main/in/PausePlayTrack";
constexpr auto k_actionStopTrack = "/actions/main/in/StopTrack"; constexpr auto k_actionStopTrack = "/actions/main/in/StopTrack";
constexpr auto k_actionLeftHandRoomTurn
= "/actions/main/in/LeftHandRoomTurn";
constexpr auto k_actionRightHandRoomTurn
= "/actions/main/in/RightHandRoomTurn";
constexpr auto k_actionLeftHandRoomDrag
= "/actions/main/in/LeftHandRoomDrag";
constexpr auto k_actionRightHandRoomDrag
= "/actions/main/in/RightHandRoomDrag";
constexpr auto k_actionOptionalOverrideLeftHandRoomTurn
= "/actions/main/in/OptionalOverrideLeftHandRoomTurn";
constexpr auto k_actionOptionalOverrideRightHandRoomTurn
= "/actions/main/in/OptionalOverrideRightHandRoomTurn";
constexpr auto k_actionOptionalOverrideLeftHandRoomDrag
= "/actions/main/in/OptionalOverrideLeftHandRoomDrag";
constexpr auto k_actionOptionalOverrideRightHandRoomDrag
= "/actions/main/in/OptionalOverrideRightHandRoomDrag";
constexpr auto k_setMain = "/actions/main"; constexpr auto k_setMain = "/actions/main";
} // namespace input_strings } // namespace input_strings
+56 -15
View File
@@ -389,7 +389,10 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
SIGNAL( timeout() ), SIGNAL( timeout() ),
this, this,
SLOT( OnTimeoutPumpEvents() ) ); SLOT( OnTimeoutPumpEvents() ) );
m_pPumpEventsTimer->setInterval( 20 );
// Every 1ms we check if the current frame has advanced (for vysnc)
m_pPumpEventsTimer->setInterval( 1 );
m_pPumpEventsTimer->start(); m_pPumpEventsTimer->start();
m_steamVRTabController.initStage2( this, m_pWindow.get() ); m_steamVRTabController.initStage2( this, m_pWindow.get() );
@@ -496,9 +499,49 @@ void OverlayController::processInputBindings()
{ {
m_utilitiesTabController.sendMediaStopSong(); m_utilitiesTabController.sendMediaStopSong();
} }
// Execution order for moveCenterTabController actions is important. Don't
// reorder these. Override actions must always come after normal because
// active priority is set based on which action is "newest"
// normal actions:
m_moveCenterTabController.leftHandRoomDrag( m_actions.leftHandRoomDrag() );
m_moveCenterTabController.rightHandRoomDrag(
m_actions.rightHandRoomDrag() );
m_moveCenterTabController.leftHandRoomTurn( m_actions.leftHandRoomTurn() );
m_moveCenterTabController.rightHandRoomTurn(
m_actions.rightHandRoomTurn() );
// override actions:
m_moveCenterTabController.optionalOverrideLeftHandRoomDrag(
m_actions.optionalOverrideLeftHandRoomDrag() );
m_moveCenterTabController.optionalOverrideRightHandRoomDrag(
m_actions.optionalOverrideRightHandRoomDrag() );
m_moveCenterTabController.optionalOverrideLeftHandRoomTurn(
m_actions.optionalOverrideLeftHandRoomTurn() );
m_moveCenterTabController.optionalOverrideRightHandRoomTurn(
m_actions.optionalOverrideRightHandRoomTurn() );
} }
// vsync implementation:
// (this function triggers every 1ms)
void OverlayController::OnTimeoutPumpEvents() void OverlayController::OnTimeoutPumpEvents()
{
// get the current frame number from the VRSystem frame counter
vr::VRSystem()->GetTimeSinceLastVsync( nullptr, &m_currentFrame );
// Check if we are in the next frame yet
if ( m_currentFrame > m_lastFrame )
{
// If the frame has advanced since last check, it's time for our main
// event loop. (this function should trigger about every 11ms assuming
// 90fps compositor)
mainEventLoop();
// wait for the next frame after executing our main event loop once.
m_lastFrame = m_currentFrame;
}
}
void OverlayController::mainEventLoop()
{ {
if ( !vr::VRSystem() ) if ( !vr::VRSystem() )
return; return;
@@ -593,8 +636,8 @@ void OverlayController::OnTimeoutPumpEvents()
case vr::VREvent_Quit: case vr::VREvent_Quit:
{ {
LOG( INFO ) << "Received quit request."; LOG( INFO ) << "Received quit request.";
vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some time vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some
// just in case // time just in case
m_moveCenterTabController.reset(); m_moveCenterTabController.reset();
m_chaperoneTabController.shutdown(); m_chaperoneTabController.shutdown();
Shutdown(); Shutdown();
@@ -626,12 +669,11 @@ void OverlayController::OnTimeoutPumpEvents()
} }
break; break;
// Multiple ChaperoneUniverseHasChanged are often emitted at the same // Multiple ChaperoneUniverseHasChanged are often emitted at the
// time (some with a little bit of delay) There is no sure way to // same time (some with a little bit of delay) There is no sure way
// recognize redundant events, we can only exclude redundant events // to recognize redundant events, we can only exclude redundant
// during the same call of OnTimeoutPumpEvents() // events during the same call of OnTimeoutPumpEvents() INFO Removed
// INFO Removed logging on play space mover for possible crashing // logging on play space mover for possible crashing issues.
// issues.
case vr::VREvent_ChaperoneUniverseHasChanged: case vr::VREvent_ChaperoneUniverseHasChanged:
case vr::VREvent_ChaperoneDataHasChanged: case vr::VREvent_ChaperoneDataHasChanged:
{ {
@@ -639,8 +681,8 @@ void OverlayController::OnTimeoutPumpEvents()
{ {
// LOG(INFO) << "Re-loading chaperone data ..."; // LOG(INFO) << "Re-loading chaperone data ...";
m_chaperoneUtils.loadChaperoneData(); m_chaperoneUtils.loadChaperoneData();
// LOG(INFO) << "Found " << m_chaperoneUtils.quadsCount() << " // LOG(INFO) << "Found " << m_chaperoneUtils.quadsCount() <<
// chaperone quads."; if // " chaperone quads."; if
// (m_chaperoneUtils.isChaperoneWellFormed()) { LOG(INFO) << // (m_chaperoneUtils.isChaperoneWellFormed()) { LOG(INFO) <<
// "Chaperone data seems to be well-formed."; // "Chaperone data seems to be well-formed.";
//} else { //} else {
@@ -694,19 +736,18 @@ void OverlayController::OnTimeoutPumpEvents()
hmdSpeed hmdSpeed
= std::sqrt( vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2] ); = 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_fixFloorTabController.eventLoopTick( devicePoses );
m_statisticsTabController.eventLoopTick( m_statisticsTabController.eventLoopTick(
devicePoses, leftSpeed, rightSpeed ); devicePoses, leftSpeed, rightSpeed );
m_moveCenterTabController.eventLoopTick(
vr::VRCompositor()->GetTrackingSpace(), devicePoses );
m_steamVRTabController.eventLoopTick(); m_steamVRTabController.eventLoopTick();
m_chaperoneTabController.eventLoopTick( m_chaperoneTabController.eventLoopTick(
devicePoses, leftSpeed, rightSpeed, hmdSpeed ); devicePoses, leftSpeed, rightSpeed, hmdSpeed );
m_settingsTabController.eventLoopTick(); m_settingsTabController.eventLoopTick();
m_reviveTabController.eventLoopTick(); m_reviveTabController.eventLoopTick();
m_audioTabController.eventLoopTick(); m_audioTabController.eventLoopTick();
m_utilitiesTabController.eventLoopTick();
m_accessibilityTabController.eventLoopTick( m_accessibilityTabController.eventLoopTick(
vr::VRCompositor()->GetTrackingSpace() ); vr::VRCompositor()->GetTrackingSpace() );
+19
View File
@@ -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
@@ -85,6 +100,9 @@ private:
QSoundEffect m_focusChangedSoundEffect; QSoundEffect m_focusChangedSoundEffect;
QSoundEffect m_alarm01SoundEffect; QSoundEffect m_alarm01SoundEffect;
uint64_t m_currentFrame = 0;
uint64_t m_lastFrame = 0;
// OpenVR_Init must be declared before any other class that uses OpenVR // OpenVR_Init must be declared before any other class that uses OpenVR
// function calls since objects are initialized in order of declaration in // function calls since objects are initialized in order of declaration in
// the class. // the class.
@@ -164,6 +182,7 @@ public:
bool pollNextEvent( vr::VROverlayHandle_t ulOverlayHandle, bool pollNextEvent( vr::VROverlayHandle_t ulOverlayHandle,
vr::VREvent_t* pEvent ); vr::VREvent_t* pEvent );
void mainEventLoop();
public slots: public slots:
void renderOverlay(); void renderOverlay();
+50 -2
View File
@@ -25,6 +25,46 @@
"name": "/actions/main/in/StopTrack", "name": "/actions/main/in/StopTrack",
"requirement": "optional", "requirement": "optional",
"type": "boolean" "type": "boolean"
},
{
"name": "/actions/main/in/LeftHandRoomTurn",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/RightHandRoomTurn",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/LeftHandRoomDrag",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/RightHandRoomDrag",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/OptionalOverrideLeftHandRoomTurn",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/OptionalOverrideRightHandRoomTurn",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/OptionalOverrideLeftHandRoomDrag",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/main/in/OptionalOverrideRightHandRoomDrag",
"requirement": "optional",
"type": "boolean"
} }
], ],
"action_sets": [ "action_sets": [
@@ -35,14 +75,22 @@
], ],
"localization" : [ "localization" : [
{ {
"language_tag": "en", "language_tag": "en_US",
"/actions/main" : "Advanced Settings Actions", "/actions/main" : "Advanced Settings Actions",
"/actions/main/in/NextTrack" : "Play Next Track", "/actions/main/in/NextTrack" : "Play Next Track",
"/actions/main/in/PreviousTrack" : "Play Previous Track", "/actions/main/in/PreviousTrack" : "Play Previous Track",
"/actions/main/in/PausePlayTrack" : "Pause/Play Track", "/actions/main/in/PausePlayTrack" : "Pause/Play Track",
"/actions/main/in/StopTrack" : "Stop Track" "/actions/main/in/StopTrack" : "Stop Track",
"/actions/main/in/LeftHandRoomTurn" : "Left Hand Room Turn",
"/actions/main/in/RightHandRoomTurn" : "Right Hand Room Turn",
"/actions/main/in/LeftHandRoomDrag" : "Left Hand Room Drag",
"/actions/main/in/RightHandRoomDrag" : "Right Hand Room Drag",
"/actions/main/in/OptionalOverrideLeftHandRoomTurn" : "Optional Override Left Hand Room Turn",
"/actions/main/in/OptionalOverrideRightHandRoomTurn" : "Optional Override Right Hand Room Turn",
"/actions/main/in/OptionalOverrideLeftHandRoomDrag" : "Optional Override Left Hand Room Drag",
"/actions/main/in/OptionalOverrideRightHandRoomDrag" : "Optional Override Right Hand Room Drag"
} }
] ]
} }
+12 -2
View File
@@ -6,7 +6,7 @@ import matzman666.advsettings 1.0
MyStackViewPage { MyStackViewPage {
headerText: "Playspace Fix" headerText: "Room Fix"
content: ColumnLayout { content: ColumnLayout {
spacing: 18 spacing: 18
@@ -57,7 +57,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
id: recenterButton id: recenterButton
Layout.fillWidth: true Layout.fillWidth: true
text: "Recenter Playspace" text: "Recenter Room"
Layout.preferredHeight: 100 Layout.preferredHeight: 100
onClicked: { onClicked: {
FixFloorTabController.recenterClicked() FixFloorTabController.recenterClicked()
@@ -74,6 +74,16 @@ MyStackViewPage {
} }
} }
MyPushButton {
id: zeroRoomButton
Layout.fillWidth: true
text: "Apply Room Settings Offsets as Center"
Layout.preferredHeight: 100
onClicked: {
MoveCenterTabController.zeroOffsets()
}
}
Item { Item {
Layout.preferredHeight: 32 Layout.preferredHeight: 32
} }
+134 -104
View File
@@ -6,7 +6,7 @@ import matzman666.advsettings 1.0
MyStackViewPage { MyStackViewPage {
headerText: "Play Space Settings" headerText: "Room Settings"
content: ColumnLayout { content: ColumnLayout {
spacing: 18 spacing: 18
@@ -17,7 +17,7 @@ MyStackViewPage {
Layout.preferredWidth: 230 Layout.preferredWidth: 230
} }
MyText { MyText {
id: playspaceModeText id: roomModeText
font.bold: true font.bold: true
text: "Standing" text: "Standing"
} }
@@ -28,7 +28,7 @@ MyStackViewPage {
label: MyText { label: MyText {
leftPadding: 10 leftPadding: 10
text: "Move Play Space" text: "Move Room"
bottomPadding: -10 bottomPadding: -10
} }
background: Rectangle { background: Rectangle {
@@ -47,24 +47,29 @@ MyStackViewPage {
} }
GridLayout { GridLayout {
columns: 5 columns: 6
MyText { MyText {
text: "X-Axis (Left/Right):" text: "X-Axis (Left/Right):"
Layout.preferredWidth: 500 Layout.preferredWidth: 340
}
MyText {
text: " "
Layout.preferredWidth: 40
} }
MyPushButton2 { MyPushButton2 {
id: playSpaceMoveXMinusButton id: roomMoveXMinusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetX(-0.5) MoveCenterTabController.modOffsetX(-0.1)
} }
} }
MyTextField { MyTextField {
id: playSpaceMoveXText id: roomMoveXText
text: "0.00" text: "0.00"
keyBoardUID: 101 keyBoardUID: 101
Layout.preferredWidth: 140 Layout.preferredWidth: 140
@@ -83,16 +88,15 @@ MyStackViewPage {
} }
MyPushButton2 { MyPushButton2 {
id: playSpaceMoveXPlusButton id: roomMoveXPlusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetX(0.5) MoveCenterTabController.modOffsetX(0.1)
} }
} }
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockXToggle id: lockXToggle
text: "Lock X" text: "Lock X"
onCheckedChanged: { onCheckedChanged: {
@@ -102,19 +106,27 @@ MyStackViewPage {
MyText { MyText {
text: "Y-Axis (Down/Up):" text: "Y-Axis (Down/Up):"
Layout.preferredWidth: 380 Layout.preferredWidth: 340
}
MyPushButton2 {
Layout.preferredWidth: 40
text: "0"
onClicked: {
MoveCenterTabController.offsetY = 0
}
} }
MyPushButton2 { MyPushButton2 {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetY(-0.5) MoveCenterTabController.modOffsetY(-0.1)
} }
} }
MyTextField { MyTextField {
id: playSpaceMoveYText id: roomMoveYText
text: "0.00" text: "0.00"
keyBoardUID: 102 keyBoardUID: 102
Layout.preferredWidth: 140 Layout.preferredWidth: 140
@@ -136,13 +148,12 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetY(0.5) MoveCenterTabController.modOffsetY(0.1)
} }
} }
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockYToggle id: lockYToggle
text: "Lock Y" text: "Lock Y"
onCheckedChanged: { onCheckedChanged: {
@@ -152,19 +163,24 @@ MyStackViewPage {
MyText { MyText {
text: "Z-Axis (Forth/Back):" text: "Z-Axis (Forth/Back):"
Layout.preferredWidth: 380 Layout.preferredWidth: 340
}
MyText {
text: " "
Layout.preferredWidth: 40
} }
MyPushButton2 { MyPushButton2 {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetZ(-0.5) MoveCenterTabController.modOffsetZ(-0.1)
} }
} }
MyTextField { MyTextField {
id: playSpaceMoveZText id: roomMoveZText
text: "0.00" text: "0.00"
keyBoardUID: 103 keyBoardUID: 103
Layout.preferredWidth: 140 Layout.preferredWidth: 140
@@ -186,13 +202,12 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
MoveCenterTabController.modOffsetZ(0.5) MoveCenterTabController.modOffsetZ(0.1)
} }
} }
MyToggleButton { MyToggleButton {
Layout.preferredWidth: 240
id: lockZToggle id: lockZToggle
text: "Lock Z" text: "Lock Z"
onCheckedChanged: { onCheckedChanged: {
@@ -208,7 +223,7 @@ MyStackViewPage {
label: MyText { label: MyText {
leftPadding: 10 leftPadding: 10
text: "Rotate Play Space" text: "Rotate Room"
bottomPadding: -10 bottomPadding: -10
} }
background: Rectangle { background: Rectangle {
@@ -216,6 +231,7 @@ MyStackViewPage {
border.color: "#ffffff" border.color: "#ffffff"
radius: 8 radius: 8
} }
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@@ -229,76 +245,88 @@ MyStackViewPage {
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
MyPushButton2 { MyPushButton2 {
id: playSpaceRotationMinusButton id: roomRotationMinusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
var val = MoveCenterTabController.tempRotation - 45 var val = ( MoveCenterTabController.tempRotation / 100 ) - 45
if (val < -180) { if (val < -180) {
val = val + 360; val = val + 360;
} }
MoveCenterTabController.tempRotation = val MoveCenterTabController.tempRotation = val * 100
} }
} }
MySlider { MySlider {
id: playspaceRotationSlider id: roomRotationSlider
from: -180 from: -180
to: 180 to: 180
stepSize: 1 stepSize: 0.01
value: 0 value: 0
Layout.fillWidth: true Layout.fillWidth: true
onPositionChanged: { onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from)) var val = this.from + ( this.position * (this.to - this.from))
MoveCenterTabController.tempRotation = Math.round(val) MoveCenterTabController.tempRotation = Math.round(val * 100)
} }
onValueChanged: { onValueChanged: {
MoveCenterTabController.tempRotation = Math.round(playspaceRotationSlider.value) MoveCenterTabController.tempRotation = Math.round(roomRotationSlider.value * 100)
//playspaceRotationText.text = Math.round(playspaceRotationSlider.value) + "°" //roomRotationText.text = Math.round(roomRotationSlider.value) + "°"
} }
} }
MyPushButton2 { MyPushButton2 {
id: playSpaceRotationPlusButton id: roomRotationPlusButton
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
var val = MoveCenterTabController.tempRotation + 45 var val = ( MoveCenterTabController.tempRotation / 100 ) + 45
if (val > 180) { if (val > 180) {
val = val -360; val = val -360;
} }
MoveCenterTabController.tempRotation = val MoveCenterTabController.tempRotation = val * 100
} }
} }
MyTextField { MyTextField {
id: playspaceRotationText id: roomRotationText
text: "0°" text: "0°"
keyBoardUID: 104 keyBoardUID: 104
Layout.preferredWidth: 100 Layout.preferredWidth: 150
Layout.leftMargin: 10 Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) { function onInputEvent(input) {
var val = parseInt(input) var val = parseFloat(input)
if (!isNaN(val)) { if (!isNaN(val)) {
val = val % 180 val = val % 180
MoveCenterTabController.tempRotation = val MoveCenterTabController.tempRotation = Math.round(val * 100)
text = MoveCenterTabController.tempRotation + "°" text = ( MoveCenterTabController.tempRotation / 100 ) + "°"
} else { } else {
text = MoveCenterTabController.tempRotation + "°" text = ( MoveCenterTabController.tempRotation / 100 ) + "°"
} }
} }
} }
MyPushButton { MyPushButton {
id: playSpaceRotationApplyButton id: roomRotationApplyButton
Layout.preferredWidth: 145 Layout.preferredWidth: 145
text:"Apply" text:"Apply"
onClicked: { onClicked: {
MoveCenterTabController.rotation = MoveCenterTabController.tempRotation MoveCenterTabController.rotation = MoveCenterTabController.tempRotation
} }
}
}
MyToggleButton {
id: roomRotateHandToggle
text: "Enable Room-Turn Binding"
onCheckedChanged: {
MoveCenterTabController.rotateHand = this.checked
} }
} }
MyText {
text: "Note: TurnSignal will ignore turning during Room-Turn rotation."
font.pointSize: 15.0
}
} }
} }
} }
@@ -308,7 +336,7 @@ MyStackViewPage {
label: MyText { label: MyText {
leftPadding: 10 leftPadding: 10
text: "Virtual Move Shortcut" text: "Room Drag Binding"
bottomPadding: -10 bottomPadding: -10
} }
background: Rectangle { background: Rectangle {
@@ -318,10 +346,11 @@ MyStackViewPage {
} }
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
Layout.fillWidth: true
MyToggleButton { MyToggleButton {
id: moveShortcutLeft id: moveShortcutLeft
text: "Left Menu Button" text: "Enable Left Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.moveShortcutLeft = this.checked MoveCenterTabController.moveShortcutLeft = this.checked
} }
@@ -329,101 +358,102 @@ MyStackViewPage {
MyToggleButton { MyToggleButton {
id: moveShortcutRight id: moveShortcutRight
text: "Right Menu Button" text: "Enable Right Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.moveShortcutRight = this.checked MoveCenterTabController.moveShortcutRight = this.checked
} }
} }
MyToggleButton {
id: requireDoubleClick
text: "Require double click"
onCheckedChanged: {
MoveCenterTabController.requireDoubleClick = this.checked
}
}
} }
} }
} }
MyToggleButton { ColumnLayout {
id: playspaceAdjustChaperoneToggle RowLayout {
text: "Adjust Chaperone" Layout.fillWidth: true
onCheckedChanged: {
MoveCenterTabController.adjustChaperone = this.checked MyPushButton {
id: roomResetButton
Layout.preferredWidth: 250
text: "Reset"
onClicked: {
MoveCenterTabController.reset()
}
}
MyToggleButton {
id: roomAdjustChaperoneToggle
text: "Adjust Chaperone"
onCheckedChanged: {
MoveCenterTabController.adjustChaperone = this.checked
}
}
} }
} }
Item { Layout.fillHeight: true; Layout.fillWidth: true} Item { Layout.fillHeight: true; Layout.fillWidth: true}
MyPushButton {
id: playspaceResetButton
Layout.preferredWidth: 250
text: "Reset"
onClicked: {
MoveCenterTabController.reset()
}
}
Component.onCompleted: { Component.onCompleted: {
playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone roomAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) roomRotateHandToggle.checked = MoveCenterTabController.rotateHand
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) roomMoveXText.text = MoveCenterTabController.offsetX.toFixed(2)
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) roomMoveYText.text = MoveCenterTabController.offsetY.toFixed(2)
playspaceRotationSlider.value = MoveCenterTabController.rotation roomMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2)
roomRotationSlider.value = MoveCenterTabController.rotation
moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight
moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft
lockXToggle.checked = MoveCenterTabController.lockXToggle lockXToggle.checked = MoveCenterTabController.lockXToggle
lockYToggle.checked = MoveCenterTabController.lockYToggle lockYToggle.checked = MoveCenterTabController.lockYToggle
lockZToggle.checked = MoveCenterTabController.lockZToggle lockZToggle.checked = MoveCenterTabController.lockZToggle
requireDoubleClick.checked = MoveCenterTabController.requireDoubleClick
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
playspaceModeText.text = "Sitting" roomModeText.text = "Sitting"
playSpaceRotationPlusButton.enabled = false roomRotationPlusButton.enabled = false
playSpaceRotationMinusButton.enabled = false roomRotationMinusButton.enabled = false
playspaceRotationSlider.enabled = false roomRotationSlider.enabled = false
playspaceRotationText.text = "-" roomRotationText.text = "-"
} else if (MoveCenterTabController.trackingUniverse === 1) { } else if (MoveCenterTabController.trackingUniverse === 1) {
playspaceModeText.text = "Standing" roomModeText.text = "Standing"
playSpaceRotationPlusButton.enabled = true roomRotationPlusButton.enabled = true
playSpaceRotationMinusButton.enabled = true roomRotationMinusButton.enabled = true
playspaceRotationSlider.enabled = true roomRotationSlider.enabled = true
playspaceRotationText.text = "0°" roomRotationText.text = "0°"
} else { } else {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" roomModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
} }
} }
Connections { Connections {
target: MoveCenterTabController target: MoveCenterTabController
onOffsetXChanged: { onOffsetXChanged: {
playSpaceMoveXText.text = MoveCenterTabController.offsetX.toFixed(2) roomMoveXText.text = MoveCenterTabController.offsetX.toFixed(2)
} }
onOffsetYChanged: { onOffsetYChanged: {
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2) roomMoveYText.text = MoveCenterTabController.offsetY.toFixed(2)
} }
onOffsetZChanged: { onOffsetZChanged: {
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2) roomMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2)
} }
onRotationChanged: { onRotationChanged: {
playspaceRotationSlider.value = MoveCenterTabController.rotation roomRotationSlider.value = ( MoveCenterTabController.rotation / 100 )
} }
onTempRotationChanged: { onTempRotationChanged: {
playspaceRotationSlider.value = MoveCenterTabController.tempRotation roomRotationSlider.value = ( MoveCenterTabController.tempRotation / 100 )
playspaceRotationText.text = MoveCenterTabController.tempRotation + "°" roomRotationText.text = ( MoveCenterTabController.tempRotation / 100 ) + "°"
} }
onAdjustChaperoneChanged: { onAdjustChaperoneChanged: {
playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone roomAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone
}
onRotateHandChanged: {
roomRotateHandToggle.checked = MoveCenterTabController.rotateHand
} }
onMoveShortcutRightChanged: { onMoveShortcutRightChanged: {
moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight
} }
onMoveShortcutLeftChanged: { onMoveShortcutLeftChanged: {
moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft
}
onRequireDoubleClickChanged: {
requireDoubleClick.checked = MoveCenterTabController.requireDoubleClick
} }
onLockXToggleChanged: { onLockXToggleChanged: {
lockXToggle.checked = MoveCenterTabController.lockXToggle lockXToggle.checked = MoveCenterTabController.lockXToggle
@@ -436,19 +466,19 @@ MyStackViewPage {
} }
onTrackingUniverseChanged: { onTrackingUniverseChanged: {
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
playspaceModeText.text = "Sitting" roomModeText.text = "Sitting"
playSpaceRotationPlusButton.enabled = false roomRotationPlusButton.enabled = false
playSpaceRotationMinusButton.enabled = false roomRotationMinusButton.enabled = false
playspaceRotationSlider.enabled = false roomRotationSlider.enabled = false
playspaceRotationText.text = "-" roomRotationText.text = "-"
} else if (MoveCenterTabController.trackingUniverse === 1) { } else if (MoveCenterTabController.trackingUniverse === 1) {
playspaceModeText.text = "Standing" roomModeText.text = "Standing"
playSpaceRotationPlusButton.enabled = true roomRotationPlusButton.enabled = true
playSpaceRotationMinusButton.enabled = true roomRotationMinusButton.enabled = true
playspaceRotationSlider.enabled = true roomRotationSlider.enabled = true
playspaceRotationText.text = "0°" roomRotationText.text = "0°"
} else { } else {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")" roomModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
} }
} }
} }
+7 -4
View File
@@ -48,7 +48,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
id: playSpaceButton id: playSpaceButton
activationSoundEnabled: false activationSoundEnabled: false
text: "Play Space" text: "Room Settings"
Layout.fillWidth: true Layout.fillWidth: true
onClicked: { onClicked: {
MyResources.playFocusChangedSound() MyResources.playFocusChangedSound()
@@ -59,7 +59,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
id: fixFloorButton id: fixFloorButton
activationSoundEnabled: false activationSoundEnabled: false
text: "Playspace Fix" text: "Room Fix"
Layout.fillWidth: true Layout.fillWidth: true
onClicked: { onClicked: {
MyResources.playFocusChangedSound() MyResources.playFocusChangedSound()
@@ -416,7 +416,10 @@ MyStackViewPage {
reloadChaperoneProfiles() reloadChaperoneProfiles()
reloadSteamVRProfiles() reloadSteamVRProfiles()
reloadPttProfiles() reloadPttProfiles()
summaryVersionText.text = applicationVersion summaryVersionText.text = applicationVersion
if (MoveCenterTabController.trackingUniverse === 0) { if (MoveCenterTabController.trackingUniverse === 0) {
summaryPlaySpaceModeText.text = "Sitting" summaryPlaySpaceModeText.text = "Sitting"
} else if (MoveCenterTabController.trackingUniverse === 1) { } else if (MoveCenterTabController.trackingUniverse === 1) {
@@ -486,9 +489,9 @@ MyStackViewPage {
function updateStatistics() { function updateStatistics() {
var rotations = StatisticsTabController.hmdRotations var rotations = StatisticsTabController.hmdRotations
if (rotations > 0) { if (rotations > 0) {
summaryHmdRotationsText.text = rotations.toFixed(1) + " CCW" summaryHmdRotationsText.text = rotations.toFixed(2) + " CCW"
} else { } else {
summaryHmdRotationsText.text = -rotations.toFixed(1) + " CW" summaryHmdRotationsText.text = -rotations.toFixed(2) + " CW"
} }
summaryDroppedFramesText.text = StatisticsTabController.droppedFrames summaryDroppedFramesText.text = StatisticsTabController.droppedFrames
summaryReprojectedFramesText.text = StatisticsTabController.reprojectedFrames summaryReprojectedFramesText.text = StatisticsTabController.reprojectedFrames
+2 -2
View File
@@ -198,9 +198,9 @@ MyStackViewPage {
statsHmdMovedText.text = StatisticsTabController.hmdDistanceMoved.toFixed(1) + " m" statsHmdMovedText.text = StatisticsTabController.hmdDistanceMoved.toFixed(1) + " m"
var rotations = StatisticsTabController.hmdRotations var rotations = StatisticsTabController.hmdRotations
if (rotations > 0) { if (rotations > 0) {
statsHmdRotationText.text = rotations.toFixed(1) + " CCW" statsHmdRotationText.text = rotations.toFixed(2) + " CCW"
} else { } else {
statsHmdRotationText.text = -rotations.toFixed(1) + " CW" statsHmdRotationText.text = -rotations.toFixed(2) + " CW"
} }
statsLeftControllerSpeedText.text = " " + StatisticsTabController.leftControllerMaxSpeed.toFixed(1) + " m/s" statsLeftControllerSpeedText.text = " " + StatisticsTabController.leftControllerMaxSpeed.toFixed(1) + " m/s"
statsRightControllerSpeedText.text = " " + StatisticsTabController.rightControllerMaxSpeed.toFixed(1) + " m/s" statsRightControllerSpeedText.text = " " + StatisticsTabController.rightControllerMaxSpeed.toFixed(1) + " m/s"
@@ -116,9 +116,13 @@ void AccessibilityTabController::eventLoopTick(
{ {
return; return;
} }
if ( settingsUpdateCounter >= 50 )
if ( settingsUpdateCounter >= k_accessibilitySettingsUpdateCounter )
{ {
setTrackingUniverse( ( int ) universe ); if ( parent->isDashboardVisible() )
{
setTrackingUniverse( ( int ) universe );
}
settingsUpdateCounter = 0; settingsUpdateCounter = 0;
} }
else else
+2 -1
View File
@@ -168,7 +168,8 @@ void AudioTabController::eventLoopTick()
{ {
return; return;
} }
if ( settingsUpdateCounter >= 50 )
if ( settingsUpdateCounter >= k_audioSettingsUpdateCounter )
{ {
if ( m_micProximitySensorCanMute ) if ( m_micProximitySensorCanMute )
{ {
+53 -47
View File
@@ -649,66 +649,72 @@ void ChaperoneTabController::eventLoopTick(
} }
} }
if ( settingsUpdateCounter >= 50 ) if ( settingsUpdateCounter >= k_chaperoneSettingsUpdateCounter )
{ {
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
+1 -1
View File
@@ -145,7 +145,7 @@ void FixFloorTabController::eventLoopTick(
floorOffsetZ = tempOffsetZ; floorOffsetZ = tempOffsetZ;
LOG( INFO ) LOG( INFO )
<< "Fix Floor and adjust playspace center: Floor Offset = [" << "Fix Floor and adjust room center: Floor Offset = ["
<< floorOffsetX << ", " << floorOffsetY << ", " << floorOffsetX << ", " << floorOffsetY << ", "
<< floorOffsetZ << "]"; << floorOffsetZ << "]";
float offset[3] = { 0, 0, 0 }; float offset[3] = { 0, 0, 0 };
File diff suppressed because it is too large Load Diff
+54 -14
View File
@@ -4,12 +4,18 @@
#include <QObject> #include <QObject>
#include <openvr.h> #include <openvr.h>
#include <chrono> #include <chrono>
#include <qmath.h>
class QQuickWindow; class QQuickWindow;
// application namespace // application namespace
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
@@ -33,14 +39,14 @@ class MoveCenterTabController : public QObject
setMoveShortcutRight NOTIFY moveShortcutRightChanged ) setMoveShortcutRight NOTIFY moveShortcutRightChanged )
Q_PROPERTY( bool moveShortcutLeft READ moveShortcutLeft WRITE Q_PROPERTY( bool moveShortcutLeft READ moveShortcutLeft WRITE
setMoveShortcutLeft NOTIFY moveShortcutLeftChanged ) setMoveShortcutLeft NOTIFY moveShortcutLeftChanged )
Q_PROPERTY( bool requireDoubleClick READ requireDoubleClick WRITE
setRequireDoubleClick NOTIFY requireDoubleClickChanged )
Q_PROPERTY( bool lockXToggle READ lockXToggle WRITE setLockX NOTIFY Q_PROPERTY( bool lockXToggle READ lockXToggle WRITE setLockX NOTIFY
requireLockXChanged ) requireLockXChanged )
Q_PROPERTY( bool lockYToggle READ lockYToggle WRITE setLockY NOTIFY Q_PROPERTY( bool lockYToggle READ lockYToggle WRITE setLockY NOTIFY
requireLockYChanged ) requireLockYChanged )
Q_PROPERTY( bool lockZToggle READ lockZToggle WRITE setLockZ NOTIFY Q_PROPERTY( bool lockZToggle READ lockZToggle WRITE setLockZ NOTIFY
requireLockZChanged ) requireLockZChanged )
Q_PROPERTY( bool rotateHand READ rotateHand WRITE setRotateHand NOTIFY
rotateHandChanged )
private: private:
OverlayController* parent; OverlayController* parent;
@@ -52,24 +58,45 @@ private:
float m_offsetZ = 0.0f; float m_offsetZ = 0.0f;
int m_rotation = 0; int m_rotation = 0;
int m_tempRotation = 0; int m_tempRotation = 0;
int m_rotationOld = 0;
bool m_adjustChaperone = true; bool m_adjustChaperone = true;
bool m_settingsHandTurningEnabled = false;
bool m_moveShortcutRightPressed = false; bool m_moveShortcutRightPressed = false;
bool m_moveShortcutLeftPressed = false; bool m_moveShortcutLeftPressed = false;
vr::ETrackedControllerRole m_activeMoveController; vr::TrackedDeviceIndex_t m_activeMoveController;
float m_lastControllerPosition[3]; float m_lastControllerPosition[3];
bool m_moveShortcutRightEnabled = false; bool m_settingsRightHandDragEnabled = false;
bool m_moveShortcutLeftEnabled = false; bool m_settingsLeftHandDragEnabled = false;
bool m_requireDoubleClick = false;
bool m_lockXToggle = false; bool m_lockXToggle = false;
bool m_lockYToggle = false; bool m_lockYToggle = false;
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.
vr::HmdQuaternion_t m_lastHandQuaternion
= { k_quaternionInvalidValue, 0.0, 0.0, 0.0 };
vr::HmdQuaternion_t m_handQuaternion;
// Set lastHmdQuaternion.w to -1000.0 when last hmd pose is invalid.
vr::HmdQuaternion_t m_lastHmdQuaternion
= { k_quaternionInvalidValue, 0.0, 0.0, 0.0 };
vr::HmdQuaternion_t m_hmdQuaternion;
double m_hmdYawTotal = 0.0;
vr::ETrackedControllerRole m_activeDragHand
= vr::TrackedControllerRole_Invalid;
vr::ETrackedControllerRole m_lastMoveHand
= vr::TrackedControllerRole_Invalid;
vr::ETrackedControllerRole m_activeTurnHand
= vr::TrackedControllerRole_Invalid;
vr::ETrackedControllerRole m_lastRotateHand
= vr::TrackedControllerRole_Invalid;
bool m_leftHandDragPressed = false;
bool m_rightHandDragPressed = false;
bool m_overrideLeftHandDragPressed = false;
bool m_overrideRightHandDragPressed = false;
bool m_leftHandTurnPressed = false;
bool m_rightHandTurnPressed = false;
bool m_overrideLeftHandTurnPressed = false;
bool m_overrideRightHandTurnPressed = false;
unsigned settingsUpdateCounter = 0; unsigned settingsUpdateCounter = 0;
vr::ETrackedControllerRole getMoveShortcutHand();
public: public:
void initStage1(); void initStage1();
void initStage2( OverlayController* parent, QQuickWindow* widget ); void initStage2( OverlayController* parent, QQuickWindow* widget );
@@ -83,12 +110,24 @@ public:
int rotation() const; int rotation() const;
int tempRotation() const; int tempRotation() const;
bool adjustChaperone() const; bool adjustChaperone() const;
bool rotateHand() const;
bool moveShortcutRight() const; bool moveShortcutRight() const;
bool moveShortcutLeft() const; bool moveShortcutLeft() const;
bool requireDoubleClick() const;
bool lockXToggle() const; bool lockXToggle() const;
bool lockYToggle() const; bool lockYToggle() const;
bool lockZToggle() const; bool lockZToggle() const;
double getHmdYawTotal();
void resetHmdYawTotal();
// actions:
void leftHandRoomDrag( bool leftHandDragActive );
void rightHandRoomDrag( bool rightHandDragActive );
void optionalOverrideLeftHandRoomDrag( bool overrideLeftHandDragActive );
void optionalOverrideRightHandRoomDrag( bool overrideRightHandDragActive );
void leftHandRoomTurn( bool leftHandTurnActive );
void rightHandRoomTurn( bool rightHandTurnActive );
void optionalOverrideLeftHandRoomTurn( bool overrideLeftHandTurnActive );
void optionalOverrideRightHandRoomTurn( bool overrideRightHandTurnActive );
public slots: public slots:
int trackingUniverse() const; int trackingUniverse() const;
@@ -104,9 +143,10 @@ public slots:
void setAdjustChaperone( bool value, bool notify = true ); void setAdjustChaperone( bool value, bool notify = true );
void setRotateHand( bool value, bool notify = true );
void setMoveShortcutRight( bool value, bool notify = true ); void setMoveShortcutRight( bool value, bool notify = true );
void setMoveShortcutLeft( bool value, bool notify = true ); void setMoveShortcutLeft( bool value, bool notify = true );
void setRequireDoubleClick( bool value, bool notify = true );
void modOffsetX( float value, bool notify = true ); void modOffsetX( float value, bool notify = true );
void modOffsetY( float value, bool notify = true ); void modOffsetY( float value, bool notify = true );
@@ -116,8 +156,8 @@ public slots:
void setLockY( bool value, bool notify = true ); void setLockY( bool value, bool notify = true );
void setLockZ( bool value, bool notify = true ); void setLockZ( bool value, bool notify = true );
void applyRotation();
void reset(); void reset();
void zeroOffsets();
signals: signals:
void trackingUniverseChanged( int value ); void trackingUniverseChanged( int value );
@@ -127,9 +167,9 @@ signals:
void rotationChanged( int value ); void rotationChanged( int value );
void tempRotationChanged( int value ); void tempRotationChanged( int value );
void adjustChaperoneChanged( bool value ); void adjustChaperoneChanged( bool value );
void rotateHandChanged( bool value );
void moveShortcutRightChanged( bool value ); void moveShortcutRightChanged( bool value );
void moveShortcutLeftChanged( bool value ); void moveShortcutLeftChanged( bool value );
void requireDoubleClickChanged( bool value );
void requireLockXChanged( bool value ); void requireLockXChanged( bool value );
void requireLockYChanged( bool value ); void requireLockYChanged( bool value );
void requireLockZChanged( bool value ); void requireLockZChanged( bool value );
+160 -145
View File
@@ -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 >= k_reviveSettingsUpdateCounter )
{ {
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
{ {
+6 -3
View File
@@ -28,10 +28,13 @@ void SettingsTabController::initStage2( OverlayController* var_parent,
void SettingsTabController::eventLoopTick() void SettingsTabController::eventLoopTick()
{ {
if ( settingsUpdateCounter >= 50 ) if ( settingsUpdateCounter >= k_settingsTabSettingsUpdateCounter )
{ {
setAutoStartEnabled( vr::VRApplications()->GetApplicationAutoLaunch( if ( parent->isDashboardVisible() )
OverlayController::applicationKey ) ); {
setAutoStartEnabled( vr::VRApplications()->GetApplicationAutoLaunch(
OverlayController::applicationKey ) );
}
settingsUpdateCounter = 0; settingsUpdateCounter = 0;
} }
else else
+6 -120
View File
@@ -77,126 +77,11 @@ void StatisticsTabController::eventLoopTick(
m_rightControllerMaxSpeed = rightSpeed; m_rightControllerMaxSpeed = rightSpeed;
} }
// Hmd Rotation // // HMD Rotation //
/* double roomHmdYawTotal = parent->m_moveCenterTabController.getHmdYawTotal();
| Intrinsic y-x'-z" rotation matrix: m_hmdRotation = static_cast<float>( roomHmdYawTotal / ( 2.0 * M_PI ) );
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy |
| cp*sr | cp*cr |-sp |
| cy*sp*sr-cr*sy | cr*cy*sp+sr*sy | cp*cy |
yaw = atan2(cp*sy, cp*cy) [pi, -pi], CCW if ( lastPosTimer <= 0 )
pitch = -asin(-sp) [pi/2, -pi/2]
roll = atan2(cp*sr, cp*cr) [pi, -pi], CW
*/
double yawRaw = 0.0;
double yaw = 0.0;
bool rotationChanged = false;
if ( devicePoses[0].bPoseIsValid
&& devicePoses[0].eTrackingResult == vr::TrackingResult_Running_OK )
{
yawRaw = std::atan2( m[0][2], m[2][2] );
if ( yawRaw < 0.0f )
{
yawRaw += 2 * M_PI; // map to [0, 2*pi], CCW
}
yaw = yawRaw - rotationOffset;
if ( yaw < 0.0 )
{
yaw = 2 * M_PI + yaw;
}
if ( rotationResetFlag )
{
rotationDir = 0;
rotationCounter = 0;
rotationOffset = yawRaw;
rotationResetFlag = false;
lastYaw = -1.0f;
rotationChanged = true;
}
else if ( lastYaw < 0.0f && yaw > 0.0 )
{
lastYaw = yaw;
rotationChanged = true;
if ( yaw <= M_PI )
{
rotationDir = 1;
}
else
{
rotationDir = -1;
}
}
else if ( std::abs( lastYaw - yaw ) >= 0.01 && yaw > 0.0 )
{
auto diff = yaw - lastYaw;
int mode = 0;
if ( std::abs( diff ) > M_PI )
{
if ( diff < -M_PI )
{ // CCW overflow
mode = 1;
}
else if ( diff > M_PI )
{ // CW overflow
mode = -1;
}
}
else
{
if ( lastYaw < 0.0 && yaw > 0.0 )
{
mode = 1;
}
else if ( lastYaw > 0.0 && yaw < 0.0 )
{
mode = -1;
}
}
if ( mode > 0 )
{
if ( rotationCounter == 0 && rotationDir <= 0 )
{
rotationDir = 1;
}
else
{
rotationCounter++;
}
}
else if ( mode < 0 )
{
if ( rotationCounter == 0 && rotationDir >= 0 )
{
rotationDir = -1;
}
else
{
rotationCounter--;
}
}
lastYaw = yaw;
rotationChanged = true;
}
}
else
{
lastYaw = -1;
}
if ( rotationChanged )
{
m_hmdRotation = ( float ) rotationCounter;
if ( rotationDir > 0 )
{
m_hmdRotation += yaw / ( 2 * M_PI );
}
else if ( rotationDir < 0 )
{
m_hmdRotation += -1.0f + yaw / ( 2 * M_PI );
}
}
if ( lastPosTimer == 0 )
{ {
lastPosTimer = 10; lastPosTimer = 10;
} }
@@ -273,7 +158,8 @@ void StatisticsTabController::statsDistanceResetClicked()
void StatisticsTabController::statsRotationResetClicked() void StatisticsTabController::statsRotationResetClicked()
{ {
rotationResetFlag = true; // rotationResetFlag = true;
parent->m_moveCenterTabController.resetHmdYawTotal();
} }
void StatisticsTabController::statsLeftControllerSpeedResetClicked() void StatisticsTabController::statsLeftControllerSpeedResetClicked()
+76 -70
View File
@@ -22,82 +22,88 @@ void SteamVRTabController::initStage2( OverlayController* var_parent,
void SteamVRTabController::eventLoopTick() void SteamVRTabController::eventLoopTick()
{ {
if ( settingsUpdateCounter >= 50 ) if ( settingsUpdateCounter >= k_steamVrSettingsUpdateCounter )
{ {
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
@@ -321,7 +321,7 @@ vr::VROverlayHandle_t createBatteryOverlay( vr::TrackedDeviceIndex_t index )
void UtilitiesTabController::eventLoopTick() void UtilitiesTabController::eventLoopTick()
{ {
if ( settingsUpdateCounter >= 10 ) if ( settingsUpdateCounter >= k_utilitiesSettingsUpdateCounter )
{ {
vr::VROverlayHandle_t pOverlayHandle; vr::VROverlayHandle_t pOverlayHandle;
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey, auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
+46
View File
@@ -107,4 +107,50 @@ inline vr::HmdVector3_t& matMul33( vr::HmdVector3_t& result,
return result; return result;
} }
inline vr::HmdQuaternion_t getQuaternion( vr::HmdMatrix34_t matrix )
{
vr::HmdQuaternion_t q;
q.w = sqrt(
fmax( 0, 1 + matrix.m[0][0] + matrix.m[1][1] + matrix.m[2][2] ) )
/ 2;
q.x = sqrt(
fmax( 0, 1 + matrix.m[0][0] - matrix.m[1][1] - matrix.m[2][2] ) )
/ 2;
q.y = sqrt(
fmax( 0, 1 - matrix.m[0][0] + matrix.m[1][1] - matrix.m[2][2] ) )
/ 2;
q.z = sqrt(
fmax( 0, 1 - matrix.m[0][0] - matrix.m[1][1] + matrix.m[2][2] ) )
/ 2;
q.x = copysign( q.x, matrix.m[2][1] - matrix.m[1][2] );
q.y = copysign( q.y, matrix.m[0][2] - matrix.m[2][0] );
q.z = copysign( q.z, matrix.m[1][0] - matrix.m[0][1] );
return q;
}
inline vr::HmdQuaternion_t multiplyQuaternion( const vr::HmdQuaternion_t& lhs,
const vr::HmdQuaternion_t& rhs )
{
return { ( lhs.w * rhs.w ) - ( lhs.x * rhs.x ) - ( lhs.y * rhs.y )
- ( lhs.z * rhs.z ),
( lhs.w * rhs.x ) + ( lhs.x * rhs.w ) + ( lhs.y * rhs.z )
- ( lhs.z * rhs.y ),
( lhs.w * rhs.y ) + ( lhs.y * rhs.w ) + ( lhs.z * rhs.x )
- ( lhs.x * rhs.z ),
( lhs.w * rhs.z ) + ( lhs.z * rhs.w ) + ( lhs.x * rhs.y )
- ( lhs.y * rhs.x ) };
}
inline vr::HmdQuaternion_t
quaternionConjugate( const vr::HmdQuaternion_t& quat )
{
return {
quat.w,
-quat.x,
-quat.y,
-quat.z,
};
}
} // end namespace utils } // end namespace utils