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-9d2fd5bffc1fpull/1/head
parent
8a27ecf827
commit
d7ce23893e
3
CREDITS
3
CREDITS
|
@ -86,3 +86,6 @@ Contributed several patches regarding Mac OS/XCode targets, bug reports.
|
||||||
|
|
||||||
- Martin Walser (Samhayne)
|
- Martin Walser (Samhayne)
|
||||||
Contributed the 'SimpleTexturedOpenGl' sample.
|
Contributed the 'SimpleTexturedOpenGl' sample.
|
||||||
|
|
||||||
|
- Matthias Fauconneau
|
||||||
|
Contributed a fix for the Q3-BSP loader.
|
||||||
|
|
|
@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "AssimpPCH.h"
|
#include "AssimpPCH.h"
|
||||||
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
#include "DefaultIOSystem.h"
|
#include "DefaultIOSystem.h"
|
||||||
#include "Q3BSPFileImporter.h"
|
#include "Q3BSPFileImporter.h"
|
||||||
#include "Q3BSPZipArchive.h"
|
#include "Q3BSPZipArchive.h"
|
||||||
|
@ -85,7 +86,7 @@ static void extractIds( const std::string &rKey, int &rId1, int &rId2 )
|
||||||
if ( std::string::npos == pos )
|
if ( std::string::npos == pos )
|
||||||
return;
|
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 );
|
std::string tmp2 = rKey.substr( pos + 1, rKey.size() - pos - 1 );
|
||||||
rId1 = atoi( tmp1.c_str() );
|
rId1 = atoi( tmp1.c_str() );
|
||||||
rId2 = atoi( tmp2.c_str() );
|
rId2 = atoi( tmp2.c_str() );
|
||||||
|
@ -141,6 +142,12 @@ Q3BSPFileImporter::~Q3BSPFileImporter()
|
||||||
for ( FaceMap::iterator it = m_MaterialLookupMap.begin(); it != m_MaterialLookupMap.end();
|
for ( FaceMap::iterator it = m_MaterialLookupMap.begin(); it != m_MaterialLookupMap.end();
|
||||||
++it )
|
++it )
|
||||||
{
|
{
|
||||||
|
const std::string matName = (*it).first;
|
||||||
|
if ( matName.empty() )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Q3BSP::sQ3BSPFace*> *pCurFaceArray = (*it).second;
|
std::vector<Q3BSP::sQ3BSPFace*> *pCurFaceArray = (*it).second;
|
||||||
if ( NULL != pCurFaceArray )
|
if ( NULL != pCurFaceArray )
|
||||||
{
|
{
|
||||||
|
@ -298,8 +305,8 @@ void Q3BSPFileImporter::CreateNodes( const Q3BSP::Q3BSPModel *pModel, aiScene* p
|
||||||
{
|
{
|
||||||
delete pMesh;
|
delete pMesh;
|
||||||
}
|
}
|
||||||
matIdx++;
|
|
||||||
}
|
}
|
||||||
|
matIdx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pScene->mNumMeshes = MeshArray.size();
|
pScene->mNumMeshes = MeshArray.size();
|
||||||
|
@ -343,7 +350,7 @@ aiNode *Q3BSPFileImporter::CreateTopology( const Q3BSP::Q3BSPModel *pModel,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
size_t numTriangles = countTriangles( rArray );
|
size_t numTriangles = countTriangles( rArray );
|
||||||
//pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
||||||
|
|
||||||
pMesh->mFaces = new aiFace[ numTriangles ];
|
pMesh->mFaces = new aiFace[ numTriangles ];
|
||||||
pMesh->mNumFaces = numTriangles;
|
pMesh->mNumFaces = numTriangles;
|
||||||
|
|
Loading…
Reference in New Issue