Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5702 in orxonox.OLD for branches/collision_detection/src/lib


Ignore:
Timestamp:
Nov 22, 2005, 1:11:06 PM (19 years ago)
Author:
patrick
Message:

collision_detection: interface change, const war continued

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

Legend:

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

    r5120 r5702  
    4545  if( this->vertices && !this->bOrigVertices)
    4646    delete[] this->vertices;
     47 
     48  if( this->triangleIndexes)
     49    delete[] this->triangleIndexes;
    4750}
  • branches/collision_detection/src/lib/collision_detection/bounding_volume.h

    r5688 r5702  
    3737    int                 numOfVertices;              //!< number of vertices in the vertices buffer
    3838    bool                bOrigVertices;              //!< is true if the vertices pointer points to the original model data - only important for deleting
     39    const modelInfo*    modelInf;                   //!< Reference to the model's ModelInfo
     40    const int*          triangleIndexes;            //!< Array with the triangle indexes in modelInfo
     41    unsigned int        numTriangles;               //!< Number of triangles in this BV
    3942};
    4043
  • branches/collision_detection/src/lib/collision_detection/bv_tree.h

    r5684 r5702  
    4040
    4141  virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = 0;
    42   virtual void spawnBVTree(int depth, const modelInfo& modInfo) = 0;
     42  virtual void spawnBVTree(int depth, const modelInfo& modelInf) = 0;
    4343  virtual void flushTree() = 0;
    4444
  • branches/collision_detection/src/lib/collision_detection/bv_tree_node.h

    r5688 r5702  
    2727
    2828  virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length ) = 0;
    29   virtual void spawnBVTree(const int depth, const modelInfo& modInfo) = 0;
     29  virtual void spawnBVTree(const int depth, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;
    3030
    3131  virtual BoundingVolume* getBV(int index) const = 0;
  • branches/collision_detection/src/lib/collision_detection/obb_tree.cc

    r5684 r5702  
    8383
    8484
    85 void OBBTree::spawnBVTree(int depth, const modelInfo& modInfo)
     85void OBBTree::spawnBVTree(int depth, const modelInfo& modelInf)
    8686{
    8787  if( unlikely(this->rootNode != NULL))
     
    9393  this->rootNode = node;
    9494  this->rootNode->setTreeRef(this);
    95   this->rootNode->spawnBVTree(--depth, modInfo);
     95 
     96  /* triangles indexes created */
     97  int* triangleIndexes = new int[modelInf.numTriangles];
     98 
     99  this->rootNode->spawnBVTree(--depth, modelInf, triangleIndexes, modelInf.numTriangles);
    96100}
    97101
  • branches/collision_detection/src/lib/collision_detection/obb_tree.h

    r5684 r5702  
    2727
    2828    virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length);
    29     virtual void spawnBVTree(int depth, const modelInfo& modInfo);
     29    virtual void spawnBVTree(int depth, const modelInfo& modelInf);
    3030    virtual void flushTree();
    3131
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5699 r5702  
    111111 * on the triangle informations (triangle soup not polygon soup)
    112112 */
    113 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modInfo)
    114 {
    115   int length = 0;
     113void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modelInf,
     114                              const int* triangleIndexes, unsigned int length)
     115{
    116116  sVec3D* verticesList;
    117117
     
    123123
    124124  this->bvElement = new OBB();
    125   this->bvElement->vertices = verticesList;
    126   this->bvElement->numOfVertices = length;
     125 
     126  this->bvElement->modelInf = &modelInf;
     127  this->bvElement->triangleIndexes = triangleIndexes;
     128  this->bvElement->numTriangles = length;
     129 
    127130  PRINTF(3)("Created OBBox\n");
    128   this->calculateBoxCovariance(this->bvElement, modInfo);
     131  this->calculateBoxCovariance(this->bvElement, modelInf, triangleIndexes, length);
    129132  PRINTF(3)("Calculated attributes1\n");
    130   this->calculateBoxEigenvectors(this->bvElement, modInfo);
     133  this->calculateBoxEigenvectors(this->bvElement, modelInf, triangleIndexes, length);
    131134  PRINTF(3)("Calculated attributes2\n");
    132   this->calculateBoxAxis(this->bvElement,modInfo);
     135  this->calculateBoxAxis(this->bvElement, modelInf, triangleIndexes, length);
    133136  PRINTF(3)("Calculated attributes3\n");
    134137
     
    228231
    229232
    230 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo)
     233void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length)
    231234{}
    232235
     
    421424
    422425
    423 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo)
     426void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo,
     427                                           const int* triangleIndexes, unsigned int length)
    424428{}
    425429
     
    473477
    474478
    475 void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo)
     479void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length)
    476480{
    477481  this->calculateBoxAxis(box, (const sVec3D*)modInfo.pVertices, modInfo.numVertices);
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.h

    r5699 r5702  
    2929
    3030    virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length);
    31     virtual void spawnBVTree(const int depth, const modelInfo& modInfo);
     31    virtual void spawnBVTree(const int depth, const modelInfo& modelInf,
     32                             const int* triangleIndexes, unsigned int length);
    3233
    3334    BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
     
    4647    void calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length);
    4748
    48     void calculateBoxCovariance(OBB* box, const modelInfo& modInfo);
    49     void calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo);
    50     void calculateBoxAxis(OBB* box, const modelInfo& modInfo);
     49    void calculateBoxCovariance(OBB* box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
     50    void calculateBoxEigenvectors(OBB* box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
     51    void calculateBoxAxis(OBB* box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    5152
    5253
Note: See TracChangeset for help on using the changeset viewer.