Changeset 2584 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/09/08 15:22:12 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2560 r2584 125 125 OptimizeForProcessor="2" 126 126 OptimizeForWindowsApplication="TRUE" 127 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin "127 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin;..\src\havran" 128 128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PVS;USE_CG" 129 129 StringPooling="TRUE" … … 1053 1053 </File> 1054 1054 <File 1055 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 1056 </File> 1057 <File 1055 1058 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 1056 </File>1057 <File1058 RelativePath=".\sparsehash\src\windows\hash_fun.h">1059 1059 </File> 1060 1060 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogReader.cpp
r2580 r2584 12 12 13 13 14 /*void LogReader::Read(ViewCellHistoryContainer &history)14 void LogReader::Read(int &numSamples, ViewCellInfoContainer &infos) 15 15 { 16 int numViewCells, numSamples; 17 18 // open file 19 std::ifstream src(mFilename.c_str()); 20 21 if (src.is_open()) 22 { 23 src >> numViewCells; 24 src >> numSamples; 25 26 while (!src.eof()) 27 { 28 ViewCellInfoContainer *infos = new ViewCellInfoContainer(); 29 30 for (size_t i = 0; i << numViewCells; ++ i) 31 { 32 ViewCellInfo info; 33 src >> info.mPiercingRays; 34 infos->push_back(info); 35 } 36 37 history[numSamples] = infos; 38 } 39 40 src.close(); 41 } 42 }*/ 43 44 45 void LogReader::Read(const int numSamples, ViewCellInfoContainer &infos) 46 { 47 char filename[64]; 16 //char filename[64]; 48 17 //sprintf(filename, "%s %06d", mFilename.c_str(), numSamples); 49 50 18 // open file 51 19 std::ifstream src(mFilename.c_str()); … … 53 21 if (src.is_open()) 54 22 { 55 while (!src.eof()) 23 src >> numSamples; 24 25 while (1) 56 26 { 57 27 ViewCellInfo info; 58 src >> info.mPiercingRays; 59 28 src >> info.mPiercingRays; src >> info.mPvsSize; 29 30 if (src.eof()) break; 31 60 32 infos.push_back(info); 61 33 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogReader.h
r2581 r2584 27 27 class LogReader 28 28 { 29 public: 29 30 void SetFilename(const std::string &filename); 30 31 … … 34 35 /** Reads the viewcells info from disc 35 36 */ 36 void Read( const intnumSamples, ViewCellInfoContainer &infos);37 void Read(int &numSamples, ViewCellInfoContainer &infos); 37 38 38 39 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogWriter.cpp
r2581 r2584 23 23 24 24 25 void LogWriter::Write(//ofstream &myfile, 26 const int numSamples, const ViewCellInfoContainer &infos) 25 void LogWriter::Write(const int numSamples, const ViewCellContainer &viewCells) 27 26 { 28 27 ofstream myfile; … … 32 31 myfile.open(mFilename.c_str()); 33 32 34 ViewCell InfoContainer::const_iterator vit, vit_end = infos.end();33 ViewCellContainer::const_iterator vit, vit_end =viewCells.end(); 35 34 36 35 myfile << numSamples << endl; 37 36 38 for (vit = infos.begin(); vit != vit_end; ++ vit)37 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 39 38 { 40 myfile << (*vit).mPiercingRays << " " << (*vit).mPvsSize << endl; 41 //myfile << (*vit); 42 //ViewCell *vc = *vit; 43 //myfile << "vc: " << vc->GetPvs().GetSize() << " " << vc->GetNumPiercingRays(); 39 myfile << (*vit)->GetNumPiercingRays() << " " << (*vit)->GetPvs().GetSize() << endl; 44 40 } 45 41 } 46 42 47 /*48 void LogWriter::Write(const ViewCellHistoryContainer &hist)49 {50 //ofstream myfile;51 //char filename[64];52 //sprintf(filename, "%s %06d", mFilename.c_str(), numSamples);53 //myfile.open(filename);54 if (!mFile.is_open())55 mFile.open(mFilename.c_str());56 57 ViewCellHistoryContainer::const_iterator vit, vit_end = hist.end();58 59 // number of samples60 //myfile << "samples: " << numSamples << endl;61 mFile << (int)hist.size() << endl;62 63 for (vit = hist.begin(); vit != vit_end; ++ vit)64 {65 Write(myfile, (*vit).first, *(*vit).second);66 }67 43 } 68 69 */70 71 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogWriter.h
r2580 r2584 23 23 void SetFilename(const std::string &filename); 24 24 25 //void Write(const int numSamples, const ViewCellContainer &viewcells); 26 void Write(//std::ofstream &myfile, 27 const int numSamples, const ViewCellInfoContainer &infos); 28 //void Write(const ViewCellHistoryContainer &hist); 25 void Write(const int numSamples, const ViewCellContainer &viewcells); 26 29 27 30 28 protected: 31 29 32 //std::ofstream mFile;33 30 std::string mFilename; 34 31 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2581 r2584 846 846 mRenderVisibilityEstimates = false; 847 847 848 mHistRecorded = false;849 850 848 mHideByCost = false; 851 849 mUseTransparency = false; … … 885 883 mShowRays = false; 886 884 887 mNextSamples = SAMPLES_INCR;888 885 mControlWidget = new QtRendererControlWidget(NULL); 889 886 890 887 connect(mControlWidget, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); 891 connect(mControlWidget, 892 SIGNAL(SetTransferFunction(int)), 893 this, 894 SLOT(SetTransferFunction(int))); 888 connect(mControlWidget, SIGNAL(SetTransferFunction(int)), this, SLOT(SetTransferFunction(int))); 889 895 890 connect(mControlWidget, SIGNAL(UpdateAllPvs()), this, SLOT(UpdateAllPvs())); 896 891 connect(mControlWidget, SIGNAL(ComputeVisibility()), this, SLOT(ComputeVisibility())); 897 892 connect(mControlWidget, SIGNAL(StopComputation()), this, SLOT(StopComputation())); 898 connect(mControlWidget, SIGNAL(SetRandomViewPoint()), this, 899 SLOT(SetRandomViewPoint()));893 connect(mControlWidget, SIGNAL(SetRandomViewPoint()), this, SLOT(SetRandomViewPoint())); 894 connect(mControlWidget, SIGNAL(StoreStatistics(void)), this, SLOT(StoreStatistics(void))); 900 895 901 896 connect(mControlWidget, SIGNAL(SetSceneCut(int)), this, SLOT(SetSceneCut(int))); … … 965 960 QtGlRendererWidget::SetRandomViewPoint() 966 961 { 967 cerr<<"s top computation called!\n"<<endl;962 cerr<<"setting random view point!\n"<<endl; 968 963 mViewCellsManager->GetViewPoint(mViewPoint); 964 updateGL(); 965 } 966 967 968 void QtGlRendererWidget::StoreStatistics() 969 { 970 cerr<<"storing statistics!\n"<<endl; 971 const int currentSamples = mViewCellsManager->GetPreprocessor()->mCurrentSamples; 972 973 cout<<"**********************************************" << endl; 974 cout << "reached " << currentSamples << " samples " << " => writing file" << endl; 975 976 LogWriter writer; 977 writer.SetFilename("compare.log"); 978 writer.Write(currentSamples, mViewCellsManager->GetViewCells()); 979 cout << "finished writing file" << endl; 980 mCompareInfo.clear(); 969 981 updateGL(); 970 982 } … … 1306 1318 1307 1319 1308 1309 void QtGlRendererWidget::FillNewContainer(const ViewCellContainer &viewCells, ViewCellInfoContainer &infos)1310 {1311 ViewCellContainer::const_iterator vit, vit_end = viewCells.end();1312 1313 for (vit = viewCells.begin(); vit != vit_end; ++ vit)1314 {1315 ViewCell *vc = *vit;1316 ViewCellInfo info;1317 1318 info.mPiercingRays = vc->GetNumPiercingRays();1319 1320 infos.push_back(info);1321 //myfile << "vc: " << vc->GetPvs().GetSize() << " " << vc->GetNumPiercingRays();1322 }1323 }1324 1325 1326 1327 1320 void QtGlRendererWidget::RenderViewCells() 1328 1321 { … … 1347 1340 } 1348 1341 1349 mNextSamples = 200000;1350 1351 1342 ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 1352 const int currentSamples = mViewCellsManager->GetPreprocessor()->mCurrentSamples; 1353 //cout << "current samples: " << currentSamples << endl; 1354 1355 if (!mHistRecorded && (currentSamples > mNextSamples)) 1356 { 1357 mHistRecorded = true; 1358 1359 //mNextSamples += SAMPLES_INCR; 1360 cout<<"************************************************" << endl; 1361 cout << "reached " << currentSamples << " samples " << " => writing file" << endl; 1362 //ViewCellInfoContainer newContainer; 1363 1364 mCurrentInfo.clear(); 1365 FillNewContainer(viewcells, mCurrentInfo); 1366 //mCurrentHist[mNextSamples] = newContainer; 1367 1368 LogWriter writer; 1369 writer.SetFilename("compare.log"); 1370 writer.Write(mNextSamples, mCurrentInfo); 1371 1372 cout << "finished writing file" << endl; 1373 } 1374 1343 1375 1344 int maxPvs, maxPiercingRays; 1376 1345 float maxRelativeRays, maxRcCost; … … 1428 1397 } 1429 1398 1430 if (!mShowComparison) //mAssignImportanceByRelativeValue)1399 if (!mShowComparison) 1431 1400 AssignImportanceByRelativeValue(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 1432 1401 else 1433 1402 { 1434 mCurrentInfo.clear();1435 FillNewContainer(viewcells, mCurrentInfo);1436 1437 //ViewCellInfoContainer *infos1 = mCurrentHist[mNextSamples];1438 //ViewCellInfoContainer *infos2 = mCompareHist[mNextSamples];1439 1440 //AssignColorByComparison(viewcells, *infos1, *infos2);1441 AssignColorByComparison(viewcells, //mCurrentInfo, 1442 1403 if (mCompareInfo.empty()) 1404 { 1405 LogReader reader; 1406 reader.SetFilename("compare.log"); 1407 int samples; 1408 reader.Read(samples, mCompareInfo); 1409 } 1410 1411 AssignColorByComparison(viewcells, mCompareInfo); 1443 1412 } 1444 1413 … … 1513 1482 const ViewCellInfoContainer &compareInfo) 1514 1483 { 1515 1516 const float maxRatio = 1.0f; 1517 const float minRatio = 0.5f; 1484 //cout << "comparing " << viewcells.size() << " view cells to " << compareInfo.size() << " values" << endl; 1485 1486 if (viewcells.size() > compareInfo.size()) 1487 { 1488 cerr << "loaded size (" << compareInfo.size() << ") does not fit to view cells size (" << viewcells.size() << ")" << endl; 1489 return; 1490 } 1491 1492 //const float maxRatio = 1.0f; 1493 const float maxRatio = 2.0f; 1494 const float minRatio = 0.0f; 1518 1495 1519 1496 const float scale = 1.0f / (maxRatio - minRatio); … … 1527 1504 ViewCellInfo vc2Info = compareInfo[i]; 1528 1505 1529 const float vcRatio = vc->GetNumPiercingRays() / vc2Info.mPiercingRays + Limits::Small; 1506 //const float vcRatio = vc->GetNumPiercingRays() / vc2Info.mPiercingRays + Limits::Small; 1507 float vcRatio = 1.0f;//maxRatio; 1508 1509 if (vc2Info.mPvsSize > Limits::Small) 1510 vcRatio = (float)vc->GetPvs().GetSize() / vc2Info.mPvsSize; 1511 1512 // truncate here 1513 if (vcRatio > maxRatio) vcRatio = 1.0f; 1530 1514 1531 1515 const float importance = (vcRatio - minRatio) * scale; 1516 1517 if (i < 20) 1518 { 1519 cout << "pvs1: " << vc->GetPvs().GetSize() << " pvs2: " << compareInfo[i].mPvsSize << " importance: " << importance << endl; 1520 } 1532 1521 1533 1522 // c = RgbColor(importance, 1.0f - importance, 0.0f); … … 1744 1733 1745 1734 myBox->setLayout(vh); 1746 1747 1735 vl->addWidget(myBox, 0, 0); 1748 1736 1749 1737 QGroupBox *groupBox = CreateVisualizationPanel(hbox); 1750 1751 1738 vh->addWidget(groupBox, 0, 0); 1752 1739 1753 1740 QGroupBox *groupBox2 = CreateRenderCostPanel(hbox); 1754 1755 1741 vh->addWidget(groupBox2, 0, 0); 1756 1742 … … 1900 1886 1901 1887 1902 vbox = new QGroupBox("PVS Errors", this);1888 /*vbox = new QGroupBox("PVS Errors", this); 1903 1889 layout()->addWidget(vbox); 1904 1890 … … 1916 1902 button = new QPushButton("Set Random View Point", vbox); 1917 1903 vbox->layout()->addWidget(button); 1918 connect(button, SIGNAL(clicked()), SLOT(SetRandomViewPoint())); 1919 1920 1904 connect(button, SIGNAL(clicked()), SLOT(SetRandomViewPoint()));*/ 1905 1906 button = new QPushButton("Store statistics", vbox); 1907 vbox->layout()->addWidget(button); 1908 connect(button, SIGNAL(clicked()), SIGNAL(StoreStatistics())); 1909 1910 /*cb = new QCheckBox("Stats", vbox); 1911 vbox->layout()->addWidget(cb); 1912 cb->setChecked(false); 1913 connect(cb, SIGNAL(toggled(bool)), SIGNAL(StoreStatistics())); 1914 */ 1921 1915 if (0) 1922 1916 { … … 1940 1934 } 1941 1935 1936 //connect(button, SIGNAL(clicked(void)), SLOT(StoreStatistics(void))); 1942 1937 //mHidingCost = 0.1f; 1943 1938 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2581 r2584 105 105 void StopComputation(); 106 106 void SetRandomViewPoint(); 107 void StoreStatistics(); 107 108 void UpdateAllPvs(); 108 109 void SetViewCellGranularity(int); … … 185 186 bool mShowWeightedTriangles; 186 187 187 /// the current number of samples188 //int mCurrentSamples;189 /// the next number of samples where we record the data190 int mNextSamples;191 bool mHistRecorded;192 193 188 // some statistics 194 189 int mPvsSize; … … 198 193 unsigned int mIndexBufferSize; 199 194 200 //bool mAssignImportanceByRelativeValue;201 202 195 Vector3 mDummyViewPoint; 203 196 … … 206 199 QtPreprocessorThread *mPreprocessorThread; 207 200 208 int mCurrentSamples;209 210 //ViewCellHistoryContainer mCurrentHist;211 //ViewCellHistoryContainer mCompareHist;212 213 ViewCellInfoContainer mCurrentInfo;214 201 ViewCellInfoContainer mCompareInfo; 215 202 … … 223 210 QtGlRendererWidget() {}; 224 211 225 void FillNewContainer(const ViewCellContainer &viewCells, ViewCellInfoContainer &infos); 226 227 228 void SetThread(QtPreprocessorThread *t) { 212 void SetThread(QtPreprocessorThread *t) 213 { 229 214 mPreprocessorThread = t; 230 215 } … … 288 273 const ViewCellInfoContainer &compareInfo); 289 274 275 void WriteViewCellInfos(); 276 290 277 291 278 ///////// … … 300 287 void StopComputation(); 301 288 void SetRandomViewPoint(); 289 void StoreStatistics(); 302 290 303 291 void SetRenderErrors(bool b) { … … 452 440 453 441 float ComputeRenderCost(ViewCell *vc); 442 443 454 444 455 445 ///////// -
GTP/trunk/Lib/Vis/Preprocessing/src/ReverseGvs.cpp
r2582 r2584 380 380 // mlrtaTraverseGroupASEye4(&box.Min().x, &box.Max().x, hit_triangles, dist); 381 381 assert(preprocessor->mRayCaster); 382 preprocessor->mRayCaster->CastRaysPacket4( &box.Min(), &box.Max(), origs,382 preprocessor->mRayCaster->CastRaysPacket4(box.Min(), box.Max(), origs, 383 383 dirs, hit_triangles, dist); 384 384
Note: See TracChangeset
for help on using the changeset viewer.