Ignore:
Timestamp:
11/20/06 09:15:28 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1765 r1768  
    309309 
    310310int ViewCellsManager::CastPassSamples(const int samplesPerPass,  
    311                                                                           const int sampleType,  
    312                                                                           VssRayContainer &passSamples) const 
     311                                                                          const vector<int> &strategies, 
     312                                                                          VssRayContainer &passSamples 
     313                                                                          ) const 
    313314{ 
    314315        SimpleRayContainer simpleRays; 
     
    318319        int castRays = 0; 
    319320         
    320         vector<int> strategies; 
    321           
    322         strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
    323         strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
    324         strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    325  
    326321        const int numRaysPerPass = samplesPerPass / (int)strategies.size(); 
    327322 
     
    397392        cout << "view cell construction: casting " << mInitialSamples << " initial samples ... " << endl; 
    398393 
     394        // mix of sampling strategies 
     395        vector<int> strategies; 
     396        strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
     397        strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     398        strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
     399 
    399400        // cast initial samples 
    400         CastPassSamples(mInitialSamples, mSamplingType, initialSamples); 
     401        CastPassSamples(mInitialSamples, strategies, initialSamples); 
    401402 
    402403        cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     
    460461        startTime = GetTime(); 
    461462        const int n = mConstructionSamples; //+initialSamples; 
    462         // should we use directional samples? 
    463         bool dirSamples = (mSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
    464463 
    465464        while (numSamples < n) 
     
    470469                VssRayContainer constructionSamples; 
    471470 
    472                 const int samplingType = mSamplingType; 
    473                         //dirSamples ? Preprocessor::DIRECTION_BASED_DISTRIBUTION :     Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 
    474  
    475                 if (0) dirSamples = !dirSamples; // toggle sampling method 
    476  
    477471                // cast new samples 
    478472                numSamples += CastPassSamples(mSamplesPerPass,  
    479                                                                           samplingType, 
     473                                                                          strategies, 
    480474                                                                          constructionSamples); 
    481475 
     
    519513        cout << "casting " << mPostProcessSamples << " post processing samples ... "; 
    520514         
    521         CastPassSamples(mPostProcessSamples, mSamplingType, postProcessSamples); 
     515        CastPassSamples(mPostProcessSamples, strategies, postProcessSamples); 
    522516 
    523517        cout << "finished" << endl; 
     
    566560                VssRayContainer visSamples; 
    567561                int numSamples = CastPassSamples(mVisualizationSamples, 
    568                                                                                  mSamplingType,  
     562                                                                                 strategies,  
    569563                                                                                 visSamples); 
    570564 
     
    948942        Debug << "view cell stats prefix: " << statsPrefix << endl; 
    949943 
    950         // should directional sampling be used? 
    951         bool dirSamples =  
    952                 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
    953  
    954944        cout << "reseting pvs ... "; 
    955945                 
     
    972962        } 
    973963 
     964        // mix of sampling strategies 
     965        vector<int> strategies; 
     966        strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
     967        strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     968        strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
     969 
    974970        cout << "finished" << endl; 
    975971    cout << "Evaluating view cell partition ... " << endl; 
     
    988984                Debug << "casting " << samplesPerPass << " samples ... "; 
    989985 
    990                 CastPassSamples(samplesPerPass, samplingType, evaluationSamples); 
     986                CastPassSamples(samplesPerPass, strategies, evaluationSamples); 
    991987                 
    992988                castSamples += samplesPerPass; 
     
    16321628        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
    16331629 
    1634         // volume and area of the view cells are recomputed and a view cell mesh is created 
     1630        // volume and area of the view cells are recomputed  
     1631        // a view cell mesh is created 
    16351632        for (it = mViewCells.begin(); it != it_end; ++ it) 
    16361633        { 
     
    41344131        {       //////// 
    41354132                //-- real meshes are contructed at this stage 
     4133 
    41364134                cout << "finalizing view cells ... "; 
    41374135                FinalizeViewCells(true); 
     
    43344332        Debug << "post processing using " << (int)postProcessRays.size() << " samples" << endl; 
    43354333 
    4336         // should maybe be done here to allow merge working  
    4337         // with area or volume and to correct the rendering statistics 
    4338         if (0) FinalizeViewCells(false); 
    4339                  
    43404334        ////////// 
    4341         //-- merge the individual view cells 
     4335        //-- merge neighbouring view cells 
    43424336        MergeViewCells(postProcessRays, objects); 
    43434337         
     
    43584352        //////////// 
    43594353        //-- compression 
    4360 //#if HAS_TO_BE_REDONE 
     4354 
    43614355        if (ViewCellsTreeConstructed() && mCompressViewCells) 
    43624356        { 
     
    43694363                Debug << "number of entries after compress: " << pvsEntries << endl; 
    43704364        } 
    4371 //#endif 
    43724365 
    43734366        // collapse sibling leaves that share the same view cell 
     
    59345927        int splitsStepSize; 
    59355928 
    5936  
    59375929        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 
    59385930        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesForStats", samplesForStats); 
     
    59465938        Debug << "view cell stats prefix: " << statsPrefix << endl; 
    59475939 
    5948         // should directional sampling be used? 
    5949         bool dirSamples =  
    5950                 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
     5940    // mix of sampling strategies 
     5941        vector<int> strategies; 
     5942        strategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
     5943        strategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     5944        strategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    59515945 
    59525946        cout << "reseting pvs ... "; 
     
    59715965                Debug << "casting " << samplesPerPass << " samples ... "; 
    59725966 
    5973                 CastPassSamples(samplesPerPass, samplingType, evaluationSamples); 
     5967                CastPassSamples(samplesPerPass, strategies, evaluationSamples); 
    59745968                 
    59755969                castSamples += samplesPerPass; 
Note: See TracChangeset for help on using the changeset viewer.