diff --git a/doc/generated/primitives.cpp b/doc/generated/primitives.cpp index d9fcc33ab..ce4569342 100644 --- a/doc/generated/primitives.cpp +++ b/doc/generated/primitives.cpp @@ -334,7 +334,7 @@ int PrimitiveVisualizer::exec() { .setLightPosition({5.0f, 5.0f, 7.0f}) .setProjectionMatrix(Projection3D) .setTransformationMatrix(Transformation3D) - .setNormalMatrix(Transformation3D.rotationScaling()); + .setNormalMatrix(Transformation3D.normalMatrix()); for(auto fun: {&PrimitiveVisualizer::capsule3DSolid, &PrimitiveVisualizer::circle3DSolid, diff --git a/doc/generated/shaders.cpp b/doc/generated/shaders.cpp index 2fbc128a6..100e37243 100644 --- a/doc/generated/shaders.cpp +++ b/doc/generated/shaders.cpp @@ -162,7 +162,7 @@ std::string ShaderVisualizer::phong() { .setLightPosition({5.0f, 5.0f, 7.0f}) .setProjectionMatrix(Projection) .setTransformationMatrix(Transformation) - .setNormalMatrix(Transformation.rotationScaling())); + .setNormalMatrix(Transformation.normalMatrix())); return "phong.png"; } diff --git a/doc/snippets/MagnumSceneGraph-gl.cpp b/doc/snippets/MagnumSceneGraph-gl.cpp index 290f06183..2f1a429bb 100644 --- a/doc/snippets/MagnumSceneGraph-gl.cpp +++ b/doc/snippets/MagnumSceneGraph-gl.cpp @@ -106,7 +106,7 @@ class RedCubeDrawable: public SceneGraph::Drawable3D { .setLightPosition(camera.cameraMatrix().transformPoint( {5.0f, 5.0f, 7.0f})) .setTransformationMatrix(transformationMatrix) - .setNormalMatrix(transformationMatrix.rotationScaling()) + .setNormalMatrix(transformationMatrix.normalMatrix()) .setProjectionMatrix(camera.projectionMatrix()); _mesh.draw(_shader); } diff --git a/doc/snippets/MagnumShaders.cpp b/doc/snippets/MagnumShaders.cpp index 1e455c1e5..b5e51e8a4 100644 --- a/doc/snippets/MagnumShaders.cpp +++ b/doc/snippets/MagnumShaders.cpp @@ -82,7 +82,7 @@ Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture}; shader.bindDiffuseTexture(diffuseTexture) .setLightPosition({5.0f, 5.0f, 7.0f}) .setTransformationMatrix(transformationMatrix) - .setNormalMatrix(transformationMatrix.rotation()) + .setNormalMatrix(transformationMatrix.normalMatrix()) .setProjectionMatrix(projectionMatrix); mesh.draw(shader); @@ -351,7 +351,7 @@ shader.setDiffuseColor(0x2f83cc_rgbf) .setShininess(200.0f) .setLightPosition({5.0f, 5.0f, 7.0f}) .setTransformationMatrix(transformationMatrix) - .setNormalMatrix(transformationMatrix.rotation()) + .setNormalMatrix(transformationMatrix.normalMatrix()) .setProjectionMatrix(projectionMatrix); mesh.draw(shader); @@ -388,7 +388,7 @@ Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture| shader.bindTextures(nullptr, &diffuseTexture, &specularTexture, nullptr) .setLightPosition({5.0f, 5.0f, 7.0f}) .setTransformationMatrix(transformationMatrix) - .setNormalMatrix(transformationMatrix.rotation()) + .setNormalMatrix(transformationMatrix.normalMatrix()) .setProjectionMatrix(projectionMatrix); mesh.draw(shader); diff --git a/src/Magnum/MeshTools/Test/CompileGLTest.cpp b/src/Magnum/MeshTools/Test/CompileGLTest.cpp index cd855ee31..9ced57bc4 100644 --- a/src/Magnum/MeshTools/Test/CompileGLTest.cpp +++ b/src/Magnum/MeshTools/Test/CompileGLTest.cpp @@ -439,7 +439,7 @@ void CompileGLTest::threeDimensions() { _phong .setDiffuseColor(0x33ff66_rgbf) .setTransformationMatrix(transformation) - .setNormalMatrix(transformation.rotationScaling()) + .setNormalMatrix(transformation.normalMatrix()) .setProjectionMatrix(projection); mesh.draw(_phong); @@ -459,7 +459,7 @@ void CompileGLTest::threeDimensions() { _phong .setDiffuseColor(0x33ff66_rgbf) .setTransformationMatrix(transformation) - .setNormalMatrix(transformation.rotationScaling()) + .setNormalMatrix(transformation.normalMatrix()) .setProjectionMatrix(projection); mesh.draw(_phong); @@ -474,7 +474,7 @@ void CompileGLTest::threeDimensions() { _phong .setDiffuseColor(0x33ff66_rgbf) .setTransformationMatrix(transformation) - .setNormalMatrix(transformation.rotationScaling()) + .setNormalMatrix(transformation.normalMatrix()) .setProjectionMatrix(projection); mesh.draw(_phong); diff --git a/src/Magnum/Shaders/Phong.h b/src/Magnum/Shaders/Phong.h index 517ade0af..45720a867 100644 --- a/src/Magnum/Shaders/Phong.h +++ b/src/Magnum/Shaders/Phong.h @@ -494,6 +494,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { * value is an identity matrix. If @ref lightCount() is zero, this * function is a no-op, as normals don't contribute to the output in * that case. + * @see @ref Math::Matrix4::normalMatrix() */ Phong& setNormalMatrix(const Matrix3x3& matrix);