OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::GLCanvas3D::LayersEditing Class Reference
Collaboration diagram for Slic3r::GUI::GLCanvas3D::LayersEditing:

Classes

struct  LayersTexture
struct  Profile

Public Types

enum  EState : unsigned char { Unknown , Editing , Completed , Num_States }

Public Member Functions

void set_shrinkage_compensation (const Vec3d &shrinkage_compensation)
 LayersEditing ()=default
 ~LayersEditing ()
void init ()
void set_config (const DynamicPrintConfig *config)
void select_object (const Model &model, int object_id)
bool is_allowed () const
bool is_enabled () const
void set_enabled (bool enabled)
void render_variable_layer_height_dialog (GLCanvas3D &canvas)
void render_overlay (GLCanvas3D &canvas)
void render_volumes (const GLCanvas3D &canvas, const GLVolumeCollection &volumes)
void adjust_layer_height_profile ()
void accept_changes (GLCanvas3D &canvas)
void reset_layer_height_profile (GLCanvas3D &canvas)
void adaptive_layer_height_profile (GLCanvas3D &canvas, float quality_factor)
void smooth_layer_height_profile (GLCanvas3D &canvas, const HeightProfileSmoothingParams &smoothing_params)
float object_max_z () const
std::string get_tooltip (const GLCanvas3D &canvas) const

Static Public Member Functions

static float get_cursor_z_relative (const GLCanvas3D &canvas)
static bool bar_rect_contains (const GLCanvas3D &canvas, float x, float y)
static Rect get_bar_rect_screen (const GLCanvas3D &canvas)
static float get_overlay_window_width ()

Public Attributes

EState state { Unknown }
float band_width { 2.0f }
float strength { 0.005f }
int last_object_id { -1 }
float last_z { 0.0f }
LayerHeightEditActionType last_action { LAYER_HEIGHT_EDIT_ACTION_INCREASE }
Profile m_profile

Static Public Attributes

static const float THICKNESS_BAR_WIDTH = 70.0f

Private Member Functions

bool is_initialized () const
void generate_layer_height_texture ()
void render_active_object_annotations (const GLCanvas3D &canvas)
void render_profile (const GLCanvas3D &canvas)
void update_slicing_parameters ()

Static Private Member Functions

static float thickness_bar_width (const GLCanvas3D &canvas)

Private Attributes

bool m_enabled { false }
unsigned int m_z_texture_id { 0 }
const DynamicPrintConfig * m_config { nullptr }
const ModelObject * m_model_object { nullptr }
float m_object_max_z { 0.0f }
SlicingParameters * m_slicing_parameters { nullptr }
std::vector< double > m_layer_height_profile
Vec3d m_shrinkage_compensation { Vec3d::Ones() }
float m_adaptive_quality { 0.5f }
HeightProfileSmoothingParams m_smooth_params
LayersTexture m_layers_texture

Static Private Attributes

static float s_overlay_window_width

Detailed Description


Class Documentation

◆ Slic3r::GUI::GLCanvas3D::LayersEditing::LayersTexture

struct Slic3r::GUI::GLCanvas3D::LayersEditing::LayersTexture
Collaboration diagram for Slic3r::GUI::GLCanvas3D::LayersEditing::LayersTexture:
Class Members
size_t cells { 0 }
vector< char > data
size_t height { 0 }
size_t levels { 0 }
bool valid { false }
size_t width { 0 }

◆ Slic3r::GUI::GLCanvas3D::LayersEditing::Profile

struct Slic3r::GUI::GLCanvas3D::LayersEditing::Profile
Collaboration diagram for Slic3r::GUI::GLCanvas3D::LayersEditing::Profile:
Class Members
GLModel background
GLModel baseline
float old_canvas_width { 0.0f }
vector< double > old_layer_height_profile
GLModel profile

Member Enumeration Documentation

◆ EState

Enumerator
Unknown 
Editing 
Completed 
Num_States 
251 {
252 Unknown,
253 Editing,
254 Completed,
256 };
@ Num_States
Definition GLCanvas3D.hpp:255
@ Editing
Definition GLCanvas3D.hpp:253
@ Unknown
Definition GLCanvas3D.hpp:252
@ Completed
Definition GLCanvas3D.hpp:254

Constructor & Destructor Documentation

◆ LayersEditing()

Slic3r::GUI::GLCanvas3D::LayersEditing::LayersEditing ( )
default

◆ ~LayersEditing()

Slic3r::GUI::GLCanvas3D::LayersEditing::~LayersEditing ( )
305{
306 if (m_z_texture_id != 0) {
308 m_z_texture_id = 0;
309 }
311}
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
unsigned int m_z_texture_id
Definition GLCanvas3D.hpp:265
SlicingParameters * m_slicing_parameters
Definition GLCanvas3D.hpp:273
#define glDeleteTextures
Definition gl.h:3587

References ~LayersEditing(), glDeleteTextures, glsafe, m_slicing_parameters, and m_z_texture_id.

Referenced by ~LayersEditing().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ accept_changes()

void Slic3r::GUI::GLCanvas3D::LayersEditing::accept_changes ( GLCanvas3D & canvas)
845{
846 if (last_object_id >= 0) {
847 wxGetApp().plater()->take_snapshot("Variable layer height - Manual edit");
848 const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile);
849 canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
850 wxGetApp().obj_list()->update_info_items(last_object_id);
851 }
852}
int last_object_id
Definition GLCanvas3D.hpp:305
std::vector< double > m_layer_height_profile
Definition GLCanvas3D.hpp:274
const ModelObject * m_model_object
Definition GLCanvas3D.hpp:269

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), accept_changes(), last_object_id, m_layer_height_profile, m_model_object, and Slic3r::GUI::GLCanvas3D::post_event().

Referenced by accept_changes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ adaptive_layer_height_profile()

