diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-14 22:33:55 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-14 22:37:18 +0300 |
commit | ee23f0f3fb58ce569947171d8f9dff97ec564c27 (patch) | |
tree | cb36a82fba12510ac6dcb0fb0ec3b460d02e5566 /source/blender/gpu/intern | |
parent | 68589a31ebfb79165f99a979357d237e5413e904 (diff) |
Sculpt: Separate hide status from face sets, use generic attribute
Whether faces are hidden and face sets are orthogonal concepts, but
currently sculpt mode stores them together in the face set array.
This means that if anything is hidden, there must be face sets,
and if there are face sets, we have to keep track of what is hidden.
In other words, it adds a bunch of redundant work and state tracking.
On the user level it's nice that face sets and hiding are consistent,
but we don't need to store them together to accomplish that.
This commit uses the `".hide_poly"` attribute from rB2480b55f216c to
read and change hiding in sculpt mode. Face sets don't need to be
negative anymore, and a bunch of "face set <-> hide status" conversion
can be removed. Plus some other benefits:
- We don't need to allocate either array quite as much.
- The hide status can be read from 1/4 the memory as face sets.
- Updates when entering or exiting sculpt mode can be removed.
- More opportunities for early-outs when nothing is hidden.
- Separating concerns makes sculpt code more obvious.
- It will be easier to convert face sets into a generic int attribute.
Differential Revision: https://developer.blender.org/D15950
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 78f595cbff2..c0527357663 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -406,7 +406,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id, uchar face_set_color[4] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX, UCHAR_MAX}; if (show_face_sets) { - const int fset = abs(sculpt_face_sets[lt->poly]); + const int fset = sculpt_face_sets[lt->poly]; /* Skip for the default color Face Set to render it white. */ if (fset != face_sets_color_default) { BKE_paint_face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color); @@ -766,7 +766,7 @@ void GPU_pbvh_grid_buffers_update(PBVHGPUFormat *vbo_id, if (show_face_sets && subdiv_ccg && sculpt_face_sets) { const int face_index = BKE_subdiv_ccg_grid_to_face_index(subdiv_ccg, grid_index); - const int fset = abs(sculpt_face_sets[face_index]); + const int fset = sculpt_face_sets[face_index]; /* Skip for the default color Face Set to render it white. */ if (fset != face_sets_color_default) { BKE_paint_face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color); |