Changeset 1640 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 10/18/06 18:17:27 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1636 r1640 1501 1501 mHierarchyManager->mVspTree->GetViewCells(*ray, tmpViewCells); 1502 1502 1503 // matt: probably slow to allocate memory for view cells every time 1503 1504 ViewCellContainer::const_iterator vit, vit_end = tmpViewCells.end(); 1504 1505 … … 1786 1787 1787 1788 1788 void BvHierarchy:: CreateRoot(const ObjectContainer &objects)1789 void BvHierarchy::Initialise(const ObjectContainer &objects) 1789 1790 { 1790 1791 /////// … … 1796 1797 mRoot = bvhleaf; 1797 1798 1799 // compute bounding box from objects 1800 mBoundingBox = mRoot->GetBoundingBox(); 1801 1798 1802 // associate root with current objects 1799 1803 AssociateObjectsWithLeaf(bvhleaf); 1800 1804 } 1805 1801 1806 1802 1807 /* … … 1831 1836 BvhSubdivisionCandidate::sBvHierarchy = this; 1832 1837 1833 // create new root 1834 CreateRoot(objects); 1835 1836 // compute bounding box from objects 1837 mBoundingBox = mRoot->GetBoundingBox(); 1838 // root and bounding box was already constructed 1838 1839 BvhLeaf *bvhLeaf = dynamic_cast<BvhLeaf *>(mRoot); 1839 1840 … … 1961 1962 // reset root 1962 1963 DEL_PTR(mRoot); 1963 CreateRoot(objects); 1964 1965 BvhLeaf *bvhleaf = new BvhLeaf(mBoundingBox, NULL, (int)objects.size()); 1966 bvhleaf->mObjects = objects; 1967 mRoot = bvhleaf; 1964 1968 1965 1969 #if PROBABILIY_IS_BV_VOLUME … … 2072 2076 2073 2077 2074 } 2078 // TODO: return memory usage in MB 2079 float BvHierarchy::GetMemUsage() const 2080 { 2081 return (float) 2082 (sizeof(BvHierarchy) 2083 + mBvhStats.Leaves() * sizeof(BvhLeaf) 2084 + mBvhStats.Interior() * sizeof(BvhInterior) 2085 ) / (1024.0f * 1024.0f); 2086 } 2087 2088 2089 }
Note: See TracChangeset
for help on using the changeset viewer.