diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-19 21:36:12 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-19 21:36:48 +0300 |
commit | f972a3c31458a7048a6ffb3e26f7d802e3433934 (patch) | |
tree | bb617cbb91a90d4d874d1662e2c63eed1e47d51b /source/blender/draw/intern/draw_manager_data.c | |
parent | bda8076d354ce9ce587d315bff4a089094af5847 (diff) |
DRW: Support inverted view matrix
We detect the case where we need to invert the facing directly inside the
DRWView update and do the appropriate GL calls at draw time.
Fix T63047 Camera with negative scale works only in Cycles Rendered view
Fix T71352 Negative scale camera causes BLI_assert
Diffstat (limited to 'source/blender/draw/intern/draw_manager_data.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager_data.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 0af68181478..fbdabb44b15 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -1551,13 +1551,6 @@ static void draw_view_matrix_state_update(DRWViewUboStorage *storage, const float viewmat[4][4], const float winmat[4][4]) { - /* If only one the matrices is negative, then the - * polygon winding changes and we don't want that. - * By convention, the winmat is negative because - * looking through the -Z axis. So this inverse the - * changes the test for the winmat. */ - BLI_assert(is_negative_m4(viewmat) == !is_negative_m4(winmat)); - copy_m4_m4(storage->viewmat, viewmat); invert_m4_m4(storage->viewinv, storage->viewmat); @@ -1629,6 +1622,7 @@ void DRW_view_update_sub(DRWView *view, const float viewmat[4][4], const float w BLI_assert(view->parent != NULL); view->is_dirty = true; + view->is_inverted = (is_negative_m4(viewmat) == is_negative_m4(winmat)); draw_view_matrix_state_update(&view->storage, viewmat, winmat); } @@ -1646,6 +1640,7 @@ void DRW_view_update(DRWView *view, BLI_assert(view->parent == NULL); view->is_dirty = true; + view->is_inverted = (is_negative_m4(viewmat) == is_negative_m4(winmat)); draw_view_matrix_state_update(&view->storage, viewmat, winmat); |