Quote from: GarageGothic on Fri 13/05/2005 15:06:46
My main concern would be with clipping - I have no idea how to perform those calculations in AGS nor how to "limit" the drawing action itself.
AGS does the clipping for you, so if you just call RawDrawTriangle it'll automatically clip.
I see you've already started toying so I'm going to assume you're using floats in 2.7 and you've already projected lines into screen space.
You may have a problem with sorting however - drawing the close triangles on top of the far triangles. Is that what you mean by "limiting" the drawing action? There are several ways to approach this.
1) Sort by the average z value of the triangles (you can get that from the screen space projection).
2) A more sophisticated approach would check if all the vertices of triangle A are on the opposite side (relative to the camera) of triangle B, and if so draw A first.
A combination would be to first check if *all* the z values of A are larger than *all* of A's z values, then if not, try (2). If you have intersecting triangles, there's nothing you can do, short of a z buffer.
For the above approaches, you'll want to make a "display list" of triangle indices, then sort that list, then draw the triangles in the list order.
Another approach is to store the polygons in a BSP, like Doom did with its walls. There's loads of source code on the internet. If you can do matrix maths you can easily understand BSPs.
Hmm, since you can't copy structs in one operation and you can't get a pointer to a struct in an array, using AGS for this is going to be difficult...