From f4e409bfd9d7d06c98cff6d56bfae5019b2b5595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 11 Nov 2019 13:28:43 +0100 Subject: [PATCH] MeshTools: allow views to be passed to the transform*() functions. Before, the functions didn't accept a r-value view. Now they do, and they also still accept l-values. However, for a proper thing I should be making those non-templated, specialized for Float and Double and implemented using SIMD. Well, later. --- src/Magnum/MeshTools/Transform.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Magnum/MeshTools/Transform.h b/src/Magnum/MeshTools/Transform.h index 1cf1065c8..444ebccf6 100644 --- a/src/Magnum/MeshTools/Transform.h +++ b/src/Magnum/MeshTools/Transform.h @@ -55,22 +55,22 @@ Example usage: @ref Quaternion::transformVectorNormalized() @todo GPU transform feedback implementation (otherwise this is only bad joke) */ -template void transformVectorsInPlace(const Math::Matrix4& matrix, U& vectors) { +template void transformVectorsInPlace(const Math::Matrix4& matrix, U&& vectors) { for(auto& vector: vectors) vector = matrix.transformVector(vector); } /** @overload */ -template void transformVectorsInPlace(const Math::Matrix3& matrix, U& vectors) { +template void transformVectorsInPlace(const Math::Matrix3& matrix, U&& vectors) { for(auto& vector: vectors) vector = matrix.transformVector(vector); } /** @overload */ -template void transformVectorsInPlace(const Math::Complex& complex, U& vectors) { +template void transformVectorsInPlace(const Math::Complex& complex, U&& vectors) { for(auto& vector: vectors) vector = complex.transformVector(vector); } /** @overload */ -template void transformVectorsInPlace(const Math::Quaternion& normalizedQuaternion, U& vectors) { +template void transformVectorsInPlace(const Math::Quaternion& normalizedQuaternion, U&& vectors) { for(auto& vector: vectors) vector = normalizedQuaternion.transformVectorNormalized(vector); } @@ -106,22 +106,22 @@ Example usage: @ref Matrix4::transformPoint(), @ref DualQuaternion::transformPointNormalized() */ -template void transformPointsInPlace(const Math::Matrix4& matrix, U& points) { +template void transformPointsInPlace(const Math::Matrix4& matrix, U&& points) { for(auto& point: points) point = matrix.transformPoint(point); } /** @overload */ -template void transformPointsInPlace(const Math::Matrix3& matrix, U& points) { +template void transformPointsInPlace(const Math::Matrix3& matrix, U&& points) { for(auto& point: points) point = matrix.transformPoint(point); } /** @overload */ -template void transformPointsInPlace(const Math::DualComplex& dualComplex, U& points) { +template void transformPointsInPlace(const Math::DualComplex& dualComplex, U&& points) { for(auto& point: points) point = dualComplex.transformPoint(point); } /** @overload */ -template void transformPointsInPlace(const Math::DualQuaternion& normalizedDualQuaternion, U& points) { +template void transformPointsInPlace(const Math::DualQuaternion& normalizedDualQuaternion, U&& points) { for(auto& point: points) point = normalizedDualQuaternion.transformPointNormalized(point); }