- Timestamp:
- 09/02/08 00:56:48 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp
r2892 r2893 46 46 47 47 static CGparameter sShadowMatrixParam; 48 49 50 51 52 DeferredShader::DeferredShader(int w, int h ):53 mWidth(w), mHeight(h) 48 static CGparameter sMaxDepthParam; 49 50 51 52 DeferredShader::DeferredShader(int w, int h, float scaleFactor): 53 mWidth(w), mHeight(h), mScaleFactor(scaleFactor) 54 54 { 55 55 //mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); … … 124 124 sNormalsTexShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "normals"); 125 125 sShadowMapParam = cgGetNamedParameter(sCgDeferredShadowProgram, "shadowMap"); 126 126 sMaxDepthParam = cgGetNamedParameter(sCgDeferredShadowProgram, "maxDepth"); 127 127 sShadowMatrixParam = cgGetNamedParameter(sCgDeferredShadowProgram, "shadowMatrix"); 128 128 } … … 184 184 glDisable(GL_TEXTURE_2D); 185 185 glDisable(GL_LIGHTING); 186 glDepthMask(GL_FALSE); 187 186 188 187 189 glPushAttrib(GL_VIEWPORT_BIT); … … 203 205 204 206 glEnable(GL_LIGHTING); 205 glDisable(GL_TEXTURE_2D); 207 glEnable(GL_TEXTURE_2D); 208 glDepthMask(GL_TRUE); 206 209 207 210 glMatrixMode(GL_PROJECTION); … … 332 335 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 333 336 GLuint shadowMap = shadowMapping->mFbo->GetDepthTex(); 334 337 /* 335 338 static Matrix4x4 biasMatrix(0.5f, 0.0f, 0.0f, 0.0f, 336 339 0.0f, 0.5f, 0.0f, 0.0f, 337 340 0.0f, 0.0f, 0.5f, 0.0f, 338 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] 339 348 340 349 Matrix4x4 inverseView = matViewing; … … 345 354 //cout << "matview:\n" << matViewing << endl; 346 355 //cout << "proj:\n" << shadowMapping->mLightProjectionMatrix << endl; 347 //cout << "view:\n" << shadowMapping->mLightViewMatrix << endl;356 cout << "view:\n" << shadowMapping->mLightViewMatrix << endl; 348 357 349 358 // compute combined matrix that transforms pixels into light texture space … … 353 362 inverseView; 354 363 */ 355 Matrix4x4 shadowMatrix = //inverseView * 356 lightProjView * 357 biasMatrix; 358 /* 359 Matrix4x4 shadowMatrix = biasMatrix * 360 lightProjView; 364 //Matrix4x4 shadowMatrix = //inverseView * lightProjView * biasMatrix;* 365 Matrix4x4 shadowMatrix = lightProjView*biasMatrix; 361 366 //inverseView; 362 */363 367 cout << "combined:\n" << shadowMatrix << endl; 364 368 … … 384 388 cgGLSetTextureParameter(sShadowMapParam, shadowMap); 385 389 cgGLEnableTextureParameter(sShadowMapParam); 390 391 cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 386 392 387 393 cgGLSetMatrixParameterfc(sShadowMatrixParam, (const float *)shadowMatrix.x);
Note: See TracChangeset
for help on using the changeset viewer.