- Timestamp:
- 09/02/08 09:07:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp
r2893 r2894 176 176 177 177 void DeferredShader::Render(FrameBufferObject *fbo, 178 const Matrix4x4 &matViewing, 179 ShadowMapping *shadowMapping) 178 ShadowMap *shadowMap) 180 179 { 181 180 cgGLEnableProfile(RenderState::sCgFragmentProfile); … … 201 200 glOrtho(-offs, offs, -offs, offs, 0, 1); 202 201 203 FirstPassShadow(fbo, matViewing, shadowMapping);202 FirstPassShadow(fbo, shadowMap); 204 203 AntiAliasing(fbo); 205 204 … … 328 327 329 328 void DeferredShader::FirstPassShadow(FrameBufferObject *fbo, 330 const Matrix4x4 &matViewing, 331 ShadowMapping *shadowMapping) 329 ShadowMap *shadowMap) 332 330 { 333 331 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); 334 332 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 335 333 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 336 GLuint shadowMap = shadowMapping->mFbo->GetDepthTex(); 337 /* 338 static Matrix4x4 biasMatrix(0.5f, 0.0f, 0.0f, 0.0f, 339 0.0f, 0.5f, 0.0f, 0.0f, 340 0.0f, 0.0f, 0.5f, 0.0f, 341 0.5f, 0.5f, 0.5f, 1.0f); //bias from [-1, 1] to [0, 1] 342 */ 343 344 static Matrix4x4 biasMatrix(0.5f, 0.0f, 0.0f, 0.5f, 345 0.0f, 0.5f, 0.0f, 0.5f, 346 0.0f, 0.0f, 0.5f, 0.5f, 347 0.0f, 0.0f, 0.0f, 1.0f); //bias from [-1, 1] to [0, 1] 348 349 Matrix4x4 inverseView = matViewing; 350 inverseView.Invert(); 351 352 Matrix4x4 lightProjView = shadowMapping->mLightViewMatrix * shadowMapping->mLightProjectionMatrix; 353 354 //cout << "matview:\n" << matViewing << endl; 355 //cout << "proj:\n" << shadowMapping->mLightProjectionMatrix << endl; 356 cout << "view:\n" << shadowMapping->mLightViewMatrix << endl; 357 358 // compute combined matrix that transforms pixels into light texture space 359 /*Matrix4x4 shadowMatrix = biasMatrix * 360 shadowMapping->mLightProjectionMatrix * 361 shadowMapping->mLightViewMatrix * 362 inverseView; 363 */ 364 //Matrix4x4 shadowMatrix = //inverseView * lightProjView * biasMatrix;* 365 Matrix4x4 shadowMatrix = lightProjView*biasMatrix; 366 //inverseView; 367 cout << "combined:\n" << shadowMatrix << endl; 334 GLuint shadowTex = shadowMap->GetShadowTexture(); 335 336 Matrix4x4 shadowMatrix; 337 shadowMap->GetTextureMatrix(shadowMatrix); 368 338 369 339 fbo->Bind(); … … 386 356 cgGLEnableTextureParameter(sNormalsTexShadowParam); 387 357 388 cgGLSetTextureParameter(sShadowMapParam, shadow Map);358 cgGLSetTextureParameter(sShadowMapParam, shadowTex); 389 359 cgGLEnableTextureParameter(sShadowMapParam); 390 360
Note: See TracChangeset
for help on using the changeset viewer.