Browse Source

Use VectorTypeFor and MatrixTypeFor instead of DimensionTraits.

Much shorter lines. I like that.
pull/59/head
Vladimír Vondruš 12 years ago
parent
commit
757ca6d1ad
  1. 4
      src/Magnum/BufferImage.cpp
  2. 14
      src/Magnum/BufferImage.h
  3. 6
      src/Magnum/DebugTools/ForceRenderer.cpp
  4. 10
      src/Magnum/DebugTools/ForceRenderer.h
  5. 2
      src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h
  6. 6
      src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp
  7. 2
      src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h
  8. 2
      src/Magnum/DebugTools/Implementation/BoxRenderer.cpp
  9. 2
      src/Magnum/DebugTools/Implementation/BoxRenderer.h
  10. 4
      src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp
  11. 2
      src/Magnum/DebugTools/Implementation/CapsuleRenderer.h
  12. 2
      src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h
  13. 2
      src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp
  14. 2
      src/Magnum/DebugTools/Implementation/CylinderRenderer.h
  15. 2
      src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h
  16. 2
      src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h
  17. 2
      src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp
  18. 2
      src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h
  19. 4
      src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h
  20. 6
      src/Magnum/DebugTools/Implementation/PointRenderer.cpp
  21. 2
      src/Magnum/DebugTools/Implementation/PointRenderer.h
  22. 6
      src/Magnum/DebugTools/Implementation/SphereRenderer.cpp
  23. 2
      src/Magnum/DebugTools/Implementation/SphereRenderer.h
  24. 4
      src/Magnum/DebugTools/ObjectRenderer.cpp
  25. 2
      src/Magnum/DebugTools/ObjectRenderer.h
  26. 4
      src/Magnum/DebugTools/ShapeRenderer.cpp
  27. 2
      src/Magnum/DebugTools/ShapeRenderer.h
  28. 2
      src/Magnum/Image.cpp
  29. 8
      src/Magnum/Image.h
  30. 8
      src/Magnum/ImageReference.h
  31. 10
      src/Magnum/MultisampleTexture.h
  32. 14
      src/Magnum/SceneGraph/AbstractCamera.h
  33. 4
      src/Magnum/SceneGraph/AbstractCamera.hpp
  34. 4
      src/Magnum/SceneGraph/AbstractFeature.h
  35. 4
      src/Magnum/SceneGraph/AbstractFeature.hpp
  36. 2
      src/Magnum/SceneGraph/AbstractObject.h
  37. 4
      src/Magnum/SceneGraph/AbstractTranslation.h
  38. 2
      src/Magnum/SceneGraph/Drawable.h
  39. 2
      src/Magnum/SceneGraph/Object.h
  40. 26
      src/Magnum/SceneGraph/TranslationTransformation.h
  41. 2
      src/Magnum/Shaders/DistanceFieldVector.h
  42. 2
      src/Magnum/Shaders/Flat.h
  43. 2
      src/Magnum/Shaders/Vector.h
  44. 2
      src/Magnum/Shaders/VertexColor.cpp
  45. 2
      src/Magnum/Shaders/VertexColor.h
  46. 2
      src/Magnum/Shapes/AxisAlignedBox.cpp
  47. 14
      src/Magnum/Shapes/AxisAlignedBox.h
  48. 2
      src/Magnum/Shapes/Box.cpp
  49. 12
      src/Magnum/Shapes/Box.h
  50. 2
      src/Magnum/Shapes/Capsule.cpp
  51. 14
      src/Magnum/Shapes/Capsule.h
  52. 10
      src/Magnum/Shapes/Collision.h
  53. 2
      src/Magnum/Shapes/Composition.cpp
  54. 2
      src/Magnum/Shapes/Composition.h
  55. 2
      src/Magnum/Shapes/Cylinder.cpp
  56. 14
      src/Magnum/Shapes/Cylinder.h
  57. 2
      src/Magnum/Shapes/Line.cpp
  58. 14
      src/Magnum/Shapes/Line.h
  59. 4
      src/Magnum/Shapes/LineSegment.h
  60. 2
      src/Magnum/Shapes/Point.cpp
  61. 10
      src/Magnum/Shapes/Point.h
  62. 2
      src/Magnum/Shapes/Shape.cpp
  63. 8
      src/Magnum/Shapes/Shape.h
  64. 22
      src/Magnum/Shapes/Sphere.cpp
  65. 14
      src/Magnum/Shapes/Sphere.h
  66. 4
      src/Magnum/Shapes/shapeImplementation.h
  67. 4
      src/Magnum/Texture.cpp
  68. 16
      src/Magnum/Texture.h
  69. 2
      src/Magnum/TextureArray.cpp
  70. 14
      src/Magnum/TextureArray.h
  71. 6
      src/Magnum/Trade/ImageData.h

4
src/Magnum/BufferImage.cpp

@ -28,13 +28,13 @@
namespace Magnum { namespace Magnum {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<UnsignedInt dimensions> BufferImage<dimensions>::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<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, const void* data, BufferUsage usage): AbstractImage(format, type), _size(size), _buffer(Buffer::Target::PixelPack) {
_buffer.setData({data, dataSize(size)}, usage); _buffer.setData({data, dataSize(size)}, usage);
} }
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(ColorFormat format, ColorType type): AbstractImage(format, type), _buffer(Buffer::Target::PixelPack) {} template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(ColorFormat format, ColorType type): AbstractImage(format, type), _buffer(Buffer::Target::PixelPack) {}
template<UnsignedInt dimensions> void BufferImage<dimensions>::setData(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, const void* data, BufferUsage usage) { template<UnsignedInt dimensions> void BufferImage<dimensions>::setData(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, const void* data, BufferUsage usage) {
_format = format; _format = format;
_type = type; _type = type;
_size = size; _size = size;

14
src/Magnum/BufferImage.h

@ -64,7 +64,7 @@ template<UnsignedInt dimensions> class BufferImage: public AbstractImage {
* @todo Make it more flexible (usable with * @todo Make it more flexible (usable with
* @extension{ARB,buffer_storage}, avoiding relocations...) * @extension{ARB,buffer_storage}, avoiding relocations...)
*/ */
explicit BufferImage(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, const void* data, BufferUsage usage); explicit BufferImage(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, const void* data, BufferUsage usage);
/** /**
* @brief Constructor * @brief Constructor
@ -89,10 +89,10 @@ template<UnsignedInt dimensions> class BufferImage: public AbstractImage {
BufferImage<dimensions>& operator=(BufferImage<dimensions>&& other) noexcept; BufferImage<dimensions>& operator=(BufferImage<dimensions>&& other) noexcept;
/** @brief %Image size */ /** @brief %Image size */
typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; } VectorTypeFor<Dimensions, Int> size() const { return _size; }
/** @copydoc Image::dataSize() */ /** @copydoc Image::dataSize() */
std::size_t dataSize(const typename DimensionTraits<Dimensions, Int>::VectorType& size) const { std::size_t dataSize(const VectorTypeFor<dimensions, Int>& size) const {
return AbstractImage::dataSize<dimensions>(size); return AbstractImage::dataSize<dimensions>(size);
} }
@ -113,14 +113,14 @@ template<UnsignedInt dimensions> class BufferImage: public AbstractImage {
* @todo Make it more flexible (usable with * @todo Make it more flexible (usable with
* @extension{ARB,buffer_storage}, avoiding relocations...) * @extension{ARB,buffer_storage}, avoiding relocations...)
*/ */
void setData(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, const void* data, BufferUsage usage); void setData(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, const void* data, BufferUsage usage);
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
/** /**
* @copybrief setData(ColorFormat, ColorType, const typename DimensionTraits<Dimensions, Int>::VectorType&, const void*, BufferUsage) * @copybrief setData(ColorFormat, ColorType, const VectorTypeFor<dimensions, Int>&, const void*, BufferUsage)
* @deprecated Use @ref Magnum::BufferImage::setData(ColorFormat, ColorType, const typename DimensionTraits<Dimensions, Int>::VectorType&, const void*, BufferUsage) "setData(ColorFormat, ColorType, const typename DimensionTraits<Dimensions, Int>::VectorType&, const void*, BufferUsage)" instead. * @deprecated Use @ref Magnum::BufferImage::setData(ColorFormat, ColorType, const VectorTypeFor<dimensions, Int>&, const void*, BufferUsage) "setData(ColorFormat, ColorType, const VectorTypeFor<dimensions, Int>&, const void*, BufferUsage)" instead.
*/ */
CORRADE_DEPRECATED("use setData(ColorFormat, ColorType, VectorNi, const void*, BufferUsage) instead") void setData(const typename DimensionTraits<Dimensions, Int>::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<dimensions, Int>& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage) {
setData(format, type, size, data, usage); setData(format, type, size, data, usage);
} }
#endif #endif

6
src/Magnum/DebugTools/ForceRenderer.cpp

@ -56,7 +56,7 @@ constexpr std::array<UnsignedByte, 6> indices{{
} }
template<UnsignedInt dimensions> ForceRenderer<dimensions>::ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const typename DimensionTraits<dimensions, Float>::VectorType& forcePosition, const typename DimensionTraits<dimensions, Float>::VectorType& force, ResourceKey options, SceneGraph::DrawableGroup<dimensions, Float>* drawables): SceneGraph::Drawable<dimensions, Float>(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance().get<ForceRendererOptions>(options)) { template<UnsignedInt dimensions> ForceRenderer<dimensions>::ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options, SceneGraph::DrawableGroup<dimensions, Float>* drawables): SceneGraph::Drawable<dimensions, Float>(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance().get<ForceRendererOptions>(options)) {
/* Shader */ /* Shader */
shader = ResourceManager::instance().get<AbstractShaderProgram, Shaders::Flat<dimensions>>(shaderKey<dimensions>()); shader = ResourceManager::instance().get<AbstractShaderProgram, Shaders::Flat<dimensions>>(shaderKey<dimensions>());
if(!shader) ResourceManager::instance().set<AbstractShaderProgram>(shader.key(), new Shaders::Flat<dimensions>); if(!shader) ResourceManager::instance().set<AbstractShaderProgram>(shader.key(), new Shaders::Flat<dimensions>);
@ -86,8 +86,8 @@ template<UnsignedInt dimensions> ForceRenderer<dimensions>::ForceRenderer(SceneG
ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual);
} }
template<UnsignedInt dimensions> void ForceRenderer<dimensions>::draw(const typename DimensionTraits<dimensions, Float>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) { template<UnsignedInt dimensions> void ForceRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) {
shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation<dimensions>(transformationMatrix.transformPoint(forcePosition), force)*DimensionTraits<dimensions, Float>::MatrixType::scaling(typename DimensionTraits<dimensions, Float>::VectorType(options->scale()))) shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation<dimensions>(transformationMatrix.transformPoint(forcePosition), force)*MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{options->scale()}))
.setColor(options->color()); .setColor(options->color());
mesh->draw(*shader); mesh->draw(*shader);
} }

10
src/Magnum/DebugTools/ForceRenderer.h

