Changeset 2648


Ignore:
Timestamp:
03/18/08 19:28:00 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
6 edited

Legend:

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

    r2647 r2648  
    9090        mSceneGraph->CollectObjects(mObjects); 
    9191 
    92 #if 0 
     92#if 1 
    9393        viewCellsManager->GetViewPoint(mViewPoint); 
    9494        mViewDirection = Vector3(0,0,1); 
     
    16211621  for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i)  
    16221622        { 
    1623            
    1624           //cout << "view point: " << (*sit) << endl;; 
     1623          //cout << "\n\nvp: " << (*sit) << endl; 
    16251624          SimpleRay sray = *sit; 
    16261625           
     
    16421641                  mPvsErrorBuffer[i].mPvsSize = pvsSize; 
    16431642 
    1644                   cout << "(" << i << "," << mPvsErrorBuffer[i].mError <<")"; 
     1643                  cout << "(vc: " << i << ", er: " << mPvsErrorBuffer[i].mError <<")" << endl; 
    16451644          } 
    16461645 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2643 r2648  
    2020   
    2121#define GVS_DEBUG 0 
    22 static ObjectContainer myobjects; 
    2322 
    2423struct VizStruct 
     
    3231static const float MIN_DIST = 0.001f; 
    3332 
     33static ObjectContainer myobjects; 
    3434static vector<VizStruct> vizContainer; 
     35 
    3536 
    3637GvsPreprocessor::GvsPreprocessor():  
     
    7879        mGvsStats.Reset(); 
    7980 
     81        // hack: some generic statistical values that can be read 
     82        // by an application using the preprocessor 
    8083        mGenericStats = 0; 
    8184        mGenericStats2 = 0; 
     
    105108ViewCell *GvsPreprocessor::NextViewCell() 
    106109{ 
    107         //if (mViewCellsManager->GetNumViewCells() == mProcessedViewCells) 
    108         //      return false; // no more view cells 
    109  
    110110        if (mProcessedViewCells == (int)mViewCells.size()) 
    111111                return NULL; // no more view cells 
     
    440440 
    441441        const int numBorderSamples = (int)vssRays.size() - numRandomRays; 
     442 
     443#if 0 
    442444        // set flags 
    443         /*VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 
     445        VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 
    444446        for (rit = vssRays.begin(); rit != rit_end; ++ rit, ++ i) 
    445447                (*rit)->mFlags |= VssRay::BorderSample; 
    446                 */ 
     448#endif 
     449 
    447450        int castRays = (int)simpleRays.size(); 
    448451 
    449452        VssRayContainer invalidSamples; 
    450  
    451453 
    452454        // handle rays 
     
    783785        int oldContribution = mGvsStats.mTotalContribution; 
    784786        int passSamples = 0; 
     787 
    785788        mGenericStats = 0; 
    786789        mGenericStats2 = 0; 
     
    831834void GvsPreprocessor::CompileViewCellsList() 
    832835{ 
     836        // Receive list of view cells from view cells manager 
    833837        ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 
    834  
    835          
    836         int i = 0; 
    837  
     838         
    838839        if (!vcPoints->empty()) 
    839840        { 
     
    843844 
    844845                for (vit = vcPoints->begin(); vit != vit_end; ++ vit) 
    845                 {//cout << i ++ << " " << (*vit)->first->GetId() << endl; 
     846                { 
    846847                        mViewCells.push_back((*vit)->first); 
    847848                } 
     
    941942 
    942943 
    943  
    944944void GvsPreprocessor::PerViewCellComputation() 
    945945{ 
     
    954954                        (*oit)->mCounter = 0; 
    955955 
    956                 ComputeViewCell(vc); 
     956        ComputeViewCell(vc); 
    957957        } 
    958958} 
     
    11241124#endif 
    11251125 
    1126         mGvsStats.Stop(); 
    1127         mGvsStats.Print(mGvsStatsStream); 
    1128  
    11291126        if (mPerViewCell) 
    11301127        { 
    1131 #if 0 
     1128#if 1 
    11321129                // provide list of view cells to compute 
    11331130                CompileViewCellsList(); 
    1134  
    11351131                // start per view cell gvs 
    11361132                PerViewCellComputation(); 
    1137  
    1138                 if (mEvaluatePixelError) 
    1139                 { 
    1140                         ComputeRenderError(); 
    1141                 } 
    11421133#else 
    11431134                PerViewCellComputation2(); 
     
    11621153        { 
    11631154                ExportPreprocessedData(mVisibilityFileName); 
     1155        } 
     1156         
     1157        // compute the pixel error of this visibility solution 
     1158        if (mEvaluatePixelError) 
     1159        { 
     1160                ComputeRenderError(); 
    11641161        } 
    11651162 
     
    12111208{ 
    12121209        app << "#ViewCells\n" << mViewCells << endl; 
    1213         app << "#ViewCellId\n" << mViewCellId << endl; 
     1210        app << "#Id\n" << mViewCellId << endl; 
     1211        app << "#Time\n" << mTimePerViewCell << endl;; 
     1212        app << "#TrianglePvs\n" << mTrianglePvs << endl; 
     1213        app << "#ObjectPvs\n" << mPerViewCellPvs << endl; 
     1214        app << "#PvsCost\n" << (int)mPvsCost << endl; 
     1215 
     1216#if 0 
     1217        app << "#TotalPvs\n" << mTotalPvs << endl; 
    12141218        app << "#TotalTime\n" << mTotalTime << endl; 
    1215         app << "#TimePerViewCell\n" << mTimePerViewCell << endl;; 
    1216  
    12171219        app << "#RaysPerSec\n" << RaysPerSec() << endl; 
    1218  
    1219         app << "#TrianglePvs\n" << mTrianglePvs << endl; 
    1220         app << "#TotalTrianglePvs\n" << mTotalTrianglePvs << endl; 
    1221  
    1222         app << "#PerViewCellPvs\n" << mPerViewCellPvs << endl; 
    1223         app << "#TotalPvs\n" << mTotalPvs << endl; 
    12241220         
    12251221        app << "#PerViewCellSamples\n" << mPerViewCellSamples << endl; 
    12261222        app << "#TotalSamples\n" << mTotalSamples << endl; 
    12271223        app     << "#SamplesContri\n" << mTotalContribution << endl; 
    1228                  
     1224        app << "#TotalTrianglePvs\n" << mTotalTrianglePvs << endl; 
     1225         
     1226#endif 
     1227 
    12291228        //app << "#ReverseSamples\n" << mReverseSamples << endl; 
    12301229        //app << "#BorderSamples\n" << mBorderSamples << endl; 
     
    12771276        else 
    12781277        { 
    1279                 /*// add pvs 
    1280                 ObjectContainer::const_iterator it, it_end = mKdPvs.end(); 
    1281  
    1282                 for (it = mKdPvs.begin(); it != it_end; ++ it) 
    1283                         mCurrentViewCell->GetPvs().AddSampleDirty(*it, 1.0f); 
    1284                 */ 
    12851278                mGvsStats.mPerViewCellPvs = mCurrentViewCell->GetPvs().GetSize(); 
    1286  
    1287                 cout << "pvs cost: " << mCurrentViewCell->GetPvs().EvalPvsCost() << " pvs tri: " << mGenericStats2 << endl; 
     1279                mGvsStats.mPvsCost = mCurrentViewCell->GetPvs().EvalPvsCost(); 
     1280 
     1281                cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: "  
     1282                         << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 
    12881283        } 
    12891284 
     
    12931288 
    12941289        mGvsStats.mViewCells = mProcessedViewCells;//mPass; 
    1295  
    1296  
    12971290        mGvsStats.mTotalPvs += mGvsStats.mPerViewCellPvs; 
    12981291        mGvsStats.mTotalSamples += mGvsStats.mPerViewCellSamples; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2625 r2648  
    4343                mTimePerViewCell = 0; 
    4444                mTotalTrianglePvs = 0; 
     45                mPvsCost = 0; 
    4546        } 
    4647 
     
    6667        float mTimePerViewCell; 
    6768        float mTotalTime; 
     69         
     70        float mPvsCost; 
    6871 
    6972        ObjectContainer mKdPvs; 
     
    211214        void ClearRayQueue(); 
    212215 
     216        /** Create a list of view cells gvs is run on. 
     217        */ 
    213218        void CompileViewCellsList(); 
    214219 
     
    223228        void StorePvs(const ObjectContainer &objectPvs); 
    224229 
     230        /** Compute visibility for a given view cell. 
     231        */ 
    225232        void ComputeViewCell(ViewCell *vc); 
    226233        /** Runs gvs on the current view cell. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2647 r2648  
    15371537        //      mutex.unlock(); 
    15381538 
    1539         if (mViewCellsManager->GetViewCellPointsList()->size()) { 
     1539        if (!mViewCellsManager->GetViewCellPointsList()->empty()) { 
    15401540           
    15411541          ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 
     
    15511551 
    15521552                SimpleRayContainer::const_iterator rit = vp->second.begin(), rit_end = vp->second.end(); 
     1553 
    15531554                for (; rit!=rit_end; ++rit) 
    15541555                  viewPoints.push_back(*rit); 
     
    15601561          } 
    15611562 
     1563          cerr << "evaluating list of " << viewPoints.size() << " pts" << endl; 
    15621564          renderer->EvalPvsStat(viewPoints); 
    15631565        } else 
     1566        { 
    15641567          renderer->EvalPvsStat(); 
    1565          
     1568        } 
     1569 
    15661570        mStats << 
    15671571          "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2645 r2648  
    142142 
    143143        ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 
     144         
     145        //cout << "vp: " << mViewPoint << endl; 
     146 
    144147        if (viewcell == NULL) 
    145148                return 0.0f; 
     
    173176 
    174177        pvsSize = pvs.GetSize(); 
    175         cout<<pvsSize<<endl; 
     178        cout << "vc id: " << viewcell->GetId() << " pvs: " << pvsSize << endl; 
    176179         
    177180        RenderPvs(pvs); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RandomViewCellsHandler.cpp

    r2647 r2648  
    129129 
    130130bool RandomViewCellsHandler::ImportViewCellsList(const string &filename,  
    131                                                                                   vector<ViewCellPoints *> &viewCells) 
     131                                                                                                vector<ViewCellPoints *> &viewCells) 
    132132{ 
    133133        ifstream inStream(filename.c_str()); 
     
    136136 
    137137        ViewCellPoints *currentViewCell = NULL; 
     138        int i = 0; 
     139        int j = 0; 
    138140 
    139141        string buf; 
     
    149151                                currentViewCell = new ViewCellPoints(); 
    150152                                currentViewCell->first = mViewCellsManager->GetViewCellById(id); 
    151                                                  
    152                                 viewCells.push_back(currentViewCell); 
     153                                         
     154                                if (1)//i ++ < 5) 
     155                                { 
     156                                        viewCells.push_back(currentViewCell); 
     157                                        j = 0; 
     158                                } 
    153159                                break; 
    154160                        } 
     
    159165                                 
    160166                                SimpleRay ray(pt, dir, 0, 1); 
    161                                 currentViewCell->second.push_back(ray); 
     167 
     168                                if (1)//j ++ < 5) 
     169                                        currentViewCell->second.push_back(ray); 
     170 
    162171                                break; 
    163172                        } 
Note: See TracChangeset for help on using the changeset viewer.