BUGFIX: Fix for material import in Q3-BSP-loader ( thanks to Matthias Fauconneau ).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@829 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
kimmi 2010-10-18 19:18:28 +00:00
parent 8a27ecf827
commit d7ce23893e
2 changed files with 13 additions and 3 deletions

View File

@ -86,3 +86,6 @@ Contributed several patches regarding Mac OS/XCode targets, bug reports.
- Martin Walser (Samhayne)
Contributed the 'SimpleTexturedOpenGl' sample.
- Matthias Fauconneau
Contributed a fix for the Q3-BSP loader.

View File

@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AssimpPCH.h"
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
#include <windows.h>
#include "DefaultIOSystem.h"
#include "Q3BSPFileImporter.h"
#include "Q3BSPZipArchive.h"
@ -85,7 +86,7 @@ static void extractIds( const std::string &rKey, int &rId1, int &rId2 )
if ( std::string::npos == pos )
return;
std::string tmp1 = rKey.substr( 0, pos - 1 );
std::string tmp1 = rKey.substr( 0, pos );
std::string tmp2 = rKey.substr( pos + 1, rKey.size() - pos - 1 );
rId1 = atoi( tmp1.c_str() );
rId2 = atoi( tmp2.c_str() );
@ -141,6 +142,12 @@ Q3BSPFileImporter::~Q3BSPFileImporter()
for ( FaceMap::iterator it = m_MaterialLookupMap.begin(); it != m_MaterialLookupMap.end();
++it )
{
const std::string matName = (*it).first;
if ( matName.empty() )
{
continue;
}
std::vector<Q3BSP::sQ3BSPFace*> *pCurFaceArray = (*it).second;
if ( NULL != pCurFaceArray )
{
@ -298,8 +305,8 @@ void Q3BSPFileImporter::CreateNodes( const Q3BSP::Q3BSPModel *pModel, aiScene* p
{
delete pMesh;
}
matIdx++;
}
matIdx++;
}
pScene->mNumMeshes = MeshArray.size();
@ -343,7 +350,7 @@ aiNode *Q3BSPFileImporter::CreateTopology( const Q3BSP::Q3BSPModel *pModel,
return NULL;
size_t numTriangles = countTriangles( rArray );
//pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
pMesh->mFaces = new aiFace[ numTriangles ];
pMesh->mNumFaces = numTriangles;