DeferredRenderer 1.0

PostProcessor Class Reference

Controller for the post process effects in your application. More...

#include <PostProcessor.h>

Collaboration diagram for PostProcessor:

List of all members.

Public Member Functions

 PostProcessor ()
 ctor
 PostProcessor (int _w, int _h, GLuint _vao)
 arg ctor
 ~PostProcessor ()
 dtor
void init ()
 initialize the post processor
void addEffect (const std::string &_effectName, Effect _e)
 add a user effect to the post process chain
void start ()
 start the postprocess chain
void finish ()
 end the postprocessor
void doEffect (const std::string &_effectName)
 explcict call to invoke effect
GLuint getFinalComposite ()
 return the last drawn effect

Private Attributes

GLuint m_finalComposite
 the most recently drawn effect
ScreenQuad m_screenQuad
 the full screen quad
std::map< std::string, Effectm_effects
 the effects chain
int m_width
 fbo w/h
int m_height
FrameBufferObject m_fbo
 the post process fbo
GLuint m_vao
 the quad vao
int m_currentAttachment
 the index of the current effect

Detailed Description

Controller for the post process effects in your application.

Definition at line 17 of file PostProcessor.h.


Constructor & Destructor Documentation

PostProcessor::PostProcessor ( ) [inline]

ctor

Definition at line 21 of file PostProcessor.h.

{}
PostProcessor::PostProcessor ( int  _w,
int  _h,
GLuint  _vao 
)

arg ctor

Parameters:
[in]_wfbo width
[in]_hfbo height
[in]_vaothe full screen quad vao

Definition at line 6 of file PostProcessor.cpp.

References FrameBufferObject::create(), Texture::generateEmpty(), Texture::id, and m_fbo.

                                                       :
                             m_screenQuad(0.0f, 0.0f, 0.5f, 1.0f),
                             m_width(_w),
                             m_height(_h),
                             m_fbo(_w,_h),
                             m_vao(_vao),
                             m_currentAttachment(0)
{
    Texture tmp("tmp");
    tmp.generateEmpty(_w, _h);
    m_fbo.create(tmp.id);
}

Here is the call graph for this function:

PostProcessor::~PostProcessor ( ) [inline]

dtor

Definition at line 30 of file PostProcessor.h.

{}

Member Function Documentation

void PostProcessor::addEffect ( const std::string &  _effectName,
Effect  _e 
)

add a user effect to the post process chain

Definition at line 19 of file PostProcessor.cpp.

References m_effects.

{
    m_effects.insert(std::pair<std::string, Effect>(_effectName, _e));
}

Here is the caller graph for this function:

void PostProcessor::doEffect ( const std::string &  _effectName)

explcict call to invoke effect

Definition at line 32 of file PostProcessor.cpp.

References FrameBufferObject::activateTarget(), FrameBufferObject::bindTextureSlot(), ScreenQuad::draw(), m_currentAttachment, m_effects, m_fbo, m_finalComposite, m_screenQuad, and m_vao.

{
    m_fbo.bindTextureSlot(m_currentAttachment, m_effects[_effectName].getOutputId());
    m_fbo.activateTarget(m_currentAttachment);

    m_currentAttachment++;
    if(m_currentAttachment > 3)
        m_currentAttachment = 0;

    m_effects[_effectName].prepare();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    m_screenQuad.draw(m_effects[_effectName].getShaderName(), m_vao);

    m_finalComposite = m_effects[_effectName].getOutputId();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PostProcessor::finish ( ) [inline]

end the postprocessor

Definition at line 42 of file PostProcessor.h.

References m_fbo, and FrameBufferObject::unbind().

Here is the call graph for this function:

Here is the caller graph for this function:

GLuint PostProcessor::getFinalComposite ( ) [inline]

return the last drawn effect

Definition at line 48 of file PostProcessor.h.

References m_finalComposite.

{return m_finalComposite;}

Here is the caller graph for this function:

void PostProcessor::init ( )

initialize the post processor

void PostProcessor::start ( )

start the postprocess chain

Definition at line 24 of file PostProcessor.cpp.

References FrameBufferObject::bind(), and m_fbo.

{
    m_fbo.bind();

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

the index of the current effect

Definition at line 71 of file PostProcessor.h.

std::map<std::string, Effect> PostProcessor::m_effects [private]

the effects chain

Definition at line 59 of file PostProcessor.h.

the post process fbo

Definition at line 65 of file PostProcessor.h.

the most recently drawn effect

Definition at line 53 of file PostProcessor.h.

int PostProcessor::m_height [private]

Definition at line 62 of file PostProcessor.h.

the full screen quad

Definition at line 56 of file PostProcessor.h.

GLuint PostProcessor::m_vao [private]

the quad vao

Definition at line 68 of file PostProcessor.h.

int PostProcessor::m_width [private]

fbo w/h

Definition at line 62 of file PostProcessor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines