mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
don't submit frames while oculus says it's not visible
This commit is contained in:
parent
83fba2ee41
commit
dd96881724
7 changed files with 24 additions and 1 deletions
|
@ -2818,8 +2818,10 @@ void Application::initializeDisplayPlugins() {
|
|||
[this](const QSize& size) { resizeGL(); });
|
||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);
|
||||
if (displayPlugin->isHmd()) {
|
||||
QObject::connect(dynamic_cast<HmdDisplayPlugin*>(displayPlugin.get()), &HmdDisplayPlugin::hmdMountedChanged,
|
||||
auto hmdDisplayPlugin = dynamic_cast<HmdDisplayPlugin*>(displayPlugin.get());
|
||||
QObject::connect(hmdDisplayPlugin, &HmdDisplayPlugin::hmdMountedChanged,
|
||||
DependencyManager::get<HMDScriptingInterface>().data(), &HMDScriptingInterface::mountedChanged);
|
||||
QObject::connect(hmdDisplayPlugin, &HmdDisplayPlugin::hmdVisibleChanged, this, &Application::hmdVisibleChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6414,6 +6416,14 @@ void Application::resetSensors(bool andReload) {
|
|||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void Application::hmdVisibleChanged(bool visible) {
|
||||
if (visible) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "start", Qt::QueuedConnection);
|
||||
} else {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "stop", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::updateWindowTitle() const {
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
|
|
@ -382,6 +382,8 @@ public slots:
|
|||
void resetSensors(bool andReload = false);
|
||||
void setActiveFaceTracker() const;
|
||||
|
||||
void hmdVisibleChanged(bool visible);
|
||||
|
||||
#if (PR_BUILD || DEV_BUILD)
|
||||
void sendWrongProtocolVersionsSignature(bool checked) { ::sendWrongProtocolVersionsSignature(checked); }
|
||||
#endif
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
|
||||
signals:
|
||||
void hmdMountedChanged();
|
||||
void hmdVisibleChanged(bool visible);
|
||||
|
||||
protected:
|
||||
virtual void hmdPresent() = 0;
|
||||
|
|
|
@ -41,6 +41,10 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
|||
_hmdMounted = !_hmdMounted;
|
||||
emit hmdMountedChanged();
|
||||
}
|
||||
if (ovr::isVisible(status) != _visible) {
|
||||
_visible = !_visible;
|
||||
emit hmdVisibleChanged(_visible);
|
||||
}
|
||||
|
||||
_currentRenderFrameInfo = FrameInfo();
|
||||
_currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds();
|
||||
|
|
|
@ -48,4 +48,5 @@ protected:
|
|||
ovrViewScaleDesc _viewScaleDesc;
|
||||
// ovrLayerEyeFovDepth _depthLayer;
|
||||
bool _hmdMounted { false };
|
||||
bool _visible { true };
|
||||
};
|
||||
|
|
|
@ -134,6 +134,10 @@ void OculusDisplayPlugin::hmdPresent() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex)
|
||||
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ struct ovr {
|
|||
|
||||
static inline bool quitRequested(const ovrSessionStatus& status) { return status.ShouldQuit != ovrFalse; }
|
||||
static inline bool displayLost(const ovrSessionStatus& status) { return status.DisplayLost != ovrFalse; }
|
||||
static inline bool isVisible(const ovrSessionStatus& status) { return status.IsVisible != ovrFalse; }
|
||||
static inline bool reorientRequested(const ovrSessionStatus& status) { return status.ShouldRecenter != ovrFalse; }
|
||||
static inline bool hmdMounted(const ovrSessionStatus& status) { return status.HmdMounted != ovrFalse; }
|
||||
static inline bool hasInputFocus(const ovrSessionStatus& status) { return status.HasInputFocus != ovrFalse; }
|
||||
|
|
Loading…
Reference in a new issue