mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
bring back ISO view!
This commit is contained in:
parent
24723679cd
commit
b8fb80c17f
2 changed files with 10 additions and 18 deletions
|
@ -554,17 +554,14 @@ void Camera::look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up
|
||||||
|
|
||||||
void Camera::set_default_orientation()
|
void Camera::set_default_orientation()
|
||||||
{
|
{
|
||||||
// BBS modify default orientation
|
m_zenit = 45.0f;
|
||||||
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;
|
|
||||||
const double theta_rad = Geometry::deg2rad(-(double)m_zenit);
|
const double theta_rad = Geometry::deg2rad(-(double)m_zenit);
|
||||||
const double phi_rad = Geometry::deg2rad(45.0);
|
const double phi_rad = Geometry::deg2rad(45.0);
|
||||||
const double sin_theta = ::sin(theta_rad);
|
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));
|
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 = Eigen::AngleAxisd(theta_rad, Vec3d::UnitX()) * Eigen::AngleAxisd(phi_rad, Vec3d::UnitZ());
|
||||||
m_view_rotation.normalize();
|
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
|
Vec3d Camera::validate_target(const Vec3d& target) const
|
||||||
|
|
|
@ -4695,12 +4695,12 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
||||||
double width = volumes_box.max.x() - volumes_box.min.x();
|
double width = volumes_box.max.x() - volumes_box.min.x();
|
||||||
double depth = volumes_box.max.y() - volumes_box.min.y();
|
double depth = volumes_box.max.y() - volumes_box.min.y();
|
||||||
double height = volumes_box.max.z() - volumes_box.min.z();
|
double height = volumes_box.max.z() - volumes_box.min.z();
|
||||||
volumes_box.max.x() = volumes_box.max.x() + width * 0.25f;
|
volumes_box.max.x() = volumes_box.max.x() + width * 0.05f;
|
||||||
volumes_box.min.x() = volumes_box.min.x() - width * 0.25f;
|
volumes_box.min.x() = volumes_box.min.x() - width * 0.05f;
|
||||||
volumes_box.max.y() = volumes_box.max.y() + depth * 0.25f;
|
volumes_box.max.y() = volumes_box.max.y() + depth * 0.05f;
|
||||||
volumes_box.min.y() = volumes_box.min.y() - depth * 0.25f;
|
volumes_box.min.y() = volumes_box.min.y() - depth * 0.05f;
|
||||||
volumes_box.max.z() = volumes_box.max.z() + height * 0.25f;
|
volumes_box.max.z() = volumes_box.max.z() + height * 0.05f;
|
||||||
volumes_box.min.z() = volumes_box.min.z() - height * 0.25f;
|
volumes_box.min.z() = volumes_box.min.z() - height * 0.05f;
|
||||||
|
|
||||||
Camera camera;
|
Camera camera;
|
||||||
camera.set_type(camera_type);
|
camera.set_type(camera_type);
|
||||||
|
@ -4715,16 +4715,11 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
||||||
camera.zoom_to_box(volumes_box);
|
camera.zoom_to_box(volumes_box);
|
||||||
const Vec3d& target = camera.get_target();
|
const Vec3d& target = camera.get_target();
|
||||||
double distance = camera.get_distance();
|
double distance = camera.get_distance();
|
||||||
//camera.select_view("topfront");
|
camera.select_view("iso");
|
||||||
camera.look_at(target - 0.707 * distance * Vec3d::UnitY() + 0.3 * distance * Vec3d::UnitZ(), target, Vec3d::UnitY() + Vec3d::UnitZ());
|
|
||||||
camera.apply_view_matrix();
|
camera.apply_view_matrix();
|
||||||
|
|
||||||
camera.apply_projection(plate_build_volume);
|
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");
|
//GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||||
if (shader == nullptr) {
|
if (shader == nullptr) {
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("render_thumbnail: shader is null, return directly");
|
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)
|
//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(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue