All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
gazebo::common::Mesh Class Reference

A 3D mesh. More...

#include <common/common.hh>

Public Member Functions

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

Detailed Description

A 3D mesh.

Constructor & Destructor Documentation

gazebo::common::Mesh::Mesh ( )

Constructor.

virtual gazebo::common::Mesh::~Mesh ( )
virtual

Destructor.

Member Function Documentation

int gazebo::common::Mesh::AddMaterial ( Material _mat)

Add a material to the mesh.

Parameters
[in]_matthe material
Returns
Index of this material
void gazebo::common::Mesh::AddSubMesh ( SubMesh _child)

Add a submesh mesh.

The Mesh object takes ownership of the submesh.

Parameters
[in]_childthe submesh
void gazebo::common::Mesh::Center ( const math::Vector3 _center = math::Vector3::Zero)

Move the center of the mesh to the given coordinate.

This will move all the vertices in all submeshes.

Parameters
[in]_centerLocation of the mesh center.
void gazebo::common::Mesh::FillArrays ( float **  _vertArr,
int **  _indArr 
) const

Put all the data into flat arrays.

Parameters
[out]_vertArrthe vertex array
[out]_indArrthe index array
void gazebo::common::Mesh::GenSphericalTexCoord ( const math::Vector3 _center)

Generate texture coordinates using spherical projection from center.

Parameters
[in]_centerthe center of the projection
void gazebo::common::Mesh::GetAABB ( math::Vector3 _center,
math::Vector3 _min_xyz,
math::Vector3 _max_xyz 
) const

Get AABB coordinate.

Parameters
[out]_centerof the bounding box
[out]_min_xyzbounding box minimum values
[out]_max_xyzbounding box maximum values
unsigned int gazebo::common::Mesh::GetIndexCount ( ) const

Return the number of indices.

Returns
the count
const Material* gazebo::common::Mesh::GetMaterial ( int  _index) const

Get a material.

Parameters
[in]_indexthe index
Returns
the material or NULL if the index is out of bounds
unsigned int gazebo::common::Mesh::GetMaterialCount ( ) const

Get the number of materials.

Returns
the count
math::Vector3 gazebo::common::Mesh::GetMax ( ) const

Get the maximun X, Y, Z values.

Returns
the upper bounds of the bounding box
math::Vector3 gazebo::common::Mesh::GetMin ( ) const

Get the minimum X, Y, Z values.

Returns
the lower bounds of the bounding box
std::string gazebo::common::Mesh::GetName ( ) const

Get the name of this mesh.

Returns
the name
unsigned int gazebo::common::Mesh::GetNormalCount ( ) const

Return the number of normals.

Returns
the count
std::string gazebo::common::Mesh::GetPath ( ) const

Get the path which contains the mesh resource.

Returns
the path to the mesh resource
Skeleton* gazebo::common::Mesh::GetSkeleton ( ) const

Get the skeleton to which this mesh is attached.

Returns
pointer to skeleton, or NULL if none is present.
const SubMesh* gazebo::common::Mesh::GetSubMesh ( unsigned int  _i) const

Get a child mesh.

Parameters
[in]_ithe index
Returns
the submesh. An exception is thrown if the index is out of bounds
const SubMesh* gazebo::common::Mesh::GetSubMesh ( const std::string &  _name) const

Get a child mesh by name.

Parameters
[in]_nameName of the submesh.
Returns
The submesh, NULL if the _name is not found.
unsigned int gazebo::common::Mesh::GetSubMeshCount ( ) const

Get the number of children.

Returns
the count
unsigned int gazebo::common::Mesh::GetTexCoordCount ( ) const

Return the number of texture coordinates.

Returns
the count
unsigned int gazebo::common::Mesh::GetVertexCount ( ) const

Return the number of vertices.

Returns
the count
bool gazebo::common::Mesh::HasSkeleton ( ) const

Return true if mesh is attached to a skeleton.

void gazebo::common::Mesh::RecalculateNormals ( )

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

void gazebo::common::Mesh::Scale ( double  _factor)

Scale all vertices by _factor.

Parameters
_factorScaling factor
void gazebo::common::Mesh::SetName ( const std::string &  _n)

Set the name of this mesh.

Parameters
[in]_nthe name to set
void gazebo::common::Mesh::SetPath ( const std::string &  _path)

Set the path which contains the mesh resource.

Parameters
[in]_paththe file path
void gazebo::common::Mesh::SetScale ( const math::Vector3 _factor)

Scale all vertices by the _factor vector.

Parameters
[in]_factorScaling vector
void gazebo::common::Mesh::SetSkeleton ( Skeleton _skel)

Set the mesh skeleton.

void gazebo::common::Mesh::Translate ( const math::Vector3 _vec)

Move all vertices in all submeshes by _vec.

Parameters
[in]_vecAmount to translate vertices.

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