Changeset 2199 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 03/07/07 16:26:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2198 r2199 83 83 mViewCellsTree->SetViewCellsManager(this); 84 84 mSamplesStat.Reset(); 85 } 86 87 88 int ViewCellsManager::CastPassSamples2(const int samplesPerPass, 89 VssRayContainer &passSamples) const 90 { 85 mStats.open("mystats.log"); 86 } 87 88 89 int ViewCellsManager::CastEvaluationSamples(const int samplesPerPass, 90 VssRayContainer &passSamples) 91 { 92 static int pass = 0; 93 static int totalRays = 0; 94 95 SimpleRayContainer rays; 96 rays.reserve(samplesPerPass); 97 passSamples.reserve(samplesPerPass * 2); 98 91 99 long startTime = GetTime(); 92 100 93 SimpleRayContainer simpleRays; 94 95 simpleRays.reserve(samplesPerPass); 96 passSamples.reserve(samplesPerPass * 2); // always creates double rays 97 98 // create one third of each type 99 int castRays = 0; 100 101 mMixtureDistribution->GenerateSamples(mSamplesPerPass, simpleRays); 102 103 cout << "generated " << (int)simpleRays.size() << " samples in " 104 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 105 106 startTime = GetTime(); 107 108 // shoot simple ray and add it to importance samples 109 mPreprocessor->CastRays(simpleRays, passSamples, true); 110 111 cout << "cast " << samplesPerPass << " samples in " 112 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 101 //cout<<"Progress :"<<i/1e6f<<"M rays, "<<(100.0f*i)/mTotalSamples<<"%"<<endl; 102 103 //rays.clear(); 104 //passSamples.clear(); 105 106 mMixtureDistribution->GenerateSamples(samplesPerPass, rays); 107 108 bool doubleRays = true; 109 bool pruneInvalidRays = true; 110 mPreprocessor->CastRays(rays, passSamples, doubleRays, pruneInvalidRays); 113 111 114 112 mMixtureDistribution->ComputeContributions(passSamples); 113 mMixtureDistribution->UpdateDistributions(passSamples); 114 115 Real time = TimeDiff(startTime, GetTime()); 116 PrintPvsStatistics(mStats); 117 118 mStats << 119 "#Pass\n" << pass ++ <<endl<< 120 "#Time\n" << time <<endl<< 121 "#TotalSamples\n" <<totalRays<<endl; 122 123 float last = 0.0f; 124 125 for (int k=0; k < 6; ++ k) 126 { 127 float ratio = 0.0f; 128 129 if (k < mMixtureDistribution->mDistributions.size()) 130 { 131 ratio = mMixtureDistribution->mDistributions[k]->mRatio-last; 132 last = mMixtureDistribution->mDistributions[k]->mRatio; 133 } 134 135 mStats << "#Distribution"<<k<<endl<< ratio<<endl; 136 } 137 138 139 totalRays += samplesPerPass; 115 140 116 141 return (int)passSamples.size(); … … 173 198 Debug << mStrategies[i] << " "; 174 199 Debug << endl; 175 176 // now decode distribution string177 char buff[1024];178 Environment::GetSingleton()->GetStringValue("RssPreprocessor.distributions", buff);179 180 mMixtureDistribution = new MixtureDistribution(*mPreprocessor);181 mMixtureDistribution->Construct(buff);182 183 200 184 201 // sampling type for view cells construction samples … … 301 318 Debug << "export pvs for view cells: " << mExportPvs << endl; 302 319 Debug << "use kd pvs " << mUseKdPvs << endl; 320 303 321 Debug << endl; 304 322 } … … 805 823 mPreprocessor = preprocessor; 806 824 825 // now decode distribution string 826 char mix[1024]; 827 Environment::GetSingleton()->GetStringValue("RssPreprocessor.distributions", mix); 828 Debug << "using mixture distributions: " << mix << endl; 829 830 mMixtureDistribution = new MixtureDistribution(*mPreprocessor); 831 mMixtureDistribution->Construct(mix); 807 832 808 833 /////////////////////////////////////////////////////// … … 6873 6898 Debug << "casting " << samplesPerPass << " samples ... "; 6874 6899 6875 if (1) 6876 { 6900 if (0) 6877 6901 CastPassSamples(samplesPerPass, evalStrats, evaluationSamples); 6878 }6879 6902 else 6880 {6881 6903 // use mixed distributions 6882 CastPassSamples2(samplesPerPass, evaluationSamples); 6883 } 6904 CastEvaluationSamples(samplesPerPass, evaluationSamples); 6884 6905 6885 6906 castSamples += samplesPerPass;
Note: See TracChangeset
for help on using the changeset viewer.