#include <Effect.h>
Public Member Functions | |
const char * | getId () const |
VertexAttribute | getVertexAttribute (const char *name) const |
Uniform * | getUniform (const char *name) const |
Uniform * | getUniform (unsigned int index) const |
unsigned int | getUniformCount () const |
void | setValue (Uniform *uniform, float value) |
void | setValue (Uniform *uniform, const float *values, unsigned int count=1) |
void | setValue (Uniform *uniform, int value) |
void | setValue (Uniform *uniform, const int *values, unsigned int count=1) |
void | setValue (Uniform *uniform, const Matrix &value) |
void | setValue (Uniform *uniform, const Matrix *values, unsigned int count=1) |
void | setValue (Uniform *uniform, const Vector2 &value) |
void | setValue (Uniform *uniform, const Vector2 *values, unsigned int count=1) |
void | setValue (Uniform *uniform, const Vector3 &value) |
void | setValue (Uniform *uniform, const Vector3 *values, unsigned int count=1) |
void | setValue (Uniform *uniform, const Vector4 &value) |
void | setValue (Uniform *uniform, const Vector4 *values, unsigned int count=1) |
void | setValue (Uniform *uniform, const Texture::Sampler *sampler) |
void | setValue (Uniform *uniform, const Texture::Sampler **values, unsigned int count) |
void | bind () |
Static Public Member Functions | |
static Effect * | createFromFile (const char *vshPath, const char *fshPath, const char *defines=NULL) |
static Effect * | createFromSource (const char *vshSource, const char *fshSource, const char *defines=NULL) |
static Effect * | getCurrentEffect () |
Defines an effect which can be applied during rendering.
An effect essentially wraps an OpenGL program object, which includes the vertex and fragment shader.
In the future, this class may be extended to support additional logic that typical effect systems support, such as GPU render state management, techniques and passes.
void gameplay::Effect::bind | ( | ) |
Binds this effect to make it the currently active effect for the rendering system.
static Effect* gameplay::Effect::createFromFile | ( | const char * | vshPath, |
const char * | fshPath, | ||
const char * | defines = NULL |
||
) | [static] |
Creates an effect using the specified vertex and fragment shader.
vshPath | The path to the vertex shader file. |
fshPath | The path to the fragment shader file. |
defines | A new-line delimited list of preprocessor defines. May be NULL. |
static Effect* gameplay::Effect::createFromSource | ( | const char * | vshSource, |
const char * | fshSource, | ||
const char * | defines = NULL |
||
) | [static] |
Creates an effect from the given vertex and fragment shader source code.
vshSource | The vertex shader source code. |
fshSource | The fragment shader source code. |
defines | A new-line delimited list of preprocessor defines. May be NULL. |
static Effect* gameplay::Effect::getCurrentEffect | ( | ) | [static] |
Returns the currently bound effect for the rendering system.
const char* gameplay::Effect::getId | ( | ) | const |
Returns the unique string identifier for the effect, which is a concatenation of the shader paths it was loaded from.
Uniform* gameplay::Effect::getUniform | ( | const char * | name | ) | const |
Returns the uniform handle for the uniform with the specified name.
name | The name of the uniform to return. |
Uniform* gameplay::Effect::getUniform | ( | unsigned int | index | ) | const |
Returns the specified active uniform.
index | The index of the uniform to return. |
unsigned int gameplay::Effect::getUniformCount | ( | ) | const |
Returns the number of active uniforms in this effect.
VertexAttribute gameplay::Effect::getVertexAttribute | ( | const char * | name | ) | const |
Returns the vertex attribute handle for the vertex attribute with the specified name.
name | The name of the vertex attribute to return. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
float | value | ||
) |
Sets a float uniform value.
uniform | The uniform to set. |
value | The float value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const float * | values, | ||
unsigned int | count = 1 |
||
) |
Sets a float array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
int | value | ||
) |
Sets an integer uniform value.
uniform | The uniform to set. |
value | The value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const int * | values, | ||
unsigned int | count = 1 |
||
) |
Sets an integer array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Matrix & | value | ||
) |
Sets a matrix uniform value.
uniform | The uniform to set. |
value | The value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Matrix * | values, | ||
unsigned int | count = 1 |
||
) |
Sets a matrix array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector2 & | value | ||
) |
Sets a vector uniform value.
uniform | The uniform to set. |
value | The value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector2 * | values, | ||
unsigned int | count = 1 |
||
) |
Sets a vector array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector3 & | value | ||
) |
Sets a vector uniform value.
uniform | The uniform to set. |
value | The value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector3 * | values, | ||
unsigned int | count = 1 |
||
) |
Sets a vector array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector4 & | value | ||
) |
Sets a vector uniform value.
uniform | The uniform to set. |
value | The value to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Vector4 * | values, | ||
unsigned int | count = 1 |
||
) |
Sets a vector array uniform value.
uniform | The uniform to set. |
values | The array to set. |
count | The number of elements in the array. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Texture::Sampler * | sampler | ||
) |
Sets a sampler uniform value.
uniform | The uniform to set. |
sampler | The sampler to set. |
void gameplay::Effect::setValue | ( | Uniform * | uniform, |
const Texture::Sampler ** | values, | ||
unsigned int | count | ||
) |
Sets a sampler array uniform value.
uniform | The uniform to set. |
values | The sampler array to set. |
count | The number of elements in the array. |