Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7579 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
May 10, 2006, 11:35:10 PM (19 years ago)
Author:
bottac
Message:

I made it, finally!:-) . Larger .bsp-maps, with visibility ebabled run twice as fast now.

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  
    389389     //         Default Material
    390390      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);
    394394    //this->Materials[i]->setShininess(100.0);
    395395    this->Materials[i].mat->setTransparency(1.0);
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r7563 r7579  
    2424#include "camera.h"
    2525#include "vertex_array_model.h"
    26 
     26#include "world_entities/player.h"
     27#include "world_entities/playable.h"
    2728// STL Containers
    2829#include <vector>
     
    6465  for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false;
    6566  float tmp = 0;
    66   this->opal.clear();
    67   this->trasparent.clear();
     67  //this->opal.clear();
     68  //this->trasparent.clear();
    6869  // Find all visible faces...
    6970
    7071  this->cam = State::getCamera()->getAbsCoor() ;
    71   this->ship = State::getCameraTargetNode()->getAbsCoor();
     72  //this->ship = State::getCameraTargetNode()->getAbsCoor();
    7273
    7374
     
    7576
    7677 
    77   this->viewDir=    State::getCameraTarget()->getAbsCoor() -  State::getCamera()->getAbsCoor() ;
     78 // this->viewDir=    State::getCameraTarget()->getAbsCoor() -  State::getCamera()->getAbsCoor() ;
    7879  float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
    7980
     
    9091  this->outputFraction = 1.0f;
    9192 
    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);
    9394 
    9495  if(this->outputFraction != 1.0f || this->outputAllSolid ) this->drawDebugCube(&this->cam);
    9596
    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)
    9798  {
    9899   
     
    141142    } //for
    142143  } else {
    143     int cluster;
    144     int seven = 7;
    145     unsigned char  one = 1;
     144
     145 
    146146    unsigned int v;
    147147    unsigned char  visSet;
     
    152152      leaf& camLeaf =  (this->bspFile->leaves)[ActLeaf->leafIndex] ;
    153153      leaf& curLeaf =  (this->bspFile->leaves)[i] ;
    154       cluster =  curLeaf.cluster;
     154      int& cluster =  curLeaf.cluster;
    155155
    156156      if(cluster < 0) continue;
    157157      v = ((viscluster *  ( ((int *)this->bspFile->visData)[1]) ) + (cluster / 8));
    158       visSet =((unsigned char*) (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 ) {
    162162        // Iterate through all faces
    163163        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];
    166166
    167167          if (!this->isAlreadyVisible(f) && f>=0) {
     
    225225  }
    226226
    227   glColor4f(3.0,3.0,3.0,1.0);
     227 // glColor4f(3.0,3.0,3.0,1.0);
    228228  glEnableClientState(GL_VERTEX_ARRAY );
    229229  glEnableClientState(GL_TEXTURE_COORD_ARRAY );
     
    320320    glEnable(GL_TEXTURE_2D);
    321321  }
    322   glColor4f(3.0,3.0,3.0,1.0);
     322  //glColor4f(3.0,3.0,3.0,1.0);
    323323
    324324  //glEnable( GL_AUTO_NORMAL);
     
    383383    } else {
    384384      node = node->right;
    385 
    386385    }
    387386  }
     
    582581    leaf& camLeaf =  ((leaf *)(this->bspFile->leaves))[(node->leafIndex ) ];
    583582
    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                              }
    585589
    586590
Note: See TracChangeset for help on using the changeset viewer.