Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2005, 10:50:00 PM (19 years ago)
Author:
patrick
Message:

orxonox/branches/md2_model: flushing work state

File:
1 edited

Legend:

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

    r4226 r4227  
    532532{
    533533  FILE *pFile;                            //file stream
    534   tMd2Header header;
     534  //tMd2Header header;
    535535  char* buffer;                           //buffer for frame data
    536536  sFrame* frame;                          //temp frame
     
    544544      return false;
    545545    }
    546   fread(&header, 1, sizeof(tMd2Header), pFile);
     546  fread(header, 1, sizeof(tMd2Header), pFile);
    547547  /* check for the header version: make sure its a md2 file :) */
    548548  if( unlikely(header.version != MD2_VERSION) && unlikely(header.ident != MD2_IDENT))
     
    553553
    554554  /* got the data: map it to locals */
    555   this->numFrames = header.numFrames;
    556   this->numVertices = header.numVertices;
    557   this->numTriangles = header.numTriangles;
    558   this->numGLCommands = header.numGlCommands;
     555  this->numFrames = this->header->numFrames;
     556  this->numVertices = this->header->numVertices;
     557  this->numTriangles = this->header->numTriangles;
     558  this->numGLCommands = this->header->numGlCommands;
    559559  /* allocate memory for the data storage */
    560560  this->pVertices = new sVec3D[this->numVertices * this->numFrames];
    561561  this->pGLCommands = new int[this->numGLCommands];
    562562  this->pLightNormals = new int[this->numVertices * this->numFrames];
    563   buffer = new char[this->numFrames * header.frameSize];
     563  buffer = new char[this->numFrames * this->header->frameSize];
    564564
    565565  /* read frame data from the file to a temp buffer */
    566   fseek(pFile, header.offsetFrames, SEEK_SET);
    567   fread(buffer, header.frameSize, this->numFrames, pFile);
     566  fseek(pFile, this->header->offsetFrames, SEEK_SET);
     567  fread(buffer, this->header->frameSize, this->numFrames, pFile);
    568568  /* read opengl commands */
    569   fseek(pFile, header.offsetGlCommands, SEEK_SET);
     569  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
    570570  fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
    571571
     
    574574      /*
    575575      faster but evt. buggy
    576       frame = (sFrame*)(buffer + header.frameSize * i);
     576      frame = (sFrame*)(buffer + this->header->frameSize * i);
    577577      pVertex = this->pVertices + this->numVertices  * i;
    578578      pNormals = this->pLightNormals + this->numVertices * i;
    579579      */
    580       frame = (sFrame *)&buffer[header.frameSize * i];
     580      frame = (sFrame *)&buffer[this->header->frameSize * i];
    581581      pVertex = &this->pVertices[this->numVertices * i];
    582582      pNormals = &this->pLightNormals[this->numVertices * i];
     
    645645
    646646        //printf("  pVertices %f, %f, %f\n", pVertices[i][0], pVertices[i][1], pVertices[i][2]);
    647         //printf("  list:     %f, %f, %f \n", verticesList[i][0], verticesList[i][1], verticesList[i][2]);     
     647        printf("  list:     %f, %f, %f \n", verticesList[i][0], verticesList[i][1], verticesList[i][2]);     
    648648      }
    649649}
     
    792792}
    793793
     794
     795void MD2Model2::debug()
     796{
     797  PRINT(0)("==========================| MD2Model2::debug() |===");
     798  PRINT(0)("= Model Name: %s", this->);
     799  PRINT(0)(" Position:      %f/%f/%f\n", this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
     800  PRINT(0)(" DiffuseColor:  %f/%f/%f\n", this->diffuseColor[0], this->diffuseColor[1], this->diffuseColor[2]);
     801  PRINT(0)(" SpecularColor: %f/%f/%f\n", this->specularColor[0], this->specularColor[1], this->specularColor[2]);
     802  PRINT(0)(" Attenuation: constant=%f linear=%f quadratic=%f\n", this->constantAttenuation, this->linearAttenuation, this->quadraticAttenuation);
     803}
     804
     805
     806  int ident;                            //!< This is used to identify the file
     807   int version;                         //!< The version number of the file (Must be 8)
     808   
     809   int skinWidth;                       //!< The skin width in pixels
     810   int skinHeight;                      //!< The skin height in pixels
     811   int frameSize;                       //!< The size in bytes the frames are
     812   
     813   int numSkins;                        //!< The number of skins associated with the model
     814   int numVertices;                     //!< The number of vertices (constant for each frame)
     815   int numTexCoords;                    //!< The number of texture coordinates
     816   int numTriangles;                    //!< The number of faces (polygons)
     817   int numGlCommands;                   //!< The number of gl commands
     818   int numFrames;                       //!< The number of animation frames
     819   
     820   int offsetSkins;                     //!< The offset in the file for the skin data
     821   int offsetTexCoords;                 //!< The offset in the file for the texture data
     822   int offsetTriangles;                 //!< The offset in the file for the face data
     823   int offsetFrames;                    //!< The offset in the file for the frames data
     824   int offsetGlCommands;                //!< The offset in the file for the gl commands data
     825   int offsetEnd;                       //!< The end of the file offset
Note: See TracChangeset for help on using the changeset viewer.