|  | 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::Model Class Reference

`#include <Model.h>`

Inheritance diagram for gameplay::Model:

List of all members.

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

## Detailed Description

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.

## Member Function Documentation

static Model* gameplay::Model::create | ( | Mesh * | mesh | ) | `[static]`

Creates a new Model.

unsigned int gameplay::Model::draw | ( | bool | wireframe = `false` | ) | `[virtual]`

See also:
  Drawable::draw

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` | ) |

Returns the Material currently bound to the specified mesh part.

If partIndex is >= 0 and no Material is directly bound to the specified mesh part, the shared Material will be returned.

Parameters:

  partIndex | The index of the mesh part whose Material to return (-1 for shared material).

Returns:
  The requested Material, or NULL if no Material is set.

Mesh* gameplay::Model::getMesh | ( |  | ) | const

Returns the Mesh for this Model.

Returns:
  The Mesh for this Model.

unsigned int gameplay::Model::getMeshPartCount | ( |  | ) | const

Returns the number of parts in the Mesh for this Model.

Returns:
  The number of parts in the Mesh for this Model.

MeshSkin* gameplay::Model::getSkin | ( |  | ) | const

Returns the MeshSkin.

Returns:
  The MeshSkin, or NULL if one is not set.

bool gameplay::Model::hasMaterial | ( | unsigned int | partIndex | ) | const

Determines if a custom (non-shared) material is set for the specified part index.

Parameters:

  partIndex | MeshPart index.

Returns:
  True if a custom MeshPart material is set for the specified index, false otherwise.

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.

Parameters:

  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.

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.
  partIndex | The index of the mesh part to set the material for (-1 for shared material).

Returns:
  The newly created and bound Material, or NULL if the Material could not be created.

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.

Parameters:

  materialPath | The path to the material file.
  partIndex | The index of the mesh part to set the material for (-1 for shared material).

Returns:
  The newly created and bound Material, or NULL if the Material could not be created.

All Classes Functions Variables Typedefs Enumerations Enumerator