- Timestamp:
- 08/27/08 17:22:34 (16 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.