Changeset 1768 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 11/20/06 09:15:28 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1765 r1768 309 309 310 310 int ViewCellsManager::CastPassSamples(const int samplesPerPass, 311 const int sampleType, 312 VssRayContainer &passSamples) const 311 const vector<int> &strategies, 312 VssRayContainer &passSamples 313 ) const 313 314 { 314 315 SimpleRayContainer simpleRays; … … 318 319 int castRays = 0; 319 320 320 vector<int> strategies;321 322 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION);323 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION);324 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION);325 326 321 const int numRaysPerPass = samplesPerPass / (int)strategies.size(); 327 322 … … 397 392 cout << "view cell construction: casting " << mInitialSamples << " initial samples ... " << endl; 398 393 394 // mix of sampling strategies 395 vector<int> strategies; 396 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 397 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 398 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 399 399 400 // cast initial samples 400 CastPassSamples(mInitialSamples, mSamplingType,initialSamples);401 CastPassSamples(mInitialSamples, strategies, initialSamples); 401 402 402 403 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; … … 460 461 startTime = GetTime(); 461 462 const int n = mConstructionSamples; //+initialSamples; 462 // should we use directional samples?463 bool dirSamples = (mSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION);464 463 465 464 while (numSamples < n) … … 470 469 VssRayContainer constructionSamples; 471 470 472 const int samplingType = mSamplingType;473 //dirSamples ? Preprocessor::DIRECTION_BASED_DISTRIBUTION : Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION;474 475 if (0) dirSamples = !dirSamples; // toggle sampling method476 477 471 // cast new samples 478 472 numSamples += CastPassSamples(mSamplesPerPass, 479 s amplingType,473 strategies, 480 474 constructionSamples); 481 475 … … 519 513 cout << "casting " << mPostProcessSamples << " post processing samples ... "; 520 514 521 CastPassSamples(mPostProcessSamples, mSamplingType, postProcessSamples);515 CastPassSamples(mPostProcessSamples, strategies, postProcessSamples); 522 516 523 517 cout << "finished" << endl; … … 566 560 VssRayContainer visSamples; 567 561 int numSamples = CastPassSamples(mVisualizationSamples, 568 mSamplingType,562 strategies, 569 563 visSamples); 570 564 … … 948 942 Debug << "view cell stats prefix: " << statsPrefix << endl; 949 943 950 // should directional sampling be used?951 bool dirSamples =952 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION);953 954 944 cout << "reseting pvs ... "; 955 945 … … 972 962 } 973 963 964 // mix of sampling strategies 965 vector<int> strategies; 966 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 967 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 968 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 969 974 970 cout << "finished" << endl; 975 971 cout << "Evaluating view cell partition ... " << endl; … … 988 984 Debug << "casting " << samplesPerPass << " samples ... "; 989 985 990 CastPassSamples(samplesPerPass, s amplingType, evaluationSamples);986 CastPassSamples(samplesPerPass, strategies, evaluationSamples); 991 987 992 988 castSamples += samplesPerPass; … … 1632 1628 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 1633 1629 1634 // volume and area of the view cells are recomputed and a view cell mesh is created 1630 // volume and area of the view cells are recomputed 1631 // a view cell mesh is created 1635 1632 for (it = mViewCells.begin(); it != it_end; ++ it) 1636 1633 { … … 4134 4131 { //////// 4135 4132 //-- real meshes are contructed at this stage 4133 4136 4134 cout << "finalizing view cells ... "; 4137 4135 FinalizeViewCells(true); … … 4334 4332 Debug << "post processing using " << (int)postProcessRays.size() << " samples" << endl; 4335 4333 4336 // should maybe be done here to allow merge working4337 // with area or volume and to correct the rendering statistics4338 if (0) FinalizeViewCells(false);4339 4340 4334 ////////// 4341 //-- merge the individualview cells4335 //-- merge neighbouring view cells 4342 4336 MergeViewCells(postProcessRays, objects); 4343 4337 … … 4358 4352 //////////// 4359 4353 //-- compression 4360 //#if HAS_TO_BE_REDONE 4354 4361 4355 if (ViewCellsTreeConstructed() && mCompressViewCells) 4362 4356 { … … 4369 4363 Debug << "number of entries after compress: " << pvsEntries << endl; 4370 4364 } 4371 //#endif4372 4365 4373 4366 // collapse sibling leaves that share the same view cell … … 5934 5927 int splitsStepSize; 5935 5928 5936 5937 5929 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 5938 5930 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesForStats", samplesForStats); … … 5946 5938 Debug << "view cell stats prefix: " << statsPrefix << endl; 5947 5939 5948 // should directional sampling be used? 5949 bool dirSamples = 5950 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 5940 // mix of sampling strategies 5941 vector<int> strategies; 5942 strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 5943 strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 5944 strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 5951 5945 5952 5946 cout << "reseting pvs ... "; … … 5971 5965 Debug << "casting " << samplesPerPass << " samples ... "; 5972 5966 5973 CastPassSamples(samplesPerPass, s amplingType, evaluationSamples);5967 CastPassSamples(samplesPerPass, strategies, evaluationSamples); 5974 5968 5975 5969 castSamples += samplesPerPass;
Note: See TracChangeset
for help on using the changeset viewer.