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/BvHierarchy.cpp

    r1298 r1302  
    2929int BvhNode::sReservedMailboxes = 1; 
    3030 
    31  
    3231BvHierarchy *BvHierarchy::BvhSubdivisionCandidate::sBvHierarchy = NULL; 
    33  
    3432 
    3533 
     
    8583 
    8684BvhLeaf::BvhLeaf(const AxisAlignedBox3 &bbox): 
    87 BvhNode(bbox) 
     85BvhNode(bbox), mSubdivisionCandidate(NULL) 
    8886{ 
    8987} 
     
    430428 
    431429        const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 
    432         const float oldRenderCost =  
    433                 splitCandidate.mParentData.mProbability * (float)leaf->mObjects.size() / viewSpaceVol; 
     430        const float oldProp = EvalViewCellsVolume(leaf->mObjects); 
     431        const float oldProp2 = splitCandidate.mParentData.mProbability; //Debug << "here8 " << (oldProp - oldProp2) / viewSpaceVol << "  " << oldProp  / viewSpaceVol << " " << oldProp2  / viewSpaceVol << endl; 
     432 
     433        const float oldRenderCost = oldProp * (float)leaf->mObjects.size() / viewSpaceVol; 
    434434 
    435435        // compute global decrease in render cost 
    436436        float newRenderCost = EvalRenderCost(splitCandidate.mParentData, 
    437                                                                              splitCandidate.mFrontObjects,  
     437                                                                             splitCandidate.mFrontObjects, 
    438438                                                                                 splitCandidate.mBackObjects); 
    439439 
     
    445445        splitCandidate.SetRenderCostDecrease(renderCostDecr); 
    446446 
    447 #if 0 
     447#if 1 
    448448        const float priority = (float)-splitCandidate.mParentData.mDepth; 
    449449#else    
     
    452452        const float factor = mRenderCostDecreaseWeight; 
    453453        const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    454  
    455454#endif 
    456455 
     
    476475        return (0 
    477476                || (mBvhStats.Leaves() >= mTermMaxLeaves) 
    478                 || (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 
     477                //|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 
    479478                //|| mOutOfMemory  
    480479                ); 
     
    574573        } 
    575574 
    576         const float oldRenderCost = tData.mProbability * (float)tData.mNode->mObjects.size(); 
    577         const float newRenderCost =  
    578                 EvalRenderCost(tData, objectsFront, objectsBack); 
     575        const float oldProp = EvalViewCellsVolume(tData.mNode->mObjects); 
     576        //const float oldProp2 = tData.mProbability; Debug << "here65 " << oldProp - oldProp2 << endl; 
     577 
     578        const float oldRenderCost = oldProp * (float)tData.mNode->mObjects.size(); 
     579        const float newRenderCost = EvalRenderCost(tData, objectsFront, objectsBack); 
    579580 
    580581        const float ratio = newRenderCost / oldRenderCost; 
     
    960961 
    961962        //-- pvs rendering heuristics 
    962         const float newRenderCost = nObjectsFront * pFront +  
    963                                                                 nObjectsBack * pBack; 
    964  
     963        const float newRenderCost = nObjectsFront * pFront + nObjectsBack * pBack; 
     964        /* 
    965965        const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 
    966         /*Debug << "\nbvh render cost\n"  
     966        Debug << "\nbvh render cost\n"  
    967967                  << "back p: " << pBack / viewSpaceVol << " front p " << pFront / viewSpaceVol << endl 
    968968                  << "new rc: " << newRenderCost / viewSpaceVol << endl;*/ 
    969                   
    970969 
    971970        return newRenderCost; 
     
    11001099 
    11011100        Debug << "collecting " << (int)viewCells.size() << " dirty candidates" << endl; 
     1101 
    11021102        for (vit = viewCells.begin(); vit != vit_end; ++ vit) 
    11031103        { 
     
    11051105                VspLeaf *leaf = vc->mLeaf; 
    11061106                SubdivisionCandidate *candidate = leaf->GetSubdivisionCandidate(); 
     1107                Debug << "here100 candidate: " << candidate << " type: " << candidate->Type() << endl; 
    11071108                 
    11081109                dirtyList.push_back(leaf->GetSubdivisionCandidate()); 
     
    13011302 
    13021303        // compute bounding box from objects 
    1303         // we assume that root was already created 
     1304        // note: we assume that root was already created 
    13041305        mBoundingBox = mRoot->GetBoundingBox(); 
    13051306        BvhLeaf *bvhleaf = dynamic_cast<BvhLeaf *>(mRoot); 
     
    13111312        AssociateObjectsWithRays(sampleRays); 
    13121313         
    1313  
    13141314        // probabilty is voume of all "seen" view cells 
    13151315#if 1 
     
    13261326                new BvhSubdivisionCandidate(oData); 
    13271327 
    1328         //UpdateViewCellsPvs(kdleaf, rays); 
    1329  
    13301328        EvalSubdivisionCandidate(*oSubdivisionCandidate); 
     1329        bvhleaf->SetSubdivisionCandidate(oSubdivisionCandidate); 
    13311330 
    13321331        const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 
Note: See TracChangeset for help on using the changeset viewer.