I am implementing the marching cubes algorithm and I need to have a way to make sure the vertices are put into the triangle array in either a clockwise or counterclockwise order (as long as it is consistent for each triangle). I need this for lighting when the triangles are constructed. How would I do this? Is there a function that I can use (or make) that is given 3 vertices that have an x,y, and z component that makes sure they are in counter clockwise or clock wise order?
I saw something similar here:
Projects > Marching Cubes
but I didn't really understand it and it's in C++ (I'm just using C)
Thanks!
If more information is needed or something is unclear let me know.