ENH: wireframe: refine the rendering logic under paint

1. remove wireframe in 3d view, only keep in paint;
2. pass barycentric_coordinates from outside
3. add shortcut hints

Change-Id: I911e5cdf3475926d9527dc0839fdce072ed54746
(cherry picked from commit 6e16d0ccfb71741e55daabd757be9f9e7613e695)
This commit is contained in:
lane.wei 2022-10-25 15:55:35 +08:00 committed by Lane.Wei
parent 79b5c94f4f
commit a9a228d071
9 changed files with 137 additions and 39 deletions

View file

@ -45,7 +45,8 @@ std::pair<bool, std::string> GLShadersManager::init()
// used to render extrusion and travel paths as lines in gcode preview
valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" });
// used to render objects in 3d editor
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0)) {
//if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0)) {
if (0) {
valid &= append_shader("gouraud", { "gouraud_130.vs", "gouraud_130.fs" }
#if ENABLE_ENVIRONMENT_MAP
, { "ENABLE_ENVIRONMENT_MAP"sv }
@ -70,16 +71,16 @@ std::pair<bool, std::string> GLShadersManager::init()
// Since macOS 12 (Monterey), this issue with the opposite direction on Apple's Arm CPU seems to be fixed, and computed
// triangle normals inside fragment shader have the right direction.
if (platform_flavor() == PlatformFlavor::OSXOnArm && wxPlatformInfo::Get().GetOSMajorVersion() < 12) {
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0))
//if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0))
valid &= append_shader("mm_gouraud", {"mm_gouraud_130.vs", "mm_gouraud_130.fs"}, {"FLIP_TRIANGLE_NORMALS"sv});
else
valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"}, {"FLIP_TRIANGLE_NORMALS"sv});
//else
// valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"}, {"FLIP_TRIANGLE_NORMALS"sv});
}
else {
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0))
valid &= append_shader("mm_gouraud", {"mm_gouraud_130.vs", "mm_gouraud_130.fs"});
else
valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"});
//if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0))
valid &= append_shader("mm_gouraud", {"mm_gouraud_wireframe.vs", "mm_gouraud_wireframe.fs"});
//else
// valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"});
}
//BBS: add shader for outline