Jump to content
  • Advertisement

Archived

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

Sfpiano

MD3 model seperates when swapping axes

This topic is 5222 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

// for each mesh
	for(i=0; i < Header.numMeshes; i++){
		MD3Mesh *m = &Meshes[ i ];

		// 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; jMeshH.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;
		}
	}
  
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. [edited by - Sfpiano on June 6, 2004 1:51:25 PM]

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!