Merge branch 'SoftFever' into feature/more_parameters

This commit is contained in:
SoftFever 2022-10-18 18:06:39 +08:00
commit d0fab5a5bd
7 changed files with 46 additions and 50 deletions

View file

@ -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

View file

@ -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));

View file

@ -2913,8 +2913,8 @@ void TabPrinter::build_fff()
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
#if 0
optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
optgroup = page->new_optgroup(L("Before layer change G-code"),"param_gcode", 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
@ -2923,7 +2923,6 @@ void TabPrinter::build_fff()
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
#endif
optgroup = page->new_optgroup(L("Layer change G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {