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`.
This commit is contained in:
2022-10-07 13:13:23 +02:00
parent 6fd557e2c2
commit bae22ac7b4
5 changed files with 5 additions and 18 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -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

View File

@@ -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