On Thu, Jun 23, 2011 at 3:30 AM, Dylan Smith dylan.ah.smith@gmail.com wrote:
On Wed, Jun 22, 2011 at 4:08 PM, Stefan Dösinger stefandoesinger@gmx.at wrote:
I'll have to do some more background reading on the kind of mesh data structures used here before I can give qualified comments on your patches, so for now I'll yield to Dylan :-)
I couldn't actually find information on point representative data (aka PointReps), but a quick search found others wondering what it is.
I used chapter 19 of "The Direct3D Graphics Pipeline" by Richard Thomson (his draft book): http://www.xmission.com/~legalize/book/download/19-D3DX%20Mesh%20Objects.pdf
Basically it is an array of vertex indices, one for each vertex, each with either its own index or the index of an co-located vertex. e.g. If you have triangles ABC and DEF (as shown below), with two sets of points co-located, and the vertex buffer stored in alphabetical order. Then the point_reps array would be [0, 1, 2, 2, 1, 5] to indicate that vertices B & C can replace E & D respectively.
A---(B/E) | / | | / | (C/D)--F
Yes that's the basics of it. It does some other funny things too. For example it re-orders the indices, so if you have
0--1 6 3 | / / | | \ | / / | | \ 2 8--7 5--4
That corresponds to:
index buffer = [ 0,1, 2, 6, 7,8, 3, 4,5] adjacency = [-1,1,-1, 2,-1,0, -1,-1,1] point rep = [ 0,1, 2, 1, 4,7, 1, 7,2]
If the indices had not been re-ordered then the point representation would have been [0,1,2, 1,7,2, 1,4,7].
Here is an example that shows how it expands collapsed triangles:
0--1 3 | / / | | / / | 2 4--5
If the triangle 3-4-5 is collapsed by repeating it's first vertex in the index buffer, then it will not be adjacent to 0-1-2:
index buffer = [ 0, 1, 2, 3, 3, 3] adjacency = [-1,-1,-1, -1,-1,-1] point rep = [ 0,1, 2, 3, 4,5]
The vertices of 3-4-5 are included anyway in the point representation, even though they do not form a real triangle.
All these things are tested in mesh6, but I can see now that they probably should be split up into separate test cases.