Jump to content
  • Advertisement
Sign in to follow this  
ChristophR

3DS-Loader for DirectX

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

Hi! I have written a 3DS file loader. If a file contains only one mesh it works fine. But if a file contains more meshed, they get split up into many pieces. Before I implemented the loading function for the local coordinate system it worked fine. Therefore I am sure that the problem has to do with the local coordinate system. I load this matrix in the following order:
			localCoordinateSystem.a11 = fis->readFloat32();
			localCoordinateSystem.a21 = fis->readFloat32();
			localCoordinateSystem.a31 = fis->readFloat32();
			localCoordinateSystem.a41 = 0.0f;
			localCoordinateSystem.a12 = fis->readFloat32();
			localCoordinateSystem.a22 = fis->readFloat32();
			localCoordinateSystem.a32 = fis->readFloat32();
			localCoordinateSystem.a42 = 0.0f;
			localCoordinateSystem.a13 = fis->readFloat32();
			localCoordinateSystem.a23 = fis->readFloat32();
			localCoordinateSystem.a33 = fis->readFloat32();
			localCoordinateSystem.a43 = 0.0f;
			localCoordinateSystem.a14 = fis->readFloat32();
			localCoordinateSystem.a24 = fis->readFloat32();
			localCoordinateSystem.a34 = fis->readFloat32();
			localCoordinateSystem.a44 = 1.0f;
The first digit after the "a" is the row (1-based) and the second one is the column. Afterwards I multiply this matrix with every vertex in my model. The multiplication looks like this (pseudo-code):
	new_X = a11*x + a12*y + a13*z + a14*1;
	new_Y = a21*x + a22*y + a23*z + a24*1;
	new_Z = a31*x + a32*y + a33*z + a34*1;
I think this should be true, but it does not work. If I replace all values of the last column of this matrix by 0 the result is better, but still not perfect. Does anybody see the mistake? PS: Before I pass the final vertices to DirectX I swap the y- and the z-component of all vertices, since 3DS has swapped these two axis. Thanks in advance. rgds.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!