Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2006, 5:10:54 PM (18 years ago)
Author:
bensch
Message:

merges some merges

File:
1 copied

Legend:

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

    r8083 r8087  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
    13    
     13
    1414   Inspired by:
    1515   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    1616   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
    17    
     17
    1818   Collision detection adapted from:
    1919   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
     
    6060  */
    6161  CDEngine::getInstance()->setBSPModel(this);
    62  
    63  
    64  
    6562}
    6663
     
    7067{
    7168
    72  
     69
    7370  if( root != NULL)
    7471    this->loadParams(root);
    75  
     72
    7673  CDEngine::getInstance()->setBSPModel(this);
    7774} */
     
    117114  this->out1.y += this->collPlane->y*5.0;
    118115  this->out1.z += this->collPlane->z*5.0;
    119  
     116
    120117  this->out2.x += this->collPlane->x*10.0;
    121118  this->out2.y += this->collPlane->y*10.0;
     
    124121  this->drawDebugCube(&this->out1);
    125122  this->drawDebugCube(&this->out2);
    126   */ 
     123  */
    127124  // Draw Debug Terrain
    128125  /*
    129   this->bspFile->Materials[0]->select(); 
     126  this->bspFile->Materials[0]->select();
    130127  for(int i = 0; i <  this->bspFile->numPatches ; i++)
    131         {
    132                 this->bspFile->VertexArrayModels[i]->draw();
    133    
    134         }
     128        {
     129                this->bspFile->VertexArrayModels[i]->draw();
     130
     131        }
    135132  */
    136133
     
    283280  glActiveTextureARB(GL_TEXTURE1_ARB);
    284281  glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap);
    285  
    286  
     282
     283
    287284
    288285}//draw
     
    540537      // don't store plane
    541538      // this->collPlane = &curPlane;
    542      
     539
    543540    } else {   // line is leaving the brush
    544541      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    547544      // don't store plane
    548545      //this->collPlane = & curPlane;
    549      
     546
    550547    }
    551548
     
    562559      if (startFraction < 0)
    563560        startFraction = 0;
    564       this->outputFraction = startFraction; 
     561      this->outputFraction = startFraction;
    565562    }
    566563  }
     
    609606      // store plane
    610607      this->collPlane = &curPlane;
    611      
     608
    612609    } else {   // line is leaving the brush
    613610      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
     
    616613      // store plane
    617614      this->collPlane = & curPlane;
    618      
     615
    619616    }
    620617
     
    631628      if (startFraction < 0)
    632629        startFraction = 0;
    633       this->outputFraction = startFraction; 
     630      this->outputFraction = startFraction;
    634631    }
    635632  }
     
    831828{
    832829  return;
    833  
     830
    834831  Vector position = worldEntity->getAbsCoor();
    835832
     
    839836  forwardDir.y =2.0*forwardDir.y;
    840837  forwardDir.z =2.0*forwardDir.z;
    841  
     838
    842839  Vector upDir = worldEntity->getAbsDirY();
    843840  Vector dest = position;
     
    847844  Vector out = Vector(-1875.0,-1875.0,-1875.0);
    848845  if(!worldEntity->isA(CL_PLAYABLE)) {
    849    
    850    
    851    
    852  
     846
     847
     848
     849
    853850  }
    854851  else {
     
    882879
    883880    }
    884    
     881
    885882    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    886883    if(this->outputFraction == 1.0f) out = dest;
     
    891888    out.y = position.y + (dest.y -position.y) * this->outputFraction;
    892889    out.z = position.z + (dest.z -position.z) * this->outputFraction;
    893    
     890
    894891    //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
    895892    //this->out = out;
     
    898895    //this->drawDebugCube(&out1);
    899896    //this->drawDebugCube(&out2);
    900    
     897
    901898    //this->drawDebugCube(&out3);
    902  
    903     }
    904    
     899
     900    }
     901
    905902    // Return the normal here: Normal's stored in this->collPlane;
    906903    if(collision) worldEntity->collidesWithGround(out,out1,out2);
    907  
     904
    908905  }
    909906
     
    947944
    948945    /*
    949         for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
    950         {
    951                 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
    952                 if(curBrush.n_brushsides < 0) return;
    953                 for(int j = 0; j < curBrush.n_brushsides; j++)
    954                 {
    955                 float dist = -0.1;
    956                 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
    957                 plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
    958                 dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
    959                
    960                 if(dist < -0.01f) dist = -1.0f *dist;
    961                 if(dist < 1.0f){
    962                                 this->drawDebugCube(&this->cam);
    963                                 return;
    964                               }
    965                 }
    966                        
    967         } */
     946        for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
     947        {
     948                brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
     949                if(curBrush.n_brushsides < 0) return;
     950                for(int j = 0; j < curBrush.n_brushsides; j++)
     951                {
     952                float dist = -0.1;
     953                brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
     954                plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
     955                dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
     956
     957                if(dist < -0.01f) dist = -1.0f *dist;
     958                if(dist < 1.0f){
     959                                this->drawDebugCube(&this->cam);
     960                                return;
     961                              }
     962                }
     963
     964        } */
    968965
    969966  }
Note: See TracChangeset for help on using the changeset viewer.