Maybe this function should be more "intelligent" than juste reversing lists.
if the Mode of TFGVertexIndexList (TFGIndexTexCoordList's parent) is fgmmTriangleFan, this Reverse function is not correct if the goal is to see the mesh from the other side.
In this mode, the first vertex is common to all triangles. If the list is just reversed, this vertex is swapped with the last one, which becomes the common one.
I think the Reverse function should contain a piece of code like this :
VertexIndices.Reverse;// <- existing codeif(Self.Mode=fgmmTriangleFan)and(VertexIndices.Count>0)thenVertexIndices.Move(VertexIndices.Count-1,0);//Put the first vertex back to its place
and so on for the TexCoords in TFGIndexTexCoordList
All is in the title !
The vertices indexes are reversed, but the texcoords are not.
Here's a patch to fix it
Maybe this function should be more "intelligent" than juste reversing lists.
if the Mode of TFGVertexIndexList (TFGIndexTexCoordList's parent) is fgmmTriangleFan, this Reverse function is not correct if the goal is to see the mesh from the other side.
In this mode, the first vertex is common to all triangles. If the list is just reversed, this vertex is swapped with the last one, which becomes the common one.
I think the Reverse function should contain a piece of code like this :
and so on for the TexCoords in TFGIndexTexCoordList
PS: This change will not work until the Move function bug is fixed
Last edit: Alexandre Guilleme 2014-05-07
The reverse function doesn't work anymore in fgmmTriangleStrip with an even number of vertices (the normal keeps the same direction).
Here is a new version of the patch (also in attachment)
Last edit: Alexandre Guilleme 2014-05-19