Sinigr
Sinigr

Reputation: 154

Assimp with android port. Error import .obj file

I am built assimp for android with android port (AndroidJNIIOSystem). When I import a file from assets, I get message: Assimp: Asset exists and next get error: Error::Assimp::No suitable reader found for the file format of file "model/nanosuit.obj".

I have assets hierarchy: assets/model/nanosuit.obj

My code:

importer.SetIOHandler(ioSystem);

auto modelPath = "model/nanosuit.obj";
const aiScene *scene =
        importer.ReadFile(modelPath, aiProcess_Triangulate | aiProcess_FlipUVs);

if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) {
    LOGI("%s::%s", "Error::Assimp", importer.GetErrorString());
}

But then I use this code with assimp built for Linux, it work without any errors. Please, help me find solution. Thanks!

P.S. importer.IsDefaultIOHandler() returns false.

Upvotes: 1

Views: 625

Answers (1)

Sinigr
Sinigr

Reputation: 154

When I build lib, I am use -DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=OFF in order to reduce lib file size. If remove this flag, all works fine. That use .obj importer you need use -DASSIMP_BUILD_OBJ_IMPORTER=ON flag

Upvotes: 2

Related Questions