load Models from XML (alternative to a .model file)
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
LUA_REGISTER_CLASS( Model )
|
LUA_REGISTER_CLASS( Model )
|
||||||
// lua end
|
// lua end
|
||||||
|
|
||||||
|
REGISTER_ACTOR_CLASS( Model )
|
||||||
|
|
||||||
const float FRAMES_PER_SECOND = 30;
|
const float FRAMES_PER_SECOND = 30;
|
||||||
const CString DEFAULT_ANIMATION_NAME = "default";
|
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 )
|
void Model::LoadMaterialsFromMilkshapeAscii( CString sPath )
|
||||||
{
|
{
|
||||||
FixSlashesInPlace(sPath);
|
FixSlashesInPlace(sPath);
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ public:
|
|||||||
void LoadMilkshapeAscii( CString sFile );
|
void LoadMilkshapeAscii( CString sFile );
|
||||||
void LoadMaterialsFromMilkshapeAscii( CString sPath );
|
void LoadMaterialsFromMilkshapeAscii( CString sPath );
|
||||||
bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath );
|
bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath );
|
||||||
|
|
||||||
|
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||||
|
|
||||||
void PlayAnimation( CString sAniName, float fPlayRate = 1 );
|
void PlayAnimation( CString sAniName, float fPlayRate = 1 );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|||||||
Reference in New Issue
Block a user