Ignore:
Timestamp:
11/13/06 23:41:00 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1744 r1745  
    737737 
    738738        if (sc->IsDirty()) 
    739                 cout << "*******************************error!" << endl; 
     739                cerr << "Error: Should never come here!" << endl; 
    740740 
    741741        if (!success) // split was not taken 
    742742        { 
    743                 cout << "x"; 
    744743                return false; 
    745744        } 
     
    988987                if ((steps >= maxSteps) || ((priority < threshold) && !(steps < minSteps))) 
    989988                { 
    990                         cout << "\n**************** breaking on " << priority  
    991                                  << " smaller than " << threshold << endl; 
     989                        cout << "\nbreaking on " << priority << " smaller than " << threshold << endl; 
    992990                        break; 
    993991                } 
     
    18311829 
    18321830 
     1831void HierarchyManager::ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries) 
     1832{ 
     1833        BvhNode::NewMail(); 
     1834 
     1835        ObjectPvsIterator pit = pvs.GetIterator(); 
     1836 
     1837        while (pit.HasMoreEntries()) 
     1838        { 
     1839                ObjectPvsEntry entry = pit.Next(); 
     1840 
     1841                BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>(entry.mObject); 
     1842 
     1843                BvhLeaf *leaf = intersect->GetItem(); 
     1844                BvhNode *activeNode = leaf->GetActiveNode(); 
     1845 
     1846                if (!activeNode->Mailed()) 
     1847                { 
     1848                        activeNode->Mail(); 
     1849 
     1850                        ObjectContainer objects; 
     1851                        activeNode->CollectObjects(objects); 
     1852 
     1853                        ++ pvsEntries; 
     1854                        rc += mBvHierarchy->EvalAbsCost(objects); 
     1855                        //cout << " pvs: " << mBvHierarchy->EvalAbsCost(leaf->mObjects); 
     1856                } 
     1857        } 
     1858} 
     1859 
     1860 
    18331861int HierarchyManager::ExtractStatistics(const int maxSplits, 
    18341862                                                                                const float maxMemoryCost, 
     
    18371865                                                                                int &pvsEntries, 
    18381866                                                                                int &viewSpaceSplits, 
    1839                                                                                 int &objectSpaceSplits) 
     1867                                                                                int &objectSpaceSplits, 
     1868                                                                                const bool useFilter) 
    18401869{ 
    18411870        ViewCellContainer viewCells; 
     
    18581887        renderCost = 0.0f; 
    18591888 
    1860         //BvhNode::NewMail(); 
    1861         //int dummy = 0; 
    18621889        for (vit = viewCells.begin(); vit != vit_end; ++ vit) 
    18631890        { 
    18641891                float rc = 0; 
    18651892                ViewCell *vc = *vit; 
     1893 
    18661894                ObjectPvs pvs; 
    18671895                mVspTree->mViewCellsTree->GetPvs(vc, pvs); 
    1868                 //dummy+=pvs.GetSize(); 
    1869                 BvhNode::NewMail(); 
    1870  
    1871                 // hack: should not be done here 
    1872                 ObjectPvsIterator pit = pvs.GetIterator(); 
    1873  
    1874                 while (pit.HasMoreEntries()) 
    1875                 { 
    1876                         ObjectPvsEntry entry = pit.Next(); 
    1877  
    1878                         BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>(entry.mObject); 
    1879  
    1880                         BvhLeaf *leaf = intersect->GetItem(); 
    1881                         BvhNode *activeNode = leaf->GetActiveNode(); 
    1882  
    1883                         if (!activeNode->Mailed()) 
    1884                         { 
    1885                                 activeNode->Mail(); 
    1886  
    1887                                 ObjectContainer objects; 
    1888                                 activeNode->CollectObjects(objects); 
    1889  
    1890                                 ++ pvsEntries; 
    1891                                 rc += mBvHierarchy->EvalAbsCost(objects); 
    1892                                 //cout << " pvs: " << mBvHierarchy->EvalAbsCost(leaf->mObjects); 
    1893                         } 
    1894                 } 
     1896 
     1897                if (useFilter) 
     1898                { 
     1899                        ObjectPvs filteredPvs; 
     1900                        mVspTree->mViewCellsManager->ApplyFilter2(vc, false, 1.0f, filteredPvs); 
     1901                        ComputePvs(filteredPvs, rc, pvsEntries); 
     1902                } 
     1903                else 
     1904                { 
     1905                        ComputePvs(pvs, rc, pvsEntries); 
     1906                }                
    18951907 
    18961908                rc *= vc->GetVolume(); 
     
    20822094 
    20832095void HierarchyManager::EvaluateSubdivision2(ofstream &splitsStats, 
    2084                                                                                         const int splitsStepSize) 
     2096                                                                                        const int splitsStepSize, 
     2097                                                                                        const bool useFilter) 
    20852098{ 
    20862099        HierarchySubdivisionStats subStats; 
     
    20962109                                                                                                subStats.mEntriesInPvs, 
    20972110                                                                                                subStats.mViewSpaceSplits, 
    2098                                                                                                 subStats.mObjectSpaceSplits); 
     2111                                                                                                subStats.mObjectSpaceSplits, 
     2112                                                                                                useFilter); 
    20992113 
    21002114                 
     
    21232137                cout << subStats.mNumSplits << " "; 
    21242138        } 
     2139 
    21252140        cout << endl; 
    21262141} 
Note: See TracChangeset for help on using the changeset viewer.