sub*_*b_o 5 opengl 3d blender assimp
我尝试使用以下代码在C++上使用Assimp库加载Blender文件,但它失败了,因为它根本没有任何网格物体.我使用的blender文件是使用Blender本身保存的默认多维数据集.
Assimp::Importer importer;
const aiScene * scene = importer.ReadFile( path, aiProcessPreset_TargetRealtime_Fast );
if( !scene ) {
fprintf( stderr, importer.GetErrorString() );
return false;
}
const aiMesh * mesh = scene->mMeshes[0]; // Fails here since mMeshes is NULL
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么,我是否需要包含特殊标志才能加载blender对象?或者我是否需要以某种方式导出Blender对象?
Blender文件很难通过任何不是Blender的东西来阅读和解释.原因是,Blender文件实际上是Blender进程的结构化内存转储.除非您计划将整个Blender实例嵌入到您的程序中,否则您几乎无法解析它.
相反,您应该使用Blender将模型导出为易于处理的文档格式.Blender附带了大量3D文件格式的集合.