diff --git a/src/Magnum/Shaders/Phong.frag b/src/Magnum/Shaders/Phong.frag index 39ff82d47..034fbee25 100644 --- a/src/Magnum/Shaders/Phong.frag +++ b/src/Magnum/Shaders/Phong.frag @@ -176,6 +176,9 @@ void main() { #ifdef AMBIENT_TEXTURE texture(ambientTexture, interpolatedTextureCoordinates)* #endif + #ifdef VERTEX_COLOR + interpolatedVertexColor* + #endif ambientColor; #if LIGHT_COUNT lowp const vec4 finalDiffuseColor = diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index bf67b8287..8927e9199 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -973,8 +973,10 @@ template void PhongGLTest::renderVertexColor() { Trade::MeshData sphereData = Primitives::uvSphereSolid(16, 32, Primitives::UVSphereFlag::TextureCoordinates); - /* Highlight the middle rings */ + /* Highlight the pole vertices and the middle rings */ Containers::Array colorData{Containers::DirectInit, sphereData.vertexCount(), 0x999999_rgbf}; + for(std::size_t i = 0; i != 3*33 + 1; ++i) + colorData[sphereData.vertexCount() - i - 1] = 0xff0000_rgbf*5.0f; for(std::size_t i = 6*33; i != 9*33; ++i) colorData[i + 1] = 0xffff99_rgbf*1.5f; @@ -1006,6 +1008,7 @@ template void PhongGLTest::renderVertexColor() { .setNormalMatrix((Matrix4::rotationY(-15.0_degf)* Matrix4::rotationX(15.0_degf)).rotationScaling()) .setProjectionMatrix(Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)) + .setAmbientColor(0x111111_rgbf) .setDiffuseColor(0x9999ff_rgbf) .bindDiffuseTexture(diffuse) .draw(sphere); @@ -1015,10 +1018,10 @@ template void PhongGLTest::renderVertexColor() { #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) /* SwiftShader has some minor differences on the edges, Apple A8 a bit more */ - const Float maxThreshold = 105.4f, meanThreshold = 0.167f; + const Float maxThreshold = 115.4f, meanThreshold = 0.167f; #else /* WebGL 1 doesn't have 8bit renderbuffer storage, so it's worse */ - const Float maxThreshold = 105.4f, meanThreshold = 3.254f; + const Float maxThreshold = 115.4f, meanThreshold = 3.254f; #endif CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ diff --git a/src/Magnum/Shaders/Test/PhongTestFiles/vertexColor.tga b/src/Magnum/Shaders/Test/PhongTestFiles/vertexColor.tga index 1f044cab8..b674db5ba 100644 Binary files a/src/Magnum/Shaders/Test/PhongTestFiles/vertexColor.tga and b/src/Magnum/Shaders/Test/PhongTestFiles/vertexColor.tga differ