Changeset 3242 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 01/02/09 17:29:48 (15 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r3239 r3242 82 82 bvh->mNumNodes = 3; 83 83 84 cout << "*******************\nbox: " << root->mBox << " area: " << root->mArea << endl; 85 84 86 tQueue.push(root); 85 87 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3235 r3242 302 302 mSavedFrameNumber(-1), 303 303 mSavedFrameSuffix(""), 304 mMaxDistance(1e6f) 304 mMaxDistance(1e6f), 305 mTempCohFactor(.0f), 306 mUseToneMapping(false), 307 mUseAntiAliasing(false), 308 mUseDepthOfField(false) 305 309 { 306 310 /////////// … … 537 541 538 542 void DeferredRenderer::Render(FrameBufferObject *fbo, 539 float tempCohFactor,540 543 DirectionalLight *light, 541 bool useToneMapping,542 bool useAntiAliasing,543 544 ShadowMap *shadowMap 544 545 ) … … 562 563 { 563 564 case SSAO: 564 ComputeSsao(fbo, tempCohFactor);565 ComputeSsao(fbo, mTempCohFactor); 565 566 CombineSsao(fbo); 566 567 break; 567 568 case GI: 568 ComputeGlobIllum(fbo, tempCohFactor);569 ComputeGlobIllum(fbo, mTempCohFactor); 569 570 CombineIllum(fbo); 570 571 break; … … 574 575 } 575 576 576 /// do depth of field 577 DepthOfField(fbo); 578 579 if (useToneMapping) 577 /// depth of field 578 if (mUseDepthOfField) 579 { 580 DepthOfField(fbo); 581 } 582 583 if (mUseToneMapping) 580 584 { 581 585 float imageKey, whiteLum, middleGrey; … … 593 597 // multisampling is difficult / costly with deferred shading 594 598 // at least do some edge blurring 595 if ( useAntiAliasing) AntiAliasing(fbo, light, displayAfterAA);599 if (mUseAntiAliasing) AntiAliasing(fbo, light, displayAfterAA); 596 600 597 601 /// store the current frame … … 599 603 600 604 // if it hasn't been done yet => just output the latest buffer 601 if (! useAntiAliasing || !displayAfterAA)605 if (!mUseAntiAliasing || !displayAfterAA) 602 606 Output(fbo); 603 607 … … 1266 1270 ) 1267 1271 { 1268 // light source not visible1272 // light source visible? 1269 1273 if (!mSunVisiblePixels) return; 1270 1274 … … 1437 1441 1438 1442 1439 void DeferredRenderer::SetSortSamples(bool sortSamples)1443 /*void DeferredRenderer::SetSortSamples(bool sortSamples) 1440 1444 { 1441 1445 mSortSamples = sortSamples; 1442 } 1446 }*/ 1443 1447 1444 1448 … … 1452 1456 { 1453 1457 mMaxDistance = maxDist; 1458 } 1459 1460 1461 void DeferredRenderer::SetUseToneMapping(bool toneMapping) 1462 { 1463 mUseToneMapping = toneMapping; 1464 } 1465 1466 1467 void DeferredRenderer::SetUseAntiAliasing(bool antiAliasing) 1468 { 1469 mUseAntiAliasing = antiAliasing; 1470 } 1471 1472 1473 void DeferredRenderer::SetUseDepthOfField(bool dof) 1474 { 1475 mUseDepthOfField = dof; 1476 } 1477 1478 1479 void DeferredRenderer::SetTemporalCoherenceFactorForSsao(float factor) 1480 { 1481 mTempCohFactor = factor; 1454 1482 } 1455 1483 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3235 r3242 36 36 and a buffer holding the difference of the pixel positions from the last frame. 37 37 38 Set useToneMapping to true if tone mapping should be applied39 Set useAntiAliasing true if some basic edge antialiasing should be performed40 38 If a shadowMap is specified that is not NULL, the shadow mapped shading algorithm is applied. 41 39 */ 40 void Render(FrameBufferObject *fbo, 41 DirectionalLight *light, 42 ShadowMap *shadowMap = NULL 43 ); 44 45 46 enum SAMPLING_METHOD {SAMPLING_POISSON, SAMPLING_QUADRATIC, SAMPLING_DEFAULT}; 47 /** Use ssao or ssao + color bleeding 48 */ 49 enum SHADING_METHOD {DEFAULT, SSAO, GI}; 50 /** Set the samplig method for the indirect illumination 51 */ 52 void SetSamplingMethod(SAMPLING_METHOD s); 53 /** Set the shading method (SSAO, SSAO + color bleeding 54 */ 55 void SetShadingMethod(SHADING_METHOD s); 56 /** Sort the samples in order to provide faster texture accesses. 57 */ 58 //void SetSortSamples(bool sortSamples); 59 /** Sets ssao sample intensity. 60 */ 61 void SetSampleIntensity(float sampleIntensity); 62 /** Sets ssao kernel radius. 63 */ 64 void SetKernelRadius(float kernelRadius); 65 /** Sets ssao filter radius. 66 */ 67 void SetSsaoFilterRadius(float radius); 68 /** Passes the number of pixels that are visible from the sun. 69 */ 70 void SetSunVisiblePixels(int visiblePixels); 71 /** If true temporal coherence is used for ssao 72 */ 73 void SetUseTemporalCoherence(bool temporal); 74 /** if set to something other than -1 the current frame is stored on disc 75 using the specified frame number 76 */ 77 void SetSaveFrame(const std::string &suffix, int frameNumber); 78 /** Sets the maximal visible distance. 79 */ 80 void SetMaxDistance(float maxDist); 81 /** Enables / disables toneMapping 82 */ 83 void SetUseToneMapping(bool toneMapping); 84 85 /** Enable antiAliasing if some basic edge antialiasing should be performed 86 */ 87 void SetUseAntiAliasing(bool antiAliasing); 88 /** Enables / disables depth of field. 89 */ 90 void SetUseDepthOfField(bool dof); 91 /** 42 92 The temporal coherence factor is the maximal number of ssao samples that are accumulated 43 93 without losing any prior sample information. … … 46 96 1000 samples a flickering cannot be seen. 47 97 */ 48 void Render(FrameBufferObject *fbo, 49 float tempCohFactor, 50 DirectionalLight *light, 51 bool useToneMapping, 52 bool useAntiAliasing, 53 ShadowMap *shadowMap = NULL 54 ); 55 56 57 enum SAMPLING_METHOD {SAMPLING_POISSON, SAMPLING_QUADRATIC, SAMPLING_DEFAULT}; 58 /** Use ssao or ssao + color bleeding 59 */ 60 enum SHADING_METHOD {DEFAULT, SSAO, GI}; 61 /** Set the samplig method for the indirect illumination 62 */ 63 void SetSamplingMethod(SAMPLING_METHOD s); 64 /** Set the shading method (SSAO, SSAO + color bleeding 65 */ 66 void SetShadingMethod(SHADING_METHOD s); 67 /** Sort the samples so texture access is faster 68 */ 69 void SetSortSamples(bool sortSamples); 70 /** Sets ssao sample intensity. 71 */ 72 void SetSampleIntensity(float sampleIntensity); 73 /** Sets ssao kernel radius. 74 */ 75 void SetKernelRadius(float kernelRadius); 76 /** Sets ssao filter radius. 77 */ 78 void SetSsaoFilterRadius(float radius); 79 /** Sets the number of visible pixels of the sun 80 */ 81 void SetSunVisiblePixels(int visiblePixels); 82 /** If true tem poral coherence is used for ssao 83 */ 84 void SetUseTemporalCoherence(bool temporal); 85 /** if set to something other than -1 the current frame is stored on disc 86 using the specified frame number 87 */ 88 void SetSaveFrame(const std::string &suffix, int frameNumber); 89 90 void SetMaxDistance(float maxDist); 98 void SetTemporalCoherenceFactorForSsao(float factor); 91 99 92 100 … … 116 124 117 125 void CombineSsao(FrameBufferObject *fbo); 126 118 127 void CombineIllum(FrameBufferObject *fbo); 119 128 /** Does some basic antialiasing (searches for edges using a edge detector, … … 210 219 211 220 float mMaxDistance; 221 222 float mTempCohFactor; 223 bool mUseToneMapping; 224 bool mUseAntiAliasing; 225 bool mUseDepthOfField; 212 226 }; 213 227 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3238 r3242 381 381 #endif 382 382 383 cout << "=== reading environment file ===" << endl << endl;384 383 385 384 int returnCode = 0; … … 582 581 583 582 584 int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects);583 /* int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); 585 584 586 585 for (int i = (int)dynamicObjects.size() - cityEntities; i < (int)dynamicObjects.size(); ++ i) 587 586 dynamicObjects[i]->GetTransform()->SetMatrix(transl); 588 587 */ 589 588 590 589 /////////// … … 1295 1294 deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 1296 1295 deferredShader->SetUseTemporalCoherence(useTemporalCoherence); 1297 deferredShader->SetSortSamples(sortSamples); 1296 //deferredShader->SetSortSamples(sortSamples); 1297 deferredShader->SetTemporalCoherenceFactorForSsao(ssaoTempCohFactor); 1298 deferredShader->SetUseToneMapping(useHDR); 1299 deferredShader->SetUseAntiAliasing(useAntiAliasing); 1300 1298 1301 1299 1302 if (recordFrames && replayPath) … … 1307 1310 1308 1311 ShadowMap *sm = showShadowMap ? shadowMap : NULL; 1309 deferredShader->Render(fbo, ssaoTempCohFactor, light, useHDR, useAntiAliasing, sm);1312 deferredShader->Render(fbo, light, sm); 1310 1313 } 1311 1314
Note: See TracChangeset
for help on using the changeset viewer.