The assimp library provides a nice way to load 3D .obj models from file. However I found out that the assimp_viewer.exe that comes with it (I use version 3.1.1) is much faster in importing my .obj file (42Mb, already simplified) then my C++ code that loads the same model. The viewer loads the file in a couple of seconds whereas my C++ program (MSVS 2013/Win64/Release) takes 154 seconds to do that. I experimented with the importer post processing flags both in the viewer and C++ but I cannot bridge the gap between the two.
Any thoughts on the cause? Here is my C++ code:
#include <ctime>
#include <iostream>
#include <fstream>
#include <vector>
#include "assimp/Importer.hpp"
#include "assimp/scene.h"
#include "assimp/postprocess.h"
#include "assimp/progresshandler.hpp"
using namespace std;
int main(int argc, char* argv[])
{
Assimp::Importer importer;
unsigned int post_processing_flags = aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices |
aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph | aiProcess_ImproveCacheLocality;
cout << "starting load: ";
auto begin = clock();
auto scene = importer.ReadFile( "MODEL.obj", post_processing_flags);
auto end = clock();
cout << "done!\n";
double seconds = (end - begin) / CLOCKS_PER_SEC;
cout << "loading took " << seconds << " seconds" << endl;
return 0;
}