Changeset 1940


Ignore:
Timestamp:
01/04/07 21:39:44 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
3 added
11 edited
1 moved

Legend:

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

    r1931 r1940  
    149149  void InitGL(); 
    150150 
    151   virtual int GetWidth() const = 0; 
    152   virtual int GetHeight() const = 0; 
     151  virtual int GetWidth() const { return 0; } 
     152  virtual int GetHeight() const { return 0; } 
    153153 
    154154  int GetId(int r, int g, int b) const; 
     
    164164 
    165165public: 
     166 
    166167  int mFrame; 
    167168  bool mWireFrame; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1932 r1940  
    740740                Environment::GetSingleton()->GetStringValue("ViewCells.geometryFilename", vcGeomFilename); 
    741741 
     742                // create view cells from specified geometry 
    742743                if (loadVcGeometry) 
    743744                { 
     
    769770 
    770771        mViewCellsManager->SetRenderer(mRenderSimulator); 
    771  
    772772         
    773773        mViewCellsManager->SetPreprocessor(this); 
     774 
    774775        return true; 
    775776} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r1936 r1940  
    217217                                OptimizeForProcessor="3" 
    218218                                OptimizeForWindowsApplication="TRUE" 
    219                                 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl"" 
     219                                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)"" 
    220220                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT" 
    221221                                ExceptionHandling="TRUE" 
     
    384384                        <File 
    385385                                RelativePath="..\src\glInterface.h"> 
     386                        </File> 
     387                        <File 
     388                                RelativePath=".\GlobalLinesRenderer.cpp"> 
     389                        </File> 
     390                        <File 
     391                                RelativePath=".\GlobalLinesRenderer.h"> 
    386392                        </File> 
    387393                        <File 
     
    694700                        </File> 
    695701                        <File 
     702                                RelativePath=".\RenderTexture.cpp"> 
     703                        </File> 
     704                        <File 
     705                                RelativePath=".\RenderTexture.h"> 
     706                        </File> 
     707                        <File 
    696708                                RelativePath="..\src\ResourceManager.h"> 
    697709                        </File> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/GlobalLinesRenderer.cpp

    r1939 r1940  
    66#include <Cg/cgGL.h> 
    77 
    8 //#include <QVBoxLayout> 
     8#include <QtOpenGL> 
    99 
    1010namespace GtpVisibilityPreprocessor { 
     
    1414static CGprofile sCgFragmentProfile; 
    1515 
     16 
    1617static void handleCgError()  
    1718{ 
    18     Debug << "Cg error: " << cgGetErrorString(cgGetError()) << endl; 
     19    cerr << "Cg error: " << cgGetErrorString(cgGetError()) << endl; 
    1920    exit(1); 
    2021} 
    2122 
    22 /*QtGlRendererBuffer::~QtGlRendererBuffer() 
     23 
     24GlobalLinesRenderer::GlobalLinesRenderer(QGLPixelBuffer *buffer1, QGLPixelBuffer *buffer2): 
     25mNewBuffer(buffer1), mOldBuffer(buffer2) 
    2326{ 
    24         if (sCgFragmentProgram) 
    25                 cgDestroyProgram(sCgFragmentProgram); 
     27} 
     28 
     29 
     30GlobalLinesRenderer::~GlobalLinesRenderer() 
     31{ 
    2632        if (sCgDepthPeelingProgram) 
    2733                cgDestroyProgram(sCgDepthPeelingProgram); 
     
    3036} 
    3137 
    32 */ 
     38  
     39void GlobalLinesRenderer::CastGlobalLines(Beam &beam, const int samples) 
     40{ 
     41        // bind pixel shader implementing the front depth buffer functionality 
     42        cgGLBindProgram(sCgDepthPeelingProgram); 
     43        cgGLEnableProfile(sCgFragmentProfile); 
     44 
     45        ApplyDepthPeeling(beam, samples); 
     46} 
     47 
     48 
     49void GlobalLinesRenderer::DrawGeometry() 
     50{ 
     51} 
     52 
     53void GlobalLinesRenderer::ApplyDepthPeeling(Beam &beam, const int samples) 
     54{ 
     55/*      if (rtNew->IsDoubleBuffered())  
     56                glDrawBuffer(GL_BACK); 
     57         
     58        rtNew->BeginCapture(); 
     59        { 
     60                cgGLBindProgram(passthru); 
     61                glColor3f(0,0.0,0.0); 
     62                DrawGeometry();   //just random geomerty    
     63        } 
     64        rtNew->EndCapture(); 
     65 
     66        for(int l = 0; l < mCurrentDepth; l++)  
     67        { 
     68                // Peel another layer 
     69                pingpong(); // switch pointer between rendertextures 
     70      
     71                rtNew->BeginCapture(); 
     72                { 
     73                        if (rtNew->IsDoubleBuffered())  
     74                                glDrawBuffer(GL_BACK); 
     75         
     76                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          
     77                         
     78                        cgGLBindProgram(fragmentProgram); 
     79                        cgGLSetTextureParameter(input1, rtOld->GetDepthTextureID()); 
     80                        cgGLEnableTextureParameter(input1); 
     81 
     82            glColor3f(0,0.0,0.0); 
     83                        DrawGeometry(); 
     84                        cgGLDisableTextureParameter(input1); 
     85                } 
     86                rtNew->EndCapture(); 
     87   }*/ 
     88} 
    3389 
    3490 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/GlobalLinesRenderer.h

    r1939 r1940  
    77class Beam; 
    88class Intersectable; 
     9class QGLPixelBuffer; 
     10 
    911struct VssRayContainer; 
    1012 
     
    1416class __declspec(dllexport) GlobalLinesRenderer 
    1517{ 
    16         GlobalLinesRenderer();//(QtGlPixelBuffer *buffer1, QtGlPixelBuffer *buffer2); 
    17  
     18        GlobalLinesRenderer(QGLPixelBuffer *buffer1, QGLPixelBuffer *buffer2); 
    1819        ~GlobalLinesRenderer(); 
    1920 
    2021        void CastGlobalLines(Beam &beam, const int samples); 
    21  
    2222 
    2323        void InitGL(); 
     
    3333private: 
    3434 
     35        /** Draws the geometry for one pass. 
     36        */ 
     37        void DrawGeometry(); 
     38 
    3539        void ApplyDepthPeeling(Beam &beam, const int samples); 
    3640 
     
    3842                                                 const Beam &beam); 
    3943 
     44        QGLPixelBuffer *mNewBuffer; 
     45        QGLPixelBuffer *mOldBuffer; 
    4046}; 
    4147 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r1935 r1940  
    786786                          up.x, up.y, up.z); 
    787787}                
    788  
    789    
    790 void QtGlRendererBuffer::CastGlobalLine(Beam &beam, const int samples) 
    791 { 
    792         // bind pixel shader implementing the front depth buffer functionality 
    793         cgGLBindProgram(sCgFragmentProgram); 
    794         cgGLEnableProfile(sCgFragmentProfile); 
    795  
    796         DepthPeeling(beam, samples); 
    797 } 
    798  
    799  
    800 void QtGlRendererBuffer::DepthPeeling(Beam &beam, const int samples) 
    801 { 
    802 /*      if (rtNew->IsDoubleBuffered())  
    803                 glDrawBuffer(GL_BACK); 
    804          
    805         rtNew->BeginCapture(); 
    806         { 
    807                 cgGLBindProgram(passthru); 
    808                 glColor3f(0,0.0,0.0); 
    809                 DrawGeometry();   //just random geomerty    
    810         } 
    811         rtNew->EndCapture(); 
    812  
    813         for(int l = 0; l < mCurrentDepth; l++)  
    814         { 
    815                 // Peel another layer 
    816                 pingpong(); // switch pointer between rendertextures 
    817       
    818                 rtNew->BeginCapture(); 
    819                 { 
    820                         if (rtNew->IsDoubleBuffered())  
    821                                 glDrawBuffer(GL_BACK); 
    822          
    823                         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          
    824                          
    825                         cgGLBindProgram(fragmentProgram); 
    826                         cgGLSetTextureParameter(input1, rtOld->GetDepthTextureID()); 
    827                         cgGLEnableTextureParameter(input1); 
    828  
    829             glColor3f(0,0.0,0.0); 
    830                         DrawGeometry(); 
    831                         cgGLDisableTextureParameter(input1); 
    832                 } 
    833                 rtNew->EndCapture(); 
    834    }*/ 
    835 } 
    836788 
    837789 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r1935 r1940  
    9494                ); 
    9595 
    96         void CastGlobalLine(Beam &beam, 
    97                                                 const int samples); 
    98  
    99         void DepthPeeling(Beam &beam, const int samples); 
    100  
    10196        void InitGL(); 
    10297 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1936 r1940  
    193193                                OptimizeForProcessor="3" 
    194194                                OptimizeForWindowsApplication="TRUE" 
    195                                 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;" 
    196                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT" 
     195                                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" 
     196                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;TRY_GLOBAL_LINES" 
    197197                                RuntimeLibrary="2" 
    198198                                RuntimeTypeInfo="TRUE" 
     
    205205                        <Tool 
    206206                                Name="VCLinkerTool" 
    207                                 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 QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 
     207                                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" 
    208208                                OutputFile="../bin/release/Preprocessor.exe" 
    209209                                LinkIncremental="1" 
    210                                 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;;.\QtGlRenderer\Release" 
     210                                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;" 
    211211                                GenerateDebugInformation="FALSE" 
    212212                                SubSystem="1" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/depth_peeling.cg

    r1935 r1940  
    22float3 main(in float4 col : COL0, 
    33       in float3 pos : WPOS, 
    4         uniform samplerRECT curentDepth) : COLOR 
     4        uniform samplerRECT depthTex) : COLOR 
    55{ 
    6    float zold = texRECT(currentDepth, pos.xy); 
     6   float zold = texRECT(depthTex, pos.xy); 
    77   if(pos.z < (zold + .000001)) 
    88      discard; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1933 r1940  
    2828#include "ObjExporter.h" 
    2929#include "SceneGraph.h" 
     30#include "GlobalLinesRenderer.h" 
    3031 
    3132#include "ViewCellsManager.h" 
     
    5253//Preprocessor *preprocessor = NULL; 
    5354GlRendererWidget *rendererWidget = NULL; 
     55//GlobalLinesRenderer *globalLinesRenderer = NULL; 
     56 
    5457 
    5558// DLL function signature 
     
    258261        PreprocessorThread *pt = NULL; 
    259262 
     263#ifdef TRY_GLOBAL_LINES 
     264        GlRenderer *renderer = new GlRenderer(preprocessor->mSceneGraph, 
     265                                                                                  preprocessor->mViewCellsManager, 
     266                                                                                  preprocessor->mKdTree); 
     267 
     268        globalLinesRenderer = new GlobalLinesRenderer(preprocessor, renderer); 
     269        globalLinesRenderer->InitGl(); 
     270        globalLinesRenderer->Run(); 
     271 
     272#else 
     273 
    260274#ifdef USE_QT 
    261275         
     
    334348        if (!guiSupported)  
    335349        { 
    336                 cout << "warning: gui not supported!" << endl; 
     350                if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 
     351                        cout << "warning: gui not supported!" << endl; 
    337352                 
    338353                preprocessor->mUseGlRenderer = false; 
     
    346361                pt->Main(); 
    347362        }        
    348  
     363#endif 
    349364        // release memory 
    350365        Cleanup(); 
Note: See TracChangeset for help on using the changeset viewer.