From b8fb80c17f3fd6814a5ec72f96f15fdcc7b0dcba Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 18 Oct 2022 00:18:06 +0800 Subject: [PATCH] bring back ISO view! --- src/slic3r/GUI/Camera.cpp | 7 ++----- src/slic3r/GUI/GLCanvas3D.cpp | 21 ++++++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index ca37795489..24a7388e71 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -554,17 +554,14 @@ void Camera::look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up void Camera::set_default_orientation() { - // BBS modify default orientation - look_at(m_target - 0.707 * m_distance * Vec3d::UnitY() + 0.707 * m_distance * Vec3d::UnitZ(), m_target, Vec3d::UnitY() + Vec3d::UnitZ()); - - /*m_zenit = 45.0f; + m_zenit = 45.0f; const double theta_rad = Geometry::deg2rad(-(double)m_zenit); const double phi_rad = Geometry::deg2rad(45.0); const double sin_theta = ::sin(theta_rad); const Vec3d camera_pos = m_target + m_distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); m_view_rotation = Eigen::AngleAxisd(theta_rad, Vec3d::UnitX()) * Eigen::AngleAxisd(phi_rad, Vec3d::UnitZ()); m_view_rotation.normalize(); - m_view_matrix.fromPositionOrientationScale(m_view_rotation * (-camera_pos), m_view_rotation, Vec3d::Ones());*/ + m_view_matrix.fromPositionOrientationScale(m_view_rotation * (-camera_pos), m_view_rotation, Vec3d::Ones()); } Vec3d Camera::validate_target(const Vec3d& target) const diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c948b351df..fdc78d2226 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4695,12 +4695,12 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const double width = volumes_box.max.x() - volumes_box.min.x(); double depth = volumes_box.max.y() - volumes_box.min.y(); double height = volumes_box.max.z() - volumes_box.min.z(); - volumes_box.max.x() = volumes_box.max.x() + width * 0.25f; - volumes_box.min.x() = volumes_box.min.x() - width * 0.25f; - volumes_box.max.y() = volumes_box.max.y() + depth * 0.25f; - volumes_box.min.y() = volumes_box.min.y() - depth * 0.25f; - volumes_box.max.z() = volumes_box.max.z() + height * 0.25f; - volumes_box.min.z() = volumes_box.min.z() - height * 0.25f; + volumes_box.max.x() = volumes_box.max.x() + width * 0.05f; + volumes_box.min.x() = volumes_box.min.x() - width * 0.05f; + volumes_box.max.y() = volumes_box.max.y() + depth * 0.05f; + volumes_box.min.y() = volumes_box.min.y() - depth * 0.05f; + volumes_box.max.z() = volumes_box.max.z() + height * 0.05f; + volumes_box.min.z() = volumes_box.min.z() - height * 0.05f; Camera camera; camera.set_type(camera_type); @@ -4715,16 +4715,11 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const camera.zoom_to_box(volumes_box); const Vec3d& target = camera.get_target(); double distance = camera.get_distance(); - //camera.select_view("topfront"); - camera.look_at(target - 0.707 * distance * Vec3d::UnitY() + 0.3 * distance * Vec3d::UnitZ(), target, Vec3d::UnitY() + Vec3d::UnitZ()); + camera.select_view("iso"); camera.apply_view_matrix(); camera.apply_projection(plate_build_volume); - //double near_z = -1.0; - //double far_z = -1.0; - //camera.apply_projection(volumes_box, near_z, far_z); - //GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light"); if (shader == nullptr) { BOOST_LOG_TRIVIAL(info) << boost::format("render_thumbnail: shader is null, return directly"); @@ -4732,7 +4727,7 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const } //if (thumbnail_params.transparent_background) - glsafe(::glClearColor(0.906f, 0.906f, 0.906f, 1.0f)); + glsafe(::glClearColor(0.2f, 0.2f, 0.2f, 0.0f)); glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); glsafe(::glEnable(GL_DEPTH_TEST));