Changeset 5702 in orxonox.OLD for branches/collision_detection/src/lib
- Timestamp:
- Nov 22, 2005, 1:11:06 PM (19 years ago)
- 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 45 45 if( this->vertices && !this->bOrigVertices) 46 46 delete[] this->vertices; 47 48 if( this->triangleIndexes) 49 delete[] this->triangleIndexes; 47 50 } -
branches/collision_detection/src/lib/collision_detection/bounding_volume.h
r5688 r5702 37 37 int numOfVertices; //!< number of vertices in the vertices buffer 38 38 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 39 42 }; 40 43 -
branches/collision_detection/src/lib/collision_detection/bv_tree.h
r5684 r5702 40 40 41 41 virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = 0; 42 virtual void spawnBVTree(int depth, const modelInfo& mod Info) = 0;42 virtual void spawnBVTree(int depth, const modelInfo& modelInf) = 0; 43 43 virtual void flushTree() = 0; 44 44 -
branches/collision_detection/src/lib/collision_detection/bv_tree_node.h
r5688 r5702 27 27 28 28 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; 30 30 31 31 virtual BoundingVolume* getBV(int index) const = 0; -
branches/collision_detection/src/lib/collision_detection/obb_tree.cc
r5684 r5702 83 83 84 84 85 void OBBTree::spawnBVTree(int depth, const modelInfo& mod Info)85 void OBBTree::spawnBVTree(int depth, const modelInfo& modelInf) 86 86 { 87 87 if( unlikely(this->rootNode != NULL)) … … 93 93 this->rootNode = node; 94 94 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); 96 100 } 97 101 -
branches/collision_detection/src/lib/collision_detection/obb_tree.h
r5684 r5702 27 27 28 28 virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length); 29 virtual void spawnBVTree(int depth, const modelInfo& mod Info);29 virtual void spawnBVTree(int depth, const modelInfo& modelInf); 30 30 virtual void flushTree(); 31 31 -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r5699 r5702 111 111 * on the triangle informations (triangle soup not polygon soup) 112 112 */ 113 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& mod Info)114 { 115 int length = 0; 113 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modelInf, 114 const int* triangleIndexes, unsigned int length) 115 { 116 116 sVec3D* verticesList; 117 117 … … 123 123 124 124 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 127 130 PRINTF(3)("Created OBBox\n"); 128 this->calculateBoxCovariance(this->bvElement, mod Info);131 this->calculateBoxCovariance(this->bvElement, modelInf, triangleIndexes, length); 129 132 PRINTF(3)("Calculated attributes1\n"); 130 this->calculateBoxEigenvectors(this->bvElement, mod Info);133 this->calculateBoxEigenvectors(this->bvElement, modelInf, triangleIndexes, length); 131 134 PRINTF(3)("Calculated attributes2\n"); 132 this->calculateBoxAxis(this->bvElement, modInfo);135 this->calculateBoxAxis(this->bvElement, modelInf, triangleIndexes, length); 133 136 PRINTF(3)("Calculated attributes3\n"); 134 137 … … 228 231 229 232 230 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo )233 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) 231 234 {} 232 235 … … 421 424 422 425 423 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo) 426 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo, 427 const int* triangleIndexes, unsigned int length) 424 428 {} 425 429 … … 473 477 474 478 475 void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo )479 void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) 476 480 { 477 481 this->calculateBoxAxis(box, (const sVec3D*)modInfo.pVertices, modInfo.numVertices); -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.h
r5699 r5702 29 29 30 30 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); 32 33 33 34 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; } … … 46 47 void calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length); 47 48 48 void calculateBoxCovariance(OBB* box, const modelInfo& mod Info);49 void calculateBoxEigenvectors(OBB* box, const modelInfo& mod Info);50 void calculateBoxAxis(OBB* box, const modelInfo& mod Info);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); 51 52 52 53
Note: See TracChangeset
for help on using the changeset viewer.