Changeset 10314 in orxonox.OLD for trunk/src/lib/graphics/importer/bsp/bsp_manager.cc
- Timestamp:
- Jan 24, 2007, 12:45:39 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/bsp/bsp_manager.cc
r10076 r10314 298 298 }//else 299 299 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 300 344 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 304 350 while(!this->trasparent.empty()) { 305 351 this->draw_face(this->trasparent.back());
Note: See TracChangeset
for help on using the changeset viewer.