PDA

View Full Version : Reversing the winding order of a tri-strip


Goz
09-02-2005, 02:54 AM
I need to reverse the winding order of an arbitrary length tri-strip. Is there an elegant way to do this?

I though, initially, that i might be able to do it by swapping the 2nd and 3rd vertex indices over but this, unfortunately, breaks the triangle AFTER the next one.

So i considered reversing the tri-strip but this only works for an odd number of triangles ...

Is there an actual way of doing it? Or is it not possible?

Note: I am NOT using DirectX or OpenGL ... degenerates are NOT supported so please don't suggest that. I want to take an arbitrary strip with verts v1, v2, v3 ... vn and reverse its winding order without adding any extra vertices. Is it possible?

Wernaeh
09-02-2005, 06:15 AM
For even-numbered triangle strips, I think inverting each second "interior" edge would work, that is, for 2 connected triangles, invert the edge that connects them.

I'm still thinking about non-even triangle strips, though.

Hope this helps,

Cheers,
- Wernaeh

Goz
09-02-2005, 07:17 AM
For even-numbered triangle strips, I think inverting each second "interior" edge would work, that is, for 2 connected triangles, invert the edge that connects them.

How does this work? You add one extra vertex per triangle (after the first full 3 verts on the 1st tri) so how can you possibly invert the direction of an edge?

I have no control of the rasteriser im using ... i need to be able to do it from indices only...

I'm still thinking about non-even triangle strips, though.

Could always just reverse the strip for them ;)

Reedbeta
09-02-2005, 12:06 PM
I believe all that's necessary in either case is to swap pairs. E.g. swap indices 0 and 1, 2 and 3, 4 and 5, etc...

0 2 4 1 3 5
| /| /| --> |\ |\ |
|/ |/ | | \| \|
1 3 5 0 2 4