@ -117,16 +117,16 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p
* saved as reference to original vector and thus it must be available * saved as reference to original vector and thus it must be available
* for the whole lifetime of the renderer. * for the whole lifetime of the renderer.
*/ */
explicit ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const typename DimensionTraits<dimensions, Float>::VectorType& forcePosition, const typename DimensionTraits<dimensions, Float>::VectorType& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr); explicit ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr);
/** @overload */ /** @overload */
ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>&, const typename DimensionTraits<dimensions, Float>::VectorType&, typename DimensionTraits<dimensions, Float>::VectorType&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) = delete; ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>&, const VectorTypeFor<dimensions, Float>&, VectorTypeFor<dimensions, Float>&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) = delete;
private: private:
void draw(const typename DimensionTraits<dimensions, Float>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override; void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override;
const typename DimensionTraits<dimensions, Float>::VectorType forcePosition; const VectorTypeFor<dimensions, Float> forcePosition;
const typename DimensionTraits<dimensions, Float>::VectorType& force; const VectorTypeFor<dimensions, Float>& force;
Resource<ForceRendererOptions> options; Resource<ForceRendererOptions> options;
Resource<AbstractShaderProgram, Shaders::Flat<dimensions>> shader; Resource<AbstractShaderProgram, Shaders::Flat<dimensions>> shader;

2
src/Magnum/DebugTools/Implementation/AbstractShapeRenderer.h

@ -50,7 +50,7 @@ template<UnsignedInt dimensions> class AbstractShapeRenderer {
AbstractShapeRenderer(ResourceKey mesh, ResourceKey vertexBuffer, ResourceKey indexBuffer); AbstractShapeRenderer(ResourceKey mesh, ResourceKey vertexBuffer, ResourceKey indexBuffer);
virtual ~AbstractShapeRenderer(); virtual ~AbstractShapeRenderer();
virtual void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) = 0; virtual void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) = 0;
protected: protected:
/* Call only if the mesh resource isn't already present */ /* Call only if the mesh resource isn't already present */

6
src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp

@ -34,10 +34,10 @@ namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> AxisAlignedBoxRenderer<dimensions>::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox): axisAlignedBox(static_cast<const Shapes::Implementation::Shape<Shapes::AxisAlignedBox<dimensions>>&>(axisAlignedBox).shape) {} template<UnsignedInt dimensions> AxisAlignedBoxRenderer<dimensions>::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox): axisAlignedBox(static_cast<const Shapes::Implementation::Shape<Shapes::AxisAlignedBox<dimensions>>&>(axisAlignedBox).shape) {}
template<UnsignedInt dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
AbstractBoxRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* AbstractBoxRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*
DimensionTraits<dimensions, Float>::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* MatrixTypeFor<dimensions, Float>::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)*
DimensionTraits<dimensions, Float>::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) MatrixTypeFor<dimensions, Float>::scaling(axisAlignedBox.max()-axisAlignedBox.min()))
.setColor(options->color()); .setColor(options->color());
AbstractBoxRenderer<dimensions>::wireframeMesh->draw(*AbstractBoxRenderer<dimensions>::wireframeShader); AbstractBoxRenderer<dimensions>::wireframeMesh->draw(*AbstractBoxRenderer<dimensions>::wireframeShader);
} }

2
src/Magnum/DebugTools/Implementation/AxisAlignedBoxRenderer.h

@ -36,7 +36,7 @@ template<UnsignedInt dimensions> class AxisAlignedBoxRenderer: public AbstractBo
explicit AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox); explicit AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& axisAlignedBox);
AxisAlignedBoxRenderer(Shapes::Implementation::AbstractShape<dimensions>&&) = delete; AxisAlignedBoxRenderer(Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::AxisAlignedBox<dimensions>& axisAlignedBox; const Shapes::AxisAlignedBox<dimensions>& axisAlignedBox;

2
src/Magnum/DebugTools/Implementation/BoxRenderer.cpp

@ -34,7 +34,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> BoxRenderer<dimensions>::BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box): box(static_cast<const Shapes::Implementation::Shape<Shapes::Box<dimensions>>&>(box).shape) {} template<UnsignedInt dimensions> BoxRenderer<dimensions>::BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box): box(static_cast<const Shapes::Implementation::Shape<Shapes::Box<dimensions>>&>(box).shape) {}
template<UnsignedInt dimensions> void BoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void BoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
AbstractBoxRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) AbstractBoxRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation())
.setColor(options->color()); .setColor(options->color());
AbstractBoxRenderer<dimensions>::wireframeMesh->draw(*AbstractBoxRenderer<dimensions>::wireframeShader); AbstractBoxRenderer<dimensions>::wireframeMesh->draw(*AbstractBoxRenderer<dimensions>::wireframeShader);

2
src/Magnum/DebugTools/Implementation/BoxRenderer.h

@ -36,7 +36,7 @@ template<UnsignedInt dimensions> class BoxRenderer: public AbstractBoxRenderer<d
explicit BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box); explicit BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>& box);
BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete; BoxRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::Box<dimensions>& box; const Shapes::Box<dimensions>& box;

4
src/Magnum/DebugTools/Implementation/CapsuleRenderer.cpp

@ -104,8 +104,8 @@ AbstractCapsuleRenderer<3>::~AbstractCapsuleRenderer() = default;
template<UnsignedInt dimensions> CapsuleRenderer<dimensions>::CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>& capsule): capsule(static_cast<const Shapes::Implementation::Shape<Shapes::Capsule<dimensions>>&>(capsule).shape) {} template<UnsignedInt dimensions> CapsuleRenderer<dimensions>::CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>& capsule): capsule(static_cast<const Shapes::Implementation::Shape<Shapes::Capsule<dimensions>>&>(capsule).shape) {}
template<UnsignedInt dimensions> void CapsuleRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void CapsuleRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
std::array<typename DimensionTraits<dimensions, Float>::MatrixType, 3> transformations = Implementation::capsuleRendererTransformation<dimensions>(capsule.a(), capsule.b(), capsule.radius()); std::array<MatrixTypeFor<dimensions, Float>, 3> transformations = Implementation::capsuleRendererTransformation<dimensions>(capsule.a(), capsule.b(), capsule.radius());
AbstractShapeRenderer<dimensions>::wireframeShader->setColor(options->color()); AbstractShapeRenderer<dimensions>::wireframeShader->setColor(options->color());
/* Bottom */ /* Bottom */

2
src/Magnum/DebugTools/Implementation/CapsuleRenderer.h

@ -56,7 +56,7 @@ template<UnsignedInt dimensions> class CapsuleRenderer: public AbstractCapsuleRe
explicit CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>& capsule); explicit CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>& capsule);
CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete; CapsuleRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::Capsule<dimensions>& capsule; const Shapes::Capsule<dimensions>& capsule;

2
src/Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h

@ -35,7 +35,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation { namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> std::array<typename DimensionTraits<dimensions, Float>::MatrixType, 3> capsuleRendererTransformation(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b, Float radius); template<UnsignedInt dimensions> std::array<MatrixTypeFor<dimensions, Float>, 3> capsuleRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius);
template<> std::array<Matrix3, 3> capsuleRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) { template<> std::array<Matrix3, 3> capsuleRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) {
/* Vector from capsule center to top hemisphere center */ /* Vector from capsule center to top hemisphere center */

2
src/Magnum/DebugTools/Implementation/CylinderRenderer.cpp

@ -48,7 +48,7 @@ AbstractCylinderRenderer<3>::AbstractCylinderRenderer(): AbstractShapeRenderer<3
template<UnsignedInt dimensions> CylinderRenderer<dimensions>::CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>& cylinder): cylinder(static_cast<const Shapes::Implementation::Shape<Shapes::Cylinder<dimensions>>&>(cylinder).shape) {} template<UnsignedInt dimensions> CylinderRenderer<dimensions>::CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>& cylinder): cylinder(static_cast<const Shapes::Implementation::Shape<Shapes::Cylinder<dimensions>>&>(cylinder).shape) {}
template<UnsignedInt dimensions> void CylinderRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void CylinderRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*
Implementation::cylinderRendererTransformation<dimensions>(cylinder.a(), cylinder.b(), cylinder.radius())) Implementation::cylinderRendererTransformation<dimensions>(cylinder.a(), cylinder.b(), cylinder.radius()))
.setColor(options->color()); .setColor(options->color());

2
src/Magnum/DebugTools/Implementation/CylinderRenderer.h

@ -48,7 +48,7 @@ template<UnsignedInt dimensions> class CylinderRenderer: public AbstractCylinder
explicit CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>& cylinder); explicit CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>& cylinder);
CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete; CylinderRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::Cylinder<dimensions>& cylinder; const Shapes::Cylinder<dimensions>& cylinder;

2
src/Magnum/DebugTools/Implementation/CylinderRendererTransformation.h

@ -33,7 +33,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation { namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Float>::MatrixType cylinderRendererTransformation(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b, Float radius); template<UnsignedInt dimensions> MatrixTypeFor<dimensions, Float> cylinderRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius);
template<> Matrix3 cylinderRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) { template<> Matrix3 cylinderRendererTransformation<2>(const Vector2& a, const Vector2& b, const Float radius) {
/* Vector from cylinder center to top hemisphere center */ /* Vector from cylinder center to top hemisphere center */

2
src/Magnum/DebugTools/Implementation/ForceRendererTransformation.h

@ -33,7 +33,7 @@
namespace Magnum { namespace DebugTools { namespace Implementation { namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Float>::MatrixType forceRendererTransformation(const typename DimensionTraits<dimensions, Float>::VectorType& forcePosition, const typename DimensionTraits<dimensions, Float>::VectorType& force); template<UnsignedInt dimensions> MatrixTypeFor<dimensions, Float> forceRendererTransformation(const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force);
template<> inline Matrix3 forceRendererTransformation<2>(const Vector2& forcePosition, const Vector2& force) { template<> inline Matrix3 forceRendererTransformation<2>(const Vector2& forcePosition, const Vector2& force) {
return Matrix3::from({force, force.perpendicular()}, forcePosition); return Matrix3::from({force, force.perpendicular()}, forcePosition);

2
src/Magnum/DebugTools/Implementation/LineSegmentRenderer.cpp

@ -55,7 +55,7 @@ template<UnsignedInt dimensions> LineSegmentRenderer<dimensions>::LineSegmentRen
if(!AbstractShapeRenderer<dimensions>::wireframeMesh) AbstractShapeRenderer<dimensions>::createResources(meshData<dimensions>()); if(!AbstractShapeRenderer<dimensions>::wireframeMesh) AbstractShapeRenderer<dimensions>::createResources(meshData<dimensions>());
} }
template<UnsignedInt dimensions> void LineSegmentRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void LineSegmentRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*
Implementation::lineSegmentRendererTransformation<dimensions>(line.a(), line.b())) Implementation::lineSegmentRendererTransformation<dimensions>(line.a(), line.b()))
.setColor(options->color()); .setColor(options->color());

2
src/Magnum/DebugTools/Implementation/LineSegmentRenderer.h

@ -36,7 +36,7 @@ template<UnsignedInt dimensions> class LineSegmentRenderer: public AbstractShape
explicit LineSegmentRenderer(const Shapes::Implementation::AbstractShape<dimensions>& line); explicit LineSegmentRenderer(const Shapes::Implementation::AbstractShape<dimensions>& line);
LineSegmentRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete; LineSegmentRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::LineSegment<dimensions>& line; const Shapes::LineSegment<dimensions>& line;

4
src/Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h

@ -29,8 +29,8 @@
namespace Magnum { namespace DebugTools { namespace Implementation { namespace Magnum { namespace DebugTools { namespace Implementation {
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Float>::MatrixType lineSegmentRendererTransformation(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b) { template<UnsignedInt dimensions> MatrixTypeFor<dimensions, Float> lineSegmentRendererTransformation(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b) {
auto transformation = DimensionTraits<dimensions, Float>::MatrixType::translation(a); auto transformation = MatrixTypeFor<dimensions, Float>::translation(a);
transformation.right() = b - a; transformation.right() = b - a;
return transformation; return transformation;
} }

6
src/Magnum/DebugTools/Implementation/PointRenderer.cpp

@ -53,11 +53,11 @@ template<UnsignedInt dimensions> PointRenderer<dimensions>::PointRenderer(const
if(!AbstractShapeRenderer<dimensions>::wireframeMesh) AbstractShapeRenderer<dimensions>::createResources(meshData<dimensions>()); if(!AbstractShapeRenderer<dimensions>::wireframeMesh) AbstractShapeRenderer<dimensions>::createResources(meshData<dimensions>());
} }
template<UnsignedInt dimensions> void PointRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void PointRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
/* Half scale, because the point is 2x2(x2) */ /* Half scale, because the point is 2x2(x2) */
AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*
DimensionTraits<dimensions, Float>::MatrixType::translation(point.position())* MatrixTypeFor<dimensions, Float>::translation(point.position())*
DimensionTraits<dimensions, Float>::MatrixType::scaling(typename DimensionTraits<dimensions, Float>::VectorType(options->pointSize()/2))) MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{options->pointSize()/2}))
.setColor(options->color()); .setColor(options->color());
AbstractShapeRenderer<dimensions>::wireframeMesh->draw(*AbstractShapeRenderer<dimensions>::wireframeShader); AbstractShapeRenderer<dimensions>::wireframeMesh->draw(*AbstractShapeRenderer<dimensions>::wireframeShader);
} }

2
src/Magnum/DebugTools/Implementation/PointRenderer.h

@ -36,7 +36,7 @@ template<UnsignedInt dimensions> class PointRenderer: public AbstractShapeRender
explicit PointRenderer(const Shapes::Implementation::AbstractShape<dimensions>& point); explicit PointRenderer(const Shapes::Implementation::AbstractShape<dimensions>& point);
PointRenderer(Shapes::Implementation::AbstractShape<dimensions>&&) = delete; PointRenderer(Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::Point<dimensions>& point; const Shapes::Point<dimensions>& point;

6
src/Magnum/DebugTools/Implementation/SphereRenderer.cpp

@ -46,10 +46,10 @@ AbstractSphereRenderer<3>::AbstractSphereRenderer(): AbstractShapeRenderer<3>("s
template<UnsignedInt dimensions> SphereRenderer<dimensions>::SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>& sphere): sphere(static_cast<const Shapes::Implementation::Shape<Shapes::Sphere<dimensions>>&>(sphere).shape) {} template<UnsignedInt dimensions> SphereRenderer<dimensions>::SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>& sphere): sphere(static_cast<const Shapes::Implementation::Shape<Shapes::Sphere<dimensions>>&>(sphere).shape) {}
template<UnsignedInt dimensions> void SphereRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) { template<UnsignedInt dimensions> void SphereRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) {
AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* AbstractShapeRenderer<dimensions>::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*
DimensionTraits<dimensions, Float>::MatrixType::translation(sphere.position())* MatrixTypeFor<dimensions, Float>::translation(sphere.position())*
DimensionTraits<dimensions, Float>::MatrixType::scaling(typename DimensionTraits<dimensions, Float>::VectorType(sphere.radius()))) MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{sphere.radius()}))
.setColor(options->color()); .setColor(options->color());
AbstractShapeRenderer<dimensions>::wireframeMesh->draw(*AbstractShapeRenderer<dimensions>::wireframeShader); AbstractShapeRenderer<dimensions>::wireframeMesh->draw(*AbstractShapeRenderer<dimensions>::wireframeShader);
} }

