Page 1 of 1

Indices and vertices

Posted: Fri Mar 12, 2010 3:53 am
by kjkrum
I'm a total noob to 3D graphics, and studying the code of CGeometryCreator and CMeshBuffer. Am I correct that index arrays (e.g., line 24 of CGeometryCreator.cpp) determine which vertices are joined into polys? Does their order determine the facing of the poly, or is that determined by the direction of the vertices? (For that matter, are vertices points or vectors? My understanding so far is that they're vectors.)

Posted: Fri Mar 12, 2010 4:05 am
by Lonesome Ducky
Yes, indices decide what vertices in an array make triangles. And yes, order of indices determines the facing.

Posted: Fri Mar 12, 2010 4:22 am
by kjkrum
Thanks. So, looking at the textured face, do the vertices go clockwise or anticlockwise?

Posted: Fri Mar 12, 2010 8:30 am
by hybrid
Irrlicht uses clockwise front-facing. Also, vertices are points, not directions. But since they are given in object coordinate system, they are relative to the local (0,0,0), and hence there's no difference here.

Posted: Fri Mar 12, 2010 9:47 am
by arras
hybrid wrote:Irrlicht uses clockwise front-facing.
Are you sure on that? I am building my faces counterclockwise so far and it's working. That is if I assume front is positive axis facing.

Posted: Fri Mar 12, 2010 1:29 pm
by Acki
arras wrote:
hybrid wrote:Irrlicht uses clockwise front-facing.
Are you sure on that? I am building my faces counterclockwise so far and it's working. That is if I assume front is positive axis facing.
I can confirm this, I recognised this at work for IrrOpenSteer...
when I created the vehicle mesh (circle with arrow) I first created the arrow shape counter clockwise and I was wandering why no face was seen until I found out that I had to create them clockwise... :shock:

Posted: Sat Mar 13, 2010 9:46 am
by arras
Right. Made some tests, it's clockwise. I had false impression that it's counter cw since I always faced "front", that is along Z axis while setting vertices/indices but looked opposite to see face. So I was building it clockwise in fact.