Changeset 1745 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 11/13/06 23:41:00 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1744 r1745 737 737 738 738 if (sc->IsDirty()) 739 c out << "*******************************error!" << endl;739 cerr << "Error: Should never come here!" << endl; 740 740 741 741 if (!success) // split was not taken 742 742 { 743 cout << "x";744 743 return false; 745 744 } … … 988 987 if ((steps >= maxSteps) || ((priority < threshold) && !(steps < minSteps))) 989 988 { 990 cout << "\n**************** breaking on " << priority 991 << " smaller than " << threshold << endl; 989 cout << "\nbreaking on " << priority << " smaller than " << threshold << endl; 992 990 break; 993 991 } … … 1831 1829 1832 1830 1831 void 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 1833 1861 int HierarchyManager::ExtractStatistics(const int maxSplits, 1834 1862 const float maxMemoryCost, … … 1837 1865 int &pvsEntries, 1838 1866 int &viewSpaceSplits, 1839 int &objectSpaceSplits) 1867 int &objectSpaceSplits, 1868 const bool useFilter) 1840 1869 { 1841 1870 ViewCellContainer viewCells; … … 1858 1887 renderCost = 0.0f; 1859 1888 1860 //BvhNode::NewMail();1861 //int dummy = 0;1862 1889 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1863 1890 { 1864 1891 float rc = 0; 1865 1892 ViewCell *vc = *vit; 1893 1866 1894 ObjectPvs pvs; 1867 1895 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 } 1895 1907 1896 1908 rc *= vc->GetVolume(); … … 2082 2094 2083 2095 void HierarchyManager::EvaluateSubdivision2(ofstream &splitsStats, 2084 const int splitsStepSize) 2096 const int splitsStepSize, 2097 const bool useFilter) 2085 2098 { 2086 2099 HierarchySubdivisionStats subStats; … … 2096 2109 subStats.mEntriesInPvs, 2097 2110 subStats.mViewSpaceSplits, 2098 subStats.mObjectSpaceSplits); 2111 subStats.mObjectSpaceSplits, 2112 useFilter); 2099 2113 2100 2114 … … 2123 2137 cout << subStats.mNumSplits << " "; 2124 2138 } 2139 2125 2140 cout << endl; 2126 2141 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1744 r1745 288 288 289 289 inline bool ConsiderMemory() const { return mConsiderMemory; } 290 //inline float GetMemoryConst() const { return mMemoryConst; }291 290 292 291 void EvaluateSubdivision(const VssRayContainer &sampleRays, … … 295 294 296 295 void EvaluateSubdivision2(ofstream &splitsStats, 297 const int splitsStepSize); 296 const int splitsStepSize, 297 const bool useFilter); 298 298 299 299 … … 523 523 int &pvsEntries, 524 524 int &viewSpaceSplits, 525 int &objectSpaceSplits); 526 525 int &objectSpaceSplits, 526 const bool useFilter); 527 528 void ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries); 527 529 528 530 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1744 r1745 441 441 442 442 443 /*template <typename T, typename S> void Pvs<T, S>::QuickMerge(const Pvs<T, S> &a)444 {445 const int samples = mSamples + a.mSamples;446 447 std::vector<PvsEntry<T, S>> >::const_iterator it;448 449 for (it = mEntries.begin(); it != mEntries.end(); ++ it)450 {451 it->first->Mail();452 }453 454 for (it = a.mEntries.begin(); it != a.mEntries.end(); ++ it)455 {456 if (!it->first->Mailed())457 {458 mEntries.push_back(*it);459 }460 }461 462 mSamples = samples;463 }*/464 465 466 443 template <typename T, typename S> void Pvs<T, S>::Clear() 467 444 { -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1740 r1745 206 206 Name="VCLinkerTool" 207 207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 208 OutputFile="../bin/release/Preprocessor .exe"208 OutputFile="../bin/release/Preprocessor2.exe" 209 209 LinkIncremental="1" 210 210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtGlRenderer\Release" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1742 r1745 1748 1748 1749 1749 // add newly found pvs to merged pvs 1750 ObjectPvs interPvs;1750 //cout << "samples vc: " << vc->GetPvs().GetSamples() << " samples pvs: " << pvs.GetSamples() << endl; 1751 1751 pvs.MergeInPlace(vc->GetPvs()); 1752 1752 //cout << "new samples: " << pvs.GetSamples() << endl; 1753 1753 if (!vc->IsLeaf()) // interior cells: go down to leaf level 1754 1754 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1744 r1745 6055 6055 6056 6056 ofstream ofstr(filename.c_str()); 6057 mHierarchyManager->EvaluateSubdivision2(ofstr, splitsStepSize );6057 mHierarchyManager->EvaluateSubdivision2(ofstr, splitsStepSize, false); 6058 6058 6059 6059 timeDiff = TimeDiff(startTime, GetTime()); … … 6062 6062 6063 6063 Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 6064 6065 #if 0 6066 //////////////////////////// 6067 // filtered stats 6068 sprintf(suffix, "-%09d-eval-filter.log", castSamples); 6069 const string filename2 = string(statsPrefix) + string(suffix); 6070 6071 startTime = GetTime(); 6072 6073 cout << "compute new statistics for filtered pvs ... " << endl; 6074 6075 ofstream ofstr2(filename2.c_str()); 6076 mHierarchyManager->EvaluateSubdivision2(ofstr2, splitsStepSize, true); 6077 6078 timeDiff = TimeDiff(startTime, GetTime()); 6079 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 6080 cout << "*************************************" << endl; 6081 6082 Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 6083 #endif 6064 6084 6065 6085 // only for debugging purpose
Note: See TracChangeset
for help on using the changeset viewer.