Browse Source

Use the new Matrix4::normalMatrix() everywhere.

pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
de95eddb3f
  1. 2
      doc/generated/primitives.cpp
  2. 2
      doc/generated/shaders.cpp
  3. 2
      doc/snippets/MagnumSceneGraph-gl.cpp
  4. 6
      doc/snippets/MagnumShaders.cpp
  5. 6
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  6. 1
      src/Magnum/Shaders/Phong.h

2
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,

2
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";
}

2
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);
}

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

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

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

Loading…
Cancel
Save