- Timestamp:
- 07/19/06 00:26:49 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1141 r1142 1288 1288 "perobject"); 1289 1289 1290 RegisterOption("ViewCells.Evaluation.countKdPvs",1291 optBool,1292 "view_cells_evaluation_count_kd_pvs=",1293 "false");1294 1295 1290 RegisterOption("ViewCells.active", 1296 1291 optInt, … … 2219 2214 RegisterOption("VspTree.storeKdPvs", 2220 2215 optBool, 2221 "vsp_store KdPvs=",2216 "vsp_store_kd_pvs=", 2222 2217 "true"); 2223 2218 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1141 r1142 1677 1677 1678 1678 1679 int ViewCellsTree::CountKdPvs(const ViewCellLeaf *vc) const 1680 { 1681 ObjectPvsMap::const_iterator oit, oit_end = vc->GetPvs().mEntries.end(); 1682 1679 int ViewCellsTree::GetPvsSize(ViewCell *vc) const 1680 { 1683 1681 int pvsSize = 0; 1684 1682 1685 1683 Intersectable::NewMail(); 1686 1684 1687 for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1688 { 1689 Intersectable *obj = (*oit).first; 1690 1691 /* KdLeaf *leaf = ; 1692 1693 pvsSize += ((int)leaf->mObjects.size() - (int)leaf->mMultipleObjects.size()); 1694 1695 //-- handle objects of several kd leaves separately 1696 ObjectContainer::const_iterator oit, oit_end = leaf->mMultipleObjects.end(); 1697 1698 for (oit = leaf->mMultipleObjects.begin(); oit != oit_end; ++ oit) 1699 { 1700 Intersectable *object = *oit; 1701 1702 // object not previously in left pvs 1703 if (!object->Mailed()) 1704 { 1705 object->Mail(); 1706 ++ pvsSize; 1707 } 1708 } 1709 }*/ 1710 } 1711 1712 return pvsSize; 1713 } 1714 1715 1716 int ViewCellsTree::GetPvsSize(ViewCell *vc, const bool countKdPvs) const 1717 { 1718 int pvsSize = 0; 1719 1720 Intersectable::NewMail(); 1721 1722 ////////////////////////// 1723 // for interiors, pvs can be stored using different methods 1685 //////////////////////////////////////////////// 1686 //-- for interiors, pvs can be stored using different methods 1687 /////////////////////////////////////////////// 1724 1688 1725 1689 switch (mViewCellsStorage) … … 1730 1694 if (vc->IsLeaf()) 1731 1695 { 1732 if (countKdPvs) 1733 pvsSize = vc->GetPvs().CountPvs(); 1734 else 1735 pvsSize = CountKdPvs(dynamic_cast<ViewCellLeaf *>(vc)); 1736 break; 1696 pvsSize = vc->GetPvs().CountPvs(); 1737 1697 } 1738 1698 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r1141 r1142 439 439 void GetPvs(ViewCell *vc, ObjectPvs &pvs) const; 440 440 441 /** Returns pvs size of view cell. 442 */ 443 //int GetPvsSize(ViewCell *vc) const; 444 int GetPvsSize(ViewCell *vc, const bool countKdPvs = false) const; 441 /** Returns pvs size (i.e. the number of entries weighted by their "importance". 442 */ 443 int GetPvsSize(ViewCell *vc) const; 445 444 446 445 /** Returns actual number of object in this pvs and the children. -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1141 r1142 100 100 Environment::GetSingleton()->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 101 101 Environment::GetSingleton()->GetBoolValue("ViewCells.exportPvs", mExportPvs); 102 Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.countKdPvs", mCountKdPvs);102 103 103 104 104 char buf[100]; … … 214 214 Debug << "export bounding boxes: " << mExportBboxesForPvs << endl; 215 215 Debug << "export pvs for view cells: " << mExportPvs << endl; 216 Debug << "count kd pvs: " << mCountKdPvs << endl;216 217 217 218 218 Debug << endl; … … 788 788 sort(viewCells.begin(), viewCells.end(), ViewCell::SmallerPvs); 789 789 790 maxPvs = mViewCellsTree->GetPvsSize(viewCells.back() , mCountKdPvs);790 maxPvs = mViewCellsTree->GetPvsSize(viewCells.back()); 791 791 minVal = 0; 792 792 … … 832 832 833 833 while ((i < (int)viewCells.size()) && 834 (mViewCellsTree->GetPvsSize(viewCells[i] , mCountKdPvs) < currentPvs))834 (mViewCellsTree->GetPvsSize(viewCells[i]) < currentPvs)) 835 835 { 836 836 volDif += viewCells[i]->GetVolume(); … … 843 843 844 844 if (0 && (i < (int)viewCells.size())) 845 Debug << "new pvs size increase: " << mViewCellsTree->GetPvsSize(viewCells[i] , mCountKdPvs)845 Debug << "new pvs size increase: " << mViewCellsTree->GetPvsSize(viewCells[i]) 846 846 << " " << currentPvs << endl; 847 847 … … 1706 1706 ViewCell *viewcell = *it; 1707 1707 1708 const int pvsSize = mViewCellsTree->GetPvsSize(viewcell , mCountKdPvs);1708 const int pvsSize = mViewCellsTree->GetPvsSize(viewcell); 1709 1709 1710 1710 if (pvsSize < stat.minPvs) … … 1957 1957 float ViewCellsManager::GetRendercost(ViewCell *viewCell) const 1958 1958 { 1959 return mViewCellsTree->GetPvsSize(viewCell , mCountKdPvs);1959 return mViewCellsTree->GetPvsSize(viewCell); 1960 1960 } 1961 1961 … … 2409 2409 { 2410 2410 importance = 2411 (float)mViewCellsTree->GetPvsSize(vc , mCountKdPvs) /2411 (float)mViewCellsTree->GetPvsSize(vc) / 2412 2412 (float)mCurrentViewCellsStats.maxPvs; 2413 2413 } … … 4390 4390 Exporter *exporter = Exporter::GetExporter(s); 4391 4391 4392 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc , mCountKdPvs) << endl;4392 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc) << endl; 4393 4393 4394 4394 //-- export the sample rays … … 4904 4904 long startTime; 4905 4905 4906 mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox);4907 4906 //mHierarchyManager->Construct(constructionRays, objects, &mViewSpaceBox); 4908 4907 //mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox); 4908 mHierarchyManager->Construct3(constructionRays, objects, &mViewSpaceBox); 4909 4909 4910 //-- stats 4910 4911 Debug << mVspTree->GetStatistics() << endl; … … 5301 5302 } 5302 5303 5303 if (1 )5304 if (1 && mOspTree->GetRoot()) 5304 5305 { 5305 5306 //-- export final object partition … … 5383 5384 Exporter *exporter = Exporter::GetExporter(s); 5384 5385 5385 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc , mCountKdPvs) << endl;5386 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc) << endl; 5386 5387 5387 5388 //-- export the sample rays -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1141 r1142 655 655 /// if pvs should be exported with view cells 656 656 bool mExportPvs; 657 // matt§§: need this?658 bool mCountKdPvs;659 657 }; 660 658 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1141 r1142 523 523 524 524 525 void VspTree::CreateViewCell(VspTraversalData &tData )525 void VspTree::CreateViewCell(VspTraversalData &tData, const bool updatePvs) 526 526 { 527 527 //-- create new view cell … … 530 530 VspViewCell *viewCell = new VspViewCell(); 531 531 leaf->SetViewCell(viewCell); 532 533 //-- update pvs 532 534 533 int conSamp = 0; 535 534 float sampCon = 0.0f; 536 AddSamplesToPvs(leaf, *tData.mRays, sampCon, conSamp); 537 538 // update scalar pvs size value 539 mViewCellsManager->SetScalarPvsSize(viewCell, viewCell->GetPvs().CountPvs()); 540 541 mVspStats.contributingSamples += conSamp; 542 mVspStats.sampleContributions +=(int) sampCon; 535 536 //-- update pvs 537 if (updatePvs) 538 { 539 AddSamplesToPvs(leaf, *tData.mRays, sampCon, conSamp); 540 541 // update scalar pvs size value 542 mViewCellsManager->SetScalarPvsSize(viewCell, viewCell->GetPvs().CountPvs()); 543 544 mVspStats.contributingSamples += conSamp; 545 mVspStats.sampleContributions += (int)sampCon; 546 } 547 543 548 544 549 //-- store additional info … … 766 771 767 772 // explicitely create front and back view cell 768 CreateViewCell(frontData );769 CreateViewCell(backData );773 CreateViewCell(frontData, true); 774 CreateViewCell(backData, true); 770 775 771 776 … … 773 778 // add front and back view cell to "Potentially Visbilie View Cells" 774 779 // of the objects in front and back pvs 775 AddViewCellReferences(frontLeaf->GetViewCell()); 776 AddViewCellReferences(backLeaf->GetViewCell()); 780 781 //AddViewCellReferences(frontLeaf->GetViewCell()); 782 //AddViewCellReferences(backLeaf->GetViewCell()); 777 783 778 784 interior->mTimeStamp = mTimeStamp ++; … … 4004 4010 mVspTree.mVspStats.nodes = 1; 4005 4011 4006 // prepare bounding box4012 // compute view space bounding box 4007 4013 mVspTree.ComputeBoundingBox(rays, forcedViewSpace); 4008 4014 … … 4032 4038 4033 4039 // create first view cell 4034 mVspTree.CreateViewCell(vData );4040 mVspTree.CreateViewCell(vData, true); 4035 4041 4036 4042 // add first view cell to all the objects view cell pvs … … 4179 4185 mVspTree.mVspStats.Stop(); 4180 4186 4187 4188 /////////////////////////////////////////////////////////////// 4189 //-- object space partition 4190 ///////////////////////////////////////////////////////////// 4191 4192 4193 cout << "starting osp contruction ... " << endl; 4181 4194 startTime = GetTime(); 4182 cout << "starting osp contruction ... " << endl; 4183 4184 //-- object space partition 4195 4185 4196 SplitCandidate *osc = 4186 4197 PrepareOsp(sampleRays, objects, forcedViewSpace, *objectSpaceRays); … … 4222 4233 mVspTree.mStoreKdPvs = savedStoreMethod; 4223 4234 } 4235 4236 4237 void HierarchyManager::Construct3(const VssRayContainer &sampleRays, 4238 const ObjectContainer &objects, 4239 AxisAlignedBox3 *forcedViewSpace) 4240 { 4241 RayInfoContainer *viewSpaceRays = new RayInfoContainer(); 4242 4243 SplitCandidate *sc = PrepareVsp(sampleRays, forcedViewSpace, *viewSpaceRays); 4244 mTQueue.Push(sc); 4245 4246 cout << "starting vsp contruction ... " << endl; 4247 4248 long startTime = GetTime(); 4249 int i = 0; 4250 4251 while (!FinishedConstruction()) 4252 { 4253 SplitCandidate *splitCandidate = NextSplitCandidate(); 4254 4255 const bool globalTerminationCriteriaMet = 4256 GlobalTerminationCriteriaMet(splitCandidate); 4257 4258 cout << "vsp nodes: " << i ++ << endl; 4259 4260 // cost ratio of cost decrease / totalCost 4261 const float costRatio = splitCandidate->GetPriority() / mTotalCost; 4262 //cout << "cost ratio: " << costRatio << endl; 4263 4264 if (costRatio < mTermMinGlobalCostRatio) 4265 ++ mGlobalCostMisses; 4266 4267 //-- subdivide leaf node 4268 4269 // we have either a object space or view space split 4270 VspTree::VspSplitCandidate *sc = 4271 dynamic_cast<VspTree::VspSplitCandidate *>(splitCandidate); 4272 4273 4274 VspNode *r = mVspTree.Subdivide(mTQueue, *sc, globalTerminationCriteriaMet); 4275 4276 DEL_PTR(splitCandidate); 4277 } 4278 4279 cout << "finished in " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl; 4280 mVspTree.mVspStats.Stop(); 4281 } 4282 4224 4283 4225 4284 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1141 r1142 1012 1012 ViewCell *back) const; 1013 1013 1014 void CreateViewCell(VspTraversalData &tData );1014 void CreateViewCell(VspTraversalData &tData, const bool updatePvs); 1015 1015 1016 1016 void CollectDirtyCandidates(VspSplitCandidate *sc, … … 1748 1748 AxisAlignedBox3 *forcedViewSpace); 1749 1749 1750 /** Constructs only vsp tree. 1751 */ 1752 void Construct3(const VssRayContainer &sampleRays, 1753 const ObjectContainer &objects, 1754 AxisAlignedBox3 *forcedViewSpace); 1755 1750 1756 public: 1751 1757 VspTree &mVspTree;
Note: See TracChangeset
for help on using the changeset viewer.