void Slic3r::GUI::GLCanvas3D::LayersEditing::adaptive_layer_height_profile ( GLCanvas3D & canvas,
float quality_factor )
796{
799 const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile);
800 m_layers_texture.valid = false;
801 canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
802 wxGetApp().obj_list()->update_info_items(last_object_id);
803}
LayersTexture m_layers_texture
Definition GLCanvas3D.hpp:299
void update_slicing_parameters()
Definition GLCanvas3D.cpp:854
std::vector< double > layer_height_profile_adaptive(const SlicingParameters &slicing_params, const ModelObject &object, float quality_factor)
Definition Slicing.cpp:318

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), adaptive_layer_height_profile(), last_object_id, Slic3r::layer_height_profile_adaptive(), m_layer_height_profile, m_layers_texture, m_model_object, m_slicing_parameters, Slic3r::GUI::GLCanvas3D::post_event(), and update_slicing_parameters().

Referenced by adaptive_layer_height_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjust_layer_height_profile()

void Slic3r::GUI::GLCanvas3D::LayersEditing::adjust_layer_height_profile ( )
779{
783 m_layers_texture.valid = false;
784}
float last_z
Definition GLCanvas3D.hpp:306
LayerHeightEditActionType last_action
Definition GLCanvas3D.hpp:307
float band_width
Definition GLCanvas3D.hpp:303
float strength
Definition GLCanvas3D.hpp:304
static bool update_layer_height_profile(const ModelObject &model_object, const SlicingParameters &slicing_parameters, std::vector< coordf_t > &layer_height_profile)
Definition PrintObject.cpp:4601
void adjust_layer_height_profile(const ModelObject &model_object, const SlicingParameters &slicing_params, std::vector< coordf_t > &layer_height_profile, coordf_t z, coordf_t layer_thickness_delta, coordf_t band_width, LayerHeightEditActionType action)
Definition Slicing.cpp:527

References Slic3r::adjust_layer_height_profile(), adjust_layer_height_profile(), band_width, last_action, last_z, m_layer_height_profile, m_layers_texture, m_model_object, m_slicing_parameters, strength, Slic3r::PrintObject::update_layer_height_profile(), and update_slicing_parameters().

Referenced by adjust_layer_height_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bar_rect_contains()

bool Slic3r::GUI::GLCanvas3D::LayersEditing::bar_rect_contains ( const GLCanvas3D & canvas,
float x,
float y )
static
522{
523 const Rect& rect = get_bar_rect_screen(canvas);
524 return rect.get_left() <= x && x <= rect.get_right() && rect.get_top() <= y && y <= rect.get_bottom();
525}
static Rect get_bar_rect_screen(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:527

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), bar_rect_contains(), get_bar_rect_screen(), Slic3r::GUI::Rect::get_bottom(), Slic3r::GUI::Rect::get_left(), Slic3r::GUI::Rect::get_right(), and Slic3r::GUI::Rect::get_top().

Referenced by bar_rect_contains().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_layer_height_texture()

void Slic3r::GUI::GLCanvas3D::LayersEditing::generate_layer_height_texture ( )
private
816{
818 // Always try to update the layer height profile.
819 bool update = !m_layers_texture.valid;
821 // Initialized to the default value.
822 update = true;
823 }
824 // Update if the layer height profile was changed, or when the texture is not valid.
825 if (!update && !m_layers_texture.data.empty() && m_layers_texture.cells > 0)
826 // Texture is valid, don't update.
827 return;
828
829 if (m_layers_texture.data.empty()) {
830 m_layers_texture.width = 1024;
831 m_layers_texture.height = 1024;
832 m_layers_texture.levels = 2;
833 m_layers_texture.data.assign(m_layers_texture.width * m_layers_texture.height * 5, 0);
834 }
835
836 bool level_of_detail_2nd_level = true;
840 m_layers_texture.data.data(), m_layers_texture.height, m_layers_texture.width, level_of_detail_2nd_level);
841 m_layers_texture.valid = true;
842}
std::vector< coordf_t > generate_object_layers(const SlicingParameters &slicing_params, const std::vector< coordf_t > &layer_height_profile, bool is_precise_z_height)
Definition Slicing.cpp:816
int generate_layer_height_texture(const SlicingParameters &slicing_params, const std::vector< coordf_t > &layers, void *data, int rows, int cols, bool level_of_detail_2nd_level)
Definition Slicing.cpp:912

References Slic3r::generate_layer_height_texture(), generate_layer_height_texture(), Slic3r::generate_object_layers(), m_layer_height_profile, m_layers_texture, m_model_object, m_slicing_parameters, Slic3r::PrintObject::update_layer_height_profile(), and update_slicing_parameters().

Referenced by generate_layer_height_texture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_bar_rect_screen()

Rect Slic3r::GUI::GLCanvas3D::LayersEditing::get_bar_rect_screen ( const GLCanvas3D & canvas)
static
528{
529 const Size& cnv_size = canvas.get_canvas_size();
530 float w = (float)cnv_size.get_width();
531 float h = (float)cnv_size.get_height();
532
533 return { w - thickness_bar_width(canvas), 0.0f, w, h };
534}
static float thickness_bar_width(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:863

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), get_bar_rect_screen(), Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), and thickness_bar_width().

Referenced by Slic3r::GUI::GLCanvas3D::_perform_layer_editing_action(), bar_rect_contains(), get_bar_rect_screen(), and get_cursor_z_relative().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cursor_z_relative()

float Slic3r::GUI::GLCanvas3D::LayersEditing::get_cursor_z_relative ( const GLCanvas3D & canvas)
static
506{
507 const Vec2d mouse_pos = canvas.get_local_mouse_position();
508 const Rect& rect = get_bar_rect_screen(canvas);
509 float x = (float)mouse_pos.x();
510 float y = (float)mouse_pos.y();
511 float t = rect.get_top();
512 float b = rect.get_bottom();
513
514 return (rect.get_left() <= x && x <= rect.get_right() && t <= y && y <= b) ?
515 // Inside the bar.
516 (b - y - 1.0f) / (b - t - 1.0f) :
517 // Outside the bar.
518 -1000.0f;
519}
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), get_bar_rect_screen(), Slic3r::GUI::Rect::get_bottom(), get_cursor_z_relative(), Slic3r::GUI::Rect::get_left(), Slic3r::GUI::GLCanvas3D::get_local_mouse_position(), Slic3r::GUI::Rect::get_right(), and Slic3r::GUI::Rect::get_top().

Referenced by get_cursor_z_relative(), get_tooltip(), render_active_object_annotations(), and render_volumes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_overlay_window_width()

float Slic3r::GUI::GLCanvas3D::LayersEditing::get_overlay_window_width ( )
inlinestatic
static float s_overlay_window_width
Definition GLCanvas3D.hpp:282

References s_overlay_window_width.

◆ get_tooltip()

std::string Slic3r::GUI::GLCanvas3D::LayersEditing::get_tooltip ( const GLCanvas3D & canvas) const
542{
543 std::string ret;
544 if (m_enabled && m_layer_height_profile.size() >= 4) {
545 float z = get_cursor_z_relative(canvas);
546 if (z != -1000.0f) {
547 z *= m_object_max_z;
548
549 float h = 0.0f;
550 for (size_t i = m_layer_height_profile.size() - 2; i >= 2; i -= 2) {
551 const float zi = static_cast<float>(m_layer_height_profile[i]);
552 const float zi_1 = static_cast<float>(m_layer_height_profile[i - 2]);
553 if (zi_1 <= z && z <= zi) {
554 float dz = zi - zi_1;
555 h = (dz != 0.0f) ? static_cast<float>(lerp(m_layer_height_profile[i - 1], m_layer_height_profile[i + 1], (z - zi_1) / dz)) :
556 static_cast<float>(m_layer_height_profile[i + 1]);
557 break;
558 }
559 }
560 if (h > 0.0f)
561 ret = wxString::Format("%.3f",h).ToStdString();
562 }
563 }
564 return ret;
565}
bool m_enabled
Definition GLCanvas3D.hpp:264
static float get_cursor_z_relative(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:505
float m_object_max_z
Definition GLCanvas3D.hpp:271
ColorRGB lerp(const ColorRGB &a, const ColorRGB &b, float t)
Definition Color.cpp:244

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), get_cursor_z_relative(), get_tooltip(), Slic3r::lerp(), m_enabled, m_layer_height_profile, and m_object_max_z.

Referenced by get_tooltip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void Slic3r::GUI::GLCanvas3D::LayersEditing::init ( )
316{
319 if (!OpenGLManager::get_gl_info().is_core_profile() || !OpenGLManager::get_gl_info().is_mesa()) {
322 }
327}
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
#define GL_TEXTURE_MIN_FILTER
Definition gl.h:1828
#define GL_TEXTURE_WRAP_S
Definition gl.h:1854
#define GL_TEXTURE_MAX_LEVEL
Definition gl.h:1826
#define GL_LINEAR
Definition gl.h:930
#define glTexParameteri
Definition gl.h:4911
#define glGenTextures
Definition gl.h:3787
#define glBindTexture
Definition gl.h:3299
#define GL_LINEAR_MIPMAP_NEAREST
Definition gl.h:933
unsigned int GLuint
Definition gl.h:2063
#define GL_TEXTURE_WRAP_T
Definition gl.h:1855
#define GL_TEXTURE_MAG_FILTER
Definition gl.h:1822
#define GL_TEXTURE_2D
Definition gl.h:1739
#define GL_CLAMP_TO_EDGE
Definition gl.h:322

References Slic3r::GUI::OpenGLManager::get_gl_info(), GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, glBindTexture, glGenTextures, glsafe, glTexParameteri, init(), and m_z_texture_id.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_allowed()

bool Slic3r::GUI::GLCanvas3D::LayersEditing::is_allowed ( ) const
359{
360 return wxGetApp().get_shader("variable_layer_height") != nullptr && m_z_texture_id > 0;
361}

References is_allowed(), and m_z_texture_id.

Referenced by is_allowed(), render_volumes(), and set_enabled().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_enabled()

bool Slic3r::GUI::GLCanvas3D::LayersEditing::is_enabled ( ) const
inline
328{ return m_enabled; }

References m_enabled.

◆ is_initialized()

bool Slic3r::GUI::GLCanvas3D::LayersEditing::is_initialized ( ) const
private
537{
538 return wxGetApp().get_shader("variable_layer_height") != nullptr;
539}

References is_initialized().

Referenced by is_initialized().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ object_max_z()

float Slic3r::GUI::GLCanvas3D::LayersEditing::object_max_z ( ) const
inline
346{ return m_object_max_z; }

References m_object_max_z.

◆ render_active_object_annotations()

