diff options
author | Jeroen Bakker <jeroen@blender.org> | 2019-12-10 17:18:16 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2019-12-11 18:58:14 +0300 |
commit | 7878adf49cfff6ccbb18203f21c6355a518b34db (patch) | |
tree | 8f54eacad26647c6bd6db0b665ea4ff8063ab2ec /source/blender/draw/intern/draw_manager.c | |
parent | 61e0e936441828c148b701c9a942d2ab6d9fe3a9 (diff) |
DrawManager: Disable Clipping in material/rendered mode
Viewport: Disable Clipping For EEVEE and External Renderers
Currently it is possible that, when using viewport clipping, the display and tools communicate
different information to the user then the renderer does. The reason is
that the renderer does not support viewport clipping. Both EEVEE and
Cycles do not support it.
This patch will disable the clipping in all the tools and drawing code
when the viewport drawing mode is `Material Preview` or `Rendered`.
This patch introduces a `RV3D_CLIPPING_ENABLED` util that checks if
clipping is enabled for the given `rv3d` and `v3d`. Also in places where
it was needed we added the `ViewContext` as a carrier for the `View3D`
and `RegionView3D`.
There are a few areas in the tooling (select, projection painting) that
still needs to be tackled after this patch.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6047
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 4bfae75848b..5832db31c4e 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -584,7 +584,7 @@ static void drw_context_state_init(void) } DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT; - if (DST.draw_ctx.rv3d && DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(DST.draw_ctx.v3d, DST.draw_ctx.rv3d)) { DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED; } } @@ -1235,7 +1235,7 @@ static void drw_engines_draw_text(void) PROFILE_START(stime); if (data->text_draw_cache) { - DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar); + DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d); } PROFILE_END_UPDATE(data->render_time, stime); @@ -2571,7 +2571,7 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_ /** * Clears the Depth Buffer and draws only the specified object. */ -void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object) +void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object) { RegionView3D *rv3d = ar->regiondata; @@ -2588,7 +2588,7 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object) GPU_depth_test(true); const float(*world_clip_planes)[4] = NULL; - if (rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { ED_view3d_clipping_set(rv3d); ED_view3d_clipping_local(rv3d, object->obmat); world_clip_planes = rv3d->clip_local; @@ -2625,7 +2625,7 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object) break; } - if (rv3d->rflag & RV3D_CLIPPING) { + if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { ED_view3d_clipping_disable(); } |