From e2e68ecc89b5f9b209621b8eccf537718b4bd93e Mon Sep 17 00:00:00 2001 From: ykeara Date: Fri, 12 Apr 2019 18:18:49 -0500 Subject: [PATCH] adjusted profiles and switched to cubed root for linearization of brightness --- src/tabcontrollers/VideoTabController.cpp | 15 +++++++++++++-- src/tabcontrollers/VideoTabController.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/tabcontrollers/VideoTabController.cpp b/src/tabcontrollers/VideoTabController.cpp index 35c188d..42d9df4 100644 --- a/src/tabcontrollers/VideoTabController.cpp +++ b/src/tabcontrollers/VideoTabController.cpp @@ -67,8 +67,9 @@ namespace advsettings settings->beginGroup(getSettingsName()); setBrightnessEnabled(settings->value("brightnessEnabled", false).toBool(), true); m_opacityValue = settings->value("opacityValue", 0.0f).toFloat(); - setBrightnessValue(settings->value("brightnessValue", 1.0f).toFloat(), true); + m_brightnessValue=settings->value("brightnessValue", 1.0f).toFloat(); settings->endGroup(); + setOpacityValue(); } @@ -130,7 +131,7 @@ namespace advsettings { //This takes the Perceived value, and converts it to allow more accurate linear positioning. (human perception logarithmic) - float realvalue = static_cast(sqrt(static_cast(1.0f - percvalue))); + float realvalue = static_cast(std::pow(static_cast(1.0f - percvalue), 1/3.)); if (realvalue != m_opacityValue) { @@ -158,4 +159,14 @@ namespace advsettings } } } + + void VideoTabController::setOpacityValue() { + vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(m_brightnessNotificationOverlayHandle, m_opacityValue); + if (overlayError != vr::VROverlayError_None) { + LOG(ERROR) << "Could not set alpha: " + << vr::VROverlay()->GetOverlayErrorNameFromEnum( + overlayError); + } + emit brightnessValueChanged(m_brightnessValue); + } } \ No newline at end of file diff --git a/src/tabcontrollers/VideoTabController.h b/src/tabcontrollers/VideoTabController.h index ced71d7..6cf3812 100644 --- a/src/tabcontrollers/VideoTabController.h +++ b/src/tabcontrollers/VideoTabController.h @@ -45,6 +45,7 @@ namespace advsettings { void reloadVideoConfig(); void saveVideoConfig(); + void setOpacityValue(); QString getSettingsName(){