Changeset 475 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 12/21/05 20:21:30 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r474 r475 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 filename ../data/atlanta/atlanta2.x3d15 # filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 #filename ../data/soda/soda5.dat17 filename ../data/soda/soda5.dat 18 18 } 19 19 … … 153 153 154 154 height 5.0 155 maxViewCells 3000155 maxViewCells 100 156 156 157 157 PostProcessing { … … 240 240 241 241 # maximal tested rays for split cost heuristics 242 maxTests 1000 0242 maxTests 1000 243 243 244 244 # factors for evaluating split plane costs … … 251 251 Termination { 252 252 # parameters used for autopartition 253 minRays 1 0253 minRays 1 254 254 minPolygons -1 255 255 maxDepth 30 … … 258 258 maxRayContribution 0.005 259 259 maxCostRatio 0.9 260 missTolerance 3260 missTolerance 2 261 261 #maxAccRayLength 100 262 262 … … 282 282 exportSplits true 283 283 exportRays true 284 exportGeometry true284 exportGeometry false 285 285 } 286 286 } -
trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp
r471 r475 615 615 const Vector3 dir = termination - origin; 616 616 617 stack<RayTraversalData 617 stack<RayTraversalData> tStack; 618 618 619 619 Intersectable::NewMail(); -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r473 r475 25 25 { 26 26 DEL_PTR(mViewCellsManager); 27 28 27 DEL_PTR(mBspTree); 29 28 DEL_PTR(mKdTree); -
trunk/VUT/GtpVisibilityPreprocessor/src/Ray.cpp
r466 r475 142 142 void 143 143 PassingRaySet::AddRay2(const Ray &ray, 144 145 146 144 const int objects, 145 const int viewcells 146 ) 147 147 { 148 148 int i = GetEntryIndex(ray.GetDir()); -
trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h
r466 r475 5 5 #include "Matrix4x4.h" 6 6 #include "Vector3.h" 7 //#include "ViewCellBsp.h" 7 8 8 9 // forward declarations … … 66 67 67 68 vector<Intersection> intersections; 68 //vector<BspIntersection> bspIntersections;69 // vector<BspIntersection> bspIntersections; 69 70 vector<KdLeaf *> kdLeaves; 70 71 vector<Intersectable *> testedObjects; -
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
r473 r475 9 9 void SimulationStatistics::Print(ostream &app) const 10 10 { 11 app << "===== Simulation statistics ===============\n";11 app << "===== Render Simulation statistics ===============\n"; 12 12 13 13 app << setprecision(4); … … 21 21 app << "#AVG_RENDER_TIME ( average render time )\n" << avgRenderTime << "\n"; 22 22 23 app << "#AVG_RENDER_TIME_NO_OVERHEAD ( average render time without overhead )\n" << avgRtWithoutOverhead << "\n"; 23 app << "#AVG_RENDER_TIME_NO_OVERHEAD ( average render time without overhead )\n" 24 << avgRtWithoutOverhead << "\n"; 24 25 25 app << "===== END OF Simulation statistics ==========\n";26 app << "===== END OF Render Simulation statistics ==========\n"; 26 27 } 27 28 … … 69 70 it_end = mViewCellsManager->GetViewCells().end(); 70 71 72 71 73 for (it = mViewCellsManager->GetViewCells().begin(); it != it_end; ++ it) 72 74 { … … 75 77 // probability of view cell 76 78 const float pInVc = mViewCellsManager->GetProbability(vc); 77 79 Debug << "prop: " << pInVc << endl; 78 80 // compute render time of PVS times probability that view point is in view cell 79 81 const float vcCost = pInVc * mViewCellsManager->GetRendercost(vc, mObjRenderCost); 80 82 Debug << "cost: " << vcCost << " rcost: " << mViewCellsManager->GetRendercost(vc, mObjRenderCost) << endl; 83 81 84 // crossing the border of a view cell is depending on the move speed 82 85 // and the probability that a view cell border is crossed 83 86 loadPvsOverhead += GetCrossVcProbability() * mVcOverhead; 84 87 88 Debug << "crossvc: " << GetCrossVcProbability() * mVcOverhead << endl; 85 89 //-- update statistics 86 90 renderTime += vcCost; -
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r473 r475 176 176 if (!use2dSampling) { 177 177 Vector3 normal; 178 int i = RandomValue(0, mObjects.size()-1);178 int i = (int)RandomValue(0, mObjects.size()-1); 179 179 Intersectable *object = mObjects[i]; 180 180 object->GetRandomSurfacePoint(point, normal); … … 513 513 514 514 //-- several visualizations and statistics 515 Debug << "view cells after post processing: " << endl; 515 516 mViewCellsManager->PrintStatistics(Debug); 516 517 -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r473 r475 391 391 392 392 //-- several visualizations and statistics 393 Debug << "view cells after post processing: " << endl; 393 394 mViewCellsManager->PrintStatistics(Debug); 394 395 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r474 r475 742 742 743 743 if (r == mRoot) 744 Debug << "BSP tree construction time spent at root: " << TimeDiff(startTime, GetTime())*1e-3 << " s" << endl;744 Debug << "BSP tree construction time spent at root: " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl; 745 745 } 746 746 … … 1153 1153 else 1154 1154 { 1155 const int candidateIdx = (int)RandomValue(0, ( int)data.mRays->size() - 1);1155 const int candidateIdx = (int)RandomValue(0, (Real)((int)data.mRays->size() - 1)); 1156 1156 BoundedRay *bRay = (*data.mRays)[candidateIdx]; 1157 1157 … … 1500 1500 for (int i = 0; i < limit; ++ i) 1501 1501 { 1502 const int testIdx = useRand ? (int)RandomValue(0, limit - 1) : i;1502 const int testIdx = useRand ? (int)RandomValue(0, (Real)(limit - 1)) : i; 1503 1503 1504 1504 BoundedRay *bRay = rays[testIdx]; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r473 r475 851 851 }; 852 852 853 struct BspIntersection { 854 // the point of intersection 855 float mT; 853 struct BspIntersection 854 { 855 // the point of intersection 856 float mT; 856 857 857 858 BspLeaf *mLeaf; 858 859 859 860 BspIntersection(const float t, BspLeaf *l): 860 861 mT(t), mLeaf(l) {} 861 862 862 863 BspIntersection() {} 863 864 864 bool operator<(const BspIntersection &b) const { 865 return mT <b.mT; } 865 bool operator<(const BspIntersection &b) const 866 { 867 return mT < b.mT; 868 } 869 }; 870 871 struct BspRay 872 { 873 VssRay *vssRay; 874 875 std::vector<BspIntersection> intersections; 876 877 BspRay(VssRay *ray): vssRay(ray) {} 866 878 }; 867 879 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r474 r475 255 255 256 256 if (added) 257 ray.mPvsContribution++;257 ++ ray.mPvsContribution; 258 258 259 259 ray.mRelativePvsContribution += contribution; … … 312 312 } 313 313 314 void ViewCellsManager::PrintStatistics(ostream &s) const 315 { 316 s << mViewCellsStats << endl; 317 } 318 314 319 /**********************************************************************/ 315 320 /* BspViewCellsManager implementation */ … … 366 371 // no view cells loaded 367 372 mBspTree->Construct(objects, constructionRays); 368 369 373 // collect final view cells 370 374 mBspTree->CollectViewCells(mViewCells); … … 375 379 } 376 380 381 mBspTree->EvaluateViewCellsStats(mViewCellsStats); 382 377 383 // destroy rays created only for construction 378 384 CLEAR_CONTAINER(constructionRays); … … 434 440 int pvsSize = 0; 435 441 436 ViewCellsStatistics vcStats; 437 mBspTree->EvaluateViewCellsStats(vcStats); 438 Debug << "original view cell partition:\n" << vcStats << endl; 442 Debug << "original view cell partition:\n" << mViewCellsStats << endl; 439 443 440 444 if (1) // export view cells before merge … … 446 450 { 447 451 exporter->SetWireframe(); 448 exporter->ExportBspLeaves(*mBspTree, vcStats.maxPvs);452 exporter->ExportBspLeaves(*mBspTree, mViewCellsStats.maxPvs); 449 453 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 450 454 … … 463 467 cout << "finished" << endl; 464 468 465 //-- render simulation466 cout << "\nevaluating bsp view cells render time before merge ... ";467 469 //-- render simulation after merge 468 470 cout << "\nevaluating bsp view cells render time after merge ... "; … … 490 492 491 493 RayContainer::const_iterator rit, rit_end = rays.end(); 492 vector< Ray::BspIntersection>::const_iterator iit;494 vector<BspIntersection>::const_iterator iit; 493 495 494 496 int limit = min((int)rays.size(), mPostProcessSamples); … … 527 529 cout << "merged " << merged << " view cells in " 528 530 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 531 532 Debug << "Postprocessing: Merged " << merged << " view cells in " 533 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 534 535 //-- recount pvs 536 mViewCellsStats.Reset(); 537 mBspTree->EvaluateViewCellsStats(mViewCellsStats); 529 538 530 539 return merged; … … 640 649 //-- some rays for output 641 650 const int raysOut = min((int)sampleRays.size(), mVisualizationSamples); 642 Debug << "visualization using " << raysOut << " samples" << endl; 651 652 Debug << "Output view cells:" << endl; 643 653 644 654 if (1) … … 650 660 bspLeaves.push_back(mBspTree->GetRandomLeaf()); 651 661 652 653 662 for (int i = 0; i < bspLeaves.size(); ++ i) 654 663 { … … 876 885 } 877 886 878 void BspViewCellsManager::PrintStatistics(ostream &s) const879 {880 ViewCellsStatistics vcStats;881 mBspTree->EvaluateViewCellsStats(vcStats);882 s << vcStats << endl;883 }884 887 885 888 … … 920 923 // create the view cells 921 924 mKdTree->CreateAndCollectViewCells(mViewCells); 925 //mKdTree->EvaluateViewCellsStats(mViewCellsStats); 922 926 923 927 return 0; … … 1129 1133 } 1130 1134 1131 1132 void KdViewCellsManager::PrintStatistics(ostream &s) const1133 {1134 }1135 1136 1137 1135 int KdViewCellsManager::CastLineSegment(const Vector3 &origin, 1138 1136 const Vector3 &termination, … … 1189 1187 1190 1188 mVspKdTree->Construct(constructionRays, sceneBbox); 1191 1192 // collect view cells1193 1189 mVspKdTree->CollectViewCells(mViewCells); 1190 //mVspBspTree->EvaluateViewCellsStats(mViewCellsStats); 1194 1191 1195 1192 Debug << mVspKdTree->GetStatistics() << endl; … … 1312 1309 } 1313 1310 1314 // evaluate maximal pvs1315 ViewCellsStatistics vcStats;1316 mVspKdTree->EvaluateViewCellsStats(vcStats);1317 1318 1311 //-- export final view cells 1319 1312 Exporter *exporter = Exporter::GetExporter("vspkdtree_merged.x3d"); … … 1353 1346 } 1354 1347 1355 void VspKdViewCellsManager::PrintStatistics(ostream &s) const1356 {1357 ViewCellsStatistics vcStats;1358 1359 mVspKdTree->EvaluateViewCellsStats(vcStats);1360 Debug << vcStats << endl;1361 }1362 1363 1348 1364 1349 int VspKdViewCellsManager::CastLineSegment(const Vector3 &origin, … … 1380 1365 } 1381 1366 1367 VspBspViewCellsManager::~VspBspViewCellsManager() 1368 { 1369 CLEAR_CONTAINER(mBspRays); 1370 } 1371 1382 1372 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) 1383 1373 { … … 1386 1376 } 1387 1377 1378 float VspBspViewCellsManager::GetArea(ViewCell *viewCell) const 1379 { 1380 PolygonContainer geom; 1381 1382 // compute view cell area 1383 mVspBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(viewCell), geom); 1384 1385 const float area = Polygon3::GetArea(geom); 1386 CLEAR_CONTAINER(geom); 1387 1388 return area; 1389 } 1388 1390 1389 1391 float VspBspViewCellsManager::GetRendercost(ViewCell *viewCell, float objRendercost) const … … 1412 1414 return 0; 1413 1415 1414 Debug << "Constructing vsp bsp view cells" << endl;1415 1416 1416 int sampleContributions = 0; 1417 1417 … … 1423 1423 mVspBspTree->Construct(constructionRays); 1424 1424 mVspBspTree->CollectViewCells(mViewCells); 1425 mVspBspTree->EvaluateViewCellsStats(mViewCellsStats); 1425 1426 1426 1427 Debug << mVspBspTree->GetStatistics() << endl; … … 1433 1434 1434 1435 1436 void VspBspViewCellsManager::ConstructBspRays(const VssRayContainer &rays, 1437 const int numSamples) 1438 { 1439 VssRayContainer::const_iterator it, it_end = rays.end(); 1440 1441 for (it = rays.begin(); it != rays.end() && mBspRays.size() < numSamples; ++ it) 1442 { 1443 VssRay *vssRay = *it; 1444 BspRay *ray = new BspRay(vssRay); 1445 1446 ViewCellContainer viewCells; 1447 1448 CastLineSegment(vssRay->mTermination, vssRay->mOrigin, viewCells); 1449 1450 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 1451 1452 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1453 { 1454 BspViewCell *vc = dynamic_cast<BspViewCell *>(*vit); 1455 ray->intersections.push_back(BspIntersection(0, vc->mLeaves[0])); 1456 } 1457 1458 mBspRays.push_back(ray); 1459 } 1460 } 1461 1462 1435 1463 int VspBspViewCellsManager::PostProcess(const ObjectContainer &objects, 1436 1464 const VssRayContainer &rays) 1437 1465 { 1438 Debug << "Post processing view cells" << endl; 1466 if (mBspRays.empty()) 1467 ConstructBspRays(rays, mConstructionSamples); 1468 1439 1469 if (!ViewCellsConstructed()) 1440 1470 { … … 1447 1477 int pvsSize = 0; 1448 1478 1449 1450 ViewCellsStatistics vcStats; 1451 mVspBspTree->EvaluateViewCellsStats(vcStats); 1452 Debug << "original view cell partition:\n" << vcStats << endl; 1479 Debug << "original view cell partition:\n" << mViewCellsStats << endl; 1453 1480 1454 1481 if (1) // export view cells … … 1459 1486 if (exporter) 1460 1487 { 1461 exporter->SetWireframe(); 1462 exporter->ExportBspViewCellPartition(*mVspBspTree, vcStats.maxPvs); 1488 //exporter->SetWireframe(); 1489 exporter->SetFilled(); 1490 exporter->ExportBspViewCellPartition(*mVspBspTree, mViewCellsStats.maxPvs); 1463 1491 1464 1492 if (0) … … 1487 1515 //-- merge or subdivide view cells 1488 1516 int merged = 0; 1489 #if 0 1490 1491 RayContainer::const_iterator rit, rit_end = rays.end(); 1492 vector<Ray::BspIntersection>::const_iterator iit; 1493 1494 int limit = min((int)rays.size(), mPostProcessSamples); 1495 1496 for (int i = 0; i < limit; ++ i) 1517 1518 vector<BspIntersection>::const_iterator iit; 1519 1520 for (int i = 0; i < (int)mBspRays.size(); ++ i) 1497 1521 { 1498 VssRay *ray = rays[i];1522 BspRay *ray = mBspRays[i]; 1499 1523 1500 1501 1502 if (ray->bspIntersections.size() < 2)1503 continue;1524 // traverse leaves stored in the rays and compare and merge consecutive 1525 // leaves (i.e., the neighbors in the tree) 1526 if (ray->intersections.size() < 2) 1527 continue; 1504 1528 1505 iit = ray->bspIntersections.begin();1529 iit = ray->intersections.begin(); 1506 1530 1507 1531 BspLeaf *previousLeaf = (*iit).mLeaf; 1508 1532 ++ iit; 1509 1533 1510 for (; iit != ray-> bspIntersections.end(); ++ iit)1534 for (; iit != ray->intersections.end(); ++ iit) 1511 1535 { 1512 1536 BspLeaf *leaf = (*iit).mLeaf; … … 1522 1546 } 1523 1547 } 1524 #endif 1548 1525 1549 //-- stats and visualizations 1526 1550 cout << "finished" << endl; … … 1528 1552 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 1529 1553 1554 Debug << "Postprocessing: Merged " << merged << " view cells in " 1555 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl << endl; 1556 1557 // reset view cells and stats 1558 mViewCells.clear(); 1559 mVspBspTree->CollectViewCells(mViewCells); 1560 mViewCellsStats.Reset(); 1561 mVspBspTree->EvaluateViewCellsStats(mViewCellsStats); 1530 1562 1531 1563 return merged; … … 1544 1576 return; 1545 1577 1546 //-- recount pvs 1547 ViewCellsStatistics vcStats; 1548 mVspBspTree->EvaluateViewCellsStats(vcStats); 1549 1578 if (mBspRays.empty()) 1579 ConstructBspRays(sampleRays, mConstructionSamples); 1580 1550 1581 if (1) // export view cells 1551 1582 { … … 1555 1586 if (exporter) 1556 1587 { 1557 exporter->ExportBspViewCellPartition(*mVspBspTree, vcStats.maxPvs);1588 exporter->ExportBspViewCellPartition(*mVspBspTree, mViewCellsStats.maxPvs); 1558 1589 delete exporter; 1559 1590 } … … 1569 1600 { 1570 1601 cout << "exporting splits ... "; 1571 ExportSplits(objects , sampleRays);1602 ExportSplits(objects); 1572 1603 cout << "finished" << endl; 1573 1604 } 1574 1605 1575 ExportBspPvs(objects, sampleRays); 1576 } 1577 1578 1579 void VspBspViewCellsManager::ExportSplits(const ObjectContainer &objects, 1580 const VssRayContainer &sampleRays) 1606 ExportBspPvs(objects); 1607 } 1608 1609 1610 void VspBspViewCellsManager::ExportSplits(const ObjectContainer &objects) 1581 1611 { 1582 1612 Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d"); … … 1601 1631 if (0) 1602 1632 { 1603 1604 1605 int raysSize = min((int) sampleRays.size(), mVisualizationSamples);1633 VssRayContainer outRays; 1634 1635 int raysSize = min((int)mBspRays.size(), mVisualizationSamples); 1606 1636 1607 1637 for (int i = 0; i < raysSize; ++ i) 1608 {1609 1638 // only rays piercing geometry 1610 outRays.push_back(sampleRays[i]); 1611 } 1612 1639 outRays.push_back(mBspRays[i]->vssRay); 1640 1613 1641 // export rays 1614 1642 exporter->ExportRays(outRays, RgbColor(1, 1, 0)); … … 1622 1650 } 1623 1651 1624 void VspBspViewCellsManager::ExportBspPvs(const ObjectContainer &objects, 1625 const VssRayContainer &sampleRays) 1652 void VspBspViewCellsManager::ExportBspPvs(const ObjectContainer &objects) 1626 1653 { 1627 1654 bool exportRays = false; … … 1636 1663 1637 1664 //-- some rays for output 1638 const int raysOut = min((int) sampleRays.size(), mVisualizationSamples);1665 const int raysOut = min((int)mBspRays.size(), mVisualizationSamples); 1639 1666 cout << "visualization using " << mVisualizationSamples << " samples" << endl; 1640 1667 Debug << "\nOutput view cells: " << endl; 1668 1641 1669 if (1) 1642 1670 { … … 1652 1680 cout << "creating output for view cell " << i << " ... "; 1653 1681 1654 //$$JB1655 #if 01656 1682 // check whether we can add the current ray to the output rays 1657 1683 for (int k = 0; k < raysOut; ++ k) 1658 1684 { 1659 VssRay *ray = sampleRays[k];1660 1661 for (int j = 0; j < (int)ray-> bspIntersections.size(); ++ j)1685 BspRay *ray = mBspRays[k]; 1686 1687 for (int j = 0; j < (int)ray->intersections.size(); ++ j) 1662 1688 { 1663 BspLeaf *leaf = ray-> bspIntersections[j].mLeaf;1689 BspLeaf *leaf = ray->intersections[j].mLeaf; 1664 1690 1665 1691 if (vspBspLeaves[i]->GetViewCell() == leaf->GetViewCell()) 1666 1692 { 1667 vcRays.push_back(ray );1693 vcRays.push_back(ray->vssRay); 1668 1694 } 1669 1695 } 1670 1696 } 1671 #endif 1697 1672 1698 Intersectable::NewMail(); 1673 1699 … … 1683 1709 ObjectPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 1684 1710 1685 //exporter->SetWireframe();1686 exporter->SetFilled();1711 exporter->SetWireframe(); 1712 //exporter->SetFilled(); 1687 1713 1688 1714 Material m;//= RandomMaterial(); … … 1728 1754 } 1729 1755 } 1730 1756 Debug << "here1 exportgeom: " << exportGeometry << endl; 1731 1757 // output rest of the objects 1732 1758 if (exportGeometry) … … 1765 1791 1766 1792 cout << "creating output for view cell " << i << " ... "; 1767 //$$ JB 1768 #if 0 1793 1769 1794 // check whether we can add the current ray to the output rays 1770 1795 for (int k = 0; k < raysOut; ++ k) 1771 1796 { 1772 Ray *ray = sampleRays[k];1773 1774 for (int j = 0; j < (int)ray-> bspIntersections.size(); ++ j)1797 BspRay *ray = mBspRays[k]; 1798 1799 for (int j = 0; j < (int)ray->intersections.size(); ++ j) 1775 1800 { 1776 BspLeaf *leaf = ray-> bspIntersections[j].mLeaf;1801 BspLeaf *leaf = ray->intersections[j].mLeaf; 1777 1802 1778 1803 if (vc == leaf->GetViewCell()) 1779 1804 { 1780 vcRays.push_back(ray );1805 vcRays.push_back(ray->vssRay); 1781 1806 } 1782 1807 } 1783 1808 } 1784 #endif 1809 1785 1810 //bspLeaves[j]->Mail(); 1786 1811 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); … … 1807 1832 1808 1833 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 1809 1834 << ", piercing rays=" << (int)vcRays.size() << endl; 1810 1835 1811 1836 … … 1839 1864 } 1840 1865 } 1841 } 1842 1843 1844 void VspBspViewCellsManager::PrintStatistics(ostream &s) const 1845 { 1846 ViewCellsStatistics vcStats; 1847 mVspBspTree->EvaluateViewCellsStats(vcStats); 1848 s << vcStats << endl; 1849 } 1866 1867 Debug << endl; 1868 } 1869 1850 1870 1851 1871 bool VspBspViewCellsManager::MergeVspBspLeafViewCells(BspLeaf *front, … … 1859 1879 return false; 1860 1880 1861 // change view cells of all leaves associated with the 1862 // previous view cells 1863 1881 // change view cells of all leaves 1882 // associated with the previous view cells 1864 1883 BspViewCell *fVc = front->GetViewCell(); 1865 1884 BspViewCell *bVc = back->GetViewCell(); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r471 r475 5 5 #include "VssRay.h" 6 6 #include "Containers.h" 7 #include "ViewCell.h" 7 8 8 9 class ViewCell; … … 21 22 class AxisAlignedBox3; 22 23 class BspLeaf; 24 class ViewCellsStatistics; 25 26 struct BspRay; 23 27 24 28 /** … … 62 66 @param contributingSamples returns the number of contributingSamples 63 67 */ 64 65 66 67 68 69 70 68 void ComputeSampleContributions(const VssRayContainer &rays); 69 70 71 /** Computes sample contribution of a simgle ray to the view cells PVS. 72 @param ray finds intersections with view cells and holds the contribution 73 @param castRay true if ray should be cast to gain the information, false if ray 74 is already holding the information and need not be recast. 71 75 72 @returns number of sample contributions 73 */ 74 virtual void ComputeSampleContributions(VssRay &ray 75 ); 76 @returns number of sample contributions 77 */ 78 virtual void ComputeSampleContributions(VssRay &ray); 76 79 77 80 /** Prints out statistics of the view cells. 78 81 */ 79 virtual void PrintStatistics(ostream &s) const = 0;82 virtual void PrintStatistics(ostream &s) const; 80 83 81 84 /** Post processes view cells givemŽa number of rays. 82 85 */ 83 84 86 virtual int PostProcess(const ObjectContainer &objects, 87 const VssRayContainer &rays) = 0; 85 88 86 89 /** Show visualization of the view cells. … … 224 227 float mTotalAreaValid; 225 228 float mTotalArea; 229 230 ViewCellsStatistics mViewCellsStats; 226 231 }; 227 232 … … 255 260 bool ViewCellsConstructed() const; 256 261 257 void PrintStatistics(ostream &s) const;262 //void PrintStatistics(ostream &s) const; 258 263 259 264 int CastLineSegment(const Vector3 &origin, … … 278 283 /// the BSP tree. 279 284 BspTree *mBspTree; 280 285 286 vector<BspRay *> mBspRays; 281 287 282 288 private: 283 284 289 285 290 /** Exports visualization of the BSP splits. … … 325 330 /** Prints out statistics of this approach. 326 331 */ 327 virtualvoid PrintStatistics(ostream &s) const;332 //void PrintStatistics(ostream &s) const; 328 333 329 334 float GetProbability(ViewCell *viewCell); … … 368 373 bool ViewCellsConstructed() const; 369 374 370 virtual void PrintStatistics(ostream &s) const;375 //virtual void PrintStatistics(ostream &s) const; 371 376 372 377 ViewCell *GenerateViewCell(Mesh *mesh) const; … … 397 402 398 403 VspBspViewCellsManager(VspBspTree *tree, int constructionSamples); 404 ~VspBspViewCellsManager(); 399 405 400 406 int Construct(const ObjectContainer &objects, … … 415 421 bool ViewCellsConstructed() const; 416 422 417 void PrintStatistics(ostream &s) const;423 //void PrintStatistics(ostream &s) const; 418 424 419 425 int CastLineSegment(const Vector3 &origin, … … 423 429 float GetProbability(ViewCell *viewCell); 424 430 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 425 431 float GetArea(ViewCell *viewCell) const; 426 432 427 433 protected: 434 435 /** Constructs bsp rays for post processing and visualization. 436 */ 437 void ConstructBspRays(const VssRayContainer &rays, const int numSamples); 428 438 429 439 /** Merges view cells front and back leaf view cell. … … 438 448 VspBspTree *mVspBspTree; 439 449 450 vector<BspRay *> mBspRays; 440 451 441 452 private: … … 444 455 /** Exports visualization of the BSP splits. 445 456 */ 446 void ExportSplits(const ObjectContainer &objects , const VssRayContainer &sampleRays);457 void ExportSplits(const ObjectContainer &objects); 447 458 448 459 /** Exports visualization of the BSP PVS. 449 460 */ 450 void ExportBspPvs(const ObjectContainer &objects , const VssRayContainer &sampleRays);461 void ExportBspPvs(const ObjectContainer &objects); 451 462 452 463 }; -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r474 r475 227 227 long startTime = GetTime(); 228 228 229 Debug << "**** Extracting polygons from rays ****\n";229 cout << "Extracting polygons from rays ..."; 230 230 231 231 Intersectable::NewMail(); … … 276 276 mStat.polys = (int)polys.size(); 277 277 278 Debug << "**** Finished polygon extraction ****" << endl; 279 Debug << (int)polys.size() << " polys extracted from " << (int)sampleRays.size() << " rays" << endl; 280 Debug << "extraction time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 278 cout << "finished" << endl; 279 280 Debug << "\nPolygon extraction: " << (int)polys.size() << " polys extracted from " 281 << (int)sampleRays.size() << " rays in " 282 << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl << endl; 281 283 282 284 Construct(polys, rays); … … 321 323 if (r == mRoot) 322 324 Debug << "VSP BSP tree construction time spent at root: " 323 << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl ;325 << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl << endl; 324 326 } 325 327 … … 336 338 (data.mPvs <= mTermMinPvs) || 337 339 (data.mArea <= mTermMinArea) || 338 ( numLeaves>= mMaxViewCells) ||340 ((mStat.nodes / 2 + 1) >= mMaxViewCells) || 339 341 // (data.GetAvgRayContribution() >= mTermMaxRayContribution) || 340 342 (data.mDepth >= mTermMaxDepth)); -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r474 r475 116 116 float GetCost() const 117 117 { 118 #if 0118 #if 1 119 119 return mPvs * mArea; 120 120 #endif 121 #if 1121 #if 0 122 122 return (float)(mPvs * (int)mRays->size()); 123 123 #endif -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r474 r475 558 558 559 559 //-- several visualizations and statistics 560 Debug << "view cells after post processing: " << endl; 560 561 mViewCellsManager->PrintStatistics(Debug); 561 562 … … 576 577 577 578 delete vssTree; 578 579 579 580 return true; 580 581 }
Note: See TracChangeset
for help on using the changeset viewer.