DeferredRenderer 1.0
|
Encapsulation of what an effect represents within this context effects have a shader, an output and several sources. More...
#include <Effect.h>
Public Member Functions | |
Effect () | |
ctor | |
Effect (GLuint _texId, const std::string &_shaderName) | |
argument ctor | |
~Effect () | |
dtor | |
void | addSourceTexture (const std::string &_samplerName, GLuint _texId) |
add a source texture to samples from | |
void | prepare () |
setup this effect for use, enabling texture 2d and shader | |
GLuint | getOutputId () |
access the texture id of this effects output | |
std::string | getShaderName () |
Private Attributes | |
std::vector< GLuint > | m_sources |
the texture handles of the effects sources | |
GLuint | m_output |
the texture handle of the output | |
std::string | m_shaderName |
the effects shadername |
Encapsulation of what an effect represents within this context effects have a shader, an output and several sources.
Effect::Effect | ( | GLuint | _texId, |
const std::string & | _shaderName | ||
) |
argument ctor
[in] | _texId | the output texture id |
[in] | _shaderName | the name of the ngl::shader used for this effect |
Definition at line 6 of file Effect.cpp.
:m_output(_texId),m_shaderName(_shaderName) { }
Effect::~Effect | ( | ) |
void Effect::addSourceTexture | ( | const std::string & | _samplerName, |
GLuint | _texId | ||
) |
add a source texture to samples from
[in] | _samplerName | the name of the uniform sampler in the fragment shader for this source |
[in] | _texId | the source texture id |
Definition at line 12 of file Effect.cpp.
References m_shaderName, and m_sources.
{ ngl::ShaderManager *shader = ngl::ShaderManager::instance(); (*shader)[m_shaderName]->use(); shader->setShaderParam1i(m_shaderName,_samplerName,m_sources.size()); m_sources.push_back(_texId); }
GLuint Effect::getOutputId | ( | ) | [inline] |
std::string Effect::getShaderName | ( | ) | [inline] |
Definition at line 41 of file Effect.h.
References m_shaderName.
{return m_shaderName;}
void Effect::prepare | ( | ) |
setup this effect for use, enabling texture 2d and shader
Definition at line 21 of file Effect.cpp.
References m_shaderName, and m_sources.
{ ngl::ShaderManager *shader = ngl::ShaderManager::instance(); (*shader)[m_shaderName]->use(); for(unsigned int i = 0; i < m_sources.size(); i++) { glActiveTexture(GL_TEXTURE0 + i); glBindTexture(GL_TEXTURE_2D, m_sources[i]); } }
GLuint Effect::m_output [private] |
std::string Effect::m_shaderName [private] |
std::vector<GLuint> Effect::m_sources [private] |