Tucano
0.1
A library for rapid prototyping with modern OpenGL and GLSL
|
The Effect class is a holder for Shaders. It is completely optional, but is contains a few methods for convenience, and is extremely useful to organize shaders belonging to a single effect (such as multipass strategies). More...
#include <effect.hpp>
Public Member Functions | |
Effect (string shadersDir="shaders/") | |
Default constructor. More... | |
virtual void | initialize (void)=0 |
Initializes all effect's funcionality. More... | |
virtual Shader * | loadShader (string shader_name) |
Loads a shader by filename, initializes it, and inserts in shaders list. More... | |
virtual void | loadShader (Shader &shader, string shader_name) |
virtual Shader * | loadShader (string shader_name, string vertex_name, string frag_name, string geom_name) |
Loads a shader by complete filenames (with extensions), initializes it, and inserts in shaders list. More... | |
void | setShadersDir (string dir) |
virtual void | reloadShaders (void) |
Reloads all shaders needed for effect usage. More... | |
Protected Attributes | |
std::vector< Shader * > | shaders_list |
Vector of pointers to shaders used in this effect, in case the user needs multiple pass rendering. More... | |
string | shaders_dir |
Directory in which the shader files are stored. More... | |
The Effect class is a holder for Shaders. It is completely optional, but is contains a few methods for convenience, and is extremely useful to organize shaders belonging to a single effect (such as multipass strategies).
This class should be extended in order to hold a full GLSL effect, it does not necessarily needs to be a render effect, but any GPU application. By loading the Shaders trough the loadShader method, the effect class also mantains the list of Shaders and can reload all shaders with a single call.
|
inline |
Default constructor.
shadersDir | The directory containing the shader files. |
|
pure virtual |
Initializes all effect's funcionality.
This method must be implemented in the extended class. It will typically hold the shader loading, however, if the application uses other parameters, their initialization can also be done in this method.
Implemented in Tucano::Effects::SSAO, Tucano::Effects::CameraBuffer, Tucano::Effects::ShadowMap, Tucano::Effects::Toon, Tucano::Effects::Phong, Tucano::Effects::Wireframe, Tucano::Effects::GradientFilter, Tucano::Effects::DirectColor, Tucano::Effects::OrenNayar, Tucano::Effects::RenderBuffer, Tucano::Effects::RenderTexture, Tucano::Effects::NormalMap, Tucano::Effects::PhongShadowmap, Tucano::Effects::MeanFilter, Tucano::Effects::BlurredNormalMap, and Tucano::Effects::Picking.
|
inlinevirtual |
Loads a shader by filename, initializes it, and inserts in shaders list.
The name should be passed without extensions, the method will automatically search the shader directory for shader extensions (vert, frag, geom, comp).
shader_name | String with filename without extensions. |
|
inlinevirtual |
|
inlinevirtual |
Loads a shader by complete filenames (with extensions), initializes it, and inserts in shaders list.
shader_name | String with name of the shader |
vertex_name | Vertex shader filename |
frag_name | Fragment shader filename |
geom_name | Geometry shader filename |
|
inlinevirtual |
Reloads all shaders needed for effect usage.
This method allows the user to change the shaders codes and see the results in real time, sparing him the need to restart the application.
|
inline |
|
protected |
Directory in which the shader files are stored.
|
protected |
Vector of pointers to shaders used in this effect, in case the user needs multiple pass rendering.