Browse Source

MeshTools: remove redundant MeshTools:: prefixes where possible.

Except for test cases that ended up having the same name as the API they
test.
pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
8d023a7612
  1. 2
      src/Magnum/MeshTools/CombineIndexedArrays.cpp
  2. 18
      src/Magnum/MeshTools/Compile.cpp
  3. 2
      src/Magnum/MeshTools/GenerateNormals.cpp
  4. 4
      src/Magnum/MeshTools/RemoveDuplicates.cpp
  5. 42
      src/Magnum/MeshTools/Test/BoundingVolumeTest.cpp
  6. 6
      src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp
  7. 42
      src/Magnum/MeshTools/Test/CombineTest.cpp
  8. 22
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  9. 16
      src/Magnum/MeshTools/Test/CompressIndicesTest.cpp
  10. 2
      src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp
  11. 16
      src/Magnum/MeshTools/Test/TransformTest.cpp

2
src/Magnum/MeshTools/CombineIndexedArrays.cpp

@ -59,7 +59,7 @@ std::pair<std::vector<UnsignedInt>, std::vector<UnsignedInt>> interleaveAndCombi
/* Combine them */ /* Combine them */
std::vector<UnsignedInt> combinedIndices; std::vector<UnsignedInt> combinedIndices;
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
std::tie(combinedIndices, interleavedArrays) = MeshTools::combineIndexArrays(interleavedArrays, stride); std::tie(combinedIndices, interleavedArrays) = combineIndexArrays(interleavedArrays, stride);
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
return {combinedIndices, interleavedArrays}; return {combinedIndices, interleavedArrays};
} }

18
src/Magnum/MeshTools/Compile.cpp

@ -360,7 +360,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
/* Interleave positions and put them in with ownership transfer, use the /* Interleave positions and put them in with ownership transfer, use the
ref for the rest */ ref for the rest */
Containers::Array<char> data = MeshTools::interleave( Containers::Array<char> data = interleave(
meshData.positions(0), meshData.positions(0),
stride - sizeof(Shaders::Generic2D::Position::Type)); stride - sizeof(Shaders::Generic2D::Position::Type));
mesh.addVertexBuffer(std::move(vertexBuffer), 0, mesh.addVertexBuffer(std::move(vertexBuffer), 0,
@ -369,7 +369,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
/* Add also texture coordinates, if present */ /* Add also texture coordinates, if present */
if(meshData.hasTextureCoords2D()) { if(meshData.hasTextureCoords2D()) {
MeshTools::interleaveInto(data, interleaveInto(data,
textureCoordsOffset, textureCoordsOffset,
meshData.textureCoords2D(0), meshData.textureCoords2D(0),
stride - textureCoordsOffset - sizeof(Shaders::Generic2D::TextureCoordinates::Type)); stride - textureCoordsOffset - sizeof(Shaders::Generic2D::TextureCoordinates::Type));
@ -381,7 +381,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
/* Add also colors, if present */ /* Add also colors, if present */
if(meshData.hasColors()) { if(meshData.hasColors()) {
MeshTools::interleaveInto(data, interleaveInto(data,
colorsOffset, colorsOffset,
meshData.colors(0), meshData.colors(0),
stride - colorsOffset - sizeof(Shaders::Generic3D::Color4::Type)); stride - colorsOffset - sizeof(Shaders::Generic3D::Color4::Type));
@ -399,7 +399,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
Containers::Array<char> indexData; Containers::Array<char> indexData;
MeshIndexType indexType; MeshIndexType indexType;
UnsignedInt indexStart, indexEnd; UnsignedInt indexStart, indexEnd;
std::tie(indexData, indexType, indexStart, indexEnd) = MeshTools::compressIndices(meshData.indices()); std::tie(indexData, indexType, indexStart, indexEnd) = compressIndices(meshData.indices());
GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray}; GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray};
indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw); indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw);
@ -501,7 +501,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
/* Interleave positions and put them in with ownership transfer, use the /* Interleave positions and put them in with ownership transfer, use the
ref for the rest */ ref for the rest */
Containers::Array<char> data = MeshTools::interleave( Containers::Array<char> data = interleave(
positions, positions,
stride - sizeof(Shaders::Generic3D::Position::Type)); stride - sizeof(Shaders::Generic3D::Position::Type));
mesh.addVertexBuffer(std::move(vertexBuffer), 0, mesh.addVertexBuffer(std::move(vertexBuffer), 0,
@ -510,7 +510,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
/* Add also normals, if present */ /* Add also normals, if present */
if(normals) { if(normals) {
MeshTools::interleaveInto(data, interleaveInto(data,
normalOffset, normalOffset,
normals, normals,
stride - normalOffset - sizeof(Shaders::Generic3D::Normal::Type)); stride - normalOffset - sizeof(Shaders::Generic3D::Normal::Type));
@ -522,7 +522,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
/* Add also texture coordinates, if present */ /* Add also texture coordinates, if present */
if(textureCoords2D) { if(textureCoords2D) {
MeshTools::interleaveInto(data, interleaveInto(data,
textureCoordsOffset, textureCoordsOffset,
textureCoords2D, textureCoords2D,
stride - textureCoordsOffset - sizeof(Shaders::Generic3D::TextureCoordinates::Type)); stride - textureCoordsOffset - sizeof(Shaders::Generic3D::TextureCoordinates::Type));
@ -534,7 +534,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
/* Add also colors, if present */ /* Add also colors, if present */
if(colors) { if(colors) {
MeshTools::interleaveInto(data, interleaveInto(data,
colorsOffset, colorsOffset,
colors, colors,
stride - colorsOffset - sizeof(Shaders::Generic3D::Color4::Type)); stride - colorsOffset - sizeof(Shaders::Generic3D::Color4::Type));
@ -553,7 +553,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
Containers::Array<char> indexData; Containers::Array<char> indexData;
MeshIndexType indexType; MeshIndexType indexType;
UnsignedInt indexStart, indexEnd; UnsignedInt indexStart, indexEnd;
std::tie(indexData, indexType, indexStart, indexEnd) = MeshTools::compressIndices(meshData.indices()); std::tie(indexData, indexType, indexStart, indexEnd) = compressIndices(meshData.indices());
GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray}; GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray};
indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw); indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw);

2
src/Magnum/MeshTools/GenerateNormals.cpp

@ -83,7 +83,7 @@ std::pair<std::vector<UnsignedInt>, std::vector<Vector3>> generateFlatNormals(co
/* Remove duplicate normals and return */ /* Remove duplicate normals and return */
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
normalIndices = MeshTools::duplicate(normalIndices, MeshTools::removeDuplicates(normals)); normalIndices = duplicate(normalIndices, removeDuplicates(normals));
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
return {std::move(normalIndices), std::move(normals)}; return {std::move(normalIndices), std::move(normals)};
} }

4
src/Magnum/MeshTools/RemoveDuplicates.cpp

@ -429,7 +429,7 @@ Trade::MeshData removeDuplicates(const Trade::MeshData& mesh) {
/* Because the interleaved mesh was forced to be repacked, the vertex data /* Because the interleaved mesh was forced to be repacked, the vertex data
should span the whole stride -- this is relied on in the attribute should span the whole stride -- this is relied on in the attribute
rerouting loop below */ rerouting loop below */
const Containers::StridedArrayView2D<char> vertexData = MeshTools::interleavedMutableData(ownedInterleaved); const Containers::StridedArrayView2D<char> vertexData = interleavedMutableData(ownedInterleaved);
CORRADE_INTERNAL_ASSERT(vertexData.size()[1] == std::size_t(ownedInterleaved.attributeStride(0))); CORRADE_INTERNAL_ASSERT(vertexData.size()[1] == std::size_t(ownedInterleaved.attributeStride(0)));
UnsignedInt uniqueVertexCount; UnsignedInt uniqueVertexCount;
@ -474,7 +474,7 @@ Trade::MeshData removeDuplicatesFuzzy(const Trade::MeshData& mesh, const Float f
/* Turn the passed data into an owned mutable instance we can operate on. /* Turn the passed data into an owned mutable instance we can operate on.
There's a chance the original data are already like this, in which case There's a chance the original data are already like this, in which case
this will be just a passthrough. */ this will be just a passthrough. */
Trade::MeshData owned = MeshTools::copy(std::move(mesh)); Trade::MeshData owned = copy(std::move(mesh));
/* Allocate an interleaved index array for all vertices times all /* Allocate an interleaved index array for all vertices times all
attributes */ attributes */

42
src/Magnum/MeshTools/Test/BoundingVolumeTest.cpp

@ -73,7 +73,7 @@ void BoundingVolumeTest::range() {
that the input and output are forwarded correctly */ that the input and output are forwarded correctly */
constexpr Float cylinderLength = 7.0f; constexpr Float cylinderLength = 7.0f;
const Trade::MeshData cylinderMesh = Primitives::capsule3DSolid(3, 1, 12, cylinderLength*0.5f); const Trade::MeshData cylinderMesh = Primitives::capsule3DSolid(3, 1, 12, cylinderLength*0.5f);
const Range3D box = MeshTools::boundingRange( const Range3D box = boundingRange(
cylinderMesh.attribute<Vector3>(Trade::MeshAttribute::Position)); cylinderMesh.attribute<Vector3>(Trade::MeshAttribute::Position));
CORRADE_COMPARE(box.center(), Vector3{}); CORRADE_COMPARE(box.center(), Vector3{});
@ -83,7 +83,7 @@ void BoundingVolumeTest::range() {
void BoundingVolumeTest::rangeNaN() { void BoundingVolumeTest::rangeNaN() {
/* NaNs are skipped (unless it's all NaNs), matching minmax() behaviour */ /* NaNs are skipped (unless it's all NaNs), matching minmax() behaviour */
{ {
const Range3D box = MeshTools::boundingRange(Containers::stridedArrayView({ const Range3D box = boundingRange(Containers::stridedArrayView({
Vector3{Constants::nan()}, Vector3{Constants::nan()},
Vector3{1.0f, 1.0f, 1.0f}, Vector3{1.0f, 1.0f, 1.0f},
Vector3{Constants::nan()}, Vector3{Constants::nan()},
@ -93,7 +93,7 @@ void BoundingVolumeTest::rangeNaN() {
CORRADE_COMPARE(box.min(), (Vector3{1.0f, 1.0f, 1.0f})); CORRADE_COMPARE(box.min(), (Vector3{1.0f, 1.0f, 1.0f}));
CORRADE_COMPARE(box.max(), (Vector3{2.0f, 2.0f, 2.0f})); CORRADE_COMPARE(box.max(), (Vector3{2.0f, 2.0f, 2.0f}));
} { } {
const Range3D box = MeshTools::boundingRange(Containers::stridedArrayView({ const Range3D box = boundingRange(Containers::stridedArrayView({
Vector3{Constants::nan()}, Vector3{Constants::nan()},
Vector3{Constants::nan()} Vector3{Constants::nan()}
})); }));
@ -107,7 +107,7 @@ void BoundingVolumeTest::sphereBouncingBubble() {
all identical positions */ all identical positions */
{ {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::StridedArrayView1D<const Vector3>{}); boundingSphereBouncingBubble(Containers::StridedArrayView1D<const Vector3>{});
CORRADE_COMPARE(sphere.first(), (Vector3{})); CORRADE_COMPARE(sphere.first(), (Vector3{}));
CORRADE_COMPARE(sphere.second(), Math::TypeTraits<Float>::epsilon()); CORRADE_COMPARE(sphere.second(), Math::TypeTraits<Float>::epsilon());
@ -115,14 +115,14 @@ void BoundingVolumeTest::sphereBouncingBubble() {
the algorithm */ the algorithm */
} { } {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{1.0f, 2.0f, 3.0f} Vector3{1.0f, 2.0f, 3.0f}
})); }));
CORRADE_COMPARE(sphere.first(), (Vector3{1.0f, 2.0f, 3.0f})); CORRADE_COMPARE(sphere.first(), (Vector3{1.0f, 2.0f, 3.0f}));
CORRADE_COMPARE(sphere.second(), Math::TypeTraits<Float>::epsilon()); CORRADE_COMPARE(sphere.second(), Math::TypeTraits<Float>::epsilon());
} { } {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{3.0f, 1.0f, 2.0f}, Vector3{3.0f, 1.0f, 2.0f},
Vector3{3.0f, 1.0f, 2.0f}, Vector3{3.0f, 1.0f, 2.0f},
Vector3{3.0f, 1.0f, 2.0f} Vector3{3.0f, 1.0f, 2.0f}
@ -133,7 +133,7 @@ void BoundingVolumeTest::sphereBouncingBubble() {
/* Simple cases */ /* Simple cases */
} { } {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{1.0f, 1.0f, 1.0f}, Vector3{1.0f, 1.0f, 1.0f},
Vector3{2.0f, 2.0f, 2.0f} Vector3{2.0f, 2.0f, 2.0f}
})); }));
@ -141,7 +141,7 @@ void BoundingVolumeTest::sphereBouncingBubble() {
CORRADE_COMPARE(sphere.second(), Vector3{0.5f}.length()); CORRADE_COMPARE(sphere.second(), Vector3{0.5f}.length());
} { } {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{2.0f, 0.0f, 0.0f}, Vector3{2.0f, 0.0f, 0.0f},
Vector3{-2.0f, 0.0f, 0.0f}, Vector3{-2.0f, 0.0f, 0.0f},
Vector3{0.0f, 2.0f, 0.0f}, Vector3{0.0f, 2.0f, 0.0f},
@ -154,7 +154,7 @@ void BoundingVolumeTest::sphereBouncingBubble() {
} { } {
const Trade::MeshData sphereMesh = Primitives::icosphereSolid(1); const Trade::MeshData sphereMesh = Primitives::icosphereSolid(1);
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(sphereMesh.attribute<Vector3>(Trade::MeshAttribute::Position)); boundingSphereBouncingBubble(sphereMesh.attribute<Vector3>(Trade::MeshAttribute::Position));
/* No error */ /* No error */
CORRADE_COMPARE(sphere.first(), (Vector3{0.0f, 0.0f, 0.0f})); CORRADE_COMPARE(sphere.first(), (Vector3{0.0f, 0.0f, 0.0f}));
CORRADE_COMPARE(sphere.second(), 1.0f); CORRADE_COMPARE(sphere.second(), 1.0f);
@ -162,9 +162,9 @@ void BoundingVolumeTest::sphereBouncingBubble() {
Trade::MeshData sphereMesh = Primitives::icosphereSolid(1); Trade::MeshData sphereMesh = Primitives::icosphereSolid(1);
constexpr Vector3 translation{1.0f, 2.0f, 3.0f}; constexpr Vector3 translation{1.0f, 2.0f, 3.0f};
constexpr Vector3 scale{0.5f, 1.2f, 2.8f}; constexpr Vector3 scale{0.5f, 1.2f, 2.8f};
MeshTools::transform3DInPlace(sphereMesh, Matrix4::translation(translation)*Matrix4::scaling(scale)); transform3DInPlace(sphereMesh, Matrix4::translation(translation)*Matrix4::scaling(scale));
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(sphereMesh.attribute<Vector3>(Trade::MeshAttribute::Position)); boundingSphereBouncingBubble(sphereMesh.attribute<Vector3>(Trade::MeshAttribute::Position));
/* Noticeable error */ /* Noticeable error */
constexpr Float Delta = 0.04f; constexpr Float Delta = 0.04f;
CORRADE_COMPARE_WITH(sphere.first(), translation, TestSuite::Compare::around(Vector3{Delta})); CORRADE_COMPARE_WITH(sphere.first(), translation, TestSuite::Compare::around(Vector3{Delta}));
@ -173,12 +173,12 @@ void BoundingVolumeTest::sphereBouncingBubble() {
/* Cube -- translated and scaled */ /* Cube -- translated and scaled */
} { } {
Trade::MeshData cubeMesh = MeshTools::copy(Primitives::cubeSolid()); Trade::MeshData cubeMesh = copy(Primitives::cubeSolid());
constexpr Vector3 translation{1.0f, 2.0f, 3.0f}; constexpr Vector3 translation{1.0f, 2.0f, 3.0f};
constexpr Float scale = 13.2f; constexpr Float scale = 13.2f;
MeshTools::transform3DInPlace(cubeMesh, Matrix4::translation(translation)*Matrix4::scaling(Vector3{scale})); transform3DInPlace(cubeMesh, Matrix4::translation(translation)*Matrix4::scaling(Vector3{scale}));
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(cubeMesh.attribute<Vector3>(Trade::MeshAttribute::Position)); boundingSphereBouncingBubble(cubeMesh.attribute<Vector3>(Trade::MeshAttribute::Position));
/* Noticeable error */ /* Noticeable error */
constexpr Float Delta = 0.04f; constexpr Float Delta = 0.04f;
CORRADE_COMPARE_WITH(sphere.first(), translation, TestSuite::Compare::around(Vector3{Delta})); CORRADE_COMPARE_WITH(sphere.first(), translation, TestSuite::Compare::around(Vector3{Delta}));
@ -191,11 +191,11 @@ void BoundingVolumeTest::sphereBouncingBubble() {
for(Deg degrees = 0.0_degf; degrees < 360.0_degf; degrees += 60.0_degf) { for(Deg degrees = 0.0_degf; degrees < 360.0_degf; degrees += 60.0_degf) {
CORRADE_ITERATION(degrees); CORRADE_ITERATION(degrees);
Trade::MeshData cubeMesh = MeshTools::copy(Primitives::cubeSolid()); Trade::MeshData cubeMesh = copy(Primitives::cubeSolid());
constexpr Vector3 translation{1.0f, 2.0f, 3.0f}; constexpr Vector3 translation{1.0f, 2.0f, 3.0f};
MeshTools::transform3DInPlace(cubeMesh, Matrix4::rotationY(degrees)*Matrix4::translation(translation)); transform3DInPlace(cubeMesh, Matrix4::rotationY(degrees)*Matrix4::translation(translation));
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(cubeMesh.attribute<Vector3>(Trade::MeshAttribute::Position)); boundingSphereBouncingBubble(cubeMesh.attribute<Vector3>(Trade::MeshAttribute::Position));
CORRADE_COMPARE(sphere.second(), Constants::sqrt3()); CORRADE_COMPARE(sphere.second(), Constants::sqrt3());
} }
} }
@ -204,7 +204,7 @@ void BoundingVolumeTest::sphereBouncingBubbleNaN() {
/* NaN is ignored except for the first position element */ /* NaN is ignored except for the first position element */
{ {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{1.0f, 1.0f, 1.0f}, Vector3{1.0f, 1.0f, 1.0f},
Vector3{Constants::nan()}, Vector3{Constants::nan()},
Vector3{2.0f, 2.0f, 2.0f}, Vector3{2.0f, 2.0f, 2.0f},
@ -215,7 +215,7 @@ void BoundingVolumeTest::sphereBouncingBubbleNaN() {
} { } {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(Containers::stridedArrayView({ boundingSphereBouncingBubble(Containers::stridedArrayView({
Vector3{Constants::nan()}, Vector3{Constants::nan()},
Vector3{1.0f, 1.0f, 1.0f}, Vector3{1.0f, 1.0f, 1.0f},
Vector3{2.0f, 2.0f, 2.0f} Vector3{2.0f, 2.0f, 2.0f}
@ -238,7 +238,7 @@ void BoundingVolumeTest::benchmarkRange() {
Float r = 0.0f; Float r = 0.0f;
CORRADE_BENCHMARK(50) { CORRADE_BENCHMARK(50) {
const Range3D box = MeshTools::boundingRange(points); const Range3D box = boundingRange(points);
r += box.size().x(); r += box.size().x();
} }
@ -254,7 +254,7 @@ void BoundingVolumeTest::benchmarkSphereBouncingBubble() {
Float r = 0.0f; Float r = 0.0f;
CORRADE_BENCHMARK(50) { CORRADE_BENCHMARK(50) {
const Containers::Pair<Vector3, Float> sphere = const Containers::Pair<Vector3, Float> sphere =
MeshTools::boundingSphereBouncingBubble(points); boundingSphereBouncingBubble(points);
r += sphere.second(); r += sphere.second();
} }

6
src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp

@ -57,7 +57,7 @@ void CombineIndexedArraysTest::wrongIndexCount() {
Error redirectError{&ss}; Error redirectError{&ss};
std::vector<UnsignedInt> a{0, 1, 0}; std::vector<UnsignedInt> a{0, 1, 0};
std::vector<UnsignedInt> b{3, 4}; std::vector<UnsignedInt> b{3, 4};
std::vector<UnsignedInt> result = MeshTools::combineIndexArrays({a, b}); std::vector<UnsignedInt> result = combineIndexArrays({a, b});
CORRADE_COMPARE(ss.str(), "MeshTools::combineIndexArrays(): the arrays don't have the same size\n"); CORRADE_COMPARE(ss.str(), "MeshTools::combineIndexArrays(): the arrays don't have the same size\n");
} }
@ -67,7 +67,7 @@ void CombineIndexedArraysTest::indexArrays() {
std::vector<UnsignedInt> b{3, 4, 3}; std::vector<UnsignedInt> b{3, 4, 3};
std::vector<UnsignedInt> c{6, 7, 6}; std::vector<UnsignedInt> c{6, 7, 6};
std::vector<UnsignedInt> result = MeshTools::combineIndexArrays({a, b, c}); std::vector<UnsignedInt> result = combineIndexArrays({a, b, c});
CORRADE_COMPARE(result, (std::vector<UnsignedInt>{0, 1, 0})); CORRADE_COMPARE(result, (std::vector<UnsignedInt>{0, 1, 0}));
CORRADE_COMPARE(a, (std::vector<UnsignedInt>{0, 1})); CORRADE_COMPARE(a, (std::vector<UnsignedInt>{0, 1}));
CORRADE_COMPARE(b, (std::vector<UnsignedInt>{3, 4})); CORRADE_COMPARE(b, (std::vector<UnsignedInt>{3, 4}));
@ -82,7 +82,7 @@ void CombineIndexedArraysTest::indexedArrays() {
std::vector<UnsignedInt> array2{ 0, 1, 2, 3, 4 }; std::vector<UnsignedInt> array2{ 0, 1, 2, 3, 4 };
std::vector<UnsignedInt> array3{ 0, 1, 2, 3, 4, 5, 6, 7 }; std::vector<UnsignedInt> array3{ 0, 1, 2, 3, 4, 5, 6, 7 };
std::vector<UnsignedInt> result = MeshTools::combineIndexedArrays( std::vector<UnsignedInt> result = combineIndexedArrays(
std::make_pair(std::cref(a), std::ref(array1)), std::make_pair(std::cref(a), std::ref(array1)),
std::make_pair(std::cref(b), std::ref(array2)), std::make_pair(std::cref(b), std::ref(array2)),
std::make_pair(std::cref(c), std::ref(array3))); std::make_pair(std::cref(c), std::ref(array3)));

42
src/Magnum/MeshTools/Test/CombineTest.cpp

@ -116,7 +116,7 @@ void CombineTest::indexedAttributes() {
internally */ internally */
Trade::meshAttributeCustom(22), VertexFormat::Float, 0, 8, sizeof(Float)}}}; Trade::meshAttributeCustom(22), VertexFormat::Float, 0, 8, sizeof(Float)}}};
Trade::MeshData result = MeshTools::combineIndexedAttributes({a, b, c}); Trade::MeshData result = combineIndexedAttributes({a, b, c});
CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop); CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop);
CORRADE_VERIFY(result.isIndexed()); CORRADE_VERIFY(result.isIndexed());
CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt); CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt);
@ -154,7 +154,7 @@ void CombineTest::indexedAttributesIndicesOnly() {
Trade::MeshData c{MeshPrimitive::LineLoop, {}, indicesC, Trade::MeshData c{MeshPrimitive::LineLoop, {}, indicesC,
Trade::MeshIndexData{indicesC}, 8}; Trade::MeshIndexData{indicesC}, 8};
Trade::MeshData result = MeshTools::combineIndexedAttributes({a, b, c}); Trade::MeshData result = combineIndexedAttributes({a, b, c});
CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop); CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop);
CORRADE_VERIFY(result.isIndexed()); CORRADE_VERIFY(result.isIndexed());
CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt); CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt);
@ -173,7 +173,7 @@ void CombineTest::indexedAttributesSingleMesh() {
{}, data, {Trade::MeshAttributeData{ {}, data, {Trade::MeshAttributeData{
Trade::meshAttributeCustom(22), Containers::arrayView(data)}}}; Trade::meshAttributeCustom(22), Containers::arrayView(data)}}};
Trade::MeshData result = MeshTools::combineIndexedAttributes({a}); Trade::MeshData result = combineIndexedAttributes({a});
CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop); CORRADE_COMPARE(result.primitive(), MeshPrimitive::LineLoop);
CORRADE_VERIFY(result.isIndexed()); CORRADE_VERIFY(result.isIndexed());
CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt); CORRADE_COMPARE(result.indexType(), MeshIndexType::UnsignedInt);
@ -192,7 +192,7 @@ void CombineTest::indexedAttributesNoMeshes() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({}); combineIndexedAttributes({});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): no meshes passed\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): no meshes passed\n");
} }
@ -208,7 +208,7 @@ void CombineTest::indexedAttributesNotIndexed() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({a, b, c}); combineIndexedAttributes({a, b, c});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 is not indexed\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 is not indexed\n");
} }
@ -223,7 +223,7 @@ void CombineTest::indexedAttributesDifferentPrimitive() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({a, b}); combineIndexedAttributes({a, b});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 is MeshPrimitive::Points but expected MeshPrimitive::Lines\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 is MeshPrimitive::Points but expected MeshPrimitive::Lines\n");
} }
@ -241,7 +241,7 @@ void CombineTest::indexedAttributesDifferentIndexCount() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({a, b, c}); combineIndexedAttributes({a, b, c});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 has 4 indices but expected 5\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 has 4 indices but expected 5\n");
} }
@ -261,7 +261,7 @@ void CombineTest::indexedAttributesImplementationSpecificIndexType() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({a, b}); combineIndexedAttributes({a, b});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 has an implementation-specific index type 0xcaca\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 has an implementation-specific index type 0xcaca\n");
} }
@ -284,7 +284,7 @@ void CombineTest::indexedAttributesImplementationSpecificVertexFormat() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineIndexedAttributes({a, b}); combineIndexedAttributes({a, b});
CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n"); CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n");
} }
@ -362,9 +362,9 @@ void CombineTest::faceAttributes() {
directly, not wrapped in a MeshData */ directly, not wrapped in a MeshData */
Containers::Optional<Trade::MeshData> combined; Containers::Optional<Trade::MeshData> combined;
if(data.indexed) if(data.indexed)
combined = MeshTools::combineFaceAttributes(mesh, faceAttributesIndexed); combined = combineFaceAttributes(mesh, faceAttributesIndexed);
else else
combined = MeshTools::combineFaceAttributes(mesh, { combined = combineFaceAttributes(mesh, {
Trade::MeshAttributeData{Trade::MeshAttribute::Color, Trade::MeshAttributeData{Trade::MeshAttribute::Color,
Containers::StridedArrayView1D<const Color3>{faceData, Containers::StridedArrayView1D<const Color3>{faceData,
&faceData[0].color, 4, sizeof(FaceData)}}, &faceData[0].color, 4, sizeof(FaceData)}},
@ -417,7 +417,7 @@ void CombineTest::faceAttributesMeshNotIndexed() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(mesh, faceAttributes); combineFaceAttributes(mesh, faceAttributes);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): vertex mesh is not indexed\n"); "MeshTools::combineFaceAttributes(): vertex mesh is not indexed\n");
} }
@ -435,8 +435,8 @@ void CombineTest::faceAttributesUnexpectedPrimitive() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(a, faceA); combineFaceAttributes(a, faceA);
MeshTools::combineFaceAttributes(b, faceB); combineFaceAttributes(b, faceB);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Triangles and MeshPrimitive::Instances\n" "MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Triangles and MeshPrimitive::Instances\n"
"MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Lines and MeshPrimitive::Faces\n"); "MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Lines and MeshPrimitive::Faces\n");
@ -452,7 +452,7 @@ void CombineTest::faceAttributesUnexpectedFaceCount() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(mesh, faceAttributes); combineFaceAttributes(mesh, faceAttributes);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): expected 1 face entries for 3 indices but got 2\n"); "MeshTools::combineFaceAttributes(): expected 1 face entries for 3 indices but got 2\n");
} }
@ -484,8 +484,8 @@ void CombineTest::faceAttributesImplementationSpecificIndexType() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(triangles, facesImplementationSpecific); combineFaceAttributes(triangles, facesImplementationSpecific);
MeshTools::combineFaceAttributes(trianglesImplementationSpecific, faces); combineFaceAttributes(trianglesImplementationSpecific, faces);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): face mesh has an implementation-specific index type 0xcaca\n" "MeshTools::combineFaceAttributes(): face mesh has an implementation-specific index type 0xcaca\n"
"MeshTools::combineFaceAttributes(): vertex mesh has an implementation-specific index type 0xcaca\n"); "MeshTools::combineFaceAttributes(): vertex mesh has an implementation-specific index type 0xcaca\n");
@ -524,8 +524,8 @@ void CombineTest::faceAttributesImplementationSpecificVertexFormat() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(triangles, facesImplementationSpecific); combineFaceAttributes(triangles, facesImplementationSpecific);
MeshTools::combineFaceAttributes(trianglesImplementationSpecific, faces); combineFaceAttributes(trianglesImplementationSpecific, faces);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n" "MeshTools::combineFaceAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n"
"MeshTools::combineFaceAttributes(): attribute 2 of mesh 0 has an implementation-specific format 0xcaca\n"); "MeshTools::combineFaceAttributes(): attribute 2 of mesh 0 has an implementation-specific format 0xcaca\n");
@ -556,7 +556,7 @@ void CombineTest::faceAttributesFacesNotInterleaved() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(mesh, faceAttributes); combineFaceAttributes(mesh, faceAttributes);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): face attributes are not interleaved\n"); "MeshTools::combineFaceAttributes(): face attributes are not interleaved\n");
} }
@ -566,7 +566,7 @@ void CombineTest::faceAttributesFaceAttributeOffsetOnly() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::combineFaceAttributes(Trade::MeshData{MeshPrimitive::Triangles, 0}, { combineFaceAttributes(Trade::MeshData{MeshPrimitive::Triangles, 0}, {
Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId, Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId,
Containers::ArrayView<UnsignedInt>{}}, Containers::ArrayView<UnsignedInt>{}},
Trade::MeshAttributeData{Trade::MeshAttribute::Color, Trade::MeshAttributeData{Trade::MeshAttribute::Color,

22
src/Magnum/MeshTools/Test/CompileGLTest.cpp

@ -1581,9 +1581,9 @@ void CompileGLTest::morphTargetAttributes() {
std::ostringstream out; std::ostringstream out;
Warning redirectError{&out}; Warning redirectError{&out};
if(instanceData.flags) if(instanceData.flags)
MeshTools::compile(data, instanceData.flags); compile(data, instanceData.flags);
else else
MeshTools::compile(data); compile(data);
CORRADE_COMPARE(out.str(), instanceData.flags ? "" : CORRADE_COMPARE(out.str(), instanceData.flags ? "" :
"MeshTools::compile(): ignoring 2 morph target attributes\n"); "MeshTools::compile(): ignoring 2 morph target attributes\n");
} }
@ -1600,9 +1600,9 @@ void CompileGLTest::customAttribute() {
std::ostringstream out; std::ostringstream out;
Warning redirectError{&out}; Warning redirectError{&out};
if(instanceData.flags) if(instanceData.flags)
MeshTools::compile(data, instanceData.flags); compile(data, instanceData.flags);
else else
MeshTools::compile(data); compile(data);
CORRADE_COMPARE(out.str(), instanceData.flags ? "" : CORRADE_COMPARE(out.str(), instanceData.flags ? "" :
"MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::Custom(115)\n"); "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::Custom(115)\n");
} }
@ -1622,9 +1622,9 @@ void CompileGLTest::unsupportedAttribute() {
std::ostringstream out; std::ostringstream out;
Warning redirectError{&out}; Warning redirectError{&out};
if(instanceData.flags) if(instanceData.flags)
MeshTools::compile(data, instanceData.flags); compile(data, instanceData.flags);
else else
MeshTools::compile(data); compile(data);
/* Warns always, regardless of the flag */ /* Warns always, regardless of the flag */
CORRADE_COMPARE(out.str(), "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::ObjectId\n"); CORRADE_COMPARE(out.str(), "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::ObjectId\n");
#endif #endif
@ -1664,9 +1664,9 @@ void CompileGLTest::implementationSpecificAttributeFormat() {
std::ostringstream out; std::ostringstream out;
Warning redirectError{&out}; Warning redirectError{&out};
if(instanceData.flags) if(instanceData.flags)
MeshTools::compile(data, instanceData.flags); compile(data, instanceData.flags);
else else
MeshTools::compile(data); compile(data);
CORRADE_COMPARE(out.str(), instanceData.flags ? "" : CORRADE_COMPARE(out.str(), instanceData.flags ? "" :
"MeshTools::compile(): ignoring attribute Trade::MeshAttribute::Position with an implementation-specific format 0xdead\n"); "MeshTools::compile(): ignoring attribute Trade::MeshAttribute::Position with an implementation-specific format 0xdead\n");
} }
@ -1678,7 +1678,7 @@ void CompileGLTest::generateNormalsNoPosition() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compile(data, CompileFlag::GenerateFlatNormals); compile(data, CompileFlag::GenerateFlatNormals);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compile(): the mesh has no positions, can't generate normals\n"); "MeshTools::compile(): the mesh has no positions, can't generate normals\n");
} }
@ -1693,7 +1693,7 @@ void CompileGLTest::generateNormals2DPosition() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compile(data, CompileFlag::GenerateFlatNormals); compile(data, CompileFlag::GenerateFlatNormals);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compile(): can't generate normals for VertexFormat::Vector2 positions\n"); "MeshTools::compile(): can't generate normals for VertexFormat::Vector2 positions\n");
} }
@ -1710,7 +1710,7 @@ void CompileGLTest::generateNormalsNoFloats() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compile(data, CompileFlag::GenerateFlatNormals); compile(data, CompileFlag::GenerateFlatNormals);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compile(): can't generate normals into VertexFormat::Vector3h\n"); "MeshTools::compile(): can't generate normals into VertexFormat::Vector3h\n");
} }

16
src/Magnum/MeshTools/Test/CompressIndicesTest.cpp

@ -242,7 +242,7 @@ void CompressIndicesTest::compressDeprecated() {
MeshIndexType type; MeshIndexType type;
UnsignedInt start, end; UnsignedInt start, end;
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
std::tie(data, type, start, end) = MeshTools::compressIndices( std::tie(data, type, start, end) = compressIndices(
std::vector<UnsignedInt>{1, 256, 0, 5}); std::vector<UnsignedInt>{1, 256, 0, 5});
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
@ -347,8 +347,8 @@ void CompressIndicesTest::compressMeshDataNonIndexed() {
/* Test both r-value and l-value overload */ /* Test both r-value and l-value overload */
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compressIndices(mesh); compressIndices(mesh);
MeshTools::compressIndices(std::move(mesh)); compressIndices(std::move(mesh));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compressIndices(): mesh data not indexed\n" "MeshTools::compressIndices(): mesh data not indexed\n"
"MeshTools::compressIndices(): mesh data not indexed\n"); "MeshTools::compressIndices(): mesh data not indexed\n");
@ -363,8 +363,8 @@ void CompressIndicesTest::compressMeshDataImplementationSpecificIndexType() {
/* Test both r-value and l-value overload */ /* Test both r-value and l-value overload */
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compressIndices(mesh); compressIndices(mesh);
MeshTools::compressIndices(std::move(mesh)); compressIndices(std::move(mesh));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n" "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n"
"MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n"); "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n");
@ -379,7 +379,7 @@ void CompressIndicesTest::compressMeshDataImplementationSpecificAtLeastIndexType
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compressIndices(mesh, meshIndexTypeWrap(0xcaca)); compressIndices(mesh, meshIndexTypeWrap(0xcaca));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compressIndices(): can't compress to an implementation-specific index type 0xcaca\n"); "MeshTools::compressIndices(): can't compress to an implementation-specific index type 0xcaca\n");
} }
@ -389,13 +389,13 @@ void CompressIndicesTest::compressAsShort() {
CORRADE_SKIP_IF_NO_ASSERT(); CORRADE_SKIP_IF_NO_ASSERT();
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
CORRADE_COMPARE_AS(MeshTools::compressIndicesAs<UnsignedShort>({123, 456}), CORRADE_COMPARE_AS(compressIndicesAs<UnsignedShort>({123, 456}),
Containers::arrayView<UnsignedShort>({123, 456}), Containers::arrayView<UnsignedShort>({123, 456}),
TestSuite::Compare::Container); TestSuite::Compare::Container);
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
MeshTools::compressIndicesAs<UnsignedShort>({65536}); compressIndicesAs<UnsignedShort>({65536});
CORRADE_COMPARE(out.str(), "MeshTools::compressIndicesAs(): type too small to represent value 65536\n"); CORRADE_COMPARE(out.str(), "MeshTools::compressIndicesAs(): type too small to represent value 65536\n");
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
} }

