Changeset 729 for GTP/trunk/Lib
- Timestamp:
- 04/06/06 18:37:31 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r728 r729 69 69 } 70 70 71 71 /// Fast computation of merged pvs size 72 72 int ComputeMergedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 73 73 { 74 // add first pvs 74 75 int pvs = pvs1.GetSize(); 75 76 76 // compute new pvs size77 77 ObjectPvsMap::const_iterator it, it_end = pvs1.mEntries.end(); 78 78 79 79 Intersectable::NewMail(); 80 80 81 // mail all objects in first pvs 81 82 for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 82 83 { … … 86 87 it_end = pvs2.mEntries.end(); 87 88 89 // look if they are in second pvs 88 90 for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 89 91 { … … 94 96 95 97 return pvs; 98 } 99 100 // computet render cost of merge 101 float ViewCellsTree::ComputeMergedPvsCost(const ObjectPvs &pvs1, const ObjectPvs &pvs2) const 102 { 103 float renderCost = 0; 104 105 // compute new pvs size 106 ObjectPvsMap::const_iterator it, it_end = pvs1.mEntries.end(); 107 108 Intersectable::NewMail(); 109 110 // first mail all objects in first pvs 111 for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 112 { 113 Intersectable *obj = (*it).first; 114 115 obj->Mail(); 116 renderCost += mViewCellsManager->EvalRenderCost(obj); 117 } 118 119 it_end = pvs2.mEntries.end(); 120 121 122 for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 123 { 124 Intersectable *obj = (*it).first; 125 126 // test if object already considered 127 if (!obj->Mailed()) 128 { 129 renderCost += mViewCellsManager->EvalRenderCost(obj); 130 } 131 } 132 133 return renderCost; 96 134 } 97 135 … … 1212 1250 { 1213 1251 //-- compute pvs difference 1214 const int newPvs = 1252 const float newPvs = 1253 #if 0 1215 1254 ComputeMergedPvsSize(mc.mLeftViewCell->GetPvs(), 1216 1255 mc.mRightViewCell->GetPvs()); 1217 1218 const float newPenalty = 1219 EvalPvsPenalty(newPvs, 1220 mViewCellsManager->GetMinPvsSize(), 1221 mViewCellsManager->GetMaxPvsSize()); 1256 #else 1257 ComputeMergedPvsCost(mc.mLeftViewCell->GetPvs(), 1258 mc.mRightViewCell->GetPvs()); 1259 #endif 1260 1261 const float newPenalty = EvalPvsPenalty(newPvs, 1262 mViewCellsManager->GetMinPvsSize(), 1263 mViewCellsManager->GetMaxPvsSize()); 1222 1264 1223 1265 ViewCell *vc1 = mc.mLeftViewCell; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r728 r729 320 320 */ 321 321 void UpdateViewCellsStats(ViewCell *vc, ViewCellsStatistics &vcStat); 322 322 323 323 324 324 /** Get costs resulting from each merge step. */ 325 325 void GetCostFunction(vector<float> &costFunction); 326 326 327 328 327 /** Returns optimal set of view cells for a given number of view cells. 329 328 */ … … 396 395 397 396 ////////////////////////////////////////////////////////////// 398 // merge options//397 // merge related stuff // 399 398 ////////////////////////////////////////////////////////////// 400 399 400 /** Computes render cost of the merged pvs. 401 */ 402 float ComputeMergedPvsCost(const ObjectPvs &pvs1, const ObjectPvs &pvs2) const; 401 403 402 404 /** Returns cost of this leaf according to current heuristics. -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r728 r729 565 565 ++ smallerCost; 566 566 } 567 567 // note: can remove already found view cells 568 //swap(neighborhood[bestViewCellIdx], neighborhood.back()); 569 //neighborhood.pop_back(); 570 571 568 572 outstream << "#RenderCost: " << currentRenderCost << endl; 569 573 outstream << "#ViewCells: " << smallerCost << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r728 r729 1707 1707 const VspBspTraversalData &data) const 1708 1708 { 1709 int pvsFront = 0;1710 int pvsBack = 0;1711 int totalPvs = 0;1709 float pvsFront = 0; 1710 float pvsBack = 0; 1711 float totalPvs = 0; 1712 1712 1713 1713 // probability that view point lies in back / front node … … 1750 1750 pBack = pOverall - pFront; 1751 1751 1752 // something is wrong with the volume 1752 1753 if ((pFront < 0.0) || (pBack < 0.0)) 1753 1754 { … … 1797 1798 float cost = 0; 1798 1799 1799 int totalPvs = 0;1800 int pvsFront = 0;1801 int pvsBack = 0;1800 float totalPvs = 0; 1801 float pvsFront = 0; 1802 float pvsBack = 0; 1802 1803 1803 1804 // probability that view point lies in back / front node … … 1855 1856 pBack = pOverall - pFront; 1856 1857 1857 // precision issues possible for unbalanced split => don't take this split!1858 // HACK: precision issues possible for unbalanced split => don't take this split! 1858 1859 if (1 && 1859 1860 (!splitSuccessFull || (pFront <= 0) || (pBack <= 0) || … … 1999 2000 float &pBack) const 2000 2001 { 2001 int pvsTotal = 0;2002 int pvsFront = 0;2003 int pvsBack = 0;2002 float pvsTotal = 0; 2003 float pvsFront = 0; 2004 float pvsBack = 0; 2004 2005 2005 2006 // create unique ids for pvs heuristics … … 2072 2073 void VspBspTree::AddObjToPvs(Intersectable *obj, 2073 2074 const int cf, 2074 int &frontPvs,2075 int &backPvs,2076 int &totalPvs) const2075 float &frontPvs, 2076 float &backPvs, 2077 float &totalPvs) const 2077 2078 { 2078 2079 if (!obj) … … 2084 2085 (obj->mMailbox != sFrontAndBackId)) 2085 2086 { 2086 ++ totalPvs;2087 totalPvs += mViewCellsManager->EvalRenderCost(obj); 2087 2088 } 2088 2089 … … 2096 2097 (obj->mMailbox != sFrontAndBackId)) 2097 2098 { 2098 ++ frontPvs;2099 frontPvs += mViewCellsManager->EvalRenderCost(obj); 2099 2100 2100 2101 if (obj->mMailbox == sBackId) … … 2110 2111 (obj->mMailbox != sFrontAndBackId)) 2111 2112 { 2112 ++ backPvs;2113 backPvs += mViewCellsManager->EvalRenderCost(obj);; 2113 2114 2114 2115 if (obj->mMailbox == sFrontId) -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r727 r729 587 587 void AddObjToPvs(Intersectable *obj, 588 588 const int cf, 589 int &frontPvs,590 int &backPvs,591 int &totalPvs) const;589 float &frontPvs, 590 float &backPvs, 591 float &totalPvs) const; 592 592 593 593 /** Computes PVS size induced by the rays.
Note: See TracChangeset
for help on using the changeset viewer.