From 16a5bef3baf224aaa682efb7f312b19e4e2e4cf9 Mon Sep 17 00:00:00 2001 From: kimmi Date: Wed, 25 Jan 2012 18:42:14 +0000 Subject: [PATCH] Bugfix: Bugfixes fror VS 2010 with CMake ( thanks to Jonathan Klein ). git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1124 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CREDITS | 2 +- code/CMakeLists.txt | 7 +++++++ code/M3Importer.cpp | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 57f075fdb..419030482 100644 --- a/CREDITS +++ b/CREDITS @@ -26,7 +26,7 @@ Visual Studio 9 support, bugfixes. B3D-Loader, Assimp testing - Jonathan Klein -Ogre Loader +Ogre Loader, VC2010 fixes and CMake fixes. - Sebastian Hempel, PyAssimp (first version) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index e664477d4..62b8117d9 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -553,6 +553,13 @@ SET( unzip_SRCS ) SOURCE_GROUP( unzip FILES ${unzip_SRCS}) + +# VC2010 fixes +OPTION( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF ) +if( VC10_STDINT_FIX ) + ADD_DEFINITIONS( -D_STDINT ) +endif( VC10_STDINT_FIX ) + ADD_DEFINITIONS( -DASSIMP_BUILD_DLL_EXPORT ) if ( MSVC80 OR MSVC90 OR MSVC10 ) diff --git a/code/M3Importer.cpp b/code/M3Importer.cpp index 384ae106a..6375694de 100644 --- a/code/M3Importer.cpp +++ b/code/M3Importer.cpp @@ -55,7 +55,7 @@ M3Importer::M3Importer() : m_pHead( NULL ), m_pRefs( NULL ) { - + // empty } // ------------------------------------------------------------------------------------------------ @@ -263,8 +263,11 @@ void M3Importer::convertToAssimp( const std::string& pFile, aiScene* pScene, DIV pRootNode->mChildren[ i ] = pCurrentNode; // Loop over the faces of the nodes +// = regions[i].ofsIndices; j < (regions[i].ofsIndices + regions[i].nIndices); j +=3) + unsigned int numFaces = ( pRegions[ i ].ofsIndices + pRegions[ i ].nIndices ) - pRegions[ i ].ofsIndices; aiMesh *pMesh = new aiMesh; + pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE; MeshArray.push_back( pMesh ); pMesh->mNumFaces = numFaces; @@ -316,13 +319,14 @@ void M3Importer::createVertexData( aiMesh *pMesh, const std::vector aiFace *pFace = &( pMesh->mFaces[ currentFace ] ); for ( unsigned int currentIdx=0; currentIdxmNumIndices; currentIdx++ ) { - unsigned int idx = pFace->mIndices[ currentIdx ]; + const unsigned int idx = pFace->mIndices[ currentIdx ]; if ( vertices.size() > idx ) { pMesh->mVertices[ pos ] = vertices[ idx ]; pMesh->mNormals[ pos ] = normals[ idx ]; pFace->mIndices[ currentIdx ] = pos; + pFace->mIndices[ pos ]; pos++; } }