Add page to change desktop overlay translation

The implementation is simple 3D vector scaling and addition. The
HmdMatrix34_t consists of a 3x3 rotation matrix and a 3D vector for
position.

The overlay position is only updated whenever a new overlay is changed
because we need the old overlay position in order to modify it. The
openvr call to get the position is only updated whenever you open the
menu.

A new page was created due to lack of space on the utilities page.
This commit is contained in:
Vasily
2019-03-31 22:31:26 +02:00
committed by username223
parent 2e42773529
commit 760d262a57
14 changed files with 557 additions and 13 deletions
+64
View File
@@ -0,0 +1,64 @@
#pragma once
#include <QObject>
#include <openvr.h>
#include <easylogging++.h>
#include <QVector2D>
#include <QVector3D>
#include <QSettings>
void outputMat();
void transformMat();
namespace overlay
{
namespace strings
{
constexpr auto overlaykey = "valve.steam.desktop";
constexpr auto settingsGroupName = "utilitiesSettings";
constexpr auto widthSettingsName = "desktopWidth";
constexpr auto forwardsSettingsName = "desktopForwardsMovement";
constexpr auto rightMovementSettingsName = "desktopRightMovement";
constexpr auto upMovementSettingsName = "desktopUpMovement";
constexpr auto positionSettingsName = "desktopOverlayPosition";
} // namespace strings
constexpr auto defaultOverlayWidth = 4.0;
constexpr auto defaultMovement = 0.0;
class DesktopOverlay : public QObject
{
Q_OBJECT
public:
Q_PROPERTY( double rightMovement READ getCurrentRightMovement()
WRITE setRightMovement )
Q_PROPERTY( double forwardsMovement READ getCurrentForwardsMovement WRITE
setForwardsMovement )
Q_PROPERTY( double width READ getCurrentWidth WRITE setWidth )
Q_PROPERTY( double height READ getCurrentHeight WRITE setHeight )
DesktopOverlay();
Q_INVOKABLE void update();
bool isAvailable() const;
void setWidth( double width );
double getCurrentWidth() const noexcept;
void setRightMovement( double distance );
double getCurrentRightMovement() const noexcept;
void setForwardsMovement( double distance );
double getCurrentForwardsMovement() const noexcept;
void setHeight( double height );
double getCurrentHeight() const noexcept;
private:
double m_width = defaultOverlayWidth;
double m_forwardsMovement = defaultMovement;
double m_rightMovement = defaultMovement;
double m_upMovement = defaultMovement;
};
} // namespace overlay