mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-11 15:29:02 +08:00
ENH:The model also uses parameter passing to avoid using global variables
jira: none Change-Id: I04675dd81509b92160598b3a4359895b13752fa8 (cherry picked from commit eef83dafce93130ecfd078a7ff0a689ec51c66bc)
This commit is contained in:
parent
682e70ca94
commit
3e0d806040
@ -355,7 +355,7 @@ void GLIndexedVertexArray::render(
|
|||||||
|
|
||||||
const float GLVolume::SinkingContours::HalfWidth = 0.25f;
|
const float GLVolume::SinkingContours::HalfWidth = 0.25f;
|
||||||
|
|
||||||
void GLVolume::SinkingContours::render(const GUI::Camera &camera)
|
void GLVolume::SinkingContours::render(const GUI::Camera &camera, Model &model)
|
||||||
{
|
{
|
||||||
const auto& shader = GUI::wxGetApp().get_shader("flat");
|
const auto& shader = GUI::wxGetApp().get_shader("flat");
|
||||||
if (!shader) {
|
if (!shader) {
|
||||||
@ -364,7 +364,7 @@ void GLVolume::SinkingContours::render(const GUI::Camera &camera)
|
|||||||
|
|
||||||
GUI::wxGetApp().bind_shader(shader);
|
GUI::wxGetApp().bind_shader(shader);
|
||||||
|
|
||||||
update();
|
update(model);
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::assemble_transform(m_shift));
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::assemble_transform(m_shift));
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
m_model.render_geometry();
|
m_model.render_geometry();
|
||||||
@ -372,11 +372,9 @@ void GLVolume::SinkingContours::render(const GUI::Camera &camera)
|
|||||||
GUI::wxGetApp().unbind_shader();
|
GUI::wxGetApp().unbind_shader();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVolume::SinkingContours::update()
|
void GLVolume::SinkingContours::update(Model &model)
|
||||||
{
|
{
|
||||||
int object_idx = m_parent.object_idx();
|
int object_idx = m_parent.object_idx();
|
||||||
Model& model = GUI::wxGetApp().plater()->model();
|
|
||||||
|
|
||||||
if (0 <= object_idx && object_idx < (int)model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) {
|
if (0 <= object_idx && object_idx < (int)model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) {
|
||||||
const BoundingBoxf3& box = m_parent.transformed_convex_hull_bounding_box();
|
const BoundingBoxf3& box = m_parent.transformed_convex_hull_bounding_box();
|
||||||
if (!m_old_box.size().isApprox(box.size()) || m_old_box.min.z() != box.min.z()) {
|
if (!m_old_box.size().isApprox(box.size()) || m_old_box.min.z() != box.min.z()) {
|
||||||
@ -784,17 +782,20 @@ BoundingBoxf3 GLVolume::transformed_convex_hull_bounding_box(const Transform3d &
|
|||||||
bounding_box().transformed(trafo);
|
bounding_box().transformed(trafo);
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxf3 GLVolume::transformed_non_sinking_bounding_box(const Transform3d& trafo) const
|
BoundingBoxf3 GLVolume::transformed_non_sinking_bounding_box(const Transform3d& trafo,Model& model) const
|
||||||
{
|
{
|
||||||
return GUI::wxGetApp().plater()->model().objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0);
|
if (object_idx() < model.objects.size())
|
||||||
|
return model.objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0);
|
||||||
|
else
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const BoundingBoxf3& GLVolume::transformed_non_sinking_bounding_box() const
|
const BoundingBoxf3 &GLVolume::transformed_non_sinking_bounding_box(Model &model) const
|
||||||
{
|
{
|
||||||
if (!m_transformed_non_sinking_bounding_box.has_value()) {
|
if (!m_transformed_non_sinking_bounding_box.has_value()) {
|
||||||
std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_non_sinking_bounding_box);
|
std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_non_sinking_bounding_box);
|
||||||
const Transform3d& trafo = world_matrix();
|
const Transform3d& trafo = world_matrix();
|
||||||
*trans_box = transformed_non_sinking_bounding_box(trafo);
|
*trans_box = transformed_non_sinking_bounding_box(trafo, model);
|
||||||
}
|
}
|
||||||
return *m_transformed_non_sinking_bounding_box;
|
return *m_transformed_non_sinking_bounding_box;
|
||||||
}
|
}
|
||||||
@ -836,7 +837,7 @@ void GLVolume::set_range(double min_z, double max_z)
|
|||||||
|
|
||||||
//BBS: add outline related logic
|
//BBS: add outline related logic
|
||||||
//static unsigned char stencil_data[1284][2944];
|
//static unsigned char stencil_data[1284][2944];
|
||||||
void GLVolume::render(const GUI::Camera &camera, const std::vector<std::array<float, 4>> &colors, bool with_outline, const std::array<float, 4> &body_color) const
|
void GLVolume::render(const GUI::Camera &camera, const std::vector<std::array<float, 4>> &colors, Model &model, bool with_outline, const std::array<float, 4> &body_color) const
|
||||||
{
|
{
|
||||||
if (!is_active)
|
if (!is_active)
|
||||||
return;
|
return;
|
||||||
@ -851,7 +852,7 @@ void GLVolume::render(const GUI::Camera &camera, const std::vector<std::array<fl
|
|||||||
// BBS: add logic for mmu segmentation rendering
|
// BBS: add logic for mmu segmentation rendering
|
||||||
auto render_body = [&]() {
|
auto render_body = [&]() {
|
||||||
bool color_volume = false;
|
bool color_volume = false;
|
||||||
ModelObjectPtrs& model_objects = GUI::wxGetApp().model().objects;
|
ModelObjectPtrs &model_objects = model.objects;
|
||||||
do {
|
do {
|
||||||
if ((!printable) || object_idx() >= model_objects.size())
|
if ((!printable) || object_idx() >= model_objects.size())
|
||||||
break;
|
break;
|
||||||
@ -1214,8 +1215,8 @@ bool GLVolume::is_below_printbed() const
|
|||||||
return transformed_convex_hull_bounding_box().max.z() < 0.0;
|
return transformed_convex_hull_bounding_box().max.z() < 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVolume::render_sinking_contours(const GUI::Camera &camera) {
|
void GLVolume::render_sinking_contours(const GUI::Camera &camera, Model &model) {
|
||||||
m_sinking_contours.render(camera);
|
m_sinking_contours.render(camera, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLWipeTowerVolume::GLWipeTowerVolume(const std::vector<std::array<float, 4>>& colors)
|
GLWipeTowerVolume::GLWipeTowerVolume(const std::vector<std::array<float, 4>>& colors)
|
||||||
@ -1226,6 +1227,7 @@ GLWipeTowerVolume::GLWipeTowerVolume(const std::vector<std::array<float, 4>>& co
|
|||||||
|
|
||||||
void GLWipeTowerVolume::render(const GUI::Camera &camera,
|
void GLWipeTowerVolume::render(const GUI::Camera &camera,
|
||||||
const std::vector<std::array<float, 4>> &extruder_colors,
|
const std::vector<std::array<float, 4>> &extruder_colors,
|
||||||
|
Model &model,
|
||||||
bool with_outline,
|
bool with_outline,
|
||||||
const std::array<float, 4> &body_color) const
|
const std::array<float, 4> &body_color) const
|
||||||
{
|
{
|
||||||
@ -1619,6 +1621,7 @@ void GLVolumeCollection::render(GUI::ERenderPipelineStage render_pip
|
|||||||
bool disable_cullface,
|
bool disable_cullface,
|
||||||
const GUI::Camera & camera,
|
const GUI::Camera & camera,
|
||||||
const std::vector<std::array<float, 4>>& colors,
|
const std::vector<std::array<float, 4>>& colors,
|
||||||
|
Model& model,
|
||||||
std::function<bool(const GLVolume &)> filter_func,
|
std::function<bool(const GLVolume &)> filter_func,
|
||||||
bool with_outline,
|
bool with_outline,
|
||||||
const std::array<float, 4> & body_color,
|
const std::array<float, 4> & body_color,
|
||||||
@ -1673,7 +1676,7 @@ void GLVolumeCollection::render(GUI::ERenderPipelineStage render_pip
|
|||||||
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
||||||
volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) {
|
volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) {
|
||||||
GUI::wxGetApp().unbind_shader();
|
GUI::wxGetApp().unbind_shader();
|
||||||
volume.first->render_sinking_contours(camera);
|
volume.first->render_sinking_contours(camera, model);
|
||||||
GUI::wxGetApp().bind_shader(shader);
|
GUI::wxGetApp().bind_shader(shader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1744,12 +1747,12 @@ void GLVolumeCollection::render(GUI::ERenderPipelineStage render_pip
|
|||||||
|
|
||||||
//BBS: add outline related logic
|
//BBS: add outline related logic
|
||||||
auto red_color = std::array<float, 4>({ 1.0f, 0.0f, 0.0f, 1.0f });//slice_error
|
auto red_color = std::array<float, 4>({ 1.0f, 0.0f, 0.0f, 1.0f });//slice_error
|
||||||
volume.first->render(camera, colors,with_outline && volume.first->selected, volume.first->slice_error ? red_color : body_color);
|
volume.first->render(camera, colors,model,with_outline && volume.first->selected, volume.first->slice_error ? red_color : body_color);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (volume.first->selected) {
|
if (volume.first->selected) {
|
||||||
shader->set_uniform("u_model_matrix", volume.first->world_matrix());
|
shader->set_uniform("u_model_matrix", volume.first->world_matrix());
|
||||||
volume.first->render(camera, colors, false, body_color);
|
volume.first->render(camera, colors, model, false, body_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1770,7 +1773,7 @@ void GLVolumeCollection::render(GUI::ERenderPipelineStage render_pip
|
|||||||
(volume.first->hover != GLVolume::HS_None || volume.first->force_sinking_contours)) {
|
(volume.first->hover != GLVolume::HS_None || volume.first->force_sinking_contours)) {
|
||||||
GUI::wxGetApp().unbind_shader();
|
GUI::wxGetApp().unbind_shader();
|
||||||
glsafe(::glDepthFunc(GL_ALWAYS));
|
glsafe(::glDepthFunc(GL_ALWAYS));
|
||||||
volume.first->render_sinking_contours(camera);
|
volume.first->render_sinking_contours(camera, model);
|
||||||
glsafe(::glDepthFunc(GL_LESS));
|
glsafe(::glDepthFunc(GL_LESS));
|
||||||
GUI::wxGetApp().bind_shader(shader);
|
GUI::wxGetApp().bind_shader(shader);
|
||||||
}
|
}
|
||||||
@ -1785,7 +1788,7 @@ void GLVolumeCollection::render(GUI::ERenderPipelineStage render_pip
|
|||||||
glsafe(::glDisable(GL_BLEND));
|
glsafe(::glDisable(GL_BLEND));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state, ObjectFilamentResults* object_results) const
|
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state, ObjectFilamentResults *object_results, Model &model) const
|
||||||
{
|
{
|
||||||
if (GUI::wxGetApp().plater() == NULL)
|
if (GUI::wxGetApp().plater() == NULL)
|
||||||
{
|
{
|
||||||
@ -1794,15 +1797,15 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Model& model = GUI::wxGetApp().plater()->model();
|
|
||||||
auto volume_below = [](GLVolume& volume) -> bool
|
auto volume_below = [](GLVolume& volume) -> bool
|
||||||
{ return volume.object_idx() != -1 && volume.volume_idx() != -1 && volume.is_below_printbed(); };
|
{ return volume.object_idx() != -1 && volume.volume_idx() != -1 && volume.is_below_printbed(); };
|
||||||
// Volume is partially below the print bed, thus a pre-calculated convex hull cannot be used.
|
// Volume is partially below the print bed, thus a pre-calculated convex hull cannot be used.
|
||||||
auto volume_sinking = [](GLVolume& volume) -> bool
|
auto volume_sinking = [](GLVolume& volume) -> bool
|
||||||
{ return volume.object_idx() != -1 && volume.volume_idx() != -1 && volume.is_sinking(); };
|
{ return volume.object_idx() != -1 && volume.volume_idx() != -1 && volume.is_sinking(); };
|
||||||
// Cached bounding box of a volume above the print bed.
|
// Cached bounding box of a volume above the print bed.
|
||||||
auto volume_bbox = [volume_sinking](GLVolume& volume) -> BoundingBoxf3
|
auto volume_bbox = [volume_sinking ,&model](GLVolume& volume) -> BoundingBoxf3 {
|
||||||
{ return volume_sinking(volume) ? volume.transformed_non_sinking_bounding_box() : volume.transformed_convex_hull_bounding_box(); };
|
return volume_sinking(volume) ? volume.transformed_non_sinking_bounding_box(model) : volume.transformed_convex_hull_bounding_box();
|
||||||
|
};
|
||||||
// Cached 3D convex hull of a volume above the print bed.
|
// Cached 3D convex hull of a volume above the print bed.
|
||||||
auto volume_convex_mesh = [volume_sinking, &model](GLVolume& volume) -> const TriangleMesh&
|
auto volume_convex_mesh = [volume_sinking, &model](GLVolume& volume) -> const TriangleMesh&
|
||||||
{ return volume_sinking(volume) ? model.objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh() : *volume.convex_hull(); };
|
{ return volume_sinking(volume) ? model.objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh() : *volume.convex_hull(); };
|
||||||
|
@ -354,10 +354,10 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SinkingContours(GLVolume& volume) : m_parent(volume) {}
|
SinkingContours(GLVolume& volume) : m_parent(volume) {}
|
||||||
void render(const GUI::Camera &camera);
|
void render(const GUI::Camera &camera, Model &model);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update();
|
void update(Model &model);
|
||||||
};
|
};
|
||||||
|
|
||||||
SinkingContours m_sinking_contours;
|
SinkingContours m_sinking_contours;
|
||||||
@ -576,9 +576,9 @@ public:
|
|||||||
// caching variant
|
// caching variant
|
||||||
const BoundingBoxf3& transformed_convex_hull_bounding_box() const;
|
const BoundingBoxf3& transformed_convex_hull_bounding_box() const;
|
||||||
// non-caching variant
|
// non-caching variant
|
||||||
BoundingBoxf3 transformed_non_sinking_bounding_box(const Transform3d& trafo) const;
|
BoundingBoxf3 transformed_non_sinking_bounding_box(const Transform3d &trafo, Model &model) const;
|
||||||
// caching variant
|
// caching variant
|
||||||
const BoundingBoxf3& transformed_non_sinking_bounding_box() const;
|
const BoundingBoxf3 &transformed_non_sinking_bounding_box(Model &model) const;
|
||||||
// convex hull
|
// convex hull
|
||||||
const TriangleMesh* convex_hull() const { return m_convex_hull.get(); }
|
const TriangleMesh* convex_hull() const { return m_convex_hull.get(); }
|
||||||
|
|
||||||
@ -589,6 +589,7 @@ public:
|
|||||||
//BBS: add outline related logic and add virtual specifier
|
//BBS: add outline related logic and add virtual specifier
|
||||||
virtual void render(const GUI::Camera & camera,
|
virtual void render(const GUI::Camera & camera,
|
||||||
const std::vector<std::array<float, 4>>& colors,
|
const std::vector<std::array<float, 4>>& colors,
|
||||||
|
Model & model,
|
||||||
bool with_outline = false,
|
bool with_outline = false,
|
||||||
const std::array<float, 4> &body_color = {1.0f, 1.0f, 1.0f, 1.0f} ) const;
|
const std::array<float, 4> &body_color = {1.0f, 1.0f, 1.0f, 1.0f} ) const;
|
||||||
|
|
||||||
@ -605,7 +606,7 @@ public:
|
|||||||
|
|
||||||
bool is_sinking() const;
|
bool is_sinking() const;
|
||||||
bool is_below_printbed() const;
|
bool is_below_printbed() const;
|
||||||
void render_sinking_contours(const GUI::Camera &camera);
|
void render_sinking_contours(const GUI::Camera &camera,Model& model);
|
||||||
|
|
||||||
// Return an estimate of the memory consumed by this class.
|
// Return an estimate of the memory consumed by this class.
|
||||||
size_t cpu_memory_used() const {
|
size_t cpu_memory_used() const {
|
||||||
@ -623,6 +624,7 @@ public:
|
|||||||
GLWipeTowerVolume(const std::vector<std::array<float, 4>>& colors);
|
GLWipeTowerVolume(const std::vector<std::array<float, 4>>& colors);
|
||||||
void render(const GUI::Camera & camera,
|
void render(const GUI::Camera & camera,
|
||||||
const std::vector<std::array<float, 4>> & colors,
|
const std::vector<std::array<float, 4>> & colors,
|
||||||
|
Model & model,
|
||||||
bool with_outline = false,
|
bool with_outline = false,
|
||||||
const std::array<float, 4> & body_color = {1.0f, 1.0f, 1.0f, 1.0f}) const override;
|
const std::array<float, 4> & body_color = {1.0f, 1.0f, 1.0f, 1.0f}) const override;
|
||||||
|
|
||||||
@ -739,6 +741,7 @@ public:
|
|||||||
bool disable_cullface,
|
bool disable_cullface,
|
||||||
const GUI::Camera & camera,
|
const GUI::Camera & camera,
|
||||||
const std::vector<std::array<float, 4>>& colors,
|
const std::vector<std::array<float, 4>>& colors,
|
||||||
|
Model & model,
|
||||||
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>(),
|
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>(),
|
||||||
bool with_outline = true,
|
bool with_outline = true,
|
||||||
const std::array<float, 4> & body_color = {1.0f, 1.0f, 1.0f, 1.0f},
|
const std::array<float, 4> & body_color = {1.0f, 1.0f, 1.0f, 1.0f},
|
||||||
@ -783,7 +786,7 @@ public:
|
|||||||
|
|
||||||
// returns true if all the volumes are completely contained in the print volume
|
// returns true if all the volumes are completely contained in the print volume
|
||||||
// returns the containment state in the given out_state, if non-null
|
// returns the containment state in the given out_state, if non-null
|
||||||
bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state, ObjectFilamentResults* object_results) const;
|
bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state, ObjectFilamentResults* object_results,Model& model) const;
|
||||||
void reset_outside_state();
|
void reset_outside_state();
|
||||||
|
|
||||||
void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true);
|
void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true);
|
||||||
|
@ -4263,7 +4263,7 @@ void GCodeViewer::render_shells()
|
|||||||
//BBS: reopen cul faces
|
//BBS: reopen cul faces
|
||||||
auto& camera = wxGetApp().plater()->get_camera();
|
auto& camera = wxGetApp().plater()->get_camera();
|
||||||
std::vector<std::array<float, 4>> colors = wxGetApp().plater()->get_extruders_colors();
|
std::vector<std::array<float, 4>> colors = wxGetApp().plater()->get_extruders_colors();
|
||||||
m_shells.volumes.render(GUI::ERenderPipelineStage::Normal, GLVolumeCollection::ERenderType::Transparent, false, camera, colors);
|
m_shells.volumes.render(GUI::ERenderPipelineStage::Normal, GLVolumeCollection::ERenderType::Transparent, false, camera, colors, wxGetApp().plater()->model());
|
||||||
wxGetApp().unbind_shader();
|
wxGetApp().unbind_shader();
|
||||||
|
|
||||||
glsafe(::glDepthMask(GL_TRUE));
|
glsafe(::glDepthMask(GL_TRUE));
|
||||||
|
@ -693,7 +693,7 @@ void GLCanvas3D::LayersEditing::render_volumes(const GLCanvas3D & canvas, const
|
|||||||
shader->set_uniform("view_model_matrix", view_model_matrix);
|
shader->set_uniform("view_model_matrix", view_model_matrix);
|
||||||
shader->set_uniform("normal_matrix", (Matrix3d)view_model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
|
shader->set_uniform("normal_matrix", (Matrix3d)view_model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
|
||||||
|
|
||||||
glvolume->render(camera, colors);
|
glvolume->render(camera, colors, m_canvas.get_ref_model());
|
||||||
}
|
}
|
||||||
// Revert back to the previous shader.
|
// Revert back to the previous shader.
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
@ -1679,7 +1679,7 @@ ModelInstanceEPrintVolumeState GLCanvas3D::check_volumes_outside_state(ObjectFil
|
|||||||
//assert(m_initialized);
|
//assert(m_initialized);
|
||||||
|
|
||||||
ModelInstanceEPrintVolumeState state;
|
ModelInstanceEPrintVolumeState state;
|
||||||
m_volumes.check_outside_state(m_bed.build_volume(), &state, object_results);
|
m_volumes.check_outside_state(m_bed.build_volume(), &state, object_results,*m_model);
|
||||||
|
|
||||||
construct_error_string(*object_results, get_object_clashed_text());
|
construct_error_string(*object_results, get_object_clashed_text());
|
||||||
construct_extruder_unprintable_error(*object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text());
|
construct_extruder_unprintable_error(*object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text());
|
||||||
@ -3211,7 +3211,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
if (!m_volumes.empty()) {
|
if (!m_volumes.empty()) {
|
||||||
ModelInstanceEPrintVolumeState state;
|
ModelInstanceEPrintVolumeState state;
|
||||||
ObjectFilamentResults object_results;
|
ObjectFilamentResults object_results;
|
||||||
const bool contained_min_one = m_volumes.check_outside_state(m_bed.build_volume(), &state, &object_results);
|
const bool contained_min_one = m_volumes.check_outside_state(m_bed.build_volume(), &state, &object_results, *m_model);
|
||||||
const bool partlyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Partly_Outside);
|
const bool partlyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Partly_Outside);
|
||||||
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
|
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
|
||||||
// const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited);
|
// const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited);
|
||||||
@ -7346,7 +7346,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_requires_check_outside_state) {
|
if (m_requires_check_outside_state) {
|
||||||
m_volumes.check_outside_state(build_volume, nullptr, nullptr);
|
m_volumes.check_outside_state(build_volume, nullptr, nullptr, *m_model);
|
||||||
m_requires_check_outside_state = false;
|
m_requires_check_outside_state = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7397,7 +7397,8 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
|||||||
{
|
{
|
||||||
if (m_picking_enabled && m_layers_editing.is_enabled() && (m_layers_editing.last_object_id != -1) && (m_layers_editing.object_max_z() > 0.0f) && GUI::ERenderPipelineStage::Silhouette != render_pipeline_stage) {
|
if (m_picking_enabled && m_layers_editing.is_enabled() && (m_layers_editing.last_object_id != -1) && (m_layers_editing.object_max_z() > 0.0f) && GUI::ERenderPipelineStage::Silhouette != render_pipeline_stage) {
|
||||||
int object_id = m_layers_editing.last_object_id;
|
int object_id = m_layers_editing.last_object_id;
|
||||||
m_volumes.render(render_pipeline_stage, type, false, camera, colors, [object_id](const GLVolume &volume) {
|
m_volumes.render(
|
||||||
|
render_pipeline_stage, type, false, camera, colors, *m_model,[object_id](const GLVolume &volume) {
|
||||||
// Which volume to paint without the layer height profile shader?
|
// Which volume to paint without the layer height profile shader?
|
||||||
return volume.is_active && (volume.is_modifier || volume.composite_id.object_id != object_id);
|
return volume.is_active && (volume.is_modifier || volume.composite_id.object_id != object_id);
|
||||||
});
|
});
|
||||||
@ -7413,8 +7414,8 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
|||||||
//BBS:add assemble view related logic
|
//BBS:add assemble view related logic
|
||||||
// do not cull backfaces to show broken geometry, if any
|
// do not cull backfaces to show broken geometry, if any
|
||||||
m_volumes.render(
|
m_volumes.render(
|
||||||
render_pipeline_stage, type, m_picking_enabled, camera,
|
render_pipeline_stage, type, m_picking_enabled, camera, colors,
|
||||||
colors,[this, canvas_type](const GLVolume &volume) {
|
*m_model,[this, canvas_type](const GLVolume &volume) {
|
||||||
if (canvas_type == ECanvasType::CanvasAssembleView) {
|
if (canvas_type == ECanvasType::CanvasAssembleView) {
|
||||||
return !volume.is_modifier && !volume.is_wipe_tower;
|
return !volume.is_modifier && !volume.is_wipe_tower;
|
||||||
}
|
}
|
||||||
@ -7449,7 +7450,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
|||||||
}*/
|
}*/
|
||||||
//BBS:add assemble view related logic
|
//BBS:add assemble view related logic
|
||||||
m_volumes.render(
|
m_volumes.render(
|
||||||
render_pipeline_stage, type, false, camera, colors,
|
render_pipeline_stage, type, false, camera, colors,*m_model,
|
||||||
[this, canvas_type](const GLVolume &volume) {
|
[this, canvas_type](const GLVolume &volume) {
|
||||||
if (canvas_type == ECanvasType::CanvasAssembleView) {
|
if (canvas_type == ECanvasType::CanvasAssembleView) {
|
||||||
return !volume.is_modifier;
|
return !volume.is_modifier;
|
||||||
@ -7846,7 +7847,7 @@ void GLCanvas3D::_render_volumes_for_picking() const
|
|||||||
std::array<float, 4> t_color{ (GLfloat)r * INV_255, (GLfloat)g * INV_255, (GLfloat)b * INV_255, (GLfloat)a * INV_255 };
|
std::array<float, 4> t_color{ (GLfloat)r * INV_255, (GLfloat)g * INV_255, (GLfloat)b * INV_255, (GLfloat)a * INV_255 };
|
||||||
shader->set_uniform("uniform_color", t_color);
|
shader->set_uniform("uniform_color", t_color);
|
||||||
volume.first->picking = true;
|
volume.first->picking = true;
|
||||||
volume.first->render(camera, colors); // colors is no use here
|
volume.first->render(camera, colors, *m_model); // colors is no use here
|
||||||
volume.first->picking = false;
|
volume.first->picking = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,6 +827,7 @@ public:
|
|||||||
void set_process(BackgroundSlicingProcess* process);
|
void set_process(BackgroundSlicingProcess* process);
|
||||||
void set_model(Model* model);
|
void set_model(Model* model);
|
||||||
const Model* get_model() const { return m_model; }
|
const Model* get_model() const { return m_model; }
|
||||||
|
Model& get_ref_model() const { return *m_model; }
|
||||||
|
|
||||||
const Selection& get_selection() const { return m_selection; }
|
const Selection& get_selection() const { return m_selection; }
|
||||||
Selection& get_selection() { return m_selection; }
|
Selection& get_selection() { return m_selection; }
|
||||||
|
@ -130,7 +130,7 @@ void GLGizmoFdmSupports::render_painter_gizmo() const
|
|||||||
|
|
||||||
const auto & camera = m_parent.get_active_camera();
|
const auto & camera = m_parent.get_active_camera();
|
||||||
std::vector<std::array<float, 4>> colors = m_parent.get_active_colors();
|
std::vector<std::array<float, 4>> colors = m_parent.get_active_colors();
|
||||||
m_support_volume->render(camera, colors);
|
m_support_volume->render(camera, colors, m_parent.get_ref_model());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_c->object_clipper()->render_cut();
|
m_c->object_clipper()->render_cut();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user