Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
debug
release
assets
*.vcxproj*
*.log
*.vs
*.stash
*.appxmanifest
*.user
6 changes: 6 additions & 0 deletions bin/win64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
*.exe
*.dll
*.pdb
qtdata
!openvr_api.dll
1 change: 1 addition & 0 deletions bin/win64/res/qml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.qmlc
27 changes: 19 additions & 8 deletions bin/win64/res/qml/MyToggleButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ import "." // QTBUG-34418, singletons require explicit import to load qmldir fil


CheckBox {
hoverEnabled: true
spacing: 12
checkState: Qt.Checked
tristate: false
hoverEnabled: true
spacing: 12

indicator: Rectangle {
implicitWidth: 28
implicitHeight: 28
x: parent.leftPadding
y: parent.height / 2 - height / 2
color: parent.enabled ? (parent.down ? "#e0e0e0" : "#ffffff") : "#a0a0a0"
border.width: 0
color: parent.enabled ? (parent.down ? "#e0e0e0" : "#ffffff") : "#a0a0a0"
border.width: 0
Path {
startX: 0
startY: 0
PathLine {
x: 40
y: 40
}
}

Image {
width: 38
height: 38
width: 28
height: 28
x: (parent.width - width) / 2
y: (parent.height - height) / 2
source: "image://default/check/#2c435d"
source: "check.svg"
sourceSize.width: width
sourceSize.height: height
visible: parent.parent.checked
Expand All @@ -36,7 +47,7 @@ CheckBox {

background: Rectangle {
color: "#2c435d"
opacity: parent.activeFocus ? 1.0 : 0.0
opacity: parent.activeFocus ? 1.0 : 0
}

onHoveredChanged: {
Expand Down
44 changes: 43 additions & 1 deletion bin/win64/res/qml/PlayspacePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,40 @@ MyStackViewPage {
}
}

GroupBox {
Layout.fillWidth: true

label: MyText {
leftPadding: 10
text: "Virtual Move Shortcut"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
RowLayout {
anchors.fill: parent

MyToggleButton {
id: moveShortcutLeft
text: "Left Menu Button"
onCheckedChanged: {
MoveCenterTabController.moveShortcutLeft = this.checked
}
}

MyToggleButton {
id: moveShortcutRight
text: "Right Menu Button"
onCheckedChanged: {
MoveCenterTabController.moveShortcutRight = this.checked
}
}
}
}

MyToggleButton {
id: playspaceAdjustChaperoneToggle
text: "Adjust Chaperone"
Expand All @@ -290,6 +324,8 @@ MyStackViewPage {
playSpaceMoveYText.text = MoveCenterTabController.offsetY.toFixed(2)
playSpaceMoveZText.text = MoveCenterTabController.offsetZ.toFixed(2)
playspaceRotationSlider.value = MoveCenterTabController.rotation
moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight;
moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft;
if (MoveCenterTabController.trackingUniverse === 0) {
playspaceModeText.text = "Sitting"
playSpaceRotationPlusButton.enabled = false
Expand Down Expand Up @@ -322,7 +358,13 @@ MyStackViewPage {
playspaceRotationSlider.value = MoveCenterTabController.rotation
}
onAdjustChaperoneChanged: {
playspaceAdjustChaperoneToggle = value
playspaceAdjustChaperoneToggle.checked = MoveCenterTabController.adjustChaperone
}
onMoveShortcutRightChanged: {
moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight
}
onMoveShortcutLeftChanged: {
moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft
}
onTrackingUniverseChanged: {
if (MoveCenterTabController.trackingUniverse === 0) {
Expand Down
1 change: 1 addition & 0 deletions bin/win64/res/qml/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 28 additions & 7 deletions src/overlaycontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void OverlayController::OnTimeoutPumpEvents() {

fixFloorTabController.eventLoopTick(devicePoses);
statisticsTabController.eventLoopTick(devicePoses, leftSpeed, rightSpeed);
moveCenterTabController.eventLoopTick(vr::VRCompositor()->GetTrackingSpace());
moveCenterTabController.eventLoopTick(vr::VRCompositor()->GetTrackingSpace(), devicePoses);
steamVRTabController.eventLoopTick();
chaperoneTabController.eventLoopTick(devicePoses, leftSpeed, rightSpeed, hmdSpeed);
settingsTabController.eventLoopTick();
Expand All @@ -475,7 +475,13 @@ void OverlayController::OnTimeoutPumpEvents() {
}

void OverlayController::AddOffsetToUniverseCenter(vr::ETrackingUniverseOrigin universe, unsigned axisId, float offset, bool adjustBounds, bool commit) {
if (offset != 0.0f) {
float offsetArray[3] = { 0,0,0 };
offsetArray[axisId] = offset;
AddOffsetToUniverseCenter(universe, offsetArray, adjustBounds, commit);
}

void OverlayController::AddOffsetToUniverseCenter(vr::ETrackingUniverseOrigin universe, float offset[3], bool adjustBounds, bool commit) {
if (offset[0] != 0.0f || offset[1] != 0.0f || offset[2] != 0.0f) {
if (commit) {
vr::VRChaperoneSetup()->RevertWorkingCopy();
}
Expand All @@ -485,16 +491,23 @@ void OverlayController::AddOffsetToUniverseCenter(vr::ETrackingUniverseOrigin un
} else {
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(&curPos);
}
curPos.m[0][3] += curPos.m[0][axisId] * offset;
curPos.m[1][3] += curPos.m[1][axisId] * offset;
curPos.m[2][3] += curPos.m[2][axisId] * offset;
for (int i = 0; i < 3; i++) {
curPos.m[0][3] += curPos.m[0][i] * offset[i];
curPos.m[1][3] += curPos.m[1][i] * offset[i];
curPos.m[2][3] += curPos.m[2][i] * offset[i];
}
if (universe == vr::TrackingUniverseStanding) {
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(&curPos);
} else {
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(&curPos);
}
if (adjustBounds && universe == vr::TrackingUniverseStanding) {
AddOffsetToCollisionBounds(axisId, -offset, false);
float collisionOffset[] = {
-offset[0],
-offset[1],
-offset[2]
};
AddOffsetToCollisionBounds(collisionOffset, false);
}
if (commit) {
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
Expand Down Expand Up @@ -537,6 +550,12 @@ void OverlayController::RotateUniverseCenter(vr::ETrackingUniverseOrigin univers


void OverlayController::AddOffsetToCollisionBounds(unsigned axisId, float offset, bool commit) {
float offsetArray[3] = { 0,0,0 };
offsetArray[axisId] = offset;
AddOffsetToCollisionBounds(offsetArray, commit);
}

void OverlayController::AddOffsetToCollisionBounds(float offset[3], bool commit) {
// Apparently Valve sanity-checks the y-coordinates of the collision bounds (and only the y-coordinates)
// I can move the bounds on the xz-plane, I can make the "ceiling" of the chaperone cage lower/higher, but when I
// dare to set one single lower corner to something non-zero, every corner gets its y-coordinates reset to the defaults.
Expand All @@ -551,7 +570,9 @@ void OverlayController::AddOffsetToCollisionBounds(unsigned axisId, float offset
vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo(collisionBounds, &collisionBoundsCount);
for (unsigned b = 0; b < collisionBoundsCount; b++) {
for (unsigned c = 0; c < 4; c++) {
collisionBounds[b].vCorners[c].v[axisId] += offset;
collisionBounds[b].vCorners[c].v[0] += offset[0];
collisionBounds[b].vCorners[c].v[1] += offset[1];
collisionBounds[b].vCorners[c].v[2] += offset[2];
}
}
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(collisionBounds, collisionBoundsCount);
Expand Down
2 changes: 2 additions & 0 deletions src/overlaycontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ class OverlayController : public QObject {
void SetWidget(QQuickItem* quickItem, const std::string& name, const std::string& key = "");

void AddOffsetToUniverseCenter(vr::ETrackingUniverseOrigin universe, unsigned axisId, float offset, bool adjustBounds = true, bool commit = true);
void AddOffsetToUniverseCenter(vr::ETrackingUniverseOrigin universe, float offset[3], bool adjustBounds = true, bool commit = true);
void RotateUniverseCenter(vr::ETrackingUniverseOrigin universe, float yAngle, bool adjustBounds = true, bool commit = true); // around y axis
void AddOffsetToCollisionBounds(unsigned axisId, float offset, bool commit = true);
void AddOffsetToCollisionBounds(float offset[3], bool commit = true);
void RotateCollisionBounds(float angle, bool commit = true); // around y axis

bool isDesktopMode() { return desktopMode; };
Expand Down
Loading