2
src/Magnum/DebugTools/Implementation/SphereRenderer.h

@ -48,7 +48,7 @@ template<UnsignedInt dimensions> class SphereRenderer: public AbstractSphereRend
explicit SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>& sphere); explicit SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>& sphere);
SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete; SphereRenderer(const Shapes::Implementation::AbstractShape<dimensions>&&) = delete;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions, Float>::MatrixType& projectionMatrix) override; void draw(Resource<ShapeRendererOptions>& options, const MatrixTypeFor<dimensions, Float>& projectionMatrix) override;
private: private:
const Shapes::Sphere<dimensions>& sphere; const Shapes::Sphere<dimensions>& sphere;

4
src/Magnum/DebugTools/ObjectRenderer.cpp

@ -175,8 +175,8 @@ template<UnsignedInt dimensions> ObjectRenderer<dimensions>::ObjectRenderer(Scen
ResourceManager::instance().set<Mesh>(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); ResourceManager::instance().set<Mesh>(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual);
} }
template<UnsignedInt dimensions> void ObjectRenderer<dimensions>::draw(const typename DimensionTraits<dimensions, Float>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) { template<UnsignedInt dimensions> void ObjectRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) {
shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*DimensionTraits<dimensions, Float>::MatrixType::scaling(typename DimensionTraits<dimensions, Float>::VectorType(options->size()))); shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*MatrixTypeFor<dimensions, Float>::scaling(VectorTypeFor<dimensions, Float>{options->size()}));
mesh->draw(*shader); mesh->draw(*shader);
} }

2
src/Magnum/DebugTools/ObjectRenderer.h

@ -98,7 +98,7 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer:
explicit ObjectRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr); explicit ObjectRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr);
private: private:
void draw(const typename DimensionTraits<dimensions, Float>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override; void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override;
Resource<ObjectRendererOptions> options; Resource<ObjectRendererOptions> options;
Resource<AbstractShaderProgram, Shaders::VertexColor<dimensions>> shader; Resource<AbstractShaderProgram, Shaders::VertexColor<dimensions>> shader;

4
src/Magnum/DebugTools/ShapeRenderer.cpp

@ -122,8 +122,8 @@ template<UnsignedInt dimensions> ShapeRenderer<dimensions>::~ShapeRenderer() {
for(auto i: renderers) delete i; for(auto i: renderers) delete i;
} }
template<UnsignedInt dimensions> void ShapeRenderer<dimensions>::draw(const typename DimensionTraits<dimensions, Float>::MatrixType&, SceneGraph::AbstractCamera<dimensions, Float>& camera) { template<UnsignedInt dimensions> void ShapeRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>&, SceneGraph::AbstractCamera<dimensions, Float>& camera) {
typename DimensionTraits<dimensions, Float>::MatrixType projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix(); const MatrixTypeFor<dimensions, Float> projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix();
for(auto i: renderers) i->draw(options, projectionMatrix); for(auto i: renderers) i->draw(options, projectionMatrix);
} }

2
src/Magnum/DebugTools/ShapeRenderer.h

@ -160,7 +160,7 @@ template<UnsignedInt dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p
~ShapeRenderer(); ~ShapeRenderer();
private: private:
void draw(const typename DimensionTraits<dimensions, Float>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override; void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::AbstractCamera<dimensions, Float>& camera) override;
Resource<ShapeRendererOptions> options; Resource<ShapeRendererOptions> options;
std::vector<Implementation::AbstractShapeRenderer<dimensions>*> renderers; std::vector<Implementation::AbstractShapeRenderer<dimensions>*> renderers;

2
src/Magnum/Image.cpp

@ -27,7 +27,7 @@
namespace Magnum { namespace Magnum {
template<UnsignedInt dimensions> void Image<dimensions>::setData(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, void* data) { template<UnsignedInt dimensions> void Image<dimensions>::setData(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, void* data) {
delete[] _data; delete[] _data;
_format = format; _format = format;
_type = type; _type = type;

8
src/Magnum/Image.h

@ -54,7 +54,7 @@ template<UnsignedInt dimensions> class Image: public AbstractImage {
* Note that the image data are not copied on construction, but they * Note that the image data are not copied on construction, but they
* are deleted on class destruction. * are deleted on class destruction.
*/ */
explicit Image(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<unsigned char*>(data)) {} explicit Image(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<unsigned char*>(data)) {}
/** /**
* @brief Constructor * @brief Constructor
@ -95,7 +95,7 @@ template<UnsignedInt dimensions> class Image: public AbstractImage {
#endif #endif
/** @brief %Image size */ /** @brief %Image size */
typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; } VectorTypeFor<dimensions, Int> size() const { return _size; }
/** /**
* @brief Size of data required to store image of given size * @brief Size of data required to store image of given size
@ -104,7 +104,7 @@ template<UnsignedInt dimensions> class Image: public AbstractImage {
* account. * account.
* @see @ref pixelSize() * @see @ref pixelSize()
*/ */
std::size_t dataSize(const typename DimensionTraits<Dimensions, Int>::VectorType& size) const { std::size_t dataSize(const VectorTypeFor<dimensions, Int>& size) const {
return AbstractImage::dataSize<dimensions>(size); return AbstractImage::dataSize<dimensions>(size);
} }
@ -133,7 +133,7 @@ template<UnsignedInt dimensions> class Image: public AbstractImage {
* data are not copied, but they are deleted on destruction. * data are not copied, but they are deleted on destruction.
* @see @ref release() * @see @ref release()
*/ */
void setData(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, void* data); void setData(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, void* data);
/** /**
* @brief Release data storage * @brief Release data storage

8
src/Magnum/ImageReference.h

@ -61,7 +61,7 @@ template<UnsignedInt dimensions> class ImageReference: public AbstractImage {
* @param size %Image size * @param size %Image size
* @param data %Image data * @param data %Image data
*/ */
constexpr explicit ImageReference(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, const void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<const unsigned char*>(data)) {} constexpr explicit ImageReference(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, const void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<const unsigned char*>(data)) {}
/** /**
* @brief Constructor * @brief Constructor
@ -72,13 +72,13 @@ template<UnsignedInt dimensions> class ImageReference: public AbstractImage {
* Data pointer is set to `nullptr`, call @ref setData() to fill the * Data pointer is set to `nullptr`, call @ref setData() to fill the
* image with data. * image with data.
*/ */
constexpr explicit ImageReference(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size): AbstractImage(format, type), _size(size), _data(nullptr) {} constexpr explicit ImageReference(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size): AbstractImage(format, type), _size(size), _data(nullptr) {}
/** @brief %Image size */ /** @brief %Image size */
constexpr typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; } constexpr VectorTypeFor<dimensions, Int> size() const { return _size; }
/** @copydoc Image::dataSize() */ /** @copydoc Image::dataSize() */
std::size_t dataSize(const typename DimensionTraits<Dimensions, Int>::VectorType& size) const { std::size_t dataSize(const VectorTypeFor<dimensions, Int>& size) const {
return AbstractImage::dataSize<dimensions>(size); return AbstractImage::dataSize<dimensions>(size);
} }

10
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<2>() { return GL_TEXTURE_2D_MULTISAMPLE; }
template<> inline constexpr GLenum multisampleTextureTarget<3>() { return GL_TEXTURE_2D_MULTISAMPLE_ARRAY; } template<> inline constexpr GLenum multisampleTextureTarget<3>() { return GL_TEXTURE_2D_MULTISAMPLE_ARRAY; }
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Int>::VectorType maxMultisampleTextureSize(); template<UnsignedInt dimensions> VectorTypeFor<dimensions, Int> maxMultisampleTextureSize();
template<> MAGNUM_EXPORT Vector2i maxMultisampleTextureSize<2>(); template<> MAGNUM_EXPORT Vector2i maxMultisampleTextureSize<2>();
template<> MAGNUM_EXPORT Vector3i maxMultisampleTextureSize<3>(); template<> MAGNUM_EXPORT Vector3i maxMultisampleTextureSize<3>();
} }
@ -98,7 +98,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
* @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and
* @def_gl{MAX_3D_TEXTURE_SIZE} * @def_gl{MAX_3D_TEXTURE_SIZE}
*/ */
static typename DimensionTraits<dimensions, Int>::VectorType maxSize() { static VectorTypeFor<dimensions, Int> maxSize() {
return Implementation::maxMultisampleTextureSize<dimensions>(); return Implementation::maxMultisampleTextureSize<dimensions>();
} }
@ -122,7 +122,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
* with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or * with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or
* @def_gl{TEXTURE_DEPTH} * @def_gl{TEXTURE_DEPTH}
*/ */
typename DimensionTraits<dimensions, Int>::VectorType imageSize() { VectorTypeFor<dimensions, Int> imageSize() {
return DataHelper<dimensions>::imageSize(*this, _target, 0); return DataHelper<dimensions>::imageSize(*this, _target, 0);
} }
@ -155,7 +155,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
/* The default parameter value was chosen based on discussion in /* The default parameter value was chosen based on discussion in
ARB_texture_multisample specs (fixed locations is treated as the ARB_texture_multisample specs (fixed locations is treated as the
special case) */ special case) */
MultisampleTexture<dimensions>& setStorage(Int samples, TextureFormat internalFormat, const typename DimensionTraits<dimensions, Int>::VectorType& size, MultisampleTextureSampleLocations sampleLocations = MultisampleTexture<dimensions>& setStorage(Int samples, TextureFormat internalFormat, const VectorTypeFor<dimensions, Int>& size, MultisampleTextureSampleLocations sampleLocations =
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MultisampleTextureSampleLocations::NotFixed MultisampleTextureSampleLocations::NotFixed
#else #else
@ -170,7 +170,7 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
void invalidateImage() { AbstractTexture::invalidateImage(0); } void invalidateImage() { AbstractTexture::invalidateImage(0); }
/** @copydoc RectangleTexture::invalidateSubImage() */ /** @copydoc RectangleTexture::invalidateSubImage() */
void invalidateSubImage(const typename DimensionTraits<dimensions, Int>::VectorType& offset, const typename DimensionTraits<dimensions, Int>::VectorType& size) { void invalidateSubImage(const VectorTypeFor<dimensions, Int>& offset, const VectorTypeFor<dimensions, Int>& size) {
DataHelper<dimensions>::invalidateSubImage(*this, 0, offset, size); DataHelper<dimensions>::invalidateSubImage(*this, 0, offset, size);
} }

14
src/Magnum/SceneGraph/AbstractCamera.h

@ -48,7 +48,7 @@ enum class AspectRatioPolicy: UnsignedByte {
}; };
namespace Implementation { namespace Implementation {
template<UnsignedInt dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Vector2i& viewport); template<UnsignedInt dimensions, class T> MatrixTypeFor<dimensions, T> aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Vector2i& viewport);
} }
/** /**
@ -90,7 +90,7 @@ template<UnsignedInt dimensions, class T> class AbstractCamera: public AbstractF
* Camera matrix describes world position relative to the camera and is * Camera matrix describes world position relative to the camera and is
* applied as first. * applied as first.
*/ */
typename DimensionTraits<dimensions, T>::MatrixType cameraMatrix() { MatrixTypeFor<dimensions, T> cameraMatrix() {
AbstractFeature<dimensions, T>::object().setClean(); AbstractFeature<dimensions, T>::object().setClean();
return _cameraMatrix; return _cameraMatrix;
} }
@ -102,7 +102,7 @@ template<UnsignedInt dimensions, class T> class AbstractCamera: public AbstractF
* as last. * as last.
* @see @ref projectionSize() * @see @ref projectionSize()
*/ */
typename DimensionTraits<dimensions, T>::MatrixType projectionMatrix() const { return _projectionMatrix; } MatrixTypeFor<dimensions, T> projectionMatrix() const { return _projectionMatrix; }
/** /**
* @brief Size of (near) XY plane in current projection * @brief Size of (near) XY plane in current projection
@ -143,7 +143,7 @@ template<UnsignedInt dimensions, class T> class AbstractCamera: public AbstractF
~AbstractCamera(); ~AbstractCamera();
/** Recalculates camera matrix */ /** Recalculates camera matrix */
void cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType& invertedAbsoluteTransformationMatrix) override { void cleanInverted(const MatrixTypeFor<dimensions, T>& invertedAbsoluteTransformationMatrix) override {
_cameraMatrix = invertedAbsoluteTransformationMatrix; _cameraMatrix = invertedAbsoluteTransformationMatrix;
} }
@ -152,13 +152,13 @@ template<UnsignedInt dimensions, class T> class AbstractCamera: public AbstractF
_projectionMatrix = Implementation::aspectRatioFix<dimensions, T>(_aspectRatioPolicy, {rawProjectionMatrix[0].x(), rawProjectionMatrix[1].y()}, _viewport)*rawProjectionMatrix; _projectionMatrix = Implementation::aspectRatioFix<dimensions, T>(_aspectRatioPolicy, {rawProjectionMatrix[0].x(), rawProjectionMatrix[1].y()}, _viewport)*rawProjectionMatrix;
} }
typename DimensionTraits<dimensions, T>::MatrixType rawProjectionMatrix; MatrixTypeFor<dimensions, T> rawProjectionMatrix;
AspectRatioPolicy _aspectRatioPolicy; AspectRatioPolicy _aspectRatioPolicy;
#endif #endif
private: private:
typename DimensionTraits<dimensions, T>::MatrixType _projectionMatrix; MatrixTypeFor<dimensions, T> _projectionMatrix;
typename DimensionTraits<dimensions, T>::MatrixType _cameraMatrix; MatrixTypeFor<dimensions, T> _cameraMatrix;
Vector2i _viewport; Vector2i _viewport;
}; };

4
src/Magnum/SceneGraph/AbstractCamera.hpp

@ -51,7 +51,7 @@ template<class T> class Camera<3, T> {
} }
}; };
template<UnsignedInt dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Vector2i& viewport) { template<UnsignedInt dimensions, class T> MatrixTypeFor<dimensions, T> aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Vector2i& viewport) {
/* Don't divide by zero / don't preserve anything */ /* 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) if(projectionScale.x() == 0 || projectionScale.y() == 0 || viewport.x() == 0 || viewport.y() == 0 || aspectRatioPolicy == AspectRatioPolicy::NotPreserved)
return {}; return {};
@ -97,7 +97,7 @@ template<UnsignedInt dimensions, class T> void AbstractCamera<dimensions, T>::dr
objects.reserve(group.size()); objects.reserve(group.size());
for(std::size_t i = 0; i != group.size(); ++i) for(std::size_t i = 0; i != group.size(); ++i)
objects.push_back(group[i].object()); objects.push_back(group[i].object());
std::vector<typename DimensionTraits<dimensions, T>::MatrixType> transformations = std::vector<MatrixTypeFor<dimensions, T>> transformations =
scene->transformationMatrices(objects, _cameraMatrix); scene->transformationMatrices(objects, _cameraMatrix);
/* Perform the drawing */ /* Perform the drawing */

4
src/Magnum/SceneGraph/AbstractFeature.h

@ -270,7 +270,7 @@ template<UnsignedInt dimensions, class T> class AbstractFeature
* Default implementation does nothing. * Default implementation does nothing.
* @see @ref scenegraph-caching, @ref cleanInverted() * @see @ref scenegraph-caching, @ref cleanInverted()
*/ */
virtual void clean(const typename DimensionTraits<dimensions, T>::MatrixType& absoluteTransformationMatrix); virtual void clean(const MatrixTypeFor<dimensions, T>& absoluteTransformationMatrix);
/** /**
* @brief Clean data based on inverted absolute transformation * @brief Clean data based on inverted absolute transformation
@ -283,7 +283,7 @@ template<UnsignedInt dimensions, class T> class AbstractFeature
* Default implementation does nothing. * Default implementation does nothing.
* @see @ref scenegraph-caching, @ref clean() * @see @ref scenegraph-caching, @ref clean()
*/ */
virtual void cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType& invertedAbsoluteTransformationMatrix); virtual void cleanInverted(const MatrixTypeFor<dimensions, T>& invertedAbsoluteTransformationMatrix);
/*@}*/ /*@}*/

4
src/Magnum/SceneGraph/AbstractFeature.hpp

@ -41,9 +41,9 @@ template<UnsignedInt dimensions, class T> AbstractFeature<dimensions, T>::~Abstr
template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::markDirty() {} template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::markDirty() {}
template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::clean(const typename DimensionTraits<dimensions, T>::MatrixType&) {} template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::clean(const MatrixTypeFor<dimensions, T>&) {}
template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType&) {} template<UnsignedInt dimensions, class T> void AbstractFeature<dimensions, T>::cleanInverted(const MatrixTypeFor<dimensions, T>&) {}
}} }}

2
src/Magnum/SceneGraph/AbstractObject.h

@ -81,7 +81,7 @@ template<UnsignedInt dimensions, class T> class AbstractObject
public: public:
/** @brief Matrix type */ /** @brief Matrix type */
typedef typename DimensionTraits<dimensions, T>::MatrixType MatrixType; typedef MatrixTypeFor<dimensions, T> MatrixType;
/** @brief Feature object type */ /** @brief Feature object type */
typedef AbstractFeature<dimensions, T> FeatureType; typedef AbstractFeature<dimensions, T> FeatureType;

4
src/Magnum/SceneGraph/AbstractTranslation.h

@ -65,7 +65,7 @@ class AbstractTranslation: public AbstractTransformation<dimensions, T> {
* @ref Math::Vector3::xAxis(), @ref Math::Vector3::yAxis(), * @ref Math::Vector3::xAxis(), @ref Math::Vector3::yAxis(),
* @ref Math::Vector3::zAxis() * @ref Math::Vector3::zAxis()
*/ */
AbstractTranslation<dimensions, T, TranslationType>& translate(const typename DimensionTraits<dimensions, TranslationType>::VectorType& vector, TransformationType type = TransformationType::Global) { AbstractTranslation<dimensions, T, TranslationType>& translate(const VectorTypeFor<dimensions, TranslationType>& vector, TransformationType type = TransformationType::Global) {
doTranslate(vector, type); doTranslate(vector, type);
return *this; return *this;
} }
@ -79,7 +79,7 @@ class AbstractTranslation: public AbstractTransformation<dimensions, T> {
private: private:
#endif #endif
/** @brief Polymorphic implementation for @ref translate() */ /** @brief Polymorphic implementation for @ref translate() */
virtual void doTranslate(const typename DimensionTraits<dimensions, TranslationType>::VectorType& vector, TransformationType type) = 0; virtual void doTranslate(const VectorTypeFor<dimensions, TranslationType>& vector, TransformationType type) = 0;
}; };
/** /**

2
src/Magnum/SceneGraph/Drawable.h

@ -165,7 +165,7 @@ template<UnsignedInt dimensions, class T> class Drawable: public AbstractGrouped
* Projection matrix can be retrieved from * Projection matrix can be retrieved from
* @ref SceneGraph::AbstractCamera::projectionMatrix() "AbstractCamera::projectionMatrix()". * @ref SceneGraph::AbstractCamera::projectionMatrix() "AbstractCamera::projectionMatrix()".
*/ */
virtual void draw(const typename DimensionTraits<dimensions, T>::MatrixType& transformationMatrix, AbstractCamera<dimensions, T>& camera) = 0; virtual void draw(const MatrixTypeFor<dimensions, T>& transformationMatrix, AbstractCamera<dimensions, T>& camera) = 0;
}; };
/** /**

2
src/Magnum/SceneGraph/Object.h

@ -106,7 +106,7 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
public: public:
/** @brief Matrix type */ /** @brief Matrix type */
typedef typename DimensionTraits<Transformation::Dimensions, typename Transformation::Type>::MatrixType MatrixType; typedef MatrixTypeFor<Transformation::Dimensions, typename Transformation::Type> MatrixType;
/** /**
* @brief Constructor * @brief Constructor

26
src/Magnum/SceneGraph/TranslationTransformation.h

@ -60,16 +60,16 @@ template<UnsignedInt dimensions, class T, class TranslationType>
class TranslationTransformation: public AbstractTranslation<dimensions, T, TranslationType> { class TranslationTransformation: public AbstractTranslation<dimensions, T, TranslationType> {
public: public:
/** @brief Underlying transformation type */ /** @brief Underlying transformation type */
typedef typename DimensionTraits<dimensions, TranslationType>::VectorType DataType; typedef VectorTypeFor<dimensions, TranslationType> DataType;
/** @brief %Object transformation */ /** @brief %Object transformation */
typename DimensionTraits<dimensions, TranslationType>::VectorType transformation() const { return _transformation; } VectorTypeFor<dimensions, TranslationType> transformation() const { return _transformation; }
/** /**
* @brief Set transformation * @brief Set transformation
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
*/ */
Object<TranslationTransformation<dimensions, T, TranslationType>>& setTransformation(const typename DimensionTraits<dimensions, TranslationType>::VectorType& transformation) { Object<TranslationTransformation<dimensions, T, TranslationType>>& setTransformation(const VectorTypeFor<dimensions, TranslationType>& transformation) {
/* Setting transformation is forbidden for the scene */ /* Setting transformation is forbidden for the scene */
/** @todo Assert for this? */ /** @todo Assert for this? */
/** @todo Do this in some common code so we don't need to include Object? */ /** @todo Do this in some common code so we don't need to include Object? */
@ -94,7 +94,7 @@ class TranslationTransformation: public AbstractTranslation<dimensions, T, Trans
* Equivalent to @ref translate(), provided only for compatibility with * Equivalent to @ref translate(), provided only for compatibility with
* other implementations. * other implementations.
*/ */
Object<TranslationTransformation<dimensions, T, TranslationType>>& transform(const typename DimensionTraits<dimensions, TranslationType>::VectorType& transformation, TransformationType = TransformationType::Global) { Object<TranslationTransformation<dimensions, T, TranslationType>>& transform(const VectorTypeFor<dimensions, TranslationType>& transformation, TransformationType = TransformationType::Global) {
return translate(transformation); return translate(transformation);
} }
@ -107,7 +107,7 @@ class TranslationTransformation: public AbstractTranslation<dimensions, T, Trans
* @ref Math::Vector3::xAxis(), @ref Math::Vector3::yAxis(), * @ref Math::Vector3::xAxis(), @ref Math::Vector3::yAxis(),
* @ref Math::Vector3::zAxis() * @ref Math::Vector3::zAxis()
*/ */
Object<TranslationTransformation<dimensions, T, TranslationType>>& translate(const typename DimensionTraits<dimensions, TranslationType>::VectorType& vector, TransformationType = TransformationType::Global) { Object<TranslationTransformation<dimensions, T, TranslationType>>& translate(const VectorTypeFor<dimensions, TranslationType>& vector, TransformationType = TransformationType::Global) {
_transformation += vector; _transformation += vector;
return static_cast<Object<TranslationTransformation<dimensions, T, TranslationType>>&>(*this); return static_cast<Object<TranslationTransformation<dimensions, T, TranslationType>>&>(*this);
} }
@ -119,11 +119,11 @@ class TranslationTransformation: public AbstractTranslation<dimensions, T, Trans
private: private:
void doResetTransformation() override final { resetTransformation(); } void doResetTransformation() override final { resetTransformation(); }
void doTranslate(const typename DimensionTraits<dimensions, TranslationType>::VectorType& vector, TransformationType) override final { void doTranslate(const VectorTypeFor<dimensions, TranslationType>& vector, TransformationType) override final {
translate(vector); translate(vector);
} }
typename DimensionTraits<dimensions, TranslationType>::VectorType _transformation; VectorTypeFor<dimensions, TranslationType> _transformation;
}; };
/** /**
@ -171,21 +171,21 @@ typedef BasicTranslationTransformation3D<Float> TranslationTransformation3D;
namespace Implementation { namespace Implementation {
template<UnsignedInt dimensions, class T, class TranslationType> struct Transformation<TranslationTransformation<dimensions, T, TranslationType>> { template<UnsignedInt dimensions, class T, class TranslationType> struct Transformation<TranslationTransformation<dimensions, T, TranslationType>> {
static typename DimensionTraits<dimensions, TranslationType>::VectorType fromMatrix(const typename DimensionTraits<dimensions, T>::MatrixType& matrix) { static VectorTypeFor<dimensions, TranslationType> fromMatrix(const MatrixTypeFor<dimensions, T>& matrix) {
CORRADE_ASSERT((matrix.rotationScaling() == Math::Matrix<dimensions, T>()), CORRADE_ASSERT((matrix.rotationScaling() == Math::Matrix<dimensions, T>()),
"SceneGraph::TranslationTransformation: the matrix doesn't represent pure translation", {}); "SceneGraph::TranslationTransformation: the matrix doesn't represent pure translation", {});
return typename DimensionTraits<dimensions, TranslationType>::VectorType(matrix.translation()); return VectorTypeFor<dimensions, TranslationType>{matrix.translation()};
} }
constexpr static typename DimensionTraits<dimensions, T>::MatrixType toMatrix(const typename DimensionTraits<dimensions, TranslationType>::VectorType& transformation) { constexpr static MatrixTypeFor<dimensions, T> toMatrix(const VectorTypeFor<dimensions, TranslationType>& transformation) {
return DimensionTraits<dimensions, T>::MatrixType::translation(typename DimensionTraits<dimensions, T>::VectorType(transformation)); return MatrixTypeFor<dimensions, T>::translation(VectorTypeFor<dimensions, T>{transformation});
} }
static typename DimensionTraits<dimensions, TranslationType>::VectorType compose(const typename DimensionTraits<dimensions, TranslationType>::VectorType& parent, const typename DimensionTraits<dimensions, TranslationType>::VectorType& child) { static VectorTypeFor<dimensions, TranslationType> compose(const VectorTypeFor<dimensions, TranslationType>& parent, const VectorTypeFor<dimensions, TranslationType>& child) {
return parent+child; return parent+child;
} }
static typename DimensionTraits<dimensions, TranslationType>::VectorType inverted(const typename DimensionTraits<dimensions, TranslationType>::VectorType& transformation) { static VectorTypeFor<dimensions, TranslationType> inverted(const VectorTypeFor<dimensions, TranslationType>& transformation) {
return -transformation; return -transformation;
} }
}; };

2
src/Magnum/Shaders/DistanceFieldVector.h

@ -57,7 +57,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT DistanceFieldVector
* @brief Set transformation and projection matrix * @brief Set transformation and projection matrix
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
*/ */
DistanceFieldVector& setTransformationProjectionMatrix(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) { DistanceFieldVector& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix);
return *this; return *this;
} }

2
src/Magnum/Shaders/Flat.h

@ -116,7 +116,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Flat: public Abstra
* @brief Set transformation and projection matrix * @brief Set transformation and projection matrix
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
*/ */
Flat<dimensions>& setTransformationProjectionMatrix(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) { Flat<dimensions>& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
setUniform(transformationProjectionMatrixUniform, matrix); setUniform(transformationProjectionMatrixUniform, matrix);
return *this; return *this;
} }

2
src/Magnum/Shaders/Vector.h

@ -54,7 +54,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Vector: public Abst
* @brief Set transformation and projection matrix * @brief Set transformation and projection matrix
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
*/ */
Vector& setTransformationProjectionMatrix(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) { Vector& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix);
return *this; return *this;
} }

2
src/Magnum/Shaders/VertexColor.cpp

@ -83,7 +83,7 @@ template<UnsignedInt dimensions> VertexColor<dimensions>::VertexColor(): transfo
/* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */ /* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
setTransformationProjectionMatrix(typename DimensionTraits<dimensions, Float>::MatrixType()); setTransformationProjectionMatrix(MatrixTypeFor<dimensions, Float>{});
#endif #endif
} }

2
src/Magnum/Shaders/VertexColor.h

@ -60,7 +60,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT VertexColor: public
* *
* Default is identity matrix. * Default is identity matrix.
*/ */
VertexColor<dimensions>& setTransformationProjectionMatrix(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) { VertexColor<dimensions>& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
setUniform(transformationProjectionMatrixUniform, matrix); setUniform(transformationProjectionMatrixUniform, matrix);
return *this; return *this;
} }

2
src/Magnum/Shapes/AxisAlignedBox.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> AxisAlignedBox<dimensions> AxisAlignedBox<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> AxisAlignedBox<dimensions> AxisAlignedBox<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return AxisAlignedBox<dimensions>(matrix.transformPoint(_min), return AxisAlignedBox<dimensions>(matrix.transformPoint(_min),
matrix.transformPoint(_max)); matrix.transformPoint(_max));
} }

14
src/Magnum/Shapes/AxisAlignedBox.h

@ -57,28 +57,28 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AxisAlignedBox {
constexpr /*implicit*/ AxisAlignedBox() {} constexpr /*implicit*/ AxisAlignedBox() {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ AxisAlignedBox(const typename DimensionTraits<dimensions, Float>::VectorType& min, const typename DimensionTraits<dimensions, Float>::VectorType& max): _min(min), _max(max) {} constexpr /*implicit*/ AxisAlignedBox(const VectorTypeFor<dimensions, Float>& min, const typename DimensionTraits<dimensions, Float>::VectorType& max): _min(min), _max(max) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
AxisAlignedBox<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; AxisAlignedBox<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Minimal coordinates */ /** @brief Minimal coordinates */
constexpr typename DimensionTraits<dimensions, Float>::VectorType min() const { constexpr VectorTypeFor<dimensions, Float> min() const {
return _min; return _min;
} }
/** @brief Set minimal coordinates */ /** @brief Set minimal coordinates */
void setMin(const typename DimensionTraits<dimensions, Float>::VectorType& min) { void setMin(const VectorTypeFor<dimensions, Float>& min) {
_min = min; _min = min;
} }
/** @brief Maximal coordinates */ /** @brief Maximal coordinates */
constexpr typename DimensionTraits<dimensions, Float>::VectorType max() const { constexpr VectorTypeFor<dimensions, Float> max() const {
return _max; return _max;
} }
/** @brief Set maximal coordinates */ /** @brief Set maximal coordinates */
void setMax(const typename DimensionTraits<dimensions, Float>::VectorType& max) { void setMax(const VectorTypeFor<dimensions, Float>& max) {
_max = max; _max = max;
} }
@ -86,7 +86,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT AxisAlignedBox {
bool operator%(const Point<dimensions>& other) const; bool operator%(const Point<dimensions>& other) const;
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _min, _max; VectorTypeFor<dimensions, Float> _min, _max;
}; };
/** @brief Two-dimensional axis-aligned box */ /** @brief Two-dimensional axis-aligned box */

2
src/Magnum/Shapes/Box.cpp

@ -27,7 +27,7 @@
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Box<dimensions> Box<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Box<dimensions> Box<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Box<dimensions>(matrix*_transformation); return Box<dimensions>(matrix*_transformation);
} }

12
src/Magnum/Shapes/Box.h

@ -56,26 +56,26 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Box {
* *
* Creates zero-sized box positioned at origin. * Creates zero-sized box positioned at origin.
*/ */
constexpr /*implicit*/ Box(): _transformation(DimensionTraits<dimensions, Float>::MatrixType::Zero) {} constexpr /*implicit*/ Box(): _transformation(MatrixTypeFor<dimensions, Float>::Zero) {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Box(const typename DimensionTraits<dimensions, Float>::MatrixType& transformation): _transformation(transformation) {} constexpr /*implicit*/ Box(const MatrixTypeFor<dimensions, Float>& transformation): _transformation(transformation) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Box<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Box<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Transformation */ /** @brief Transformation */
constexpr typename DimensionTraits<dimensions, Float>::MatrixType transformation() const { constexpr MatrixTypeFor<dimensions, Float> transformation() const {
return _transformation; return _transformation;
} }
/** @brief Set transformation */ /** @brief Set transformation */
void setTransformation(const typename DimensionTraits<dimensions, Float>::MatrixType& transformation) { void setTransformation(const MatrixTypeFor<dimensions, Float>& transformation) {
_transformation = transformation; _transformation = transformation;
} }
private: private:
typename DimensionTraits<dimensions, Float>::MatrixType _transformation; MatrixTypeFor<dimensions, Float> _transformation;
}; };
/** @brief Two-dimensional box */ /** @brief Two-dimensional box */

2
src/Magnum/Shapes/Capsule.cpp

@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry;
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Capsule<dimensions> Capsule<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Capsule<dimensions> Capsule<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Capsule<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius); return Capsule<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius);
} }

14
src/Magnum/Shapes/Capsule.h

@ -59,28 +59,28 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Capsule {
constexpr /*implicit*/ Capsule(): _radius(0.0f) {} constexpr /*implicit*/ Capsule(): _radius(0.0f) {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Capsule(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b, Float radius): _a(a), _b(b), _radius(radius) {} constexpr /*implicit*/ Capsule(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius): _a(a), _b(b), _radius(radius) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Capsule<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Capsule<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Start point */ /** @brief Start point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType a() const { constexpr VectorTypeFor<dimensions, Float> a() const {
return _a; return _a;
} }
/** @brief Set start point */ /** @brief Set start point */
void setA(const typename DimensionTraits<dimensions, Float>::VectorType& a) { void setA(const VectorTypeFor<dimensions, Float>& a) {
_a = a; _a = a;
} }
/** @brief End point */ /** @brief End point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType b() const { constexpr VectorTypeFor<dimensions, Float> b() const {
return _b; return _b;
} }
/** @brief Set end point */ /** @brief Set end point */
void setB(const typename DimensionTraits<dimensions, Float>::VectorType& b) { void setB(const VectorTypeFor<dimensions, Float>& b) {
_b = b; _b = b;
} }
@ -97,7 +97,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Capsule {
bool operator%(const Sphere<dimensions>& other) const; bool operator%(const Sphere<dimensions>& other) const;
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _a, _b; VectorTypeFor<dimensions, Float> _a, _b;
Float _radius; Float _radius;
}; };

10
src/Magnum/Shapes/Collision.h

@ -67,7 +67,7 @@ template<UnsignedInt dimensions> class Collision {
* If separation distance is positive, the separation normal is * If separation distance is positive, the separation normal is
* expected to be normalized. * expected to be normalized.
*/ */
explicit Collision(typename DimensionTraits<dimensions, Float>::VectorType position, typename DimensionTraits<dimensions, Float>::VectorType separationNormal, Float separationDistance) noexcept: _position(position), _separationNormal(separationNormal), _separationDistance(separationDistance) { explicit Collision(const VectorTypeFor<dimensions, Float>& position, const VectorTypeFor<dimensions, Float>& separationNormal, Float separationDistance) noexcept: _position(position), _separationNormal(separationNormal), _separationDistance(separationDistance) {
CORRADE_ASSERT(_separationDistance < Math::TypeTraits<Float>::epsilon() || separationNormal.isNormalized(), "Shapes::Collision::Collision: separation normal is not normalized", ); CORRADE_ASSERT(_separationDistance < Math::TypeTraits<Float>::epsilon() || separationNormal.isNormalized(), "Shapes::Collision::Collision: separation normal is not normalized", );
} }
@ -81,7 +81,7 @@ template<UnsignedInt dimensions> class Collision {
operator bool() const { return _separationDistance > 0.0f; } operator bool() const { return _separationDistance > 0.0f; }
/** @brief %Collision position */ /** @brief %Collision position */
typename DimensionTraits<dimensions, Float>::VectorType position() const { VectorTypeFor<dimensions, Float> position() const {
return _position; return _position;
} }
@ -90,7 +90,7 @@ template<UnsignedInt dimensions> class Collision {
* *
* @see @ref separationDistance(), @ref flipped() * @see @ref separationDistance(), @ref flipped()
*/ */
typename DimensionTraits<dimensions, Float>::VectorType separationNormal() const { VectorTypeFor<dimensions, Float> separationNormal() const {
return _separationNormal; return _separationNormal;
} }
@ -117,8 +117,8 @@ template<UnsignedInt dimensions> class Collision {
} }
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _position; VectorTypeFor<dimensions, Float> _position;
typename DimensionTraits<dimensions, Float>::VectorType _separationNormal; VectorTypeFor<dimensions, Float> _separationNormal;
Float _separationDistance; Float _separationDistance;
}; };

2
src/Magnum/Shapes/Composition.cpp

@ -113,7 +113,7 @@ template<UnsignedInt dimensions> void Composition<dimensions>::copyNodes(std::si
std::copy(other._nodes.begin(), other._nodes.end(), _nodes.begin()+offset); std::copy(other._nodes.begin(), other._nodes.end(), _nodes.begin()+offset);
} }
template<UnsignedInt dimensions> Composition<dimensions> Composition<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Composition<dimensions> Composition<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
Composition<dimensions> out(*this); Composition<dimensions> out(*this);
for(Implementation::AbstractShape<dimensions> * const* i = _shapes.begin(), * const* o = out._shapes.begin(); i != _shapes.end(); ++i, ++o) for(Implementation::AbstractShape<dimensions> * const* i = _shapes.begin(), * const* o = out._shapes.begin(); i != _shapes.end(); ++i, ++o)
(*i)->transform(matrix, *o); (*i)->transform(matrix, *o);

2
src/Magnum/Shapes/Composition.h

@ -129,7 +129,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Composition {
Composition<dimensions>& operator=(Composition<dimensions>&& other); Composition<dimensions>& operator=(Composition<dimensions>&& other);
/** @brief Transformed shape */ /** @brief Transformed shape */
Composition<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Composition<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Count of shapes in the hierarchy */ /** @brief Count of shapes in the hierarchy */
std::size_t size() const { return _shapes.size(); } std::size_t size() const { return _shapes.size(); }

2
src/Magnum/Shapes/Cylinder.cpp

@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry;
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Cylinder<dimensions> Cylinder<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Cylinder<dimensions> Cylinder<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Cylinder<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius); return Cylinder<dimensions>(matrix.transformPoint(_a), matrix.transformPoint(_b), matrix.uniformScaling()*_radius);
} }

14
src/Magnum/Shapes/Cylinder.h

@ -59,28 +59,28 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Cylinder {
constexpr /*implicit*/ Cylinder(): _radius(0.0f) {} constexpr /*implicit*/ Cylinder(): _radius(0.0f) {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Cylinder(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b, Float radius): _a(a), _b(b), _radius(radius) {} constexpr /*implicit*/ Cylinder(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b, Float radius): _a(a), _b(b), _radius(radius) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Cylinder<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Cylinder<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief First point */ /** @brief First point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType a() const { constexpr VectorTypeFor<dimensions, Float> a() const {
return _a; return _a;
} }
/** @brief Set first point */ /** @brief Set first point */
void setA(const typename DimensionTraits<dimensions, Float>::VectorType& a) { void setA(const VectorTypeFor<dimensions, Float>& a) {
_a = a; _a = a;
} }
/** @brief Second point */ /** @brief Second point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType b() const { constexpr VectorTypeFor<dimensions, Float> b() const {
return _b; return _b;
} }
/** @brief Set second point */ /** @brief Set second point */
void setB(const typename DimensionTraits<dimensions, Float>::VectorType& b) { void setB(const VectorTypeFor<dimensions, Float>& b) {
_b = b; _b = b;
} }
@ -97,7 +97,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Cylinder {
bool operator%(const Sphere<dimensions>& other) const; bool operator%(const Sphere<dimensions>& other) const;
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _a, _b; VectorTypeFor<dimensions, Float> _a, _b;
Float _radius; Float _radius;
}; };

2
src/Magnum/Shapes/Line.cpp

@ -30,7 +30,7 @@
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Line<dimensions> Line<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Line<dimensions> Line<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Line<dimensions>(matrix.transformPoint(_a), return Line<dimensions>(matrix.transformPoint(_a),
matrix.transformPoint(_b)); matrix.transformPoint(_b));
} }

14
src/Magnum/Shapes/Line.h

@ -56,33 +56,33 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Line {
constexpr /*implicit*/ Line() {} constexpr /*implicit*/ Line() {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Line(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b): _a(a), _b(b) {} constexpr /*implicit*/ Line(const VectorTypeFor<dimensions, Float>& a, const typename DimensionTraits<dimensions, Float>::VectorType& b): _a(a), _b(b) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Line<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Line<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief First point */ /** @brief First point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType a() const { constexpr VectorTypeFor<dimensions, Float> a() const {
return _a; return _a;
} }
/** @brief Set first point */ /** @brief Set first point */
void setA(const typename DimensionTraits<dimensions, Float>::VectorType& a) { void setA(const VectorTypeFor<dimensions, Float>& a) {
_a = a; _a = a;
} }
/** @brief Second point */ /** @brief Second point */
constexpr typename DimensionTraits<dimensions, Float>::VectorType b() const { constexpr VectorTypeFor<dimensions, Float> b() const {
return _b; return _b;
} }
/** @brief Set second point */ /** @brief Set second point */
void setB(const typename DimensionTraits<dimensions, Float>::VectorType& b) { void setB(const VectorTypeFor<dimensions, Float>& b) {
_b = b; _b = b;
} }
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _a, _b; VectorTypeFor<dimensions, Float> _a, _b;
}; };
/** @brief Infinite two-dimensional line */ /** @brief Infinite two-dimensional line */

4
src/Magnum/Shapes/LineSegment.h

@ -49,10 +49,10 @@ template<UnsignedInt dimensions> class LineSegment: public Line<dimensions> {
constexpr /*implicit*/ LineSegment() {} constexpr /*implicit*/ LineSegment() {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ LineSegment(const typename DimensionTraits<dimensions, Float>::VectorType& a, const typename DimensionTraits<dimensions, Float>::VectorType& b): Line<dimensions>(a, b) {} constexpr /*implicit*/ LineSegment(const VectorTypeFor<dimensions, Float>& a, const VectorTypeFor<dimensions, Float>& b): Line<dimensions>(a, b) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
LineSegment<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { LineSegment<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Line<dimensions>::transformed(matrix); return Line<dimensions>::transformed(matrix);
} }

2
src/Magnum/Shapes/Point.cpp

@ -30,7 +30,7 @@
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Point<dimensions> Point<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Point<dimensions> Point<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Point<dimensions>(matrix.transformPoint(_position)); return Point<dimensions>(matrix.transformPoint(_position));
} }

10
src/Magnum/Shapes/Point.h

@ -55,23 +55,23 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Point {
constexpr /*implicit*/ Point() {} constexpr /*implicit*/ Point() {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Point(const typename DimensionTraits<dimensions, Float>::VectorType& position): _position(position) {} constexpr /*implicit*/ Point(const VectorTypeFor<dimensions, Float>& position): _position(position) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Point<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Point<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Position */ /** @brief Position */
constexpr typename DimensionTraits<dimensions, Float>::VectorType position() const { constexpr VectorTypeFor<dimensions, Float> position() const {
return _position; return _position;
} }
/** @brief Set position */ /** @brief Set position */
void setPosition(const typename DimensionTraits<dimensions, Float>::VectorType& position) { void setPosition(const VectorTypeFor<dimensions, Float>& position) {
_position = position; _position = position;
} }
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _position; VectorTypeFor<dimensions, Float> _position;
}; };
/** @brief Two-dimensional point */ /** @brief Two-dimensional point */

2
src/Magnum/Shapes/Shape.cpp

@ -37,7 +37,7 @@ template<UnsignedInt dimensions> void ShapeHelper<Composition<dimensions>>::set(
shape._transformedShape.shape = shape._shape.shape = std::move(composition); shape._transformedShape.shape = shape._shape.shape = std::move(composition);
} }
template<UnsignedInt dimensions> void ShapeHelper<Composition<dimensions>>::transform(Shapes::Shape<Composition<dimensions>>& shape, const typename DimensionTraits<dimensions, Float>::MatrixType& absoluteTransformationMatrix) { template<UnsignedInt dimensions> void ShapeHelper<Composition<dimensions>>::transform(Shapes::Shape<Composition<dimensions>>& shape, const MatrixTypeFor<dimensions, Float>& absoluteTransformationMatrix) {
CORRADE_INTERNAL_ASSERT(shape._shape.shape.size() == shape._transformedShape.shape.size()); CORRADE_INTERNAL_ASSERT(shape._shape.shape.size() == shape._transformedShape.shape.size());
for(std::size_t i = 0; i != shape.shape().size(); ++i) for(std::size_t i = 0; i != shape.shape().size(); ++i)
shape._shape.shape._shapes[i]->transform(absoluteTransformationMatrix, shape._transformedShape.shape._shapes[i]); shape._shape.shape._shapes[i]->transform(absoluteTransformationMatrix, shape._transformedShape.shape._shapes[i]);

8
src/Magnum/Shapes/Shape.h

@ -108,7 +108,7 @@ template<class T> class Shape: public AbstractShape<T::Dimensions> {
protected: protected:
/** Applies transformation to associated shape. */ /** Applies transformation to associated shape. */
void clean(const typename DimensionTraits<T::Dimensions, Float>::MatrixType& absoluteTransformationMatrix) override; void clean(const MatrixTypeFor<T::Dimensions, Float>& absoluteTransformationMatrix) override;
private: private:
const Implementation::AbstractShape<T::Dimensions>& abstractTransformedShape() const override { const Implementation::AbstractShape<T::Dimensions>& abstractTransformedShape() const override {
@ -129,7 +129,7 @@ template<class T> inline const T& Shape<T>::transformedShape() {
return _transformedShape.shape; return _transformedShape.shape;
} }
template<class T> void Shape<T>::clean(const typename DimensionTraits<T::Dimensions, Float>::MatrixType& absoluteTransformationMatrix) { template<class T> void Shape<T>::clean(const MatrixTypeFor<T::Dimensions, Float>& absoluteTransformationMatrix) {
Implementation::ShapeHelper<T>::transform(*this, absoluteTransformationMatrix); Implementation::ShapeHelper<T>::transform(*this, absoluteTransformationMatrix);
} }
@ -139,7 +139,7 @@ namespace Implementation {
shape._shape.shape = s; shape._shape.shape = s;
} }
static void transform(Shapes::Shape<T>& shape, const typename DimensionTraits<T::Dimensions, Float>::MatrixType& absoluteTransformationMatrix) { static void transform(Shapes::Shape<T>& shape, const MatrixTypeFor<T::Dimensions, Float>& absoluteTransformationMatrix) {
shape._transformedShape.shape = shape._shape.shape.transformed(absoluteTransformationMatrix); shape._transformedShape.shape = shape._shape.shape.transformed(absoluteTransformationMatrix);
} }
}; };
@ -148,7 +148,7 @@ namespace Implementation {
static void set(Shapes::Shape<Composition<dimensions>>& shape, const Composition<dimensions>& composition); static void set(Shapes::Shape<Composition<dimensions>>& shape, const Composition<dimensions>& composition);
static void set(Shapes::Shape<Composition<dimensions>>& shape, Composition<dimensions>&& composition); static void set(Shapes::Shape<Composition<dimensions>>& shape, Composition<dimensions>&& composition);
static void transform(Shapes::Shape<Composition<dimensions>>& shape, const typename DimensionTraits<dimensions, Float>::MatrixType& absoluteTransformationMatrix); static void transform(Shapes::Shape<Composition<dimensions>>& shape, const MatrixTypeFor<dimensions, Float>& absoluteTransformationMatrix);
}; };
} }

22
src/Magnum/Shapes/Sphere.cpp

@ -37,7 +37,7 @@ using namespace Magnum::Math::Geometry;
namespace Magnum { namespace Shapes { namespace Magnum { namespace Shapes {
template<UnsignedInt dimensions> Sphere<dimensions> Sphere<dimensions>::transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { template<UnsignedInt dimensions> Sphere<dimensions> Sphere<dimensions>::transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Sphere<dimensions>(matrix.transformPoint(_position), matrix.uniformScaling()*_radius); return Sphere<dimensions>(matrix.transformPoint(_position), matrix.uniformScaling()*_radius);
} }
@ -50,7 +50,7 @@ template<UnsignedInt dimensions> bool InvertedSphere<dimensions>::operator%(cons
} }
template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::operator/(const Point<dimensions>& other) const { template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::operator/(const Point<dimensions>& other) const {
const typename DimensionTraits<dimensions, Float>::VectorType separating = _position - other.position(); const VectorTypeFor<dimensions, Float> separating = _position - other.position();
const Float dot = separating.dot(); const Float dot = separating.dot();
/* No collision occured */ /* No collision occured */
@ -61,9 +61,9 @@ template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::opera
/* Separating normal. If can't decide on direction, just move up. */ /* Separating normal. If can't decide on direction, just move up. */
/** @todo How to handle this in a configurable way? */ /** @todo How to handle this in a configurable way? */
const typename DimensionTraits<dimensions, Float>::VectorType separatingNormal = const VectorTypeFor<dimensions, Float> separatingNormal =
Math::TypeTraits<Float>::equals(dot, 0.0f) ? Math::TypeTraits<Float>::equals(dot, 0.0f) ?
DimensionTraits<dimensions, Float>::VectorType::yAxis() : VectorTypeFor<dimensions, Float>::yAxis() :
separating/distance; separating/distance;
/* Collision position is on the point */ /* Collision position is on the point */
@ -71,7 +71,7 @@ template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::opera
} }
template<UnsignedInt dimensions> Collision<dimensions> InvertedSphere<dimensions>::operator/(const Point<dimensions>& other) const { template<UnsignedInt dimensions> Collision<dimensions> InvertedSphere<dimensions>::operator/(const Point<dimensions>& other) const {
const typename DimensionTraits<dimensions, Float>::VectorType separating = other.position() - position(); const VectorTypeFor<dimensions, Float> separating = other.position() - position();
const Float dot = separating.dot(); const Float dot = separating.dot();
/* No collision occured */ /* No collision occured */
@ -81,7 +81,7 @@ template<UnsignedInt dimensions> Collision<dimensions> InvertedSphere<dimensions
const Float distance = Math::sqrt(dot); const Float distance = Math::sqrt(dot);
/* Separating normal */ /* Separating normal */
const typename DimensionTraits<dimensions, Float>::VectorType separatingNormal = separating/distance; const VectorTypeFor<dimensions, Float> separatingNormal = separating/distance;
/* Collision position is on the point */ /* Collision position is on the point */
return Collision<dimensions>(other.position(), separatingNormal, distance - radius()); return Collision<dimensions>(other.position(), separatingNormal, distance - radius());
@ -105,7 +105,7 @@ template<UnsignedInt dimensions> bool InvertedSphere<dimensions>::operator%(cons
template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::operator/(const Sphere<dimensions>& other) const { template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::operator/(const Sphere<dimensions>& other) const {
const Float minDistance = _radius + other._radius; const Float minDistance = _radius + other._radius;
const typename DimensionTraits<dimensions, Float>::VectorType separating = _position - other._position; const VectorTypeFor<dimensions, Float> separating = _position - other._position;
const Float dot = separating.dot(); const Float dot = separating.dot();
/* No collision occured */ /* No collision occured */
@ -116,9 +116,9 @@ template<UnsignedInt dimensions> Collision<dimensions> Sphere<dimensions>::opera
/* Separating normal. If can't decide on direction, just move up. */ /* Separating normal. If can't decide on direction, just move up. */
/** @todo How to handle this in a configurable way? */ /** @todo How to handle this in a configurable way? */
const typename DimensionTraits<dimensions, Float>::VectorType separatingNormal = const VectorTypeFor<dimensions, Float> separatingNormal =
Math::TypeTraits<Float>::equals(dot, 0.0f) ? Math::TypeTraits<Float>::equals(dot, 0.0f) ?
DimensionTraits<dimensions, Float>::VectorType::yAxis() : VectorTypeFor<dimensions, Float>::yAxis() :
separating/distance; separating/distance;
/* Contact position is on the surface of `other`, minDistace > distance */ /* Contact position is on the surface of `other`, minDistace > distance */
@ -129,7 +129,7 @@ template<UnsignedInt dimensions> Collision<dimensions> InvertedSphere<dimensions
const Float maxDistance = radius() - other.radius(); const Float maxDistance = radius() - other.radius();
/** @todo How to handle inseparable shapes or shapes which can't be separated by movement only (i.e. two half-spaces)? */ /** @todo How to handle inseparable shapes or shapes which can't be separated by movement only (i.e. two half-spaces)? */
CORRADE_INTERNAL_ASSERT(maxDistance > 0.0f); CORRADE_INTERNAL_ASSERT(maxDistance > 0.0f);
const typename DimensionTraits<dimensions, Float>::VectorType separating = other.position() - position(); const VectorTypeFor<dimensions, Float> separating = other.position() - position();
const Float dot = separating.dot(); const Float dot = separating.dot();
/* No collision occured */ /* No collision occured */
@ -139,7 +139,7 @@ template<UnsignedInt dimensions> Collision<dimensions> InvertedSphere<dimensions
const Float distance = Math::sqrt(dot); const Float distance = Math::sqrt(dot);
/* Separating normal */ /* Separating normal */
const typename DimensionTraits<dimensions, Float>::VectorType separatingNormal = separating/distance; const VectorTypeFor<dimensions, Float> separatingNormal = separating/distance;
/* Contact position is on the surface of `other`, distance > maxDistance */ /* Contact position is on the surface of `other`, distance > maxDistance */
return Collision<dimensions>(other.position() + separatingNormal*other.radius(), separatingNormal, distance - maxDistance); return Collision<dimensions>(other.position() + separatingNormal*other.radius(), separatingNormal, distance - maxDistance);

14
src/Magnum/Shapes/Sphere.h

@ -60,18 +60,18 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Sphere {
constexpr /*implicit*/ Sphere(): _radius(0.0f) {} constexpr /*implicit*/ Sphere(): _radius(0.0f) {}
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ Sphere(const typename DimensionTraits<dimensions, Float>::VectorType& position, Float radius): _position(position), _radius(radius) {} constexpr /*implicit*/ Sphere(const VectorTypeFor<dimensions, Float>& position, Float radius): _position(position), _radius(radius) {}
/** @brief Transformed shape */ /** @brief Transformed shape */
Sphere<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const; Sphere<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const;
/** @brief Position */ /** @brief Position */
constexpr typename DimensionTraits<dimensions, Float>::VectorType position() const { constexpr VectorTypeFor<dimensions, Float> position() const {
return _position; return _position;
} }
/** @brief Set position */ /** @brief Set position */
void setPosition(const typename DimensionTraits<dimensions, Float>::VectorType& position) { void setPosition(const VectorTypeFor<dimensions, Float>& position) {
_position = position; _position = position;
} }
@ -100,7 +100,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT Sphere {
Collision<dimensions> operator/(const Sphere<dimensions>& other) const; Collision<dimensions> operator/(const Sphere<dimensions>& other) const;
private: private:
typename DimensionTraits<dimensions, Float>::VectorType _position; VectorTypeFor<dimensions, Float> _position;
Float _radius; Float _radius;
}; };
@ -133,12 +133,12 @@ template<UnsignedInt dimensions> class MAGNUM_SHAPES_EXPORT InvertedSphere:
constexpr /*implicit*/ InvertedSphere() = default; constexpr /*implicit*/ InvertedSphere() = default;
/** @brief Constructor */ /** @brief Constructor */
constexpr /*implicit*/ InvertedSphere(const typename DimensionTraits<dimensions, Float>::VectorType& position, Float radius): Sphere<dimensions>(position, radius) {} constexpr /*implicit*/ InvertedSphere(const VectorTypeFor<dimensions, Float>& position, Float radius): Sphere<dimensions>(position, radius) {}
using Sphere<dimensions>::Dimensions; using Sphere<dimensions>::Dimensions;
/** @brief Transformed shape */ /** @brief Transformed shape */
InvertedSphere<dimensions> transformed(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix) const { InvertedSphere<dimensions> transformed(const MatrixTypeFor<dimensions, Float>& matrix) const {
return Sphere<dimensions>::transformed(matrix); return Sphere<dimensions>::transformed(matrix);
} }

4
src/Magnum/Shapes/shapeImplementation.h

@ -158,7 +158,7 @@ template<UnsignedInt dimensions> struct MAGNUM_SHAPES_EXPORT AbstractShape {
virtual typename ShapeDimensionTraits<dimensions>::Type MAGNUM_SHAPES_LOCAL type() const = 0; virtual typename ShapeDimensionTraits<dimensions>::Type MAGNUM_SHAPES_LOCAL type() const = 0;
virtual AbstractShape<dimensions> MAGNUM_SHAPES_LOCAL * clone() const = 0; virtual AbstractShape<dimensions> MAGNUM_SHAPES_LOCAL * clone() const = 0;
virtual void MAGNUM_SHAPES_LOCAL transform(const typename DimensionTraits<dimensions, Float>::MatrixType& matrix, AbstractShape<dimensions>* result) const = 0; virtual void MAGNUM_SHAPES_LOCAL transform(const MatrixTypeFor<dimensions, Float>& matrix, AbstractShape<dimensions>* result) const = 0;
}; };
template<class T> struct Shape: AbstractShape<T::Dimensions> { template<class T> struct Shape: AbstractShape<T::Dimensions> {
@ -176,7 +176,7 @@ template<class T> struct Shape: AbstractShape<T::Dimensions> {
return new Shape<T>(shape); return new Shape<T>(shape);
} }
void transform(const typename DimensionTraits<T::Dimensions, Float>::MatrixType& matrix, AbstractShape<T::Dimensions>* result) const override { void transform(const MatrixTypeFor<T::Dimensions, Float>& matrix, AbstractShape<T::Dimensions>* result) const override {
CORRADE_INTERNAL_ASSERT(result->type() == type()); CORRADE_INTERNAL_ASSERT(result->type() == type());
static_cast<Shape<T>*>(result)->shape = shape.transformed(matrix); static_cast<Shape<T>*>(result)->shape = shape.transformed(matrix);
} }

4
src/Magnum/Texture.cpp

@ -34,8 +34,8 @@
namespace Magnum { namespace Implementation { namespace Magnum { namespace Implementation {
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Int>::VectorType maxTextureSize() { template<UnsignedInt dimensions> VectorTypeFor<dimensions, Int> maxTextureSize() {
return typename DimensionTraits<dimensions, Int>::VectorType{Implementation::maxTextureSideSize()}; return VectorTypeFor<dimensions, Int>{Implementation::maxTextureSideSize()};
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

16
src/Magnum/Texture.h

@ -52,7 +52,7 @@ namespace Implementation {
#endif #endif
} }
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Int>::VectorType maxTextureSize(); template<UnsignedInt dimensions> VectorTypeFor<dimensions, Int> maxTextureSize();
template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>(); template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>();
} }
@ -152,7 +152,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE}, * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE},
* @def_gl{MAX_3D_TEXTURE_SIZE} * @def_gl{MAX_3D_TEXTURE_SIZE}
*/ */
static typename DimensionTraits<dimensions, Int>::VectorType maxSize() { static VectorTypeFor<dimensions, Int> maxSize() {
return Implementation::maxTextureSize<dimensions>(); return Implementation::maxTextureSize<dimensions>();
} }
@ -198,7 +198,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @def_gl{TEXTURE_DEPTH} * @def_gl{TEXTURE_DEPTH}
* @requires_gl %Texture image queries are not available in OpenGL ES. * @requires_gl %Texture image queries are not available in OpenGL ES.
*/ */
typename DimensionTraits<dimensions, Int>::VectorType imageSize(Int level) { VectorTypeFor<dimensions, Int> imageSize(Int level) {
return DataHelper<dimensions>::imageSize(*this, _target, level); return DataHelper<dimensions>::imageSize(*this, _target, level);
} }
#endif #endif
@ -585,7 +585,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @todo allow the user to specify ColorType explicitly to avoid * @todo allow the user to specify ColorType explicitly to avoid
* issues in WebGL (see setSubImage()) * issues in WebGL (see setSubImage())
*/ */
Texture<dimensions>& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits<dimensions, Int>::VectorType& size) { Texture<dimensions>& setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor<dimensions, Int>& size) {
DataHelper<dimensions>::setStorage(*this, _target, levels, internalFormat, size); DataHelper<dimensions>::setStorage(*this, _target, levels, internalFormat, size);
return *this; return *this;
} }
@ -695,20 +695,20 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/
* @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access}
*/ */
Texture<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions, Int>::VectorType& offset, const ImageReference<dimensions>& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, const ImageReference<dimensions>& image) {
DataHelper<Dimensions>::setSubImage(*this, _target, level, offset, image); DataHelper<Dimensions>::setSubImage(*this, _target, level, offset, image);
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** @overload */ /** @overload */
Texture<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions, Int>::VectorType& offset, BufferImage<dimensions>& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>& image) {
DataHelper<Dimensions>::setSubImage(*this, _target, level, offset, image); DataHelper<Dimensions>::setSubImage(*this, _target, level, offset, image);
return *this; return *this;
} }
/** @overload */ /** @overload */
Texture<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions, Int>::VectorType& offset, BufferImage<dimensions>&& image) { Texture<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, BufferImage<dimensions>&& image) {
return setSubImage(level, offset, image); return setSubImage(level, offset, image);
} }
#endif #endif
@ -749,7 +749,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* (part of OpenGL 4.3) is not available, this function does nothing. * (part of OpenGL 4.3) is not available, this function does nothing.
* @see @ref invalidateImage(), @fn_gl{InvalidateTexSubImage} * @see @ref invalidateImage(), @fn_gl{InvalidateTexSubImage}
*/ */
void invalidateSubImage(Int level, const typename DimensionTraits<dimensions, Int>::VectorType& offset, const typename DimensionTraits<dimensions, Int>::VectorType& size) { void invalidateSubImage(Int level, const VectorTypeFor<dimensions, Int>& offset, const VectorTypeFor<dimensions, Int>& size) {
DataHelper<dimensions>::invalidateSubImage(*this, level, offset, size); DataHelper<dimensions>::invalidateSubImage(*this, level, offset, size);
} }

2
src/Magnum/TextureArray.cpp

@ -39,7 +39,7 @@ namespace {
template<> struct VectorOrScalar<2> { typedef Vector2i Type; }; template<> struct VectorOrScalar<2> { typedef Vector2i Type; };
} }
template<UnsignedInt dimensions> typename DimensionTraits<dimensions+1, Int>::VectorType TextureArray<dimensions>::maxSize() { template<UnsignedInt dimensions> VectorTypeFor<dimensions+1, Int> TextureArray<dimensions>::maxSize() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_array>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_array>())
return {}; return {};

14
src/Magnum/TextureArray.h

@ -105,7 +105,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and * @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and
* @def_gl{MAX_ARRAY_TEXTURE_LAYERS} * @def_gl{MAX_ARRAY_TEXTURE_LAYERS}
*/ */
static typename DimensionTraits<dimensions+1, Int>::VectorType maxSize(); static VectorTypeFor<dimensions+1, Int> maxSize();
/** /**
* @brief Constructor * @brief Constructor
@ -251,7 +251,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** @copydoc Texture::imageSize() */ /** @copydoc Texture::imageSize() */
typename DimensionTraits<dimensions+1, Int>::VectorType imageSize(Int level) { VectorTypeFor<dimensions+1, Int> imageSize(Int level) {
return DataHelper<dimensions+1>::imageSize(*this, _target, level); return DataHelper<dimensions+1>::imageSize(*this, _target, level);
} }
#endif #endif
@ -282,7 +282,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/
* @fn_gl_extension{TextureImage3D,EXT,direct_state_access}. * @fn_gl_extension{TextureImage3D,EXT,direct_state_access}.
*/ */
TextureArray<dimensions>& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits<dimensions+1, Int>::VectorType& size) { TextureArray<dimensions>& setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor<dimensions+1, Int>& size) {
DataHelper<dimensions+1>::setStorage(*this, _target, levels, internalFormat, size); DataHelper<dimensions+1>::setStorage(*this, _target, levels, internalFormat, size);
return *this; return *this;
} }
@ -351,20 +351,20 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* or @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * or @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/
* @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access}
*/ */
TextureArray<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions+1, Int>::VectorType& offset, const ImageReference<dimensions+1>& image) { TextureArray<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const ImageReference<dimensions+1>& image) {
DataHelper<dimensions+1>::setSubImage(*this, _target, level, offset, image); DataHelper<dimensions+1>::setSubImage(*this, _target, level, offset, image);
return *this; return *this;
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** @overload */ /** @overload */
TextureArray<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions+1, Int>::VectorType& offset, BufferImage<dimensions+1>& image) { TextureArray<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>& image) {
DataHelper<dimensions+1>::setSubImage(*this, _target, level, offset, image); DataHelper<dimensions+1>::setSubImage(*this, _target, level, offset, image);
return *this; return *this;
} }
/** @overload */ /** @overload */
TextureArray<dimensions>& setSubImage(Int level, const typename DimensionTraits<dimensions+1, Int>::VectorType& offset, BufferImage<dimensions+1>&& image) { TextureArray<dimensions>& setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>&& image) {
return setSubImage(level, offset, image); return setSubImage(level, offset, image);
} }
#endif #endif
@ -379,7 +379,7 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
void invalidateImage(Int level) { AbstractTexture::invalidateImage(level); } void invalidateImage(Int level) { AbstractTexture::invalidateImage(level); }
/** @copydoc Texture::invalidateSubImage() */ /** @copydoc Texture::invalidateSubImage() */
void invalidateSubImage(Int level, const typename DimensionTraits<dimensions+1, Int>::VectorType& offset, const typename DimensionTraits<dimensions+1, Int>::VectorType& size) { void invalidateSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const VectorTypeFor<dimensions+1, Int>& size) {
DataHelper<dimensions+1>::invalidateSubImage(*this, level, offset, size); DataHelper<dimensions+1>::invalidateSubImage(*this, level, offset, size);
} }

6
src/Magnum/Trade/ImageData.h

@ -54,7 +54,7 @@ template<UnsignedInt dimensions> class ImageData: public AbstractImage {
* Note that the image data are not copied on construction, but they * Note that the image data are not copied on construction, but they
* are deleted on class destruction. * are deleted on class destruction.
*/ */
explicit ImageData(ColorFormat format, ColorType type, const typename DimensionTraits<Dimensions, Int>::VectorType& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<unsigned char*>(data)) {} explicit ImageData(ColorFormat format, ColorType type, const VectorTypeFor<dimensions, Int>& size, void* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<unsigned char*>(data)) {}
/** @brief Copying is not allowed */ /** @brief Copying is not allowed */
ImageData(const ImageData<dimensions>&) = delete; ImageData(const ImageData<dimensions>&) = delete;
@ -85,10 +85,10 @@ template<UnsignedInt dimensions> class ImageData: public AbstractImage {
#endif #endif
/** @brief %Image size */ /** @brief %Image size */
typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; } VectorTypeFor<dimensions, Int> size() const { return _size; }
/** @copydoc Image::dataSize() */ /** @copydoc Image::dataSize() */
std::size_t dataSize(const typename DimensionTraits<Dimensions, Int>::VectorType& size) const { std::size_t dataSize(const VectorTypeFor<dimensions, Int>& size) const {
return AbstractImage::dataSize<dimensions>(size); return AbstractImage::dataSize<dimensions>(size);
} }

Loading…
Cancel
Save