start animations in LoadPieces, but not LoadMilkshapeAsciiBones

This commit is contained in:
Glenn Maynard
2004-08-19 08:15:35 +00:00
parent e6bc94a4af
commit bbc55a3a1a
2 changed files with 13 additions and 6 deletions
+7 -4
View File
@@ -99,7 +99,9 @@ void Model::LoadPieces( CString sMeshesPath, CString sMaterialsPath, CString sBo
LoadMaterialsFromMilkshapeAscii( sMaterialsPath ); LoadMaterialsFromMilkshapeAscii( sMaterialsPath );
LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ); if( LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ) )
PlayAnimation( DEFAULT_ANIMATION_NAME );
// //
// Setup temp vertices (if necessary) // Setup temp vertices (if necessary)
@@ -263,7 +265,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( CString sPath )
f.Close(); f.Close();
} }
void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
{ {
FixSlashesInPlace(sPath); FixSlashesInPlace(sPath);
const CString sDir = Dirname( sPath ); const CString sDir = Dirname( sPath );
@@ -275,6 +277,7 @@ void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
CString sLine; CString sLine;
int iLineNum = 0; int iLineNum = 0;
bool bLoaded = false;
while( f.GetLine( sLine ) > 0 ) while( f.GetLine( sLine ) > 0 )
{ {
iLineNum++; iLineNum++;
@@ -394,9 +397,9 @@ void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
for( unsigned j = 0; j < Bone.RotationKeys.size(); ++j ) for( unsigned j = 0; j < Bone.RotationKeys.size(); ++j )
Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.RotationKeys[j].fTime ); Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.RotationKeys[j].fTime );
} }
PlayAnimation( sAniName );
} }
return bLoaded;
} }
bool Model::EarlyAbortDraw() bool Model::EarlyAbortDraw()
+6 -2
View File
@@ -24,7 +24,7 @@ public:
void LoadFromModelFile( CString sFile ); void LoadFromModelFile( CString sFile );
void LoadMilkshapeAscii( CString sFile ); void LoadMilkshapeAscii( CString sFile );
void LoadMaterialsFromMilkshapeAscii( CString sPath ); void LoadMaterialsFromMilkshapeAscii( CString sPath );
void LoadMilkshapeAsciiBones( CString sAniName, CString sPath ); bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath );
void PlayAnimation( CString sAniName, float fPlayRate = 1 ); void PlayAnimation( CString sAniName, float fPlayRate = 1 );
virtual void Update( float fDelta ); virtual void Update( float fDelta );
@@ -57,9 +57,13 @@ private:
// If any vertex has a bone weight, then then render from m_pTempGeometry. // If any vertex has a bone weight, then then render from m_pTempGeometry.
// Otherwise, render directly from m_pGeometry. // Otherwise, render directly from m_pGeometry.
vector<msMesh> m_vTempMeshes;
RageCompiledGeometry* m_pTempGeometry; RageCompiledGeometry* m_pTempGeometry;
/* Keep a copy of the mesh data only if m_pTempGeometry is in use. The normal and
* position data will be changed; the rest is static and kept only to prevent making
* a complete copy. */
vector<msMesh> m_vTempMeshes;
void DrawMesh( int i ) const; void DrawMesh( int i ) const;
float m_fCurFrame; float m_fCurFrame;