diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-10-07 14:13:23 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-10-07 14:13:23 +0300 |
commit | bae22ac7b48062b94e9061e6bf1a7a756e919ed3 (patch) | |
tree | 8a3b3a6c9c0288cb206b3ebabaaaeebfde04d942 /source | |
parent | 6fd557e2c289bd37e46f855c4ec5b96ec8c30291 (diff) |
DRW: Remove mouse_pixel and is_inverted from ViewInfos
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
`mouse_pixel` is only use for debug purpose and will be reintroduced later.
`is_inverted` is moved to `draw::View`.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager_data.cc | 7 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_shader_shared.h | 8 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view.cc | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view.hh | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/shaders/common_view_lib.glsl | 3 |
5 files changed, 5 insertions, 18 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc index 42c574dd4d5..1c8d38ba162 100644 --- a/source/blender/draw/intern/draw_manager_data.cc +++ b/source/blender/draw/intern/draw_manager_data.cc @@ -2176,13 +2176,6 @@ DRWView *DRW_view_create(const float viewmat[4][4], view->visibility_fn = visibility_fn; view->parent = nullptr; - if (DST.draw_ctx.evil_C && DST.draw_ctx.region) { - int region_origin[2] = {DST.draw_ctx.region->winrct.xmin, DST.draw_ctx.region->winrct.ymin}; - wmWindow *win = CTX_wm_window(DST.draw_ctx.evil_C); - wm_cursor_position_get(win, &view->storage.mouse_pixel[0], &view->storage.mouse_pixel[1]); - sub_v2_v2v2_int(view->storage.mouse_pixel, view->storage.mouse_pixel, region_origin); - } - DRW_view_update(view, viewmat, winmat, culling_viewmat, culling_winmat); return view; diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h index 3d41cbc8511..bf055daea3d 100644 --- a/source/blender/draw/intern/draw_shader_shared.h +++ b/source/blender/draw/intern/draw_shader_shared.h @@ -66,14 +66,6 @@ struct ViewInfos { float4x4 viewinv; float4x4 winmat; float4x4 wininv; - - /** For debugging purpose */ - /* Mouse pixel. */ - int2 mouse_pixel; - - /** True if facing needs to be inverted. */ - bool1 is_inverted; - int _pad0; }; BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16) diff --git a/source/blender/draw/intern/draw_view.cc b/source/blender/draw/intern/draw_view.cc index 89a8826e628..13b03e5a945 100644 --- a/source/blender/draw/intern/draw_view.cc +++ b/source/blender/draw/intern/draw_view.cc @@ -22,7 +22,7 @@ void View::sync(const float4x4 &view_mat, const float4x4 &win_mat) data_.winmat = win_mat; data_.wininv = win_mat.inverted(); - data_.is_inverted = (is_negative_m4(view_mat.ptr()) == is_negative_m4(win_mat.ptr())); + is_inverted_ = (is_negative_m4(view_mat.ptr()) == is_negative_m4(win_mat.ptr())); BoundBox &bound_box = *reinterpret_cast<BoundBox *>(&culling_.corners); BoundSphere &bound_sphere = *reinterpret_cast<BoundSphere *>(&culling_.bound_sphere); diff --git a/source/blender/draw/intern/draw_view.hh b/source/blender/draw/intern/draw_view.hh index aef8b5865be..d31cfec679e 100644 --- a/source/blender/draw/intern/draw_view.hh +++ b/source/blender/draw/intern/draw_view.hh @@ -35,6 +35,7 @@ class View { const char *debug_name_; + bool is_inverted_ = false; bool do_visibility_ = true; bool dirty_ = true; bool frozen_ = false; @@ -59,7 +60,7 @@ class View { bool is_inverted() const { - return data_.is_inverted; + return is_inverted_; } float far_clip() const diff --git a/source/blender/draw/intern/shaders/common_view_lib.glsl b/source/blender/draw/intern/shaders/common_view_lib.glsl index eafa36c4351..90c1e0490b8 100644 --- a/source/blender/draw/intern/shaders/common_view_lib.glsl +++ b/source/blender/draw/intern/shaders/common_view_lib.glsl @@ -25,7 +25,8 @@ layout(std140) uniform viewBlock # endif #endif -#define IS_DEBUG_MOUSE_FRAGMENT (ivec2(gl_FragCoord) == drw_view.mouse_pixel) +/* Not supported anymore. TODO(fclem): Add back support. */ +// #define IS_DEBUG_MOUSE_FRAGMENT (ivec2(gl_FragCoord) == drw_view.mouse_pixel) #define IS_FIRST_INVOCATION (gl_GlobalInvocationID == uvec3(0)) #define cameraForward ViewMatrixInverse[2].xyz |