![]() |
NDEVR
API Documentation
|
A Shader for rendering default OpenGL logic to the graphics card. More...
Classes | |
| struct | Definition |
| Defines the set of features a shader must support, used to select or compile the correct variant. More... | |
Public Types | |
| enum | ShaderPart { Vertex , Fragment , Geometry } |
| Identifies a stage within the shader pipeline. More... | |
| enum | ShaderType { e_points , e_linework , e_solid , e_shader_type_size , e_all } |
| Classifies the type of geometry a shader is designed to render. More... | |
Public Member Functions | |
| GLESShader (const Definition &def, const DynamicPointer< GLESGraphicsDevice > &device) | |
| Constructs a GLESShader from a definition and device. | |
| ~GLESShader () | |
| Destroys the shader and releases GPU programs. | |
| void | bind () |
| Binds this shader program for use. | |
| String | buildFragmentSource () const |
| Builds the complete fragment shader source string for the current definition. | |
| String | buildVertexSource () const |
| Builds the complete vertex shader source string for the current definition. | |
| bool | checkID (int id, std::size_t value) |
| Checks if a uniform value has changed since last set. | |
| void | compile (ShaderPart type, const char *src) |
| Compiles a single shader stage from source. | |
| void | compileAndLink () |
| Compiles all shader stages and links the program. | |
| const Definition & | definition () const |
| Returns the shader definition. | |
| uint04 | id () const |
| Returns the unique identifier of this shader based on its definition. | |
| void | linkShader () |
| Links all compiled shader stages into a program. | |
| template<class t_type> | |
| void | setUniformValue (const char *const location, const t_type &value) |
| Sets a uniform value by name. | |
| void | unBind () |
| Unbinds this shader program. | |
| int | uniformLocation (const char *const location) const |
| Returns the uniform location for a named variable. | |
| int | uniformLocation (uint08 hash, const char *const location) const |
| Returns the uniform location using a pre-computed hash. | |
| String | versionedShaderCode (ShaderPart type, const String &src) const |
| Prepends the appropriate GLSL version directive and defines to shader source. | |
Static Public Member Functions | |
| static GLESShader * | BoundShader () |
| Returns the currently bound shader. | |
A Shader for rendering default OpenGL logic to the graphics card.
Definition at line 15 of file GLESShader.h.
Identifies a stage within the shader pipeline.
| Enumerator | |
|---|---|
| Vertex | Vertex shader stage. |
| Fragment | Fragment shader stage. |
| Geometry | Geometry shader stage. |
Definition at line 29 of file GLESShader.h.
Classifies the type of geometry a shader is designed to render.
Definition at line 19 of file GLESShader.h.
| GLESShader::GLESShader | ( | const Definition & | def, |
| const DynamicPointer< GLESGraphicsDevice > & | device ) |
Constructs a GLESShader from a definition and device.
| [in] | def | The shader feature definition. |
| [in] | device | The OpenGL graphics device. |
Referenced by BoundShader().
|
static |
Returns the currently bound shader.
References GLESShader().
| String GLESShader::buildFragmentSource | ( | ) | const |
Builds the complete fragment shader source string for the current definition.
| String GLESShader::buildVertexSource | ( | ) | const |
Builds the complete vertex shader source string for the current definition.
| bool GLESShader::checkID | ( | int | id, |
| std::size_t | value ) |
Checks if a uniform value has changed since last set.
| [in] | id | The uniform location. |
| [in] | value | The hash of the new value. |
| void GLESShader::compile | ( | ShaderPart | type, |
| const char * | src ) |
Compiles a single shader stage from source.
| [in] | type | The shader stage. |
| [in] | src | The GLSL source code. |
|
inline |
Returns the shader definition.
Definition at line 248 of file GLESShader.h.
| uint04 GLESShader::id | ( | ) | const |
Returns the unique identifier of this shader based on its definition.
|
inline |
Sets a uniform value by name.
| [in] | location | The uniform variable name. |
| [in] | value | The value to set. |
Definition at line 185 of file GLESShader.h.
References setUniformValue(), and uniformLocation().
Referenced by setUniformValue().
|
inline |
Returns the uniform location for a named variable.
| [in] | location | The uniform variable name. |
Definition at line 106 of file GLESShader.h.
References String::hash(), and uniformLocation().
Referenced by setUniformValue(), and uniformLocation().
| int GLESShader::uniformLocation | ( | uint08 | hash, |
| const char *const | location ) const |
Returns the uniform location using a pre-computed hash.
| [in] | hash | The hash of the variable name. |
| [in] | location | The uniform variable name. |
| String GLESShader::versionedShaderCode | ( | ShaderPart | type, |
| const String & | src ) const |
Prepends the appropriate GLSL version directive and defines to shader source.
| [in] | type | The shader stage. |
| [in] | src | The original GLSL source. |