Changeset 375 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 11/03/05 18:49:59 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r374 r375 343 343 } 344 344 345 void BspViewCellsStatistics::Print(ostream &app) const 346 { 347 app << "===== BspViewCells statistics ===============\n"; 348 349 app << setprecision(4); 350 351 app << "#N_PMAXPVS ( largest PVS )\n" << maxPvs << endl; 352 353 app << "#N_PMINPVS ( smallest PVS )\n" << minPvs << endl; 354 355 app << "#N_PAVGPVS ( average PVS )\n" << AvgPvs() << endl; 356 357 app << "#N_PEMPTYPVS ( view cells with PVS smaller 2 )\n" << emptyPvs << endl; 358 359 app << "#N_VIEWCELLS ( number of view cells)\n" << viewCells << endl; 360 361 app << "#N_AVGBSPLEAVES (average number of BSP leaves per view cell )\n" << AvgBspLeaves() << endl; 362 363 app << "#N_MAXBSPLEAVES ( maximal number of BSP leaves per view cell )\n" << maxBspLeaves << endl; 364 365 app << "===== END OF BspViewCells statistics ==========\n"; 366 } 367 345 368 void BspTreeStatistics::Print(ostream &app) const 346 369 { … … 368 391 app << "#N_INPUT_POLYGONS (number of input polygons )\n" << polys << endl; 369 392 370 app << "#N_PVS: " << pvs << endl;393 //app << "#N_PVS: " << pvs << endl; 371 394 372 395 app << "#N_ROUTPUT_INPUT_POLYGONS ( ratio polygons after subdivision / input polygons )\n" << … … 375 398 app << "===== END OF BspTree statistics ==========\n"; 376 399 } 400 377 401 378 402 BspTree::~BspTree() … … 1044 1068 ((int)rays.size() > sTermMaxRaysForAxisAligned) && 1045 1069 ((sTermMaxObjectsForAxisAligned < 0) || 1046 (Polygon3:: CountIntersectables(polys) > sTermMaxObjectsForAxisAligned)))1070 (Polygon3::ParentObjectsSize(polys) > sTermMaxObjectsForAxisAligned))) 1047 1071 { 1048 1072 Plane3 plane; … … 1529 1553 if (data.mDepth >= sTermMaxDepth) 1530 1554 ++ mStat.maxDepthNodes; 1555 1531 1556 // store maximal and minimal depth 1532 1557 if (data.mDepth > mStat.maxDepth) 1533 1558 mStat.maxDepth = data.mDepth; 1559 1534 1560 if (data.mDepth < mStat.minDepth) 1535 1561 mStat.minDepth = data.mDepth; … … 1537 1563 // accumulate depth to compute average 1538 1564 mStat.accumDepth += data.mDepth; 1539 1540 if (leaf->mViewCell != mRootCell)1541 {1542 ++ mStat.viewCells;1543 mStat.pvs += leaf->mViewCell->GetPvs().GetSize();1544 }1545 1565 1546 1566 #ifdef _DEBUG … … 1695 1715 } 1696 1716 1697 int BspTree::CountViewCellPvs() const 1698 { 1699 int count = 0; 1717 void BspTree::EvaluateViewCellsStats(BspViewCellsStatistics &stat) const 1718 { 1719 stat.Reset(); 1720 1700 1721 stack<BspNode *> nodeStack; 1701 1722 nodeStack.push(mRoot); … … 1713 1734 if (node->IsLeaf()) 1714 1735 { 1715 ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 1736 ++ stat.bspLeaves; 1737 1738 BspViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 1716 1739 1717 1740 if (!viewCell->Mailed()) 1718 1741 { 1719 1742 viewCell->Mail(); 1720 count += viewCell->GetPvs().GetSize(); 1743 1744 ++ stat.viewCells; 1745 int pvsSize = viewCell->GetPvs().GetSize(); 1746 1747 stat.pvs += pvsSize; 1748 1749 if (pvsSize < 2) 1750 ++ stat.emptyPvs; 1751 1752 if (pvsSize > stat.maxPvs) 1753 stat.maxPvs = pvsSize; 1754 1755 if (pvsSize < stat.minPvs) 1756 stat.minPvs = pvsSize; 1757 1758 if ((int)viewCell->mBspLeaves.size() > stat.maxBspLeaves) 1759 stat.maxBspLeaves = (int)viewCell->mBspLeaves.size(); 1721 1760 } 1722 1761 } … … 1729 1768 } 1730 1769 } 1731 return count;1732 1770 } 1733 1771 … … 2308 2346 Ray *ray = (*rit)->mRay; 2309 2347 2310 for (iit = ray->bspIntersections.begin(); iit != ray->bspIntersections.end(); ++ iit) 2348 for (iit = ray->bspIntersections.begin(); 2349 iit != ray->bspIntersections.end(); ++ iit) 2311 2350 { 2312 2351 BspViewCell *vc = (*iit).mLeaf->mViewCell;
Note: See TracChangeset
for help on using the changeset viewer.