Changeset 2899 for GTP


Ignore:
Timestamp:
09/03/08 13:02:39 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
10 edited

Legend:

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

    r2898 r2899  
    66#include "Camera.h" 
    77#include "shaderenv.h" 
    8 #include "RndGauss.h" 
    98#include "Halton.h" 
    109#include "ShadowMapping.h" 
     
    1211 
    1312using namespace std; 
    14  
    15 static GLenum mymrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT}; 
    1613 
    1714 
     
    130127        case DeferredRenderer::GAUSS: 
    131128                { 
    132                         static GaussianSampleGenerator gauss(NUM_SAMPLES, 0.5f); 
     129                        //static GaussianSampleGenerator gauss(NUM_SAMPLES, 0.5f); 
     130                        //gauss.Generate((Sample2 *)samples); 
     131 
     132                        static SphericalSampleGenerator gauss(NUM_SAMPLES, 0.5f); 
    133133                        gauss.Generate((Sample2 *)samples); 
    134134                } 
     
    508508        //mNewFbo->Bind(); 
    509509        mFbo->Bind(); 
    510         glDrawBuffers(1, mymrt + mFboIndex); 
     510        glDrawBuffers(1, mrt + mFboIndex); 
    511511 
    512512 
     
    657657 
    658658        colorBufferIdx = 3; 
    659         glDrawBuffers(1, mymrt + colorBufferIdx); 
     659        glDrawBuffers(1, mrt + colorBufferIdx); 
    660660 
    661661        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     
    727727        mFbo->Bind(); 
    728728 
    729         glDrawBuffers(2, mymrt + mFboIndex); 
     729        glDrawBuffers(2, mrt + mFboIndex); 
    730730 
    731731        //GLuint oldSsaoTex = mOldFbo->GetColorBuffer(0)->GetTexture(); 
     
    819819        // overwrite old color texture 
    820820        colorBufferIdx = 0; 
    821         glDrawBuffers(1, mymrt + colorBufferIdx); 
     821        glDrawBuffers(1, mrt + colorBufferIdx); 
    822822 
    823823        cgGLEnableProfile(RenderState::sCgFragmentProfile); 
     
    872872        // overwrite old color texture 
    873873        colorBufferIdx = 0; 
    874         glDrawBuffers(1, mymrt + colorBufferIdx); 
     874        glDrawBuffers(1, mrt + colorBufferIdx); 
    875875 
    876876        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     
    925925 
    926926        colorBufferIdx = 3; 
    927         glDrawBuffers(1, mymrt + colorBufferIdx); 
     927        glDrawBuffers(1, mrt + colorBufferIdx); 
    928928 
    929929         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp

    r2884 r2899  
    99{ 
    1010 
    11 GLenum color_attachment[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT}; 
    1211 
    1312void PrintFBOStatus(GLenum status) 
     
    7372         
    7473        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalFormat, w, h); 
    75         glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, color_attachment[attachment_idx], GL_RENDERBUFFER_EXT, mId); 
     74        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, mrt[attachment_idx], GL_RENDERBUFFER_EXT, mId); 
    7675 
    7776 
     
    8079        glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, GL_RGBA, glformat, NULL); 
    8180 
    82         glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, color_attachment[attachment_idx], GL_TEXTURE_2D, mTexId, 0); 
     81        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, mrt[attachment_idx], GL_TEXTURE_2D, mTexId, 0); 
    8382 
    8483        GLuint minfilterParam; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h

    r2878 r2899  
    88namespace CHCDemoEngine  
    99{  
     10 
    1011 
    1112 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp

    r2898 r2899  
    118118        //cout << "minDist after= " << minDist << endl; 
    119119} 
     120 
     121 
     122SphericalSampleGenerator::SphericalSampleGenerator(int numSamples, float radius): 
     123SampleGenerator(numSamples, radius) 
     124{} 
     125 
     126 
     127 
     128 
     129void SphericalSampleGenerator::Generate(Sample2 *samples) const 
     130{ 
     131        static HaltonSequence halton; 
     132        float r[2]; 
     133 
     134        for (int i = 0; i < mNumSamples; ++ i) 
     135        { 
     136                halton.GetNext(2, r); 
     137 
     138                // create stratified samples over sphere 
     139                const float rx = r[0]; 
     140                const float ry = r[1]; 
     141 
     142                const float theta = 2.0f * acos(sqrt(1.0f - rx)); 
     143                const float phi = 2.0f * M_PI * ry; 
     144 
     145                float x = sin(theta) * cos(phi); 
     146                float y = sin(theta) * sin(phi); 
     147                float z = cos(theta); 
     148 
     149                // project to disc 
     150                samples[i].x = x / z; 
     151                samples[i].y = y / z; 
     152        } 
     153} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h

    r2898 r2899  
    5353 
    5454 
     55class SphericalSampleGenerator: public SampleGenerator 
     56{ 
     57public: 
     58         
     59        SphericalSampleGenerator(int numSamples, float radius); 
     60 
     61        virtual void Generate(Sample2 *samples) const; 
     62}; 
     63 
     64 
    5565#endif 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp

    r2897 r2899  
    1919 
    2020 
    21 static GLenum mrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT}; 
    2221 
    2322 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp

    r2897 r2899  
    1313{ 
    1414 
    15 static GLenum mrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT}; 
    1615 
    1716static void PrintGLerror(char *msg) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2897 r2899  
    232232DeferredRenderer *ssaoShader = NULL; 
    233233 
    234 static GLenum mrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT}; 
    235234 
    236235 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/glInterface.h

    r2879 r2899  
    2323#endif   
    2424 
     25static GLenum mrt[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT}; 
     26 
     27 
    2528#endif // GLINTERFACE_H 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r2898 r2899  
    88//#define SAMPLE_INTENSITY 0.14f 
    99#define SAMPLE_INTENSITY 0.28f 
    10 //#define SAMPLE_INTENSITY 0.9f 
     10//#define SAMPLE_INTENSITY 1.0f 
    1111 
    1212//#define AREA_SIZE 20e-1f 
Note: See TracChangeset for help on using the changeset viewer.