mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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.
|
||||
_isHMDMode = qApp->isHMDMode();
|
||||
auto frameCount = qApp->getFrameCount();
|
||||
|
||||
QSharedPointer<AvatarManager> manager = DependencyManager::get<AvatarManager>();
|
||||
MyAvatar* myAvatar = manager->getMyAvatar();
|
||||
|
|
|
@ -35,14 +35,15 @@ void OculusLegacyDisplayPlugin::resetSensors() {
|
|||
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 {
|
||||
static uint32_t lastFrameSeen = 0;
|
||||
if (frameIndex > lastFrameSeen) {
|
||||
Lock lock(_mutex);
|
||||
_trackingState = ovrHmd_GetTrackingState(_hmd, ovr_GetTimeInSeconds());
|
||||
lastFrameSeen = frameIndex;
|
||||
}
|
||||
return toGlm(_trackingState.HeadPose.ThePose);
|
||||
return _headPoseCache.get();
|
||||
}
|
||||
|
||||
bool OculusLegacyDisplayPlugin::isSupported() const {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <display-plugins/hmd/HmdDisplayPlugin.h>
|
||||
#include <ThreadSafeValueCache.h>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
@ -26,7 +27,8 @@ public:
|
|||
|
||||
// Stereo specific methods
|
||||
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;
|
||||
|
||||
|
@ -52,6 +54,7 @@ private:
|
|||
//ovrTexture _eyeTextures[2]; // FIXME - not currently in use
|
||||
mutable int _hmdScreen { -1 };
|
||||
bool _hswDismissed { false };
|
||||
ThreadSafeValueCache _headPoseCache { glm::mat4() };
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue