Changeset 1548 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 10/02/06 08:38:25 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1522 r1548 1663 1663 mBvhStats.Reset(); 1664 1664 mBvhStats.Start(); 1665 1666 1665 mBvhStats.nodes = 1; 1667 1666 … … 1669 1668 BvhSubdivisionCandidate::sBvHierarchy = this; 1670 1669 1670 // create new root 1671 CreateRoot(objects); 1672 1671 1673 // compute bounding box from objects 1672 // note: we assume that root was already created1673 1674 mBoundingBox = mRoot->GetBoundingBox(); 1674 BvhLeaf *bvh leaf = dynamic_cast<BvhLeaf *>(mRoot);1675 BvhLeaf *bvhLeaf = dynamic_cast<BvhLeaf *>(mRoot); 1675 1676 1676 1677 // multiply termination criterium for comparison, … … 1693 1694 1694 1695 // create bvh traversal data 1695 BvhTraversalData oData(bvh leaf, 0, prop, nRays);1696 BvhTraversalData oData(bvhLeaf, 0, prop, nRays); 1696 1697 1697 1698 // create sorted object lists for the first data … … 1709 1710 1710 1711 EvalSubdivisionCandidate(*oSubdivisionCandidate); 1711 bvh leaf->SetSubdivisionCandidate(oSubdivisionCandidate);1712 bvhLeaf->SetSubdivisionCandidate(oSubdivisionCandidate); 1712 1713 1713 1714 const float viewSpaceVol = mHierarchyManager->GetViewSpaceBox().GetVolume(); … … 1784 1785 1785 1786 1787 SubdivisionCandidate *BvHierarchy::Reset(const VssRayContainer &sampleRays, 1788 const ObjectContainer &objects) 1789 { 1790 // reset stats 1791 mBvhStats.Reset(); 1792 mBvhStats.Start(); 1793 mBvhStats.nodes = 1; 1794 1795 // reset root 1796 DEL_PTR(mRoot); 1797 CreateRoot(objects); 1798 1799 #if PROBABILIY_IS_BV_VOLUME 1800 mTermMinProbability *= mBoundingBox.GetVolume(); 1801 // probability that bounding volume is seen 1802 const float prop = GetBoundingBox().GetVolume(); 1803 #else 1804 mTermMinProbability *= mVspTree->GetBoundingBox().GetVolume(); 1805 // probability that volume is "seen" from the view cells 1806 const float prop = EvalViewCellsVolume(objects); 1807 #endif 1808 1809 const int nRays = CountRays(objects); 1810 BvhLeaf *bvhLeaf = dynamic_cast<BvhLeaf *>(mRoot); 1811 1812 // create bvh traversal data 1813 BvhTraversalData oData(bvhLeaf, 0, prop, nRays); 1814 1815 /////////////////// 1816 //-- add first candidate for object space partition 1817 1818 BvhSubdivisionCandidate *oSubdivisionCandidate = 1819 new BvhSubdivisionCandidate(oData); 1820 1821 EvalSubdivisionCandidate(*oSubdivisionCandidate); 1822 bvhLeaf->SetSubdivisionCandidate(oSubdivisionCandidate); 1823 1824 const float viewSpaceVol = mHierarchyManager->GetViewSpaceBox().GetVolume(); 1825 mTotalCost = (float)objects.size() * prop / viewSpaceVol; 1826 1827 PrintSubdivisionStats(*oSubdivisionCandidate); 1828 1829 return oSubdivisionCandidate; 1830 } 1831 1832 1786 1833 void BvhStatistics::Print(ostream &app) const 1787 1834 {
Note: See TracChangeset
for help on using the changeset viewer.