This cleanup naming convention and code clarity. There
is no functional change.
- `elem_ranges` is changed to a `Map` to avoid relying on
`sel_data->drawn_index`.
- `select_draw_utils.cc` is merged with `select_engine.cc`
- `index_drawn_len` is renamed to `max_index_drawn_len`
- Remove the usage of `DrawData`
Rel #134690
Pull Request: https://projects.blender.org/blender/blender/pulls/134940
The selection engine renders `uint` texture where each element of the
geometry is represented as an index.
When the geometry have modifiers, the original index was used for the
texture.
However this is not necessary for the select engine to work. The real
mesh indexes can be used in the texture and, only at the end, the
original index can be retrieved on the CPU itself.
Advantages of this approach:
- Optimizes the code to generate selection buffers.
- Makes the select id texture more informative as it identifies the
real elements instead of the original ones.
Pull Request: https://projects.blender.org/blender/blender/pulls/119977
This simplifies code using these functions because of RAII,
range based for loops, and the lack of output arguments.
Also pass object pointer array as a span in more cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/117482
The selection engine has some complex tricks that improve performance.
These are:
- Only draws objects whose bounding box intersects the selection
threshold;
- If the viewport or objects are not "dirty", it does not clean the
texture IDs and only adds objects that have not yet been drawn;
- Only updates the depth buffer if a new object is drawn;
- Skip drawing if no object is found;
These tricks were initially implemented so that this engine could be
used for snapping.
But this initial idea has changed and now the engine is only used to
select Vertices, Edges or Faces.
Due to this limited use, these tricks bring no real benefit.
In fact, it's even worse with the Retopology Overlay, as it forces the
Depth buffer to be redrawn.
This commit removes these tricks and only keeps those that indicate
whether the drawing needs to be updated.
Pull Request: https://projects.blender.org/blender/blender/pulls/113308