+ SplitByBonesCountProcess: make bone limit configurable.
- fix tabbing. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@883 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
9a47236bb3
commit
24a0132598
|
@ -75,7 +75,7 @@ bool SplitByBoneCountProcess::IsActive( unsigned int pFlags) const
|
||||||
// Updates internal properties
|
// Updates internal properties
|
||||||
void SplitByBoneCountProcess::SetupProperties(const Importer* pImp)
|
void SplitByBoneCountProcess::SetupProperties(const Importer* pImp)
|
||||||
{
|
{
|
||||||
// ein andermal.
|
mMaxBoneCount = pImp->GetPropertyInteger(AI_CONFIG_PP_SBBC_MAX_BONES,AI_SBBC_DEFAULT_MAX_BONES);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -174,9 +174,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
subMeshFaces.reserve( pMesh->mNumFaces);
|
subMeshFaces.reserve( pMesh->mNumFaces);
|
||||||
// accumulated vertex count of all the faces in this submesh
|
// accumulated vertex count of all the faces in this submesh
|
||||||
size_t numSubMeshVertices = 0;
|
size_t numSubMeshVertices = 0;
|
||||||
// a small local array of new bones for the current face. State of all used bones for that face
|
// a small local array of new bones for the current face. State of all used bones for that face
|
||||||
// can only be updated AFTER the face is completely analysed. Thanks to imre for the fix.
|
// can only be updated AFTER the face is completely analysed. Thanks to imre for the fix.
|
||||||
std::vector<size_t> newBonesAtCurrentFace;
|
std::vector<size_t> newBonesAtCurrentFace;
|
||||||
|
|
||||||
// add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit
|
// add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit
|
||||||
for( size_t a = 0; a < pMesh->mNumFaces; ++a)
|
for( size_t a = 0; a < pMesh->mNumFaces; ++a)
|
||||||
|
@ -197,25 +197,25 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if it's not used, yet, we would need to add it. Store its bone index
|
// if it's not used, yet, we would need to add it. Store its bone index
|
||||||
newBonesAtCurrentFace.push_back( vb[c].first);
|
newBonesAtCurrentFace.push_back( vb[c].first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
|
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
|
||||||
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
|
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// mark all new bones as necessary
|
// mark all new bones as necessary
|
||||||
while( !newBonesAtCurrentFace.empty() )
|
while( !newBonesAtCurrentFace.empty() )
|
||||||
{
|
{
|
||||||
size_t newIndex = newBonesAtCurrentFace.back();
|
size_t newIndex = newBonesAtCurrentFace.back();
|
||||||
newBonesAtCurrentFace.pop_back(); // this also avoids the deallocation which comes with a clear()
|
newBonesAtCurrentFace.pop_back(); // this also avoids the deallocation which comes with a clear()
|
||||||
if( isBoneUsed[newIndex] )
|
if( isBoneUsed[newIndex] )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
isBoneUsed[newIndex] = true;
|
isBoneUsed[newIndex] = true;
|
||||||
numBones++;
|
numBones++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the face index and the vertex count
|
// store the face index and the vertex count
|
||||||
subMeshFaces.push_back( a);
|
subMeshFaces.push_back( a);
|
||||||
|
|
|
@ -52,19 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
|
|
||||||
// NOTE: If you change these limits, don't forget to change the
|
|
||||||
// corresponding values in all Assimp ports
|
|
||||||
|
|
||||||
// **********************************************************
|
|
||||||
// Java: ConfigProperty.java,
|
|
||||||
// ConfigProperty.DEFAULT_VERTEX_SPLIT_LIMIT
|
|
||||||
// ConfigProperty.DEFAULT_TRIANGLE_SPLIT_LIMIT
|
|
||||||
// **********************************************************
|
|
||||||
|
|
||||||
// default limit for bone count
|
|
||||||
#if (!defined AI_SBBC_DEFAULT_MAX_BONES)
|
|
||||||
# define AI_SBBC_DEFAULT_MAX_BONES 60
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Postprocessing filter to split meshes with many bones into submeshes
|
/** Postprocessing filter to split meshes with many bones into submeshes
|
||||||
* so that each submesh has a certain max bone count.
|
* so that each submesh has a certain max bone count.
|
||||||
|
|
|
@ -102,6 +102,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// Various stuff to fine-tune the behavior of a specific post processing step.
|
// Various stuff to fine-tune the behavior of a specific post processing step.
|
||||||
// ###########################################################################
|
// ###########################################################################
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
/** @brief Maximum bone count per mesh for the SplitbyBoneCount step.
|
||||||
|
*
|
||||||
|
* Meshes are split until the maximum number of bones is reached. The default
|
||||||
|
* value is AI_SBBC_DEFAULT_MAX_BONES, which may be altered at
|
||||||
|
* compile-time.
|
||||||
|
* Property data type: integer.
|
||||||
|
*/
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define AI_CONFIG_PP_SBBC_MAX_BONES \
|
||||||
|
"PP_SBBC_MAX_BONES"
|
||||||
|
|
||||||
|
|
||||||
|
// default limit for bone count
|
||||||
|
#if (!defined AI_SBBC_DEFAULT_MAX_BONES)
|
||||||
|
# define AI_SBBC_DEFAULT_MAX_BONES 60
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @brief Specifies the maximum angle that may be between two vertex tangents
|
/** @brief Specifies the maximum angle that may be between two vertex tangents
|
||||||
* that their tangents and bitangents are smoothed.
|
* that their tangents and bitangents are smoothed.
|
||||||
|
|
Loading…
Reference in New Issue