- Timestamp:
- 08/29/08 15:46:36 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2883 r2884 5 5 #include "Vector3.h" 6 6 #include "Camera.h" 7 #include "shaderenv.h" 7 8 8 9 … … 13 14 namespace CHCDemoEngine 14 15 { 15 16 // number of ssao samples17 #define NUM_SAMPLES 1018 19 16 20 17 static CGprogram sCgSsaoProgram = NULL; … … 49 46 static CGparameter sNoiseMultiplierParam; 50 47 static CGparameter sExpFactorParam; 48 51 49 52 50 … … 137 135 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 138 136 139 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, mWidth, mHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, randomNormals);137 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, randomNormals); 140 138 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, w, h, 0, GL_RGB, GL_FLOAT, randomNormals); 141 139 … … 183 181 184 182 SsaoShader::~SsaoShader() 185 186 183 { 187 184 if (sCgSsaoProgram) cgDestroyProgram(sCgSsaoProgram); … … 259 256 sExpFactorParam = cgGetNamedParameter(sCgSsaoProgram, "expFactor"); 260 257 261 sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples");262 258 sOldTexParam = cgGetNamedParameter(sCgSsaoProgram, "oldTex"); 263 259 260 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 264 261 265 262 // generate samples for ssao kernel 266 263 GenerateSamples(); 264 265 sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples"); 266 //cgSetArraySize(sSamplesParam, NUM_SAMPLES); 267 //cgCompileProgram(sCgSsaoProgram); 268 267 269 cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples); 268 269 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f));270 270 } 271 271 else … … 415 415 CombineIllum(fbo); 416 416 } 417 417 418 AntiAliasing(fbo); 418 419 … … 439 440 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 440 441 441 // GLuint colorsTex = mFbo->GetColorBuffer(0)->GetTexture();442 442 GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 443 443 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); … … 577 577 void SsaoShader::AntiAliasing(FrameBufferObject *fbo) 578 578 { 579 //GLuint colorsTex = mNewFbo->GetColorBuffer(1)->GetTexture();580 579 GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); 581 580 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); … … 727 726 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 728 727 cgGLSetParameter1f(sExpFactorGiParam, expFactor); 729 730 728 731 729 // q: should we generate new samples or only rotate the old ones? … … 774 772 { 775 773 GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 774 776 775 GLuint ssaoTex = mNewFbo->GetColorBuffer(0)->GetTexture(); 777 776 GLuint illumTex = mNewFbo->GetColorBuffer(1)->GetTexture(); 778 777 779 //780 778 fbo->Bind(); 781 779 782 // write into old color texture (not needed anymore)780 // overwrite old color texture 783 781 glDrawBuffers(1, mymrt); 784 782 … … 829 827 GLuint ssaoTex = mNewFbo->GetColorBuffer(0)->GetTexture(); 830 828 831 //832 829 fbo->Bind(); 833 830
Note: See TracChangeset
for help on using the changeset viewer.