Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExCModelMD2 Class Reference

#include <ExCModelMD2.h>

Inheritance diagram for ExCModelMD2:

ExCModelMD ExCModel ExCObject3D ExCObject

Public Methods

 ExCModelMD2 (void)
 ~ExCModelMD2 (void)
void Draw (void)
void DrawFrameFromFile (int NumFrame, int interpolation)
bool Load (std::string FileName)
void StopRun (void)
void StartRun (void)
void StartAction (std::string Action)
void StopAction (void)
void Process (std::string Action)

Protected Attributes

int m_magic
int m_version
int m_skinWidth
int m_skinHeight
int m_frameSize
int m_numSkins
int m_numVertices
int m_numTexCoords
int m_numTriangles
int m_numGlCommands
int m_offsetSkins
int m_offsetTexCoords
int m_offsetTriangles
int m_offsetFrames
int m_offsetGlCommands
int m_offsetEnd
std::vector< std::string > m_VecSkin
std::vector< ExCVec2Dm_VecTexture
std::vector< std::pair< ExCVec3D,
ExCVec3D > > 
m_VecTriangle
std::vector< ExCVec3Dm_VecVertex
std::string m_Skin

Constructor & Destructor Documentation

ExCModelMD2 void   
 

Definition at line 26 of file ExCModelMD2.cpp.

References ExCModelMD2(), Guard, ExCModel::m_CurrentFrames, ExCModel::m_Interpolation, ExCModel::m_InterpolationPourcentage, ExCModel::m_NextFrame, ExCObject3D::m_speed, ExCObject3D::m_Target, ExCModel::m_Transition, ExCVec3D::SetX(), and StartAction().

Referenced by ExCModelMD2(), and ~ExCModelMD2().

00027 {
00028 Guard(ExCModelMD2::ExCModelMD2(void))
00029         m_CurrentFrames=2;
00030         m_NextFrame=3;
00031         m_InterpolationPourcentage=0.1f;
00032         m_Interpolation=m_InterpolationPourcentage;
00033         m_Transition=false;
00034         m_Target.SetX(0.1f);
00035         StartAction("IDLE");
00036         m_speed=1;
00037 UnGuard
00038 }

~ExCModelMD2 void   
 

Definition at line 57 of file ExCModelMD2.cpp.

References ExCModelMD2(), and Guard.

00058 {
00059 Guard(ExCModelMD2::~ExCModelMD2(void))
00060 UnGuard
00061 }


Member Function Documentation

void Draw void    [virtual]
 

Reimplemented from ExCModel.

Definition at line 181 of file ExCModelMD2.cpp.

References ExCModel::Draw(), Draw(), ExCVec3D::GetX(), ExCVec2D::GetX(), ExCVec3D::GetY(), ExCVec2D::GetY(), ExCVec3D::GetZ(), Guard, ExCModel::m_CurrentAction, ExCModel::m_CurrentFrames, ExCModel::m_Interpolation, ExCModel::m_InterpolationPourcentage, ExCModel::m_KeyFrameStartAction, ExCModel::m_KeyFrameStopAction, ExCModel::m_NextFrame, m_numTriangles, m_numVertices, m_Skin, m_VecTexture, m_VecTriangle, m_VecVertex, ExCModel::ManagerTexture, Process(), ExManagerTexture::SetCurrentObject(), ExCVec3D::SetX(), ExCVec2D::SetX(), ExCVec3D::SetY(), ExCVec2D::SetY(), and ExCVec3D::SetZ().

Referenced by Draw().

