fb3f7f0501
[Renderer] Deleted, code moved to Application. [Transformable] Transformations are now applied to model matrix in applyTransform. [ResourceHandler|TextureLoader|XMLFile] Added. [Debug|Exception] Updated.
34 lines
985 B
C++
34 lines
985 B
C++
/*
|
|
* =====================================================================================
|
|
*
|
|
* Filename: TextureLoader.cpp
|
|
*
|
|
* Description:
|
|
*
|
|
* Created: 09/04/2018 01:38:03
|
|
*
|
|
* Author: Quentin Bazin, <quent42340@gmail.com>
|
|
*
|
|
* =====================================================================================
|
|
*/
|
|
#include "ResourceHandler.hpp"
|
|
#include "Texture.hpp"
|
|
#include "TextureLoader.hpp"
|
|
#include "XMLFile.hpp"
|
|
|
|
void TextureLoader::load(const char *xmlFilename, ResourceHandler &handler) {
|
|
XMLFile doc(xmlFilename);
|
|
|
|
tinyxml2::XMLElement *textureElement = doc.FirstChildElement("textures").FirstChildElement("texture").ToElement();
|
|
while (textureElement) {
|
|
std::string name = textureElement->Attribute("name");
|
|
std::string path = textureElement->Attribute("path");
|
|
|
|
auto &texture = handler.add<Texture>("texture-" + name);
|
|
texture.loadFromFile(path);
|
|
|
|
textureElement = textureElement->NextSiblingElement("texture");
|
|
}
|
|
}
|
|
|