- Timestamp:
- 09/23/08 15:41:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2965 r2966 9 9 #include "ShadowMapping.h" 10 10 #include "Light.h" 11 #include "ToneMapper.h" 11 12 12 13 … … 96 97 static CGparameter sLightDirShadowParam; 97 98 99 static CGparameter sImageKeyParam; 100 static CGparameter sImageKeyShadowParam; 98 101 99 102 //#define USE_3D_SSAO … … 108 111 static Sample2 samples2[NUM_SAMPLES]; 109 112 #endif 110 Sample2 pcfSamples[16]; 113 114 // number of pcf tabs 115 Sample2 pcfSamples[NUM_PCF_TABS]; 111 116 112 117 static int colorBufferIdx = 0; … … 281 286 sNormalsTexDeferredParam = cgGetNamedParameter(sCgDeferredProgram, "normals"); 282 287 sLightDirParam = cgGetNamedParameter(sCgDeferredProgram, "lightDir"); 288 289 sImageKeyParam = cgGetNamedParameter(sCgDeferredProgram, "imageKey"); 283 290 } 284 291 else … … 433 440 sLightDirShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "lightDir"); 434 441 435 PoissonDiscSampleGenerator2 poisson(16, 1.0f); 442 sImageKeyShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "imageKey"); 443 444 PoissonDiscSampleGenerator2 poisson(NUM_PCF_TABS, 1.0f); 436 445 poisson.Generate((float *)pcfSamples); 437 446 438 cgGLSetParameterArray2f(sSamplesShadowParam, 0, 16, (const float *)pcfSamples);447 cgGLSetParameterArray2f(sSamplesShadowParam, 0, NUM_PCF_TABS, (const float *)pcfSamples); 439 448 } 440 449 else … … 699 708 void DeferredRenderer::FirstPass(FrameBufferObject *fbo, DirectionalLight *light) 700 709 { 710 const float imageKey = ToneMapper().CalcImageKey(fbo->GetColorBuffer(0)); 711 701 712 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); 702 713 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); … … 725 736 Vector3 lightDir = -light->GetDirection(); 726 737 cgGLSetParameter3f(sLightDirParam, lightDir.x, lightDir.y, lightDir.z); 738 739 cgGLSetParameter1f(sImageKeyParam, imageKey); 727 740 728 741 glColor3f(1.0f, 1.0f, 1.0f); … … 965 978 ShadowMap *shadowMap) 966 979 { 980 const float imageKey = ToneMapper().CalcImageKey(fbo->GetColorBuffer(0)); 981 967 982 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); 968 983 … … 1009 1024 cgGLSetParameter3f(sLightDirShadowParam, lightDir.x, lightDir.y, lightDir.z); 1010 1025 1026 // the average log luminance for tone mapping 1027 cgGLSetParameter1f(sImageKeyShadowParam, imageKey); 1011 1028 1012 1029 glColor3f(1.0f, 1.0f, 1.0f);
Note: See TracChangeset
for help on using the changeset viewer.