Fix broken coloring of wielditems (#9969)

Fixes a regression that appeared in 5.3.0-dev.
This commit is contained in:
Danila Shutov 2020-06-09 22:38:09 +03:00 committed by GitHub
parent 7148834440
commit fe3e69eb40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

@ -145,6 +145,8 @@ void main(void)
vec4 col = vec4(color.rgb, base.a);
col.rgb *= gl_Color.rgb;
col.rgb *= emissiveColor.rgb * vIDiff;
#ifdef ENABLE_TONE_MAPPING

@ -38,7 +38,12 @@ void main(void)
lightVec = sunPosition - worldPosition;
eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz;
vIDiff = directional_ambient(normalize(gl_Normal));
// This is intentional comparison with zero without any margin.
// If normal is not equal to zero exactly, then we assume it's a valid, just not normalized vector
vIDiff = length(gl_Normal) == 0.0
? 1.0
: directional_ambient(normalize(gl_Normal));
gl_FrontColor = gl_BackColor = gl_Color;
}

@ -467,6 +467,10 @@ void WieldMeshSceneNode::setColor(video::SColor c)
bc.getGreen() * green / 255,
bc.getBlue() * blue / 255);
scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
if (m_enable_shaders)
setMeshBufferColor(buf, buffercolor);
else
colorizeMeshBuffer(buf, &buffercolor);
}
}
@ -481,9 +485,9 @@ void WieldMeshSceneNode::setNodeLightColor(video::SColor color)
video::SMaterial &material = m_meshnode->getMaterial(i);
material.EmissiveColor = color;
}
} else {
setColor(color);
}
setColor(color);
}
void WieldMeshSceneNode::render()