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

List of all members.

Public Member Functions

MeshgetMesh () const
unsigned int getMeshPartCount () const
MaterialgetMaterial (int partIndex=-1)
void setMaterial (Material *material, int partIndex=-1)
MaterialsetMaterial (const char *vshPath, const char *fshPath, const char *defines=NULL, int partIndex=-1)
MaterialsetMaterial (const char *materialPath, int partIndex=-1)
bool hasMaterial (unsigned int partIndex) const
MeshSkingetSkin () const
unsigned int draw (bool wireframe=false)

Static Public Member Functions

static Modelcreate (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:
partIndexThe index of the mesh part whose Material to return (-1 for shared material).
Returns:
The requested Material, or NULL if no Material is set.

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.

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:
partIndexMeshPart 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:
materialThe new material.
partIndexThe 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:
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.
partIndexThe 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:
materialPathThe path to the material file.
partIndexThe 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