Ignore:
Timestamp:
02/11/09 01:52:36 (15 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3296 r3297  
    652652#else 
    653653 
     654/** star filter 
     655*/ 
    654656void DeferredRenderer::PrepareSsaoFilter() 
    655657{ 
     
    662664        const float yoffs = (float)filterWidth / mHeight; 
    663665 
    664         for (int i = 0; i < NUM_SSAO_FILTER_SAMPLES / 2; ++ i) 
    665         { 
    666                 float x = xoffs * (i - NUM_SSAO_FILTER_SAMPLES / 4); 
    667                 float y = 0; 
     666        const int n = NUM_SSAO_FILTER_SAMPLES / 2 + 1; 
     667 
     668        for (int i = 0; i < n; ++ i) 
     669        { 
     670                const int idx = i - NUM_SSAO_FILTER_SAMPLES / 4; 
     671 
     672                const float x = xoffs * (float)idx; 
     673                const float y = 0; 
    668674 
    669675                ssaoFilterWeights[i] = GaussianDistribution(x, y, 1.0f); 
    670676                 
    671                 ssaoFilterOffsets[2 * i + 0] = xoffs; 
    672                 ssaoFilterOffsets[2 * i + 1] = yoffs; 
    673         } 
    674  
    675         for (int i = 0; i < NUM_SSAO_FILTER_SAMPLES / 2; ++ i) 
    676         { 
    677                 float x = 0; 
    678                 float y = yoffs * (i - NUM_SSAO_FILTER_SAMPLES / 4); 
    679  
    680                 ssaoFilterWeights[i] = GaussianDistribution(x, y, 1.0f); 
    681                 //ssaoFilterWeights[i] = 1.0f; 
    682  
    683                 ssaoFilterOffsets[2 * (NUM_SSAO_FILTER_SAMPLES / 2 + i) + 0] *= xoffs; 
    684                 ssaoFilterOffsets[2 * (NUM_SSAO_FILTER_SAMPLES / 2 + i) + 1] *= yoffs; 
     677                ssaoFilterOffsets[2 * i + 0] = x; 
     678                ssaoFilterOffsets[2 * i + 1] = y; 
     679        } 
     680 
     681        int j = 2 * n; 
     682 
     683        for (int i = 0; i < n; ++ i) 
     684        {  
     685                const int idx = i - NUM_SSAO_FILTER_SAMPLES / 4; 
     686 
     687                if (idx) 
     688                { 
     689                        const float x = 0; 
     690                        const float y = yoffs * (float)idx; 
     691 
     692                        ssaoFilterWeights[i] = GaussianDistribution(x, y, 1.0f); 
     693                        //ssaoFilterWeights[i] = 1.0f; 
     694                         
     695                        ssaoFilterOffsets[j + 0] = x; 
     696                        ssaoFilterOffsets[j + 1] = y; 
     697 
     698                        j += 2; 
     699                } 
     700        } 
     701 
     702        for (int i = 0; i < NUM_SSAO_FILTER_SAMPLES; ++ i) 
     703        { 
     704                cout << "samples " << i << ": " << ssaoFilterOffsets[i * 2] << " " << ssaoFilterOffsets[i * 2 + 1] << endl; 
    685705        } 
    686706} 
Note: See TracChangeset for help on using the changeset viewer.