Ignore:
Timestamp:
11/03/05 16:43:51 (19 years ago)
Author:
bittner
Message:
 
File:
1 edited

Legend:

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

    r372 r374  
    2828VssPreprocessor::SetupRay(Ray &ray,  
    2929                                                                                                        const Vector3 &point,  
    30                                                                                                         const Vector3 &direction, 
    31                                                                                                         const int type) 
     30                                                                                                        const Vector3 &direction 
     31                                                                                                        ) 
    3232{ 
    3333  ray.intersections.clear(); 
    34   ray.kdLeaves.clear(); 
    35   ray.meshes.clear(); 
    36  
     34        // do not store anything else then intersections at the ray 
     35        ray.kdLeaves.clear(); 
     36        ray.mFlags = Ray::STORE_KDLEAVES; 
     37         
    3738  //  cout<<point<<" "<<direction<<endl; 
    38   ray.Init(point, direction, type); 
     39  ray.Init(point, direction, Ray::LOCAL_RAY); 
    3940} 
    4041 
     
    5152int 
    5253VssPreprocessor::AddNodeSamples(const Ray &ray, 
    53                                                                                                                                                  Intersectable *sObject, 
    54                                                                                                                                                  Intersectable *tObject 
    55                                                                                                                                                  ) 
     54                                                                                                                                Intersectable *sObject, 
     55                                                                                                                                Intersectable *tObject 
     56                                                                                                                                ) 
    5657{ 
    5758  int contributingSamples = 0; 
     
    6263        if (tObject) 
    6364                objects++; 
    64  
     65         
    6566        if (objects) { 
    6667                for (j=0; j < ray.kdLeaves.size(); j++) { 
     
    123124        KdNode *nodeToSample = NULL; 
    124125         
    125         bool samplePvsBoundary = false; 
    126         if (pvsSize && samplePvsBoundary) { 
    127                 // this samples the nodes from the boundary of the current PVS 
    128                 // mail all nodes from the pvs 
    129                 Intersectable::NewMail(); 
    130                 KdPvsMap::iterator i = object->mKdPvs.mEntries.begin(); 
    131                  
    132                 for (; i != object->mKdPvs.mEntries.end(); i++) { 
    133                         KdNode *node = (*i).first; 
    134                         node->Mail(); 
    135                 } 
    136                  
    137                 int maxTries = 2*pvsSize; 
    138                 Debug << "Finding random neighbour" << endl;     
    139                 for (int tries = 0; tries < 10; tries++) { 
    140                         int index = RandomValue(0, pvsSize - 1); 
    141                         KdPvsData data; 
    142                         KdNode *node; 
    143                         object->mKdPvs.GetData(index, node, data); 
    144                         nodeToSample = mKdTree->FindRandomNeighbor(node, true); 
    145                         if (nodeToSample) 
    146                                 break; 
    147                 } 
    148         } else { 
    149                 // just pickup a random node 
    150                 //              nodeToSample = mKdTree->GetRandomLeaf(Plane3(normal, point)); 
    151                 nodeToSample = mKdTree->GetRandomLeaf(); 
    152         } 
     126        // just pickup a random node 
     127        nodeToSample = mKdTree->GetRandomLeaf(); 
    153128        return nodeToSample; 
    154129} 
     
    229204                                         
    230205                                        // construct a ray 
    231                                         SetupRay(ray, point, direction, Ray::LOCAL_RAY); 
     206                                        SetupRay(ray, point, direction); 
    232207                                         
    233208                                        sampleContributions = CastRay(reverseSample ? NULL : object, ray); 
     
    298273        } 
    299274         
    300         if (ViewCell::sHierarchy == ViewCell::KD)        
    301                 cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    302    
    303          
    304   //  HoleSamplingPass(); 
     275        cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
     276   
     277         
    305278        if (0) { 
    306279                Exporter *exporter = Exporter::GetExporter("ray-density.x3d");  
Note: See TracChangeset for help on using the changeset viewer.