Ignore:
Timestamp:
11/05/05 13:18:14 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r379 r380  
    557557                        if (exporter) 
    558558                        { 
    559                                 //exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
    560                                 exporter->ExportBspViewCellPartition(*mBspTree, 0); 
     559                                exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
     560                                //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    561561                                delete exporter; 
    562562                        } 
     
    592592                        if (exporter) 
    593593                        { 
    594                                 //exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
    595                                 exporter->ExportBspViewCellPartition(*mBspTree, 0); 
     594                                exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
     595                                //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    596596                                delete exporter; 
    597597                        } 
     
    686686} 
    687687 
    688 bool SamplingPreprocessor::ProcessBspViewCells(Ray &ray, 
     688void SamplingPreprocessor::ProcessBspViewCells(Ray &ray, 
    689689                                                                                           Intersectable *object, 
    690690                                                                                           int faceIndex, 
     
    693693{ 
    694694        // save rays for bsp tree construction 
    695         if ((BspTree::sConstructionMethod == BspTree::FROM_RAYS) && 
    696                 (mSampleRays.size() < mBspConstructionSamples)) 
     695        if (!mBspTree) 
    697696        { 
    698                 // also add origin to sample in order to extract it as input polygons 
    699                 MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 
    700                 ray.sourceObject = Ray::Intersection(0.0, mi, faceIndex); 
     697                if ((BspTree::sConstructionMethod == BspTree::FROM_RAYS) && 
     698                        ((int)mSampleRays.size() < mBspConstructionSamples)) 
     699                { 
     700                        // also add origin to sample in order to extract it as input polygons 
     701                        MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 
     702                        ray.sourceObject = Ray::Intersection(0.0, mi, faceIndex); 
    701703                                                         
    702         mSampleRays.push_back(new Ray(ray)); 
    703                  
    704                 return false; 
    705         } 
    706          
    707         if (!mBspTree) // construct BSP tree using the samples 
     704                        mSampleRays.push_back(new Ray(ray)); 
     705                        Debug << "abba " << mSampleRays.size() << endl; 
     706                } 
     707                else 
     708                { 
     709                        // construct BSP tree using the samples 
     710                        cout << "building bsp tree from " << mSampleRays.size() << " samples " << endl; 
     711                        BuildBspTree(); 
     712                 
     713                        // add contributions of saved samples to PVS 
     714                        contributingSamples += mBspTree->GetStat().contributingSamples; 
     715                        sampleContributions += mBspTree->GetStat().sampleContributions; 
     716 
     717                        BspTreeStatistics(Debug);        
     718 
     719                        if (0) Export("vc_bsptree.x3d", false, false, true); 
     720 
     721                        // throw away samples because BSP leaves not stored in order  
     722                        // Need ordered rays for post processing => collect new rays 
     723                        CLEAR_CONTAINER(mSampleRays); 
     724                } 
     725        } 
     726        // save rays for post processing 
     727        else if ((int)mSampleRays.size() < mPostProcessSamples) 
    708728        { 
    709         cout << "building bsp tree from " << mSampleRays.size() << " samples " << endl; 
    710                 BuildBspTree(); 
    711                  
    712                 // add contributions of saved samples to PVS 
    713                 contributingSamples += mBspTree->GetStat().contributingSamples; 
    714                 sampleContributions += mBspTree->GetStat().sampleContributions; 
    715  
    716                 BspTreeStatistics(Debug);        
    717  
    718                 if (0) Export("vc_bsptree.x3d", false, false, true); 
    719  
    720                 // throw away samples because BSP leaves not stored in order  
    721                 // Need ordered rays for post processing => collect new rays 
    722                 CLEAR_CONTAINER(mSampleRays); 
    723         } 
    724          
    725         if ((int)mSampleRays.size() < mPostProcessSamples) 
    726         { 
     729                Debug << "police " << mSampleRays.size() << endl; 
    727730                mSampleRays.push_back(new Ray(ray)); 
    728731        } 
    729  
    730         return true; 
    731732} 
    732733 
Note: See TracChangeset for help on using the changeset viewer.