53265bbc90
You can now load textures threaded. PNG will now throw exceptions when errors happend SpriteComponent is now working without billboarding.
20 lines
542 B
C++
20 lines
542 B
C++
#include "Rendering/Util/CommonFunctions.h"
|
|
|
|
Texture* CommonFunctions::LoadTexture(std::string path, bool threaded)
|
|
{
|
|
Texture* img;
|
|
try {
|
|
if(threaded) {
|
|
img = ResourceManager::Load<Texture, true>(path);
|
|
} else {
|
|
img = ResourceManager::Load<Texture, false>(path);
|
|
}
|
|
} catch (const Resource::StillLoadingException&) {
|
|
img = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
|
} catch (const std::exception&) {
|
|
img = nullptr;
|
|
}
|
|
|
|
return img;
|
|
}
|