Manipulator: draw 2d manipulators over view border

Needed so passepartout doesn't cover 2d manipulators.
This commit is contained in:
Campbell Barton 2017-12-16 18:55:42 +11:00
parent d855fc4dad
commit 625d72ed48
4 changed files with 28 additions and 36 deletions

View File

@ -3456,10 +3456,14 @@ void DRW_draw_render_loop_ex(
if (DST.draw_ctx.evil_C) {
/* needed so manipulator isn't obscured */
glDisable(GL_DEPTH_TEST);
DRW_draw_manipulator();
glEnable(GL_DEPTH_TEST);
DRW_draw_manipulator_3d();
DRW_draw_region_info();
/* Draw 2D after region info so we can draw on top of the camera passepartout overlay.
* 'DRW_draw_region_info' sets the projection in pixel-space. */
DRW_draw_manipulator_2d();
glEnable(GL_DEPTH_TEST);
}
DRW_stats_reset();

View File

@ -715,16 +715,13 @@ void DRW_draw_cursor(void)
/* **************************** 3D Manipulator ******************************** */
void DRW_draw_manipulator(void)
void DRW_draw_manipulator_3d(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
v3d->zbuf = false;
ARegion *ar = draw_ctx->ar;
/* TODO, only draws 3D manipulators right now, need to see how 2D drawing will work in new viewport */
/* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */
/* TODO depth culling manipulators is not yet supported, just drawing _3D here, should
* later become _IN_SCENE (and draw _3D separate) */
@ -732,25 +729,18 @@ void DRW_draw_manipulator(void)
ar->manipulator_map, draw_ctx->evil_C,
WM_MANIPULATORMAP_DRAWSTEP_3D);
/* We may want to split this into a separate pass.
* or maintain a stage in the draw manager where all pixel-space drawing happens. */
{
float original_proj[4][4];
gpuGetProjectionMatrix(original_proj);
wmOrtho2_region_pixelspace(ar);
gpuPushMatrix();
gpuLoadIdentity();
glDepthMask(GL_FALSE);
WM_manipulatormap_draw(
ar->manipulator_map, draw_ctx->evil_C,
WM_MANIPULATORMAP_DRAWSTEP_2D);
glDepthMask(GL_TRUE);
gpuPopMatrix();
gpuLoadProjectionMatrix(original_proj);
}
}
void DRW_draw_manipulator_2d(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
v3d->zbuf = false;
ARegion *ar = draw_ctx->ar;
WM_manipulatormap_draw(
ar->manipulator_map, draw_ctx->evil_C,
WM_MANIPULATORMAP_DRAWSTEP_2D);
glDepthMask(GL_TRUE);
}

View File

@ -30,6 +30,7 @@ void DRW_draw_grid(void);
void DRW_draw_region_info(void);
void DRW_draw_background(void);
void DRW_draw_cursor(void);
void DRW_draw_manipulator(void);
void DRW_draw_manipulator_3d(void);
void DRW_draw_manipulator_2d(void);
#endif /* __DRAW_VIEW_H__ */
#endif /* __DRAW_VIEW_H__ */

View File

@ -2007,11 +2007,6 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
/* main drawing call */
view3d_draw_objects(C, &eval_ctx, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL);
/* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */
/* TODO depth culling manipulators is not yet supported, just drawing _3D here, should
* later become _IN_SCENE (and draw _3D separate) */
WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_3D);
/* post process */
if (do_compositing) {
GPU_fx_do_composite_pass(rv3d->compositor, rv3d->winmat, rv3d->is_persp, scene, NULL);
@ -2141,12 +2136,14 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar)
VP_legacy_view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, NULL, NULL);
glClear(GL_DEPTH_BUFFER_BIT);
WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_3D);
ED_region_pixelspace(ar);
WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_2D);
view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border);
WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_2D);
gpuPopProjectionMatrix();
gpuPopMatrix();