ASSIMP 导出导入的场景而不进行任何更改会引发异常
ASSIMP exporting an imported scene without any changes throws exception
我正在做一个项目,我使用 ASSIMP 库导入头像的 3D 网格,更新它并使用相同的 ASSIMP 库再次导出更新的场景。为了实现这一点,作为第一步,我编写了一个代码来导入场景,并且在不进行任何更改的情况下,我将引用传递给导出函数。但是,导出函数给我抛出了一个错误。主要功能如下(您可以验证我没有对导入的场景进行任何更改):
int main(int argc, char** argv)
{
string filename = "../Content/PinocchioMesh/Model1.obj";
Assimp::Importer Importer;
//Importer.
cout << "tReading file using ASSIMP" << endl;
const aiScene* aiscene = Importer.ReadFile(filename.c_str(), aiProcess_JoinIdenticalVertices |
aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_SortByPType | aiProcess_Triangulate);
string str = Importer.GetErrorString();
if (!aiscene) {
printf("Error parsing '%s': '%s'n", filename.c_str(), Importer.GetErrorString());
return false;
}
Assimp::Exporter exporter;
const aiExportFormatDesc* format = exporter.GetExportFormatDescription(0);
int lIndex = filename.find_last_of('/');
//const string path = Filename.substr(0,lIndex+1);
string path = "../Content/PinocchioMesh/";
cout << "tExport path: " << path << endl;
aiReturn ret = exporter.Export(aiscene, format->id, path, aiscene->mFlags);
cout << exporter.GetErrorString() << endl;
return 0;
}
错误出在 Export() 函数中,上面写着:
First-chance exception at 0x1052591B (Assimp32.dll) in ImportRigExport.exe: 0xC0000005: Access violation reading location 0x00000000.
如果有人使用 assimp 导出场景,请帮助我。
似乎 path 不包含文件名,只包含目录部分,因此 export() 不太可能创建输出文件。尽管如此,我同意,Assimp 应该管理此错误情况。
相关文章:
- C++中"覆盖功能的异常规范比基本版本更宽松"的奇怪错误
- 有没有更好的方法来处理异常? try-catch块真的很丑
- VisualC++ 2010 有没有办法找出有关未处理异常错误的更多详细信息
- 为什么 c++ 使用 throw() 关键字来指示函数不会引发任何异常
- 什么时候在 c++ 中使用 exit() 与异常更好?
- 代码不会处理任何异常
- 为什么null std ::可选的被认为小于任何值,而不是更多
- 通过重新加载DLL,避免使用DLL预加载漏洞,任何更好的方法
- HTTP异常::无法连接到任何解决的端点-CPPRESTSDK
- std:任何抛出异常解析函数类型
- 你能在任何独立于架构的低级语言中获得更小的整数吗?
- 是否存在与将数据流式传输到 c++ 异常类相关的任何危险
- 为什么重载运算符上的异常说明符'<<'不适用于任何 std::ostream 对象,但对库中定义的运算符不起作用?
- C 向量异常处理:哪一种是抛出out_of_range()的更好方法以及原因
- 任何更快地生成元素并检查它们是否为素数的方法
- STL 中是否有任何错误代码异常
- 在C++中使用armadillo lib将条目分配到稀疏矩阵中的任何更快的方法
- 在c++中,任何更好的方法都可以做到这一点,计算谜题的解决方案(49!结果,49个循环)
- 在for循环内部使用时,是否存在任何异常甚至极端的情况,即后增量实际上比预增量更好
- 计算分布流中字符串数的任何更快方法