Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10314 in orxonox.OLD for trunk/src/lib/graphics/importer/bsp


Ignore:
Timestamp:
Jan 24, 2007, 12:45:39 AM (18 years ago)
Author:
patrick
Message:

merged branche mount_point to trunk. this will add mount point abilities, bsp transparency fix and some other smaller stuff to this trunk

Location:
trunk/src/lib/graphics/importer/bsp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/bsp/bsp_file.cc

    r10033 r10314  
    430430  char fileName [500];
    431431  char ext [500];
    432   struct stat results;
    433432
    434433
     
    660659  int      errorCode = 0;           //!< the error code for the texture loading functions
    661660  unsigned int   lightMap;          //!< the OpenGL texture handle
    662   int      mipmapLevel = 0;         //!< the maximum mipmap level for this texture
    663   int      mipmapWidth = 0;         //!< the width of the mipmap
    664   int      mipmapHight = 0;         //!< the height of the mipmap3
     661  //int      mipmapLevel = 0;         //!< the maximum mipmap level for this texture
     662  //int      mipmapWidth = 0;         //!< the width of the mipmap
     663  //int      mipmapHight = 0;         //!< the height of the mipmap3
    665664  float sc, scale, temp;
    666665  for(int i = 0; i < 128*128*3 ; i++)
     
    11011100  {
    11021101    int sto  =  array[0];
    1103     array[0] =  scale * array[1] ;
    1104     array[1] =  scale * array[2];
    1105     array[2] =  scale * sto ;
     1102    array[0] =  (int) scale * array[1] ;
     1103    array[1] =  (int) scale * array[2];
     1104    array[2] =  (int) scale * sto ;
    11061105  }
    11071106
  • trunk/src/lib/graphics/importer/bsp/bsp_manager.cc

    r10076 r10314  
    298298  }//else
    299299
     300
     301  // now sort the transparent faces in the right order
     302  int size = this->trasparent.size();
     303
     304  // bubble sort
     305  bool hasSwapped = true;
     306  Vector v1, v2;
     307
     308  while( hasSwapped)
     309  {
     310    hasSwapped = false;
     311
     312    for( int i = 0; i < size - 1; i++)
     313    {
     314      // sorting test
     315      face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
     316      face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
     317
     318      // get center of face 1
     319      const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
     320
     321      // assign the values of the vertices
     322      v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
     323      v2(curVertex[fac2.vertex].position[0], curVertex[fac2.vertex].position[1], curVertex[fac2.vertex].position[2]);
     324      // relativly to observer
     325      v1 = this->cam - v1;
     326      v2 = this->cam - v2;
     327
     328      // swap if necessary
     329      if( v1 > v2)
     330      {
     331        // swap elements
     332        int tmp = this->trasparent[i+1];
     333        this->trasparent[i+1] = this->trasparent[i];
     334        this->trasparent[i] = tmp;
     335
     336        hasSwapped = true;
     337      }
     338    }
     339  }
     340
     341
     342
     343  // draw all solid faces
    300344  while(!this->opal.empty()) {
    301     this->draw_face(this->opal.front());
    302     this->opal.pop_front();
    303   }
     345    this->draw_face(this->opal.back()); // front()
     346    this->opal.pop_back();              // pop_back()
     347  }
     348
     349  // draw all transparent faces
    304350  while(!this->trasparent.empty()) {
    305351    this->draw_face(this->trasparent.back());
  • trunk/src/lib/graphics/importer/bsp/bsp_manager.h

    r10033 r10314  
    128128  bool * alreadyVisible;
    129129  // Deques to store the visible faces
    130   ::std::deque<int> trasparent; //!< the ones with transparancy go here
    131   ::std::deque<int> opal; //!< the others here.
     130  ::std::vector<int> trasparent; //!< the ones with transparancy go here
     131  ::std::vector<int> opal; //!< the others here.
    132132
    133133  Vector out;  //!< Stores collision coordinates
Note: See TracChangeset for help on using the changeset viewer.