Changeset 2580 for GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Timestamp:
- 01/09/08 10:22:15 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogReader.cpp
r2578 r2580 12 12 13 13 14 void LogReader::Read(ViewCellHistoryContainer &history)14 /*void LogReader::Read(ViewCellHistoryContainer &history) 15 15 { 16 /*std::vector<int>::const_iterator it, it_end = numSamples.end();17 18 for (it = numSamples.begin(); it != it_end; ++ it)19 {20 int numSamples = *it;21 22 Read(numSamples, infos);23 }*/24 25 16 int numViewCells, numSamples; 26 17 … … 49 40 src.close(); 50 41 } 51 } 42 }*/ 52 43 53 44 54 /*void LogReader::Read(const int numSamples, ViewCellInfoContainer &infos)45 void LogReader::Read(const int numSamples, ViewCellInfoContainer &infos) 55 46 { 56 47 char filename[64]; 57 sprintf(filename, "%s %06d", mFilename.c_str(), numSamples);48 //sprintf(filename, "%s %06d", mFilename.c_str(), numSamples); 58 49 59 50 // open file 60 std::ifstream src( filename);51 std::ifstream src(mFilename.c_str()); 61 52 62 53 if (src.is_open()) … … 65 56 { 66 57 ViewCellInfo info; 67 68 58 src >> info.mPiercingRays; 69 59 … … 76 66 src.close(); 77 67 } 78 } */68 } 79 69 80 70 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogReader.h
r2578 r2580 21 21 22 22 typedef std::vector<ViewCellInfo> ViewCellInfoContainer; 23 typedef std::map<int, ViewCellInfoContainer *> ViewCellHistoryContainer;23 //typedef std::map<int, ViewCellInfoContainer *> ViewCellHistoryContainer; 24 24 25 26 /*struct ViewCellHistory;27 {28 }*/29 25 30 26 class LogReader … … 34 30 /** Reads the info for several #samples. 35 31 */ 36 void Read(ViewCellHistoryContainer &history);37 /** Reads the viewcells info after specific #samples.32 //void Read(ViewCellHistoryContainer &history); 33 /** Reads the viewcells info from disc 38 34 */ 39 35 void Read(const int numSamples, ViewCellInfoContainer &infos); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogWriter.cpp
r2576 r2580 7 7 8 8 9 LogWriter::LogWriter() 10 { 11 } 12 13 14 LogWriter::LogWriter(const std::string &filename): mFilename(filename) 15 { 16 } 17 18 9 19 void LogWriter::SetFilename(const std::string &filename) 10 20 { … … 13 23 14 24 15 void LogWriter::Write(ofstream &myfile, const int numSamples, const ViewCellInfoContainer &infos) 25 void LogWriter::Write(//ofstream &myfile, 26 const int numSamples, const ViewCellInfoContainer &infos) 16 27 { 28 ofstream myfile; 29 myfile.open(mFilename.c_str()); 30 31 if (!myfile.is_open()) 32 myfile.open(mFilename.c_str()); 33 17 34 ViewCellInfoContainer::const_iterator vit, vit_end = infos.end(); 18 35 … … 25 42 } 26 43 27 44 /* 28 45 void LogWriter::Write(const ViewCellHistoryContainer &hist) 29 46 { 30 ofstream myfile; 31 47 //ofstream myfile; 32 48 //char filename[64]; 33 49 //sprintf(filename, "%s %06d", mFilename.c_str(), numSamples); 34 50 //myfile.open(filename); 35 myfile.open(mFilename.c_str()); 51 if (!mFile.is_open()) 52 mFile.open(mFilename.c_str()); 36 53 37 54 ViewCellHistoryContainer::const_iterator vit, vit_end = hist.end(); … … 39 56 // number of samples 40 57 //myfile << "samples: " << numSamples << endl; 41 m yfile << (int)hist.size() << endl;58 mFile << (int)hist.size() << endl; 42 59 43 60 for (vit = hist.begin(); vit != vit_end; ++ vit) … … 47 64 } 48 65 66 */ 67 49 68 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogWriter.h
r2576 r2580 17 17 class LogWriter 18 18 { 19 public: 20 21 LogWriter(); 22 LogWriter(const std::string &filename); 19 23 void SetFilename(const std::string &filename); 20 24 21 25 //void Write(const int numSamples, const ViewCellContainer &viewcells); 22 void Write(std::ofstream &myfile, const int numSamples, const ViewCellInfoContainer &infos); 23 void Write(const ViewCellHistoryContainer &hist); 26 void Write(//std::ofstream &myfile, 27 const int numSamples, const ViewCellInfoContainer &infos); 28 //void Write(const ViewCellHistoryContainer &hist); 24 29 25 30 protected: 26 31 32 //std::ofstream mFile; 27 33 std::string mFilename; 28 34 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2577 r2580 16 16 #include "Material.h" 17 17 #include "IntersectableWrapper.h" 18 #include "LogWriter.h" 18 19 19 20 … … 44 45 QtGlDebuggerWidget *debuggerWidget = NULL; 45 46 47 const static int SAMPLES_INCR = 2000000; 46 48 47 49 static inline bool ilt(Intersectable *obj1, Intersectable *obj2) … … 860 862 mUseFilter = tmp; 861 863 862 Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter", 863 tmp ); 864 Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter", tmp ); 864 865 mUseSpatialFilter = tmp; 866 867 //mLogWriter = new LogWriter("myfile.out"); 865 868 866 869 mShowRenderCost = false; 867 870 mShowPvsSizes = false; 871 mShowComparison = false; 868 872 mShowPiercingRays = false; 869 873 mShowWeightedRays = false; … … 879 883 mShowRays = false; 880 884 885 mNextSamples = SAMPLES_INCR; 881 886 mControlWidget = new QtRendererControlWidget(NULL); 882 887 … … 904 909 connect(mControlWidget, SIGNAL(SetUseTransparency(bool)), this, SLOT(SetUseTransparency(bool))); 905 910 connect(mControlWidget, SIGNAL(SetShowPvsSizes(bool)), this, SLOT(SetShowPvsSizes(bool))); 911 connect(mControlWidget, SIGNAL(SetShowComparison(bool)), this, SLOT(SetShowComparison(bool))); 906 912 connect(mControlWidget, SIGNAL(SetTopView(bool)), this, SLOT(SetTopView(bool))); 907 913 connect(mControlWidget, SIGNAL(SetCutViewCells(bool)), this, SLOT(SetCutViewCells(bool))); … … 1341 1347 int i; 1342 1348 1343 mRecordHist = false; 1344 //mRecordHist = true; 1349 //mRecordHist = false; 1350 mRecordHist = true; 1351 mNextSamples = 2000000; 1345 1352 1346 1353 ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 1347 1348 if (mRecordHist && (mSamples > mNextSamples)) 1349 { 1350 mNextSamples += 2000000; 1351 1352 ViewCellInfoContainer *newContainer = new ViewCellInfoContainer(); 1353 1354 FillNewContainer(viewcells, *newContainer); 1355 mCurrentHist[mNextSamples] = newContainer; 1354 const int currentSamples = mViewCellsManager->GetPreprocessor()->mCurrentSamples; 1355 //cout << "current samples: " << currentSamples << endl; 1356 1357 if (mRecordHist && (currentSamples > mNextSamples)) 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 cout << "finished writing file" << endl; 1356 1372 } 1357 1373 … … 1410 1426 } 1411 1427 1412 if ( mAssignImportanceByRelativeValue)1428 if (!mShowComparison)//mAssignImportanceByRelativeValue) 1413 1429 AssignImportanceByRelativeValue(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 1414 1430 else 1415 1431 { 1416 ViewCellInfoContainer *infos1 = mCurrentHist[mCurrentSamples]; 1417 ViewCellInfoContainer *infos2 = mCompareHist[mCurrentSamples]; 1418 AssignColorByComparison(viewcells, *infos1, *infos2); 1419 } 1420 1432 mCurrentInfo.clear(); 1433 FillNewContainer(viewcells, mCurrentInfo); 1434 1435 //ViewCellInfoContainer *infos1 = mCurrentHist[mNextSamples]; 1436 //ViewCellInfoContainer *infos2 = mCompareHist[mNextSamples]; 1437 1438 //AssignColorByComparison(viewcells, *infos1, *infos2); 1439 AssignColorByComparison(viewcells, //mCurrentInfo, 1440 mCompareInfo); 1441 } 1421 1442 1422 1443 glEnable(GL_DEPTH_TEST); … … 1487 1508 1488 1509 void QtGlRendererWidget::AssignColorByComparison(const ViewCellContainer &viewcells, 1489 const ViewCellInfoContainer &infos1,1490 const ViewCellInfoContainer & infos2)1491 { 1492 1493 const float maxRatio = 2;1494 const float minRatio = 0.5 ;1510 //const ViewCellInfoContainer &infos1, 1511 const ViewCellInfoContainer &compareInfo) 1512 { 1513 1514 const float maxRatio = 1.0f; 1515 const float minRatio = 0.5f; 1495 1516 1496 1517 const float scale = 1.0f / (maxRatio - minRatio); … … 1501 1522 ViewCell *vc = viewcells[i]; 1502 1523 1503 ViewCellInfo vc1Info = infos1[i];1504 ViewCellInfo vc2Info = infos2[i];1505 1506 const float vcRatio = vc 1Info.mPiercingRays/ vc2Info.mPiercingRays + Limits::Small;1524 //ViewCellInfo vc1Info = infos1[i]; 1525 ViewCellInfo vc2Info = compareInfo[i]; 1526 1527 const float vcRatio = vc->GetNumPiercingRays() / vc2Info.mPiercingRays + Limits::Small; 1507 1528 1508 1529 const float importance = (vcRatio - minRatio) * scale; … … 1526 1547 /**********************************************************************/ 1527 1548 1528 #if 1 1549 1529 1550 QGroupBox *QtRendererControlWidget::CreateVisualizationPanel(QWidget *parent) 1530 1551 { … … 1707 1728 cb->setChecked(false); 1708 1729 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 1730 1731 cb = new QCheckBox("Show Comparison", hbox); 1732 hlayout->addWidget(cb); 1733 cb->setChecked(false); 1734 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowComparison(bool))); 1709 1735 1710 1736 … … 1943 1969 1944 1970 1945 #endif1946 1947 1971 1948 1972 /*********************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2577 r2580 41 41 struct RenderCostSample; 42 42 43 //class LogWriter; 44 45 43 46 44 47 class QtGlRendererBuffer : public QObject, public QGLPixelBuffer, public GlRendererBuffer … … 124 127 void SetShowPiercingRays(bool); 125 128 void SetShowWeightedRays(bool); 129 void SetShowComparison(bool); 126 130 void SetShowWeightedCost(bool); 127 131 … … 163 167 164 168 bool mShowPvsSizes; 169 bool mShowComparison; 165 170 float mSpatialFilterSize; 166 171 172 //LogWriter *mLogWriter; 167 173 Plane3 mSceneCutPlane; 168 174 float mHidingCost; … … 180 186 181 187 /// the current number of samples 182 int mSamples;188 //int mCurrentSamples; 183 189 /// the next number of samples where we record the data 184 190 int mNextSamples; … … 192 198 unsigned int mIndexBufferSize; 193 199 194 bool mAssignImportanceByRelativeValue;200 //bool mAssignImportanceByRelativeValue; 195 201 196 202 Vector3 mDummyViewPoint; … … 202 208 int mCurrentSamples; 203 209 204 ViewCellHistoryContainer mCurrentHist; 205 ViewCellHistoryContainer mCompareHist; 206 210 //ViewCellHistoryContainer mCurrentHist; 211 //ViewCellHistoryContainer mCompareHist; 212 213 ViewCellInfoContainer mCurrentInfo; 214 ViewCellInfoContainer mCompareInfo; 207 215 208 216 QtGlRendererWidget(SceneGraph *sceneGraph, 209 ViewCellsManager *viewcells, 210 KdTree *tree, 211 QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WFlags f = 0 212 ); 217 ViewCellsManager *viewcells, 218 KdTree *tree, 219 QWidget * parent = 0, 220 const QGLWidget *shareWidget = 0, 221 Qt::WFlags f = 0); 213 222 214 223 QtGlRendererWidget() {}; … … 276 285 277 286 void AssignColorByComparison(const ViewCellContainer &viewcells, 278 const ViewCellInfoContainer &info1,279 const ViewCellInfoContainer & info2);287 //const ViewCellInfoContainer &info1, 288 const ViewCellInfoContainer &compareInfo); 280 289 281 290 … … 368 377 void SetShowPvsSizes(bool b) { 369 378 mShowPvsSizes = b; 379 updateGL(); 380 } 381 382 void SetShowComparison(bool b) { 383 mShowComparison = b; 370 384 updateGL(); 371 385 }
Note: See TracChangeset
for help on using the changeset viewer.