[Bf-blender-cvs] [3d7ca99c892] HMD_viewport: Disable zooming/pannig of HMD view while in camera perspective

Julian Eisel noreply at git.blender.org
Wed Mar 29 20:42:08 CEST 2017


Commit: 3d7ca99c892d757b7f1246be1f548219bf09a098
Author: Julian Eisel
Date:   Sun Mar 26 01:47:21 2017 +0100
Branches: HMD_viewport
https://developer.blender.org/rB3d7ca99c892d757b7f1246be1f548219bf09a098

Disable zooming/pannig of HMD view while in camera perspective

Applying zoom to projection matrix wouldn't be correct, applying it to
the view matrix would work, but not easy to do it nicely. We'd also
still miss vertical/horizontal offset since it's realized using lens
shifting (= modifiying projection matrix), so that had to be applyied
onto view matrix as well.
Decided to just disallow paning and zooming completely for now, I don't
think it would make much sense in camera perspective.

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

M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 015380c5d8d..3472f5b2fd7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3718,7 +3718,7 @@ static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d,
 
 #ifdef WITH_INPUT_HMD
 
-static bool view3d_hmd_view_active(wmWindowManager *wm, wmWindow *win)
+static bool view3d_is_hmd_view(wmWindowManager *wm, wmWindow *win)
 {
 	return ((wm->hmd_view.hmd_win == win) && (wm->hmd_view.hmd_win->screen->is_hmd_running));
 }
@@ -3756,11 +3756,6 @@ static void view3d_hmd_view_calc_matrices_from_device(const View3D *v3d, const R
 	}
 	/* apply IPD offset */
 	add_v3_v3(r_modelviewmat[3], hmd_modelviewmat[3]);
-
-	if (rv3d->persp == RV3D_CAMOB) {
-		/* projection matrix contains camera zoom and camera view shift, needs to be applied */
-		add_m4_m4m4(r_projectionmat, r_projectionmat, (float (*)[4])rv3d->winmat);
-	}
 }
 
 static void view3d_hmd_view_get_matrices(
@@ -3946,7 +3941,7 @@ static void view3d_main_region_draw_objects(
 
 	/* setup the view matrix */
 #ifdef WITH_INPUT_HMD
-	if (view3d_hmd_view_active(wm, win)) {
+	if (view3d_is_hmd_view(wm, win)) {
 		view3d_hmd_view_setup(scene, v3d, ar);
 	}
 	else if (wm->hmd_view.hmd_win &&
@@ -4066,8 +4061,8 @@ static bool is_cursor_visible(Scene *scene)
 }
 
 static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
-                                       ARegion *ar, View3D *v3d,
-                                       const char *grid_unit, bool render_border)
+                                         ARegion *ar, View3D *v3d,
+                                         const char *grid_unit, bool render_border)
 {
 	wmWindowManager *wm = CTX_wm_manager(C);
 	RegionView3D *rv3d = ar->regiondata;
@@ -4077,7 +4072,13 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
 	ED_region_visible_rect(ar, &rect);
 
 	if (rv3d->persp == RV3D_CAMOB) {
-		drawviewborder(scene, ar, v3d);
+#ifdef WITH_INPUT_HMD
+		if (!view3d_is_hmd_view(wm, CTX_wm_window(C))) {
+#else
+		{
+#endif
+			drawviewborder(scene, ar, v3d);
+		}
 	}
 	else if (v3d->flag2 & V3D_RENDER_BORDER) {
 		glLineWidth(1.0f);




More information about the Bf-blender-cvs mailing list