#include#include #include int main() { Assimp::Importer importer; const aiScene* scene = importer.ReadFile("my_model.obj", aiProcess_Triangulate | aiProcess_FlipUVs); // use the scene data return 0; }
#include#include #include #include int main() { Assimp::Importer importer; const aiScene* scene = importer.ReadFile("my_model.obj", aiProcess_Triangulate | aiProcess_FlipUVs); if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) { std::cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << std::endl; return 1; } // use the scene data return 0; }
#includeIn this example, we access some of the data in the imported model. We find the number of meshes in the scene and grab the first mesh. We then access the number of vertices in the mesh and print it to the console. Package library: assimp#include #include #include int main() { Assimp::Importer importer; const aiScene* scene = importer.ReadFile("my_model.obj", aiProcess_Triangulate | aiProcess_FlipUVs); if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) { std::cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << std::endl; return 1; } int num_meshes = scene->mNumMeshes; const aiMesh* mesh = scene->mMeshes[0]; int num_vertices = mesh->mNumVertices; std::cout << "The model has " << num_vertices << " vertices." << std::endl; // use the scene data return 0; }