- Timestamp:
- 04/14/09 08:59:19 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3349 r3350 447 447 448 448 mTempFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 449 mTempFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 449 450 FrameBufferObject::InitBuffer(mTempFbo, 0); 451 FrameBufferObject::InitBuffer(mTempFbo, 1); 450 452 451 453 … … 561 563 ////////////// 562 564 563 string deferredParams[] = {"colors", "normals", "lightDir" };564 sCgDeferredProgram->AddParameters(deferredParams, 0, 3);565 string deferredParams[] = {"colors", "normals", "lightDir", "aoTex"}; 566 sCgDeferredProgram->AddParameters(deferredParams, 0, 4); 565 567 566 568 /////////////////// … … 652 654 InitFrame(); 653 655 654 if (shadowMap)656 /*if (shadowMap) 655 657 FirstPassShadow(fbo, light, shadowMap); 656 658 else 657 659 FirstPass(fbo, light); 660 */ 658 661 659 662 if (mShadingMethod != 0) … … 681 684 } 682 685 686 if (shadowMap) 687 FirstPassShadow(fbo, light, shadowMap); 688 else 689 FirstPass(fbo, light); 690 683 691 /// depth of field 684 692 if (mUseDepthOfField) … … 958 966 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 959 967 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 968 GLuint aoTex = mTempFbo->GetColorBuffer(1)->GetTexture(); 960 969 961 970 FlipFbos(fbo); … … 966 975 sCgDeferredProgram->SetTexture(1, normalsTex); 967 976 sCgDeferredProgram->SetValue3f(2, lightDir.x, lightDir.y, lightDir.z); 968 977 sCgDeferredProgram->SetTexture(3, aoTex); 978 969 979 DrawQuad(sCgDeferredProgram); 970 980 … … 1093 1103 GLuint ssaoTex = mTempFbo->GetColorBuffer(0)->GetTexture(); 1094 1104 1095 FlipFbos(fbo); 1105 mTempFbo->Bind(); 1106 glDrawBuffers(1, mrt + 1); 1107 //FlipFbos(fbo); 1096 1108 1097 1109 int i = 0; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3349 r3350 24 24 uniform float4 color, 25 25 uniform float3 normal, 26 float3 lightDir) 26 float3 lightDir, 27 float4 ao) 27 28 { 28 29 // diffuse intensity … … 44 45 else 45 46 { 46 outColor = (ambient + diffuse) * color; 47 outColor = (ambient * ao + diffuse) * color; 48 //outColor = ambient + diffuse * color; 47 49 } 48 50 … … 57 59 uniform sampler2D colors, 58 60 uniform sampler2D normals, 59 uniform float3 lightDir 61 uniform float3 lightDir, 62 uniform sampler2D aoTex 60 63 ) 61 64 { … … 64 67 float4 norm = tex2D(normals, IN.texCoord); 65 68 float4 color = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 69 float4 ao = tex2Dlod(aoTex, float4(IN.texCoord, 0, 0)); 66 70 67 71 float3 normal = normalize(norm.xyz); 68 float4 col = shade(IN, color, normal, lightDir );72 float4 col = shade(IN, color, normal, lightDir, ao); 69 73 70 74 OUT.color = col; 71 // store scaled view vector so wie don't have to normalize for e.g., ssao75 // store scaled view vector so wie don't have to normalize for later 72 76 //OUT.color.w = color.w / length(IN.view); 73 77 OUT.color.w = color.w; … … 172 176 173 177 float shadowTerm = CalcShadowTerm(IN, shadowMap, sampleWidth, 174 lightSpacePos.xy, lightSpacePos.z, samples, weights, noiseTex); 178 lightSpacePos.xy, lightSpacePos.z, samples, 179 weights, noiseTex); 175 180 diffuse *= shadowTerm; 176 181 }
Note: See TracChangeset
for help on using the changeset viewer.