- Add unit test to avoid ppfx-related issue with re-use of Importer's in future.
- X file loader now properly resets all of its members.
- OptimizeMeshes step now properly resets all of its member.
- Fix old (and already deprecated) makefile.mingw.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@593 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-11 18:24:54 +00:00
parent 08ace2f27b
commit e2daf37a39
5 changed files with 41 additions and 2 deletions

View File

@ -103,6 +103,10 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
DefaultLogger::get()->debug("OptimizeMeshesProcess begin");
mScene = pScene;
// need to clear persistent members from previous runs
merge_list.clear();
output.clear();
merge_list.reserve(pScene->mNumMeshes);
output.reserve(pScene->mNumMeshes);

View File

@ -96,6 +96,10 @@ void XFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene, I
if( fileSize < 16)
throw new ImportErrorException( "XFile is too small.");
// need to clear members - this method might be called multiple
// times on a single XFileImporter instance.
mImportedMats.clear();
// in the hope that binary files will never start with a BOM ...
mBuffer.resize( fileSize);
file->Read( &mBuffer.front(), 1, fileSize);

View File

@ -45,12 +45,14 @@ CPPFLAGS=-Wall
# Setup environment for noboost build
ifeq ($(NOBOOST),1)
SINGLETHREADED = 1
INCLUDEFLAGS += -I../include/BoostWorkaround/
INCLUDEFLAGS += -I/BoostWorkaround/
DEFINEFLAGS += -DASSIMP_BUILD_BOOST_WORKAROUND
# NAMESUFFIX += -noboost
else
# adjust this manually if your boost is stored elsewhere
INCLUDEFLAGS += -I"C:/Program Files/boost/boost_1_38"
#INCLUDEFLAGS += -I"$(BOOST_DIR)"
endif
# Setup environment for st build

View File

@ -171,5 +171,31 @@ void ImporterTest :: testExtensionCheck (void)
std::string s;
pImp->GetExtensionList(s);
// todo ..
// TODO
}
void ImporterTest :: testMultipleReads (void)
{
// see http://sourceforge.net/projects/assimp/forums/forum/817654/topic/3591099
// Check whether reading and post-processing multiple times using
// the same objects is *generally* fine.
const unsigned int flags =
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_GenSmoothNormals |
aiProcess_ValidateDataStructure |
aiProcess_RemoveRedundantMaterials |
aiProcess_SortByPType |
aiProcess_FindDegenerates |
aiProcess_FindInvalidData |
aiProcess_GenUVCoords |
aiProcess_OptimizeMeshes |
aiProcess_OptimizeGraph;
CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/test.x",flags));
CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/dwarf.x",flags));
CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/Testwuson.x",flags));
CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/anim_test.x",flags));
CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/dwarf.x",flags));
}

View File

@ -19,6 +19,7 @@ class ImporterTest : public CPPUNIT_NS :: TestFixture
CPPUNIT_TEST (testPluginInterface);
CPPUNIT_TEST (testExtensionCheck);
CPPUNIT_TEST (testMemoryRead);
CPPUNIT_TEST (testMultipleReads);
CPPUNIT_TEST_SUITE_END ();
public:
@ -35,6 +36,8 @@ class ImporterTest : public CPPUNIT_NS :: TestFixture
void testExtensionCheck (void);
void testMemoryRead (void);
void testMultipleReads (void);
private:
Importer* pImp;