Преглед изворни кода

update:
- add assert test in obj-import
- fix material token in Obj.

Signed-off-by: Kim Kulling <[email protected]>

Kim Kulling пре 11 година
родитељ
комит
b359deb7fd
2 измењених фајлова са 9 додато и 8 уклоњено
  1. 6 5
      code/ObjFileImporter.cpp
  2. 3 3
      code/ObjFileMtlImporter.cpp

+ 6 - 5
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++)

+ 3 - 3
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";