mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
The gizmo is now able to triangulate and show the cut, the triangulated cut is cached
This commit is contained in:
parent
9b7857aaab
commit
bbda1896f9
6 changed files with 150 additions and 48 deletions
|
@ -4432,13 +4432,29 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
_set_current();
|
||||
::glViewport(0, 0, w, h);
|
||||
|
||||
::glMatrixMode(GL_PROJECTION);
|
||||
::glLoadIdentity();
|
||||
|
||||
const BoundingBoxf3& bbox = _max_bounding_box();
|
||||
|
||||
switch (m_camera.type)
|
||||
{
|
||||
case Camera::Ortho:
|
||||
{
|
||||
float w2 = w;
|
||||
float h2 = h;
|
||||
float two_zoom = 2.0f * get_camera_zoom();
|
||||
if (two_zoom != 0.0f)
|
||||
{
|
||||
float inv_two_zoom = 1.0f / two_zoom;
|
||||
w2 *= inv_two_zoom;
|
||||
h2 *= inv_two_zoom;
|
||||
}
|
||||
|
||||
// FIXME: calculate a tighter value for depth will improve z-fighting
|
||||
float depth = 5.0f * (float)(_max_bounding_box().max_size());
|
||||
set_ortho_projection(w, h, -depth, depth);
|
||||
float depth = 5.0f * (float)bbox.max_size();
|
||||
::glOrtho(-w2, w2, -h2, h2, -depth, depth);
|
||||
|
||||
break;
|
||||
}
|
||||
// case Camera::Perspective:
|
||||
|
@ -4470,6 +4486,8 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
}
|
||||
}
|
||||
|
||||
::glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
|
@ -4689,22 +4707,6 @@ void GLCanvas3D::_render_axes() const
|
|||
}
|
||||
|
||||
|
||||
void GLCanvas3D::set_ortho_projection(float w, float h, float near, float far) const
|
||||
{
|
||||
float two_zoom = 2.0f * get_camera_zoom();
|
||||
if (two_zoom != 0.0f)
|
||||
{
|
||||
float inv_two_zoom = 1.0f / two_zoom;
|
||||
w *= inv_two_zoom;
|
||||
h *= inv_two_zoom;
|
||||
}
|
||||
::glMatrixMode(GL_PROJECTION);
|
||||
::glLoadIdentity();
|
||||
::glOrtho(-w, w, -h, h, near, far);
|
||||
::glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLCanvas3D::_render_objects() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue