When I import meshes, I get the material, but can't access the file name of the texture. The .mtl file explicitly shows the filename for the texture. In the code, it shows a texture count of 1 but the filename field shows an empty string and fullPath outputs "*0". In the mTexture it does show the texture file extension ".png" but not the filename of the texture itself. Thanks for any help.
if (scene->HasMaterials())
{
for (unsigned int i = 0; i < scene->mNumMaterials; ++i)
{
aiMaterial* material = scene->mMaterials[i];
aiString name;
material->Get(AI_MATKEY_NAME, name);
aiReturn texFound = scene->mMaterials[i]->GetTexture(aiTextureType_DIFFUSE, i, &name);
if (material->GetTextureCount(aiTextureType_DIFFUSE) > 0)
{
aiString path;
if (material->GetTexture(aiTextureType_DIFFUSE, 0, &path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS)
{
std::string fullPath = path.data;
}
}
}
}