Changeset 5716 in orxonox.OLD for branches/collision_detection/src
- Timestamp:
- Nov 22, 2005, 11:27:44 PM (19 years ago)
- Location:
- branches/collision_detection/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/collision_detection/src/lib/collision_detection/bv_tree.h
r5702 r5716 39 39 virtual ~BVTree(); 40 40 41 virtual void spawnBVTree( int depth,sVec3D *verticesList, const int length) = 0;42 virtual void spawnBVTree( int depth,const modelInfo& modelInf) = 0;41 virtual void spawnBVTree(sVec3D *verticesList, const int length) = 0; 42 virtual void spawnBVTree(const modelInfo& modelInf) = 0; 43 43 virtual void flushTree() = 0; 44 44 -
branches/collision_detection/src/lib/collision_detection/bv_tree_node.h
r5703 r5716 26 26 virtual ~BVTreeNode(); 27 27 28 virtual void spawnBVTree(const int depth, constsVec3D *verticesList, unsigned int length ) = 0;29 virtual void spawnBVTree(const int depth, constmodelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;28 virtual void spawnBVTree(const sVec3D *verticesList, unsigned int length ) = 0; 29 virtual void spawnBVTree(const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0; 30 30 31 31 virtual const BoundingVolume* getBV() const = 0; -
branches/collision_detection/src/lib/collision_detection/cd_engine.cc
r5713 r5716 166 166 { 167 167 if ( this->rootTree == NULL) 168 this->rootTree = new OBBTree(); 169 this->rootTree->spawnBVTree(depth, vertices, numVertices); 168 this->rootTree = new OBBTree(depth, vertices, numVertices); 170 169 } 171 170 -
branches/collision_detection/src/lib/collision_detection/obb_tree.cc
r5713 r5716 31 31 * standard constructor 32 32 */ 33 OBBTree::OBBTree () 33 OBBTree::OBBTree(int depth, sVec3D *verticesList, const int length) 34 : BVTree() 34 35 { 36 this->depth = depth; 35 37 this->init(); 38 this->spawnBVTree(verticesList, length); 36 39 } 37 40 38 OBBTree::OBBTree(int depth, sVec3D *verticesList, const int length) 41 42 OBBTree::OBBTree(int depth, const modelInfo& modelInf) 43 : BVTree() 39 44 { 45 this->depth = depth; 40 46 this->init(); 41 this->spawnBVTree(depth, verticesList, length); 42 } 43 44 OBBTree::OBBTree(int depth, const modelInfo& modInfo) 45 { 46 this->init(); 47 this->spawnBVTree(depth, modInfo); 47 this->spawnBVTree(modelInf); 48 48 } 49 49 … … 53 53 { 54 54 this->setClassID(CL_OBB_TREE, "OBBTree"); 55 56 55 this->rootNode = NULL; 57 58 56 this->id = 0; 59 57 } … … 69 67 70 68 71 void OBBTree::spawnBVTree( int depth,sVec3D *verticesList, const int length)69 void OBBTree::spawnBVTree(sVec3D *verticesList, const int length) 72 70 { 73 71 if( unlikely(this->rootNode != NULL)) … … 78 76 OBBTreeNode* node = new OBBTreeNode(*this, depth); 79 77 this->rootNode = node; 80 this->rootNode->spawnBVTree( --depth,verticesList, length);78 this->rootNode->spawnBVTree(verticesList, length); 81 79 } 82 80 83 81 84 void OBBTree::spawnBVTree( int depth,const modelInfo& modelInf)82 void OBBTree::spawnBVTree(const modelInfo& modelInf) 85 83 { 86 84 if( unlikely(this->rootNode != NULL)) … … 97 95 triangleIndexes[i] = i; 98 96 99 this->rootNode->spawnBVTree( --depth,modelInf, triangleIndexes, modelInf.numTriangles);97 this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles); 100 98 } 101 99 … … 157 155 } 158 156 159 this->spawnBVTree( 3,vertList, length);157 this->spawnBVTree(vertList, length); 160 158 161 159 PRINT(0)("= Spawning Tree: Finished\n"); -
branches/collision_detection/src/lib/collision_detection/obb_tree.h
r5702 r5716 20 20 21 21 public: 22 OBBTree();23 22 OBBTree(int depth, sVec3D *verticesList, const int length); 24 23 OBBTree(int depth, const modelInfo& modInfo); … … 26 25 void init(); 27 26 28 virtual void spawnBVTree( int depth,sVec3D *verticesList, const int length);29 virtual void spawnBVTree( int depth,const modelInfo& modelInf);27 virtual void spawnBVTree(sVec3D *verticesList, const int length); 28 virtual void spawnBVTree(const modelInfo& modelInf); 30 29 virtual void flushTree(); 31 30 … … 43 42 OBBTreeNode* rootNode; //!< reference to the root node of the tree 44 43 int id; 44 int depth; //!< the depth of the tree to generate 45 45 }; 46 46 -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r5713 r5716 79 79 OBBTreeNode_sphereObj = gluNewQuadric(); 80 80 } 81 81 82 82 83 /** … … 114 115 * on the triangle informations (triangle soup not polygon soup) 115 116 */ 116 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modelInf, 117 const int* triangleIndexes, unsigned int length) 117 void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length) 118 118 { 119 119 sVec3D* verticesList; … … 172 172 * this function creates an Bounding Volume tree from a vertices soup (no triangle data) 173 173 */ 174 void OBBTreeNode::spawnBVTree(const int depth, constsVec3D *verticesList, unsigned int length)174 void OBBTreeNode::spawnBVTree(const sVec3D *verticesList, unsigned int length) 175 175 { 176 176 // PRINTF(3)("\n"); … … 281 281 r = *tmpVec; 282 282 283 284 283 covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j] * p[k] + 285 284 q[j] * q[k] + r[j] * r[k]) - center[j] * center[k]; -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.h
r5713 r5716 31 31 virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; } 32 32 33 34 virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length); 35 virtual void spawnBVTree(const int depth, const modelInfo& modelInf, 36 const int* triangleIndexes, unsigned int length); 33 virtual void spawnBVTree(const sVec3D *verticesList, unsigned int length); 34 virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length); 37 35 38 36 virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); … … 48 46 void calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length); 49 47 void calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length); 50 51 48 void forkBox(OBB& box); 52 49 -
branches/collision_detection/src/orxonox.cc
r5641 r5716 57 57 #include <string.h> 58 58 59 int verbose = 4;59 int verbose = 5; 60 60 61 61 using namespace std;
Note: See TracChangeset
for help on using the changeset viewer.