aiMesh Struct Reference

A mesh represents a geometry or model with a single material. More...

List of all members.

Public Member Functions

 aiMesh ()
 Default constructor. Initializes all members to 0.
unsigned int GetNumColorChannels () const
 Get the number of vertex color channels the mesh contains.
unsigned int GetNumUVChannels () const
 Get the number of UV channels the mesh contains.
bool HasBones () const
 Check whether the mesh contains bones.
bool HasFaces () const
 Check whether the mesh contains faces.
bool HasNormals () const
 Check whether the mesh contains normal vectors.
bool HasPositions () const
 Check whether the mesh contains positions.
bool HasTangentsAndBitangents () const
 Check whether the mesh contains tangent and bitangent vectors It is not possible that it contains tangents and no bitangents (or the other way round).
bool HasTextureCoords (unsigned int pIndex) const
 Check whether the mesh contains a texture coordinate set.
bool HasVertexColors (unsigned int pIndex) const
 Check whether the mesh contains a vertex color set.
 ~aiMesh ()
 Deletes all storage allocated for the mesh.

Public Attributes

aiVector3DmBitangents
 Vertex bitangents.
aiBone ** mBones
 The bones of this mesh.
aiColor4DmColors [AI_MAX_NUMBER_OF_COLOR_SETS]
 Vertex color sets.
aiFacemFaces
 The faces the mesh is constructed from.
unsigned int mMaterialIndex
 The material used by this mesh.
aiVector3DmNormals
 Vertex normals.
unsigned int mNumBones
 The number of bones this mesh contains.
unsigned int mNumFaces
 The number of primitives (triangles, polygons, lines) in this mesh.
unsigned int mNumUVComponents [AI_MAX_NUMBER_OF_TEXTURECOORDS]
 Specifies the number of components for a given UV channel.
unsigned int mNumVertices
 The number of vertices in this mesh.
unsigned int mPrimitiveTypes
 Bitwise combination of the members of the aiPrimitiveType enum.
aiVector3DmTangents
 Vertex tangents.
aiVector3DmTextureCoords [AI_MAX_NUMBER_OF_TEXTURECOORDS]
 Vertex texture coords, also known as UV channels.
aiVector3DmVertices
 Vertex positions.


Detailed Description

A mesh represents a geometry or model with a single material.

It usually consists of a number of vertices and a series of primitives/faces referencing the vertices. In addition there might be a series of bones, each of them addressing a number of vertices with a certain weight. Vertex data is presented in channels with each channel containing a single per-vertex information such as a set of texture coords or a normal vector. If a data pointer is non-null, the corresponding data stream is present. From C++-programs you can also use the comfort functions Has*() to test for the presence of various data streams.

A Mesh uses only a single material which is referenced by a material ID.

Note:
The mPositions member is usually not optional. However, vertex positions *could* be missing if the AI_SCENE_FLAGS_INCOMPLETE flag is set in

Constructor & Destructor Documentation

aiMesh::aiMesh (  )  [inline]

Default constructor. Initializes all members to 0.

aiMesh::~aiMesh (  )  [inline]

Deletes all storage allocated for the mesh.


Member Function Documentation

unsigned int aiMesh::GetNumColorChannels (  )  const [inline]

Get the number of vertex color channels the mesh contains.

unsigned int aiMesh::GetNumUVChannels (  )  const [inline]

Get the number of UV channels the mesh contains.

bool aiMesh::HasBones (  )  const [inline]

Check whether the mesh contains bones.

bool aiMesh::HasFaces (  )  const [inline]

Check whether the mesh contains faces.

If no special scene flags are set this should always return true

bool aiMesh::HasNormals (  )  const [inline]

Check whether the mesh contains normal vectors.

bool aiMesh::HasPositions (  )  const [inline]

Check whether the mesh contains positions.

If no special scene flags (such as AI_SCENE_FLAGS_ANIM_SKELETON_ONLY) are set this will always return true

bool aiMesh::HasTangentsAndBitangents (  )  const [inline]

Check whether the mesh contains tangent and bitangent vectors It is not possible that it contains tangents and no bitangents (or the other way round).

The existence of one of them implies that the second is there, too.

