- Timestamp:
- Nov 22, 2005, 1:42:42 PM (19 years ago)
- Location:
- branches/collision_detection/src/lib/collision_detection
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/collision_detection/src/lib/collision_detection/bv_tree_node.h
r5702 r5703 29 29 virtual void spawnBVTree(const int depth, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0; 30 30 31 virtual BoundingVolume* getBV(int index) const = 0;31 virtual const BoundingVolume* getBV() const = 0; 32 32 inline const int getIndex() { return this->treeIndex; } 33 33 -
branches/collision_detection/src/lib/collision_detection/obb_tree.cc
r5702 r5703 76 76 this->flushTree(); 77 77 } 78 OBBTreeNode* node = new OBBTreeNode( );78 OBBTreeNode* node = new OBBTreeNode(this); 79 79 this->rootNode = node; 80 this->rootNode->setTreeRef(this);81 80 this->rootNode->spawnBVTree(--depth, verticesList, length); 82 81 } … … 90 89 this->flushTree(); 91 90 } 92 OBBTreeNode* node = new OBBTreeNode( );91 OBBTreeNode* node = new OBBTreeNode(this); 93 92 this->rootNode = node; 94 this->rootNode->setTreeRef(this);95 93 96 94 /* triangles indexes created */ -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r5702 r5703 33 33 using namespace std; 34 34 35 OBBTree* OBBTreeNode::obbTree = NULL;36 37 35 float** OBBTreeNode::coMat = NULL; 38 36 float** OBBTreeNode::eigvMat = NULL; … … 44 42 * standard constructor 45 43 */ 46 OBBTreeNode::OBBTreeNode () 44 OBBTreeNode::OBBTreeNode (const OBBTree* tree) 45 : BVTreeNode() 47 46 { 48 47 this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode"); 48 this->obbTree = tree; 49 49 this->nodeLeft = NULL; 50 50 this->nodeRight = NULL; … … 117 117 118 118 PRINT(3)("\n"); 119 this->treeIndex = this->obbTree->getID();120 119 PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length); 121 120 this->depth = depth; … … 181 180 { 182 181 PRINT(3)("\n"); 183 this->treeIndex = this->obbTree->getID();184 182 PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length); 185 183 this->depth = depth; … … 208 206 if(this->tmpLen1 > 2) 209 207 { 210 OBBTreeNode* node1 = new OBBTreeNode( );208 OBBTreeNode* node1 = new OBBTreeNode(this->obbTree); 211 209 this->nodeLeft = node1; 212 210 this->nodeLeft->spawnBVTree(depth - 1, this->tmpVert1, this->tmpLen1); … … 219 217 if( this->tmpLen2 > 2) 220 218 { 221 OBBTreeNode* node2 = new OBBTreeNode( );219 OBBTreeNode* node2 = new OBBTreeNode(this->obbTree); 222 220 this->nodeRight = node2; 223 221 this->nodeRight->spawnBVTree(depth - 1, this->tmpVert2, this->tmpLen2); -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.h
r5702 r5703 25 25 26 26 public: 27 OBBTreeNode( );27 OBBTreeNode(const OBBTree* tree); 28 28 virtual ~OBBTreeNode(); 29 29 30 /* this function returns the bounding volume of this tree node @return: returns the BV */ 31 virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; } 32 30 33 virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length); 31 34 virtual void spawnBVTree(const int depth, const modelInfo& modelInf, 32 35 const int* triangleIndexes, unsigned int length); 33 34 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }35 inline const int getIndex() { return this->treeIndex; }36 inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;}37 36 38 37 virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); … … 66 65 int numOfVertices; //!< number of vertices in vertices data 67 66 int depth; //!< the depth of the node in the tree 68 static OBBTree*obbTree; //!< reference to the obb tree67 const OBBTree* obbTree; //!< reference to the obb tree 69 68 Plane separationPlane; //!< the separation plane of the obb 70 69 const sVec3D* sepPlaneCenter; //!< only needed to draw plane
Note: See TracChangeset
for help on using the changeset viewer.