Changeset 1935


Ignore:
Timestamp:
01/04/07 00:23:09 (17 years ago)
Author:
mattausch
Message:

started depth peeling

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
1 added
5 edited

Legend:

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

    r1931 r1935  
    882882 
    883883 
    884  
    885  
    886  
    887  
    888  
    889884void GlRendererBuffer::SampleBeamContributions(Intersectable *sourceObject, 
    890885                                                                                           Beam &beam, 
     
    10151010        glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, depthMapSize, depthMapSize); 
    10161011 
    1017  
    10181012        // reset clear function 
    10191013        glClearDepth(clearDepth); 
    1020  
    10211014         
    10221015         
     
    10991092#endif 
    11001093         
    1101     
    1102  
    1103         // 6. Use occlusion queries for all viewcell meshes associated with the beam -> 
     1094        // 6. Use occlusion queries for all viewcell meshes associated with the beam -> 
    11041095        //     a fragment passes if the corresponding stencil fragment is set and its depth is 
    11051096        //     between origin and termination buffer 
     
    11321123        } 
    11331124 
    1134  
    1135  
    11361125        // at this point, if possible, go and do some other computation 
    11371126 
    1138  
    1139          
    11401127        // 7. The number of visible pixels is the number of sample rays which see the source 
    11411128        //    object from the corresponding viewcell -> remember these values for later update 
     
    11791166#endif 
    11801167 
    1181  
    1182  
    11831168        //-- cleanup 
    1184  
    11851169 
    11861170        // reset gl state 
     
    11891173        glEnable(GL_CULL_FACE); 
    11901174        glDisable(GL_STENCIL_TEST); 
     1175 
    11911176#if USE_CG 
    11921177        cgGLDisableProfile(sCgFragmentProfile); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r1934 r1935  
    1515{ 
    1616   
    17 #define GVS_DEBUG 0 
     17#define GVS_DEBUG 1 
    1818 
    1919struct VizStruct 
     
    435435        // take xnew, p = intersect(viewcell, line(pnew, predicted(x)) as origin ? 
    436436        // difficult to say!! 
    437         const Vector3 newOrigin = newPoint + newDir * -5000.0f; 
     437        const float offset = 0.5f; 
     438        const Vector3 newOrigin = newPoint - newDir * offset; 
    438439 
    439440        const SimpleRay simpleRay(newOrigin, newDir, SamplingStrategy::GVS, 1.0f); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp

    r1926 r1935  
    2121static CGcontext sCgContext = NULL; 
    2222static CGprogram sCgFragmentProgram = NULL; 
     23static CGprogram sCgDepthPeelingProgram = NULL; 
    2324static CGprofile sCgFragmentProfile; 
    2425 
     
    140141        if (sCgFragmentProgram) 
    141142                cgDestroyProgram(sCgFragmentProgram); 
     143        if (sCgDepthPeelingProgram) 
     144                cgDestroyProgram(sCgDepthPeelingProgram); 
    142145        if (sCgContext) 
    143146                cgDestroyContext(sCgContext); 
     
    692695        } 
    693696 
    694  
    695  
    696697        // at this point, if possible, go and do some other computation 
    697  
    698  
    699698         
    700699        // 7. The number of visible pixels is the number of sample rays which see the source 
     
    739738#endif 
    740739 
    741  
    742  
     740        //////// 
    743741        //-- cleanup 
    744  
    745742 
    746743        // reset gl state 
     
    791788 
    792789   
     790void 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 
     800void 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} 
     836 
     837 
    793838void QtGlRendererBuffer::InitGL() 
    794839{ 
    795  makeCurrent();  
    796  GlRenderer::InitGL(); 
     840        makeCurrent();  
     841        GlRenderer::InitGL(); 
    797842 
    798843#if 1 
     
    851896  Debug << "---- PROGRAM BEGIN ----\n" << 
    852897          cgGetProgramString(sCgFragmentProgram, CG_COMPILED_PROGRAM) << "---- PROGRAM END ----\n"; 
     898 
     899 
     900  sCgDepthPeelingProgram =  
     901          cgCreateProgramFromFile(sCgContext, 
     902                                                          CG_SOURCE,  
     903                                                          "../src/depth_peeling.cg", 
     904                                                          sCgFragmentProfile, 
     905                                                          NULL,  
     906                                                          NULL); 
     907 
     908  if (!cgIsProgramCompiled(sCgDepthPeelingProgram)) 
     909          cgCompileProgram(sCgDepthPeelingProgram); 
     910 
     911  cgGLLoadProgram(sCgDepthPeelingProgram); 
     912  cgGLBindProgram(sCgDepthPeelingProgram); 
     913 
     914  Debug << "---- PROGRAM BEGIN ----\n"  
     915            << cgGetProgramString(sCgDepthPeelingProgram, CG_COMPILED_PROGRAM)  
     916                << "---- PROGRAM END ----\n"; 
    853917 
    854918#endif 
     
    17421806 
    17431807 
    1744  
    17451808void 
    17461809QtRendererControlWidget::FocusNextPvsErrorFrame(void) 
     
    17521815void 
    17531816QtRendererControlWidget::UpdatePvsErrorItem(int row, 
    1754                                                                                   GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 
     1817                                                                                        GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 
    17551818{ 
    17561819 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h

    r1932 r1935  
    7979 
    8080        void SampleBeamContributions( 
    81                 Intersectable *sourceObject, 
    82                 Beam &beam, 
    83                 const int samples, 
    84                 BeamSampleStatistics &stat 
     81                        Intersectable *sourceObject, 
     82                        Beam &beam, 
     83                        const int samples, 
     84                        BeamSampleStatistics &stat 
    8585                ); 
    8686 
    8787        void 
    8888                SampleViewpointContributions( 
    89                 Intersectable *sourceObject, 
    90                 const Vector3 viewPoint, 
    91                 Beam &beam, 
    92                 const int desiredSamples, 
    93                 BeamSampleStatistics &stat 
     89                        Intersectable *sourceObject, 
     90                        const Vector3 viewPoint, 
     91                        Beam &beam, 
     92                        const int desiredSamples, 
     93                        BeamSampleStatistics &stat 
    9494                ); 
    9595 
     96        void CastGlobalLine(Beam &beam, 
     97                                                const int samples); 
     98 
     99        void DepthPeeling(Beam &beam, const int samples); 
     100 
    96101        void InitGL(); 
    97102 
    98         /** Computes rays from information gained with hw sampling- 
     103        /** Computes rays from information gained with hw sampling 
    99104        */ 
    100105        void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1932 r1935  
    35613561                                if (p < raysOut) 
    35623562                                { 
    3563                                         if (0 && (*rit)->mFlags & VssRay::BorderSample) 
     3563                                        if ((*rit)->mFlags & VssRay::BorderSample) 
    35643564                                        { 
    35653565                                                vcRays.push_back(*rit); 
     
    35673567                                        else if ((*rit)->mFlags & VssRay::ReverseSample) 
    35683568                                        { 
    3569                                                 cout << "l"; 
    35703569                                                vcRays2.push_back(*rit); 
    35713570                                        } 
    3572                                         else if(0) 
     3571                                        else 
    35733572                                        { 
    35743573                                                vcRays3.push_back(*rit); 
Note: See TracChangeset for help on using the changeset viewer.