Changeset 1787 for GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
- Timestamp:
- 11/24/06 12:05:28 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1786 r1787 1813 1813 1814 1814 1815 // TODO matt: implement this function for different storing methods 1816 void HierarchyManager::GetPvsIncrementally(ViewCell *vc, ObjectPvs &pvs) const 1815 void HierarchyManager::GetPvsEfficiently(ViewCell *viewCell, ObjectPvs &pvs) const 1817 1816 { 1818 1817 //////////////// … … 1821 1820 // add pvs from leaves 1822 1821 stack<ViewCell *> tstack; 1823 tstack.push(vc); 1822 tstack.push(viewCell); 1823 1824 Intersectable::NewMail(); 1824 1825 1825 1826 while (!tstack.empty()) 1826 1827 { 1827 vc = tstack.top();1828 ViewCell *vc = tstack.top(); 1828 1829 tstack.pop(); 1829 1830 … … 1831 1832 if (!vc->GetPvs().Empty()) 1832 1833 { 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 } 1836 1847 } 1837 1848 else if (!vc->IsLeaf()) // interior cells: go down to leaf level 1838 1849 { 1839 cout <<" t";1840 1850 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 1841 1851 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); … … 1846 1856 } 1847 1857 } 1858 } 1859 } 1860 1861 1862 // TODO matt: implement this function for different storing methods 1863 void 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 } 1848 1895 else cout <<"k"; 1849 1896 } … … 1875 1922 if (!vc->GetPvs().Empty()) 1876 1923 { 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()); 1882 1925 } 1883 1926 else if (!vc->IsLeaf()) // interior cells: go down to leaf level … … 1963 2006 ViewCell::NewMail(); 1964 2007 1965 cout << "\n**************viewcells: " << viewCells.size() << endl;2008 //cout << "\nviewcells: " << viewCells.size() << endl; 1966 2009 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1967 2010 { 1968 2011 ViewCell *vc = *vit; 1969 1970 //cout << "\nhere5: ";1971 2012 float rc = 0; 1972 2013 1973 2014 #if STUPID_METHOD 1974 2015 ObjectPvs pvs; 1975 GetPvsIncrement ally(vc, pvs);2016 GetPvsIncrementially(vc, pvs); 1976 2017 vc->SetPvs(pvs); 2018 1977 2019 #else 1978 //PullUpPvsIncrementally(vc);2020 1979 2021 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"; 1982 2033 #endif 1983 2034 … … 1991 2042 const long endT = GetTime(); 1992 2043 1993 cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl;2044 //cout << "filter computed in " << TimeDiff(startT, endT) * 1e-3f << " secs" << endl; 1994 2045 ComputePvs(filteredPvs, rc, pvsEntries); 1995 2046 }
Note: See TracChangeset
for help on using the changeset viewer.