2
src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp

@ -131,7 +131,7 @@ void GenerateNormalsTest::flatDeprecated() {
std::vector<UnsignedInt> indices; std::vector<UnsignedInt> indices;
std::vector<Vector3> normals; std::vector<Vector3> normals;
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
std::tie(indices, normals) = MeshTools::generateFlatNormals({ std::tie(indices, normals) = generateFlatNormals({
0, 1, 2, 0, 1, 2,
1, 2, 3 1, 2, 3
}, { }, {

16
src/Magnum/MeshTools/Test/TransformTest.cpp

@ -443,25 +443,25 @@ constexpr static std::array<Vector3, 2> points3DRotatedTranslated{{
}}; }};
void TransformTest::transformVectors2D() { void TransformTest::transformVectors2D() {
auto matrix = MeshTools::transformVectors(Matrix3::rotation(Deg(90.0f)), points2D); auto matrix = transformVectors(Matrix3::rotation(Deg(90.0f)), points2D);
auto complex = MeshTools::transformVectors(Complex::rotation(Deg(90.0f)), points2D); auto complex = transformVectors(Complex::rotation(Deg(90.0f)), points2D);
CORRADE_COMPARE(matrix, points2DRotated); CORRADE_COMPARE(matrix, points2DRotated);
CORRADE_COMPARE(complex, points2DRotated); CORRADE_COMPARE(complex, points2DRotated);
} }
void TransformTest::transformVectors3D() { void TransformTest::transformVectors3D() {
auto matrix = MeshTools::transformVectors(Matrix4::rotationZ(Deg(90.0f)), points3D); auto matrix = transformVectors(Matrix4::rotationZ(Deg(90.0f)), points3D);
auto quaternion = MeshTools::transformVectors(Quaternion::rotation(Deg(90.0f), Vector3::zAxis()), points3D); auto quaternion = transformVectors(Quaternion::rotation(Deg(90.0f), Vector3::zAxis()), points3D);
CORRADE_COMPARE(matrix, points3DRotated); CORRADE_COMPARE(matrix, points3DRotated);
CORRADE_COMPARE(quaternion, points3DRotated); CORRADE_COMPARE(quaternion, points3DRotated);
} }
void TransformTest::transformPoints2D() { void TransformTest::transformPoints2D() {
auto matrix = MeshTools::transformPoints( auto matrix = transformPoints(
Matrix3::translation(Vector2::yAxis(-1.0f))*Matrix3::rotation(Deg(90.0f)), points2D); Matrix3::translation(Vector2::yAxis(-1.0f))*Matrix3::rotation(Deg(90.0f)), points2D);
auto complex = MeshTools::transformPoints( auto complex = transformPoints(
DualComplex::translation(Vector2::yAxis(-1.0f))*DualComplex::rotation(Deg(90.0f)), points2D); DualComplex::translation(Vector2::yAxis(-1.0f))*DualComplex::rotation(Deg(90.0f)), points2D);
CORRADE_COMPARE(matrix, points2DRotatedTranslated); CORRADE_COMPARE(matrix, points2DRotatedTranslated);
@ -469,9 +469,9 @@ void TransformTest::transformPoints2D() {
} }
void TransformTest::transformPoints3D() { void TransformTest::transformPoints3D() {
auto matrix = MeshTools::transformPoints( auto matrix = transformPoints(
Matrix4::translation(Vector3::yAxis(-1.0f))*Matrix4::rotationZ(Deg(90.0f)), points3D); Matrix4::translation(Vector3::yAxis(-1.0f))*Matrix4::rotationZ(Deg(90.0f)), points3D);
auto quaternion = MeshTools::transformPoints( auto quaternion = transformPoints(
DualQuaternion::translation(Vector3::yAxis(-1.0f))*DualQuaternion::rotation(Deg(90.0f), Vector3::zAxis()), points3D); DualQuaternion::translation(Vector3::yAxis(-1.0f))*DualQuaternion::rotation(Deg(90.0f), Vector3::zAxis()), points3D);
CORRADE_COMPARE(matrix, points3DRotatedTranslated); CORRADE_COMPARE(matrix, points3DRotatedTranslated);

Loading…
Cancel
Save