Ignore:
Timestamp:
04/06/06 18:37:31 (18 years ago)
Author:
mattausch
Message:

added cost flexible render cost measurements

File:
1 edited

Legend:

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

    r728 r729  
    6969} 
    7070 
    71  
     71/// Fast computation of merged pvs size 
    7272int ComputeMergedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 
    7373{ 
     74        // add first pvs 
    7475        int pvs = pvs1.GetSize(); 
    7576 
    76         // compute new pvs size 
    7777        ObjectPvsMap::const_iterator it, it_end =  pvs1.mEntries.end(); 
    7878 
    7979        Intersectable::NewMail(); 
    8080 
     81        // mail all objects in first pvs 
    8182        for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 
    8283        { 
     
    8687        it_end = pvs2.mEntries.end(); 
    8788 
     89        // look if they are in second pvs 
    8890        for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 
    8991        { 
     
    9496 
    9597        return pvs; 
     98} 
     99 
     100// computet render cost of merge 
     101float ViewCellsTree::ComputeMergedPvsCost(const ObjectPvs &pvs1, const ObjectPvs &pvs2) const 
     102{ 
     103        float renderCost = 0; 
     104 
     105        // compute new pvs size 
     106        ObjectPvsMap::const_iterator it, it_end =  pvs1.mEntries.end(); 
     107 
     108        Intersectable::NewMail(); 
     109 
     110        // first mail all objects in first pvs 
     111        for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 
     112        { 
     113                Intersectable *obj = (*it).first; 
     114 
     115                obj->Mail(); 
     116                renderCost += mViewCellsManager->EvalRenderCost(obj); 
     117        } 
     118 
     119        it_end = pvs2.mEntries.end(); 
     120 
     121         
     122        for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 
     123        { 
     124                Intersectable *obj = (*it).first; 
     125 
     126                // test if object already considered     
     127                if (!obj->Mailed()) 
     128                { 
     129                        renderCost += mViewCellsManager->EvalRenderCost(obj); 
     130                } 
     131        } 
     132 
     133        return renderCost; 
    96134} 
    97135 
     
    12121250{ 
    12131251        //-- compute pvs difference 
    1214         const int newPvs =  
     1252        const float newPvs =  
     1253#if 0 
    12151254                ComputeMergedPvsSize(mc.mLeftViewCell->GetPvs(),  
    12161255                                                         mc.mRightViewCell->GetPvs()); 
    1217                          
    1218         const float newPenalty =  
    1219                 EvalPvsPenalty(newPvs, 
    1220                                            mViewCellsManager->GetMinPvsSize(), 
    1221                                            mViewCellsManager->GetMaxPvsSize()); 
     1256#else 
     1257                ComputeMergedPvsCost(mc.mLeftViewCell->GetPvs(),  
     1258                                                         mc.mRightViewCell->GetPvs()); 
     1259#endif 
     1260 
     1261        const float newPenalty = EvalPvsPenalty(newPvs, 
     1262                                                                                        mViewCellsManager->GetMinPvsSize(), 
     1263                                                                                        mViewCellsManager->GetMaxPvsSize()); 
    12221264 
    12231265        ViewCell *vc1 = mc.mLeftViewCell; 
Note: See TracChangeset for help on using the changeset viewer.