draft: upgrade codebase to qt6 and cmake (#657)
* update qt6 upgrade progress * add flawed addition for QRenderTarget and link needed libs * update to better logging format * move many assets and qml files into qrc * get rid of deprecation messages * remove additional deprecation notices * make Qt6 finally render on desktop with some progress on vr * initialize QRhi with QQuickRenderControl * use default values to stop SegFaults * fix compilation on windows * add windows files for aiding in running exe * fix formatting of testing qt.conf * first attempt on using textures instead of files in AudioTabController * Fix public/private access issue * use getter instead of directly accessing class members * use QImage as a base to set overlay textures * use native logging * add more QImage Overlays * implement faulty vulkan implementation --------- Co-authored-by: ykeara <ykeara1@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QtLogging>
|
#include <QtLogging>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
namespace alarm_clock
|
namespace alarm_clock
|
||||||
{
|
{
|
||||||
@@ -23,8 +24,10 @@ VrAlarm::VrAlarm()
|
|||||||
|
|
||||||
ovr_overlay_wrapper::hideOverlay( m_alarmOverlayHandle );
|
ovr_overlay_wrapper::hideOverlay( m_alarmOverlayHandle );
|
||||||
|
|
||||||
const auto filename = "/res/img/alarm/alarm_activated.png";
|
// Only need to set it once, no need to keep it in memory
|
||||||
ovr_overlay_wrapper::setOverlayFromFile( m_alarmOverlayHandle, filename );
|
QImage alarmIcon( QString( ":/alarm/alarm_activated.png" ) );
|
||||||
|
ovr_overlay_wrapper::setOverlayFromQImage( m_alarmOverlayHandle,
|
||||||
|
alarmIcon );
|
||||||
|
|
||||||
ovr_overlay_wrapper::setOverlayWidthInMeters( m_alarmOverlayHandle, 0.3f );
|
ovr_overlay_wrapper::setOverlayWidthInMeters( m_alarmOverlayHandle, 0.3f );
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ovr_overlay_wrapper.h"
|
#include "ovr_overlay_wrapper.h"
|
||||||
#include <QtLogging>
|
#include <QtLogging>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
namespace ovr_overlay_wrapper
|
namespace ovr_overlay_wrapper
|
||||||
{
|
{
|
||||||
@@ -100,6 +101,24 @@ OverlayError setOverlayFromFile( vr::VROverlayHandle_t overlayHandle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverlayError setOverlayFromQImage( vr::VROverlayHandle_t overlayHandle,
|
||||||
|
QImage& image,
|
||||||
|
std::string customErrorMsg )
|
||||||
|
{
|
||||||
|
image.convertTo( QImage::Format_RGBA8888 );
|
||||||
|
vr::VROverlayError oError = vr::VROverlay()->SetOverlayRaw(
|
||||||
|
overlayHandle, image.bits(), image.width(), image.height(), 4 );
|
||||||
|
if ( oError != vr::VROverlayError_None )
|
||||||
|
{
|
||||||
|
qCritical() << "Error setting Overlay from" << image << "For"
|
||||||
|
<< getOverlayKey( overlayHandle ) << "with error:"
|
||||||
|
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
|
||||||
|
<< customErrorMsg;
|
||||||
|
return OverlayError::UndefinedError;
|
||||||
|
}
|
||||||
|
return OverlayError::NoError;
|
||||||
|
}
|
||||||
|
|
||||||
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
|
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
|
||||||
std::string customErrorMsg )
|
std::string customErrorMsg )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <QImage>
|
||||||
#include "../utils/paths.h"
|
#include "../utils/paths.h"
|
||||||
|
|
||||||
/* Wrapper For OpenVR's IVR settings class, allows us to do our error logging
|
/* Wrapper For OpenVR's IVR settings class, allows us to do our error logging
|
||||||
@@ -42,6 +43,9 @@ OverlayError setOverlayWidthInMeters( vr::VROverlayHandle_t overlayHandle,
|
|||||||
OverlayError setOverlayFromFile( vr::VROverlayHandle_t overlayHandle,
|
OverlayError setOverlayFromFile( vr::VROverlayHandle_t overlayHandle,
|
||||||
std::string fileName,
|
std::string fileName,
|
||||||
std::string customErrorMsg = "" );
|
std::string customErrorMsg = "" );
|
||||||
|
OverlayError setOverlayFromQImage( vr::VROverlayHandle_t overlayHandle,
|
||||||
|
QImage& image,
|
||||||
|
std::string customErrorMsg = "" );
|
||||||
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
|
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
|
||||||
std::string customErrorMsg = "" );
|
std::string customErrorMsg = "" );
|
||||||
OverlayError hideOverlay( vr::VROverlayHandle_t overlayHandle,
|
OverlayError hideOverlay( vr::VROverlayHandle_t overlayHandle,
|
||||||
|
|||||||
+62
-51
@@ -11,6 +11,7 @@
|
|||||||
#include <QtWidgets/QGraphicsSceneMouseEvent>
|
#include <QtWidgets/QGraphicsSceneMouseEvent>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtWidgets/QGraphicsEllipseItem>
|
#include <QtWidgets/QGraphicsEllipseItem>
|
||||||
|
#include <QQuickGraphicsConfiguration>
|
||||||
#include <QOpenGLExtraFunctions>
|
#include <QOpenGLExtraFunctions>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <openvr.h>
|
#include <openvr.h>
|
||||||
|
#include "openvr/ovr_overlay_wrapper.h"
|
||||||
#include "utils/Matrix.h"
|
#include "utils/Matrix.h"
|
||||||
#include "keyboard_input/input_sender.h"
|
#include "keyboard_input/input_sender.h"
|
||||||
#include "settings/settings.h"
|
#include "settings/settings.h"
|
||||||
@@ -387,18 +389,10 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
|||||||
vr::VROverlayFlags_SendVRSmoothScrollEvents,
|
vr::VROverlayFlags_SendVRSmoothScrollEvents,
|
||||||
true );
|
true );
|
||||||
|
|
||||||
constexpr auto thumbiconFilename = "res/img/icons/thumbicon.png";
|
|
||||||
const auto thumbIconPath
|
|
||||||
= paths::binaryDirectoryFindFile( thumbiconFilename );
|
|
||||||
if ( thumbIconPath.has_value() )
|
|
||||||
{
|
{
|
||||||
vr::VROverlay()->SetOverlayFromFile( m_ulOverlayThumbnailHandle,
|
QImage thumbiconImg( QString( ":/icons/thumbicon.png" ) );
|
||||||
thumbIconPath->c_str() );
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
}
|
m_ulOverlayThumbnailHandle, thumbiconImg );
|
||||||
else
|
|
||||||
{
|
|
||||||
qCritical() << "Could not find thumbnail icon \""
|
|
||||||
<< thumbiconFilename << "\"";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Too many render calls in too short time overwhelm Qt and an
|
// Too many render calls in too short time overwhelm Qt and an
|
||||||
@@ -413,10 +407,25 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
|||||||
this,
|
this,
|
||||||
SLOT( renderOverlay() ) );
|
SLOT( renderOverlay() ) );
|
||||||
|
|
||||||
|
#if QT_CONFIG( vulkan )
|
||||||
|
if ( m_window.graphicsApi() == QSGRendererInterface::Vulkan )
|
||||||
|
{
|
||||||
|
m_vulkanInstance.reset( new QVulkanInstance );
|
||||||
|
m_vulkanInstance->setExtensions(
|
||||||
|
QQuickGraphicsConfiguration::preferredInstanceExtensions() );
|
||||||
|
if ( !m_vulkanInstance->create() )
|
||||||
|
throw std::runtime_error( "Cannot create vulkan instance" );
|
||||||
|
|
||||||
|
m_window.setVulkanInstance( m_vulkanInstance.get() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( !m_renderControl.initialize() )
|
if ( !m_renderControl.initialize() )
|
||||||
throw std::runtime_error( "could not initialize m_renderControl" );
|
throw std::runtime_error( "could not initialize m_renderControl" );
|
||||||
|
|
||||||
QRhi* rhi = m_renderControl.rhi();
|
QRhi* rhi = this->rhi();
|
||||||
|
|
||||||
|
qInfo() << "Started with" << rhi->backendName();
|
||||||
|
|
||||||
m_pFBTexture.reset( rhi->newTexture(
|
m_pFBTexture.reset( rhi->newTexture(
|
||||||
QRhiTexture::RGBA8,
|
QRhiTexture::RGBA8,
|
||||||
@@ -444,7 +453,6 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
|||||||
0,
|
0,
|
||||||
static_cast<int>( quickItem->width() ),
|
static_cast<int>( quickItem->width() ),
|
||||||
static_cast<int>( quickItem->height() ) );
|
static_cast<int>( quickItem->height() ) );
|
||||||
m_renderControl.initialize();
|
|
||||||
|
|
||||||
vr::HmdVector2_t vecWindowSize
|
vr::HmdVector2_t vecWindowSize
|
||||||
= { static_cast<float>( quickItem->width() ),
|
= { static_cast<float>( quickItem->width() ),
|
||||||
@@ -511,40 +519,49 @@ void OverlayController::OnRenderRequest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vr::ETextureType OverlayController::vrTextureTypeFromRhiBackend()
|
void OverlayController::SetOverlayFromQRhiTexture( QRhiTexture& tex )
|
||||||
{
|
{
|
||||||
if ( !m_cached_vr_texture_type.has_value() )
|
vr::Texture_t vrTex = {};
|
||||||
|
QRhi* rhi = this->rhi();
|
||||||
|
|
||||||
|
switch ( rhi->backend() )
|
||||||
{
|
{
|
||||||
QRhi* rhi = m_renderControl.rhi();
|
case QRhi::OpenGLES2:
|
||||||
switch ( rhi->backend() )
|
{
|
||||||
{
|
vrTex.handle = reinterpret_cast<void*>( tex.nativeTexture().object );
|
||||||
case QRhi::Vulkan:
|
vrTex.eType = vr::TextureType_OpenGL;
|
||||||
m_cached_vr_texture_type = vr::TextureType_Vulkan;
|
vrTex.eColorSpace = vr::ColorSpace_Auto;
|
||||||
break;
|
|
||||||
case QRhi::D3D12:
|
|
||||||
m_cached_vr_texture_type = vr::TextureType_DirectX12;
|
|
||||||
break;
|
|
||||||
case QRhi::D3D11:
|
|
||||||
m_cached_vr_texture_type = vr::TextureType_DirectX;
|
|
||||||
break;
|
|
||||||
case QRhi::OpenGLES2:
|
|
||||||
m_cached_vr_texture_type = vr::TextureType_OpenGL;
|
|
||||||
break;
|
|
||||||
case QRhi::Metal:
|
|
||||||
m_cached_vr_texture_type = vr::TextureType_Metal;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qFatal() << "unknown RHI backend encountered:" << rhi->backend();
|
|
||||||
throw std::runtime_error( "unsupported RHI backend encountered" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return m_cached_vr_texture_type.value();
|
break;
|
||||||
}
|
#if QT_CONFIG( vulkan )
|
||||||
vr::Texture_t OverlayController::vrTextureFromRhiTexture( QRhiTexture& tex )
|
case QRhi::Vulkan:
|
||||||
{
|
{
|
||||||
return { reinterpret_cast<void*>( tex.nativeTexture().object ),
|
const QRhiVulkanNativeHandles* vulkan_handles
|
||||||
vrTextureTypeFromRhiBackend(),
|
= reinterpret_cast<const QRhiVulkanNativeHandles*>(
|
||||||
vr::ColorSpace_Auto };
|
rhi->nativeHandles() );
|
||||||
|
vr::VRVulkanTextureData_t vulkan = {
|
||||||
|
.m_nImage = tex.nativeTexture().object,
|
||||||
|
.m_pDevice = vulkan_handles->dev,
|
||||||
|
.m_pPhysicalDevice = vulkan_handles->physDev,
|
||||||
|
.m_pInstance = vulkan_handles->inst->vkInstance(),
|
||||||
|
.m_pQueue = vulkan_handles->gfxQueue,
|
||||||
|
.m_nQueueFamilyIndex = vulkan_handles->gfxQueueIdx,
|
||||||
|
.m_nWidth = static_cast<uint32_t>( tex.pixelSize().width() ),
|
||||||
|
.m_nHeight = static_cast<uint32_t>( tex.pixelSize().height() ),
|
||||||
|
.m_nFormat = tex.format(),
|
||||||
|
.m_nSampleCount = static_cast<uint32_t>( tex.sampleCount() ),
|
||||||
|
};
|
||||||
|
vrTex.handle = &vulkan;
|
||||||
|
vrTex.eType = vr::TextureType_Vulkan;
|
||||||
|
vrTex.eColorSpace = vr::ColorSpace_Auto;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
qFatal() << "unimplemented backend:" << rhi->backend();
|
||||||
|
throw std::runtime_error( "unimplemented backend" );
|
||||||
|
}
|
||||||
|
vr::VROverlay()->SetOverlayTexture( m_ulOverlayHandle, &vrTex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayController::renderOverlay()
|
void OverlayController::renderOverlay()
|
||||||
@@ -563,13 +580,7 @@ void OverlayController::renderOverlay()
|
|||||||
m_renderControl.render();
|
m_renderControl.render();
|
||||||
m_renderControl.endFrame();
|
m_renderControl.endFrame();
|
||||||
|
|
||||||
auto tex = vrTextureFromRhiTexture( *m_pFBTexture );
|
SetOverlayFromQRhiTexture( *m_pFBTexture );
|
||||||
vr::VROverlay()->SetOverlayTexture( m_ulOverlayHandle, &tex );
|
|
||||||
|
|
||||||
/*
|
|
||||||
m_openGLContext.functions()->glFlush(); // We need to flush otherwise
|
|
||||||
// the texture may be empty.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-6
@@ -108,6 +108,12 @@ private:
|
|||||||
vr::VROverlayHandle_t m_ulOverlayThumbnailHandle
|
vr::VROverlayHandle_t m_ulOverlayThumbnailHandle
|
||||||
= vr::k_ulOverlayHandleInvalid;
|
= vr::k_ulOverlayHandleInvalid;
|
||||||
|
|
||||||
|
#if QT_CONFIG( vulkan )
|
||||||
|
std::unique_ptr<QVulkanInstance> m_vulkanInstance = nullptr;
|
||||||
|
#endif
|
||||||
|
QQuickRenderControl m_renderControl;
|
||||||
|
QQuickWindow m_window{ &m_renderControl };
|
||||||
|
|
||||||
std::optional<vr::ETextureType> m_cached_vr_texture_type;
|
std::optional<vr::ETextureType> m_cached_vr_texture_type;
|
||||||
std::unique_ptr<QRhiTexture> m_pFBTexture;
|
std::unique_ptr<QRhiTexture> m_pFBTexture;
|
||||||
std::unique_ptr<QRhiTextureRenderTarget> m_render_target;
|
std::unique_ptr<QRhiTextureRenderTarget> m_render_target;
|
||||||
@@ -163,11 +169,8 @@ private:
|
|||||||
QJsonObject m_remoteVersionJsonObject;
|
QJsonObject m_remoteVersionJsonObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QQuickRenderControl m_renderControl;
|
|
||||||
QQuickWindow m_window{ &m_renderControl };
|
|
||||||
// I know it's an ugly hack to make them public to enable external
|
// I know it's an ugly hack to make them public to enable external
|
||||||
// access, but I am too lazy to implement getters.
|
// access, but I am too lazy to implement getters.
|
||||||
SteamVRTabController m_steamVRTabController;
|
SteamVRTabController m_steamVRTabController;
|
||||||
ChaperoneTabController m_chaperoneTabController;
|
ChaperoneTabController m_chaperoneTabController;
|
||||||
MoveCenterTabController m_moveCenterTabController;
|
MoveCenterTabController m_moveCenterTabController;
|
||||||
@@ -191,13 +194,17 @@ private:
|
|||||||
void processRotationBindings();
|
void processRotationBindings();
|
||||||
void processExclusiveInputBinding();
|
void processExclusiveInputBinding();
|
||||||
|
|
||||||
|
inline QRhi* rhi()
|
||||||
|
{
|
||||||
|
return m_renderControl.rhi();
|
||||||
|
}
|
||||||
|
|
||||||
bool m_exclusiveState = false;
|
bool m_exclusiveState = false;
|
||||||
bool m_keyPressOneState = false;
|
bool m_keyPressOneState = false;
|
||||||
bool m_keyPressTwoState = false;
|
bool m_keyPressTwoState = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
vr::ETextureType vrTextureTypeFromRhiBackend();
|
void SetOverlayFromQRhiTexture( QRhiTexture& tex );
|
||||||
vr::Texture_t vrTextureFromRhiTexture( QRhiTexture& tex );
|
|
||||||
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
|
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
|
||||||
virtual ~OverlayController();
|
virtual ~OverlayController();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
<file alias="backarrow">img/common/backarrow.svg</file>
|
<file alias="backarrow">img/common/backarrow.svg</file>
|
||||||
<file alias="box_checkmark">img/common/check.svg</file>
|
<file alias="box_checkmark">img/common/check.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
<qresource prefix="/icons">
|
||||||
|
<file alias="thumbicon.png">img/icons/thumbicon.png</file>
|
||||||
|
</qresource>
|
||||||
<qresource prefix="/microphone">
|
<qresource prefix="/microphone">
|
||||||
<file alias="on">img/audio/microphone/mic_on.svg</file>
|
<file alias="on">img/audio/microphone/mic_on.svg</file>
|
||||||
<file alias="off">img/audio/microphone/mic_off.svg</file>
|
<file alias="off">img/audio/microphone/mic_off.svg</file>
|
||||||
@@ -65,4 +68,7 @@
|
|||||||
<file alias="noautoturn.png">img/rotation/noautoturn.png</file>
|
<file alias="noautoturn.png">img/rotation/noautoturn.png</file>
|
||||||
<file alias="noautoturn.svg">img/rotation/noautoturn.svg</file>
|
<file alias="noautoturn.svg">img/rotation/noautoturn.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
<qresource prefix="/alarm">
|
||||||
|
<file alias="alarm_activated.png">img/alarm/alarm_activated.png</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "../settings/settings.h"
|
#include "../settings/settings.h"
|
||||||
#include "../settings/settings_object.h"
|
#include "../settings/settings_object.h"
|
||||||
#include "../utils/update_rate.h"
|
#include "../utils/update_rate.h"
|
||||||
|
#include "openvr/ovr_overlay_wrapper.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "audiomanager/AudioManagerWindows.h"
|
# include "audiomanager/AudioManagerWindows.h"
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
@@ -87,31 +88,19 @@ void AudioTabController::initStage2( OverlayController* var_parent )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage pushToTalkIcon;
|
m_pushToTalkValues.pushToTalkImg.reset(
|
||||||
Q_ASSERT( pushToTalkIcon.load(
|
new QImage( QString( ":/microphone/ptt_notification.png" ) ) );
|
||||||
QString( "qrc:/res/img/audio/microphone/ptt_notification.png" ) ) );
|
m_pushToTalkValues.pushToMuteImg.reset(
|
||||||
QImage pushToMuteIcon;
|
new QImage( QString( ":/microphone/ptm_notification.png" ) ) );
|
||||||
Q_ASSERT( pushToMuteIcon.load(
|
|
||||||
QString( "qrc:/res/img/audio/microphone/ptt_notification.png" ) ) );
|
|
||||||
|
|
||||||
emit defaultProfileDisplay();
|
auto* pushToImg = m_pushToTalkValues.pushToTalkImg.get();
|
||||||
return;
|
|
||||||
|
|
||||||
auto* rhi = parent->m_renderControl.rhi();
|
|
||||||
m_pushToTalkValues.pushToTalkTex.reset(
|
|
||||||
rhi->newTexture( QRhiTexture::RGBA8, pushToTalkIcon.size(), 1 ) );
|
|
||||||
m_pushToTalkValues.pushToMuteTex.reset(
|
|
||||||
rhi->newTexture( QRhiTexture::RGBA8, pushToTalkIcon.size(), 1 ) );
|
|
||||||
|
|
||||||
auto* pushToTex = m_pushToTalkValues.pushToTalkTex.get();
|
|
||||||
if ( settings::getSetting( settings::BoolSetting::AUDIO_micReversePtt ) )
|
if ( settings::getSetting( settings::BoolSetting::AUDIO_micReversePtt ) )
|
||||||
{
|
{
|
||||||
pushToTex = m_pushToTalkValues.pushToMuteTex.get();
|
pushToImg = m_pushToTalkValues.pushToMuteImg.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tex = parent->vrTextureFromRhiTexture( *pushToTex );
|
ovr_overlay_wrapper::setOverlayFromQImage( m_pushToTalkValues.overlayHandle,
|
||||||
vr::VROverlay()->SetOverlayTexture( m_pushToTalkValues.overlayHandle,
|
*pushToImg );
|
||||||
&tex );
|
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters( m_pushToTalkValues.overlayHandle,
|
vr::VROverlay()->SetOverlayWidthInMeters( m_pushToTalkValues.overlayHandle,
|
||||||
0.02f );
|
0.02f );
|
||||||
vr::HmdMatrix34_t notificationTransform
|
vr::HmdMatrix34_t notificationTransform
|
||||||
@@ -356,6 +345,8 @@ void AudioTabController::setMicReversePtt( bool value, bool notify )
|
|||||||
|
|
||||||
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
settings::setSetting( settings::BoolSetting::AUDIO_micReversePtt, value );
|
||||||
|
|
||||||
|
// TODO: if reenabled use `ovr_overlay_wrapper::setOverlayFromQImage`
|
||||||
|
// instead
|
||||||
if ( value )
|
if ( value )
|
||||||
{
|
{
|
||||||
// vr::VROverlay()->SetOverlayFromFile(m_ptt_overlayHandle,/*pt_mute*/);
|
// vr::VROverlay()->SetOverlayFromFile(m_ptt_overlayHandle,/*pt_mute*/);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "audiomanager/AudioManager.h"
|
#include "audiomanager/AudioManager.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <rhi/qrhi.h>
|
#include <QImage>
|
||||||
#include "../utils/FrameRateUtils.h"
|
#include "../utils/FrameRateUtils.h"
|
||||||
#include "../settings/settings_object.h"
|
#include "../settings/settings_object.h"
|
||||||
|
|
||||||
@@ -116,8 +116,8 @@ private:
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
|
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||||
std::unique_ptr<QRhiTexture> pushToTalkTex;
|
std::unique_ptr<QImage> pushToTalkImg;
|
||||||
std::unique_ptr<QRhiTexture> pushToMuteTex;
|
std::unique_ptr<QImage> pushToMuteImg;
|
||||||
} m_pushToTalkValues;
|
} m_pushToTalkValues;
|
||||||
|
|
||||||
int m_playbackDeviceIndex = -1;
|
int m_playbackDeviceIndex = -1;
|
||||||
|
|||||||
@@ -1619,8 +1619,22 @@ void ChaperoneTabController::initCenterMarkerOverlay()
|
|||||||
"" );
|
"" );
|
||||||
if ( overlayError == ovr_overlay_wrapper::OverlayError::NoError )
|
if ( overlayError == ovr_overlay_wrapper::OverlayError::NoError )
|
||||||
{
|
{
|
||||||
ovr_overlay_wrapper::setOverlayFromFile(
|
m_floorMarkers[-3] = std::unique_ptr<QImage>(
|
||||||
m_chaperoneFloorOverlayHandle, m_floorMarkerFN, "" );
|
new QImage( QString( ":/chaperone/centermarkl3.png" ) ) );
|
||||||
|
m_floorMarkers[-2] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermarkl2.png" ) ) );
|
||||||
|
m_floorMarkers[-1] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermarkl1.png" ) ) );
|
||||||
|
m_floorMarkers[0] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermark.png" ) ) );
|
||||||
|
m_floorMarkers[1] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermarkr1.png" ) ) );
|
||||||
|
m_floorMarkers[2] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermarkr2.png" ) ) );
|
||||||
|
m_floorMarkers[3] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/chaperone/centermarkr3.png" ) ) );
|
||||||
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
|
m_chaperoneFloorOverlayHandle, *m_floorMarkers[0], "" );
|
||||||
ovr_overlay_wrapper::setOverlayWidthInMeters(
|
ovr_overlay_wrapper::setOverlayWidthInMeters(
|
||||||
m_chaperoneFloorOverlayHandle, 0.5f );
|
m_chaperoneFloorOverlayHandle, 0.5f );
|
||||||
updateCenterMarkerOverlayColor();
|
updateCenterMarkerOverlayColor();
|
||||||
@@ -1662,57 +1676,25 @@ void ChaperoneTabController::checkCenterMarkerOverlayRotationCount()
|
|||||||
if ( rotation > 0 )
|
if ( rotation > 0 )
|
||||||
{
|
{
|
||||||
rotation = rotation + 0.5f;
|
rotation = rotation + 0.5f;
|
||||||
int fullRotation = static_cast<int>( rotation );
|
rotationNext = static_cast<int>( rotation );
|
||||||
switch ( fullRotation )
|
if ( rotationNext > 3 )
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermark.png";
|
|
||||||
rotationNext = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkr1.png";
|
|
||||||
rotationNext = 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkr2.png";
|
|
||||||
rotationNext = 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkr3.png";
|
|
||||||
rotationNext = 3;
|
rotationNext = 3;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rotation = rotation + 0.5f;
|
rotation = rotation + 0.5f;
|
||||||
int fullRotation = static_cast<int>( std::floor( rotation ) );
|
rotationNext = static_cast<int>( std::floor( rotation ) );
|
||||||
switch ( fullRotation )
|
if ( rotationNext < -3 )
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermark.png";
|
|
||||||
rotationNext = 0;
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkl1.png";
|
|
||||||
rotationNext = -1;
|
|
||||||
break;
|
|
||||||
case -2:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkl2.png";
|
|
||||||
rotationNext = -2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
m_floorMarkerFN = "/res/img/chaperone/centermarkl3.png";
|
|
||||||
rotationNext = -3;
|
rotationNext = -3;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rotationNext != m_rotationCurrent && m_centerMarkerOverlayIsInit )
|
if ( rotationNext != m_rotationCurrent && m_centerMarkerOverlayIsInit )
|
||||||
{
|
{
|
||||||
m_rotationCurrent = rotationNext;
|
m_rotationCurrent = rotationNext;
|
||||||
ovr_overlay_wrapper::setOverlayFromFile(
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
m_chaperoneFloorOverlayHandle, m_floorMarkerFN, "" );
|
m_chaperoneFloorOverlayHandle,
|
||||||
|
*m_floorMarkers[rotationNext],
|
||||||
|
"" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -379,7 +380,7 @@ private:
|
|||||||
|
|
||||||
std::vector<ChaperoneProfile> chaperoneProfiles;
|
std::vector<ChaperoneProfile> chaperoneProfiles;
|
||||||
|
|
||||||
std::string m_floorMarkerFN = "/res/img/chaperone/centermark.png";
|
std::map<int, std::unique_ptr<QImage>> m_floorMarkers;
|
||||||
void initCenterMarkerOverlay();
|
void initCenterMarkerOverlay();
|
||||||
void updateCenterMarkerOverlayColor();
|
void updateCenterMarkerOverlayColor();
|
||||||
void checkCenterMarkerOverlayRotationCount();
|
void checkCenterMarkerOverlayRotationCount();
|
||||||
|
|||||||
@@ -39,29 +39,14 @@ void RotationTabController::initStage2( OverlayController* var_parent )
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_autoturnValues.autoturnImg.reset(
|
||||||
|
new QImage( QString( ":/rotation/autoturn.png" ) ) );
|
||||||
|
m_autoturnValues.noautoturnImg.reset(
|
||||||
|
new QImage( QString( ":/rotation/noautoturn.png" ) ) );
|
||||||
|
|
||||||
constexpr auto autoturnIconFilepath = "/res/img/rotation/autoturn.png";
|
ovr_overlay_wrapper::setOverlayFromQImage( m_autoturnValues.overlayHandle,
|
||||||
constexpr auto noautoturnIconFilepath = "/res/img/rotation/noautoturn.png";
|
*m_autoturnValues.autoturnImg );
|
||||||
|
|
||||||
const auto autoturnIconFilePath
|
|
||||||
= paths::verifyIconFilePath( autoturnIconFilepath );
|
|
||||||
const auto noautoturnIconFilePath
|
|
||||||
= paths::verifyIconFilePath( noautoturnIconFilepath );
|
|
||||||
|
|
||||||
if ( !autoturnIconFilePath.has_value()
|
|
||||||
|| !noautoturnIconFilePath.has_value() )
|
|
||||||
{
|
|
||||||
emit defaultProfileDisplay();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_autoturnValues.autoturnPath = *autoturnIconFilePath;
|
|
||||||
m_autoturnValues.noautoturnPath = *noautoturnIconFilePath;
|
|
||||||
|
|
||||||
auto pushToPath = m_autoturnValues.autoturnPath.c_str();
|
|
||||||
|
|
||||||
vr::VROverlay()->SetOverlayFromFile( m_autoturnValues.overlayHandle,
|
|
||||||
pushToPath );
|
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters( m_autoturnValues.overlayHandle,
|
vr::VROverlay()->SetOverlayWidthInMeters( m_autoturnValues.overlayHandle,
|
||||||
0.02f );
|
0.02f );
|
||||||
vr::HmdMatrix34_t notificationTransform
|
vr::HmdMatrix34_t notificationTransform
|
||||||
@@ -677,22 +662,21 @@ void RotationTabController::setAutoTurnEnabled( bool value, bool notify )
|
|||||||
emit autoTurnEnabledChanged( value );
|
emit autoTurnEnabledChanged( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !value )
|
|
||||||
{
|
|
||||||
vr::VROverlay()->SetOverlayFromFile(
|
|
||||||
m_autoturnValues.overlayHandle,
|
|
||||||
m_autoturnValues.noautoturnPath.c_str() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vr::VROverlay()->SetOverlayFromFile(
|
|
||||||
m_autoturnValues.overlayHandle,
|
|
||||||
m_autoturnValues.autoturnPath.c_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( autoTurnShowNotification()
|
if ( autoTurnShowNotification()
|
||||||
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
&& getNotificationOverlayHandle() != vr::k_ulOverlayHandleInvalid )
|
||||||
{
|
{
|
||||||
|
if ( !value )
|
||||||
|
{
|
||||||
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
|
m_autoturnValues.overlayHandle,
|
||||||
|
*m_autoturnValues.noautoturnImg );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
|
m_autoturnValues.overlayHandle, *m_autoturnValues.autoturnImg );
|
||||||
|
}
|
||||||
|
|
||||||
vr::VROverlay()->SetOverlayAlpha( getNotificationOverlayHandle(),
|
vr::VROverlay()->SetOverlayAlpha( getNotificationOverlayHandle(),
|
||||||
1.0f );
|
1.0f );
|
||||||
vr::VROverlay()->ShowOverlay( getNotificationOverlayHandle() );
|
vr::VROverlay()->ShowOverlay( getNotificationOverlayHandle() );
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QImage>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -99,8 +100,8 @@ private:
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
|
vr::VROverlayHandle_t overlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||||
std::string autoturnPath;
|
std::unique_ptr<QImage> autoturnImg;
|
||||||
std::string noautoturnPath;
|
std::unique_ptr<QImage> noautoturnImg;
|
||||||
} m_autoturnValues;
|
} m_autoturnValues;
|
||||||
|
|
||||||
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
|
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
#include "../keyboard_input/input_sender.h"
|
#include "../keyboard_input/input_sender.h"
|
||||||
#include "../settings/settings.h"
|
#include "../settings/settings.h"
|
||||||
#include "../utils/update_rate.h"
|
#include "../utils/update_rate.h"
|
||||||
|
#include "openvr/ovr_overlay_wrapper.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <qimage.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
// application namespace
|
// application namespace
|
||||||
@@ -257,34 +259,36 @@ vr::VROverlayHandle_t UtilitiesTabController::createBatteryOverlay(
|
|||||||
batteryKey.c_str(), batteryKey.c_str(), &handle );
|
batteryKey.c_str(), batteryKey.c_str(), &handle );
|
||||||
if ( overlayError == vr::VROverlayError_None )
|
if ( overlayError == vr::VROverlayError_None )
|
||||||
{
|
{
|
||||||
QString batteryIconPath = getBatteryIconPath( 0 );
|
m_batteryImgs[0] = std::unique_ptr<QImage>(
|
||||||
if ( QFile::exists( batteryIconPath ) )
|
new QImage( QString( ":/battery/battery_0.png" ) ) );
|
||||||
|
m_batteryImgs[1] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/battery/battery_1.png" ) ) );
|
||||||
|
m_batteryImgs[2] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/battery/battery_2.png" ) ) );
|
||||||
|
m_batteryImgs[3] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/battery/battery_3.png" ) ) );
|
||||||
|
m_batteryImgs[4] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/battery/battery_4.png" ) ) );
|
||||||
|
m_batteryImgs[5] = std::unique_ptr<QImage>(
|
||||||
|
new QImage( QString( ":/battery/battery_5.png" ) ) );
|
||||||
|
ovr_overlay_wrapper::setOverlayFromQImage( handle, *m_batteryImgs[0] );
|
||||||
|
vr::VROverlay()->SetOverlayWidthInMeters( handle, 0.045f );
|
||||||
|
vr::HmdMatrix34_t notificationTransform;
|
||||||
|
if ( style == 1 )
|
||||||
{
|
{
|
||||||
vr::VROverlay()->SetOverlayFromFile(
|
notificationTransform = { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
||||||
handle, batteryIconPath.toStdString().c_str() );
|
{ 0.0f, -1.0f, 0.0f, 0.0081f },
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters( handle, 0.045f );
|
{ 0.0f, 0.0f, -1.0f, -0.028f } } };
|
||||||
vr::HmdMatrix34_t notificationTransform;
|
|
||||||
if ( style == 1 )
|
|
||||||
{
|
|
||||||
notificationTransform = { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
|
||||||
{ 0.0f, -1.0f, 0.0f, 0.0081f },
|
|
||||||
{ 0.0f, 0.0f, -1.0f, -0.028f } } };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notificationTransform = { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
|
||||||
{ 0.0f, -1.0f, 0.0f, 0.0081f },
|
|
||||||
{ 0.0f, 0.0f, -1.0f, -0.0178f } } };
|
|
||||||
}
|
|
||||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
|
||||||
handle, index, ¬ificationTransform );
|
|
||||||
qInfo() << "Created battery overlay for device " << index;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical() << "Could not find battery icon \"" << batteryIconPath
|
notificationTransform = { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
||||||
<< "\"";
|
{ 0.0f, -1.0f, 0.0f, 0.0081f },
|
||||||
|
{ 0.0f, 0.0f, -1.0f, -0.0178f } } };
|
||||||
}
|
}
|
||||||
|
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
||||||
|
handle, index, ¬ificationTransform );
|
||||||
|
qInfo() << "Created battery overlay for device " << index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -378,19 +382,9 @@ void UtilitiesTabController::handleTrackerBatOvl()
|
|||||||
qInfo() << "Updating battery overlay for device " << i
|
qInfo() << "Updating battery overlay for device " << i
|
||||||
<< " to " << batteryState << "(" << battery << ")"
|
<< " to " << batteryState << "(" << battery << ")"
|
||||||
<< QString::number( m_batteryOverlayHandles[i] );
|
<< QString::number( m_batteryOverlayHandles[i] );
|
||||||
QString batteryIconPath
|
ovr_overlay_wrapper::setOverlayFromQImage(
|
||||||
= getBatteryIconPath( batteryState );
|
m_batteryOverlayHandles[i],
|
||||||
if ( QFile::exists( batteryIconPath ) )
|
*m_batteryImgs[batteryState] );
|
||||||
{
|
|
||||||
vr::VROverlay()->SetOverlayFromFile(
|
|
||||||
m_batteryOverlayHandles[i],
|
|
||||||
batteryIconPath.toStdString().c_str() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qCritical() << "Could not find battery icon \""
|
|
||||||
<< batteryIconPath << "\"";
|
|
||||||
}
|
|
||||||
m_batteryState[i] = batteryState;
|
m_batteryState[i] = batteryState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QImage>
|
||||||
#include <openvr.h>
|
#include <openvr.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "src/keyboard_input/keyboard_input.h"
|
#include "src/keyboard_input/keyboard_input.h"
|
||||||
@@ -29,6 +30,7 @@ private:
|
|||||||
|
|
||||||
unsigned settingsUpdateCounter = 0;
|
unsigned settingsUpdateCounter = 0;
|
||||||
|
|
||||||
|
std::array<std::unique_ptr<QImage>, 6> m_batteryImgs;
|
||||||
vr::VROverlayHandle_t m_batteryOverlayHandles[vr::k_unMaxTrackedDeviceCount]
|
vr::VROverlayHandle_t m_batteryOverlayHandles[vr::k_unMaxTrackedDeviceCount]
|
||||||
= { 0 };
|
= { 0 };
|
||||||
int m_batteryState[vr::k_unMaxTrackedDeviceCount];
|
int m_batteryState[vr::k_unMaxTrackedDeviceCount];
|
||||||
|
|||||||
@@ -52,30 +52,21 @@ void VideoTabController::initBrightnessOverlay()
|
|||||||
notifKey.c_str(), notifKey.c_str(), &m_brightnessOverlayHandle );
|
notifKey.c_str(), notifKey.c_str(), &m_brightnessOverlayHandle );
|
||||||
if ( overlayError == vr::VROverlayError_None )
|
if ( overlayError == vr::VROverlayError_None )
|
||||||
{
|
{
|
||||||
const auto notifIconPath = paths::binaryDirectoryFindFile(
|
QImage notifIcon( QString( ":/video/dimmer.png" ) );
|
||||||
video_keys::k_brightnessOverlayFilename );
|
ovr_overlay_wrapper::setOverlayFromQImage( m_brightnessOverlayHandle,
|
||||||
if ( notifIconPath.has_value() )
|
notifIcon );
|
||||||
{
|
vr::VROverlay()->SetOverlayWidthInMeters( m_brightnessOverlayHandle,
|
||||||
vr::VROverlay()->SetOverlayFromFile( m_brightnessOverlayHandle,
|
k_overlayWidth );
|
||||||
notifIconPath->c_str() );
|
vr::HmdMatrix34_t notificationTransform
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters( m_brightnessOverlayHandle,
|
= { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
||||||
k_overlayWidth );
|
{ 0.0f, 1.0f, 0.0f, 0.00f },
|
||||||
vr::HmdMatrix34_t notificationTransform
|
{ 0.0f, 0.0f, 1.0f, k_hmdDistance } } };
|
||||||
= { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
||||||
{ 0.0f, 1.0f, 0.0f, 0.00f },
|
m_brightnessOverlayHandle,
|
||||||
{ 0.0f, 0.0f, 1.0f, k_hmdDistance } } };
|
vr::k_unTrackedDeviceIndex_Hmd,
|
||||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
¬ificationTransform );
|
||||||
m_brightnessOverlayHandle,
|
vr::VROverlay()->SetOverlaySortOrder( m_brightnessOverlayHandle,
|
||||||
vr::k_unTrackedDeviceIndex_Hmd,
|
sortMax );
|
||||||
¬ificationTransform );
|
|
||||||
vr::VROverlay()->SetOverlaySortOrder( m_brightnessOverlayHandle,
|
|
||||||
sortMax );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qCritical() << "Could not find brightness overlay \""
|
|
||||||
<< video_keys::k_brightnessOverlayFilename << "\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -95,32 +86,23 @@ void VideoTabController::initColorOverlay()
|
|||||||
notifKey.c_str(), notifKey.c_str(), &m_colorOverlayHandle );
|
notifKey.c_str(), notifKey.c_str(), &m_colorOverlayHandle );
|
||||||
if ( overlayError == vr::VROverlayError_None )
|
if ( overlayError == vr::VROverlayError_None )
|
||||||
{
|
{
|
||||||
const auto notifIconPath = paths::binaryDirectoryFindFile(
|
QImage notifIcon( QString( ":/video/color.png" ) );
|
||||||
video_keys::k_colorOverlayFilename );
|
ovr_overlay_wrapper::setOverlayFromQImage( m_colorOverlayHandle,
|
||||||
if ( notifIconPath.has_value() )
|
notifIcon );
|
||||||
{
|
vr::VROverlay()->SetOverlayWidthInMeters( m_colorOverlayHandle,
|
||||||
vr::VROverlay()->SetOverlayFromFile( m_colorOverlayHandle,
|
k_overlayWidth );
|
||||||
notifIconPath->c_str() );
|
// position it just slightly further out so we don't have to worry
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters( m_colorOverlayHandle,
|
// about render order.
|
||||||
k_overlayWidth );
|
vr::HmdMatrix34_t notificationTransform
|
||||||
// position it just slightly further out so we don't have to worry
|
= { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
||||||
// about render order.
|
{ 0.0f, 1.0f, 0.0f, 0.00f },
|
||||||
vr::HmdMatrix34_t notificationTransform
|
{ 0.0f, 0.0f, 1.0f, ( k_hmdDistance - 0.01f ) } } };
|
||||||
= { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
||||||
{ 0.0f, 1.0f, 0.0f, 0.00f },
|
m_colorOverlayHandle,
|
||||||
{ 0.0f, 0.0f, 1.0f, ( k_hmdDistance - 0.01f ) } } };
|
vr::k_unTrackedDeviceIndex_Hmd,
|
||||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
¬ificationTransform );
|
||||||
m_colorOverlayHandle,
|
vr::VROverlay()->SetOverlaySortOrder( m_brightnessOverlayHandle,
|
||||||
vr::k_unTrackedDeviceIndex_Hmd,
|
sortMax );
|
||||||
¬ificationTransform );
|
|
||||||
vr::VROverlay()->SetOverlaySortOrder( m_brightnessOverlayHandle,
|
|
||||||
sortMax );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qCritical() << "Could not find Base color overlay: \""
|
|
||||||
<< video_keys::k_colorOverlayFilename << "\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user