Changeset 7579 in orxonox.OLD for branches/bsp_model
- Timestamp:
- May 10, 2006, 11:35:10 PM (19 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_file.cc
r7544 r7579 389 389 // Default Material 390 390 this->Materials[i].mat = new Material(); 391 this->Materials[i].mat->setDiffuse(0.1,0.1, 0.1);392 this->Materials[i].mat->setAmbient(0.1,0.1, 0.1);393 this->Materials[i].mat->setSpecular(0.4,0.4, 0.4);391 this->Materials[i].mat->setDiffuse(0.1,0.1,1.0); 392 this->Materials[i].mat->setAmbient(0.1,0.1,1.0 ); 393 this->Materials[i].mat->setSpecular(0.4,0.4,1.0); 394 394 //this->Materials[i]->setShininess(100.0); 395 395 this->Materials[i].mat->setTransparency(1.0); -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r7563 r7579 24 24 #include "camera.h" 25 25 #include "vertex_array_model.h" 26 26 #include "world_entities/player.h" 27 #include "world_entities/playable.h" 27 28 // STL Containers 28 29 #include <vector> … … 64 65 for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false; 65 66 float tmp = 0; 66 this->opal.clear();67 this->trasparent.clear();67 //this->opal.clear(); 68 //this->trasparent.clear(); 68 69 // Find all visible faces... 69 70 70 71 this->cam = State::getCamera()->getAbsCoor() ; 71 this->ship = State::getCameraTargetNode()->getAbsCoor();72 //this->ship = State::getCameraTargetNode()->getAbsCoor(); 72 73 73 74 … … 75 76 76 77 77 this->viewDir= State::getCameraTarget()->getAbsCoor() - State::getCamera()->getAbsCoor() ;78 // this->viewDir= State::getCameraTarget()->getAbsCoor() - State::getCamera()->getAbsCoor() ; 78 79 float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z); 79 80 … … 90 91 this->outputFraction = 1.0f; 91 92 92 this->checkCollisionRay(this->root,0.0f,1.0f, &(State::getCameraTargetNode()->getLastAbsCoor()), &this->cam);93 //this->checkCollisionRay(this->root,0.0f,1.0f, &(State::getCameraTargetNode()->getLastAbsCoor()), &this->cam); 93 94 94 95 if(this->outputFraction != 1.0f || this->outputAllSolid ) this->drawDebugCube(&this->cam); 95 96 96 if ( true|| (((int *)(this->bspFile->header))[35] == 0 ) || viscluster < 0) //!< if (sizeof(Visdata) == 0)97 if (false || viscluster < 0 ) // || (((int *)(this->bspFile->header))[35] == 0 ) || viscluster < 0) //!< if (sizeof(Visdata) == 0) 97 98 { 98 99 … … 141 142 } //for 142 143 } else { 143 int cluster; 144 int seven = 7; 145 unsigned char one = 1; 144 145 146 146 unsigned int v; 147 147 unsigned char visSet; … … 152 152 leaf& camLeaf = (this->bspFile->leaves)[ActLeaf->leafIndex] ; 153 153 leaf& curLeaf = (this->bspFile->leaves)[i] ; 154 cluster = curLeaf.cluster;154 int& cluster = curLeaf.cluster; 155 155 156 156 if(cluster < 0) continue; 157 157 v = ((viscluster * ( ((int *)this->bspFile->visData)[1]) ) + (cluster / 8)); 158 visSet =(( unsignedchar*) (this->bspFile->visData))[v + 8];159 160 161 if( !((visSet) & ((unsigned char)1 <<(unsigned char) (cluster & 7)))) {158 visSet =((char*) (this->bspFile->visData))[v + 8]; 159 160 // gets bit of visSet 161 if( ((visSet) & (1 << (cluster & 7))) != 0 ) { 162 162 // Iterate through all faces 163 163 for (int j = 0; j < curLeaf.n_leaffaces ; ++j) { 164 const int f = (j + curLeaf.leafface) % this->bspFile->numFaces;165 164 const int g = (j + curLeaf.leafface); 165 const int f = ((int *)this->bspFile->leafFaces)[g]; 166 166 167 167 if (!this->isAlreadyVisible(f) && f>=0) { … … 225 225 } 226 226 227 glColor4f(3.0,3.0,3.0,1.0);227 // glColor4f(3.0,3.0,3.0,1.0); 228 228 glEnableClientState(GL_VERTEX_ARRAY ); 229 229 glEnableClientState(GL_TEXTURE_COORD_ARRAY ); … … 320 320 glEnable(GL_TEXTURE_2D); 321 321 } 322 glColor4f(3.0,3.0,3.0,1.0);322 //glColor4f(3.0,3.0,3.0,1.0); 323 323 324 324 //glEnable( GL_AUTO_NORMAL); … … 383 383 } else { 384 384 node = node->right; 385 386 385 } 387 386 } … … 582 581 leaf& camLeaf = ((leaf *)(this->bspFile->leaves))[(node->leafIndex ) ]; 583 582 584 if (camLeaf.cluster < 0) {this->drawDebugCube(&this->cam); this->drawDebugCube(&next);} 583 if (camLeaf.cluster < 0) { 584 this->drawDebugCube(&this->cam); 585 this->drawDebugCube(&next); 586 State::getPlayer()->getPlayable()->setRelCoor(-100,-100,-100); 587 State::getPlayer()->getPlayable()->collidesWith(NULL, State::getCameraTargetNode()->getLastAbsCoor()); 588 } 585 589 586 590
Note: See TracChangeset
for help on using the changeset viewer.