Ignore:
Timestamp:
08/30/06 21:54:49 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1297 r1302  
    2323 
    2424 
     25 
    2526namespace GtpVisibilityPreprocessor { 
    2627 
     
    3233 
    3334VspTree *VspTree::VspSubdivisionCandidate::sVspTree = NULL; 
    34  
     35int VspNode::sMailId = 1; 
    3536 
    3637// variable for debugging volume contribution for heuristics 
    3738static float debugVol; 
    3839 
    39 int VspNode::sMailId = 1; 
    4040 
    4141// pvs penalty can be different from pvs size 
     
    5353                return (float)upper; 
    5454        } 
    55  
    5655        return (float)pvs; 
    5756} 
     
    299298 
    300299 
    301 VspLeaf::VspLeaf(): mViewCell(NULL), mPvs(NULL) 
     300VspLeaf::VspLeaf(): mViewCell(NULL), mPvs(NULL), mSubdivisionCandidate(NULL) 
    302301{ 
    303302} 
     
    554553                // || mOutOfMemory 
    555554                || (mVspStats.Leaves() >= mMaxViewCells) 
    556         || (mGlobalCostMisses >= mTermGlobalCostMissTolerance)  
     555        //|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance)  
    557556                ); 
    558557 
     
    630629        VspSubdivisionCandidate *sc =  
    631630                dynamic_cast<VspSubdivisionCandidate *>(splitCandidate); 
     631 
    632632        VspTraversalData &tData = sc->mParentData; 
    633  
    634633        VspNode *newNode = tData.mNode; 
    635634 
     
    735734 
    736735        // max cost threshold violated? 
    737         splitCandidate.mMaxCostMisses =  
    738                 maxCostRatioViolated  ?  
     736        splitCandidate.mMaxCostMisses = maxCostRatioViolated  ?  
    739737                        splitCandidate.mParentData.mMaxCostMisses + 1: 
    740738                        splitCandidate.mParentData.mMaxCostMisses; 
     
    749747        splitCandidate.SetRenderCostDecrease(renderCostDecr); 
    750748 
    751 #if 0 
     749#if 1 
    752750        const float priority = (float)-splitCandidate.mParentData.mDepth; 
    753 #else    
    754  
     751#else 
    755752        // take render cost of node into account  
    756753        // otherwise danger of being stuck in a local minimum!! 
     
    785782 
    786783        //-- compute pvs 
     784 
    787785        frontData.mPvs = EvalPvsSize(*frontData.mRays); 
    788786        backData.mPvs = EvalPvsSize(*backData.mRays); 
     
    815813     
    816814        VspInterior *interior = new VspInterior(splitPlane); 
    817  
    818 #ifdef _DEBUG 
    819         Debug << interior << endl; 
    820 #endif+ 
    821815 
    822816 
     
    11961190        float minSum = 1e20f; 
    11971191 
    1198          
    11991192        // if no good split can be found, take mid split 
    12001193        position = minBox + 0.5f * sizeBox; 
     
    12091202 
    12101203        //-- traverse through visibility events 
    1211  
    12121204        vector<SortableEntry>::const_iterator ci, ci_end = mLocalSubdivisionCandidates->end(); 
    12131205 
     
    13731365        Intersectable::NewMail(3); 
    13741366        KdLeaf::NewMail(3); 
    1375         //for (int i=0;i<25;++i) BvhLeaf::NewMail(); 
    13761367        BvhLeaf::NewMail(3); 
    13771368 
     
    13921383                // evaluate contribution of ray endpoint to front and back pvs 
    13931384                // with respect to the classification 
    1394                 //Debug << "mail1:  " << BvhLeaf::sMailId << endl; 
    13951385                UpdateContributionsToPvs(*ray, true, cf, pvsFront, pvsBack, totalPvs);   
    1396                 //Debug << "mail2:  " << BvhLeaf::sMailId << endl; 
    13971386                UpdateContributionsToPvs(*ray, false, cf, pvsFront, pvsBack, totalPvs); 
    1398                 //Debug << "mail3:  " << BvhLeaf::sMailId << endl; 
    1399         } 
    1400  
     1387        } 
    14011388 
    14021389        AxisAlignedBox3 frontBox; 
     
    14121399 
    14131400        //-- pvs rendering heuristics 
     1401 
    14141402        const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 
    14151403        const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 
    14161404 
    1417         //-- only render cost heuristics or combined with standard deviation 
    1418  
     1405        // only render cost heuristics or combined with standard deviation 
    14191406        const float penaltyOld = EvalPvsPenalty((int)totalPvs, lowerPvsLimit, upperPvsLimit); 
    14201407    const float penaltyFront = EvalPvsPenalty((int)pvsFront, lowerPvsLimit, upperPvsLimit); 
     
    14841471         
    14851472#ifdef _DEBUG 
    1486         Debug << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 
    1487         Debug << pFront << " " << pBack << " " << pOverall << endl; 
     1473        Debug << "axis: " << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 
     1474        Debug << "p: " << pFront << " " << pBack << " " << pOverall << endl; 
    14881475#endif 
    14891476 
     
    26622649        VspSubdivisionCandidate *splitCandidate = new VspSubdivisionCandidate(vData); 
    26632650    EvalSubdivisionCandidate(*splitCandidate); 
     2651        leaf->SetSubdivisionCandidate(splitCandidate); 
    26642652 
    26652653        mTotalCost = (float)pvsSize; 
     
    26742662                                                                        vector<SubdivisionCandidate *> &dirtyList) const 
    26752663{ 
     2664 
    26762665        Intersectable *obj; 
    26772666        Vector3 pt; 
     
    26792668 
    26802669        ray.GetSampleData(isTermination, pt, &obj, &node); 
    2681  
     2670         
    26822671        if (!obj) return; 
    26832672 
     
    26932682                                dirtyList.push_back(leaf->mSubdivisionCandidate); 
    26942683                        } 
    2695  
    26962684                        break; 
    26972685                } 
    26982686        case HierarchyManager::BV_BASED_OBJ_SUBDIV: 
    26992687                { 
     2688                        BvhLeaf *leaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj); 
     2689 
     2690                        if (!leaf->Mailed()) 
     2691                        { 
     2692                                leaf->Mail(); 
     2693                                dirtyList.push_back(leaf->GetSubdivisionCandidate()); 
     2694                                Debug << "here120 candidate: " << leaf->GetSubdivisionCandidate() << " type: " << leaf->GetSubdivisionCandidate()->Type() << endl; 
     2695                        } 
     2696                        break; 
    27002697                } 
    27012698                break; 
     
    27142711        KdLeaf::NewMail(); 
    27152712        BvhLeaf::NewMail(); 
    2716  
     2713         
    27172714        RayInfoContainer::const_iterator rit, rit_end = tData.mRays->end(); 
    27182715 
     
    27212718        { 
    27222719                VssRay *ray = (*rit).mRay; 
    2723          
     2720                 
    27242721                CollectDirtyCandidate(*ray, true, dirtyList); 
    27252722                CollectDirtyCandidate(*ray, false, dirtyList); 
Note: See TracChangeset for help on using the changeset viewer.