Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4702 in orxonox.OLD


Ignore:
Timestamp:
Jun 26, 2005, 1:37:14 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: a collision is now marked with a white box, not yet fully functional, since there are mission some axis to check

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

Legend:

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

    r4700 r4702  
    3131  virtual void collideWith(BVTreeNode* treeNode, PNode* nodeA, PNode* nodeB) = NULL;
    3232
    33   virtual void drawBV(int depth, int drawMode) const = NULL;
     33  virtual void drawBV(int depth, int drawMode) = NULL;
    3434
    3535
  • orxonox/trunk/src/lib/collision_detection/obb.h

    r4660 r4702  
    2929
    3030
     31
    3132 public:
    3233  Vector*          axis;                       //!< Axes of oriented box [x,y,z]
     
    3435  float            covarianceMatrix[3][3];     //!< the covariance matrix
    3536
     37  bool                bCollided;                  //!< is true if this obb has collided
     38
    3639};
    3740
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4700 r4702  
    7272  transparentMaterial[3]->setAmbient(5.0, 3.0, 1.0);
    7373  transparentMaterial[4]->setAmbient(1.0, 0.0, 7.0);
     74
     75  this->collisionMaterial = new Material();
     76  this->collisionMaterial->setIllum(5);
     77  this->collisionMaterial->setTransparency(0.5);
     78  this->collisionMaterial->setAmbient(1.0, 1.0, 1.0);
    7479
    7580  this->id = 0;
  • orxonox/trunk/src/lib/collision_detection/obb_tree.h

    r4700 r4702  
    3232    virtual void drawBV(int depth, int drawMode) const;
    3333
    34     Material* getMaterial(unsigned int depth) { return material[depth%5]; }
    35     Material* getTransparentMaterial(unsigned int depth) { return transparentMaterial[depth%5]; }
     34    Material* getMaterial(unsigned int depth) { return this->material[depth%5]; }
     35    Material* getTransparentMaterial(unsigned int depth) { return this->transparentMaterial[depth%5]; }
     36    Material* getCollisionMaterial() { return this->collisionMaterial; }
    3637    int getID() { return ++this->id;}
    3738    inline OBBTreeNode* getRootNode() { return this->rootNode; }
     
    4748    Material**           material;
    4849    Material**           transparentMaterial;
     50    Material*            collisionMaterial;
    4951    int                  id;
    5052};
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4701 r4702  
    694694    }
    695695
    696   return true;
    697 }
    698 
    699 
    700 
    701 void OBBTreeNode::drawBV(int depth, int drawMode) const
     696    boxA->bCollided = true; /* use this ONLY!!!! for drawing operations */
     697    boxB->bCollided = true;
     698    return true;
     699}
     700
     701
     702
     703void OBBTreeNode::drawBV(int depth, int drawMode)
    702704{
    703705  this->obbTree->getMaterial(treeIndex)->select();
     
    774776    float* len = this->bvElement->halfLength;
    775777
    776     if( drawMode & DRAW_BV_BLENDED)
     778    if( this->bvElement->bCollided)
     779      this->obbTree->getCollisionMaterial()->select();
     780    else if( drawMode & DRAW_BV_BLENDED)
    777781      this->obbTree->getTransparentMaterial(treeIndex)->select();
     782
     783
    778784
    779785    /* draw bounding box */
     
    918924  }
    919925
     926
     927
    920928  if( this->nodeLeft != NULL && depth != 0 )
    921929    this->nodeLeft->drawBV(depth - 1, drawMode);
     
    923931    this->nodeRight->drawBV(depth - 1, drawMode);
    924932
     933  this->bvElement->bCollided = false;
    925934}
    926935
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4700 r4702  
    3636    virtual void collideWith(BVTreeNode* treeNode, PNode* nodeA, PNode* nodeB);
    3737
    38     virtual void drawBV(int depth, int drawMode) const;
     38    virtual void drawBV(int depth, int drawMode);
    3939
    4040    void debug(void) const;
     
    5252    OBBTreeNode*        nodeLeft;                   //!< ref to the left tree node
    5353    OBBTreeNode*        nodeRight;                  //!< ref to the right tree node
    54 
    5554
    5655  private:
Note: See TracChangeset for help on using the changeset viewer.