2018-05-09 10:47:04 +02:00
|
|
|
#ifndef slic3r_GLCanvas3DManager_hpp_
|
|
|
|
|
#define slic3r_GLCanvas3DManager_hpp_
|
|
|
|
|
|
2018-05-18 11:05:48 +02:00
|
|
|
#include "../../slic3r/GUI/GLCanvas3D.hpp"
|
2018-05-09 10:47:04 +02:00
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
|
|
class GLCanvas3DManager
|
|
|
|
|
{
|
2018-06-04 10:14:09 +02:00
|
|
|
struct GLInfo
|
2018-05-09 10:47:04 +02:00
|
|
|
{
|
2018-06-04 10:14:09 +02:00
|
|
|
std::string version;
|
|
|
|
|
std::string glsl_version;
|
|
|
|
|
std::string vendor;
|
|
|
|
|
std::string renderer;
|
|
|
|
|
|
|
|
|
|
GLInfo();
|
2018-05-09 10:47:04 +02:00
|
|
|
|
|
|
|
|
bool detect();
|
2018-06-04 10:14:09 +02:00
|
|
|
bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
2018-05-09 10:47:04 +02:00
|
|
|
|
2018-06-04 10:14:09 +02:00
|
|
|
std::string to_string(bool format_as_html, bool extensions) const;
|
2018-05-09 10:47:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
|
|
|
|
|
|
|
|
|
|
CanvasesMap m_canvases;
|
2018-06-04 10:14:09 +02:00
|
|
|
GLInfo m_gl_info;
|
2018-05-09 10:47:04 +02:00
|
|
|
bool m_gl_initialized;
|
|
|
|
|
bool m_use_legacy_opengl;
|
|
|
|
|
bool m_use_VBOs;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
GLCanvas3DManager();
|
|
|
|
|
|
|
|
|
|
bool add(wxGLCanvas* canvas, wxGLContext* context);
|
|
|
|
|
bool remove(wxGLCanvas* canvas);
|
|
|
|
|
|
|
|
|
|
void remove_all();
|
|
|
|
|
|
|
|
|
|
unsigned int count() const;
|
|
|
|
|
|
|
|
|
|
void init_gl();
|
2018-06-04 10:14:09 +02:00
|
|
|
std::string get_gl_info(bool format_as_html, bool extensions) const;
|
2018-05-09 10:47:04 +02:00
|
|
|
|
|
|
|
|
bool use_VBOs() const;
|
|
|
|
|
bool layer_editing_allowed() const;
|
|
|
|
|
|
2018-06-04 13:15:28 +02:00
|
|
|
bool init(wxGLCanvas* canvas);
|
2018-05-23 09:57:44 +02:00
|
|
|
|
2018-05-14 14:14:19 +02:00
|
|
|
bool is_shown_on_screen(wxGLCanvas* canvas) const;
|
|
|
|
|
|
|
|
|
|
void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
2018-05-18 14:08:59 +02:00
|
|
|
void reset_volumes(wxGLCanvas* canvas);
|
2018-05-25 09:03:55 +02:00
|
|
|
void deselect_volumes(wxGLCanvas* canvas);
|
|
|
|
|
void select_volume(wxGLCanvas* canvas, unsigned int id);
|
2018-05-18 14:08:59 +02:00
|
|
|
|
2018-05-23 11:14:49 +02:00
|
|
|
void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
|
2018-05-28 15:23:01 +02:00
|
|
|
void set_print(wxGLCanvas* canvas, Print* print);
|
2018-05-23 11:14:49 +02:00
|
|
|
|
2018-05-14 14:14:19 +02:00
|
|
|
void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
2018-05-15 15:38:25 +02:00
|
|
|
void set_auto_bed_shape(wxGLCanvas* canvas);
|
2018-05-14 14:14:19 +02:00
|
|
|
|
2018-05-15 10:32:38 +02:00
|
|
|
BoundingBoxf3 get_volumes_bounding_box(wxGLCanvas* canvas);
|
2018-05-14 14:14:19 +02:00
|
|
|
|
2018-05-18 13:02:47 +02:00
|
|
|
void set_axes_length(wxGLCanvas* canvas, float length);
|
|
|
|
|
|
2018-05-18 11:05:48 +02:00
|
|
|
void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons);
|
|
|
|
|
|
2018-05-18 14:08:59 +02:00
|
|
|
bool is_layers_editing_enabled(wxGLCanvas* canvas) const;
|
2018-05-25 16:28:24 +02:00
|
|
|
bool is_layers_editing_allowed(wxGLCanvas* canvas) const;
|
2018-06-04 14:28:59 +02:00
|
|
|
bool is_shader_enabled(wxGLCanvas* canvas) const;
|
2018-05-18 14:08:59 +02:00
|
|
|
|
2018-05-25 14:05:08 +02:00
|
|
|
void enable_layers_editing(wxGLCanvas* canvas, bool enable);
|
2018-05-21 14:40:09 +02:00
|
|
|
void enable_warning_texture(wxGLCanvas* canvas, bool enable);
|
2018-05-21 14:57:43 +02:00
|
|
|
void enable_legend_texture(wxGLCanvas* canvas, bool enable);
|
2018-05-22 09:02:42 +02:00
|
|
|
void enable_picking(wxGLCanvas* canvas, bool enable);
|
2018-05-31 13:51:50 +02:00
|
|
|
void enable_moving(wxGLCanvas* canvas, bool enable);
|
2018-05-23 09:57:44 +02:00
|
|
|
void enable_shader(wxGLCanvas* canvas, bool enable);
|
2018-06-05 10:56:55 +02:00
|
|
|
void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
|
2018-05-23 15:35:11 +02:00
|
|
|
void allow_multisample(wxGLCanvas* canvas, bool allow);
|
2018-05-21 14:40:09 +02:00
|
|
|
|
2018-05-15 10:32:38 +02:00
|
|
|
void zoom_to_bed(wxGLCanvas* canvas);
|
|
|
|
|
void zoom_to_volumes(wxGLCanvas* canvas);
|
2018-05-15 11:30:11 +02:00
|
|
|
void select_view(wxGLCanvas* canvas, const std::string& direction);
|
2018-05-29 15:36:09 +02:00
|
|
|
void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
2018-05-15 10:32:38 +02:00
|
|
|
|
2018-05-29 15:07:06 +02:00
|
|
|
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
|
|
|
|
|
2018-05-29 13:54:34 +02:00
|
|
|
void render(wxGLCanvas* canvas) const;
|
2018-05-30 15:18:45 +02:00
|
|
|
|
2018-06-04 15:42:34 +02:00
|
|
|
std::vector<double> get_current_print_zs(wxGLCanvas* canvas, bool active_only) const;
|
|
|
|
|
void set_toolpaths_range(wxGLCanvas* canvas, double low, double high);
|
|
|
|
|
|
2018-06-05 14:09:36 +02:00
|
|
|
void load_print_toolpaths(wxGLCanvas* canvas);
|
|
|
|
|
void load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& tool_colors);
|
|
|
|
|
void load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
|
2018-06-05 10:56:55 +02:00
|
|
|
void load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors);
|
|
|
|
|
|
2018-05-15 09:50:01 +02:00
|
|
|
void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
2018-05-31 13:51:50 +02:00
|
|
|
void register_on_double_click_callback(wxGLCanvas* canvas, void* callback);
|
|
|
|
|
void register_on_right_click_callback(wxGLCanvas* canvas, void* callback);
|
|
|
|
|
void register_on_select_callback(wxGLCanvas* canvas, void* callback);
|
2018-05-31 16:04:59 +02:00
|
|
|
void register_on_model_update_callback(wxGLCanvas* canvas, void* callback);
|
|
|
|
|
void register_on_move_callback(wxGLCanvas* canvas, void* callback);
|
2018-05-15 09:50:01 +02:00
|
|
|
|
2018-05-09 10:47:04 +02:00
|
|
|
private:
|
|
|
|
|
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
|
|
|
|
CanvasesMap::const_iterator _get_canvas(wxGLCanvas* canvas) const;
|
2018-06-04 13:15:28 +02:00
|
|
|
|
|
|
|
|
bool _init(GLCanvas3D& canvas);
|
2018-05-09 10:47:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
|
|
#endif // slic3r_GLCanvas3DManager_hpp_
|