Archived

This topic is now archived and is closed to further replies.

more MD2 questions

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It seems as if I''m only able to load a single frame from the file. Are there triangle indices for each frame? I''m not sure how this works since there''s only an offset to the triangle list and then number of triangles. It seems to me that there is only 1 list of triangle indices. I found this code used to load them:
  

triangleIndices = &buffer[offsetTriangles];
for(j=0;j<numFrames;j++)
{
for(i=0;i<numTriangles;i++)
{
 triangle[i].vertexIndices[0] = triangleIndices[i].vertexIndices[0];
...
}
}
  
What I don''t get is why loop through the frames? If this code is correct, then wouldn''t the triangle array get overwritten each time and only end up with the values in the last loop? Is there a list of triangle indices for each frame?

Share this post


Link to post
Share on other sites
Your code is a bit sketchy, but from what I remember of MD2 you should have:

[a number of frames, each of which contain ...]
[a number of vertices. Each frame has the same number of vertices]
[a number of indices which come in multiples of three (triangles)]

so you have SEVERAL frames, each of which has the same number of vertices - but usually in different positions.

You have ONE group of indices, which you can use for any frame since they index the same vertices in each frame.

Kinda make sense?

Share this post


Link to post
Share on other sites