#include <Model.h>
Public Member Functions | |
Mesh * | getMesh () const |
unsigned int | getMeshPartCount () const |
Material * | getMaterial (int partIndex=-1) |
void | setMaterial (Material *material, int partIndex=-1) |
Material * | setMaterial (const char *vshPath, const char *fshPath, const char *defines=NULL, int partIndex=-1) |
Material * | setMaterial (const char *materialPath, int partIndex=-1) |
bool | hasMaterial (unsigned int partIndex) const |
MeshSkin * | getSkin () const |
unsigned int | draw (bool wireframe=false) |
Static Public Member Functions | |
static Model * | create (Mesh *mesh) |
Defines a Model or mesh renderer which is an instance of a Mesh.
A model has a mesh that can be drawn with the specified materials for each of the mesh parts within it.
static Model* gameplay::Model::create | ( | Mesh * | mesh | ) | [static] |
Creates a new Model.
unsigned int gameplay::Model::draw | ( | bool | wireframe = false | ) | [virtual] |
Binds the vertex buffer and index buffers for the Mesh and all of its MeshPart's and draws the mesh geometry. Any other state necessary to render the Mesh, such as rendering states, shader state, and so on, should be set up before calling this method.
Implements gameplay::Drawable.
Material* gameplay::Model::getMaterial | ( | int | partIndex = -1 | ) |
Mesh* gameplay::Model::getMesh | ( | ) | const |
unsigned int gameplay::Model::getMeshPartCount | ( | ) | const |
MeshSkin* gameplay::Model::getSkin | ( | ) | const |
bool gameplay::Model::hasMaterial | ( | unsigned int | partIndex | ) | const |
void gameplay::Model::setMaterial | ( | Material * | material, |
int | partIndex = -1 |
||
) |
Sets a material to be used for drawing this Model.
The specified Material is applied for the MeshPart at the given index in this Model's Mesh. A partIndex of -1 sets a shared Material for all mesh parts, whereas a value of 0 or greater sets the Material for the specified mesh part only.
Mesh parts will use an explicitly set part material, if set; otherwise they will use the globally set material.
material | The new material. |
partIndex | The index of the mesh part to set the material for (-1 for shared material). |
Material* gameplay::Model::setMaterial | ( | const char * | vshPath, |
const char * | fshPath, | ||
const char * | defines = NULL , |
||
int | partIndex = -1 |
||
) |
Sets a material to be used for drawing this Model.
A Material is created from the given vertex and fragment shader source files. The Material is applied for the MeshPart at the given index in this Model's Mesh. A partIndex of -1 sets a shared Material for all mesh parts, whereas a value of 0 or greater sets the Material for the specified mesh part only.
Mesh parts will use an explicitly set part material, if set; otherwise they will use the globally set material.
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. |
partIndex | The index of the mesh part to set the material for (-1 for shared material). |
Material* gameplay::Model::setMaterial | ( | const char * | materialPath, |
int | partIndex = -1 |
||
) |
Sets a material to be used for drawing this Model.
A Material is created from the specified material file. The Material is applied for the MeshPart at the given index in this Model's Mesh. A partIndex of -1 sets a shared Material for all mesh parts, whereas a value of 0 or greater sets the Material for the specified mesh part only.
Mesh parts will use an explicitly set part material, if set; otherwise they will use the globally set material.
materialPath | The path to the material file. |
partIndex | The index of the mesh part to set the material for (-1 for shared material). |