Fixed conflicts after merge with master

This commit is contained in:
Enrico Turri 2019-02-22 10:18:15 +01:00
commit a36896e4c9
38 changed files with 6382 additions and 1018 deletions

View file

@ -8,6 +8,7 @@
#include "3DScene.hpp"
#include "GLToolbar.hpp"
#include "Event.hpp"
#include "3DBed.hpp"
#include <float.h>
@ -25,9 +26,6 @@ class wxGLCanvas;
// Support for Retina OpenGL on Mac OS
#define ENABLE_RETINA_GL __APPLE__
class GLUquadric;
typedef class GLUquadric GLUquadricObj;
namespace Slic3r {
class GLShader;
@ -45,21 +43,6 @@ class GLGizmoBase;
class RetinaHelper;
#endif
class GeometryBuffer
{
std::vector<float> m_vertices;
std::vector<float> m_tex_coords;
public:
bool set_from_triangles(const Polygons& triangles, float z, bool generate_tex_coords);
bool set_from_lines(const Lines& lines, float z);
const float* get_vertices() const;
const float* get_tex_coords() const;
unsigned int get_vertices_count() const;
};
class Size
{
int m_width;
@ -131,6 +114,8 @@ wxDECLARE_EVENT(EVT_GLCANVAS_INSTANCE_SCALED, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_BED_SHAPE, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_TAB, SimpleEvent);
// this describes events being passed from GLCanvas3D to SlaSupport gizmo
enum class SLAGizmoEventType {
@ -208,95 +193,7 @@ class GLCanvas3D
void set_scene_box(const BoundingBoxf3& box, GLCanvas3D& canvas);
};
class Bed
{
public:
enum EType : unsigned char
{
MK2,
MK3,
SL1,
Custom,
Num_Types
};
private:
EType m_type;
Pointfs m_shape;
BoundingBoxf3 m_bounding_box;
Polygon m_polygon;
GeometryBuffer m_triangles;
GeometryBuffer m_gridlines;
mutable GLTexture m_top_texture;
mutable GLTexture m_bottom_texture;
#if ENABLE_PRINT_BED_MODELS
mutable GLBed m_model;
#endif // ENABLE_PRINT_BED_MODELS
mutable float m_scale_factor;
public:
Bed();
#if ENABLE_REWORKED_BED_SHAPE_CHANGE
EType get_type() const { return m_type; }
#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
bool is_prusa() const;
bool is_custom() const;
const Pointfs& get_shape() const;
// Return true if the bed shape changed, so the calee will update the UI.
bool set_shape(const Pointfs& shape);
const BoundingBoxf3& get_bounding_box() const;
bool contains(const Point& point) const;
Point point_projection(const Point& point) const;
#if ENABLE_PRINT_BED_MODELS
void render(float theta, bool useVBOs, float scale_factor) const;
#else
void render(float theta, float scale_factor) const;
#endif // ENABLE_PRINT_BED_MODELS
private:
void _calc_bounding_box();
void _calc_triangles(const ExPolygon& poly);
void _calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox);
#if ENABLE_REWORKED_BED_SHAPE_CHANGE
EType _detect_type(const Pointfs& shape) const;
#else
EType _detect_type() const;
#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
#if ENABLE_PRINT_BED_MODELS
void _render_prusa(const std::string &key, float theta, bool useVBOs) const;
#else
void _render_prusa(const std::string &key, float theta) const;
#endif // ENABLE_PRINT_BED_MODELS
void _render_custom() const;
#if !ENABLE_REWORKED_BED_SHAPE_CHANGE
static bool _are_equal(const Pointfs& bed_1, const Pointfs& bed_2);
#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
};
struct Axes
{
static const double Radius;
static const double ArrowBaseRadius;
static const double ArrowLength;
Vec3d origin;
Vec3d length;
GLUquadricObj* m_quadric;
Axes();
~Axes();
void render() const;
private:
void render_axis(double length) const;
};
#if !ENABLE_TEXTURES_FROM_SVG
class Shader
{
GLShader* m_shader;
@ -320,6 +217,7 @@ class GLCanvas3D
private:
void _reset();
};
#endif // !ENABLE_TEXTURES_FROM_SVG
class LayersEditing
{
@ -911,8 +809,7 @@ private:
WarningTexture m_warning_texture;
wxTimer m_timer;
Camera m_camera;
Bed m_bed;
Axes m_axes;
Bed3D* m_bed;
LayersEditing m_layers_editing;
Shader m_shader;
Mouse m_mouse;
@ -934,11 +831,7 @@ private:
bool m_dirty;
bool m_initialized;
bool m_use_VBOs;
#if ENABLE_REWORKED_BED_SHAPE_CHANGE
bool m_requires_zoom_to_bed;
#else
bool m_force_zoom_to_bed_enabled;
#endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
bool m_apply_zoom_to_volumes_filter;
mutable int m_hover_volume_id;
bool m_toolbar_action_running;
@ -950,6 +843,7 @@ private:
bool m_multisample_allowed;
bool m_regenerate_volumes;
bool m_moving;
bool m_tab_down;
bool m_render_sla_auxiliaries;
std::string m_color_by;
@ -971,6 +865,8 @@ public:
wxGLCanvas* get_wxglcanvas() { return m_canvas; }
const wxGLCanvas* get_wxglcanvas() const { return m_canvas; }
void set_bed(Bed3D* bed) { m_bed = bed; }
void set_view_toolbar(GLToolbar* toolbar) { m_view_toolbar = toolbar; }
bool init(bool useVBOs, bool use_legacy_opengl);
@ -992,12 +888,7 @@ public:
const Selection& get_selection() const { return m_selection; }
Selection& get_selection() { return m_selection; }
// 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.
void set_bed_shape(const Pointfs& shape);
void set_bed_axes_length(double length);
void bed_shape_changed();
void set_clipping_plane(unsigned int id, const ClippingPlane& plane)
{
@ -1027,9 +918,6 @@ public:
void enable_moving(bool enable);
void enable_gizmos(bool enable);
void enable_toolbar(bool enable);
#if !ENABLE_REWORKED_BED_SHAPE_CHANGE
void enable_force_zoom_to_bed(bool enable);
#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
void enable_dynamic_background(bool enable);
void allow_multisample(bool allow);
@ -1115,9 +1003,6 @@ public:
private:
bool _is_shown_on_screen() const;
#if !ENABLE_REWORKED_BED_SHAPE_CHANGE
void _force_zoom_to_bed();
#endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
bool _init_toolbar();