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

GLGizmo.hpp « GUI « slic3r « src « xs - github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a626305c100625844f49702af4df1d97c5a4b917 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef slic3r_GLGizmo_hpp_
#define slic3r_GLGizmo_hpp_

#include "../../slic3r/GUI/GLTexture.hpp"

namespace Slic3r {

class BoundingBoxf3;
class Pointf3;

namespace GUI {

class GLGizmoBase
{
public:
    enum EState
    {
        Off,
        Hover,
        On,
        Num_States
    };

protected:
    EState m_state;
    // textures are assumed to be square and all with the same size in pixels
    // no internal check is done
    GLTexture m_textures[Num_States];

public:
    GLGizmoBase();
    virtual ~GLGizmoBase();

    bool init();

    EState get_state() const;
    void set_state(EState state);

    unsigned int get_textures_id() const;
    int get_textures_size() const;

    void render(const BoundingBoxf3& box) const;

protected:
    virtual bool on_init() = 0;
    virtual void on_render(const BoundingBoxf3& box) const = 0;
};

class GLGizmoRotate : public GLGizmoBase
{
    float m_angle_x;
    float m_angle_y;
    float m_angle_z;

public:
    GLGizmoRotate();

protected:
    virtual bool on_init();
    virtual void on_render(const BoundingBoxf3& box) const;
};

class GLGizmoScale : public GLGizmoBase
{
    static const float Offset;
    static const float SquareHalfSize;

    float m_scale_x;
    float m_scale_y;
    float m_scale_z;

public:
    GLGizmoScale();

protected:
    virtual bool on_init();
    virtual void on_render(const BoundingBoxf3& box) const;

private:
    void _render_square(const Pointf3& center) const;
};

} // namespace GUI
} // namespace Slic3r

#endif // slic3r_GLGizmo_hpp_