00182 {
00183         Guard(void ExCModelMD2::Draw(void))
00184                 ExCVec3D VecAB,VecBC,VecCA;
00185         ExCVec2D VecTAB,VecTBC,VecTCA;
00186         int FrameToDraw,FrameToInterpol;
00187 
00188         glPushMatrix();
00189         ExCModel::Draw();
00190         glPushMatrix();
00191         glEnable(GL_TEXTURE_2D);
00192         glDisable(GL_LIGHTING);
00193 
00194         if(m_Transition)
00195         {
00196                 m_Interpolation+=m_InterpolationPourcentage;
00197                 if(m_Interpolation>1)//chexk if we go to next frame
00198                 {
00199                         m_Interpolation=m_InterpolationPourcentage;
00200                         m_CurrentFrames++;
00201                         m_NextFrame=m_CurrentFrames+1;
00202                         if(m_NextFrame>m_KeyFrameStopAction)m_NextFrame=m_KeyFrameStartAction;
00203                         if(m_CurrentFrames>m_KeyFrameStopAction)
00204                         {
00205                                 m_CurrentFrames=m_KeyFrameStartAction;
00206                                 m_NextFrame=m_CurrentFrames+1;
00207                         }
00208                 }
00209         }
00210         FrameToDraw=m_numVertices*m_CurrentFrames;
00211         FrameToInterpol=m_numVertices*m_NextFrame;
00212         Process(m_CurrentAction);
00213         ManagerTexture->SetCurrentObject(m_Skin);
00214 
00215         glBegin(GL_TRIANGLES);
00216         for(int i = 0; i < m_numTriangles; i++)
00217         {
00218                 //----------------
00219                 //Texture coord
00220                 //----------------
00221                 VecTAB.SetX(m_VecTexture.at(m_VecTriangle.at(i).second.GetX()).GetX());
00222                 VecTAB.SetY(m_VecTexture.at(m_VecTriangle.at(i).second.GetX()).GetY());
00223 
00224                 VecTBC.SetX(m_VecTexture.at(m_VecTriangle.at(i).second.GetY()).GetX());
00225                 VecTBC.SetY(m_VecTexture.at(m_VecTriangle.at(i).second.GetY()).GetY());
00226 
00227                 VecTCA.SetX(m_VecTexture.at(m_VecTriangle.at(i).second.GetZ()).GetX());
00228                 VecTCA.SetY(m_VecTexture.at(m_VecTriangle.at(i).second.GetZ()).GetY());
00229                 //----------------
00230                 //Vertex coord
00231                 //----------------
00232                 VecAB.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToDraw).GetX());
00233                 VecAB.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToDraw).GetY());
00234                 VecAB.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToDraw).GetZ());                
00235 
00236                 VecBC.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToDraw).GetX());
00237                 VecBC.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToDraw).GetY());
00238                 VecBC.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToDraw).GetZ());
00239 
00240                 VecCA.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToDraw).GetX());
00241                 VecCA.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToDraw).GetY());
00242                 VecCA.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToDraw).GetZ());
00243 
00244                 //--------------
00245                 //interpolation
00246                 //--------------
00247                 if(m_Transition)
00248                 {
00249                         ExCVec3D VecABN,VecBCN,VecCAN;
00250 
00251                         VecABN.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToInterpol).GetX());
00252                         VecABN.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToInterpol).GetY());
00253                         VecABN.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetX()+FrameToInterpol).GetZ());           
00254 
00255                         VecBCN.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToInterpol).GetX());
00256                         VecBCN.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToInterpol).GetY());
00257                         VecBCN.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetY()+FrameToInterpol).GetZ());
00258 
00259                         VecCAN.SetX(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToInterpol).GetX());
00260                         VecCAN.SetY(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToInterpol).GetY());
00261                         VecCAN.SetZ(m_VecVertex.at(m_VecTriangle.at(i).first.GetZ()+FrameToInterpol).GetZ());
00262 
00263                         VecAB=VecAB+((VecABN-VecAB)*m_Interpolation);
00264                         VecBC=VecBC+((VecBCN-VecBC)*m_Interpolation);
00265                         VecCA=VecCA+((VecCAN-VecCA)*m_Interpolation);
00266                 }
00267                 //--------------
00268                 //Draw
00269                 //--------------
00270                 glColor3f(1,1,1);
00271                 glTexCoord2f(VecTBC.GetX(),VecTBC.GetY());
00272                 glVertex3f(VecBC.GetX(),VecBC.GetY(),VecBC.GetZ());
00273 
00274                 glTexCoord2f(VecTAB.GetX(),VecTAB.GetY());
00275                 glVertex3f(VecAB.GetX(),VecAB.GetY(),VecAB.GetZ());
00276 
00277                 glTexCoord2f(VecTCA.GetX(),VecTCA.GetY());
00278                 glVertex3f(VecCA.GetX(),VecCA.GetY(),VecCA.GetZ());
00279         }
00280         glEnd();
00281         glDisable(GL_TEXTURE_2D);
00282         glPopMatrix();
00283         glPopMatrix();
00284         UnGuard
00285 }

