Ignore:
Timestamp:
01/23/08 01:38:11 (16 years ago)
Author:
mattausch
Message:

revived hash pvs

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
10 edited

Legend:

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

    r2622 r2633  
    17801780         
    17811781        KdNode::NewMail(); 
    1782         //Intersectable::NewMail(); 
    1783  
    1784          
     1782                 
    17851783        ObjectPvsIterator it = pvs.GetIterator(); 
    17861784 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2625 r2633  
    1717{ 
    1818   
    19 #define GVS_DEBUG 1 
     19#define GVS_DEBUG 0 
    2020 
    2121struct VizStruct 
     
    3737mCurrentViewCell(NULL), 
    3838mCurrentViewPoint(Vector3(0.0f, 0.0f, 0.0f)) 
     39//,mGenericStats(0) 
    3940{ 
    4041        Environment::GetSingleton()->GetIntValue("GvsPreprocessor.totalSamples", mTotalSamples); 
     
    219220                return false; 
    220221 
     222//      cout << "t"; 
    221223        if (0 && GVS_DEBUG) 
    222224                mVssRays.push_back(new VssRay(*vssRay)); 
     
    592594 
    593595        //CLEAR_CONTAINER(invalidSamples); 
    594         Debug << "generated " <<  numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     596        //Debug << "generated " <<  numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    595597        return (int)simpleRays.size(); 
    596598} 
     
    606608 
    607609                HandleRay(ray); 
    608  
    609                 //if (!HandleRay(ray)); 
    610                 //      invalidSamples.push_back(ray); 
     610                //if (!HandleRay(ray)) invalidSamples.push_back(ray); 
    611611        } 
    612612} 
     
    675675 
    676676 
    677 //void GvsPreprocessor::VisualizeViewCell(ViewCell *vc) 
    678677void GvsPreprocessor::VisualizeViewCell(const ObjectContainer &objects) 
    679678{ 
    680679    Intersectable::NewMail(); 
    681  
    682680        Material m; 
    683681         
     
    760758        int passSamples = 0; 
    761759 
    762         //if (mCurrentViewCell->GetId() != 82975 )return; 
     760        mGenericStats = 0; 
    763761 
    764762        //while (mGvsStats.mPerViewCellSamples < mTotalSamples)  
     
    789787                        cout << "\nPass " << mPass << " #samples: " << mGvsStats.mPerViewCellSamples << endl; 
    790788                        cout << "contribution=" << mGvsStats.mPassContribution << " (of " << mMinContribution << ")" << endl; 
     789 
     790                        //mGenericStats = GvsStats.mGvsStats.mPassContribution; 
    791791 
    792792                        // termination criterium 
     
    964964} 
    965965 
    966 /* 
    967 void GvsPreprocessor::ComputeRenderError() 
    968 { 
    969         cout << "computing gvs render error" << endl; 
    970         vector<ViewCellPoints *> *vcPoints = mViewCellsManager->GetViewCellPoints(); 
    971  
    972         vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end(); 
    973  
    974         for (vit = vcPoints->begin(); vit != vit_end; ++ vit) 
    975         { 
    976                 ViewCellPoints *vcPoints = *vit; 
    977                  
    978                 renderer->EvalPvsStat(vcPoints->second); 
    979  
    980                 mStats << 
    981                         "#ViewCell\n" << vcPoints->first->GetId() << endl << 
    982                         "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError() << endl << 
    983                         "#AvgPixelError\n" << renderer->GetAvgPixelError() << endl << 
    984                         "#MaxPixelError\n" << renderer->GetMaxPixelError() << endl << 
    985                         "#MaxPvsRenderError\n" << renderer->mPvsStat.GetMaxError() << endl << 
    986                         "#ErrorFreeFrames\n" << renderer->mPvsStat.GetErrorFreeFrames() << endl << 
    987                         "#AvgRenderPvs\n" << renderer->mPvsStat.GetAvgPvs() << endl; 
    988         } 
    989 } 
    990 */ 
    991966 
    992967void GvsPreprocessor::UpdatePvs(ViewCell *currentViewCell) 
     
    13001275        mGvsStats.mTotalTime += mGvsStats.mTimePerViewCell; 
    13011276 
    1302         //lastTime = currentTime; 
    1303  
    13041277        mGvsStats.Stop(); 
    13051278        mGvsStats.Print(mGvsStatsStream); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h

    r2530 r2633  
    150150 
    151151        inline int GetSamples() const   { return mSamples; } 
    152         } 
    153152 
    154153        void MergeInPlace(const HashPvs<T, S> &a) 
    155154        { 
    156                 cerr << "hashpvs: mergeinplace not implemented yet" << endl; 
     155                std::cerr << "hashpvs: mergeinplace not implemented yet" << std::endl; 
    157156        } 
    158157 
    159158        inline bool RequiresResortLog() const { return false; } 
    160159 
    161         void Reserve(const int n) { // not necessary } 
     160        void Reserve(const int n)  
     161        { // not necessary  
     162        } 
    162163 
    163164        /** Sort pvs entries assume that the pvs contains unique entries 
    164165        */ 
    165         void SimpleSort() {     // not necessary } 
     166        void SimpleSort()  
     167        {       // not necessary  
     168        } 
    166169 
    167170        int SubtractPvs(const HashPvs<T, S> &pvs) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2625 r2633  
    273273 
    274274 
     275        int mGenericStats; 
     276 
    275277protected: 
    276278 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2621 r2633  
    126126                                OptimizeForWindowsApplication="TRUE" 
    127127                                AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(CG_INC_PATH)&quot;;Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin;..\src\havran" 
    128                                 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PVS;USE_CG" 
     128                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_HASH_PVS;USE_CG" 
    129129                                StringPooling="TRUE" 
    130130                                MinimalRebuild="TRUE" 
     
    10741074                        </File> 
    10751075                        <File 
     1076                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
     1077                        </File> 
     1078                        <File 
    10761079                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    1077                         </File> 
    1078                         <File 
    1079                                 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    10801080                        </File> 
    10811081                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2627 r2633  
    304304        GlRenderer::InitGL(); 
    305305 
     306        GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 
     307    GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 
     308    GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 
     309    GLfloat light_position[] =  //{278.0f, 548.8f,279.0f, 1.0f }; 
     310    { 0.f,0.f,0.f,1.0f }; 
     311 
     312    /*glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 
     313    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 
     314    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 
     315    glLightfv(GL_LIGHT0, GL_POSITION, light_position); 
     316*/ 
     317    glEnable(GL_LIGHT0);  
     318 
    306319        GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 
    307320         
     
    311324        GLfloat mat_shininess[] = {1.0f}; 
    312325 
    313         GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 
     326/*      GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 
    314327        GLfloat light_diffuse[] = {0.4f, 0.4f, 0.4f, 1.0f}; 
    315328        GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
    316329 
    317330        GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
    318  
     331*/ 
    319332 
    320333        // default Material 
     
    329342        glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 
    330343 
    331         glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 
     344        /*glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 
    332345        glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 
    333346        glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 
    334  
    335         glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 
     347*/ 
     348        //glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 
    336349 
    337350        glEnable(GL_LIGHTING); 
    338351        glEnable(GL_LIGHT0); 
    339         glEnable(GL_LIGHT1); 
     352//      glEnable(GL_LIGHT1); 
    340353 
    341354        // set position of the light 
    342         GLfloat infinite_light[] = {  1.0, 0.8, 1.0, 0.0  }; 
     355        /*GLfloat infinite_light[] = {  1.0, 0.8, 1.0, 0.0  }; 
    343356        glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 
    344357 
     
    346359        GLfloat infinite_light2[] = {  -0.3, 1.5, 1.0, 0.0  }; 
    347360        glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 
     361*/ 
     362        glLightfv (GL_LIGHT0, GL_POSITION, light_position); 
    348363 
    349364        glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 
     
    351366        glEnable(GL_COLOR_MATERIAL); 
    352367 
    353         glShadeModel(GL_FLAT); 
     368        glShadeModel(GL_SMOOTH); 
    354369} 
    355370 
     
    392407void QtGlRendererWidget::_RenderPvs() 
    393408{ 
    394  
    395 #if TEST_PVS_RENDERING 
    396    
    397   ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 
    398  
    399   int pvsSize = mPvsCache.mPvs.GetSize(); 
    400  
    401   Intersectable::NewMail(); 
    402   mCurrentFrame++; 
    403   while (it.HasMoreEntries())  
    404         { 
    405           RenderIntersectable(it.Next()); 
    406         } 
    407  
    408    
    409   return; 
    410 #endif 
    411    
    412   mUseFalseColors = false; 
     409        mUseFalseColors = false; 
    413410 
    414411        int offset = (int)mObjects.size() * 3; 
     
    436433 
    437434 
    438 void QtGlRendererWidget::PreparePvs() 
     435void QtGlRendererWidget::PreparePvs2(const ObjectPvs &pvs) 
    439436{ 
    440437        int indexBufferSize = 0; 
     
    443440        //Intersectable::NewMail(); 
    444441 
    445         mPvsSize = mPvsCache.mPvs.GetSize(); 
     442        mPvsSize = pvs.GetSize(); 
     443 
    446444#if DYNAMIC_OBJECTS_HACK 
    447445        mDynamicObjects.clear(); 
    448446#endif 
    449         ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 
     447 
     448        ObjectPvsIterator it = pvs.GetIterator(); 
    450449 
    451450        while (it.HasMoreEntries())  
     
    492491 
    493492        EnableDrawArrays(); 
    494  
    495493        //Intersectable::NewMail(); 
    496494         
     
    505503        if (viewcell)  
    506504        { 
     505#if 1 
    507506                // copy the pvs so that it can be filtered ... 
    508507                if (PvsChanged(viewcell))  
     
    524523                                //mPvsCache.mPvs = pvs; 
    525524                                //mMutex.unlock(); 
    526                                 cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl; 
     525                                //cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl; 
    527526                        } 
    528527                        else 
     
    530529                                mPvsCache.mPvs = viewcell->GetPvs(); 
    531530                        } 
    532  
    533                         /// update the indices for rendering 
    534                         PreparePvs(); 
    535  
     531                         
     532                        // update the indices for rendering 
     533                        PreparePvs2(mPvsCache.mPvs); 
     534                         
    536535                        emit PvsUpdated(); 
    537536                } 
     537#else 
     538                PreparePvs2(viewcell->GetPvs()); 
     539                emit PvsUpdated(); 
     540#endif 
    538541 
    539542 
     
    898901                                                                           ) 
    899902                                                                           : 
    900 GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(parent, shareWidget, f) 
     903GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f) 
    901904{ 
    902905        mPreprocessorThread = NULL; 
     
    910913        mRenderFilter = true; 
    911914        mRenderVisibilityEstimates = false; 
     915        //mRenderVisibilityEstimates = true; 
    912916 
    913917        mUseRandomColorPerPvsObject = false; 
     
    918922        mTransferFunction = 1.0f; 
    919923        mIndexBufferSize = 0; 
    920  
    921         //mCurrentFrame = 0; 
    922924 
    923925        const int delay = 250; // in milliseconds 
     
    956958        mShowRays = false; 
    957959 
     960        SetSceneCut(0); 
    958961        mControlWidget = new QtRendererControlWidget(NULL); 
    959962 
     
    12421245        s.sprintf("PVS: %04d", mPvsSize); 
    12431246        renderText(20, 40, s, font40); 
     1247 
     1248/*      QFont font40; font40.setPointSize(30); 
     1249        s.sprintf("New triangles: %04d", 100); 
     1250        renderText(200, 40, s, font40);*/ 
    12441251} 
    12451252 
     
    13621369        float renderCost = 0; 
    13631370 
    1364 #ifndef USE_BIT_PVS 
     1371#ifdef USE_VERBOSE_PVS 
    13651372        if (mShowDistanceWeightedPvs) 
    13661373        { 
     
    14611468 
    14621469        ComputeMaxValues(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 
     1470         
    14631471        // matt: temp hack 
    1464         maxRcCost = 200.0f; 
     1472        //maxRcCost = 5000.0f; 
    14651473        //cout << "maxRcCost: " << maxRcCost << endl; 
     1474 
    14661475        int i; 
    14671476 
     
    19821991 
    19831992 
    1984  
    19851993        cb = new QCheckBox("Cut view cells", vbox); 
    19861994        vbox->layout()->addWidget(cb); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2621 r2633  
    538538        } 
    539539 
    540         void PreparePvs(); 
     540        void PreparePvs2(const ObjectPvs &pvs); 
    541541 
    542542        void _RenderPvs(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj

    r2576 r2633  
    165165                        <Tool 
    166166                                Name="VCCLCompilerTool" 
    167                                 AdditionalIncludeDirectories="..\..\src;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\include;&quot;$(CG_INC_PATH)&quot;" 
    168                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_VERBOSE_PVS;USE_QT;USE_CG;GTP_INTERNAL" 
     167                                AdditionalIncludeDirectories="..\..\src;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\include;&quot;$(CG_INC_PATH)&quot;;..\..\src\sparsehash\src;..\..\src\sparsehash\src\google;..\..\src\sparsehash\src\windows;..\..\src\sparsehash\src\google\sparsehash" 
     168                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_HASH_PVS;USE_QT;USE_CG;GTP_INTERNAL" 
    169169                                RuntimeLibrary="2" 
    170170                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r2598 r2633  
    145145                                OptimizeForWindowsApplication="TRUE" 
    146146                                AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface;..\src\sparsehash\src\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;$(NOINHERIT)" 
    147                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_VERBOSE_PVS;QT_OPENGL_LIB;QT_DLL" 
     147                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_HASH_PVS;QT_OPENGL_LIB;QT_DLL" 
    148148                                StringPooling="TRUE" 
    149149                                MinimalRebuild="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2627 r2633  
    24062406 
    24072407        const int numTriangles = kdObj->ComputeNumTriangles(); 
    2408 #ifndef USE_BIT_PVS 
     2408#ifdef USE_VERBOSE_PVS 
    24092409        vc->GetPvs().mStats.mDistanceWeightedTriangles += f * numTriangles;  
    24102410        vc->GetPvs().mStats.mDistanceWeightedPvs += f ; 
Note: See TracChangeset for help on using the changeset viewer.