Changeset 4900 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 19, 2005, 10:28:36 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/spatial_separation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h
r4898 r4900 12 12 #include "abstract_model.h" 13 13 14 14 15 class QuadtreeNode; 16 class Material; 15 17 16 18 //! A class for quadtree separation of the world -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r4899 r4900 30 30 const float* pVertices, int numVertices, 31 31 Quadtree* quadtree, QuadtreeNode* parent, 32 Rectangle* rect, int treeDepth, const int maxDepth 32 Rectangle* rect, int treeDepth, const int maxDepth, int index 33 33 ) 34 34 { … … 44 44 this->treeDepth = treeDepth; 45 45 this->maxDepth = maxDepth; 46 this->indexNode = index; 46 47 47 48 … … 49 50 for( int i = 0; i < this->treeDepth; ++i) 50 51 PRINT(3)(" |"); 51 PRINT(3)(" | +-| (Event) Separating Node Depth: %i/%i\n", treeDepth, maxDepth);52 PRINT(3)(" | +-| (Event) Separating Node Nr. %i Depth: %i/%i\n", this->indexNode, treeDepth, maxDepth); 52 53 53 54 for( int i = 0; i < this->treeDepth; ++i) … … 74 75 for( int i = 0; i < this->pModelInfo->numTriangles; ++i) 75 76 this->pTriangles[i] = &this->pModelInfo->pTriangles[i]; 77 76 78 this->treeDepth = 0; 77 79 this->maxDepth = maxDepth; 80 this->indexNode = 0; 78 81 79 82 /* debug output */ 80 83 for( int i = 0; i < this->treeDepth; ++i) 81 84 PRINT(3)(" |"); 82 PRINT(3)(" | +-| (Event) Separating Node Depth: %i/%i\n", treeDepth, maxDepth);85 PRINT(3)(" | +-| (Event) Separating Node Nr. %i Depth: %i/%i\n", this->indexNode, treeDepth, maxDepth); 83 86 84 87 this->pDimension = this->getDimFromModel(); … … 164 167 if( pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset) 165 168 listA->add(&this->pTriangles[i]); 166 if( pVert[0] > rectCenter->x + this->offset && pVert[2]<rectCenter->z + this->offset)169 if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset) 167 170 listB->add(&this->pTriangles[i]); 168 if( pVert[0] < rectCenter->x + this->offset && pVert[2] >rectCenter->z + this->offset)171 if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset) 169 172 listC->add(&this->pTriangles[i]); 170 if( pVert[0] <rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)173 if( pVert[0] > rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset) 171 174 listD->add(&this->pTriangles[i]); 172 175 } … … 252 255 253 256 v.x = this->pDimension->getCenter()->x + this->pDimension->getAxis() / 2.0f; 257 v.y = 0.0; 254 258 v.z = this->pDimension->getCenter()->z + this->pDimension->getAxis() / 2.0f; 255 259 Rectangle* rA = new Rectangle(v, this->pDimension->getAxis() / 2.0f); … … 265 269 266 270 /* now propagate */ 267 this->nodeA = new QuadtreeNode(pTriA, lenA, this->pVertices, this->numVertices, this->quadtree, this, rA, this->treeDepth + 1, this->maxDepth); 268 this->nodeB = new QuadtreeNode(pTriB, lenB, this->pVertices, this->numVertices, this->quadtree, this, rB, this->treeDepth + 1, this->maxDepth); 269 this->nodeC = new QuadtreeNode(pTriC, lenC, this->pVertices, this->numVertices, this->quadtree, this, rC, this->treeDepth + 1, this->maxDepth); 270 this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree, this, rD, this->treeDepth + 1, this->maxDepth); 271 this->nodeA = new QuadtreeNode(pTriA, lenA, this->pVertices, this->numVertices, this->quadtree, this, rA, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 0); 272 273 this->nodeB = new QuadtreeNode(pTriB, lenB, this->pVertices, this->numVertices, this->quadtree, this, rB, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 1); 274 275 this->nodeC = new QuadtreeNode(pTriC, lenC, this->pVertices, this->numVertices, this->quadtree, this, rC, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 2); 276 277 this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree, this, rD, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 3); 271 278 } 272 279 -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
r4899 r4900 23 23 const float* pVertices, int numVertices, 24 24 Quadtree* quadtree, QuadtreeNode* parent, 25 Rectangle* rect, int treeDepth, const int maxDepth );25 Rectangle* rect, int treeDepth, const int maxDepth, int index); 26 26 QuadtreeNode(modelInfo* pModelInfo, const int maxDepth); 27 27 virtual ~QuadtreeNode(); … … 54 54 int treeDepth; //!< the depth of the tree 55 55 int maxDepth; //!< the maximal depth of the tree 56 int indexNode; //!< the index number of the node 56 57 57 58 sTriangleExt** pTriangles; //!< reference to the triangles of the node
Note: See TracChangeset
for help on using the changeset viewer.