This is my prototype for the new texture paint mode.
Notes:
- It uses an extremely crude rasterizer (it iterates over a triangle's bounding box and calculates barycentric coordinates).
- Texels are rasterized into PBVH nodes. Each texel is associated with a 3D coordinate, a 64-bit integer pixel key and a u,v pair. We could probably get rid of the u,v pair since the pixel key actually encodes the x/y coordinates, but I've not tried this yet.
- After rasterization PBVH leaf nodes are further split into special "texture" leaf nodes (which have their own PBVH node flag, PBVH_TexLeaf).
- There is a C++ UV mesh BREP in the patch, though I ended up not using it.
We need to decide how to merge the various development efforts. I'm not particularly wedded to any of my code here except perhaps for the UV mesh BREP. Splitting the PBVH turned out to be fairly simple; I can simply code it again if necessary.
I think I've figured out how to do neighbor iterators (I wrote a little JS prototype here), though I'm thinking of waiting until we're a bit further along before attempting to code it in Blender.