Skip to main content
gamedev.net
🔒 Locked

Help with ms3d loader

Started by Beaverbutt8 11 replies 1.3k views
Original Post
Beaverbutt8
Beaverbutt8
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
Nit
Nit
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]
frecco2k
frecco2k
i think this should do the trick.
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
----------------------------"I refuse to answer that question on the grounds that I don't know the answer"-- Douglas Adams (1952 - 2001)
Beaverbutt8
Beaverbutt8
Well, i copied and pasted what you wrote there, exactly. What should be


I got 2 errors when compiling

'pathTemp' undeclared
'pathLength' undeclared
DrewGreen
DrewGreen
You were also told that there's a newer version on his site that fixes this problem.
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
Beaverbutt8
Beaverbutt8
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?
DrewGreen
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)

[Edited by - DrewGreen on December 12, 2005 6:15:35 PM]
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
DrewGreen
DrewGreen
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:

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.
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
Beaverbutt8
Beaverbutt8
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.