mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 04:03:28 +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"
|
||||
|
||||
OverlayConductor::OverlayConductor() {
|
||||
|
||||
}
|
||||
|
||||
OverlayConductor::~OverlayConductor() {
|
||||
|
@ -43,7 +42,6 @@ bool OverlayConductor::headOutsideOverlay() const {
|
|||
}
|
||||
|
||||
bool OverlayConductor::updateAvatarIsAtRest() {
|
||||
|
||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
|
||||
const quint64 REST_ENABLE_TIME_USECS = 1000 * 1000; // 1 s
|
||||
|
@ -69,31 +67,6 @@ bool OverlayConductor::updateAvatarIsAtRest() {
|
|||
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() {
|
||||
// place the overlay at the current hmd position in sensor space
|
||||
auto camMat = cancelOutRollAndPitch(qApp->getHMDSensorPose());
|
||||
|
@ -115,20 +88,19 @@ void OverlayConductor::update(float dt) {
|
|||
_hmdMode = false;
|
||||
}
|
||||
|
||||
bool prevDriving = _currentDriving;
|
||||
bool isDriving = updateAvatarHasDriveInput();
|
||||
bool drivingChanged = prevDriving != isDriving;
|
||||
bool isAtRest = updateAvatarIsAtRest();
|
||||
bool isMoving = !isAtRest;
|
||||
|
||||
bool shouldRecenter = false;
|
||||
|
||||
if (_flags & SuppressedByDrive) {
|
||||
if (!isDriving) {
|
||||
_flags &= ~SuppressedByDrive;
|
||||
if (_flags & SuppressedByMove) {
|
||||
if (!isMoving) {
|
||||
_flags &= ~SuppressedByMove;
|
||||
shouldRecenter = true;
|
||||
}
|
||||
} else {
|
||||
if (myAvatar->getClearOverlayWhenMoving() && drivingChanged && isDriving) {
|
||||
_flags |= SuppressedByDrive;
|
||||
if (myAvatar->getClearOverlayWhenMoving() && isMoving) {
|
||||
_flags |= SuppressedByMove;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +115,6 @@ void OverlayConductor::update(float dt) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && (0 == (_flags & SuppressMask));
|
||||
if (targetVisible != currentVisible) {
|
||||
offscreenUi->setPinned(!targetVisible);
|
||||
|
|
|
@ -23,23 +23,17 @@ public:
|
|||
|
||||
private:
|
||||
bool headOutsideOverlay() const;
|
||||
bool updateAvatarHasDriveInput();
|
||||
bool updateAvatarIsAtRest();
|
||||
|
||||
enum SupressionFlags {
|
||||
SuppressedByDrive = 0x01,
|
||||
SuppressedByMove = 0x01,
|
||||
SuppressedByHead = 0x02,
|
||||
SuppressMask = 0x03,
|
||||
};
|
||||
|
||||
uint8_t _flags { SuppressedByDrive };
|
||||
uint8_t _flags { SuppressedByMove };
|
||||
bool _hmdMode { false };
|
||||
|
||||
// used by updateAvatarHasDriveInput
|
||||
uint64_t _desiredDrivingTimer { 0 };
|
||||
bool _desiredDriving { false };
|
||||
bool _currentDriving { false };
|
||||
|
||||
// used by updateAvatarIsAtRest
|
||||
uint64_t _desiredAtRestTimer { 0 };
|
||||
bool _desiredAtRest { true };
|
||||
|
|
Loading…
Reference in a new issue