Tech ENABLE_PRINT_BED_MODELS set as default
This commit is contained in:
parent
644794233f
commit
e861f5a243
5 changed files with 0 additions and 91 deletions
|
@ -29,15 +29,6 @@
|
|||
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1)
|
||||
|
||||
|
||||
//====================
|
||||
// 1.42.0.alpha2 techs
|
||||
//====================
|
||||
#define ENABLE_1_42_0_ALPHA2 1
|
||||
|
||||
// Adds print bed models to 3D scene
|
||||
#define ENABLE_PRINT_BED_MODELS (1 && ENABLE_1_42_0_ALPHA2)
|
||||
|
||||
|
||||
//====================
|
||||
// 1.42.0.alpha4 techs
|
||||
//====================
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include "libslic3r/Slicing.hpp"
|
||||
#include "libslic3r/GCode/Analyzer.hpp"
|
||||
#include "slic3r/GUI/PresetBundle.hpp"
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
#include "libslic3r/Format/STL.hpp"
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -23,10 +21,8 @@
|
|||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/spin_mutex.h>
|
||||
|
@ -1671,27 +1667,19 @@ GUI::GLCanvas3DManager _3DScene::s_canvas_mgr;
|
|||
|
||||
GLModel::GLModel()
|
||||
: m_useVBOs(false)
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
, m_filename("")
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
{
|
||||
m_volume.shader_outside_printer_detection_enabled = false;
|
||||
}
|
||||
|
||||
GLModel::~GLModel()
|
||||
{
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
reset();
|
||||
#else
|
||||
m_volume.release_geometry();
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
}
|
||||
|
||||
void GLModel::set_color(const float* color, unsigned int size)
|
||||
{
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
::memcpy((void*)m_volume.color, (const void*)color, (size_t)(std::min((unsigned int)4, size) * sizeof(float)));
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
m_volume.set_render_color(color, size);
|
||||
}
|
||||
|
||||
|
@ -1725,13 +1713,11 @@ void GLModel::set_scale(const Vec3d& scale)
|
|||
m_volume.set_volume_scaling_factor(scale);
|
||||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
void GLModel::reset()
|
||||
{
|
||||
m_volume.release_geometry();
|
||||
m_filename = "";
|
||||
}
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
void GLModel::render() const
|
||||
{
|
||||
|
@ -1968,7 +1954,6 @@ bool GLCurvedArrow::on_init(bool useVBOs)
|
|||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
bool GLBed::on_init_from_file(const std::string& filename, bool useVBOs)
|
||||
{
|
||||
reset();
|
||||
|
@ -2011,7 +1996,6 @@ bool GLBed::on_init_from_file(const std::string& filename, bool useVBOs)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
std::string _3DScene::get_gl_info(bool format_as_html, bool extensions)
|
||||
{
|
||||
|
|
|
@ -498,20 +498,16 @@ class GLModel
|
|||
protected:
|
||||
GLVolume m_volume;
|
||||
bool m_useVBOs;
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
std::string m_filename;
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
public:
|
||||
GLModel();
|
||||
virtual ~GLModel();
|
||||
|
||||
bool init(bool useVBOs) { return on_init(useVBOs); }
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
bool init_from_file(const std::string& filename, bool useVBOs) { return on_init_from_file(filename, useVBOs); }
|
||||
|
||||
void center_around(const Vec3d& center) { m_volume.set_volume_offset(center - m_volume.bounding_box.center()); }
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
void set_color(const float* color, unsigned int size);
|
||||
|
||||
const Vec3d& get_offset() const;
|
||||
|
@ -521,22 +517,16 @@ public:
|
|||
const Vec3d& get_scale() const;
|
||||
void set_scale(const Vec3d& scale);
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
const std::string& get_filename() const { return m_filename; }
|
||||
const BoundingBoxf3& get_bounding_box() const { return m_volume.bounding_box; }
|
||||
|
||||
void reset();
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
void render() const;
|
||||
|
||||
protected:
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
virtual bool on_init(bool useVBOs) { return false; }
|
||||
virtual bool on_init_from_file(const std::string& filename, bool useVBOs) { return false; }
|
||||
#else
|
||||
virtual bool on_init(bool useVBOs) = 0;
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
private:
|
||||
void render_VBOs() const;
|
||||
|
@ -560,13 +550,11 @@ protected:
|
|||
virtual bool on_init(bool useVBOs);
|
||||
};
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
class GLBed : public GLModel
|
||||
{
|
||||
protected:
|
||||
virtual bool on_init_from_file(const std::string& filename, bool useVBOs);
|
||||
};
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
class _3DScene
|
||||
{
|
||||
|
|
|
@ -412,7 +412,6 @@ Point GLCanvas3D::Bed::point_projection(const Point& point) const
|
|||
return m_polygon.point_projection(point);
|
||||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
void GLCanvas3D::Bed::render(float theta, bool useVBOs, float scale_factor) const
|
||||
{
|
||||
m_scale_factor = scale_factor;
|
||||
|
@ -442,37 +441,6 @@ void GLCanvas3D::Bed::render(float theta, bool useVBOs, float scale_factor) cons
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void GLCanvas3D::Bed::render(float theta, float scale_factor) const
|
||||
{
|
||||
m_scale_factor = scale_factor;
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
case MK2:
|
||||
{
|
||||
_render_prusa("mk2", theta);
|
||||
break;
|
||||
}
|
||||
case MK3:
|
||||
{
|
||||
_render_prusa("mk3", theta);
|
||||
break;
|
||||
}
|
||||
case SL1:
|
||||
{
|
||||
_render_prusa("sl1", theta);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case Custom:
|
||||
{
|
||||
_render_custom();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
void GLCanvas3D::Bed::_calc_bounding_box()
|
||||
{
|
||||
|
@ -588,11 +556,7 @@ GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const
|
|||
return type;
|
||||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta, bool useVBOs) const
|
||||
#else
|
||||
void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
{
|
||||
std::string tex_path = resources_dir() + "/icons/bed/" + key;
|
||||
|
||||
|
@ -608,9 +572,7 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const
|
|||
else if (max_tex_size >= 4096)
|
||||
tex_path += "_4096";
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
std::string model_path = resources_dir() + "/models/" + key;
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
#if ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES
|
||||
// use anisotropic filter if graphic card allows
|
||||
|
@ -655,7 +617,6 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const
|
|||
#endif // ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES
|
||||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
if (theta <= 90.0f)
|
||||
{
|
||||
filename = model_path + "_bed.stl";
|
||||
|
@ -681,7 +642,6 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const
|
|||
::glDisable(GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
unsigned int triangles_vcount = m_triangles.get_vertices_count();
|
||||
if (triangles_vcount > 0)
|
||||
|
@ -6533,11 +6493,7 @@ void GLCanvas3D::_render_bed(float theta) const
|
|||
scale_factor = m_retina_helper->get_scale_factor();
|
||||
#endif
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
m_bed.render(theta, m_use_VBOs, scale_factor);
|
||||
#else
|
||||
m_bed.render(theta, scale_factor);
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_axes() const
|
||||
|
|
|
@ -217,9 +217,7 @@ class GLCanvas3D
|
|||
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;
|
||||
|
||||
|
@ -241,11 +239,7 @@ class GLCanvas3D
|
|||
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();
|
||||
|
@ -256,11 +250,7 @@ class GLCanvas3D
|
|||
#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);
|
||||
|
|
Loading…
Reference in a new issue