#include <Material.h>
Public Types | |
typedef std::string(* | PassCallback )(Pass *, void *) |
Public Member Functions | |
unsigned int | getTechniqueCount () const |
Technique * | getTechniqueByIndex (unsigned int index) const |
Technique * | getTechnique (const char *id) const |
Technique * | getTechnique () const |
void | setTechnique (const char *id) |
void | setNodeBinding (Node *node) |
Static Public Member Functions | |
static Material * | create (const char *url) |
static Material * | create (const char *url, PassCallback callback, void *cookie=NULL) |
static Material * | create (Properties *materialProperties) |
static Material * | create (Effect *effect) |
static Material * | create (const char *vshPath, const char *fshPath, const char *defines=NULL) |
Defines a material for an object to be rendered.
This class encapsulates a set of rendering techniques that can be used to render an object. This class facilitates loading of techniques using specified shaders or material files (.material). When multiple techniques are loaded using a material file, the current technique for an object can be set at runtime.
typedef std::string(* gameplay::Material::PassCallback)(Pass *, void *) |
Pass creation callback function definition.
static Material* gameplay::Material::create | ( | const char * | url | ) | [static] |
Creates a material using the data from the Properties object defined at the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
url | The URL pointing to the Properties object defining the material. |
static Material* gameplay::Material::create | ( | const char * | url, |
PassCallback | callback, | ||
void * | cookie = NULL |
||
) | [static] |
Creates a material from a Properties file.
This overloaded method allows you to pass a function pointer to be called back for each pass that is loaded for the material. The passed in callback receives a pointer to each Pass being created and returns a string of optional defines to append to the shaders being compiled for each Pass. The function is called during Pass creation, prior to compiling the shaders for that Pass. MaterialParameters can be safely modified in this callback even though the shader is not yet compiled.
url | The URL pointing to the Properties object defining the material. |
callback | Function pointer to be called during Pass creation. |
cookie | Optional custom parameter to be passed to the callback function. |
static Material* gameplay::Material::create | ( | Properties * | materialProperties | ) | [static] |
Creates a material from the specified properties object.
materialProperties | The properties object defining the material (must have namespace equal to 'material'). |
static Material* gameplay::Material::create | ( | Effect * | effect | ) | [static] |
static Material* gameplay::Material::create | ( | const char * | vshPath, |
const char * | fshPath, | ||
const char * | defines = NULL |
||
) | [static] |
Creates a material using the specified vertex and fragment shader.
The returned material has a single technique and a single pass for the given effect.
vshPath | Path to the vertex shader file. |
fshPath | Path to the fragment shader file. |
defines | New-line delimited list of preprocessor defines. |
Technique* gameplay::Material::getTechnique | ( | const char * | id | ) | const |
Returns the technique with the specified ID in this material.
id | The ID of the technique to return. |
Technique* gameplay::Material::getTechnique | ( | ) | const |
Returns this material's current technique.
Technique* gameplay::Material::getTechniqueByIndex | ( | unsigned int | index | ) | const |
Returns the technique at the specified index in this material.
index | The index of the technique to return. |
unsigned int gameplay::Material::getTechniqueCount | ( | ) | const |
Returns the number of techniques in the material.
void gameplay::Material::setNodeBinding | ( | Node * | node | ) | [virtual] |
Reimplemented from gameplay::RenderState.
void gameplay::Material::setTechnique | ( | const char * | id | ) |
Sets the current material technique.
id | ID of the technique to set. |