Changeset 2679 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 05/15/08 16:00:23 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2677 r2679 28 28 -preprocessor=gvs \ 29 29 -gvs_epsilon=0.0001 \ 30 -gvs_total_samples=100000 0\31 -gvs_samples_per_pass=100000 0\30 -gvs_total_samples=100000 \ 31 -gvs_samples_per_pass=100000 \ 32 32 -gvs_initial_samples=16 \ 33 -gvs_max_viewcells= 20\33 -gvs_max_viewcells=1 \ 34 34 -gvs_min_contribution=50 \ 35 35 -gvs_per_viewcell=true \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2678 r2679 1022 1022 GlRendererBuffer::EvalPvsStat() 1023 1023 { 1024 MakeLive();1024 //MakeLive(); 1025 1025 1026 1026 GlRenderer::EvalPvsStat(); 1027 1027 1028 DoneLive();1028 //DoneLive(); 1029 1029 // mRenderingFinished.wakeAll(); 1030 1030 } … … 1033 1033 void GlRendererBuffer::EvalPvsStat(const SimpleRayContainer &viewPoints) 1034 1034 { 1035 MakeLive();1035 //MakeLive(); 1036 1036 1037 1037 GlRenderer::EvalPvsStat(viewPoints); 1038 1038 1039 DoneLive();1039 //DoneLive(); 1040 1040 } 1041 1041 … … 1476 1476 GlRenderer::EvalPvsStat() 1477 1477 { 1478 mPvsStat.Reset(); 1479 halton.Reset(); 1480 1481 SetupProjection(GetWidth(), GetHeight()); 1482 1483 cout << "Random Pvs STATS, mPvsStatFrames=" << mPvsStatFrames << endl; 1484 1485 for (int i=0; i < mPvsStatFrames; i++) { 1486 float err; 1487 // set frame id for saving the error buffer 1488 mFrame = i; 1489 1490 // cerr<<"RV"<<endl; 1491 RandomViewPoint(); 1492 // cerr<<"RV2"<<endl; 1493 1494 if (mPvsErrorBuffer[i].mError == 1.0f) { 1495 // check if the view point is valid 1496 if (!ValidViewPoint()) { 1497 mPvsErrorBuffer[i].mError = -1.0f; 1498 } 1499 1500 // manualy corrected view point 1501 if (mFrame == 5105) 1502 mPvsErrorBuffer[i].mError = -1.0f; 1503 } 1504 1505 1506 if (mPvsErrorBuffer[i].mError > 0.0f) { 1507 int pvsSize; 1508 1509 float error = GetPixelError(pvsSize); 1510 1511 mPvsErrorBuffer[i].mError = error; 1512 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1513 1514 //cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")"; 1515 } 1516 1517 err = mPvsErrorBuffer[i].mError; 1518 1519 if (err >= 0.0f) { 1520 if (err > mPvsStat.maxError) 1521 mPvsStat.maxError = err; 1522 mPvsStat.sumError += err; 1523 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 1524 1525 if (err == 0.0f) 1526 mPvsStat.errorFreeFrames++; 1527 mPvsStat.frames++; 1528 } 1529 } 1530 1531 glFinish(); 1532 1533 static bool first = true; 1534 if (first) { 1535 1536 1537 bool exportRandomViewCells; 1538 Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 1539 exportRandomViewCells); 1540 1541 if (0 && exportRandomViewCells) 1542 { 1543 char buff[512]; 1544 Environment::GetSingleton()->GetStringValue("Scene.filename", buff); 1545 string filename(buff); 1546 1547 string viewCellPointsFile; 1548 1549 if (strstr(filename.c_str(), ".obj")) 1550 viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc"); 1551 else if (strstr(filename.c_str(), ".dat")) 1552 viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc"); 1553 else if (strstr(filename.c_str(), ".x3d")) 1554 viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc"); 1555 1556 1557 cout << "exporting random view cells" << endl; 1558 preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 1559 cout << "finished" << endl; 1560 } 1561 first = false; 1562 } 1563 1564 cout<<endl<<flush; 1478 mPvsStat.Reset(); 1479 halton.Reset(); 1480 1481 SetupProjection(GetWidth(), GetHeight()); 1482 1483 cout << "Random Pvs STATS, mPvsStatFrames=" << mPvsStatFrames << endl; 1484 1485 for (int i=0; i < mPvsStatFrames; i++) { 1486 float err; 1487 // set frame id for saving the error buffer 1488 mFrame = i; 1489 1490 // cerr<<"RV"<<endl; 1491 RandomViewPoint(); 1492 // cerr<<"RV2"<<endl; 1493 1494 if (mPvsErrorBuffer[i].mError == 1.0f) { 1495 // check if the view point is valid 1496 if (!ValidViewPoint()) { 1497 mPvsErrorBuffer[i].mError = -1.0f; 1498 } 1499 1500 // manualy corrected view point 1501 if (mFrame == 5105) 1502 mPvsErrorBuffer[i].mError = -1.0f; 1503 } 1504 1505 1506 if (mPvsErrorBuffer[i].mError > 0.0f) 1507 { 1508 int pvsSize; 1509 1510 float error = GetPixelError(pvsSize); 1511 1512 mPvsErrorBuffer[i].mError = error; 1513 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1514 1515 //cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")"; 1516 } 1517 1518 err = mPvsErrorBuffer[i].mError; 1519 1520 if (err >= 0.0f) { 1521 if (err > mPvsStat.maxError) 1522 mPvsStat.maxError = err; 1523 mPvsStat.sumError += err; 1524 mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 1525 1526 if (err == 0.0f) 1527 mPvsStat.errorFreeFrames++; 1528 mPvsStat.frames++; 1529 } 1530 } 1531 1532 glFinish(); 1533 1534 static bool first = true; 1535 if (first) { 1536 1537 1538 bool exportRandomViewCells; 1539 Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 1540 exportRandomViewCells); 1541 1542 if (0 && exportRandomViewCells) 1543 { 1544 char buff[512]; 1545 Environment::GetSingleton()->GetStringValue("Scene.filename", buff); 1546 string filename(buff); 1547 1548 string viewCellPointsFile; 1549 1550 if (strstr(filename.c_str(), ".obj")) 1551 viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc"); 1552 else if (strstr(filename.c_str(), ".dat")) 1553 viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc"); 1554 else if (strstr(filename.c_str(), ".x3d")) 1555 viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc"); 1556 1557 1558 cout << "exporting random view cells" << endl; 1559 preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 1560 cout << "finished" << endl; 1561 } 1562 first = false; 1563 } 1564 1565 cout<<endl<<flush; 1565 1566 } 1566 1567 … … 1580 1581 for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i) 1581 1582 { 1582 if ((i % 10 ) == 99)1583 if ((i % 100) == 99) 1583 1584 cout << "processed " << i << " view points " << endl; 1584 1585 … … 1603 1604 1604 1605 const int pixelError = (int)mPvsErrorBuffer[i].mError * GetWidth() * GetHeight(); 1606 1605 1607 if (0 && (pixelError > 0) && (pvsSize > 0)) 1606 1608 { … … 1623 1625 mPvsStat.maxError = err; 1624 1626 1625 cout << "new max error: " << mPvsStat.maxError * GetWidth() *GetHeight() << endl;1627 cout << "new max error: " << mPvsStat.maxError * GetWidth() * GetHeight() << endl; 1626 1628 } 1627 1629 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2678 r2679 30 30 31 31 #include <QVBoxLayout> 32 static GLint cubeArray[][3] = { 33 {0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, 34 {0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}, 35 {0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}, 36 {0, 1, 0}, {0, 1, 1}, {1, 1, 1}, {1, 1, 0}, 37 {0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}, 38 {1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1} 39 }; 40 41 static GLint cubeTextureArray[][2] = { 42 {0, 0}, {1, 0}, {1, 1}, {0, 1}, 43 {0, 0}, {0, 1}, {1, 1}, {1, 0}, 44 {0, 0}, {1, 0}, {1, 1}, {0, 1}, 45 {1, 0}, {0, 0}, {0, 1}, {1, 1}, 46 {0, 0}, {1, 0}, {1, 1}, {0, 1}, 47 {1, 0}, {0, 0}, {0, 1}, {1, 1} 48 }; 49 50 static GLint faceArray[][2] = { 51 {1, -1}, {1, 1}, {-1, 1}, {-1, -1} 52 }; 53 54 static GLubyte colorArray[][4] = { 55 {170, 202, 0, 255}, 56 {120, 143, 0, 255}, 57 {83, 102, 0, 255}, 58 {120, 143, 0, 255} 59 }; 60 61 62 32 63 33 64 namespace GtpVisibilityPreprocessor … … 68 99 } 69 100 #endif 101 102 103 void QtGlRendererBuffer::dummyBuffer() 104 { 105 //QGLPixelBuffer *dummy = new QGLPixelBuffer(QSize(256, 256), format(), this); 106 107 // set up the pbuffer context 108 makeCurrent(); 109 110 glEnableClientState(GL_VERTEX_ARRAY); 111 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 112 glVertexPointer(3, GL_INT, 0, cubeArray); 113 glTexCoordPointer(2, GL_INT, 0, cubeTextureArray); 114 glColorPointer(4, GL_UNSIGNED_BYTE, 0, colorArray); 115 116 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 117 glEnable(GL_BLEND); 118 glEnable(GL_TEXTURE_2D); 119 glEnable(GL_DEPTH_TEST); 120 121 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 122 123 glViewport(0, 0, size().width(), size().height()); 124 glMatrixMode(GL_PROJECTION); 125 glLoadIdentity(); 126 glOrtho(-1, 1, -1, 1, -99, 99); 127 glTranslatef(-0.5f, -0.5f, 0.0f); 128 glMatrixMode(GL_MODELVIEW); 129 glLoadIdentity(); 130 131 132 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 133 134 // draw cube background 135 glPushMatrix(); 136 glLoadIdentity(); 137 glTranslatef(0.5f, 0.5f, -2.0f); 138 glDisable(GL_TEXTURE_2D); 139 glEnableClientState(GL_COLOR_ARRAY); 140 glVertexPointer(2, GL_INT, 0, faceArray); 141 glDrawArrays(GL_QUADS, 0, 4); 142 glVertexPointer(3, GL_INT, 0, cubeArray); 143 glDisableClientState(GL_COLOR_ARRAY); 144 glEnable(GL_TEXTURE_2D); 145 glPopMatrix(); 146 147 // draw cube 148 glTranslatef(0.5f, 0.5f, 0.5f); 149 glRotatef(3.0f, 1.0f, 1.0f, 1.0f); 150 glTranslatef(-0.5f, -0.5f, -0.5f); 151 glColor4f(0.9f, 0.9f, 0.9f, 1.0f); 152 glDrawArrays(GL_QUADS, 0, 24); 153 154 QImage im = toImage(); 155 QString qstr("test.png"); 156 157 im.save(qstr, "PNG"); 158 159 doneCurrent(); 160 } 70 161 71 162 … … 99 190 //mUseVbos = false; 100 191 192 //makeCurrent(); 101 193 MakeLive(); 102 194 glViewport(0, 0, w, h); … … 109 201 110 202 InitGL(); 111 112 //mydynamicTexture = generateDynamicTexture(); 113 // bind the dynamic texture to the pbuffer - this is a no-op under X11 114 //bindToDynamicTexture(mydynamicTexture); 115 116 DoneLive(); 203 204 //doneCurrent(); 205 //DoneLive(); 117 206 } 118 207 … … 275 364 char filename[256]; 276 365 //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 277 sprintf(filename, "error-frame-%04d-%0 4d.png", mFrame, pixelCount);366 sprintf(filename, "error-frame-%04d-%08d.png", mFrame, pixelCount); 278 367 QImage im = toImage(); 279 368 string str = mSnapPrefix + filename; … … 305 394 306 395 im = toImage(); 307 sprintf(filename, "error-frame-%04d-%04d-%0 .5f-pvs.png", mFrame, viewcell->GetId(), pErrorPixels);396 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 308 397 str = mSnapPrefix + filename; 309 398 qstr = str.c_str(); … … 316 405 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 317 406 318 DoneLive();407 //DoneLive(); 319 408 320 409 return pErrorPixels; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2678 r2679 76 76 77 77 unsigned int mydynamicTexture; 78 78 void dummyBuffer(); 79 79 public: 80 80 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface05.vcproj
r2676 r2679 212 212 > 213 213 <File 214 RelativePath=".\glwidget.cpp" 215 > 216 </File> 217 <File 214 218 RelativePath="LogReader.cpp" 215 219 > … … 241 245 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" 242 246 > 247 <File 248 RelativePath=".\glwidget.h" 249 > 250 </File> 243 251 <File 244 252 RelativePath="LogReader.h" -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2677 r2679 34 34 #include "QtGlRenderer.h" 35 35 #include <QGLWidget> 36 #include "glwidget.h" 36 37 37 38 #else … … 292 293 // create a qt application first (must be created before any opengl widget ...) 293 294 QApplication *app = new QApplication(argc, NULL); 295 296 //Dummy dummy(1024, 1024); 297 //dummy.dummyBuffer(); 298 294 299 pt = new QtPreprocessorThread(preprocessor); 295 300 … … 314 319 // renderer must be initialised 315 320 // $$matt 316 preprocessor->renderer=321 QtGlRendererBuffer *glbuf = 317 322 new QtGlRendererBuffer(1024, 1024, 318 preprocessor->mSceneGraph, 319 preprocessor->mViewCellsManager, 320 preprocessor->mKdTree); 321 323 preprocessor->mSceneGraph, 324 preprocessor->mViewCellsManager, 325 preprocessor->mKdTree); 326 327 preprocessor->renderer = glbuf; 328 329 //glbuf->dummyBuffer(); 322 330 } 323 331
Note: See TracChangeset
for help on using the changeset viewer.