load Models from XML (alternative to a .model file)

This commit is contained in:
Chris Danford
2005-04-01 23:46:45 +00:00
parent 164d272b4c
commit 35251bb25b
2 changed files with 21 additions and 0 deletions
+18
View File
@@ -18,6 +18,8 @@
LUA_REGISTER_CLASS( Model )
// lua end
REGISTER_ACTOR_CLASS( Model )
const float FRAMES_PER_SECOND = 30;
const CString DEFAULT_ANIMATION_NAME = "default";
@@ -139,6 +141,22 @@ void Model::LoadPieces( CString sMeshesPath, CString sMaterialsPath, CString sBo
}
}
void Model::LoadFromNode( const CString& sDir, const XNode* pNode )
{
Actor::LoadFromNode( sDir, pNode );
CString s1, s2, s3;
pNode->GetAttrValue( "Meshes", s1 );
pNode->GetAttrValue( "Materials", s2 );
pNode->GetAttrValue( "Bones", s3 );
if( !s1.empty() || !s2.empty() || !s3.empty() )
{
ASSERT( !s1.empty() && !s2.empty() && !s3.empty() );
LoadPieces( sDir+s1, sDir+s2, sDir+s3 );
}
}
void Model::LoadMaterialsFromMilkshapeAscii( CString sPath )
{
FixSlashesInPlace(sPath);
+3
View File
@@ -39,6 +39,9 @@ public:
void LoadMilkshapeAscii( CString sFile );
void LoadMaterialsFromMilkshapeAscii( CString sPath );
bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath );
void LoadFromNode( const CString& sDir, const XNode* pNode );
void PlayAnimation( CString sAniName, float fPlayRate = 1 );
virtual void Update( float fDelta );