- Timestamp:
- 08/27/08 17:22:34 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2874 r2875 104 104 mWidth(w), mHeight(h), 105 105 mCamera(cam), 106 mScaleFactor(scaleFactor) 106 mScaleFactor(scaleFactor), 107 mUseTemporalCoherence(true), 108 mUseGlobIllum(false) 107 109 { 108 110 /////////// … … 140 142 141 143 glDeleteTextures(1, &noiseTex); 144 } 145 146 147 void SsaoShader::SetUseGlobIllum(bool useGlobIllum) 148 { 149 mUseGlobIllum = useGlobIllum; 150 } 151 152 153 void SsaoShader::SetUseTemporalCoherence(bool temporal) 154 { 155 mUseTemporalCoherence = temporal; 142 156 } 143 157 … … 198 212 GenerateSamples(); 199 213 cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples); 214 215 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 200 216 } 201 217 else … … 233 249 GenerateSamples(); 234 250 cgGLSetParameterArray2f(sSamplesGiParam, 0, NUM_SAMPLES, (const float *)samples); 251 252 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 235 253 } 236 254 else … … 298 316 FirstPass(fbo); 299 317 300 //ComputeSsao(fbo, expFactor, oldProjViewMatrix); 301 ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix); 302 303 //Combine(fbo); 318 if (!mUseGlobIllum) 319 ComputeSsao(fbo, expFactor, oldProjViewMatrix); 320 else 321 ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix); 322 304 323 AntiAliasing(fbo); 305 324 … … 363 382 cgGLSetTextureParameter(sOldTexParam, oldTex); 364 383 cgGLEnableTextureParameter(sOldTexParam); 365 366 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f));367 384 368 385 cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 369 cgGLSetParameter1f(sExpFactorParam, expFactor); 370 371 372 // q: should we generate new samples or only rotate the old ones? 373 // in the first case, the sample patterns look nicer, but the kernel 374 // needs longer to converge 375 GenerateSamples(); 376 cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples); 386 387 if (mUseTemporalCoherence) 388 { 389 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 390 cgGLSetParameter1f(sExpFactorParam, expFactor); 391 392 393 // q: should we generate new samples or only rotate the old ones? 394 // in the first case, the sample patterns look nicer, but the kernel 395 // needs longer to converge 396 GenerateSamples(); 397 cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples); 398 } 399 else 400 { 401 cgGLSetParameter1f(sExpFactorParam, 1.0f); 402 } 377 403 378 404 Vector3 tl, tr, bl, br; … … 638 664 cgGLEnableTextureParameter(sOldIllumTexGiParam); 639 665 640 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f));641 642 666 cgGLSetParameter1f(sMaxDepthGiParam, mScaleFactor); 643 cgGLSetParameter1f(sExpFactorGiParam, expFactor); 644 645 646 // q: should we generate new samples or only rotate the old ones? 647 // in the first case, the sample patterns look nicer, but the kernel 648 // needs longer to converge 649 GenerateSamples(); 650 cgGLSetParameterArray2f(sSamplesGiParam, 0, NUM_SAMPLES, (const float *)samples); 667 668 669 if (mUseTemporalCoherence) 670 { 671 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 672 cgGLSetParameter1f(sExpFactorGiParam, expFactor); 673 674 675 // q: should we generate new samples or only rotate the old ones? 676 // in the first case, the sample patterns look nicer, but the kernel 677 // needs longer to converge 678 GenerateSamples(); 679 cgGLSetParameterArray2f(sSamplesGiParam, 0, NUM_SAMPLES, (const float *)samples); 680 } 681 else 682 { 683 cgGLSetParameter1f(sExpFactorGiParam, 1.0f); 684 } 651 685 652 686 Vector3 tl, tr, bl, br; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
r2874 r2875 44 44 ~SsaoShader(); 45 45 46 void SetType(bool useGlobIllum, bool useTemporalCoherence); 46 void SetUseGlobIllum(bool useGlobIllum); 47 void SetUseTemporalCoherence(bool temporal); 48 47 49 48 50 protected: … … 73 75 FrameBufferObject *mNewFbo; 74 76 FrameBufferObject *mFbo3; 77 78 bool mUseGlobIllum; 79 bool mUseTemporalCoherence; 75 80 }; 76 81 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2874 r2875 154 154 bool ascendKeyPressed = false; 155 155 156 bool useGlobIllum = false; 156 157 bool useSsao = false; 158 bool useTemporalCoherence = true; 159 157 160 static float ssaoExpFactor = 0.1f; 158 161 … … 1096 1099 SceneEntity::SetUseLODs(useLODs); 1097 1100 break; 1101 case 'g': 1102 case 'G': 1103 useGlobIllum = !useGlobIllum; 1104 ssaoShader->SetUseGlobIllum(useGlobIllum); 1105 break; 1106 case 't': 1107 case 'T': 1108 useTemporalCoherence = !useTemporalCoherence; 1109 ssaoShader->SetUseTemporalCoherence(useTemporalCoherence); 1110 break; 1098 1111 case 'o': 1099 1112 case 'O':
Note: See TracChangeset
for help on using the changeset viewer.