Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5717 in orxonox.OLD for branches/collision_detection/src/lib


Ignore:
Timestamp:
Nov 23, 2005, 12:31:47 AM (19 years ago)
Author:
patrick
Message:

collision_detection: work flush

Location:
branches/collision_detection/src/lib/collision_detection
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/bv_tree_node.h

    r5716 r5717  
    2626  virtual ~BVTreeNode();
    2727
     28  virtual const BoundingVolume* getBV() const = 0;
     29  inline const int getIndex() const { return this->treeIndex; }
     30
    2831  virtual void spawnBVTree(const sVec3D *verticesList, unsigned int length ) = 0;
    2932  virtual void spawnBVTree(const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;
    3033
    31   virtual const BoundingVolume* getBV() const = 0;
    32   inline const int getIndex() { return this->treeIndex; }
    33 
    34   virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) = 0;
     34  virtual void collideWith(const BVTreeNode& treeNode, const WorldEntity& nodeA, const WorldEntity& nodeB) const = 0;
    3535
    3636  virtual void drawBV(int depth, int drawMode, const Vector& color = Vector(1,0,0), bool top = true) const = 0;
  • branches/collision_detection/src/lib/collision_detection/cd_engine.cc

    r5716 r5717  
    1414*/
    1515
    16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_DETECTION
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION
    1717
    1818#include "cd_engine.h"
     
    7878void CDEngine::checkCollisionObjects()
    7979{
    80   BVTree* tree;
     80  const BVTree* tree;
    8181  tIterator<WorldEntity>* iterator1 = entityList->getIterator();
    8282  tIterator<WorldEntity>* iterator2 = entityList->getIterator();
     
    9494        if( likely(entity2 != this->terrain))
    9595        {
    96           PRINTF(4)("checking object %s against %s\n", entity1->getName(), entity2->getName());
     96          printf("checking object %s against %s\n", entity1->getName(), entity2->getName());
    9797          tree = entity1->getOBBTree();
    98           if( likely(tree != NULL) && entity2->getOBBTree() != NULL) tree->collideWith(entity1, entity2);
     98
     99          if( likely(tree != NULL) && entity2->getOBBTree() != NULL)
     100            //tree->collideWith(entity1, entity2);
     101            PRINTF(5)("Collision check\n");
    99102        }
    100103        entity2 = iterator2->nextElement();
  • branches/collision_detection/src/lib/collision_detection/obb_tree.cc

    r5716 r5717  
    8787    this->flushTree();
    8888  }
    89   OBBTreeNode* node = new OBBTreeNode(*this, depth);
    90   this->rootNode = node;
     89  this->rootNode = new OBBTreeNode(*this, depth-1);
    9190
    9291  /* triangles indexes created */
     
    9796  this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles);
    9897}
     98
     99
    99100
    100101
  • branches/collision_detection/src/lib/collision_detection/obb_tree.h

    r5716 r5717  
    3434    virtual void drawBV(int depth, int drawMode) const;
    3535
    36     int getID() { return ++this->id;}
    37     inline OBBTreeNode* getRootNode() { return this->rootNode; }
     36    const int getID() { return ++this->id;}
     37    inline const OBBTreeNode* getRootNode() const { return this->rootNode; }
    3838
    3939    void debug();
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5716 r5717  
    600600
    601601
    602 void OBBTreeNode::collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB)
     602void OBBTreeNode::collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) const
    603603{
    604604  PRINTF(3)("collideWith\n");
     
    645645
    646646
    647 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)
     647bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) const
    648648{
    649649  if( boxB == NULL || boxA == NULL)
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.h

    r5716 r5717  
    3434    virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    3535
    36     virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
     36    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) const;
    3737    virtual void drawBV(int depth, int drawMode, const Vector& color = Vector(1,0,0), bool top = true) const;
    3838    void debug() const;
     
    4848    void forkBox(OBB& box);
    4949
    50     bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB);
     50    bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) const;
    5151
    5252
Note: See TracChangeset for help on using the changeset viewer.