Changeset 2679 for GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
- Timestamp:
- 05/15/08 16:00:23 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.