mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +02:00
OculusLegacyDisplayPlugin: fixes for macosx and linux
This commit is contained in:
parent
960ffd9c9e
commit
4321c5a62b
3 changed files with 12 additions and 9 deletions
|
@ -30,7 +30,6 @@ void AvatarUpdate::synchronousProcess() {
|
||||||
|
|
||||||
// Keep our own updated value, so that our asynchronous code can consult it.
|
// Keep our own updated value, so that our asynchronous code can consult it.
|
||||||
_isHMDMode = qApp->isHMDMode();
|
_isHMDMode = qApp->isHMDMode();
|
||||||
auto frameCount = qApp->getFrameCount();
|
|
||||||
|
|
||||||
QSharedPointer<AvatarManager> manager = DependencyManager::get<AvatarManager>();
|
QSharedPointer<AvatarManager> manager = DependencyManager::get<AvatarManager>();
|
||||||
MyAvatar* myAvatar = manager->getMyAvatar();
|
MyAvatar* myAvatar = manager->getMyAvatar();
|
||||||
|
|
|
@ -35,14 +35,15 @@ void OculusLegacyDisplayPlugin::resetSensors() {
|
||||||
ovrHmd_RecenterPose(_hmd);
|
ovrHmd_RecenterPose(_hmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::mat4 OculusLegacyDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
||||||
|
Lock lock(_mutex);
|
||||||
|
_trackingState = ovrHmd_GetTrackingState(_hmd, ovr_GetTimeInSeconds());
|
||||||
|
lastFrameSeen = frameIndex;
|
||||||
|
_headPoseCache.set(toGlm(_trackingState.HeadPose.ThePose));
|
||||||
|
}
|
||||||
|
|
||||||
glm::mat4 OculusLegacyDisplayPlugin::getHeadPose(uint32_t frameIndex) const {
|
glm::mat4 OculusLegacyDisplayPlugin::getHeadPose(uint32_t frameIndex) const {
|
||||||
static uint32_t lastFrameSeen = 0;
|
return _headPoseCache.get();
|
||||||
if (frameIndex > lastFrameSeen) {
|
|
||||||
Lock lock(_mutex);
|
|
||||||
_trackingState = ovrHmd_GetTrackingState(_hmd, ovr_GetTimeInSeconds());
|
|
||||||
lastFrameSeen = frameIndex;
|
|
||||||
}
|
|
||||||
return toGlm(_trackingState.HeadPose.ThePose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OculusLegacyDisplayPlugin::isSupported() const {
|
bool OculusLegacyDisplayPlugin::isSupported() const {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <display-plugins/hmd/HmdDisplayPlugin.h>
|
#include <display-plugins/hmd/HmdDisplayPlugin.h>
|
||||||
|
#include <ThreadSafeValueCache.h>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -26,7 +27,8 @@ public:
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
virtual void resetSensors() override;
|
virtual void resetSensors() override;
|
||||||
virtual glm::mat4 getHeadPose(uint32_t frameIndex) const override;
|
virtual void updateHeadPose(uint32_t frameIndex) override;
|
||||||
|
virtual glm::mat4 getHeadPose() const override;
|
||||||
|
|
||||||
virtual float getTargetFrameRate() override;
|
virtual float getTargetFrameRate() override;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ private:
|
||||||
//ovrTexture _eyeTextures[2]; // FIXME - not currently in use
|
//ovrTexture _eyeTextures[2]; // FIXME - not currently in use
|
||||||
mutable int _hmdScreen { -1 };
|
mutable int _hmdScreen { -1 };
|
||||||
bool _hswDismissed { false };
|
bool _hswDismissed { false };
|
||||||
|
ThreadSafeValueCache _headPoseCache { glm::mat4() };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue