Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/GUI/3DBed.hpp')
-rw-r--r--src/slic3r/GUI/3DBed.hpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp
index 3a5f95978..b5b063e6f 100644
--- a/src/slic3r/GUI/3DBed.hpp
+++ b/src/slic3r/GUI/3DBed.hpp
@@ -3,12 +3,10 @@
#include "GLTexture.hpp"
#include "3DScene.hpp"
-#include "GLShader.hpp"
+#include "GLModel.hpp"
#include <tuple>
-
-class GLUquadric;
-typedef class GLUquadric GLUquadricObj;
+#include <array>
namespace Slic3r {
namespace GUI {
@@ -45,22 +43,25 @@ public:
class Bed3D
{
- struct Axes
+ class 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;
+ public:
+ static const float DefaultStemRadius;
+ static const float DefaultStemLength;
+ static const float DefaultTipRadius;
+ static const float DefaultTipLength;
private:
- void render_axis(double length) const;
+ Vec3d m_origin{ Vec3d::Zero() };
+ float m_stem_length{ DefaultStemLength };
+ mutable GLModel m_arrow;
+
+ public:
+ const Vec3d& get_origin() const { return m_origin; }
+ void set_origin(const Vec3d& origin) { m_origin = origin; }
+ void set_stem_length(float length);
+ float get_total_length() const { return m_stem_length + DefaultTipLength; }
+ void render() const;
};
public:
@@ -82,10 +83,11 @@ private:
GeometryBuffer m_triangles;
GeometryBuffer m_gridlines;
mutable GLTexture m_texture;
- mutable GLBed m_model;
+ mutable GLModel m_model;
+ mutable Vec3d m_model_offset{ Vec3d::Zero() };
+ std::array<float, 4> m_model_color{ 0.235f, 0.235f, 0.235f, 1.0f };
// temporary texture shown until the main texture has still no levels compressed
mutable GLTexture m_temp_texture;
- mutable Shader m_shader;
mutable unsigned int m_vbo_id;
Axes m_axes;
@@ -101,13 +103,17 @@ public:
const Pointfs& get_shape() const { return m_shape; }
// Return true if the bed shape changed, so the calee will update the UI.
- bool set_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model);
+ bool set_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false);
+
+ const BoundingBoxf3& get_bounding_box(bool extended) const {
+ return extended ? m_extended_bounding_box : m_bounding_box;
+ }
- const BoundingBoxf3& get_bounding_box(bool extended) const { return extended ? m_extended_bounding_box : m_bounding_box; }
bool contains(const Point& point) const;
Point point_projection(const Point& point) const;
- void render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes) const;
+ void render(GLCanvas3D& canvas, bool bottom, float scale_factor,
+ bool show_axes, bool show_texture) const;
private:
void calc_bounding_boxes() const;
@@ -115,10 +121,10 @@ private:
void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox);
std::tuple<EType, std::string, std::string> detect_type(const Pointfs& shape) const;
void render_axes() const;
- void render_system(GLCanvas3D& canvas, bool bottom) const;
+ void render_system(GLCanvas3D& canvas, bool bottom, bool show_texture) const;
void render_texture(bool bottom, GLCanvas3D& canvas) const;
void render_model() const;
- void render_custom(GLCanvas3D& canvas, bool bottom) const;
+ void render_custom(GLCanvas3D& canvas, bool bottom, bool show_texture) const;
void render_default(bool bottom) const;
void reset();
};