Ignore:
Timestamp:
11/01/06 23:20:53 (18 years ago)
Author:
mattausch
Message:

worked on full render cost evaluation
warning: some change sin render cost evaluation for pvs which could have bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1705 r1707  
    10771077 
    10781078/// Returns index of the best view cells of the neighborhood 
    1079 int GetBestViewCellIdx(ViewCell *root, const ViewCellContainer &neighborhood) 
     1079static int GetBestViewCellIdx(ViewCell *root, const ViewCellContainer &neighborhood) 
    10801080{ 
    10811081        int bestViewCellIdx = 0; 
     
    12371237{ 
    12381238 
    1239         if ((vc->GetPvs().CountObjectsInPvs() > maxPvsSize) || 
    1240                 (vc->GetPvs().CountObjectsInPvs() < minPvsSize)) 
     1239        if ((vc->GetPvs().EvalPvsCost() > maxPvsSize) || 
     1240                (vc->GetPvs().EvalPvsCost() < minPvsSize)) 
    12411241        { 
    12421242                return false; 
     
    15101510        { 
    15111511                ViewCell *vc = *it; 
    1512                 totalRenderCost += vc->GetPvs().CountObjectsInPvs() * vc->GetVolume(); 
    1513                 totalPvs += (int)vc->GetPvs().CountObjectsInPvs(); 
     1512                totalRenderCost += vc->GetPvs().EvalPvsCost() * vc->GetVolume(); 
     1513                totalPvs += (int)vc->GetPvs().EvalPvsCost(); 
    15141514        } 
    15151515 
     
    15301530                ViewCell *vc = *it; 
    15311531 
    1532                 float renderCost = vc->GetPvs().CountObjectsInPvs() * vc->GetVolume(); 
     1532                float renderCost = vc->GetPvs().EvalPvsCost() * vc->GetVolume(); 
    15331533                float dev; 
    15341534 
    15351535                if (1) 
    1536                         dev = fabs(avgRenderCost - (float)vc->GetPvs().CountObjectsInPvs()); 
     1536                        dev = fabs(avgRenderCost - (float)vc->GetPvs().EvalPvsCost()); 
    15371537                else 
    15381538                        dev = fabs(expectedRenderCost - renderCost); 
     
    16431643 
    16441644        // update pvs size 
    1645         UpdateScalarPvsSize(vc, vc->GetPvs().CountObjectsInPvs(), vc->GetPvs().GetSize()); 
     1645        UpdateScalarPvsSize(vc, vc->GetPvs().EvalPvsCost(), vc->GetPvs().GetSize()); 
    16461646 
    16471647        return vc; 
     
    21552155 
    21562156 
     2157void ViewCellsManager::SetViewCellActive(ViewCell *vc) const 
     2158{ 
     2159        ViewCellContainer leaves; 
     2160        // sets the pointers to the currently active view cells 
     2161        mViewCellsTree->CollectLeaves(vc, leaves); 
     2162 
     2163        ViewCellContainer::const_iterator lit, lit_end = leaves.end(); 
     2164        for (lit = leaves.begin(); lit != lit_end; ++ lit) 
     2165        { 
     2166                dynamic_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(vc); 
     2167        } 
     2168} 
     2169 
     2170 
    21572171void ViewCellsManager::SetViewCellsActive() 
    21582172{ 
    2159         // collect leaf view cells and set the pointers to the currently 
    2160         // active view cells 
     2173        // collect leaf view cells and set the pointers to  
     2174        // the currently active view cells 
    21612175        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
    21622176 
    21632177        for (it = mViewCells.begin(); it != it_end; ++ it) 
    21642178        { 
    2165                 ViewCellContainer leaves; 
    2166                 mViewCellsTree->CollectLeaves(*it, leaves); 
    2167  
    2168                 ViewCellContainer::const_iterator lit, lit_end = leaves.end(); 
    2169                 for (lit = mViewCells.begin(); lit != lit_end; ++ lit) 
    2170                 { 
    2171                         dynamic_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(*it); 
    2172                 } 
     2179                SetViewCellActive(*it); 
    21732180        } 
    21742181} 
     
    25702577                // we assume that pvs is explicitly stored in leaves 
    25712578                pvs = root->GetPvs(); 
    2572                 UpdateScalarPvsSize(root, pvs.CountObjectsInPvs(), pvs.GetSize()); 
     2579                UpdateScalarPvsSize(root, pvs.EvalPvsCost(), pvs.GetSize()); 
    25732580                 
    25742581                return; 
     
    26372644         
    26382645        // set new pvs size 
    2639         UpdateScalarPvsSize(interior, pvs.CountObjectsInPvs(), pvs.GetSize()); 
     2646        UpdateScalarPvsSize(interior, pvs.EvalPvsCost(), pvs.GetSize()); 
    26402647         
    26412648#else  
     
    57205727        { 
    57215728                ViewCell *vc = *vit; 
    5722                 int pvs = vc->GetPvs().CountObjectsInPvs(); 
     5729                int pvs = vc->GetPvs().EvalPvsCost(); 
    57235730                float vol = vc->GetVolume(); 
    57245731                rc += pvs * vol; 
Note: See TracChangeset for help on using the changeset viewer.