我正在做一个项目,我使用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()函数中,ans表示:
First-chance exception at 0x1052591B (Assimp32.dll) in ImportRigExport.exe: 0xC0000005: Access violation reading location 0x00000000.
如果有人使用assimp导出场景,请帮助我。
发布于 2016-09-27 10:38:28
path似乎不包含文件名,只包含目录部分,因此for export()不太可能创建输出文件。然而,我同意,Assimp应该处理这个错误情况。
https://stackoverflow.com/questions/35620357
复制相似问题