From f99aaa1191245a61ded3e8c70ffdd6548612a8dd Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 20 Mar 2018 13:01:50 +0100 Subject: [PATCH] Out of bed detection - New colors for out of bed state --- lib/Slic3r/GUI/3DScene.pm | 11 +++++------ xs/src/slic3r/GUI/3DScene.cpp | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm index b4f1849e8..420ea493a 100644 --- a/lib/Slic3r/GUI/3DScene.pm +++ b/lib/Slic3r/GUI/3DScene.pm @@ -1823,6 +1823,7 @@ sub _fragment_shader_Gouraud { return <<'FRAGMENT'; #version 110 +const vec4 OUTSIDE_COLOR = vec4(0.24, 0.42, 0.62, 1.0); const vec3 ZERO = vec3(0.0, 0.0, 0.0); // x = tainted, y = specular; @@ -1835,13 +1836,11 @@ uniform vec4 uniform_color; void main() { - gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + uniform_color * intensity.x; + // if the fragment is outside the print volume use predefined color + vec4 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? OUTSIDE_COLOR : uniform_color; - // if the fragment is outside the print volume darken it and set it as transparent - if (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) - gl_FragColor = vec4(mix(gl_FragColor.xyz, ZERO, 0.5), 0.5 * uniform_color.a); - else - gl_FragColor.a = uniform_color.a; + gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + color * intensity.x; + gl_FragColor.a = color.a; } FRAGMENT diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index cb5d580c1..0bd7008d2 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -194,8 +194,8 @@ void GLIndexedVertexArray::render( const float GLVolume::SELECTED_COLOR[4] = { 0.0f, 1.0f, 0.0f, 1.0f }; const float GLVolume::HOVER_COLOR[4] = { 0.4f, 0.9f, 0.1f, 1.0f }; -const float GLVolume::OUTSIDE_COLOR[4] = { 0.75f, 0.0f, 0.75f, 1.0f }; -const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 1.0f, 0.0f, 1.0f, 1.0f }; +const float GLVolume::OUTSIDE_COLOR[4] = { 0.0f, 0.38f, 0.8f, 1.0f }; +const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 0.19f, 0.58f, 1.0f, 1.0f }; void GLVolume::set_render_color(float r, float g, float b, float a) {