2018-05-09 08:47:04 +00:00
|
|
|
#ifndef slic3r_GLCanvas3D_hpp_
|
|
|
|
#define slic3r_GLCanvas3D_hpp_
|
|
|
|
|
2018-05-14 12:14:19 +00:00
|
|
|
#include "../../libslic3r/BoundingBox.hpp"
|
2018-05-15 07:50:01 +00:00
|
|
|
#include "../../libslic3r/Utils.hpp"
|
2018-05-18 09:05:48 +00:00
|
|
|
#include "../../libslic3r/ExPolygon.hpp"
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
class wxGLCanvas;
|
|
|
|
class wxGLContext;
|
2018-05-30 13:18:45 +00:00
|
|
|
class wxTimer;
|
2018-05-09 08:47:04 +00:00
|
|
|
class wxSizeEvent;
|
2018-05-14 12:47:13 +00:00
|
|
|
class wxIdleEvent;
|
2018-05-15 14:09:04 +00:00
|
|
|
class wxKeyEvent;
|
2018-05-28 13:23:01 +00:00
|
|
|
class wxMouseEvent;
|
2018-05-30 13:18:45 +00:00
|
|
|
class wxTimerEvent;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
2018-05-14 12:14:19 +00:00
|
|
|
|
|
|
|
class GLVolumeCollection;
|
2018-05-25 13:56:14 +00:00
|
|
|
class GLVolume;
|
2018-05-23 09:14:49 +00:00
|
|
|
class DynamicPrintConfig;
|
2018-05-23 07:57:44 +00:00
|
|
|
class GLShader;
|
2018-05-15 13:38:25 +00:00
|
|
|
class ExPolygon;
|
2018-05-25 13:56:14 +00:00
|
|
|
class Print;
|
2018-05-24 13:17:01 +00:00
|
|
|
class PrintObject;
|
2018-05-14 12:14:19 +00:00
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2018-05-15 13:38:25 +00:00
|
|
|
class GeometryBuffer
|
|
|
|
{
|
|
|
|
std::vector<float> m_data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool set_from_triangles(const Polygons& triangles, float z);
|
|
|
|
bool set_from_lines(const Lines& lines, float z);
|
|
|
|
|
|
|
|
const float* get_data() const;
|
|
|
|
unsigned int get_data_size() const;
|
|
|
|
};
|
|
|
|
|
2018-05-24 11:46:17 +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
|
|
|
|
{
|
|
|
|
public:
|
2018-05-14 10:08:23 +00:00
|
|
|
class Camera
|
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
|
|
|
enum EType : unsigned char
|
|
|
|
{
|
|
|
|
CT_Unknown,
|
|
|
|
CT_Perspective,
|
|
|
|
CT_Ortho,
|
|
|
|
CT_Count
|
|
|
|
};
|
|
|
|
|
2018-05-14 10:08:23 +00:00
|
|
|
private:
|
|
|
|
EType m_type;
|
|
|
|
float m_zoom;
|
|
|
|
float m_phi;
|
|
|
|
float m_theta;
|
|
|
|
float m_distance;
|
|
|
|
Pointf3 m_target;
|
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
|
|
|
|
2018-05-14 10:08:23 +00:00
|
|
|
Camera::EType get_type() const;
|
|
|
|
void set_type(Camera::EType type);
|
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_zoom() const;
|
|
|
|
void set_zoom(float zoom);
|
|
|
|
|
|
|
|
float get_phi() const;
|
|
|
|
void set_phi(float phi);
|
|
|
|
|
|
|
|
float get_theta() const;
|
|
|
|
void set_theta(float theta);
|
|
|
|
|
|
|
|
float get_distance() const;
|
|
|
|
void set_distance(float distance);
|
|
|
|
|
|
|
|
const Pointf3& get_target() const;
|
|
|
|
void set_target(const Pointf3& target);
|
2018-05-09 08:47:04 +00:00
|
|
|
};
|
|
|
|
|
2018-05-14 12:14:19 +00:00
|
|
|
class Bed
|
|
|
|
{
|
|
|
|
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-05-14 12:14:19 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
const Pointfs& get_shape() const;
|
|
|
|
void set_shape(const Pointfs& shape);
|
|
|
|
|
|
|
|
const BoundingBoxf3& get_bounding_box() const;
|
2018-05-31 14:04:59 +00:00
|
|
|
bool contains(const Point& point) const;
|
|
|
|
Point point_projection(const Point& point) const;
|
2018-05-14 12:14:19 +00:00
|
|
|
|
2018-05-21 13:57:03 +00:00
|
|
|
void render() 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-05-14 12:14:19 +00:00
|
|
|
};
|
|
|
|
|
2018-05-18 11:02:47 +00:00
|
|
|
class Axes
|
|
|
|
{
|
|
|
|
Pointf3 m_origin;
|
|
|
|
float m_length;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Axes();
|
|
|
|
|
|
|
|
const Pointf3& get_origin() const;
|
|
|
|
void set_origin(const Pointf3& origin);
|
|
|
|
|
|
|
|
float get_length() const;
|
|
|
|
void set_length(float length);
|
|
|
|
|
2018-05-21 13:57:03 +00:00
|
|
|
void render() 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;
|
|
|
|
|
2018-05-25 13:56:14 +00:00
|
|
|
void set_uniform(const std::string& name, float value) const;
|
|
|
|
|
2018-05-29 12:34:45 +00:00
|
|
|
const GLShader* get_shader() const;
|
2018-05-25 12:05:08 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void _reset();
|
|
|
|
};
|
|
|
|
|
2018-05-18 12:08:59 +00:00
|
|
|
class LayersEditing
|
|
|
|
{
|
2018-05-30 13:18:45 +00:00
|
|
|
public:
|
|
|
|
enum EState : unsigned char
|
|
|
|
{
|
|
|
|
Unknown,
|
|
|
|
Editing,
|
|
|
|
Completed,
|
|
|
|
Num_States
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2018-05-24 11:46:17 +00:00
|
|
|
struct GLTextureData
|
|
|
|
{
|
|
|
|
unsigned int id;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
GLTextureData();
|
|
|
|
GLTextureData(unsigned int id, int width, int height);
|
|
|
|
};
|
|
|
|
|
2018-05-30 13:18:45 +00:00
|
|
|
EState m_state;
|
2018-05-25 14:28:24 +00:00
|
|
|
bool m_use_legacy_opengl;
|
2018-05-18 12:08:59 +00:00
|
|
|
bool m_enabled;
|
2018-05-25 12:05:08 +00:00
|
|
|
Shader m_shader;
|
|
|
|
unsigned int m_z_texture_id;
|
2018-05-24 11:46:17 +00:00
|
|
|
mutable GLTextureData m_tooltip_texture;
|
|
|
|
mutable GLTextureData m_reset_texture;
|
2018-05-25 13:56:14 +00:00
|
|
|
float m_band_width;
|
2018-05-28 11:43:29 +00:00
|
|
|
float m_strength;
|
|
|
|
int m_last_object_id;
|
|
|
|
float m_last_z;
|
|
|
|
unsigned int m_last_action;
|
2018-05-18 12:08:59 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
LayersEditing();
|
2018-05-24 11:46:17 +00:00
|
|
|
~LayersEditing();
|
2018-05-18 12:08:59 +00:00
|
|
|
|
2018-05-25 12:05:08 +00:00
|
|
|
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
|
|
|
|
|
2018-05-30 13:18:45 +00:00
|
|
|
EState get_state() const;
|
|
|
|
void set_state(EState state);
|
|
|
|
|
2018-05-25 12:05:08 +00:00
|
|
|
bool is_allowed() const;
|
2018-05-25 14:28:24 +00:00
|
|
|
void set_use_legacy_opengl(bool use_legacy_opengl);
|
2018-05-25 12:05:08 +00:00
|
|
|
|
2018-05-18 12:08:59 +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;
|
2018-05-24 11:46:17 +00:00
|
|
|
|
2018-05-25 13:56:14 +00:00
|
|
|
float get_band_width() const;
|
|
|
|
void set_band_width(float band_width);
|
|
|
|
|
2018-05-28 11:43:29 +00:00
|
|
|
float get_strength() const;
|
|
|
|
void set_strength(float strength);
|
|
|
|
|
|
|
|
int get_last_object_id() const;
|
|
|
|
void set_last_object_id(int id);
|
|
|
|
|
|
|
|
float get_last_z() const;
|
|
|
|
void set_last_z(float z);
|
|
|
|
|
|
|
|
unsigned int get_last_action() const;
|
|
|
|
void set_last_action(unsigned int action);
|
|
|
|
|
2018-05-25 13:56:14 +00:00
|
|
|
void render(const GLCanvas3D& canvas, const PrintObject& print_object, const GLVolume& volume) const;
|
2018-05-24 11:46:17 +00:00
|
|
|
|
2018-05-29 12:34:45 +00:00
|
|
|
const GLShader* get_shader() const;
|
2018-05-25 12:05:08 +00:00
|
|
|
|
2018-05-28 12:10:02 +00:00
|
|
|
static float get_cursor_z_relative(const GLCanvas3D& canvas);
|
|
|
|
static int get_first_selected_object_id(const GLVolumeCollection& volumes, unsigned int objects_count);
|
2018-05-28 12:39:59 +00:00
|
|
|
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
|
|
|
static bool reset_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
2018-05-30 13:18:45 +00:00
|
|
|
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);
|
2018-05-28 11:43:29 +00:00
|
|
|
|
2018-05-24 11:46:17 +00:00
|
|
|
private:
|
2018-05-25 12:05:08 +00:00
|
|
|
bool _is_initialized() const;
|
2018-05-24 11:46:17 +00:00
|
|
|
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
|
|
|
void _render_reset_texture(const GLCanvas3D& canvas, const Rect& reset_rect) const;
|
2018-05-25 13:56:14 +00:00
|
|
|
void _render_active_object_annotations(const GLCanvas3D& canvas, const GLVolume& volume, const PrintObject& print_object, const Rect& bar_rect) const;
|
2018-05-24 13:17:01 +00:00
|
|
|
void _render_profile(const PrintObject& print_object, const Rect& bar_rect) const;
|
2018-05-28 12:39:59 +00:00
|
|
|
static GLTextureData _load_texture_from_file(const std::string& filename);
|
2018-05-18 12:08:59 +00:00
|
|
|
};
|
|
|
|
|
2018-05-23 11:56:54 +00:00
|
|
|
class Mouse
|
|
|
|
{
|
|
|
|
bool m_dragging;
|
|
|
|
Pointf m_position;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Mouse();
|
|
|
|
|
|
|
|
bool is_dragging() const;
|
|
|
|
void set_dragging(bool dragging);
|
|
|
|
|
|
|
|
const Pointf& get_position() const;
|
|
|
|
void set_position(const Pointf& position);
|
|
|
|
};
|
|
|
|
|
2018-05-31 11:51:50 +00:00
|
|
|
class Drag
|
|
|
|
{
|
2018-05-31 14:04:59 +00:00
|
|
|
Point m_start_position_2D;
|
2018-05-31 11:51:50 +00:00
|
|
|
Pointf3 m_start_position_3D;
|
|
|
|
Vectorf3 m_volume_center_offset;
|
|
|
|
int m_volume_idx;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Drag();
|
|
|
|
|
2018-05-31 14:04:59 +00:00
|
|
|
const Point& get_start_position_2D() const;
|
|
|
|
void set_start_position_2D(const Point& position);
|
2018-05-31 11:51:50 +00:00
|
|
|
|
|
|
|
const Pointf3& get_start_position_3D() const;
|
|
|
|
void set_start_position_3D(const Pointf3& position);
|
|
|
|
|
|
|
|
const Vectorf3& get_volume_center_offset() const;
|
|
|
|
void set_volume_center_offset(const Vectorf3& offset);
|
|
|
|
|
|
|
|
int get_volume_idx() const;
|
|
|
|
void set_volume_idx(int idx);
|
|
|
|
};
|
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
private:
|
|
|
|
wxGLCanvas* m_canvas;
|
|
|
|
wxGLContext* m_context;
|
2018-05-30 13:18:45 +00:00
|
|
|
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;
|
2018-05-18 12:08:59 +00:00
|
|
|
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-05-31 11:51:50 +00:00
|
|
|
Drag m_drag;
|
2018-05-14 12:14:19 +00:00
|
|
|
|
|
|
|
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-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
bool m_dirty;
|
2018-05-14 12:14:19 +00:00
|
|
|
bool m_apply_zoom_to_volumes_filter;
|
2018-05-29 11:54:34 +00:00
|
|
|
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;
|
2018-05-22 07:02:42 +00:00
|
|
|
bool m_picking_enabled;
|
2018-05-31 11:51:50 +00:00
|
|
|
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
|
|
|
|
2018-05-15 07:50:01 +00:00
|
|
|
PerlCallback m_on_viewport_changed_callback;
|
2018-05-31 11:51:50 +00:00
|
|
|
PerlCallback m_on_double_click_callback;
|
|
|
|
PerlCallback m_on_right_click_callback;
|
|
|
|
PerlCallback m_on_select_callback;
|
2018-05-31 14:04:59 +00:00
|
|
|
PerlCallback m_on_model_update_callback;
|
|
|
|
PerlCallback m_on_move_callback;
|
2018-05-15 07:50:01 +00:00
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
public:
|
|
|
|
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
|
2018-05-15 07:50:01 +00:00
|
|
|
~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
|
|
|
|
2018-05-18 12:08:59 +00:00
|
|
|
bool set_current();
|
2018-05-09 08:47:04 +00:00
|
|
|
|
2018-05-15 13:38:25 +00:00
|
|
|
bool is_dirty() const;
|
|
|
|
void set_dirty(bool dirty);
|
|
|
|
|
2018-05-14 12:14:19 +00:00
|
|
|
bool is_shown_on_screen() const;
|
|
|
|
|
|
|
|
void resize(unsigned int w, unsigned int h);
|
|
|
|
|
|
|
|
GLVolumeCollection* get_volumes();
|
|
|
|
void set_volumes(GLVolumeCollection* volumes);
|
2018-05-18 12:08:59 +00:00
|
|
|
void reset_volumes();
|
2018-05-25 07:03:55 +00:00
|
|
|
void deselect_volumes();
|
|
|
|
void select_volume(unsigned int id);
|
2018-05-18 12:08:59 +00:00
|
|
|
|
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-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
|
|
|
const Pointf3& get_axes_origin() const;
|
|
|
|
void set_axes_origin(const Pointf3& origin);
|
|
|
|
|
|
|
|
float get_axes_length() const;
|
|
|
|
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-05-09 08:47:04 +00:00
|
|
|
Camera::EType get_camera_type() const;
|
|
|
|
void set_camera_type(Camera::EType type);
|
2018-05-14 09:31:58 +00:00
|
|
|
std::string get_camera_type_as_string() const;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
float get_camera_zoom() const;
|
|
|
|
void set_camera_zoom(float zoom);
|
|
|
|
|
|
|
|
float get_camera_phi() const;
|
|
|
|
void set_camera_phi(float phi);
|
|
|
|
|
|
|
|
float get_camera_theta() const;
|
|
|
|
void set_camera_theta(float theta);
|
|
|
|
|
|
|
|
float get_camera_distance() const;
|
|
|
|
void set_camera_distance(float distance);
|
|
|
|
|
|
|
|
const Pointf3& get_camera_target() const;
|
|
|
|
void set_camera_target(const Pointf3& target);
|
|
|
|
|
2018-05-14 12:14:19 +00:00
|
|
|
BoundingBoxf3 bed_bounding_box() const;
|
|
|
|
BoundingBoxf3 volumes_bounding_box() const;
|
|
|
|
BoundingBoxf3 max_bounding_box() const;
|
|
|
|
|
2018-05-18 12:08:59 +00:00
|
|
|
bool is_layers_editing_enabled() const;
|
2018-05-22 07:02:42 +00:00
|
|
|
bool is_picking_enabled() const;
|
2018-05-31 11:51:50 +00:00
|
|
|
bool is_moving_enabled() const;
|
2018-05-25 14:28:24 +00:00
|
|
|
bool is_layers_editing_allowed() const;
|
2018-05-23 13:35:11 +00:00
|
|
|
bool is_multisample_allowed() const;
|
2018-05-18 12:08:59 +00:00
|
|
|
|
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);
|
2018-05-22 07:02:42 +00:00
|
|
|
void enable_picking(bool enable);
|
2018-05-31 11:51:50 +00:00
|
|
|
void enable_moving(bool enable);
|
2018-05-23 07:57:44 +00:00
|
|
|
void enable_shader(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-23 11:56:54 +00:00
|
|
|
bool is_mouse_dragging() const;
|
|
|
|
void set_mouse_dragging(bool dragging);
|
|
|
|
|
|
|
|
const Pointf& get_mouse_position() const;
|
|
|
|
void set_mouse_position(const Pointf& position);
|
|
|
|
|
2018-05-23 13:35:11 +00:00
|
|
|
int get_hover_volume_id() const;
|
|
|
|
void set_hover_volume_id(int id);
|
|
|
|
|
2018-05-25 12:05:08 +00:00
|
|
|
unsigned int get_layers_editing_z_texture_id() const;
|
2018-05-25 13:56:14 +00:00
|
|
|
|
2018-05-30 13:18:45 +00:00
|
|
|
unsigned int get_layers_editing_state() const;
|
|
|
|
void set_layers_editing_state(unsigned int state);
|
|
|
|
|
2018-05-25 13:56:14 +00:00
|
|
|
float get_layers_editing_band_width() const;
|
|
|
|
void set_layers_editing_band_width(float band_width);
|
|
|
|
|
2018-05-28 11:43:29 +00:00
|
|
|
float get_layers_editing_strength() const;
|
|
|
|
void set_layers_editing_strength(float strength);
|
|
|
|
|
|
|
|
int get_layers_editing_last_object_id() const;
|
|
|
|
void set_layers_editing_last_object_id(int id);
|
|
|
|
|
|
|
|
float get_layers_editing_last_z() const;
|
|
|
|
void set_layers_editing_last_z(float z);
|
|
|
|
|
|
|
|
unsigned int get_layers_editing_last_action() const;
|
|
|
|
void set_layers_editing_last_action(unsigned int action);
|
|
|
|
|
2018-05-29 12:34:45 +00:00
|
|
|
const GLShader* get_layers_editing_shader() const;
|
2018-05-25 12:05:08 +00:00
|
|
|
|
2018-05-28 12:39:59 +00:00
|
|
|
float get_layers_editing_cursor_z_relative() const;
|
2018-05-28 12:10:02 +00:00
|
|
|
int get_layers_editing_first_selected_object_id(unsigned int objects_count) const;
|
2018-05-28 12:39:59 +00:00
|
|
|
bool bar_rect_contains(float x, float y) const;
|
|
|
|
bool reset_rect_contains(float x, float y) const;
|
2018-05-28 11:43:29 +00:00
|
|
|
|
2018-05-15 08:32:38 +00:00
|
|
|
void zoom_to_bed();
|
|
|
|
void zoom_to_volumes();
|
2018-05-15 09:30:11 +00:00
|
|
|
void select_view(const std::string& direction);
|
2018-05-29 13:36:09 +00:00
|
|
|
void set_viewport_from_scene(const GLCanvas3D& other);
|
2018-05-15 08:32:38 +00:00
|
|
|
|
2018-05-29 13:07:06 +00:00
|
|
|
void update_volumes_colors_by_extruder();
|
|
|
|
|
2018-05-23 07:57:44 +00:00
|
|
|
bool start_using_shader() const;
|
|
|
|
void stop_using_shader() const;
|
|
|
|
|
2018-05-29 11:54:34 +00:00
|
|
|
void render(bool useVBOs) const;
|
2018-05-21 13:57:03 +00:00
|
|
|
void render_volumes(bool fake_colors) const;
|
|
|
|
void render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const;
|
2018-05-15 13:38:25 +00:00
|
|
|
|
2018-05-15 07:50:01 +00:00
|
|
|
void register_on_viewport_changed_callback(void* callback);
|
2018-05-31 11:51:50 +00:00
|
|
|
void register_on_double_click_callback(void* callback);
|
|
|
|
void register_on_right_click_callback(void* callback);
|
|
|
|
void register_on_select_callback(void* callback);
|
2018-05-31 14:04:59 +00:00
|
|
|
void register_on_model_update_callback(void* callback);
|
|
|
|
void register_on_move_callback(void* callback);
|
2018-05-15 07:50:01 +00:00
|
|
|
|
2018-05-14 12:47:13 +00:00
|
|
|
void on_size(wxSizeEvent& evt);
|
|
|
|
void on_idle(wxIdleEvent& evt);
|
2018-05-15 14:09:04 +00:00
|
|
|
void on_char(wxKeyEvent& evt);
|
2018-05-28 13:23:01 +00:00
|
|
|
void on_mouse_wheel(wxMouseEvent& evt);
|
2018-05-30 13:18:45 +00:00
|
|
|
void on_timer(wxTimerEvent& evt);
|
2018-05-31 11:51:50 +00:00
|
|
|
void on_mouse(wxMouseEvent& evt);
|
2018-05-14 12:47:13 +00:00
|
|
|
|
2018-05-24 11:46:17 +00:00
|
|
|
Size get_canvas_size() const;
|
2018-05-25 13:56:14 +00:00
|
|
|
Point get_local_mouse_position() const;
|
2018-05-24 11:46:17 +00:00
|
|
|
|
2018-05-30 13:18:45 +00:00
|
|
|
void start_timer();
|
|
|
|
void stop_timer();
|
|
|
|
void perform_layer_editing_action(int y, bool shift_down, bool right_down);
|
|
|
|
|
2018-05-14 12:14:19 +00:00
|
|
|
private:
|
|
|
|
void _zoom_to_bounding_box(const BoundingBoxf3& bbox);
|
2018-05-15 07:50:01 +00:00
|
|
|
float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const;
|
|
|
|
|
|
|
|
void _deregister_callbacks();
|
2018-05-28 13:23:01 +00:00
|
|
|
|
2018-05-29 12:34:45 +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-29 11:54:34 +00:00
|
|
|
|
2018-05-31 06:44:39 +00:00
|
|
|
void _camera_tranform() const;
|
2018-05-29 11:54:34 +00:00
|
|
|
void _picking_pass() const;
|
|
|
|
void _render_background() const;
|
|
|
|
void _render_bed() const;
|
|
|
|
void _render_axes() const;
|
|
|
|
void _render_objects(bool useVBOs) const;
|
|
|
|
void _render_cutting_plane() const;
|
|
|
|
void _render_warning_texture() const;
|
|
|
|
void _render_legend_texture() const;
|
|
|
|
void _render_layer_editing_overlay() const;
|
2018-05-30 13:18:45 +00:00
|
|
|
|
|
|
|
void _perform_layer_editing_action(wxMouseEvent* evt = nullptr);
|
2018-05-31 11:51:50 +00:00
|
|
|
|
|
|
|
// 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-05-09 08:47:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
#endif // slic3r_GLCanvas3D_hpp_
|