Changeset 1716 for GTP/trunk/Lib/Vis


Ignore:
Timestamp:
11/06/06 23:33:16 (18 years ago)
Author:
bittner
Message:

new visibility filter support

File:
1 edited

Legend:

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

    r1715 r1716  
    24512451                                                                         ) 
    24522452{ 
    2453         // now compute a new Pvs by including also objects intersecting the  
    2454         // extended boxes of visible objects 
    2455         Intersectable::NewMail(); 
    2456  
    2457         ObjectPvsMap::const_iterator oi; 
    2458  
     2453  // now compute a new Pvs by including also objects intersecting the  
     2454  // extended boxes of visible objects 
     2455  Intersectable::NewMail(); 
     2456   
     2457  ObjectPvsMap::const_iterator oi; 
     2458   
    24592459  for (oi = pvs.mEntries.begin(); oi != pvs.mEntries.end(); ++ oi)  
    2460   { 
     2460        { 
    24612461          Intersectable *object = (*oi).first; 
    24622462      object->Mail(); 
    2463   } 
     2463        } 
    24642464 
    24652465  ObjectPvs nPvs; 
     
    24752475        AxisAlignedBox3 box = object->GetBox(); 
    24762476        box.Enlarge(Vector3(spatialFilterSize/2)); 
    2477  
     2477         
    24782478        ObjectContainer objects; 
    2479  
     2479         
    24802480        // $$ warning collect objects takes only unmailed ones! 
    24812481        kdTree->CollectObjects(box, objects); 
     
    25022502                                                           ) 
    25032503{ 
    2504   // first determine the average 
    2505  
    2506  
    2507  
    2508 } 
     2504  Vector3 center = viewCell->GetBox().Center(); 
     2505  // first determine the average size of the filter 
     2506 
     2507 
     2508 
     2509  Intersectable::NewMail(); 
     2510  ObjectPvsMap::const_iterator oi; 
     2511  // first mark all object from this pvs 
     2512  for (oi = pvs.mEntries.begin(); oi != pvs.mEntries.end(); ++ oi) { 
     2513        Intersectable *object = (*oi).first; 
     2514        object->Mail(); 
     2515  } 
     2516 
     2517  ObjectPvs nPvs; 
     2518  int pvsSize = 0; 
     2519  int nPvsSize = 0; 
     2520  int samples = pvs.mSamples; 
     2521 
     2522   
     2523  for (oi = pvs.mEntries.begin(); oi != pvs.mEntries.end(); ++oi, pvsSize++) { 
     2524        Intersectable *object = (*oi).first; 
     2525        // compute filter size based on the distance and the numebr of samples 
     2526        float distance = Distance(center, object->GetBox().Center()); 
     2527 
     2528        // now compute the filter size 
     2529        float radius = distance*(filterSize/(4*samples)); 
     2530        AxisAlignedBox3 box = object->GetBox(); 
     2531        box.Enlarge(Vector3(radius)); 
     2532 
     2533        ObjectContainer objects; 
     2534        // $$ warning collect objects takes only unmailed ones! 
     2535        // should use VspOsp!! 
     2536        kdTree->CollectObjects(box, objects); 
     2537        //      cout<<"collected objects="<<objects.size()<<endl; 
     2538        ObjectContainer::const_iterator noi = objects.begin(); 
     2539        for (; noi != objects.end(); ++ noi) { 
     2540          Intersectable *o = *noi; 
     2541          // $$ JB warning: pdfs are not correct at this point!    
     2542          nPvs.AddSample(o, Limits::Small); 
     2543          nPvsSize ++; 
     2544        } 
     2545  } 
     2546  //  cout<<"nPvs size = "<<nPvsSize<<endl; 
     2547  pvs.Merge(nPvs); 
     2548} 
     2549   
     2550   
     2551 
    25092552   
    25102553 
Note: See TracChangeset for help on using the changeset viewer.