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... | |
SubMesh (const SubMesh &_other) | |
Copy 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 ignition::math::Vector3d &_n) |
Add a normal to the mesh. More... | |
void | AddNormal (const double _x, const double _y, const double _z) |
Add a normal to the mesh. More... | |
void | AddTexCoord (const double _u, const double _v) |
Add a texture coord to the mesh. More... | |
void | AddTexCoord (const ignition::math::Vector2d &_uv) |
Add a texture coordinate to the mesh. More... | |
void | AddVertex (const ignition::math::Vector3d &_v) |
Add a vertex to the mesh. More... | |
void | AddVertex (const double _x, const double _y, const double _z) |
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... | |
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. 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 ignition::math::Vector3d &_factor) |
Scale all vertices by _factor. More... | |
void | Scale (const double &_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. 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... | |
unsigned int | TexCoordCount () const |
Return the number of texture coordinates. 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/3]
SubMesh | ( | ) |
Constructor.
◆ SubMesh() [2/3]
|
explicit |
Constructor.
- Parameters
-
_name Name of the submesh.
◆ SubMesh() [3/3]
◆ ~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 ignition::math::Vector3d & | _n | ) |
Add a normal to the mesh.
- Parameters
-
[in] _n The normal
◆ AddNormal() [2/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
◆ AddTexCoord() [1/2]
void AddTexCoord | ( | const double | _u, |
const double | _v | ||
) |
Add a texture coord to the mesh.
- Parameters
-
[in] _u Position along u [in] _v Position along v
◆ AddTexCoord() [2/2]
void AddTexCoord | ( | const ignition::math::Vector2d & | _uv | ) |
Add a texture coordinate to the mesh.
- Parameters
-
[in] _uv The texture coordinate
◆ AddVertex() [1/2]
void AddVertex | ( | const ignition::math::Vector3d & | _v | ) |
Add a vertex to the mesh.
- Parameters
-
[in] _v The new position
◆ AddVertex() [2/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
◆ 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.
◆ 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.
- Parameters
-
[in] _index Texture coordinate 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 ignition::math::Vector3d & | _factor | ) |
Scale all vertices by _factor.
- Parameters
-
[in] _factor Scaling factor
◆ Scale() [2/2]
void Scale | ( | const double & | _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.
- Parameters
-
[in] _index Index of the texture coordinate that will be set. [in] _uv The new texture coordinate
◆ 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
◆ TexCoordCount()
unsigned int TexCoordCount | ( | ) | const |
Return the number of texture coordinates.
- Returns
- The number of texture coordinates.
◆ 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: