Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v20.8.1 #2111

Merged
merged 1 commit into from
May 7, 2024
Merged
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
40 changes: 28 additions & 12 deletions alvr/server/cpp/alvr_server/ChaperoneUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,27 @@ void _SetChaperoneArea(float areaWidth, float areaHeight) {
perimeterPoints[3][0] = 1.0f * areaWidth;
perimeterPoints[3][1] = -1.0f * areaHeight;

vr::VRChaperoneSetup()->SetWorkingPerimeter(
reinterpret_cast<vr::HmdVector2_t *>(perimeterPoints), 4);
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(&MATRIX_IDENTITY);
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(&MATRIX_IDENTITY);
vr::VRChaperoneSetup()->SetWorkingPlayAreaSize(areaWidth, areaHeight);
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);

// Hide SteamVR Chaperone
vr::VRSettings()->SetFloat(
vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_FadeDistance_Float, 0.0f);
auto setup = vr::VRChaperoneSetup();

if (setup != nullptr)
{
vr::VRChaperoneSetup()->SetWorkingPerimeter(
reinterpret_cast<vr::HmdVector2_t *>(perimeterPoints), 4);
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(&MATRIX_IDENTITY);
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(&MATRIX_IDENTITY);
vr::VRChaperoneSetup()->SetWorkingPlayAreaSize(areaWidth, areaHeight);
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
}

auto settings = vr::VRSettings();

if (settings != nullptr)
{
// Hide SteamVR Chaperone
vr::VRSettings()->SetFloat(
vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_FadeDistance_Float, 0.0f);
}

#endif
}

