diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-30 22:23:58 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-30 22:23:58 +0300 |
commit | 142541124976af41f08fb5479886350c2d803710 (patch) | |
tree | 6ee06d11f3179f4d704a20531f91541a4a15094e /source/blender/editors/space_view3d/view3d_utils.c | |
parent | da1b002c8d2f331d97458167746e5974d8556799 (diff) |
Cleanup/Refactor: Unify functions that redraw the depth buffer
Now `ED_view3d_backbuf_depth_validate`, `ED_view3d_draw_depth` and
`ED_view3d_draw_depth_gpencil` are unified in `ED_view3d_depth_override`.
This new function replaces `ED_view3d_autodist_init`.
Also, since `ED_view3d_depth_update` depends on the render context, and
changing the context is a slow operation, that function also was removed,
and the depth buffer cached is now updated inside the new unified drawing
function when the "bool update_cache" parameter is true.
Finally `V3D_INVALID_BACKBUF` flag has been renamed and moved to
`runtime.flag`.
Differential revision: https://developer.blender.org/D10678
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_utils.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index e3acda9bffb..3b4834045f8 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -1024,6 +1024,7 @@ static float view_autodist_depth_margin(ARegion *region, const int mval[2], int /** * Get the world-space 3d location from a screen-space 2d point. + * TODO: Implement #alphaoverride. We don't want to zoom into billboards. * * \param mval: Input screen-space pixel location. * \param mouse_worldloc: Output world-space location. @@ -1034,7 +1035,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, View3D *v3d, const int mval[2], float mouse_worldloc[3], - const bool alphaoverride, + const bool UNUSED(alphaoverride), const float fallback_depth_pt[3]) { float depth_close; @@ -1042,7 +1043,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(depsgraph, region, v3d, alphaoverride); + ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); /* Attempt with low margin's first */ int i = 0; @@ -1067,22 +1068,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, return false; } -void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, int mode) -{ - /* Get Z Depths, needed for perspective, nice for ortho */ - switch (mode) { - case 0: - ED_view3d_draw_depth(depsgraph, region, v3d, true); - break; - case 1: { - Scene *scene = DEG_get_evaluated_scene(depsgraph); - ED_view3d_draw_depth_gpencil(depsgraph, scene, region, v3d); - break; - } - } -} - -/* no 4x4 sampling, run #ED_view3d_autodist_init first */ +/* no 4x4 sampling, run #ED_view3d_depth_override first */ bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], |