mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 03:27:24 +02:00
Merge pull request #5871 from ctrlaltdavid/20688
DO NOT MERGE - QA for 20688 - Fix 3rd person HMD view
This commit is contained in:
commit
c09ac51d75
1 changed files with 23 additions and 18 deletions
|
@ -1122,34 +1122,39 @@ void Application::paintGL() {
|
||||||
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
||||||
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
||||||
|
|
||||||
|
// Always use the default eye position, not the actual head eye position.
|
||||||
|
// Using the latter will cause the camera to wobble with idle animations,
|
||||||
|
// or with changes from the face tracker
|
||||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
||||||
// Always use the default eye position, not the actual head eye position.
|
if (isHMDMode()) {
|
||||||
// Using the latter will cause the camera to wobble with idle animations,
|
|
||||||
// or with changes from the face tracker
|
|
||||||
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
|
||||||
|
|
||||||
if (!getActiveDisplayPlugin()->isHmd()) {
|
|
||||||
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
|
|
||||||
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
|
|
||||||
} else {
|
|
||||||
mat4 camMat = _myAvatar->getSensorToWorldMatrix() * _myAvatar->getHMDSensorMatrix();
|
mat4 camMat = _myAvatar->getSensorToWorldMatrix() * _myAvatar->getHMDSensorMatrix();
|
||||||
_myCamera.setPosition(extractTranslation(camMat));
|
_myCamera.setPosition(extractTranslation(camMat));
|
||||||
_myCamera.setRotation(glm::quat_cast(camMat));
|
_myCamera.setRotation(glm::quat_cast(camMat));
|
||||||
|
} else {
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
|
||||||
|
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
|
||||||
}
|
}
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
|
glm::quat hmdRotation = extractRotation(_myAvatar->getHMDSensorMatrix());
|
||||||
|
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * hmdRotation);
|
||||||
|
// Ignore MenuOption::CenterPlayerInView in HMD view
|
||||||
|
glm::vec3 hmdOffset = extractTranslation(_myAvatar->getHMDSensorMatrix());
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition()
|
||||||
|
+ _myAvatar->getOrientation()
|
||||||
|
* (_myAvatar->getScale() * _myAvatar->getBoomLength() * glm::vec3(0.0f, 0.0f, 1.0f) + hmdOffset));
|
||||||
} else {
|
} else {
|
||||||
_myCamera.setRotation(_myAvatar->getHead()->getOrientation());
|
_myCamera.setRotation(_myAvatar->getHead()->getOrientation());
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition()
|
||||||
|
+ _myCamera.getRotation()
|
||||||
|
* (_myAvatar->getScale() * _myAvatar->getBoomLength() * glm::vec3(0.0f, 0.0f, 1.0f)));
|
||||||
|
} else {
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition()
|
||||||
|
+ _myAvatar->getOrientation()
|
||||||
|
* (_myAvatar->getScale() * _myAvatar->getBoomLength() * glm::vec3(0.0f, 0.0f, 1.0f)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::CenterPlayerInView)) {
|
|
||||||
_myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
|
|
||||||
_myCamera.getRotation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
|
|
||||||
} else {
|
|
||||||
_myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
|
|
||||||
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * _myAvatar->getBoomLength() * _myAvatar->getScale());
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
glm::quat hmdRotation = extractRotation(_myAvatar->getHMDSensorMatrix());
|
glm::quat hmdRotation = extractRotation(_myAvatar->getHMDSensorMatrix());
|
||||||
|
|
Loading…
Reference in a new issue