mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 19:57:55 -06:00
1st installment of gizmos
This commit is contained in:
parent
2d97d8e7fe
commit
b2cf576bf3
19 changed files with 812 additions and 177 deletions
109
xs/src/slic3r/GUI/GLGizmo.cpp
Normal file
109
xs/src/slic3r/GUI/GLGizmo.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
#include "GLGizmo.hpp"
|
||||
|
||||
#include "../../libslic3r/utils.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
GLGizmoBase::GLGizmoBase()
|
||||
: m_state(Off)
|
||||
{
|
||||
}
|
||||
|
||||
GLGizmoBase::~GLGizmoBase()
|
||||
{
|
||||
}
|
||||
|
||||
GLGizmoBase::EState GLGizmoBase::get_state() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
unsigned int GLGizmoBase::get_textures_id() const
|
||||
{
|
||||
return m_textures[m_state].get_id();
|
||||
}
|
||||
|
||||
int GLGizmoBase::get_textures_height() const
|
||||
{
|
||||
return m_textures[Off].get_height();
|
||||
}
|
||||
|
||||
int GLGizmoBase::get_textures_width() const
|
||||
{
|
||||
return m_textures[Off].get_width();
|
||||
}
|
||||
|
||||
bool GLGizmoBase::init()
|
||||
{
|
||||
return on_init();
|
||||
}
|
||||
|
||||
GLGizmoRotate::GLGizmoRotate()
|
||||
: GLGizmoBase()
|
||||
, m_angle_x(0.0f)
|
||||
, m_angle_y(0.0f)
|
||||
, m_angle_z(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
void GLGizmoRotate::render() const
|
||||
{
|
||||
std::cout << "GLGizmoRotate::render()" << std::endl;
|
||||
}
|
||||
|
||||
bool GLGizmoRotate::on_init()
|
||||
{
|
||||
std::string path = resources_dir() + "/icons/overlay/";
|
||||
|
||||
std::string filename = path + "rotate_off.png";
|
||||
if (!m_textures[Off].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
filename = path + "rotate_hover.png";
|
||||
if (!m_textures[Hover].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
filename = path + "rotate_on.png";
|
||||
if (!m_textures[On].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GLGizmoScale::GLGizmoScale()
|
||||
: GLGizmoBase()
|
||||
, m_scale_x(1.0f)
|
||||
, m_scale_y(1.0f)
|
||||
, m_scale_z(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
void GLGizmoScale::render() const
|
||||
{
|
||||
std::cout << "GLGizmoScale::render()" << std::endl;
|
||||
}
|
||||
|
||||
bool GLGizmoScale::on_init()
|
||||
{
|
||||
std::string path = resources_dir() + "/icons/overlay/";
|
||||
|
||||
std::string filename = path + "scale_off.png";
|
||||
if (!m_textures[Off].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
filename = path + "scale_hover.png";
|
||||
if (!m_textures[Hover].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
filename = path + "scale_on.png";
|
||||
if (!m_textures[On].load_from_file(filename))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
Loading…
Add table
Add a link
Reference in a new issue