Extended Model to support specular and normal maps

This commit is contained in:
2014-04-24 02:36:31 +02:00
parent c1cb4da684
commit 0fbce570ff
2 changed files with 12 additions and 2 deletions
+9 -1
View File
@@ -17,11 +17,19 @@ Model::Model(OBJ &obj, ResourceManager* rm)
if (face.Material != currentMaterial)
{
currentMaterial = face.Material;
// Load texture
auto texture = std::shared_ptr<Texture>(rm->Load<Texture>("Texture", currentMaterial->DiffuseTexture.FileName));
// TODO: Load normal map
std::shared_ptr<Texture> normalMap = nullptr;
// Load specular map
std::shared_ptr<Texture> specularMap = nullptr;
if (!currentMaterial->SpecularMap.FileName.empty())
specularMap = std::shared_ptr<Texture>(rm->Load<Texture>("Texture", currentMaterial->SpecularMap.FileName));
// TODO: Load material parameters
// Create new texture group (start index of new group is upcoming index)
TextureGroup texGroup = { texture, index, index };
TextureGroup texGroup = { texture, normalMap, specularMap, index, index };
TextureGroups.push_back(texGroup);
currentTexGroup = &TextureGroups.back();
}