Use a 2-pass depth based outline algorithm when selected

This commit is contained in:
Noisyfox
2024-08-18 19:30:40 +08:00
parent 2acd858bf3
commit 13e18d1d65
7 changed files with 262 additions and 46 deletions

View File

@@ -39,6 +39,10 @@ extern Slic3r::ColorRGBA adjust_color_for_rendering(const Slic3r::C
namespace Slic3r {
namespace GUI {
class Size;
}
class SLAPrintObject;
enum SLAPrintObjectStep : unsigned int;
class BuildVolume;
@@ -322,7 +326,7 @@ public:
virtual void render();
//BBS: add outline related logic and add virtual specifier
virtual void render_with_outline(const Transform3d &view_model_matrix);
virtual void render_with_outline(const GUI::Size& cnv_size);
//BBS: add simple render function for thumbnail
void simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector<ColorRGBA>& extruder_colors, bool ban_light =false);
@@ -355,7 +359,7 @@ class GLWipeTowerVolume : public GLVolume {
public:
GLWipeTowerVolume(const std::vector<ColorRGBA>& colors);
void render() override;
void render_with_outline(const Transform3d &view_model_matrix) override { render(); }
void render_with_outline(const GUI::Size& cnv_size) override { render(); }
std::vector<GUI::GLModel> model_per_colors;
bool IsTransparent();
@@ -465,8 +469,8 @@ public:
int get_selection_support_threshold_angle(bool&) const;
// Render the volumes by OpenGL.
//BBS: add outline drawing logic
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix,
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>(), bool with_outline = true) const;
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix, const GUI::Size& cnv_size,
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>()) const;
// Clear the geometry
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }