- Timestamp:
- 09/16/08 16:03:01 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2946 r2952 8 8 #include "Halton.h" 9 9 #include "ShadowMapping.h" 10 #include "Light.h" 10 11 11 12 … … 91 92 static CGparameter sNoiseTexShadowParam; 92 93 static CGparameter sSamplesShadowParam; 94 95 static CGparameter sLightDirParam; 96 static CGparameter sLightDirShadowParam; 93 97 94 98 … … 245 249 if (sCgAntiAliasingProgram) cgDestroyProgram(sCgAntiAliasingProgram); 246 250 247 //DEL_PTR(mNewFbo);248 //DEL_PTR(mOldFbo);249 251 DEL_PTR(mFbo); 250 252 … … 277 279 sColorsTexDeferredParam = cgGetNamedParameter(sCgDeferredProgram, "colors"); 278 280 sNormalsTexDeferredParam = cgGetNamedParameter(sCgDeferredProgram, "normals"); 281 sLightDirParam = cgGetNamedParameter(sCgDeferredProgram, "lightDir"); 279 282 } 280 283 else … … 427 430 sNoiseTexShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "noiseTexture"); 428 431 sSamplesShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "samples"); 432 sLightDirShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "lightDir"); 429 433 430 434 PoissonDiscSampleGenerator2 poisson(16, 1.0f); … … 444 448 const Matrix4x4 &projViewMatrix, 445 449 float tempCohFactor, 450 DirectionalLight *light, 446 451 ShadowMap *shadowMap) 447 452 { … … 477 482 478 483 if (shadowMap) 479 FirstPassShadow(fbo, shadowMap);484 FirstPassShadow(fbo, light, shadowMap); 480 485 else 481 FirstPass(fbo );486 FirstPass(fbo, light); 482 487 483 488 switch (mShadingMethod) … … 691 696 692 697 693 void DeferredRenderer::FirstPass(FrameBufferObject *fbo )698 void DeferredRenderer::FirstPass(FrameBufferObject *fbo, DirectionalLight *light) 694 699 { 695 700 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); … … 717 722 cgGLEnableTextureParameter(sNormalsTexDeferredParam); 718 723 724 Vector3 lightDir = -light->GetDirection(); 725 cgGLSetParameter3f(sLightDirParam, lightDir.x, lightDir.y, lightDir.z); 726 719 727 glColor3f(1.0f, 1.0f, 1.0f); 720 728 … … 952 960 953 961 954 void DeferredRenderer::FirstPassShadow(FrameBufferObject *fbo, ShadowMap *shadowMap) 962 void DeferredRenderer::FirstPassShadow(FrameBufferObject *fbo, 963 DirectionalLight *light, 964 ShadowMap *shadowMap) 955 965 { 956 966 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); … … 995 1005 cgGLEnableTextureParameter(sNoiseTexShadowParam); 996 1006 1007 Vector3 lightDir = -light->GetDirection(); 1008 cgGLSetParameter3f(sLightDirShadowParam, lightDir.x, lightDir.y, lightDir.z); 1009 997 1010 998 1011 glColor3f(1.0f, 1.0f, 1.0f);
Note: See TracChangeset
for help on using the changeset viewer.