CenterMarker Rotation Fix + Misc (#458)
* add native chaperone option * refactored overlaywrapper error handling * added reset all settings * added reset all settings option * clarified driver bounds language * fixed naming schema of turn settings * fixed qml issue * marked errors in settings * fixed rotation of center marker and cleaned up * ci test * removed debugging code * fixed comment * fixed rotation.... made messy * fixed crash when centermarker new was on at launch * added settings to scroll view * fixed some initialization issues w/ center marker and some race conditions * updated Documentation to be more correct/concise about openGL rendering Information issue 457 * changed default behaviour of chaperone bounds to be un-checked to be consistant w/ other settings (default is unchecked) * cleaned up code around centermarker overlay * removed unused variables, changed scope of some existing * code naming cleanup * more rename * updated Version strings for 5.1.1 release * updated string to be more concise
This commit is contained in:
@@ -20,17 +20,24 @@ void ChaperoneTabController::initStage1()
|
||||
reloadChaperoneProfiles();
|
||||
m_chaperoneSettingsUpdateCounter
|
||||
= utils::adjustUpdateRate( k_chaperoneSettingsUpdateCounter );
|
||||
initFloorOverlay();
|
||||
initCenterMarkerOverlay();
|
||||
eventLoopTick( m_trackingUniverse, nullptr );
|
||||
}
|
||||
|
||||
void ChaperoneTabController::initStage2( OverlayController* var_parent )
|
||||
{
|
||||
this->parent = var_parent;
|
||||
// Cludge Fix for now, but its not getting called for some reason w/ QML
|
||||
setCenterMarkerNew( centerMarkerNew() );
|
||||
|
||||
updateChaperoneSettings(); // force one update of OVR saved settings to make
|
||||
// sure our m_ variables are correct
|
||||
// Force call Update Overlay Once, so Default state is in correct location
|
||||
if ( m_centerMarkerOverlayIsInit )
|
||||
{
|
||||
vr::HmdMatrix34_t temp = { { { 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, -1.0f, 0.0f, 0.0f } } };
|
||||
updateCenterMarkerOverlay( &( temp ) );
|
||||
}
|
||||
}
|
||||
|
||||
void ChaperoneTabController::dashboardLoopTick()
|
||||
@@ -237,13 +244,7 @@ void ChaperoneTabController::eventLoopTick(
|
||||
vr::TrackedDevicePose_t* devicePoses )
|
||||
{
|
||||
m_trackingUniverse = universe;
|
||||
// Update overlay should only run After move center tab controller is
|
||||
// initialized.
|
||||
// As such this protects it from running during initstage 1.
|
||||
if ( centerMarkerNew() && devicePoses != nullptr )
|
||||
{
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
if ( devicePoses )
|
||||
{
|
||||
m_isHMDActive = false;
|
||||
@@ -739,7 +740,7 @@ void ChaperoneTabController::setChaperoneColorR( int value, bool notify )
|
||||
vr::k_pch_CollisionBounds_ColorGammaR_Int32,
|
||||
m_chaperoneColorR,
|
||||
"" );
|
||||
updateOverlayColor();
|
||||
updateCenterMarkerOverlayColor();
|
||||
if ( notify )
|
||||
{
|
||||
emit chaperoneColorRChanged( value );
|
||||
@@ -767,7 +768,7 @@ void ChaperoneTabController::setChaperoneColorG( int value, bool notify )
|
||||
vr::k_pch_CollisionBounds_ColorGammaG_Int32,
|
||||
m_chaperoneColorG,
|
||||
"" );
|
||||
updateOverlayColor();
|
||||
updateCenterMarkerOverlayColor();
|
||||
if ( notify )
|
||||
{
|
||||
emit chaperoneColorGChanged( value );
|
||||
@@ -795,14 +796,14 @@ void ChaperoneTabController::setChaperoneColorB( int value, bool notify )
|
||||
vr::k_pch_CollisionBounds_ColorGammaB_Int32,
|
||||
m_chaperoneColorB,
|
||||
"" );
|
||||
updateOverlayColor();
|
||||
updateCenterMarkerOverlayColor();
|
||||
if ( notify )
|
||||
{
|
||||
emit chaperoneColorBChanged( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
void ChaperoneTabController::updateOverlayColor()
|
||||
void ChaperoneTabController::updateCenterMarkerOverlayColor()
|
||||
{
|
||||
float chapColorR = static_cast<float>( m_chaperoneColorR ) / 255.0f;
|
||||
float chapColorG = static_cast<float>( m_chaperoneColorG ) / 255.0f;
|
||||
@@ -840,10 +841,12 @@ void ChaperoneTabController::setCenterMarkerNew( bool value, bool notify )
|
||||
if ( value )
|
||||
{
|
||||
ovr_overlay_wrapper::showOverlay( m_chaperoneFloorOverlayHandle );
|
||||
m_centerMarkerOverlayNeedsUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ovr_overlay_wrapper::hideOverlay( m_chaperoneFloorOverlayHandle );
|
||||
m_centerMarkerOverlayNeedsUpdate = false;
|
||||
}
|
||||
|
||||
if ( notify )
|
||||
@@ -1546,7 +1549,7 @@ void ChaperoneTabController::addRightHapticClick( bool rightHapticClickPressed )
|
||||
}
|
||||
}
|
||||
|
||||
void ChaperoneTabController::initFloorOverlay()
|
||||
void ChaperoneTabController::initCenterMarkerOverlay()
|
||||
{
|
||||
std::string overlayFloorMarkerKey
|
||||
= std::string( application_strings::applicationKey ) + ".floormarker";
|
||||
@@ -1561,9 +1564,10 @@ void ChaperoneTabController::initFloorOverlay()
|
||||
m_chaperoneFloorOverlayHandle, m_floorMarkerFN, "" );
|
||||
ovr_overlay_wrapper::setOverlayWidthInMeters(
|
||||
m_chaperoneFloorOverlayHandle, 0.5f );
|
||||
updateOverlayColor();
|
||||
updateCenterMarkerOverlayColor();
|
||||
ovr_overlay_wrapper::setOverlayAlpha(
|
||||
m_chaperoneFloorOverlayHandle, m_visibility, "" );
|
||||
m_centerMarkerOverlayIsInit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1572,32 +1576,25 @@ void ChaperoneTabController::initFloorOverlay()
|
||||
}
|
||||
}
|
||||
|
||||
void ChaperoneTabController::updateOverlay()
|
||||
// This Function Is called And Handled In MoveCenterTabController to reduce
|
||||
// un-necessary overhead, as well as consistancy in movement operations
|
||||
// It will be updated Every frame that movement is updated
|
||||
void ChaperoneTabController::updateCenterMarkerOverlay(
|
||||
vr::HmdMatrix34_t* centerPlaySpaceMatrix )
|
||||
{
|
||||
if ( m_trackingUniverse != vr::TrackingUniverseRawAndUncalibrated )
|
||||
{
|
||||
float xoff = -( parent->m_moveCenterTabController.offsetX() );
|
||||
float yoff = -( parent->m_moveCenterTabController.offsetY() );
|
||||
float zoff = -( parent->m_moveCenterTabController.offsetZ() );
|
||||
/* Rotation on Y Axis
|
||||
* {cos t, 0, sin t}
|
||||
* {0, 1, 0}
|
||||
* {-sin t, 0 cost t}
|
||||
*/
|
||||
|
||||
vr::HmdMatrix34_t updateTransform = { { { 1.0f, 0.0f, 0.0f, xoff },
|
||||
{ 0.0f, 0.0f, 1.0f, yoff },
|
||||
{ 0.0f, -1.0f, 0.0f, zoff } } };
|
||||
ovr_overlay_wrapper::setOverlayTransformAbsolute(
|
||||
m_chaperoneFloorOverlayHandle,
|
||||
m_trackingUniverse,
|
||||
&updateTransform,
|
||||
( centerPlaySpaceMatrix ),
|
||||
"" );
|
||||
checkOverlayRotation();
|
||||
|
||||
checkCenterMarkerOverlayRotationCount();
|
||||
}
|
||||
}
|
||||
|
||||
void ChaperoneTabController::checkOverlayRotation()
|
||||
void ChaperoneTabController::checkCenterMarkerOverlayRotationCount()
|
||||
{
|
||||
// can only turn so quickly soooo roughly .5 secondish update should be fine
|
||||
if ( m_rotationUpdateCounter > 45 )
|
||||
|
||||
@@ -376,13 +376,12 @@ private:
|
||||
std::vector<ChaperoneProfile> chaperoneProfiles;
|
||||
|
||||
std::string m_floorMarkerFN = "/res/img/chaperone/centermark.png";
|
||||
void initFloorOverlay();
|
||||
void updateOverlay();
|
||||
void updateOverlayColor();
|
||||
void checkOverlayRotation();
|
||||
void initCenterMarkerOverlay();
|
||||
void updateCenterMarkerOverlayColor();
|
||||
void checkCenterMarkerOverlayRotationCount();
|
||||
int m_rotationUpdateCounter = 0;
|
||||
int m_rotationCurrent = 0;
|
||||
bool m_overlayNeedsUpdate = false;
|
||||
bool m_centerMarkerOverlayIsInit = false;
|
||||
|
||||
vr::ETrackingUniverseOrigin m_trackingUniverse
|
||||
= vr::TrackingUniverseRawAndUncalibrated;
|
||||
@@ -398,6 +397,8 @@ public:
|
||||
void dashboardLoopTick();
|
||||
void handleChaperoneWarnings( float distance );
|
||||
|
||||
void updateCenterMarkerOverlay( vr::HmdMatrix34_t* centerPlaySpaceMatrix );
|
||||
|
||||
float boundsVisibility() const;
|
||||
float fadeDistance();
|
||||
float height();
|
||||
@@ -412,6 +413,7 @@ public:
|
||||
int chaperoneColorA() const;
|
||||
|
||||
bool centerMarkerNew();
|
||||
bool m_centerMarkerOverlayNeedsUpdate = false;
|
||||
|
||||
bool chaperoneFloorToggle();
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "MoveCenterTabController.h"
|
||||
#include <QQuickWindow>
|
||||
#include "../overlaycontroller.h"
|
||||
#include "../utils/Matrix.h"
|
||||
#include "../quaternion/quaternion.h"
|
||||
#include "../settings/settings.h"
|
||||
|
||||
@@ -1005,6 +1004,14 @@ void MoveCenterTabController::reset()
|
||||
m_lastControllerPosition[0] = 0.0f;
|
||||
m_lastControllerPosition[1] = 0.0f;
|
||||
m_lastControllerPosition[2] = 0.0f;
|
||||
|
||||
// For Center Marker
|
||||
if ( parent->m_chaperoneTabController.m_centerMarkerOverlayNeedsUpdate )
|
||||
{
|
||||
m_offsetmatrix = utils::k_forwardUpMatrix;
|
||||
parent->m_chaperoneTabController.updateCenterMarkerOverlay(
|
||||
&m_offsetmatrix );
|
||||
}
|
||||
m_lastMoveHand = vr::TrackedControllerRole_Invalid;
|
||||
m_lastRotateHand = vr::TrackedControllerRole_Invalid;
|
||||
applyChaperoneResetData();
|
||||
@@ -2567,14 +2574,17 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
|
||||
// (we reuse offsetUniverseCenterYaw to rotate the chaperone also)
|
||||
double offsetUniverseCenterYaw = static_cast<double>( std::atan2(
|
||||
offsetUniverseCenter.m[0][2], offsetUniverseCenter.m[2][2] ) );
|
||||
|
||||
double offsetUniverseCenterXyz[3]
|
||||
= { static_cast<double>( offsetUniverseCenter.m[0][3] ),
|
||||
static_cast<double>( offsetUniverseCenter.m[1][3] ),
|
||||
static_cast<double>( offsetUniverseCenter.m[2][3] ) };
|
||||
// unrotate to get raw values of xyz
|
||||
|
||||
rotateCoordinates( offsetUniverseCenterXyz,
|
||||
offsetUniverseCenterYaw
|
||||
- ( m_rotation * k_centidegreesToRadians ) );
|
||||
|
||||
if ( abs( offsetUniverseCenterXyz[0] ) > k_maxOpenvrWorkingSetOffest
|
||||
|| ( abs( offsetUniverseCenterXyz[0] )
|
||||
> k_maxOvrasUniverseCenteredTurningOffset
|
||||
@@ -2715,6 +2725,47 @@ void MoveCenterTabController::updateSpace( bool forceUpdate )
|
||||
}
|
||||
}
|
||||
|
||||
// Center Marker for playspace.
|
||||
if ( parent->m_chaperoneTabController.m_centerMarkerOverlayNeedsUpdate )
|
||||
{
|
||||
// Set Unrotated Coordinates
|
||||
float universePlayCenterTempCoords[3] = { 0.0f, 0.0f, 0.0f };
|
||||
universePlayCenterTempCoords[0]
|
||||
-= offsetUniverseCenter.m[0][3]
|
||||
- m_universeCenterForReset.m[0][3];
|
||||
universePlayCenterTempCoords[1]
|
||||
-= offsetUniverseCenter.m[1][3]
|
||||
- m_universeCenterForReset.m[1][3];
|
||||
universePlayCenterTempCoords[2]
|
||||
-= offsetUniverseCenter.m[2][3]
|
||||
- m_universeCenterForReset.m[2][3];
|
||||
// Rotate un-rotated to rotated
|
||||
rotateFloatCoordinates(
|
||||
universePlayCenterTempCoords,
|
||||
static_cast<float>( offsetUniverseCenterYaw ) );
|
||||
// Set Up orientation properly away from raw center
|
||||
utils::matMul33( m_offsetmatrix,
|
||||
offsetUniverseCenter,
|
||||
utils::k_forwardUpMatrix );
|
||||
vr::HmdMatrix34_t rotMatrix;
|
||||
utils::initRotationMatrix(
|
||||
rotMatrix,
|
||||
1,
|
||||
static_cast<float>( -( ( m_rotation * k_centidegreesToRadians )
|
||||
+ offsetUniverseCenterYaw ) ) );
|
||||
|
||||
// Rotates orientation At playspace center
|
||||
vr::HmdMatrix34_t finalmatrix;
|
||||
utils::matMul33( finalmatrix, rotMatrix, m_offsetmatrix );
|
||||
|
||||
finalmatrix.m[0][3] = universePlayCenterTempCoords[0];
|
||||
finalmatrix.m[1][3] = universePlayCenterTempCoords[1];
|
||||
finalmatrix.m[2][3] = universePlayCenterTempCoords[2];
|
||||
|
||||
parent->m_chaperoneTabController.updateCenterMarkerOverlay(
|
||||
&finalmatrix );
|
||||
}
|
||||
|
||||
// update chaperone working set preview (this does not commit)
|
||||
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(
|
||||
updatedBounds, m_collisionBoundsCountForReset );
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <openvr.h>
|
||||
#include <chrono>
|
||||
#include <qmath.h>
|
||||
#include "../utils/Matrix.h"
|
||||
#include "../utils/FrameRateUtils.h"
|
||||
#include "../settings/settings_object.h"
|
||||
|
||||
@@ -205,6 +206,9 @@ private:
|
||||
|
||||
unsigned int m_moveCenterSettingsUpdateCounter = 83;
|
||||
|
||||
// Matrix used For Center Marker
|
||||
vr::HmdMatrix34_t m_offsetmatrix = utils::k_forwardUpMatrix;
|
||||
|
||||
double m_velocity[3] = { 0.0, 0.0, 0.0 };
|
||||
std::chrono::steady_clock::time_point m_lastGravityUpdateTimePoint;
|
||||
std::chrono::steady_clock::time_point m_lastDragUpdateTimePoint;
|
||||
|
||||
@@ -16,6 +16,7 @@ void SettingsTabController::initStage1()
|
||||
void SettingsTabController::initStage2( OverlayController* var_parent )
|
||||
{
|
||||
this->parent = var_parent;
|
||||
setNativeChaperoneToggle( nativeChaperoneToggle() );
|
||||
}
|
||||
|
||||
void SettingsTabController::dashboardLoopTick()
|
||||
@@ -37,6 +38,38 @@ bool SettingsTabController::autoStartEnabled() const
|
||||
return m_autoStartEnabled;
|
||||
}
|
||||
|
||||
bool SettingsTabController::nativeChaperoneToggle()
|
||||
{
|
||||
std::pair<ovr_settings_wrapper::SettingsError, bool> p
|
||||
= ovr_settings_wrapper::getFloat(
|
||||
vr::k_pch_CollisionBounds_Section,
|
||||
vr::k_pch_CollisionBounds_EnableDriverImport,
|
||||
"" );
|
||||
if ( p.first == ovr_settings_wrapper::SettingsError::NoError )
|
||||
{
|
||||
m_nativeChaperoneToggle = !( p.second );
|
||||
}
|
||||
return m_nativeChaperoneToggle;
|
||||
}
|
||||
|
||||
void SettingsTabController::setNativeChaperoneToggle( bool value, bool notify )
|
||||
{
|
||||
if ( m_nativeChaperoneToggle != value )
|
||||
{
|
||||
m_nativeChaperoneToggle = !( value );
|
||||
ovr_settings_wrapper::setBool(
|
||||
vr::k_pch_CollisionBounds_Section,
|
||||
vr::k_pch_CollisionBounds_EnableDriverImport,
|
||||
m_nativeChaperoneToggle,
|
||||
"" );
|
||||
// On Error Do Nothing
|
||||
if ( notify )
|
||||
{
|
||||
emit nativeChaperoneToggleChanged( m_nativeChaperoneToggle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsTabController::setAutoStartEnabled( bool value, bool notify )
|
||||
{
|
||||
if ( m_autoStartEnabled != value )
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include "../utils/FrameRateUtils.h"
|
||||
#include "../openvr/ovr_settings_wrapper.h"
|
||||
|
||||
class QQuickWindow;
|
||||
// application namespace
|
||||
@@ -16,6 +17,9 @@ class SettingsTabController : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( bool autoStartEnabled READ autoStartEnabled WRITE
|
||||
setAutoStartEnabled NOTIFY autoStartEnabledChanged )
|
||||
Q_PROPERTY(
|
||||
bool nativeChaperoneToggle READ nativeChaperoneToggle WRITE
|
||||
setNativeChaperoneToggle NOTIFY nativeChaperoneToggleChanged )
|
||||
|
||||
private:
|
||||
OverlayController* parent;
|
||||
@@ -23,6 +27,7 @@ private:
|
||||
unsigned settingsUpdateCounter = 0;
|
||||
|
||||
bool m_autoStartEnabled = false;
|
||||
bool m_nativeChaperoneToggle = false;
|
||||
|
||||
unsigned int m_settingsTabSettingsUpdateCounter = 157;
|
||||
|
||||
@@ -33,12 +38,15 @@ public:
|
||||
void dashboardLoopTick();
|
||||
|
||||
bool autoStartEnabled() const;
|
||||
bool nativeChaperoneToggle();
|
||||
|
||||
public slots:
|
||||
void setAutoStartEnabled( bool value, bool notify = true );
|
||||
void setNativeChaperoneToggle( bool value, bool notify = true );
|
||||
|
||||
signals:
|
||||
void autoStartEnabledChanged( bool value );
|
||||
void nativeChaperoneToggleChanged( bool value );
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -58,6 +58,7 @@ struct VideoProfile : settings::ISettingsObject
|
||||
|
||||
o.addValue( overlayMethodState );
|
||||
|
||||
// TODO add opacity Toggle?
|
||||
o.addValue( static_cast<double>( opacity ) );
|
||||
|
||||
return o;
|
||||
|
||||
Reference in New Issue
Block a user