在相同的.obj模型文件上,Assimp查看器比Assimp c++导入器快得多
Assimp viewer is much faster then Assimp C++ importer on the same .obj model file
assimp库提供了一种从文件加载3D .obj模型的好方法。然而,我发现它附带的assimp_viewer.exe(我使用版本3.1.1)在导入我的。obj文件(42Mb,已经简化)时要快得多,然后我的c++代码加载相同的模型。查看器在几秒钟内加载文件,而我的c++程序(MSVS 2013/Win64/Release)需要154秒才能完成。我在查看器和c++中都尝试了导入器后处理标志,但我无法弥合两者之间的差距。
对原因有什么想法吗?下面是我的c++代码:
#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;
}
找到了我自己的答案:我在Visual Studio中运行它,但在发布模式(F5)下启动调试器。当我在没有调试(CTRL+F5)的情况下启动它时,现在需要1秒才能像assimp查看器一样加载模型。如果您使用文件资源管理器或命令行从外部visual studio运行可执行文件,则同样适用。有调试和没有调试仍然有很大的区别。
相关文章:
- "assimp/config.h"找不到,但它在文件夹中
- 使用 assimp 加载模型 - 不需要提升?
- Assimp 库错误:获取打包成员的地址
- 使用 assimp 获取纹理比例
- Assimp - 如何使用任何文件格式导入带有纹理的网格?
- 无法让 Assimp 在 Windows " linker problem" 上运行?(与2019年相比)
- Assimp 无法加载除 FBX 的漫反射纹理之外的其他纹理
- 似乎无法渲染加载了 Assimp 的模型
- Assimp模型加载库安装/链接故障
- 使用 MinGW 构建 ASSIMP 会导致文件太大错误
- mOffsetMatrix在Assimp中实际上做了什么?
- Cmake 无法正确生成 assimp 解决方案 [Windows 10]
- Assimp 不返回纹理数据
- 无法使用Assimp访问3D模型(.OBJ)的正确数量的顶点
- 如何访问Assimp模型数据以进行碰撞
- aiNodeAnim in Assimp
- assimp-vc140-mt.dll ASSIMP was not found
- 将嵌入式纹理添加到Assimp Matrial
- Assimp错误地进口了OBJ指数
- 危机纳米服中的多个纹理 - 使用Assimp加载模型