2#include "assimp/scene.h"
7const std::map<TextureType, uint32_t> ModelMaterial::sTextureTypeMappings =
47 material.Get(AI_MATKEY_NAME, name);
52 aiTextureType mappedTextureType =
static_cast<aiTextureType
>(sTextureTypeMappings.at(textureType));
54 uint32_t textureCount = material.GetTextureCount(mappedTextureType);
55 if( textureCount > 0 )
57 std::vector<std::string> textures;
58 textures.reserve(textureCount);
59 for( uint32_t textureIndex = 0; textureIndex < textureCount; textureIndex++ )
62 if( material.GetTexture(mappedTextureType, textureIndex, &path) == AI_SUCCESS )
64 textures.push_back(path.C_Str());
67 mTextures.emplace(textureType, move(textures));
Represents a 3D model composed of multiple meshes and materials.
const std::string & Name() const
Gets the material name as defined in the source file.
const std::map< TextureType, std::vector< std::string > > Textures() const
Retrieves the list of textures associated with each texture type.
ModelMaterial(Model &model)
Constructs an empty material associated with a model.
Model & GetModel()
Returns a reference to the owning Model.
TextureType
Enumerates supported texture map types for imported materials.