Ignition Common

API Reference

3.0.0

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...
 

Detailed Description

A child mesh.

Member Enumeration Documentation

◆ PrimitiveType

An enumeration of the geometric mesh primitives.

Enumerator
POINTS 

Point. 1 vertex per point.

LINES 

Line. 2 vertices per line.

LINESTRIPS 

Connected lines. 2 vertices for the first line and every vertex specified afterwards creates a new line.

TRIANGLES 

Triangle type. 3 vertices per triangle.

TRIFANS 

Connected triangle in fan shape. 3 vertices for the first triangle and every vertex specified afterwards creates a new triangle.

TRISTRIPS 

Connected triangle. 3 vertices for the first triangle and every vertex specified afterwards creates a new triangle.

Constructor & Destructor Documentation

◆ SubMesh() [1/3]

SubMesh ( )

Constructor.

◆ SubMesh() [2/3]

SubMesh ( const std::string _name)
explicit

Constructor.

Parameters
_nameName of the submesh.

◆ SubMesh() [3/3]

SubMesh ( const SubMesh _other)

Copy Constructor.

_other Other mesh object

◆ ~SubMesh()

virtual ~SubMesh ( )
virtual

Destructor.

Member Function Documentation

◆ AddIndex()

void AddIndex ( const unsigned int  _index)

Add an index to the mesh.

Parameters
[in]_indexThe 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]_vertexThe vertex index
[in]_nodeThe node index
[in]_weightThe weight (between 0 and 1)

◆ AddNormal() [1/2]

void AddNormal ( const ignition::math::Vector3d _n)

Add a normal to the mesh.

Parameters
[in]_nThe normal

◆ AddNormal() [2/2]

void AddNormal ( const double  _x,
const double  _y,
const double  _z 
)

Add a normal to the mesh.

Parameters
[in]_xPosition along x
[in]_yPosition along y
[in]_zPosition along z

◆ AddTexCoord() [1/2]

void AddTexCoord ( const double  _u,
const double  _v 
)

Add a texture coord to the mesh.

Parameters
[in]_uPosition along u
[in]_vPosition along v

◆ AddTexCoord() [2/2]

void AddTexCoord ( const ignition::math::Vector2d _uv)

Add a texture coordinate to the mesh.

Parameters
[in]_uvThe texture coordinate

◆ AddVertex() [1/2]

void AddVertex ( const ignition::math::Vector3d _v)

Add a vertex to the mesh.

Parameters
[in]_vThe new position

◆ AddVertex() [2/2]

void AddVertex ( const double  _x,
const double  _y,
const double  _z 
)

Add a vertex to the mesh.

Parameters
[in]_xPosition along x
[in]_yPosition along y
[in]_zPosition 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]_centerLocation of the mesh center.

◆ FillArrays()

void FillArrays ( double **  _vertArr,
int **  _indexndArr 
) const

Put all the data into flat arrays.

Parameters
[in]_verArrThe vertex array to be filled.
[in]_indexndArrThe index array to be filled.

◆ GenSphericalTexCoord()

void GenSphericalTexCoord ( const ignition::math::Vector3d _center)

Generate texture coordinates using spherical projection from center.

Parameters
[in]_centerCenter 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]_indexNode 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]_indexNormal 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]_indexTexture 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]_vVertex 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]_indexVertex 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]_indexArray 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]_vVertex 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]_indexThe 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]_indexThe 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]_factorScaling factor

◆ Scale() [2/2]

void Scale ( const double &  _factor)

Scale all vertices by _factor.

Parameters
[in]_factorScaling factor

◆ SetIndex()

void SetIndex ( const unsigned int  _index,
const unsigned int  _i 
)

Set an index.

Parameters
[in]_indexIndex of the indices
[in]_iThe 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]_indexIndex to set the material to.

◆ SetName()

void SetName ( const std::string _name)

Set the name of this mesh.

Parameters
[in]_nThe name to set

◆ SetNormal()

void SetNormal ( const unsigned int  _index,
const ignition::math::Vector3d _n 
)

Set a normal.

Parameters
[in]_indexIndex of the normal that will be set.
[in]_nThe new normal direction

◆ SetPrimitiveType()

void SetPrimitiveType ( PrimitiveType  _type)

Set the primitive type.

Parameters
[in]_typeThe primitive type

◆ SetTexCoord()

void SetTexCoord ( const unsigned int  _index,
const ignition::math::Vector2d _uv 
)

Set a texture coordinate.

Parameters
[in]_indexIndex of the texture coordinate that will be set.
[in]_uvThe new texture coordinate

◆ SetVertex()

void SetVertex ( const unsigned int  _index,
const ignition::math::Vector3d _v 
)

Set a vertex.

Parameters
[in]_indexIndex of the vertex
[in]_vThe 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]_indexthe 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]_vecAmount to translate vertices.

◆ Vertex()

ignition::math::Vector3d Vertex ( const unsigned int  _index) const

Get a vertex.

Parameters
[in]_indexIndex 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.

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