diff --git a/resources/shaders/gouraud.vs b/resources/shaders/gouraud.vs index a9f3f6118..17cc764e2 100644 --- a/resources/shaders/gouraud.vs +++ b/resources/shaders/gouraud.vs @@ -65,11 +65,15 @@ void main() intensity.y = 0.0; if (NdotL > 0.0) - intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(normal, reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + { + vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; + intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + } // Perform the same lighting calculation for the 2nd light source (no specular applied). NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); - intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; + if (NdotL > 0.0) + intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // compute deltas for out of print volume detection (world coordinates) if (print_box.actived) diff --git a/resources/shaders/variable_layer_height.vs b/resources/shaders/variable_layer_height.vs index 4f98dfa56..5dd697063 100644 --- a/resources/shaders/variable_layer_height.vs +++ b/resources/shaders/variable_layer_height.vs @@ -35,12 +35,16 @@ void main() intensity.y = 0.0; if (NdotL > 0.0) - intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(normal, reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + { + vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; + intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + } // Perform the same lighting calculation for the 2nd light source (no specular) NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); - intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; + if (NdotL > 0.0) + intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // Scaled to widths of the Z texture. if (object_max_z > 0.0) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index a1a6583bc..c9e91bd95 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1291,9 +1291,13 @@ void PointCtrl::set_value(const boost::any& value, bool change_event) boost::any& PointCtrl::get_value() { double x, y; - x_textctrl->GetValue().ToDouble(&x); - y_textctrl->GetValue().ToDouble(&y); - + if (!x_textctrl->GetValue().ToDouble(&x) || + !y_textctrl->GetValue().ToDouble(&y)) + { + set_value(m_value.empty() ? Vec2d(0.0, 0.0) : m_value, true); + show_error(m_parent, _L("Invalid numeric input.")); + } + else if (m_opt.min > x || x > m_opt.max || m_opt.min > y || y > m_opt.max) { @@ -1303,7 +1307,7 @@ boost::any& PointCtrl::get_value() if (y > m_opt.max) y = m_opt.max; set_value(Vec2d(x, y), true); - show_error(m_parent, _(L("Input value is out of range"))); + show_error(m_parent, _L("Input value is out of range")); } return m_value = Vec2d(x, y);