Browse Source

StepFile: Working parser.

Kim Kulling 7 years ago
parent
commit
92f69affd9
1 changed files with 26 additions and 0 deletions
  1. 26 0
      test/unit/utglTF2ImportExport.cpp

+ 26 - 0
test/unit/utglTF2ImportExport.cpp

@@ -347,6 +347,32 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) {
     }
 }
 
+std::vector<char> ReadFile(const char* name)
+{
+    std::vector<char> ret;
+
+    FILE* p = ::fopen(name, "r");
+    if (p)
+    {
+        ::fseek(p, 0, SEEK_END);
+        const auto size = ::ftell(p);
+        ::fseek(p, 0, SEEK_SET);
+
+        ret.resize(size);
+        ::fread(&ret[0], 1, size, p);
+        ::fclose(p);
+    }
+    return ret;
+}
+
+TEST_F(utglTF2ImportExport, importglTF2FromMemory) {
+    const auto flags = aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_RemoveComponent |
+        aiProcess_GenSmoothNormals | aiProcess_PreTransformVertices | aiProcess_FixInfacingNormals |
+        aiProcess_FindDegenerates | aiProcess_GenUVCoords | aiProcess_SortByPType;
+    const auto& buff = ReadFile("C:\\Users\\kimkulling\\Downloads\\camel\\camel\\scene.gltf");
+    const aiScene* Scene = ::aiImportFileFromMemory(&buff[0], buff.size(), flags, ".gltf");
+}
+
 #ifndef ASSIMP_BUILD_NO_EXPORT
 TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
     EXPECT_TRUE( exporterTest() );