Ignore:
Timestamp:
01/23/07 14:13:43 (17 years ago)
Author:
bittner
Message:

merge

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp

    r2022 r2035  
    1111#include "VssRay.h" 
    1212#include "SamplingStrategy.h" 
     13#include "RayCaster.h" 
    1314 
    1415 
     
    2526SamplingPreprocessor::~SamplingPreprocessor() 
    2627{ 
    27   CLEAR_CONTAINER(mSampleRays); 
    28   CLEAR_CONTAINER(mVssSampleRays); 
    2928} 
    3029 
     
    9190 
    9291  map<ViewCell *, HaltonSequence> dirHalton; 
    93    
     92  int lastEvaluation = 0; 
     93  SimpleRayContainer rays; 
     94  VssRayContainer vssRays; 
     95 
    9496  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(); 
    99100           
    100101          float r[5]; 
     
    107108          if (!viewcell || !viewcell->GetValid()) 
    108109                continue; 
    109            
     110 
     111          rays.clear(); 
     112          vssRays.clear(); 
     113 
    110114          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                } 
    113118                 
    114                 //              dirHalton.GetNext(2, r); 
    115119                dirHalton[viewcell].GetNext(2, r); 
    116120                direction = UniformRandomVector(r[0],r[1]); 
    117121                //direction = UniformRandomVector(); 
    118122                 
    119                 //              viewcells.push_back(viewcell); 
    120123                // cast rays in both directions to make the number of samples comparable 
    121124                // with the global sampling method which also casts a "double" ray per sample 
     
    133136                           true); 
    134137           
    135           //      if (vssRays.size()!=32) { 
    136           //            cerr<<"wrong number of rays "<<(int)vssRays.size()<<endl; 
    137           //            exit(1); 
    138           //      } 
    139138 
    140139          rssSamples += vssRays.size(); 
     
    147146                        float pdf = 1.0f; 
    148147                        //                      ViewCell *viewcell = viewcells[j/2]; 
    149  
     148                         
    150149                        ObjectPvs &pvs = viewcell->GetPvs(); 
    151150                        pvs.AddSampleDirtyCheck(obj, pdf); 
     
    157156                } 
    158157           
    159           CLEAR_CONTAINER(vssRays); 
    160            
    161158          if (samples > mTotalSamples) 
    162159                break; 
    163160        } 
    164161 
    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  } 
    181178  if (0) { 
    182179        Exporter *exporter = Exporter::GetExporter("ray-density.x3d");  
     
    185182        delete exporter; 
    186183  } 
    187    
    188    
    189   // $$JB temporary removed 
     184         
     185         
     186        // $$JB temporary removed 
    190187  //    mViewCellsManager->PostProcess(objects, mSampleRays); 
    191188   
Note: See TracChangeset for help on using the changeset viewer.