🔒 Locked
Help with ms3d loader
Advertisement
Original Post
Hey guys, Before i asked why Brent Porter's MS3D loader wasn't showing the textures. I was told that it is was becasue of absolute directories for the textures, or something like that. I was then told that i should change the loader accordingly, so that this does not happen. But how can i do this?? I don't even have a vauge idea. It would help alot if someone could show me. If neccesary, i can email the source code to somone who wants to fix it. Thanks Mike
Taken from Brett's Source code is the loop which will load the materials:
[SOURCE] for ( i = 0; i < nMaterials; i++ ) { MS3DMaterial *pMaterial = ( MS3DMaterial* )pPtr; memcpy( m_pMaterials.m_ambient, pMaterial->m_ambient, sizeof( float )*4 ); memcpy( m_pMaterials.m_diffuse, pMaterial->m_diffuse, sizeof( float )*4 ); memcpy( m_pMaterials.m_specular, pMaterial->m_specular, sizeof( float )*4 ); memcpy( m_pMaterials.m_emissive, pMaterial->m_emissive, sizeof( float )*4 ); m_pMaterials.m_shininess = pMaterial->m_shininess; if ( strncmp( pMaterial->m_texture, ".\\", 2 ) == 0 ) { // MS3D 1.5.x relative path strcpy( pathTemp + pathLength, pMaterial->m_texture + 2 ); m_pMaterials.m_pTextureFilename = new char[strlen( pathTemp )+1]; strcpy( m_pMaterials.m_pTextureFilename, pathTemp ); } else { // MS3D 1.4.x or earlier - absolute path m_pMaterials.m_pTextureFilename = new char[strlen( pMaterial->m_texture )+1]; strcpy( m_pMaterials.m_pTextureFilename, pMaterial->m_texture ); } pPtr += sizeof( MS3DMaterial ); }[/SOURCE]
i think this should do the trick.
found this code in an old MS3D anim tutor by Brett Porter.
// Fredrik
EDIT: Beat me to it Nit
if ( strncmp( pMaterial->m_texture, ".\\", 2 ) == 0 ) { // MS3D 1.5.x relative path strcpy( pathTemp + pathLength, pMaterial->m_texture + 2 ); m_pMaterials.m_pTextureFilename = new char[strlen( pathTemp )+1]; strcpy( m_pMaterials.m_pTextureFilename, pathTemp );}else { // MS3D 1.4.x or earlier - absolute path m_pMaterials.m_pTextureFilename = new char[strlen( pMaterial->m_texture )+1]; strcpy( m_pMaterials.m_pTextureFilename, pMaterial->m_texture );}found this code in an old MS3D anim tutor by Brett Porter.
// Fredrik
EDIT: Beat me to it Nit
Well, i copied and pasted what you wrote there, exactly. What should be
I got 2 errors when compiling
'pathTemp' undeclared
'pathLength' undeclared
I got 2 errors when compiling
'pathTemp' undeclared
'pathLength' undeclared
If you want to look at Brett's full (and updated) source code, clicky:
http://rsn.gamedev.net/files/ms3danim.zip
http://rsn.gamedev.net/files/ms3danim.zip
Ok.
Not to be a pain, but here's what happened - when i tried to run the .exe it said that it encountered an error, and will now close. I thought that was kind of wierd. So i tried again. Same thing. Ten more times i tried, then i restarted my computer and tried again, it did the same thing :( . Any idea what's going on?
Not to be a pain, but here's what happened - when i tried to run the .exe it said that it encountered an error, and will now close. I thought that was kind of wierd. So i tried again. Same thing. Ten more times i tried, then i restarted my computer and tried again, it did the same thing :( . Any idea what's going on?
Have you tried this one?
http://rsn.gamedev.net/files/lesson31_new.zip
And here it is in action using a .jpg and a .bmp texture (the helichopper)
[Edited by - DrewGreen on December 12, 2005 6:15:35 PM]
http://rsn.gamedev.net/files/lesson31_new.zip
And here it is in action using a .jpg and a .bmp texture (the helichopper)
[Edited by - DrewGreen on December 12, 2005 6:15:35 PM]
Quote:
Original post by DrewGreen
Have you tried this one?
http://rsn.gamedev.net/files/lesson31_new.zip
And here it is in action using a .jpg and a .bmp texture (the helichopper)
Ok, Excellent!!!! The ms3d loader is working!
Just one thing - the "ms3d anim" is still saying that it encountered an error and will now close
So what do i do now?
Have you tried compiling the ms3danim project yourself as well? If you're using VC6 without service pack 6 installed you might get the error I got:
because of this:
#ifdef _MSC_VER
# pragma pack( pop, packing )
#endif
I have no idea how to fix this (I'm sticking with SP5 for compatibility issues with some libraries I'm working with) & don't have any of the compatible compilers listed in Brett's readme, so either try it with one of them and see if your version works, or download the milkshape SDK from the product website & check the examples in there.
Quote:
Compiling...
MilkshapeModel.cpp
C:\Documents and Settings\Codemonkey\Desktop\ms3danim\ms3danim\MilkshapeModel.cpp(109) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
SkelAnimTut.exe - 1 error(s), 0 warning(s)
because of this:
#ifdef _MSC_VER
# pragma pack( pop, packing )
#endif
I have no idea how to fix this (I'm sticking with SP5 for compatibility issues with some libraries I'm working with) & don't have any of the compatible compilers listed in Brett's readme, so either try it with one of them and see if your version works, or download the milkshape SDK from the product website & check the examples in there.
Hmm. I still get he problem
Any other good OGL skeletal animation tutorials? I'm desprate to learn how to do this. It would help ALOT =)
Thanks =)
Mike
Any other good OGL skeletal animation tutorials? I'm desprate to learn how to do this. It would help ALOT =)
Thanks =)
Mike
0_o
~
~
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement