Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4787 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jul 5, 2005, 2:06:19 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: changes on the md2model - now it loads also the triangle information, but not used yet

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/abstract_model.h

    r4550 r4787  
    6868typedef struct
    6969{
    70   short            indexToVertices[3];   //!< index to the verteces of the triangle
    71   short            indexToTexCoor[3];    //!< index to the texture coordinates
     70  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
     71  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
    7272} sTriangle;
    7373
  • orxonox/trunk/src/lib/graphics/importer/md2Model.cc

    r4717 r4787  
    8282  /* this creates the data container via ressource manager */
    8383  this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, (void*)skinFileName);
     84  if( unlikely(this->data == NULL))
     85    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
     86 
    8487  this->scaleFactor = this->data->scaleFactor;
    85 
    8688  this->setAnim(BOOM);
    8789}
     
    355357  this->pGLCommands = new int[this->numGLCommands];
    356358  this->pLightNormals = new int[this->numVertices * this->numFrames];
     359  this->pTriangles = new sTriangle[this->numTriangles];
    357360  buffer = new char[this->numFrames * this->header->frameSize];
     361
     362  /*
     363  TriangleList = new stTriangleIndice[md2Header.numTriangles];
     364
     365  // Next extract the data by moving to the spot in the data where the triangle data start.
     366  stTriangleIndice *pTriList;
     367
     368  // Get the data.
     369  pTriList = (stTriangleIndice*)&buffer[md2Header.offsetTriangles];
     370
     371  // Now we pretty much store the data in our TriangleList object.
     372  for(i = 0; i < md2Header.numTriangles; i++)
     373    {
     374      TriangleList[i].triIndex[0] = pTriList[i].triIndex[0];
     375      TriangleList[i].triIndex[1] = pTriList[i].triIndex[1];
     376      TriangleList[i].triIndex[2] = pTriList[i].triIndex[2];
     377      TriangleList[i].texCoordIndex[0] = pTriList[i].texCoordIndex[0];
     378      TriangleList[i].texCoordIndex[1] = pTriList[i].texCoordIndex[1];
     379      TriangleList[i].texCoordIndex[2] = pTriList[i].texCoordIndex[2];
     380    }
     381  */
     382
     383 
     384
    358385
    359386  /* read frame data from the file to a temp buffer */
     
    363390  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
    364391  fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
     392  /* triangle list */
     393  fseek(pFile, this->header->offsetTriangles, SEEK_SET);
     394  fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);
    365395
    366396  for(int i = 0; i < this->numFrames; ++i)
  • orxonox/trunk/src/lib/graphics/importer/md2Model.h

    r4615 r4787  
    122122
    123123  sVec3D*            pVertices;             //!< pointer to the vertices data block
     124  sTriangle*         pTriangles;            //!< pointer to the triangles data
    124125  int*               pGLCommands;           //!< pointer to the gllist data block
    125126  int*               pLightNormals;         //!< pointer to the light normals
  • orxonox/trunk/src/world_entities/test_entity.cc

    r4762 r4787  
    3232
    3333//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
    34   this->md2Model = new MD2Model("models/ogro.md2", "maps/ogro.pcx");
     34  this->md2Model = new MD2Model("models/tris.md2", "maps/tris.pcx");
    3535  this->obbTree = new OBBTree(15, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
    3636
Note: See TracChangeset for help on using the changeset viewer.