Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ModelTypes.h

Go to the documentation of this file.
00001 /* ModelTypes - Types defined in msLib.h. C arrays converted to use std::vector */ 00002 00003 #ifndef MODEL_TYPES_H 00004 #define MODEL_TYPES_H 00005 00006 #define MS_MAX_NAME 32 00007 00008 #include "RageTypes.h" 00009 00010 struct msTriangle 00011 { 00012 uint16_t nVertexIndices[3]; 00013 }; 00014 00015 00016 struct msMesh 00017 { 00018 msMesh(); 00019 ~msMesh(); 00020 00021 char szName[MS_MAX_NAME]; 00022 char nMaterialIndex; 00023 00024 vector<RageModelVertex> Vertices; 00025 00026 // OPTIMIZATION: If all verts in a mesh are transformed by the same bone, 00027 // then send the transform to the graphics card for the whole mesh instead 00028 // of transforming each vertex on the CPU; 00029 char nBoneIndex; // -1 = no bone 00030 00031 vector<msTriangle> Triangles; 00032 }; 00033 00034 class RageTexture; 00035 00036 // merge this into Sprite? 00037 class AnimatedTexture 00038 { 00039 public: 00040 AnimatedTexture(); 00041 ~AnimatedTexture(); 00042 00043 void Load( CString sTexOrIniFile ); 00044 void Unload(); 00045 void Update( float fDelta ); 00046 00047 RageTexture* GetCurrentTexture(); 00048 00049 int GetNumStates() const; 00050 void SetState( int iNewState ); 00051 float GetAnimationLengthSeconds() const; 00052 void SetSecondsIntoAnimation( float fSeconds ); 00053 float GetSecondsIntoAnimation() const; 00054 00055 bool m_bSphereMapped; 00056 float m_fTexVelocityX; 00057 float m_fTexVelocityY; 00058 BlendMode m_BlendMode; 00059 00060 bool NeedsNormals() const { return m_bSphereMapped; } 00061 00062 private: 00063 00064 int m_iCurState; 00065 float m_fSecsIntoFrame; 00066 struct AnimatedTextureState 00067 { 00068 RageTexture* pTexture; 00069 float fDelaySecs; 00070 }; 00071 vector<AnimatedTextureState> vFrames; 00072 }; 00073 00074 struct msMaterial 00075 { 00076 int nFlags; 00077 CString sName; 00078 RageColor Ambient; 00079 RageColor Diffuse; 00080 RageColor Specular; 00081 RageColor Emissive; 00082 float fShininess; 00083 float fTransparency; 00084 int nName; // not used in SM. What is this for anyway? 00085 00086 AnimatedTexture diffuse; 00087 AnimatedTexture alpha; 00088 00089 bool NeedsNormals() const { return diffuse.NeedsNormals() || alpha.NeedsNormals() ; } 00090 }; 00091 00092 struct msPositionKey 00093 { 00094 float fTime; 00095 RageVector3 Position; 00096 }; 00097 00098 struct msRotationKey 00099 { 00100 float fTime; 00101 RageVector3 Rotation; 00102 }; 00103 00104 struct msBone 00105 { 00106 int nFlags; 00107 char szName[MS_MAX_NAME]; 00108 char szParentName[MS_MAX_NAME]; 00109 RageVector3 Position; 00110 RageVector3 Rotation; 00111 00112 vector<msPositionKey> PositionKeys; 00113 00114 int nNumRotationKeys; 00115 int nNumAllocedRotationKeys; 00116 vector<msRotationKey> RotationKeys; 00117 }; 00118 00119 struct msAnimation 00120 { 00121 vector<msBone> Bones; 00122 00123 int FindBoneByName( const char* szName ) const 00124 { 00125 for( unsigned i=0; i<Bones.size(); i++ ) 00126 if( strcmp(Bones[i].szName, szName)==0 ) 00127 return i; 00128 return -1; 00129 } 00130 00131 bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath ); 00132 00133 int nTotalFrames; 00134 00135 RageVector3 Position; 00136 RageVector3 Rotation; 00137 }; 00138 00139 struct myBone_t 00140 { 00141 RageMatrix mRelative; 00142 RageMatrix mAbsolute; 00143 RageMatrix mRelativeFinal; 00144 RageMatrix mFinal; 00145 }; 00146 00147 #endif 00148 00149 /* 00150 * (c) 2003-2004 Chris Danford 00151 * All rights reserved. 00152 * 00153 * Permission is hereby granted, free of charge, to any person obtaining a 00154 * copy of this software and associated documentation files (the 00155 * "Software"), to deal in the Software without restriction, including 00156 * without limitation the rights to use, copy, modify, merge, publish, 00157 * distribute, and/or sell copies of the Software, and to permit persons to 00158 * whom the Software is furnished to do so, provided that the above 00159 * copyright notice(s) and this permission notice appear in all copies of 00160 * the Software and that both the above copyright notice(s) and this 00161 * permission notice appear in supporting documentation. 00162 * 00163 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00164 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00165 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00166 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00167 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00168 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00169 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00170 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00171 * PERFORMANCE OF THIS SOFTWARE. 00172 */

Generated on Thu Jan 27 20:57:24 2005 for StepMania by doxygen 1.3.7