Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GLTexture.hpp « GUI « slic3r « src - github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e027bd152f4402974941bbc234e6de1c91fefa05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef slic3r_GLTexture_hpp_
#define slic3r_GLTexture_hpp_

#include <string>

class wxImage;

namespace Slic3r {
namespace GUI {

    class GLTexture
    {
    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;

    protected:
        unsigned int m_id;
        int m_width;
        int m_height;
        std::string m_source;

    public:
        GLTexture();
        virtual ~GLTexture();

        bool load_from_file(const std::string& filename, bool generate_mipmaps);
        void reset();

        unsigned int get_id() const;
        int get_width() const;
        int get_height() const;

        const std::string& get_source() const;

        static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top);
        static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs);

    protected:
        unsigned int _generate_mipmaps(wxImage& image);
    };

} // namespace GUI
} // namespace Slic3r

#endif // slic3r_GLTexture_hpp_