Changeset 1740 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
- Timestamp:
- 11/10/06 22:15:56 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1738 r1740 64 64 for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it) 65 65 { 66 if (!(*it). first->Mailed())67 { 68 (*it). first->Mail();66 if (!(*it).mObject->Mailed()) 67 { 68 (*it).mObject->Mail(); 69 69 ++ count; 70 70 } … … 88 88 for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 89 89 { 90 (*it). first->Mail();90 (*it).mObject->Mail(); 91 91 } 92 92 … … 96 96 for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 97 97 { 98 Intersectable *obj = (*it). first;98 Intersectable *obj = (*it).mObject; 99 99 if (!obj->Mailed()) 100 100 ++ pvs; … … 837 837 for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 838 838 { 839 Intersectable *obj = (*it). first;839 Intersectable *obj = (*it).mObject; 840 840 841 841 obj->Mail(); … … 848 848 for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 849 849 { 850 Intersectable *obj = (*it). first;850 Intersectable *obj = (*it).mObject; 851 851 852 852 // test if object already considered … … 1152 1152 inline int AddedPvsSize(ObjectPvs pvs1, const ObjectPvs &pvs2) 1153 1153 { 1154 return pvs1.AddPvs(pvs2); 1154 ObjectPvs interPvs; 1155 ObjectPvs::Merge(interPvs, pvs1, pvs2); 1156 1157 return (int)interPvs.GetSize(); 1155 1158 } 1156 1159 … … 1242 1245 // TODO change 1243 1246 vc1->GetPvs().SubtractPvs(leaf->GetPvs()); 1244 vc2->GetPvs().AddPvs(leaf->GetPvs()); 1245 1247 1248 ObjectPvs interPvs; 1249 ObjectPvs::Merge(interPvs, vc2->GetPvs(), leaf->GetPvs()); 1250 vc2->SetPvs(interPvs); 1251 1246 1252 if (mUseAreaForPvs) 1247 1253 { … … 1651 1657 for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1652 1658 { 1653 Intersectable *obj = (*oit). first;1659 Intersectable *obj = (*oit).mObject; 1654 1660 if ((cit == interior->mChildren.begin()) && !obj->Mailed()) 1655 1661 obj->Mail(); … … 1673 1679 for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1674 1680 { 1675 if ((*oit). first->Mailed((int)interior->mChildren.size()))1681 if ((*oit).mObject->Mailed((int)interior->mChildren.size())) 1676 1682 { 1677 interior->GetPvs().AddSample((*oit). first, (*oit).second.mSumPdf);1683 interior->GetPvs().AddSample((*oit).mObject, (*oit).mData.mSumPdf); 1678 1684 } 1679 1685 } … … 1688 1694 for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 1689 1695 { 1690 if (!(*cit)->GetPvs().RemoveSample((*oit). first, Limits::Infinity))1696 if (!(*cit)->GetPvs().RemoveSample((*oit).mObject, Limits::Infinity)) 1691 1697 { 1692 1698 Debug << "should not come here!" << endl; … … 1717 1723 { 1718 1724 root = root->GetParent(); 1719 pvs. AddPvs(root->GetPvs());1725 pvs.MergeInPlace(root->GetPvs()); 1720 1726 } 1721 1727 … … 1730 1736 1731 1737 // add newly found pvs to merged pvs 1732 pvs.AddPvs(vc->GetPvs()); 1738 ObjectPvs interPvs; 1739 pvs.MergeInPlace(vc->GetPvs()); 1733 1740 1734 1741 if (!vc->IsLeaf()) // interior cells: go down to leaf level … … 1779 1786 for (oit = (*it)->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1780 1787 { 1781 Intersectable *intersect = (*oit). first;1788 Intersectable *intersect = (*oit).mObject; 1782 1789 1783 1790 if (!intersect->Mailed()) 1784 1791 { 1785 1792 intersect->Mail(); 1786 newPvs.AddSample(intersect, (*oit). second.mSumPdf);1793 newPvs.AddSample(intersect, (*oit).mData.mSumPdf); 1787 1794 } 1788 1795 } … … 1829 1836 for (oit = (*it)->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1830 1837 { 1831 Intersectable *intersect = (*oit). first;1838 Intersectable *intersect = (*oit).mObject; 1832 1839 1833 1840 if (!intersect->Mailed()) … … 2050 2057 2051 2058 2052 void ViewCellsTree::PropagatePvs(ViewCell * vc)2059 void ViewCellsTree::PropagatePvs(ViewCell *root) 2053 2060 { 2054 ViewCell *viewCell = vc;2061 ViewCell *viewCell = root; 2055 2062 2056 2063 // propagate pvs up 2057 2064 while (viewCell->GetParent()) 2058 2065 { 2059 viewCell->GetParent()->GetPvs().Merge(vc->GetPvs()); 2066 ObjectPvs mergedPvs; 2067 viewCell->GetParent()->GetPvs().MergeInPlace(root->GetPvs()); 2068 2060 2069 viewCell = viewCell->GetParent(); 2061 2070 } 2062 2071 2063 if ( vc->IsLeaf())2072 if (root->IsLeaf()) 2064 2073 return; 2065 2074 2066 2075 // propagate pvs to the leaves 2067 2076 stack<ViewCell *> tstack; 2068 tstack.push( vc);2077 tstack.push(root); 2069 2078 2070 2079 while (!tstack.empty()) … … 2073 2082 tstack.pop(); 2074 2083 2075 if (viewCell != vc)2076 { 2077 viewCell->GetPvs().Merge (vc->GetPvs());2084 if (viewCell != root) 2085 { 2086 viewCell->GetPvs().MergeInPlace(root->GetPvs()); 2078 2087 } 2079 2088 … … 2105 2114 tqueue.pop(); 2106 2115 2107 // save the view cells if it is a leaf or if enough view cells have already been traversed 2108 // because of the priority queue, this will be the optimal set of v 2116 // save the view cells if it is a leaf or if enough view cells 2117 // have already been traversed because of the priority queue, 2118 // this will be the optimal set of v 2109 2119 if (!vc->IsLeaf()) 2110 2120 { … … 2343 2353 for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 2344 2354 { 2345 Intersectable *obj = (*it). first;2355 Intersectable *obj = (*it).mObject; 2346 2356 // hack: just output full pvs 2347 2357 if (obj->Type() == Intersectable::BVH_INTERSECTABLE) … … 2359 2369 else 2360 2370 { 2361 stream << (*it). first->GetId() << " ";2371 stream << (*it).mObject->GetId() << " "; 2362 2372 } 2363 2373 }
Note: See TracChangeset
for help on using the changeset viewer.