Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 13, 2005, 9:41:30 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: the obb tree now gets rendered correctly

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

Legend:

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

    r4550 r4618  
    1 /*! 
     1/*!
    22    \file bv_tree.h
    33    \brief Definition of a bounding volume tree
     
    2727
    2828  virtual BoundingVolume* getBV(int index) const = NULL;
    29   inline const int getIndex() { return this->treeIndex; } 
     29  inline const int getIndex() { return this->treeIndex; }
    3030
    3131  virtual void collideWith(const BVTree &tree) = NULL;
    3232
    33   virtual void drawBV(int currentDepth, const int depth) const = NULL;
    34   virtual void drawBVPolygon(int currentDepth, const int depth) const = NULL;
    35   virtual void drawBVBlended(int currentDepth, const int depth) const = NULL;
     33  virtual void drawBV(int depth) const = NULL;
     34  virtual void drawBVPolygon(int depth) const = NULL;
     35  virtual void drawBVBlended(int depth) const = NULL;
    3636
    3737
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4616 r4618  
    7575  if( likely(this->rootNode != NULL))
    7676  {
    77     this->rootNode->drawBV(currentDepth, depth);
    78     this->rootNode->drawBVPolygon(currentDepth, depth);
     77    this->rootNode->drawBV(currentDepth);
     78    this->rootNode->drawBVPolygon(currentDepth);
    7979  }
    8080}
     
    8484{
    8585  if( likely(this->rootNode != NULL))
    86     this->rootNode->drawBVPolygon(currentDepth, depth);
     86    this->rootNode->drawBVPolygon(currentDepth);
    8787}
    8888
     
    9191{
    9292  if( likely(this->rootNode != NULL))
    93     this->rootNode->drawBVBlended(currentDepth, depth);
     93    this->rootNode->drawBVBlended(currentDepth);
    9494}
    9595
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4617 r4618  
    4848{
    4949  this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
    50 
     50  this->nodeLeft = NULL;
     51  this->nodeRight = NULL;
    5152}
    5253
     
    388389
    389390
    390 void OBBTreeNode::drawBV(int currentDepth, const int depth) const
     391void OBBTreeNode::drawBV(int depth) const
    391392{
    392393//   glBegin(GL_LINE_LOOP);
     
    402403
    403404
    404 void OBBTreeNode::drawBVPolygon(int currentDepth, const int depth) const
     405void OBBTreeNode::drawBVPolygon(int depth) const
    405406{
    406407
     
    408409
    409410  /* draw world axes */
    410   glBegin(GL_LINES);
    411   glColor3f(0.0, 0.4, 0.3);
    412   glVertex3f(0.0, 0.0, 0.0);
    413   glVertex3f(3.0, 0.0, 0.0);
    414 
    415   glVertex3f(0.0, 0.0, 0.0);
    416   glVertex3f(0.0, 3.0, 0.0);
    417 
    418   glVertex3f(0.0, 0.0, 0.0);
    419   glVertex3f(0.0, 0.0, 3.0);
    420   glEnd();
     411//   glBegin(GL_LINES);
     412//   glColor3f(0.0, 0.4, 0.3);
     413//   glVertex3f(0.0, 0.0, 0.0);
     414//   glVertex3f(3.0, 0.0, 0.0);
     415//
     416//   glVertex3f(0.0, 0.0, 0.0);
     417//   glVertex3f(0.0, 3.0, 0.0);
     418//
     419//   glVertex3f(0.0, 0.0, 0.0);
     420//   glVertex3f(0.0, 0.0, 3.0);
     421//   glEnd();
    421422
    422423
    423424
    424425  /* draw the obb axes */
    425   glBegin(GL_LINES);
    426   glColor3f(0.0, 0.4, 0.3);
    427   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    428   glVertex3f(this->bvElement->center->x + this->bvElement->axis[0]->x * this->bvElement->halfLength[0],
    429              this->bvElement->center->y + this->bvElement->axis[0]->y * this->bvElement->halfLength[0],
    430              this->bvElement->center->z + this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
    431 
    432   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    433   glVertex3f(this->bvElement->center->x + this->bvElement->axis[1]->x * this->bvElement->halfLength[1],
    434              this->bvElement->center->y + this->bvElement->axis[1]->y * this->bvElement->halfLength[1],
    435              this->bvElement->center->z + this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
    436 
    437   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    438   glVertex3f(this->bvElement->center->x + this->bvElement->axis[2]->x * this->bvElement->halfLength[2],
    439              this->bvElement->center->y + this->bvElement->axis[2]->y * this->bvElement->halfLength[2],
    440              this->bvElement->center->z + this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
    441   glEnd();
     426//   glBegin(GL_LINES);
     427//   glColor3f(0.0, 0.4, 0.3);
     428//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
     429//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[0]->x * this->bvElement->halfLength[0],
     430//              this->bvElement->center->y + this->bvElement->axis[0]->y * this->bvElement->halfLength[0],
     431//              this->bvElement->center->z + this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
     432//
     433//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
     434//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[1]->x * this->bvElement->halfLength[1],
     435//              this->bvElement->center->y + this->bvElement->axis[1]->y * this->bvElement->halfLength[1],
     436//              this->bvElement->center->z + this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
     437//
     438//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
     439//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[2]->x * this->bvElement->halfLength[2],
     440//              this->bvElement->center->y + this->bvElement->axis[2]->y * this->bvElement->halfLength[2],
     441//              this->bvElement->center->z + this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
     442//   glEnd();
    442443
    443444
     
    519520  glEnd();
    520521
    521 
    522 }
    523 
    524 
    525 void OBBTreeNode::drawBVBlended(int currentDepth, const int depth) const
     522  if( this->nodeLeft != NULL && depth != 0)
     523    this->nodeLeft->drawBVPolygon(depth -1);
     524  if( this->nodeRight != NULL && depth != 0)
     525    this->nodeRight->drawBVPolygon(depth -1);
     526
     527}
     528
     529
     530void OBBTreeNode::drawBVBlended(int depth) const
    526531{}
    527532
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4614 r4618  
    3232    virtual void collideWith(const BVTree &tree);
    3333
    34     virtual void drawBV(int currentDepth, const int depth) const;
    35     virtual void drawBVPolygon(int currentDepth, const int depth) const;
    36     virtual void drawBVBlended(int currentDepth, const int depth) const;
     34    virtual void drawBV(int depth) const;
     35    virtual void drawBVPolygon(int depth) const;
     36    virtual void drawBVBlended(int depth) const;
    3737
    3838    void debug();
Note: See TracChangeset for help on using the changeset viewer.