History

Application: Maintain orientation of eye offset matrix.

Lubosz Sarnecki committed 2 years ago

Commit fff21271 parent 4b9998e1 file · +2 −8Browse files

Showing the changes to interface/src/Application_Graphics.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application_Graphics.cpp+2−8
@@ -551,16 +551,10 @@ void Application::updateRenderArgs(float deltaTime) { · 550 unmodified lines
551 // only when the display plugin changes (or in non-HMD modes when the user551 // only when the display plugin changes (or in non-HMD modes when the user
552 // changes the FOV manually, which right now I don't think they can.552 // changes the FOV manually, which right now I don't think they can.
553 for_each_eye([&](Eye eye) {553 for_each_eye([&](Eye eye) {
554 // For providing the stereo eye views, the HMD head pose has already been
555 // applied to the avatar, so we need to get the difference between the head
556 // pose applied to the avatar and the per eye pose, and use THAT as
557 // the per-eye stereo matrix adjustment.
558 mat4 eyeToHead = getActiveDisplayPlugin()->getEyeToHeadTransform(eye);
559 // Grab the translation554 // Grab the translation
560 vec3 eyeOffset = glm::vec3(eyeToHead[3]);555 eyeOffsets[eye] = getActiveDisplayPlugin()->getEyeToHeadTransform(eye);
561 // Apply IPD scaling556 // Apply IPD scaling
562 mat4 eyeOffsetTransform = glm::translate(mat4(), eyeOffset * -1.0f * ipdScale);557 eyeOffsets[eye][3][0] *= ipdScale;
563 eyeOffsets[eye] = eyeOffsetTransform;
564 eyeProjections[eye] = getActiveDisplayPlugin()->getEyeProjection(eye, baseProjection);558 eyeProjections[eye] = getActiveDisplayPlugin()->getEyeProjection(eye, baseProjection);
565 });559 });
566 560