##

Mesh Class Reference
Common

A 3D mesh. More...

`#include <common/common.hh>`

## Public Member Functions

| Mesh ()
| Constructor. More...
virtual | ~Mesh ()
| Destructor. More...
int | AddMaterial (Material *_mat)
| Add a material to the mesh. More...
void | AddSubMesh (SubMesh *_child)
| Add a submesh mesh. More...
void | Center (const ignition::math::Vector3d &_center=ignition::math::Vector3d::Zero)
| Move the center of the mesh to the given coordinate. More...
void | FillArrays (float **_vertArr, int **_indArr) const
| Put all the data into flat arrays. More...
void | GenSphericalTexCoord (const ignition::math::Vector3d &_center)
| Generate texture coordinates using spherical projection from center. More...
void | GetAABB (ignition::math::Vector3d &_center, ignition::math::Vector3d &_minXYZ, ignition::math::Vector3d &_maxXYZ) const
| Get AABB coordinate. More...
unsigned int | GetIndexCount () const
| Return the number of indices. More...
const Material * | GetMaterial (int _index) const
| Get a material. More...
unsigned int | GetMaterialCount () const
| Get the number of materials. More...
int | GetMaterialIndex (const Material *_mat) const
| Get the index of material. More...
std::string | GetName () const
| Get the name of this mesh. More...
unsigned int | GetNormalCount () const
| Return the number of normals. More...
std::string | GetPath () const
| Get the path which contains the mesh resource. More...
Skeleton * | GetSkeleton () const
| Get the skeleton to which this mesh is attached. More...
const SubMesh * | GetSubMesh (const std::string &_name) const
| Get a child mesh by name. More...
const SubMesh * | GetSubMesh (unsigned int _i) const
| Get a child mesh. More...
unsigned int | GetSubMeshCount () const
| Get the number of children. More...
unsigned int | GetTexCoordCount () const
| Return the number of texture coordinates. More...
unsigned int | GetVertexCount () const
| Return the number of vertices. More...
bool | HasSkeleton () const
| Return true if mesh is attached to a skeleton. More...
ignition::math::Vector3d | Max () const
| Get the maximun X, Y, Z values. More...
ignition::math::Vector3d | Min () const
| Get the minimum X, Y, Z values. More...
void | RecalculateNormals ()
| Recalculate all the normals of each face defined by three indices. More...
void | Scale (double _factor)
| Scale all vertices by _factor. More...
void | SetName (const std::string &_n)
| Set the name of this mesh. More...
void | SetPath (const std::string &_path)
| Set the path which contains the mesh resource. More...
void | SetScale (const ignition::math::Vector3d &_factor)
| Scale all vertices by the _factor vector. More...
void | SetSkeleton (Skeleton *_skel)
| Set the mesh skeleton. More...
void | Translate (const ignition::math::Vector3d &_vec)
| Move all vertices in all submeshes by _vec. More...

## Detailed Description

A 3D mesh.

## Constructor & Destructor Documentation

## Mesh()

Mesh | ( |  | ) |

Constructor.

## ~Mesh()

virtual ~Mesh | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## AddMaterial()

int AddMaterial | ( | Material * | _mat | ) |

Add a material to the mesh.

Parameters

  [in] | _mat | the material

Returns
  Index of this material

## AddSubMesh()

void AddSubMesh | ( | SubMesh * | _child | ) |

Add a submesh mesh.

The Mesh object takes ownership of the submesh.

Parameters

  [in] | _child | the submesh

## Center()

void Center | ( | const ignition::math::Vector3d & | _center = `ignition::math::Vector3d::Zero` | ) |

Move the center of the mesh to the given coordinate.

This will move all the vertices in all submeshes.

Parameters

  [in] | _center | Location of the mesh center.

## FillArrays()

void FillArrays | ( | float ** | _vertArr,
|  | int ** | _indArr
| ) |  | const

Put all the data into flat arrays.

Parameters

  [out] | _vertArr | the vertex array
  [out] | _indArr | the index array

## GenSphericalTexCoord()

void GenSphericalTexCoord | ( | const ignition::math::Vector3d & | _center | ) |

Generate texture coordinates using spherical projection from center.

