1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-05 00:27:30 +02:00
openrw/rwlib/source/gl/TextureData.hpp
Anonymous Maarten 90acef28f7 rwlib: iwyu: reduce warnings
- use mapping file
- forward define FileContentsInfo, CutsceneTracks, GameTexts
- no more "#pragma once"
- add mapping file
2018-01-08 22:52:48 +00:00

50 lines
1.0 KiB
C++

#ifndef _LIBRW_TEXTUREDATA_HPP_
#define _LIBRW_TEXTUREDATA_HPP_
#include <gl/gl_core_3_3.h>
#include <glm/glm.hpp>
#include <map>
#include <memory>
#include <string>
/**
* 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) {
}
~TextureData() {
glDeleteTextures(1, &texName);
}
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 std::make_shared<TextureData>(name, size, transparent);
}
private:
GLuint texName;
glm::ivec2 size;
bool hasAlpha;
};
using TextureArchive = std::map<std::string, TextureData::Handle>;
#endif