Procházet zdrojové kódy

Merge branch 'master' into 2075

Kim Kulling před 7 roky
rodič
revize
063ae05310
54 změnil soubory, kde provedl 1646 přidání a 123 odebrání
  1. 1 1
      CMakeLists.txt
  2. 2 0
      code/Assimp.cpp
  3. 22 9
      code/ConvertToLHProcess.cpp
  4. 11 23
      code/FBXConverter.cpp
  5. 1 1
      code/FBXConverter.h
  6. 3 0
      code/Importer.cpp
  7. 1 1
      code/Importer/IFC/IFCGeometry.cpp
  8. 56 24
      code/MaterialSystem.cpp
  9. 5 7
      code/ObjFileMtlImporter.cpp
  10. 22 8
      code/STLLoader.cpp
  11. 10 6
      code/ScenePrivate.h
  12. 5 3
      code/Version.cpp
  13. 31 23
      code/glTF2Importer.cpp
  14. 0 5
      code/glTFImporter.cpp
  15. 1 1
      include/assimp/Macros.h
  16. 37 6
      include/assimp/material.h
  17. 2 2
      include/assimp/material.inl
  18. 21 0
      test/models/glTF2/glTF-Asset-Generator/LICENSE
  19. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.bin
  20. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.gltf
  21. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.bin
  22. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.gltf
  23. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.bin
  24. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf
  25. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.bin
  26. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf
  27. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.bin
  28. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.gltf
  29. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.bin
  30. 63 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.gltf
  31. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.bin
  32. 62 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.gltf
  33. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.bin
  34. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf
  35. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.bin
  36. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf
  37. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.bin
  38. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf
  39. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.bin
  40. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf
  41. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.bin
  42. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf
  43. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.bin
  44. 77 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf
  45. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_13.bin
  46. 76 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_13.gltf
  47. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_14.bin
  48. 76 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_14.gltf
  49. binární
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_15.bin
  50. 76 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_15.gltf
  51. 33 0
      test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/README.md
  52. 22 2
      test/unit/utMaterialSystem.cpp
  53. 1 1
      test/unit/utSTLImportExport.cpp
  54. 229 0
      test/unit/utglTF2ImportExport.cpp

+ 1 - 1
CMakeLists.txt

@@ -216,7 +216,7 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
 ELSEIF(MSVC)
   # enable multi-core compilation with MSVC
   ADD_COMPILE_OPTIONS(/MP)
-  IF("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
     ADD_COMPILE_OPTIONS( /bigobj )
   ENDIF()
   # disable "elements of array '' will be default initialized" warning on MSVC2013

+ 2 - 0
code/Assimp.cpp

@@ -272,6 +272,8 @@ void aiReleaseImport( const aiScene* pScene)
 
     ASSIMP_BEGIN_EXCEPTION_REGION();
 
+    aiReleaseDefaultMaterial();
+
     // find the importer associated with this data
     const ScenePrivateData* priv = ScenePriv(pScene);
     if( !priv || !priv->mOrigImporter)  {

+ 22 - 9
code/ConvertToLHProcess.cpp

@@ -59,6 +59,25 @@ using namespace Assimp;
 
 #ifndef ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS
 
+namespace {
+
+template <typename aiMeshType>
+void flipUVs(aiMeshType* pMesh) {
+    if (pMesh == nullptr) { return; }
+    // mirror texture y coordinate
+    for (unsigned int tcIdx = 0; tcIdx < AI_MAX_NUMBER_OF_TEXTURECOORDS; tcIdx++) {
+        if (!pMesh->HasTextureCoords(tcIdx)) {
+            break;
+        }
+
+        for (unsigned int vIdx = 0; vIdx < pMesh->mNumVertices; vIdx++) {
+            pMesh->mTextureCoords[tcIdx][vIdx].y = 1.0f - pMesh->mTextureCoords[tcIdx][vIdx].y;
+        }
+    }
+}
+
+} // namespace
+
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 MakeLeftHandedProcess::MakeLeftHandedProcess()
@@ -282,15 +301,9 @@ void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat)
 // Converts a single mesh
 void FlipUVsProcess::ProcessMesh( aiMesh* pMesh)
 {
-    // mirror texture y coordinate
-    for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)   {
-        if( !pMesh->HasTextureCoords( a ) ) {
-            break;
-        }
-
-        for( unsigned int b = 0; b < pMesh->mNumVertices; b++ ) {
-            pMesh->mTextureCoords[ a ][ b ].y = 1.0f - pMesh->mTextureCoords[ a ][ b ].y;
-        }
+    flipUVs(pMesh);
+    for (unsigned int idx = 0; idx < pMesh->mNumAnimMeshes; idx++) {
+        flipUVs(pMesh->mAnimMeshes[idx]);
     }
 }
 

+ 11 - 23
code/FBXConverter.cpp

@@ -185,12 +185,12 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
                 }
 
                 if ( !name_carrier ) {
-                    NodeNameCache::const_iterator it( std::find( mNodeNames.begin(), mNodeNames.end(), original_name ) );
+                    NodeNameCache::const_iterator it = mNodeNames.find(original_name);
                     if ( it != mNodeNames.end() ) {
                         original_name = original_name + std::string( "001" );
                     }
 
-                    mNodeNames.push_back( original_name );
+                    mNodeNames.insert( original_name );
                     nodes_chain.push_back( new aiNode( original_name ) );
                 } else {
                     original_name = nodes_chain.back()->mName.C_Str();
@@ -398,30 +398,18 @@ void Converter::ConvertCamera( const Camera& cam, const std::string &orig_name )
     out_camera->mClipPlaneFar = cam.FarPlane();
 }
 
-static bool HasName( NodeNameCache &cache, const std::string &name ) {
-    NodeNameCache::const_iterator it( std::find( cache.begin(), cache.end(), name ) );
-    return it != cache.end();
-
-}
-void Converter::GetUniqueName( const std::string &name, std::string &uniqueName ) {
-    if ( !HasName( mNodeNames, name ) ) {
-        uniqueName = name;
-        mNodeNames.push_back( uniqueName );
-        return;
-    }
-
-    int i( 0 );
-    std::string newName( name );
-    while ( HasName( mNodeNames, newName ) ) {
+void Converter::GetUniqueName( const std::string &name, std::string &uniqueName )
+{
+    int i = 0;
+    uniqueName = name;
+    while (mNodeNames.find(uniqueName) != mNodeNames.end())
+    {
         ++i;
-        newName.clear();
-        newName += name;
         std::stringstream ext;
-        ext << std::setfill( '0' ) << std::setw( 3 ) << i;
-        newName += ext.str();
+        ext << name << std::setfill('0') << std::setw(3) << i;
+        uniqueName = ext.str();
     }
-    uniqueName = newName;
-    mNodeNames.push_back( uniqueName );
+    mNodeNames.insert(uniqueName);
 }
 
 

+ 1 - 1
code/FBXConverter.h

@@ -68,7 +68,7 @@ namespace FBX {
 
 class Document;
 
-using NodeNameCache = std::vector<std::string>;
+using NodeNameCache = std::set<std::string>;
 
 /** 
  *  Convert a FBX #Document to #aiScene

+ 3 - 0
code/Importer.cpp

@@ -178,6 +178,7 @@ Importer::~Importer()
 {
     // Delete all import plugins
 	DeleteImporterInstanceList(pimpl->mImporter);
+    aiReleaseDefaultMaterial();
 
     // Delete all post-processing plug-ins
     for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
@@ -383,6 +384,8 @@ bool _ValidateFlags(unsigned int pFlags)
 void Importer::FreeScene( )
 {
     ASSIMP_BEGIN_EXCEPTION_REGION();
+
+    aiReleaseDefaultMaterial();
     delete pimpl->mScene;
     pimpl->mScene = NULL;
 

+ 1 - 1
code/Importer/IFC/IFCGeometry.cpp

@@ -317,7 +317,7 @@ void ProcessRevolvedAreaSolid(const Schema_2x3::IfcRevolvedAreaSolid& solid, Tem
 }
 
 // ------------------------------------------------------------------------------------------------
-void ProcessSweptDiskSolid(const Schema_2x3::IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv)
+void ProcessSweptDiskSolid(const Schema_2x3::IfcSweptDiskSolid &solid, TempMesh& result, ConversionData& conv)
 {
     const Curve* const curve = Curve::Convert(*solid.Directrix, conv);
     if(!curve) {

+ 56 - 24
code/MaterialSystem.cpp

@@ -63,9 +63,9 @@ aiReturn aiGetMaterialProperty(const aiMaterial* pMat,
     unsigned int index,
     const aiMaterialProperty** pPropOut)
 {
-    ai_assert (pMat != NULL);
-    ai_assert (pKey != NULL);
-    ai_assert (pPropOut != NULL);
+    ai_assert( pMat != NULL );
+    ai_assert( pKey != NULL );
+    ai_assert( pPropOut != NULL );
 
     /*  Just search for a property with exactly this name ..
      *  could be improved by hashing, but it's possibly
@@ -76,7 +76,7 @@ aiReturn aiGetMaterialProperty(const aiMaterial* pMat,
 
         if (prop /* just for safety ... */
             && 0 == strcmp( prop->mKey.data, pKey )
-            && (UINT_MAX == type  || prop->mSemantic == type) /* UINT_MAX is a wildcard, but this is undocumented :-) */
+            && (UINT_MAX == type  || prop->mSemantic == type) /* UINT_MAX is a wild-card, but this is undocumented :-) */
             && (UINT_MAX == index || prop->mIndex == index))
         {
             *pPropOut = pMat->mProperties[i];
@@ -96,8 +96,8 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial* pMat,
     ai_real* pOut,
     unsigned int* pMax)
 {
-    ai_assert (pOut != NULL);
-    ai_assert (pMat != NULL);
+    ai_assert( pOut != NULL );
+    ai_assert( pMat != NULL );
 
     const aiMaterialProperty* prop;
     aiGetMaterialProperty(pMat,pKey,type,index, (const aiMaterialProperty**) &prop);
@@ -182,8 +182,8 @@ aiReturn aiGetMaterialIntegerArray(const aiMaterial* pMat,
     int* pOut,
     unsigned int* pMax)
 {
-    ai_assert (pOut != NULL);
-    ai_assert (pMat != NULL);
+    ai_assert( pOut != NULL );
+    ai_assert( pMat != NULL );
 
     const aiMaterialProperty* prop;
     aiGetMaterialProperty(pMat,pKey,type,index,(const aiMaterialProperty**) &prop);
@@ -274,7 +274,7 @@ aiReturn aiGetMaterialUVTransform(const aiMaterial* pMat,
     aiUVTransform* pOut)
 {
     unsigned int iMax = 4;
-    return  aiGetMaterialFloatArray(pMat,pKey,type,index,(ai_real*)pOut,&iMax);
+    return aiGetMaterialFloatArray(pMat,pKey,type,index,(ai_real*)pOut,&iMax);
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -314,7 +314,7 @@ aiReturn aiGetMaterialString(const aiMaterial* pMat,
 
 // ------------------------------------------------------------------------------------------------
 // Get the number of textures on a particular texture stack
-ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,
+unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,
     C_ENUM aiTextureType type)
 {
     ai_assert (pMat != NULL);
@@ -347,12 +347,14 @@ aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
     unsigned int* flags         /*= NULL*/
     )
 {
-    ai_assert(NULL != mat && NULL != path);
+    ai_assert( NULL != mat );
+    ai_assert( NULL != path );
 
     // Get the path to the texture
     if (AI_SUCCESS != aiGetMaterialString(mat,AI_MATKEY_TEXTURE(type,index),path))  {
         return AI_FAILURE;
     }
+
     // Determine mapping type
     int mapping_ = static_cast<int>(aiTextureMapping_UV);
     aiGetMaterialInteger(mat,AI_MATKEY_MAPPING(type,index), &mapping_);
@@ -381,15 +383,37 @@ aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
     if (flags){
         aiGetMaterialInteger(mat,AI_MATKEY_TEXFLAGS(type,index),(int*)flags);
     }
+
     return AI_SUCCESS;
 }
 
+static aiMaterial *DefaultMaterial = nullptr;
+
+// ------------------------------------------------------------------------------------------------
+// Will return the default material.
+aiMaterial *aiCreateAndRegisterDefaultMaterial() {
+    if (nullptr == DefaultMaterial) {
+        DefaultMaterial = new aiMaterial;
+        aiString s;
+        s.Set(AI_DEFAULT_MATERIAL_NAME);
+        DefaultMaterial->AddProperty(&s, AI_MATKEY_NAME);
+    }
+
+    return DefaultMaterial;
+}
+
+// ------------------------------------------------------------------------------------------------
+// Will return the default material.
+void aiReleaseDefaultMaterial() {
+    DefaultMaterial = nullptr;
+}
+
 static const unsigned int DefaultNumAllocated = 5;
 
 // ------------------------------------------------------------------------------------------------
 // Construction. Actually the one and only way to get an aiMaterial instance
 aiMaterial::aiMaterial() 
-: mProperties( NULL )
+: mProperties( nullptr )
 , mNumProperties( 0 )
 , mNumAllocated( DefaultNumAllocated ) {
     // Allocate 5 entries by default
@@ -404,12 +428,20 @@ aiMaterial::~aiMaterial()
     delete[] mProperties;
 }
 
+// ------------------------------------------------------------------------------------------------
+aiString aiMaterial::GetName() {
+    aiString name;
+    Get(AI_MATKEY_NAME, name);
+
+    return name;
+}
+
 // ------------------------------------------------------------------------------------------------
 void aiMaterial::Clear()
 {
-    for (unsigned int i = 0; i < mNumProperties;++i)    {
+    for ( unsigned int i = 0; i < mNumProperties; ++i )    {
         // delete this entry
-        delete mProperties[i];
+        delete mProperties[ i ];
         AI_DEBUG_INVALIDATE_PTR(mProperties[i]);
     }
     mNumProperties = 0;
@@ -418,11 +450,9 @@ void aiMaterial::Clear()
 }
 
 // ------------------------------------------------------------------------------------------------
-aiReturn aiMaterial::RemoveProperty (const char* pKey,unsigned int type,
-    unsigned int index
-    )
+aiReturn aiMaterial::RemoveProperty ( const char* pKey,unsigned int type, unsigned int index )
 {
-    ai_assert(NULL != pKey);
+    ai_assert( nullptr != pKey );
 
     for (unsigned int i = 0; i < mNumProperties;++i) {
         aiMaterialProperty* prop = mProperties[i];
@@ -454,17 +484,18 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
     aiPropertyTypeInfo pType
     )
 {
-    ai_assert (pInput != NULL);
-    ai_assert (pKey != NULL);
-    ai_assert (0 != pSizeInBytes);
+    ai_assert( pInput != NULL );
+    ai_assert( pKey != NULL );
+    ai_assert( 0 != pSizeInBytes );
 
     if ( 0 == pSizeInBytes ) {
 
     }
+
     // first search the list whether there is already an entry with this key
-    unsigned int iOutIndex = UINT_MAX;
-    for (unsigned int i = 0; i < mNumProperties;++i)    {
-        aiMaterialProperty* prop = mProperties[i];
+    unsigned int iOutIndex( UINT_MAX );
+    for ( unsigned int i = 0; i < mNumProperties; ++i ) {
+        aiMaterialProperty *prop( mProperties[ i ] );
 
         if (prop /* just for safety */ && !strcmp( prop->mKey.data, pKey ) &&
             prop->mSemantic == type && prop->mIndex == index){
@@ -516,6 +547,7 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
     }
     // push back ...
     mProperties[mNumProperties++] = pcNew;
+
     return AI_SUCCESS;
 }
 

+ 5 - 7
code/ObjFileMtlImporter.cpp

@@ -84,8 +84,6 @@ static const std::string BumpOption         = "-bm";
 static const std::string ChannelOption      = "-imfchan";
 static const std::string TypeOption         = "-type";
 
-
-
 // -------------------------------------------------------------------
 //  Constructor
 ObjFileMtlImporter::ObjFileMtlImporter( std::vector<char> &buffer,
@@ -334,6 +332,11 @@ void ObjFileMtlImporter::getTexture() {
         // Specular texture
         out = & m_pModel->m_pCurrentMaterial->textureSpecular;
         clampIndex = ObjFile::Material::TextureSpecularType;
+    } else if ( !ASSIMP_strincmp( pPtr, DisplacementTexture1.c_str(), static_cast<unsigned int>(DisplacementTexture1.size()) ) ||
+                !ASSIMP_strincmp( pPtr, DisplacementTexture2.c_str(), static_cast<unsigned int>(DisplacementTexture2.size()) ) ) {
+        // Displacement texture
+        out = &m_pModel->m_pCurrentMaterial->textureDisp;
+        clampIndex = ObjFile::Material::TextureDispType;
     } else if ( !ASSIMP_strincmp( pPtr, OpacityTexture.c_str(), static_cast<unsigned int>(OpacityTexture.size()) ) ) {
         // Opacity texture
         out = & m_pModel->m_pCurrentMaterial->textureOpacity;
@@ -356,11 +359,6 @@ void ObjFileMtlImporter::getTexture() {
         // Reflection texture(s)
         //Do nothing here
         return;
-    } else if ( !ASSIMP_strincmp( pPtr, DisplacementTexture1.c_str(), static_cast<unsigned int>(DisplacementTexture1.size()) ) ||
-                !ASSIMP_strincmp( pPtr, DisplacementTexture2.c_str(), static_cast<unsigned int>(DisplacementTexture2.size()) ) ) {
-        // Displacement texture
-        out = &m_pModel->m_pCurrentMaterial->textureDisp;
-        clampIndex = ObjFile::Material::TextureDispType;
     } else if ( !ASSIMP_strincmp( pPtr, SpecularityTexture.c_str(), static_cast<unsigned int>(SpecularityTexture.size()) ) ) {
         // Specularity scaling (glossiness)
         out = & m_pModel->m_pCurrentMaterial->textureSpecularity;

+ 22 - 8
code/STLLoader.cpp

@@ -90,6 +90,9 @@ static bool IsBinarySTL(const char* buffer, unsigned int fileSize) {
     return expectedBinaryFileSize == fileSize;
 }
 
+static const size_t BufferSize = 500;
+static const char UnicodeBoundary = 127;
+
 // An ascii STL buffer will begin with "solid NAME", where NAME is optional.
 // Note: The "solid NAME" check is necessary, but not sufficient, to determine
 // if the buffer is ASCII; a binary header could also begin with "solid NAME".
@@ -108,10 +111,10 @@ static bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
     bool isASCII( strncmp( buffer, "solid", 5 ) == 0 );
     if( isASCII ) {
         // A lot of importers are write solid even if the file is binary. So we have to check for ASCII-characters.
-        if( fileSize >= 500 ) {
+        if( fileSize >= BufferSize) {
             isASCII = true;
-            for( unsigned int i = 0; i < 500; i++ ) {
-                if( buffer[ i ] > 127 ) {
+            for( unsigned int i = 0; i < BufferSize; i++ ) {
+                if( buffer[ i ] > UnicodeBoundary) {
                     isASCII = false;
                     break;
                 }
@@ -211,10 +214,11 @@ void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
 
     // create a single default material, using a white diffuse color for consistency with
     // other geometric types (e.g., PLY).
-    aiMaterial* pcMat = new aiMaterial();
+    aiMaterial* pcMat = aiCreateAndRegisterDefaultMaterial();
+    /*aiMaterial* pcMat = new aiMaterial();
     aiString s;
     s.Set(AI_DEFAULT_MATERIAL_NAME);
-    pcMat->AddProperty(&s, AI_MATKEY_NAME);
+    pcMat->AddProperty(&s, AI_MATKEY_NAME);*/
 
     aiColor4D clrDiffuse(ai_real(1.0),ai_real(1.0),ai_real(1.0),ai_real(1.0));
     if (bMatClr) {
@@ -535,11 +539,21 @@ bool STLImporter::LoadBinaryFile()
     // now copy faces
     addFacesToMesh(pMesh);
 
+    aiNode* root = pScene->mRootNode;
+
+    // allocate one node
+    aiNode* node = new aiNode();
+    node->mParent = root;
+
+    root->mNumChildren = 1u;
+    root->mChildren = new aiNode*[root->mNumChildren];
+    root->mChildren[0] = node;
+
     // add all created meshes to the single node
-    pScene->mRootNode->mNumMeshes = pScene->mNumMeshes;
-    pScene->mRootNode->mMeshes = new unsigned int[pScene->mNumMeshes];
+    node->mNumMeshes = pScene->mNumMeshes;
+    node->mMeshes = new unsigned int[pScene->mNumMeshes];
     for (unsigned int i = 0; i < pScene->mNumMeshes; i++)
-        pScene->mRootNode->mMeshes[i] = i;
+        node->mMeshes[i] = i;
 
     if (bIsMaterialise && !pMesh->mColors[0])
     {

+ 10 - 6
code/ScenePrivate.h

@@ -55,12 +55,8 @@ namespace Assimp {
 class Importer;
 
 struct ScenePrivateData {
-    ScenePrivateData()
-    : mOrigImporter( nullptr )
-    , mPPStepsApplied( 0 )
-    , mIsCopy( false ) {
-        // empty
-    }
+    //  The struct constructor.
+    ScenePrivateData();
 
     // Importer that originally loaded the scene though the C-API
     // If set, this object is owned by this private data instance.
@@ -77,6 +73,14 @@ struct ScenePrivateData {
     bool mIsCopy;
 };
 
+inline
+ScenePrivateData::ScenePrivateData()
+: mOrigImporter( nullptr )
+, mPPStepsApplied( 0 )
+, mIsCopy( false ) {
+    // empty
+}
+
 // Access private data stored in the scene
 inline
 ScenePrivateData* ScenePriv(aiScene* in) {

+ 5 - 3
code/Version.cpp

@@ -150,9 +150,11 @@ ASSIMP_API aiScene::~aiScene() {
             delete mMeshes[a];
     delete [] mMeshes;
 
-    if (mNumMaterials && mMaterials)
-        for( unsigned int a = 0; a < mNumMaterials; a++)
-            delete mMaterials[a];
+    if (mNumMaterials && mMaterials) {
+        for (unsigned int a = 0; a < mNumMaterials; ++a ) {
+            delete mMaterials[ a ];
+        }
+    }
     delete [] mMaterials;
 
     if (mNumAnimations && mAnimations)

+ 31 - 23
code/glTF2Importer.cpp

@@ -117,13 +117,9 @@ bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool
 
     if (pIOHandler) {
         glTF2::Asset asset(pIOHandler);
-        try {
-            asset.Load(pFile, extension == "glb");
-            std::string version = asset.asset.version;
-            return !version.empty() && version[0] == '2';
-        } catch (...) {
-            return false;
-        }
+        asset.Load(pFile, extension == "glb");
+        std::string version = asset.asset.version;
+        return !version.empty() && version[0] == '2';
     }
 
     return false;
@@ -550,9 +546,18 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
                     case PrimitiveMode_TRIANGLE_STRIP: {
                         nFaces = count - 2;
                         faces = new aiFace[nFaces];
-                        SetFace(faces[0], data.GetUInt(0), data.GetUInt(1), data.GetUInt(2));
-                        for (unsigned int i = 3; i < count; ++i) {
-                            SetFace(faces[i - 2], faces[i - 1].mIndices[1], faces[i - 1].mIndices[2], data.GetUInt(i));
+                        for (unsigned int i = 0; i < nFaces; ++i) {
+                            //The ordering is to ensure that the triangles are all drawn with the same orientation
+                            if ((i + 1) % 2 == 0)
+                            {
+                                //For even n, vertices n + 1, n, and n + 2 define triangle n
+                                SetFace(faces[i], data.GetUInt(i + 1), data.GetUInt(i), data.GetUInt(i + 2));
+                            }
+                            else
+                            {
+                                //For odd n, vertices n, n+1, and n+2 define triangle n
+                                SetFace(faces[i], data.GetUInt(i), data.GetUInt(i + 1), data.GetUInt(i + 2));
+                            }
                         }
                         break;
                     }
@@ -560,8 +565,8 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
                         nFaces = count - 2;
                         faces = new aiFace[nFaces];
                         SetFace(faces[0], data.GetUInt(0), data.GetUInt(1), data.GetUInt(2));
-                        for (unsigned int i = 3; i < count; ++i) {
-                            SetFace(faces[i - 2], faces[0].mIndices[0], faces[i - 1].mIndices[2], data.GetUInt(i));
+                        for (unsigned int i = 1; i < nFaces; ++i) {
+                            SetFace(faces[i], faces[0].mIndices[0], faces[i - 1].mIndices[2], data.GetUInt(i + 2));
                         }
                         break;
                 }
@@ -615,9 +620,18 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
                 case PrimitiveMode_TRIANGLE_STRIP: {
                     nFaces = count - 2;
                     faces = new aiFace[nFaces];
-                    SetFace(faces[0], 0, 1, 2);
-                    for (unsigned int i = 3; i < count; ++i) {
-                        SetFace(faces[i - 2], faces[i - 1].mIndices[1], faces[i - 1].mIndices[2], i);
+                    for (unsigned int i = 0; i < nFaces; ++i) {
+                        //The ordering is to ensure that the triangles are all drawn with the same orientation
+                        if ((i+1) % 2 == 0)
+                        {
+                            //For even n, vertices n + 1, n, and n + 2 define triangle n
+                            SetFace(faces[i], i+1, i, i+2);
+                        }
+                        else
+                        {
+                            //For odd n, vertices n, n+1, and n+2 define triangle n
+                            SetFace(faces[i], i, i+1, i+2);
+                        }
                     }
                     break;
                 }
@@ -625,8 +639,8 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
                     nFaces = count - 2;
                     faces = new aiFace[nFaces];
                     SetFace(faces[0], 0, 1, 2);
-                    for (unsigned int i = 3; i < count; ++i) {
-                        SetFace(faces[i - 2], faces[0].mIndices[0], faces[i - 1].mIndices[2], i);
+                    for (unsigned int i = 1; i < nFaces; ++i) {
+                        SetFace(faces[i], faces[0].mIndices[0], faces[i - 1].mIndices[2], i + 2);
                     }
                     break;
                 }
@@ -848,12 +862,6 @@ void glTF2Importer::InternReadFile(const std::string& pFile, aiScene* pScene, IO
 
     ImportNodes(asset);
 
-    // TODO: it does not split the loaded vertices, should it?
-    //pScene->mFlags |= AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
-    MakeVerboseFormatProcess process;
-    process.Execute(pScene);
-
-
     if (pScene->mNumMeshes == 0) {
         pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
     }

+ 0 - 5
code/glTFImporter.cpp

@@ -740,11 +740,6 @@ void glTFImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOS
 
     ImportNodes(asset);
 
-    // TODO: it does not split the loaded vertices, should it?
-    //pScene->mFlags |= AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
-	MakeVerboseFormatProcess process;
-    process.Execute(pScene);
-
 
     if (pScene->mNumMeshes == 0) {
         pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;

+ 1 - 1
include/assimp/Macros.h

@@ -3,7 +3,7 @@
 Open Asset Import Library (assimp)
 ---------------------------------------------------------------------------
 
-Copyright (c) 2006-2012, assimp team
+Copyright (c) 2006-2018, assimp team
 
 All rights reserved.
 

+ 37 - 6
include/assimp/material.h

@@ -608,16 +608,17 @@ struct aiMaterialProperty
 #ifdef __cplusplus
 
     aiMaterialProperty()
-        : mSemantic( 0 )
-        , mIndex( 0 )
-        , mDataLength( 0 )
-        , mType( aiPTI_Float )
-        , mData( NULL )
-    {
+    : mSemantic( 0 )
+    , mIndex( 0 )
+    , mDataLength( 0 )
+    , mType( aiPTI_Float )
+    , mData(nullptr) {
+        // empty
     }
 
     ~aiMaterialProperty()   {
         delete[] mData;
+        mData = nullptr;
     }
 
 #endif
@@ -651,6 +652,14 @@ public:
     aiMaterial();
     ~aiMaterial();
 
+    // -------------------------------------------------------------------
+    /**
+      * @brief  Returns the name of the material.
+      * @return The name of the material.
+      */
+    // -------------------------------------------------------------------
+    aiString GetName();
+
     // -------------------------------------------------------------------
     /** @brief Retrieve an array of Type values with a specific key
      *  from the material
@@ -1556,10 +1565,32 @@ C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
     unsigned int* flags                 /*= NULL*/);
 #endif // !#ifdef __cplusplus
 
+// ---------------------------------------------------------------------------
+/** @brief  Helper function to get all values pertaining to a particular
+*  texture slot from a material structure.
+*
+*  @return Pointer showing to the default material.
+*/
+// ---------------------------------------------------------------------------
+#ifdef __cplusplus
+ASSIMP_API aiMaterial *aiCreateAndRegisterDefaultMaterial(void);
+#else
+C_STRUCT aiMaterial *aiCreateAndRegisterDefaultMaterial(void);
+#endif // !#ifdef __cplusplus
+
+// ---------------------------------------------------------------------------
+/**
+  * @brief  Helper function to release the default material instance, the
+  *         instance will not be destroyed.
+  */
+// ---------------------------------------------------------------------------
+ASSIMP_API void aiReleaseDefaultMaterial();
+
 #ifdef __cplusplus
 }
 
 #include "material.inl"
 
 #endif //!__cplusplus
+
 #endif //!!AI_MATERIAL_H_INC

+ 2 - 2
include/assimp/material.inl

@@ -120,7 +120,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
     const aiMaterialProperty* prop;
     const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx,
         (const aiMaterialProperty**)&prop);
-    if ( AI_SUCCESS == ret )    {
+    if ( AI_SUCCESS == ret ) {
 
         if (prop->mDataLength < sizeof(Type)) {
             return AI_FAILURE;
@@ -130,7 +130,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
             return AI_FAILURE;
         }
 
-        ::memcpy(&pOut,prop->mData,sizeof(Type));
+        ::memcpy( &pOut, prop->mData, sizeof( Type ) );
     }
     return ret;
 }

+ 21 - 0
test/models/glTF2/glTF-Asset-Generator/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Gary Hsu
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_00.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 1024,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_00.bin",
+      "byteLength": 12288
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 12288,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 0
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_01.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 8,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_01.bin",
+      "byteLength": 96
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 96,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 1
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_02.bin",
+      "byteLength": 48
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 2
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 5,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_03.bin",
+      "byteLength": 60
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 60,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 3
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_04.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_04.bin",
+      "byteLength": 48
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 5
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.bin


+ 63 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_05.gltf

@@ -0,0 +1,63 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_05.bin",
+      "byteLength": 48
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "mode": 6
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.bin


+ 62 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_06.gltf

@@ -0,0 +1,62 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 6,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_06.bin",
+      "byteLength": 72
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 72,
+      "name": "Positions"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          }
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 1024,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 1024,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_07.bin",
+      "byteLength": 16384
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 12288,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 12288,
+      "byteLength": 4096,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 0
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 8,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_08.bin",
+      "byteLength": 80
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 32,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 1
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 4,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_09.bin",
+      "byteLength": 64
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 16,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 2
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 5,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_10.bin",
+      "byteLength": 68
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 20,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 3
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 4,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_11.bin",
+      "byteLength": 64
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 16,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 5
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.bin


+ 77 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf

@@ -0,0 +1,77 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 4,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_12.bin",
+      "byteLength": 64
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 16,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1,
+          "mode": 6
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_13.bin


+ 76 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_13.gltf

@@ -0,0 +1,76 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5125,
+      "count": 6,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_13.bin",
+      "byteLength": 72
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 24,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_14.bin


+ 76 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_14.gltf

@@ -0,0 +1,76 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5121,
+      "count": 6,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_14.bin",
+      "byteLength": 54
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 6,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

binární
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_15.bin


+ 76 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_15.gltf

@@ -0,0 +1,76 @@
+{
+  "accessors": [
+    {
+      "bufferView": 0,
+      "componentType": 5126,
+      "count": 4,
+      "type": "VEC3",
+      "max": [
+        0.5,
+        0.5,
+        0.0
+      ],
+      "min": [
+        -0.5,
+        -0.5,
+        0.0
+      ],
+      "name": "Positions Accessor"
+    },
+    {
+      "bufferView": 1,
+      "componentType": 5123,
+      "count": 6,
+      "type": "SCALAR",
+      "name": "Indices Accessor"
+    }
+  ],
+  "asset": {
+    "generator": "glTF Asset Generator",
+    "version": "2.0"
+  },
+  "buffers": [
+    {
+      "uri": "Mesh_PrimitiveMode_15.bin",
+      "byteLength": 60
+    }
+  ],
+  "bufferViews": [
+    {
+      "buffer": 0,
+      "byteLength": 48,
+      "name": "Positions"
+    },
+    {
+      "buffer": 0,
+      "byteOffset": 48,
+      "byteLength": 12,
+      "name": "Indices"
+    }
+  ],
+  "meshes": [
+    {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": 0
+          },
+          "indices": 1
+        }
+      ]
+    }
+  ],
+  "nodes": [
+    {
+      "mesh": 0
+    }
+  ],
+  "scene": 0,
+  "scenes": [
+    {
+      "nodes": [
+        0
+      ]
+    }
+  ]
+}

+ 33 - 0
test/models/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/README.md

@@ -0,0 +1,33 @@
+These models are intended to test indices, vertexes without indices, and using mode to render different primitive types.  
+
+All values of Byte, Short, and Int are unsigned.  
+
+All model indices relate to vertices as shown by the Indices figure below, except for models using Points Mode:  
+
+| Indices | Indices (For Points Mode) |
+| :---: | :---: | 
+| <img src="Figures/Indices.png" height="144" width="144" align="middle"> | <img src="Figures/Indices_Points.png" height="144" width="144" align="middle"> | 
+
+<br>
+
+The following table shows the properties that are set for a given model.  
+
+|   | Sample Image | Mode | Indices Values | Indices Component Type |
+| :---: | :---: | :---: | :---: | :---: |
+| [00](Mesh_PrimitiveMode_00.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=0) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_00.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_00.png) | Points |   |   |
+| [01](Mesh_PrimitiveMode_01.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=1) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_01.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_01.png) | Lines |   |   |
+| [02](Mesh_PrimitiveMode_02.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=2) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_02.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_02.png) | Line Loop |   |   |
+| [03](Mesh_PrimitiveMode_03.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=3) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_03.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_03.png) | Line Strip |   |   |
+| [04](Mesh_PrimitiveMode_04.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=4) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_04.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_04.png) | Triangle Strip |   |   |
+| [05](Mesh_PrimitiveMode_05.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=5) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_05.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_05.png) | Triangle Fan |   |   |
+| [06](Mesh_PrimitiveMode_06.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=6) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_06.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_06.png) | Triangles |   |   |
+| [07](Mesh_PrimitiveMode_07.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=7) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_07.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_07.png) | Points | [0 - 1023] | Int |
+| [08](Mesh_PrimitiveMode_08.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=8) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_08.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_08.png) | Lines | [0, 3, 3, 2, 2, 1, 1, 0] | Int |
+| [09](Mesh_PrimitiveMode_09.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=9) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_09.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_09.png) | Line Loop | [0, 3, 2, 1] | Int |
+| [10](Mesh_PrimitiveMode_10.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=10) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_10.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_10.png) | Line Strip | [0, 3, 2, 1, 0] | Int |
+| [11](Mesh_PrimitiveMode_11.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=11) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_11.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_11.png) | Triangle Strip | [0, 3, 1, 2] | Int |
+| [12](Mesh_PrimitiveMode_12.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=12) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_12.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_12.png) | Triangle Fan | [0, 3, 2, 1] | Int |
+| [13](Mesh_PrimitiveMode_13.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=13) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_13.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_13.png) | Triangles | [1, 0, 3, 1, 3, 2] | Int |
+| [14](Mesh_PrimitiveMode_14.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=14) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_14.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_14.png) | Triangles | [1, 0, 3, 1, 3, 2] | Byte |
+| [15](Mesh_PrimitiveMode_15.gltf)<br>[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=12&model=15) | [<img src="Figures/Thumbnails/Mesh_PrimitiveMode_15.png" align="middle">](Figures/SampleImages/Mesh_PrimitiveMode_15.png) | Triangles | [1, 0, 3, 1, 3, 2] | Short |
+ 

+ 22 - 2
test/unit/utMaterialSystem.cpp

@@ -120,8 +120,7 @@ TEST_F(MaterialSystemTest, testColorProperty)
 }
 
 // ------------------------------------------------------------------------------------------------
-TEST_F(MaterialSystemTest, testStringProperty)
-{
+TEST_F(MaterialSystemTest, testStringProperty) {
     aiString s;
     s.Set("Hello, this is a small test");
     this->pcMat->AddProperty(&s,"testKey6");
@@ -129,3 +128,24 @@ TEST_F(MaterialSystemTest, testStringProperty)
     EXPECT_EQ(AI_SUCCESS, pcMat->Get("testKey6",0,0,s));
     EXPECT_STREQ("Hello, this is a small test", s.data);
 }
+
+// ------------------------------------------------------------------------------------------------
+TEST_F(MaterialSystemTest, testDefaultMaterialAccess) {
+    aiMaterial *mat = aiCreateAndRegisterDefaultMaterial();
+    EXPECT_NE(nullptr, mat);
+    aiReleaseDefaultMaterial();
+
+    delete mat;
+}
+
+// ------------------------------------------------------------------------------------------------
+TEST_F(MaterialSystemTest, testMaterialNameAccess) {
+    aiMaterial *mat = aiCreateAndRegisterDefaultMaterial();
+    EXPECT_NE(nullptr, mat);
+
+    aiString name = mat->GetName();
+    const int retValue(strncmp(name.C_Str(), AI_DEFAULT_MATERIAL_NAME, name.length));
+    EXPECT_EQ(0, retValue );
+
+    delete mat;
+}

+ 1 - 1
test/unit/utSTLImportExport.cpp

@@ -63,7 +63,7 @@ public:
     }
 };
 
-TEST_F( utSTLImporterExporter, importXFromFileTest ) {
+TEST_F( utSTLImporterExporter, importSTLFromFileTest ) {
     EXPECT_TRUE( importerTest() );
 }
 

+ 229 - 0
test/unit/utglTF2ImportExport.cpp

@@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/Exporter.hpp>
 #include <assimp/postprocess.h>
 #include <assimp/scene.h>
+#include <array>
 
 using namespace Assimp;
 
@@ -100,6 +101,234 @@ TEST_F( utglTF2ImportExport, importBinaryglTF2FromFileTest ) {
     EXPECT_TRUE( binaryImporterTest() );
 }
 
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePointsWithoutIndices) {
+    Assimp::Importer importer;
+    //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]->mFaces[i].mIndices[0], i);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesWithoutIndices) {
+    Assimp::Importer importer;
+    //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);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesLoopWithoutIndices) {
+    Assimp::Importer importer;
+    //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);
+
+    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);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesStripWithoutIndices) {
+    Assimp::Importer importer;
+    //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]->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[i].mIndices[0], i);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], i + 1);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStripWithoutIndices) {
+    Assimp::Importer importer;
+    //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]->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)
+    {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices) {
+    Assimp::Importer importer;
+    //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]->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)
+    {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesWithoutIndices) {
+    Assimp::Importer importer;
+    //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]->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)
+    {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePoints) {
+    Assimp::Importer importer;
+    //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]->mFaces[i].mIndices[0], i);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) {
+    Assimp::Importer importer;
+    //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);
+    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]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) {
+    Assimp::Importer importer;
+    //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);
+    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]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) {
+    Assimp::Importer importer;
+    //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]->mFaces[i].mIndices[0], l1[i]);
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) {
+    Assimp::Importer importer;
+    //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]->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)
+    {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
+    }
+}
+
+TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) {
+    Assimp::Importer importer;
+    //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]->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)
+    {
+        EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
+    }
+}
+
 #ifndef ASSIMP_BUILD_NO_EXPORT
 TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
     EXPECT_TRUE( exporterTest() );