PrusaSlicer-NonPlainar/xs/src/slic3r/GUI/GLCanvas3D.hpp

655 lines
19 KiB
C++
Raw Normal View History

2018-05-09 08:47:04 +00:00
#ifndef slic3r_GLCanvas3D_hpp_
#define slic3r_GLCanvas3D_hpp_
2018-06-11 13:13:13 +00:00
#include "../../slic3r/GUI/3DScene.hpp"
2018-06-13 07:12:16 +00:00
#include "../../slic3r/GUI/GLTexture.hpp"
2018-05-09 08:47:04 +00:00
class wxTimer;
2018-05-09 08:47:04 +00:00
class wxSizeEvent;
class wxIdleEvent;
class wxKeyEvent;
2018-05-28 13:23:01 +00:00
class wxMouseEvent;
class wxTimerEvent;
class wxPaintEvent;
2018-05-09 08:47:04 +00:00
namespace Slic3r {
2018-05-14 12:14:19 +00:00
2018-05-23 07:57:44 +00:00
class GLShader;
2018-05-15 13:38:25 +00:00
class ExPolygon;
2018-05-14 12:14:19 +00:00
2018-05-09 08:47:04 +00:00
namespace GUI {
2018-06-13 07:12:16 +00:00
class GLGizmoBase;
2018-05-15 13:38:25 +00:00
class GeometryBuffer
{
2018-06-11 08:46:32 +00:00
std::vector<float> m_vertices;
std::vector<float> m_tex_coords;
2018-05-15 13:38:25 +00:00
public:
2018-06-11 08:46:32 +00:00
bool set_from_triangles(const Polygons& triangles, float z, bool generate_tex_coords);
2018-05-15 13:38:25 +00:00
bool set_from_lines(const Lines& lines, float z);
2018-06-11 08:46:32 +00:00
const float* get_vertices() const;
const float* get_tex_coords() const;
unsigned int get_vertices_count() const;
2018-05-15 13:38:25 +00:00
};
class Size
{
int m_width;
int m_height;
public:
Size();
Size(int width, int height);
int get_width() const;
void set_width(int width);
int get_height() const;
void set_height(int height);
};
class Rect
{
float m_left;
float m_top;
float m_right;
float m_bottom;
public:
Rect();
Rect(float left, float top, float right, float bottom);
float get_left() const;
void set_left(float left);
float get_top() const;
void set_top(float top);
float get_right() const;
void set_right(float right);
float get_bottom() const;
void set_bottom(float bottom);
};
2018-05-09 08:47:04 +00:00
class GLCanvas3D
{
2018-06-05 08:56:55 +00:00
struct GCodePreviewVolumeIndex
{
enum EType
{
Extrusion,
Travel,
Retraction,
Unretraction,
Shell,
Num_Geometry_Types
};
struct FirstVolume
{
EType type;
unsigned int flag;
// Index of the first volume in a GLVolumeCollection.
unsigned int id;
FirstVolume(EType type, unsigned int flag, unsigned int id) : type(type), flag(flag), id(id) {}
};
std::vector<FirstVolume> first_volumes;
void reset() { first_volumes.clear(); }
};
2018-05-09 08:47:04 +00:00
public:
2018-06-01 13:54:41 +00:00
struct Camera
2018-05-09 08:47:04 +00:00
{
enum EType : unsigned char
{
2018-06-01 13:54:41 +00:00
Unknown,
// Perspective,
2018-06-01 13:54:41 +00:00
Ortho,
Num_types
2018-05-09 08:47:04 +00:00
};
2018-06-01 13:54:41 +00:00
EType type;
float zoom;
float phi;
// float distance;
2018-06-01 13:54:41 +00:00
Pointf3 target;
2018-05-14 10:08:23 +00:00
private:
float m_theta;
2018-05-09 08:47:04 +00:00
2018-05-14 10:08:23 +00:00
public:
2018-05-09 08:47:04 +00:00
Camera();
2018-05-14 09:31:58 +00:00
std::string get_type_as_string() const;
2018-05-14 10:08:23 +00:00
float get_theta() const;
void set_theta(float theta);
2018-05-09 08:47:04 +00:00
};
2018-05-14 12:14:19 +00:00
class Bed
{
2018-06-11 08:46:32 +00:00
public:
enum EType : unsigned char
{
MK2,
MK3,
Custom,
Num_Types
};
private:
EType m_type;
2018-05-14 12:14:19 +00:00
Pointfs m_shape;
BoundingBoxf3 m_bounding_box;
2018-05-15 13:38:25 +00:00
Polygon m_polygon;
GeometryBuffer m_triangles;
GeometryBuffer m_gridlines;
2018-06-13 07:12:16 +00:00
mutable GLTexture m_top_texture;
mutable GLTexture m_bottom_texture;
2018-05-14 12:14:19 +00:00
public:
2018-06-11 08:46:32 +00:00
Bed();
bool is_prusa() const;
bool is_custom() const;
2018-05-14 12:14:19 +00:00
const Pointfs& get_shape() const;
void set_shape(const Pointfs& shape);
const BoundingBoxf3& get_bounding_box() const;
bool contains(const Point& point) const;
Point point_projection(const Point& point) const;
2018-05-14 12:14:19 +00:00
2018-06-11 08:46:32 +00:00
void render(float theta) const;
2018-05-15 13:38:25 +00:00
2018-05-14 12:14:19 +00:00
private:
void _calc_bounding_box();
2018-05-15 13:38:25 +00:00
void _calc_triangles(const ExPolygon& poly);
void _calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox);
2018-06-11 08:46:32 +00:00
EType _detect_type() const;
void _render_mk2(float theta) const;
void _render_mk3(float theta) const;
void _render_prusa(float theta) const;
void _render_custom() const;
static bool _are_equal(const Pointfs& bed_1, const Pointfs& bed_2);
2018-05-14 12:14:19 +00:00
};
2018-06-01 13:54:41 +00:00
struct Axes
2018-05-18 11:02:47 +00:00
{
2018-06-01 13:54:41 +00:00
Pointf3 origin;
float length;
2018-05-18 11:02:47 +00:00
Axes();
2018-06-13 11:14:17 +00:00
void render(bool depth_test) const;
2018-05-18 11:02:47 +00:00
};
2018-05-18 09:05:48 +00:00
class CuttingPlane
{
float m_z;
GeometryBuffer m_lines;
public:
CuttingPlane();
bool set(float z, const ExPolygons& polygons);
2018-05-21 13:57:03 +00:00
void render(const BoundingBoxf3& bb) const;
2018-05-21 13:24:52 +00:00
private:
2018-05-21 13:57:03 +00:00
void _render_plane(const BoundingBoxf3& bb) const;
void _render_contour() const;
2018-05-18 09:05:48 +00:00
};
2018-05-25 12:05:08 +00:00
class Shader
{
GLShader* m_shader;
public:
Shader();
~Shader();
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
bool is_initialized() const;
bool start_using() const;
void stop_using() const;
void set_uniform(const std::string& name, float value) const;
2018-06-21 06:37:04 +00:00
void set_uniform(const std::string& name, const float* matrix) const;
const GLShader* get_shader() const;
2018-05-25 12:05:08 +00:00
private:
void _reset();
};
class LayersEditing
{
public:
enum EState : unsigned char
{
Unknown,
Editing,
Completed,
Num_States
};
private:
bool m_use_legacy_opengl;
bool m_enabled;
2018-05-25 12:05:08 +00:00
Shader m_shader;
unsigned int m_z_texture_id;
2018-06-13 07:12:16 +00:00
mutable GLTexture m_tooltip_texture;
mutable GLTexture m_reset_texture;
public:
2018-06-01 13:54:41 +00:00
EState state;
float band_width;
float strength;
int last_object_id;
float last_z;
unsigned int last_action;
LayersEditing();
~LayersEditing();
2018-05-25 12:05:08 +00:00
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
bool is_allowed() const;
void set_use_legacy_opengl(bool use_legacy_opengl);
2018-05-25 12:05:08 +00:00
bool is_enabled() const;
2018-05-25 12:05:08 +00:00
void set_enabled(bool enabled);
unsigned int get_z_texture_id() const;
void render(const GLCanvas3D& canvas, const PrintObject& print_object, const GLVolume& volume) const;
2018-06-01 13:54:41 +00:00
int get_shader_program_id() const;
2018-05-25 12:05:08 +00:00
static float get_cursor_z_relative(const GLCanvas3D& canvas);
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
static bool reset_rect_contains(const GLCanvas3D& canvas, float x, float y);
static Rect get_bar_rect_screen(const GLCanvas3D& canvas);
static Rect get_reset_rect_screen(const GLCanvas3D& canvas);
static Rect get_bar_rect_viewport(const GLCanvas3D& canvas);
static Rect get_reset_rect_viewport(const GLCanvas3D& canvas);
private:
2018-05-25 12:05:08 +00:00
bool _is_initialized() const;
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
2018-06-13 07:12:16 +00:00
void _render_reset_texture(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_profile(const PrintObject& print_object, const Rect& bar_rect) const;
};
2018-06-01 13:54:41 +00:00
struct Mouse
2018-05-23 11:56:54 +00:00
{
2018-06-01 13:54:41 +00:00
struct Drag
{
static const Point Invalid_2D_Point;
static const Pointf3 Invalid_3D_Point;
2018-05-23 11:56:54 +00:00
2018-06-01 13:54:41 +00:00
Point start_position_2D;
Pointf3 start_position_3D;
Vectorf3 volume_center_offset;
2018-06-21 06:37:04 +00:00
bool move_with_shift;
2018-06-21 06:37:04 +00:00
int move_volume_idx;
int gizmo_volume_idx;
2018-05-23 11:56:54 +00:00
2018-06-01 13:54:41 +00:00
public:
Drag();
};
2018-05-23 11:56:54 +00:00
2018-06-01 13:54:41 +00:00
bool dragging;
Pointf position;
Drag drag;
2018-06-01 13:54:41 +00:00
Mouse();
2018-06-01 13:54:41 +00:00
void set_start_position_2D_as_invalid();
void set_start_position_3D_as_invalid();
bool is_start_position_2D_defined() const;
bool is_start_position_3D_defined() const;
};
2018-06-13 07:12:16 +00:00
class Gizmos
{
2018-06-22 07:00:01 +00:00
static const float OverlayTexturesScale;
2018-06-13 07:12:16 +00:00
static const float OverlayOffsetX;
static const float OverlayGapY;
public:
enum EType : unsigned char
{
2018-06-13 07:26:58 +00:00
Undefined,
2018-06-13 07:12:16 +00:00
Scale,
Rotate,
Num_Types
};
private:
bool m_enabled;
typedef std::map<EType, GLGizmoBase*> GizmosMap;
GizmosMap m_gizmos;
EType m_current;
2018-06-15 12:10:28 +00:00
bool m_dragging;
2018-06-13 07:12:16 +00:00
public:
Gizmos();
~Gizmos();
bool init();
bool is_enabled() const;
void set_enabled(bool enable);
2018-06-13 08:49:59 +00:00
void update_hover_state(const GLCanvas3D& canvas, const Pointf& mouse_pos);
2018-06-13 11:14:17 +00:00
void update_on_off_state(const GLCanvas3D& canvas, const Pointf& mouse_pos);
void reset_all_states();
2018-06-14 13:32:26 +00:00
void set_hover_id(int id);
bool overlay_contains_mouse(const GLCanvas3D& canvas, const Pointf& mouse_pos) const;
2018-06-15 12:10:28 +00:00
bool grabber_contains_mouse() const;
void update(const Pointf& mouse_pos);
2018-06-19 07:46:26 +00:00
EType get_current_type() const;
2018-06-15 12:10:28 +00:00
2018-06-18 13:07:17 +00:00
bool is_running() const;
2018-06-19 07:46:26 +00:00
2018-06-15 12:10:28 +00:00
bool is_dragging() const;
void start_dragging();
void stop_dragging();
2018-06-13 08:49:59 +00:00
2018-06-18 13:07:17 +00:00
float get_scale() const;
2018-06-19 07:46:26 +00:00
void set_scale(float scale);
float get_angle_z() const;
void set_angle_z(float angle_z);
2018-06-18 13:07:17 +00:00
2018-06-13 13:44:04 +00:00
void render(const GLCanvas3D& canvas, const BoundingBoxf3& box) const;
2018-06-14 13:32:26 +00:00
void render_current_gizmo_for_picking_pass(const BoundingBoxf3& box) const;
2018-06-13 07:12:16 +00:00
private:
void _reset();
void _render_overlay(const GLCanvas3D& canvas) const;
2018-06-13 13:44:04 +00:00
void _render_current_gizmo(const BoundingBoxf3& box) const;
2018-06-13 08:49:59 +00:00
float _get_total_overlay_height() const;
2018-06-15 12:10:28 +00:00
GLGizmoBase* _get_current() const;
2018-06-13 07:12:16 +00:00
};
2018-05-09 08:47:04 +00:00
private:
wxGLCanvas* m_canvas;
wxGLContext* m_context;
wxTimer* m_timer;
2018-05-09 08:47:04 +00:00
Camera m_camera;
2018-05-14 12:14:19 +00:00
Bed m_bed;
2018-05-18 11:02:47 +00:00
Axes m_axes;
2018-05-18 09:05:48 +00:00
CuttingPlane m_cutting_plane;
LayersEditing m_layers_editing;
2018-05-23 07:57:44 +00:00
Shader m_shader;
2018-05-23 11:56:54 +00:00
Mouse m_mouse;
2018-06-13 08:49:59 +00:00
mutable Gizmos m_gizmos;
2018-05-14 12:14:19 +00:00
2018-06-11 13:13:13 +00:00
mutable GLVolumeCollection m_volumes;
2018-05-23 09:14:49 +00:00
DynamicPrintConfig* m_config;
2018-05-28 13:23:01 +00:00
Print* m_print;
2018-06-07 09:18:28 +00:00
Model* m_model;
2018-05-09 08:47:04 +00:00
bool m_dirty;
// the active member has been introduced to overcome a bug in wxWidgets method IsShownOnScreen() which always return true
// when a window is inside a wxNotebook
bool m_active;
bool m_initialized;
bool m_use_VBOs;
2018-06-05 08:56:55 +00:00
bool m_force_zoom_to_bed_enabled;
2018-05-14 12:14:19 +00:00
bool m_apply_zoom_to_volumes_filter;
mutable int m_hover_volume_id;
2018-05-21 12:40:09 +00:00
bool m_warning_texture_enabled;
2018-05-21 12:57:43 +00:00
bool m_legend_texture_enabled;
bool m_picking_enabled;
bool m_moving_enabled;
2018-05-25 12:05:08 +00:00
bool m_shader_enabled;
2018-05-23 13:35:11 +00:00
bool m_multisample_allowed;
2018-05-09 08:47:04 +00:00
std::string m_color_by;
std::string m_select_by;
std::string m_drag_by;
bool m_reload_delayed;
std::vector<std::vector<int>> m_objects_volumes_idxs;
std::vector<int> m_objects_selections;
2018-06-05 08:56:55 +00:00
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
PerlCallback m_on_viewport_changed_callback;
PerlCallback m_on_double_click_callback;
PerlCallback m_on_right_click_callback;
PerlCallback m_on_select_object_callback;
PerlCallback m_on_model_update_callback;
PerlCallback m_on_remove_object_callback;
PerlCallback m_on_arrange_callback;
PerlCallback m_on_rotate_object_left_callback;
PerlCallback m_on_rotate_object_right_callback;
PerlCallback m_on_scale_object_uniformly_callback;
PerlCallback m_on_increase_objects_callback;
PerlCallback m_on_decrease_objects_callback;
2018-06-07 09:18:28 +00:00
PerlCallback m_on_instance_moved_callback;
PerlCallback m_on_wipe_tower_moved_callback;
PerlCallback m_on_enable_action_buttons_callback;
2018-06-18 13:07:17 +00:00
PerlCallback m_on_gizmo_scale_uniformly_callback;
2018-06-19 07:46:26 +00:00
PerlCallback m_on_gizmo_rotate_callback;
PerlCallback m_on_update_geometry_info_callback;
2018-05-09 08:47:04 +00:00
public:
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
~GLCanvas3D();
2018-05-09 08:47:04 +00:00
2018-05-25 12:05:08 +00:00
bool init(bool useVBOs, bool use_legacy_opengl);
2018-05-23 07:57:44 +00:00
bool set_current();
2018-05-09 08:47:04 +00:00
void set_active(bool active);
2018-05-14 12:14:19 +00:00
2018-06-11 11:48:02 +00:00
unsigned int get_volumes_count() const;
void reset_volumes();
void deselect_volumes();
void select_volume(unsigned int id);
void update_volumes_selection(const std::vector<int>& selections);
2018-06-11 11:48:02 +00:00
bool check_volumes_outside_state(const DynamicPrintConfig* config) const;
bool move_volume_up(unsigned int id);
bool move_volume_down(unsigned int id);
void set_objects_selections(const std::vector<int>& selections);
2018-05-23 09:14:49 +00:00
void set_config(DynamicPrintConfig* config);
2018-05-28 13:23:01 +00:00
void set_print(Print* print);
2018-06-07 09:18:28 +00:00
void set_model(Model* model);
2018-05-23 09:14:49 +00:00
2018-05-15 13:38:25 +00:00
// Set the bed shape to a single closed 2D polygon(array of two element arrays),
// triangulate the bed and store the triangles into m_bed.m_triangles,
// fills the m_bed.m_grid_lines and sets m_bed.m_origin.
// Sets m_bed.m_polygon to limit the object placement.
2018-05-14 12:14:19 +00:00
void set_bed_shape(const Pointfs& shape);
2018-05-15 13:38:25 +00:00
// Used by ObjectCutDialog and ObjectPartsPanel to generate a rectangular ground plane to support the scene objects.
void set_auto_bed_shape();
2018-05-14 12:14:19 +00:00
2018-05-18 11:02:47 +00:00
void set_axes_length(float length);
2018-05-15 09:07:32 +00:00
2018-05-18 09:05:48 +00:00
void set_cutting_plane(float z, const ExPolygons& polygons);
2018-06-06 10:36:52 +00:00
void set_color_by(const std::string& value);
void set_select_by(const std::string& value);
void set_drag_by(const std::string& value);
2018-05-09 08:47:04 +00:00
float get_camera_zoom() const;
2018-05-14 12:14:19 +00:00
BoundingBoxf3 volumes_bounding_box() const;
bool is_layers_editing_enabled() const;
bool is_layers_editing_allowed() const;
bool is_shader_enabled() const;
bool is_reload_delayed() const;
2018-05-25 12:05:08 +00:00
void enable_layers_editing(bool enable);
2018-05-21 12:40:09 +00:00
void enable_warning_texture(bool enable);
2018-05-21 12:57:43 +00:00
void enable_legend_texture(bool enable);
void enable_picking(bool enable);
void enable_moving(bool enable);
2018-06-13 07:12:16 +00:00
void enable_gizmos(bool enable);
2018-05-23 07:57:44 +00:00
void enable_shader(bool enable);
2018-06-05 08:56:55 +00:00
void enable_force_zoom_to_bed(bool enable);
2018-05-23 13:35:11 +00:00
void allow_multisample(bool allow);
2018-05-21 12:40:09 +00:00
2018-05-15 08:32:38 +00:00
void zoom_to_bed();
void zoom_to_volumes();
void select_view(const std::string& direction);
void set_viewport_from_scene(const GLCanvas3D& other);
2018-05-15 08:32:38 +00:00
void update_volumes_colors_by_extruder();
2018-06-19 07:46:26 +00:00
void update_gizmos_data();
void render();
2018-05-15 13:38:25 +00:00
std::vector<double> get_current_print_zs(bool active_only) const;
void set_toolpaths_range(double low, double high);
std::vector<int> load_object(const ModelObject& model_object, int obj_idx, std::vector<int> instance_idxs);
std::vector<int> load_object(const Model& model, int obj_idx);
void reload_scene(bool force);
// Create 3D thick extrusion lines for a skirt and brim.
// Adds a new Slic3r::GUI::3DScene::Volume to volumes.
void load_print_toolpaths();
// Create 3D thick extrusion lines for object forming extrusions.
// Adds a new Slic3r::GUI::3DScene::Volume to $self->volumes,
// one for perimeters, one for infill and one for supports.
void load_print_object_toolpaths(const PrintObject& print_object, const std::vector<std::string>& str_tool_colors);
// Create 3D thick extrusion lines for wipe tower extrusions
void load_wipe_tower_toolpaths(const std::vector<std::string>& str_tool_colors);
2018-06-05 08:56:55 +00:00
void load_gcode_preview(const GCodePreviewData& preview_data, const std::vector<std::string>& str_tool_colors);
void register_on_viewport_changed_callback(void* callback);
void register_on_double_click_callback(void* callback);
void register_on_right_click_callback(void* callback);
void register_on_select_object_callback(void* callback);
void register_on_model_update_callback(void* callback);
void register_on_remove_object_callback(void* callback);
void register_on_arrange_callback(void* callback);
void register_on_rotate_object_left_callback(void* callback);
void register_on_rotate_object_right_callback(void* callback);
void register_on_scale_object_uniformly_callback(void* callback);
void register_on_increase_objects_callback(void* callback);
void register_on_decrease_objects_callback(void* callback);
2018-06-07 09:18:28 +00:00
void register_on_instance_moved_callback(void* callback);
void register_on_wipe_tower_moved_callback(void* callback);
void register_on_enable_action_buttons_callback(void* callback);
2018-06-18 13:07:17 +00:00
void register_on_gizmo_scale_uniformly_callback(void* callback);
2018-06-19 07:46:26 +00:00
void register_on_gizmo_rotate_callback(void* callback);
void register_on_update_geometry_info_callback(void* callback);
2018-06-06 12:19:28 +00:00
void bind_event_handlers();
void unbind_event_handlers();
void on_size(wxSizeEvent& evt);
void on_idle(wxIdleEvent& evt);
void on_char(wxKeyEvent& evt);
2018-05-28 13:23:01 +00:00
void on_mouse_wheel(wxMouseEvent& evt);
void on_timer(wxTimerEvent& evt);
void on_mouse(wxMouseEvent& evt);
void on_paint(wxPaintEvent& evt);
void on_key_down(wxKeyEvent& evt);
Size get_canvas_size() const;
Point get_local_mouse_position() const;
2018-05-14 12:14:19 +00:00
private:
bool _is_shown_on_screen() const;
2018-06-05 08:56:55 +00:00
void _force_zoom_to_bed();
2018-06-01 13:54:41 +00:00
void _resize(unsigned int w, unsigned int h);
BoundingBoxf3 _max_bounding_box() const;
2018-06-13 13:44:04 +00:00
BoundingBoxf3 _selected_volumes_bounding_box() const;
2018-06-01 13:54:41 +00:00
2018-05-14 12:14:19 +00:00
void _zoom_to_bounding_box(const BoundingBoxf3& bbox);
float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const;
void _deregister_callbacks();
2018-05-28 13:23:01 +00:00
void _mark_volumes_for_layer_height() const;
2018-05-28 13:23:01 +00:00
void _refresh_if_shown_on_screen();
2018-05-31 06:44:39 +00:00
void _camera_tranform() const;
void _picking_pass() const;
void _render_background() const;
2018-06-11 08:46:32 +00:00
void _render_bed(float theta) const;
2018-06-13 11:14:17 +00:00
void _render_axes(bool depth_test) const;
void _render_objects() const;
void _render_cutting_plane() const;
void _render_warning_texture() const;
void _render_legend_texture() const;
void _render_layer_editing_overlay() const;
2018-06-01 13:54:41 +00:00
void _render_volumes(bool fake_colors) const;
2018-06-13 07:12:16 +00:00
void _render_gizmo() const;
2018-06-01 13:54:41 +00:00
float _get_layers_editing_cursor_z_relative() const;
void _perform_layer_editing_action(wxMouseEvent* evt = nullptr);
// Convert the screen space coordinate to an object space coordinate.
// If the Z screen space coordinate is not provided, a depth buffer value is substituted.
Pointf3 _mouse_to_3d(const Point& mouse_pos, float* z = nullptr);
2018-06-01 13:54:41 +00:00
2018-06-15 12:10:28 +00:00
// Convert the screen space coordinate to world coordinate on the bed.
Pointf3 _mouse_to_bed_3d(const Point& mouse_pos);
2018-06-01 13:54:41 +00:00
void _start_timer();
void _stop_timer();
2018-06-05 08:56:55 +00:00
2018-06-13 11:14:17 +00:00
int _get_first_selected_object_id() const;
2018-06-21 06:37:04 +00:00
int _get_first_selected_volume_id() const;
2018-06-13 11:14:17 +00:00
2018-06-05 08:56:55 +00:00
// generates gcode extrusion paths geometry
void _load_gcode_extrusion_paths(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
// generates gcode travel paths geometry
void _load_gcode_travel_paths(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
bool _travel_paths_by_type(const GCodePreviewData& preview_data);
bool _travel_paths_by_feedrate(const GCodePreviewData& preview_data);
bool _travel_paths_by_tool(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
// generates gcode retractions geometry
void _load_gcode_retractions(const GCodePreviewData& preview_data);
// generates gcode unretractions geometry
void _load_gcode_unretractions(const GCodePreviewData& preview_data);
// generates objects and wipe tower geometry
void _load_shells();
// sets gcode geometry visibility according to user selection
void _update_gcode_volumes_visibility(const GCodePreviewData& preview_data);
2018-06-07 09:18:28 +00:00
void _on_move(const std::vector<int>& volume_idxs);
void _on_select(int volume_idx);
2018-06-07 09:18:28 +00:00
static std::vector<float> _parse_colors(const std::vector<std::string>& colors);
2018-05-09 08:47:04 +00:00
};
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_GLCanvas3D_hpp_