Changeset 8508 in orxonox.OLD for branches/bsp_model/src/lib/collision_detection
- Timestamp:
- Jun 15, 2006, 11:59:56 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/collision_detection
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_detection/Makefile.am
r8507 r8508 12 12 bounding_volume.cc \ 13 13 bounding_sphere.cc \ 14 aabb_tree_node.cc 14 aabb_tree_node.cc \ 15 aabb.cc 15 16 16 17 … … 24 25 bounding_volume.h \ 25 26 bounding_sphere.h \ 26 aabb_tree_node.h 27 aabb_tree_node.h \ 28 aabb.h 27 29 -
branches/bsp_model/src/lib/collision_detection/aabb_tree_node.cc
r8507 r8508 16 16 17 17 #include "aabb_tree_node.h" 18 #include "obb_tree.h" 19 #include "obb.h" 18 #include "aabb.h" 19 20 #include "bv_tree.h" 20 21 21 22 #include "matrix.h" … … 133 134 void AABBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length) 134 135 { 135 PRINTF(4)("\n==============================Creating OBB Tree Node==================\n");136 PRINT(4)(" OBB Tree Infos: \n");136 PRINTF(4)("\n==============================Creating AABB Tree Node==================\n"); 137 PRINT(4)(" AABB Tree Infos: \n"); 137 138 PRINT(4)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, this->treeIndex, length); 138 139 this->depth = depth; 139 140 140 this->bvElement = new OBB();141 this->bvElement = new AABB(); 141 142 this->bvElement->modelInf = &modelInf; 142 143 this->bvElement->triangleIndexes = triangleIndexes; … … 175 176 * @param length: the length of the indexes array 176 177 */ 177 void AABBTreeNode::calculateBoxCovariance( OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)178 void AABBTreeNode::calculateBoxCovariance(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length) 178 179 { 179 180 float facelet[length]; //!< surface area of the i'th triangle of the convex hull … … 246 247 PRINT(4)("\n"); 247 248 } 248 PRINTF(4)("\nWeighteed OBB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", center.x, center.y, center.z);249 PRINTF(4)("\nWeighteed AABB Center:\n\t\t%11.4f\t %11.4f\t %11.4f\n", center.x, center.y, center.z); 249 250 } 250 251 … … 258 259 * @param length: the length of the indexes array 259 260 */ 260 void AABBTreeNode::calculateBoxEigenvectors( OBB& box, const modelInfo& modelInf,261 void AABBTreeNode::calculateBoxEigenvectors(AABB& box, const modelInfo& modelInf, 261 262 const int* triangleIndexes, int length) 262 263 { … … 295 296 * @param length: the length of the indexes array 296 297 */ 297 void AABBTreeNode::calculateBoxAxis( OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)298 void AABBTreeNode::calculateBoxAxis(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length) 298 299 { 299 300 … … 371 372 * this will separate the box into to smaller boxes. the separation is done along the middle of the longest axis 372 373 */ 373 void AABBTreeNode::forkBox( OBB& box)374 void AABBTreeNode::forkBox(AABB& box) 374 375 { 375 376 … … 481 482 482 483 PRINTF(4)("collideWith\n"); 483 PRINTF(5)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());484 PRINTF(5)("Checking AABB %i vs %i: ", this->getIndex(), treeNode->getIndex()); 484 485 485 486 // for now only collide with AABBTreeNodes … … 556 557 * @param nodeB the node itself 557 558 */ 558 bool AABBTreeNode::overlapTest( OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)559 bool AABBTreeNode::overlapTest(AABB* boxA, AABB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) 559 560 { 560 561 //HACK remove this again … … 776 777 glColor4f(color.x, color.y, color.z, .5); 777 778 } 778 779 // debug out780 if( this->obbTree->getOwner() != NULL)781 {782 PRINTF(4)("debug poly draw: depth: %i, mode: %i, entity-name: %s, class: %s\n", depth, drawMode, this->obbTree->getOwner()->getName(), this->obbTree->getOwner()->getClassName());783 }784 else785 PRINTF(4)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode);786 779 787 780 -
branches/bsp_model/src/lib/collision_detection/aabb_tree_node.h
r8507 r8508 12 12 13 13 class BoundingVolume; 14 class OBB;14 class AABB; 15 15 class OBBTree; 16 16 class Plane; … … 41 41 /** gets the id of the current child @return id of the child */ 42 42 inline const int getID() { return this->nextID++; } 43 43 inline AABB* getAABB() { return this->bvElement; } 44 44 45 45 private: 46 void calculateBoxAxis( OBB& box, const sVec3D* verticesList, unsigned int length);46 void calculateBoxAxis(AABB& box, const sVec3D* verticesList, unsigned int length); 47 47 48 void calculateBoxCovariance( OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);49 void calculateBoxEigenvectors( OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);50 void calculateBoxAxis( OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length);51 void forkBox( OBB& box);48 void calculateBoxCovariance(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length); 49 void calculateBoxEigenvectors(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length); 50 void calculateBoxAxis(AABB& box, const modelInfo& modelInf, const int* triangleIndexes, int length); 51 void forkBox(AABB& box); 52 52 53 53 void collideWithOBB(AABBTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); 54 bool overlapTest( OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB);54 bool overlapTest(AABB* boxA, AABB* boxB, WorldEntity* nodeA, WorldEntity* nodeB); 55 55 56 56 57 57 protected: 58 OBB* bvElement; //!< the obb element58 AABB* bvElement; //!< the obb element 59 59 AABBTreeNode* nodePrev; //!< ref to the previous (parent) tree node = NULL if first 60 60 AABBTreeNode* nodeLeft; //!< ref to the left tree node
Note: See TracChangeset
for help on using the changeset viewer.