OpenMiner/include/gl/Texture.hpp

49 lines
985 B
C++
Raw Normal View History

2014-12-20 01:46:31 +01:00
/*
* =====================================================================================
*
* Filename: Texture.hpp
*
2018-06-05 01:24:54 +02:00
* Description:
2014-12-20 01:46:31 +01:00
*
* Created: 20/12/2014 01:15:27
*
* Author: Quentin Bazin, <quent42340@gmail.com>
2014-12-20 01:46:31 +01:00
*
* =====================================================================================
*/
#ifndef TEXTURE_HPP_
#define TEXTURE_HPP_
#include <string>
#include "IntTypes.hpp"
#include "NonCopyable.hpp"
2014-12-20 01:46:31 +01:00
#include "OpenGL.hpp"
class Texture : public NonCopyable {
2014-12-20 01:46:31 +01:00
public:
2018-06-20 05:43:52 +02:00
Texture() = default;
2014-12-20 12:59:59 +01:00
Texture(const std::string &filename);
Texture(Texture &&);
2018-06-20 05:43:52 +02:00
~Texture() noexcept;
2018-06-05 01:24:54 +02:00
Texture &operator=(Texture &&) = default;
void loadFromFile(const std::string &filename);
2018-06-05 01:24:54 +02:00
2014-12-20 01:46:31 +01:00
static void bind(const Texture *texture);
2018-06-05 01:24:54 +02:00
2014-12-20 01:46:31 +01:00
u16 width() const { return m_width; }
u16 height() const { return m_height; }
2018-06-05 01:24:54 +02:00
2014-12-20 01:46:31 +01:00
private:
std::string m_filename;
2018-06-05 01:24:54 +02:00
2014-12-20 01:46:31 +01:00
u16 m_width;
u16 m_height;
2018-06-05 01:24:54 +02:00
GLuint m_texture = 0;
2014-12-20 01:46:31 +01:00
};
#endif // TEXTURE_HPP_