- Timestamp:
- 01/23/07 14:13:43 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r2022 r2035 11 11 #include "VssRay.h" 12 12 #include "SamplingStrategy.h" 13 #include "RayCaster.h" 13 14 14 15 … … 25 26 SamplingPreprocessor::~SamplingPreprocessor() 26 27 { 27 CLEAR_CONTAINER(mSampleRays);28 CLEAR_CONTAINER(mVssSampleRays);29 28 } 30 29 … … 91 90 92 91 map<ViewCell *, HaltonSequence> dirHalton; 93 92 int lastEvaluation = 0; 93 SimpleRayContainer rays; 94 VssRayContainer vssRays; 95 94 96 while (samples < mTotalSamples) { 95 for (int i=0; i < mSamplesPerEvaluation;) { 96 SimpleRayContainer rays; 97 VssRayContainer vssRays; 98 // vector<ViewCell *> viewcells; 97 for (int i=0; i < mSamplesPerPass;) { 98 99 mRayCaster->InitPass(); 99 100 100 101 float r[5]; … … 107 108 if (!viewcell || !viewcell->GetValid()) 108 109 continue; 109 110 111 rays.clear(); 112 vssRays.clear(); 113 110 114 for (; rays.size() < 16; ) { 111 if (i%100000 == 0) 112 cout<<"+"; 115 if (i%100000 == 0) { 116 cout<<samples/1e6f<<"M rays, progress: "<<samples*100/mTotalSamples<<" % \r"; 117 } 113 118 114 // dirHalton.GetNext(2, r);115 119 dirHalton[viewcell].GetNext(2, r); 116 120 direction = UniformRandomVector(r[0],r[1]); 117 121 //direction = UniformRandomVector(); 118 122 119 // viewcells.push_back(viewcell);120 123 // cast rays in both directions to make the number of samples comparable 121 124 // with the global sampling method which also casts a "double" ray per sample … … 133 136 true); 134 137 135 // if (vssRays.size()!=32) {136 // cerr<<"wrong number of rays "<<(int)vssRays.size()<<endl;137 // exit(1);138 // }139 138 140 139 rssSamples += vssRays.size(); … … 147 146 float pdf = 1.0f; 148 147 // ViewCell *viewcell = viewcells[j/2]; 149 148 150 149 ObjectPvs &pvs = viewcell->GetPvs(); 151 150 pvs.AddSampleDirtyCheck(obj, pdf); … … 157 156 } 158 157 159 CLEAR_CONTAINER(vssRays);160 161 158 if (samples > mTotalSamples) 162 159 break; 163 160 } 164 161 165 #if 0 166 Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl;167 mViewCellsManager->SetValidity(0, intersectables/2);168 Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl;169 #endif 170 171 // mVssRays.PrintStatistics(mStats);172 mStats <<173 "#Time\n" << TimeDiff(startTime, GetTime())*1e-3<<endl<<174 "#TotalSamples\n" <<samples<<endl<< 175 "#RssSamples\n" <<rssSamples<<endl;176 177 mViewCellsManager->PrintPvsStatistics(mStats);178 // ComputeRenderError();179 180 162 163 if (samples - lastEvaluation >= mSamplesPerEvaluation) { 164 mViewCellsManager->PrintPvsStatistics(mStats); 165 mStats << 166 "#Pass\n" <<mPass<<endl<< 167 "#Time\n" << TimeDiff(startTime, GetTime())<<endl<< 168 "#TotalSamples\n" <<samples<<endl<< 169 "#RssSamples\n" <<rssSamples<<endl; 170 lastEvaluation = samples; 171 172 if (renderer) { 173 ComputeRenderError(); 174 } 175 176 } 177 } 181 178 if (0) { 182 179 Exporter *exporter = Exporter::GetExporter("ray-density.x3d"); … … 185 182 delete exporter; 186 183 } 187 188 189 184 185 186 // $$JB temporary removed 190 187 // mViewCellsManager->PostProcess(objects, mSampleRays); 191 188
Note: See TracChangeset
for help on using the changeset viewer.