Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4147 in orxonox.OLD for orxonox/branches/md2_loader/src/lib


Ignore:
Timestamp:
May 10, 2005, 5:27:40 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: some debug information outpur, code beautifullizer

Location:
orxonox/branches/md2_loader/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc

    r4146 r4147  
    6363      for(int whichVertex = 0; whichVertex < 3; whichVertex++)
    6464        {
     65          printf("now drawing vertex %i of face nr: %i\n", whichVertex, j);
    6566          int index = pObject->pFaces[j].vertIndex[whichVertex];
    6667          int index2 = pObject->pFaces[j].coordIndex[whichVertex];
     68          printf("using index: %i, %i\n", index, index2);
    6769          /* we invert the normals since the md2 file format uses different style */
    68           glNormal3f(-pObject->pNormals[ index ].x, -pObject->pNormals[ index ].y, -pObject->pNormals[ index ].z);
    69           if(pObject->pTexVerts)
     70          glNormal3f(-pObject->pNormals[index].x, -pObject->pNormals[index].y, -pObject->pNormals[index].z);
     71
     72          if( pObject->pTexVerts)
    7073            {
    7174              glTexCoord2f(pObject->pTexVerts[ index2 ].x, pObject->pTexVerts[ index2 ].y);
     
    166169  /* reading all frame data */
    167170  fseek(this->pFile, this->header.offsetFrames, SEEK_SET);
    168   for(int i = 0; i < this->header.numFrames; i++)
     171  for( int i = 0; i < this->header.numFrames; i++)
    169172    {
    170173      tMd2AliasFrame *pFrame = (tMd2AliasFrame *) buffer;
     
    179182         and negate z axis
    180183      */
    181       for(int j = 0; j < this->header.numVertices; j++)
     184      for( int j = 0; j < this->header.numVertices; j++)
    182185        {
    183186          pVertices[j].vertex[0] = pFrame->aliasVertices[j].vertex[0] * pFrame->scale[0] + pFrame->translate[0];
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4138 r4147  
    1212        512 frames. The maximal vetices count is set to 2048 verteces, not enough?
    1313        You just have to change the MD2_MAX_* values if it doesn't fit your purposes...
     14
     15        Surface Culling is fully implemented in md2 models: quake2 uses front face culling.
    1416*/
    1517
     
    3638struct tMd2Header
    3739{
    38    int ident;                                   //!< This is used to identify the file
    39    int version;                                 //!< The version number of the file (Must be 8)
     40   int ident;                           //!< This is used to identify the file
     41   int version;                         //!< The version number of the file (Must be 8)
     42   
     43   int skinWidth;                       //!< The skin width in pixels
     44   int skinHeight;                      //!< The skin height in pixels
     45   int frameSize;                       //!< The size in bytes the frames are
    4046   
    41    int skinWidth;                               //!< The skin width in pixels
    42    int skinHeight;                              //!< The skin height in pixels
    43    int frameSize;                               //!< The size in bytes the frames are
    44    
    45    int numSkins;                                //!< The number of skins associated with the model
    46    int numVertices;                             //!< The number of vertices (constant for each frame)
     47   int numSkins;                        //!< The number of skins associated with the model
     48   int numVertices;                     //!< The number of vertices (constant for each frame)
    4749   int numTexCoords;                    //!< The number of texture coordinates
    4850   int numTriangles;                    //!< The number of faces (polygons)
    4951   int numGlCommands;                   //!< The number of gl commands
    50    int numFrames;                               //!< The number of animation frames
     52   int numFrames;                       //!< The number of animation frames
    5153   
    52    int offsetSkins;                             //!< The offset in the file for the skin data
     54   int offsetSkins;                     //!< The offset in the file for the skin data
    5355   int offsetTexCoords;                 //!< The offset in the file for the texture data
    5456   int offsetTriangles;                 //!< The offset in the file for the face data
    5557   int offsetFrames;                    //!< The offset in the file for the frames data
    5658   int offsetGlCommands;                //!< The offset in the file for the gl commands data
    57    int offsetEnd;                               //!< The end of the file offset
     59   int offsetEnd;                       //!< The end of the file offset
    5860};
    5961
     
    147149 
    148150  FILE *pFile; 
    149   tMd2Header header;                                        //!< The header data
    150   tMd2Skin *pSkins;                                             //!< The skin data
    151   tMd2TexCoord *pTexCoords;                             //!< The texture coordinates
    152   tMd2Face *pTriangles;                                 //!< Face index information
    153   tMd2Frame *pFrames;                                       //!< The frames of animation (vertices)
     151  tMd2Header header;                          //!< The header data
     152  tMd2Skin *pSkins;                           //!< The skin data
     153  tMd2TexCoord *pTexCoords;                   //!< The texture coordinates
     154  tMd2Face *pTriangles;                       //!< Face index information
     155  tMd2Frame *pFrames;                         //!< The frames of animation (vertices)
    154156};
    155157
Note: See TracChangeset for help on using the changeset viewer.