Ignore:
Timestamp:
11/03/05 18:49:59 (19 years ago)
Author:
mattausch
Message:

added bsp view cells statistics

File:
1 edited

Legend:

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

    r374 r375  
    514514                                 << "k   #SampleContributions=" << passSampleContributions << " ("  
    515515                                 << 100*passContributingSamples/(float)passSamples<<"%)" << " avgPVS=" 
    516                                  << pvsSize/(float)objects.size() << endl  
     516                                 << pvsSize /(float)objects.size() << endl  
    517517                                 << "avg ray contrib=" << avgRayContrib << endl 
    518518                                 << "reverse samples [%]" << reverseSamples/(float)passSamples*100.0f << endl; 
     
    531531                cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 
    532532   
     533        //-- post processing of bsp view cells 
    533534        if (mBspTree) 
    534535        { 
     536                int vcSize = 0; 
     537                int pvsSize = 0; 
     538 
     539                BspViewCellsStatistics stat; 
     540                 
     541                Debug << "overall scene size: " << objects.size() << endl; 
     542                mBspTree->EvaluateViewCellsStats(stat); 
     543                 
     544                Debug << "original view cell partition:\n" << stat << endl; 
     545                 
    535546                cout << "starting post processing using " << mSampleRays.size() << " samples ... "; 
    536  
    537                 Debug << "original pvs size: " << mBspTree->CountViewCellPvs() << endl; 
    538  
    539                 // merge or subdivide view cells 
     547                 
    540548                long startTime = GetTime(); 
    541549                int merged = PostprocessViewCells(mSampleRays); 
     
    545553                         << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 
    546554 
     555                cout << "evaluating render time heuristics ... "; 
     556 
    547557                //-- recount pvs 
    548                 Debug << "merged pvs size: " << mBspTree->CountViewCellPvs() << endl; 
    549  
    550  
    551                 cout << "evaluating render time heuristics ... "; 
     558                mBspTree->EvaluateViewCellsStats(stat); 
     559                 
     560                Debug << "after post processing:\n" << stat << endl; 
     561 
    552562                Real rt = SimulateRendering(); 
    553563                cout << "finished" << endl; 
     
    591601 
    592602                // export the bsp splits 
     603                cout << "exporting splits ... "; 
    593604                if (exportSplits) 
    594605                        ExportSplits(objects); 
    595                  
     606                cout << "finished" << endl; 
     607 
    596608                ExportBspPvs(objects); 
    597609        } 
     
    686698{ 
    687699        int merged = 0; 
     700 
    688701        RayContainer::const_iterator rit, rit_end = rays.end(); 
    689702        vector<Ray::BspIntersection>::const_iterator iit; 
     
    708721                        {                        
    709722                                mBspTree->MergeViewCells(leaf, previousLeaf); 
     723 
    710724                                ++ merged; 
    711725                        } 
     
    723737        if (exporter)  
    724738        {        
    725                 cout << "exporting splits ... "; 
    726  
    727739                Material m;  
    728740                m.mDiffuseColor = RgbColor(1, 0, 0); 
     
    769781 
    770782                delete exporter; 
    771  
    772                 cout << "finished" << endl; 
    773783        } 
    774784} 
     
    787797        const int raysOut = min((int)mSampleRays.size(), 20000); 
    788798 
    789         // check whether we can add the current ray to the output rays 
    790         for (int k = 0; k < raysOut; ++ k)  
     799        ViewCell::NewMail(); 
     800 
     801        for (int i = 0; i < bspLeaves.size(); ++ i) 
    791802        { 
    792                 Ray *ray = mSampleRays[k]; 
    793  
    794                 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 
    795                 { 
    796                         BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 
    797  
    798                         for (int i = 0; i < (int)bspLeaves.size(); ++ i) 
     803                cout << "creating output for view cell " << i << " ... "; 
     804                // check whether we can add the current ray to the output rays 
     805                for (int k = 0; k < raysOut; ++ k)  
     806                { 
     807                        Ray *ray = mSampleRays[k]; 
     808 
     809                        for     (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 
    799810                        { 
     811                                BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 
     812 
    800813                                if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell())  
    801814                                { 
     
    804817                        } 
    805818                } 
    806         } 
    807  
    808         ViewCell::NewMail(); 
    809  
    810         for (int i = 0; i < bspLeaves.size(); ++ i) 
    811         { 
     819 
    812820                Intersectable::NewMail(); 
    813821 
     
    883891                } 
    884892                DEL_PTR(exporter); 
     893                cout << "finished" << endl; 
    885894        } 
    886895 
    887896        if (1) // export view cells and leaves 
    888897        { 
     898                cout << "exporting view cells and leaves ... "; 
    889899                Exporter *exporter = Exporter::GetExporter("viewCells.x3d"); 
    890900                if (exporter) 
     
    901911                        delete exporter; 
    902912                } 
     913                cout << "finished" << endl; 
    903914        } 
    904915 
Note: See TracChangeset for help on using the changeset viewer.