- CHANGE vertex count and texture channel count limits to 8. Adapt all parts of the code which depended on both of them being set to 4. Test suite passes.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@900 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
58ce3ee879
commit
2b9ad081e0
|
@ -175,43 +175,32 @@ void FindInstancesProcess::Execute( aiScene* pScene)
|
||||||
// use a constant epsilon for colors and UV coordinates
|
// use a constant epsilon for colors and UV coordinates
|
||||||
static const float uvEpsilon = 10e-4f;
|
static const float uvEpsilon = 10e-4f;
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(4 == AI_MAX_NUMBER_OF_COLOR_SETS);
|
{
|
||||||
|
unsigned int i, end = orig->GetNumUVChannels();
|
||||||
// as in JIV: manually unrolled as continue wouldn't work as desired in inner loops
|
for(i = 0; i < end; ++i) {
|
||||||
if (orig->mTextureCoords[0]) {
|
if (!orig->mTextureCoords[i]) {
|
||||||
if(!CompareArrays(orig->mTextureCoords[0],inst->mTextureCoords[0],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
|
||||||
if (orig->mTextureCoords[1]) {
|
|
||||||
if(!CompareArrays(orig->mTextureCoords[1],inst->mTextureCoords[1],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
continue;
|
||||||
if (orig->mTextureCoords[2]) {
|
}
|
||||||
if(!CompareArrays(orig->mTextureCoords[2],inst->mTextureCoords[2],orig->mNumVertices,uvEpsilon))
|
if(!CompareArrays(orig->mTextureCoords[i],inst->mTextureCoords[i],orig->mNumVertices,uvEpsilon)) {
|
||||||
continue;
|
break;
|
||||||
if (orig->mTextureCoords[3]) {
|
|
||||||
if(!CompareArrays(orig->mTextureCoords[3],inst->mTextureCoords[3],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (i != end) {
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(4 == AI_MAX_NUMBER_OF_COLOR_SETS);
|
|
||||||
|
|
||||||
// and the same nasty stuff for vertex colors ...
|
|
||||||
if (orig->mColors[0]) {
|
|
||||||
if(!CompareArrays(orig->mColors[0],inst->mColors[0],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
continue;
|
||||||
if (orig->mTextureCoords[1]) {
|
}
|
||||||
if(!CompareArrays(orig->mColors[1],inst->mColors[1],orig->mNumVertices,uvEpsilon))
|
}
|
||||||
|
{
|
||||||
|
unsigned int i, end = orig->GetNumColorChannels();
|
||||||
|
for(i = 0; i < end; ++i) {
|
||||||
|
if (!orig->mColors[i]) {
|
||||||
continue;
|
continue;
|
||||||
if (orig->mTextureCoords[2]) {
|
|
||||||
if(!CompareArrays(orig->mColors[2],inst->mColors[2],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
|
||||||
if (orig->mTextureCoords[3]) {
|
|
||||||
if(!CompareArrays(orig->mColors[3],inst->mColors[3],orig->mNumVertices,uvEpsilon))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if(!CompareArrays(orig->mColors[i],inst->mColors[i],orig->mNumVertices,uvEpsilon)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i != end) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ void JoinVerticesProcess::Execute( aiScene* pScene)
|
||||||
// Unites identical vertices in the given mesh
|
// Unites identical vertices in the given mesh
|
||||||
int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_COLOR_SETS == 4);
|
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_COLOR_SETS == 8);
|
||||||
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_TEXTURECOORDS == 4);
|
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_TEXTURECOORDS == 8);
|
||||||
|
|
||||||
// Return early if we don't have any positions
|
// Return early if we don't have any positions
|
||||||
if (!pMesh->HasPositions() || !pMesh->HasFaces()) {
|
if (!pMesh->HasPositions() || !pMesh->HasFaces()) {
|
||||||
|
@ -168,14 +168,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
|
|
||||||
// Run an optimized code path if we don't have multiple UVs or vertex colors.
|
// Run an optimized code path if we don't have multiple UVs or vertex colors.
|
||||||
// This should yield false in more than 99% of all imports ...
|
// This should yield false in more than 99% of all imports ...
|
||||||
const bool complex = (
|
const bool complex = ( pMesh->GetNumColorChannels() > 0 || pMesh->GetNumUVChannels() > 1);
|
||||||
pMesh->mTextureCoords[1] ||
|
|
||||||
pMesh->mTextureCoords[2] ||
|
|
||||||
pMesh->mTextureCoords[3] ||
|
|
||||||
pMesh->mColors[0] ||
|
|
||||||
pMesh->mColors[1] ||
|
|
||||||
pMesh->mColors[2] ||
|
|
||||||
pMesh->mColors[3] );
|
|
||||||
|
|
||||||
// Now check each vertex if it brings something new to the table
|
// Now check each vertex if it brings something new to the table
|
||||||
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
||||||
|
@ -213,22 +206,48 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
// Actually this increases runtime performance slightly, at least if branch
|
// Actually this increases runtime performance slightly, at least if branch
|
||||||
// prediction is on our side.
|
// prediction is on our side.
|
||||||
if (complex){
|
if (complex){
|
||||||
// manually unrolled because continue wouldn't work as desired in an inner loop
|
// manually unrolled because continue wouldn't work as desired in an inner loop,
|
||||||
|
// also because some compilers seem to fail the task. Colors and UV coords
|
||||||
|
// are interleaved since the higher entries are most likely to be
|
||||||
|
// zero and thus useless. By interleaving the arrays, vertices are,
|
||||||
|
// on average, rejected earlier.
|
||||||
|
|
||||||
|
if( (uv.texcoords[1] - v.texcoords[1]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
if( GetColorDifference( uv.colors[0], v.colors[0]) > squareEpsilon)
|
if( GetColorDifference( uv.colors[0], v.colors[0]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( (uv.texcoords[2] - v.texcoords[2]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
if( GetColorDifference( uv.colors[1], v.colors[1]) > squareEpsilon)
|
if( GetColorDifference( uv.colors[1], v.colors[1]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( (uv.texcoords[3] - v.texcoords[3]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
if( GetColorDifference( uv.colors[2], v.colors[2]) > squareEpsilon)
|
if( GetColorDifference( uv.colors[2], v.colors[2]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( (uv.texcoords[4] - v.texcoords[4]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
if( GetColorDifference( uv.colors[3], v.colors[3]) > squareEpsilon)
|
if( GetColorDifference( uv.colors[3], v.colors[3]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// texture coord matching manually unrolled as well
|
if( (uv.texcoords[5] - v.texcoords[5]).SquareLength() > squareEpsilon)
|
||||||
if( (uv.texcoords[1] - v.texcoords[1]).SquareLength() > squareEpsilon)
|
|
||||||
continue;
|
continue;
|
||||||
if( (uv.texcoords[2] - v.texcoords[2]).SquareLength() > squareEpsilon)
|
if( GetColorDifference( uv.colors[4], v.colors[4]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
if( (uv.texcoords[3] - v.texcoords[3]).SquareLength() > squareEpsilon)
|
|
||||||
|
if( (uv.texcoords[6] - v.texcoords[6]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
|
if( GetColorDifference( uv.colors[5], v.colors[5]) > squareEpsilon)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( (uv.texcoords[7] - v.texcoords[7]).SquareLength() > squareEpsilon)
|
||||||
|
continue;
|
||||||
|
if( GetColorDifference( uv.colors[6], v.colors[6]) > squareEpsilon)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( GetColorDifference( uv.colors[7], v.colors[7]) > squareEpsilon)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,14 @@ extern "C" {
|
||||||
* Supported number of vertex color sets per mesh. */
|
* Supported number of vertex color sets per mesh. */
|
||||||
|
|
||||||
#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
|
#ifndef AI_MAX_NUMBER_OF_COLOR_SETS
|
||||||
# define AI_MAX_NUMBER_OF_COLOR_SETS 0x4
|
# define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
|
||||||
#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
|
#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS
|
||||||
|
|
||||||
/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
|
/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||||
* Supported number of texture coord sets (UV(W) channels) per mesh */
|
* Supported number of texture coord sets (UV(W) channels) per mesh */
|
||||||
|
|
||||||
#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
|
#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||||
# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x4
|
# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8
|
||||||
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue