Ignore:
Timestamp:
11/25/06 04:07:13 (18 years ago)
Author:
mattausch
Message:

implemented dirty pvs and lazy update

File:
1 edited

Legend:

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

    r1789 r1790  
    19561956} 
    19571957 
    1958 /* 
    1959 void 
    1960 ViewCellsManager::AddSampleContributions(const VssRayContainer &rays) 
    1961 { 
    1962   if (!ViewCellsConstructed()) 
    1963         return; 
    1964  
    1965   VssRayContainer::const_iterator it, it_end = rays.end(); 
    1966 cout <<"here60"<<endl; 
    1967   for (it = rays.begin(); it != it_end; ++ it) { 
    1968         AddSampleContributions(*(*it)); 
    1969   } 
    1970 } 
    1971 */ 
    19721958 
    19731959int ViewCellsManager::GetMinPvsSize() const 
     
    19831969} 
    19841970 
    1985 /* 
    1986 void 
    1987 ViewCellsManager::AddSampleContributions(VssRay &ray) 
    1988 {cout << "here12" << endl; 
    1989         // assumes viewcells have been stored... 
    1990         ViewCellContainer *viewcells = &ray.mViewCells; 
    1991         ViewCellContainer::const_iterator it; 
    1992  
    1993         if (!ray.mTerminationObject) 
    1994                 return; 
    1995  
    1996         Intersectable *obj = GetIntersectable(ray, true); 
    1997  
    1998         for (it = viewcells->begin(); it != viewcells->end(); ++it)  
    1999         { 
    2000                 ViewCell *viewcell = *it; 
    2001                 if (viewcell->GetValid())  
    2002                 { 
    2003                         Intersectable *entry = GetIntersectable(ray, true); 
    2004                         if (entry)     
    2005                                 // if ray not outside of view space 
    2006                                 viewcell->GetPvs().AddSample(entry, ray.mPdf); 
    2007                 } 
    2008         } 
    2009 } 
    2010 */ 
    20111971 
    20121972float ViewCellsManager::ComputeSampleContribution(VssRay &ray, 
    20131973                                                                                                  const bool addRays, 
    20141974                                                                                                  const bool storeViewCells) 
    2015 {cout << "$$$$$$$$$$$$$4here10" << endl; 
     1975{ 
    20161976        ViewCellContainer viewcells; 
    20171977 
     
    60416001         
    60426002 
     6003#define PVS_ADD_DIRTY 1 
    60436004float VspOspViewCellsManager::ComputeSampleContribution(VssRay &ray, 
    60446005                                                                                                                const bool addRays, 
     
    60946055                        { 
    60956056                                // todo: maybe not correct for kd node pvs 
    6096                         /*      if (viewcell->GetPvs().GetSampleContribution( 
    6097                                         terminationObj, ray.mPdf, contribution)) 
     6057                                if (viewcell->GetPvs().GetSampleContribution( 
     6058                                                        terminationObj, ray.mPdf, contribution)) 
    60986059                                { 
    60996060                                        ++ ray.mPvsContribution; 
    61006061                                } 
    6101                                 ray.mRelativePvsContribution += contribution;*/ 
     6062 
     6063                                ray.mRelativePvsContribution += contribution; 
    61026064                        } 
    61036065 
     
    61096071#if SAMPLE_ORIGIN_OBJECTS 
    61106072 
    6111                 /*      if (originObj &&  
     6073                        if (originObj &&  
    61126074                                viewcell->GetPvs().GetSampleContribution(originObj, 
    61136075                                                                                                                 ray.mPdf, 
     
    61166078                                ++ ray.mPvsContribution; 
    61176079                                ray.mRelativePvsContribution += contribution; 
    6118                         }*/ 
     6080                        } 
    61196081#endif 
    61206082                } 
     
    61356097 
    61366098                //$$JB hack 
    6137                 float contrib; 
    6138                 //viewCell->GetPvs().AddSampleDirtyCheck(terminationObj, ray.mPdf, contrib); 
    6139                 viewCell->GetPvs().AddSample(terminationObj, ray.mPdf);//, contrib); 
    6140  
    6141                 if (viewCell->GetPvs().GetSize() == 50) 
    6142                 //if (viewCell->GetPvs().RequiresResort()) 
    6143                 {Intersectable::NewMail(); 
    6144                 cout << "\nbefore sort: " << viewCell->GetPvs().GetLastSorted() << " \n"; 
    6145                         ObjectPvsIterator pit = viewCell->GetPvs().GetIterator(); int i = 0; 
    6146                         while (pit.HasMoreEntries()) 
    6147                         {                
    6148                                 ObjectPvsEntry entry = pit.Next(); 
    6149                 Intersectable *object = entry.mObject; 
    6150  
    6151                                 if ((i ++) == viewCell->GetPvs().GetLastSorted()) 
    6152                                         cout << "| "; 
    6153                                  
    6154                                 //if (object->Mailed()) cout << "error!!"<<endl; 
    6155                                 object->Mail(); 
    6156                                 cout << (int)object << " "; 
    6157                         } 
    6158  
    6159                         //viewCell->GetPvs().Sort(); 
    6160                          
    6161                         /*cout << "\nafter sort\n"; 
    6162                         pit = viewCell->GetPvs().GetIterator(); i = 0; 
    6163                         while (pit.HasMoreEntries()) 
    6164                         {                
    6165                                 ObjectPvsEntry entry = pit.Next(); 
    6166                 Intersectable *object = entry.mObject; 
    6167  
    6168                                 if ((i ++) == viewCell->GetPvs().GetLastSorted()) 
    6169                                         cout << "| ";    
    6170                                 cout << (int)object << " "; 
    6171                         }*/ 
    6172                 } 
    6173                 //else cout << "b"; 
     6099 
     6100#if PVS_ADD_DIRTY 
     6101                viewCell->GetPvs().AddSampleDirtyCheck(terminationObj, ray.mPdf); 
     6102#else 
     6103                viewCell->GetPvs().AddSample(terminationObj, ray.mPdf); 
     6104#endif 
     6105 
    61746106#if SAMPLE_ORIGIN_OBJECTS 
    6175                 //viewCell->GetPvs().AddSample(originObj, ray.mPdf); 
     6107#if PVS_ADD_DIRTY 
     6108                viewCell->GetPvs().AddSampleDirtyCheck(originObj, ray.mPdf); 
     6109#else 
     6110                viewCell->GetPvs().AddSample(originObj, ray.mPdf); 
    61766111#endif 
     6112#endif 
     6113                if (viewCell->GetPvs().RequiresResort()) 
     6114                { 
     6115                        viewCell->GetPvs().Sort();                       
     6116                } 
    61776117        } 
    61786118 
     
    63106250                        ////////////// 
    63116251                        // filtered stats 
     6252 
    63126253                        sprintf(suffix, "-%09d-eval-filter.log", castSamples); 
    63136254                        const string filename2 = string(statsPrefix) + string(suffix); 
Note: See TracChangeset for help on using the changeset viewer.