diff --git a/src/Physics/AbstractShape.h b/src/Physics/AbstractShape.h index 44fa0af6a..cebb5f61e 100644 --- a/src/Physics/AbstractShape.h +++ b/src/Physics/AbstractShape.h @@ -100,12 +100,12 @@ template class MAGNUM_PHYSICS_EXPORT AbstractShape { virtual Type type() const = 0; /** - * @brief Apply transformation + * @brief Apply transformation matrix * - * Applies transformation to user-defined shape properties and caches - * them for later usage in collision detection. + * Applies transformation matrix to user-defined shape properties and + * caches them for later usage in collision detection. */ - virtual void applyTransformation(const typename DimensionTraits::MatrixType& transformation) = 0; + virtual void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) = 0; /** * @brief Detect collision with other shape diff --git a/src/Physics/AxisAlignedBox.cpp b/src/Physics/AxisAlignedBox.cpp index 8b15efa27..9c2f004cf 100644 --- a/src/Physics/AxisAlignedBox.cpp +++ b/src/Physics/AxisAlignedBox.cpp @@ -20,9 +20,9 @@ namespace Magnum { namespace Physics { -template void AxisAlignedBox::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedPosition = (transformation*typename DimensionTraits::PointType(_position)).vector(); - _transformedSize = transformation.rotationScaling()*_size; +template void AxisAlignedBox::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedPosition = (matrix*typename DimensionTraits::PointType(_position)).vector(); + _transformedSize = matrix.rotationScaling()*_size; } template class AxisAlignedBox<2>; diff --git a/src/Physics/AxisAlignedBox.h b/src/Physics/AxisAlignedBox.h index 6d76e7da5..b94a1c70e 100644 --- a/src/Physics/AxisAlignedBox.h +++ b/src/Physics/AxisAlignedBox.h @@ -40,7 +40,7 @@ template class MAGNUM_PHYSICS_EXPORT AxisAlignedBox: pu return AbstractShape::Type::AxisAlignedBox; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; /** @brief Position */ inline typename DimensionTraits::VectorType position() const { diff --git a/src/Physics/Box.cpp b/src/Physics/Box.cpp index e1ed39501..d71c6d570 100644 --- a/src/Physics/Box.cpp +++ b/src/Physics/Box.cpp @@ -20,8 +20,8 @@ namespace Magnum { namespace Physics { -template void Box::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedTransformation = (transformation*_transformation); +template void Box::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedTransformation = matrix*_transformation; } template class Box<2>; diff --git a/src/Physics/Box.h b/src/Physics/Box.h index f09e093b2..828f9e2af 100644 --- a/src/Physics/Box.h +++ b/src/Physics/Box.h @@ -42,7 +42,7 @@ template class MAGNUM_PHYSICS_EXPORT Box: public Abstra return AbstractShape::Type::Box; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; /** @brief Transformation */ inline typename DimensionTraits::MatrixType transformation() const { diff --git a/src/Physics/Capsule.cpp b/src/Physics/Capsule.cpp index 422bd12bb..8fc516ba6 100644 --- a/src/Physics/Capsule.cpp +++ b/src/Physics/Capsule.cpp @@ -27,10 +27,10 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Physics { -template void Capsule::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedA = (transformation*typename DimensionTraits::PointType(_a)).vector(); - _transformedB = (transformation*typename DimensionTraits::PointType(_b)).vector(); - float scaling = (transformation.rotationScaling()*typename DimensionTraits::VectorType(1/Constants::sqrt3())).length(); +template void Capsule::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedA = (matrix*typename DimensionTraits::PointType(_a)).vector(); + _transformedB = (matrix*typename DimensionTraits::PointType(_b)).vector(); + float scaling = (matrix.rotationScaling()*typename DimensionTraits::VectorType(1/Constants::sqrt3())).length(); _transformedRadius = scaling*_radius; } diff --git a/src/Physics/Capsule.h b/src/Physics/Capsule.h index 015050ffe..f279985de 100644 --- a/src/Physics/Capsule.h +++ b/src/Physics/Capsule.h @@ -43,7 +43,7 @@ template class MAGNUM_PHYSICS_EXPORT Capsule: public Ab return AbstractShape::Type::Capsule; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; bool collides(const AbstractShape* other) const override; diff --git a/src/Physics/Implementation/AxisAlignedBoxRenderer.cpp b/src/Physics/Implementation/AxisAlignedBoxRenderer.cpp index d53732742..97102bf35 100644 --- a/src/Physics/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/Physics/Implementation/AxisAlignedBoxRenderer.cpp @@ -26,7 +26,7 @@ template void AxisAlignedBoxRenderer::draw( typename DimensionTraits::MatrixType transformation = DimensionTraits::MatrixType::translation(axisAlignedBox.transformedPosition())* DimensionTraits::MatrixType::scaling(axisAlignedBox.transformedSize()); - this->shader->setTransformationProjection(camera->projectionMatrix()*camera->cameraMatrix()*transformation) + this->shader->setTransformationProjectionMatrix(camera->projectionMatrix()*camera->cameraMatrix()*transformation) ->setColor(options->color) ->use(); this->mesh->draw(); diff --git a/src/Physics/Implementation/BoxRenderer.cpp b/src/Physics/Implementation/BoxRenderer.cpp index ea4531324..840c6b306 100644 --- a/src/Physics/Implementation/BoxRenderer.cpp +++ b/src/Physics/Implementation/BoxRenderer.cpp @@ -23,7 +23,7 @@ namespace Magnum { namespace Physics { namespace Implementation { template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType&, typename SceneGraph::AbstractCamera* camera) { - this->shader->setTransformationProjection(camera->projectionMatrix()*camera->cameraMatrix()*box.transformedTransformation()) + this->shader->setTransformationProjectionMatrix(camera->projectionMatrix()*camera->cameraMatrix()*box.transformedTransformation()) ->setColor(options->color) ->use(); this->mesh->draw(); diff --git a/src/Physics/Line.cpp b/src/Physics/Line.cpp index 65533e3ef..49fbe566e 100644 --- a/src/Physics/Line.cpp +++ b/src/Physics/Line.cpp @@ -20,9 +20,9 @@ namespace Magnum { namespace Physics { -template void Line::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedA = (transformation*typename DimensionTraits::PointType(_a)).vector(); - _transformedB = (transformation*typename DimensionTraits::PointType(_b)).vector(); +template void Line::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedA = (matrix*typename DimensionTraits::PointType(_a)).vector(); + _transformedB = (matrix*typename DimensionTraits::PointType(_b)).vector(); } /* Explicitly instantiate the templates */ diff --git a/src/Physics/Line.h b/src/Physics/Line.h index 26d3232dd..9246133a4 100644 --- a/src/Physics/Line.h +++ b/src/Physics/Line.h @@ -41,7 +41,7 @@ template class MAGNUM_PHYSICS_EXPORT Line: public Abstr return AbstractShape::Type::Line; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; /** @brief First point */ inline typename DimensionTraits::VectorType a() const { diff --git a/src/Physics/ObjectShape.cpp b/src/Physics/ObjectShape.cpp index 446433d5a..766a475a9 100644 --- a/src/Physics/ObjectShape.cpp +++ b/src/Physics/ObjectShape.cpp @@ -36,8 +36,8 @@ template void ObjectShape::markDirty() { group()->setDirty(); } -template void ObjectShape::clean(const typename DimensionTraits::MatrixType& absoluteTransformation) { - if(_shape) _shape->applyTransformation(absoluteTransformation); +template void ObjectShape::clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { + if(_shape) _shape->applyTransformationMatrix(absoluteTransformationMatrix); } template class ObjectShape<2>; diff --git a/src/Physics/ObjectShape.h b/src/Physics/ObjectShape.h index 61791fa21..b1d04e1fd 100644 --- a/src/Physics/ObjectShape.h +++ b/src/Physics/ObjectShape.h @@ -78,7 +78,7 @@ template class MAGNUM_PHYSICS_EXPORT ObjectShape: publi void markDirty() override; /** Applies transformation to associated shape. */ - void clean(const typename DimensionTraits::MatrixType& absoluteTransformation) override; + void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) override; private: AbstractShape* _shape; diff --git a/src/Physics/Plane.cpp b/src/Physics/Plane.cpp index e1ddf5ac5..4798b991c 100644 --- a/src/Physics/Plane.cpp +++ b/src/Physics/Plane.cpp @@ -27,9 +27,9 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Physics { -void Plane::applyTransformation(const Matrix4& transformation) { - _transformedPosition = (transformation*Magnum::Point3D(_position)).xyz(); - _transformedNormal = transformation.rotation()*_normal; +void Plane::applyTransformationMatrix(const Matrix4& matrix) { + _transformedPosition = (matrix*Magnum::Point3D(_position)).xyz(); + _transformedNormal = matrix.rotation()*_normal; } bool Plane::collides(const AbstractShape<3>* other) const { diff --git a/src/Physics/Plane.h b/src/Physics/Plane.h index d3ff91617..4a622ec58 100644 --- a/src/Physics/Plane.h +++ b/src/Physics/Plane.h @@ -36,10 +36,10 @@ class MAGNUM_PHYSICS_EXPORT Plane: public AbstractShape<3> { inline Type type() const override { return Type::Plane; } #ifndef DOXYGEN_GENERATING_OUTPUT - void applyTransformation(const Matrix4& transformation) override; + void applyTransformationMatrix(const Matrix4& matrix) override; bool collides(const AbstractShape<3>* other) const override; #else - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; bool collides(const AbstractShape* other) const override; #endif diff --git a/src/Physics/Point.cpp b/src/Physics/Point.cpp index 06850fd68..53f697109 100644 --- a/src/Physics/Point.cpp +++ b/src/Physics/Point.cpp @@ -20,8 +20,8 @@ namespace Magnum { namespace Physics { -template void Point::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedPosition = (transformation*typename DimensionTraits::PointType(_position)).vector(); +template void Point::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedPosition = (matrix*typename DimensionTraits::PointType(_position)).vector(); } template class Point<2>; diff --git a/src/Physics/Point.h b/src/Physics/Point.h index 70bf6df40..5c8e48574 100644 --- a/src/Physics/Point.h +++ b/src/Physics/Point.h @@ -40,7 +40,7 @@ template class MAGNUM_PHYSICS_EXPORT Point: public Abst return AbstractShape::Type::Point; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; /** @brief Position */ inline typename DimensionTraits::VectorType position() const { diff --git a/src/Physics/ShapeGroup.cpp b/src/Physics/ShapeGroup.cpp index 3352a2664..d77a0ce18 100644 --- a/src/Physics/ShapeGroup.cpp +++ b/src/Physics/ShapeGroup.cpp @@ -43,9 +43,9 @@ template ShapeGroup& ShapeGroup return *this; } -template void ShapeGroup::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - if(a) a->applyTransformation(transformation); - if(b) b->applyTransformation(transformation); +template void ShapeGroup::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + if(a) a->applyTransformationMatrix(matrix); + if(b) b->applyTransformationMatrix(matrix); } template bool ShapeGroup::collides(const AbstractShape* other) const { diff --git a/src/Physics/ShapeGroup.h b/src/Physics/ShapeGroup.h index 5a00f0488..88fd7bd1b 100644 --- a/src/Physics/ShapeGroup.h +++ b/src/Physics/ShapeGroup.h @@ -105,7 +105,7 @@ template class MAGNUM_PHYSICS_EXPORT ShapeGroup: public return AbstractShape::Type::ShapeGroup; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; bool collides(const AbstractShape* other) const override; diff --git a/src/Physics/Sphere.cpp b/src/Physics/Sphere.cpp index 94b971b3e..9bd6f754e 100644 --- a/src/Physics/Sphere.cpp +++ b/src/Physics/Sphere.cpp @@ -39,9 +39,9 @@ namespace { } } -template void Sphere::applyTransformation(const typename DimensionTraits::MatrixType& transformation) { - _transformedPosition = (transformation*typename DimensionTraits::PointType(_position)).vector(); - float scaling = (transformation.rotationScaling()*unitVector()).length(); +template void Sphere::applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) { + _transformedPosition = (matrix*typename DimensionTraits::PointType(_position)).vector(); + float scaling = (matrix.rotationScaling()*unitVector()).length(); _transformedRadius = scaling*_radius; } diff --git a/src/Physics/Sphere.h b/src/Physics/Sphere.h index 1f96f698a..083fea64e 100644 --- a/src/Physics/Sphere.h +++ b/src/Physics/Sphere.h @@ -43,7 +43,7 @@ template class MAGNUM_PHYSICS_EXPORT Sphere: public Abs return AbstractShape::Type::Sphere; } - void applyTransformation(const typename DimensionTraits::MatrixType& transformation) override; + void applyTransformationMatrix(const typename DimensionTraits::MatrixType& matrix) override; bool collides(const AbstractShape* other) const override; diff --git a/src/Physics/Test/AxisAlignedBoxTest.cpp b/src/Physics/Test/AxisAlignedBoxTest.cpp index da5cd0894..a3b8595d8 100644 --- a/src/Physics/Test/AxisAlignedBoxTest.cpp +++ b/src/Physics/Test/AxisAlignedBoxTest.cpp @@ -30,11 +30,11 @@ AxisAlignedBoxTest::AxisAlignedBoxTest() { void AxisAlignedBoxTest::applyTransformation() { Physics::AxisAlignedBox3D box({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f}); - box.applyTransformation(Matrix4::scaling({2.0f, -1.0f, 1.5f})); + box.applyTransformationMatrix(Matrix4::scaling({2.0f, -1.0f, 1.5f})); CORRADE_COMPARE(box.transformedPosition(), Vector3(-2.0f, 2.0f, -4.5f)); CORRADE_COMPARE(box.transformedSize(), Vector3(2.0f, -2.0f, 4.5f)); - box.applyTransformation(Matrix4::translation(Vector3(1.0f))*Matrix4::rotation(deg(90.0f), Vector3::xAxis())); + box.applyTransformationMatrix(Matrix4::translation(Vector3(1.0f))*Matrix4::rotation(deg(90.0f), Vector3::xAxis())); CORRADE_COMPARE(box.transformedPosition(), Vector3(0.0f, 4.0f, -1.0f)); CORRADE_COMPARE(box.transformedSize(), Vector3(1.0f, -3.0f, 2.0f)); } diff --git a/src/Physics/Test/BoxTest.cpp b/src/Physics/Test/BoxTest.cpp index 32c04ff48..824ce34d9 100644 --- a/src/Physics/Test/BoxTest.cpp +++ b/src/Physics/Test/BoxTest.cpp @@ -29,7 +29,7 @@ BoxTest::BoxTest() { void BoxTest::applyTransformation() { Physics::Box3D box(Matrix4::translation({1.0f, 2.0f, -3.0f})); - box.applyTransformation(Matrix4::scaling({2.0f, -1.0f, 1.5f})); + box.applyTransformationMatrix(Matrix4::scaling({2.0f, -1.0f, 1.5f})); CORRADE_COMPARE(box.transformedTransformation(), Matrix4::scaling({2.0f, -1.0f, 1.5f})*Matrix4::translation({1.0f, 2.0f, -3.0f})); } diff --git a/src/Physics/Test/CapsuleTest.cpp b/src/Physics/Test/CapsuleTest.cpp index 698778a90..04c85235b 100644 --- a/src/Physics/Test/CapsuleTest.cpp +++ b/src/Physics/Test/CapsuleTest.cpp @@ -32,13 +32,13 @@ CapsuleTest::CapsuleTest() { void CapsuleTest::applyTransformation() { Physics::Capsule3D capsule({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}, 7.0f); - capsule.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); + capsule.applyTransformationMatrix(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); CORRADE_COMPARE(capsule.transformedA(), Vector3(-2.0f, 1.0f, 3.0f)); CORRADE_COMPARE(capsule.transformedB(), Vector3(2.0f, -1.0f, -3.0f)); CORRADE_COMPARE(capsule.radius(), 7.0f); /* Apply average scaling to radius */ - capsule.applyTransformation(Matrix4::scaling({Constants::sqrt3(), -Constants::sqrt2(), 2.0f})); + capsule.applyTransformationMatrix(Matrix4::scaling({Constants::sqrt3(), -Constants::sqrt2(), 2.0f})); CORRADE_COMPARE(capsule.transformedRadius(), Constants::sqrt3()*7.0f); } diff --git a/src/Physics/Test/LineTest.cpp b/src/Physics/Test/LineTest.cpp index 2a673d33c..2de48f44a 100644 --- a/src/Physics/Test/LineTest.cpp +++ b/src/Physics/Test/LineTest.cpp @@ -29,7 +29,7 @@ LineTest::LineTest() { void LineTest::applyTransformation() { Physics::Line3D line({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}); - line.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); + line.applyTransformationMatrix(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); CORRADE_COMPARE(line.transformedA(), Vector3(-2.0f, 1.0f, 3.0f)); CORRADE_COMPARE(line.transformedB(), Vector3(2.0f, -1.0f, -3.0f)); } diff --git a/src/Physics/Test/PlaneTest.cpp b/src/Physics/Test/PlaneTest.cpp index 294032de7..2ec0ab9d0 100644 --- a/src/Physics/Test/PlaneTest.cpp +++ b/src/Physics/Test/PlaneTest.cpp @@ -33,12 +33,12 @@ PlaneTest::PlaneTest() { void PlaneTest::applyTransformation() { Physics::Plane plane({1.0f, 2.0f, 3.0f}, {Constants::sqrt2(), -Constants::sqrt2(), 0}); - plane.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::xAxis())); + plane.applyTransformationMatrix(Matrix4::rotation(deg(90.0f), Vector3::xAxis())); CORRADE_COMPARE(plane.transformedPosition(), Vector3(1.0f, -3.0f, 2.0f)); CORRADE_COMPARE(plane.transformedNormal(), Vector3(Constants::sqrt2(), 0, -Constants::sqrt2())); /* The normal should stay normalized */ - plane.applyTransformation(Matrix4::scaling({1.5f, 2.0f, 3.0f})); + plane.applyTransformationMatrix(Matrix4::scaling({1.5f, 2.0f, 3.0f})); CORRADE_COMPARE(plane.transformedPosition(), Vector3(1.5f, 4.0f, 9.0f)); CORRADE_COMPARE(plane.transformedNormal(), Vector3(Constants::sqrt2(), -Constants::sqrt2(), 0)); } diff --git a/src/Physics/Test/PointTest.cpp b/src/Physics/Test/PointTest.cpp index f6e47e785..25c36bf53 100644 --- a/src/Physics/Test/PointTest.cpp +++ b/src/Physics/Test/PointTest.cpp @@ -28,7 +28,7 @@ PointTest::PointTest() { void PointTest::applyTransformation() { Physics::Point3D point({1.0f, 2.0f, 3.0f}); - point.applyTransformation(Matrix4::translation({5.0f, 6.0f, 7.0f})); + point.applyTransformationMatrix(Matrix4::translation({5.0f, 6.0f, 7.0f})); CORRADE_COMPARE(point.transformedPosition(), Vector3(6.0f, 8.0f, 10.0f)); } diff --git a/src/Physics/Test/ShapeGroupTest.cpp b/src/Physics/Test/ShapeGroupTest.cpp index 4270fd4be..249dc8dd7 100644 --- a/src/Physics/Test/ShapeGroupTest.cpp +++ b/src/Physics/Test/ShapeGroupTest.cpp @@ -41,7 +41,7 @@ void ShapeGroupTest::copy() { } /* Just to test that it doesn't crash */ - group.applyTransformation(Matrix4::translation(Vector3::xAxis(1.0f))); + group.applyTransformationMatrix(Matrix4::translation(Vector3::xAxis(1.0f))); CORRADE_VERIFY(true); } @@ -52,7 +52,7 @@ void ShapeGroupTest::reference() { ShapeGroup3D group = !(ref(point) || ref(segment)); - group.applyTransformation(Matrix4::translation(Vector3(1.0f))); + group.applyTransformationMatrix(Matrix4::translation(Vector3(1.0f))); CORRADE_VERIFY((point.transformedPosition() == Vector3(2.0f, 3.0f, 4.0f))); CORRADE_VERIFY((segment.transformedA() == Vector3(3.0f, 2.0f, 31.0f))); diff --git a/src/Physics/Test/ShapeTestBase.h b/src/Physics/Test/ShapeTestBase.h index d5503bc65..099fb20c0 100644 --- a/src/Physics/Test/ShapeTestBase.h +++ b/src/Physics/Test/ShapeTestBase.h @@ -25,7 +25,7 @@ namespace Magnum { namespace Physics { namespace Test { class ShapeTestBase { protected: template void randomTransformation(T& shape) { - shape.applyTransformation(Matrix4::translation({7.0f, 8.0f, -9.0f})); + shape.applyTransformationMatrix(Matrix4::translation({7.0f, 8.0f, -9.0f})); } }; diff --git a/src/Physics/Test/SphereTest.cpp b/src/Physics/Test/SphereTest.cpp index f845b942e..3b8414e79 100644 --- a/src/Physics/Test/SphereTest.cpp +++ b/src/Physics/Test/SphereTest.cpp @@ -35,17 +35,17 @@ SphereTest::SphereTest() { void SphereTest::applyTransformation() { Physics::Sphere3D sphere({1.0f, 2.0f, 3.0f}, 7.0f); - sphere.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::yAxis())); + sphere.applyTransformationMatrix(Matrix4::rotation(deg(90.0f), Vector3::yAxis())); CORRADE_COMPARE(sphere.transformedPosition(), Vector3(3.0f, 2.0f, -1.0f)); CORRADE_COMPARE(sphere.transformedRadius(), 7.0f); /* Symmetric scaling */ - sphere.applyTransformation(Matrix4::scaling(Vector3(2.0f))); + sphere.applyTransformationMatrix(Matrix4::scaling(Vector3(2.0f))); CORRADE_COMPARE(sphere.transformedPosition(), Vector3(2.0f, 4.0f, 6.0f)); CORRADE_COMPARE(sphere.transformedRadius(), 14.0f); /* Apply average scaling to radius */ - sphere.applyTransformation(Matrix4::scaling({Constants::sqrt3(), -Constants::sqrt2(), 2.0f})); + sphere.applyTransformationMatrix(Matrix4::scaling({Constants::sqrt3(), -Constants::sqrt2(), 2.0f})); CORRADE_COMPARE(sphere.transformedRadius(), Constants::sqrt3()*7.0f); } diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index dae625e54..e5a3793f6 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -141,8 +141,8 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature::MatrixType& invertedAbsoluteTransformation) override { - _cameraMatrix = invertedAbsoluteTransformation; + inline void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformationMatrix) override { + _cameraMatrix = invertedAbsoluteTransformationMatrix; } #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index f48b88034..9e29b77a6 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -72,8 +72,8 @@ class CachingFeature: public SceneGraph::AbstractFeature3D<> { } protected: - void clean(const Matrix4& absoluteTransformation) override { - absolutePosition = absoluteTransformation.translation(); + void clean(const Matrix4& absoluteTransformationMatrix) override { + absolutePosition = absoluteTransformationMatrix.translation(); } private: @@ -258,7 +258,7 @@ template class AbstractFeature * Default implementation does nothing. * @see @ref scenegraph-caching, cleanInverted() */ - virtual void clean(const typename DimensionTraits::MatrixType& absoluteTransformation); + virtual void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix); /** * @brief Clean data based on inverted absolute transformation @@ -272,7 +272,7 @@ template class AbstractFeature * Default implementation does nothing. * @see @ref scenegraph-caching, clean() */ - virtual void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformation); + virtual void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformationMatrix); /*@}*/ diff --git a/src/Shaders/FlatShader.cpp b/src/Shaders/FlatShader.cpp index 78ad7a450..d232e342b 100644 --- a/src/Shaders/FlatShader.cpp +++ b/src/Shaders/FlatShader.cpp @@ -65,7 +65,7 @@ template FlatShader::FlatShader() { link(); - transformationProjectionUniform = uniformLocation("transformationProjection"); + transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); colorUniform = uniformLocation("color"); } diff --git a/src/Shaders/FlatShader.h b/src/Shaders/FlatShader.h index 3467666ad..e8787cdd4 100644 --- a/src/Shaders/FlatShader.h +++ b/src/Shaders/FlatShader.h @@ -46,8 +46,8 @@ template class MAGNUM_SHADERS_EXPORT FlatShader: public * @brief Set transformation and projection matrix * @return Pointer to self (for method chaining) */ - FlatShader* setTransformationProjection(const typename DimensionTraits::MatrixType& matrix) { - setUniform(transformationProjectionUniform, matrix); + FlatShader* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + setUniform(transformationProjectionMatrixUniform, matrix); return this; } @@ -61,7 +61,7 @@ template class MAGNUM_SHADERS_EXPORT FlatShader: public } private: - GLint transformationProjectionUniform, + GLint transformationProjectionMatrixUniform, colorUniform; }; diff --git a/src/Shaders/FlatShader2D.vert b/src/Shaders/FlatShader2D.vert index dc702bf98..78d041e8d 100644 --- a/src/Shaders/FlatShader2D.vert +++ b/src/Shaders/FlatShader2D.vert @@ -2,7 +2,7 @@ #define in attribute #endif -uniform highp mat3 transformationProjection; +uniform highp mat3 transformationProjectionMatrix; #ifdef EXPLICIT_ATTRIB_LOCATION layout(location = 0) in highp vec3 position; @@ -11,5 +11,5 @@ in highp vec3 position; #endif void main() { - gl_Position.xywz = vec4(transformationProjection*position, 0.0); + gl_Position.xywz = vec4(transformationProjectionMatrix*position, 0.0); } diff --git a/src/Shaders/PhongShader.h b/src/Shaders/PhongShader.h index 14d4dd970..6be38d84c 100644 --- a/src/Shaders/PhongShader.h +++ b/src/Shaders/PhongShader.h @@ -84,10 +84,10 @@ class MAGNUM_SHADERS_EXPORT PhongShader: public AbstractShaderProgram { } /** - * @brief Set transformation matrix and normal matrix + * @brief Set transformation and normal matrix * @return Pointer to self (for method chaining) */ - inline PhongShader* setTransformation(const Matrix4& matrix) { + inline PhongShader* setTransformationMatrix(const Matrix4& matrix) { setUniform(transformationMatrixUniform, matrix); setUniform(normalMatrixUniform, matrix.rotation()); return this; @@ -97,7 +97,7 @@ class MAGNUM_SHADERS_EXPORT PhongShader: public AbstractShaderProgram { * @brief Set projection matrix * @return Pointer to self (for method chaining) */ - inline PhongShader* setProjection(const Matrix4& matrix) { + inline PhongShader* setProjectionMatrix(const Matrix4& matrix) { setUniform(projectionMatrixUniform, matrix); return this; } diff --git a/src/Shaders/VertexColorShader.cpp b/src/Shaders/VertexColorShader.cpp index bb6305b4d..5313da38c 100644 --- a/src/Shaders/VertexColorShader.cpp +++ b/src/Shaders/VertexColorShader.cpp @@ -66,7 +66,7 @@ template VertexColorShader::VertexColorShad link(); - transformationProjectionUniform = uniformLocation("transformationProjection"); + transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); } template class VertexColorShader<2>; diff --git a/src/Shaders/VertexColorShader.h b/src/Shaders/VertexColorShader.h index 35cd3377f..896fefdc6 100644 --- a/src/Shaders/VertexColorShader.h +++ b/src/Shaders/VertexColorShader.h @@ -46,16 +46,16 @@ template class MAGNUM_SHADERS_EXPORT VertexColorShader: VertexColorShader(); /** - * @brief Set transformation and projection + * @brief Set transformation and projection matrix * @return Pointer to self (for method chaining) */ - inline VertexColorShader* setTransformationProjection(const typename DimensionTraits::MatrixType& matrix) { - setUniform(transformationProjectionUniform, matrix); + inline VertexColorShader* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + setUniform(transformationProjectionMatrixUniform, matrix); return this; } private: - GLint transformationProjectionUniform; + GLint transformationProjectionMatrixUniform; }; /** @brief 2D vertex color shader */ diff --git a/src/Shaders/VertexColorShader2D.vert b/src/Shaders/VertexColorShader2D.vert index 12be1d046..88c8fc9a5 100644 --- a/src/Shaders/VertexColorShader2D.vert +++ b/src/Shaders/VertexColorShader2D.vert @@ -3,7 +3,7 @@ #define out varying #endif -uniform highp mat3 transformationProjection; +uniform highp mat3 transformationProjectionMatrix; #ifdef EXPLICIT_ATTRIB_LOCATION layout(location = 0) in highp vec3 position; @@ -16,6 +16,6 @@ in lowp vec3 color; out lowp vec3 interpolatedColor; void main() { - gl_Position.xywz = vec4(transformationProjection*position, 0.0); + gl_Position.xywz = vec4(transformationProjectionMatrix*position, 0.0); interpolatedColor = color; }