[Bf-blender-cvs] [afbb62fecda] soc-2019-openxr: Bring back wm_xr.c for higher level XR functions

Julian Eisel noreply at git.blender.org
Sun Jun 23 18:29:03 CEST 2019


Commit: afbb62fecda14dd7d096cd17876cd82dd68fa9b8
Author: Julian Eisel
Date:   Sun Jun 23 15:42:18 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBafbb62fecda14dd7d096cd17876cd82dd68fa9b8

Bring back wm_xr.c for higher level XR functions

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

M	source/blender/windowmanager/CMakeLists.txt
M	source/blender/windowmanager/intern/wm_draw.c
A	source/blender/windowmanager/intern/wm_xr.c
M	source/blender/windowmanager/wm.h

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

diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 79028a593c6..0669129d55c 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -76,6 +76,7 @@ set(SRC
   intern/wm_uilist_type.c
   intern/wm_utils.c
   intern/wm_window.c
+  intern/wm_xr.c
   gizmo/intern/wm_gizmo.c
   gizmo/intern/wm_gizmo_group.c
   gizmo/intern/wm_gizmo_group_type.c
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index bab16a0d49c..03bd08495f0 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -873,11 +873,8 @@ static void wm_draw_window(bContext *C, wmWindow *win)
 static void wm_draw_non_window_surfaces(wmWindowManager *wm)
 {
 #ifdef WITH_OPENXR
-  if (wm->xr_context && GHOST_XrSessionIsRunning(wm->xr_context)) {
-    GHOST_XrSessionBeginDrawing(wm->xr_context);
-    /* TODO execute drawcall. Something like this? */
-    // ED_XR_view_draw();
-    GHOST_XrSessionEndDrawing(wm->xr_context);
+  if (wm->xr_context) {
+    wm_xr_session_draw(wm->xr_context);
   }
 #else
   UNUSED_VARS(wm);
diff --git a/source/blender/windowmanager/intern/wm_xr.c b/source/blender/windowmanager/intern/wm_xr.c
new file mode 100644
index 00000000000..c9fd9b164c1
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -0,0 +1,33 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup wm
+ */
+
+#include "GHOST_C-api.h"
+
+void wm_xr_session_draw(struct GHOST_XrContext *xr_context)
+{
+  if (!GHOST_XrSessionIsRunning(xr_context)) {
+    return;
+  }
+
+  GHOST_XrSessionBeginDrawing(xr_context);
+  /* TODO execute drawcall. Something like this? */
+  // ED_XR_view_draw();
+  GHOST_XrSessionEndDrawing(xr_context);
+}
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index fa375efb469..326dc035942 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -95,4 +95,7 @@ void wm_stereo3d_set_cancel(bContext *C, wmOperator *op);
 void wm_open_init_load_ui(wmOperator *op, bool use_prefs);
 void wm_open_init_use_scripts(wmOperator *op, bool use_prefs);
 
+/* wm_xr.c */
+void wm_xr_session_draw(struct GHOST_XrContext *xr_context);
+
 #endif /* __WM_H__ */



More information about the Bf-blender-cvs mailing list