Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer

This commit is contained in:
enricoturri1966 2020-04-08 08:10:03 +02:00
commit 4df141815b
3 changed files with 20 additions and 8 deletions

View File

@ -65,10 +65,14 @@ 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);
if (NdotL > 0.0)
intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
// compute deltas for out of print volume detection (world coordinates)

View File

@ -35,11 +35,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)
NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0);
if (NdotL > 0.0)
intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
// Scaled to widths of the Z texture.

View File

@ -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);