Triangulate Them Polygons!

Blitz3D Forums/Blitz3D Programming/Triangulate Them Polygons!

My method might not be the best, but here is how I do it.
First I build a list of all unique edges in the mesh.
Every edge belong to two triangles so for every edge I store the index to these two triangles.

Then, in the mainloop I iterate through each edge and do a backfacecull of the two triangles. If one triangle is hidden and one is visible I got myself an outline edge.
To make sure that the edge is clockwise aligned, I simply perform a trianglearea calculation using the two vertices of the edge and the midpoint of the mesh.
Since the outline is a 2D-shape I do the triangleareacheck in 2D, that is, the vertexpositions and midpoint is projected to screencoordinates before doing the calculation.
If the trianglearea is negative I flip the vertices(or rather the variables that holds the vertexindices)
Finally, I create the planes using every edge and the cameraposition.
I just got it working last night, but was to tired to test if this really gives me a speedboost.(Can't wait to get home)...

By the way, the meshes I use for occluding must be convex, solid and have shared vertices.
It can have "unshared" vertices if I rewrite the code that build a list of edges.(Maybe later)

Tonight I will clean up the code(quiet a mess right now) and try to optimize the code(At least I will try) and then I will post the code.