Changeset 1757 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 11/15/06 14:56:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1749 r1757 2424 2424 2425 2425 2426 void BvHierarchy::CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects) 2426 void BvHierarchy::CollectObjects(const AxisAlignedBox3 &box, 2427 ObjectContainer &objects) 2427 2428 { 2428 2429 stack<BvhNode *> nodeStack; … … 2430 2431 nodeStack.push(mRoot); 2431 2432 2432 while (!nodeStack.empty()) 2433 { 2434 BvhNode *node = nodeStack.top(); 2433 while (!nodeStack.empty()) { 2434 BvhNode *node = nodeStack.top(); 2435 2436 nodeStack.pop(); 2437 2438 if (node->IsLeaf()) { 2439 BvhLeaf *leaf = (BvhLeaf *)node; 2440 if (Overlap(box, leaf->GetBoundingBox())) { 2441 Intersectable *object = GetOrCreateBvhIntersectable(leaf); 2442 if (!object->Mailed()) { 2443 object->Mail(); 2444 objects.push_back(object); 2445 } 2446 } 2447 } 2448 else { 2449 BvhInterior *interior = (BvhInterior *)node; 2435 2450 2436 nodeStack.pop(); 2451 if (Overlap(box, interior->GetBoundingBox())) 2452 nodeStack.push(interior->GetFront()); 2437 2453 2438 if (node->IsLeaf()) 2439 { 2440 BvhLeaf *leaf = (BvhLeaf *)node; 2441 if (Overlap(box, leaf->GetBoundingBox())) { 2442 Intersectable *object = GetOrCreateBvhIntersectable(leaf); 2443 if (!object->Mailed()) { 2444 object->Mail(); 2445 objects.push_back(object); 2446 } 2447 } 2448 } 2449 else 2450 { 2451 BvhInterior *interior = (BvhInterior *)node; 2452 2453 if (Overlap(box, interior->GetBoundingBox())) 2454 nodeStack.push(interior->GetFront()); 2455 2456 if (Overlap(box, interior->GetBoundingBox())) 2457 nodeStack.push(interior->GetBack()); 2458 } 2459 } 2460 } 2461 2462 } 2454 if (Overlap(box, interior->GetBoundingBox())) 2455 nodeStack.push(interior->GetBack()); 2456 } 2457 } 2458 } 2459 2460 }
Note: See TracChangeset
for help on using the changeset viewer.