Browse Source

MeshTools,Trade: clarify why offset-only attributes can't be used.

Instead of saying "which is not supported" in each assert, which is
vague and might imply that "it eventually will be supported", document
the actual reason in a single place, which is the MeshAttributeData docs.
pull/620/head
Vladimír Vondruš 3 years ago
parent
commit
2c27831b0a
  1. 2
      src/Magnum/MeshTools/Combine.cpp
  2. 2
      src/Magnum/MeshTools/Duplicate.cpp
  3. 2
      src/Magnum/MeshTools/Interleave.cpp
  4. 2
      src/Magnum/MeshTools/Test/CombineTest.cpp
  5. 2
      src/Magnum/MeshTools/Test/DuplicateTest.cpp
  6. 2
      src/Magnum/MeshTools/Test/InterleaveTest.cpp
  7. 8
      src/Magnum/Trade/MeshData.h

2
src/Magnum/MeshTools/Combine.cpp

@ -239,7 +239,7 @@ Trade::MeshData combineFaceAttributes(const Trade::MeshData& mesh, Containers::A
#ifndef CORRADE_NO_ASSERT
for(std::size_t i = 0; i != faceAttributes.size(); ++i)
CORRADE_ASSERT(!faceAttributes[i].isOffsetOnly(),
"MeshTools::combineFaceAttributes(): face attribute" << i << "is offset-only, which is not supported",
"MeshTools::combineFaceAttributes(): face attribute" << i << "is offset-only",
(Trade::MeshData{MeshPrimitive::Triangles, 0}));
#endif

2
src/Magnum/MeshTools/Duplicate.cpp

@ -116,7 +116,7 @@ Trade::MeshData duplicate(const Trade::MeshData& mesh, const Containers::ArrayVi
/* Asserting here even though data() has another assert since that one
would be too confusing in this context */
CORRADE_ASSERT(!extra[i].isOffsetOnly(),
"MeshTools::duplicate(): extra attribute" << i << "is offset-only, which is not supported",
"MeshTools::duplicate(): extra attribute" << i << "is offset-only",
(Trade::MeshData{MeshPrimitive::Triangles, 0}));
/* Copy the attribute in, if it is non-empty, otherwise keep the

2
src/Magnum/MeshTools/Interleave.cpp

@ -346,7 +346,7 @@ Trade::MeshData interleave(Trade::MeshData&& mesh, const Containers::ArrayView<c
/* Asserting here even though data() has another assert since that
one would be too confusing in this context */
CORRADE_ASSERT(!extra[i].isOffsetOnly(),
"MeshTools::interleave(): extra attribute" << i << "is offset-only, which is not supported",
"MeshTools::interleave(): extra attribute" << i << "is offset-only",
(Trade::MeshData{MeshPrimitive::Triangles, 0}));
/* Copy the attribute in, if it is non-empty, otherwise keep the

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

@ -571,7 +571,7 @@ void CombineTest::combineFaceAttributesFaceAttributeOffsetOnly() {
VertexFormat::Vector4, 0, 5, 16}
});
CORRADE_COMPARE(out.str(),
"MeshTools::combineFaceAttributes(): face attribute 1 is offset-only, which is not supported\n");
"MeshTools::combineFaceAttributes(): face attribute 1 is offset-only\n");
}
}}}}

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

@ -457,7 +457,7 @@ void DuplicateTest::duplicateMeshDataExtraOffsetOnly() {
Trade::MeshAttributeData{10},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, 3, 5, 14}
});
CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): extra attribute 1 is offset-only, which is not supported\n");
CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): extra attribute 1 is offset-only\n");
}
void DuplicateTest::duplicateMeshDataExtraImplementationSpecificVertexFormat() {

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

@ -1350,7 +1350,7 @@ void InterleaveTest::interleaveMeshDataExtraOffsetOnly() {
Trade::MeshAttributeData{10},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, 3, 5, 14}
});
CORRADE_COMPARE(out.str(), "MeshTools::interleave(): extra attribute 1 is offset-only, which is not supported\n");
CORRADE_COMPARE(out.str(), "MeshTools::interleave(): extra attribute 1 is offset-only\n");
}
void InterleaveTest::interleaveMeshDataExtraImplementationSpecificVertexFormat() {

8
src/Magnum/Trade/MeshData.h

@ -414,9 +414,11 @@ but the actual data is allocated / populated at runtime:
@snippet MagnumTrade.cpp MeshAttributeData-usage-offset-only
Note that @ref MeshTools algorithms generally don't accept offset-only
@ref MeshAttributeData instances except when passed through a @ref MeshData
instance.
Offset-only attributes return @cpp true @ce for @ref isOffsetOnly(). Note that
@ref MeshTools algorithms generally don't accept offset-only
@ref MeshAttributeData instances except when passed through a @ref MeshData, as
for a standalone offset-only @ref MeshAttributeData it's impossible to know
what data it points to.
@section Trade-MeshAttributeData-custom-vertex-format Custom vertex formats

Loading…
Cancel
Save