Ignore:
Timestamp:
01/03/06 23:33:45 (18 years ago)
Author:
bittner
Message:

Large merge - viewcells seem not functional now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r491 r492  
    15251525void VspBspTree::CollectViewCells(ViewCellContainer &viewCells) const 
    15261526{ 
    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())  
    15411546                        { 
    1542                                 viewCell->Mail(); 
    1543                                 viewCells.push_back(viewCell); 
     1547                          viewCell->Mail(); 
     1548                          viewCells.push_back(viewCell); 
    15441549                        } 
    15451550                } 
    15461551                else 
    15471552                { 
    1548                         BspInterior *interior = dynamic_cast<BspInterior *>(node); 
    1549  
    1550                         nodeStack.push(interior->GetFront()); 
    1551                         nodeStack.push(interior->GetBack()); 
     1553                  BspInterior *interior = dynamic_cast<BspInterior *>(node); 
     1554                   
     1555                  nodeStack.push(interior->GetFront()); 
     1556                  nodeStack.push(interior->GetBack()); 
    15521557                } 
    15531558        } 
     
    25042509 
    25052510 
     2511ViewCell * 
     2512VspBspTree::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 
    25062545int VspBspTree::RefineViewCells(const VssRayContainer &rays) 
    25072546{ 
Note: See TracChangeset for help on using the changeset viewer.