mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 23:01:22 -06:00
ENH: refine the thumbnail rendering
1. add specific shader for thumbnail 2. do not render the negative-z part 3. fix the sinking related issue under cli Change-Id: Ia59083437544c1c0bd924c811274ccbb137e9eb7
This commit is contained in:
parent
031d61faca
commit
90760e0d07
6 changed files with 86 additions and 11 deletions
|
@ -1983,7 +1983,7 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w,
|
|||
void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params,
|
||||
const GLVolumeCollection& volumes, Camera::EType camera_type, bool use_top_view, bool for_picking)
|
||||
{
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thumbnail");
|
||||
ModelObjectPtrs& model_objects = GUI::wxGetApp().model().objects;
|
||||
std::vector<std::array<float, 4>> colors = ::get_extruders_colors();
|
||||
switch (OpenGLManager::get_framebuffers_type())
|
||||
|
@ -5429,7 +5429,14 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||
auto is_visible = [plate_idx, plate_build_volume](const GLVolume& v) {
|
||||
bool ret = v.printable;
|
||||
if (plate_idx >= 0) {
|
||||
ret &= plate_build_volume.contains(v.transformed_convex_hull_bounding_box());
|
||||
bool contained = false;
|
||||
BoundingBoxf3 plate_bbox = plate_build_volume;
|
||||
plate_bbox.min(2) = -1e10;
|
||||
const BoundingBoxf3& volume_bbox = v.transformed_convex_hull_bounding_box();
|
||||
if (plate_bbox.contains(volume_bbox) && (volume_bbox.max(2) > 0)) {
|
||||
contained = true;
|
||||
}
|
||||
ret &= contained;
|
||||
}
|
||||
else {
|
||||
ret &= (!v.shader_outside_printer_detection_enabled || !v.is_outside);
|
||||
|
@ -5461,6 +5468,7 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||
volumes_box.merge(vol->transformed_bounding_box());
|
||||
}
|
||||
}
|
||||
volumes_box.min.z() = -Slic3r::BuildVolume::SceneEpsilon;
|
||||
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();
|
||||
|
@ -5592,6 +5600,7 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||
curr_color[3] = vol->color[3];
|
||||
|
||||
shader->set_uniform("uniform_color", curr_color);
|
||||
shader->set_uniform("volume_world_matrix", vol->world_matrix());
|
||||
//BBS set all volume to orange
|
||||
//shader->set_uniform("uniform_color", orange);
|
||||
/*if (plate_idx > 0) {
|
||||
|
|
|
@ -35,6 +35,8 @@ std::pair<bool, std::string> GLShadersManager::init()
|
|||
|
||||
// used to render bed axes and model, selection hints, gcode sequential view marker model, preview shells, options in gcode preview
|
||||
valid &= append_shader("gouraud_light", { "gouraud_light.vs", "gouraud_light.fs" });
|
||||
//used to render thumbnail
|
||||
valid &= append_shader("thumbnail", { "thumbnail.vs", "thumbnail.fs" });
|
||||
// used to render first layer for calibration
|
||||
valid &= append_shader("cali", { "cali.vs", "cali.fs"});
|
||||
// used to render printbed
|
||||
|
|
|
@ -251,14 +251,19 @@ bool OpenGLManager::init_gl()
|
|||
if (GLEW_ARB_framebuffer_object) {
|
||||
s_framebuffers_type = EFramebufferType::Arb;
|
||||
BOOST_LOG_TRIVIAL(info) << "Found Framebuffer Type ARB."<< std::endl;
|
||||
}
|
||||
else if (GLEW_EXT_framebuffer_object)
|
||||
}
|
||||
else if (GLEW_EXT_framebuffer_object) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Found Framebuffer Type Ext."<< std::endl;
|
||||
s_framebuffers_type = EFramebufferType::Ext;
|
||||
else
|
||||
}
|
||||
else {
|
||||
s_framebuffers_type = EFramebufferType::Unknown;
|
||||
BOOST_LOG_TRIVIAL(warning) << "Found Framebuffer Type unknown!"<< std::endl;
|
||||
}
|
||||
|
||||
bool valid_version = s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
if (!valid_version) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "Found opengl version <= 2.0"<< std::endl;
|
||||
// Complain about the OpenGL version.
|
||||
wxString message = from_u8((boost::format(
|
||||
_utf8(L("The application cannot run normally because OpenGL version is lower than 2.0.\n")))).str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue