Changeset 5705 in orxonox.OLD for branches/collision_detection/src/lib
- Timestamp:
- Nov 22, 2005, 2:22:40 PM (19 years ago)
- Location:
- branches/collision_detection/src/lib/collision_detection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/collision_detection/src/lib/collision_detection/obb_tree.cc
r5703 r5705 94 94 /* triangles indexes created */ 95 95 int* triangleIndexes = new int[modelInf.numTriangles]; 96 for(int i = 0; i < modelInf.numTriangles; ++i) 97 triangleIndexes[i] = i; 96 98 97 99 this->rootNode->spawnBVTree(--depth, modelInf, triangleIndexes, modelInf.numTriangles); -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r5704 r5705 124 124 this->bvElement->numTriangles = length; 125 125 126 /* create the boxes in three steps */ 126 127 this->calculateBoxCovariance(this->bvElement, modelInf, triangleIndexes, length); 127 128 this->calculateBoxEigenvectors(this->bvElement, modelInf, triangleIndexes, length); 128 129 this->calculateBoxAxis(this->bvElement, modelInf, triangleIndexes, length); 129 130 130 /* if this is the first node, the vertices data are the original ones of the model itself, 131 so dont delete them in cleanup */ 131 /* do we need to descent further in the obb tree?*/ 132 132 if( likely( this->depth > 0)) 133 133 { … … 218 218 219 219 220 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) 221 {} 222 223 224 void OBBTreeNode::calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length) 225 { 220 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo, 221 const int* triangleIndexes, unsigned int length) 222 { 223 const sVec3D* verticesList; 224 226 225 PRINTF(3)("Created OBBox\n"); 227 226 -
branches/collision_detection/src/lib/collision_detection/obb_tree_node.h
r5704 r5705 32 32 virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; } 33 33 34 34 35 virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length); 35 36 virtual void spawnBVTree(const int depth, const modelInfo& modelInf, … … 37 38 38 39 virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); 39 40 40 virtual void drawBV(int depth, int drawMode, const Vector& color = Vector(1,0,0), bool top = true) const; 41 42 41 void debug() const; 43 42 43 44 44 private: 45 void calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length);46 45 void calculateBoxEigenvectors(OBB* box, const sVec3D* verticesList, unsigned int length); 47 46 void calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length); … … 51 50 void calculateBoxAxis(OBB* box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length); 52 51 53 54 52 void forkBox(OBB* box); 55 53 56 54 bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB); 57 55 56 58 57 protected: 59 58 OBB* bvElement; //!< the obb element … … 61 60 OBBTreeNode* nodeRight; //!< ref to the right tree node 62 61 62 63 63 private: 64 64 unsigned int treeIndex; //!< Index number of the BV in the tree 65 int depth; //!< the depth of the node in the tree 66 const OBBTree* obbTree; //!< reference to the obb tree 67 65 68 const sVec3D* vertices; //!< pointer to the vertices data 66 69 int numOfVertices; //!< number of vertices in vertices data 67 int depth; //!< the depth of the node in the tree68 const OBBTree* obbTree; //!< reference to the obb tree69 70 Plane separationPlane; //!< the separation plane of the obb 70 71 const sVec3D* sepPlaneCenter; //!< only needed to draw plane … … 81 82 static float* eigvlMat; 82 83 static int* rotCount; 84 83 85 }; 84 86
Note: See TracChangeset
for help on using the changeset viewer.