# Re: GSoC-2011: Implement Missing Mesh Functions in Wine’s D3DX9

Michael Mc Donnell michael at mcdonnell.dk
Thu Jun 23 04:07:49 CDT 2011

On Thu, Jun 23, 2011 at 3:30 AM, Dylan Smith <dylan.ah.smith at gmail.com> wrote:
> On Wed, Jun 22, 2011 at 4:08 PM, Stefan Dösinger <stefandoesinger at 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):

> 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]
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]