|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions
gameplay::Effect Class Reference

`#include <Effect.h>`

Inheritance diagram for gameplay::Effect:

List of all members.

## 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 ()

## Detailed Description

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.

## Member Function Documentation

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.

Parameters:

  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.

Returns:
  The created effect.

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.

Parameters:

  vshSource | The vertex shader source code.
  fshSource | The fragment shader source code.
  defines | A new-line delimited list of preprocessor defines. May be NULL.

Returns:
  The created effect.

static Effect* gameplay::Effect::getCurrentEffect | ( |  | ) | `[static]`

Returns the currently bound effect for the rendering system.

Returns:
  The currently bound effect, or NULL if no effect is currently bound.

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.

Parameters:

  name | The name of the uniform to return.

Returns:
  The uniform, or NULL if no such uniform exists.

Uniform* gameplay::Effect::getUniform | ( | unsigned int | index | ) | const

Returns the specified active uniform.

Parameters:

  index | The index of the uniform to return.

Returns:
  The uniform, or NULL if index is invalid.

unsigned int gameplay::Effect::getUniformCount | ( |  | ) | const

Returns the number of active uniforms in this effect.

Returns:
  The number of active uniforms.

VertexAttribute gameplay::Effect::getVertexAttribute | ( | const char * | name | ) | const

Returns the vertex attribute handle for the vertex attribute with the specified name.

Parameters:

  name | The name of the vertex attribute to return.

Returns:
  The vertex attribute, or -1 if no such vertex attribute exists.

void gameplay::Effect::setValue | ( | Uniform * | uniform,
|  | float | value
| ) |  |

Sets a float uniform value.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  uniform | The uniform to set.
  values | The sampler array to set.
  count | The number of elements in the array.

All Classes Functions Variables Typedefs Enumerations Enumerator