Ignore:
Timestamp:
10/29/06 15:20:18 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1694 r1695  
    3838// HACK 
    3939const static bool SAMPLE_AFTER_SUBDIVISION = true; 
    40 const static bool CLAMP_TO_BOX = false; 
     40const static bool CLAMP_TO_BOX = true; 
    4141 
    4242template <typename T> class myless 
     
    7272 
    7373        mViewCellsTree->SetViewCellsManager(this); 
    74         //mViewCellsTree = new ViewCellsTree(this); 
    7574} 
    7675 
     
    112111         
    113112        // sampling type for view cells construction samples 
    114         if (strcmp(buf, "box") == 0) 
     113        if (strcmp(buf, "object") == 0) 
     114        { 
     115                mSamplingType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 
     116        } 
     117        else if (strcmp(buf, "box") == 0) 
    115118        { 
    116119                mSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
     
    123126        { 
    124127                mSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     128        } 
     129        else if (strcmp(buf, "reverse_object") == 0) 
     130        { 
     131                mSamplingType = SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION; 
    125132        } 
    126133        /*else if (strcmp(buf, "interior") == 0) 
     
    137144        Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.samplingType", buf); 
    138145         
    139         if (strcmp(buf, "box") == 0) 
     146        if (strcmp(buf, "object") == 0) 
     147        { 
     148                mEvaluationSamplingType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 
     149        } 
     150        else if (strcmp(buf, "box") == 0) 
    140151        { 
    141152                mEvaluationSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
     
    148159        { 
    149160                mEvaluationSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     161        } 
     162        else if (strcmp(buf, "reverse_object") == 0) 
     163        { 
     164                mEvaluationSamplingType = SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION; 
    150165        } 
    151166        /*else if (strcmp(buf, "interior") == 0) 
     
    155170        else 
    156171        { 
     172                mEvaluationSamplingType = -1; 
    157173                Debug << "error! wrong sampling type" << endl; 
    158174                exit(0); 
     
    868884        int castSamples = 0; 
    869885        char str[64];  
     886        int oldSamples = 0; 
     887 
     888        int samplesForStats; 
    870889 
    871890        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 
     891        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesForStats", samplesForStats); 
    872892        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samples", numSamples); 
    873893 
     
    924944 
    925945                Real timeDiff = TimeDiff(startTime, GetTime()); 
    926                 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
    927                 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
    928  
     946                 
     947                cout << "finished in " << timeDiff * 1e-3f << " secs" << endl; 
    929948                cout << "computing sample contributions of " << (int)evaluationSamples.size()  << " samples ... "; 
     949                 
     950                Debug << "finished in " << timeDiff * 1e-3f << " secs" << endl; 
    930951                Debug << "computing sample contributions of " << (int)evaluationSamples.size()  << " samples ... "; 
    931952 
     
    938959                Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
    939960 
    940                 startTime = GetTime(); 
    941                 cout << "compute new statistics ... " << endl; 
    942  
    943                 /////////// 
    944                 //-- output stats 
    945  
    946                 sprintf(str, "-%09d-eval.log", castSamples); 
    947                 string fileName = string(statsPrefix) + string(str); 
    948  
    949                 /////////////// 
    950                 //-- propagate pvs or pvs size information 
    951  
    952                 ObjectPvs pvs; 
    953                 UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 
    954  
    955                 ExportStats(fileName); 
    956  
    957                 timeDiff = TimeDiff(startTime, GetTime()); 
    958                 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
    959                 Debug << "statistis compted in " << timeDiff * 1e-3 << " secs" << endl; 
    960          
     961                if ((castSamples >= samplesForStats + oldSamples) || (castSamples >= numSamples)) 
     962                { 
     963                        oldSamples += samplesForStats; 
     964 
     965                        /////////// 
     966                        //-- output stats 
     967 
     968                        sprintf(str, "-%09d-eval.log", castSamples); 
     969                        string fileName = string(statsPrefix) + string(str); 
     970 
     971                        /////////////// 
     972                        //-- propagate pvs or pvs size information 
     973 
     974                        startTime = GetTime(); 
     975                        ObjectPvs pvs; 
     976 
     977                        cout << "updating pvs for contribution ... " << endl; 
     978 
     979                        UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 
     980 
     981                        timeDiff = TimeDiff(startTime, GetTime()); 
     982                        cout << "finished updating the pvs in " << timeDiff * 1e-3 << " secs" << endl; 
     983                        Debug << "pvs evaluated in " << timeDiff * 1e-3 << " secs" << endl; 
     984                 
     985                        startTime = GetTime(); 
     986                        cout << "compute new statistics ... " << endl; 
     987 
     988                        ExportStats(fileName); 
     989 
     990                        timeDiff = TimeDiff(startTime, GetTime()); 
     991                        cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
     992                        Debug << "statistis computed in " << timeDiff * 1e-3 << " secs" << endl; 
     993                } 
     994 
    961995                disposeRays(evaluationSamples, NULL); 
    962996        } 
     
    9661000        //-- histogram 
    9671001 
     1002        const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 
    9681003        bool useHisto; 
    9691004        int histoStepSize; 
     
    9711006        Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 
    9721007        Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize); 
    973  
    974         const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 
    975  
    9761008 
    9771009        if (useHisto) 
     
    25292561        // reset recursive pvs 
    25302562        pvs.Clear(); 
     2563 
     2564        // pvss of child nodes 
    25312565        vector<ObjectPvs> pvsList; 
    25322566 
    25332567        ViewCellContainer::const_iterator vit, vit_end = interior->mChildren.end(); 
    2534  
    2535         for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit) 
    2536         { 
    2537                 ObjectPvs objPvs; 
     2568        pvsList.resize((int)interior->mChildren.size()); 
     2569        int i = 0; 
     2570        for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit, ++ i) 
     2571        { 
     2572                //ObjectPvs objPvs; 
    25382573                 
    25392574                ////////////////// 
    25402575                //-- recursivly compute child pvss 
    25412576 
    2542                 UpdatePvsForEvaluation(*vit, objPvs); 
     2577                UpdatePvsForEvaluation(*vit, pvsList[i]/*objPvs*/); 
    25432578 
    25442579                // store pvs in vector 
    2545                 pvsList.push_back(objPvs); 
     2580                //pvsList.push_back(objPvs); 
    25462581        } 
    25472582 
Note: See TracChangeset for help on using the changeset viewer.