void DrawFrameFromFile int    NumFrame,
int    interpolation
 

Definition at line 287 of file ExCModelMD2.cpp.

References DrawFrameFromFile(), and Guard.

Referenced by DrawFrameFromFile().

00288 {
00289 Guard(void ExCModelMD2::DrawFrameFromFile(int NumFrame,int interpolation))
00290 /*      int i,j;
00291         FILE *filePtr;                          // file pointer
00292         int fileLen;                            // length of model file
00293         char *buffer;                           // file buffer
00294 
00295         
00296         frame_t *frame;                              // frame data
00297         stIndex_t *stPtr;                       // texture data
00298         mesh_t *bufIndexPtr;          // index variables
00299 
00300         //-------------------------------------
00301         //read vertex data
00302         //-------------------------------------
00303         ExCVec3D Vec3D;
00304         frame = (frame_t*)&buffer[m_offsetFrames+ m_frameSize * NumFrame];
00305         for (i = 0; i < m_numVertices; i++)
00306         {
00307                 Vec3D.SetX(frame->scale[0] * frame->fp[i].v[0] + frame->translate[0]);
00308                 Vec3D.SetY(frame->scale[1] * frame->fp[i].v[1] + frame->translate[1]);
00309                 Vec3D.SetZ(frame->scale[2] * frame->fp[i].v[2] + frame->translate[2]);
00310                 Vec3D=Vec3D/10;
00311                 m_VecVertex.push_back(Vec3D);
00312         }
00313         //-----------------------------------------------
00314         //read triangles data 
00315         //-----------------------------------------------
00316         fseek(filePtr, m_offsetTriangles, SEEK_SET);
00317         short AB,BC,CA,TAB,TBC,TCA;
00318         ExCVec3D VertexNum,TexturNum;
00319         // point to triangle indexes in buffer
00320         bufIndexPtr = (mesh_t*)&buffer[m_offsetTriangles]; 
00321         // create a mesh (triangle) list
00322         for (j = 0; j < m_numFrames; j++)         
00323         {
00324                 // for all triangles in each frame
00325                 for(i = 0; i < m_numTriangles; i++)
00326                 {
00327                         AB = bufIndexPtr[i].meshIndex[0];
00328                         BC = bufIndexPtr[i].meshIndex[1];
00329                         CA = bufIndexPtr[i].meshIndex[2];
00330                         TAB = bufIndexPtr[i].stIndex[0];
00331                         TBC = bufIndexPtr[i].stIndex[1];
00332                         TCA = bufIndexPtr[i].stIndex[2];
00333 
00334                         VertexNum.SetValue(AB,BC,CA);
00335                         TexturNum.SetValue(TAB,TBC,TCA);
00336                         std::pair<ExCVec3D,ExCVec3D> tmp(VertexNum,TexturNum);
00337                         m_VecTriangle.push_back(tmp);
00338                 }
00339         }
00340 
00341         //--------------------------------------------------------------------------------------------
00342         //draw
00343 
00344 */
00345 UnGuard
00346 }

