- Timestamp:
- 01/17/06 23:28:10 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r544 r547 25 25 mTotalAreaValid(false), 26 26 mTotalArea(0.0f), 27 mViewCellsFinished(false) 27 mViewCellsFinished(false), 28 mMaxPvsSize(99999) 28 29 { 29 30 mViewSpaceBox.Initialize(); … … 49 50 environment->GetBoolValue("ViewCells.Visualization.exportRays", mExportRays); 50 51 environment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 52 environment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 51 53 52 54 char buf[50]; … … 105 107 return (int)rays.size(); 106 108 } 109 110 111 bool ViewCellsManager::CheckValid(ViewCell *vc) const 112 { 113 if (vc->GetPvs().GetSize() > mMaxPvsSize) 114 return false; 115 116 return true; 117 } 118 107 119 108 120 bool ViewCellsManager::LoadViewCells(const string filename, ObjectContainer *objects) … … 347 359 } 348 360 361 349 362 ViewCellContainer &ViewCellsManager::GetViewCells() 350 363 { … … 375 388 // has to be recomputed 376 389 mTotalAreaValid = false; 390 } 391 392 393 int ViewCellsManager::GetMaxPvsSize() const 394 { 395 return mMaxPvsSize; 377 396 } 378 397 … … 1797 1816 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) 1798 1817 { 1799 #if 0 1800 return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 1801 #else 1802 return GetArea(viewCell) / GetAccVcArea(); 1803 #endif 1818 if (mVspBspTree->mUseAreaForPvs) 1819 return GetArea(viewCell) / GetAccVcArea(); 1820 else 1821 return GetVolume(viewCell) / mViewSpaceBox.GetVolume(); 1804 1822 } 1805 1823 … … 1807 1825 void VspBspViewCellsManager::CollectViewCells() 1808 1826 { 1809 mVspBspTree->CollectViewCells(mViewCells );1827 mVspBspTree->CollectViewCells(mViewCells, false); 1810 1828 } 1811 1829 … … 1852 1870 Debug << "saved rays: " << (int)savedRays.size() << endl; 1853 1871 1872 mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 1873 1854 1874 mVspBspTree->Construct(constructionRays, &mViewSpaceBox); 1855 1875 … … 1929 1949 1930 1950 // TODO: should be done BEFORE the ray casting 1931 merged = mVspBspTree->MergeViewCells(rays );1951 merged = mVspBspTree->MergeViewCells(rays, objects); 1932 1952 1933 1953 //-- stats and visualizations … … 2300 2320 ViewCell *vc) const 2301 2321 { 2302 if ( mColorCode == 0) // Random color2322 if (CheckValid(vc) && (mColorCode == 0)) // Random color 2303 2323 return; 2304 2324 2305 2325 float importance = 0; 2306 2326 2327 Material m; 2328 2307 2329 switch (mColorCode) 2308 2330 { … … 2319 2341 importance = (float)bspVc->mLeaves.size() / 2320 2342 (float)mViewCellsStats.maxLeaves; 2343 2344 if (CheckValid(vc)) 2345 m.mDiffuseColor.b = 1.0f; 2346 m.mDiffuseColor.r = importance; 2347 m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 2321 2348 } 2322 2349 break; … … 2325 2352 importance = (float)GetMaxTreeDiff(vc) / 2326 2353 (float)(mVspBspTree->GetStatistics().maxDepth * 2); 2354 2355 if (CheckValid(vc)) 2356 m.mDiffuseColor.b = 1.0f; 2357 m.mDiffuseColor.r = importance; 2358 m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 2327 2359 } 2328 2360 break; … … 2331 2363 } 2332 2364 2333 Material m; 2334 m.mDiffuseColor.b = 1.0f; 2365 m.mDiffuseColor.b = CheckValid(vc) ? 1.0f : 0.0f; 2335 2366 m.mDiffuseColor.r = importance; 2336 2367 m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 2368 2337 2369 //Debug << "importance: " << importance << endl; 2338 2370 exporter->SetForcedMaterial(m);
Note: See TracChangeset
for help on using the changeset viewer.