This is a port of sculpt-dev's SculptVertRef refactor
to master. SculptVertRef is a structure that abstracts
the concept of a vertex in the sculpt code; it's simply
an intptr_t wrapped in a struct.
For PBVH_FACES and PBVH_GRIDS this struct stores a
vertex index, but for BMesh it stores a direct pointer
to a BMVert. The intptr_t is wrapped in a struct to prevent
the accidental usage of it as an index.
There are many reasons to do this:
- Right now BMesh verts are not logical sculpt verts; to use the sculpt API they must first be converted to indices. This requires a lot of indirect lookups into tables, leading to performance loss. It has also led to greater code complexity and duplication.
- Having an abstract vertex type makes it feasible to have one unified temporary attribute API for all three PBVH modes, which in turn made it rather trivial to port sculpt brushes to DynTopo in sculpt-dev (e.g. the layer brush, draw sharp, the smooth brushes, the paint brushes, etc). This attribute API will be in a future patch.
- We need to do this anyway for the eventual move to C++.