Changeset 492 for trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
- Timestamp:
- 01/03/06 23:33:45 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r491 r492 1525 1525 void VspBspTree::CollectViewCells(ViewCellContainer &viewCells) const 1526 1526 { 1527 stack<BspNode *> nodeStack; 1528 nodeStack.push(mRoot); 1529 1530 ViewCell::NewMail(); 1531 1532 while (!nodeStack.empty()) 1533 { 1534 BspNode *node = nodeStack.top(); 1535 nodeStack.pop(); 1536 1537 if (node->IsLeaf()) 1538 { 1539 ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 1540 if (node->TreeValid() && !viewCell->Mailed()) 1527 stack<BspNode *> nodeStack; 1528 1529 if (!mRoot) 1530 return; 1531 1532 nodeStack.push(mRoot); 1533 1534 ViewCell::NewMail(); 1535 1536 while (!nodeStack.empty()) 1537 { 1538 BspNode *node = nodeStack.top(); 1539 nodeStack.pop(); 1540 1541 if (node->IsLeaf()) 1542 { 1543 ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 1544 1545 if (!viewCell->Mailed()) 1541 1546 { 1542 1543 1547 viewCell->Mail(); 1548 viewCells.push_back(viewCell); 1544 1549 } 1545 1550 } 1546 1551 else 1547 1552 { 1548 1549 1550 1551 1553 BspInterior *interior = dynamic_cast<BspInterior *>(node); 1554 1555 nodeStack.push(interior->GetFront()); 1556 nodeStack.push(interior->GetBack()); 1552 1557 } 1553 1558 } … … 2504 2509 2505 2510 2511 ViewCell * 2512 VspBspTree::GetViewCell(const Vector3 &point) 2513 { 2514 if (mRoot == NULL) 2515 return NULL; 2516 2517 stack<BspNode *> nodeStack; 2518 nodeStack.push(mRoot); 2519 2520 ViewCell *viewcell = NULL; 2521 2522 while (!nodeStack.empty()) { 2523 BspNode *node = nodeStack.top(); 2524 nodeStack.pop(); 2525 2526 if (node->IsLeaf()) { 2527 viewcell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 2528 break; 2529 } else { 2530 2531 BspInterior *interior = dynamic_cast<BspInterior *>(node); 2532 2533 // random decision 2534 if (interior->GetPlane().Side(point) < 0) 2535 nodeStack.push(interior->GetBack()); 2536 else 2537 nodeStack.push(interior->GetFront()); 2538 } 2539 } 2540 2541 return viewcell; 2542 } 2543 2544 2506 2545 int VspBspTree::RefineViewCells(const VssRayContainer &rays) 2507 2546 {
Note: See TracChangeset
for help on using the changeset viewer.