Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4695 in orxonox.OLD


Ignore:
Timestamp:
Jun 24, 2005, 11:15:12 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: no only the overlap test is missing

Location:
orxonox/trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/bv_tree.h

    r4635 r4695  
    1414// FORWARD DEFINITION
    1515class BoundingVolume;
     16class BVTreeNode;
    1617
    1718typedef enum DrawMode
     
    3839  virtual void flushTree() = NULL;
    3940
     41  virtual void collideWith(BVTree* tree) = NULL;
     42
    4043  virtual void drawBV(int depth, int drawMode) const = NULL;
     44
    4145
    4246 protected:
  • orxonox/trunk/src/lib/collision_detection/bv_tree_node.h

    r4635 r4695  
    2929  inline const int getIndex() { return this->treeIndex; }
    3030
    31   virtual void collideWith(const BVTree &tree) = NULL;
     31  virtual void collideWith(BVTreeNode* treeNode) = NULL;
    3232
    3333  virtual void drawBV(int depth, int drawMode) const = NULL;
  • orxonox/trunk/src/lib/collision_detection/cd_engine.cc

    r4694 r4695  
    5454
    5555
     56/**
     57  \brief this is the collision checking function
     58
     59  there are some speed improvements that can be done here. a rewrite of the list a would be appropriate to
     60  be able to enhance iteration speed.
     61 */
    5662void CDEngine::checkCollisions()
    5763{
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4682 r4695  
    103103
    104104
    105 void OBBTree::collideWith(const OBBTree &tree)
    106 {}
     105void OBBTree::collideWith(BVTree* tree)
     106{
     107  //this->rootNode->collideWith(tree->);
     108}
    107109
    108110
  • orxonox/trunk/src/lib/collision_detection/obb_tree.h

    r4682 r4695  
    2727    virtual void flushTree();
    2828
    29     void collideWith(const OBBTree &tree);
     29    virtual void collideWith(BVTree* tree);
    3030
    3131    virtual void drawBV(int depth, int drawMode) const;
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4688 r4695  
    530530  tList<sVec3D>      partition2;                           //!< the vertex partition 2
    531531
    532   printf("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices);
     532  PRINTF(3)("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices);
    533533  this->separationPlane = new Plane(box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
    534534  this->sepPlaneCenter = &box->vertices[vertexIndex];
     
    604604
    605605
    606 void OBBTreeNode::collideWith(const BVTree &tree)
    607 {}
    608 
    609 
     606void OBBTreeNode::collideWith(BVTreeNode* treeNode)
     607{
     608  /* if the obb overlap, make subtests: check which node is realy overlaping  */
     609  if( this->overlapTest(this->bvElement, ((OBBTreeNode*)treeNode)->bvElement))
     610  {
     611    /* check if left node overlaps */
     612    if( unlikely( this->nodeLeft != NULL))
     613      if( this->overlapTest(this->nodeLeft->bvElement, ((OBBTreeNode*)treeNode)->bvElement))
     614        this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeLeft);
     615    /* check if right node overlaps */
     616    if( unlikely( this->nodeRight != NULL))
     617      if(this->overlapTest(this->nodeRight->bvElement, ((OBBTreeNode*)treeNode)->bvElement))
     618        this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight);
     619  }
     620}
     621
     622
     623
     624bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB)
     625{
     626
     627}
    610628
    611629
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4685 r4695  
    3333    inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;}
    3434
    35     virtual void collideWith(const BVTree &tree);
     35    virtual void collideWith(BVTreeNode* treeNode);
    3636
    3737    virtual void drawBV(int depth, int drawMode) const;
     
    4545    void forkBox(OBB* box);
    4646
     47    bool overlapTest(OBB* boxA, OBB* boxB);
    4748
    4849  protected:
  • orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc

    r4694 r4695  
    6969  b->setRelCoor(0.0, 0.0, -10.0);
    7070
    71   TestEntity* c = new TestEntity(); c->setName("Colwn2");
    72   c->setRelCoor(0.0, 0.0, -20.0);
     71//   TestEntity* c = new TestEntity(); c->setName("Colwn2");
     72//   c->setRelCoor(0.0, 0.0, -20.0);
    7373
    7474  entityList->add(a);
    7575  entityList->add(b);
    76   entityList->add(c);
     76//   entityList->add(c);
    7777
    7878  CDEngine::getInstance()->setEntityList(entityList);
     
    204204{
    205205
    206   CDEngine::getInstance()->checkCollisions();
     206  //CDEngine::getInstance()->checkCollisions();
    207207
    208208  currentFrame = SDL_GetTicks();
     
    220220          /* the frame-rate is limited to 100 frames per second, all other things are for nothing.
    221221          */
    222     SDL_Delay((unsigned int)(10-dt));
     222    SDL_Delay(1);
    223223    dt = 10;
    224224  }
     
    240240void Framework::moduleDraw() const
    241241{
    242   //CDEngine::getInstance()->drawBV(depth, drawMode);
     242  CDEngine::getInstance()->drawBV(depth, drawMode);
    243243  LightManager::getInstance()->draw();
    244244
  • orxonox/trunk/src/world_entities/world_entity.cc

    r4689 r4695  
    124124/**
    125125   \brief this function is called, when two entities collide
    126    \param other: the world entity with whom it collides
    127    \param ownhitflags: flags to the CollisionCluster subsections that registered an impact
    128    \param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact
     126   \param entity: the world entity with whom it collides
    129127
    130128   Implement behaviour like damage application or other miscellaneous collision stuff in this function
    131129*/
    132 void WorldEntity::collideWith(WorldEntity* entity) {}
     130void WorldEntity::collideWith(WorldEntity* entity)
     131{
     132  this->obbTree->collideWith(entity->obbTree);
     133
     134}
    133135
    134136
Note: See TracChangeset for help on using the changeset viewer.