Expand All @@ -91,10 +102,15 @@ std::unique_ptr<vr::HmdMatrix34_t> GetInvZeroPose() {
{
return nullptr;
}
std::unique_ptr<vr::HmdMatrix34_t> mat;
auto mat = std::make_unique<vr::HmdMatrix34_t>();
// revert pulls live into working copy
vr::VRChaperoneSetup()->RevertWorkingCopy();
if (vr::VRCompositor()->GetTrackingSpace() == vr::TrackingUniverseStanding) {
auto compositor = vr::VRCompositor();
if (compositor == nullptr)
{
return nullptr;
}
if (compositor->GetTrackingSpace() == vr::TrackingUniverseStanding) {
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(mat.get());
} else {
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(mat.get());
Expand Down
2 changes: 1 addition & 1 deletion alvr/server/cpp/alvr_server/alvr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ std::unique_ptr<vr::HmdMatrix34_t> GetRawZeroPose() {
{
return nullptr;
}
return vrmath::matInv33(std::move(invZeroPose));
return std::make_unique<vr::HmdMatrix34_t>(vrmath::matInv33(*invZeroPose));
}

bool IsOpenvrClientReady();
Expand Down
56 changes: 28 additions & 28 deletions alvr/server/cpp/alvr_server/include/openvr_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,42 +298,42 @@ namespace vrmath {
return result;
}

inline std::unique_ptr<vr::HmdMatrix34_t> matInv33(std::unique_ptr<vr::HmdMatrix34_t> matrix) {
std::unique_ptr<vr::HmdMatrix34_t> result;
float cofac00 = matrix->m[1][1] * matrix->m[2][2] - matrix->m[1][2] * matrix->m[2][1];
float cofac10 = matrix->m[1][2] * matrix->m[2][0] - matrix->m[1][0] * matrix->m[2][2];
float cofac20 = matrix->m[1][0] * matrix->m[2][1] - matrix->m[1][1] * matrix->m[2][0];
inline vr::HmdMatrix34_t matInv33(vr::HmdMatrix34_t matrix) {
vr::HmdMatrix34_t result;
float cofac00 = matrix.m[1][1] * matrix.m[2][2] - matrix.m[1][2] * matrix.m[2][1];
float cofac10 = matrix.m[1][2] * matrix.m[2][0] - matrix.m[1][0] * matrix.m[2][2];
float cofac20 = matrix.m[1][0] * matrix.m[2][1] - matrix.m[1][1] * matrix.m[2][0];

float det = matrix->m[0][0] * cofac00 + matrix->m[0][1] * cofac10 + matrix->m[0][2] * cofac20;
float det = matrix.m[0][0] * cofac00 + matrix.m[0][1] * cofac10 + matrix.m[0][2] * cofac20;

if (det == 0) {
vr::HmdMatrix34_t result = { { { 1.0, 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 } } };
return std::make_unique<vr::HmdMatrix34_t>(result);
return result;
}

float invDet = 1.0f / det;

float cofac01 = matrix->m[0][2] * matrix->m[2][1] - matrix->m[0][1] * matrix->m[2][2];
float cofac02 = matrix->m[0][1] * matrix->m[1][2] - matrix->m[0][2] * matrix->m[1][1];
float cofac11 = matrix->m[0][0] * matrix->m[2][2] - matrix->m[0][2] * matrix->m[2][0];
float cofac12 = matrix->m[0][2] * matrix->m[1][0] - matrix->m[0][0] * matrix->m[1][2];
float cofac21 = matrix->m[0][1] * matrix->m[2][0] - matrix->m[0][0] * matrix->m[2][1];
float cofac22 = matrix->m[0][0] * matrix->m[1][1] - matrix->m[0][1] * matrix->m[1][0];

result->m[0][0] = invDet * cofac00;
result->m[0][1] = invDet * cofac01;
result->m[0][2] = invDet * cofac02;
result->m[0][3] = 0.0f;

result->m[1][0] = invDet * cofac10;
result->m[1][1] = invDet * cofac11;
result->m[1][2] = invDet * cofac12;
result->m[1][3] = 0.0f;

result->m[2][0] = invDet * cofac20;
result->m[2][1] = invDet * cofac21;
result->m[2][2] = invDet * cofac22;
result->m[2][3] = 0.0f;
float cofac01 = matrix.m[0][2] * matrix.m[2][1] - matrix.m[0][1] * matrix.m[2][2];
float cofac02 = matrix.m[0][1] * matrix.m[1][2] - matrix.m[0][2] * matrix.m[1][1];
float cofac11 = matrix.m[0][0] * matrix.m[2][2] - matrix.m[0][2] * matrix.m[2][0];
float cofac12 = matrix.m[0][2] * matrix.m[1][0] - matrix.m[0][0] * matrix.m[1][2];
float cofac21 = matrix.m[0][1] * matrix.m[2][0] - matrix.m[0][0] * matrix.m[2][1];
float cofac22 = matrix.m[0][0] * matrix.m[1][1] - matrix.m[0][1] * matrix.m[1][0];

result.m[0][0] = invDet * cofac00;
result.m[0][1] = invDet * cofac01;
result.m[0][2] = invDet * cofac02;
result.m[0][3] = 0.0f;

result.m[1][0] = invDet * cofac10;
result.m[1][1] = invDet * cofac11;
result.m[1][2] = invDet * cofac12;
result.m[1][3] = 0.0f;

result.m[2][0] = invDet * cofac20;
result.m[2][1] = invDet * cofac21;
result.m[2][2] = invDet * cofac22;
result.m[2][3] = 0.0f;

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion wiki/Building-From-Source.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you are on Linux, install these additional packages:
* **Debian 12 / Ubuntu 20.04 / Pop!\_OS 20.04**

```bash
sudo apt install build-essential pkg-config libclang-dev libssl-dev libasound2-dev libjack-dev libgtk-3-dev libvulkan-dev libunwind-dev gcc yasm nasm curl libx264-dev libx265-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libdrm-dev libva-dev libvulkan-dev vulkan-headers
sudo apt install pulseaudio-utils build-essential pkg-config libclang-dev libssl-dev libasound2-dev libjack-dev libgtk-3-dev libvulkan-dev libunwind-dev gcc yasm nasm curl libx264-dev libx265-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libdrm-dev libva-dev libvulkan-dev vulkan-headers
```

* **Fedora**
Expand Down