A child mesh. More...
#include <SubMesh.hh>
Public Types | |
enum | PrimitiveType { POINTS, LINES, LINESTRIPS, TRIANGLES, TRIFANS, TRISTRIPS } |
An enumeration of the geometric mesh primitives. More... | |
Public Member Functions | |
SubMesh () | |
Constructor. More... | |
SubMesh (const std::string &_name) | |
Constructor. More... | |
virtual | ~SubMesh () |
Destructor. More... | |
void | AddIndex (const unsigned int _index) |
Add an index to the mesh. More... | |
void | AddNodeAssignment (const unsigned int _vertex, const unsigned int _node, const float _weight) |
Add a vertex - skeleton node assignment. More... | |
void | AddNormal (const double _x, const double _y, const double _z) |
Add a normal to the mesh. More... | |
void | AddNormal (const ignition::math::Vector3d &_n) |
Add a normal to the mesh. More... | |
void | AddTexCoord (const double _u, const double _v) |
Add a texture coord to the mesh. If multiple texture coordinate sets exist, this function adds it to the first texture coordinate set in the submesh. If no previous texture coordinates exist, it is added to set 0. More... | |
void | AddTexCoord (const ignition::math::Vector2d &_uv) |
Add a texture coordinate to the mesh. If multiple texture coordinate sets exist, this function adds it to the first texture coordinate set in the submesh. If no previous texture coordinates exist, it is added to set 0. More... | |
void | AddTexCoordBySet (const ignition::math::Vector2d &_uv, unsigned int _setIndex) |
Add a texture coord to a texture coordinate set of the mesh. More... | |
void | AddTexCoordBySet (double _u, double _v, unsigned int _setIndex) |
Add a texture coord to a texture coordinate set of the mesh. More... | |
void | AddVertex (const double _x, const double _y, const double _z) |
Add a vertex to the mesh. More... | |
void | AddVertex (const ignition::math::Vector3d &_v) |
Add a vertex to the mesh. More... | |
void | Center (const ignition::math::Vector3d &_center=ignition::math::Vector3d::Zero) |
Move the center of the submesh to the given coordinate. This will move all the vertices. More... | |
void | FillArrays (double **_vertArr, int **_indexndArr) 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 | GenSphericalTexCoordBySet (const ignition::math::Vector3d &_center, unsigned int _setIndex) |
Generate texture coordinates for a texture coordinate set using spherical projection from center. More... | |
bool | HasNodeAssignment (const unsigned int _index) const |
Return true if this submesh has the node assignment with the given index. More... | |
bool | HasNormal (const unsigned int _index) const |
Return true if this submesh has the normal with the given index. More... | |
bool | HasTexCoord (const unsigned int _index) const |
Return true if this submesh has the texture coordinate with the given index. If multiple texture coordinate sets exist, this function checks the first texture coordinate set in the submesh, which by default is set 0 unless AddTexCoordBySet is called with a different set index number the first time a texture coordinate is added. More... | |
bool | HasTexCoordBySet (unsigned int _index, unsigned int _setIndex) const |
Return true if this submesh has the texture coordinate with the given index in a texture coordinate set. More... | |
bool | HasVertex (const ignition::math::Vector3d &_v) const |
Return true if this submesh has the vertex. More... | |
bool | HasVertex (const unsigned int _index) const |
Return true if this submesh has the vertex with the given index. More... | |
int | Index (const unsigned int _index) const |
Get an index value from the index array. More... | |
unsigned int | IndexCount () const |
Return the number of indices. More... | |
int | IndexOfVertex (const ignition::math::Vector3d &_v) const |
Get the index of the vertex. More... | |
unsigned int | MaterialIndex () const |
Get the material index. More... | |
ignition::math::Vector3d | Max () const |
Get the maximum X, Y, Z values from all the vertices. More... | |
unsigned int | MaxIndex () const |
Get the highest value in the index array. More... | |
ignition::math::Vector3d | Min () const |
Get the minimum X, Y, Z values from all the vertices. More... | |
std::string | Name () const |
Get the name of this mesh. More... | |
NodeAssignment | NodeAssignmentByIndex (const unsigned int _index) const |
Get a vertex - skeleton node assignment. More... | |
unsigned int | NodeAssignmentsCount () const |
Get the number of vertex-skeleton node assignments. More... | |
ignition::math::Vector3d | Normal (const unsigned int _index) const |
Get a normal. More... | |
unsigned int | NormalCount () const |
Return the number of normals. More... | |
void | RecalculateNormals () |
Recalculate all the normals. More... | |
void | Scale (const double &_factor) |
Scale all vertices by _factor. More... | |
void | Scale (const ignition::math::Vector3d &_factor) |
Scale all vertices by _factor. More... | |
void | SetIndex (const unsigned int _index, const unsigned int _i) |
Set an index. More... | |
void | SetMaterialIndex (const unsigned int _index) |
Set the material index. Relates to the parent mesh material list. More... | |
void | SetName (const std::string &_name) |
Set the name of this mesh. More... | |
void | SetNormal (const unsigned int _index, const ignition::math::Vector3d &_n) |
Set a normal. More... | |
void | SetPrimitiveType (PrimitiveType _type) |
Set the primitive type. More... | |
void | SetTexCoord (const unsigned int _index, const ignition::math::Vector2d &_uv) |
Set a texture coordinate. If multiple texture coordinate sets exist, this function sets the texture coordinate in the first texture coordinate set in the submesh. More... | |
void | SetTexCoordBySet (unsigned int _index, const ignition::math::Vector2d &_uv, unsigned int _setIdex) |
Set a texture coordinate for a texture coordinate set. More... | |
void | SetVertex (const unsigned int _index, const ignition::math::Vector3d &_v) |
Set a vertex. More... | |
PrimitiveType | SubMeshPrimitiveType () const |
Get the primitive type. More... | |
ignition::math::Vector2d | TexCoord (const unsigned int _index) const |
Get a texture coordinate. More... | |
ignition::math::Vector2d | TexCoordBySet (unsigned int _index, unsigned int _setIndex) const |
Get a texture coordinate for a texture coordinate set. More... | |
unsigned int | TexCoordCount () const |
Return the number of texture coordinates. If multiple texture coordinate sets exist, this function checks the first texture coordinate set in the submesh, which by default is set 0, unless AddTexCoordBySet is called with a different set index number the first time a texture coordinate is added. More... | |
unsigned int | TexCoordCountBySet (unsigned int _setIndex) const |
Return the number of texture coordinates for a texture coordinate set. More... | |
unsigned int | TexCoordSetCount () const |
Return the number of texture coordinate sets. More... | |
void | Translate (const ignition::math::Vector3d &_vec) |
Move all vertices by _vec. More... | |
ignition::math::Vector3d | Vertex (const unsigned int _index) const |
Get a vertex. More... | |
unsigned int | VertexCount () const |
Get the number of vertices. More... | |
double | Volume () const |
Compute the volume of this submesh. The primitive type must be TRIANGLES. More... | |
Detailed Description
A child mesh.
Member Enumeration Documentation
◆ PrimitiveType
enum PrimitiveType |
An enumeration of the geometric mesh primitives.
Constructor & Destructor Documentation
◆ SubMesh() [1/2]
SubMesh | ( | ) |
Constructor.
◆ SubMesh() [2/2]
|
explicit |
Constructor.
- Parameters
-
_name Name of the submesh.
◆ ~SubMesh()
|
virtual |
Destructor.
Member Function Documentation
◆ AddIndex()
void AddIndex | ( | const unsigned int | _index | ) |
Add an index to the mesh.
- Parameters
-
[in] _index The new vertex index
◆ AddNodeAssignment()
void AddNodeAssignment | ( | const unsigned int | _vertex, |
const unsigned int | _node, | ||
const float | _weight | ||
) |
Add a vertex - skeleton node assignment.
- Parameters
-
[in] _vertex The vertex index [in] _node The node index [in] _weight The weight (between 0 and 1)
◆ AddNormal() [1/2]
void AddNormal | ( | const double | _x, |
const double | _y, | ||
const double | _z | ||
) |
Add a normal to the mesh.
- Parameters
-
[in] _x Position along x [in] _y Position along y [in] _z Position along z
◆ AddNormal() [2/2]
void AddNormal | ( | const ignition::math::Vector3d & | _n | ) |
Add a normal to the mesh.
- Parameters
-
[in] _n The normal
◆ AddTexCoord() [1/2]
void AddTexCoord | ( | const double | _u, |
const double | _v | ||
) |
Add a texture coord to the mesh. If multiple texture coordinate sets exist, this function adds it to the first texture coordinate set in the submesh. If no previous texture coordinates exist, it is added to set 0.
- Parameters
-
[in] _u Position along u [in] _v Position along v
- See also
- AddTexCoordBySet
◆ AddTexCoord() [2/2]
void AddTexCoord | ( | const ignition::math::Vector2d & | _uv | ) |
Add a texture coordinate to the mesh. If multiple texture coordinate sets exist, this function adds it to the first texture coordinate set in the submesh. If no previous texture coordinates exist, it is added to set 0.
- Parameters
-
[in] _uv The texture coordinate
- See also
- AddTexCoordBySet
◆ AddTexCoordBySet() [1/2]
void AddTexCoordBySet | ( | const ignition::math::Vector2d & | _uv, |
unsigned int | _setIndex | ||
) |
Add a texture coord to a texture coordinate set of the mesh.
- Parameters
-
[in] _u Position along u [in] _v Position along v [in] _setIndex Texture coordinate set index
◆ AddTexCoordBySet() [2/2]
void AddTexCoordBySet | ( | double | _u, |
double | _v, | ||
unsigned int | _setIndex | ||
) |
Add a texture coord to a texture coordinate set of the mesh.
- Parameters
-
[in] _u Position along u [in] _v Position along v [in] _setIndex Texture coordinate set index
◆ AddVertex() [1/2]
void AddVertex | ( | const double | _x, |
const double | _y, | ||
const double | _z | ||
) |
Add a vertex to the mesh.
- Parameters
-
[in] _x Position along x [in] _y Position along y [in] _z Position along z
◆ AddVertex() [2/2]
void AddVertex | ( | const ignition::math::Vector3d & | _v | ) |
Add a vertex to the mesh.
- Parameters
-
[in] _v The new position
◆ Center()
void Center | ( | const ignition::math::Vector3d & | _center = ignition::math::Vector3d::Zero | ) |
Move the center of the submesh to the given coordinate. This will move all the vertices.
- Parameters
-
[in] _center Location of the mesh center.
◆ FillArrays()
void FillArrays | ( | double ** | _vertArr, |
int ** | _indexndArr | ||
) | const |
Put all the data into flat arrays.
- Parameters
-
[in] _verArr The vertex array to be filled. [in] _indexndArr The index array to be filled.
◆ GenSphericalTexCoord()
void GenSphericalTexCoord | ( | const ignition::math::Vector3d & | _center | ) |
Generate texture coordinates using spherical projection from center.
- Parameters
-
[in] _center Center of the projection.
◆ GenSphericalTexCoordBySet()
void GenSphericalTexCoordBySet | ( | const ignition::math::Vector3d & | _center, |
unsigned int | _setIndex | ||
) |
Generate texture coordinates for a texture coordinate set using spherical projection from center.
- Parameters
-
[in] _center Center of the projection. [in] _setIndex Texture coordinate set index
◆ HasNodeAssignment()
bool HasNodeAssignment | ( | const unsigned int | _index | ) | const |
Return true if this submesh has the node assignment with the given index.
- Parameters
-
[in] _index Node assignment index
- Returns
- Return true if this submesh has the node assignment with the given _index.
◆ HasNormal()
bool HasNormal | ( | const unsigned int | _index | ) | const |
Return true if this submesh has the normal with the given index.
- Parameters
-
[in] _index Normal index
- Returns
- Return true if this submesh has the normal with the given _index.
◆ HasTexCoord()
bool HasTexCoord | ( | const unsigned int | _index | ) | const |
Return true if this submesh has the texture coordinate with the given index. If multiple texture coordinate sets exist, this function checks the first texture coordinate set in the submesh, which by default is set 0 unless AddTexCoordBySet is called with a different set index number the first time a texture coordinate is added.
- Parameters
-
[in] _index Texture coordinate index
- Returns
- Return true if this submesh has the texture coordinate with the given _index.
- See also
- HasTexCoordBySet
◆ HasTexCoordBySet()
bool HasTexCoordBySet | ( | unsigned int | _index, |
unsigned int | _setIndex | ||
) | const |
Return true if this submesh has the texture coordinate with the given index in a texture coordinate set.
- Parameters
-
[in] _index Texture coordinate index [in] _setIndex Texture coordinate set index
- Returns
- Return true if this submesh has the texture coordinate with the given _index.
◆ HasVertex() [1/2]
bool HasVertex | ( | const ignition::math::Vector3d & | _v | ) | const |
Return true if this submesh has the vertex.
- Parameters
-
[in] _v Vertex coordinate
- Returns
- Return true if this submesh has the vertex
◆ HasVertex() [2/2]
bool HasVertex | ( | const unsigned int | _index | ) | const |
Return true if this submesh has the vertex with the given index.
- Parameters
-
[in] _index Vertex index
- Returns
- Return true if this submesh has the vertex with the given _index.
◆ Index()
int Index | ( | const unsigned int | _index | ) | const |
Get an index value from the index array.
- Parameters
-
[in] _index Array index.
- Returns
- The index, or -1 if the _index is out of bounds.
◆ IndexCount()
unsigned int IndexCount | ( | ) | const |
Return the number of indices.
- Returns
- The number of indices.
◆ IndexOfVertex()
int IndexOfVertex | ( | const ignition::math::Vector3d & | _v | ) | const |
Get the index of the vertex.
- Parameters
-
[in] _v Vertex to check
- Returns
- Index of the vertex that matches _v.
◆ MaterialIndex()
unsigned int MaterialIndex | ( | ) | const |
Get the material index.
- Returns
- The assigned material index.
◆ Max()
ignition::math::Vector3d Max | ( | ) | const |
Get the maximum X, Y, Z values from all the vertices.
- Returns
- Max X,Y,Z values from all vertices in submesh
◆ MaxIndex()
unsigned int MaxIndex | ( | ) | const |
Get the highest value in the index array.
- Returns
- The highest index value.
◆ Min()
ignition::math::Vector3d Min | ( | ) | const |
Get the minimum X, Y, Z values from all the vertices.
- Returns
- Min X,Y,Z values from all vertices in submesh
◆ Name()
std::string Name | ( | ) | const |
Get the name of this mesh.
- Returns
- The name
◆ NodeAssignmentByIndex()
NodeAssignment NodeAssignmentByIndex | ( | const unsigned int | _index | ) | const |
Get a vertex - skeleton node assignment.
- Parameters
-
[in] _index The index of the assignment
- Returns
- The skeleton node assignment, or a default constructed skeleton node assignment when _index is invalid.
- See also
- bool HasNodeAssignment(const unsigned int _index) const;
◆ NodeAssignmentsCount()
unsigned int NodeAssignmentsCount | ( | ) | const |
Get the number of vertex-skeleton node assignments.
- Returns
- The number of vertex-skeleton node assignments
◆ Normal()
ignition::math::Vector3d Normal | ( | const unsigned int | _index | ) | const |
Get a normal.
- Parameters
-
[in] _index The normal index
- Returns
- The normal direction or ignition::math::Vector3d::Zero if index is out of bounds.
- See also
- bool HasNormal(const unsigned int _index);
◆ NormalCount()
unsigned int NormalCount | ( | ) | const |
Return the number of normals.
- Returns
- The number of normals.
◆ RecalculateNormals()
void RecalculateNormals | ( | ) |
Recalculate all the normals.
◆ Scale() [1/2]
void Scale | ( | const double & | _factor | ) |
Scale all vertices by _factor.
- Parameters
-
[in] _factor Scaling factor
◆ Scale() [2/2]
void Scale | ( | const ignition::math::Vector3d & | _factor | ) |
Scale all vertices by _factor.
- Parameters
-
[in] _factor Scaling factor
◆ SetIndex()
void SetIndex | ( | const unsigned int | _index, |
const unsigned int | _i | ||
) |
Set an index.
- Parameters
-
[in] _index Index of the indices [in] _i The new index value to set to
◆ SetMaterialIndex()
void SetMaterialIndex | ( | const unsigned int | _index | ) |
Set the material index. Relates to the parent mesh material list.
- Parameters
-
[in] _index Index to set the material to.
◆ SetName()
void SetName | ( | const std::string & | _name | ) |
Set the name of this mesh.
- Parameters
-
[in] _n The name to set
◆ SetNormal()
void SetNormal | ( | const unsigned int | _index, |
const ignition::math::Vector3d & | _n | ||
) |
Set a normal.
- Parameters
-
[in] _index Index of the normal that will be set. [in] _n The new normal direction
◆ SetPrimitiveType()
void SetPrimitiveType | ( | PrimitiveType | _type | ) |
Set the primitive type.
- Parameters
-
[in] _type The primitive type
◆ SetTexCoord()
void SetTexCoord | ( | const unsigned int | _index, |
const ignition::math::Vector2d & | _uv | ||
) |
Set a texture coordinate. If multiple texture coordinate sets exist, this function sets the texture coordinate in the first texture coordinate set in the submesh.
- Parameters
-
[in] _index Index of the texture coordinate that will be set. [in] _uv The new texture coordinate
- See also
- SetTexCoordBySet
◆ SetTexCoordBySet()
void SetTexCoordBySet | ( | unsigned int | _index, |
const ignition::math::Vector2d & | _uv, | ||
unsigned int | _setIdex | ||
) |
Set a texture coordinate for a texture coordinate set.
- Parameters
-
[in] _index Index of the texture coordinate that will be set. [in] _uv The new texture coordinate [in] _setIndex Texture coordinate set index
◆ SetVertex()
void SetVertex | ( | const unsigned int | _index, |
const ignition::math::Vector3d & | _v | ||
) |
Set a vertex.
- Parameters
-
[in] _index Index of the vertex [in] _v The new vertex coordinate
◆ SubMeshPrimitiveType()
PrimitiveType SubMeshPrimitiveType | ( | ) | const |
Get the primitive type.
- Returns
- The primitive type
◆ TexCoord()
ignition::math::Vector2d TexCoord | ( | const unsigned int | _index | ) | const |
Get a texture coordinate.
- Parameters
-
[in] _index the texture index
- Returns
- The texture coordinate or ignition::math::Vector2d::Zero if index is out of bounds.
- See also
- bool HasTexCoord(const unsigned int _index) const
◆ TexCoordBySet()
ignition::math::Vector2d TexCoordBySet | ( | unsigned int | _index, |
unsigned int | _setIndex | ||
) | const |
Get a texture coordinate for a texture coordinate set.
- Parameters
-
[in] _index the texture index
- Returns
- The texture coordinate or ignition::math::Vector2d::Zero if index is out of bounds.
- Parameters
-
[in] _setIndex Texture coordinate set index
- See also
- bool HasTexCoordBySet(unsigned int _index, unsigned int _setIndex) const
◆ TexCoordCount()
unsigned int TexCoordCount | ( | ) | const |
Return the number of texture coordinates. If multiple texture coordinate sets exist, this function checks the first texture coordinate set in the submesh, which by default is set 0, unless AddTexCoordBySet is called with a different set index number the first time a texture coordinate is added.
- Returns
- The number of texture coordinates.
- See also
- TexCoordCountBySet
◆ TexCoordCountBySet()
unsigned int TexCoordCountBySet | ( | unsigned int | _setIndex | ) | const |
Return the number of texture coordinates for a texture coordinate set.
- Parameters
-
[in] _setIndex Texture coordinate set index
- Returns
- The number of texture coordinates.
◆ TexCoordSetCount()
unsigned int TexCoordSetCount | ( | ) | const |
Return the number of texture coordinate sets.
- Returns
- The number of texture coordinates sets.
◆ Translate()
void Translate | ( | const ignition::math::Vector3d & | _vec | ) |
Move all vertices by _vec.
- Parameters
-
[in] _vec Amount to translate vertices.
◆ Vertex()
ignition::math::Vector3d Vertex | ( | const unsigned int | _index | ) | const |
Get a vertex.
- Parameters
-
[in] _index Index of the vertex
- Returns
- Coordinates of the vertex or ignition::math::Vector3d::Zero if the index is out of bounds.
- See also
- bool HasVertex(const unsigned int) const
◆ VertexCount()
unsigned int VertexCount | ( | ) | const |
Get the number of vertices.
- Returns
- The number of vertices.
◆ Volume()
double Volume | ( | ) | const |
Compute the volume of this submesh. The primitive type must be TRIANGLES.
This function utilizes the mesh volume formula from "Efficient feature extraction for 2d/3d objects in mesh representation" by Cha Zhang and Tsuhan Chen. Link: http://chenlab.ece.cornell.edu/Publication/Cha/icip01_Cha.pdf. The formula does not check for a closed (water tight) mesh.
- Returns
- The submesh's volume. The volume can be zero if the primitive type is not TRIANGLES, or there are no triangles.
The documentation for this class was generated from the following file: