Context: Maintain orientation of eye offset matrix.

This commit is contained in:
Lubosz Sarnecki 2024-03-10 21:02:57 +01:00 committed by Ada
parent da111b996c
commit 2125d60a4e

View file

@ -238,10 +238,14 @@ const Backend::TransformCamera& Backend::TransformCamera::recomputeDerived(const
Backend::TransformCamera Backend::TransformCamera::getEyeCamera(int eye, const StereoState& _stereo, const Transform& xformView, Vec2 normalizedJitter) const { Backend::TransformCamera Backend::TransformCamera::getEyeCamera(int eye, const StereoState& _stereo, const Transform& xformView, Vec2 normalizedJitter) const {
TransformCamera result = *this; TransformCamera result = *this;
Transform offsetTransform = xformView; Transform offsetTransform = xformView;
if (!_stereo._skybox) { glm::vec3 eyePosition = extractTranslation(_stereo._eyeViews[eye]);
offsetTransform.postTranslate(-Vec3(_stereo._eyeViews[eye][3])); glm::quat eyeOrientation = glmExtractRotation(_stereo._eyeViews[eye]);
if (!_stereo._skybox)
{
offsetTransform.postRotate(eyeOrientation).postTranslate(eyePosition);
} else { } else {
// FIXME: If "skybox" the ipd is set to 0 for now, let s try to propose a better solution for this in the future // FIXME: If "skybox" the ipd is set to 0 for now, let s try to propose a better solution for this in the future
offsetTransform.postRotate(eyeOrientation);
} }
result._projection = _stereo._eyeProjections[eye]; result._projection = _stereo._eyeProjections[eye];
normalizedJitter.x *= 2.0f; normalizedJitter.x *= 2.0f;