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 math::Vector3 &_center=math::Vector3::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 math::Vector3 &_center) |
Generate texture coordinates using spherical projection from center. More... | |
void | GetAABB (math::Vector3 &_center, math::Vector3 &_min_xyz, math::Vector3 &_max_xyz) 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... | |
math::Vector3 | GetMax () const |
Get the maximun X, Y, Z values. More... | |
math::Vector3 | GetMin () const |
Get the minimum X, Y, Z values. 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 (unsigned int _i) const |
Get a child mesh. More... | |
const SubMesh * | GetSubMesh (const std::string &_name) const |
Get a child mesh by name. 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... | |
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 math::Vector3 &_factor) |
Scale all vertices by the _factor vector. More... | |
void | SetSkeleton (Skeleton *_skel) |
Set the mesh skeleton. More... | |
void | Translate (const math::Vector3 &_vec) |
Move all vertices in all submeshes by _vec. More... | |
A 3D mesh.
gazebo::common::Mesh::Mesh | ( | ) |
Constructor.
|
virtual |
Destructor.
int gazebo::common::Mesh::AddMaterial | ( | Material * | _mat | ) |
Add a material to the mesh.
[in] | _mat | the material |
void gazebo::common::Mesh::AddSubMesh | ( | SubMesh * | _child | ) |
Add a submesh mesh.
The Mesh object takes ownership of the submesh.
[in] | _child | the 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.
[in] | _center | Location of the mesh center. |
void gazebo::common::Mesh::FillArrays | ( | float ** | _vertArr, |
int ** | _indArr | ||
) | const |
Put all the data into flat arrays.
[out] | _vertArr | the vertex array |
[out] | _indArr | the index array |
void gazebo::common::Mesh::GenSphericalTexCoord | ( | const math::Vector3 & | _center | ) |
Generate texture coordinates using spherical projection from center.
[in] | _center | the center of the projection |
void gazebo::common::Mesh::GetAABB | ( | math::Vector3 & | _center, |
math::Vector3 & | _min_xyz, | ||
math::Vector3 & | _max_xyz | ||
) | const |
Get AABB coordinate.
[out] | _center | of the bounding box |
[out] | _min_xyz | bounding box minimum values |
[out] | _max_xyz | bounding box maximum values |
unsigned int gazebo::common::Mesh::GetIndexCount | ( | ) | const |
Return the number of indices.
const Material* gazebo::common::Mesh::GetMaterial | ( | int | _index | ) | const |
Get a material.
[in] | _index | the index |
unsigned int gazebo::common::Mesh::GetMaterialCount | ( | ) | const |
Get the number of materials.
int gazebo::common::Mesh::GetMaterialIndex | ( | const Material * | _mat | ) | const |
Get the index of material.
[in] | _mat | the material |
math::Vector3 gazebo::common::Mesh::GetMax | ( | ) | const |
Get the maximun X, Y, Z values.
math::Vector3 gazebo::common::Mesh::GetMin | ( | ) | const |
Get the minimum X, Y, Z values.
std::string gazebo::common::Mesh::GetName | ( | ) | const |
Get the name of this mesh.
unsigned int gazebo::common::Mesh::GetNormalCount | ( | ) | const |
Return the number of normals.
std::string gazebo::common::Mesh::GetPath | ( | ) | const |
Get the path which contains the mesh resource.
Skeleton* gazebo::common::Mesh::GetSkeleton | ( | ) | const |
Get the skeleton to which this mesh is attached.
const SubMesh* gazebo::common::Mesh::GetSubMesh | ( | unsigned int | _i | ) | const |
Get a child mesh.
[in] | _i | the index |
const SubMesh* gazebo::common::Mesh::GetSubMesh | ( | const std::string & | _name | ) | const |
Get a child mesh by name.
[in] | _name | Name of the submesh. |
unsigned int gazebo::common::Mesh::GetSubMeshCount | ( | ) | const |
Get the number of children.
unsigned int gazebo::common::Mesh::GetTexCoordCount | ( | ) | const |
Return the number of texture coordinates.
unsigned int gazebo::common::Mesh::GetVertexCount | ( | ) | const |
Return the number of vertices.
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.
_factor | Scaling factor |
void gazebo::common::Mesh::SetName | ( | const std::string & | _n | ) |
Set the name of this mesh.
[in] | _n | the name to set |
void gazebo::common::Mesh::SetPath | ( | const std::string & | _path | ) |
Set the path which contains the mesh resource.
[in] | _path | the file path |
void gazebo::common::Mesh::SetScale | ( | const math::Vector3 & | _factor | ) |
Scale all vertices by the _factor vector.
[in] | _factor | Scaling 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.
[in] | _vec | Amount to translate vertices. |