Async load works, using exceptions for special resources.
This commit is contained in:
@@ -141,9 +141,7 @@ RawModel::RawModel(std::string fileName)
|
||||
aiString path;
|
||||
aiTextureMapping mapping;
|
||||
material->GetTexture(aiTextureType_DIFFUSE, 0, &path, &mapping);
|
||||
std::string absolutePath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
//LOG_DEBUG("Diffuse texture: %s", absolutePath.c_str());
|
||||
matGroup.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(absolutePath));
|
||||
matGroup.TexturePath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
}
|
||||
// Normal map
|
||||
//LOG_DEBUG("%i normal maps found", material->GetTextureCount(aiTextureType_HEIGHT));
|
||||
@@ -151,9 +149,7 @@ RawModel::RawModel(std::string fileName)
|
||||
aiString path;
|
||||
aiTextureMapping mapping;
|
||||
material->GetTexture(aiTextureType_HEIGHT, 0, &path, &mapping);
|
||||
std::string absolutePath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
//LOG_DEBUG("Normal map: %s", absolutePath.c_str());
|
||||
matGroup.NormalMap = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(absolutePath));
|
||||
matGroup.NormalMapPath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
}
|
||||
// Specular map
|
||||
//LOG_DEBUG("%i specular maps found", material->GetTextureCount(aiTextureType_SPECULAR));
|
||||
@@ -161,9 +157,7 @@ RawModel::RawModel(std::string fileName)
|
||||
aiString path;
|
||||
aiTextureMapping mapping;
|
||||
material->GetTexture(aiTextureType_SPECULAR, 0, &path, &mapping);
|
||||
std::string absolutePath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
//LOG_DEBUG("Specular map: %s", absolutePath.c_str());
|
||||
matGroup.SpecularMap = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(absolutePath));
|
||||
matGroup.SpecularMapPath = (boost::filesystem::path(fileName).branch_path() / path.C_Str()).string();
|
||||
}
|
||||
TextureGroups.push_back(matGroup);
|
||||
|
||||
@@ -292,22 +286,6 @@ RawModel::RawModel(std::string fileName)
|
||||
}
|
||||
}
|
||||
|
||||
void RawModel::GlCommands()
|
||||
{
|
||||
//Since RawModel contains Textures that was loaded in the constructor, their GlCommands must be run.
|
||||
for (auto& texGroup : TextureGroups) {
|
||||
if (texGroup.Texture) {
|
||||
texGroup.Texture->PostCtorGLCommands();
|
||||
}
|
||||
if (texGroup.NormalMap) {
|
||||
texGroup.NormalMap->PostCtorGLCommands();
|
||||
}
|
||||
if (texGroup.SpecularMap) {
|
||||
texGroup.SpecularMap->PostCtorGLCommands();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RawModel::~RawModel()
|
||||
{
|
||||
if (m_Skeleton) {
|
||||
|
||||
Reference in New Issue
Block a user