diff --git a/src/DebugTools/ForceRenderer.cpp b/src/DebugTools/ForceRenderer.cpp index 800b0747b..5ee1f2179 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/DebugTools/ForceRenderer.cpp @@ -94,8 +94,8 @@ template ForceRenderer::ForceRenderer(SceneG ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { - shader->setTransformationProjectionMatrix(camera->projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), *force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) +template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { + shader->setTransformationProjectionMatrix(camera->projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), *force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) ->setColor(options->color()) ->use(); mesh->draw(); diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.h b/src/DebugTools/Implementation/AbstractShapeRenderer.h index bbc96185b..837724f70 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.h +++ b/src/DebugTools/Implementation/AbstractShapeRenderer.h @@ -49,7 +49,7 @@ template class AbstractShapeRenderer { AbstractShapeRenderer(ResourceKey mesh, ResourceKey vertexBuffer, ResourceKey indexBuffer); virtual ~AbstractShapeRenderer(); - virtual void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) = 0; + virtual void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) = 0; protected: /* Call only if the mesh resource isn't already present */ diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index faaf5cb5c..60bd5a346 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -33,10 +33,10 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template AxisAlignedBoxRenderer::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape* axisAlignedBox): axisAlignedBox(static_cast>*>(axisAlignedBox)->shape) {} -template void AxisAlignedBoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void AxisAlignedBoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* - DimensionTraits::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) + DimensionTraits::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* + DimensionTraits::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) ->setColor(options->color()) ->use(); this->wireframeMesh->draw(); diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h index 2af4617cd..b50cb5777 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h @@ -36,7 +36,7 @@ template class AxisAlignedBoxRenderer: public AbstractBo public: AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape* axisAlignedBox); - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; private: const Shapes::AxisAlignedBox& axisAlignedBox; diff --git a/src/DebugTools/Implementation/BoxRenderer.cpp b/src/DebugTools/Implementation/BoxRenderer.cpp index 87b64ae26..c1e443315 100644 --- a/src/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/DebugTools/Implementation/BoxRenderer.cpp @@ -33,7 +33,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template BoxRenderer::BoxRenderer(const Shapes::Implementation::AbstractShape* box): box(static_cast>*>(box)->shape) {} -template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) ->setColor(options->color()) ->use(); diff --git a/src/DebugTools/Implementation/BoxRenderer.h b/src/DebugTools/Implementation/BoxRenderer.h index 20afc7ee9..c027ae6d8 100644 --- a/src/DebugTools/Implementation/BoxRenderer.h +++ b/src/DebugTools/Implementation/BoxRenderer.h @@ -36,7 +36,7 @@ template class BoxRenderer: public AbstractBoxRenderer* box); - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; private: const Shapes::Box& box; diff --git a/src/DebugTools/Implementation/ForceRendererTransformation.h b/src/DebugTools/Implementation/ForceRendererTransformation.h index 13cf870e7..83879104c 100644 --- a/src/DebugTools/Implementation/ForceRendererTransformation.h +++ b/src/DebugTools/Implementation/ForceRendererTransformation.h @@ -31,7 +31,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template typename DimensionTraits::MatrixType forceRendererTransformation(const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force); +template typename DimensionTraits::MatrixType forceRendererTransformation(const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force); template<> inline Matrix3 forceRendererTransformation<2>(const Vector2& forcePosition, const Vector2& force) { return Matrix3::from({force, Vector2(-force.y(), force.x())}, forcePosition); diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/DebugTools/Implementation/LineSegmentRenderer.cpp index 4436c3064..b5527d016 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -54,7 +54,7 @@ template LineSegmentRenderer::LineSegmentRen if(!this->wireframeMesh) this->createResources(meshData()); } -template void LineSegmentRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void LineSegmentRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* Implementation::lineSegmentRendererTransformation(line.a(), line.b())) ->setColor(options->color()) diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.h b/src/DebugTools/Implementation/LineSegmentRenderer.h index 550557dc9..946870cc2 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.h +++ b/src/DebugTools/Implementation/LineSegmentRenderer.h @@ -36,7 +36,7 @@ template class LineSegmentRenderer: public AbstractShape public: LineSegmentRenderer(const Shapes::Implementation::AbstractShape* line); - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; private: const Shapes::LineSegment& line; diff --git a/src/DebugTools/Implementation/LineSegmentRendererTransformation.h b/src/DebugTools/Implementation/LineSegmentRendererTransformation.h index fc94a1bfe..4d0927cd6 100644 --- a/src/DebugTools/Implementation/LineSegmentRendererTransformation.h +++ b/src/DebugTools/Implementation/LineSegmentRendererTransformation.h @@ -28,8 +28,8 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template typename DimensionTraits::MatrixType lineSegmentRendererTransformation(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b) { - auto transformation = DimensionTraits::MatrixType::translation(a); +template typename DimensionTraits::MatrixType lineSegmentRendererTransformation(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b) { + auto transformation = DimensionTraits::MatrixType::translation(a); transformation.right() = b - a; return transformation; } diff --git a/src/DebugTools/Implementation/PointRenderer.cpp b/src/DebugTools/Implementation/PointRenderer.cpp index 7827ca856..6e7ab84e7 100644 --- a/src/DebugTools/Implementation/PointRenderer.cpp +++ b/src/DebugTools/Implementation/PointRenderer.cpp @@ -52,11 +52,11 @@ template PointRenderer::PointRenderer(const if(!this->wireframeMesh) this->createResources(meshData()); } -template void PointRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void PointRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { /* Half scale, because the point is 2x2(x2) */ this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation(point.position())* - DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->pointSize()/2))) + DimensionTraits::MatrixType::translation(point.position())* + DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->pointSize()/2))) ->setColor(options->color()) ->use(); this->wireframeMesh->draw(); diff --git a/src/DebugTools/Implementation/PointRenderer.h b/src/DebugTools/Implementation/PointRenderer.h index a017c1649..2b194e663 100644 --- a/src/DebugTools/Implementation/PointRenderer.h +++ b/src/DebugTools/Implementation/PointRenderer.h @@ -36,7 +36,7 @@ template class PointRenderer: public AbstractShapeRender public: PointRenderer(const Shapes::Implementation::AbstractShape* point); - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; private: const Shapes::Point& point; diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/DebugTools/Implementation/SphereRenderer.cpp index 3649d05b0..6452e9e8e 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/DebugTools/Implementation/SphereRenderer.cpp @@ -39,10 +39,10 @@ AbstractSphereRenderer<2>::AbstractSphereRenderer(): AbstractShapeRenderer<2>("s template SphereRenderer::SphereRenderer(const Shapes::Implementation::AbstractShape* sphere): sphere(static_cast>*>(sphere)->shape) {} -template void SphereRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void SphereRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation(sphere.position())* - DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(sphere.radius()))) + DimensionTraits::MatrixType::translation(sphere.position())* + DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(sphere.radius()))) ->setColor(options->color()) ->use(); this->wireframeMesh->draw(); diff --git a/src/DebugTools/Implementation/SphereRenderer.h b/src/DebugTools/Implementation/SphereRenderer.h index 3c1a89649..15d12048c 100644 --- a/src/DebugTools/Implementation/SphereRenderer.h +++ b/src/DebugTools/Implementation/SphereRenderer.h @@ -43,7 +43,7 @@ template class SphereRenderer: public AbstractSphereRend public: SphereRenderer(const Shapes::Implementation::AbstractShape* sphere); - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; private: const Shapes::Sphere& sphere; diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/DebugTools/ObjectRenderer.cpp index 96461e6a9..94194bc4c 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/DebugTools/ObjectRenderer.cpp @@ -173,8 +173,8 @@ template ObjectRenderer::ObjectRenderer(Scen ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { - shader->setTransformationProjectionMatrix(camera->projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) +template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { + shader->setTransformationProjectionMatrix(camera->projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) ->use(); mesh->draw(); diff --git a/src/DebugTools/ShapeRenderer.cpp b/src/DebugTools/ShapeRenderer.cpp index a15ae1d3c..d1843d0d1 100644 --- a/src/DebugTools/ShapeRenderer.cpp +++ b/src/DebugTools/ShapeRenderer.cpp @@ -102,8 +102,8 @@ template ShapeRenderer::~ShapeRenderer() { for(auto i: renderers) delete i; } -template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractBasicCamera* camera) { - typename DimensionTraits::MatrixType projectionMatrix = camera->projectionMatrix()*camera->cameraMatrix(); +template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractBasicCamera* camera) { + typename DimensionTraits::MatrixType projectionMatrix = camera->projectionMatrix()*camera->cameraMatrix(); for(auto i: renderers) i->draw(options, projectionMatrix); } diff --git a/src/DimensionTraits.h b/src/DimensionTraits.h index d729aca74..6ca6df1ad 100644 --- a/src/DimensionTraits.h +++ b/src/DimensionTraits.h @@ -33,8 +33,8 @@ namespace Magnum { -/** @brief Matrix, point and vector specializations for given dimension count */ -template struct DimensionTraits { +/** @brief Matrix and vector specializations for given dimension count */ +template struct DimensionTraits { DimensionTraits() = delete; #ifdef DOXYGEN_GENERATING_OUTPUT diff --git a/src/Shaders/AbstractVector.h b/src/Shaders/AbstractVector.h index 1337e7ae0..2d23586e4 100644 --- a/src/Shaders/AbstractVector.h +++ b/src/Shaders/AbstractVector.h @@ -42,7 +42,7 @@ namespace Magnum { namespace Shaders { template class AbstractVector: public AbstractShaderProgram { public: /** @brief Vertex position */ - typedef Attribute<0, typename DimensionTraits::VectorType> Position; + typedef Attribute<0, typename DimensionTraits::VectorType> Position; /** @brief Texture coordinates */ typedef Attribute<1, Vector2> TextureCoordinates; diff --git a/src/Shaders/DistanceFieldVector.h b/src/Shaders/DistanceFieldVector.h index 50ad57051..8d5319deb 100644 --- a/src/Shaders/DistanceFieldVector.h +++ b/src/Shaders/DistanceFieldVector.h @@ -52,7 +52,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector DistanceFieldVector(); /** @brief Set transformation and projection matrix */ - DistanceFieldVector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + DistanceFieldVector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); return this; } diff --git a/src/Shaders/Flat.h b/src/Shaders/Flat.h index 69e9cccf0..582378a76 100644 --- a/src/Shaders/Flat.h +++ b/src/Shaders/Flat.h @@ -47,7 +47,7 @@ Draws whole mesh with one color. template class MAGNUM_SHADERS_EXPORT Flat: public AbstractShaderProgram { public: /** @brief Vertex position */ - typedef Attribute<0, typename DimensionTraits::VectorType> Position; + typedef Attribute<0, typename DimensionTraits::VectorType> Position; explicit Flat(); @@ -55,7 +55,7 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra * @brief Set transformation and projection matrix * @return Pointer to self (for method chaining) */ - Flat* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Flat* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); return this; } diff --git a/src/Shaders/Vector.h b/src/Shaders/Vector.h index f4d7e61c2..f33bf468c 100644 --- a/src/Shaders/Vector.h +++ b/src/Shaders/Vector.h @@ -51,7 +51,7 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst * @brief Set transformation and projection matrix * @return Pointer to self (for method chaining) */ - Vector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Vector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); return this; } diff --git a/src/Shaders/VertexColor.h b/src/Shaders/VertexColor.h index d50eea060..d19cc87c9 100644 --- a/src/Shaders/VertexColor.h +++ b/src/Shaders/VertexColor.h @@ -47,7 +47,7 @@ Draws vertex-colored mesh. template class MAGNUM_SHADERS_EXPORT VertexColor: public AbstractShaderProgram { public: /** @brief Vertex position */ - typedef Attribute<0, typename DimensionTraits::VectorType> Position; + typedef Attribute<0, typename DimensionTraits::VectorType> Position; /** @brief Vertex color */ typedef Attribute<1, Color3> Color; @@ -60,7 +60,7 @@ template class MAGNUM_SHADERS_EXPORT VertexColor: public * * Default is identity matrix. */ - VertexColor* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + VertexColor* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); return this; } diff --git a/src/Shapes/AxisAlignedBox.cpp b/src/Shapes/AxisAlignedBox.cpp index d5474755f..75c7df465 100644 --- a/src/Shapes/AxisAlignedBox.cpp +++ b/src/Shapes/AxisAlignedBox.cpp @@ -30,7 +30,7 @@ namespace Magnum { namespace Shapes { -template AxisAlignedBox AxisAlignedBox::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template AxisAlignedBox AxisAlignedBox::transformed(const typename DimensionTraits::MatrixType& matrix) const { return AxisAlignedBox(matrix.transformPoint(_min), matrix.transformPoint(_max)); } diff --git a/src/Shapes/AxisAlignedBox.h b/src/Shapes/AxisAlignedBox.h index b65f89e98..750689828 100644 --- a/src/Shapes/AxisAlignedBox.h +++ b/src/Shapes/AxisAlignedBox.h @@ -56,28 +56,28 @@ template class MAGNUM_SHAPES_EXPORT AxisAlignedBox { constexpr /*implicit*/ AxisAlignedBox() {} /** @brief Constructor */ - constexpr /*implicit*/ AxisAlignedBox(const typename DimensionTraits::VectorType& min, const typename DimensionTraits::VectorType& max): _min(min), _max(max) {} + constexpr /*implicit*/ AxisAlignedBox(const typename DimensionTraits::VectorType& min, const typename DimensionTraits::VectorType& max): _min(min), _max(max) {} /** @brief Transformed shape */ - AxisAlignedBox transformed(const typename DimensionTraits::MatrixType& matrix) const; + AxisAlignedBox transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Minimal coordinates */ - constexpr typename DimensionTraits::VectorType min() const { + constexpr typename DimensionTraits::VectorType min() const { return _min; } /** @brief Set minimal coordinates */ - void setMin(const typename DimensionTraits::VectorType& min) { + void setMin(const typename DimensionTraits::VectorType& min) { _min = min; } /** @brief Maximal coordinates */ - constexpr typename DimensionTraits::VectorType max() const { + constexpr typename DimensionTraits::VectorType max() const { return _max; } /** @brief Set maximal coordinates */ - void setMax(const typename DimensionTraits::VectorType& max) { + void setMax(const typename DimensionTraits::VectorType& max) { _max = max; } @@ -85,7 +85,7 @@ template class MAGNUM_SHAPES_EXPORT AxisAlignedBox { bool operator%(const Point& other) const; private: - typename DimensionTraits::VectorType _min, _max; + typename DimensionTraits::VectorType _min, _max; }; /** @brief Two-dimensional axis-aligned box */ diff --git a/src/Shapes/Box.cpp b/src/Shapes/Box.cpp index 6282784ee..202344c1c 100644 --- a/src/Shapes/Box.cpp +++ b/src/Shapes/Box.cpp @@ -26,7 +26,7 @@ namespace Magnum { namespace Shapes { -template Box Box::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Box Box::transformed(const typename DimensionTraits::MatrixType& matrix) const { return Box(matrix*_transformation); } diff --git a/src/Shapes/Box.h b/src/Shapes/Box.h index 22750192d..f7abec1d2 100644 --- a/src/Shapes/Box.h +++ b/src/Shapes/Box.h @@ -55,26 +55,26 @@ template class MAGNUM_SHAPES_EXPORT Box { * * Creates zero-sized box positioned at origin. */ - constexpr /*implicit*/ Box(): _transformation(DimensionTraits::MatrixType::Zero) {} + constexpr /*implicit*/ Box(): _transformation(DimensionTraits::MatrixType::Zero) {} /** @brief Constructor */ - constexpr /*implicit*/ Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation) {} + constexpr /*implicit*/ Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation) {} /** @brief Transformed shape */ - Box transformed(const typename DimensionTraits::MatrixType& matrix) const; + Box transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Transformation */ - constexpr typename DimensionTraits::MatrixType transformation() const { + constexpr typename DimensionTraits::MatrixType transformation() const { return _transformation; } /** @brief Set transformation */ - void setTransformation(const typename DimensionTraits::MatrixType& transformation) { + void setTransformation(const typename DimensionTraits::MatrixType& transformation) { _transformation = transformation; } private: - typename DimensionTraits::MatrixType _transformation; + typename DimensionTraits::MatrixType _transformation; }; /** @brief Two-dimensional box */ diff --git a/src/Shapes/Capsule.cpp b/src/Shapes/Capsule.cpp index 69c543ec9..497696d09 100644 --- a/src/Shapes/Capsule.cpp +++ b/src/Shapes/Capsule.cpp @@ -36,9 +36,9 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Shapes { -template Capsule Capsule::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Capsule Capsule::transformed(const typename DimensionTraits::MatrixType& matrix) const { return Capsule(matrix.transformPoint(_a), matrix.transformPoint(_b), - (matrix.rotationScaling()*typename DimensionTraits::VectorType(1/Constants::sqrt3())).length()*_radius); + (matrix.rotationScaling()*typename DimensionTraits::VectorType(1/Constants::sqrt3())).length()*_radius); } template bool Capsule::operator%(const Point& other) const { diff --git a/src/Shapes/Capsule.h b/src/Shapes/Capsule.h index 4eb91869d..2d85ddd97 100644 --- a/src/Shapes/Capsule.h +++ b/src/Shapes/Capsule.h @@ -58,28 +58,28 @@ template class MAGNUM_SHAPES_EXPORT Capsule { constexpr /*implicit*/ Capsule(): _radius(0.0f) {} /** @brief Constructor */ - constexpr /*implicit*/ Capsule(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius): _a(a), _b(b), _radius(radius) {} + constexpr /*implicit*/ Capsule(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius): _a(a), _b(b), _radius(radius) {} /** @brief Transformed shape */ - Capsule transformed(const typename DimensionTraits::MatrixType& matrix) const; + Capsule transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Start point */ - constexpr typename DimensionTraits::VectorType a() const { + constexpr typename DimensionTraits::VectorType a() const { return _a; } /** @brief Set start point */ - void setA(const typename DimensionTraits::VectorType& a) { + void setA(const typename DimensionTraits::VectorType& a) { _a = a; } /** @brief End point */ - constexpr typename DimensionTraits::VectorType b() const { + constexpr typename DimensionTraits::VectorType b() const { return _b; } /** @brief Set end point */ - void setB(const typename DimensionTraits::VectorType& b) { + void setB(const typename DimensionTraits::VectorType& b) { _b = b; } @@ -96,7 +96,7 @@ template class MAGNUM_SHAPES_EXPORT Capsule { bool operator%(const Sphere& other) const; private: - typename DimensionTraits::VectorType _a, _b; + typename DimensionTraits::VectorType _a, _b; Float _radius; }; diff --git a/src/Shapes/Composition.cpp b/src/Shapes/Composition.cpp index 3bc721b73..9f4fc5707 100644 --- a/src/Shapes/Composition.cpp +++ b/src/Shapes/Composition.cpp @@ -125,7 +125,7 @@ template void Composition::copyNodes(std::si std::copy(other._nodes, other._nodes+other._nodeCount, _nodes+offset); } -template Composition Composition::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Composition Composition::transformed(const typename DimensionTraits::MatrixType& matrix) const { Composition out(*this); for(std::size_t i = 0; i != _shapeCount; ++i) _shapes[i]->transform(matrix, out._shapes[i]); diff --git a/src/Shapes/Composition.h b/src/Shapes/Composition.h index 6f6abdbf6..c2530c1fc 100644 --- a/src/Shapes/Composition.h +++ b/src/Shapes/Composition.h @@ -125,7 +125,7 @@ template class MAGNUM_SHAPES_EXPORT Composition { Composition& operator=(Composition&& other); /** @brief Transformed shape */ - Composition transformed(const typename DimensionTraits::MatrixType& matrix) const; + Composition transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Count of shapes in the hierarchy */ std::size_t size() const { return _shapeCount; } diff --git a/src/Shapes/Line.cpp b/src/Shapes/Line.cpp index abbdb5d9a..9a39dbf94 100644 --- a/src/Shapes/Line.cpp +++ b/src/Shapes/Line.cpp @@ -29,7 +29,7 @@ namespace Magnum { namespace Shapes { -template Line Line::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Line Line::transformed(const typename DimensionTraits::MatrixType& matrix) const { return Line(matrix.transformPoint(_a), matrix.transformPoint(_b)); } diff --git a/src/Shapes/Line.h b/src/Shapes/Line.h index eb9f5afba..f908860fc 100644 --- a/src/Shapes/Line.h +++ b/src/Shapes/Line.h @@ -55,33 +55,33 @@ template class MAGNUM_SHAPES_EXPORT Line { constexpr /*implicit*/ Line() {} /** @brief Constructor */ - constexpr /*implicit*/ Line(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): _a(a), _b(b) {} + constexpr /*implicit*/ Line(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): _a(a), _b(b) {} /** @brief Transformed shape */ - Line transformed(const typename DimensionTraits::MatrixType& matrix) const; + Line transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief First point */ - constexpr typename DimensionTraits::VectorType a() const { + constexpr typename DimensionTraits::VectorType a() const { return _a; } /** @brief Set first point */ - void setA(const typename DimensionTraits::VectorType& a) { + void setA(const typename DimensionTraits::VectorType& a) { _a = a; } /** @brief Second point */ - constexpr typename DimensionTraits::VectorType b() const { + constexpr typename DimensionTraits::VectorType b() const { return _b; } /** @brief Set second point */ - void setB(const typename DimensionTraits::VectorType& b) { + void setB(const typename DimensionTraits::VectorType& b) { _b = b; } private: - typename DimensionTraits::VectorType _a, _b; + typename DimensionTraits::VectorType _a, _b; }; /** @brief Infinite two-dimensional line */ diff --git a/src/Shapes/LineSegment.h b/src/Shapes/LineSegment.h index a79bc0d4d..ee0f22dbc 100644 --- a/src/Shapes/LineSegment.h +++ b/src/Shapes/LineSegment.h @@ -48,10 +48,10 @@ template class LineSegment: public Line { constexpr /*implicit*/ LineSegment() {} /** @brief Constructor */ - constexpr /*implicit*/ LineSegment(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): Line(a, b) {} + constexpr /*implicit*/ LineSegment(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): Line(a, b) {} /** @brief Transformed shape */ - LineSegment transformed(const typename DimensionTraits::MatrixType& matrix) const { + LineSegment transformed(const typename DimensionTraits::MatrixType& matrix) const { return Line::transformed(matrix); } diff --git a/src/Shapes/Point.cpp b/src/Shapes/Point.cpp index 5631e1137..4badc0565 100644 --- a/src/Shapes/Point.cpp +++ b/src/Shapes/Point.cpp @@ -29,7 +29,7 @@ namespace Magnum { namespace Shapes { -template Point Point::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Point Point::transformed(const typename DimensionTraits::MatrixType& matrix) const { return Point(matrix.transformPoint(_position)); } diff --git a/src/Shapes/Point.h b/src/Shapes/Point.h index a03a2c676..47cdb89e0 100644 --- a/src/Shapes/Point.h +++ b/src/Shapes/Point.h @@ -54,23 +54,23 @@ template class MAGNUM_SHAPES_EXPORT Point { constexpr /*implicit*/ Point() {} /** @brief Constructor */ - constexpr /*implicit*/ Point(const typename DimensionTraits::VectorType& position): _position(position) {} + constexpr /*implicit*/ Point(const typename DimensionTraits::VectorType& position): _position(position) {} /** @brief Transformed shape */ - Point transformed(const typename DimensionTraits::MatrixType& matrix) const; + Point transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Position */ - constexpr typename DimensionTraits::VectorType position() const { + constexpr typename DimensionTraits::VectorType position() const { return _position; } /** @brief Set position */ - void setPosition(const typename DimensionTraits::VectorType& position) { + void setPosition(const typename DimensionTraits::VectorType& position) { _position = position; } private: - typename DimensionTraits::VectorType _position; + typename DimensionTraits::VectorType _position; }; /** @brief Two-dimensional point */ diff --git a/src/Shapes/Shape.cpp b/src/Shapes/Shape.cpp index ed8d477a2..a302db9aa 100644 --- a/src/Shapes/Shape.cpp +++ b/src/Shapes/Shape.cpp @@ -36,7 +36,7 @@ template void ShapeHelper>::set( shape._transformedShape.shape = shape._shape.shape = std::move(composition); } -template void ShapeHelper>::transform(Shapes::Shape>& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { +template void ShapeHelper>::transform(Shapes::Shape>& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { CORRADE_INTERNAL_ASSERT(shape._shape.shape.size() == shape._transformedShape.shape.size()); for(std::size_t i = 0; i != shape.shape().size(); ++i) shape._shape.shape._shapes[i]->transform(absoluteTransformationMatrix, shape._transformedShape.shape._shapes[i]); diff --git a/src/Shapes/Shape.h b/src/Shapes/Shape.h index c42e91099..7d1774f91 100644 --- a/src/Shapes/Shape.h +++ b/src/Shapes/Shape.h @@ -107,7 +107,7 @@ template class MAGNUM_SHAPES_EXPORT Shape: public AbstractShape::MatrixType& absoluteTransformationMatrix) override; + void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) override; private: const Implementation::AbstractShape* abstractTransformedShape() const override { @@ -128,7 +128,7 @@ template inline const T& Shape::transformedShape() { return _transformedShape.shape; } -template void Shape::clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { +template void Shape::clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { Implementation::ShapeHelper::transform(*this, absoluteTransformationMatrix); } @@ -138,7 +138,7 @@ namespace Implementation { shape._shape.shape = s; } - static void transform(Shapes::Shape& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { + static void transform(Shapes::Shape& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { shape._transformedShape.shape = shape._shape.shape.transformed(absoluteTransformationMatrix); } }; @@ -147,7 +147,7 @@ namespace Implementation { static void set(Shapes::Shape>& shape, const Composition& composition); static void set(Shapes::Shape>& shape, Composition&& composition); - static void transform(Shapes::Shape>& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix); + static void transform(Shapes::Shape>& shape, const typename DimensionTraits::MatrixType& absoluteTransformationMatrix); }; } diff --git a/src/Shapes/Sphere.cpp b/src/Shapes/Sphere.cpp index 154641c09..f1af70317 100644 --- a/src/Shapes/Sphere.cpp +++ b/src/Shapes/Sphere.cpp @@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Shapes { namespace { - template static typename DimensionTraits::VectorType unitVector(); + template static typename DimensionTraits::VectorType unitVector(); template<> inline Vector2 unitVector<2>() { return Vector2(1/Constants::sqrt2()); @@ -48,7 +48,7 @@ namespace { } } -template Sphere Sphere::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Sphere Sphere::transformed(const typename DimensionTraits::MatrixType& matrix) const { return Sphere(matrix.transformPoint(_position), (matrix.rotationScaling()*unitVector()).length()*_radius); } diff --git a/src/Shapes/Sphere.h b/src/Shapes/Sphere.h index d9792109b..c100f90b3 100644 --- a/src/Shapes/Sphere.h +++ b/src/Shapes/Sphere.h @@ -58,18 +58,18 @@ template class MAGNUM_SHAPES_EXPORT Sphere { constexpr /*implicit*/ Sphere(): _radius(0.0f) {} /** @brief Constructor */ - constexpr /*implicit*/ Sphere(const typename DimensionTraits::VectorType& position, Float radius): _position(position), _radius(radius) {} + constexpr /*implicit*/ Sphere(const typename DimensionTraits::VectorType& position, Float radius): _position(position), _radius(radius) {} /** @brief Transformed shape */ - Sphere transformed(const typename DimensionTraits::MatrixType& matrix) const; + Sphere transformed(const typename DimensionTraits::MatrixType& matrix) const; /** @brief Position */ - constexpr typename DimensionTraits::VectorType position() const { + constexpr typename DimensionTraits::VectorType position() const { return _position; } /** @brief Set position */ - void setPosition(const typename DimensionTraits::VectorType& position) { + void setPosition(const typename DimensionTraits::VectorType& position) { _position = position; } @@ -92,7 +92,7 @@ template class MAGNUM_SHAPES_EXPORT Sphere { bool operator%(const Sphere& other) const; private: - typename DimensionTraits::VectorType _position; + typename DimensionTraits::VectorType _position; Float _radius; }; diff --git a/src/Shapes/shapeImplementation.h b/src/Shapes/shapeImplementation.h index 0731cfad0..ecf028570 100644 --- a/src/Shapes/shapeImplementation.h +++ b/src/Shapes/shapeImplementation.h @@ -126,7 +126,7 @@ template struct MAGNUM_SHAPES_EXPORT AbstractShape { virtual typename ShapeDimensionTraits::Type MAGNUM_SHAPES_LOCAL type() const = 0; virtual AbstractShape MAGNUM_SHAPES_LOCAL * clone() const = 0; - virtual void MAGNUM_SHAPES_LOCAL transform(const typename DimensionTraits::MatrixType& matrix, AbstractShape* result) const = 0; + virtual void MAGNUM_SHAPES_LOCAL transform(const typename DimensionTraits::MatrixType& matrix, AbstractShape* result) const = 0; }; template struct Shape: AbstractShape { @@ -144,7 +144,7 @@ template struct Shape: AbstractShape { return new Shape(shape); } - void transform(const typename DimensionTraits::MatrixType& matrix, AbstractShape* result) const override { + void transform(const typename DimensionTraits::MatrixType& matrix, AbstractShape* result) const override { CORRADE_INTERNAL_ASSERT(result->type() == type()); static_cast*>(result)->shape = shape.transformed(matrix); }