Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10166 in orxonox.OLD for branches/mount_points


Ignore:
Timestamp:
Jan 3, 2007, 4:31:15 PM (18 years ago)
Author:
patrick
Message:

starting implementation of the transparancy sorting for bsp

Location:
branches/mount_points/src/lib/graphics/importer/bsp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/lib/graphics/importer/bsp/bsp_manager.cc

    r10076 r10166  
    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  while( hasSwapped)
     307  {
     308    hasSwapped = false;
     309    for( int i = 0; i < size - 1; i++)
     310    {
     311      // sorting test
     312      face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
     313      face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
     314
     315      if(1)
     316      {
     317        // swap elements
     318        int tmp = this->trasparent[i+1];
     319        this->trasparent[i+1] = this->trasparent[i];
     320        this->trasparent[i+1] = tmp;
     321
     322        hasSwapped = true;
     323      }
     324    }
     325  }
     326
     327//   function bubble_sort(list L, number listsize)
     328//       loop
     329//        has_swapped := 0 //reset flag
     330//        for number i from 1 to (listsize - 1)
     331//          if L[i] > L[i + 1] //if they are in the wrong order
     332//            swap(L[i], L[i + 1]) //exchange them
     333//            has_swapped := 1 //we have swapped at least once, list may not be sorted yet
     334//          endif
     335//       endfor
     336//         //if no swaps were made during this pass, the list has been sorted
     337//         if has_swapped = 0
     338//          exit
     339//         endif
     340//       endloop
     341//   endfunction
     342
     343
     344
     345  // draw all solid faces
    300346  while(!this->opal.empty()) {
    301     this->draw_face(this->opal.front());
    302     this->opal.pop_front();
    303   }
     347    this->draw_face(this->opal.back()); // front()
     348    this->opal.pop_back();              // pop_back()
     349  }
     350
     351  // draw all transparent faces
    304352  while(!this->trasparent.empty()) {
    305353    this->draw_face(this->trasparent.back());
  • branches/mount_points/src/lib/graphics/importer/bsp/bsp_manager.h

    r10033 r10166  
    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.