2008-05-09 17:24:28 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2008-05-22 10:20:31 +00:00
|
|
|
Open Asset Import Library (ASSIMP)
|
2008-05-09 17:24:28 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2010-04-10 15:30:22 +00:00
|
|
|
Copyright (c) 2006-2010, ASSIMP Development Team
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the following
|
|
|
|
conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
|
|
|
* Neither the name of the ASSIMP team, nor the names of its
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
|
|
|
written permission of the ASSIMP Development Team.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-01-13 18:58:07 +00:00
|
|
|
/** @file aiMesh.h
|
|
|
|
* @brief Declares the data structures in which the imported geometry is
|
|
|
|
returned by ASSIMP: aiMesh, aiFace and aiBone data structures.
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
#ifndef INCLUDED_AI_MESH_H
|
|
|
|
#define INCLUDED_AI_MESH_H
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#include "aiTypes.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-07-16 11:44:31 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Limits. These values are required to match the settings Assimp was
|
|
|
|
// compiled against. Therfore, do not redefine them unless you build the
|
|
|
|
// library from source using the same definitions.
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/** @def AI_MAX_FACE_INDICES
|
|
|
|
* Maximum number of indices per face (polygon). */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_FACE_INDICES
|
|
|
|
# define AI_MAX_FACE_INDICES 0x7fff
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @def AI_MAX_BONE_WEIGHTS
|
|
|
|
* Maximum number of indices per face (polygon). */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_BONE_WEIGHTS
|
|
|
|
# define AI_MAX_BONE_WEIGHTS 0x7fffffff
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @def AI_MAX_VERTICES
|
|
|
|
* Maximum number of vertices per mesh. */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_VERTICES
|
|
|
|
# define AI_MAX_VERTICES 0x7fffffff
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @def AI_MAX_FACES
|
|
|
|
* Maximum number of faces per mesh. */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_FACES
|
|
|
|
# define AI_MAX_FACES 0x7fffffff
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @def AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
|
* Supported number of vertex color sets per mesh. */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
|
# define AI_MAX_NUMBER_OF_COLOR_SETS 0x4
|
|
|
|
#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
|
|
|
|
|
|
|
|
/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
|
* Supported number of texture coord sets (UV(W) channels) per mesh */
|
|
|
|
|
|
|
|
#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
|
# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x4
|
|
|
|
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
/** @brief A single face in a mesh, referring to multiple vertices.
|
|
|
|
*
|
2009-04-02 15:16:01 +00:00
|
|
|
* If mNumIndices is 3, we call the face 'triangle', for mNumIndices > 3
|
2009-01-12 22:06:54 +00:00
|
|
|
* it's called 'polygon' (hey, that's just a definition!).
|
|
|
|
* <br>
|
|
|
|
* aiMesh::mPrimitiveTypes can be queried to quickly examine which types of
|
2009-04-02 15:16:01 +00:00
|
|
|
* primitive are actually present in a mesh. The #aiProcess_SortByPType flag
|
|
|
|
* executes a special post-processing algorithm which splits meshes with
|
|
|
|
* *different* primitive types mixed up (e.g. lines and triangles) in several
|
|
|
|
* 'clean' submeshes. Furthermore there is a configuration option (
|
|
|
|
* #AI_CONFIG_PP_SBP_REMOVE) to force #aiProcess_SortByPType to remove
|
|
|
|
* specific kinds of primitives from the imported scene, completely and forever.
|
|
|
|
* In many cases you'll probably want to set this setting to
|
2009-01-12 22:06:54 +00:00
|
|
|
* @code
|
|
|
|
* aiPrimitiveType_LINE|aiPrimitiveType_POINT
|
|
|
|
* @endcode
|
2009-04-02 15:16:01 +00:00
|
|
|
* Together with the #aiProcess_Triangulate flag you can then be sure that
|
|
|
|
* #aiFace::mNumIndices is always 3.
|
2009-03-18 22:01:11 +00:00
|
|
|
* @note Take a look at the @link data Data Structures page @endlink for
|
|
|
|
* more information on the layout and winding order of a face.
|
2009-01-12 22:06:54 +00:00
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
struct aiFace
|
|
|
|
{
|
2010-07-16 11:44:31 +00:00
|
|
|
//! Number of indices defining this face.
|
|
|
|
//! The maximum value for this member is #AI_MAX_FACE_INDICES.
|
2008-05-09 17:24:28 +00:00
|
|
|
unsigned int mNumIndices;
|
|
|
|
|
|
|
|
//! Pointer to the indices array. Size of the array is given in numIndices.
|
|
|
|
unsigned int* mIndices;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Default constructor
|
2008-05-05 12:36:31 +00:00
|
|
|
aiFace()
|
|
|
|
{
|
|
|
|
mNumIndices = 0; mIndices = NULL;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Default destructor. Delete the index array
|
2008-05-05 12:36:31 +00:00
|
|
|
~aiFace()
|
|
|
|
{
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mIndices;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Copy constructor. Copy the index array
|
2008-05-05 12:36:31 +00:00
|
|
|
aiFace( const aiFace& o)
|
|
|
|
{
|
|
|
|
mIndices = NULL;
|
|
|
|
*this = o;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Assignment operator. Copy the index array
|
2008-05-05 12:36:31 +00:00
|
|
|
const aiFace& operator = ( const aiFace& o)
|
|
|
|
{
|
|
|
|
if (&o == this)
|
|
|
|
return *this;
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
delete[] mIndices;
|
2008-05-05 12:36:31 +00:00
|
|
|
mNumIndices = o.mNumIndices;
|
|
|
|
mIndices = new unsigned int[mNumIndices];
|
2009-01-12 22:06:54 +00:00
|
|
|
::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
|
2008-05-05 12:36:31 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Comparison operator. Checks whether the index array
|
|
|
|
//! of two faces is identical
|
|
|
|
bool operator== (const aiFace& o) const
|
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
if (mIndices == o.mIndices)return true;
|
|
|
|
else if (mIndices && mNumIndices == o.mNumIndices)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
|
|
|
for (unsigned int i = 0;i < this->mNumIndices;++i)
|
2009-01-12 22:06:54 +00:00
|
|
|
if (mIndices[i] != o.mIndices[i])return false;
|
2008-05-09 17:24:28 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Inverse comparison operator. Checks whether the index
|
|
|
|
//! array of two faces is NOT identical
|
|
|
|
bool operator != (const aiFace& o) const
|
|
|
|
{
|
|
|
|
return !(*this == o);
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
#endif // __cplusplus
|
2009-01-15 17:15:05 +00:00
|
|
|
}; // struct aiFace
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
/** @brief A single influence of a bone on a vertex.
|
2008-05-09 17:24:28 +00:00
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
struct aiVertexWeight
|
|
|
|
{
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Index of the vertex which is influenced by the bone.
|
|
|
|
unsigned int mVertexId;
|
|
|
|
|
|
|
|
//! The strength of the influence in the range (0...1).
|
|
|
|
//! The influence from all bones at one vertex amounts to 1.
|
|
|
|
float mWeight;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Default constructor
|
2008-05-05 12:36:31 +00:00
|
|
|
aiVertexWeight() { }
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Initialisation from a given index and vertex weight factor
|
|
|
|
//! \param pID ID
|
|
|
|
//! \param pWeight Vertex weight factor
|
|
|
|
aiVertexWeight( unsigned int pID, float pWeight)
|
|
|
|
: mVertexId( pID), mWeight( pWeight)
|
|
|
|
{ /* nothing to do here */ }
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#endif // __cplusplus
|
2009-01-15 17:15:05 +00:00
|
|
|
};
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
/** @brief A single bone of a mesh.
|
|
|
|
*
|
|
|
|
* A bone has a name by which it can be found in the frame hierarchy and by
|
|
|
|
* which it can be addressed by animations. In addition it has a number of
|
|
|
|
* influences on vertices.
|
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
struct aiBone
|
|
|
|
{
|
2008-05-09 17:24:28 +00:00
|
|
|
//! The name of the bone.
|
|
|
|
C_STRUCT aiString mName;
|
|
|
|
|
|
|
|
//! The number of vertices affected by this bone
|
2010-07-16 11:44:31 +00:00
|
|
|
//! The maximum value for this member is #AI_MAX_BONE_WEIGHTS.
|
2008-05-09 17:24:28 +00:00
|
|
|
unsigned int mNumWeights;
|
|
|
|
|
|
|
|
//! The vertices affected by this bone
|
|
|
|
C_STRUCT aiVertexWeight* mWeights;
|
|
|
|
|
|
|
|
//! Matrix that transforms from mesh space to bone space in bind pose
|
|
|
|
C_STRUCT aiMatrix4x4 mOffsetMatrix;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Default constructor
|
2008-05-05 12:36:31 +00:00
|
|
|
aiBone()
|
|
|
|
{
|
|
|
|
mNumWeights = 0; mWeights = NULL;
|
|
|
|
}
|
|
|
|
|
2008-06-03 21:50:53 +00:00
|
|
|
//! Copy constructor
|
|
|
|
aiBone(const aiBone& other)
|
|
|
|
{
|
|
|
|
mNumWeights = other.mNumWeights;
|
|
|
|
mOffsetMatrix = other.mOffsetMatrix;
|
|
|
|
mName = other.mName;
|
|
|
|
|
|
|
|
if (other.mWeights && other.mNumWeights)
|
|
|
|
{
|
|
|
|
mWeights = new aiVertexWeight[mNumWeights];
|
2008-08-08 15:18:28 +00:00
|
|
|
::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
2008-06-03 21:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-08 15:18:28 +00:00
|
|
|
//! Destructor - deletes the array of vertex weights
|
2008-05-05 12:36:31 +00:00
|
|
|
~aiBone()
|
|
|
|
{
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mWeights;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
#endif // __cplusplus
|
2009-01-15 17:15:05 +00:00
|
|
|
};
|
2008-08-08 15:18:28 +00:00
|
|
|
|
2008-09-30 20:20:56 +00:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
/** @brief Enumerates the types of geometric primitives supported by Assimp.
|
|
|
|
*
|
|
|
|
* @see aiFace Face data structure
|
|
|
|
* @see aiProcess_SortByPType Per-primitive sorting of meshes
|
|
|
|
* @see aiProcess_Triangulate Automatic triangulation
|
|
|
|
* @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.
|
|
|
|
*/
|
2008-09-30 20:20:56 +00:00
|
|
|
enum aiPrimitiveType
|
|
|
|
{
|
|
|
|
/** A point primitive.
|
2008-10-19 11:32:33 +00:00
|
|
|
*
|
2008-09-30 20:20:56 +00:00
|
|
|
* This is just a single vertex in the virtual world,
|
2008-10-13 16:45:48 +00:00
|
|
|
* #aiFace contains just one index for such a primitive.
|
2008-09-30 20:20:56 +00:00
|
|
|
*/
|
|
|
|
aiPrimitiveType_POINT = 0x1,
|
|
|
|
|
|
|
|
/** A line primitive.
|
2008-10-19 11:32:33 +00:00
|
|
|
*
|
2008-09-30 20:20:56 +00:00
|
|
|
* This is a line defined through a start and an end position.
|
2008-10-13 16:45:48 +00:00
|
|
|
* #aiFace contains exactly two indices for such a primitive.
|
2008-09-30 20:20:56 +00:00
|
|
|
*/
|
|
|
|
aiPrimitiveType_LINE = 0x2,
|
|
|
|
|
|
|
|
/** A triangular primitive.
|
2008-10-19 11:32:33 +00:00
|
|
|
*
|
2008-09-30 20:20:56 +00:00
|
|
|
* A triangle consists of three indices.
|
|
|
|
*/
|
|
|
|
aiPrimitiveType_TRIANGLE = 0x4,
|
|
|
|
|
|
|
|
/** A higher-level polygon with more than 3 edges.
|
2008-10-19 11:32:33 +00:00
|
|
|
*
|
2008-09-30 20:20:56 +00:00
|
|
|
* A triangle is a polygon, but polygon in this context means
|
|
|
|
* "all polygons that are not triangles". The "Triangulate"-Step
|
2009-01-13 18:58:07 +00:00
|
|
|
* is provided for your convenience, it splits all polygons in
|
2008-09-30 20:20:56 +00:00
|
|
|
* triangles (which are much easier to handle).
|
|
|
|
*/
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
aiPrimitiveType_POLYGON = 0x8,
|
|
|
|
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
/** This value is not used. It is just here to force the
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
* compiler to map this enum to a 32 Bit integer.
|
|
|
|
*/
|
2010-02-15 18:28:32 +00:00
|
|
|
#ifndef SWIG
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
_aiPrimitiveType_Force32Bit = 0x9fffffff
|
2010-02-15 18:28:32 +00:00
|
|
|
#endif
|
2009-01-12 22:06:54 +00:00
|
|
|
}; //! enum aiPrimitiveType
|
2008-09-30 20:20:56 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Get the #aiPrimitiveType flag for a specific number of face indices
|
|
|
|
#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \
|
2009-01-15 17:15:05 +00:00
|
|
|
((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))
|
2008-09-30 20:20:56 +00:00
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2010-11-21 14:57:00 +00:00
|
|
|
/** @brief NOT CURRENTLY IN USE. An AnimMesh is an attachment to an #aiMesh stores per-vertex
|
2010-05-10 18:05:52 +00:00
|
|
|
* animations for a particular frame.
|
|
|
|
*
|
|
|
|
* You may think of an #aiAnimMesh as a `patch` for the host mesh, which
|
|
|
|
* replaces only certain vertex data streams at a particular time.
|
|
|
|
* Each mesh stores n attached attached meshes (#aiMesh::mAnimMeshes).
|
|
|
|
* The actual relationship between the time line and anim meshes is
|
|
|
|
* established by #aiMeshAnim, which references singular mesh attachments
|
|
|
|
* by their ID and binds them to a time offset.
|
|
|
|
*/
|
|
|
|
struct aiAnimMesh
|
|
|
|
{
|
|
|
|
/** Replacement for aiMesh::mVertices. If this array is non-NULL,
|
2010-07-07 22:01:29 +00:00
|
|
|
* it *must* contain mNumVertices entries. The corresponding
|
2010-05-10 18:05:52 +00:00
|
|
|
* array in the host mesh must be non-NULL as well - animation
|
|
|
|
* meshes may neither add or nor remove vertex components (if
|
|
|
|
* a replacement array is NULL and the corresponding source
|
|
|
|
* array is not, the source data is taken instead)*/
|
|
|
|
C_STRUCT aiVector3D* mVertices;
|
|
|
|
|
|
|
|
/** Replacement for aiMesh::mNormals. */
|
|
|
|
C_STRUCT aiVector3D* mNormals;
|
|
|
|
|
|
|
|
/** Replacement for aiMesh::mTangents. */
|
|
|
|
C_STRUCT aiVector3D* mTangents;
|
|
|
|
|
|
|
|
/** Replacement for aiMesh::mBitangents. */
|
|
|
|
C_STRUCT aiVector3D* mBitangents;
|
|
|
|
|
|
|
|
/** Replacement for aiMesh::mColors */
|
|
|
|
C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
|
|
|
|
|
|
|
/** Replacement for aiMesh::mTextureCoords */
|
|
|
|
C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
|
|
2010-07-07 22:01:29 +00:00
|
|
|
/** The number of vertices in the aiAnimMesh, and thus the length of all
|
|
|
|
* the member arrays.
|
|
|
|
*
|
|
|
|
* This has always the same value as the mNumVertices property in the
|
|
|
|
* corresponding aiMesh. It is duplicated here merely to make the length
|
|
|
|
* of the member arrays accessible even if the aiMesh is not known, e.g.
|
|
|
|
* from language bindings.
|
|
|
|
*/
|
|
|
|
unsigned int mNumVertices;
|
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
aiAnimMesh()
|
|
|
|
: mVertices()
|
|
|
|
, mNormals()
|
|
|
|
, mTangents()
|
|
|
|
, mBitangents()
|
|
|
|
{
|
|
|
|
// fixme consider moving this to the ctor initializer list as well
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){
|
|
|
|
mTextureCoords[a] = NULL;
|
|
|
|
}
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
|
mColors[a] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~aiAnimMesh()
|
|
|
|
{
|
|
|
|
delete [] mVertices;
|
|
|
|
delete [] mNormals;
|
|
|
|
delete [] mTangents;
|
|
|
|
delete [] mBitangents;
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
|
|
|
delete [] mTextureCoords[a];
|
|
|
|
}
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
|
|
|
delete [] mColors[a];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check whether the anim mesh overrides the vertex positions
|
|
|
|
* of its host mesh*/
|
|
|
|
bool HasPositions() const {
|
|
|
|
return mVertices != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check whether the anim mesh overrides the vertex normals
|
|
|
|
* of its host mesh*/
|
|
|
|
bool HasNormals() const {
|
|
|
|
return mNormals != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check whether the anim mesh overrides the vertex tangents
|
|
|
|
* and bitangents of its host mesh. As for aiMesh,
|
|
|
|
* tangents and bitangents always go together. */
|
|
|
|
bool HasTangentsAndBitangents() const {
|
|
|
|
return mTangents != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check whether the anim mesh overrides a particular
|
|
|
|
* set of vertex colors on his host mesh.
|
|
|
|
* @param pIndex 0<index<AI_MAX_NUMBER_OF_COLOR_SETS */
|
|
|
|
bool HasVertexColors( unsigned int pIndex) const {
|
|
|
|
return pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Check whether the anim mesh overrides a particular
|
|
|
|
* set of texture coordinates on his host mesh.
|
|
|
|
* @param pIndex 0<index<AI_MAX_NUMBER_OF_TEXTURECOORDS */
|
|
|
|
bool HasTextureCoords( unsigned int pIndex) const {
|
|
|
|
return pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
/** @brief A mesh represents a geometry or model with a single material.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-05-09 17:24:28 +00:00
|
|
|
* 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
|
2008-05-05 12:36:31 +00:00
|
|
|
* 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.
|
2009-01-12 22:06:54 +00:00
|
|
|
* @note The mPositions member is usually not optional. However, vertex positions
|
2010-07-16 11:44:31 +00:00
|
|
|
* *could* be missing if the #AI_SCENE_FLAGS_INCOMPLETE flag is set in
|
2009-01-12 22:06:54 +00:00
|
|
|
* @code
|
|
|
|
* aiScene::mFlags
|
|
|
|
* @endcode
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
struct aiMesh
|
|
|
|
{
|
2008-09-30 20:20:56 +00:00
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
unsigned int mPrimitiveTypes;
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
/** The number of vertices in this mesh.
|
2010-07-16 11:44:31 +00:00
|
|
|
* This is also the size of all of the per-vertex data arrays.
|
|
|
|
* The maximum value for this member is #AI_MAX_VERTICES.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
unsigned int mNumVertices;
|
|
|
|
|
2008-10-27 00:36:26 +00:00
|
|
|
/** The number of primitives (triangles, polygons, lines) in this mesh.
|
2010-07-16 11:44:31 +00:00
|
|
|
* This is also the size of the mFaces array.
|
|
|
|
* The maximum value for this member is #AI_MAX_FACES.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
unsigned int mNumFaces;
|
|
|
|
|
|
|
|
/** Vertex positions.
|
|
|
|
* This array is always present in a mesh. The array is
|
|
|
|
* mNumVertices in size.
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiVector3D* mVertices;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** Vertex normals.
|
|
|
|
* The array contains normalized vectors, NULL if not present.
|
2008-10-19 11:32:33 +00:00
|
|
|
* 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
|
2008-10-27 00:36:26 +00:00
|
|
|
* point or line primitives are undefined and set to QNaN (WARN:
|
|
|
|
* qNaN compares to inequal to *everything*, even to qNaN itself.
|
2010-04-14 21:13:58 +00:00
|
|
|
* Using code like this to check whether a field is qnan is:
|
2008-10-27 00:36:26 +00:00
|
|
|
* @code
|
|
|
|
* #define IS_QNAN(f) (f != f)
|
|
|
|
* @endcode
|
2010-04-14 21:13:58 +00:00
|
|
|
* still dangerous because even 1.f == 1.f could evaluate to false! (
|
|
|
|
* remember the subtleties of IEEE754 artithmetics). Use stuff like
|
|
|
|
* @c fpclassify instead.
|
2008-10-27 00:36:26 +00:00
|
|
|
* @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.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiVector3D* mNormals;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** Vertex tangents.
|
|
|
|
* The tangent of a vertex points in the direction of the positive
|
|
|
|
* X texture axis. The array contains normalized vectors, NULL if
|
2008-10-19 11:32:33 +00:00
|
|
|
* 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
|
2010-04-14 21:13:58 +00:00
|
|
|
* point or line primitives are undefined and set to qNaN. See
|
|
|
|
* the #mNormals member for a detailled discussion of qNaNs.
|
2008-05-05 12:36:31 +00:00
|
|
|
* @note If the mesh contains tangents, it automatically also
|
2010-11-22 18:14:51 +00:00
|
|
|
* contains bitangents.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiVector3D* mTangents;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** 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
|
2010-04-14 21:13:58 +00:00
|
|
|
* bitangents.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiVector3D* mBitangents;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** 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 mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
|
|
|
|
|
2009-01-13 18:58:07 +00:00
|
|
|
/** The faces the mesh is constructed from.
|
|
|
|
* Each face refers to a number of vertices by their indices.
|
2008-05-05 12:36:31 +00:00
|
|
|
* This array is always present in a mesh, its size is given
|
2010-07-16 11:44:31 +00:00
|
|
|
* in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT
|
2008-10-19 11:32:33 +00:00
|
|
|
* is NOT set each face references an unique set of vertices.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiFace* mFaces;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** The number of bones this mesh contains.
|
|
|
|
* Can be 0, in which case the mBones array is NULL.
|
|
|
|
*/
|
|
|
|
unsigned int mNumBones;
|
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
C_STRUCT aiBone** mBones;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
/** The material used by this mesh.
|
2008-08-08 15:18:28 +00:00
|
|
|
* 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.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
unsigned int mMaterialIndex;
|
|
|
|
|
2010-05-10 13:59:29 +00:00
|
|
|
/** Name of the mesh. Meshes can be named, but this is not a
|
|
|
|
* requirement and leaving this field empty is totally fine.
|
|
|
|
* There are mainly three uses for mesh names:
|
|
|
|
* - some formats name nodes and meshes independently.
|
|
|
|
* - importers tend to split meshes up to meet the
|
|
|
|
* one-material-per-mesh requirement. Assigning
|
|
|
|
* the same (dummy) name to each of the result meshes
|
|
|
|
* aids the caller at recovering the original mesh
|
|
|
|
* partitioning.
|
|
|
|
* - Vertex animations refer to meshes by their names.
|
|
|
|
**/
|
2010-05-18 12:20:09 +00:00
|
|
|
C_STRUCT aiString mName;
|
2010-05-10 13:59:29 +00:00
|
|
|
|
2010-11-21 14:57:00 +00:00
|
|
|
|
|
|
|
/** NOT CURRENTLY IN USE. The number of attachment meshes */
|
2010-05-10 18:05:52 +00:00
|
|
|
unsigned int mNumAnimMeshes;
|
|
|
|
|
2010-11-21 14:57:00 +00:00
|
|
|
/** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
|
2010-05-10 18:05:52 +00:00
|
|
|
* Attachment meshes carry replacement data for some of the
|
|
|
|
* mesh'es vertex components (usually positions, normals). */
|
|
|
|
C_STRUCT aiAnimMesh** mAnimMeshes;
|
|
|
|
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifdef __cplusplus
|
2008-08-08 15:18:28 +00:00
|
|
|
|
|
|
|
//! Default constructor. Initializes all members to 0
|
2008-05-05 12:36:31 +00:00
|
|
|
aiMesh()
|
|
|
|
{
|
2008-09-30 20:20:56 +00:00
|
|
|
mNumVertices = 0;
|
|
|
|
mNumFaces = 0;
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
mNumAnimMeshes = 0;
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2008-09-30 20:20:56 +00:00
|
|
|
mPrimitiveTypes = 0;
|
|
|
|
mVertices = NULL; mFaces = NULL;
|
|
|
|
mNormals = NULL; mTangents = NULL;
|
2008-05-05 12:36:31 +00:00
|
|
|
mBitangents = NULL;
|
2010-05-10 18:05:52 +00:00
|
|
|
mAnimMeshes = NULL;
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)
|
|
|
|
{
|
|
|
|
mNumUVComponents[a] = 0;
|
|
|
|
mTextureCoords[a] = NULL;
|
|
|
|
}
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++)
|
|
|
|
mColors[a] = NULL;
|
|
|
|
mNumBones = 0; mBones = NULL;
|
|
|
|
mMaterialIndex = 0;
|
2010-11-22 18:14:51 +00:00
|
|
|
mNumAnimMeshes = 0;
|
|
|
|
mAnimMeshes = NULL;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-08 15:18:28 +00:00
|
|
|
//! Deletes all storage allocated for the mesh
|
2008-05-05 12:36:31 +00:00
|
|
|
~aiMesh()
|
|
|
|
{
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mVertices;
|
|
|
|
delete [] mNormals;
|
|
|
|
delete [] mTangents;
|
|
|
|
delete [] mBitangents;
|
2010-05-10 18:05:52 +00:00
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mTextureCoords[a];
|
2010-05-10 18:05:52 +00:00
|
|
|
}
|
|
|
|
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mColors[a];
|
2010-05-10 18:05:52 +00:00
|
|
|
}
|
2008-11-16 14:39:54 +00:00
|
|
|
|
|
|
|
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
2010-05-10 18:05:52 +00:00
|
|
|
if (mNumBones && mBones) {
|
|
|
|
for( unsigned int a = 0; a < mNumBones; a++) {
|
2008-11-16 14:39:54 +00:00
|
|
|
delete mBones[a];
|
2010-05-10 18:05:52 +00:00
|
|
|
}
|
2008-11-16 14:39:54 +00:00
|
|
|
delete [] mBones;
|
|
|
|
}
|
2010-11-21 14:57:00 +00:00
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
if (mNumAnimMeshes && mAnimMeshes) {
|
|
|
|
for( unsigned int a = 0; a < mNumAnimMeshes; a++) {
|
|
|
|
delete mAnimMeshes[a];
|
|
|
|
}
|
2010-11-21 14:57:00 +00:00
|
|
|
delete [] mAnimMeshes;
|
2010-05-10 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
2008-11-04 17:21:08 +00:00
|
|
|
delete [] mFaces;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
//! Check whether the mesh contains positions. Provided no special
|
2010-07-16 11:44:31 +00:00
|
|
|
//! scene flags are set (such as #AI_SCENE_FLAGS_ANIM_SKELETON_ONLY),
|
2010-05-10 18:05:52 +00:00
|
|
|
//! this will always be true
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasPositions() const
|
2008-11-04 17:21:08 +00:00
|
|
|
{ return mVertices != NULL && mNumVertices > 0; }
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-07-22 22:52:16 +00:00
|
|
|
//! Check whether the mesh contains faces. If no special scene flags
|
|
|
|
//! are set this should always return true
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasFaces() const
|
2008-11-04 17:21:08 +00:00
|
|
|
{ return mFaces != NULL && mNumFaces > 0; }
|
2008-07-22 22:52:16 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Check whether the mesh contains normal vectors
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasNormals() const
|
2008-11-04 17:21:08 +00:00
|
|
|
{ return mNormals != NULL && mNumVertices > 0; }
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Check whether the mesh contains tangent and bitangent vectors
|
2008-10-19 11:32:33 +00:00
|
|
|
//! 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.
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasTangentsAndBitangents() const
|
2008-11-04 17:21:08 +00:00
|
|
|
{ return mTangents != NULL && mBitangents != NULL && mNumVertices > 0; }
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Check whether the mesh contains a vertex color set
|
|
|
|
//! \param pIndex Index of the vertex color set
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasVertexColors( unsigned int pIndex) const
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
if( pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS)
|
|
|
|
return false;
|
|
|
|
else
|
2008-11-04 17:21:08 +00:00
|
|
|
return mColors[pIndex] != NULL && mNumVertices > 0;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! Check whether the mesh contains a texture coordinate set
|
|
|
|
//! \param pIndex Index of the texture coordinates set
|
2009-01-12 22:06:54 +00:00
|
|
|
bool HasTextureCoords( unsigned int pIndex) const
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2008-10-19 11:32:33 +00:00
|
|
|
if( pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS)
|
2008-05-05 12:36:31 +00:00
|
|
|
return false;
|
|
|
|
else
|
2008-11-04 17:21:08 +00:00
|
|
|
return mTextureCoords[pIndex] != NULL && mNumVertices > 0;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
//! Get the number of UV channels the mesh contains
|
2009-01-12 22:06:54 +00:00
|
|
|
unsigned int GetNumUVChannels() const
|
2008-11-16 21:56:45 +00:00
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
|
|
|
while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n])++n;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Get the number of vertex color channels the mesh contains
|
2009-01-12 22:06:54 +00:00
|
|
|
unsigned int GetNumColorChannels() const
|
2008-11-16 21:56:45 +00:00
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
|
|
|
while (n < AI_MAX_NUMBER_OF_COLOR_SETS && mColors[n])++n;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Check whether the mesh contains bones
|
|
|
|
inline bool HasBones() const
|
2008-11-04 17:21:08 +00:00
|
|
|
{ return mBones != NULL && mNumBones > 0; }
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#endif // __cplusplus
|
2009-01-15 17:15:05 +00:00
|
|
|
};
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-05-10 18:05:52 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2009-01-12 22:06:54 +00:00
|
|
|
#endif //! extern "C"
|
2008-10-19 11:32:33 +00:00
|
|
|
#endif // __AI_MESH_H_INC
|
2008-09-11 20:50:15 +00:00
|
|
|
|