Ignore:
Timestamp:
03/07/07 16:26:58 (17 years ago)
Author:
mattausch
Message:

using mutationsamples for evaluation

File:
1 edited

Legend:

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

    r2198 r2199  
    2727#define USE_VOLUMES_FOR_HEURISTICS 1 
    2828#define TEST_POWERPLANT 0 
    29    
     29#define USE_BETTER_RENDERCOST_EST 0 
     30 
    3031//int BvhNode::sMailId = 10000; 
    3132//int BvhNode::sReservedMailboxes = 1; 
     
    172173        } 
    173174} 
     175 
     176 
    174177 
    175178/******************************************************************/ 
     
    673676        // high avg ray contri, the result is influenced by undersampling 
    674677        splitCandidate.SetAvgRayContribution(avgRayContri); 
    675         const float viewSpaceVol =  GetViewSpaceVolume(); 
     678        const float viewSpaceVol = GetViewSpaceVolume(); 
    676679 
    677680        const float oldVolume = EvalViewCellsVolume(leaf->mObjects) / viewSpaceVol; 
     
    10461049                Intersectable *obj = (*cit).mObject; 
    10471050 
    1048                 const float renderCost = mViewCellsManager->EvalRenderCost(obj); 
     1051#if USE_BETTER_RENDERCOST_EST 
     1052                const float renderCost = ViewCellsManager::EvalRenderCost(obj); 
    10491053                 
    10501054                objectsLeft += renderCost; 
    10511055                objectsRight -= renderCost; 
    10521056 
     1057                const bool noValidSplit = ((objectsLeft <= Limits::Small) || (objectsRight <= Limits::Small)); 
     1058 
     1059#else 
     1060                ++ objectsLeft; 
     1061                -- objectsRight; 
     1062 
     1063                const bool noValidSplit = !objectsLeft || !objectsRight; 
     1064#endif 
    10531065                const AxisAlignedBox3 obox = obj->GetBox(); 
    10541066 
     
    10701082                ar = rbox.SurfaceArea(); 
    10711083 
    1072                 const bool noValidSplit = ((objectsLeft <= Limits::Small) || (objectsRight <= Limits::Small)); 
    10731084                const float sum = noValidSplit ? 1e25f : objectsLeft * al + objectsRight * ar; 
    10741085       
     
    13171328        float volRight = totalVol; 
    13181329         
     1330#if USE_BETTER_RENDERCOST_EST 
    13191331        const float nTotalObjects = EvalAbsCost(tData.mNode->mObjects); 
    13201332        float nObjectsLeft = 0; 
    13211333        float nObjectsRight = nTotalObjects; 
     1334#else 
     1335        const int nTotalObjects = (int)EvalAbsCost(tData.mNode->mObjects); 
     1336        int nObjectsLeft = 0; 
     1337        int nObjectsRight = (int)nTotalObjects; 
     1338#endif 
    13221339 
    13231340        const float viewSpaceVol =  
     
    13621379                EvalHeuristicsContribution(object, volLeft, volRight); 
    13631380 
    1364                 const float rc = mViewCellsManager->EvalRenderCost(object); 
    1365  
     1381#if USE_BETTER_RENDERCOST_EST 
     1382 
     1383                const float rc = ViewCellsManager::EvalRenderCost(object); 
     1384                 
    13661385                nObjectsLeft += rc; 
    13671386                nObjectsRight -= rc; 
     
    13701389                const bool noValidSplit = ((nObjectsLeft <= Limits::Small) ||  
    13711390                                                                   (nObjectsRight <= Limits::Small)); 
    1372  
     1391#else 
     1392                ++ nObjectsLeft; 
     1393                -- nObjectsRight; 
     1394 
     1395                // split is only valid if #objects on left and right is not zero 
     1396                const bool noValidSplit = !nObjectsLeft || !nObjectsRight; 
     1397 
     1398#endif 
     1399                 
    13731400                // the heuristics 
    13741401            const float sum = noValidSplit ?  
     
    13781405                if (printStats) 
    13791406                { 
    1380                         PrintHeuristics(nObjectsRight, sum, volLeft, volRight, viewSpaceVol, 
     1407                        PrintHeuristics(nObjectsRight, sum, volLeft,  
     1408                                                        volRight, viewSpaceVol, 
    13811409                                                        sumStats, vollStats, volrStats); 
    13821410                } 
     
    14321460void BvHierarchy::PrepareLocalSubdivisionCandidates(const BvhTraversalData &tData, 
    14331461                                                                                                        const int axis)                                                                                  
    1434 {mSort2Timer.Entry(); 
     1462{ 
     1463        mSortTimer.Entry(); 
     1464         
    14351465        //-- insert object queries 
    14361466        ObjectContainer *objects = mUseGlobalSorting ?  
     
    14381468 
    14391469        CreateLocalSubdivisionCandidates(*objects, &mSubdivisionCandidates, !mUseGlobalSorting, axis); 
    1440                 mSort2Timer.Exit(); 
     1470         
     1471        mSortTimer.Exit(); 
    14411472} 
    14421473 
     
    14661497        for (oit = objects.begin(); oit < oit_end; ++ oit) 
    14671498        { 
    1468                 Intersectable *object = *oit; 
    1469                 const AxisAlignedBox3 &box = object->GetBox(); 
    1470                 const float midPt = (box.Min(axis) + box.Max(axis)) * 0.5f; 
    1471  
    1472                 (*subdivisionCandidates)->push_back(SortableEntry(object, midPt)); 
     1499                (*subdivisionCandidates)->push_back(SortableEntry(*oit, (*oit)->GetBox().Center(axis))); 
    14731500        } 
    14741501 
     
    15021529        const bool onlyUnmailed = true; 
    15031530 
    1504         const int numRays = CollectViewCells(tData.mNode->mObjects,  
    1505                                                                                  viewCells,  
    1506                                                                                  setCounter,  
    1507                                                                                  onlyUnmailed); 
    1508  
    1509         //cout << "number of rays: " << numRays << endl; 
     1531         
     1532        CollectViewCells(tData.mNode->mObjects,  
     1533                                         viewCells,  
     1534                                         setCounter,  
     1535                                         onlyUnmailed); 
    15101536 
    15111537        ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 
     1538 
    15121539        for (vit = viewCells.begin(); vit != vit_end; ++ vit) 
    15131540        { 
     
    15201547        } 
    15211548 
    1522         // we will mail view cells switching to the back side 
     1549        // mail view cells that go from front node to back node 
    15231550        ViewCell::NewMail(); 
    15241551         
     
    15361563        // (also multiple times, if they are pierced by several rays) 
    15371564        ViewCellContainer viewCells; 
     1565 
    15381566        const bool useMailboxing = false; 
    1539  
    1540         CollectViewCells(obj, viewCells, useMailboxing, false, true); 
     1567        const bool setCounter = false; 
     1568        const bool onlyUnmailedRays = true; 
     1569 
     1570        CollectViewCells(obj, viewCells, useMailboxing, setCounter, onlyUnmailedRays); 
    15411571 
    15421572        // classify view cells and compute volume contri accordingly 
     
    15511581                // view cells can also be seen from left child node 
    15521582                ViewCell *viewCell = *vit; 
     1583 
    15531584#if USE_VOLUMES_FOR_HEURISTICS 
    15541585                const float vol = viewCell->GetVolume(); 
     
    22482279        int nViewCells = 0; 
    22492280 
    2250         //ViewCell::NewMail(); 
     2281        ViewCell::NewMail(); 
    22512282        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    22522283 
Note: See TracChangeset for help on using the changeset viewer.