mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Fix to use new HMD methods
This commit is contained in:
parent
e6473fc8b9
commit
3e8d0ad712
3 changed files with 37 additions and 10 deletions
|
@ -2371,11 +2371,19 @@ void Application::updateMyAvatarLookAtPosition() {
|
||||||
} else {
|
} else {
|
||||||
lookAtSpot = _myCamera.getPosition() + transformPoint(_myAvatar->getSensorToWorldMatrix(), extractTranslation(getHMDSensorPose()));
|
lookAtSpot = _myCamera.getPosition() + transformPoint(_myAvatar->getSensorToWorldMatrix(), extractTranslation(getHMDSensorPose()));
|
||||||
}
|
}
|
||||||
} else if (eyeTracker->isTracking() && (OculusManager::isConnected() || eyeTracker->isSimulating())) {
|
} else if (eyeTracker->isTracking() && (isHMDMode() || eyeTracker->isSimulating())) {
|
||||||
// Look at the point that the user is looking at.
|
// Look at the point that the user is looking at.
|
||||||
if (OculusManager::isConnected()) {
|
if (isHMDMode()) {
|
||||||
lookAtSpot = _myCamera.getPosition() + OculusManager::getMidEyePosition() +
|
|
||||||
_myAvatar->getOrientation() * (OculusManager::getOrientation() * eyeTracker->getLookAtPosition());
|
// TODO: Test ...
|
||||||
|
// Position of simulated look-at target should change with change in HMD position and orientation
|
||||||
|
|
||||||
|
glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose();
|
||||||
|
glm::quat hmdOrientation = glm::quat_cast(headPose);
|
||||||
|
glm::vec3 hmdPosition = glm::vec3(headPose[3]);
|
||||||
|
|
||||||
|
lookAtSpot = _myCamera.getPosition() + hmdPosition +
|
||||||
|
_myAvatar->getOrientation() * (hmdOrientation * eyeTracker->getLookAtPosition());
|
||||||
} else {
|
} else {
|
||||||
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
||||||
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * eyeTracker->getLookAtPosition());
|
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * eyeTracker->getLookAtPosition());
|
||||||
|
@ -2412,9 +2420,17 @@ void Application::updateMyAvatarLookAtPosition() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// I am not looking at anyone else, so just look forward
|
// I am not looking at anyone else, so just look forward
|
||||||
if (OculusManager::isConnected()) {
|
if (isHMDMode()) {
|
||||||
lookAtSpot = _myCamera.getPosition() + OculusManager::getMidEyePosition() +
|
|
||||||
_myAvatar->getOrientation() * (OculusManager::getOrientation() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
// TODO: Test ...
|
||||||
|
// Look-at vector should go into distance based on HMD position and orientation
|
||||||
|
|
||||||
|
glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose();
|
||||||
|
glm::quat hmdOrientation = glm::quat_cast(headPose);
|
||||||
|
glm::vec3 hmdPosition = glm::vec3(headPose[3]);
|
||||||
|
|
||||||
|
lookAtSpot = _myCamera.getPosition() + hmdPosition +
|
||||||
|
_myAvatar->getOrientation() * (hmdOrientation * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||||
} else {
|
} else {
|
||||||
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
||||||
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||||
|
|
|
@ -292,9 +292,10 @@ public:
|
||||||
virtual QGLWidget* getPrimarySurface() override;
|
virtual QGLWidget* getPrimarySurface() override;
|
||||||
|
|
||||||
void setActiveDisplayPlugin(const QString& pluginName);
|
void setActiveDisplayPlugin(const QString& pluginName);
|
||||||
private:
|
|
||||||
DisplayPlugin * getActiveDisplayPlugin();
|
DisplayPlugin * getActiveDisplayPlugin();
|
||||||
const DisplayPlugin * getActiveDisplayPlugin() const;
|
const DisplayPlugin * getActiveDisplayPlugin() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FileLogger* getLogger() { return _logger; }
|
FileLogger* getLogger() { return _logger; }
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <AnimationHandle.h>
|
#include <AnimationHandle.h>
|
||||||
#include <AudioClient.h>
|
#include <AudioClient.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <display-plugins/DisplayPlugin.h>
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
|
@ -1253,9 +1254,18 @@ void MyAvatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qApp->isHMDMode()) {
|
if (qApp->isHMDMode()) {
|
||||||
|
|
||||||
|
// TODO: Test ...
|
||||||
|
// Look-at vectors should go from HMD mid eyes regardless of combined position and orientation
|
||||||
|
|
||||||
|
glm::mat4 leftEye = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Left);
|
||||||
|
glm::vec3 leftEyePosition = glm::vec3(leftEye[3]);
|
||||||
|
glm::mat4 rightEye = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Right);
|
||||||
|
glm::vec3 rightEyePosition = glm::vec3(leftEye[3]);
|
||||||
|
|
||||||
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||||
getHead()->renderLookAts(renderArgs, cameraPosition + OculusManager::getLeftEyePosition(),
|
getHead()->renderLookAts(renderArgs, cameraPosition + leftEyePosition,
|
||||||
cameraPosition + OculusManager::getRightEyePosition());
|
cameraPosition + rightEyePosition);
|
||||||
} else {
|
} else {
|
||||||
getHead()->renderLookAts(renderArgs);
|
getHead()->renderLookAts(renderArgs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue