Changeset 3003 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 10/03/08 18:42:33 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r2994 r3003 25 25 tempCohFactor=50.0f 26 26 27 useHDR= 127 useHDR=0 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3002 r3003 10 10 #include "Light.h" 11 11 12 #include <IL/il.h> 13 #include <assert.h> 14 12 15 13 16 using namespace std; 14 17 18 19 static void startil() 20 { 21 ilInit(); 22 assert(ilGetError() == IL_NO_ERROR); 23 } 24 25 26 static void stopil() 27 { 28 ilShutDown(); 29 assert(ilGetError() == IL_NO_ERROR); 30 } 15 31 16 32 namespace CHCDemoEngine … … 279 295 280 296 mDownSampleFbo = new FrameBufferObject(w / 2, h / 2, FrameBufferObject::DEPTH_NONE); 297 //mDownSampleFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 281 298 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 282 299 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); … … 902 919 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 903 920 904 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 921 // GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 922 GLuint colorsTex = mDownSampleFbo->GetColorBuffer(0)->GetTexture(); 905 923 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 906 924 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); … … 1267 1285 1268 1286 1287 static void ExportData(float *data, int w, int h) 1288 { 1289 startil(); 1290 1291 cout << "w: " << w << " h: " << h << endl; 1292 ILstring filename = ILstring("downsample2.jpg"); 1293 ilRegisterType(IL_FLOAT); 1294 1295 const int depth = 1; 1296 const int bpp = 4; 1297 1298 if (!ilTexImage(w, h, depth, bpp, IL_RGBA, IL_FLOAT, data)) 1299 { 1300 cerr << "IL error " << ilGetError() << endl; 1301 stopil(); 1302 return; 1303 } 1304 1305 if (!ilSaveImage(filename)) 1306 { 1307 cerr << "TGA write error " << ilGetError() << endl; 1308 } 1309 1310 stopil(); 1311 1312 // cout << "exported buffer" << endl; 1313 } 1314 1315 1269 1316 void DeferredRenderer::DownSample(FrameBufferObject *fbo) 1270 1317 { 1271 glPushAttrib(GL_VIEWPORT_BIT); 1272 glViewport(0, 0, mWidth, mHeight); 1318 //glPushAttrib(GL_VIEWPORT_BIT); 1319 glViewport(0, 0, mWidth / 2, mHeight / 2); 1320 1321 glMatrixMode(GL_PROJECTION); 1322 glPushMatrix(); 1323 glLoadIdentity(); 1324 1325 const float offs2 = 0.5f; 1326 glOrtho(-offs2, offs2, -offs2, offs2, 0, 1); 1327 1328 glMatrixMode(GL_MODELVIEW); 1329 glPushMatrix(); 1330 glLoadIdentity(); 1331 1273 1332 1274 1333 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); … … 1305 1364 FrameBufferObject::Release(); 1306 1365 1307 glPopAttrib(); 1366 //glPopAttrib(); 1367 glViewport(0, 0, mWidth, mHeight); 1308 1368 PrintGLerror("downsample"); 1369 1370 float *data = (float *)mDownSampleFbo->GetColorBuffer(0)->ReadTexture(); 1371 //float *data = (float *)mFbo->GetColorBuffer(colorBufferIdx)->ReadTexture(); 1372 ExportData(data, mWidth / 2, mHeight / 2); 1373 //ExportData(data, mWidth, mHeight); 1374 1375 glMatrixMode(GL_PROJECTION); 1376 glPopMatrix(); 1377 glMatrixMode(GL_MODELVIEW); 1378 glPopMatrix(); 1379 1380 delete [] data; 1381 1382 PrintGLerror("shadow map"); 1309 1383 } 1310 1384 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r3001 r3003 175 175 float w = norm.w; 176 176 // the current world position 177 const float4 centerPosition = tex2D(positions, IN.texCoord.xy);177 const float4 centerPosition2 = tex2D(positions, IN.texCoord.xy); 178 178 179 179 /// reconstruct position from the eye space depth 180 /*float3 viewDir = normalize(IN.view);180 float3 viewDir = normalize(IN.view); 181 181 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 182 182 … … 185 185 186 186 centerPosition.w = centerPosition2.w; 187 */ 187 188 188 // the current color 189 189 const float4 currentCol = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); … … 191 191 const float currentDepth = centerPosition.w; 192 192 193 GiStruct gi = globIllum(IN, colors, noiseTexture, samples, normal, centerPosition , w, eyePos, bl, br, tl, tr);193 GiStruct gi = globIllum(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr); 194 194 195 195 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r3002 r3003 33 33 average *= 1.0f / 4.0f; 34 34 35 return average;35 return tex2D(colors, IN.texCoord);//average; 36 36 } 37 37
Note: See TracChangeset
for help on using the changeset viewer.