mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Added option to disable automatic head rotation in HMD simulator
This commit is contained in:
parent
e0f398dcab
commit
1b8821c649
2 changed files with 19 additions and 6 deletions
|
@ -7,6 +7,8 @@
|
||||||
//
|
//
|
||||||
#include "DebugHmdDisplayPlugin.h"
|
#include "DebugHmdDisplayPlugin.h"
|
||||||
|
|
||||||
|
#include <ui-plugins/PluginContainer.h>
|
||||||
|
|
||||||
#include <QtCore/QProcessEnvironment>
|
#include <QtCore/QProcessEnvironment>
|
||||||
|
|
||||||
#include <ViewFrustum.h>
|
#include <ViewFrustum.h>
|
||||||
|
@ -41,6 +43,13 @@ bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebugHmdDisplayPlugin::internalActivate() {
|
bool DebugHmdDisplayPlugin::internalActivate() {
|
||||||
|
_isAutoRotateEnabled = _container->getBoolSetting("autoRotate", true);
|
||||||
|
_container->addMenuItem(PluginType::DISPLAY_PLUGIN, MENU_PATH(), tr("Auto Rotate"),
|
||||||
|
[this](bool clicked) {
|
||||||
|
_isAutoRotateEnabled = clicked;
|
||||||
|
_container->setBoolSetting("autoRotate", _isAutoRotateEnabled);
|
||||||
|
}, true, _isAutoRotateEnabled);
|
||||||
|
|
||||||
_ipd = 0.0327499993f * 2.0f;
|
_ipd = 0.0327499993f * 2.0f;
|
||||||
_eyeProjections[0][0] = vec4{ 0.759056330, 0.000000000, 0.000000000, 0.000000000 };
|
_eyeProjections[0][0] = vec4{ 0.759056330, 0.000000000, 0.000000000, 0.000000000 };
|
||||||
_eyeProjections[0][1] = vec4{ 0.000000000, 0.682773232, 0.000000000, 0.000000000 };
|
_eyeProjections[0][1] = vec4{ 0.000000000, 0.682773232, 0.000000000, 0.000000000 };
|
||||||
|
@ -63,10 +72,12 @@ bool DebugHmdDisplayPlugin::internalActivate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugHmdDisplayPlugin::updatePresentPose() {
|
void DebugHmdDisplayPlugin::updatePresentPose() {
|
||||||
float yaw = sinf(secTimestampNow()) * 0.25f;
|
if (_isAutoRotateEnabled) {
|
||||||
float pitch = cosf(secTimestampNow()) * 0.25f;
|
float yaw = sinf(secTimestampNow()) * 0.25f;
|
||||||
// Simulates head pose latency correction
|
float pitch = cosf(secTimestampNow()) * 0.25f;
|
||||||
_currentPresentFrameInfo.presentPose =
|
// Simulates head pose latency correction
|
||||||
glm::mat4_cast(glm::angleAxis(yaw, Vectors::UP)) *
|
_currentPresentFrameInfo.presentPose =
|
||||||
glm::mat4_cast(glm::angleAxis(pitch, Vectors::RIGHT));
|
glm::mat4_cast(glm::angleAxis(yaw, Vectors::UP)) *
|
||||||
|
glm::mat4_cast(glm::angleAxis(pitch, Vectors::RIGHT));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,7 @@ protected:
|
||||||
bool isHmdMounted() const override { return true; }
|
bool isHmdMounted() const override { return true; }
|
||||||
bool internalActivate() override;
|
bool internalActivate() override;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
|
bool _isAutoRotateEnabled{ true };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue