Ignore:
Timestamp:
12/10/07 09:12:27 (17 years ago)
Author:
mattausch
Message:

added functionality for visualization

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

Legend:

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

    r2543 r2560  
    473473        { 
    474474                ViewCell *vc = *vit; 
    475  
    476                 int vcTri; 
    477                 int vcObj; 
    478475 
    479476                int oldVcTri = (int)vc->GetTrianglesInPvs(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/DifferenceSampling.cpp

    r2559 r2560  
    103103                // n samples per object 
    104104                const int n = 50; 
    105                 mNumSamples = mPvsDifference.size() * n; 
     105                mNumSamples = (int)mPvsDifference.size() * n; 
    106106        } 
    107107 
  • GTP/trunk/Lib/Vis/Preprocessing/src/DifferenceSampling.h

    r2548 r2560  
    1010 
    1111 
    12  
    1312/** This sampling strategy utilizes the spatial filter to find  
    1413        areas that are likely to be visible. 
    1514 
    16         First the filter is applied. The difference set of objects (filtered pvs - unfiltered pvs) gives you the objects  
    17         which are not found visible yet but have a good probability that they are in fact visible, based on the current  
    18         state of the sampling and the size of the filter. In fact the difference set is a probably visible set. 
    19      
    20         Idea: 
    21         We apply the filter for n times, each time with a higher filter radius. The difference set gives you the probable visible set.  
    22         Then we use a certain #random samples for sampling the view cell border + the object border.  
    23         We can use different filter sizes to estimate the probablility distribution. The objects shouldreceived samples  
     15        First the filter is applied. The difference set of objects  
     16        (filtered pvs - unfiltered pvs) gives you the objects which  
     17        are not found visible yet but have a good probability that they  
     18        are in fact visible, based on the current  
     19        state of the sampling and the size of the filter. In fact the  
     20        difference set is a probably visible set. 
     21 
     22        Algorithm overview: 
     23        We apply the filter for n times, each time with a higher filter radius.  
     24        The difference set gives you the probable visible set.  
     25        Then we use a certain #random samples for sampling the view cell border +  
     26        the object border. We can use different filter sizes to estimate the probability  
     27        distribution. The objects shouldreceived samples  
    2428        roughly according to their probability of becoming invisible. 
    2529*/       
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2552 r2560  
    7676mData(NULL), 
    7777mIndices(NULL), 
    78 mUseVbos(true), 
     78//mUseVbos(true), 
     79mUseVbos(false), 
    7980mCurrentFrame(-1) 
    8081{ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2546 r2560  
    126126                                OptimizeForWindowsApplication="TRUE" 
    127127                                AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";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" 
    128                                 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PV" 
     128                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PVS;USE_CG" 
    129129                                StringPooling="TRUE" 
    130130                                MinimalRebuild="TRUE" 
     
    10531053                        </File> 
    10541054                        <File 
     1055                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
     1056                        </File> 
     1057                        <File 
    10551058                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    1056                         </File> 
    1057                         <File 
    1058                                 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    10591059                        </File> 
    10601060                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2543 r2560  
    690690        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    691691 
    692         if (1) { 
     692        if (1)  
     693        { 
    693694                SetupCameraProjection(width(), height()); 
    694695                SetupCamera(); 
    695696 
    696                 if (mRenderErrors) { 
     697                if (mRenderErrors)  
     698                { 
    697699                        RenderErrors(); 
    698                 } else { 
     700                }  
     701                else  
     702                { 
    699703                        glColor3f(0.6f, 0.6f, 0.6f); 
    700704                        RenderPvs(); 
     
    845849        mShowRenderCost = false; 
    846850        mShowPvsSizes = false; 
     851        mShowPiercingRays = false; 
    847852        mSpatialFilterSize = 0.01; 
    848853        mPvsSize = 0; 
     
    883888        connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), 
    884889                this, SLOT(SetUseSpatialFilter(bool))); 
     890        connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool))); 
    885891 
    886892        connect(mControlWidget, 
     
    11461152        eq[3] = mSceneCutPlane.mD; 
    11471153 
    1148         if (mCutViewCells) { 
     1154        if (mCutViewCells)  
     1155        { 
    11491156                glClipPlane(GL_CLIP_PLANE0, eq); 
    11501157                glEnable(GL_CLIP_PLANE0); 
     
    11541161        ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 
    11551162        int maxPvs = -1; 
    1156         for (i=0; i < viewcells.size(); i++)  
     1163        int maxPiercingRays = 0; 
     1164 
     1165        for (i = 0; i < viewcells.size(); ++ i)  
    11571166        { 
    11581167                ViewCell *vc = viewcells[i]; 
     
    11621171                if (p > maxPvs) 
    11631172                        maxPvs = p; 
    1164         } 
    1165  
    1166  
    1167         for (i=0; i < viewcells.size(); i++) { 
     1173                const int piercingRays = vc->GetNumPiercingRays(); 
     1174                if (piercingRays > maxPiercingRays) 
     1175                        maxPiercingRays = piercingRays; 
     1176        } 
     1177 
     1178 
     1179        for (i = 0; i < viewcells.size(); ++ i)  
     1180        { 
    11681181                ViewCell *vc = viewcells[i]; 
    11691182                //      Mesh *m = vc->GetMesh(); 
     
    11711184                RgbColor c; 
    11721185 
    1173                 if (!mShowPvsSizes) { 
     1186                if (!mShowPvsSizes && !mShowPiercingRays) 
     1187                { 
    11741188                        mWireFrame = true; 
    11751189                        c = vc->GetColor(); 
    1176                 } else { 
    1177                         //        const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
    1178                         const float importance = 5.0f*mTransferFunction * 
     1190                }  
     1191                else if (mShowPiercingRays) 
     1192                { 
     1193                        // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
     1194                        const float importance = 5.0f * mTransferFunction * 
     1195                                ((float)vc->GetNumPiercingRays() / (float)maxPiercingRays); 
     1196                        // c = RgbColor(importance, 1.0f - importance, 0.0f); 
     1197                        c = RainbowColorMapping(importance); 
     1198                } 
     1199                else 
     1200                { 
     1201                        // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
     1202                        const float importance = 5.0f * mTransferFunction * 
    11791203                                ((float)vc->GetPvs().GetSize() / (float)maxPvs); 
    1180                         //        c = RgbColor(importance, 1.0f - importance, 0.0f); 
     1204                        // c = RgbColor(importance, 1.0f - importance, 0.0f); 
    11811205                        c = RainbowColorMapping(importance); 
    1182  
    11831206                } 
     1207 
    11841208                glColor3f(c.r, c.g, c.b); 
    11851209 
     
    11911215 
    11921216        glPopAttrib(); 
    1193  
    11941217} 
    11951218 
     
    13181341        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 
    13191342 
    1320         vbox->resize(800,100); 
     1343         
     1344        cb = new QCheckBox("Show piercing rays", hbox); 
     1345        hlayout->addWidget(cb); 
     1346        cb->setChecked(false); 
     1347        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool))); 
     1348 
     1349        vbox->resize(800,150); 
    13211350 
    13221351 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2543 r2560  
    112112  void SetShowRenderCost(bool); 
    113113  void SetShowPvsSizes(bool); 
     114  void SetShowPiercingRays(bool); 
    114115  void SetTopView(bool); 
    115116  void SetCutViewCells(bool); 
    116117  void SetCutScene(bool); 
    117  
    118118}; 
    119119 
     
    137137        bool mUseSpatialFilter; 
    138138        bool mShowRenderCost; 
     139        bool mShowPiercingRays; 
    139140        bool mShowRays; 
    140141 
     
    293294        void SetShowPvsSizes(bool b) { 
    294295                mShowPvsSizes = b; 
     296                updateGL(); 
     297        } 
     298 
     299        void SetShowPiercingRays(bool b) { 
     300                mShowPiercingRays = b; 
    295301                updateGL(); 
    296302        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2538 r2560  
    5252        if (mRenderer->mRenderViewCells)  
    5353          mRenderer->RenderViewCells(); 
    54  
     54         
    5555        glColor3f(0.8f, 0.8f, 0.8f); 
    5656        mRenderer->RenderPvs(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj

    r2530 r2560  
    166166                                Name="VCCLCompilerTool" 
    167167                                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" 
     168                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_VERBOSE_PVS;USE_QT;USE_CG;GTP_INTERNAL" 
    169169                                RuntimeLibrary="2" 
    170170                                UsePrecompiledHeader="0" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r2559 r2560  
    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_PV" 
     147                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_VERBOSE_PVS;QT_OPENGL_LIB;QT_DLL" 
    148148                                StringPooling="TRUE" 
    149149                                MinimalRebuild="TRUE" 
     
    160160                        <Tool 
    161161                                Name="VCLinkerTool" 
    162                                 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib cg.lib cgGL.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib" 
     162                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib cg.lib cgGL.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib QtOpenGL4.lib QtCore4.lib qtmain.lib" 
    163163                                OutputFile="../bin/release/Preprocessor.exe" 
    164164                                LinkIncremental="1" 
    165                                 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtInterface\Release;&quot;$(CG_LIB_PATH)&quot;" 
     165                                AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;.\QtInterface\Release;&quot;$(CG_LIB_PATH)&quot;" 
    166166                                GenerateDebugInformation="FALSE" 
    167167                                SubSystem="1" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r2544 r2560  
    129129mEntriesInPvs(0), 
    130130mPvsSizeValid(false), 
    131 mFilteredPvsSize(0) 
     131mFilteredPvsSize(0), 
     132mNumPiercingRays(0) 
    132133{ 
    133134        mId = -100; 
     
    144145mPvsCost(0), 
    145146mPvsSizeValid(false), 
    146 mFilteredPvsSize(0) 
     147mFilteredPvsSize(0), 
     148mNumPiercingRays(0) 
    147149{ 
    148150        mId = -100; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r2544 r2560  
    253253        float GetMergeCost() const; 
    254254 
    255         void UpdatePvsCost() { 
     255        void UpdatePvsCost()  
     256        { 
    256257                mPvsCost = GetPvs().EvalPvsCost(); 
    257258        } 
    258259 
    259         void SetTrianglesInPvs(const float c) { 
     260        void SetTrianglesInPvs(const float c)  
     261        { 
    260262                mPvsCost = c; 
    261263        } 
    262264 
    263         void SetEntriesInPvs(const int e) { 
     265        void SetEntriesInPvs(const int e)  
     266        { 
    264267                mEntriesInPvs = e; 
    265268        } 
    266269 
    267         float GetTrianglesInPvs() const { 
     270        float GetTrianglesInPvs() const  
     271        { 
    268272                return mPvsCost; 
    269273        } 
    270274 
    271         int GetEntriesInPvs() const { 
     275        int GetEntriesInPvs() const  
     276        { 
    272277                return mEntriesInPvs; 
    273278        } 
     
    278283        } 
    279284 
    280         void SetFilteredPvsSize(const int s) { 
     285        void SetFilteredPvsSize(const int s)  
     286        { 
    281287                mFilteredPvsSize = s; 
    282288        } 
    283289 
    284         //virtual int ViewCellType; 
     290        void IncNumPiercingRays() 
     291        { 
     292                ++ mNumPiercingRays; 
     293        } 
     294         
     295        void ResetNumPiercingRays() 
     296        { 
     297                mNumPiercingRays = 0; 
     298        } 
     299 
     300        int GetNumPiercingRays() 
     301        { 
     302                return mNumPiercingRays; 
     303        } 
     304 
    285305 
    286306protected: 
     
    311331        /// Filter cost of the pvs 
    312332        int mFilteredPvsSize; 
    313  
     333        /// number of rays piercing this view cell 
     334        int mNumPiercingRays; 
    314335}; 
     336 
    315337 
    316338inline bool SmallerPvs(const ViewCell *a, const ViewCell *b)  
     
    357379        bool IsLeaf() const; 
    358380 
    359         void SetCost(const float c) { 
     381        void SetCost(const float c)  
     382        { 
    360383                mCost = c; 
    361384        } 
    362385 
    363         float GetCost() const { 
     386        float GetCost() const  
     387        { 
    364388                return mCost; 
    365389        } 
     
    580604 
    581605 
    582         ////////////////////////////////////////////////////////////// 
    583         //                    merge related stuff                   // 
    584         ////////////////////////////////////////////////////////////// 
     606        //////////////////////////////////////////// 
     607        //-- merge related stuff                    
    585608 
    586609 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2548 r2560  
    28332833        // check if last ray was not same ray with reverse direction 
    28342834        if (1)  
    2835                 // tmp matt: don't use that before origin objects are accounted for, currently the second ray is lost!! 
     2835                // tmp matt: don't use when origin objects are not accounted for, currently the second ray is lost!! 
    28362836                //!lastVssRay || 
    28372837                //!(ray.mOrigin == lastVssRay->mTermination) || 
     
    28832883                                                                        ray.mTermination,  
    28842884                                                                        addRays); 
     2885                (*it)->IncNumPiercingRays(); 
    28852886        } 
    28862887 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2543 r2560  
    2121#include "GlobalLinesRenderer.h" 
    2222 
    23  
    2423#include "ViewCellsManager.h" 
    2524 
    26 #ifdef USE_QT   
     25//#ifdef USE_QT   
    2726        #include "QtPreprocessorThread.h" 
    2827        #include "QtGlViewer.h" 
    2928        #include "QtGlRenderer.h" 
    30 #else 
     29        #include <QGLWidget> 
     30 
     31//#else 
    3132        #if USE_THREADS 
    3233                #include "BoostPreprocessorThread.h" 
    3334        #endif 
    34 #endif 
     35//#endif 
    3536 
    3637#include "ResourceManager.h" 
     
    155156main(int argc, char **argv) 
    156157{ 
     158        int returnCode = 0; 
     159 
    157160        //Now just call this function at the start of your program and if you're 
    158161        //compiling in debug mode (F5), any leaks will be displayed in the Output 
     
    160163        //be ignored. Use it as you will! 
    161164        //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 
    162 #if 1 
    163   _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 
    164   _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 
    165   _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);  
    166 #endif 
    167  
    168         int returnCode = 0; 
     165        _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 
     166        _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 
     167        _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);  
    169168 
    170169        InitTiming(); 
     
    185184        } 
    186185 
    187  
    188186        Environment::GetSingleton()->GetStringValue("Scene.filename", buff); 
    189187        string filename(buff); 
     
    216214        } 
    217215         
     216 
    218217        //////////// 
    219218        //-- initialize external ray caster 
     
    292291        // create a preprocessor thread (note: capsulates calls to boost fuctions!) 
    293292        PreprocessorThread *pt = NULL; 
    294  
    295 #ifdef TRY_GLOBAL_LINES 
    296          
    297         preprocessor->PrepareHwGlobalLines(); 
    298         globalLinesRenderer->Run(); 
    299  
    300 #else 
     293         
     294        //preprocessor->PrepareHwGlobalLines(); 
     295        //globalLinesRenderer->Run(); 
     296 
     297 
     298        bool guiSupported = false; 
     299        const bool useRendererBuffer = true; 
     300 
     301        int frames; 
     302        Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 
    301303 
    302304#ifdef USE_QT 
    303          
     305 
    304306        // create a qt application first (must be created before any opengl widget ...) 
    305307        QApplication *app = new QApplication(argc, NULL); 
    306  
    307         pt = new QtPreprocessorThread(preprocessor); 
    308  
    309 #else 
     308        pt = new QtPreprocessorThread(preprocessor);     
     309         
     310        if (0 && preprocessor->mUseGlRenderer && (importRandomViewCells || frames)) 
     311        { 
     312                QGLFormat f; 
     313                f.setStencil(true); 
     314                QGLFormat::setDefaultFormat(f); 
     315 
     316                // NOTE: render texture should be power of 2 and square 
     317                // renderer must be initialised 
     318                // $$matt 
     319                preprocessor->renderer =  
     320                        new QtGlRendererBuffer(1024, 1024, 
     321                        preprocessor->mSceneGraph, 
     322                        preprocessor->mViewCellsManager, 
     323                        preprocessor->mKdTree); 
     324        } 
     325 
     326        if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
     327        { 
     328                //////// 
     329                //-- create and run the preprocessor application in a parallel thread 
     330 
     331                cout << "using gl widget" << endl; 
     332 
     333                pt->InitThread(); 
     334                pt->RunThread(); 
     335 
     336                // display the render widget 
     337                if (!rendererWidget)  
     338                { 
     339                        if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 
     340                                cout << "damn" << endl; 
     341                                QMessageBox::information(0, "OpenGL pbuffers",  
     342                                        "This system does not support OpenGL/pbuffers.", 
     343                                        QMessageBox::Ok); 
     344                                return NULL; 
     345                        } 
     346 
     347                        rendererWidget =  
     348                                new QtGlRendererWidget(preprocessor->mSceneGraph, 
     349                                preprocessor->mViewCellsManager, 
     350                                preprocessor->mKdTree); 
     351 
     352                        rendererWidget->Show(); 
     353 
     354                        if (1) // not working with vbo 
     355                        { 
     356                                QtGlViewer *viewer =  
     357                                        new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 
     358                                viewer->show(); 
     359                        } 
     360 
     361                        guiSupported = true;  
     362                } 
     363 
     364                bool exportRandomViewCells; 
     365                Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 
     366                        exportRandomViewCells); 
     367 
     368                if (exportRandomViewCells) 
     369                { 
     370                        cout << "exporting random view cells" << endl; 
     371                        preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 
     372                        cout << "finished" << endl; 
     373                } 
     374 
     375                /*bool evaluatePixelError; 
     376                Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluatePixelError",  evaluatePixelError); 
     377 
     378                if (evaluatePixelError) 
     379                { 
     380                cout << "evaluating pixel error" << endl; 
     381                preprocessor->ComputeRenderError(); 
     382                }*/ 
     383 
     384                qApp->exec(); 
     385        } 
     386#else // USE_QUT 
    310387 
    311388        //#if USE_THREADS 
     
    319396        preprocessor->SetThread(pt); 
    320397 
    321         bool guiSupported = false; 
    322         bool useRendererBuffer = true; 
    323  
    324         int frames; 
    325         Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 
    326          
    327          
    328 #ifdef USE_QT 
    329  
    330         if (0 && preprocessor->mUseGlRenderer && (importRandomViewCells || frames)) 
    331         { 
    332                 QGLFormat f; 
    333                 f.setStencil(true); 
    334                 QGLFormat::setDefaultFormat(f); 
    335  
    336                 // NOTE: render texture should be power of 2 and square 
    337                 // renderer must be initialised 
    338                 // $$matt 
    339                 preprocessor->renderer =  
    340                         new QtGlRendererBuffer(1024, 1024, 
    341                                                preprocessor->mSceneGraph, 
    342                                                                    preprocessor->mViewCellsManager, 
    343                                                                    preprocessor->mKdTree); 
    344         } 
    345 #endif 
    346  
    347           if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
    348           { 
    349 #ifdef USE_QT 
    350  
    351                   //////// 
    352                   // create and run the preprocessor application in a parallel thread 
    353  
    354                   cout << "using gl widget" << endl; 
    355  
    356                   pt->InitThread(); 
    357                   pt->RunThread(); 
    358  
    359                   // display the render widget 
    360                   if (!rendererWidget)  
    361                   { 
    362  
    363                           if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 
    364                                   QMessageBox::information(0, "OpenGL pbuffers",  
    365                                           "This system does not support OpenGL/pbuffers.", 
    366                                           QMessageBox::Ok); 
    367                                   return NULL; 
    368                           } 
    369  
    370                           rendererWidget =  
    371                                   new QtGlRendererWidget(preprocessor->mSceneGraph, 
    372                                                          preprocessor->mViewCellsManager, 
    373                                                          preprocessor->mKdTree); 
    374  
    375                           rendererWidget->Show(); 
    376  
    377                           if (0) 
    378                           { 
    379                                   QtGlViewer *viewer =  
    380                                           new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 
    381                                   viewer->show(); 
    382                           } 
    383  
    384                           guiSupported = true;  
    385                   } 
    386  
    387  
    388                   bool exportRandomViewCells; 
    389                   Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 
    390                           exportRandomViewCells); 
    391  
    392                   if (exportRandomViewCells) 
    393                   { 
    394                           cout << "exporting random view cells" << endl; 
    395                           preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 
    396                           cout << "finished" << endl; 
    397                   } 
    398  
    399                   /*bool evaluatePixelError; 
    400                   Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluatePixelError",  evaluatePixelError); 
    401  
    402                   if (evaluatePixelError) 
    403                   { 
    404                   cout << "evaluating pixel error" << endl; 
    405                   preprocessor->ComputeRenderError(); 
    406                   }*/ 
    407  
    408                   qApp->exec(); 
    409 #endif 
    410           } 
    411  
    412           // no gui available 
    413           if (!guiSupported)  
    414           { 
    415                   if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
    416                           cout << "warning: gui not supported!" << endl; 
    417  
    418                   preprocessor->mUseGlRenderer = false; 
    419                   preprocessor->mUseGlDebugger = false; 
    420           } 
    421  
    422           if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger))  
    423           { 
    424                   cout << "executing main thread" << endl; 
    425                   // just call the mail method -> will be executed in the main thread 
    426                   pt->Main(); 
    427           }      
    428 #endif 
    429  
    430           // release memory 
    431           Cleanup(); 
    432           delete pt; 
    433  
    434           return returnCode; 
     398        // no gui available 
     399        if (!guiSupported)  
     400        { 
     401                if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
     402                        cout << "warning: gui not supported!" << endl; 
     403 
     404                preprocessor->mUseGlRenderer = false; 
     405                preprocessor->mUseGlDebugger = false; 
     406        } 
     407 
     408        if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger))  
     409        { 
     410                cout << "executing main thread" << endl; 
     411                // just call the mail method -> will be executed in the main thread 
     412                pt->Main(); 
     413        }        
     414 
     415        // release memory 
     416        Cleanup(); 
     417        delete pt; 
     418 
     419        return returnCode; 
    435420} 
    436421 
Note: See TracChangeset for help on using the changeset viewer.