- Timestamp:
- 09/03/08 01:57:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2896 r2897 50 50 static CGparameter sNoiseTexParam; 51 51 static CGparameter sNoiseMultiplierParam; 52 static CGparameter sExpFactorParam; 53 52 static CGparameter sTemporalCoherenceParam; 54 53 55 54 … … 69 68 static CGparameter sNoiseTexGiParam; 70 69 static CGparameter sNoiseMultiplierGiParam; 71 static CGparameter s ExpFactorGiParam;70 static CGparameter sTemporalCoherenceGiParam; 72 71 73 72 … … 299 298 cgGLLoadProgram(sCgSsaoProgram); 300 299 301 // we need size of texture for scaling302 300 sPositionsTexParam = cgGetNamedParameter(sCgSsaoProgram, "positions"); 303 301 sColorsTexParam = cgGetNamedParameter(sCgSsaoProgram, "colors"); … … 308 306 sOldModelViewProjMatrixParam = cgGetNamedParameter(sCgSsaoProgram, "oldModelViewProj"); 309 307 sMaxDepthParam = cgGetNamedParameter(sCgSsaoProgram, "maxDepth"); 310 s ExpFactorParam = cgGetNamedParameter(sCgSsaoProgram, "expFactor");308 sTemporalCoherenceParam = cgGetNamedParameter(sCgSsaoProgram, "temporalCoherence"); 311 309 312 310 sOldTexParam = cgGetNamedParameter(sCgSsaoProgram, "oldTex"); … … 339 337 sOldModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj"); 340 338 sMaxDepthGiParam = cgGetNamedParameter(sCgGiProgram, "maxDepth"); 341 s ExpFactorGiParam = cgGetNamedParameter(sCgGiProgram, "expFactor");339 sTemporalCoherenceGiParam = cgGetNamedParameter(sCgGiProgram, "temporalCoherence"); 342 340 343 341 sSamplesGiParam = cgGetNamedParameter(sCgGiProgram, "samples"); … … 437 435 438 436 void DeferredRenderer::Render(FrameBufferObject *fbo, 439 const Matrix4x4 &oldProjViewMatrix, 440 float expFactor, 441 ShadowMap *shadowMap) 442 { 443 437 const Matrix4x4 &oldProjViewMatrix, 438 float expFactor, 439 ShadowMap *shadowMap) 440 { 444 441 // switch roles of old and new fbo 445 442 // the algorihm uses two input fbos, where the one 446 443 // contais the color buffer from the last frame, 447 444 // the other one will be written 445 446 mFboIndex = 2 - mFboIndex; 448 447 //swap(mNewFbo, mOldFbo); 449 mFboIndex = 2 - mFboIndex; 448 450 449 FrameBufferObject::Release(); 451 450 … … 463 462 glLoadIdentity(); 464 463 464 const float offs = 0.5f; 465 glOrtho(-offs, offs, -offs, offs, 0, 1); 466 465 467 glMatrixMode(GL_MODELVIEW); 466 468 glPushMatrix(); 467 469 glLoadIdentity(); 468 469 const float offs = 0.5f;470 glOrtho(-offs, offs, -offs, offs, 0, 1);471 470 472 471 if (shadowMap) … … 557 556 cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 558 557 558 cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255 : 0); 559 559 560 560 if (mUseTemporalCoherence || mRegenerateSamples) … … 570 570 } 571 571 572 cgGLSetParameter1f(sExpFactorParam, mUseTemporalCoherence ? expFactor : 1.0f);573 574 572 Vector3 tl, tr, bl, br; 575 573 ComputeViewVectors(tl, tr, bl, br); … … 782 780 cgGLSetParameter1f(sMaxDepthGiParam, mScaleFactor); 783 781 782 cgGLSetParameter1f(sTemporalCoherenceGiParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255 : 0); 783 784 784 785 785 if (mUseTemporalCoherence || mRegenerateSamples) … … 787 787 mRegenerateSamples = false; 788 788 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 789 cgGLSetParameter1f(sExpFactorGiParam, expFactor);790 789 791 790 // q: should we generate new samples or only rotate the old ones? … … 796 795 } 797 796 798 cgGLSetParameter1f(sExpFactorParam, mUseTemporalCoherence ? expFactor : 1.0f);799 797 800 798 Vector3 tl, tr, bl, br; … … 1004 1002 } 1005 1003 1004 1005 void DeferredRenderer::SetShadingMethod(SHADING_METHOD s) 1006 { 1007 if (s != mShadingMethod) 1008 { 1009 mShadingMethod = s; 1010 mRegenerateSamples = true; 1011 } 1012 } 1013 1006 1014 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.