Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7005 in orxonox.OLD for branches/current_cd


Ignore:
Timestamp:
Feb 3, 2006, 9:34:57 AM (19 years ago)
Author:
patrick
Message:

cd: work flush

Location:
branches/current_cd/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/current_cd/src/lib/collision_detection/cd_engine.cc

    r6921 r7005  
    133133  std::list<WorldEntity*>::const_iterator entity;
    134134  for (entity = drawList.begin(); entity != drawList.end(); entity++)
    135     (*entity)->drawBVTree(1, 226);
     135    (*entity)->drawBVTree(3, 226);
    136136}
    137137
     
    141141void CDEngine::debugDraw(int depth, int drawMode)
    142142{
    143   if(this-> rootTree != NULL)
    144     this->rootTree->drawBV(depth, drawMode);
     143//   if(this-> rootTree != NULL)
     144//     this->rootTree->drawBV(depth, drawMode);
    145145}
  • branches/current_cd/src/lib/collision_detection/obb_tree.cc

    r6922 r7005  
    3131 *  standard constructor
    3232*/
    33 OBBTree::OBBTree(int depth, const modelInfo* modelInf)
     33OBBTree::OBBTree(int depth, const modelInfo* modelInf, WorldEntity* owner)
    3434  : BVTree()
    3535{
     
    3737  this->init();
    3838  this->spawnBVTree(*modelInf);
     39  this->owner = owner;
    3940}
    4041
  • branches/current_cd/src/lib/collision_detection/obb_tree.h

    r6922 r7005  
    1515class OBBTreeNode;
    1616class PNode;
     17class WorldEntity;
    1718
    1819//! A class for representing an obb tree
     
    2122
    2223  public:
    23     OBBTree(int depth, const modelInfo* modInfo);
     24    OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity);
    2425    virtual ~OBBTree();
    2526    void init();
     
    3536    /** returns the root node of the bounding volume tree @return reference to the root node */
    3637    inline OBBTreeNode* getRootNode() const { return this->rootNode; }
     38    inline WorldEntity* getOwner() const { return this->owner; }
    3739
    3840    void debug();
     
    4244    int                  id;                              //!< the next id of a obb tree node
    4345    int                  depth;                           //!< the depth of the tree to generate
     46    WorldEntity*         owner;                           //!< owner
    4447};
    4548
  • branches/current_cd/src/lib/collision_detection/obb_tree_node.cc

    r6922 r7005  
    6666  if( OBBTreeNode_sphereObj == NULL)
    6767    OBBTreeNode_sphereObj = gluNewQuadric();
     68
     69  this->owner = NULL;
    6870
    6971  /* debug ids */
     
    565567
    566568
    567 bool OBBTreeNode::overlapTest(const OBB& boxA, const OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB)
    568 {
     569bool OBBTreeNode::overlapTest(OBB& boxA, OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB)
     570{
     571  //HACK remove this again
     572  this->owner = nodeA;
    569573  //   if( boxB == NULL || boxA == NULL)
    570574  //     return false;
     
    677681
    678682  /* FIXME: there is no collision mark set now */
    679   //   boxA.bCollided = true; /* use this ONLY(!!!!) for drawing operations */
    680   //   boxB.bCollided = true;
     683     boxA.bCollided = true; /* use this ONLY(!!!!) for drawing operations */
     684     boxB.bCollided = true;
    681685
    682686
     
    689693
    690694
     695
     696
     697
     698
     699
     700/**
     701 *
     702 * draw the BV tree - debug mode
     703 */
    691704void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color,  bool top) const
    692705{
    693 
    694 
    695706  /* this function can be used to draw the triangles and/or the points only  */
    696707  if( drawMode & DRAW_MODEL || drawMode & DRAW_ALL)
     
    778789      depth = 0;
    779790
    780     if( !(drawMode & DRAW_SINGLE && depth != 0))
    781     {
    782       PRINTF(0)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode);
     791    if( depth == 0 /*!(drawMode & DRAW_SINGLE && depth != 0)*/)
     792    {
     793
    783794
    784795      Vector cen = this->bvElement->center;
     
    794805        glColor4f(color.x, color.y, color.z, .5);
    795806      }
     807
     808      // debug out
     809      if( this->obbTree->getOwner() != NULL)
     810      {
     811        PRINTF(0)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getName(), this->obbTree->getOwner()->getClassName());
     812      }
     813      else
     814        PRINTF(0)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode);
     815
    796816
    797817      /* draw bounding box */
     
    902922      }
    903923
    904 
    905924      if( drawMode & DRAW_BV_BLENDED)
    906925        glColor3f(color.x, color.y, color.z);
    907926    }
    908 
    909927  }
    910928
  • branches/current_cd/src/lib/collision_detection/obb_tree_node.h

    r6922 r7005  
    4848    void forkBox(OBB& box);
    4949
    50     bool overlapTest(const OBB& boxA, const OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB);
     50    bool overlapTest(OBB& boxA, OBB& boxB, WorldEntity* nodeA, WorldEntity* nodeB);
    5151
    5252
     
    7676    int                 triangleIndexLength1;       //!< len vert data obbox1
    7777    int                 triangleIndexLength2;       //!< len vert data obbox2
     78
     79    WorldEntity*        owner;
    7880};
    7981
  • branches/current_cd/src/story_entities/game_world.cc

    r6921 r7005  
    381381{
    382382  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
    383   this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
     383    this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
    384384  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    385   this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
    386 
     385    this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
    387386  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    388       this->dataTank->objectManager->getObjectList(OM_COMMON));
     387    this->dataTank->objectManager->getObjectList(OM_COMMON));
    389388}
    390389
     
    428427  {
    429428    CDEngine* engine = CDEngine::getInstance();
    430     //engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
     429    engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
    431430    engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON));
    432431    engine->drawBV(State::getObjectManager()->getObjectList(OM_COMMON));
    433432    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00));
     433    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00_PROJ));
    434434    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01));
    435435    engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
  • branches/current_cd/src/world_entities/world_entity.cc

    r6911 r7005  
    211211  if (this->models[0] != NULL)
    212212  {
    213     this->obbTree = new OBBTree(depth, models[0]->getModelInfo());
     213    this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this);
    214214    return true;
    215215  }
     
    461461 * @param drawMode the mode to draw this entity under
    462462 */
    463 void WorldEntity::drawBVTree(unsigned int depth, int drawMode) const
     463void WorldEntity::drawBVTree(int depth, int drawMode) const
    464464{
    465465  glMatrixMode(GL_MODELVIEW);
     
    473473  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    474474
     475
    475476  if (this->obbTree)
    476477    this->obbTree->drawBV(depth, drawMode);
     478
     479
    477480  glPopMatrix();
    478481}
  • branches/current_cd/src/world_entities/world_entity.h

    r6911 r7005  
    22 * @file world_entity.h
    33 * Definition of the basic WorldEntity
    4 */
     4 */
    55
    66#ifndef _WORLD_ENTITY_H
     
    3939  void setModel(Model* model, unsigned int modelNumber = 0);
    4040  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    41   bool buildObbTree(int depth);
    4241
    4342  inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; }
     
    5453  virtual void draw () const;
    5554
     55  bool buildObbTree(int depth);
    5656  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    57   void drawBVTree(unsigned int depth, int drawMode) const;
    5857  /** @returns a reference to the obb tree of this worldentity */
    5958  inline BVTree* getOBBTree() const { return this->obbTree; };
    60 
     59  void drawBVTree(int depth, int drawMode) const;
    6160
    6261  void debugWE() { this->debugEntity(); }
Note: See TracChangeset for help on using the changeset viewer.