mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 02:01:12 -06:00
Rotate gizmo rendering
This commit is contained in:
parent
3a19b81cef
commit
bc5640eef4
2 changed files with 157 additions and 29 deletions
|
|
@ -12,6 +12,11 @@ namespace GUI {
|
|||
|
||||
class GLGizmoBase
|
||||
{
|
||||
protected:
|
||||
static const float BaseColor[3];
|
||||
static const float HighlightColor[3];
|
||||
static const float GrabberHalfSize;
|
||||
|
||||
public:
|
||||
enum EState
|
||||
{
|
||||
|
|
@ -44,10 +49,22 @@ public:
|
|||
protected:
|
||||
virtual bool on_init() = 0;
|
||||
virtual void on_render(const BoundingBoxf3& box) const = 0;
|
||||
|
||||
void _render_square(const Pointf3& center) const;
|
||||
};
|
||||
|
||||
class GLGizmoRotate : public GLGizmoBase
|
||||
{
|
||||
static const float Offset;
|
||||
static const unsigned int CircleResolution;
|
||||
static const unsigned int ScaleStepsCount;
|
||||
static const float ScaleStepRad;
|
||||
static const unsigned int ScaleLongEvery;
|
||||
static const float ScaleLongTooth;
|
||||
static const float ScaleShortTooth;
|
||||
static const unsigned int SnapRegionsCount;
|
||||
static const float GrabberOffset;
|
||||
|
||||
float m_angle_x;
|
||||
float m_angle_y;
|
||||
float m_angle_z;
|
||||
|
|
@ -58,12 +75,18 @@ public:
|
|||
protected:
|
||||
virtual bool on_init();
|
||||
virtual void on_render(const BoundingBoxf3& box) const;
|
||||
|
||||
private:
|
||||
void _render_circle(const Pointf3& center, float radius) const;
|
||||
void _render_scale(const Pointf3& center, float radius) const;
|
||||
void _render_snap_radii(const Pointf3& center, float radius) const;
|
||||
void _render_reference_radius(const Pointf3& center, float radius) const;
|
||||
void _render_grabber(const Pointf3& center, float radius) const;
|
||||
};
|
||||
|
||||
class GLGizmoScale : public GLGizmoBase
|
||||
{
|
||||
static const float Offset;
|
||||
static const float SquareHalfSize;
|
||||
|
||||
float m_scale_x;
|
||||
float m_scale_y;
|
||||
|
|
@ -75,9 +98,6 @@ public:
|
|||
protected:
|
||||
virtual bool on_init();
|
||||
virtual void on_render(const BoundingBoxf3& box) const;
|
||||
|
||||
private:
|
||||
void _render_square(const Pointf3& center) const;
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue