mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02: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(); });
|
[this](const QSize& size) { resizeGL(); });
|
||||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);
|
QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);
|
||||||
if (displayPlugin->isHmd()) {
|
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);
|
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);
|
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 {
|
void Application::updateWindowTitle() const {
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
|
@ -382,6 +382,8 @@ public slots:
|
||||||
void resetSensors(bool andReload = false);
|
void resetSensors(bool andReload = false);
|
||||||
void setActiveFaceTracker() const;
|
void setActiveFaceTracker() const;
|
||||||
|
|
||||||
|
void hmdVisibleChanged(bool visible);
|
||||||
|
|
||||||
#if (PR_BUILD || DEV_BUILD)
|
#if (PR_BUILD || DEV_BUILD)
|
||||||
void sendWrongProtocolVersionsSignature(bool checked) { ::sendWrongProtocolVersionsSignature(checked); }
|
void sendWrongProtocolVersionsSignature(bool checked) { ::sendWrongProtocolVersionsSignature(checked); }
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void hmdMountedChanged();
|
void hmdMountedChanged();
|
||||||
|
void hmdVisibleChanged(bool visible);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void hmdPresent() = 0;
|
virtual void hmdPresent() = 0;
|
||||||
|
|
|
@ -41,6 +41,10 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
_hmdMounted = !_hmdMounted;
|
_hmdMounted = !_hmdMounted;
|
||||||
emit hmdMountedChanged();
|
emit hmdMountedChanged();
|
||||||
}
|
}
|
||||||
|
if (ovr::isVisible(status) != _visible) {
|
||||||
|
_visible = !_visible;
|
||||||
|
emit hmdVisibleChanged(_visible);
|
||||||
|
}
|
||||||
|
|
||||||
_currentRenderFrameInfo = FrameInfo();
|
_currentRenderFrameInfo = FrameInfo();
|
||||||
_currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds();
|
_currentRenderFrameInfo.sensorSampleTime = ovr_GetTimeInSeconds();
|
||||||
|
|
|
@ -48,4 +48,5 @@ protected:
|
||||||
ovrViewScaleDesc _viewScaleDesc;
|
ovrViewScaleDesc _viewScaleDesc;
|
||||||
// ovrLayerEyeFovDepth _depthLayer;
|
// ovrLayerEyeFovDepth _depthLayer;
|
||||||
bool _hmdMounted { false };
|
bool _hmdMounted { false };
|
||||||
|
bool _visible { true };
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,6 +134,10 @@ void OculusDisplayPlugin::hmdPresent() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)_currentFrame->frameIndex)
|
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 quitRequested(const ovrSessionStatus& status) { return status.ShouldQuit != ovrFalse; }
|
||||||
static inline bool displayLost(const ovrSessionStatus& status) { return status.DisplayLost != 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 reorientRequested(const ovrSessionStatus& status) { return status.ShouldRecenter != ovrFalse; }
|
||||||
static inline bool hmdMounted(const ovrSessionStatus& status) { return status.HmdMounted != ovrFalse; }
|
static inline bool hmdMounted(const ovrSessionStatus& status) { return status.HmdMounted != ovrFalse; }
|
||||||
static inline bool hasInputFocus(const ovrSessionStatus& status) { return status.HasInputFocus != ovrFalse; }
|
static inline bool hasInputFocus(const ovrSessionStatus& status) { return status.HasInputFocus != ovrFalse; }
|
||||||
|
|
Loading…
Reference in a new issue