Changeset 2994 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 10/02/08 18:34:07 (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
r2986 r2994 24 24 # ssao temporal coherence factor 25 25 tempCohFactor=50.0f 26 27 useHDR=1 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2993 r2994 38 38 39 39 40 static CGprogram sCgInitialIntensityProgram;41 40 static CGprogram sCgDownSampleProgram; 42 41 static CGprogram sCgToneProgram; … … 129 128 static CGparameter sColorsTexInitialParam; 130 129 static CGparameter sColorsTexToneParam; 131 static CGparameter sIntensityTexDownSampleParam; 130 131 static CGparameter sColorsTexDownSampleParam; 132 132 133 133 //#define USE_3D_SSAO … … 532 532 cerr << "tone program failed to load" << endl; 533 533 534 /* 535 sCgInitialIntensityProgram = 534 sCgDownSampleProgram = 536 535 cgCreateProgramFromFile(context, 537 536 CG_SOURCE, … … 541 540 NULL); 542 541 543 if (sCg InitialIntensityProgram != NULL)544 { 545 cgGLLoadProgram(sCg InitialIntensityProgram);542 if (sCgDownSampleProgram != NULL) 543 { 544 cgGLLoadProgram(sCgDownSampleProgram); 546 545 547 546 // we need size of texture for scaling 548 sColorsTex InitialParam = cgGetNamedParameter(sCgInitialIntensityProgram, "colors");547 sColorsTexDownSampleParam = cgGetNamedParameter(sCgDownSampleProgram, "colors"); 549 548 } 550 549 else 551 550 cerr << "intensity program failed to load" << endl; 552 553 */554 551 555 552 PrintGLerror("init"); … … 1236 1233 1237 1234 cgGLDisableTextureParameter(sColorsTexLogLumParam); 1238 1239 1235 FrameBufferObject::Release(); 1240 1236 … … 1253 1249 void DeferredRenderer::DownSample(FrameBufferObject *fbo) 1254 1250 { 1255 GLuint intensityTex=0; 1251 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 1252 GLuint colorsTex = colorBuffer->GetTexture(); 1256 1253 1257 1254 cgGLEnableProfile(RenderState::sCgFragmentProfile); 1258 1255 cgGLBindProgram(sCgDownSampleProgram); 1259 1256 1260 cgGLSetTextureParameter(sIntensityTexDownSampleParam, intensityTex); 1261 cgGLEnableTextureParameter(sIntensityTexDownSampleParam); 1257 cgGLSetTextureParameter(sColorsTexDownSampleParam, colorsTex); 1258 cgGLEnableTextureParameter(sColorsTexDownSampleParam); 1259 1260 mDownSampleFbo->Bind(); 1261 1262 glDrawBuffers(1, mrt); 1263 1264 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1265 1266 cgGLEnableProfile(RenderState::sCgFragmentProfile); 1267 cgGLBindProgram(sCgDownSampleProgram); 1268 1269 const float offs = 0.5f; 1270 1271 glBegin(GL_QUADS); 1272 1273 glTexCoord2f(0, 0); glVertex3f(-offs, -offs, -0.5f); 1274 glTexCoord2f(1, 0); glVertex3f( offs, -offs, -0.5f); 1275 glTexCoord2f(1, 1); glVertex3f( offs, offs, -0.5f); 1276 glTexCoord2f(0, 1); glVertex3f(-offs, offs, -0.5f); 1277 1278 glEnd(); 1279 1280 cgGLDisableTextureParameter(sColorsTexDownSampleParam); 1281 1282 FrameBufferObject::Release(); 1283 1284 PrintGLerror("ToneMapParams"); 1262 1285 } 1263 1286 … … 1270 1293 { 1271 1294 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 1295 GLuint colorsTex = colorBuffer->GetTexture(); 1272 1296 1273 1297 fbo->Bind(); … … 1275 1299 colorBufferIdx = 3 - colorBufferIdx; 1276 1300 glDrawBuffers(1, mrt + colorBufferIdx); 1277 1278 1279 GLuint colorsTex = colorBuffer->GetTexture();1280 1301 1281 1302 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r2991 r2994 105 105 Camera *mCamera; 106 106 107 FrameBufferObject *mFbo;108 109 107 bool mUseTemporalCoherence; 110 108 … … 116 114 bool mRegenerateSamples; 117 115 116 // the main fbo we are working with 117 FrameBufferObject *mFbo; 118 119 FrameBufferObject *mDownSampleFbo; 118 120 }; 119 121 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2992 r2994 97 97 SkyPreetham *preetham = NULL; 98 98 99 /// the used render type for this render pass 100 enum RenderMethod 101 { 102 RENDER_FIXED, 103 RENDER_DEPTH_PASS, 104 RENDER_DEFERRED, 105 RENDER_DEPTH_PASS_DEFERRED, 106 RENDER_NUM_RENDER_TYPES 107 }; 108 109 /// one of four possible render methods 110 int renderMethod = RENDER_FIXED; 111 99 112 100 113 /// these values get scaled with the frame rate … … 133 146 int numBatches = 0; 134 147 135 bool showHelp = false;136 bool showStatistics = false;137 bool showOptions = true;138 bool showBoundingVolumes = false;139 bool visMode = false;140 148 141 149 // mouse navigation state … … 146 154 int horizontalMotionBegin = 0; 147 155 148 bool useOptimization = false;149 bool useTightBounds = true;150 bool useRenderQueue = true;151 bool useMultiQueries = true;152 bool flyMode = true;153 156 154 157 bool leftKeyPressed = false; … … 159 162 bool ascendKeyPressed = false; 160 163 164 bool showHelp = false; 165 bool showStatistics = false; 166 bool showOptions = true; 167 bool showBoundingVolumes = false; 168 bool visMode = false; 169 170 bool useOptimization = false; 171 bool useTightBounds = true; 172 bool useRenderQueue = true; 173 bool useMultiQueries = true; 174 bool flyMode = true; 175 161 176 bool useGlobIllum = false; 162 177 bool useTemporalCoherence = true; 178 bool showAlgorithmTime = false; 179 180 bool useFullScreen = false; 181 bool useLODs = true; 182 bool moveLight = false; 183 184 bool useAdvancedShading = false; 185 bool showShadowMap = false; 186 bool renderLightView = false; 187 188 bool altKeyPressed = false; 189 190 bool useHDR = true; 163 191 164 192 static float ssaoTempCohFactor = 255.0; 165 193 166 bool showAlgorithmTime = false;167 168 GLubyte *randomNormals = NULL;169 194 170 195 PerfTimer frameTimer, algTimer; … … 172 197 static int sCurrentMrtSet = 0; 173 198 174 /// the used render type for this render pass175 enum RenderMethod176 {177 RENDER_FIXED,178 RENDER_DEPTH_PASS,179 RENDER_DEFERRED,180 RENDER_DEPTH_PASS_DEFERRED,181 RENDER_NUM_RENDER_TYPES182 };183 184 /// one of four possible render methods185 int renderMethod = RENDER_FIXED;186 187 199 PerformanceGraph *perfGraph = NULL; 188 200 189 bool useFullScreen = false;190 191 bool useLODs = true;192 193 bool moveLight = false;194 201 195 202 //DeferredRenderer::SAMPLING_METHOD samplingMethod = DeferredRenderer::SAMPLING_POISSON; 196 203 DeferredRenderer::SAMPLING_METHOD samplingMethod = DeferredRenderer::SAMPLING_QUADRATIC; 197 204 198 bool useAdvancedShading = false;199 200 bool showShadowMap = false;201 bool shadowChanged = true;202 205 203 206 static Matrix4x4 matProjectionView = IdentityMatrix(); 204 207 205 bool renderLightView = false;206 208 207 209 ShadowMap *shadowMap = NULL; … … 213 215 SceneEntity *skyDome = NULL; 214 216 215 bool altKeyPressed = false;216 217 #define USE_TONE_MAPPING 0218 217 219 218 … … 345 344 env.GetBoolParam(string("useLODs"), useLODs); 346 345 env.GetIntParam(string("shadowSize"), shadowSize); 346 347 env.GetBoolParam(string("useHDR"), useHDR); 347 348 348 349 //env.GetStringParam(string("modelPath"), model_path); … … 845 846 846 847 847 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && USE_TONE_MAPPING;848 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && useHDR; 848 849 849 850 Vector3 sunAmbient; … … 1190 1191 1191 1192 ShadowMap *sm = showShadowMap ? shadowMap : NULL; 1192 ssaoShader->Render(fbo, oldViewProjMatrix, matProjectionView, ssaoTempCohFactor, light, USE_TONE_MAPPING, sm);1193 ssaoShader->Render(fbo, oldViewProjMatrix, matProjectionView, ssaoTempCohFactor, light, useHDR, sm); 1193 1194 } 1194 1195 … … 1255 1256 1256 1257 break; 1257 case 'h':1258 case 'H':1259 showHelp = !showHelp;1260 break;1261 1258 case '+': 1262 1259 if (maxBatchSize < 10) … … 1364 1361 case 'L': 1365 1362 renderLightView = !renderLightView; 1363 break; 1364 case 'h': 1365 case 'H': 1366 useHDR = !useHDR; 1366 1367 break; 1367 1368 default: … … 2027 2028 state.SetRenderPassType(RenderState::DEFERRED); 2028 2029 2029 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && USE_TONE_MAPPING;2030 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && useHDR; 2030 2031 2031 2032 preetham->RenderSkyDome(-light->GetDirection(), camera, &state, !useToneMapping);
Note: See TracChangeset
for help on using the changeset viewer.