DRW: optimize mesh data extraction

Change extraction callbacks to take index ranges instead of calling them
for each mesh element (poly, loop, vert & edge).

This gives a minor overall performance gain in my tests, ~5% on average.

Details:

- Use typed parameter structs and macros for looping over elements.
  Without this, changes to these callbacks is time consuming as changes
  need to be made in many places.
- Avoid iterating over polygon-loops when iterating over polygons
  is sufficient.
- Simplify logic to access adjacent loops for faster line extraction.
- Rename 'loop' iterators to 'poly' (as they take polygon ranges)
  the iterator callbacks can operator on either polygon or loop data.
- Use term 'last' for the last index (inclusive),
  use 'end' when this value (not inclusive).
This commit is contained in:
Campbell Barton 2020-07-01 00:13:39 +10:00
parent 36d6aa428f
commit d885b1141c
2 changed files with 1659 additions and 1108 deletions

View File

@ -63,7 +63,7 @@ typedef struct DRW_MeshCDMask {
typedef enum eMRIterType {
MR_ITER_LOOPTRI = 1 << 0,
MR_ITER_LOOP = 1 << 1,
MR_ITER_POLY = 1 << 1,
MR_ITER_LEDGE = 1 << 2,
MR_ITER_LVERT = 1 << 3,
} eMRIterType;

File diff suppressed because it is too large Load Diff