From d1051ce5c9fbea1d7785901e3b5527b2f1e8dc4c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 5 Jul 2013 04:09:53 +0200 Subject: [PATCH] Handle head orientation in ryzom client, ref #43 --HG-- branch : multipass-stereo --- code/ryzom/client/src/main_loop.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 7b7c0bd9c..c76a6964c 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -1384,7 +1384,15 @@ bool mainLoop() MainCam.setRotQuat(View.currentViewQuat()); if (StereoHMD) { - // ... + NLMISC::CQuat hmdOrient = StereoHMD->getOrientation(); + NLMISC::CMatrix camMatrix = MainCam.getMatrix(); + NLMISC::CMatrix hmdMatrix; + hmdMatrix.setRot(hmdOrient); + NLMISC::CMatrix posMatrix; // minimal head modeling, will be changed in the future + posMatrix.translate(StereoHMD->getEyePosition()); + NLMISC::CMatrix mat = ((camMatrix * hmdMatrix) * posMatrix); + MainCam.setPos(mat.getPos()); + MainCam.setRotQuat(mat.getRot()); } if (StereoDisplay) {