From b359deb7fdc348b2d8fd56f3e7e5d6c3d3156ed4 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 21 Sep 2014 20:37:36 +0200 Subject: [PATCH] update: - add assert test in obj-import - fix material token in Obj. Signed-off-by: Kim Kulling --- code/ObjFileImporter.cpp | 11 ++++++----- code/ObjFileMtlImporter.cpp | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 874dda707..b44ca4f05 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -62,7 +62,7 @@ static const aiImporterDesc desc = { static const unsigned int ObjMinSize = 16; -namespace Assimp { +namespace Assimp { using namespace std; @@ -284,8 +284,9 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj aiMesh* pMesh = new aiMesh; for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) { - ObjFile::Face* const inp = pObjMesh->m_Faces[ index ]; - + ObjFile::Face *const inp = pObjMesh->m_Faces[ index ]; + ai_assert( NULL != inp ); + if (inp->m_PrimitiveType == aiPrimitiveType_LINE) { pMesh->mNumFaces += inp->m_pVertices->size() - 1; pMesh->mPrimitiveTypes |= aiPrimitiveType_LINE; @@ -302,7 +303,7 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj } } - unsigned int uiIdxCount = 0u; + unsigned int uiIdxCount( 0u ); if ( pMesh->mNumFaces > 0 ) { pMesh->mFaces = new aiFace[ pMesh->mNumFaces ]; @@ -311,7 +312,7 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj pMesh->mMaterialIndex = pObjMesh->m_uiMaterialIndex; } - unsigned int outIndex = 0; + unsigned int outIndex( 0 ); // Copy all data from all stored meshes for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index e494fa515..e09a16f2f 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { // Material specific token -static const std::string DiffuseTexture = "map_kd"; -static const std::string AmbientTexture = "map_ka"; -static const std::string SpecularTexture = "map_ks"; +static const std::string DiffuseTexture = "map_Kd"; +static const std::string AmbientTexture = "map_Ka"; +static const std::string SpecularTexture = "map_Ks"; static const std::string OpacityTexture = "map_d"; static const std::string EmmissiveTexture = "map_emissive"; static const std::string BumpTexture1 = "map_bump";