2018-06-13 07:12:16 +00:00
|
|
|
#ifndef slic3r_GLTexture_hpp_
|
|
|
|
#define slic3r_GLTexture_hpp_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2018-06-14 08:37:28 +00:00
|
|
|
class wxImage;
|
|
|
|
|
2018-06-13 07:12:16 +00:00
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
2018-06-14 08:37:28 +00:00
|
|
|
class GLTexture
|
2018-06-13 07:12:16 +00:00
|
|
|
{
|
2018-07-31 10:25:00 +00:00
|
|
|
public:
|
|
|
|
struct UV
|
|
|
|
{
|
|
|
|
float u;
|
|
|
|
float v;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Quad_UVs
|
|
|
|
{
|
|
|
|
UV left_bottom;
|
|
|
|
UV right_bottom;
|
|
|
|
UV right_top;
|
|
|
|
UV left_top;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Quad_UVs FullTextureUVs;
|
|
|
|
|
2018-07-18 13:07:52 +00:00
|
|
|
protected:
|
2018-06-13 07:12:16 +00:00
|
|
|
unsigned int m_id;
|
|
|
|
int m_width;
|
|
|
|
int m_height;
|
|
|
|
std::string m_source;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GLTexture();
|
2018-07-18 13:07:52 +00:00
|
|
|
virtual ~GLTexture();
|
2018-06-13 07:12:16 +00:00
|
|
|
|
2018-06-14 08:37:28 +00:00
|
|
|
bool load_from_file(const std::string& filename, bool generate_mipmaps);
|
2018-06-13 07:12:16 +00:00
|
|
|
void reset();
|
|
|
|
|
|
|
|
unsigned int get_id() const;
|
|
|
|
int get_width() const;
|
|
|
|
int get_height() const;
|
2018-07-18 13:07:52 +00:00
|
|
|
|
2018-06-13 07:12:16 +00:00
|
|
|
const std::string& get_source() const;
|
|
|
|
|
|
|
|
static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top);
|
2018-07-31 10:25:00 +00:00
|
|
|
static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs);
|
2018-06-14 08:37:28 +00:00
|
|
|
|
2018-07-18 13:07:52 +00:00
|
|
|
protected:
|
2018-07-23 11:54:43 +00:00
|
|
|
unsigned int _generate_mipmaps(wxImage& image);
|
2018-06-13 07:12:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
#endif // slic3r_GLTexture_hpp_
|
|
|
|
|