protected Matrix transformModelView(Matrix modelView, IDelegateView view) { if (disableHeadTransform) { return modelView; } Vec4 translation = RiftUtils.toVec4(eyePoses[eye].Position); double translationScale = getHeadTranslationScale(view); Quaternion rotation = RiftUtils.toQuaternion(eyePoses[eye].Orientation); Matrix translationM = Matrix.fromTranslation(translation.multiply3(-translationScale)); Matrix rotationM = Matrix.fromQuaternion(rotation.getInverse()); return rotationM.multiply(translationM.multiply(modelView)); }
@Override public Matrix computeProjection( IDelegateView view, Angle horizontalFieldOfView, double nearDistance, double farDistance) { if (!shouldRenderForHMD()) { return view.computeProjection(horizontalFieldOfView, nearDistance, farDistance); } return RiftUtils.toMatrix( Hmd.getPerspectiveProjection(eyeFov[eye], (float) nearDistance, (float) farDistance, true)); }