Merge branch 'main' into skirt-object-fix-pr

This commit is contained in:
SoftFever 2024-09-07 10:57:59 +08:00 committed by GitHub
commit 5b5cd478c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
160 changed files with 13381 additions and 10798 deletions

View file

@ -666,8 +666,9 @@ void GLCanvas3D::LayersEditing::update_slicing_parameters()
{
if (m_slicing_parameters == nullptr) {
m_slicing_parameters = new SlicingParameters();
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z);
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z, m_shrinkage_compensation);
}
}
float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D & canvas)
@ -1489,6 +1490,11 @@ void GLCanvas3D::set_config(const DynamicPrintConfig* config)
{
m_config = config;
m_layers_editing.set_config(config);
// Orca: Filament shrinkage compensation
const Print *print = fff_print();
if (print != nullptr)
m_layers_editing.set_shrinkage_compensation(fff_print()->shrinkage_compensation());
}
void GLCanvas3D::set_process(BackgroundSlicingProcess *process)
@ -7227,6 +7233,12 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
if (shader != nullptr) {
shader->start_using();
const Size& cvn_size = get_canvas_size();
{
const Camera& camera = wxGetApp().plater()->get_camera();
shader->set_uniform("z_far", camera.get_far_z());
shader->set_uniform("z_near", camera.get_near_z());
}
switch (type)
{
default:
@ -7238,7 +7250,7 @@ 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)) {
int object_id = m_layers_editing.last_object_id;
const Camera& camera = wxGetApp().plater()->get_camera();
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), [object_id](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [object_id](const GLVolume& volume) {
// Which volume to paint without the layer height profile shader?
return volume.is_active && (volume.is_modifier || volume.composite_id.object_id != object_id);
});
@ -7254,14 +7266,14 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
//BBS:add assemble view related logic
// do not cull backfaces to show broken geometry, if any
const Camera& camera = wxGetApp().plater()->get_camera();
m_volumes.render(type, m_picking_enabled, camera.get_view_matrix(), camera.get_projection_matrix(), [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, m_picking_enabled, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier && !volume.is_wipe_tower;
}
else {
return (m_render_sla_auxiliaries || volume.composite_id.volume_id >= 0);
}
}, with_outline);
});
}
}
else {
@ -7288,14 +7300,14 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
}*/
const Camera& camera = wxGetApp().plater()->get_camera();
//BBS:add assemble view related logic
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier;
}
else {
return true;
}
}, with_outline);
});
if (m_canvas_type == CanvasAssembleView && m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position() > 0) {
const GLGizmosManager& gm = get_gizmos_manager();
shader->stop_using();
@ -8433,7 +8445,6 @@ void GLCanvas3D::_render_assemble_info() const
auto canvas_h = float(get_canvas_size().get_height());
float space_size = imgui->get_style_scaling() * 8.0f;
float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size;
char buf[3][64];
ImGuiIO& io = ImGui::GetIO();
ImFont* font = io.Fonts->Fonts[0];