Tech ENABLE_SINKING_CONTOURS -> 1st installment

This commit is contained in:
enricoturri1966 2021-07-21 15:30:57 +02:00
parent be9114c6c8
commit 22f04ca46e
7 changed files with 286 additions and 27 deletions

View file

@ -8,6 +8,10 @@
#include "libslic3r/Utils.hpp"
#include "libslic3r/Geometry.hpp"
#if ENABLE_SINKING_CONTOURS
#include "GLModel.hpp"
#endif // ENABLE_SINKING_CONTOURS
#include <functional>
#define HAS_GLSAFE
@ -250,6 +254,9 @@ public:
enum EHoverState : unsigned char
{
HS_None,
#if ENABLE_SINKING_CONTOURS
HS_Hover,
#endif // ENABLE_SINKING_CONTOURS
HS_Select,
HS_Deselect
};
@ -262,7 +269,7 @@ private:
Geometry::Transformation m_volume_transformation;
// Shift in z required by sla supports+pad
double m_sla_shift_z;
double m_sla_shift_z;
// Bounding box of this volume, in unscaled coordinates.
BoundingBoxf3 m_transformed_bounding_box;
// Whether or not is needed to recalculate the transformed bounding box.
@ -274,6 +281,24 @@ private:
// Whether or not is needed to recalculate the transformed convex hull bounding box.
bool m_transformed_convex_hull_bounding_box_dirty;
#if ENABLE_SINKING_CONTOURS
class SinkingContours
{
GLVolume& m_parent;
GUI::GLModel m_model;
BoundingBoxf3 m_old_box;
Vec3d m_shift{ Vec3d::Zero() };
public:
SinkingContours(GLVolume& volume) : m_parent(volume) {}
void update();
void set_color(const std::array<float, 4>& color);
void render() const;
};
SinkingContours m_sinking_contours;
#endif // ENABLE_SINKING_CONTOURS
public:
// Color of the triangles / quads held by this volume.
std::array<float, 4> color;
@ -462,6 +487,11 @@ public:
#if ENABLE_ALLOW_NEGATIVE_Z
bool is_sinking() const;
bool is_below_printbed() const;
#if ENABLE_SINKING_CONTOURS
void update_sinking_contours();
void update_sinking_contours_color();
void render_sinking_contours();
#endif // ENABLE_SINKING_CONTOURS
#endif // ENABLE_ALLOW_NEGATIVE_Z
// Return an estimate of the memory consumed by this class.