// for each mesh
for(i=0; i < Header.numMeshes; i++){
MD3Mesh *m = &Meshes;
// allocate space and load in the vertices
fseek(fp, mesh_offset+m->MeshH.vertex_start, SEEK_SET);
m->Vertices = new Vertice[m->MeshH.numVertices * m->MeshH.numMeshFrames];
fread(m->Vertices, sizeof(Vertice), m->MeshH.numMeshFrames*m->MeshH.numVertices, fp);
// Swap Y and Z axis
int j;
for(j=0; j<m->MeshH.numMeshFrames*m->MeshH.numVertices; j++){
short temp = m->Vertices[j].Vec[2];
m->Vertices[j].Vec[2] = -m->Vertices[j].Vec[1];
m->Vertices[j].Vec[1] = temp;
}
}
</pre>
When I run the above code, everything loads fine, except that the upper and head parts are not connected to the lower part, and instead are resting side by side.
<SPAN CLASS=editedby>[edited by - Sfpiano on June 6, 2004 1:51:25 PM]</SPAN>
MD3 model seperates when swapping axes
you need to multiply the other meshes by the tag matrix that their connected to(when rendering), thatl put them in the right spot
edit: its not a matrix on its own, youll need to turn those 3 verticies into a matrix, which can be done pretty easily...
-Dan
[edited by - Ademan555 on June 6, 2004 3:46:36 PM]
edit: its not a matrix on its own, youll need to turn those 3 verticies into a matrix, which can be done pretty easily...
-Dan
[edited by - Ademan555 on June 6, 2004 3:46:36 PM]
Argh, in that code you use "vertice" as the singular of "verticies...." it''s "vertex," man.
And what he''s saying is that you have to load in the matricies from the MD3 and multiply them by the points that are loaded in to form the model.
And what he''s saying is that you have to load in the matricies from the MD3 and multiply them by the points that are loaded in to form the model.
i explained it poorly, but assuming your aware of the special "tag" verticies (which you should be to load the model) there is a special set of 3 verticies that forms a "tag" which defines the orientation and position of the mesh that gets attached there, and to "attach" it, you simply multiply the mesh to be attached, by a matrix created by using the three verticies (a process which can be done with D3DXMatrixLookAtLh() ... though i personally have never done this, i know it can be done and that that is what needs to happen, if yo udidnt follow what i said, say so, ill try again... im a bad teacher...
-Dan
-Dan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement