A 3D mesh. More...
#include <ignition/common/Mesh.hh>
Public Member Functions | |
Mesh () | |
Constructor. More... | |
virtual | ~Mesh () |
Destructor. More... | |
void | AABB (ignition::math::Vector3d &_center, ignition::math::Vector3d &_minXYZ, ignition::math::Vector3d &_maxXYZ) const |
Get axis-aligned bounding box in the mesh frame. More... | |
int | AddMaterial (const MaterialPtr &_mat) |
Add a material to the mesh. More... | |
std::weak_ptr< SubMesh > | AddSubMesh (const SubMesh &_child) |
Add a submesh mesh. This can be an expensive since _child is copied into this mesh. More... | |
std::weak_ptr< SubMesh > | AddSubMesh (std::unique_ptr< SubMesh > _child) |
Add a submesh mesh. This transfers ownership of _child to this mesh. The value of _child after this call is nullptr. More... | |
void | Center (const ignition::math::Vector3d &_center=ignition::math::Vector3d::Zero) |
Move the center of the mesh to the given coordinate in the mesh frame. This will move all the vertices in all submeshes. More... | |
void | FillArrays (double **_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... | |
bool | HasSkeleton () const |
Check if mesh is attached to a skeleton. More... | |
unsigned int | IndexCount () const |
Get the number of indices. More... | |
int | IndexOfMaterial (const Material *_mat) const |
Get the index of material. More... | |
MaterialPtr | MaterialByIndex (const unsigned int _index) const |
Get a material by index. More... | |
unsigned int | MaterialCount () const |
Get the number of materials. More... | |
ignition::math::Vector3d | Max () const |
Get the maximun X, Y, Z values. More... | |
SkeletonPtr | MeshSkeleton () const |
Get the skeleton to which this mesh is attached. More... | |
ignition::math::Vector3d | Min () const |
Get the minimum X, Y, Z values. More... | |
std::string | Name () const |
Get the name of this mesh. More... | |
unsigned int | NormalCount () const |
Get the number of normals. More... | |
std::string | Path () const |
Get the path which contains the mesh resource. More... | |
void | RecalculateNormals () |
Recalculate all the normals of each face defined by three indices. More... | |
void | Scale (const ignition::math::Vector3d &_factor) |
Scale all vertices by _factor. More... | |
void | SetName (const std::string &_name) |
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) |
Set the scale all vertices. More... | |
void | SetSkeleton (const SkeletonPtr &_skel) |
Set the mesh skeleton. More... | |
std::weak_ptr< SubMesh > | SubMeshByIndex (const unsigned int _index) const |
Get a child submesh by index. More... | |
std::weak_ptr< SubMesh > | SubMeshByName (const std::string &_name) const |
Get a child submesh by name. More... | |
unsigned int | SubMeshCount () const |
Get the number of child submeshes. More... | |
unsigned int | TexCoordCount () const |
Get the number of texture coordinates. More... | |
void | Translate (const ignition::math::Vector3d &_vec) |
Move all vertices in all submeshes by _vec. More... | |
unsigned int | VertexCount () const |
Get the number of vertices. More... | |
Detailed Description
A 3D mesh.
Constructor & Destructor Documentation
◆ Mesh()
Mesh | ( | ) |
Constructor.
◆ ~Mesh()
|
virtual |
Destructor.
Member Function Documentation
◆ AABB()
void AABB | ( | ignition::math::Vector3d & | _center, |
ignition::math::Vector3d & | _minXYZ, | ||
ignition::math::Vector3d & | _maxXYZ | ||
) | const |
Get axis-aligned bounding box in the mesh frame.
- Parameters
-
[out] _center Center of the bounding box [out] _minXYZ Bounding box minimum values [out] _maxXYZ Bounding box maximum values
◆ AddMaterial()
int AddMaterial | ( | const MaterialPtr & | _mat | ) |
Add a material to the mesh.
- Parameters
-
[in] _mat The material to add.
- Returns
- Index of this material
◆ AddSubMesh() [1/2]
std::weak_ptr<SubMesh> AddSubMesh | ( | const SubMesh & | _child | ) |
Add a submesh mesh. This can be an expensive since _child is copied into this mesh.
- Parameters
-
[in] _child the submesh
- Returns
- Weak pointer to the added submesh
◆ AddSubMesh() [2/2]
std::weak_ptr<SubMesh> AddSubMesh | ( | std::unique_ptr< SubMesh > | _child | ) |
Add a submesh mesh. This transfers ownership of _child to this mesh. The value of _child after this call is nullptr.
- Parameters
-
[in] _child the submesh
- Returns
- Weak pointer to the added submesh
◆ Center()
void Center | ( | const ignition::math::Vector3d & | _center = ignition::math::Vector3d::Zero | ) |
Move the center of the mesh to the given coordinate in the mesh frame. This will move all the vertices in all submeshes.
- Parameters
-
[in] _center Location of the mesh center.
◆ FillArrays()
void FillArrays | ( | double ** | _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 Center of the projection
◆ HasSkeleton()
bool HasSkeleton | ( | ) | const |
Check if mesh is attached to a skeleton.
- Returns
- True if mesh is attached to a skeleton.
◆ IndexCount()
unsigned int IndexCount | ( | ) | const |
Get the number of indices.
- Returns
- The number of indices
◆ IndexOfMaterial()
int IndexOfMaterial | ( | 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, or _mat is null.
◆ MaterialByIndex()
MaterialPtr MaterialByIndex | ( | const unsigned int | _index | ) | const |
Get a material by index.
- Parameters
-
[in] _index The index of the material.
- Returns
- The material or NULL if the index is out of bounds
◆ MaterialCount()
unsigned int MaterialCount | ( | ) | const |
Get the number of materials.
- Returns
- The number of materials
◆ Max()
ignition::math::Vector3d Max | ( | ) | const |
Get the maximun X, Y, Z values.
- Returns
- The upper bounds of the bounding box
◆ MeshSkeleton()
SkeletonPtr MeshSkeleton | ( | ) | const |
Get the skeleton to which this mesh is attached.
- Returns
- Pointer to skeleton or nullptr if none is present.
◆ Min()
ignition::math::Vector3d Min | ( | ) | const |
Get the minimum X, Y, Z values.
- Returns
- The lower bounds of the bounding box
◆ Name()
std::string Name | ( | ) | const |
Get the name of this mesh.
- Returns
- Name of the mesh.
◆ NormalCount()
unsigned int NormalCount | ( | ) | const |
Get the number of normals.
- Returns
- The number of normals
◆ Path()
std::string Path | ( | ) | const |
Get the path which contains the mesh resource.
- Returns
- The path to the mesh resource
◆ RecalculateNormals()
void RecalculateNormals | ( | ) |
Recalculate all the normals of each face defined by three indices.
◆ Scale()
void Scale | ( | const ignition::math::Vector3d & | _factor | ) |
Scale all vertices by _factor.
- Parameters
-
_factor Scaling factor
◆ SetName()
void SetName | ( | const std::string & | _name | ) |
Set the name of this mesh.
- Parameters
-
[in] _name 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 | ) |
Set the scale all vertices.
- Parameters
-
[in] _factor Scaling vector
◆ SetSkeleton()
void SetSkeleton | ( | const SkeletonPtr & | _skel | ) |
Set the mesh skeleton.
- Parameters
-
[in] _skel Skeleton to attach to the mesh.
◆ SubMeshByIndex()
std::weak_ptr<SubMesh> SubMeshByIndex | ( | const unsigned int | _index | ) | const |
Get a child submesh by index.
- Parameters
-
[in] _index Index of the submesh
- Returns
- The submesh or nullptr if the index is out of bounds.
◆ SubMeshByName()
std::weak_ptr<SubMesh> SubMeshByName | ( | const std::string & | _name | ) | const |
Get a child submesh by name.
- Parameters
-
[in] _name Name of the submesh.
- Returns
- The submesh or nullptr if the _name is not found.
◆ SubMeshCount()
unsigned int SubMeshCount | ( | ) | const |
Get the number of child submeshes.
- Returns
- The number of submeshes.
◆ TexCoordCount()
unsigned int TexCoordCount | ( | ) | const |
Get the number of texture coordinates.
- Returns
- The number of texture coordinates
◆ Translate()
void Translate | ( | const ignition::math::Vector3d & | _vec | ) |
Move all vertices in all submeshes by _vec.
- Parameters
-
[in] _vec Amount to translate vertices.
◆ VertexCount()
unsigned int VertexCount | ( | ) | const |
Get the number of vertices.
- Returns
- The number of vertices
The documentation for this class was generated from the following file: