2
0
Эх сурвалжийг харах

Merge branch 'master' into fix_export_custom_bindpose_error

Kim Kulling 6 жил өмнө
parent
commit
5895f04391

+ 96 - 102
code/Collada/ColladaLoader.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2019, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,7 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /** @file Implementation of the Collada loader */
 
-
 #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
 
 #include "ColladaLoader.h"
@@ -67,7 +64,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <numeric>
 #include <memory>
 
-using namespace Assimp;
+namespace Assimp {
+    
 using namespace Assimp::Formatter;
 
 static const aiImporterDesc desc = {
@@ -112,7 +110,7 @@ ColladaLoader::~ColladaLoader() {
 // Returns whether the class can handle the format of the given file.
 bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
     // check file extension
-    std::string extension = GetExtension(pFile);
+    const std::string extension = GetExtension(pFile);
 
     if (extension == "dae") {
         return true;
@@ -166,12 +164,13 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
     // parse the input file
     ColladaParser parser( pIOHandler, pFile);
 
-    if( !parser.mRootNode)
+    if( !parser.mRootNode) {
         throw DeadlyImportError( "Collada: File came out empty. Something is wrong here.");
+    }
 
     // reserve some storage to avoid unnecessary reallocs
-    newMats.reserve(parser.mMaterialLibrary.size()*2);
-    mMeshes.reserve(parser.mMeshLibrary.size()*2);
+    newMats.reserve(parser.mMaterialLibrary.size()*2u);
+    mMeshes.reserve(parser.mMeshLibrary.size()*2u);
 
     mCameras.reserve(parser.mCameraLibrary.size());
     mLights.reserve(parser.mLightLibrary.size());
@@ -191,19 +190,20 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
                                                         0,  0,  parser.mUnitSize,  0,
                                                         0,  0,  0,  1);
     if( !ignoreUpDirection ) {
-    // Convert to Y_UP, if different orientation
-    if( parser.mUpDirection == ColladaParser::UP_X)
-        pScene->mRootNode->mTransformation *= aiMatrix4x4(
-                0, -1,  0,  0,
-                1,  0,  0,  0,
-                0,  0,  1,  0,
-                0,  0,  0,  1);
-    else if( parser.mUpDirection == ColladaParser::UP_Z)
-        pScene->mRootNode->mTransformation *= aiMatrix4x4(
-                1,  0,  0,  0,
-                0,  0,  1,  0,
-                0, -1,  0,  0,
-                0,  0,  0,  1);
+        // Convert to Y_UP, if different orientation
+        if( parser.mUpDirection == ColladaParser::UP_X) {
+            pScene->mRootNode->mTransformation *= aiMatrix4x4(
+                    0, -1,  0,  0,
+                    1,  0,  0,  0,
+                    0,  0,  1,  0,
+                    0,  0,  0,  1);
+        } else if( parser.mUpDirection == ColladaParser::UP_Z) {
+            pScene->mRootNode->mTransformation *= aiMatrix4x4(
+                    1,  0,  0,  0,
+                    0,  0,  1,  0,
+                    0, -1,  0,  0,
+                    0,  0,  0,  1);
+        }
     }
 
     // Store scene metadata
@@ -211,8 +211,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
         const size_t numMeta(parser.mAssetMetaData.size());
         pScene->mMetaData = aiMetadata::Alloc(static_cast<unsigned int>(numMeta));
         size_t i = 0;
-        for (auto it = parser.mAssetMetaData.cbegin(); it != parser.mAssetMetaData.cend(); ++it, ++i)
-        {
+        for (auto it = parser.mAssetMetaData.cbegin(); it != parser.mAssetMetaData.cend(); ++it, ++i) {
             pScene->mMetaData->Set(static_cast<unsigned int>(i), (*it).first, (*it).second);
         }
     }
@@ -232,9 +231,8 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
     // store all animations
     StoreAnimations( pScene, parser);
 
-
     // If no meshes have been loaded, it's probably just an animated skeleton.
-    if (!pScene->mNumMeshes) {
+    if ( 0u == pScene->mNumMeshes) {
 
         if (!noSkeletonMesh) {
             SkeletonMeshBuilder hero(pScene);
@@ -302,13 +300,12 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
         // FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632
         // need to check for both name and ID to catch all. To avoid breaking valid files,
         // the workaround is only enabled when the first attempt to resolve the node has failed.
-        if (!nd) {
+        if (nullptr == nd) {
             nd = FindNode(pParser.mRootNode, nodeInst.mNode);
         }
-        if (!nd)
+        if (nullptr == nd) {
             ASSIMP_LOG_ERROR_F("Collada: Unable to resolve reference to instanced node ", nodeInst.mNode);
-
-        else {
+        } else {
             //  attach this node to the list of children
             resolved.push_back(nd);
         }
@@ -318,7 +315,7 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
 // ------------------------------------------------------------------------------------------------
 // Resolve UV channels
 void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler,
-     const Collada::SemanticMappingTable& table) {
+        const Collada::SemanticMappingTable& table) {
     std::map<std::string, Collada::InputSemanticMapEntry>::const_iterator it = table.mMap.find(sampler.mUVChannel);
     if (it != table.mMap.end()) {
         if (it->second.mType != Collada::IT_Texcoord) {
@@ -431,8 +428,7 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col
                 out->mAspect = std::tan(AI_DEG_TO_RAD(srcCamera->mHorFov)) /
                     std::tan(AI_DEG_TO_RAD(srcCamera->mVerFov));
             }
-        }
-        else if (srcCamera->mAspect != 10e10f && srcCamera->mVerFov != 10e10f)  {
+        } else if (srcCamera->mAspect != 10e10f && srcCamera->mVerFov != 10e10f)  {
             out->mHorizontalFOV = 2.0f * AI_RAD_TO_DEG(std::atan(srcCamera->mAspect *
                 std::tan(AI_DEG_TO_RAD(srcCamera->mVerFov) * 0.5f)));
         }
@@ -470,7 +466,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
                 }
             }
 
-            if( !srcMesh) {
+            if( nullptr == srcMesh) {
                 ASSIMP_LOG_WARN_F( "Collada: Unable to find geometry for ID \"", mid.mMeshOrController, "\". Skipping." );
                 continue;
             }
@@ -770,16 +766,13 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
             IndexPairVector::const_iterator iit = weightStartPerVertex[orgIndex];
             size_t pairCount = pSrcController->mWeightCounts[orgIndex];
 
-            for( size_t b = 0; b < pairCount; ++b, ++iit)
-            {
-
+            for( size_t b = 0; b < pairCount; ++b, ++iit) {
                 const size_t jointIndex = iit->first;
                 const size_t vertexIndex = iit->second;                
                 ai_real weight = 1.0f;
                 if (!weights.mValues.empty()) {
                     weight = ReadFloat(weightsAcc, weights, vertexIndex, 0);
                 }
-                
 
                 // one day I gonna kill that XSI Collada exporter
                 if( weight > 0.0f)
@@ -794,19 +787,21 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
 
         // count the number of bones which influence vertices of the current submesh
         size_t numRemainingBones = 0;
-        for( std::vector<std::vector<aiVertexWeight> >::const_iterator it = dstBones.begin(); it != dstBones.end(); ++it)
-            if( it->size() > 0)
-                numRemainingBones++;
+        for( std::vector<std::vector<aiVertexWeight> >::const_iterator it = dstBones.begin(); it != dstBones.end(); ++it) {
+            if( it->size() > 0) {
+                ++numRemainingBones;
+            }
+        }
 
         // create bone array and copy bone weights one by one
         dstMesh->mNumBones = static_cast<unsigned int>(numRemainingBones);
         dstMesh->mBones = new aiBone*[numRemainingBones];
         size_t boneCount = 0;
-        for( size_t a = 0; a < numBones; ++a)
-        {
+        for( size_t a = 0; a < numBones; ++a) {
             // omit bones without weights
-            if( dstBones[a].size() == 0)
+            if( dstBones[a].empty() ) {
                 continue;
+            }
 
             // create bone with its weights
             aiBone* bone = new aiBone;
@@ -852,14 +847,16 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
             // and replace the bone's name by the node's name so that the user can use the standard
             // find-by-name method to associate nodes with bones.
             const Collada::Node* bnode = FindNode( pParser.mRootNode, bone->mName.data);
-            if( !bnode)
+            if( !bnode) {
                 bnode = FindNodeBySID( pParser.mRootNode, bone->mName.data);
+            }
 
             // assign the name that we would have assigned for the source node
-            if( bnode)
+            if( bnode) {
                 bone->mName.Set( FindNameForNode( bnode));
-            else
+            } else {
                 ASSIMP_LOG_WARN_F( "ColladaLoader::CreateMesh(): could not find corresponding node for joint \"", bone->mName.data, "\"." );
+            }
 
             // and insert bone
             dstMesh->mBones[boneCount++] = bone;
@@ -871,89 +868,80 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
 
 // ------------------------------------------------------------------------------------------------
 // Stores all meshes in the given scene
-void ColladaLoader::StoreSceneMeshes( aiScene* pScene)
-{
+void ColladaLoader::StoreSceneMeshes( aiScene* pScene) {
     pScene->mNumMeshes = static_cast<unsigned int>(mMeshes.size());
-    if( mMeshes.size() > 0)
-    {
-        pScene->mMeshes = new aiMesh*[mMeshes.size()];
-        std::copy( mMeshes.begin(), mMeshes.end(), pScene->mMeshes);
-        mMeshes.clear();
+    if( mMeshes.empty() ) {
+        return;
     }
+    pScene->mMeshes = new aiMesh*[mMeshes.size()];
+    std::copy( mMeshes.begin(), mMeshes.end(), pScene->mMeshes);
+    mMeshes.clear();
 }
 
 // ------------------------------------------------------------------------------------------------
 // Stores all cameras in the given scene
-void ColladaLoader::StoreSceneCameras( aiScene* pScene)
-{
+void ColladaLoader::StoreSceneCameras( aiScene* pScene) {
     pScene->mNumCameras = static_cast<unsigned int>(mCameras.size());
-    if( mCameras.size() > 0)
-    {
-        pScene->mCameras = new aiCamera*[mCameras.size()];
-        std::copy( mCameras.begin(), mCameras.end(), pScene->mCameras);
-        mCameras.clear();
+    if( mCameras.empty() ) {
+        return;
     }
+    pScene->mCameras = new aiCamera*[mCameras.size()];
+    std::copy( mCameras.begin(), mCameras.end(), pScene->mCameras);
+    mCameras.clear();
 }
 
 // ------------------------------------------------------------------------------------------------
 // Stores all lights in the given scene
-void ColladaLoader::StoreSceneLights( aiScene* pScene)
-{
+void ColladaLoader::StoreSceneLights( aiScene* pScene) {
     pScene->mNumLights = static_cast<unsigned int>(mLights.size());
-    if( mLights.size() > 0)
-    {
-        pScene->mLights = new aiLight*[mLights.size()];
-        std::copy( mLights.begin(), mLights.end(), pScene->mLights);
-        mLights.clear();
+    if( mLights.empty() ) {
+        return;
     }
+    pScene->mLights = new aiLight*[mLights.size()];
+    std::copy( mLights.begin(), mLights.end(), pScene->mLights);
+    mLights.clear();
 }
 
 // ------------------------------------------------------------------------------------------------
 // Stores all textures in the given scene
-void ColladaLoader::StoreSceneTextures( aiScene* pScene)
-{
+void ColladaLoader::StoreSceneTextures( aiScene* pScene) {
     pScene->mNumTextures = static_cast<unsigned int>(mTextures.size());
-    if( mTextures.size() > 0)
-    {
-        pScene->mTextures = new aiTexture*[mTextures.size()];
-        std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures);
-        mTextures.clear();
+    if( mTextures.empty() ) {
+        return;
     }
+    pScene->mTextures = new aiTexture*[mTextures.size()];
+    std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures);
+    mTextures.clear();
 }
 
 // ------------------------------------------------------------------------------------------------
 // Stores all materials in the given scene
-void ColladaLoader::StoreSceneMaterials( aiScene* pScene)
-{
+void ColladaLoader::StoreSceneMaterials( aiScene* pScene) {
     pScene->mNumMaterials = static_cast<unsigned int>(newMats.size());
-
-    if (newMats.size() > 0) {
-        pScene->mMaterials = new aiMaterial*[newMats.size()];
-        for (unsigned int i = 0; i < newMats.size();++i)
-            pScene->mMaterials[i] = newMats[i].second;
-
-        newMats.clear();
+    if (newMats.empty() ) {
+        return;
+    }
+    pScene->mMaterials = new aiMaterial*[newMats.size()];
+    for (unsigned int i = 0; i < newMats.size();++i) {
+        pScene->mMaterials[i] = newMats[i].second;
     }
+    newMats.clear();
 }
 
 // ------------------------------------------------------------------------------------------------
 // Stores all animations
-void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser)
-{
+void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser) {
     // recursively collect all animations from the collada scene
     StoreAnimations( pScene, pParser, &pParser.mAnims, "");
 
     // catch special case: many animations with the same length, each affecting only a single node.
     // we need to unite all those single-node-anims to a proper combined animation
-    for( size_t a = 0; a < mAnims.size(); ++a)
-    {
+    for( size_t a = 0; a < mAnims.size(); ++a) {
         aiAnimation* templateAnim = mAnims[a];
-        if( templateAnim->mNumChannels == 1)
-        {
+        if( templateAnim->mNumChannels == 1) {
             // search for other single-channel-anims with the same duration
             std::vector<size_t> collectedAnimIndices;
-            for( size_t b = a+1; b < mAnims.size(); ++b)
-            {
+            for( size_t b = a+1; b < mAnims.size(); ++b) {
                 aiAnimation* other = mAnims[b];
                 if( other->mNumChannels == 1 && other->mDuration == templateAnim->mDuration && 
                         other->mTicksPerSecond == templateAnim->mTicksPerSecond )
@@ -1884,19 +1872,23 @@ const Collada::Node* ColladaLoader::FindNode( const Collada::Node* pNode, const
 
 // ------------------------------------------------------------------------------------------------
 // Finds a node in the collada scene by the given SID
-const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const
-{
-  if( pNode->mSID == pSID)
-    return pNode;
+const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const {
+    if (nullptr == pNode) {
+        return nullptr;
+    }
 
-  for( size_t a = 0; a < pNode->mChildren.size(); ++a)
-  {
-    const Collada::Node* node = FindNodeBySID( pNode->mChildren[a], pSID);
-    if( node)
-      return node;
-  }
+    if (pNode->mSID == pSID) {
+        return pNode;
+    }
 
-  return NULL;
+    for( size_t a = 0; a < pNode->mChildren.size(); ++a) {
+        const Collada::Node* node = FindNodeBySID( pNode->mChildren[a], pSID);
+        if (node) {
+            return node;
+        }
+    }
+
+    return nullptr;
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -1930,4 +1922,6 @@ std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
     }
 }
 
+} // Namespace Assimp
+
 #endif // !! ASSIMP_BUILD_NO_DAE_IMPORTER

+ 1 - 1
code/Obj/ObjFileParser.cpp

@@ -118,7 +118,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
     size_t lastFilePos( 0 );
 
     std::vector<char> buffer;
-    while ( streamBuffer.getNextDataLine( buffer, '\0' ) ) {
+    while ( streamBuffer.getNextDataLine( buffer, '\\' ) ) {
         m_DataIt = buffer.begin();
         m_DataItEnd = buffer.end();
 

+ 2 - 1
code/Unreal/UnrealLoader.h

@@ -127,7 +127,8 @@ inline void CompressVertex(const aiVector3D& v, uint32_t& out)
     n.X = (int32_t)v.x;
     n.Y = (int32_t)v.y;
     n.Z = (int32_t)v.z;
-    out = t;
+    ::memcpy( &out, &t, sizeof(int32_t));
+    //out = t;
 }
 
     // UNREAL vertex decompression

+ 2 - 9
test/unit/utBlenderWork.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2019, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -73,11 +71,6 @@ TEST_F(BlenderWorkTest,work_279) {
     ASSERT_TRUE(pTest->HasMaterials());
     ASSERT_TRUE(pTest->HasMeshes());
     ASSERT_TRUE(pTest->mMeshes[0]->mNumVertices > 0);
-    ASSERT_EQ(44, pTest->mMeshes[0]->mNumFaces);
-    EXPECT_EQ(1, pTest->mNumMaterials);
+    ASSERT_EQ(44u, pTest->mMeshes[0]->mNumFaces);
+    EXPECT_EQ(1u, pTest->mNumMaterials);
 }
-
-
-
-
-

+ 25 - 24
test/unit/utFBXImporterExporter.cpp

@@ -70,10 +70,10 @@ TEST_F( utFBXImporterExporter, importBareBoxWithoutColorsAndTextureCoords ) {
     Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/box.fbx", aiProcess_ValidateDataStructure );
     EXPECT_NE( nullptr, scene );
-    EXPECT_EQ(scene->mNumMeshes, 1);
+    EXPECT_EQ(scene->mNumMeshes, 1u);
     aiMesh* mesh = scene->mMeshes[0];
-    EXPECT_EQ(mesh->mNumFaces, 12);
-    EXPECT_EQ(mesh->mNumVertices, 36);
+    EXPECT_EQ(mesh->mNumFaces, 12u);
+    EXPECT_EQ(mesh->mNumVertices, 36u);
 }
 
 TEST_F(utFBXImporterExporter, importCubesWithNoNames) {
@@ -85,13 +85,13 @@ TEST_F(utFBXImporterExporter, importCubesWithNoNames) {
     const auto root = scene->mRootNode;
     ASSERT_STREQ(root->mName.C_Str(), "RootNode");
     ASSERT_TRUE(root->mChildren);
-    ASSERT_EQ(root->mNumChildren, 2);
+    ASSERT_EQ(root->mNumChildren, 2u);
 
     const auto child0 = root->mChildren[0];
     ASSERT_TRUE(child0);
     ASSERT_STREQ(child0->mName.C_Str(), "RootNode001");
     ASSERT_TRUE(child0->mChildren);
-    ASSERT_EQ(child0->mNumChildren, 1);
+    ASSERT_EQ(child0->mNumChildren, 1u);
 
     const auto child00 = child0->mChildren[0];
     ASSERT_TRUE(child00);
@@ -101,7 +101,7 @@ TEST_F(utFBXImporterExporter, importCubesWithNoNames) {
     ASSERT_TRUE(child1);
     ASSERT_STREQ(child1->mName.C_Str(), "RootNode002");
     ASSERT_TRUE(child1->mChildren);
-    ASSERT_EQ(child1->mNumChildren, 1);
+    ASSERT_EQ(child1->mNumChildren, 1u);
 
     const auto child10 = child1->mChildren[0];
     ASSERT_TRUE(child10);
@@ -117,13 +117,13 @@ TEST_F(utFBXImporterExporter, importCubesWithUnicodeDuplicatedNames) {
     const auto root = scene->mRootNode;
     ASSERT_STREQ(root->mName.C_Str(), "RootNode");
     ASSERT_TRUE(root->mChildren);
-    ASSERT_EQ(root->mNumChildren, 2);
+    ASSERT_EQ(root->mNumChildren, 2u);
 
     const auto child0 = root->mChildren[0];
     ASSERT_TRUE(child0);
     ASSERT_STREQ(child0->mName.C_Str(), "Cube2");
     ASSERT_TRUE(child0->mChildren);
-    ASSERT_EQ(child0->mNumChildren, 1);
+    ASSERT_EQ(child0->mNumChildren, 1u);
 
     const auto child00 = child0->mChildren[0];
     ASSERT_TRUE(child00);
@@ -133,7 +133,7 @@ TEST_F(utFBXImporterExporter, importCubesWithUnicodeDuplicatedNames) {
     ASSERT_TRUE(child1);
     ASSERT_STREQ(child1->mName.C_Str(), "Cube3");
     ASSERT_TRUE(child1->mChildren);
-    ASSERT_EQ(child1->mNumChildren, 1);
+    ASSERT_EQ(child1->mNumChildren, 1u);
 
     const auto child10 = child1->mChildren[0];
     ASSERT_TRUE(child10);
@@ -149,13 +149,13 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) {
     const auto root = scene->mRootNode;
     ASSERT_STREQ(root->mName.C_Str(), "RootNode");
     ASSERT_TRUE(root->mChildren);
-    ASSERT_EQ(root->mNumChildren, 2);
+    ASSERT_EQ(root->mNumChildren, 2u);
 
     const auto child0 = root->mChildren[0];
     ASSERT_TRUE(child0);
     ASSERT_STREQ(child0->mName.C_Str(), "Cube2");
     ASSERT_TRUE(child0->mChildren);
-    ASSERT_EQ(child0->mNumChildren, 1);
+    ASSERT_EQ(child0->mNumChildren, 1u);
 
     const auto child00 = child0->mChildren[0];
     ASSERT_TRUE(child00);
@@ -177,35 +177,36 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) {
         "Cube1001_$AssimpFbx$_ScalingPivotInverse",
         "Cube1001"
     };
-    for (size_t i = 0; i < chain_length; ++i)
-    {
+    for (size_t i = 0; i < chain_length; ++i) {
         ASSERT_TRUE(parent->mChildren);
-        ASSERT_EQ(parent->mNumChildren, 1);
+        ASSERT_EQ(parent->mNumChildren, 1u);
         auto node = parent->mChildren[0];
         ASSERT_TRUE(node);
         ASSERT_STREQ(node->mName.C_Str(), chainStr[i]);
         parent = node;
     }
-    ASSERT_EQ(0, parent->mNumChildren) << "Leaf node";
+    ASSERT_EQ(0u, parent->mNumChildren) << "Leaf node";
 }
 
 TEST_F( utFBXImporterExporter, importPhongMaterial ) {
     Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/FBX/phong_cube.fbx", aiProcess_ValidateDataStructure );
     EXPECT_NE( nullptr, scene );
-    EXPECT_EQ( (unsigned int)1, scene->mNumMaterials );
+    EXPECT_EQ( 1u, scene->mNumMaterials );
     const aiMaterial *mat = scene->mMaterials[0];
     EXPECT_NE( nullptr, mat );
-    float f; aiColor3D c;
+    float f;
+    aiColor3D c;
+
     // phong_cube.fbx has all properties defined
     EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_DIFFUSE, c), aiReturn_SUCCESS );
     EXPECT_EQ( c, aiColor3D(0.5, 0.25, 0.25) );
     EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_SPECULAR, c), aiReturn_SUCCESS );
     EXPECT_EQ( c, aiColor3D(0.25, 0.25, 0.5) );
     EXPECT_EQ( mat->Get(AI_MATKEY_SHININESS_STRENGTH, f), aiReturn_SUCCESS );
-    EXPECT_EQ( f, 0.5 );
+    EXPECT_EQ( f, 0.5f );
     EXPECT_EQ( mat->Get(AI_MATKEY_SHININESS, f), aiReturn_SUCCESS );
-    EXPECT_EQ( f, 10.0 );
+    EXPECT_EQ( f, 10.0f );
     EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_AMBIENT, c), aiReturn_SUCCESS );
     EXPECT_EQ( c, aiColor3D(0.125, 0.25, 0.25) );
     EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_EMISSIVE, c), aiReturn_SUCCESS );
@@ -213,7 +214,7 @@ TEST_F( utFBXImporterExporter, importPhongMaterial ) {
     EXPECT_EQ( mat->Get(AI_MATKEY_COLOR_TRANSPARENT, c), aiReturn_SUCCESS );
     EXPECT_EQ( c, aiColor3D(0.75, 0.5, 0.25) );
     EXPECT_EQ( mat->Get(AI_MATKEY_OPACITY, f), aiReturn_SUCCESS );
-    EXPECT_EQ( f, 0.5 );
+    EXPECT_EQ( f, 0.5f );
 }
 
 TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
@@ -234,7 +235,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
 
-    EXPECT_EQ(1, scene->mNumMaterials);
+    EXPECT_EQ(1u, scene->mNumMaterials);
     aiMaterial *mat = scene->mMaterials[0];
     ASSERT_NE(nullptr, mat);
 
@@ -243,7 +244,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
     EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
     ASSERT_STREQ(path.C_Str(), "..\\..\\..\\Desktop\\uv_test.png");
 
-    ASSERT_EQ(1, scene->mNumTextures);
+    ASSERT_EQ(1u, scene->mNumTextures);
     ASSERT_TRUE(scene->mTextures[0]->pcData);
     ASSERT_EQ(439176u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture";
 }
@@ -254,7 +255,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) {
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box_embedded_texture_fragmented.fbx", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
 
-    EXPECT_EQ(1, scene->mNumMaterials);
+    EXPECT_EQ(1u, scene->mNumMaterials);
     aiMaterial *mat = scene->mMaterials[0];
     ASSERT_NE(nullptr, mat);
 
@@ -263,7 +264,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) {
     ASSERT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
     ASSERT_STREQ(path.C_Str(), "paper.png");
 
-    ASSERT_EQ(1, scene->mNumTextures);
+    ASSERT_EQ(1u, scene->mNumTextures);
     ASSERT_TRUE(scene->mTextures[0]->pcData);
     ASSERT_EQ(968029u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture";
 }

+ 34 - 0
test/unit/utObjImportExport.cpp

@@ -448,3 +448,37 @@ TEST_F(utObjImportExport, import_without_linend) {
     const aiScene *scene = myImporter.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/box_without_lineending.obj", 0);
     ASSERT_NE(nullptr, scene);
 }
+
+TEST_F(utObjImportExport, import_with_line_continuations) {
+    static const char *ObjModel =
+        "v -0.5 -0.5 0.5\n"
+        "v -0.5 \\\n"
+        "  -0.5 -0.5\n"
+        "v -0.5 \\\n"
+        "   0.5 \\\n"
+        "   -0.5\n"
+        "f 1 2 3\n";
+
+    Assimp::Importer myImporter;
+    const aiScene *scene = myImporter.ReadFileFromMemory(ObjModel, strlen(ObjModel), 0);
+    EXPECT_NE(nullptr, scene);
+
+    EXPECT_EQ(scene->mNumMeshes, 1U);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 3U);
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 1U);
+
+    auto vertices = scene->mMeshes[0]->mVertices;
+    const float threshold = 0.0001f;
+
+    EXPECT_NEAR(vertices[0].x, -0.5f, threshold);
+    EXPECT_NEAR(vertices[0].y, -0.5f, threshold);
+    EXPECT_NEAR(vertices[0].z, 0.5f, threshold);
+
+    EXPECT_NEAR(vertices[1].x, -0.5f, threshold);
+    EXPECT_NEAR(vertices[1].y, -0.5f, threshold);
+    EXPECT_NEAR(vertices[1].z, -0.5f, threshold);
+
+    EXPECT_NEAR(vertices[2].x, -0.5f, threshold);
+    EXPECT_NEAR(vertices[2].y, 0.5f, threshold);
+    EXPECT_NEAR(vertices[2].z, -0.5f, threshold);
+}

+ 1 - 2
test/unit/utSortByPType.cpp

@@ -183,8 +183,7 @@ TEST_F(SortByPTypeProcessTest, SortByPTypeStep) {
     unsigned int idx = 0;
     for (unsigned int m = 0,real = 0; m< 10;++m) {
         for (unsigned int n = 0; n < 4;++n) {
-            if ((idx = num[m][n]))
-            {
+            if ((idx = num[m][n])) {
                 EXPECT_TRUE(real < mScene->mNumMeshes);
 
                 aiMesh* mesh = mScene->mMeshes[real];

+ 92 - 99
test/unit/utglTF2ImportExport.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2019, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -55,17 +53,23 @@ class utglTF2ImportExport : public AbstractImportExportBase {
 public:
     virtual bool importerTest() {
         Assimp::Importer importer;
-        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf",
+            aiProcess_ValidateDataStructure);
         EXPECT_NE( scene, nullptr );
-        if ( !scene ) return false;
+        if (!scene) {
+            return false;
+        }
 
         EXPECT_TRUE( scene->HasMaterials() );
-        if ( !scene->HasMaterials() ) return false;
+        if (!scene->HasMaterials()) {
+            return false;
+        }
         const aiMaterial *material = scene->mMaterials[0];
 
         aiString path;
         aiTextureMapMode modes[2];
-        EXPECT_EQ( aiReturn_SUCCESS, material->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes) );
+        EXPECT_EQ( aiReturn_SUCCESS, material->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr,
+            nullptr, nullptr, modes) );
         EXPECT_STREQ( path.C_Str(), "CesiumLogoFlat.png" );
         EXPECT_EQ( modes[0], aiTextureMapMode_Mirror );
         EXPECT_EQ( modes[1], aiTextureMapMode_Clamp );
@@ -75,7 +79,8 @@ public:
 
     virtual bool binaryImporterTest() {
         Assimp::Importer importer;
-        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/2CylinderEngine-glTF-Binary/2CylinderEngine.glb", aiProcess_ValidateDataStructure);
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/2CylinderEngine-glTF-Binary/2CylinderEngine.glb",
+            aiProcess_ValidateDataStructure);
         return nullptr != scene;
     }
 
@@ -83,7 +88,8 @@ public:
     virtual bool exporterTest() {
         Assimp::Importer importer;
         Assimp::Exporter exporter;
-        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure );
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf",
+            aiProcess_ValidateDataStructure );
         EXPECT_NE( nullptr, scene );
         EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "gltf2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured_out.gltf" ) );
 
@@ -105,7 +111,8 @@ TEST_F( utglTF2ImportExport, importBinaryglTF2FromFileTest ) {
 TEST_F(utglTF2ImportExport, importglTF2AndExportToOBJ) {
     Assimp::Importer importer;
     Assimp::Exporter exporter;
-    const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
+    const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf",
+        aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
     EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "obj", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured_out.obj"));
 }
@@ -113,7 +120,8 @@ TEST_F(utglTF2ImportExport, importglTF2AndExportToOBJ) {
 TEST_F(utglTF2ImportExport, importglTF2EmbeddedAndExportToOBJ) {
     Assimp::Importer importer;
     Assimp::Exporter exporter;
-    const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured.gltf", aiProcess_ValidateDataStructure);
+    const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured.gltf",
+        aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
     EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "obj", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF-Embedded/BoxTextured_out.obj"));
 }
@@ -124,10 +132,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePointsWithoutIndices) {
     //Points without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1u);
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i);
     }
 }
@@ -137,12 +144,11 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesWithoutIndices) {
     //Lines without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 8);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2);
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i*2);
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i*2 + 1);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 8u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i*2u);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i*2u + 1u);
     }
 }
 
@@ -151,15 +157,14 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesLoopWithoutIndices) {
     //Lines loop without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
 
-    std::array<int, 5> l1 = {{ 0, 1, 2, 3, 0 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2);
+    std::array<unsigned int, 5> l1 = {{ 0u, 1u, 2u, 3u, 0u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u);
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1u]);
     }
 }
 
@@ -168,14 +173,13 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesStripWithoutIndices) {
     //Lines strip without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5u);
 
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2);
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u);
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i);
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i + 1);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i + 1u);
     }
 }
 
@@ -184,19 +188,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStripWithoutIndices
     //Triangles strip without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 3> f1 = {{ 0, 1, 2 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 3> f1 = {{ 0u, 1u, 2u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
+    for (unsigned int i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
     }
 
-    std::array<int, 3> f2 = {{ 2, 1, 3 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    std::array<unsigned int, 3> f2 = {{ 2u, 1u, 3u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
     }
 }
@@ -206,19 +208,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices)
     //Triangles fan without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 3> f1 = {{ 0, 1, 2 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 3> f1 = {{ 0u, 1u, 2u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
     }
 
-    std::array<int, 3> f2 = {{ 0, 2, 3 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    std::array<unsigned int, 3> f2 = {{ 0u, 2u, 3u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
     }
 }
@@ -228,19 +228,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesWithoutIndices) {
     //Triangles without indices
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 6);
-    std::array<int, 3> f1 = {{ 0, 1, 2 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 6u);
+    std::array<unsigned int, 3> f1 = {{ 0u, 1u, 2u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
     }
 
-    std::array<int, 3> f2 = {{ 3, 4, 5 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    std::array<unsigned int, 3> f2 = {{ 3u, 4u, 5u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
     }
 }
@@ -250,10 +248,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePoints) {
     //Line loop
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
-        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1u);
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i);
     }
 }
@@ -263,9 +260,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) {
     //Lines
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 5> l1 = {{ 0, 3, 2, 1, 0 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 5> l1 = {{ 0u, 3u, 2u, 1u, 0u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
     for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
     {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
@@ -278,9 +275,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) {
     //Line loop
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 5> l1 = {{ 0, 3, 2, 1, 0 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 5> l1 = {{ 0, 3u, 2u, 1u, 0u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
     for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
     {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
@@ -293,11 +290,10 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) {
     //Lines Strip
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 5> l1 = {{ 0, 3, 2, 1, 0 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
-    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 5> l1 = {{ 0u, 3u, 2u, 1u, 0u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
+    for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
         EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
     }
@@ -308,19 +304,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) {
     //Triangles strip
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    std::array<int, 3> f1 = {{ 0, 3, 1 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    std::array<unsigned int, 3> f1 = {{ 0u, 3u, 1u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
     }
 
-    std::array<int, 3> f2 = {{ 1, 3, 2 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    std::array<unsigned int, 3> f2 = {{ 1u, 3u, 2u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
     }
 }
@@ -330,19 +324,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) {
     //Triangles fan
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf", aiProcess_ValidateDataStructure);
     EXPECT_NE(nullptr, scene);
-    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
-    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2);
-    std::array<int, 3> f1 = {{ 0, 3, 2 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
+    EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
+    std::array<unsigned int, 3> f1 = {{ 0u, 3u, 2u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u );
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
     }
 
-    std::array<int, 3> f2 = {{ 0, 2, 1 }};
-    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3);
-    for (int i = 0; i < 3; ++i)
-    {
+    std::array<unsigned int, 3> f2 = {{ 0u, 2u, 1u }};
+    EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u );
+    for (size_t i = 0; i < 3; ++i) {
         EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
     }
 }
@@ -378,7 +370,8 @@ TEST_F(utglTF2ImportExport, importglTF2FromMemory) {
 
 TEST_F( utglTF2ImportExport, bug_import_simple_skin ) {
     Assimp::Importer importer;
-    const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf", aiProcess_ValidateDataStructure );
+    const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf",
+        aiProcess_ValidateDataStructure );
     EXPECT_NE( nullptr, scene );
 }