Ignore:
Timestamp:
11/24/06 12:05:28 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1786 r1787  
    18131813 
    18141814 
    1815 // TODO matt: implement this function for different storing methods 
    1816 void HierarchyManager::GetPvsIncrementally(ViewCell *vc, ObjectPvs &pvs) const 
     1815void HierarchyManager::GetPvsEfficiently(ViewCell *viewCell, ObjectPvs &pvs) const 
    18171816{ 
    18181817        //////////////// 
     
    18211820        // add pvs from leaves 
    18221821        stack<ViewCell *> tstack; 
    1823         tstack.push(vc); 
     1822        tstack.push(viewCell); 
     1823 
     1824        Intersectable::NewMail(); 
    18241825 
    18251826        while (!tstack.empty()) 
    18261827        { 
    1827                 vc = tstack.top(); 
     1828                ViewCell *vc = tstack.top(); 
    18281829                tstack.pop(); 
    18291830         
     
    18311832                if (!vc->GetPvs().Empty()) 
    18321833                { 
    1833                         if (vc->IsLeaf()) cout << " l " << pvs.GetSize(); 
    1834                         else cout << " i " << pvs.GetSize(); 
    1835                         pvs.MergeInPlace(vc->GetPvs()); 
     1834                        ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1835 
     1836                        while (pit.HasMoreEntries()) 
     1837                        {                
     1838                                const ObjectPvsEntry &entry = pit.Next(); 
     1839 
     1840                                Intersectable *object = entry.mObject; 
     1841                                if (!object->Mailed()) 
     1842                                { 
     1843                                        object->Mail(); 
     1844                                        pvs.AddSampleDirty(object, 1.0f); 
     1845                                } 
     1846                        } 
    18361847                } 
    18371848                else if (!vc->IsLeaf()) // interior cells: go down to leaf level 
    18381849                { 
    1839                         cout <<" t"; 
    18401850                        ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 
    18411851                        ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
     
    18461856                        }                
    18471857                } 
     1858        } 
     1859} 
     1860 
     1861 
     1862// TODO matt: implement this function for different storing methods 
     1863void HierarchyManager::GetPvsIncrementially(ViewCell *vc, ObjectPvs &pvs) const 
     1864{ 
     1865        //////////////// 
     1866        //-- pvs is not stored with the interiors => reconstruct 
     1867         
     1868        // add pvs from leaves 
     1869        stack<ViewCell *> tstack; 
     1870        tstack.push(vc); 
     1871 
     1872        while (!tstack.empty()) 
     1873        { 
     1874                vc = tstack.top(); 
     1875                tstack.pop(); 
     1876         
     1877                // add newly found pvs to merged pvs: break here even for interior 
     1878                if (!vc->GetPvs().Empty()) 
     1879                { 
     1880                        //if (vc->IsLeaf()) cout << " l " << pvs.GetSize(); 
     1881                        //else cout << " i " << pvs.GetSize(); 
     1882                        pvs.MergeInPlace(vc->GetPvs()); 
     1883                } 
     1884                else if (!vc->IsLeaf()) // interior cells: go down to leaf level 
     1885                { 
     1886                        //cout <<" t"; 
     1887                        ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 
     1888                        ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
     1889 
     1890                        for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1891                        { 
     1892                                tstack.push(*it); 
     1893                        }                
     1894                } 
    18481895                else cout <<"k"; 
    18491896        } 
     
    18751922                if (!vc->GetPvs().Empty()) 
    18761923                { 
    1877                         /*if (vc->IsLeaf())  
    1878                                 cout << " l " << viewCell->GetPvs().GetSize(); 
    1879                         else cout << " i " << viewCell->GetPvs().GetSize(); 
    1880                         */ 
    1881                                 viewCell->GetPvs().MergeInPlace(vc->GetPvs()); 
     1924                        viewCell->GetPvs().MergeInPlace(vc->GetPvs()); 
    18821925                } 
    18831926                else if (!vc->IsLeaf()) // interior cells: go down to leaf level 
     
    19632006        ViewCell::NewMail(); 
    19642007 
    1965         cout << "\n**************viewcells: " << viewCells.size() << endl; 
     2008        //cout << "\nviewcells: " << viewCells.size() << endl; 
    19662009        for (vit = viewCells.begin(); vit != vit_end; ++ vit) 
    19672010        { 
    19682011                ViewCell *vc = *vit; 
    1969  
    1970                 //cout << "\nhere5: "; 
    19712012                float rc = 0; 
    19722013         
    19732014#if STUPID_METHOD        
    19742015                ObjectPvs pvs; 
    1975                 GetPvsIncrementally(vc, pvs); 
     2016                GetPvsIncrementially(vc, pvs); 
    19762017                vc->SetPvs(pvs); 
     2018                 
    19772019#else 
    1978                 //PullUpPvsIncrementally(vc); 
     2020         
    19792021                ObjectPvs pvs; 
    1980                 GetPvsRecursive(vc, pvs); 
    1981                 vc->SetPvs(pvs); 
     2022                //GetPvsRecursive(vc, pvs); 
     2023                 
     2024                // uses mailing 
     2025                // warning: pvs not sorted!! 
     2026                if (vc->GetPvs().Empty()) 
     2027                { 
     2028                        GetPvsEfficiently(vc, pvs); 
     2029                        vc->SetPvs(pvs); 
     2030                        //cout << "q"; 
     2031                } 
     2032                //else cout << "t"; 
    19822033#endif 
    19832034 
     
    19912042                        const long endT = GetTime(); 
    19922043 
    1993                         cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl; 
     2044                        //cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl; 
    19942045                        ComputePvs(filteredPvs, rc, pvsEntries); 
    19952046                } 
Note: See TracChangeset for help on using the changeset viewer.