mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 14:13:05 +02:00
Merge pull request #13341 from zfox23/MS13761_hideOverlayFix
Fix MS13761: Change the move conditions under which overlays hide
This commit is contained in:
commit
15129e37db
2 changed files with 13 additions and 48 deletions
|
@ -18,7 +18,6 @@
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
|
|
||||||
OverlayConductor::OverlayConductor() {
|
OverlayConductor::OverlayConductor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayConductor::~OverlayConductor() {
|
OverlayConductor::~OverlayConductor() {
|
||||||
|
@ -43,7 +42,6 @@ bool OverlayConductor::headOutsideOverlay() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayConductor::updateAvatarIsAtRest() {
|
bool OverlayConductor::updateAvatarIsAtRest() {
|
||||||
|
|
||||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
|
||||||
const quint64 REST_ENABLE_TIME_USECS = 1000 * 1000; // 1 s
|
const quint64 REST_ENABLE_TIME_USECS = 1000 * 1000; // 1 s
|
||||||
|
@ -69,31 +67,6 @@ bool OverlayConductor::updateAvatarIsAtRest() {
|
||||||
return _currentAtRest;
|
return _currentAtRest;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayConductor::updateAvatarHasDriveInput() {
|
|
||||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
|
||||||
|
|
||||||
const quint64 DRIVE_ENABLE_TIME_USECS = 200 * 1000; // 200 ms
|
|
||||||
const quint64 DRIVE_DISABLE_TIME_USECS = 1000 * 1000; // 1 s
|
|
||||||
|
|
||||||
bool desiredDriving = myAvatar->hasDriveInput();
|
|
||||||
if (desiredDriving != _desiredDriving) {
|
|
||||||
// start timer
|
|
||||||
_desiredDrivingTimer = usecTimestampNow() + (desiredDriving ? DRIVE_ENABLE_TIME_USECS : DRIVE_DISABLE_TIME_USECS);
|
|
||||||
}
|
|
||||||
|
|
||||||
_desiredDriving = desiredDriving;
|
|
||||||
|
|
||||||
if (_desiredDrivingTimer != 0 && usecTimestampNow() > _desiredDrivingTimer) {
|
|
||||||
// timer expired
|
|
||||||
// change state!
|
|
||||||
_currentDriving = _desiredDriving;
|
|
||||||
// disable timer
|
|
||||||
_desiredDrivingTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _currentDriving;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OverlayConductor::centerUI() {
|
void OverlayConductor::centerUI() {
|
||||||
// place the overlay at the current hmd position in sensor space
|
// place the overlay at the current hmd position in sensor space
|
||||||
auto camMat = cancelOutRollAndPitch(qApp->getHMDSensorPose());
|
auto camMat = cancelOutRollAndPitch(qApp->getHMDSensorPose());
|
||||||
|
@ -115,20 +88,19 @@ void OverlayConductor::update(float dt) {
|
||||||
_hmdMode = false;
|
_hmdMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prevDriving = _currentDriving;
|
|
||||||
bool isDriving = updateAvatarHasDriveInput();
|
|
||||||
bool drivingChanged = prevDriving != isDriving;
|
|
||||||
bool isAtRest = updateAvatarIsAtRest();
|
bool isAtRest = updateAvatarIsAtRest();
|
||||||
|
bool isMoving = !isAtRest;
|
||||||
|
|
||||||
bool shouldRecenter = false;
|
bool shouldRecenter = false;
|
||||||
|
|
||||||
if (_flags & SuppressedByDrive) {
|
if (_flags & SuppressedByMove) {
|
||||||
if (!isDriving) {
|
if (!isMoving) {
|
||||||
_flags &= ~SuppressedByDrive;
|
_flags &= ~SuppressedByMove;
|
||||||
shouldRecenter = true;
|
shouldRecenter = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (myAvatar->getClearOverlayWhenMoving() && drivingChanged && isDriving) {
|
if (myAvatar->getClearOverlayWhenMoving() && isMoving) {
|
||||||
_flags |= SuppressedByDrive;
|
_flags |= SuppressedByMove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +115,6 @@ void OverlayConductor::update(float dt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && (0 == (_flags & SuppressMask));
|
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && (0 == (_flags & SuppressMask));
|
||||||
if (targetVisible != currentVisible) {
|
if (targetVisible != currentVisible) {
|
||||||
offscreenUi->setPinned(!targetVisible);
|
offscreenUi->setPinned(!targetVisible);
|
||||||
|
|
|
@ -23,23 +23,17 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool headOutsideOverlay() const;
|
bool headOutsideOverlay() const;
|
||||||
bool updateAvatarHasDriveInput();
|
|
||||||
bool updateAvatarIsAtRest();
|
bool updateAvatarIsAtRest();
|
||||||
|
|
||||||
enum SupressionFlags {
|
enum SupressionFlags {
|
||||||
SuppressedByDrive = 0x01,
|
SuppressedByMove = 0x01,
|
||||||
SuppressedByHead = 0x02,
|
SuppressedByHead = 0x02,
|
||||||
SuppressMask = 0x03,
|
SuppressMask = 0x03,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t _flags { SuppressedByDrive };
|
uint8_t _flags { SuppressedByMove };
|
||||||
bool _hmdMode { false };
|
bool _hmdMode { false };
|
||||||
|
|
||||||
// used by updateAvatarHasDriveInput
|
|
||||||
uint64_t _desiredDrivingTimer { 0 };
|
|
||||||
bool _desiredDriving { false };
|
|
||||||
bool _currentDriving { false };
|
|
||||||
|
|
||||||
// used by updateAvatarIsAtRest
|
// used by updateAvatarIsAtRest
|
||||||
uint64_t _desiredAtRestTimer { 0 };
|
uint64_t _desiredAtRestTimer { 0 };
|
||||||
bool _desiredAtRest { true };
|
bool _desiredAtRest { true };
|
||||||
|
|
Loading…
Reference in a new issue