mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +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 <ui-plugins/PluginContainer.h>
|
||||
|
||||
#include <QtCore/QProcessEnvironment>
|
||||
|
||||
#include <ViewFrustum.h>
|
||||
|
@ -41,6 +43,13 @@ bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
|||
}
|
||||
|
||||
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;
|
||||
_eyeProjections[0][0] = vec4{ 0.759056330, 0.000000000, 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() {
|
||||
float yaw = sinf(secTimestampNow()) * 0.25f;
|
||||
float pitch = cosf(secTimestampNow()) * 0.25f;
|
||||
// Simulates head pose latency correction
|
||||
_currentPresentFrameInfo.presentPose =
|
||||
glm::mat4_cast(glm::angleAxis(yaw, Vectors::UP)) *
|
||||
glm::mat4_cast(glm::angleAxis(pitch, Vectors::RIGHT));
|
||||
if (_isAutoRotateEnabled) {
|
||||
float yaw = sinf(secTimestampNow()) * 0.25f;
|
||||
float pitch = cosf(secTimestampNow()) * 0.25f;
|
||||
// Simulates head pose latency correction
|
||||
_currentPresentFrameInfo.presentPose =
|
||||
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 internalActivate() override;
|
||||
private:
|
||||
|
||||
static const QString NAME;
|
||||
bool _isAutoRotateEnabled{ true };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue