Fix fov so off-plate objects can be rendered properly (#8452)
Adopted from bambulab/BambuStudio@ba19513380 and bambulab/BambuStudio@d0e91b5164 Thanks BambuLab! Old:  New: 
This commit is contained in:
commit
55a351d5f0
1 changed files with 14 additions and 7 deletions
|
@ -1541,13 +1541,20 @@ void GLCanvas3D::refresh_camera_scene_box()
|
||||||
BoundingBoxf3 GLCanvas3D::volumes_bounding_box(bool current_plate_only) const
|
BoundingBoxf3 GLCanvas3D::volumes_bounding_box(bool current_plate_only) const
|
||||||
{
|
{
|
||||||
BoundingBoxf3 bb;
|
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) {
|
for (const GLVolume *volume : m_volumes.volumes) {
|
||||||
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_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();
|
const auto v_bb = volume->transformed_bounding_box();
|
||||||
if (!plate_bb.overlap(v_bb))
|
if (is_limit && !expand_part_plate_list_box.overlap(v_bb))
|
||||||
continue;
|
continue;
|
||||||
bb.merge(v_bb);
|
bb.merge(v_bb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue