本文介绍了如何使用Assimp加载Blender的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Assimp库在C ++中使用下列code装载搅拌机的文件,但它失败,因为它没有任何网格在所有。我现在用的搅拌机的文件是用搅拌机本身保存默认的立方体。

I tried to load Blender file using Assimp library on C++ using the following code, but it fails since it doesn't have any meshes at all. The blender file I am using is the default cube saved using Blender itself.

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

我在做什么错在这里,我需要使用的特殊标志,以装载搅拌机对象?或者我需要在搅拌机对象导出某种方式?

What am I doing wrong here, do I need to include special flag in order to load blender object ? Or do I need to export the Blender object in certain way ?

推荐答案

搅拌机文件难以阅读,跨preT被任何东西,这不是搅拌机。这样做的原因是,搅拌机文件在搅拌机过程其实结构性的内存转储。除非你打算嵌入整个搅拌机实例到你的程序,你就很难能够分析它。

Blender files are difficult to read and interpret by anything that's not Blender. The reason for this is, that Blender files are in fact structured memory dumps of the Blender process. Unless you plan to embed a whole Blender instance into your program you'll hardly be able to parse it.

相反,你应该使用搅拌机进成才易于加工,一个有据可查的文件格式导出模型。搅拌机附带了大量的3D文件格式的集合。

Instead you should export your model using Blender into someting easy to process, a well documented file format. Blender ships with a collection for a large number of 3D file formats.

这篇关于如何使用Assimp加载Blender的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 08:25