Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5705 in orxonox.OLD for branches/collision_detection/src


Ignore:
Timestamp:
Nov 22, 2005, 2:22:40 PM (19 years ago)
Author:
patrick
Message:

collision_detection: slowly removing old functions and exchanging them with the new interface

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

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/obb_tree.cc

    r5703 r5705  
    9494  /* triangles indexes created */
    9595  int* triangleIndexes = new int[modelInf.numTriangles];
     96  for(int i = 0; i < modelInf.numTriangles; ++i)
     97    triangleIndexes[i] = i;
    9698 
    9799  this->rootNode->spawnBVTree(--depth, modelInf, triangleIndexes, modelInf.numTriangles);
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5704 r5705  
    124124  this->bvElement->numTriangles = length;
    125125 
     126  /* create the boxes in three steps */
    126127  this->calculateBoxCovariance(this->bvElement, modelInf, triangleIndexes, length);
    127128  this->calculateBoxEigenvectors(this->bvElement, modelInf, triangleIndexes, length);
    128129  this->calculateBoxAxis(this->bvElement, modelInf, triangleIndexes, length);
    129130
    130   /* if this is the first node, the vertices data are the original ones of the model itself,
    131      so dont delete them in cleanup */
     131  /* do we need to descent further in the obb tree?*/
    132132  if( likely( this->depth > 0))
    133133  {
     
    218218
    219219
    220 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length)
    221 {}
    222 
    223 
    224 void OBBTreeNode::calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length)
    225 {
     220void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo,
     221                                         const int* triangleIndexes, unsigned int length)
     222{
     223  const sVec3D* verticesList;
     224 
    226225  PRINTF(3)("Created OBBox\n");
    227226 
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.h

    r5704 r5705  
    3232    virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; }
    3333   
     34   
    3435    virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length);
    3536    virtual void spawnBVTree(const int depth, const modelInfo& modelInf,
     
    3738
    3839    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
    39 
    4040    virtual void drawBV(int depth, int drawMode, const Vector& color = Vector(1,0,0), bool top = true) const;
    41 
    4241    void debug() const;
    4342
     43   
    4444  private:
    45     void calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length);
    4645    void calculateBoxEigenvectors(OBB* box, const sVec3D* verticesList, unsigned int length);
    4746    void calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length);
     
    5150    void calculateBoxAxis(OBB* box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    5251
    53 
    5452    void forkBox(OBB* box);
    5553
    5654    bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB);
    5755
     56   
    5857  protected:
    5958    OBB*                bvElement;                  //!< the obb element
     
    6160    OBBTreeNode*        nodeRight;                  //!< ref to the right tree node
    6261
     62
    6363  private:
    6464    unsigned int        treeIndex;                  //!< Index number of the BV in the tree
     65    int                 depth;                      //!< the depth of the node in the tree
     66    const OBBTree*      obbTree;                    //!< reference to the obb tree
     67   
    6568    const sVec3D*       vertices;                   //!< pointer to the vertices data
    6669    int                 numOfVertices;              //!< number of vertices in vertices data
    67     int                 depth;                      //!< the depth of the node in the tree
    68     const OBBTree*      obbTree;                    //!< reference to the obb tree
    6970    Plane               separationPlane;            //!< the separation plane of the obb
    7071    const sVec3D*       sepPlaneCenter;             //!< only needed to draw plane
     
    8182    static float*       eigvlMat;
    8283    static int*         rotCount;
     84   
    8385};
    8486
Note: See TracChangeset for help on using the changeset viewer.