Ignore:
Timestamp:
06/09/06 01:26:46 (18 years ago)
Author:
mattausch
Message:

started viewspace-objectspace subdivision
removed memory leaks

File:
1 edited

Legend:

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

    r1004 r1006  
    124124        Environment::GetSingleton()->GetIntValue("VspBspTree.nodePriorityQueueType", mNodePriorityQueueType); 
    125125 
    126         Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.emptyViewCellsMerge", mEmptyViewCellsMergeAllowed); 
    127126         
    128127        char subdivisionStatsLog[100]; 
     
    132131        Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.minBand", mMinBand); 
    133132        Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.maxBand", mMaxBand); 
    134         Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisForMaxCost); 
     133        Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisIfMaxCostViolated); 
    135134 
    136135        //-- debug output 
     
    161160        Debug << "use random axis: " << mUseRandomAxis << endl; 
    162161        Debug << "priority queue type: " << mNodePriorityQueueType << endl; 
    163         Debug << "empty view cells merge: " << mEmptyViewCellsMergeAllowed << endl; 
    164162        Debug << "circulating axis: " << mCirculatingAxis << endl; 
    165163        Debug << "minband: " << mMinBand << endl; 
    166164        Debug << "maxband: " << mMaxBand << endl; 
    167         Debug << "use driving axis for max cost: " << mUseDrivingAxisForMaxCost << endl; 
     165        Debug << "use driving axis for max cost: " << mUseDrivingAxisIfMaxCostViolated << endl; 
    168166 
    169167        Debug << "Split plane strategy: "; 
     
    11941192                } 
    11951193           
    1196                 if (ray->mOriginObject)  
     1194                // only count termination objects? 
     1195                if (1 && ray->mOriginObject)  
    11971196                { 
    11981197                        if (vc->AddPvsSample(ray->mOriginObject, ray->mPdf, contribution)) 
     
    14821481        const float maxCostRatioForArbitraryAxis = 0.9f; 
    14831482 
    1484         if (mUseDrivingAxisForMaxCost) 
     1483        if (mUseDrivingAxisIfMaxCostViolated) 
    14851484                bestAxis = box.Size().DrivingAxis(); 
    14861485        else 
     
    15231522                                                                                        nPosition[axis]);                        
    15241523                        } 
    1525                          
    1526                         //-- split plane position is spatial median 
    1527  
    1528  
    1529                         // also use median split if cost ratio very low as 
    1530                         // there are not enough visibility cues 
    1531                         //if (!mUseCostHeuristics || (nCostRatio[axis] > maxCostRatioForHeur)) 
    1532                         else  
     1524                        else //-- split plane position is spatial median 
    15331525                        { 
    15341526 
     
    15781570                                                 
    15791571                         
    1580                         if (mUseDrivingAxisForMaxCost) 
     1572                        if (mUseDrivingAxisIfMaxCostViolated) 
    15811573                        { 
    15821574                                // we take longest axis split if cost ratio exceeds threshold 
     
    17101702        } 
    17111703 
     1704 
    17121705        //-- evaluate axis aligned splits 
     1706         
    17131707        int axis; 
    17141708        BspNodeGeometry *fGeom, *bGeom; 
     
    17171711        candidateCost = 99999999.0f; 
    17181712 
    1719         // option: axis aligned split only if no polygon available 
     1713        // as a variant, we take axis aligned split only if there is  
     1714        // more polygon available to guide the split 
    17201715        if (!mUsePolygonSplitIfAvailable || data.mPolygons->empty()) 
    17211716        { 
     
    19321927 
    19331928#if 1 
    1934         // take render cost of node into account 
     1929        // take render cost of node into account to avoid being stuck in a local minimum 
    19351930        const float normalizedOldRenderCost = oldRenderCost / mBox.GetVolume(); 
     1931         
    19361932        //Debug << "rendercostdecr: " << 0.99f * renderCostDecrease << " old render cost: " << 0.01f * normalizedOldRenderCost << endl; 
    1937         //return 0.5f * renderCostDecrease + 0.5f * normalizedOldRenderCost; 
    19381933        return 0.99f * renderCostDecrease + 0.01f * normalizedOldRenderCost; 
    19391934#else 
     
    19561951        float pvsBack = 0; 
    19571952         
     1953        // overall probability is used as normalizer 
     1954        float pOverall = 0; 
     1955 
    19581956        // probability that view point lies in back / front node 
    1959         float pOverall = 0; 
    19601957        pFront = 0; 
    19611958        pBack = 0; 
     
    35323529 
    35333530 
    3534 typedef pair<BspNode *, BspNodeGeometry *> bspNodePair; 
    3535  
    3536  
    35373531int VspBspTree::CastBeam(Beam &beam) 
    35383532{ 
     
    36563650                                MergeCandidate mc(leaf->GetViewCell(), (*nit)->GetViewCell()); 
    36573651 
    3658                                 // dont't merge view cells if they are empty and not front and back leaf of the same parent 
    3659                                 // in the tree? 
    3660                                 if (mEmptyViewCellsMergeAllowed || 
    3661                                         !leaf->GetViewCell()->GetPvs().Empty() ||  
     3652                                if (!leaf->GetViewCell()->GetPvs().Empty() ||  
    36623653                                        !(*nit)->GetViewCell()->GetPvs().Empty() || 
    36633654                    leaf->IsSibling(*nit)) 
Note: See TracChangeset for help on using the changeset viewer.