bool Load std::string    FileName
 

Definition at line 350 of file ExCModelMD2.cpp.

References ExNihilo::ExtracValueFromSring(), frame_t::fp, modelHeader_t::framesize, Guard, modelHeader_t::ident, ExManagerTexture::Load(), Load(), m_frameSize, m_magic, ExCModel::m_numFrames, m_numGlCommands, m_numSkins, m_numTexCoords, m_numTriangles, m_numVertices, m_offsetEnd, m_offsetFrames, m_offsetGlCommands, m_offsetSkins, m_offsetTexCoords, m_offsetTriangles, m_Skin, m_skinHeight, m_skinWidth, m_VecSkin, m_VecTexture, m_VecTriangle, m_VecVertex, m_version, ExCModel::ManagerTexture, mesh_t::meshIndex, modelHeader_t::numFrames, modelHeader_t::numGLcmds, modelHeader_t::numSkins, modelHeader_t::numST, modelHeader_t::numTris, modelHeader_t::numXYZ, modelHeader_t::offsetEnd, modelHeader_t::offsetFrames, modelHeader_t::offsetGLcmds, modelHeader_t::offsetSkins, modelHeader_t::offsetST, modelHeader_t::offsetTris, frame_t::scale, ExCVec3D::SetValue(), ExCVec2D::SetX(), ExCVec3D::SetX(), ExCVec2D::SetY(), ExCVec3D::SetY(), ExCVec3D::SetZ(), modelHeader_t::skinheight, modelHeader_t::skinwidth, mesh_t::stIndex, frame_t::translate, framePoint_t::v, and modelHeader_t::version.

Referenced by Load(), and ExManagerModel::LoadMD2().

