- Timestamp:
- 08/27/08 16:14:10 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2873 r2874 106 106 mScaleFactor(scaleFactor) 107 107 { 108 109 108 /////////// 110 109 //-- the flip-flop fbos … … 222 221 sNoiseMultiplierGiParam = cgGetNamedParameter(sCgGiProgram, "noiseMultiplier"); 223 222 224 sOldModelViewProjMatrix Param = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj");223 sOldModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj"); 225 224 sMaxDepthGiParam = cgGetNamedParameter(sCgGiProgram, "maxDepth"); 226 225 sExpFactorGiParam = cgGetNamedParameter(sCgGiProgram, "expFactor"); … … 272 271 swap(mNewFbo, mOldFbo); 273 272 274 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x);275 273 276 274 glPushAttrib(GL_VIEWPORT_BIT); … … 300 298 FirstPass(fbo); 301 299 302 ComputeSsao(fbo, expFactor);303 //ComputeGlobIllum(fbo, expFactor);300 //ComputeSsao(fbo, expFactor, oldProjViewMatrix); 301 ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix); 304 302 305 303 //Combine(fbo); … … 321 319 322 320 323 void SsaoShader::ComputeSsao(FrameBufferObject *fbo, float expFactor) 324 { 321 void SsaoShader::ComputeSsao(FrameBufferObject *fbo, 322 float expFactor, 323 const Matrix4x4 &oldProjViewMatrix 324 ) 325 { 326 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 327 325 328 GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture(); 326 329 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); … … 582 585 583 586 584 void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo, float expFactor) 585 { 587 void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo, 588 float expFactor, 589 const Matrix4x4 &oldProjViewMatrix 590 ) 591 { 592 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 593 586 594 GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture(); 587 595 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
r2873 r2874 22 22 { 23 23 public: 24 /** constructor for a deferred shader taking the requested output image size,24 /** Constructor for a deferred shader taking the requested output image size, 25 25 the current camera, and a scaling factor. 26 26 … … 30 30 */ 31 31 SsaoShader(int w, int h, Camera *cam, float scaleFactor); 32 /** 33 34 The algorithm renders the scene given an fbo consists of 1 color buffer, 32 /** The algorithm renders the scene given an fbo consists of 1 color buffer, 35 33 1 position buffer, and 1 normal buffer. 36 34 We also need the projection view matrix of the last frame for reprojection, and … … 46 44 ~SsaoShader(); 47 45 46 void SetType(bool useGlobIllum, bool useTemporalCoherence); 47 48 48 protected: 49 49 50 void ComputeSsao(FrameBufferObject *fbo, float expFactor );50 void ComputeSsao(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix); 51 51 52 void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor );52 void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix); 53 53 54 54 void FirstPass(FrameBufferObject *fbo); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2873 r2874 539 539 540 540 // the diffuse color buffer 541 //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true);542 fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false);541 fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true); 542 //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 543 543 544 544 // the positions buffer -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2873 r2874 63 63 float3 normal = normalize(norm.xyz);// * 2.0f - float4(1.0f)); 64 64 65 float4 col = shade(IN, color, position, normal .xyz, amb);65 float4 col = shade(IN, color, position, normal, amb); 66 66 67 67 //OUT.color = float4(1.0f); 68 68 OUT.color = col; 69 OUT.color.w = color.w; 69 70 70 71 return OUT; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2873 r2874 151 151 realPos.w = 1.0f; 152 152 153 // reproject 153 154 float4 oldPos = mul(oldModelViewProj, realPos); 154 155 … … 176 177 OUT.illum_col.w = currentDepth; 177 178 178 179 //OUT.combined_col = float4(newDepth / oldDepth * 100, 0, 0, 1) ; 180 //OUT.combined_col = float4(newDepth, 0, 0, 1) ; 179 181 180 182 return OUT;
Note: See TracChangeset
for help on using the changeset viewer.