Changeset 3002
- Timestamp:
- 10/03/08 17:16:48 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3001 r3002 36 36 static CGparameter sColorsTexLogLumParam; 37 37 38 static CGparameter sDownSampleOffsetParam; 38 39 39 40 … … 276 277 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 277 278 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 278 } 279 280 mDownSampleFbo = new FrameBufferObject(w / 2, h / 2, FrameBufferObject::DEPTH_NONE); 281 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 282 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 283 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 284 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 285 } 286 279 287 280 288 … … 535 543 "src/shaders/tonemap.cg", 536 544 RenderState::sCgFragmentProfile, 537 " GreyScaleDownSample",545 "DownSample", 538 546 NULL); 539 547 … … 543 551 544 552 // we need size of texture for scaling 545 sColorsTexDownSampleParam = cgGetNamedParameter(sCgDownSampleProgram, "colors"); 553 sColorsTexDownSampleParam = cgGetNamedParameter(sCgDownSampleProgram, "colors"); 554 sDownSampleOffsetParam = cgGetNamedParameter(sCgDownSampleProgram, "downSampleOffs"); 555 556 float downSampleOffsets[8]; 557 558 float w = 1028; 559 float h = 768; 560 561 float xoffs = 1 / w; 562 float yoffs = 1 / h; 563 564 downSampleOffsets[0] = xoffs; downSampleOffsets[1] = yoffs; 565 downSampleOffsets[2] = xoffs; downSampleOffsets[3] = -yoffs; 566 downSampleOffsets[4] = -xoffs; downSampleOffsets[5] = -yoffs; 567 downSampleOffsets[6] = -xoffs; downSampleOffsets[7] = yoffs; 568 569 cgGLSetParameterArray2f(sDownSampleOffsetParam, 0, 4, (const float *)downSampleOffsets); 546 570 } 547 571 else … … 602 626 break; 603 627 case GI: 628 DownSample(fbo); 604 629 ComputeGlobIllum(fbo, tempCohFactor, oldProjViewMatrix); 605 630 CombineIllum(fbo); … … 1244 1269 void DeferredRenderer::DownSample(FrameBufferObject *fbo) 1245 1270 { 1271 glPushAttrib(GL_VIEWPORT_BIT); 1272 glViewport(0, 0, mWidth, mHeight); 1273 1246 1274 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 1247 1275 GLuint colorsTex = colorBuffer->GetTexture(); … … 1277 1305 FrameBufferObject::Release(); 1278 1306 1279 PrintGLerror("ToneMapParams"); 1307 glPopAttrib(); 1308 PrintGLerror("downsample"); 1280 1309 } 1281 1310 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3001 r3002 668 668 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 669 669 // the positions buffer 670 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST , ColorBufferObject::FILTER_NEAREST);670 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST); 671 671 //fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 672 672 // the normals buffer 673 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST , ColorBufferObject::FILTER_NEAREST);673 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST); 674 674 // another color buffer 675 675 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r2999 r3002 22 22 float4 DownSample(frag IN, 23 23 uniform sampler2D colors, 24 float2 downSampleOffs[ 16]) : COLOR24 float2 downSampleOffs[4]) : COLOR 25 25 { 26 26 float4 average = .0f; 27 27 28 for(int i = 0; i < 16; ++ i)28 for(int i = 0; i < 4; ++ i) 29 29 { 30 30 average += tex2D(colors, IN.texCoord + downSampleOffs[i]); 31 31 } 32 32 33 average *= 1.0f / 16.0f;33 average *= 1.0f / 4.0f; 34 34 35 35 return average;
Note: See TracChangeset
for help on using the changeset viewer.