00351 {
00352 Guard(bool ExCModelMD2::Load(std::string FileName))
00353         int i,j;
00354         FILE *filePtr;                          // file pointer
00355     int fileLen;                            // length of model file
00356     char *buffer;                           // file buffer
00357 
00358     modelHeader_t *modelHeader;             // model header
00359         frame_t *frame;                              // frame data
00360         stIndex_t *stPtr;                       // texture data
00361          mesh_t *bufIndexPtr;          // index variables
00362         m_Skin=ExNihilo::ExtracValueFromSring(FileName,"../Data/Modeles/",".md2");
00363         m_Skin=m_Skin+".pcx";
00364         ManagerTexture->Load(m_Skin);
00365 
00366 
00367     filePtr = fopen(FileName.data(), "rb");
00368     if (filePtr == NULL) 
00369         {
00370                 throw ExCExpFileNotFound();
00371                 return false;
00372         }
00373      
00374 
00375          // find length of file
00376      fseek(filePtr, 0, SEEK_END);
00377      fileLen = ftell(filePtr);
00378      fseek(filePtr, 0, SEEK_SET);
00379      
00380      // read entire file into buffer
00381      buffer = new char [fileLen+1];
00382      fread(buffer, sizeof(char), fileLen, filePtr);
00383 
00384          modelHeader = (modelHeader_t*)buffer; 
00385 
00386 /*       std::ofstream logscale;
00387          std::ofstream logfp;
00388          std::ofstream logtranslate;
00389          std::ofstream logfile;
00390          std::ofstream logHeader;
00391          std::ofstream logTextureCoord;
00392          
00393          logscale.open("logscale.txt",std::ios::out);
00394          logfp.open("logfp.txt",std::ios::out);
00395          logtranslate.open("logtranslate.txt",std::ios::out);
00396          logfile.open("logfile.txt",std::ios::out);
00397          logHeader.open("logHeader.txt",std::ios::out);
00398          logTextureCoord.open("logTextureCoord.txt",std::ios::out);
00399 */
00400 
00401         m_magic=modelHeader->ident;
00402         m_version=modelHeader->version;                                         // The version number of the file (Must be 8)
00403         m_skinWidth=modelHeader->skinwidth;                                     // The skin width in pixels
00404         m_skinHeight=modelHeader->skinheight;                           // The skin height in pixels
00405         m_frameSize=modelHeader->framesize;                                     // The size in bytes the frames are
00406         m_numSkins=modelHeader->numSkins;                                       // The number of skins associated with the model
00407         m_numVertices=modelHeader->numXYZ;                              // The number of vertices (constant for each frame)
00408         m_numTexCoords=modelHeader->numST;                      // The number of texture coordinates
00409         m_numTriangles=modelHeader->numTris;                    // The number of faces (polygons)
00410         m_numGlCommands=modelHeader->numGLcmds;                 // The number of gl commands
00411         m_numFrames=modelHeader->numFrames;                                     // The number of animation frames
00412         m_offsetSkins=modelHeader->offsetSkins;                         // The offset in the file for the skin data
00413         m_offsetTexCoords=modelHeader->offsetST;                // The offset in the file for the texture data
00414         m_offsetTriangles=modelHeader->offsetTris;              // The offset in the file for the face data
00415         m_offsetFrames=modelHeader->offsetFrames;                       // The offset in the file for the frames data
00416         m_offsetGlCommands=modelHeader->offsetGLcmds;   // The offset in the file for the gl commands data
00417         m_offsetEnd=modelHeader->offsetEnd;                                     // The end of the file offset
00418         
00419         /*logHeader<<"This is used to identify the file: "<<m_magic<<std::endl;
00420         logHeader<<"The version number of the file (Musbe 8):"<<m_version<<std::endl;
00421         logHeader<<"The skin width in pixels:"<<m_skinWidth<<std::endl;
00422         logHeader<<"The skin heighin pixels:"<<m_skinHeight<<std::endl;
00423         logHeader<<"The size in bytes the frames are:"<<m_frameSize<<std::endl;
00424         logHeader<<"The number of skins associated with the model:"<<m_numSkins<<std::endl;
00425         logHeader<<"The number of vertices (constan for each frame):"<<m_numVertices<<std::endl;
00426         logHeader<<"The number of texture coordinates:"<<m_numTexCoords<<std::endl;
00427         logHeader<<"The number of faces (polygons):"<<m_numTriangles<<std::endl;
00428         logHeader<<"The number of gl commands:"<<m_numGlCommands<<std::endl;
00429         logHeader<<"The number of animation frames:"<<m_numFrames<<std::endl;
00430         logHeader<<"The offset in the file for the skin data:"<<m_offsetSkins<<std::endl;
00431         logHeader<<"The offset in the file for the texture data:"<<m_offsetTexCoords<<std::endl;
00432         logHeader<<"The offset in the file for the face data:"<<m_offsetTriangles<<std::endl;
00433         logHeader<<"The offset in the file for the frames data:"<<m_offsetFrames<<std::endl;
00434         logHeader<<"The offset in the file for the gl commands data:"<<m_offsetGlCommands<<std::endl;
00435         logHeader<<"The end of the file offset:"<<m_offsetEnd<<std::endl;
00436           */
00437         //-----------------------------------------------
00438         //read all skin
00439         //-----------------------------------------------
00440         char mybuff[65];
00441         std::string BuffSkin;
00442     fseek(filePtr, m_offsetSkins, SEEK_SET);
00443         for(i = 0;i<m_numSkins;++i)
00444         {
00445                 fread(&mybuff,sizeof(char),64, filePtr);
00446                 BuffSkin=mybuff;
00447                 //std::cout<<BuffSkin<<std::endl;
00448                 m_VecSkin.push_back(BuffSkin);
00449         }
00450         //-----------------------------------------------
00451         //read vertex  data 
00452         //-----------------------------------------------
00453          ExCVec3D Vec3D;
00454          for (j = 0; j < m_numFrames; j++)
00455      {
00456           frame = (frame_t*)&buffer[m_offsetFrames+ m_frameSize * j];
00457           for (i = 0; i < m_numVertices; i++)
00458           {
00459                                 Vec3D.SetX(frame->scale[0] * frame->fp[i].v[0] + frame->translate[0]);
00460                                 Vec3D.SetY(frame->scale[1] * frame->fp[i].v[1] + frame->translate[1]);
00461                                 Vec3D.SetZ(frame->scale[2] * frame->fp[i].v[2] + frame->translate[2]);
00462                                 Vec3D=Vec3D/10;
00463                                 m_VecVertex.push_back(Vec3D);
00464 
00465                                 //logscale<<"X:"<<frame->scale[0]<<" Y:"<<frame->scale[1]<<" Z:"<<frame->scale[2]<<std::endl;
00466                                 //logfp<<"X:"<<frame->fp[i].v[0]<<" Y:"<<frame->fp[i].v[1]<<" Z:"<<frame->fp[i].v[2]<<std::endl;
00467                                 //logtranslate<<"X:"<<frame->translate[0]<<" Y:"<<frame->translate[1]<<" Z:"<<frame->translate[2]<<std::endl;
00468                                 //logfile<<"vec :"<<i<<" "<<Vec3D<<std::endl;
00469           }
00470                   //logfile<<"------------------------------------------------------------------"<<std::endl;
00471      }
00472         //-----------------------------------------------
00473         //read texture coord  data 
00474         //-----------------------------------------------
00475          ExCVec2D Vec2D;
00476          stPtr = (stIndex_t*)&buffer[m_offsetTexCoords];
00477      for (i = 0; i < m_numTexCoords; i++)
00478      {
00479           Vec2D.SetX((float)stPtr[i].s / (float)m_skinWidth);
00480           Vec2D.SetY((float)stPtr[i].t / (float)m_skinHeight);
00481                   //logTextureCoord<<"vec :"<<Vec2D<<std::endl;
00482                   m_VecTexture.push_back(Vec2D);
00483      }
00484          
00485         //-----------------------------------------------
00486         //read triangles data 
00487         //-----------------------------------------------
00488         fseek(filePtr, m_offsetTriangles, SEEK_SET);
00489         short AB,BC,CA,TAB,TBC,TCA;
00490         ExCVec3D VertexNum,TexturNum;
00491 /*      std::ofstream logTri;
00492         logTri.open("logTri.txt",std::ios::out);
00493 */      
00494 
00495             
00496      // point to triangle indexes in buffer
00497     bufIndexPtr = (mesh_t*)&buffer[modelHeader->offsetTris]; 
00498         // create a mesh (triangle) list
00499      for (j = 0; j < m_numFrames; j++)         
00500      {
00501           // for all triangles in each frame
00502           for(i = 0; i < m_numTriangles; i++)
00503           {
00504                AB = bufIndexPtr[i].meshIndex[0];
00505                BC = bufIndexPtr[i].meshIndex[1];
00506                CA = bufIndexPtr[i].meshIndex[2];
00507                TAB = bufIndexPtr[i].stIndex[0];
00508                TBC = bufIndexPtr[i].stIndex[1];
00509                TCA = bufIndexPtr[i].stIndex[2];
00510                         
00511                         VertexNum.SetValue(AB,BC,CA);
00512                         TexturNum.SetValue(TAB,TBC,TCA);
00513                         std::pair<ExCVec3D,ExCVec3D> tmp(VertexNum,TexturNum);
00514                         m_VecTriangle.push_back(tmp);
00515                 //      logTri<<"AB:"<<AB<<" BC:"<<BC<<" CA:"<<CA<<std::endl;
00516                 //      logTri<<"TAB:"<<TAB<<" TBC:"<<TBC<<" TCA:"<<TCA<<std::endl;
00517           }
00518      }
00519 
00520          delete buffer;
00521          return true;
00522 UnGuard
00523 }

