mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Workaround to fix SPE-1082 + refactoring of 6 dof camera
This commit is contained in:
parent
15cb8ec653
commit
17a6b696e7
3 changed files with 137 additions and 8 deletions
|
@ -1710,11 +1710,16 @@ void GLCanvas3D::render()
|
|||
}
|
||||
|
||||
const Size& cnv_size = get_canvas_size();
|
||||
#if ENABLE_6DOF_CAMERA
|
||||
m_camera.apply_viewport(0, 0, (unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
|
||||
#endif // ENABLE_6DOF_CAMERA
|
||||
|
||||
if (m_camera.requires_zoom_to_bed)
|
||||
{
|
||||
zoom_to_bed();
|
||||
#if !ENABLE_6DOF_CAMERA
|
||||
_resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
|
||||
#endif // !ENABLE_6DOF_CAMERA
|
||||
m_camera.requires_zoom_to_bed = false;
|
||||
}
|
||||
|
||||
|
@ -3814,8 +3819,13 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool
|
|||
#if ENABLE_6DOF_CAMERA
|
||||
camera.set_scene_box(scene_bounding_box());
|
||||
#endif // ENABLE_6DOF_CAMERA
|
||||
#if ENABLE_6DOF_CAMERA
|
||||
camera.apply_viewport(0, 0, thumbnail_data.width, thumbnail_data.height);
|
||||
camera.zoom_to_volumes(visible_volumes);
|
||||
#else
|
||||
camera.zoom_to_volumes(visible_volumes, thumbnail_data.width, thumbnail_data.height);
|
||||
camera.apply_viewport(0, 0, thumbnail_data.width, thumbnail_data.height);
|
||||
#endif // ENABLE_6DOF_CAMERA
|
||||
camera.apply_view_matrix();
|
||||
|
||||
double near_z = -1.0;
|
||||
|
@ -4406,8 +4416,10 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
// ensures that this canvas is current
|
||||
_set_current();
|
||||
|
||||
#if !ENABLE_6DOF_CAMERA
|
||||
// updates camera
|
||||
m_camera.apply_viewport(0, 0, w, h);
|
||||
#endif // !ENABLE_6DOF_CAMERA
|
||||
}
|
||||
|
||||
BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_bed_model) const
|
||||
|
@ -4431,8 +4443,12 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_be
|
|||
#if ENABLE_THUMBNAIL_GENERATOR
|
||||
void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box, double margin_factor)
|
||||
{
|
||||
#if ENABLE_6DOF_CAMERA
|
||||
m_camera.zoom_to_box(box, margin_factor);
|
||||
#else
|
||||
const Size& cnv_size = get_canvas_size();
|
||||
m_camera.zoom_to_box(box, cnv_size.get_width(), cnv_size.get_height(), margin_factor);
|
||||
#endif // ENABLE_6DOF_CAMERA
|
||||
m_dirty = true;
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue