/* ModelTypes - Types defined in msLib.h. C arrays converted to use std::vector */ #ifndef MODEL_TYPES_H #define MODEL_TYPES_H #define MS_MAX_NAME 32 #include "RageTypes.h" struct msTriangle { uint16_t nVertexIndices[3]; }; struct msMesh { msMesh(); ~msMesh(); char szName[MS_MAX_NAME]; char nMaterialIndex; vector Vertices; // OPTIMIZATION: If all verts in a mesh are transformed by the same bone, // then send the transform to the graphics card for the whole mesh instead // of transforming each vertex on the CPU; char nBoneIndex; // -1 = no bone vector Triangles; }; class RageTexture; // merge this into Sprite? class AnimatedTexture { public: AnimatedTexture(); ~AnimatedTexture(); void Load( CString sTexOrIniFile ); void Unload(); void Update( float fDelta ); RageTexture* GetCurrentTexture(); int GetNumStates() const; void SetState( int iNewState ); float GetAnimationLengthSeconds() const; void SetSecondsIntoAnimation( float fSeconds ); float GetSecondsIntoAnimation() const; RageVector2 GetTextureTranslate(); bool m_bSphereMapped; BlendMode m_BlendMode; bool NeedsNormals() const { return m_bSphereMapped; } private: RageVector2 m_vTexOffset; RageVector2 m_vTexVelocity; int m_iCurState; float m_fSecsIntoFrame; struct AnimatedTextureState { AnimatedTextureState( RageTexture* pTexture_, float fDelaySecs_, RageVector2 vTranslate_ ) { pTexture = pTexture_; fDelaySecs = fDelaySecs_; vTranslate = vTranslate_; } RageTexture* pTexture; float fDelaySecs; RageVector2 vTranslate; }; vector vFrames; }; struct msMaterial { int nFlags; CString sName; RageColor Ambient; RageColor Diffuse; RageColor Specular; RageColor Emissive; float fShininess; float fTransparency; int nName; // not used in SM. What is this for anyway? AnimatedTexture diffuse; AnimatedTexture alpha; bool NeedsNormals() const { return diffuse.NeedsNormals() || alpha.NeedsNormals() ; } }; struct msPositionKey { float fTime; RageVector3 Position; }; struct msRotationKey { float fTime; RageVector3 Rotation; }; struct msBone { int nFlags; char szName[MS_MAX_NAME]; char szParentName[MS_MAX_NAME]; RageVector3 Position; RageVector3 Rotation; vector PositionKeys; int nNumRotationKeys; int nNumAllocedRotationKeys; vector RotationKeys; }; struct msAnimation { vector Bones; int FindBoneByName( const char* szName ) const { for( unsigned i=0; i