/* ModelTypes - Types defined in msLib.h. C arrays converted to use std::vector */ #ifndef MODEL_TYPES_H #define MODEL_TYPES_H #include "RageTypes.h" #include #include struct msTriangle { uint16_t nVertexIndices[3]; }; struct msMesh { RString sName; int8_t nMaterialIndex; std::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; int8_t m_iBoneIndex; // -1 = no bone std::vector Triangles; }; class RageTexture; class AnimatedTexture { public: AnimatedTexture(); ~AnimatedTexture(); RageVector3 RadianToDegree(RageVector3 radian); void LoadBlank(); void Load(const RString &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; }; std::vector vFrames; }; struct msMaterial { int nFlags; RString sName; RageColor Ambient; RageColor Diffuse; RageColor Specular; RageColor Emissive; float fShininess; float fTransparency; AnimatedTexture diffuse; AnimatedTexture alpha; bool NeedsNormals() const { return diffuse.NeedsNormals() || alpha.NeedsNormals() ; } }; struct msPositionKey { float fTime; RageVector3 Position; msPositionKey() : fTime(0.0f) {} }; struct msRotationKey { float fTime; RageVector4 Rotation; msRotationKey() : fTime(0.0f) {} }; struct msBone { int nFlags; RString sName; RString sParentName; RageVector3 Position; RageVector3 Rotation; std::vector PositionKeys; std::vector RotationKeys; msBone() : nFlags(0) {} }; struct msAnimation { int FindBoneByName( const RString &sName ) const { for (unsigned i = 0; i < Bones.size(); i++) { if (Bones[i].sName == sName) return i; } return -1; } bool LoadMilkshapeAsciiBones( RString sAniName, RString sPath ); std::vector Bones; int nTotalFrames = 0; }; struct myBone_t { RageMatrix m_Relative; RageMatrix m_Absolute; RageMatrix m_Final; }; #endif /* * (c) 2003-2004 Chris Danford * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, and/or sell copies of the Software, and to permit persons to * whom the Software is furnished to do so, provided that the above * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */