Changeset 4912 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 21, 2005, 1:00:08 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/spatial_separation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4911 r4912 73 73 void Quadtree::drawTree(int depth, int drawMode) const 74 74 { 75 this->rootNode->drawTree(depth, drawMode); 75 //this->rootNode->drawTree(depth, drawMode); 76 for(int i = 0; i < 256; ++i) 77 { 78 this->nodes[i]->drawTree(0, 0); 79 } 76 80 } -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r4911 r4912 136 136 void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index) 137 137 { 138 int loopLimit = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?2:4;139 140 printf("buildHashTable depth: %i, nodeIter : %i, limit: %i, @nodeIndex: %i\n", this->treeDepth, nodeIter, loopLimit, indexNode); 138 int elCount = (int)pow(4, maxDepth - treeDepth) / 2; 139 int loopLimit = (this->nodeIter < elCount)?2:4; 140 141 141 /* is it a leaf? */ 142 142 if( this->treeDepth < this->maxDepth) 143 143 { 144 for(int i = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?0:2; i < loopLimit; ++i) 145 { 144 for(int i = (this->nodeIter < elCount)?0:2; i < loopLimit; ++i) 145 { 146 for( int j = 0; j < this->treeDepth; ++j) 147 printf(" "); 148 printf("-> %i @ depth: %i, %i/%i \n", i, this->treeDepth, nodeIter, elCount); 149 146 150 this->nodes[i]->buildHashTable(nodeList, index); 147 151 ++this->nodeIter; … … 150 154 else 151 155 { 152 printf("leaf, index: %i\n", *index); 156 for( int j = 0; j < this->treeDepth; ++j) 157 printf(" "); 158 printf(" leaf, index: %i\n", *index); 153 159 nodeList[(*index)++] = this; 154 160 } … … 366 372 void QuadtreeNode::drawTree(int depth, int drawMode) const 367 373 { 368 369 Vector t1 = *this->pDimension->getCenter(); 370 float ax = this->pDimension->getAxis(); 371 float h = 50.0f; 372 373 glBegin(GL_QUADS); 374 this->quadtree->getMaterial(this->indexNode)->select(); 375 glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax); 376 glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax); 377 glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z - ax); 378 glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z - ax); 379 glEnd(); 380 374 if( depth == 0) 375 { 376 Vector t1 = *this->pDimension->getCenter(); 377 float ax = this->pDimension->getAxis(); 378 float h = 50.0f; 379 380 glBegin(GL_QUADS); 381 this->quadtree->getMaterial(this->indexNode)->select(); 382 glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z + ax); 383 glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z + ax); 384 glVertex3f(t1.x - ax, h - depth * 10.0f, t1.z - ax); 385 glVertex3f(t1.x + ax, h - depth * 10.0f, t1.z - ax); 386 glEnd(); 387 } 381 388 if( this->nodeA != NULL) 382 389 this->nodeA->drawTree(depth - 1, drawMode);
Note: See TracChangeset
for help on using the changeset viewer.