2003-04-25 21:05:40 +00:00
|
|
|
#ifndef Model_H
|
|
|
|
|
#define Model_H
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: Model
|
|
|
|
|
|
|
|
|
|
Desc: A 3D model.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Actor.h"
|
|
|
|
|
#include "RageTypes.h"
|
2003-06-07 18:09:20 +00:00
|
|
|
#include "ModelTypes.h"
|
2003-05-04 05:21:16 +00:00
|
|
|
#include <vector>
|
2003-06-07 18:09:20 +00:00
|
|
|
#include <map>
|
2003-04-25 21:05:40 +00:00
|
|
|
|
|
|
|
|
struct msModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Model : public Actor
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Model ();
|
|
|
|
|
virtual ~Model ();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void Clear ();
|
2003-06-07 18:09:20 +00:00
|
|
|
void Load( CString sFile )
|
2003-05-11 07:23:47 +00:00
|
|
|
{
|
2003-06-07 18:09:20 +00:00
|
|
|
if( sFile == "" ) return;
|
2003-09-21 20:57:07 +00:00
|
|
|
LoadMilkshapeAscii( sFile );
|
2003-05-11 07:23:47 +00:00
|
|
|
};
|
|
|
|
|
|
2003-06-07 18:09:20 +00:00
|
|
|
bool LoadMilkshapeAscii( CString sFile );
|
|
|
|
|
bool LoadMilkshapeAsciiBones( CString sAniName, CString sFile );
|
2003-08-31 08:15:52 +00:00
|
|
|
void PlayAnimation( CString sAniName, float fPlayRate = 1 );
|
2003-04-25 21:05:40 +00:00
|
|
|
|
|
|
|
|
virtual void Update( float fDelta );
|
|
|
|
|
virtual void DrawPrimitives();
|
|
|
|
|
|
|
|
|
|
void AdvanceFrame (float dt);
|
|
|
|
|
|
2003-05-11 07:23:47 +00:00
|
|
|
virtual void SetState( int iNewState );
|
2003-07-31 11:31:24 +00:00
|
|
|
float GetCurFrame();
|
|
|
|
|
void SetFrame( float fNewFrame );
|
2003-05-11 07:23:47 +00:00
|
|
|
virtual int GetNumStates();
|
2003-08-20 09:15:53 +00:00
|
|
|
CString GetDefaultAnimation() { return m_sDefaultAnimation; };
|
2003-08-31 08:15:52 +00:00
|
|
|
void SetDefaultAnimation( CString sAnimation, float fPlayRate = 1 );
|
2003-08-20 09:15:53 +00:00
|
|
|
bool m_bRevertToDefaultAnimation;
|
2003-05-11 07:23:47 +00:00
|
|
|
|
2004-01-10 20:34:18 +00:00
|
|
|
virtual void HandleCommand( const ParsedCommand &command );
|
2003-05-11 07:23:47 +00:00
|
|
|
|
2003-04-25 21:05:40 +00:00
|
|
|
private:
|
2003-06-07 18:09:20 +00:00
|
|
|
vector<msMesh> m_Meshes;
|
|
|
|
|
vector<msMaterial> m_Materials;
|
|
|
|
|
map<CString,msAnimation> m_mapNameToAnimation;
|
|
|
|
|
msAnimation* m_pCurAnimation;
|
|
|
|
|
|
|
|
|
|
RageVector3 m_vMins, m_vMaxs;
|
2004-02-08 04:58:43 +00:00
|
|
|
vector<myBone_t> m_vpBones;
|
|
|
|
|
|
|
|
|
|
// true if any vertex has a bone weight.
|
|
|
|
|
// If true, then render from m_vTempVerticesByBone.
|
|
|
|
|
// Otherwise, render directly from the mesh's vertices
|
|
|
|
|
bool bUseTempVertices;
|
|
|
|
|
|
2003-07-07 01:29:18 +00:00
|
|
|
typedef vector<RageModelVertex> RageModelVertexVector;
|
2004-02-08 04:58:43 +00:00
|
|
|
vector<RageModelVertexVector> m_vTempVerticesByMesh;
|
|
|
|
|
|
2003-08-28 06:36:33 +00:00
|
|
|
float m_fCurrFrame;
|
|
|
|
|
CString m_sDefaultAnimation;
|
2003-08-31 08:15:52 +00:00
|
|
|
float m_fDefaultAnimationRate;
|
|
|
|
|
float m_fCurAnimationRate;
|
2003-04-25 21:05:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|