[Bf-blender-cvs] [9c1f140a473] master: Fix pose offset on VR session start for some OpenXR runtimes

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


Commit: 9c1f140a4735712de47a8b207fd8b3f007a0464a
Author: Julian Eisel
Date:   Mon Aug 10 13:47:00 2020 +0200
Branches: master
https://developer.blender.org/rB9c1f140a4735712de47a8b207fd8b3f007a0464a

Fix pose offset on VR session start for some OpenXR runtimes

We want the session to start exactly at the landmark position, with
no additional offset. Some runtimes (e.g. Windows Mixed Reality) may
give an initial non-[0,0,0] position at session start though.

Also add a comment explaining the purpose of the eye offset variable.

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

M	source/blender/windowmanager/xr/intern/wm_xr_intern.h
M	source/blender/windowmanager/xr/intern/wm_xr_session.c

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

diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
index 9b7b81f769a..c49e9e534b6 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h
+++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
@@ -70,6 +70,8 @@ typedef struct wmXrDrawData {
    * space). With positional tracking enabled, it should be the same as the base pose, when
    * disabled it also contains a location delta from the moment the option was toggled. */
   GHOST_XrPose base_pose;
+  /** Offset to _substract_ from the OpenXR eye and viewer pose to get the wanted effective pose
+   * (e.g. a pose exactly at the landmark position). */
   float eye_position_ofs[3]; /* Local/view space. */
 } wmXrDrawData;
 
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index ded8ebada79..f2dd8417a74 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -207,8 +207,9 @@ void wm_xr_session_draw_data_update(const wmXrSessionState *state,
 
   switch (event) {
     case SESSION_STATE_EVENT_START:
-      /* Always use the exact base pose with no offset when starting the session. */
-      copy_v3_fl(draw_data->eye_position_ofs, 0.0f);
+      /* We want to start the session exactly at landmark position. Runtimes may have a non-[0,0,0]
+       * starting position that we have to substract for that. */
+      copy_v3_v3(draw_data->eye_position_ofs, draw_view->local_pose.position);
       break;
       /* This should be triggered by the VR add-on if a landmark changes. */
     case SESSION_STATE_EVENT_RESET_TO_BASE_POSE:



More information about the Bf-blender-cvs mailing list