Parameters

  [in] | _center | the center of the projection

## GetAABB()

void GetAABB | ( | ignition::math::Vector3d & | _center,
|  | ignition::math::Vector3d & | _minXYZ,
|  | ignition::math::Vector3d & | _maxXYZ
| ) |  | const

Get AABB coordinate.

Parameters

  [out] | _center | of the bounding box
  [out] | _minXYZ | bounding box minimum values
  [out] | _maxXYZ | bounding box maximum values

## GetIndexCount()

unsigned int GetIndexCount | ( |  | ) | const

Return the number of indices.

Returns
  the count

## GetMaterial()

const Material* GetMaterial | ( | int | _index | ) | const

Get a material.

Parameters

  [in] | _index | the index

Returns
  the material or nullptr if the index is out of bounds

## GetMaterialCount()

unsigned int GetMaterialCount | ( |  | ) | const

Get the number of materials.

Returns
  the count

## GetMaterialIndex()

int GetMaterialIndex | ( | const Material * | _mat | ) | const

Get the index of material.

Parameters

  [in] | _mat | the material

Returns
  the index of the material or -1 if not found.

## GetName()

std::string GetName | ( |  | ) | const

Get the name of this mesh.

Returns
  the name

## GetNormalCount()

unsigned int GetNormalCount | ( |  | ) | const

Return the number of normals.

Returns
  the count

## GetPath()

std::string GetPath | ( |  | ) | const

Get the path which contains the mesh resource.

Returns
  the path to the mesh resource

## GetSkeleton()

Skeleton* GetSkeleton | ( |  | ) | const

Get the skeleton to which this mesh is attached.

Returns
  pointer to skeleton, or nullptr if none is present.

## GetSubMesh() [1/2]

const SubMesh* GetSubMesh | ( | const std::string & | _name | ) | const

Get a child mesh by name.

Parameters

  [in] | _name | Name of the submesh.

Returns
  The submesh, nullptr if the _name is not found.

## GetSubMesh() [2/2]

const SubMesh* GetSubMesh | ( | unsigned int | _i | ) | const

Get a child mesh.

Parameters

  [in] | _i | the index

Returns
  the submesh. An exception is thrown if the index is out of bounds

## GetSubMeshCount()

unsigned int GetSubMeshCount | ( |  | ) | const

Get the number of children.

Returns
  the count

## GetTexCoordCount()

unsigned int GetTexCoordCount | ( |  | ) | const

Return the number of texture coordinates.

Returns
  the count

## GetVertexCount()

unsigned int GetVertexCount | ( |  | ) | const

Return the number of vertices.

Returns
  the count

## HasSkeleton()

bool HasSkeleton | ( |  | ) | const

Return true if mesh is attached to a skeleton.

## Max()

ignition::math::Vector3d Max | ( |  | ) | const

Get the maximun X, Y, Z values.

Returns
  the upper bounds of the bounding box

## Min()

ignition::math::Vector3d Min | ( |  | ) | const

Get the minimum X, Y, Z values.

Returns
  the lower bounds of the bounding box

## RecalculateNormals()

void RecalculateNormals | ( |  | ) |

Recalculate all the normals of each face defined by three indices.

## Scale()

void Scale | ( | double | _factor | ) |

Scale all vertices by _factor.

Parameters

  _factor | Scaling factor

## SetName()

void SetName | ( | const std::string & | _n | ) |

Set the name of this mesh.

Parameters

  [in] | _n | the name to set

## SetPath()

void SetPath | ( | const std::string & | _path | ) |

Set the path which contains the mesh resource.

Parameters

  [in] | _path | the file path

## SetScale()

void SetScale | ( | const ignition::math::Vector3d & | _factor | ) |

Scale all vertices by the _factor vector.

Parameters

  [in] | _factor | Scaling vector

## SetSkeleton()

void SetSkeleton | ( | Skeleton * | _skel | ) |

Set the mesh skeleton.

## Translate()

void Translate | ( | const ignition::math::Vector3d & | _vec | ) |

Move all vertices in all submeshes by _vec.

Parameters

  [in] | _vec | Amount to translate vertices.

The documentation for this class was generated from the following file:

- Mesh.hh