Changeset 1168 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
- Timestamp:
- 07/28/06 09:37:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1166 r1168 254 254 255 255 // update pvs size scalar 256 mPvsSize = mPvs.GetSize();257 mPvsSizeValid = true;256 //mPvsSize = mPvs.GetSize(); 257 mPvsSizeValid = false; // recompute pvs size 258 258 259 259 return result; … … 886 886 const int upper = mViewCellsManager->GetMaxPvsSize(); 887 887 888 const float penalty = EvalPvsPenalty((*vit)->GetPvs().Count Pvs(), lower, upper);888 const float penalty = EvalPvsPenalty((*vit)->GetPvs().CountObjectsInPvs(), lower, upper); 889 889 890 890 mDeviation += fabs(mAvgRenderCost - penalty); … … 978 978 vc->Mail(); 979 979 980 const int pvs1 = left->GetPvs().Count Pvs();981 const int pvs2 = right->GetPvs().Count Pvs();980 const int pvs1 = left->GetPvs().CountObjectsInPvs(); 981 const int pvs2 = right->GetPvs().CountObjectsInPvs(); 982 982 983 983 … … 985 985 mMergedViewCells.push_back(vc); 986 986 987 pvsDiff = vc->GetPvs().Count Pvs() - pvs1 - pvs2;987 pvsDiff = vc->GetPvs().CountObjectsInPvs() - pvs1 - pvs2; 988 988 989 989 … … 991 991 if (mViewCellsStorage == PVS_IN_LEAVES) 992 992 { 993 left->mPvsSize = left->GetPvs().GetSize(); 994 left->mPvsSizeValid = true; 995 993 // set scalars 994 mViewCellsManager->UpdateScalarPvsSize(left, 995 left->GetPvs().CountObjectsInPvs(), 996 left->GetPvs().GetSize()); 997 996 998 // remove pvs, we don't store interior pvss 997 999 if (!left->IsLeaf()) … … 1000 1002 } 1001 1003 1002 right->mPvsSize = right->GetPvs().CountPvs(); 1004 // set scalars 1005 mViewCellsManager->UpdateScalarPvsSize(right, 1006 right->GetPvs().CountObjectsInPvs(), 1007 right->GetPvs().GetSize()); 1008 1003 1009 right->mPvsSizeValid = true; 1004 1010 … … 1285 1291 if (1) 1286 1292 { 1287 const float penalty = EvalPvsPenalty(vc->GetPvs().Count Pvs(), lower, upper);1293 const float penalty = EvalPvsPenalty(vc->GetPvs().CountObjectsInPvs(), lower, upper); 1288 1294 return fabs(mAvgRenderCost - penalty) / (float)mNumActiveViewCells; 1289 1295 } … … 1298 1304 if (mUseAreaForPvs) 1299 1305 { 1300 return vc->GetPvs().Count Pvs() * vc->GetArea();1301 } 1302 1303 return vc->GetPvs().Count Pvs() * vc->GetVolume();1306 return vc->GetPvs().CountObjectsInPvs() * vc->GetArea(); 1307 } 1308 1309 return vc->GetPvs().CountObjectsInPvs() * vc->GetVolume(); 1304 1310 } 1305 1311 … … 1469 1475 const int rootEntries = GetPvsEntries(mRoot); 1470 1476 1477 Debug << "******** Export stats **********" << endl; 1471 1478 /*Debug << "vsb volume: " << vol << endl; 1472 1479 Debug << "root volume: " << mRoot->GetVolume() << endl; … … 1517 1524 1518 1525 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1519 1526 Debug << "\nhere92" << endl; 1520 1527 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1521 1528 { 1529 Debug << "here15" << endl; 1522 1530 ViewCell *vc = *it; 1531 1523 1532 const int pvsSize = GetPvsSize(vc); 1524 1533 const int pvsEntries = GetPvsEntries(vc); … … 1532 1541 } 1533 1542 1534 1543 Debug << "\nhere1005" << endl; 1535 1544 const float costDecr = (parentCost - childCost) / vol; 1536 1545 … … 1655 1664 } 1656 1665 1666 1657 1667 // TODO matt: implement this function for different storing methods 1658 1668 void ViewCellsTree::GetPvs(ViewCell *vc, ObjectPvs &pvs) const … … 1708 1718 int ViewCellsTree::GetPvsSizeForLeafStorage(ViewCell *vc) const 1709 1719 { 1710 int pvsSize = 0;1711 1712 1720 // pvs is always stored directly in leaves 1713 1721 if (vc->IsLeaf()) 1714 1722 { 1715 pvsSize = vc->GetPvs().CountPvs(); 1716 //int pvsSize1 = vc->GetPvs().GetSize(); 1717 //Debug << "entries num: " << pvsSize1 << " size: "" << pvsSize << endl; 1718 } 1719 else // interior node 1720 { 1721 // interior nodes: pvs is either stored as a scalar or 1722 // has to be reconstructed from the leaves 1723 1724 // the stored pvs size is the valid pvs size => just return scalar 1725 if (vc->mPvsSizeValid) 1726 { 1727 pvsSize = vc->mPvsSize; 1728 } 1729 1730 // if no valid pvs size stored as a scalar => 1731 // compute current pvs size of interior from it's leaf nodes 1732 ViewCellContainer leaves; 1733 CollectLeaves(vc, leaves); 1734 1735 ViewCellContainer::const_iterator it, it_end = leaves.end(); 1736 1737 Intersectable::NewMail(); 1738 1739 // sum different intersectables 1740 for (it = leaves.begin(); it != it_end; ++ it) 1741 { 1742 pvsSize = GetPvsSizeForLeafStorage(*it); 1743 } 1744 } 1745 1746 return pvsSize; 1723 return vc->GetPvs().CountObjectsInPvs(); 1724 } 1725 1726 // interior node 1727 1728 // interior nodes: pvs is either stored as a scalar or 1729 // has to be reconstructed from the leaves 1730 1731 // the stored pvs size is the valid pvs size => just return scalar 1732 if (vc->mPvsSizeValid) 1733 { 1734 Debug << "here5"<<endl; 1735 return vc->mPvsSize; 1736 } 1737 1738 Debug << "here2"<<endl; 1739 1740 // if no valid pvs size stored as a scalar => 1741 // compute current pvs size of interior from it's leaf nodes 1742 ViewCellContainer leaves; 1743 CollectLeaves(vc, leaves); 1744 1745 ViewCellContainer::const_iterator it, it_end = leaves.end(); 1746 1747 Intersectable::NewMail(); 1748 ObjectPvs newPvs; 1749 1750 // sum different intersectables 1751 for (it = leaves.begin(); it != it_end; ++ it) 1752 { 1753 ObjectPvsMap::iterator oit, oit_end = (*it)->GetPvs().mEntries.end(); 1754 1755 for (oit = (*it)->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1756 { 1757 Intersectable *intersect = (*oit).first; 1758 1759 if (!intersect->Mailed()) 1760 { 1761 intersect->Mail(); 1762 newPvs.AddSample(intersect, (*oit).second.mSumPdf); 1763 } 1764 } 1765 } 1766 1767 return newPvs.CountObjectsInPvs(); 1747 1768 } 1748 1769 … … 1750 1771 int ViewCellsTree::GetEntriesInPvsForLeafStorage(ViewCell *vc) const 1751 1772 { 1752 int pvsSize = 0;1753 1754 1773 // pvs is always stored directly in leaves 1755 1774 if (vc->IsLeaf()) 1756 1775 { 1757 pvsSize = vc->GetPvs().GetSize(); 1758 } 1759 else // interior node 1760 { 1761 // interior nodes: pvs is either stored as a scalar or 1762 // has to be reconstructed from the leaves 1763 1764 // the stored pvs size is the valid pvs size => just return scalar 1765 if (vc->mPvsSizeValid) 1766 { 1767 pvsSize = vc->mEntriesInPvs; 1768 } 1769 1770 // if no valid pvs size stored as a scalar => 1771 // compute current pvs size of interior from it's leaf nodes 1772 ViewCellContainer leaves; 1773 CollectLeaves(vc, leaves); 1774 1775 ViewCellContainer::const_iterator it, it_end = leaves.end(); 1776 1777 Intersectable::NewMail(); 1778 1779 // sum different intersectables 1780 for (it = leaves.begin(); it != it_end; ++ it) 1781 { 1782 pvsSize = GetEntriesInPvsForLeafStorage(*it); 1776 return vc->GetPvs().GetSize(); 1777 } 1778 1779 // interior node 1780 1781 // interior nodes: pvs is either stored as a scalar or 1782 // has to be reconstructed from the leaves 1783 1784 // the stored pvs size is the valid pvs size => just return scalar 1785 if (vc->mPvsSizeValid) 1786 { 1787 return vc->mEntriesInPvs; 1788 } 1789 1790 int pvsSize = 0; 1791 1792 // if no valid pvs size stored as a scalar => 1793 // compute current pvs size of interior from it's leaf nodes 1794 ViewCellContainer leaves; 1795 CollectLeaves(vc, leaves); 1796 1797 ViewCellContainer::const_iterator it, it_end = leaves.end(); 1798 Intersectable::NewMail(); 1799 1800 // sum different intersectables 1801 for (it = leaves.begin(); it != it_end; ++ it) 1802 { 1803 ObjectPvsMap::iterator oit, oit_end = (*it)->GetPvs().mEntries.end(); 1804 1805 for (oit = (*it)->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1806 { 1807 Intersectable *intersect = (*oit).first; 1808 1809 if (!intersect->Mailed()) 1810 { 1811 intersect->Mail(); 1812 ++ pvsSize; 1813 } 1783 1814 } 1784 1815 } … … 1916 1947 // pvs is stored consistently in the tree up to the root 1917 1948 // just return pvs size 1918 pvsSize = vc->GetPvs().Count Pvs();1949 pvsSize = vc->GetPvs().CountObjectsInPvs(); 1919 1950 break; 1920 1951 }
Note: See TracChangeset
for help on using the changeset viewer.