1st installment of gizmos

This commit is contained in:
Enrico Turri 2018-06-13 09:12:16 +02:00
parent 2d97d8e7fe
commit b2cf576bf3
19 changed files with 812 additions and 177 deletions

View file

@ -0,0 +1,78 @@
#ifndef slic3r_GLGizmo_hpp_
#define slic3r_GLGizmo_hpp_
#include "../../slic3r/GUI/GLTexture.hpp"
namespace Slic3r {
namespace GUI {
class GLGizmoBase
{
public:
enum EState
{
Off,
Hover,
On,
Num_States
};
protected:
EState m_state;
// textures are assumed to be all 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;
unsigned int get_textures_id() const;
int get_textures_height() const;
int get_textures_width() const;
virtual void render() const = 0;
protected:
virtual bool on_init() = 0;
};
class GLGizmoRotate : public GLGizmoBase
{
float m_angle_x;
float m_angle_y;
float m_angle_z;
public:
GLGizmoRotate();
void render() const;
protected:
virtual bool on_init();
};
class GLGizmoScale : public GLGizmoBase
{
float m_scale_x;
float m_scale_y;
float m_scale_z;
public:
GLGizmoScale();
void render() const;
protected:
virtual bool on_init();
};
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_GLGizmo_hpp_