void Slic3r::GUI::GLCanvas3D::LayersEditing::render_active_object_annotations ( const GLCanvas3D & canvas)
private
568{
569 if (!m_enabled)
570 return;
571
572 const Size cnv_size = canvas.get_canvas_size();
573 const float cnv_width = (float)cnv_size.get_width();
574 const float cnv_height = (float)cnv_size.get_height();
575 if (cnv_width == 0.0f || cnv_height == 0.0f)
576 return;
577
578 const float cnv_inv_width = 1.0f / cnv_width;
579
580 GLShaderProgram* shader = wxGetApp().get_shader("variable_layer_height");
581 if (shader == nullptr)
582 return;
583
584 shader->start_using();
585
586 shader->set_uniform("z_to_texture_row", float(m_layers_texture.cells - 1) / (float(m_layers_texture.width) * m_object_max_z));
587 shader->set_uniform("z_texture_row_to_normalized", 1.0f / (float)m_layers_texture.height);
588 shader->set_uniform("z_cursor", m_object_max_z * this->get_cursor_z_relative(canvas));
589 shader->set_uniform("z_cursor_band_width", band_width);
590 shader->set_uniform("object_max_z", m_object_max_z);
591 shader->set_uniform("view_model_matrix", Transform3d::Identity());
592 shader->set_uniform("projection_matrix", Transform3d::Identity());
593 shader->set_uniform("view_normal_matrix", (Matrix3d)Matrix3d::Identity());
594
597
598 // Render the color bar
599 if (!m_profile.background.is_initialized() || m_profile.old_canvas_width != cnv_width) {
600 m_profile.old_canvas_width = cnv_width;
601 m_profile.background.reset();
602
603 GLModel::Geometry init_data;
605 init_data.reserve_vertices(4);
606 init_data.reserve_indices(6);
607
608 // vertices
609 const float l = 1.0f - 2.0f * THICKNESS_BAR_WIDTH * cnv_inv_width;
610 const float r = 1.0f;
611 const float t = 1.0f;
612 const float b = -1.0f;
613 init_data.add_vertex(Vec3f(l, b, 0.0f), Vec3f::UnitZ(), Vec2f(0.0f, 0.0f));
614 init_data.add_vertex(Vec3f(r, b, 0.0f), Vec3f::UnitZ(), Vec2f(1.0f, 0.0f));
615 init_data.add_vertex(Vec3f(r, t, 0.0f), Vec3f::UnitZ(), Vec2f(1.0f, 1.0f));
616 init_data.add_vertex(Vec3f(l, t, 0.0f), Vec3f::UnitZ(), Vec2f(0.0f, 1.0f));
617
618 // indices
619 init_data.add_triangle(0, 1, 2);
620 init_data.add_triangle(2, 3, 0);
621
622 m_profile.background.init_from(std::move(init_data));
623 }
624
625 m_profile.background.render();
626
628
629 shader->stop_using();
630}
static const float THICKNESS_BAR_WIDTH
Definition GLCanvas3D.hpp:258
Profile m_profile
Definition GLCanvas3D.hpp:316
#define glPixelStorei
Definition gl.h:4451
#define GL_UNPACK_ALIGNMENT
Definition gl.h:1924
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64
Eigen::Matrix< double, 3, 3, Eigen::DontAlign > Matrix3d
Definition Point.hpp:86

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), Slic3r::GUI::GLModel::Geometry::add_triangle(), Slic3r::GUI::GLModel::Geometry::add_vertex(), band_width, Slic3r::GUI::GLModel::Geometry::format, Slic3r::GUI::GLCanvas3D::get_canvas_size(), get_cursor_z_relative(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), GL_TEXTURE_2D, GL_UNPACK_ALIGNMENT, glBindTexture, glPixelStorei, glsafe, m_enabled, m_layers_texture, m_object_max_z, m_profile, m_z_texture_id, Slic3r::GUI::GLModel::Geometry::P3N3T2, render_active_object_annotations(), Slic3r::GUI::GLModel::Geometry::reserve_indices(), Slic3r::GUI::GLModel::Geometry::reserve_vertices(), Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), THICKNESS_BAR_WIDTH, and Slic3r::GUI::GLModel::Geometry::Triangles.

Referenced by render_active_object_annotations(), and render_overlay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_overlay()

void Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay ( GLCanvas3D & canvas)
500{
502 render_profile(canvas);
503}
void render_active_object_annotations(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:567
void render_profile(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:632

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), render_active_object_annotations(), render_overlay(), and render_profile().

Referenced by render_overlay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_profile()

void Slic3r::GUI::GLCanvas3D::LayersEditing::render_profile ( const GLCanvas3D & canvas)
private
633{
634 if (!m_enabled)
635 return;
636
637 //FIXME show some kind of legend.
638
640 return;
641
642 const Size cnv_size = canvas.get_canvas_size();
643 const float cnv_width = (float)cnv_size.get_width();
644 const float cnv_height = (float)cnv_size.get_height();
645 if (cnv_width == 0.0f || cnv_height == 0.0f)
646 return;
647
648 // Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region.
649 const float scale_x = THICKNESS_BAR_WIDTH / float(1.12 * m_slicing_parameters->max_layer_height);
650 const float scale_y = cnv_height / m_object_max_z;
651
652 const float cnv_inv_width = 1.0f / cnv_width;
653 const float cnv_inv_height = 1.0f / cnv_height;
654
655 // Baseline
656 if (!m_profile.baseline.is_initialized() || m_profile.old_layer_height_profile != m_layer_height_profile) {
657 m_profile.baseline.reset();
658
659 GLModel::Geometry init_data;
661 init_data.color = ColorRGBA::BLACK();
662 init_data.reserve_vertices(2);
663 init_data.reserve_indices(2);
664
665 // vertices
666 const float axis_x = 2.0f * ((cnv_width - THICKNESS_BAR_WIDTH + float(m_slicing_parameters->layer_height) * scale_x) * cnv_inv_width - 0.5f);
667 init_data.add_vertex(Vec2f(axis_x, -1.0f));
668 init_data.add_vertex(Vec2f(axis_x, 1.0f));
669
670 // indices
671 init_data.add_line(0, 1);
672
673 m_profile.baseline.init_from(std::move(init_data));
674 }
675
676 if (!m_profile.profile.is_initialized() || m_profile.old_layer_height_profile != m_layer_height_profile) {
677 m_profile.old_layer_height_profile = m_layer_height_profile;
678 m_profile.profile.reset();
679
680 GLModel::Geometry init_data;
682 init_data.color = ColorRGBA::BLUE();
683 init_data.reserve_vertices(m_layer_height_profile.size() / 2);
684 init_data.reserve_indices(m_layer_height_profile.size() / 2);
685
686 // vertices + indices
687 for (unsigned int i = 0; i < (unsigned int)m_layer_height_profile.size(); i += 2) {
688 init_data.add_vertex(Vec2f(2.0f * ((cnv_width - THICKNESS_BAR_WIDTH + float(m_layer_height_profile[i + 1]) * scale_x) * cnv_inv_width - 0.5f),
689 2.0f * (float(m_layer_height_profile[i]) * scale_y * cnv_inv_height - 0.5)));
690 init_data.add_index(i / 2);
691 }
692
693 m_profile.profile.init_from(std::move(init_data));
694 }
695
696#if SLIC3R_OPENGL_ES
697 GLShaderProgram* shader = wxGetApp().get_shader("dashed_lines");
698#else
699 GLShaderProgram* shader = OpenGLManager::get_gl_info().is_core_profile() ? wxGetApp().get_shader("dashed_thick_lines") : wxGetApp().get_shader("flat");
700#endif // SLIC3R_OPENGL_ES
701 if (shader != nullptr) {
702 shader->start_using();
703 shader->set_uniform("view_model_matrix", Transform3d::Identity());
704 shader->set_uniform("projection_matrix", Transform3d::Identity());
705#if !SLIC3R_OPENGL_ES
706 if (OpenGLManager::get_gl_info().is_core_profile()) {
707#endif // !SLIC3R_OPENGL_ES
708 const std::array<int, 4>& viewport = wxGetApp().plater()->get_camera().get_viewport();
709 shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
710 shader->set_uniform("width", 0.25f);
711 shader->set_uniform("gap_size", 0.0f);
712#if !SLIC3R_OPENGL_ES
713 }
714#endif // !SLIC3R_OPENGL_ES
715 m_profile.baseline.render();
716 m_profile.profile.render();
717 shader->stop_using();
718 }
719}
static const ColorRGBA BLACK()
Definition Color.hpp:127
static const ColorRGBA BLUE()
Definition Color.hpp:128
bool is_core_profile() const
Definition OpenGLManager.hpp:53

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), Slic3r::GUI::GLModel::Geometry::add_index(), Slic3r::GUI::GLModel::Geometry::add_line(), Slic3r::GUI::GLModel::Geometry::add_vertex(), Slic3r::ColorRGBA::BLACK(), Slic3r::ColorRGBA::BLUE(), Slic3r::GUI::GLModel::Geometry::color, Slic3r::GUI::GLModel::Geometry::format, Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::OpenGLManager::get_gl_info(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), Slic3r::GUI::GLModel::Geometry::Lines, Slic3r::GUI::GLModel::Geometry::LineStrip, m_enabled, m_layer_height_profile, m_object_max_z, m_profile, m_slicing_parameters, Slic3r::GUI::GLModel::Geometry::P2, render_profile(), Slic3r::GUI::GLModel::Geometry::reserve_indices(), Slic3r::GUI::GLModel::Geometry::reserve_vertices(), Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), and THICKNESS_BAR_WIDTH.

