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

revived hash pvs

Location:
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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" 
Note: See TracChangeset for help on using the changeset viewer.