Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7805 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer


Ignore:
Timestamp:
May 24, 2006, 2:33:45 PM (19 years ago)
Author:
bottac
Message:

All Coordinates are now beeing converted from Q3A-Coods to OrxonoxCoords at loadtime.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/bsp_file.cc

    r7801 r7805  
    288288
    289289    PRINTF(0)("BSP FILE:NumberOfPatches: %i . \n", numPatches);
     290   
     291    this->swapAllBspCoordinates();
     292   
    290293    // Do tesselation for all Faces of type 2
    291294    for( int i = 0; i < this->numFaces; i++) {
     
    301304    return -1;
    302305  }
     306 
     307 
    303308
    304309}
     
    978983void BspFile::swapAllBspCoordinates()
    979984{
     985  for(int i = 0; i < this->numVertex ; ++i)
     986  {
     987    this->swapCoords(&((BspVertex *)this->vertice)[i].position[0]);
     988    this->swapCoords(&((BspVertex *)this->vertice)[i].normal[0]);
     989
     990   
     991  }
    980992 
    981 }
    982 
    983 void BspFile::swapCoords((int *) array)
    984 {
     993  for(int i = 0; i < this->numLeafs ; ++i)
     994  {
     995    this->swapCoords(this->leaves[i].mins);
     996    this->swapCoords(this->leaves[i].maxs);
    985997 
    986 }
    987 
    988 void BspFile::swapCoords((float *) array)
    989 {
     998  }
    990999 
    991 }
    992 
     1000  for(int i = 0; i < this->numPlanes; ++i)
     1001  {
     1002    float sto = this->planes[i].x;
     1003    this->planes[i].x = this->planes[i].y;
     1004    this->planes[i].y = this->planes[i].z;
     1005    this->planes[i].z = sto;
     1006  }
     1007
     1008   
     1009  for(int i = 0; i < this->numFaces; ++i)
     1010  {
     1011    this->swapCoords(this->faces[i].normal);
     1012  }
     1013 
     1014   
     1015 
     1016
     1017 
     1018}
     1019
     1020void BspFile::swapCoords(int *array)
     1021{
     1022  int sto  =  array[0];
     1023  array[0] =  array[1];
     1024  array[1] =  array[2];
     1025  array[2] =  sto;
     1026 
     1027}
     1028
     1029void BspFile::swapCoords(float * array)
     1030{
     1031  float sto  =  array[0];
     1032  array[0] =  array[1];
     1033  array[1] =  array[2];
     1034  array[2] =  sto;
     1035}
     1036
Note: See TracChangeset for help on using the changeset viewer.