Referenced by render_overlay(), and render_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_variable_layer_height_dialog()

void Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog ( GLCanvas3D & canvas)
365 {
366 if (!m_enabled)
367 return;
368
369 ImGuiWrapper& imgui = *wxGetApp().imgui();
370 const Size& cnv_size = canvas.get_canvas_size();
371 float left_pos = canvas.m_main_toolbar.get_item("layersediting")->render_left_pos;
372 float x = (1 + left_pos) * cnv_size.get_width() / 2;
373
374 const auto canvas_width = cnv_size.get_width();
378 x = 0;
379 else
381 }
382 }
383 x = std::max(x, 0.0f);
384
385 imgui.set_next_window_pos(x, canvas.m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f);
386
387 imgui.push_toolbar_style(canvas.get_scale());
388 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f * canvas.get_scale(), 4.0f * canvas.get_scale()));
389 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f * canvas.get_scale(), 10.0f * canvas.get_scale()));
390 imgui.begin(_L("Variable layer height"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
391 const float sliders_width = imgui.scaled(7.0f);
392 const float input_box_width = 1.5 * imgui.get_slider_icon_size().x;
393
394 if (imgui.button(_L("Adaptive")))
395 wxPostEvent((wxEvtHandler*)canvas.get_wxglcanvas(), Event<float>(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, m_adaptive_quality));
396 ImGui::SameLine();
397 static float text_align = ImGui::GetCursorPosX();
398 ImGui::AlignTextToFramePadding();
399 text_align = std::max(text_align, ImGui::GetCursorPosX());
400 ImGui::SetCursorPosX(text_align);
401 imgui.text(_L("Quality / Speed"));
402 if (ImGui::IsItemHovered()) {
403 //ImGui::BeginTooltip();
404 //ImGui::TextUnformatted(_L("Higher print quality versus higher print speed.").ToUTF8());
405 //ImGui::EndTooltip();
406 }
407 ImGui::SameLine();
408 static float slider_align = ImGui::GetCursorPosX();
409 ImGui::PushItemWidth(sliders_width);
410 m_adaptive_quality = std::clamp(m_adaptive_quality, 0.0f, 1.f);
411 slider_align = std::max(slider_align, ImGui::GetCursorPosX());
412 ImGui::SetCursorPosX(slider_align);
413 imgui.bbl_slider_float_style("##adaptive_slider", &m_adaptive_quality, 0.0f, 1.f, "%.2f");
414 ImGui::SameLine();
415 static float input_align = ImGui::GetCursorPosX();
416 ImGui::PushItemWidth(input_box_width);
417 input_align = std::max(input_align, ImGui::GetCursorPosX());
418 ImGui::SetCursorPosX(input_align);
419 ImGui::BBLDragFloat("##adaptive_input", &m_adaptive_quality, 0.05f, 0.0f, 0.0f, "%.2f");
420
421 if (imgui.button(_L_CONTEXT("Smooth", "Mesh action")))
422 wxPostEvent((wxEvtHandler*)canvas.get_wxglcanvas(), HeightProfileSmoothEvent(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, m_smooth_params));
423 ImGui::SameLine();
424 text_align = std::max(text_align, ImGui::GetCursorPosX());
425 ImGui::SetCursorPosX(text_align);
426 ImGui::AlignTextToFramePadding();
427 imgui.text(_L("Radius"));
428 ImGui::SameLine();
429 slider_align = std::max(slider_align, ImGui::GetCursorPosX());
430 ImGui::SetCursorPosX(slider_align);
431 ImGui::PushItemWidth(sliders_width);
432 int radius = (int)m_smooth_params.radius;
433 int v_min = 1, v_max = 10;
434 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
435 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f));
436 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f));
437 ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
438 ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
439 if(ImGui::BBLSliderScalar("##radius_slider", ImGuiDataType_S32, &radius, &v_min, &v_max)){
440 radius = std::clamp(radius, 1, 10);
441 m_smooth_params.radius = (unsigned int)radius;
442 }
443 ImGui::PopStyleColor(4);
444 ImGui::PopStyleVar();
445 ImGui::SameLine();
446 input_align = std::max(input_align, ImGui::GetCursorPosX());
447 ImGui::SetCursorPosX(input_align);
448 ImGui::PushItemWidth(input_box_width);
449 ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
450 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.00f, 0.59f, 0.53f, 0.00f));
451 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.00f, 0.59f, 0.53f, 0.00f));
452 ImGui::BBLDragScalar("##radius_input", ImGuiDataType_S32, &radius, 1, &v_min, &v_max);
453 ImGui::PopStyleColor(3);
454
455 imgui.bbl_checkbox("##keep_min", m_smooth_params.keep_min);
456 ImGui::SameLine();
457 ImGui::AlignTextToFramePadding();
458 imgui.text(_L("Keep min"));
459
460 ImGui::Separator();
461
462 const wxString shift = GUI::shortkey_shift_prefix();
463 std::vector<std::pair<wxString, wxString>> shortcuts = {
464 {_L("Left mouse button"), _L("Add detail")},
465 {_L("Right mouse button"), _L("Remove detail")},
466 {shift + _L("Left mouse button"), _L("Reset to base")},
467 {shift + _L("Right mouse button"), _L("Smoothing")},
468 {_L("Mouse wheel"), _L("Increase/decrease edit area")}
469 };
470
471 float y = canvas.m_main_toolbar.get_height();
472 GLGizmoUtils::render_tooltip_button(&imgui, canvas, shortcuts, x, y);
473
474 ImGui::SameLine();
476 if (imgui.button(_L("Reset"))) {
477 wxPostEvent((wxEvtHandler*) canvas.get_wxglcanvas(), SimpleEvent(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE));
478 }
479 imgui.disabled_end();
480
481 ImGui::SameLine();
483 if (imgui.button(_L("Done"))) {
484 m_enabled = false;
485
486 GLToolbarItem* item = canvas.m_main_toolbar.get_item("layersediting");
487 item->set_state(GLToolbarItem::Normal);
488
489 canvas.set_as_dirty();
490 canvas.request_extra_frame();
491 }
492
493 GLCanvas3D::LayersEditing::s_overlay_window_width = ImGui::GetWindowSize().x;
494 imgui.end();
495 ImGui::PopStyleVar(2);
496 imgui.pop_toolbar_style();
497}
#define _L(s)
Definition OBJ.cpp:34
float m_adaptive_quality
Definition GLCanvas3D.hpp:279
HeightProfileSmoothingParams m_smooth_params
Definition GLCanvas3D.hpp:280
@ Normal
Definition GLToolbar.hpp:94
void begin_right_aligned_buttons(const std::vector< wxString > &labels)
Definition GLGizmoUtils.cpp:135
void render_tooltip_button(ImGuiWrapper *imgui_wrapper, const GLCanvas3D &canvas, const std::vector< std::pair< wxString, wxString > > &shortcuts, float x, float y)
Definition GLGizmoUtils.cpp:48
const std::string & shortkey_shift_prefix()
Definition GUI.cpp:109
Event< HeightProfileSmoothingParams > HeightProfileSmoothEvent
Definition GLCanvas3D.hpp:196
bool check_object_layers_fixed(const SlicingParameters &slicing_params, const std::vector< coordf_t > &layer_height_profile)
Definition Slicing.cpp:879
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), _L, _L_CONTEXT, Slic3r::GUI::ImGuiWrapper::bbl_checkbox(), Slic3r::GUI::ImGuiWrapper::bbl_slider_float_style(), Slic3r::GUI::ImGuiWrapper::begin(), Slic3r::GUI::GLGizmoUtils::begin_right_aligned_buttons(), Slic3r::GUI::ImGuiWrapper::button(), Slic3r::check_object_layers_fixed(), Slic3r::GUI::ImGuiWrapper::disabled_begin(), Slic3r::GUI::ImGuiWrapper::disabled_end(), Slic3r::GUI::ImGuiWrapper::end(), Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::GLToolbar::get_height(), Slic3r::GUI::GLToolbar::get_item(), Slic3r::GUI::GLCanvas3D::get_scale(), Slic3r::GUI::Size::get_width(), Slic3r::GUI::GLCanvas3D::get_wxglcanvas(), m_adaptive_quality, m_enabled, m_layer_height_profile, Slic3r::GUI::GLCanvas3D::m_main_toolbar, m_slicing_parameters, m_smooth_params, Slic3r::GUI::GLToolbarItem::Normal, Slic3r::GUI::ImGuiWrapper::pop_toolbar_style(), Slic3r::GUI::ImGuiWrapper::push_toolbar_style(), Slic3r::GUI::GLToolbarItem::render_left_pos, Slic3r::GUI::GLGizmoUtils::render_tooltip_button(), render_variable_layer_height_dialog(), Slic3r::GUI::GLCanvas3D::request_extra_frame(), s_overlay_window_width, Slic3r::GUI::ImGuiWrapper::scaled(), Slic3r::GUI::GLCanvas3D::set_as_dirty(), Slic3r::GUI::ImGuiWrapper::set_next_window_pos(), Slic3r::GUI::GLToolbarItem::set_state(), Slic3r::GUI::shortkey_shift_prefix(), and Slic3r::GUI::ImGuiWrapper::text().

