Changeset 5684 in orxonox.OLD for trunk/src/lib/collision_detection/obb_tree_node.cc
- Timestamp:
- Nov 21, 2005, 10:33:42 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/obb_tree_node.cc
r5678 r5684 96 96 97 97 98 /** 99 * creates a new BVTree or BVTree partition 100 * @param depth: how much more depth-steps to go: if == 1 don't go any deeper! 101 * @param modInfo: model informations from the abstrac model 102 * 103 * this function creates the Bounding Volume tree from a modelInfo struct and bases its calculations 104 * on the triangle informations (triangle soup not polygon soup) 105 */ 106 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modInfo) 107 { 108 int length = 0; 109 sVec3D* verticesList; 110 111 PRINT(3)("\n"); 112 this->treeIndex = this->obbTree->getID(); 113 PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length); 114 this->depth = depth; 115 116 117 this->bvElement = new OBB(); 118 this->bvElement->vertices = verticesList; 119 this->bvElement->numOfVertices = length; 120 PRINTF(3)("Created OBBox\n"); 121 this->calculateBoxCovariance(this->bvElement, modInfo); 122 PRINTF(3)("Calculated attributes1\n"); 123 this->calculateBoxEigenvectors(this->bvElement, modInfo); 124 PRINTF(3)("Calculated attributes2\n"); 125 this->calculateBoxAxis(this->bvElement,modInfo); 126 PRINTF(3)("Calculated attributes3\n"); 127 128 /* if this is the first node, the vertices data are the original ones of the model itself, so dont delete them in cleanup */ 129 if( this->treeIndex == 1) 130 this->bvElement->bOrigVertices = true; 131 132 if( likely( this->depth > 0)) 133 { 134 this->forkBox(this->bvElement); 135 136 137 // if(this->tmpLen1 > 2) 138 // { 139 // OBBTreeNode* node1 = new OBBTreeNode(); 140 // this->nodeLeft = node1; 141 // this->nodeLeft->spawnBVTree(depth - 1, this->tmpVert1, this->tmpLen1); 142 // } 143 // else 144 // { 145 // PRINTF(3)("Aboarding tree walk: less than 3 vertices left\n"); 146 // } 147 // 148 // if( this->tmpLen2 > 2) 149 // { 150 // OBBTreeNode* node2 = new OBBTreeNode(); 151 // this->nodeRight = node2; 152 // this->nodeRight->spawnBVTree(depth - 1, this->tmpVert2, this->tmpLen2); 153 // } 154 // else 155 // { 156 // PRINTF(3)("Abording tree walk: less than 3 vertices left\n"); 157 // } 158 159 } 160 } 161 98 162 99 163 /** … … 101 165 * @param depth: how much more depth-steps to go: if == 1 don't go any deeper! 102 166 * @param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle 167 * 168 * this function creates an Bounding Volume tree from a vertices soup (no triangle data) 103 169 */ 104 170 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length) … … 151 217 PRINTF(3)("Abording tree walk: less than 3 vertices left\n"); 152 218 } 153 154 } 155 } 156 219 } 220 } 221 222 223 void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo) 224 {} 157 225 158 226 … … 346 414 347 415 416 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo) 417 {} 348 418 349 419 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length) … … 394 464 // PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[2].x, box->axis[2].y, box->axis[2].z); 395 465 } 466 467 468 void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo) 469 {} 396 470 397 471
Note: See TracChangeset
for help on using the changeset viewer.