Changeset 7385 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- Apr 26, 2006, 4:37:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r7353 r7385 17 17 #include "bsp_file.h" 18 18 #include "bsp_manager.h" 19 #include "bsp_tree_ node.h"19 #include "bsp_tree_leaf.h" 20 20 #include "p_node.h" 21 21 #include "state.h" … … 23 23 #include "material.h" 24 24 #include "camera.h" 25 26 25 #include "vertex_array_model.h" 27 26 28 29 30 27 // STL Containers 28 #include <vector> 29 #include <deque> 31 30 32 31 … … 37 36 // open a BSP file 38 37 this->bspFile = new BspFile(); 39 this->bspFile->read(" Kanti175.bsp");38 this->bspFile->read("/root/data/Kanti175.bsp"); 40 39 this->bspFile->build_tree(); 41 40 this->root = this->bspFile->get_root(); … … 64 63 // erase alreadyVisible 65 64 for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false; 66 float tmp = 0; 65 float tmp = 0; 66 this->opal.clear(); 67 this->trasparent.clear(); 67 68 // Find all visible faces... 68 69 … … 110 111 this->alreadyVisible[i] = true; 111 112 } 112 else */ draw_face(f); // "visibleFaces.append(f)"113 else */addFace(f); // "visibleFaces.append(f)" 113 114 } 114 115 } … … 150 151 if (!this->isAlreadyVisible(f) && f>=0) 151 152 { 152 this-> draw_face(f);153 this->addFace(f); 153 154 this->alreadyVisible[f] = true; 154 155 } … … 161 162 162 163 }//else 164 165 while(!this->opal.empty()) 166 { 167 this->draw_face(this->opal.front()); 168 this->opal.pop_front(); 169 } 170 while(!this->trasparent.empty()) 171 { 172 this->draw_face(this->trasparent.back()); 173 this->trasparent.pop_back(); 174 } 163 175 164 176 … … 190 202 if(this->lastTex != curFace.texture) 191 203 { 192 this->bspFile->Materials[curFace.texture] ->select();204 this->bspFile->Materials[curFace.texture].mat->select(); 193 205 this->lastTex = curFace.texture; 194 206 } … … 239 251 // if(this->bspFile->Materials[curFace.texture] != NULL) 240 252 241 this->bspFile->Materials[2] ->select();253 this->bspFile->Materials[2].mat->select(); 242 254 this->lastTex = 2; 243 255 … … 266 278 if(this->lastTex != Face->texture) 267 279 { 268 this->bspFile->Materials[Face->texture] ->select();280 this->bspFile->Materials[Face->texture].mat->select(); 269 281 this->lastTex = Face->texture; 270 282 } … … 331 343 { 332 344 dist = (node->plane.x * this->cam.x + node->plane.y*this->cam.y + node->plane.z*this->cam.z) - node->d; 333 if(dist > 1.0f)345 if(dist > 4.0f) 334 346 { 335 347 checkCollision(node->left,cam); 336 348 return; 337 349 } 338 if(dist < - 1.0f)350 if(dist < -4.0f) 339 351 { 340 352 checkCollision(node->right,cam); 341 353 return; 342 354 } 343 if(dist<= 1.0f && dist >= -1.0f)355 if(dist<=4.0f && dist >= -4.0f) 344 356 { 345 357 checkCollision(node->left,cam); … … 357 369 358 370 359 371 /* 360 372 for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ ) 361 373 { … … 376 388 } 377 389 378 } 390 } */ 379 391 380 392 } … … 454 466 glTexCoord2f(0.005f, 0.995f); glVertex3f(cam->x-1.0f, cam->y+ 1.0f, cam->z -1.0f); 455 467 456 457 458 glEnd(); 459 } 468 glEnd(); 469 } 470 471 void BspManager::addFace(int f) 472 { 473 face& curFace = ((face *)(this->bspFile->faces))[f]; 474 if(this->bspFile->Materials[curFace.texture].alpha) this->trasparent.push_back(f); 475 else this->opal.push_back(f); 476 }
Note: See TracChangeset
for help on using the changeset viewer.