polymonkey
Full Member
Offline
Posts: 137
Australia
Re: Saito OBJ loader: how to determine where lines
Reply #3 - Mar 1st , 2009, 1:52am
hmm, so what your after is to get the triangulation of the mesh? so that you know that vertex a, b and c make a triangle, and then c,b,d make another triangle. So the line class knows that ab, bc, ca, cd, bd are lines? If that's the case then the getting that through the obj loader could be a little tricky. The ojb loader stores a list of vert positions and vert normals and then there are a collection of modelsegments that store model elements. These elements are the triangles of the mesh. They are basicly indexes to the lists of vert positions and normals. So for what you're after you might be going about it the hard way. HOWEVER, there are some undocumented functions that you could use (I think). try this int segmentCount = model.getSegmentCount(); //use a number between 0 and segmentCount int elementCount = model.getIndexCountInSegment(segment); int[] vertIndexes = model.getVertIndexArrayInSegment(segment, element); ok now vertIndexes *should* be an array of indexes to the original verts that you already have. And they should when taken in pairs give you the connection information between verts. This is untested, and the above functions are part of the overhaul to the objloader that I'm in the middle of. Pretty sure that those functions are available in the latest version up on google code. This week, work permitting I'm trying to get some time to update the loading code and a few extra bits, let me know if this works or not, I might be able to help out later in the week.