Ignore:
Timestamp:
11/23/06 21:38:45 (18 years ago)
Author:
bittner
Message:

merge, filter update, renderebuffer made functional

File:
1 edited

Legend:

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

    r1784 r1785  
    2626 
    2727 
    28 #define ABS_CONTRIBUTION_WEIGHT 1.0f 
    2928 
    3029// warning: Should not count origin object for sampling  
     
    3332 
    3433// $$JB HACK 
    35 #define USE_KD_PVS 0 
     34#define USE_KD_PVS 1 
    3635#define KD_PVS_AREA (1e-5f) 
    3736 
     
    18261825                 
    18271826                stat.avgPvs += pvsCost; 
    1828                  
    1829                 const bool evaluateFilter = true; 
     1827 
     1828                bool evaluateFilter; 
     1829                Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluateFilter", evaluateFilter); 
     1830                 
    18301831                 
    18311832                if (evaluateFilter) { 
    18321833                  ObjectPvs filteredPvs = viewcell->GetPvs(); 
    1833                   PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 1.0f, filteredPvs); 
     1834                  PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 
     1835                                                                                                   1.0f, filteredPvs); 
    18341836                   
    18351837                  float filteredCost = filteredPvs.EvalPvsCost(); 
     
    20322034        ViewCell::NewMail(); 
    20332035 
     2036        //      if (ray.mPdf!=1.0f) 
     2037        //        cout<<ray.mPdf<<" "; 
     2038         
     2039         
    20342040        // traverse the view space subdivision 
    20352041        CastLineSegment(origin, termination, viewcells); 
     
    58525858        //Ray hray(ray); 
    58535859 
     5860        //      if (ray.mPdf!=1.0f) 
     5861        //        cout<<ray.mPdf<<" "; 
     5862 
    58545863        float tmin = 0, tmax = 1.0; 
    58555864 
     5865         
    58565866        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
    58575867                return 0; 
     
    58675877        if (storeViewCells) 
    58685878        {        
    5869                 // copy viewcells memory efficiently 
    5870                 ray.mViewCells.reserve(viewcells.size()); 
    5871                 ray.mViewCells = viewcells; 
     5879          // copy viewcells memory efficiently 
     5880          ray.mViewCells.reserve(viewcells.size()); 
     5881          ray.mViewCells = viewcells; 
    58725882        } 
    58735883 
     
    58775887        Intersectable *originObj = GetIntersectable(ray, false); 
    58785888           
    5879         for (; it != viewcells.end(); ++ it)  
    5880         { 
    5881                 ViewCell *viewcell = *it; 
    5882  
    5883                 if (viewcell->GetValid()) 
     5889        for (; it != viewcells.end(); ++ it) { 
     5890          ViewCell *viewcell = *it; 
     5891           
     5892          if (viewcell->GetValid()) 
    58845893                {       // if ray not outside of view space 
    5885                         float contribution; 
    5886  
    5887                         if (terminationObj)  
     5894                  float contribution; 
     5895                   
     5896                  if (terminationObj)  
    58885897                        { 
    5889                                 // todo: maybe not correct for kd node pvs 
    5890                                 if (viewcell->GetPvs().GetSampleContribution( 
    5891                                                 terminationObj, ray.mPdf, contribution)) 
     5898                          // todo: maybe not correct for kd node pvs 
     5899                          if (viewcell->GetPvs().GetSampleContribution( 
     5900                                                                                                                   terminationObj, ray.mPdf, contribution)) 
    58925901                                { 
    5893                                         ++ ray.mPvsContribution; 
     5902                                  ++ ray.mPvsContribution; 
    58945903                                } 
    5895  
    5896                                 ray.mRelativePvsContribution += contribution; 
     5904                           
     5905                          ray.mRelativePvsContribution += contribution; 
    58975906                        } 
    58985907                         
    5899                         //////////////// 
    5900                         //-- for directional sampling it is important to count  
    5901                         //-- only contributions made in one direction! 
    5902                         //-- the other contributions of this sample will be counted for the opposite ray! 
    5903  
     5908                  //////////////// 
     5909                  //-- for directional sampling it is important to count  
     5910                  //-- only contributions made in one direction! 
     5911                  //-- the other contributions of this sample will be counted for the opposite ray! 
     5912                   
    59045913#if SAMPLE_ORIGIN_OBJECTS 
    5905  
    5906                         if (originObj &&  
    5907                                 viewcell->GetPvs().GetSampleContribution(originObj, 
    5908                                                                                                                 ray.mPdf, 
    5909                                                                                                                 contribution)) 
    5910                           { 
    5911                                 ++ ray.mPvsContribution; 
    5912                                 ray.mRelativePvsContribution += contribution; 
    5913                           } 
     5914                   
     5915                  if (originObj &&  
     5916                          viewcell->GetPvs().GetSampleContribution(originObj, 
     5917                                                                                                          ray.mPdf, 
     5918                                                                                                          contribution)) 
     5919                        { 
     5920                          ++ ray.mPvsContribution; 
     5921                          ray.mRelativePvsContribution += contribution; 
     5922                        } 
    59145923#endif 
    59155924                } 
    59165925        } 
    5917  
     5926         
    59185927        if (!addRays) 
    59195928        { 
Note: See TracChangeset for help on using the changeset viewer.