- Timestamp:
- 10/12/08 11:46:50 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3021 r3025 66 66 static CGparameter sFilterOffsetsParam; 67 67 static CGparameter sFilterWeightsParam; 68 static CGparameter sPCFFilterWeightsParam; 68 69 69 70 static CGprogram sCgDownSampleProgram; … … 174 175 175 176 int DeferredRenderer::colorBufferIdx = 0; 177 178 179 180 static float GaussianDistribution(float x, float y, float rho) 181 { 182 float g = 1.0f / sqrtf(2.0f * M_PI * rho * rho); 183 g *= expf( -(x*x + y*y) / (2.0f * rho * rho)); 184 185 return g; 186 } 176 187 177 188 … … 380 391 ShaderProgram *pr; 381 392 382 383 393 sCgDeferredProgram = 384 394 cgCreateProgramFromFile(context, … … 583 593 sEyePosShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "eyePos"); 584 594 595 float filterWeights[NUM_PCF_TABS]; 596 597 sPCFFilterWeightsParam = cgGetNamedParameter(sCgDeferredShadowProgram, "weights"); 598 585 599 PoissonDiscSampleGenerator2 poisson(NUM_PCF_TABS, 1.0f); 586 600 poisson.Generate((float *)pcfSamples); 587 601 602 603 for (int i = 0; i < NUM_PCF_TABS; ++ i) 604 { 605 filterWeights[i] = GaussianDistribution(pcfSamples[i].x, pcfSamples[i].y, 1.0f); 606 } 607 588 608 cgGLSetParameterArray2f(sSamplesShadowParam, 0, NUM_PCF_TABS, (const float *)pcfSamples); 609 cgGLSetParameterArray1f(sPCFFilterWeightsParam, 0, NUM_PCF_TABS, (const float *)filterWeights); 589 610 590 611 pr = new ShaderProgram(sCgDeferredShadowProgram); … … 777 798 #endif 778 799 779 780 800 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 781 801 #if 0 … … 1129 1149 1130 1150 1131 static float GaussianDistribution(float x, float y, float rho)1132 {1133 float g = 1.0f / sqrtf(2.0f * M_PI * rho * rho);1134 g *= expf( -(x*x + y*y) / (2.0f * rho * rho));1135 1136 return g;1137 }1138 1139 1140 1151 void DeferredRenderer::CombineSsao(FrameBufferObject *fbo) 1141 1152 { … … 1238 1249 1239 1250 cgGLSetParameter1f(sSampleWidthParam, 2.0f / shadowMap->GetSize()); 1240 1251 1241 1252 1242 1253 cgGLSetMatrixParameterfc(sShadowMatrixParam, (const float *)shadowMatrix.x); … … 1441 1452 1442 1453 fbo->Bind(); 1443 #if 1 1454 1444 1455 colorBufferIdx = 3 - colorBufferIdx; 1445 1456 glDrawBuffers(1, mrt + colorBufferIdx); … … 1468 1479 1469 1480 glEnd(); 1470 #endif1471 1481 1472 1482 cgGLDisableTextureParameter(sColorsTexToneParam);
Note: See TracChangeset
for help on using the changeset viewer.