Ignore:
Timestamp:
09/24/08 11:08:13 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r2967 r2968  
    9797static CGparameter sLightDirParam; 
    9898static CGparameter sLightDirShadowParam; 
    99  
    10099static CGparameter sImageKeyParam; 
     100static CGparameter sWhiteLumParam; 
    101101 
    102102//#define USE_3D_SSAO 
     
    285285                sColorsTexDeferredParam = cgGetNamedParameter(sCgDeferredProgram, "colors");   
    286286                sNormalsTexDeferredParam = cgGetNamedParameter(sCgDeferredProgram, "normals"); 
     287                 
    287288                sLightDirParam = cgGetNamedParameter(sCgDeferredProgram, "lightDir"); 
    288289        } 
     
    407408 
    408409                sImageKeyParam = cgGetNamedParameter(sCgAntiAliasingProgram, "imageKey"); 
     410                sWhiteLumParam = cgGetNamedParameter(sCgAntiAliasingProgram, "whiteLum"); 
    409411 
    410412                sColorsTexAntiAliasingParam = cgGetNamedParameter(sCgAntiAliasingProgram, "colors");   
     
    438440                sNoiseTexShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "noiseTexture"); 
    439441                sSamplesShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "samples"); 
     442 
    440443                sLightDirShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "lightDir"); 
    441444 
     
    667670void DeferredRenderer::AntiAliasing(FrameBufferObject *fbo) 
    668671{ 
    669         const float imageKey = ToneMapper().CalcImageKey(fbo->GetColorBuffer(colorBufferIdx)); 
    670  
    671         GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 
     672        ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 
     673 
     674        // we assume that we have a floating point rgba texture 
     675        float *pixels = (float *)colorBuffer->ReadTexture(); 
     676 
     677        const int w = colorBuffer->GetHeight(); 
     678        const int h = colorBuffer->GetWidth(); 
     679 
     680        const float imageKey = ToneMapper().CalcImageKey(pixels, w, h); 
     681        const float whiteLum = 0.5f * ToneMapper().CalcMaxLuminance(pixels, w, h); 
     682 
     683        delete [] pixels; 
     684 
     685        GLuint colorsTex = colorBuffer->GetTexture(); 
    672686        GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 
    673687         
     
    684698 
    685699        cgGLSetParameter1f(sImageKeyParam, imageKey); 
     700        cgGLSetParameter1f(sWhiteLumParam, whiteLum); 
     701 
    686702 
    687703        glColor3f(1.0f, 1.0f, 1.0f); 
Note: See TracChangeset for help on using the changeset viewer.