Fix fov so off-plate objects can be rendered properly.
Adopted from bambulab/BambuStudio@ba19513380 and bambulab/BambuStudio@d0e91b5164 Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
This commit is contained in:
parent
5d2e7e4dc4
commit
85cf995458
1 changed files with 14 additions and 7 deletions
|
@ -1541,15 +1541,22 @@ void GLCanvas3D::refresh_camera_scene_box()
|
|||
BoundingBoxf3 GLCanvas3D::volumes_bounding_box(bool current_plate_only) const
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||
|
||||
BoundingBoxf3 expand_part_plate_list_box;
|
||||
bool is_limit = m_canvas_type != ECanvasType::CanvasAssembleView;
|
||||
if (is_limit) {
|
||||
auto plate_list_box = current_plate_only ? wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_bounding_box() :
|
||||
wxGetApp().plater()->get_partplate_list().get_bounding_box();
|
||||
auto horizontal_radius = 0.5 * sqrt(std::pow(plate_list_box.min[0] - plate_list_box.max[0], 2) + std::pow(plate_list_box.min[1] - plate_list_box.max[1], 2));
|
||||
const float scale = 2;
|
||||
expand_part_plate_list_box.merge(plate_list_box.min - scale * Vec3d(horizontal_radius, horizontal_radius, 0));
|
||||
expand_part_plate_list_box.merge(plate_list_box.max + scale * Vec3d(horizontal_radius, horizontal_radius, 0));
|
||||
}
|
||||
for (const GLVolume *volume : m_volumes.volumes) {
|
||||
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_volumes)) {
|
||||
const auto plate_bb = plate->get_bounding_box();
|
||||
const auto v_bb = volume->transformed_bounding_box();
|
||||
if (!plate_bb.overlap(v_bb))
|
||||
continue;
|
||||
bb.merge(v_bb);
|
||||
const auto v_bb = volume->transformed_bounding_box();
|
||||
if (is_limit && !expand_part_plate_list_box.overlap(v_bb))
|
||||
continue;
|
||||
bb.merge(v_bb);
|
||||
}
|
||||
}
|
||||
return bb;
|
||||
|
|
Loading…
Reference in a new issue