diff --git a/code/Importer.cpp b/code/Importer.cpp index d70bc3bfe..8ebf61732 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "AssimpPCH.h" +#include "../include/aiVersion.h" // ------------------------------------------------------------------------------------------------ /* Uncomment this line to prevent Assimp from catching unknown exceptions. @@ -68,8 +69,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ScenePreprocessor.h" #include "MemoryIOWrapper.h" #include "Profiler.h" +#include "TinyFormatter.h" using namespace Assimp::Profiling; +using namespace Assimp::Formatter; // ------------------------------------------------------------------------------------------------ // Importers @@ -827,6 +830,56 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer, return pimpl->mScene; } +// ------------------------------------------------------------------------------------------------ +void WriteLogOpening(const std::string& file) +{ + Logger* l = DefaultLogger::get(); + if (!l) { + return; + } + l->info("Load " + file); + + // print a full version dump. This is nice because we don't + // need to ask the authors of incoming bug reports for + // the library version they're using - a log dump is + // sufficient. + const unsigned int flags = aiGetCompileFlags(); + l->debug(format() + << "Assimp " + << aiGetVersionMajor() + << "." + << aiGetVersionMinor() + << "." + << aiGetVersionRevision() + +#if defined(ASSIMP_BUILD_X86_32BIT_ARCHITECTURE) + << " x86" +#elif defined(ASSIMP_BUILD_X86_64BIT_ARCHITECTURE) + << " amd64" +#elif defined(ASSIMP_BUILD_IA_64BIT_ARCHITECTURE) + << " itanium" +#else +# error unknown architecture +#endif + +#if defined(_MSC_VER) + << " msvc" +#elif defined(__GNUC__) + << " gcc" +#else +# error unknown compiler +#endif + +#ifndef NDEBUG + << " debug" +#endif + + << (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "") + << (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "") + << (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "") + ); +} + // ------------------------------------------------------------------------------------------------ // Reads the given file and returns its contents if successful. const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) @@ -840,6 +893,8 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) // ImportErrorException's are throw by ourselves and caught elsewhere. //----------------------------------------------------------------------- + WriteLogOpening(pFile); + #ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS try #endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS diff --git a/tools/assimp_view/assimp_view.cpp b/tools/assimp_view/assimp_view.cpp index f5c29482a..71c3cfd2b 100644 --- a/tools/assimp_view/assimp_view.cpp +++ b/tools/assimp_view/assimp_view.cpp @@ -195,13 +195,13 @@ int LoadAsset(void) g_mWorldRotate = aiMatrix4x4(); g_mWorld = aiMatrix4x4(); - char szTemp[MAX_PATH+64]; - sprintf(szTemp,"Starting to load %s",g_szFileName); - CLogWindow::Instance().WriteLine( - "----------------------------------------------------------------------------"); - CLogWindow::Instance().WriteLine(szTemp); +// char szTemp[MAX_PATH+64]; +// sprintf(szTemp,"Starting to load %s",g_szFileName); CLogWindow::Instance().WriteLine( "----------------------------------------------------------------------------"); +// CLogWindow::Instance().WriteLine(szTemp); +// CLogWindow::Instance().WriteLine( +// "----------------------------------------------------------------------------"); CLogWindow::Instance().SetAutoUpdate(false); // create a helper thread to load the asset