Changeset 1146


Ignore:
Timestamp:
07/24/06 17:17:18 (18 years ago)
Author:
mattausch
Message:

use qt renderer as dll
changed vsp render heuristics sweep
capsulated thread

Location:
GTP/trunk/Lib/Vis
Files:
6 added
13 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1004 r1146  
    10551055                if (!(*oit).first) continue; 
    10561056 
    1057                 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance*>((*oit).first); 
     1057                OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first); 
    10581058                omi->GetMesh()->setVisible(load); 
    10591059                //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidHalfBoundingBox.cpp

    r117 r1146  
    4141        // 0+------+4      *---x 
    4242 
    43         // fan 1 
    44         if (isFirstHalf) 
     43         
     44        if (isFirstHalf) // fan 1 
    4545        { 
    4646                *pPos++ = min.x; *pPos++ = max.y; *pPos++ = max.z; //011 
     
    5454                *pPos++ = min.x; *pPos++ = min.y; *pPos++ = max.z; //001 
    5555        } 
    56         else 
    57         // fan 2 
     56        else // fan 2 
    5857        { 
    5958                *pPos++ = max.x; *pPos++ = min.y; *pPos++ = min.z; //100 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj

    r1145 r1146  
    6464                                FavorSizeOrSpeed="0" 
    6565                                OptimizeForWindowsApplication="TRUE" 
    66                                 AdditionalIncludeDirectories="..\include;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\src;&quot;$(CG_INC_PATH)&quot;;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces" 
     66                                AdditionalIncludeDirectories="..\include;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\src;&quot;$(CG_INC_PATH)&quot;;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(BOOST_INCLUDE)&quot;" 
    6767                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;" 
    6868                                ExceptionHandling="TRUE" 
     
    119119                        </File> 
    120120                        <File 
     121                                RelativePath="..\src\BoostPreprocessorThread.cpp"> 
     122                        </File> 
     123                        <File 
     124                                RelativePath="..\src\BoostPreprocessorThread.h"> 
     125                        </File> 
     126                        <File 
    121127                                RelativePath="..\src\BoundingBoxConverter.h"> 
    122128                        </File> 
     
    338344                        </File> 
    339345                        <File 
    340                                 RelativePath="..\src\RenderSimulator.cpp"> 
    341                         </File> 
    342                         <File 
    343                                 RelativePath="..\src\RenderSimulator.h"> 
    344                         </File> 
    345                         <File 
    346346                                RelativePath="..\src\ResourceManager.h"> 
    347347                        </File> 
     
    530530                        </File> 
    531531                        <File 
    532                                 RelativePath="..\src\QtGlRenderer.cpp"> 
    533                         </File> 
    534                         <File 
    535                                 RelativePath="..\src\QtGlRenderer.h"> 
    536                         </File> 
    537                         <File 
    538532                                RelativePath="..\src\Renderer.cpp"> 
    539533                        </File> 
    540534                        <File 
    541535                                RelativePath="..\src\Renderer.h"> 
     536                        </File> 
     537                        <File 
     538                                RelativePath="..\src\RenderSimulator.cpp"> 
     539                        </File> 
     540                        <File 
     541                                RelativePath="..\src\RenderSimulator.h"> 
    542542                        </File> 
    543543                </Filter> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r1145 r1146  
    1111#include "Environment.h" 
    1212 
    13  
    14 //#define GL_GLEXT_PROTOTYPES 
    15  
    16  
    17 #include <Cg/cg.h> 
    18 #include <Cg/cgGL.h> 
    19  
    20  
    21 #include <QVBoxLayout> 
     13//#include <Cg/cg.h> 
     14//#include <Cg/cgGL.h> 
     15 
    2216 
    2317namespace GtpVisibilityPreprocessor { 
    2418 
    25  
    26 /* 
    27 GLuint frontDepthMap; 
    28 GLuint backDepthMap; 
    29  
    30 const int depthMapSize = 512; 
    31  
    32 //static vector<OcclusionQuery *> sQueries; 
    33 */ 
    3419 
    3520static bool arbQuerySupport = false; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r1145 r1146  
    11#ifndef __GLRENDERER_H 
    22#define __GLRENDERER_H 
    3  
    4 //#include "glInterface.h" 
    5  
    6 //#include <QWaitCondition> 
    7 //#include <QtOpenGL> 
    8 //#include <QGLPixelBuffer> 
    9  
    10 //class QWidget; 
    113 
    124#include "Vector3.h" 
     
    8274        derived classes 
    8375*/ 
    84  
    8576class GlRenderer: public Renderer 
    8677{ 
     
    151142}; 
    152143 
    153  
     144/* Class implementing an OpenGl render buffer. 
     145*/ 
    154146class GlRendererBuffer: public GlRenderer 
    155147{ 
     
    253245        */ 
    254246        void EvalQueryWithItemBuffer(); 
     247 
    255248        /** Evaluates query for one direction using occlusion queries. 
    256249        */ 
     
    263256}; 
    264257 
     258 
     259/** Abstract class for implmenenting a gl render widget. 
     260*/ 
     261class GlRenderWidget 
     262{ 
     263public: 
     264         
     265        GlRenderWidget(SceneGraph *sceneGraph, ViewCellsManager *vcm, KdTree *kdTree): 
     266          mSceneGraph(sceneGraph), mViewCellsManager(vcm), mKdTree(kdTree) 
     267        { 
     268        } 
     269 
     270         
     271        GlRenderWidget() {} 
     272 
     273    virtual ~GlRenderWidget() {} 
     274 
     275        //virtual void Create() {} 
     276        virtual void Show() {} 
     277         
     278 
     279protected: 
     280 
     281 
     282        SceneGraph *mSceneGraph; 
     283        ViewCellsManager *mViewCellsManager; 
     284        KdTree *mKdTree; 
     285}; 
     286 
    265287}; 
    266288 
    267289#endif 
    268  
  • GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp

    r1145 r1146  
    11//#include <QApplication> 
    22#include "PreprocessorThread.h" 
    3 #include "Camera.h" 
    4 #include "KdTree.h" 
    5 #include "SceneGraph.h" 
    6 #include "Preprocessor.h" 
    73 
    84 
    95namespace GtpVisibilityPreprocessor { 
    106 
    11  
    12 // matt: remove qt dependencies 
    13 /* 
    14 PreprocessorThread::PreprocessorThread(Preprocessor *p, 
    15                                                                            QObject *parent):QThread(parent) 
    16 { 
    17   mPreprocessor = p; 
    18    
    19   if (p->mQuitOnFinish) 
    20         connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void))); 
    21 } 
    22 */ 
    237 
    248PreprocessorThread::PreprocessorThread(Preprocessor *p): 
     
    2812 
    2913 
    30 void PreprocessorThread::operator()() 
    31 { 
    32         Main(); 
    33 } 
    34  
    35 void PreprocessorThread::Main() 
    36 { 
    37         Camera camera; 
    38  
    39         if (0)  
    40         { 
    41                 // camera.LookAtBox(mPreprocessor->mKdTree->GetBox()); 
    42                 //      camera.LookInBox(mPreprocessor->mKdTree->GetBox()); 
    43                 camera.SetPosition(Vector3(3473, 6.778, -1699)); 
    44                 camera.SetDirection(Vector3(-0.2432, 0, 0.97)); 
    45                 //      camera.SetPosition(Vector3(991.7, 187.8, -271)); 
    46                 //      camera.SetDirection(Vector3(0.9, 0, -0.4)); 
    47  
    48                 camera.SnapImage("camera.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph); 
    49         }  
    50  
    51         if (0) { 
    52                 camera.LookInBox(mPreprocessor->mKdTree->GetBox()); 
    53                 camera.SetPosition(camera.mPosition + Vector3(-250,0,-550)); 
    54                 camera.SnapImage("camera2.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph); 
    55         } 
    56  
    57         if (0) { 
    58                 camera.SetPosition( mPreprocessor->mKdTree->GetBox().Center() - Vector3(0,-100,0) ); 
    59                 camera.SetDirection(Vector3(1, 0, 0)); 
    60                 camera.SnapImage("camera3.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph); 
    61         } 
    62  
    63         if (mPreprocessor->mComputeVisibility) { 
    64                 mPreprocessor->ComputeVisibility(); 
    65                 //      mPreprocessor->ExportPreprocessedData("scene.vis"); 
    66                 mPreprocessor->PostProcessVisibility(); 
    67         } 
    68  
    69         cerr << "Preprocessor main finished...\n"; 
    70    
    71 } 
    72  
    7314PreprocessorThread::~PreprocessorThread() 
    7415{ 
    75   cerr<<"Preprocessor thread destructor...\n"; 
    7616} 
    7717 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h

    r1145 r1146  
    11#ifndef __PREPROCESSOR_THREAD_H 
    22#define __PREPROCESSOR_THREAD_H 
    3 // matt: remove qt dependencies 
    4 //#include <QThread> 
    53 
    6 namespace GtpVisibilityPreprocessor { 
     4 
     5namespace GtpVisibilityPreprocessor  
     6{ 
    77 
    88class Preprocessor; 
     
    1010/** This class represents a preprocessor thread. 
    1111*/ 
    12 class PreprocessorThread//: public QThread 
     12class PreprocessorThread 
    1313{ 
    14   //Q_OBJECT 
     14public: 
     15        PreprocessorThread(Preprocessor *p); 
     16        virtual ~PreprocessorThread(); 
    1517 
    16   Preprocessor *mPreprocessor; 
    17 public: 
    18   //PreprocessorThread(Preprocessor *p, QObject *parent = 0); 
    19         PreprocessorThread(Preprocessor *p); 
    20   ~PreprocessorThread(); 
     18        virtual void InitThread() = 0; 
     19        virtual void RunThread() = 0; 
    2120 
    22   void operator()(); 
    23  
    24   void Main(); 
    25  
    26 /*protected: 
    27   void run() { 
    28         Main(); 
    29   }*/ 
     21protected: 
     22        virtual void Main() = 0; 
     23  
     24        Preprocessor *mPreprocessor; 
    3025}; 
    3126 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1145 r1146  
    707707          GenerateRays(mRssSamplesPerPass*ratios[0], RSS_BASED_DISTRIBUTION, rays); 
    708708 
    709           rays.NormalizePdf(rays.size()); 
     709          rays.NormalizePdf((int)rays.size()); 
    710710           
    711711          CastRays(rays, tmpVssRays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r1021 r1146  
    5151        Vector3 origin, direction;  
    5252 
    53     const int i = RandomValue(0, (int)mPreprocessor.mObjects.size() - 1); 
     53    const int i = (int)RandomValue(0, (int)mPreprocessor.mObjects.size() - 1); 
    5454 
    5555        Intersectable *object = mPreprocessor.mObjects[i]; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1145 r1146  
    14441444                if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) 
    14451445                { 
     1446 
     1447                        float currentPos; 
     1448                         
     1449                        // HACK: current positition is BETWEEN visibility events 
     1450                        if (ci != ci_end) 
     1451                                currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 
     1452                        else 
     1453                                currentPos = (*ci).value;                        
     1454 
    14461455                        sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 
    1447  
    1448                         //Debug  << "pos=" << (*ci).value << "\t pvs=(" <<  pvsl << "," << pvsr << ")" << "\t cost= " << sum << endl; 
     1456                        Debug  << "pos=" << (*ci).value << "\t newpos=" << currentPos << "\t pvs=(" <<  pvsl << "," << pvsr << ")" << "\t cost= " << sum << endl; 
    14491457 
    14501458                        if (sum < minSum) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1145 r1146  
    1212#include "ViewCell.h" 
    1313#include "SceneGraph.h" 
    14 #include "PreprocessorThread.h" 
     14#include "BoostPreprocessorThread.h" 
    1515#include "RenderSampler.h" 
    1616#include "ResourceManager.h" 
    17  
    18 //#include <QApplication> 
    19 //#include <QtOpenGL> 
    20 #include <boost/thread/thread.hpp> 
    21 #include <boost/thread/xtime.hpp> 
    2217#include "GlRenderer.h" 
    2318 
     
    2924 
    3025Preprocessor *preprocessor = NULL; 
    31  
    32 #if QT_ENABLED 
    33 QApplication *app = NULL; 
    34 #endif 
     26GlRenderWidget *renderWidget = NULL; 
    3527 
    3628 
    3729void Cleanup() 
    3830{ 
    39 #if QT_ENABLED 
    40         DEL_PTR(rendererWidget); 
    41 #endif 
    42  
     31        DEL_PTR(renderWidget); 
    4332        DEL_PTR(preprocessor); 
    4433 
     
    5140void DisplayWidget() 
    5241{ 
     42        // note matt: capsulate qt dependent code as good as possible 
     43        renderWidget =  
     44                new GlRenderWidget(preprocessor->mSceneGraph,  
     45                                                   preprocessor->mViewCellsManager,  
     46                                                   preprocessor->mKdTree); 
     47 
     48        renderWidget->Show(); 
     49 
    5350#if QT_ENABLED 
    54         QApplication *app = NULL; 
    5551 
    5652        // create a qt application first (must be created before any opengl widget ...) 
     
    175171        // create a preprocessor thread 
    176172        //PreprocessorThread *pt = new PreprocessorThread(p, app); 
    177         PreprocessorThread pt(preprocessor); 
     173        BoostPreprocessorThread pt(preprocessor); 
    178174 
    179175        if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
     
    182178                DisplayWidget(); 
    183179 
    184                 // create and run the thread 
    185                 boost::thread thrd(pt); 
    186                 thrd.join(); 
    187                 //pt->start(QThread::LowPriority); 
     180                // create and run the preprocessor application in a parallel thread 
     181                pt.InitThread(); 
     182                pt.RunThread(); 
    188183        }  
    189184        else 
     
    193188        } 
    194189 
    195 #if QT_ENABLED 
    196         if (app) 
    197         { 
    198                 returnCode = app->exec(); 
    199         DEL_PTR(app); 
    200         } 
    201 #endif 
    202190 
    203191        Cleanup(); 
  • GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln

    r1011 r1146  
    3131EndProject 
    3232Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "..\..\OnlineCullingCHC\IVReader\scripts\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 
     33        ProjectSection(ProjectDependencies) = postProject 
     34        EndProjectSection 
     35EndProject 
     36Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QtRenderer", "..\..\QtRenderer\QtRenderer.vcproj", "{B85DC7B1-58B6-4912-BD64-8B452630A368}" 
    3337        ProjectSection(ProjectDependencies) = postProject 
    3438        EndProjectSection 
     
    6872                {7319E499-473D-4CE5-9983-725D6E68A55D}.Release.ActiveCfg = Release|Win32 
    6973                {7319E499-473D-4CE5-9983-725D6E68A55D}.Release.Build.0 = Release|Win32 
     74                {B85DC7B1-58B6-4912-BD64-8B452630A368}.Debug.ActiveCfg = Debug|Win32 
     75                {B85DC7B1-58B6-4912-BD64-8B452630A368}.Debug.Build.0 = Debug|Win32 
     76                {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.ActiveCfg = Release|Win32 
     77                {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.Build.0 = Release|Win32 
    7078        EndGlobalSection 
    7179        GlobalSection(ExtensibilityGlobals) = postSolution 
Note: See TracChangeset for help on using the changeset viewer.