void Process std::string    Action
 

Reimplemented from ExCModel.

Definition at line 79 of file ExCModelMD2.cpp.

References Guard, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, ExCModel::m_CurrentAction, ExCObject3D::m_Position, ExCObject3D::m_speed, ExCObject3D::m_Target, and Process().

Referenced by Draw(), and Process().

00080 {
00081 Guard(void ExCModelMD2::Process(std::string Action))
00082         //function must be repeat each time a frame of action is called
00083         //std::cout<<"MD2 Process :"<<m_CurrentAction<<std::endl;
00084         if(m_CurrentAction=="RUN")
00085         {
00086                 //m_Position=m_Position+((m_Target-m_Position)*m_speed);
00087                 m_Position=m_Target*m_speed;
00088         }
00089         if(m_CurrentAction=="TURN_LEFT")
00090         {
00091                 m_AngleZ++;
00092         }
00093         if(m_CurrentAction=="TURN_RIGHT")
00094         {
00095                 m_AngleZ--;
00096         }
00097         if(m_CurrentAction=="LOOK_UP")
00098         {
00099                 m_AngleY++;
00100         }
00101         if(m_CurrentAction=="LOOK_DOWN")
00102         {
00103                 m_AngleY--;
00104         }
00105 UnGuard
00106 }

void StartAction std::string    Action [virtual]
 

Reimplemented from ExCModel.

Definition at line 108 of file ExCModelMD2.cpp.

References Guard, ExCModel::m_CurrentAction, ExCModel::m_CurrentFrames, ExCModel::m_KeyFrameStartAction, ExCModel::m_KeyFrameStopAction, and ExCModel::m_Transition.

Referenced by ExCModelMD2().

00109 {
00110 Guard(void ExCModelMD2::SStartAction(std::string         Action))
00111         m_CurrentAction=Action;
00112         if(m_CurrentAction=="RUN")
00113         {
00114                 m_KeyFrameStartAction=41;
00115                 m_KeyFrameStopAction=46;
00116         }
00117         if(m_CurrentAction=="ATTACK")
00118         {
00119                 m_KeyFrameStartAction=47;
00120                 m_KeyFrameStopAction=60;
00121         }       
00122         if(m_CurrentAction=="CROUCH")
00123         {
00124                 m_KeyFrameStartAction=136;
00125                 m_KeyFrameStopAction=154;
00126         }       
00127         if(m_CurrentAction=="JUMP")
00128         {
00129                 m_KeyFrameStartAction=67;
00130                 m_KeyFrameStopAction=72;
00131         }       
00132         if(m_CurrentAction=="IDLE")
00133         {
00134                 m_KeyFrameStartAction=1;
00135                 m_KeyFrameStopAction=39;
00136         }
00137         if(m_CurrentAction=="TEST")
00138         {
00139                 m_KeyFrameStartAction=113;
00140                 m_KeyFrameStopAction=125;
00141 
00142         }
00143         if(m_CurrentAction=="TURN_LEFT")
00144         {
00145                 m_KeyFrameStartAction=1;
00146                 m_KeyFrameStopAction=39;
00147     }
00148         if(m_CurrentAction=="TURN_RIGHT")
00149         {
00150                 m_KeyFrameStartAction=1;
00151                 m_KeyFrameStopAction=39;
00152         }
00153         if(m_CurrentAction=="LOOK_UP")
00154         {
00155                 m_KeyFrameStartAction=1;
00156                 m_KeyFrameStopAction=39;
00157     }
00158         if(m_CurrentAction=="LOOK_DOWN")
00159         {
00160                 m_KeyFrameStartAction=1;
00161                 m_KeyFrameStopAction=39;
00162         }
00163         if(m_CurrentAction=="FULL")
00164         {
00165                 m_KeyFrameStartAction=1;
00166                 m_KeyFrameStopAction=198;
00167         }       
00168         m_Transition=true;
00169         m_CurrentFrames=m_KeyFrameStartAction;
00170 UnGuard
00171 }

void StartRun void    [virtual]
 

Reimplemented from ExCModel.

Definition at line 63 of file ExCModelMD2.cpp.

References Guard, ExCModel::m_Transition, and StartRun().

Referenced by StartRun().

00064 {
00065 Guard(void ExCModelMD2::StartRun(void))
00066         //m_CurrentFrames=40;
00067         m_Transition=true;
00068 UnGuard
00069 }

void StopAction void    [virtual]
 

Reimplemented from ExCModel.

Definition at line 173 of file ExCModelMD2.cpp.

References Guard, ExCModel::m_CurrentFrames, ExCModel::m_Transition, and StopAction().

Referenced by StopAction().

00174 {
00175 Guard(void ExCModelMD2::StopAction(void))
00176         m_CurrentFrames=1;
00177         m_Transition=false;
00178 UnGuard
00179 }

void StopRun void    [virtual]
 

Reimplemented from ExCModel.

Definition at line 71 of file ExCModelMD2.cpp.

References Guard, ExCModel::m_CurrentFrames, ExCModel::m_Transition, and StopRun().

Referenced by StopRun().

00072 {
00073 Guard(void ExCModelMD2::StopRun(void))
00074         m_CurrentFrames=1;
00075         m_Transition=false;
00076 UnGuard
00077 }


Field Documentation

int m_frameSize [protected]
 

Definition at line 98 of file ExCModelMD2.h.

Referenced by Load().

int m_magic [protected]
 

Definition at line 94 of file ExCModelMD2.h.

Referenced by Load().

int m_numGlCommands [protected]
 

Definition at line 103 of file ExCModelMD2.h.

Referenced by Load().

int m_numSkins [protected]
 

Definition at line 99 of file ExCModelMD2.h.

Referenced by Load().

int m_numTexCoords [protected]
 

Definition at line 101 of file ExCModelMD2.h.

Referenced by Load().

int m_numTriangles [protected]
 

Definition at line 102 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

int m_numVertices [protected]
 

Definition at line 100 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

int m_offsetEnd [protected]
 

Definition at line 110 of file ExCModelMD2.h.

Referenced by Load().

int m_offsetFrames [protected]
 

Definition at line 108 of file ExCModelMD2.h.

Referenced by Load().

int m_offsetGlCommands [protected]
 

Definition at line 109 of file ExCModelMD2.h.

Referenced by Load().

int m_offsetSkins [protected]
 

Definition at line 105 of file ExCModelMD2.h.

Referenced by Load().

int m_offsetTexCoords [protected]
 

Definition at line 106 of file ExCModelMD2.h.

Referenced by Load().

int m_offsetTriangles [protected]
 

Definition at line 107 of file ExCModelMD2.h.

Referenced by Load().

std::string m_Skin [protected]
 

Definition at line 119 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

int m_skinHeight [protected]
 

Definition at line 97 of file ExCModelMD2.h.

Referenced by Load().

int m_skinWidth [protected]
 

Definition at line 96 of file ExCModelMD2.h.

Referenced by Load().

std::vector<std::string> m_VecSkin [protected]
 

Definition at line 115 of file ExCModelMD2.h.

Referenced by Load().

std::vector<ExCVec2D> m_VecTexture [protected]
 

Definition at line 116 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

std::vector< std::pair<ExCVec3D , ExCVec3D > > m_VecTriangle [protected]
 

Definition at line 117 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

std::vector<ExCVec3D> m_VecVertex [protected]
 

Definition at line 118 of file ExCModelMD2.h.

Referenced by Draw(), and Load().

int m_version [protected]
 

Definition at line 95 of file ExCModelMD2.h.

Referenced by Load().


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:24 2002 for ExNihilo by doxygen1.3-rc1