1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 19:32:49 +01:00
openrw/rwlib/source/gl/TextureData.hpp
2016-12-03 21:59:37 +00:00

42 lines
879 B
C++

#pragma once
#include <gl/gl_core_3_3.h>
#include <glm/glm.hpp>
#include <map>
#include <memory>
/**
* Stores a handle and metadata about a loaded texture.
*/
class TextureData {
public:
TextureData(GLuint name, const glm::ivec2& dims, bool alpha)
: texName(name), size(dims), hasAlpha(alpha) {
}
GLuint getName() const {
return texName;
}
const glm::ivec2& getSize() const {
return size;
}
bool isTransparent() const {
return hasAlpha;
}
typedef std::shared_ptr<TextureData> Handle;
static Handle create(GLuint name, const glm::ivec2& size,
bool transparent) {
return Handle(new TextureData(name, size, transparent));
}
private:
GLuint texName;
glm::ivec2 size;
bool hasAlpha;
};
using TextureArchive = std::map<std::string, TextureData::Handle>;