bool aiMesh::HasTextureCoords ( unsigned int  pIndex  )  const [inline]

Check whether the mesh contains a texture coordinate set.

Parameters:
pIndex Index of the texture coordinates set

bool aiMesh::HasVertexColors ( unsigned int  pIndex  )  const [inline]

Check whether the mesh contains a vertex color set.

Parameters:
pIndex Index of the vertex color set


Member Data Documentation

Vertex bitangents.

The bitangent of a vertex points in the direction of the positive Y texture axis. The array contains normalized vectors, NULL if not present. The array is mNumVertices in size.

Note:
If the mesh contains tangents, it automatically also contains bitangents.

The bones of this mesh.

A bone consists of a name by which it can be found in the frame hierarchy and a set of vertex weights.

aiColor4D* aiMesh::mColors[AI_MAX_NUMBER_OF_COLOR_SETS]

Vertex color sets.

A mesh may contain 0 to AI_MAX_NUMBER_OF_COLOR_SETS vertex colors per vertex. NULL if not present. Each array is mNumVertices in size if present.

The faces the mesh is constructed from.

Each face refers to a number of vertices by their indices. This array is always present in a mesh, its size is given in mNumFaces. If the AI_SCENE_FLAGS_NON_VERBOSE_FORMAT is NOT set each face references an unique set of vertices.

unsigned int aiMesh::mMaterialIndex

The material used by this mesh.

A mesh does use only a single material. If an imported model uses multiple materials, the import splits up the mesh. Use this value as index into the scene's material list.

Vertex normals.

The array contains normalized vectors, NULL if not present. The array is mNumVertices in size. Normals are undefined for point and line primitives. A mesh consisting of points and lines only may not have normal vectors. Meshes with mixed primitive types (i.e. lines and triangles) may have normals, but the normals for vertices that are only referenced by point or line primitives are undefined and set to QNaN (WARN: qNaN compares to inequal to *everything*, even to qNaN itself. Using code like this to check whether a field is qnan is:

 #define IS_QNAN(f) (f != f)
still dangerous because even 1.f == 1.f could evaluate to false! ( remember the subtleties of IEEE754 artithmetics). Use stuff like fpclassify instead.
Note:
Normal vectors computed by Assimp are always unit-length. However, this needn't apply for normals that have been taken directly from the model file.

unsigned int aiMesh::mNumBones

The number of bones this mesh contains.

Can be 0, in which case the mBones array is NULL.

unsigned int aiMesh::mNumFaces

The number of primitives (triangles, polygons, lines) in this mesh.

This is also the size of the mFaces array

unsigned int aiMesh::mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS]

Specifies the number of components for a given UV channel.

Up to three channels are supported (UVW, for accessing volume or cube maps). If the value is 2 for a given channel n, the component p.z of mTextureCoords[n][p] is set to 0.0f. If the value is 1 for a given channel, p.y is set to 0.0f, too.

Note:
4D coords are not supported

unsigned int aiMesh::mNumVertices

The number of vertices in this mesh.

This is also the size of all of the per-vertex data arrays

Bitwise combination of the members of the aiPrimitiveType enum.

This specifies which types of primitives are present in the mesh. The "SortByPrimitiveType"-Step can be used to make sure the output meshes consist of one primitive type each.

Vertex tangents.

The tangent of a vertex points in the direction of the positive X texture axis. The array contains normalized vectors, NULL if not present. The array is mNumVertices in size. A mesh consisting of points and lines only may not have normal vectors. Meshes with mixed primitive types (i.e. lines and triangles) may have normals, but the normals for vertices that are only referenced by point or line primitives are undefined and set to qNaN. See the mNormals member for a detailled discussion of qNaNs.

Note:
If the mesh contains tangents, it automatically also contains bitangents (the bitangent is just the cross product of tangent and normal vectors).

aiVector3D* aiMesh::mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS]

Vertex texture coords, also known as UV channels.

A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per vertex. NULL if not present. The array is mNumVertices in size.

Vertex positions.

This array is always present in a mesh. The array is mNumVertices in size.


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

Generated on Sat Apr 17 18:41:24 2010 for Assimp by  doxygen 1.5.8