1) Added new tech ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE

2) Imgui dialog replaces texture for reset button and tooltip when layer editing is active
This commit is contained in:
Enrico Turri 2019-11-07 15:55:45 +01:00
parent 1e8aa54559
commit 6e4060569a
5 changed files with 132 additions and 12 deletions

View file

@ -104,6 +104,9 @@ wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
wxDECLARE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
class GLCanvas3D
{
@ -153,13 +156,17 @@ private:
private:
static const float THICKNESS_BAR_WIDTH;
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static const float THICKNESS_RESET_BUTTON_HEIGHT;
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
bool m_enabled;
Shader m_shader;
unsigned int m_z_texture_id;
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
mutable GLTexture m_tooltip_texture;
mutable GLTexture m_reset_texture;
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
// Not owned by LayersEditing.
const DynamicPrintConfig *m_config;
// ModelObject for the currently selected object (Model::objects[last_object_id]).
@ -220,25 +227,35 @@ private:
static float get_cursor_z_relative(const GLCanvas3D& canvas);
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static bool reset_rect_contains(const GLCanvas3D& canvas, float x, float y);
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static Rect get_bar_rect_screen(const GLCanvas3D& canvas);
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static Rect get_reset_rect_screen(const GLCanvas3D& canvas);
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static Rect get_bar_rect_viewport(const GLCanvas3D& canvas);
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static Rect get_reset_rect_viewport(const GLCanvas3D& canvas);
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
float object_max_z() const { return m_object_max_z; }
private:
bool _is_initialized() const;
bool is_initialized() const;
void generate_layer_height_texture();
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
void _render_reset_texture(const Rect& reset_rect) const;
void _render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
void _render_profile(const Rect& bar_rect) const;
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
void render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
void render_profile(const Rect& bar_rect) const;
void update_slicing_parameters();
static float thickness_bar_width(const GLCanvas3D &canvas);
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
static float reset_button_height(const GLCanvas3D &canvas);
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
};
struct Mouse
@ -500,6 +517,10 @@ public:
bool is_layers_editing_enabled() const;
bool is_layers_editing_allowed() const;
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
void reset_layer_height_profile();
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
bool is_reload_delayed() const;
void enable_layers_editing(bool enable);