Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9140 in orxonox.OLD for branches/terrain/src/lib/collision_detection


Ignore:
Timestamp:
Jul 4, 2006, 3:06:00 PM (18 years ago)
Author:
bensch
Message:

merged back

Location:
branches/terrain/src/lib/collision_detection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/terrain/src/lib/collision_detection/cd_engine.cc

    r9110 r9140  
    2424#include "model.h"
    2525#include "world_entity.h"
    26 #include "terrain.h"
     26#include "terrain_entity.h"
    2727// #include "player.h"
    2828
     
    4545
    4646  this->bAbordOnFirstCollision = false;
    47  
     47
    4848  this->terrain = NULL;
    4949}
     
    106106  std::list<WorldEntity*>::iterator entityIterator;
    107107  const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY);
    108   if( bspList == NULL)
    109     return;
     108  if( bspList != NULL)
     109  {
    110110
    111   // for all bsp managers check all entities
    112   for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
     111    // for all bsp managers check all entities
     112    for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++)
     113    {
    113114      for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
    114115      {
    115 //         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
     116        //               PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
    116117        (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
    117118      }
     119    }
    118120  }
     121
     122  /// COLLISION OF THE Modular-TERRAIN
     123/*  const std::list<BaseObject*>* tl = ClassList::getList( CL_TERRAIN );
     124  std::list<BaseObject*>::const_iterator ti;
     125  if ( tl == NULL )
     126    return;
     127  float offset = 8.0f;
     128  for ( ti = tl->begin(); ti != tl->end(); ++ti )
     129  {
     130    TerrainEntity* terrain = dynamic_cast<TerrainEntity*>( *ti );
     131    for( entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++ )
     132    {
     133      Vector pos( (*entityIterator)->getAbsCoor() );
     134      Vector normal;
     135      float height = pos.y;
     136      terrain->getAltitude( pos, normal );
     137      if ( height-offset < pos.y )
     138      {
     139        ( *entityIterator )->registerCollision(
     140          *entityIterator, terrain, pos, normal );
     141      }
     142    }
     143  }*/
    119144}
    120145
     
    138163void CDEngine::debugSpawnTree(int depth, sVec3D* vertices, int numVertices)
    139164{
    140 //   if ( this->rootTree == NULL)
    141 //     this->rootTree = new OBBTree(depth, vertices, numVertices);
     165  //   if ( this->rootTree == NULL)
     166  //     this->rootTree = new OBBTree(depth, vertices, numVertices);
    142167}
    143168
     
    156181void CDEngine::debugDraw(int depth, int drawMode)
    157182{
    158 //   if(this-> rootTree != NULL)
    159 //     this->rootTree->drawBV(depth, drawMode);
     183  //   if(this-> rootTree != NULL)
     184  //     this->rootTree->drawBV(depth, drawMode);
    160185}
  • branches/terrain/src/lib/collision_detection/cd_engine.h

    r8186 r9140  
    1616class WorldEntity;
    1717class OBBTree;
    18 class Terrain;
     18class TerrainEntity;
    1919class BspManager;
    2020//class Player;
     
    5050  inline void disable(const int options) { int temp = this->state & options; this->state ^= temp; }
    5151
    52   inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
     52  inline void setTerrain( TerrainEntity* terrain) { this->terrain = terrain; }
    5353  inline void setBSPModel(BspManager* bspManager) { this->bspManager = bspManager; }
    5454
     
    8383  OBBTree*                rootTree;                         //!< for testing purposes a root tree
    8484
    85   Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
     85  TerrainEntity*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
    8686  BspManager*             bspManager;
    8787};
Note: See TracChangeset for help on using the changeset viewer.