Referenced by render_variable_layer_height_dialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_volumes()

void Slic3r::GUI::GLCanvas3D::LayersEditing::render_volumes ( const GLCanvas3D & canvas,
const GLVolumeCollection & volumes )
722{
723 assert(this->is_allowed());
724 assert(this->last_object_id != -1);
725
726 GLShaderProgram* current_shader = wxGetApp().get_current_shader();
727 ScopeGuard guard([current_shader]() { if (current_shader != nullptr) current_shader->start_using(); });
728 if (current_shader != nullptr)
729 current_shader->stop_using();
730
731 GLShaderProgram* shader = wxGetApp().get_shader("variable_layer_height");
732 if (shader == nullptr)
733 return;
734
735 shader->start_using();
736
738
739 // Uniforms were resolved, go ahead using the layer editing shader.
740 shader->set_uniform("z_to_texture_row", float(m_layers_texture.cells - 1) / (float(m_layers_texture.width) * float(m_object_max_z)));
741 shader->set_uniform("z_texture_row_to_normalized", 1.0f / float(m_layers_texture.height));
742 shader->set_uniform("z_cursor", float(m_object_max_z) * float(this->get_cursor_z_relative(canvas)));
743 shader->set_uniform("z_cursor_band_width", float(this->band_width));
744
745 const Camera& camera = wxGetApp().plater()->get_camera();
746 shader->set_uniform("projection_matrix", camera.get_projection_matrix());
747
748 // Initialize the layer height texture mapping.
749 const GLsizei w = (GLsizei)m_layers_texture.width;
750 const GLsizei h = (GLsizei)m_layers_texture.height;
751 const GLsizei half_w = w / 2;
752 const GLsizei half_h = h / 2;
758 glsafe(::glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, half_w, half_h, GL_RGBA, GL_UNSIGNED_BYTE, m_layers_texture.data.data() + m_layers_texture.width * m_layers_texture.height * 4));
759 for (GLVolume* glvolume : volumes.volumes) {
760 // Render the object using the layer editing shader and texture.
761 if (!glvolume->is_active || glvolume->composite_id.object_id != this->last_object_id || glvolume->is_modifier)
762 continue;
763
764 shader->set_uniform("volume_world_matrix", glvolume->world_matrix());
765 shader->set_uniform("object_max_z", 0.0f);
766 const Transform3d& view_matrix = camera.get_view_matrix();
767 const Transform3d model_matrix = glvolume->world_matrix();
768 shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
769 const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
770 shader->set_uniform("view_normal_matrix", view_normal_matrix);
771
772 glvolume->render();
773 }
774 // Revert back to the previous shader.
776}
bool is_allowed() const
Definition GLCanvas3D.cpp:358
void generate_layer_height_texture()
Definition GLCanvas3D.cpp:815
Camera camera
Definition GLCanvas3D.hpp:794
#define glTexImage2D
Definition gl.h:4895
#define GL_UNSIGNED_BYTE
Definition gl.h:1937
#define glTexSubImage2D
Definition gl.h:4927
int GLsizei
Definition gl.h:2065
#define GL_RGBA
Definition gl.h:1493
@ Camera
Definition Shortcuts.hpp:72
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
const Transform3d & get_projection_matrix() const
Definition Camera.hpp:116
const Transform3d & get_view_matrix() const
Definition Camera.hpp:115

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), band_width, Slic3r::GUI::GLCanvas3D::camera, Slic3r::GLVolume::composite_id, Slic3r::generate_layer_height_texture(), get_cursor_z_relative(), GL_RGBA, GL_TEXTURE_2D, GL_UNPACK_ALIGNMENT, GL_UNSIGNED_BYTE, glBindTexture, glPixelStorei, glsafe, glTexImage2D, glTexSubImage2D, is_allowed(), last_object_id, m_layers_texture, m_object_max_z, m_z_texture_id, Slic3r::GLVolume::CompositeID::object_id, Slic3r::GLVolume::render(), render_volumes(), Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), Slic3r::GLShaderProgram::stop_using(), Slic3r::GLVolumeCollection::volumes, and Slic3r::GLVolume::world_matrix().

Referenced by render_volumes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_layer_height_profile()

void Slic3r::GUI::GLCanvas3D::LayersEditing::reset_layer_height_profile ( GLCanvas3D & canvas)
787{
788 const_cast<ModelObject*>(m_model_object)->layer_height_profile.clear();
790 m_layers_texture.valid = false;
791 canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
792 wxGetApp().obj_list()->update_info_items(last_object_id);
793}

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), last_object_id, m_layer_height_profile, m_layers_texture, m_model_object, Slic3r::GUI::GLCanvas3D::post_event(), and reset_layer_height_profile().

Referenced by reset_layer_height_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_object()

void Slic3r::GUI::GLCanvas3D::LayersEditing::select_object ( const Model & model,
int object_id )
339{
340 const ModelObject* model_object_new = (object_id >= 0) ? model.objects[object_id] : nullptr;
341 // Maximum height of an object changes when the object gets rotated or scaled.
342 // Changing maximum height of an object will invalidate the layer heigth editing profile.
343 // m_model_object->bounding_box() is cached, therefore it is cheap even if this method is called frequently.
344 const float new_max_z = (model_object_new == nullptr) ? 0.0f : static_cast<float>(model_object_new->max_z());
345
346 if (m_model_object != model_object_new || this->last_object_id != object_id || m_object_max_z != new_max_z ||
347 (model_object_new != nullptr && m_model_object->id() != model_object_new->id())) {
348 m_layer_height_profile.clear();
349 delete m_slicing_parameters;
350 m_slicing_parameters = nullptr;
351 m_layers_texture.valid = false;
352 this->last_object_id = object_id;
353 m_model_object = model_object_new;
354 m_object_max_z = new_max_z;
355 }
356}

References Slic3r::ObjectBase::id(), last_object_id, m_layer_height_profile, m_layers_texture, m_model_object, m_object_max_z, m_slicing_parameters, Slic3r::ModelObject::max_z(), Slic3r::Model::objects, and select_object().

Referenced by select_object().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_config()

void Slic3r::GUI::GLCanvas3D::LayersEditing::set_config ( const DynamicPrintConfig * config)
330{
331 m_config = config;
333 m_slicing_parameters = nullptr;
334 m_layers_texture.valid = false;
336}
const DynamicPrintConfig * m_config
Definition GLCanvas3D.hpp:267

References m_config, m_layer_height_profile, m_layers_texture, m_slicing_parameters, and set_config().

