Ignore:
Timestamp:
01/02/09 17:29:48 (15 years ago)
Author:
mattausch
Message:
 
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  
    8282        bvh->mNumNodes = 3; 
    8383 
     84        cout << "*******************\nbox: " << root->mBox << " area: " << root->mArea << endl; 
     85 
    8486        tQueue.push(root); 
    8587         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3235 r3242  
    302302mSavedFrameNumber(-1), 
    303303mSavedFrameSuffix(""), 
    304 mMaxDistance(1e6f) 
     304mMaxDistance(1e6f), 
     305mTempCohFactor(.0f), 
     306mUseToneMapping(false), 
     307mUseAntiAliasing(false), 
     308mUseDepthOfField(false) 
    305309{ 
    306310        /////////// 
     
    537541 
    538542void DeferredRenderer::Render(FrameBufferObject *fbo,  
    539                                                           float tempCohFactor, 
    540543                                                          DirectionalLight *light, 
    541                                                           bool useToneMapping, 
    542                                                           bool useAntiAliasing, 
    543544                                                          ShadowMap *shadowMap 
    544545                                                          ) 
     
    562563        { 
    563564        case SSAO: 
    564                 ComputeSsao(fbo, tempCohFactor); 
     565                ComputeSsao(fbo, mTempCohFactor); 
    565566                CombineSsao(fbo); 
    566567                break; 
    567568        case GI: 
    568                 ComputeGlobIllum(fbo, tempCohFactor); 
     569                ComputeGlobIllum(fbo, mTempCohFactor); 
    569570                CombineIllum(fbo); 
    570571                break; 
     
    574575        } 
    575576 
    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) 
    580584        { 
    581585                float imageKey, whiteLum, middleGrey; 
     
    593597        // multisampling is difficult / costly with deferred shading 
    594598        // at least do some edge blurring  
    595         if (useAntiAliasing) AntiAliasing(fbo, light, displayAfterAA);  
     599        if (mUseAntiAliasing) AntiAliasing(fbo, light, displayAfterAA);  
    596600         
    597601        /// store the current frame 
     
    599603 
    600604        // if it hasn't been done yet => just output the latest buffer 
    601         if (!useAntiAliasing || !displayAfterAA) 
     605        if (!mUseAntiAliasing || !displayAfterAA) 
    602606                Output(fbo);  
    603607 
     
    12661270                                                                  ) 
    12671271{ 
    1268         // light source not visible 
     1272        // light source visible? 
    12691273        if (!mSunVisiblePixels) return; 
    12701274 
     
    14371441 
    14381442 
    1439 void DeferredRenderer::SetSortSamples(bool sortSamples)  
     1443/*void DeferredRenderer::SetSortSamples(bool sortSamples)  
    14401444{ 
    14411445        mSortSamples = sortSamples;  
    1442 } 
     1446}*/ 
    14431447 
    14441448 
     
    14521456{ 
    14531457        mMaxDistance = maxDist; 
     1458} 
     1459 
     1460 
     1461void DeferredRenderer::SetUseToneMapping(bool toneMapping) 
     1462{ 
     1463        mUseToneMapping = toneMapping; 
     1464} 
     1465         
     1466 
     1467void DeferredRenderer::SetUseAntiAliasing(bool antiAliasing) 
     1468{ 
     1469        mUseAntiAliasing = antiAliasing; 
     1470} 
     1471 
     1472 
     1473void DeferredRenderer::SetUseDepthOfField(bool dof) 
     1474{ 
     1475        mUseDepthOfField = dof; 
     1476} 
     1477 
     1478 
     1479void DeferredRenderer::SetTemporalCoherenceFactorForSsao(float factor) 
     1480{ 
     1481        mTempCohFactor = factor; 
    14541482} 
    14551483 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h

    r3235 r3242  
    3636                and a buffer holding the difference of the pixel positions from the last frame. 
    3737 
    38                 Set useToneMapping to true if tone mapping should be applied 
    39                 Set useAntiAliasing true if some basic edge antialiasing should be performed 
    4038                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        /** 
    4292                The temporal coherence factor is the maximal number of ssao samples that are accumulated 
    4393                without losing any prior sample information. 
     
    4696                1000 samples a flickering cannot be seen. 
    4797        */ 
    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); 
    9199 
    92100 
     
    116124 
    117125        void CombineSsao(FrameBufferObject *fbo); 
     126 
    118127        void CombineIllum(FrameBufferObject *fbo); 
    119128        /** Does some basic antialiasing (searches for edges using a edge detector, 
     
    210219 
    211220        float mMaxDistance; 
     221 
     222        float mTempCohFactor; 
     223        bool mUseToneMapping; 
     224        bool mUseAntiAliasing; 
     225        bool mUseDepthOfField;     
    212226}; 
    213227 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3238 r3242  
    381381#endif 
    382382 
    383         cout << "=== reading environment file ===" << endl << endl; 
    384383 
    385384        int returnCode = 0; 
     
    582581 
    583582 
    584         int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); 
     583/*      int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); 
    585584         
    586585        for (int i = (int)dynamicObjects.size() - cityEntities; i < (int)dynamicObjects.size(); ++ i) 
    587586                dynamicObjects[i]->GetTransform()->SetMatrix(transl); 
    588  
     587*/ 
    589588 
    590589        /////////// 
     
    12951294                deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
    12961295                deferredShader->SetUseTemporalCoherence(useTemporalCoherence); 
    1297                 deferredShader->SetSortSamples(sortSamples); 
     1296                //deferredShader->SetSortSamples(sortSamples); 
     1297                deferredShader->SetTemporalCoherenceFactorForSsao(ssaoTempCohFactor); 
     1298                deferredShader->SetUseToneMapping(useHDR); 
     1299                deferredShader->SetUseAntiAliasing(useAntiAliasing); 
     1300 
    12981301 
    12991302                if (recordFrames && replayPath) 
     
    13071310 
    13081311                ShadowMap *sm = showShadowMap ? shadowMap : NULL; 
    1309                 deferredShader->Render(fbo, ssaoTempCohFactor, light, useHDR, useAntiAliasing, sm); 
     1312                deferredShader->Render(fbo, light, sm); 
    13101313        } 
    13111314 
Note: See TracChangeset for help on using the changeset viewer.