Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10174 in orxonox.OLD for branches/mount_points/src/lib/graphics


Ignore:
Timestamp:
Jan 3, 2007, 5:25:07 PM (18 years ago)
Author:
patrick
Message:

upgraded vector class to support some more actions, bubble sort algorithm almost finished

File:
1 edited

Legend:

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

    r10166 r10174  
    304304  // bubble sort
    305305  bool hasSwapped = true;
     306  Vector v1, v2;
     307
    306308  while( hasSwapped)
    307309  {
     
    313315      face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
    314316
    315       if(1)
     317      // get center of face 1
     318      const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
     319
     320      // assign the values of the vertices
     321      v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
     322      v2(curVertex[fac2.vertex].position[0], curVertex[fac2.vertex].position[1], curVertex[fac2.vertex].position[2]);
     323      // relativly to observer
     324      v1 = this->cam - v1;
     325      v2 = this->cam - v2;
     326
     327      // swap if necessary
     328      if( v1 < v2)
    316329      {
    317330        // swap elements
     
    324337    }
    325338  }
    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
    342339
    343340
Note: See TracChangeset for help on using the changeset viewer.