From 757ca6d1ad0d89bfeab93e4bbe8357f8e78396ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 24 May 2014 17:57:58 +0200 Subject: [PATCH] Use VectorTypeFor and MatrixTypeFor instead of DimensionTraits. Much shorter lines. I like that. --- src/Magnum/BufferImage.cpp | 4 +-- src/Magnum/BufferImage.h | 14 +++++----- src/Magnum/DebugTools/ForceRenderer.cpp | 6 ++--- src/Magnum/DebugTools/ForceRenderer.h | 10 +++---- .../Implementation/AbstractShapeRenderer.h | 2 +- .../Implementation/AxisAlignedBoxRenderer.cpp | 6 ++--- .../Implementation/AxisAlignedBoxRenderer.h | 2 +- .../DebugTools/Implementation/BoxRenderer.cpp | 2 +- .../DebugTools/Implementation/BoxRenderer.h | 2 +- .../Implementation/CapsuleRenderer.cpp | 4 +-- .../Implementation/CapsuleRenderer.h | 2 +- .../CapsuleRendererTransformation.h | 2 +- .../Implementation/CylinderRenderer.cpp | 2 +- .../Implementation/CylinderRenderer.h | 2 +- .../CylinderRendererTransformation.h | 2 +- .../ForceRendererTransformation.h | 2 +- .../Implementation/LineSegmentRenderer.cpp | 2 +- .../Implementation/LineSegmentRenderer.h | 2 +- .../LineSegmentRendererTransformation.h | 4 +-- .../Implementation/PointRenderer.cpp | 6 ++--- .../DebugTools/Implementation/PointRenderer.h | 2 +- .../Implementation/SphereRenderer.cpp | 6 ++--- .../Implementation/SphereRenderer.h | 2 +- src/Magnum/DebugTools/ObjectRenderer.cpp | 4 +-- src/Magnum/DebugTools/ObjectRenderer.h | 2 +- src/Magnum/DebugTools/ShapeRenderer.cpp | 4 +-- src/Magnum/DebugTools/ShapeRenderer.h | 2 +- src/Magnum/Image.cpp | 2 +- src/Magnum/Image.h | 8 +++--- src/Magnum/ImageReference.h | 8 +++--- src/Magnum/MultisampleTexture.h | 10 +++---- src/Magnum/SceneGraph/AbstractCamera.h | 14 +++++----- src/Magnum/SceneGraph/AbstractCamera.hpp | 4 +-- src/Magnum/SceneGraph/AbstractFeature.h | 4 +-- src/Magnum/SceneGraph/AbstractFeature.hpp | 4 +-- src/Magnum/SceneGraph/AbstractObject.h | 2 +- src/Magnum/SceneGraph/AbstractTranslation.h | 4 +-- src/Magnum/SceneGraph/Drawable.h | 2 +- src/Magnum/SceneGraph/Object.h | 2 +- .../SceneGraph/TranslationTransformation.h | 26 +++++++++---------- src/Magnum/Shaders/DistanceFieldVector.h | 2 +- src/Magnum/Shaders/Flat.h | 2 +- src/Magnum/Shaders/Vector.h | 2 +- src/Magnum/Shaders/VertexColor.cpp | 2 +- src/Magnum/Shaders/VertexColor.h | 2 +- src/Magnum/Shapes/AxisAlignedBox.cpp | 2 +- src/Magnum/Shapes/AxisAlignedBox.h | 14 +++++----- src/Magnum/Shapes/Box.cpp | 2 +- src/Magnum/Shapes/Box.h | 12 ++++----- src/Magnum/Shapes/Capsule.cpp | 2 +- src/Magnum/Shapes/Capsule.h | 14 +++++----- src/Magnum/Shapes/Collision.h | 10 +++---- src/Magnum/Shapes/Composition.cpp | 2 +- src/Magnum/Shapes/Composition.h | 2 +- src/Magnum/Shapes/Cylinder.cpp | 2 +- src/Magnum/Shapes/Cylinder.h | 14 +++++----- src/Magnum/Shapes/Line.cpp | 2 +- src/Magnum/Shapes/Line.h | 14 +++++----- src/Magnum/Shapes/LineSegment.h | 4 +-- src/Magnum/Shapes/Point.cpp | 2 +- src/Magnum/Shapes/Point.h | 10 +++---- src/Magnum/Shapes/Shape.cpp | 2 +- src/Magnum/Shapes/Shape.h | 8 +++--- src/Magnum/Shapes/Sphere.cpp | 22 ++++++++-------- src/Magnum/Shapes/Sphere.h | 14 +++++----- src/Magnum/Shapes/shapeImplementation.h | 4 +-- src/Magnum/Texture.cpp | 4 +-- src/Magnum/Texture.h | 16 ++++++------ src/Magnum/TextureArray.cpp | 2 +- src/Magnum/TextureArray.h | 14 +++++----- src/Magnum/Trade/ImageData.h | 6 ++--- 71 files changed, 200 insertions(+), 200 deletions(-) diff --git a/src/Magnum/BufferImage.cpp b/src/Magnum/BufferImage.cpp index 08c6fb1ae..38fa069a2 100644 --- a/src/Magnum/BufferImage.cpp +++ b/src/Magnum/BufferImage.cpp @@ -28,13 +28,13 @@ namespace Magnum { #ifndef MAGNUM_TARGET_GLES2 -template BufferImage::BufferImage(ColorFormat format, ColorType type, const typename DimensionTraits< Dimensions, Int >::VectorType& size, const void* data, BufferUsage usage): AbstractImage(format, type), _size(size), _buffer(Buffer::Target::PixelPack) { +template BufferImage::BufferImage(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage): AbstractImage(format, type), _size(size), _buffer(Buffer::Target::PixelPack) { _buffer.setData({data, dataSize(size)}, usage); } template BufferImage::BufferImage(ColorFormat format, ColorType type): AbstractImage(format, type), _buffer(Buffer::Target::PixelPack) {} -template void BufferImage::setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage) { +template void BufferImage::setData(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage) { _format = format; _type = type; _size = size; diff --git a/src/Magnum/BufferImage.h b/src/Magnum/BufferImage.h index 6715d579f..1acaf1679 100644 --- a/src/Magnum/BufferImage.h +++ b/src/Magnum/BufferImage.h @@ -64,7 +64,7 @@ template class BufferImage: public AbstractImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - explicit BufferImage(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage); + explicit BufferImage(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage); /** * @brief Constructor @@ -89,10 +89,10 @@ template class BufferImage: public AbstractImage { BufferImage& operator=(BufferImage&& other) noexcept; /** @brief %Image size */ - typename DimensionTraits::VectorType size() const { return _size; } + VectorTypeFor size() const { return _size; } /** @copydoc Image::dataSize() */ - std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + std::size_t dataSize(const VectorTypeFor& size) const { return AbstractImage::dataSize(size); } @@ -113,14 +113,14 @@ template class BufferImage: public AbstractImage { * @todo Make it more flexible (usable with * @extension{ARB,buffer_storage}, avoiding relocations...) */ - void setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage); + void setData(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data, BufferUsage usage); #ifdef MAGNUM_BUILD_DEPRECATED /** - * @copybrief setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage) - * @deprecated Use @ref Magnum::BufferImage::setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage) "setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage)" instead. + * @copybrief setData(ColorFormat, ColorType, const VectorTypeFor&, const void*, BufferUsage) + * @deprecated Use @ref Magnum::BufferImage::setData(ColorFormat, ColorType, const VectorTypeFor&, const void*, BufferUsage) "setData(ColorFormat, ColorType, const VectorTypeFor&, const void*, BufferUsage)" instead. */ - CORRADE_DEPRECATED("use setData(ColorFormat, ColorType, VectorNi, const void*, BufferUsage) instead") void setData(const typename DimensionTraits::VectorType& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage) { + CORRADE_DEPRECATED("use setData(ColorFormat, ColorType, VectorNi, const void*, BufferUsage) instead") void setData(const VectorTypeFor& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage) { setData(format, type, size, data, usage); } #endif diff --git a/src/Magnum/DebugTools/ForceRenderer.cpp b/src/Magnum/DebugTools/ForceRenderer.cpp index 8b5b40e77..a713fdc70 100644 --- a/src/Magnum/DebugTools/ForceRenderer.cpp +++ b/src/Magnum/DebugTools/ForceRenderer.cpp @@ -56,7 +56,7 @@ constexpr std::array indices{{ } -template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject& object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance().get(options)) { +template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject& object, const VectorTypeFor& forcePosition, const VectorTypeFor& force, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance().get(options)) { /* Shader */ shader = ResourceManager::instance().get>(shaderKey()); if(!shader) ResourceManager::instance().set(shader.key(), new Shaders::Flat); @@ -86,8 +86,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::AbstractCamera& camera) { - shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) +template void ForceRenderer::draw(const MatrixTypeFor& transformationMatrix, SceneGraph::AbstractCamera& camera) { + shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), force)*MatrixTypeFor::scaling(VectorTypeFor{options->scale()})) .setColor(options->color()); mesh->draw(*shader); } diff --git a/src/Magnum/DebugTools/ForceRenderer.h b/src/Magnum/DebugTools/ForceRenderer.h index 80c97837a..72de1a0c2 100644 --- a/src/Magnum/DebugTools/ForceRenderer.h +++ b/src/Magnum/DebugTools/ForceRenderer.h @@ -117,16 +117,16 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p * saved as reference to original vector and thus it must be available * for the whole lifetime of the renderer. */ - explicit ForceRenderer(SceneGraph::AbstractObject& object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + explicit ForceRenderer(SceneGraph::AbstractObject& object, const VectorTypeFor& forcePosition, const VectorTypeFor& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); /** @overload */ - ForceRenderer(SceneGraph::AbstractObject&, const typename DimensionTraits::VectorType&, typename DimensionTraits::VectorType&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup* = nullptr) = delete; + ForceRenderer(SceneGraph::AbstractObject&, const VectorTypeFor&, VectorTypeFor&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup* = nullptr) = delete; private: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; + void draw(const MatrixTypeFor& transformationMatrix, SceneGraph::AbstractCamera& camera) override; - const typename DimensionTraits::VectorType forcePosition; - const typename DimensionTraits::VectorType& force; + const VectorTypeFor forcePosition; + const VectorTypeFor& force; Resource options; Resource> shader; diff --git a/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h index 361bc4461..554235b51 100644 --- a/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h +++ b/src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h @@ -50,7 +50,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 MatrixTypeFor& projectionMatrix) = 0; protected: /* Call only if the mesh resource isn't already present */ diff --git a/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index 33e014ca5..664822559 100644 --- a/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -34,10 +34,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 MatrixTypeFor& projectionMatrix) { AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* - DimensionTraits::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) + MatrixTypeFor::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* + MatrixTypeFor::scaling(axisAlignedBox.max()-axisAlignedBox.min())) .setColor(options->color()); AbstractBoxRenderer::wireframeMesh->draw(*AbstractBoxRenderer::wireframeShader); } diff --git a/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h index df337caf2..e5ca939f7 100644 --- a/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h +++ b/src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h @@ -36,7 +36,7 @@ template class AxisAlignedBoxRenderer: public AbstractBo explicit AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape& axisAlignedBox); AxisAlignedBoxRenderer(Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::AxisAlignedBox& axisAlignedBox; diff --git a/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp b/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp index e070188c9..9e1351958 100644 --- a/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/BoxRenderer.cpp @@ -34,7 +34,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 MatrixTypeFor& projectionMatrix) { AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) .setColor(options->color()); AbstractBoxRenderer::wireframeMesh->draw(*AbstractBoxRenderer::wireframeShader); diff --git a/src/Magnum/DebugTools/Implementation/BoxRenderer.h b/src/Magnum/DebugTools/Implementation/BoxRenderer.h index 5e59912ac..044054dcd 100644 --- a/src/Magnum/DebugTools/Implementation/BoxRenderer.h +++ b/src/Magnum/DebugTools/Implementation/BoxRenderer.h @@ -36,7 +36,7 @@ template class BoxRenderer: public AbstractBoxRenderer& box); BoxRenderer(const Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::Box& box; diff --git a/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp index 5c359e593..e6f50f598 100644 --- a/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp @@ -104,8 +104,8 @@ AbstractCapsuleRenderer<3>::~AbstractCapsuleRenderer() = default; template CapsuleRenderer::CapsuleRenderer(const Shapes::Implementation::AbstractShape& capsule): capsule(static_cast>&>(capsule).shape) {} -template void CapsuleRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { - std::array::MatrixType, 3> transformations = Implementation::capsuleRendererTransformation(capsule.a(), capsule.b(), capsule.radius()); +template void CapsuleRenderer::draw(Resource& options, const MatrixTypeFor& projectionMatrix) { + std::array, 3> transformations = Implementation::capsuleRendererTransformation(capsule.a(), capsule.b(), capsule.radius()); AbstractShapeRenderer::wireframeShader->setColor(options->color()); /* Bottom */ diff --git a/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h index 53dd86fb5..8c8cab49c 100644 --- a/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h +++ b/src/Magnum/DebugTools/Implementation/CapsuleRenderer.h @@ -56,7 +56,7 @@ template class CapsuleRenderer: public AbstractCapsuleRe explicit CapsuleRenderer(const Shapes::Implementation::AbstractShape& capsule); CapsuleRenderer(const Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::Capsule& capsule; diff --git a/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h b/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h index eeb1d8e8e..53e612b43 100644 --- a/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h @@ -35,7 +35,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template std::array::MatrixType, 3> capsuleRendererTransformation(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius); +template std::array, 3> capsuleRendererTransformation(const VectorTypeFor& a, const VectorTypeFor& b, Float radius); template<> std::array capsuleRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) { /* Vector from capsule center to top hemisphere center */ diff --git a/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp b/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp index 20f3e1798..9cdc57ab6 100644 --- a/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp @@ -48,7 +48,7 @@ AbstractCylinderRenderer<3>::AbstractCylinderRenderer(): AbstractShapeRenderer<3 template CylinderRenderer::CylinderRenderer(const Shapes::Implementation::AbstractShape& cylinder): cylinder(static_cast>&>(cylinder).shape) {} -template void CylinderRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void CylinderRenderer::draw(Resource& options, const MatrixTypeFor& projectionMatrix) { AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* Implementation::cylinderRendererTransformation(cylinder.a(), cylinder.b(), cylinder.radius())) .setColor(options->color()); diff --git a/src/Magnum/DebugTools/Implementation/CylinderRenderer.h b/src/Magnum/DebugTools/Implementation/CylinderRenderer.h index 581410c4b..0d1b81a37 100644 --- a/src/Magnum/DebugTools/Implementation/CylinderRenderer.h +++ b/src/Magnum/DebugTools/Implementation/CylinderRenderer.h @@ -48,7 +48,7 @@ template class CylinderRenderer: public AbstractCylinder explicit CylinderRenderer(const Shapes::Implementation::AbstractShape& cylinder); CylinderRenderer(const Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::Cylinder& cylinder; diff --git a/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h b/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h index 2f21dc130..851d3f2a0 100644 --- a/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h @@ -33,7 +33,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template typename DimensionTraits::MatrixType cylinderRendererTransformation(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius); +template MatrixTypeFor cylinderRendererTransformation(const VectorTypeFor& a, const VectorTypeFor& b, Float radius); template<> Matrix3 cylinderRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) { /* Vector from cylinder center to top hemisphere center */ diff --git a/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h index bef0566be..2a8535ec5 100644 --- a/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h @@ -33,7 +33,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template typename DimensionTraits::MatrixType forceRendererTransformation(const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force); +template MatrixTypeFor forceRendererTransformation(const VectorTypeFor& forcePosition, const VectorTypeFor& force); template<> inline Matrix3 forceRendererTransformation<2>(const Vector2& forcePosition, const Vector2& force) { return Matrix3::from({force, force.perpendicular()}, forcePosition); diff --git a/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp index 956bbae84..32cd8ef95 100644 --- a/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -55,7 +55,7 @@ template LineSegmentRenderer::LineSegmentRen if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } -template void LineSegmentRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void LineSegmentRenderer::draw(Resource& options, const MatrixTypeFor& projectionMatrix) { AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* Implementation::lineSegmentRendererTransformation(line.a(), line.b())) .setColor(options->color()); diff --git a/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h index 7017ecefa..612709ef6 100644 --- a/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h @@ -36,7 +36,7 @@ template class LineSegmentRenderer: public AbstractShape explicit LineSegmentRenderer(const Shapes::Implementation::AbstractShape& line); LineSegmentRenderer(const Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::LineSegment& line; diff --git a/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h b/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h index e18403986..8c32b9fbe 100644 --- a/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h +++ b/src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h @@ -29,8 +29,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 MatrixTypeFor lineSegmentRendererTransformation(const VectorTypeFor& a, const VectorTypeFor& b) { + auto transformation = MatrixTypeFor::translation(a); transformation.right() = b - a; return transformation; } diff --git a/src/Magnum/DebugTools/Implementation/PointRenderer.cpp b/src/Magnum/DebugTools/Implementation/PointRenderer.cpp index 29614f3da..26a186b55 100644 --- a/src/Magnum/DebugTools/Implementation/PointRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/PointRenderer.cpp @@ -53,11 +53,11 @@ template PointRenderer::PointRenderer(const if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } -template void PointRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { +template void PointRenderer::draw(Resource& options, const MatrixTypeFor& projectionMatrix) { /* Half scale, because the point is 2x2(x2) */ AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation(point.position())* - DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->pointSize()/2))) + MatrixTypeFor::translation(point.position())* + MatrixTypeFor::scaling(VectorTypeFor{options->pointSize()/2})) .setColor(options->color()); AbstractShapeRenderer::wireframeMesh->draw(*AbstractShapeRenderer::wireframeShader); } diff --git a/src/Magnum/DebugTools/Implementation/PointRenderer.h b/src/Magnum/DebugTools/Implementation/PointRenderer.h index 38c6f2a8f..21e510c7b 100644 --- a/src/Magnum/DebugTools/Implementation/PointRenderer.h +++ b/src/Magnum/DebugTools/Implementation/PointRenderer.h @@ -36,7 +36,7 @@ template class PointRenderer: public AbstractShapeRender explicit PointRenderer(const Shapes::Implementation::AbstractShape& point); PointRenderer(Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::Point& point; diff --git a/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp b/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp index dbdf66ab4..229a39894 100644 --- a/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/Magnum/DebugTools/Implementation/SphereRenderer.cpp @@ -46,10 +46,10 @@ AbstractSphereRenderer<3>::AbstractSphereRenderer(): AbstractShapeRenderer<3>("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 MatrixTypeFor& projectionMatrix) { AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* - DimensionTraits::MatrixType::translation(sphere.position())* - DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(sphere.radius()))) + MatrixTypeFor::translation(sphere.position())* + MatrixTypeFor::scaling(VectorTypeFor{sphere.radius()})) .setColor(options->color()); AbstractShapeRenderer::wireframeMesh->draw(*AbstractShapeRenderer::wireframeShader); } diff --git a/src/Magnum/DebugTools/Implementation/SphereRenderer.h b/src/Magnum/DebugTools/Implementation/SphereRenderer.h index e82ba874e..a9e16754e 100644 --- a/src/Magnum/DebugTools/Implementation/SphereRenderer.h +++ b/src/Magnum/DebugTools/Implementation/SphereRenderer.h @@ -48,7 +48,7 @@ template class SphereRenderer: public AbstractSphereRend explicit SphereRenderer(const Shapes::Implementation::AbstractShape& sphere); SphereRenderer(const Shapes::Implementation::AbstractShape&&) = delete; - void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; + void draw(Resource& options, const MatrixTypeFor& projectionMatrix) override; private: const Shapes::Sphere& sphere; diff --git a/src/Magnum/DebugTools/ObjectRenderer.cpp b/src/Magnum/DebugTools/ObjectRenderer.cpp index ee3da5fce..02e9257f4 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.cpp +++ b/src/Magnum/DebugTools/ObjectRenderer.cpp @@ -175,8 +175,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::AbstractCamera& camera) { - shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))); +template void ObjectRenderer::draw(const MatrixTypeFor& transformationMatrix, SceneGraph::AbstractCamera& camera) { + shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*MatrixTypeFor::scaling(VectorTypeFor{options->size()})); mesh->draw(*shader); } diff --git a/src/Magnum/DebugTools/ObjectRenderer.h b/src/Magnum/DebugTools/ObjectRenderer.h index 70371d95f..e9d22c906 100644 --- a/src/Magnum/DebugTools/ObjectRenderer.h +++ b/src/Magnum/DebugTools/ObjectRenderer.h @@ -98,7 +98,7 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: explicit ObjectRenderer(SceneGraph::AbstractObject& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); private: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; + void draw(const MatrixTypeFor& transformationMatrix, SceneGraph::AbstractCamera& camera) override; Resource options; Resource> shader; diff --git a/src/Magnum/DebugTools/ShapeRenderer.cpp b/src/Magnum/DebugTools/ShapeRenderer.cpp index 70ba2d8a1..6d4e595af 100644 --- a/src/Magnum/DebugTools/ShapeRenderer.cpp +++ b/src/Magnum/DebugTools/ShapeRenderer.cpp @@ -122,8 +122,8 @@ template ShapeRenderer::~ShapeRenderer() { for(auto i: renderers) delete i; } -template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractCamera& camera) { - typename DimensionTraits::MatrixType projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix(); +template void ShapeRenderer::draw(const MatrixTypeFor&, SceneGraph::AbstractCamera& camera) { + const MatrixTypeFor projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix(); for(auto i: renderers) i->draw(options, projectionMatrix); } diff --git a/src/Magnum/DebugTools/ShapeRenderer.h b/src/Magnum/DebugTools/ShapeRenderer.h index 4c8aa875a..27cc1df29 100644 --- a/src/Magnum/DebugTools/ShapeRenderer.h +++ b/src/Magnum/DebugTools/ShapeRenderer.h @@ -160,7 +160,7 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p ~ShapeRenderer(); private: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; + void draw(const MatrixTypeFor& transformationMatrix, SceneGraph::AbstractCamera& camera) override; Resource options; std::vector*> renderers; diff --git a/src/Magnum/Image.cpp b/src/Magnum/Image.cpp index 72ac20ccc..26146b5b8 100644 --- a/src/Magnum/Image.cpp +++ b/src/Magnum/Image.cpp @@ -27,7 +27,7 @@ namespace Magnum { -template void Image::setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, void* data) { +template void Image::setData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data) { delete[] _data; _format = format; _type = type; diff --git a/src/Magnum/Image.h b/src/Magnum/Image.h index 7a7d0d4d5..7741113c4 100644 --- a/src/Magnum/Image.h +++ b/src/Magnum/Image.h @@ -54,7 +54,7 @@ template class Image: public AbstractImage { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - explicit Image(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} + explicit Image(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} /** * @brief Constructor @@ -95,7 +95,7 @@ template class Image: public AbstractImage { #endif /** @brief %Image size */ - typename DimensionTraits::VectorType size() const { return _size; } + VectorTypeFor size() const { return _size; } /** * @brief Size of data required to store image of given size @@ -104,7 +104,7 @@ template class Image: public AbstractImage { * account. * @see @ref pixelSize() */ - std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + std::size_t dataSize(const VectorTypeFor& size) const { return AbstractImage::dataSize(size); } @@ -133,7 +133,7 @@ template class Image: public AbstractImage { * data are not copied, but they are deleted on destruction. * @see @ref release() */ - void setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, void* data); + void setData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data); /** * @brief Release data storage diff --git a/src/Magnum/ImageReference.h b/src/Magnum/ImageReference.h index d2cef6001..8ab4054d5 100644 --- a/src/Magnum/ImageReference.h +++ b/src/Magnum/ImageReference.h @@ -61,7 +61,7 @@ template class ImageReference: public AbstractImage { * @param size %Image size * @param data %Image data */ - constexpr explicit ImageReference(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} + constexpr explicit ImageReference(ColorFormat format, ColorType type, const VectorTypeFor& size, const void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} /** * @brief Constructor @@ -72,13 +72,13 @@ template class ImageReference: public AbstractImage { * Data pointer is set to `nullptr`, call @ref setData() to fill the * image with data. */ - constexpr explicit ImageReference(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size): AbstractImage(format, type), _size(size), _data(nullptr) {} + constexpr explicit ImageReference(ColorFormat format, ColorType type, const VectorTypeFor& size): AbstractImage(format, type), _size(size), _data(nullptr) {} /** @brief %Image size */ - constexpr typename DimensionTraits::VectorType size() const { return _size; } + constexpr VectorTypeFor size() const { return _size; } /** @copydoc Image::dataSize() */ - std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + std::size_t dataSize(const VectorTypeFor& size) const { return AbstractImage::dataSize(size); } diff --git a/src/Magnum/MultisampleTexture.h b/src/Magnum/MultisampleTexture.h index 34148aeff..dfee8ffb5 100644 --- a/src/Magnum/MultisampleTexture.h +++ b/src/Magnum/MultisampleTexture.h @@ -43,7 +43,7 @@ namespace Implementation { template<> inline constexpr GLenum multisampleTextureTarget<2>() { return GL_TEXTURE_2D_MULTISAMPLE; } template<> inline constexpr GLenum multisampleTextureTarget<3>() { return GL_TEXTURE_2D_MULTISAMPLE_ARRAY; } - template typename DimensionTraits::VectorType maxMultisampleTextureSize(); + template VectorTypeFor maxMultisampleTextureSize(); template<> MAGNUM_EXPORT Vector2i maxMultisampleTextureSize<2>(); template<> MAGNUM_EXPORT Vector3i maxMultisampleTextureSize<3>(); } @@ -98,7 +98,7 @@ template class MultisampleTexture: public AbstractTextur * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and * @def_gl{MAX_3D_TEXTURE_SIZE} */ - static typename DimensionTraits::VectorType maxSize() { + static VectorTypeFor maxSize() { return Implementation::maxMultisampleTextureSize(); } @@ -122,7 +122,7 @@ template class MultisampleTexture: public AbstractTextur * with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or * @def_gl{TEXTURE_DEPTH} */ - typename DimensionTraits::VectorType imageSize() { + VectorTypeFor imageSize() { return DataHelper::imageSize(*this, _target, 0); } @@ -155,7 +155,7 @@ template class MultisampleTexture: public AbstractTextur /* The default parameter value was chosen based on discussion in ARB_texture_multisample specs (fixed locations is treated as the special case) */ - MultisampleTexture& setStorage(Int samples, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size, MultisampleTextureSampleLocations sampleLocations = + MultisampleTexture& setStorage(Int samples, TextureFormat internalFormat, const VectorTypeFor& size, MultisampleTextureSampleLocations sampleLocations = #ifndef DOXYGEN_GENERATING_OUTPUT MultisampleTextureSampleLocations::NotFixed #else @@ -170,7 +170,7 @@ template class MultisampleTexture: public AbstractTextur void invalidateImage() { AbstractTexture::invalidateImage(0); } /** @copydoc RectangleTexture::invalidateSubImage() */ - void invalidateSubImage(const typename DimensionTraits::VectorType& offset, const typename DimensionTraits::VectorType& size) { + void invalidateSubImage(const VectorTypeFor& offset, const VectorTypeFor& size) { DataHelper::invalidateSubImage(*this, 0, offset, size); } diff --git a/src/Magnum/SceneGraph/AbstractCamera.h b/src/Magnum/SceneGraph/AbstractCamera.h index 19c7477d2..fc2e01e4c 100644 --- a/src/Magnum/SceneGraph/AbstractCamera.h +++ b/src/Magnum/SceneGraph/AbstractCamera.h @@ -48,7 +48,7 @@ enum class AspectRatioPolicy: UnsignedByte { }; namespace Implementation { - template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport); + template MatrixTypeFor aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport); } /** @@ -90,7 +90,7 @@ template class AbstractCamera: public AbstractF * Camera matrix describes world position relative to the camera and is * applied as first. */ - typename DimensionTraits::MatrixType cameraMatrix() { + MatrixTypeFor cameraMatrix() { AbstractFeature::object().setClean(); return _cameraMatrix; } @@ -102,7 +102,7 @@ template class AbstractCamera: public AbstractF * as last. * @see @ref projectionSize() */ - typename DimensionTraits::MatrixType projectionMatrix() const { return _projectionMatrix; } + MatrixTypeFor projectionMatrix() const { return _projectionMatrix; } /** * @brief Size of (near) XY plane in current projection @@ -143,7 +143,7 @@ template class AbstractCamera: public AbstractF ~AbstractCamera(); /** Recalculates camera matrix */ - void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformationMatrix) override { + void cleanInverted(const MatrixTypeFor& invertedAbsoluteTransformationMatrix) override { _cameraMatrix = invertedAbsoluteTransformationMatrix; } @@ -152,13 +152,13 @@ template class AbstractCamera: public AbstractF _projectionMatrix = Implementation::aspectRatioFix(_aspectRatioPolicy, {rawProjectionMatrix[0].x(), rawProjectionMatrix[1].y()}, _viewport)*rawProjectionMatrix; } - typename DimensionTraits::MatrixType rawProjectionMatrix; + MatrixTypeFor rawProjectionMatrix; AspectRatioPolicy _aspectRatioPolicy; #endif private: - typename DimensionTraits::MatrixType _projectionMatrix; - typename DimensionTraits::MatrixType _cameraMatrix; + MatrixTypeFor _projectionMatrix; + MatrixTypeFor _cameraMatrix; Vector2i _viewport; }; diff --git a/src/Magnum/SceneGraph/AbstractCamera.hpp b/src/Magnum/SceneGraph/AbstractCamera.hpp index b3128484a..805aba6ff 100644 --- a/src/Magnum/SceneGraph/AbstractCamera.hpp +++ b/src/Magnum/SceneGraph/AbstractCamera.hpp @@ -51,7 +51,7 @@ template class Camera<3, T> { } }; -template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport) { +template MatrixTypeFor aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport) { /* Don't divide by zero / don't preserve anything */ if(projectionScale.x() == 0 || projectionScale.y() == 0 || viewport.x() == 0 || viewport.y() == 0 || aspectRatioPolicy == AspectRatioPolicy::NotPreserved) return {}; @@ -97,7 +97,7 @@ template void AbstractCamera::dr objects.reserve(group.size()); for(std::size_t i = 0; i != group.size(); ++i) objects.push_back(group[i].object()); - std::vector::MatrixType> transformations = + std::vector> transformations = scene->transformationMatrices(objects, _cameraMatrix); /* Perform the drawing */ diff --git a/src/Magnum/SceneGraph/AbstractFeature.h b/src/Magnum/SceneGraph/AbstractFeature.h index 6a81f36d1..c2c9fe89c 100644 --- a/src/Magnum/SceneGraph/AbstractFeature.h +++ b/src/Magnum/SceneGraph/AbstractFeature.h @@ -270,7 +270,7 @@ template class AbstractFeature * Default implementation does nothing. * @see @ref scenegraph-caching, @ref cleanInverted() */ - virtual void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix); + virtual void clean(const MatrixTypeFor& absoluteTransformationMatrix); /** * @brief Clean data based on inverted absolute transformation @@ -283,7 +283,7 @@ template class AbstractFeature * Default implementation does nothing. * @see @ref scenegraph-caching, @ref clean() */ - virtual void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformationMatrix); + virtual void cleanInverted(const MatrixTypeFor& invertedAbsoluteTransformationMatrix); /*@}*/ diff --git a/src/Magnum/SceneGraph/AbstractFeature.hpp b/src/Magnum/SceneGraph/AbstractFeature.hpp index 1d5b47db8..d6398d41b 100644 --- a/src/Magnum/SceneGraph/AbstractFeature.hpp +++ b/src/Magnum/SceneGraph/AbstractFeature.hpp @@ -41,9 +41,9 @@ template AbstractFeature::~Abstr template void AbstractFeature::markDirty() {} -template void AbstractFeature::clean(const typename DimensionTraits::MatrixType&) {} +template void AbstractFeature::clean(const MatrixTypeFor&) {} -template void AbstractFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} +template void AbstractFeature::cleanInverted(const MatrixTypeFor&) {} }} diff --git a/src/Magnum/SceneGraph/AbstractObject.h b/src/Magnum/SceneGraph/AbstractObject.h index a399f6722..82ad3863c 100644 --- a/src/Magnum/SceneGraph/AbstractObject.h +++ b/src/Magnum/SceneGraph/AbstractObject.h @@ -81,7 +81,7 @@ template class AbstractObject public: /** @brief Matrix type */ - typedef typename DimensionTraits::MatrixType MatrixType; + typedef MatrixTypeFor MatrixType; /** @brief Feature object type */ typedef AbstractFeature FeatureType; diff --git a/src/Magnum/SceneGraph/AbstractTranslation.h b/src/Magnum/SceneGraph/AbstractTranslation.h index 21ee3a297..edd735877 100644 --- a/src/Magnum/SceneGraph/AbstractTranslation.h +++ b/src/Magnum/SceneGraph/AbstractTranslation.h @@ -65,7 +65,7 @@ class AbstractTranslation: public AbstractTransformation { * @ref Math::Vector3::xAxis(), @ref Math::Vector3::yAxis(), * @ref Math::Vector3::zAxis() */ - AbstractTranslation& translate(const typename DimensionTraits::VectorType& vector, TransformationType type = TransformationType::Global) { + AbstractTranslation& translate(const VectorTypeFor& vector, TransformationType type = TransformationType::Global) { doTranslate(vector, type); return *this; } @@ -79,7 +79,7 @@ class AbstractTranslation: public AbstractTransformation { private: #endif /** @brief Polymorphic implementation for @ref translate() */ - virtual void doTranslate(const typename DimensionTraits::VectorType& vector, TransformationType type) = 0; + virtual void doTranslate(const VectorTypeFor& vector, TransformationType type) = 0; }; /** diff --git a/src/Magnum/SceneGraph/Drawable.h b/src/Magnum/SceneGraph/Drawable.h index d900ece41..8f27706a6 100644 --- a/src/Magnum/SceneGraph/Drawable.h +++ b/src/Magnum/SceneGraph/Drawable.h @@ -165,7 +165,7 @@ template class Drawable: public AbstractGrouped * Projection matrix can be retrieved from * @ref SceneGraph::AbstractCamera::projectionMatrix() "AbstractCamera::projectionMatrix()". */ - virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractCamera& camera) = 0; + virtual void draw(const MatrixTypeFor& transformationMatrix, AbstractCamera& camera) = 0; }; /** diff --git a/src/Magnum/SceneGraph/Object.h b/src/Magnum/SceneGraph/Object.h index cfa7d6ddc..929bafb67 100644 --- a/src/Magnum/SceneGraph/Object.h +++ b/src/Magnum/SceneGraph/Object.h @@ -106,7 +106,7 @@ template class Object: public AbstractObject::MatrixType MatrixType; + typedef MatrixTypeFor MatrixType; /** * @brief Constructor diff --git a/src/Magnum/SceneGraph/TranslationTransformation.h b/src/Magnum/SceneGraph/TranslationTransformation.h index b00346950..6e09ccaac 100644 --- a/src/Magnum/SceneGraph/TranslationTransformation.h +++ b/src/Magnum/SceneGraph/TranslationTransformation.h @@ -60,16 +60,16 @@ template class TranslationTransformation: public AbstractTranslation { public: /** @brief Underlying transformation type */ - typedef typename DimensionTraits::VectorType DataType; + typedef VectorTypeFor DataType; /** @brief %Object transformation */ - typename DimensionTraits::VectorType transformation() const { return _transformation; } + VectorTypeFor transformation() const { return _transformation; } /** * @brief Set transformation * @return Reference to self (for method chaining) */ - Object>& setTransformation(const typename DimensionTraits::VectorType& transformation) { + Object>& setTransformation(const VectorTypeFor& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ @@ -94,7 +94,7 @@ class TranslationTransformation: public AbstractTranslation>& transform(const typename DimensionTraits::VectorType& transformation, TransformationType = TransformationType::Global) { + Object>& transform(const VectorTypeFor& transformation, TransformationType = TransformationType::Global) { return translate(transformation); } @@ -107,7 +107,7 @@ class TranslationTransformation: public AbstractTranslation>& translate(const typename DimensionTraits::VectorType& vector, TransformationType = TransformationType::Global) { + Object>& translate(const VectorTypeFor& vector, TransformationType = TransformationType::Global) { _transformation += vector; return static_cast>&>(*this); } @@ -119,11 +119,11 @@ class TranslationTransformation: public AbstractTranslation::VectorType& vector, TransformationType) override final { + void doTranslate(const VectorTypeFor& vector, TransformationType) override final { translate(vector); } - typename DimensionTraits::VectorType _transformation; + VectorTypeFor _transformation; }; /** @@ -171,21 +171,21 @@ typedef BasicTranslationTransformation3D TranslationTransformation3D; namespace Implementation { template struct Transformation> { - static typename DimensionTraits::VectorType fromMatrix(const typename DimensionTraits::MatrixType& matrix) { + static VectorTypeFor fromMatrix(const MatrixTypeFor& matrix) { CORRADE_ASSERT((matrix.rotationScaling() == Math::Matrix()), "SceneGraph::TranslationTransformation: the matrix doesn't represent pure translation", {}); - return typename DimensionTraits::VectorType(matrix.translation()); + return VectorTypeFor{matrix.translation()}; } - constexpr static typename DimensionTraits::MatrixType toMatrix(const typename DimensionTraits::VectorType& transformation) { - return DimensionTraits::MatrixType::translation(typename DimensionTraits::VectorType(transformation)); + constexpr static MatrixTypeFor toMatrix(const VectorTypeFor& transformation) { + return MatrixTypeFor::translation(VectorTypeFor{transformation}); } - static typename DimensionTraits::VectorType compose(const typename DimensionTraits::VectorType& parent, const typename DimensionTraits::VectorType& child) { + static VectorTypeFor compose(const VectorTypeFor& parent, const VectorTypeFor& child) { return parent+child; } - static typename DimensionTraits::VectorType inverted(const typename DimensionTraits::VectorType& transformation) { + static VectorTypeFor inverted(const VectorTypeFor& transformation) { return -transformation; } }; diff --git a/src/Magnum/Shaders/DistanceFieldVector.h b/src/Magnum/Shaders/DistanceFieldVector.h index 9512c212b..ad9986bc5 100644 --- a/src/Magnum/Shaders/DistanceFieldVector.h +++ b/src/Magnum/Shaders/DistanceFieldVector.h @@ -57,7 +57,7 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * @brief Set transformation and projection matrix * @return Reference to self (for method chaining) */ - DistanceFieldVector& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + DistanceFieldVector& setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); return *this; } diff --git a/src/Magnum/Shaders/Flat.h b/src/Magnum/Shaders/Flat.h index f87a56b24..2f8980cb8 100644 --- a/src/Magnum/Shaders/Flat.h +++ b/src/Magnum/Shaders/Flat.h @@ -116,7 +116,7 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra * @brief Set transformation and projection matrix * @return Reference to self (for method chaining) */ - Flat& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Flat& setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); return *this; } diff --git a/src/Magnum/Shaders/Vector.h b/src/Magnum/Shaders/Vector.h index ae73cf8d0..dc8777b06 100644 --- a/src/Magnum/Shaders/Vector.h +++ b/src/Magnum/Shaders/Vector.h @@ -54,7 +54,7 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst * @brief Set transformation and projection matrix * @return Reference to self (for method chaining) */ - Vector& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Vector& setTransformationProjectionMatrix(const MatrixTypeFor& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); return *this; } diff --git a/src/Magnum/Shaders/VertexColor.cpp b/src/Magnum/Shaders/VertexColor.cpp index 178d3bf6f..fe4688f6f 100644 --- a/src/Magnum/Shaders/VertexColor.cpp +++ b/src/Magnum/Shaders/VertexColor.cpp @@ -83,7 +83,7 @@ template VertexColor::VertexColor(): transfo /* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */ #ifdef MAGNUM_TARGET_GLES - setTransformationProjectionMatrix(typename DimensionTraits::MatrixType()); + setTransformationProjectionMatrix(MatrixTypeFor{}); #endif } diff --git a/src/Magnum/Shaders/VertexColor.h b/src/Magnum/Shaders/VertexColor.h index 4cb7cc865..b7b8aafbd 100644 --- a/src/Magnum/Shaders/VertexColor.h +++ b/src/Magnum/Shaders/VertexColor.h @@ -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 MatrixTypeFor& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); return *this; } diff --git a/src/Magnum/Shapes/AxisAlignedBox.cpp b/src/Magnum/Shapes/AxisAlignedBox.cpp index d75d3695d..cf06fb4f4 100644 --- a/src/Magnum/Shapes/AxisAlignedBox.cpp +++ b/src/Magnum/Shapes/AxisAlignedBox.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace Shapes { -template AxisAlignedBox AxisAlignedBox::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template AxisAlignedBox AxisAlignedBox::transformed(const MatrixTypeFor& matrix) const { return AxisAlignedBox(matrix.transformPoint(_min), matrix.transformPoint(_max)); } diff --git a/src/Magnum/Shapes/AxisAlignedBox.h b/src/Magnum/Shapes/AxisAlignedBox.h index bb2d1076e..d92fb9275 100644 --- a/src/Magnum/Shapes/AxisAlignedBox.h +++ b/src/Magnum/Shapes/AxisAlignedBox.h @@ -57,28 +57,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 VectorTypeFor& min, const typename DimensionTraits::VectorType& max): _min(min), _max(max) {} /** @brief Transformed shape */ - AxisAlignedBox transformed(const typename DimensionTraits::MatrixType& matrix) const; + AxisAlignedBox transformed(const MatrixTypeFor& matrix) const; /** @brief Minimal coordinates */ - constexpr typename DimensionTraits::VectorType min() const { + constexpr VectorTypeFor min() const { return _min; } /** @brief Set minimal coordinates */ - void setMin(const typename DimensionTraits::VectorType& min) { + void setMin(const VectorTypeFor& min) { _min = min; } /** @brief Maximal coordinates */ - constexpr typename DimensionTraits::VectorType max() const { + constexpr VectorTypeFor max() const { return _max; } /** @brief Set maximal coordinates */ - void setMax(const typename DimensionTraits::VectorType& max) { + void setMax(const VectorTypeFor& max) { _max = max; } @@ -86,7 +86,7 @@ template class MAGNUM_SHAPES_EXPORT AxisAlignedBox { bool operator%(const Point& other) const; private: - typename DimensionTraits::VectorType _min, _max; + VectorTypeFor _min, _max; }; /** @brief Two-dimensional axis-aligned box */ diff --git a/src/Magnum/Shapes/Box.cpp b/src/Magnum/Shapes/Box.cpp index 13dbaecf2..3363e931b 100644 --- a/src/Magnum/Shapes/Box.cpp +++ b/src/Magnum/Shapes/Box.cpp @@ -27,7 +27,7 @@ namespace Magnum { namespace Shapes { -template Box Box::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Box Box::transformed(const MatrixTypeFor& matrix) const { return Box(matrix*_transformation); } diff --git a/src/Magnum/Shapes/Box.h b/src/Magnum/Shapes/Box.h index e6b785cd6..3f95b7171 100644 --- a/src/Magnum/Shapes/Box.h +++ b/src/Magnum/Shapes/Box.h @@ -56,26 +56,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(MatrixTypeFor::Zero) {} /** @brief Constructor */ - constexpr /*implicit*/ Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation) {} + constexpr /*implicit*/ Box(const MatrixTypeFor& transformation): _transformation(transformation) {} /** @brief Transformed shape */ - Box transformed(const typename DimensionTraits::MatrixType& matrix) const; + Box transformed(const MatrixTypeFor& matrix) const; /** @brief Transformation */ - constexpr typename DimensionTraits::MatrixType transformation() const { + constexpr MatrixTypeFor transformation() const { return _transformation; } /** @brief Set transformation */ - void setTransformation(const typename DimensionTraits::MatrixType& transformation) { + void setTransformation(const MatrixTypeFor& transformation) { _transformation = transformation; } private: - typename DimensionTraits::MatrixType _transformation; + MatrixTypeFor _transformation; }; /** @brief Two-dimensional box */ diff --git a/src/Magnum/Shapes/Capsule.cpp b/src/Magnum/Shapes/Capsule.cpp index 0e95e1843..efb3c4871 100644 --- a/src/Magnum/Shapes/Capsule.cpp +++ b/src/Magnum/Shapes/Capsule.cpp @@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Shapes { -template Capsule Capsule::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Capsule Capsule::transformed(const MatrixTypeFor& matrix) const { return Capsule(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius); } diff --git a/src/Magnum/Shapes/Capsule.h b/src/Magnum/Shapes/Capsule.h index e760327fc..bdc622dcd 100644 --- a/src/Magnum/Shapes/Capsule.h +++ b/src/Magnum/Shapes/Capsule.h @@ -59,28 +59,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 VectorTypeFor& a, const VectorTypeFor& b, Float radius): _a(a), _b(b), _radius(radius) {} /** @brief Transformed shape */ - Capsule transformed(const typename DimensionTraits::MatrixType& matrix) const; + Capsule transformed(const MatrixTypeFor& matrix) const; /** @brief Start point */ - constexpr typename DimensionTraits::VectorType a() const { + constexpr VectorTypeFor a() const { return _a; } /** @brief Set start point */ - void setA(const typename DimensionTraits::VectorType& a) { + void setA(const VectorTypeFor& a) { _a = a; } /** @brief End point */ - constexpr typename DimensionTraits::VectorType b() const { + constexpr VectorTypeFor b() const { return _b; } /** @brief Set end point */ - void setB(const typename DimensionTraits::VectorType& b) { + void setB(const VectorTypeFor& b) { _b = b; } @@ -97,7 +97,7 @@ template class MAGNUM_SHAPES_EXPORT Capsule { bool operator%(const Sphere& other) const; private: - typename DimensionTraits::VectorType _a, _b; + VectorTypeFor _a, _b; Float _radius; }; diff --git a/src/Magnum/Shapes/Collision.h b/src/Magnum/Shapes/Collision.h index 71687ccf0..8fe8e7a78 100644 --- a/src/Magnum/Shapes/Collision.h +++ b/src/Magnum/Shapes/Collision.h @@ -67,7 +67,7 @@ template class Collision { * If separation distance is positive, the separation normal is * expected to be normalized. */ - explicit Collision(typename DimensionTraits::VectorType position, typename DimensionTraits::VectorType separationNormal, Float separationDistance) noexcept: _position(position), _separationNormal(separationNormal), _separationDistance(separationDistance) { + explicit Collision(const VectorTypeFor& position, const VectorTypeFor& separationNormal, Float separationDistance) noexcept: _position(position), _separationNormal(separationNormal), _separationDistance(separationDistance) { CORRADE_ASSERT(_separationDistance < Math::TypeTraits::epsilon() || separationNormal.isNormalized(), "Shapes::Collision::Collision: separation normal is not normalized", ); } @@ -81,7 +81,7 @@ template class Collision { operator bool() const { return _separationDistance > 0.0f; } /** @brief %Collision position */ - typename DimensionTraits::VectorType position() const { + VectorTypeFor position() const { return _position; } @@ -90,7 +90,7 @@ template class Collision { * * @see @ref separationDistance(), @ref flipped() */ - typename DimensionTraits::VectorType separationNormal() const { + VectorTypeFor separationNormal() const { return _separationNormal; } @@ -117,8 +117,8 @@ template class Collision { } private: - typename DimensionTraits::VectorType _position; - typename DimensionTraits::VectorType _separationNormal; + VectorTypeFor _position; + VectorTypeFor _separationNormal; Float _separationDistance; }; diff --git a/src/Magnum/Shapes/Composition.cpp b/src/Magnum/Shapes/Composition.cpp index 06fa29413..6a951a8cb 100644 --- a/src/Magnum/Shapes/Composition.cpp +++ b/src/Magnum/Shapes/Composition.cpp @@ -113,7 +113,7 @@ template void Composition::copyNodes(std::si std::copy(other._nodes.begin(), other._nodes.end(), _nodes.begin()+offset); } -template Composition Composition::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Composition Composition::transformed(const MatrixTypeFor& matrix) const { Composition out(*this); for(Implementation::AbstractShape * const* i = _shapes.begin(), * const* o = out._shapes.begin(); i != _shapes.end(); ++i, ++o) (*i)->transform(matrix, *o); diff --git a/src/Magnum/Shapes/Composition.h b/src/Magnum/Shapes/Composition.h index c22de86fc..90b6dc8cd 100644 --- a/src/Magnum/Shapes/Composition.h +++ b/src/Magnum/Shapes/Composition.h @@ -129,7 +129,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 MatrixTypeFor& matrix) const; /** @brief Count of shapes in the hierarchy */ std::size_t size() const { return _shapes.size(); } diff --git a/src/Magnum/Shapes/Cylinder.cpp b/src/Magnum/Shapes/Cylinder.cpp index aeb4ab640..012b0d192 100644 --- a/src/Magnum/Shapes/Cylinder.cpp +++ b/src/Magnum/Shapes/Cylinder.cpp @@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Shapes { -template Cylinder Cylinder::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Cylinder Cylinder::transformed(const MatrixTypeFor& matrix) const { return Cylinder(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius); } diff --git a/src/Magnum/Shapes/Cylinder.h b/src/Magnum/Shapes/Cylinder.h index 04a311a71..12de64612 100644 --- a/src/Magnum/Shapes/Cylinder.h +++ b/src/Magnum/Shapes/Cylinder.h @@ -59,28 +59,28 @@ template class MAGNUM_SHAPES_EXPORT Cylinder { constexpr /*implicit*/ Cylinder(): _radius(0.0f) {} /** @brief Constructor */ - constexpr /*implicit*/ Cylinder(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, Float radius): _a(a), _b(b), _radius(radius) {} + constexpr /*implicit*/ Cylinder(const VectorTypeFor& a, const VectorTypeFor& b, Float radius): _a(a), _b(b), _radius(radius) {} /** @brief Transformed shape */ - Cylinder transformed(const typename DimensionTraits::MatrixType& matrix) const; + Cylinder transformed(const MatrixTypeFor& matrix) const; /** @brief First point */ - constexpr typename DimensionTraits::VectorType a() const { + constexpr VectorTypeFor a() const { return _a; } /** @brief Set first point */ - void setA(const typename DimensionTraits::VectorType& a) { + void setA(const VectorTypeFor& a) { _a = a; } /** @brief Second point */ - constexpr typename DimensionTraits::VectorType b() const { + constexpr VectorTypeFor b() const { return _b; } /** @brief Set second point */ - void setB(const typename DimensionTraits::VectorType& b) { + void setB(const VectorTypeFor& b) { _b = b; } @@ -97,7 +97,7 @@ template class MAGNUM_SHAPES_EXPORT Cylinder { bool operator%(const Sphere& other) const; private: - typename DimensionTraits::VectorType _a, _b; + VectorTypeFor _a, _b; Float _radius; }; diff --git a/src/Magnum/Shapes/Line.cpp b/src/Magnum/Shapes/Line.cpp index d492ec8b0..9d98db309 100644 --- a/src/Magnum/Shapes/Line.cpp +++ b/src/Magnum/Shapes/Line.cpp @@ -30,7 +30,7 @@ namespace Magnum { namespace Shapes { -template Line Line::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Line Line::transformed(const MatrixTypeFor& matrix) const { return Line(matrix.transformPoint(_a), matrix.transformPoint(_b)); } diff --git a/src/Magnum/Shapes/Line.h b/src/Magnum/Shapes/Line.h index b000a14d5..7ab2c981b 100644 --- a/src/Magnum/Shapes/Line.h +++ b/src/Magnum/Shapes/Line.h @@ -56,33 +56,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 VectorTypeFor& a, const typename DimensionTraits::VectorType& b): _a(a), _b(b) {} /** @brief Transformed shape */ - Line transformed(const typename DimensionTraits::MatrixType& matrix) const; + Line transformed(const MatrixTypeFor& matrix) const; /** @brief First point */ - constexpr typename DimensionTraits::VectorType a() const { + constexpr VectorTypeFor a() const { return _a; } /** @brief Set first point */ - void setA(const typename DimensionTraits::VectorType& a) { + void setA(const VectorTypeFor& a) { _a = a; } /** @brief Second point */ - constexpr typename DimensionTraits::VectorType b() const { + constexpr VectorTypeFor b() const { return _b; } /** @brief Set second point */ - void setB(const typename DimensionTraits::VectorType& b) { + void setB(const VectorTypeFor& b) { _b = b; } private: - typename DimensionTraits::VectorType _a, _b; + VectorTypeFor _a, _b; }; /** @brief Infinite two-dimensional line */ diff --git a/src/Magnum/Shapes/LineSegment.h b/src/Magnum/Shapes/LineSegment.h index da20b31b5..6c5f7c99a 100644 --- a/src/Magnum/Shapes/LineSegment.h +++ b/src/Magnum/Shapes/LineSegment.h @@ -49,10 +49,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 VectorTypeFor& a, const VectorTypeFor& b): Line(a, b) {} /** @brief Transformed shape */ - LineSegment transformed(const typename DimensionTraits::MatrixType& matrix) const { + LineSegment transformed(const MatrixTypeFor& matrix) const { return Line::transformed(matrix); } diff --git a/src/Magnum/Shapes/Point.cpp b/src/Magnum/Shapes/Point.cpp index a4bd7c5d2..e71fcb567 100644 --- a/src/Magnum/Shapes/Point.cpp +++ b/src/Magnum/Shapes/Point.cpp @@ -30,7 +30,7 @@ namespace Magnum { namespace Shapes { -template Point Point::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Point Point::transformed(const MatrixTypeFor& matrix) const { return Point(matrix.transformPoint(_position)); } diff --git a/src/Magnum/Shapes/Point.h b/src/Magnum/Shapes/Point.h index b2358ade3..d63eadd45 100644 --- a/src/Magnum/Shapes/Point.h +++ b/src/Magnum/Shapes/Point.h @@ -55,23 +55,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 VectorTypeFor& position): _position(position) {} /** @brief Transformed shape */ - Point transformed(const typename DimensionTraits::MatrixType& matrix) const; + Point transformed(const MatrixTypeFor& matrix) const; /** @brief Position */ - constexpr typename DimensionTraits::VectorType position() const { + constexpr VectorTypeFor position() const { return _position; } /** @brief Set position */ - void setPosition(const typename DimensionTraits::VectorType& position) { + void setPosition(const VectorTypeFor& position) { _position = position; } private: - typename DimensionTraits::VectorType _position; + VectorTypeFor _position; }; /** @brief Two-dimensional point */ diff --git a/src/Magnum/Shapes/Shape.cpp b/src/Magnum/Shapes/Shape.cpp index 176b4eb54..5471b8217 100644 --- a/src/Magnum/Shapes/Shape.cpp +++ b/src/Magnum/Shapes/Shape.cpp @@ -37,7 +37,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 MatrixTypeFor& 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/Magnum/Shapes/Shape.h b/src/Magnum/Shapes/Shape.h index bf86ee497..b501ee1db 100644 --- a/src/Magnum/Shapes/Shape.h +++ b/src/Magnum/Shapes/Shape.h @@ -108,7 +108,7 @@ template class Shape: public AbstractShape { protected: /** Applies transformation to associated shape. */ - void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) override; + void clean(const MatrixTypeFor& absoluteTransformationMatrix) override; private: const Implementation::AbstractShape& abstractTransformedShape() const override { @@ -129,7 +129,7 @@ template inline const T& Shape::transformedShape() { return _transformedShape.shape; } -template void Shape::clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) { +template void Shape::clean(const MatrixTypeFor& absoluteTransformationMatrix) { Implementation::ShapeHelper::transform(*this, absoluteTransformationMatrix); } @@ -139,7 +139,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 MatrixTypeFor& absoluteTransformationMatrix) { shape._transformedShape.shape = shape._shape.shape.transformed(absoluteTransformationMatrix); } }; @@ -148,7 +148,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 MatrixTypeFor& absoluteTransformationMatrix); }; } diff --git a/src/Magnum/Shapes/Sphere.cpp b/src/Magnum/Shapes/Sphere.cpp index 5d6fba2d1..e7e0e94b1 100644 --- a/src/Magnum/Shapes/Sphere.cpp +++ b/src/Magnum/Shapes/Sphere.cpp @@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry; namespace Magnum { namespace Shapes { -template Sphere Sphere::transformed(const typename DimensionTraits::MatrixType& matrix) const { +template Sphere Sphere::transformed(const MatrixTypeFor& matrix) const { return Sphere(matrix.transformPoint(_position), matrix.uniformScaling()*_radius); } @@ -50,7 +50,7 @@ template bool InvertedSphere::operator%(cons } template Collision Sphere::operator/(const Point& other) const { - const typename DimensionTraits::VectorType separating = _position - other.position(); + const VectorTypeFor separating = _position - other.position(); const Float dot = separating.dot(); /* No collision occured */ @@ -61,9 +61,9 @@ template Collision Sphere::opera /* Separating normal. If can't decide on direction, just move up. */ /** @todo How to handle this in a configurable way? */ - const typename DimensionTraits::VectorType separatingNormal = + const VectorTypeFor separatingNormal = Math::TypeTraits::equals(dot, 0.0f) ? - DimensionTraits::VectorType::yAxis() : + VectorTypeFor::yAxis() : separating/distance; /* Collision position is on the point */ @@ -71,7 +71,7 @@ template Collision Sphere::opera } template Collision InvertedSphere::operator/(const Point& other) const { - const typename DimensionTraits::VectorType separating = other.position() - position(); + const VectorTypeFor separating = other.position() - position(); const Float dot = separating.dot(); /* No collision occured */ @@ -81,7 +81,7 @@ template Collision InvertedSphere::VectorType separatingNormal = separating/distance; + const VectorTypeFor separatingNormal = separating/distance; /* Collision position is on the point */ return Collision(other.position(), separatingNormal, distance - radius()); @@ -105,7 +105,7 @@ template bool InvertedSphere::operator%(cons template Collision Sphere::operator/(const Sphere& other) const { const Float minDistance = _radius + other._radius; - const typename DimensionTraits::VectorType separating = _position - other._position; + const VectorTypeFor separating = _position - other._position; const Float dot = separating.dot(); /* No collision occured */ @@ -116,9 +116,9 @@ template Collision Sphere::opera /* Separating normal. If can't decide on direction, just move up. */ /** @todo How to handle this in a configurable way? */ - const typename DimensionTraits::VectorType separatingNormal = + const VectorTypeFor separatingNormal = Math::TypeTraits::equals(dot, 0.0f) ? - DimensionTraits::VectorType::yAxis() : + VectorTypeFor::yAxis() : separating/distance; /* Contact position is on the surface of `other`, minDistace > distance */ @@ -129,7 +129,7 @@ template Collision InvertedSphere 0.0f); - const typename DimensionTraits::VectorType separating = other.position() - position(); + const VectorTypeFor separating = other.position() - position(); const Float dot = separating.dot(); /* No collision occured */ @@ -139,7 +139,7 @@ template Collision InvertedSphere::VectorType separatingNormal = separating/distance; + const VectorTypeFor separatingNormal = separating/distance; /* Contact position is on the surface of `other`, distance > maxDistance */ return Collision(other.position() + separatingNormal*other.radius(), separatingNormal, distance - maxDistance); diff --git a/src/Magnum/Shapes/Sphere.h b/src/Magnum/Shapes/Sphere.h index 0b02115d8..9eed8685e 100644 --- a/src/Magnum/Shapes/Sphere.h +++ b/src/Magnum/Shapes/Sphere.h @@ -60,18 +60,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 VectorTypeFor& position, Float radius): _position(position), _radius(radius) {} /** @brief Transformed shape */ - Sphere transformed(const typename DimensionTraits::MatrixType& matrix) const; + Sphere transformed(const MatrixTypeFor& matrix) const; /** @brief Position */ - constexpr typename DimensionTraits::VectorType position() const { + constexpr VectorTypeFor position() const { return _position; } /** @brief Set position */ - void setPosition(const typename DimensionTraits::VectorType& position) { + void setPosition(const VectorTypeFor& position) { _position = position; } @@ -100,7 +100,7 @@ template class MAGNUM_SHAPES_EXPORT Sphere { Collision operator/(const Sphere& other) const; private: - typename DimensionTraits::VectorType _position; + VectorTypeFor _position; Float _radius; }; @@ -133,12 +133,12 @@ template class MAGNUM_SHAPES_EXPORT InvertedSphere: constexpr /*implicit*/ InvertedSphere() = default; /** @brief Constructor */ - constexpr /*implicit*/ InvertedSphere(const typename DimensionTraits::VectorType& position, Float radius): Sphere(position, radius) {} + constexpr /*implicit*/ InvertedSphere(const VectorTypeFor& position, Float radius): Sphere(position, radius) {} using Sphere::Dimensions; /** @brief Transformed shape */ - InvertedSphere transformed(const typename DimensionTraits::MatrixType& matrix) const { + InvertedSphere transformed(const MatrixTypeFor& matrix) const { return Sphere::transformed(matrix); } diff --git a/src/Magnum/Shapes/shapeImplementation.h b/src/Magnum/Shapes/shapeImplementation.h index afdf89aee..ec9f17b42 100644 --- a/src/Magnum/Shapes/shapeImplementation.h +++ b/src/Magnum/Shapes/shapeImplementation.h @@ -158,7 +158,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 MatrixTypeFor& matrix, AbstractShape* result) const = 0; }; template struct Shape: AbstractShape { @@ -176,7 +176,7 @@ template struct Shape: AbstractShape { return new Shape(shape); } - void transform(const typename DimensionTraits::MatrixType& matrix, AbstractShape* result) const override { + void transform(const MatrixTypeFor& matrix, AbstractShape* result) const override { CORRADE_INTERNAL_ASSERT(result->type() == type()); static_cast*>(result)->shape = shape.transformed(matrix); } diff --git a/src/Magnum/Texture.cpp b/src/Magnum/Texture.cpp index a7566f218..a3008479b 100644 --- a/src/Magnum/Texture.cpp +++ b/src/Magnum/Texture.cpp @@ -34,8 +34,8 @@ namespace Magnum { namespace Implementation { -template typename DimensionTraits::VectorType maxTextureSize() { - return typename DimensionTraits::VectorType{Implementation::maxTextureSideSize()}; +template VectorTypeFor maxTextureSize() { + return VectorTypeFor{Implementation::maxTextureSideSize()}; } #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index a6fd0613d..9b442ac23 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -52,7 +52,7 @@ namespace Implementation { #endif } - template typename DimensionTraits::VectorType maxTextureSize(); + template VectorTypeFor maxTextureSize(); template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>(); } @@ -152,7 +152,7 @@ template class Texture: public AbstractTexture { * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE}, * @def_gl{MAX_3D_TEXTURE_SIZE} */ - static typename DimensionTraits::VectorType maxSize() { + static VectorTypeFor maxSize() { return Implementation::maxTextureSize(); } @@ -198,7 +198,7 @@ template class Texture: public AbstractTexture { * @def_gl{TEXTURE_DEPTH} * @requires_gl %Texture image queries are not available in OpenGL ES. */ - typename DimensionTraits::VectorType imageSize(Int level) { + VectorTypeFor imageSize(Int level) { return DataHelper::imageSize(*this, _target, level); } #endif @@ -585,7 +585,7 @@ template class Texture: public AbstractTexture { * @todo allow the user to specify ColorType explicitly to avoid * issues in WebGL (see setSubImage()) */ - Texture& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size) { + Texture& setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor& size) { DataHelper::setStorage(*this, _target, levels, internalFormat, size); return *this; } @@ -695,20 +695,20 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} */ - Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, const ImageReference& image) { + Texture& setSubImage(Int level, const VectorTypeFor& offset, const ImageReference& image) { DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage& image) { + Texture& setSubImage(Int level, const VectorTypeFor& offset, BufferImage& image) { DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } /** @overload */ - Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage&& image) { + Texture& setSubImage(Int level, const VectorTypeFor& offset, BufferImage&& image) { return setSubImage(level, offset, image); } #endif @@ -749,7 +749,7 @@ template class Texture: public AbstractTexture { * (part of OpenGL 4.3) is not available, this function does nothing. * @see @ref invalidateImage(), @fn_gl{InvalidateTexSubImage} */ - void invalidateSubImage(Int level, const typename DimensionTraits::VectorType& offset, const typename DimensionTraits::VectorType& size) { + void invalidateSubImage(Int level, const VectorTypeFor& offset, const VectorTypeFor& size) { DataHelper::invalidateSubImage(*this, level, offset, size); } diff --git a/src/Magnum/TextureArray.cpp b/src/Magnum/TextureArray.cpp index fafd9d47b..c4cb0087c 100644 --- a/src/Magnum/TextureArray.cpp +++ b/src/Magnum/TextureArray.cpp @@ -39,7 +39,7 @@ namespace { template<> struct VectorOrScalar<2> { typedef Vector2i Type; }; } -template typename DimensionTraits::VectorType TextureArray::maxSize() { +template VectorTypeFor TextureArray::maxSize() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) return {}; diff --git a/src/Magnum/TextureArray.h b/src/Magnum/TextureArray.h index d860b4636..09f6c2eae 100644 --- a/src/Magnum/TextureArray.h +++ b/src/Magnum/TextureArray.h @@ -105,7 +105,7 @@ template class TextureArray: public AbstractTexture { * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and * @def_gl{MAX_ARRAY_TEXTURE_LAYERS} */ - static typename DimensionTraits::VectorType maxSize(); + static VectorTypeFor maxSize(); /** * @brief Constructor @@ -251,7 +251,7 @@ template class TextureArray: public AbstractTexture { #ifndef MAGNUM_TARGET_GLES /** @copydoc Texture::imageSize() */ - typename DimensionTraits::VectorType imageSize(Int level) { + VectorTypeFor imageSize(Int level) { return DataHelper::imageSize(*this, _target, level); } #endif @@ -282,7 +282,7 @@ template class TextureArray: public AbstractTexture { * @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureImage3D,EXT,direct_state_access}. */ - TextureArray& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size) { + TextureArray& setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor& size) { DataHelper::setStorage(*this, _target, levels, internalFormat, size); return *this; } @@ -351,20 +351,20 @@ template class TextureArray: public AbstractTexture { * or @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} */ - TextureArray& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, const ImageReference& image) { + TextureArray& setSubImage(Int level, const VectorTypeFor& offset, const ImageReference& image) { DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - TextureArray& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage& image) { + TextureArray& setSubImage(Int level, const VectorTypeFor& offset, BufferImage& image) { DataHelper::setSubImage(*this, _target, level, offset, image); return *this; } /** @overload */ - TextureArray& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage&& image) { + TextureArray& setSubImage(Int level, const VectorTypeFor& offset, BufferImage&& image) { return setSubImage(level, offset, image); } #endif @@ -379,7 +379,7 @@ template class TextureArray: public AbstractTexture { void invalidateImage(Int level) { AbstractTexture::invalidateImage(level); } /** @copydoc Texture::invalidateSubImage() */ - void invalidateSubImage(Int level, const typename DimensionTraits::VectorType& offset, const typename DimensionTraits::VectorType& size) { + void invalidateSubImage(Int level, const VectorTypeFor& offset, const VectorTypeFor& size) { DataHelper::invalidateSubImage(*this, level, offset, size); } diff --git a/src/Magnum/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h index 7ce0c1753..dc216de7a 100644 --- a/src/Magnum/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -54,7 +54,7 @@ template class ImageData: public AbstractImage { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - explicit ImageData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} + explicit ImageData(ColorFormat format, ColorType type, const VectorTypeFor& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} /** @brief Copying is not allowed */ ImageData(const ImageData&) = delete; @@ -85,10 +85,10 @@ template class ImageData: public AbstractImage { #endif /** @brief %Image size */ - typename DimensionTraits::VectorType size() const { return _size; } + VectorTypeFor size() const { return _size; } /** @copydoc Image::dataSize() */ - std::size_t dataSize(const typename DimensionTraits::VectorType& size) const { + std::size_t dataSize(const VectorTypeFor& size) const { return AbstractImage::dataSize(size); }