Renamed shaders

This commit is contained in:
enricoturri1966 2020-08-25 08:12:28 +02:00
parent e4f767b2ed
commit ac8a6fccbe
7 changed files with 15 additions and 16 deletions

View File

@ -606,8 +606,7 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
fprintf(fp, "# Generated by %s based on Slic3r\n", SLIC3R_BUILD_ID);
unsigned int colors_count = 1;
for (const Color& color : colors)
{
for (const Color& color : colors) {
fprintf(fp, "\nnewmtl material_%d\n", colors_count++);
fprintf(fp, "Ka 1 1 1\n");
fprintf(fp, "Kd %f %f %f\n", color[0], color[1], color[2]);
@ -858,14 +857,14 @@ void GCodeViewer::init_shaders()
for (unsigned char i = begin_id; i < end_id; ++i) {
switch (buffer_type(i))
{
case EMoveType::Tool_change: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Color_change: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Pause_Print: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Custom_GCode: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Retract: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Unretract: { m_buffers[i].shader = is_glsl_120 ? "options_120_flat" : "options_110"; break; }
case EMoveType::Extrude: { m_buffers[i].shader = "toolpaths"; break; }
case EMoveType::Travel: { m_buffers[i].shader = "toolpaths"; break; }
case EMoveType::Tool_change: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Color_change: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Pause_Print: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Custom_GCode: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Retract: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Unretract: { m_buffers[i].shader = is_glsl_120 ? "options_120" : "options_110"; break; }
case EMoveType::Extrude: { m_buffers[i].shader = "toolpaths_lines"; break; }
case EMoveType::Travel: { m_buffers[i].shader = "toolpaths_lines"; break; }
default: { break; }
}
}
@ -1463,8 +1462,8 @@ void GCodeViewer::render_legend() const
else
draw_list->AddCircleFilled(center, 0.5f * icon_size, ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f }), 16);
#else
ImVec2 center(0.5f * (pos.x + pos.x + icon_size), 0.5f * (pos.y + pos.y + icon_size));
if (m_buffers[buffer_id(EMoveType::Retract)].shader == "options_120_flat") {
ImVec2 center(0.5f * (pos.x + pos.x + icon_size), 0.5f * (pos.y + pos.y + icon_size));
if (m_buffers[buffer_id(EMoveType::Retract)].shader == "options_120") {
draw_list->AddCircleFilled(center, 0.5f * icon_size,
ImGui::GetColorU32({ 0.5f * color[0], 0.5f * color[1], 0.5f * color[2], 1.0f }), 16);
float radius = 0.5f * icon_size;
@ -2527,7 +2526,7 @@ void GCodeViewer::render_shaders_editor() const
switch (m_shaders_editor.points.shader_version)
{
case 0: { set_shader("options_110"); break; }
case 1: { set_shader("options_120_flat"); break; }
case 1: { set_shader("options_120"); break; }
}
if (ImGui::TreeNode("Options")) {

View File

@ -65,7 +65,7 @@ class GCodeViewer
void reset();
};
// ibo buffer containing indices data (triangles) used to render a specific toolpath type
// ibo buffer containing indices data (lines/triangles) used to render a specific toolpath type
struct IBuffer
{
// ibo id

View File

@ -36,9 +36,9 @@ std::pair<bool, std::string> GLShadersManager::init()
// used to render options in gcode preview
valid &= append_shader("options_110", { "options_110.vs", "options_110.fs" });
if (GUI::wxGetApp().is_glsl_version_greater_or_equal_to(1, 20))
valid &= append_shader("options_120_flat", { "options_120_flat.vs", "options_120_flat.fs" });
valid &= append_shader("options_120", { "options_120.vs", "options_120.fs" });
// used to render extrusion and travel paths in gcode preview
valid &= append_shader("toolpaths", { "toolpaths.vs", "toolpaths.fs" });
valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" });
// used to render objects in 3d editor
valid &= append_shader("gouraud", { "gouraud.vs", "gouraud.fs" });
// used to render variable layers heights in 3d editor