overview wiki api reference download
 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:
gameplay::Ref

List of all members.

Public Member Functions

const char * getId () const
VertexAttribute getVertexAttribute (const char *name) const
UniformgetUniform (const char *name) const
UniformgetUniform (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 EffectcreateFromFile (const char *vshPath, const char *fshPath, const char *defines=NULL)
static EffectcreateFromSource (const char *vshSource, const char *fshSource, const char *defines=NULL)
static EffectgetCurrentEffect ()

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

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:
vshPathThe path to the vertex shader file.
fshPathThe path to the fragment shader file.
definesA 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:
vshSourceThe vertex shader source code.
fshSourceThe fragment shader source code.
definesA new-line delimited list of preprocessor defines. May be NULL.
Returns:
The created effect.

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:
nameThe 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:
indexThe 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:
nameThe 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:
uniformThe uniform to set.
valueThe float value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const float *  values,
unsigned int  count = 1 
)

Sets a float array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
int  value 
)

Sets an integer uniform value.

Parameters:
uniformThe uniform to set.
valueThe value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const int *  values,
unsigned int  count = 1 
)

Sets an integer array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
const Matrix value 
)

Sets a matrix uniform value.

Parameters:
uniformThe uniform to set.
valueThe value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const Matrix values,
unsigned int  count = 1 
)

Sets a matrix array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector2 value 
)

Sets a vector uniform value.

Parameters:
uniformThe uniform to set.
valueThe value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector2 values,
unsigned int  count = 1 
)

Sets a vector array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector3 value 
)

Sets a vector uniform value.

Parameters:
uniformThe uniform to set.
valueThe value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector3 values,
unsigned int  count = 1 
)

Sets a vector array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector4 value 
)

Sets a vector uniform value.

Parameters:
uniformThe uniform to set.
valueThe value to set.
void gameplay::Effect::setValue ( Uniform uniform,
const Vector4 values,
unsigned int  count = 1 
)

Sets a vector array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe array to set.
countThe number of elements in the array.
void gameplay::Effect::setValue ( Uniform uniform,
const Texture::Sampler sampler 
)

Sets a sampler uniform value.

Parameters:
uniformThe uniform to set.
samplerThe sampler to set.
void gameplay::Effect::setValue ( Uniform uniform,
const Texture::Sampler **  values,
unsigned int  count 
)

Sets a sampler array uniform value.

Parameters:
uniformThe uniform to set.
valuesThe sampler array to set.
countThe number of elements in the array.
 All Classes Functions Variables Typedefs Enumerations Enumerator