Fixup for multi-view single eye viewport issues
authorDalai Felinto <dfelinto@gmail.com>
Wed, 10 May 2017 11:13:55 +0000 (13:13 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 10 May 2017 11:13:55 +0000 (13:13 +0200)
In d2f1f80a6fa I was always calling view3d_main_regio_setup_view with
NULL matrices, which is not always correct.

source/blender/editors/include/ED_view3d.h
source/blender/editors/space_view3d/view3d_draw.c

index 74041de019bd437fc87c80aa6dd848c64566486a..bd0dd72bf7001b4fa4a9ce116b035d092c0a7269 100644 (file)
@@ -356,7 +356,9 @@ void ED_view3d_draw_offscreen(
         float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname,
         struct GPUFX *fx, struct GPUFXSettings *fx_settings,
         struct GPUOffScreen *ofs);
-void ED_view3d_draw_setup_view(struct wmWindow *win, struct Scene *scene, struct ARegion *ar, struct View3D *v3d);
+void ED_view3d_draw_setup_view(
+        struct wmWindow *win, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
+        float viewmat[4][4], float winmat[4][4]);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(
         struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey,
index 05f18a6771f6c2dd649b75abcd52846c79adb26c..cd2a6fe0feb27b092cdad2f65e4732f8ed284768 100644 (file)
@@ -2370,9 +2370,10 @@ float view3d_depth_near(ViewDepths *d)
 void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 {
        short zbuf = v3d->zbuf;
+       RegionView3D *rv3d = ar->regiondata;
 
        /* Setup view matrix. */
-       ED_view3d_draw_setup_view(NULL, scene, ar, v3d);
+       ED_view3d_draw_setup_view(NULL, scene, ar, v3d, rv3d->winmat, rv3d->viewmat);
 
        glClear(GL_DEPTH_BUFFER_BIT);
 
@@ -2483,7 +2484,7 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover
        U.obcenter_dia = 0;
        
        /* Setup view matrix. */
-       ED_view3d_draw_setup_view(NULL, scene, ar, v3d);
+       ED_view3d_draw_setup_view(NULL, scene, ar, v3d, rv3d->viewmat, rv3d->winmat);
        
        glClear(GL_DEPTH_BUFFER_BIT);
        
@@ -3254,7 +3255,7 @@ void ED_view3d_draw_offscreen(
 /**
  * Set the correct matrices
  */
-void ED_view3d_draw_setup_view(wmWindow *win, Scene *scene, ARegion *ar, View3D *v3d)
+void ED_view3d_draw_setup_view(wmWindow *win, Scene *scene, ARegion *ar, View3D *v3d, float viewmat[4][4], float winmat[4][4])
 {
        RegionView3D *rv3d = ar->regiondata;
 
@@ -3263,7 +3264,7 @@ void ED_view3d_draw_setup_view(wmWindow *win, Scene *scene, ARegion *ar, View3D
                view3d_stereo3d_setup(scene, v3d, ar);
        }
        else {
-               view3d_main_region_setup_view(scene, v3d, ar, NULL, NULL);
+               view3d_main_region_setup_view(scene, v3d, ar, viewmat, winmat);
        }
 }
 
@@ -3845,7 +3846,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
        }
 
        /* Setup the view matrix. */
-       ED_view3d_draw_setup_view(CTX_wm_window(C), scene, ar, v3d);
+       ED_view3d_draw_setup_view(CTX_wm_window(C), scene, ar, v3d, NULL, NULL);
 
        rv3d->rflag &= ~RV3D_IS_GAME_ENGINE;
 #ifdef WITH_GAMEENGINE