[Bf-blender-cvs] [727a744e3c3] master: Fix broken behavior on active VR Landmark change

Julian Eisel noreply at git.blender.org
Mon Aug 10 13:50:27 CEST 2020


Commit: 727a744e3c3eba755767e718ed26cef3558e46a8
Author: Julian Eisel
Date:   Mon Aug 10 13:35:47 2020 +0200
Branches: master
https://developer.blender.org/rB727a744e3c3eba755767e718ed26cef3558e46a8

Fix broken behavior on active VR Landmark change

There would always be an unintended offset applied. Per design there
should not be any offset when changing VR Landmarks, the view should
just jump exactly to the Landmark.

Due to the recent changes, we don't have to add, but substract the eye
offset we apply to get the wanted behavior.

Mistake in 607d745a79e0.

===================================================================

M	source/blender/windowmanager/xr/intern/wm_xr_draw.c
M	source/blender/windowmanager/xr/intern/wm_xr_session.c

===================================================================

diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
index 684e59eb8b2..6f96d2ea6a0 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
@@ -55,7 +55,7 @@ static void wm_xr_draw_matrices_create(const wmXrDrawData *draw_data,
 
   copy_qt_qt(eye_pose.orientation_quat, draw_view->eye_pose.orientation_quat);
   copy_v3_v3(eye_pose.position, draw_view->eye_pose.position);
-  add_v3_v3(eye_pose.position, draw_data->eye_position_ofs);
+  sub_v3_v3(eye_pose.position, draw_data->eye_position_ofs);
   if ((session_settings->flag & XR_SESSION_USE_POSITION_TRACKING) == 0) {
     sub_v3_v3(eye_pose.position, draw_view->local_pose.position);
   }
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index b44f006cde8..ded8ebada79 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -255,9 +255,9 @@ void wm_xr_session_state_update(const XrSessionSettings *settings,
   copy_v3_v3(viewer_pose.position, draw_data->base_pose.position);
   /* The local pose and the eye pose (which is copied from an earlier local pose) both are view
    * space, so Y-up. In this case we need them in regular Z-up. */
-  viewer_pose.position[0] += draw_data->eye_position_ofs[0];
-  viewer_pose.position[1] -= draw_data->eye_position_ofs[2];
-  viewer_pose.position[2] += draw_data->eye_position_ofs[1];
+  viewer_pose.position[0] -= draw_data->eye_position_ofs[0];
+  viewer_pose.position[1] += draw_data->eye_position_ofs[2];
+  viewer_pose.position[2] -= draw_data->eye_position_ofs[1];
   if (use_position_tracking) {
     viewer_pose.position[0] += draw_view->local_pose.position[0];
     viewer_pose.position[1] -= draw_view->local_pose.position[2];



More information about the Bf-blender-cvs mailing list