Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/lib/collision_detection


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/lib/collision_detection
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_detection/obb_tree.cc

    r8316 r9235  
    4141
    4242
     43/**
     44 *  standard constructor
     45 */
     46OBBTree::OBBTree()
     47  : BVTree()
     48{}
     49
    4350
    4451void OBBTree::init()
     
    7885
    7986  this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles);
     87}
     88
     89
     90void OBBTree::createBox(Vector start, Vector end)
     91{
     92  this->rootNode = new OBBTreeNode(*this, NULL, 1);
     93
     94  this->rootNode->createBox(start, end);
    8095}
    8196
  • trunk/src/lib/collision_detection/obb_tree.h

    r7711 r9235  
    2323  public:
    2424    OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity);
     25    OBBTree();
    2526    virtual ~OBBTree();
    2627    void init();
     
    2829    virtual void spawnBVTree(const modelInfo& modelInf);
    2930    virtual void flushTree();
     31
     32    void createBox(Vector start, Vector end);
    3033
    3134    virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2);
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r9008 r9235  
    9090    delete this->bvElement;
    9191}
     92
     93
     94
     95void OBBTreeNode::createBox(Vector start, Vector end)
     96{
     97
     98  this->bvElement = new OBB();
     99  this->nodeLeft = NULL;
     100  this->nodeRight = NULL;
     101//   this->depth = 0;
     102
     103  this->bvElement->center = (end - start) * 0.5f;
     104  this->bvElement->halfLength[0] = (end.x - start.x) * 0.5f;
     105  this->bvElement->halfLength[1] = (end.y - start.y) * 0.5f;
     106  this->bvElement->halfLength[2] = (end.z - start.z) * 0.5f;
     107
     108  this->bvElement->axis[0] = Vector(1,0,0);
     109  this->bvElement->axis[1] = Vector(0,1,0);
     110  this->bvElement->axis[2] = Vector(0,0,1);
     111}
     112
    92113
    93114
     
    561582bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)
    562583{
     584
    563585  //HACK remove this again
    564586  this->owner = nodeA;
     
    677699void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color,  bool top) const
    678700{
     701
    679702  /* this function can be used to draw the triangles and/or the points only  */
    680703  if( 1 /*drawMode & DRAW_MODEL || drawMode & DRAW_ALL*/)
     
    682705    if( depth == 0/*!(drawMode & DRAW_SINGLE && depth != 0)*/)
    683706    {
    684       if( 1 /*drawMode & DRAW_POINTS*/)
     707      if( 0 /*drawMode & DRAW_POINTS*/)
    685708      {
    686709        glBegin(GL_POINTS);
  • trunk/src/lib/collision_detection/obb_tree_node.h

    r7732 r9235  
    3131
    3232    virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length);
     33    void createBox(Vector start, Vector end);
    3334
    3435    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
     
    7980
    8081    WorldEntity*        owner;
     82
    8183};
    8284
Note: See TracChangeset for help on using the changeset viewer.