|
Basic Renderer
|
A shader class that represents a program to be run on the GPU. More...
#include <Shader.h>
Classes | |
| struct | Attrib |
Public Types | |
| typedef std::unordered_map< std::string, GLint > | LocationMap |
| typedef std::unordered_map< std::string, Attrib > | AttribMap |
Public Member Functions | |
| Shader (const IShaderData &shaderData) | |
| Constructor. More... | |
| virtual | ~Shader () |
| Virtual destructor. More... | |
| virtual void | bind () |
| Binds the shader and its attributes. More... | |
| virtual void | setUniform (const std::string &name, const vmml::Matrix4f &arg) |
| Pass a 4 dimensional matrix to the shader. More... | |
| virtual void | setUniform (const std::string &name, const vmml::Matrix3f &arg) |
| Pass a 3 dimensional matrix to the shader. More... | |
| virtual void | setUniform (const std::string &name, const vmml::Vector4f &arg) |
| Pass a 4 dimensional vector to the shader. More... | |
| virtual void | setUniform (const std::string &name, const vmml::Vector3f &arg) |
| Pass a 3 dimensional vector to the shader. More... | |
| virtual void | setUniform (const std::string &name, GLfloat arg) |
| Pass a floating-point number to the shader. More... | |
| virtual void | setUniform (const std::string &name, TexturePtr texture) |
| Pass a texture to the shader. More... | |
| virtual GLint | registerUniform (const std::string &name) |
| Register a uniform. More... | |
| virtual GLint | registerAttrib (const std::string &name, GLint size, GLenum type, GLsizei stride, size_t offset) |
| Register an attribute. More... | |
| GLuint | getProgramID () |
| Returns the shader ID. More... | |
| virtual GLint | findUniformLocation (const std::string &name) |
| Returns uniform location (tries to register uniform if not already available) More... | |
| virtual GLint | findAttribLocation (const std::string &name, GLint size, GLenum type, GLsizei stride, size_t offset) |
| Returns attribute location (tries to register attribute if not already available) More... | |
| virtual GLint | getUniformLocation (const std::string &name) |
| Returns uniform location. More... | |
| virtual GLint | getAttribLocation (const std::string &name) |
| Returns attribute location. More... | |
| GLuint | getMaxLights () |
| Get the maximum number of lights used. More... | |
| bool | supportsVariableNumberOfLights () const |
| Returns true if the number of lights is variable in the shader. More... | |
| bool | supportsAmbientLighting () const |
| Returns true if the shader supports ambient lighting. More... | |
| bool | supportsDiffuseLighting () const |
| Returns true if the shader supports diffuse lighting. More... | |
| bool | supportsSpecularLighting () const |
| Returns true if the shader supports specular lighting. More... | |
| bool | supportsCubicReflectionMap () const |
| Returns true if the shader supports a cubic reflection map. More... | |
| template<typename T > | |
| void | setUniforms (const T &arg) |
| Sets multiple uniforms. More... | |
| GLint | getCurrentTexUnit () |
| Returns the current texture unit used in the shader. More... | |
| virtual void | deleteShader () |
| Deletes the shader. More... | |
Protected Member Functions | |
| virtual void | resetTexUnit () |
| virtual bool | compile (GLuint *shader, GLenum type, const std::string &src) |
| virtual bool | link () |
| virtual bool | validate () |
A shader class that represents a program to be run on the GPU.
| typedef std::unordered_map< std::string, Attrib > Shader::AttribMap |
| typedef std::unordered_map< std::string, GLint > Shader::LocationMap |
| Shader::Shader | ( | const IShaderData & | shaderData | ) |
Constructor.
| [in] | shaderData |
|
inlinevirtual |
Virtual destructor.
|
virtual |
Binds the shader and its attributes.
|
protectedvirtual |
|
inlinevirtual |
Deletes the shader.
|
virtual |
Returns attribute location (tries to register attribute if not already available)
| [in] | name | Attribute name |
| [in] | size | |
| [in] | type | |
| [in] | stride | |
| [in] | offset |
|
virtual |
Returns uniform location (tries to register uniform if not already available)
| [in] | name | Uniform name |
|
virtual |
Returns attribute location.
| [in] | name | Attribute name |
|
inline |
Returns the current texture unit used in the shader.
|
inline |
Get the maximum number of lights used.
|
inline |
Returns the shader ID.
|
virtual |
Returns uniform location.
| [in] | name | Uniform name |
|
protectedvirtual |
|
virtual |
Register an attribute.
| [in] | name | Attribute name |
| [in] | size | |
| [in] | type | |
| [in] | stride | |
| [in] | offset |
|
virtual |
Register a uniform.
| [in] | name | Uniform name |
|
protectedvirtual |
|
virtual |
Pass a 4 dimensional matrix to the shader.
| [in] | name | Uniform name |
| [in] | arg | 4 dimensional matrix |
|
virtual |
Pass a 3 dimensional matrix to the shader.
| [in] | name | Uniform name |
| [in] | arg | 3 dimensional matrix |
|
virtual |
Pass a 4 dimensional vector to the shader.
| [in] | name | Uniform name |
| [in] | arg | 4 dimensional vector |
|
virtual |
Pass a 3 dimensional vector to the shader.
| [in] | name | Uniform name |
| [in] | arg | 3 dimensional vector |
|
virtual |
Pass a floating-point number to the shader.
| [in] | name | Uniform name |
| [in] | arg | Floating-point number |
|
virtual |
Pass a texture to the shader.
| [in] | name | Uniform name |
| [in] | arg | Texture |
|
inline |
Sets multiple uniforms.
| [in] | arg | Data to pass to the shader |
|
inline |
Returns true if the shader supports ambient lighting.
|
inline |
Returns true if the shader supports a cubic reflection map.
|
inline |
Returns true if the shader supports diffuse lighting.
|
inline |
Returns true if the shader supports specular lighting.
|
inline |
Returns true if the number of lights is variable in the shader.
|
protectedvirtual |