Referenced by set_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_enabled()

void Slic3r::GUI::GLCanvas3D::LayersEditing::set_enabled ( bool enabled)
inline
329{ m_enabled = is_allowed() && enabled; }

References is_allowed(), and m_enabled.

Here is the call graph for this function:

◆ set_shrinkage_compensation()

void Slic3r::GUI::GLCanvas3D::LayersEditing::set_shrinkage_compensation ( const Vec3d & shrinkage_compensation)
inline
261{ m_shrinkage_compensation = shrinkage_compensation; };
Vec3d m_shrinkage_compensation
Definition GLCanvas3D.hpp:277

References m_shrinkage_compensation.

◆ smooth_layer_height_profile()

void Slic3r::GUI::GLCanvas3D::LayersEditing::smooth_layer_height_profile ( GLCanvas3D & canvas,
const HeightProfileSmoothingParams & smoothing_params )
806{
809 const_cast<ModelObject*>(m_model_object)->layer_height_profile.set(m_layer_height_profile);
810 m_layers_texture.valid = false;
811 canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
812 wxGetApp().obj_list()->update_info_items(last_object_id);
813}
std::vector< double > smooth_height_profile(const std::vector< double > &profile, const SlicingParameters &slicing_params, const HeightProfileSmoothingParams &smoothing_params)
Definition Slicing.cpp:418

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), last_object_id, m_layer_height_profile, m_layers_texture, m_model_object, m_slicing_parameters, Slic3r::GUI::GLCanvas3D::post_event(), Slic3r::smooth_height_profile(), smooth_layer_height_profile(), and update_slicing_parameters().

Referenced by smooth_layer_height_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ thickness_bar_width()

float Slic3r::GUI::GLCanvas3D::LayersEditing::thickness_bar_width ( const GLCanvas3D & canvas)
staticprivate
864{
865 return
866#if ENABLE_RETINA_GL
867 canvas.get_canvas_size().get_scale_factor()
868#else
869 canvas.get_wxglcanvas()->GetContentScaleFactor()
870#endif
872}

References Slic3r::GUI::GLCanvas3D::GLCanvas3D(), Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::Size::get_scale_factor(), Slic3r::GUI::GLCanvas3D::get_wxglcanvas(), THICKNESS_BAR_WIDTH, and thickness_bar_width().

Referenced by get_bar_rect_screen(), and thickness_bar_width().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_slicing_parameters()

void Slic3r::GUI::GLCanvas3D::LayersEditing::update_slicing_parameters ( )
private
855{
856 if (m_slicing_parameters == nullptr) {
857 m_slicing_parameters = new SlicingParameters();
859 }
860
861}
const SlicingParameters & slicing_parameters() const
Definition Print.hpp:496

References m_config, m_model_object, m_object_max_z, m_shrinkage_compensation, m_slicing_parameters, Slic3r::PrintObject::slicing_parameters(), and update_slicing_parameters().

Referenced by adaptive_layer_height_profile(), adjust_layer_height_profile(), generate_layer_height_texture(), smooth_layer_height_profile(), and update_slicing_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ band_width

float Slic3r::GUI::GLCanvas3D::LayersEditing::band_width { 2.0f }

◆ last_action

LayerHeightEditActionType Slic3r::GUI::GLCanvas3D::LayersEditing::last_action { LAYER_HEIGHT_EDIT_ACTION_INCREASE }
@ LAYER_HEIGHT_EDIT_ACTION_INCREASE
Definition Slicing.hpp:184

Referenced by adjust_layer_height_profile().

◆ last_object_id

int Slic3r::GUI::GLCanvas3D::LayersEditing::last_object_id { -1 }

◆ last_z

float Slic3r::GUI::GLCanvas3D::LayersEditing::last_z { 0.0f }
306{ 0.0f };

Referenced by adjust_layer_height_profile().

◆ m_adaptive_quality

float Slic3r::GUI::GLCanvas3D::LayersEditing::m_adaptive_quality { 0.5f }
mutableprivate
279{ 0.5f };

Referenced by render_variable_layer_height_dialog().

◆ m_config

const DynamicPrintConfig* Slic3r::GUI::GLCanvas3D::LayersEditing::m_config { nullptr }
private
267{ nullptr };

Referenced by set_config(), and update_slicing_parameters().

◆ m_enabled

bool Slic3r::GUI::GLCanvas3D::LayersEditing::m_enabled { false }
private

◆ m_layer_height_profile

◆ m_layers_texture

◆ m_model_object

◆ m_object_max_z

float Slic3r::GUI::GLCanvas3D::LayersEditing::m_object_max_z { 0.0f }
private

◆ m_profile

Profile Slic3r::GUI::GLCanvas3D::LayersEditing::m_profile

◆ m_shrinkage_compensation

Vec3d Slic3r::GUI::GLCanvas3D::LayersEditing::m_shrinkage_compensation { Vec3d::Ones() }
private
277{ Vec3d::Ones() };

Referenced by set_shrinkage_compensation(), and update_slicing_parameters().

◆ m_slicing_parameters

◆ m_smooth_params

HeightProfileSmoothingParams Slic3r::GUI::GLCanvas3D::LayersEditing::m_smooth_params
mutableprivate

◆ m_z_texture_id

unsigned int Slic3r::GUI::GLCanvas3D::LayersEditing::m_z_texture_id { 0 }
private

◆ s_overlay_window_width

float Slic3r::GUI::GLCanvas3D::LayersEditing::s_overlay_window_width
staticprivate

◆ state

EState Slic3r::GUI::GLCanvas3D::LayersEditing::state { Unknown }
302{ Unknown };

◆ strength

float Slic3r::GUI::GLCanvas3D::LayersEditing::strength { 0.005f }
304{ 0.005f };

Referenced by adjust_layer_height_profile().

◆ THICKNESS_BAR_WIDTH

const float Slic3r::GUI::GLCanvas3D::LayersEditing::THICKNESS_BAR_WIDTH = 70.0f
static

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/GLCanvas3D.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/GLCanvas3D.cpp