Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-17 13:37:20 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-17 13:37:20 +0300
commit2c1b0536c9e89eb401c422bed78edd3c35fb8b01 (patch)
tree4dc50d24efb8995ab6014ae7f7b3daa81a9bba5f
parentcdc1dab073a3fd344ff3ca4a2abdcdecbf5e965e (diff)
Fix T43697, grid drawing over wires and grease pencil. Props to Julian
for figuring out a simple solution to that :)
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index ba031c83e3e..f552d5ca3db 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2656,8 +2656,6 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view
}
}
-
-
/**
* Shared by #ED_view3d_draw_offscreen and #view3d_main_area_draw_objects
*
@@ -2673,8 +2671,10 @@ static void view3d_draw_objects(
RegionView3D *rv3d = ar->regiondata;
Base *base;
const bool do_camera_frame = !draw_offscreen;
- const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO);
const bool draw_grids = !draw_offscreen && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0;
+ const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO);
+ /* only draw grids after in solid modes, else it hovers over mesh wires */
+ const bool draw_grids_after = draw_grids && draw_floor && (v3d->drawtype > OB_WIRE);
bool xrayclear = true;
if (!draw_offscreen) {
@@ -2722,6 +2722,9 @@ static void view3d_draw_objects(
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(rv3d->viewmat);
}
+ else {
+ drawfloor(scene, v3d, grid_unit);
+ }
}
/* important to do before clipping */
@@ -2796,6 +2799,11 @@ static void view3d_draw_objects(
}
}
+ /* perspective floor goes last to use scene depth and avoid writing to depth buffer */
+ if (draw_grids_after) {
+ drawfloor(scene, v3d, grid_unit);
+ }
+
/* must be before xray draw which clears the depth buffer */
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
/* must be before xray draw which clears the depth buffer */
@@ -2804,11 +2812,6 @@ static void view3d_draw_objects(
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
- /* perspective floor goes last to use scene depth and avoid writing to depth buffer */
- if (draw_grids && draw_floor) {
- drawfloor(scene, v3d, grid_unit);
- }
-
/* transp and X-ray afterdraw stuff */
if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, &xrayclear);