closes https://github.com/assimp/assimp/issues/1076: use ai_assert instead
of assert.
This commit is contained in:
@@ -57,9 +57,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* - dump all polygons and their triangulation sequences to
|
||||
* a file
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
|
||||
#include "TriangulateProcess.h"
|
||||
#include "ProcessHelper.h"
|
||||
@@ -106,11 +103,15 @@ void TriangulateProcess::Execute( aiScene* pScene)
|
||||
bool bHas = false;
|
||||
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
|
||||
{
|
||||
if( TriangulateMesh( pScene->mMeshes[a]))
|
||||
if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) {
|
||||
bHas = true;
|
||||
}
|
||||
}
|
||||
if ( bHas ) {
|
||||
DefaultLogger::get()->info( "TriangulateProcess finished. All polygons have been triangulated." );
|
||||
} else {
|
||||
DefaultLogger::get()->debug( "TriangulateProcess finished. There was nothing to be done." );
|
||||
}
|
||||
if (bHas)DefaultLogger::get()->info ("TriangulateProcess finished. All polygons have been triangulated.");
|
||||
else DefaultLogger::get()->debug("TriangulateProcess finished. There was nothing to be done.");
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +156,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||
}
|
||||
|
||||
// Just another check whether aiMesh::mPrimitiveTypes is correct
|
||||
assert(numOut != pMesh->mNumFaces);
|
||||
ai_assert(numOut != pMesh->mNumFaces);
|
||||
|
||||
aiVector3D* nor_out = NULL;
|
||||
|
||||
@@ -184,7 +185,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||
aiColor4D* clr = pMesh->mColors[0];
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
FILE* fout = fopen(POLY_OUTPUT_FILE,"a");
|
||||
#endif
|
||||
@@ -276,7 +276,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||
{
|
||||
// A polygon with more than 3 vertices can be either concave or convex.
|
||||
// Usually everything we're getting is convex and we could easily
|
||||
// triangulate by trifanning. However, LightWave is probably the only
|
||||
// triangulate by tri-fanning. However, LightWave is probably the only
|
||||
// modeling suite to make extensive use of highly concave, monster polygons ...
|
||||
// so we need to apply the full 'ear cutting' algorithm to get it right.
|
||||
|
||||
@@ -325,7 +325,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||
done[tmp] = false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
// plot the plane onto which we mapped the polygon to a 2D ASCII pic
|
||||
aiVector2D bmin,bmax;
|
||||
@@ -404,14 +403,13 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||
if (num_found == 2) {
|
||||
|
||||
// Due to the 'two ear theorem', every simple polygon with more than three points must
|
||||
// have 2 'ears'. Here's definitely someting wrong ... but we don't give up yet.
|
||||
// have 2 'ears'. Here's definitely something wrong ... but we don't give up yet.
|
||||
//
|
||||
|
||||
// Instead we're continuting with the standard trifanning algorithm which we'd
|
||||
// Instead we're continuing with the standard tri-fanning algorithm which we'd
|
||||
// use if we had only convex polygons. That's life.
|
||||
DefaultLogger::get()->error("Failed to triangulate polygon (no ear found). Probably not a simple polygon?");
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
fprintf(fout,"critical error here, no ear found! ");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user