Ignore:
Timestamp:
12/14/05 19:38:39 (19 years ago)
Author:
bittner
Message:

changed the viewcellsmanager interface to use vssrays - some functionality like the bsp merging is now restricted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp

    r464 r466  
    525525 
    526526  // viewcells->UpdatePVS(newVssRays); 
    527   // get viewcells as kd tree boxes 
    528   vector<AxisAlignedBox3> kdViewcells; 
    529  
    530   if (0) { 
    531         vector<KdLeaf *> leaves; 
    532         mKdTree->CollectLeaves(leaves); 
    533         vector<KdLeaf *>::const_iterator it; 
    534         int targetLeaves = 50; 
    535         float prob = targetLeaves/(float)leaves.size(); 
    536         for (it = leaves.begin(); it != leaves.end(); ++it) 
    537           if (RandomValue(0.0f,1.0f) < prob) 
    538                 kdViewcells.push_back(mKdTree->GetBox(*it)); 
    539                  
    540         float avgPvs = GetAvgPvsSize(rssTree, kdViewcells); 
    541         cout<<"Initial average PVS size = "<<avgPvs<<endl; 
    542   } 
    543  
    544          
     527   
    545528  int samples = 0; 
    546529  int pass = 0; 
     
    563546        for (int i=0; i < rays.size(); i++) 
    564547          CastRay(rays[i].mOrigin, rays[i].mDirection, vssRays); 
    565                  
     548         
     549        if (mUseViewcells) { 
     550           
     551           
     552          /// compute view cell contribution of rays 
     553          mViewCellsManager->ComputeSampleContributions(vssRays 
     554                                                                                                        ); 
     555           
     556           
     557          float pvs = rssTree->GetAvgPvsSize(); 
     558          cout<<"*****************************\n"; 
     559          cout<<samples<<" avgPVS ="<<pvs<<endl; 
     560          cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl; 
     561          cout<<"*****************************\n"; 
     562        } 
     563 
     564 
     565 
    566566        rssTree->AddRays(vssRays); 
    567                  
     567         
    568568        if (mUpdateSubdivision) { 
    569569          int subdivided = rssTree->UpdateSubdivision(); 
    570570          cout<<"subdivided leafs = "<<subdivided<<endl; 
    571571          cout<<"#total leaves = "<<rssTree->stat.Leaves()<<endl; 
    572  
    573572        } 
    574573 
    575574        if (mUseViewcells) { 
    576           float avgPvs = GetAvgPvsSize(rssTree, kdViewcells); 
    577           cout<<"Average PVS size = "<<avgPvs<<endl; 
     575          //      float avgPvs = GetAvgPvsSize(rssTree, kdViewcells); 
     576          //      cout<<"Average PVS size = "<<avgPvs<<endl; 
    578577        } 
    579578 
     
    590589        samples+=num; 
    591590 
    592         if (mUseViewcells) { 
    593            
    594           //-- prepare traversal rays for view cell intersections 
    595           RayContainer passRays; 
    596            
    597           VssRayContainer::const_iterator it, it_end = vssRays.end(); 
    598            
    599           for (it = vssRays.begin(); it != it_end; ++ it) 
    600                 passRays.push_back(new Ray(*(*it))); 
    601            
    602           int sampleContributions = 0; 
    603           int contributingSamples = 0; 
    604            
    605           /// compute view cell contribution of rays 
    606           mViewCellsManager->ComputeSampleContributions(passRays, 
    607                                                                                                         sampleContributions,  
    608                                                                                                         contributingSamples); 
    609            
    610           //-- save rays for post processing 
    611           if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) || 
    612                   ((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples())) 
    613                 { 
    614                   RayContainer::const_iterator it, it_end = passRays.end(); 
    615                    
    616                   for (it = passRays.begin(); it != it_end; ++ it) 
    617                         storedRays.push_back(new Ray(*(*it))); 
    618                 } 
    619           else 
    620                 { 
    621                   CLEAR_CONTAINER(passRays); 
    622                 } 
    623            
    624           float pvs = rssTree->GetAvgPvsSize(); 
    625           cout<<"*****************************\n"; 
    626           cout<<samples<<" avgPVS ="<<pvs<<endl; 
    627           cout<<"sample contributions ="<<sampleContributions<<endl; 
    628           cout<<"contributing sample ="<<contributingSamples<<endl; 
    629           cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl; 
    630           cout<<"*****************************\n"; 
    631         } 
    632591         
    633592        if (mExportPvs) { 
     
    645604   
    646605  if (mUseViewcells) { 
     606 
     607        VssRayContainer storedRays; 
     608        rssTree->CollectRays(storedRays, Max( 
     609                                                                                 mViewCellsManager->GetPostProcessSamples(), 
     610                                                                                 mViewCellsManager->GetVisualizationSamples())); 
    647611         
    648612        //-- post process view cells 
     
    651615        //-- several visualizations and statistics 
    652616        mViewCellsManager->PrintStatistics(Debug); 
    653          
    654         //-- render simulation after merge 
    655         cout << "\nevaluating render time of final view cells ... "; 
    656          
    657         const SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 
    658          
    659         cout << " finished" << endl; 
    660          
    661         cout << ss << endl; 
    662         Debug << ss << endl; 
    663          
     617 
    664618        mViewCellsManager->Visualize(mObjects, storedRays); 
    665   } 
    666    
     619 
     620        CLEAR_CONTAINER(storedRays); 
     621 
     622  //-- render simulation after merge 
     623  cout << "\nevaluating bsp view cells render time after merge ... "; 
     624   
     625  const SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 
     626   
     627  cout << " finished" << endl; 
     628  cout << ss << endl; 
     629  Debug << ss << endl; 
     630 
     631  } 
     632 
    667633  delete rssTree; 
    668634   
Note: See TracChangeset for help on using the changeset viewer.