mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Hovering on gizmo overlay
This commit is contained in:
parent
6079fed951
commit
c657654c02
8 changed files with 61 additions and 249 deletions
|
@ -1903,12 +1903,10 @@ void _3DScene::enable_moving(wxGLCanvas* canvas, bool enable)
|
||||||
s_canvas_mgr.enable_moving(canvas, enable);
|
s_canvas_mgr.enable_moving(canvas, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void _3DScene::enable_gizmos(wxGLCanvas* canvas, bool enable)
|
void _3DScene::enable_gizmos(wxGLCanvas* canvas, bool enable)
|
||||||
{
|
{
|
||||||
s_canvas_mgr.enable_gizmos(canvas, enable);
|
s_canvas_mgr.enable_gizmos(canvas, enable);
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
void _3DScene::enable_shader(wxGLCanvas* canvas, bool enable)
|
void _3DScene::enable_shader(wxGLCanvas* canvas, bool enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -557,9 +557,7 @@ public:
|
||||||
static void enable_legend_texture(wxGLCanvas* canvas, bool enable);
|
static void enable_legend_texture(wxGLCanvas* canvas, bool enable);
|
||||||
static void enable_picking(wxGLCanvas* canvas, bool enable);
|
static void enable_picking(wxGLCanvas* canvas, bool enable);
|
||||||
static void enable_moving(wxGLCanvas* canvas, bool enable);
|
static void enable_moving(wxGLCanvas* canvas, bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
static void enable_gizmos(wxGLCanvas* canvas, bool enable);
|
static void enable_gizmos(wxGLCanvas* canvas, bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
static void enable_shader(wxGLCanvas* canvas, bool enable);
|
static void enable_shader(wxGLCanvas* canvas, bool enable);
|
||||||
static void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
|
static void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
|
||||||
static void allow_multisample(wxGLCanvas* canvas, bool allow);
|
static void allow_multisample(wxGLCanvas* canvas, bool allow);
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
#include "../../slic3r/GUI/GLShader.hpp"
|
#include "../../slic3r/GUI/GLShader.hpp"
|
||||||
#include "../../slic3r/GUI/GUI.hpp"
|
#include "../../slic3r/GUI/GUI.hpp"
|
||||||
#include "../../slic3r/GUI/PresetBundle.hpp"
|
#include "../../slic3r/GUI/PresetBundle.hpp"
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
#include "../../slic3r/GUI/GLGizmo.hpp"
|
#include "../../slic3r/GUI/GLGizmo.hpp"
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
#include "../../libslic3r/ClipperUtils.hpp"
|
#include "../../libslic3r/ClipperUtils.hpp"
|
||||||
#include "../../libslic3r/PrintConfig.hpp"
|
#include "../../libslic3r/PrintConfig.hpp"
|
||||||
#include "../../libslic3r/Print.hpp"
|
#include "../../libslic3r/Print.hpp"
|
||||||
|
@ -15,9 +13,6 @@
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
//#include <wx/image.h>
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
|
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
|
@ -28,9 +23,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
static const float TRACKBALLSIZE = 0.8f;
|
static const float TRACKBALLSIZE = 0.8f;
|
||||||
static const float GIMBALL_LOCK_THETA_MAX = 180.0f;
|
static const float GIMBALL_LOCK_THETA_MAX = 180.0f;
|
||||||
|
@ -245,108 +238,6 @@ void Rect::set_bottom(float bottom)
|
||||||
m_bottom = bottom;
|
m_bottom = bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
//GLCanvas3D::GLTextureData::GLTextureData()
|
|
||||||
// : m_id(0)
|
|
||||||
// , m_width(0)
|
|
||||||
// , m_height(0)
|
|
||||||
// , m_source("")
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//GLCanvas3D::GLTextureData::~GLTextureData()
|
|
||||||
//{
|
|
||||||
// reset();
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//bool GLCanvas3D::GLTextureData::load_from_file(const std::string& filename)
|
|
||||||
//{
|
|
||||||
// reset();
|
|
||||||
//
|
|
||||||
// // Load a PNG with an alpha channel.
|
|
||||||
// wxImage image;
|
|
||||||
// if (!image.LoadFile(filename, wxBITMAP_TYPE_PNG))
|
|
||||||
// {
|
|
||||||
// reset();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// m_width = image.GetWidth();
|
|
||||||
// m_height = image.GetHeight();
|
|
||||||
// int n_pixels = m_width * m_height;
|
|
||||||
//
|
|
||||||
// if (n_pixels <= 0)
|
|
||||||
// {
|
|
||||||
// reset();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Get RGB & alpha raw data from wxImage, pack them into an array.
|
|
||||||
// unsigned char* img_rgb = image.GetData();
|
|
||||||
// if (img_rgb == nullptr)
|
|
||||||
// {
|
|
||||||
// reset();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// unsigned char* img_alpha = image.GetAlpha();
|
|
||||||
//
|
|
||||||
// std::vector<unsigned char> data(n_pixels * 4, 0);
|
|
||||||
// for (int i = 0; i < n_pixels; ++i)
|
|
||||||
// {
|
|
||||||
// int data_id = i * 4;
|
|
||||||
// int img_id = i * 3;
|
|
||||||
// data[data_id + 0] = img_rgb[img_id + 0];
|
|
||||||
// data[data_id + 1] = img_rgb[img_id + 1];
|
|
||||||
// data[data_id + 2] = img_rgb[img_id + 2];
|
|
||||||
// data[data_id + 3] = (img_alpha != nullptr) ? img_alpha[i] : 255;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // sends data to gpu
|
|
||||||
// ::glGenTextures(1, &m_id);
|
|
||||||
// ::glBindTexture(GL_TEXTURE_2D, m_id);
|
|
||||||
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
|
|
||||||
// ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data());
|
|
||||||
// ::glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
//
|
|
||||||
// m_source = filename;
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void GLCanvas3D::GLTextureData::reset()
|
|
||||||
//{
|
|
||||||
// if (m_id != 0)
|
|
||||||
// ::glDeleteTextures(1, &m_id);
|
|
||||||
//
|
|
||||||
// m_id = 0;
|
|
||||||
// m_width = 0;
|
|
||||||
// m_height = 0;
|
|
||||||
// m_source = "";
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//unsigned int GLCanvas3D::GLTextureData::get_id() const
|
|
||||||
//{
|
|
||||||
// return m_id;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//int GLCanvas3D::GLTextureData::get_width() const
|
|
||||||
//{
|
|
||||||
// return m_width;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//int GLCanvas3D::GLTextureData::get_height() const
|
|
||||||
//{
|
|
||||||
// return m_height;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//const std::string& GLCanvas3D::GLTextureData::get_source() const
|
|
||||||
//{
|
|
||||||
// return m_source;
|
|
||||||
//}
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
GLCanvas3D::Camera::Camera()
|
GLCanvas3D::Camera::Camera()
|
||||||
: type(Ortho)
|
: type(Ortho)
|
||||||
, zoom(1.0f)
|
, zoom(1.0f)
|
||||||
|
@ -918,10 +809,7 @@ void GLCanvas3D::LayersEditing::render(const GLCanvas3D& canvas, const PrintObje
|
||||||
::glLoadIdentity();
|
::glLoadIdentity();
|
||||||
|
|
||||||
_render_tooltip_texture(canvas, bar_rect, reset_rect);
|
_render_tooltip_texture(canvas, bar_rect, reset_rect);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
_render_reset_texture(reset_rect);
|
_render_reset_texture(reset_rect);
|
||||||
// _render_reset_texture(canvas, reset_rect);
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
_render_active_object_annotations(canvas, volume, print_object, bar_rect);
|
_render_active_object_annotations(canvas, volume, print_object, bar_rect);
|
||||||
_render_profile(print_object, bar_rect);
|
_render_profile(print_object, bar_rect);
|
||||||
|
|
||||||
|
@ -1049,16 +937,10 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas
|
||||||
float t = reset_bottom + (float)m_tooltip_texture.get_height() * inv_zoom + gap;
|
float t = reset_bottom + (float)m_tooltip_texture.get_height() * inv_zoom + gap;
|
||||||
float b = reset_bottom + gap;
|
float b = reset_bottom + gap;
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
GLTexture::render_texture(m_tooltip_texture.get_id(), l, r, b, t);
|
GLTexture::render_texture(m_tooltip_texture.get_id(), l, r, b, t);
|
||||||
// canvas.render_texture(m_tooltip_texture.get_id(), l, r, b, t);
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) const
|
void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) const
|
||||||
//void GLCanvas3D::LayersEditing::_render_reset_texture(const GLCanvas3D& canvas, const Rect& reset_rect) const
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
{
|
{
|
||||||
if (m_reset_texture.get_id() == 0)
|
if (m_reset_texture.get_id() == 0)
|
||||||
{
|
{
|
||||||
|
@ -1067,10 +949,7 @@ void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) co
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
GLTexture::render_texture(m_reset_texture.get_id(), reset_rect.get_left(), reset_rect.get_right(), reset_rect.get_bottom(), reset_rect.get_top());
|
GLTexture::render_texture(m_reset_texture.get_id(), reset_rect.get_left(), reset_rect.get_right(), reset_rect.get_bottom(), reset_rect.get_top());
|
||||||
// canvas.render_texture(m_reset_texture.get_id(), reset_rect.get_left(), reset_rect.get_right(), reset_rect.get_bottom(), reset_rect.get_top());
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas3D& canvas, const GLVolume& volume, const PrintObject& print_object, const Rect& bar_rect) const
|
void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas3D& canvas, const GLVolume& volume, const PrintObject& print_object, const Rect& bar_rect) const
|
||||||
|
@ -1203,7 +1082,6 @@ bool GLCanvas3D::Mouse::is_start_position_3D_defined() const
|
||||||
return (drag.start_position_3D != Drag::Invalid_3D_Point);
|
return (drag.start_position_3D != Drag::Invalid_3D_Point);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
const float GLCanvas3D::Gizmos::OverlayOffsetX = 10.0f;
|
const float GLCanvas3D::Gizmos::OverlayOffsetX = 10.0f;
|
||||||
const float GLCanvas3D::Gizmos::OverlayGapY = 10.0f;
|
const float GLCanvas3D::Gizmos::OverlayGapY = 10.0f;
|
||||||
|
|
||||||
|
@ -1268,6 +1146,29 @@ void GLCanvas3D::Gizmos::reset_selection()
|
||||||
m_current = Undefined;
|
m_current = Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, const Pointf& mouse_pos)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float cnv_h = (float)canvas.get_canvas_size().get_height();
|
||||||
|
float height = _get_total_overlay_height();
|
||||||
|
float top_y = 0.5f * (cnv_h - height);
|
||||||
|
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((it->second == nullptr) || (it->second->get_state() == GLGizmoBase::On))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
float tex_size = (float)it->second->get_textures_size();
|
||||||
|
float half_tex_size = 0.5f * tex_size;
|
||||||
|
|
||||||
|
// we currently use circular icons for gizmo, so we check the radius
|
||||||
|
bool inside = length(Pointf(OverlayOffsetX + half_tex_size, top_y + half_tex_size).vector_to(mouse_pos)) < half_tex_size;
|
||||||
|
it->second->set_state(inside ? GLGizmoBase::Hover : GLGizmoBase::Off);
|
||||||
|
top_y += (tex_size + OverlayGapY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::Gizmos::render(const GLCanvas3D& canvas) const
|
void GLCanvas3D::Gizmos::render(const GLCanvas3D& canvas) const
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
|
@ -1300,30 +1201,19 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas) const
|
||||||
if (m_gizmos.empty())
|
if (m_gizmos.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
float cnv_w = (float)canvas.get_canvas_size().get_width();
|
||||||
|
|
||||||
float cnv_w = (float)cnv_size.get_width();
|
|
||||||
|
|
||||||
float zoom = canvas.get_camera_zoom();
|
float zoom = canvas.get_camera_zoom();
|
||||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||||
|
|
||||||
float total_h = 0.0f;
|
float height = _get_total_overlay_height();
|
||||||
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
|
||||||
{
|
|
||||||
total_h += (float)it->second->get_textures_height();
|
|
||||||
if (std::distance(it, m_gizmos.end()) > 1)
|
|
||||||
total_h += OverlayGapY;
|
|
||||||
}
|
|
||||||
|
|
||||||
float top_x = (OverlayOffsetX - 0.5f * cnv_w) * inv_zoom;
|
float top_x = (OverlayOffsetX - 0.5f * cnv_w) * inv_zoom;
|
||||||
float top_y = 0.5f * total_h * inv_zoom;
|
float top_y = 0.5f * height * inv_zoom;
|
||||||
float scaled_gap_y = OverlayGapY * inv_zoom;
|
float scaled_gap_y = OverlayGapY * inv_zoom;
|
||||||
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||||
{
|
{
|
||||||
float tex_w = (float)it->second->get_textures_width() * inv_zoom;
|
float tex_size = (float)it->second->get_textures_size() * inv_zoom;
|
||||||
float tex_h = (float)it->second->get_textures_height() * inv_zoom;
|
GLTexture::render_texture(it->second->get_textures_id(), top_x, top_x + tex_size, top_y - tex_size, top_y);
|
||||||
GLTexture::render_texture(it->second->get_textures_id(), top_x, top_x + tex_w, top_y - tex_h, top_y);
|
top_y -= (tex_size + scaled_gap_y);
|
||||||
top_y -= (tex_h + scaled_gap_y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1335,7 +1225,19 @@ void GLCanvas3D::Gizmos::_render_current_gizmo() const
|
||||||
|
|
||||||
it->second->render();
|
it->second->render();
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
float GLCanvas3D::Gizmos::_get_total_overlay_height() const
|
||||||
|
{
|
||||||
|
float height = 0.0f;
|
||||||
|
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||||
|
{
|
||||||
|
height += (float)it->second->get_textures_size();
|
||||||
|
if (std::distance(it, m_gizmos.end()) > 1)
|
||||||
|
height += OverlayGapY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
||||||
: m_canvas(canvas)
|
: m_canvas(canvas)
|
||||||
|
@ -1441,10 +1343,8 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
|
||||||
if (!m_volumes.empty())
|
if (!m_volumes.empty())
|
||||||
m_volumes.finalize_geometry(m_use_VBOs);
|
m_volumes.finalize_geometry(m_use_VBOs);
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
if (m_gizmos.is_enabled() && !m_gizmos.init())
|
if (m_gizmos.is_enabled() && !m_gizmos.init())
|
||||||
return false;
|
return false;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
|
||||||
|
@ -1687,12 +1587,10 @@ void GLCanvas3D::enable_moving(bool enable)
|
||||||
m_moving_enabled = enable;
|
m_moving_enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void GLCanvas3D::enable_gizmos(bool enable)
|
void GLCanvas3D::enable_gizmos(bool enable)
|
||||||
{
|
{
|
||||||
m_gizmos.set_enabled(enable);
|
m_gizmos.set_enabled(enable);
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
void GLCanvas3D::enable_shader(bool enable)
|
void GLCanvas3D::enable_shader(bool enable)
|
||||||
{
|
{
|
||||||
|
@ -1811,40 +1709,11 @@ void GLCanvas3D::render()
|
||||||
_render_warning_texture();
|
_render_warning_texture();
|
||||||
_render_legend_texture();
|
_render_legend_texture();
|
||||||
_render_layer_editing_overlay();
|
_render_layer_editing_overlay();
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
_render_gizmo();
|
_render_gizmo();
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
m_canvas->SwapBuffers();
|
m_canvas->SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
//void GLCanvas3D::render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const
|
|
||||||
//{
|
|
||||||
// ::glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
//
|
|
||||||
// ::glDisable(GL_LIGHTING);
|
|
||||||
// ::glEnable(GL_BLEND);
|
|
||||||
// ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
// ::glEnable(GL_TEXTURE_2D);
|
|
||||||
//
|
|
||||||
// ::glBindTexture(GL_TEXTURE_2D, (GLuint)tex_id);
|
|
||||||
//
|
|
||||||
// ::glBegin(GL_QUADS);
|
|
||||||
// ::glTexCoord2d(0.0f, 1.0f); ::glVertex3f(left, bottom, 0.0f);
|
|
||||||
// ::glTexCoord2d(1.0f, 1.0f); ::glVertex3f(right, bottom, 0.0f);
|
|
||||||
// ::glTexCoord2d(1.0f, 0.0f); ::glVertex3f(right, top, 0.0f);
|
|
||||||
// ::glTexCoord2d(0.0f, 0.0f); ::glVertex3f(left, top, 0.0f);
|
|
||||||
// ::glEnd();
|
|
||||||
//
|
|
||||||
// ::glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
//
|
|
||||||
// ::glDisable(GL_TEXTURE_2D);
|
|
||||||
// ::glDisable(GL_BLEND);
|
|
||||||
// ::glEnable(GL_LIGHTING);
|
|
||||||
//}
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
||||||
{
|
{
|
||||||
return m_volumes.get_current_print_zs(active_only);
|
return m_volumes.get_current_print_zs(active_only);
|
||||||
|
@ -3179,6 +3048,10 @@ void GLCanvas3D::_picking_pass() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updates gizmos overlay
|
||||||
|
if (!m_volumes.empty())
|
||||||
|
m_gizmos.update_hover_state(*this, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3301,10 +3174,7 @@ void GLCanvas3D::_render_warning_texture() const
|
||||||
float r = l + (float)w * inv_zoom;
|
float r = l + (float)w * inv_zoom;
|
||||||
float b = t - (float)h * inv_zoom;
|
float b = t - (float)h * inv_zoom;
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
GLTexture::render_texture(tex_id, l, r, b, t);
|
GLTexture::render_texture(tex_id, l, r, b, t);
|
||||||
// render_texture(tex_id, l, r, b, t);
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
::glEnable(GL_DEPTH_TEST);
|
::glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -3336,10 +3206,7 @@ void GLCanvas3D::_render_legend_texture() const
|
||||||
float t = (0.5f * (float)cnv_size.get_height()) * inv_zoom;
|
float t = (0.5f * (float)cnv_size.get_height()) * inv_zoom;
|
||||||
float r = l + (float)w * inv_zoom;
|
float r = l + (float)w * inv_zoom;
|
||||||
float b = t - (float)h * inv_zoom;
|
float b = t - (float)h * inv_zoom;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
GLTexture::render_texture(tex_id, l, r, b, t);
|
GLTexture::render_texture(tex_id, l, r, b, t);
|
||||||
// render_texture(tex_id, l, r, b, t);
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
::glEnable(GL_DEPTH_TEST);
|
::glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -3425,12 +3292,10 @@ void GLCanvas3D::_render_volumes(bool fake_colors) const
|
||||||
::glEnable(GL_CULL_FACE);
|
::glEnable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void GLCanvas3D::_render_gizmo() const
|
void GLCanvas3D::_render_gizmo() const
|
||||||
{
|
{
|
||||||
m_gizmos.render(*this);
|
m_gizmos.render(*this);
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
float GLCanvas3D::_get_layers_editing_cursor_z_relative() const
|
float GLCanvas3D::_get_layers_editing_cursor_z_relative() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
#define slic3r_GLCanvas3D_hpp_
|
#define slic3r_GLCanvas3D_hpp_
|
||||||
|
|
||||||
#include "../../slic3r/GUI/3DScene.hpp"
|
#include "../../slic3r/GUI/3DScene.hpp"
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
#include "../../slic3r/GUI/GLTexture.hpp"
|
#include "../../slic3r/GUI/GLTexture.hpp"
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
class wxTimer;
|
class wxTimer;
|
||||||
class wxSizeEvent;
|
class wxSizeEvent;
|
||||||
|
@ -21,9 +19,7 @@ class ExPolygon;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
class GLGizmoBase;
|
class GLGizmoBase;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
class GeometryBuffer
|
class GeometryBuffer
|
||||||
{
|
{
|
||||||
|
@ -109,29 +105,6 @@ class GLCanvas3D
|
||||||
void reset() { first_volumes.clear(); }
|
void reset() { first_volumes.clear(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
// struct GLTextureData
|
|
||||||
// {
|
|
||||||
// private:
|
|
||||||
// unsigned int m_id;
|
|
||||||
// int m_width;
|
|
||||||
// int m_height;
|
|
||||||
// std::string m_source;
|
|
||||||
//
|
|
||||||
// public:
|
|
||||||
// GLTextureData();
|
|
||||||
// ~GLTextureData();
|
|
||||||
//
|
|
||||||
// bool load_from_file(const std::string& filename);
|
|
||||||
// void reset();
|
|
||||||
//
|
|
||||||
// unsigned int get_id() const;
|
|
||||||
// int get_width() const;
|
|
||||||
// int get_height() const;
|
|
||||||
// const std::string& get_source() const;
|
|
||||||
// };
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Camera
|
struct Camera
|
||||||
{
|
{
|
||||||
|
@ -179,12 +152,8 @@ public:
|
||||||
Polygon m_polygon;
|
Polygon m_polygon;
|
||||||
GeometryBuffer m_triangles;
|
GeometryBuffer m_triangles;
|
||||||
GeometryBuffer m_gridlines;
|
GeometryBuffer m_gridlines;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
mutable GLTexture m_top_texture;
|
mutable GLTexture m_top_texture;
|
||||||
mutable GLTexture m_bottom_texture;
|
mutable GLTexture m_bottom_texture;
|
||||||
// mutable GLTextureData m_top_texture;
|
|
||||||
// mutable GLTextureData m_bottom_texture;
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Bed();
|
Bed();
|
||||||
|
@ -279,12 +248,8 @@ public:
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
Shader m_shader;
|
Shader m_shader;
|
||||||
unsigned int m_z_texture_id;
|
unsigned int m_z_texture_id;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
mutable GLTexture m_tooltip_texture;
|
mutable GLTexture m_tooltip_texture;
|
||||||
mutable GLTexture m_reset_texture;
|
mutable GLTexture m_reset_texture;
|
||||||
// mutable GLTextureData m_tooltip_texture;
|
|
||||||
// mutable GLTextureData m_reset_texture;
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EState state;
|
EState state;
|
||||||
|
@ -323,10 +288,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool _is_initialized() const;
|
bool _is_initialized() const;
|
||||||
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void _render_reset_texture(const Rect& reset_rect) const;
|
void _render_reset_texture(const Rect& reset_rect) const;
|
||||||
// void _render_reset_texture(const GLCanvas3D& canvas, const Rect& reset_rect) const;
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void _render_active_object_annotations(const GLCanvas3D& canvas, const GLVolume& volume, const PrintObject& print_object, const Rect& bar_rect) const;
|
void _render_active_object_annotations(const GLCanvas3D& canvas, const GLVolume& volume, const PrintObject& print_object, const Rect& bar_rect) const;
|
||||||
void _render_profile(const PrintObject& print_object, const Rect& bar_rect) const;
|
void _render_profile(const PrintObject& print_object, const Rect& bar_rect) const;
|
||||||
};
|
};
|
||||||
|
@ -360,7 +322,6 @@ public:
|
||||||
bool is_start_position_3D_defined() const;
|
bool is_start_position_3D_defined() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
class Gizmos
|
class Gizmos
|
||||||
{
|
{
|
||||||
static const float OverlayOffsetX;
|
static const float OverlayOffsetX;
|
||||||
|
@ -393,6 +354,8 @@ public:
|
||||||
void select(EType type);
|
void select(EType type);
|
||||||
void reset_selection();
|
void reset_selection();
|
||||||
|
|
||||||
|
void update_hover_state(const GLCanvas3D& canvas, const Pointf& mouse_pos);
|
||||||
|
|
||||||
void render(const GLCanvas3D& canvas) const;
|
void render(const GLCanvas3D& canvas) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -400,8 +363,9 @@ public:
|
||||||
|
|
||||||
void _render_overlay(const GLCanvas3D& canvas) const;
|
void _render_overlay(const GLCanvas3D& canvas) const;
|
||||||
void _render_current_gizmo() const;
|
void _render_current_gizmo() const;
|
||||||
|
|
||||||
|
float _get_total_overlay_height() const;
|
||||||
};
|
};
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxGLCanvas* m_canvas;
|
wxGLCanvas* m_canvas;
|
||||||
|
@ -414,9 +378,7 @@ private:
|
||||||
LayersEditing m_layers_editing;
|
LayersEditing m_layers_editing;
|
||||||
Shader m_shader;
|
Shader m_shader;
|
||||||
Mouse m_mouse;
|
Mouse m_mouse;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
mutable Gizmos m_gizmos;
|
||||||
Gizmos m_gizmos;
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
mutable GLVolumeCollection m_volumes;
|
mutable GLVolumeCollection m_volumes;
|
||||||
DynamicPrintConfig* m_config;
|
DynamicPrintConfig* m_config;
|
||||||
|
@ -521,9 +483,7 @@ public:
|
||||||
void enable_legend_texture(bool enable);
|
void enable_legend_texture(bool enable);
|
||||||
void enable_picking(bool enable);
|
void enable_picking(bool enable);
|
||||||
void enable_moving(bool enable);
|
void enable_moving(bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void enable_gizmos(bool enable);
|
void enable_gizmos(bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void enable_shader(bool enable);
|
void enable_shader(bool enable);
|
||||||
void enable_force_zoom_to_bed(bool enable);
|
void enable_force_zoom_to_bed(bool enable);
|
||||||
void allow_multisample(bool allow);
|
void allow_multisample(bool allow);
|
||||||
|
@ -536,9 +496,6 @@ public:
|
||||||
void update_volumes_colors_by_extruder();
|
void update_volumes_colors_by_extruder();
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
// void render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const;
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
std::vector<double> get_current_print_zs(bool active_only) const;
|
std::vector<double> get_current_print_zs(bool active_only) const;
|
||||||
void set_toolpaths_range(double low, double high);
|
void set_toolpaths_range(double low, double high);
|
||||||
|
@ -617,9 +574,7 @@ private:
|
||||||
void _render_legend_texture() const;
|
void _render_legend_texture() const;
|
||||||
void _render_layer_editing_overlay() const;
|
void _render_layer_editing_overlay() const;
|
||||||
void _render_volumes(bool fake_colors) const;
|
void _render_volumes(bool fake_colors) const;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void _render_gizmo() const;
|
void _render_gizmo() const;
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
float _get_layers_editing_cursor_z_relative() const;
|
float _get_layers_editing_cursor_z_relative() const;
|
||||||
int _get_layers_editing_first_selected_object_id(unsigned int objects_count) const;
|
int _get_layers_editing_first_selected_object_id(unsigned int objects_count) const;
|
||||||
|
|
|
@ -107,7 +107,7 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten
|
||||||
GLint num_extensions;
|
GLint num_extensions;
|
||||||
::glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
::glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < num_extensions; ++i)
|
for (GLint i = 0; i < num_extensions; ++i)
|
||||||
{
|
{
|
||||||
const char* e = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
const char* e = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
||||||
extensions_list.push_back(e);
|
extensions_list.push_back(e);
|
||||||
|
@ -427,14 +427,12 @@ void GLCanvas3DManager::enable_moving(wxGLCanvas* canvas, bool enable)
|
||||||
it->second->enable_moving(enable);
|
it->second->enable_moving(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void GLCanvas3DManager::enable_gizmos(wxGLCanvas* canvas, bool enable)
|
void GLCanvas3DManager::enable_gizmos(wxGLCanvas* canvas, bool enable)
|
||||||
{
|
{
|
||||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||||
if (it != m_canvases.end())
|
if (it != m_canvases.end())
|
||||||
it->second->enable_gizmos(enable);
|
it->second->enable_gizmos(enable);
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
|
|
||||||
void GLCanvas3DManager::enable_shader(wxGLCanvas* canvas, bool enable)
|
void GLCanvas3DManager::enable_shader(wxGLCanvas* canvas, bool enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,9 +110,7 @@ public:
|
||||||
void enable_legend_texture(wxGLCanvas* canvas, bool enable);
|
void enable_legend_texture(wxGLCanvas* canvas, bool enable);
|
||||||
void enable_picking(wxGLCanvas* canvas, bool enable);
|
void enable_picking(wxGLCanvas* canvas, bool enable);
|
||||||
void enable_moving(wxGLCanvas* canvas, bool enable);
|
void enable_moving(wxGLCanvas* canvas, bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void enable_gizmos(wxGLCanvas* canvas, bool enable);
|
void enable_gizmos(wxGLCanvas* canvas, bool enable);
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void enable_shader(wxGLCanvas* canvas, bool enable);
|
void enable_shader(wxGLCanvas* canvas, bool enable);
|
||||||
void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
|
void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
|
||||||
void allow_multisample(wxGLCanvas* canvas, bool allow);
|
void allow_multisample(wxGLCanvas* canvas, bool allow);
|
||||||
|
|
|
@ -21,17 +21,17 @@ GLGizmoBase::EState GLGizmoBase::get_state() const
|
||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLGizmoBase::set_state(GLGizmoBase::EState state)
|
||||||
|
{
|
||||||
|
m_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int GLGizmoBase::get_textures_id() const
|
unsigned int GLGizmoBase::get_textures_id() const
|
||||||
{
|
{
|
||||||
return m_textures[m_state].get_id();
|
return m_textures[m_state].get_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GLGizmoBase::get_textures_height() const
|
int GLGizmoBase::get_textures_size() const
|
||||||
{
|
|
||||||
return m_textures[Off].get_height();
|
|
||||||
}
|
|
||||||
|
|
||||||
int GLGizmoBase::get_textures_width() const
|
|
||||||
{
|
{
|
||||||
return m_textures[Off].get_width();
|
return m_textures[Off].get_width();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EState m_state;
|
EState m_state;
|
||||||
// textures are assumed to be all the same size in pixels
|
// textures are assumed to be square and all with the same size in pixels
|
||||||
// no internal check is done
|
// no internal check is done
|
||||||
GLTexture m_textures[Num_States];
|
GLTexture m_textures[Num_States];
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ public:
|
||||||
bool init();
|
bool init();
|
||||||
|
|
||||||
EState get_state() const;
|
EState get_state() const;
|
||||||
|
void set_state(EState state);
|
||||||
|
|
||||||
unsigned int get_textures_id() const;
|
unsigned int get_textures_id() const;
|
||||||
int get_textures_height() const;
|
int get_textures_size() const;
|
||||||
int get_textures_width() const;
|
|
||||||
|
|
||||||
virtual void render() const = 0;
|
virtual void render() const = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue