Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2006, 6:41:08 PM (19 years ago)
Author:
bottac
Message:

collision detection.

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

Legend:

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

    r6316 r7833  
    2929#include "quadtree_node.h"
    3030
    31 
     31#include "bsp_manager.h"
    3232
    3333using namespace std;
     
    137137 *  this checks the collisions with the ground
    138138 */
    139 void CDEngine::checkCollisionGround()
     139void CDEngine::checkCollisionGround(std::list<WorldEntity*>& list1)
    140140{
    141141  if( likely( this->terrain != NULL))
    142142  {
    143143    Quadtree* q = dynamic_cast<Terrain*>(this->terrain)->ssp->getQuadtree();
    144 
    145144//    QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
    146145  }
    147   //sTriangleExt* tri = q->getTriangleFromPosition(this->player->getAbsCoor());
     146 
     147  if( likely( this->bspManager != NULL))
     148  {
     149    std::list<WorldEntity*>::iterator iterator;
     150    PRINTF(3)("checking for collisions\n");
     151
     152    iterator = list1.begin();
     153    while (iterator != list1.end())
     154    {
     155      bspManager->checkCollision(*iterator);
     156      iterator++;
     157    }
     158  }
    148159}
    149160
  • branches/bsp_model/src/lib/collision_detection/cd_engine.h

    r6316 r7833  
    1717class OBBTree;
    1818class Terrain;
     19class BspManager;
    1920//class Player;
    2021
     
    5051
    5152  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
     53  inline void setBSPModel(BspManager* bspManager) { this->bspManager = bspManager; }
    5254  //  inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
    5355
     
    5658//  void checkCollisions();
    5759  void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2);
    58 
     60  void checkCollisionGround(std::list<WorldEntity*>& list1);
     61 
    5962  void drawBV(const std::list<WorldEntity*>& drawList ) const;
    6063  void debug();
     
    6871
    6972  void checkCollisionObjects();
    70   void checkCollisionGround();
     73
    7174
    7275  void debugSpawnTree(int depth, sVec3D* vertices, int numVertices);
     
    7982
    8083  Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
     84  BspManager*             bspManager;
    8185//  Player*                 player;
    8286};
Note: See TracChangeset for help on using the changeset viewer.