Browse Source

Don't take an Iterable by value.

It's four pointers, twice as much as what would be acceptable. Not sure
why this happened, maybe because all those cases used an ArrayView
before and so I just changed the type without considering the difference
in its size?

Unfortunately this change also means a bump in the plugin interface
string, thus all scene converter plugins have to be updated as well.
pull/605/head
Vladimír Vondruš 4 years ago
parent
commit
8616927a75
  1. 2
      doc/changelog.dox
  2. 4
      src/Magnum/GL/AbstractShaderProgram.cpp
  3. 4
      src/Magnum/GL/AbstractShaderProgram.h
  4. 4
      src/Magnum/MeshTools/Combine.cpp
  5. 2
      src/Magnum/MeshTools/Combine.h
  6. 6
      src/Magnum/MeshTools/Concatenate.cpp
  7. 10
      src/Magnum/MeshTools/Concatenate.h
  8. 6
      src/Magnum/MeshTools/InterleaveFlags.h
  9. 52
      src/Magnum/Trade/AbstractSceneConverter.cpp
  10. 122
      src/Magnum/Trade/AbstractSceneConverter.h
  11. 82
      src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp
  12. 2
      src/Magnum/Vk/DescriptorSetLayout.cpp
  13. 2
      src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h
  14. 10
      src/MagnumPlugins/AnySceneConverter/AnySceneConverter.cpp
  15. 8
      src/MagnumPlugins/AnySceneConverter/AnySceneConverter.h

2
doc/changelog.dox

@ -474,7 +474,7 @@ See also:
- @ref MeshTools::interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags), - @ref MeshTools::interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags),
@ref MeshTools::interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags) and @ref MeshTools::interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags) and
@ref MeshTools::concatenate(Containers::Iterable<const Trade::MeshData>, InterleaveFlags) @ref MeshTools::concatenate(const Containers::Iterable<const Trade::MeshData>&, InterleaveFlags)
optionally take a @ref MeshTools::InterleaveFlags parameter affecting the optionally take a @ref MeshTools::InterleaveFlags parameter affecting the
output, in particular whether to preserve the original interleaved layout. output, in particular whether to preserve the original interleaved layout.

4
src/Magnum/GL/AbstractShaderProgram.cpp

@ -537,7 +537,7 @@ void AbstractShaderProgram::attachShader(Shader& shader) {
glAttachShader(_id, shader.id()); glAttachShader(_id, shader.id());
} }
void AbstractShaderProgram::attachShaders(Containers::Iterable<Shader> shaders) { void AbstractShaderProgram::attachShaders(const Containers::Iterable<Shader>& shaders) {
for(Shader& s: shaders) attachShader(s); for(Shader& s: shaders) attachShader(s);
} }
@ -596,7 +596,7 @@ void AbstractShaderProgram::submitLink() {
glLinkProgram(_id); glLinkProgram(_id);
} }
bool AbstractShaderProgram::checkLink(const Containers::Iterable<Shader> shaders) { bool AbstractShaderProgram::checkLink(const Containers::Iterable<Shader>& shaders) {
/* If any compilation failed, abort without even checking the link status. /* If any compilation failed, abort without even checking the link status.
The checkCompile() API is called always, to print also compilation The checkCompile() API is called always, to print also compilation
warnings even in case everything still manages to link well. */ warnings even in case everything still manages to link well. */

4
src/Magnum/GL/AbstractShaderProgram.h

@ -1415,7 +1415,7 @@ class MAGNUM_GL_EXPORT AbstractShaderProgram: public AbstractObject {
* than one shader at once. Other than that there is no other * than one shader at once. Other than that there is no other
* (performance) difference when using this function. * (performance) difference when using this function.
*/ */
void attachShaders(Containers::Iterable<Shader> shaders); void attachShaders(const Containers::Iterable<Shader>& shaders);
/** /**
* @brief Bind an attribute to given location * @brief Bind an attribute to given location
@ -1584,7 +1584,7 @@ class MAGNUM_GL_EXPORT AbstractShaderProgram: public AbstractObject {
*/ */
/* No default argument is provided in order to *really* encourage apps /* No default argument is provided in order to *really* encourage apps
to pass the shaders here */ to pass the shaders here */
bool checkLink(Containers::Iterable<Shader> shaders); bool checkLink(const Containers::Iterable<Shader>& shaders);
/** /**
* @brief Get uniform location * @brief Get uniform location

4
src/Magnum/MeshTools/Combine.cpp

@ -43,7 +43,7 @@ Trade::MeshData combineIndexedImplementation(
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
const char* assertPrefix, const char* assertPrefix,
#endif #endif
const MeshPrimitive primitive, Containers::Array<char>& combinedIndices, const UnsignedInt indexCount, const UnsignedInt indexStride, const Containers::Iterable<const Trade::MeshData> data) const MeshPrimitive primitive, Containers::Array<char>& combinedIndices, const UnsignedInt indexCount, const UnsignedInt indexStride, const Containers::Iterable<const Trade::MeshData>& data)
{ {
/* Calculate attribute count and vertex stride */ /* Calculate attribute count and vertex stride */
UnsignedInt attributeCount = 0; UnsignedInt attributeCount = 0;
@ -110,7 +110,7 @@ Trade::MeshData combineIndexedImplementation(
} }
Trade::MeshData combineIndexedAttributes(const Containers::Iterable<const Trade::MeshData> data) { Trade::MeshData combineIndexedAttributes(const Containers::Iterable<const Trade::MeshData>& data) {
CORRADE_ASSERT(!data.isEmpty(), CORRADE_ASSERT(!data.isEmpty(),
"MeshTools::combineIndexedAttributes(): no meshes passed", "MeshTools::combineIndexedAttributes(): no meshes passed",
(Trade::MeshData{MeshPrimitive{}, 0})); (Trade::MeshData{MeshPrimitive{}, 0}));

2
src/Magnum/MeshTools/Combine.h

@ -95,7 +95,7 @@ implementation-specific format.
@see @ref isMeshIndexTypeImplementationSpecific(), @see @ref isMeshIndexTypeImplementationSpecific(),
@ref isVertexFormatImplementationSpecific() @ref isVertexFormatImplementationSpecific()
*/ */
MAGNUM_MESHTOOLS_EXPORT Trade::MeshData combineIndexedAttributes(const Containers::Iterable<const Trade::MeshData> data); MAGNUM_MESHTOOLS_EXPORT Trade::MeshData combineIndexedAttributes(const Containers::Iterable<const Trade::MeshData>& data);
/** /**
@brief Combine per-face attributes into an existing mesh @brief Combine per-face attributes into an existing mesh

6
src/Magnum/MeshTools/Concatenate.cpp

@ -33,7 +33,7 @@ namespace Magnum { namespace MeshTools {
namespace Implementation { namespace Implementation {
std::pair<UnsignedInt, UnsignedInt> concatenateIndexVertexCount(Containers::Iterable<const Trade::MeshData> meshes) { std::pair<UnsignedInt, UnsignedInt> concatenateIndexVertexCount(const Containers::Iterable<const Trade::MeshData>& meshes) {
UnsignedInt indexCount = 0; UnsignedInt indexCount = 0;
UnsignedInt vertexCount = 0; UnsignedInt vertexCount = 0;
for(const Trade::MeshData& mesh: meshes) { for(const Trade::MeshData& mesh: meshes) {
@ -62,7 +62,7 @@ struct MeshAttributeHash: std::hash<typename std::underlying_type<Trade::MeshAtt
} }
}; };
Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedInt vertexCount, Containers::Array<char>&& vertexData, Containers::Array<Trade::MeshAttributeData>&& attributeData, const Containers::Iterable<const Trade::MeshData> meshes, const char* const assertPrefix) { Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedInt vertexCount, Containers::Array<char>&& vertexData, Containers::Array<Trade::MeshAttributeData>&& attributeData, const Containers::Iterable<const Trade::MeshData>& meshes, const char* const assertPrefix) {
#ifdef CORRADE_NO_ASSERT #ifdef CORRADE_NO_ASSERT
static_cast<void>(assertPrefix); static_cast<void>(assertPrefix);
#endif #endif
@ -189,7 +189,7 @@ Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedI
} }
Trade::MeshData concatenate(const Containers::Iterable<const Trade::MeshData> meshes, const InterleaveFlags flags) { Trade::MeshData concatenate(const Containers::Iterable<const Trade::MeshData>& meshes, const InterleaveFlags flags) {
CORRADE_ASSERT(!meshes.isEmpty(), CORRADE_ASSERT(!meshes.isEmpty(),
"MeshTools::concatenate(): expected at least one mesh", "MeshTools::concatenate(): expected at least one mesh",
(Trade::MeshData{MeshPrimitive::Points, 0})); (Trade::MeshData{MeshPrimitive::Points, 0}));

10
src/Magnum/MeshTools/Concatenate.h

@ -39,8 +39,8 @@
namespace Magnum { namespace MeshTools { namespace Magnum { namespace MeshTools {
namespace Implementation { namespace Implementation {
MAGNUM_MESHTOOLS_EXPORT std::pair<UnsignedInt, UnsignedInt> concatenateIndexVertexCount(Containers::Iterable<const Trade::MeshData> meshes); MAGNUM_MESHTOOLS_EXPORT std::pair<UnsignedInt, UnsignedInt> concatenateIndexVertexCount(const Containers::Iterable<const Trade::MeshData>& meshes);
MAGNUM_MESHTOOLS_EXPORT Trade::MeshData concatenate(Containers::Array<char>&& indexData, UnsignedInt vertexCount, Containers::Array<char>&& vertexData, Containers::Array<Trade::MeshAttributeData>&& attributeData, Containers::Iterable<const Trade::MeshData> meshes, const char* assertPrefix); MAGNUM_MESHTOOLS_EXPORT Trade::MeshData concatenate(Containers::Array<char>&& indexData, UnsignedInt vertexCount, Containers::Array<char>&& vertexData, Containers::Array<Trade::MeshAttributeData>&& attributeData, const Containers::Iterable<const Trade::MeshData>& meshes, const char* assertPrefix);
} }
/** /**
@ -82,7 +82,7 @@ to compress it to a smaller type, if desired.
@ref SceneTools::flattenMeshHierarchy2D(), @ref SceneTools::flattenMeshHierarchy2D(),
@ref SceneTools::flattenMeshHierarchy3D() @ref SceneTools::flattenMeshHierarchy3D()
*/ */
MAGNUM_MESHTOOLS_EXPORT Trade::MeshData concatenate(Containers::Iterable<const Trade::MeshData> meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes); MAGNUM_MESHTOOLS_EXPORT Trade::MeshData concatenate(const Containers::Iterable<const Trade::MeshData>& meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes);
/** /**
@brief Concatenate a list of meshes into a pre-existing destination, enlarging it if necessary @brief Concatenate a list of meshes into a pre-existing destination, enlarging it if necessary
@ -93,14 +93,14 @@ MAGNUM_MESHTOOLS_EXPORT Trade::MeshData concatenate(Containers::Iterable<const T
@param[in] flags Flags to pass to @ref interleavedLayout() @param[in] flags Flags to pass to @ref interleavedLayout()
@m_since{2020,06} @m_since{2020,06}
Compared to @ref concatenate(Containers::Iterable<const Trade::MeshData>, InterleaveFlags) Compared to @ref concatenate(const Containers::Iterable<const Trade::MeshData>&, InterleaveFlags)
this function resizes existing index and vertex buffers in @p destination using this function resizes existing index and vertex buffers in @p destination using
@ref Containers::arrayResize() and given @p allocator, and reuses its @ref Containers::arrayResize() and given @p allocator, and reuses its
atttribute data array instead of always allocating new ones. Only the attribute atttribute data array instead of always allocating new ones. Only the attribute
layout from @p destination is used, all vertex/index data are taken from layout from @p destination is used, all vertex/index data are taken from
@p meshes. Expects that @p meshes contains at least one item. @p meshes. Expects that @p meshes contains at least one item.
*/ */
template<template<class> class Allocator = Containers::ArrayAllocator> void concatenateInto(Trade::MeshData& destination, Containers::Iterable<const Trade::MeshData> meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes) { template<template<class> class Allocator = Containers::ArrayAllocator> void concatenateInto(Trade::MeshData& destination, const Containers::Iterable<const Trade::MeshData>& meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes) {
CORRADE_ASSERT(!meshes.isEmpty(), CORRADE_ASSERT(!meshes.isEmpty(),
"MeshTools::concatenateInto(): no meshes passed", ); "MeshTools::concatenateInto(): no meshes passed", );
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT

6
src/Magnum/MeshTools/InterleaveFlags.h

@ -43,7 +43,7 @@ namespace Magnum { namespace MeshTools {
@see @ref InterleaveFlags, @see @ref InterleaveFlags,
@ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags), @ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags),
@ref interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags), @ref interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags),
@ref concatenate(Containers::Iterable<const Trade::MeshData>, InterleaveFlags) @ref concatenate(const Containers::Iterable<const Trade::MeshData>&, InterleaveFlags)
*/ */
enum class InterleaveFlag: UnsignedInt { enum class InterleaveFlag: UnsignedInt {
/** /**
@ -72,7 +72,7 @@ enum class InterleaveFlag: UnsignedInt {
* *
* Has no effect when passed to @ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags) "interleavedLayout()" * Has no effect when passed to @ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags) "interleavedLayout()"
* as that function doesn't preserve the index buffer. Has no effect when * as that function doesn't preserve the index buffer. Has no effect when
* passed to @ref concatenate(Containers::Iterable<const Trade::MeshData>, InterleaveFlags) "concatenate()" * passed to @ref concatenate(const Containers::Iterable<const Trade::MeshData>&, InterleaveFlags) "concatenate()"
* as that function allocates a new combined index buffer anyway. * as that function allocates a new combined index buffer anyway.
* @see @ref isMeshIndexTypeImplementationSpecific() * @see @ref isMeshIndexTypeImplementationSpecific()
*/ */
@ -85,7 +85,7 @@ enum class InterleaveFlag: UnsignedInt {
@see @ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags), @see @ref interleavedLayout(const Trade::MeshData&, UnsignedInt, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags),
@ref interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags), @ref interleave(const Trade::MeshData&, Containers::ArrayView<const Trade::MeshAttributeData>, InterleaveFlags),
@ref concatenate(Containers::Iterable<const Trade::MeshData>, InterleaveFlags) @ref concatenate(const Containers::Iterable<const Trade::MeshData>&, InterleaveFlags)
*/ */
typedef Containers::EnumSet<InterleaveFlag> InterleaveFlags; typedef Containers::EnumSet<InterleaveFlag> InterleaveFlags;

52
src/Magnum/Trade/AbstractSceneConverter.cpp

@ -209,7 +209,7 @@ struct AbstractSceneConverter::State {
Containers::StringView AbstractSceneConverter::pluginInterface() { Containers::StringView AbstractSceneConverter::pluginInterface() {
return return
/* [interface] */ /* [interface] */
"cz.mosra.magnum.Trade.AbstractSceneConverter/0.2"_s "cz.mosra.magnum.Trade.AbstractSceneConverter/0.2.1"_s
/* [interface] */ /* [interface] */
; ;
} }
@ -824,7 +824,7 @@ bool AbstractSceneConverter::doAdd(const UnsignedInt id, const MeshData& mesh, c
return doAdd(id, Containers::Iterable<const MeshData>{mesh}, name); return doAdd(id, Containers::Iterable<const MeshData>{mesh}, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const MeshData> meshLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const MeshData>& meshLevels, const Containers::StringView name) {
CORRADE_ASSERT(features() >= (SceneConverterFeature::AddMeshes|SceneConverterFeature::MeshLevels), CORRADE_ASSERT(features() >= (SceneConverterFeature::AddMeshes|SceneConverterFeature::MeshLevels),
"Trade::AbstractSceneConverter::add(): multi-level mesh conversion not supported", {}); "Trade::AbstractSceneConverter::add(): multi-level mesh conversion not supported", {});
CORRADE_ASSERT(_state, CORRADE_ASSERT(_state,
@ -837,11 +837,11 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return {}; return {};
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const MeshData> meshLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const MeshData>& meshLevels) {
return add(meshLevels, {}); return add(meshLevels, {});
} }
bool AbstractSceneConverter::doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) { bool AbstractSceneConverter::doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView) {
CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level mesh conversion advertised but not implemented", {}); CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level mesh conversion advertised but not implemented", {});
} }
@ -924,7 +924,7 @@ template<UnsignedInt dimensions> bool checkImageValidity(const char* const messa
return true; return true;
} }
template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::Iterable<const ImageData<dimensions>> imageLevels) { template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::Iterable<const ImageData<dimensions>>& imageLevels) {
CORRADE_ASSERT(!imageLevels.isEmpty(), CORRADE_ASSERT(!imageLevels.isEmpty(),
messagePrefix << "at least one image level has to be specified", false); messagePrefix << "at least one image level has to be specified", false);
@ -1009,7 +1009,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const CompressedIm
return add(image, {}); return add(image, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D>& imageLevels, const Containers::StringView name) {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
/* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds. /* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds.
Has to be first so we can safely ask for the first item in asserts Has to be first so we can safely ask for the first item in asserts
@ -1027,15 +1027,15 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return {}; return {};
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
bool AbstractSceneConverter::doAdd(UnsignedInt, Containers::Iterable<const ImageData1D>, Containers::StringView) { bool AbstractSceneConverter::doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>&, Containers::StringView) {
CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 1D image conversion advertised but not implemented", {}); CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 1D image conversion advertised but not implemented", {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView1D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView1D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData1D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData1D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const ImageView1D& image = imageLevels[i]; const ImageView1D& image = imageLevels[i];
@ -1045,11 +1045,11 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView1D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView1D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView1D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView1D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData1D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData1D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const CompressedImageView1D& image = imageLevels[i]; const CompressedImageView1D& image = imageLevels[i];
@ -1059,7 +1059,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView1D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView1D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
@ -1110,7 +1110,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const CompressedIm
return add(image, {}); return add(image, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D>& imageLevels, const Containers::StringView name) {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
/* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds. /* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds.
Has to be first so we can safely ask for the first item in asserts Has to be first so we can safely ask for the first item in asserts
@ -1128,15 +1128,15 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return {}; return {};
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
bool AbstractSceneConverter::doAdd(UnsignedInt, Containers::Iterable<const ImageData2D>, Containers::StringView) { bool AbstractSceneConverter::doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>&, Containers::StringView) {
CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 2D image conversion advertised but not implemented", {}); CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 2D image conversion advertised but not implemented", {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView2D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView2D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData2D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData2D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const ImageView2D& image = imageLevels[i]; const ImageView2D& image = imageLevels[i];
@ -1146,11 +1146,11 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView2D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView2D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView2D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView2D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData2D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData2D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const CompressedImageView2D& image = imageLevels[i]; const CompressedImageView2D& image = imageLevels[i];
@ -1160,7 +1160,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView2D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView2D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
@ -1211,7 +1211,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const CompressedIm
return add(image, {}); return add(image, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData3D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData3D>& imageLevels, const Containers::StringView name) {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
/* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds. /* Explicitly return if checks fail for CORRADE_GRACEFUL_ASSERT builds.
Has to be first so we can safely ask for the first item in asserts Has to be first so we can safely ask for the first item in asserts
@ -1229,15 +1229,15 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return {}; return {};
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData3D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageData3D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
bool AbstractSceneConverter::doAdd(UnsignedInt, Containers::Iterable<const ImageData3D>, Containers::StringView) { bool AbstractSceneConverter::doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>&, Containers::StringView) {
CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 3D image conversion advertised but not implemented", {}); CORRADE_ASSERT_UNREACHABLE("Trade::AbstractSceneConverter::add(): multi-level 3D image conversion advertised but not implemented", {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView3D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView3D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData3D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData3D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const ImageView3D& image = imageLevels[i]; const ImageView3D& image = imageLevels[i];
@ -1247,11 +1247,11 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView3D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const ImageView3D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView3D> imageLevels, const Containers::StringView name) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView3D>& imageLevels, const Containers::StringView name) {
Containers::Array<ImageData3D> data{NoInit, imageLevels.size()}; Containers::Array<ImageData3D> data{NoInit, imageLevels.size()};
for(std::size_t i = 0; i != imageLevels.size(); ++i) { for(std::size_t i = 0; i != imageLevels.size(); ++i) {
const CompressedImageView3D& image = imageLevels[i]; const CompressedImageView3D& image = imageLevels[i];
@ -1261,7 +1261,7 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
return add(data, name); return add(data, name);
} }
Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView3D> imageLevels) { Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::Iterable<const CompressedImageView3D>& imageLevels) {
return add(imageLevels, {}); return add(imageLevels, {});
} }

122
src/Magnum/Trade/AbstractSceneConverter.h

@ -241,7 +241,7 @@ enum class SceneConverterFeature: UnsignedInt {
/** /**
* Add multiple mesh levels with * Add multiple mesh levels with
* @ref AbstractSceneConverter::add(Containers::Iterable<const MeshData>, Containers::StringView) * @ref AbstractSceneConverter::add(const Containers::Iterable<const MeshData>&, Containers::StringView)
* if @ref SceneConverterFeature::AddMeshes is also supported. * if @ref SceneConverterFeature::AddMeshes is also supported.
* @m_since_latest * @m_since_latest
*/ */
@ -249,13 +249,13 @@ enum class SceneConverterFeature: UnsignedInt {
/** /**
* Add multiple image levels with * Add multiple image levels with
* @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData1D>, Containers::StringView) * @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D>&, Containers::StringView)
* if @ref SceneConverterFeature::AddImages1D or * if @ref SceneConverterFeature::AddImages1D or
* @relativeref{SceneConverterFeature,AddCompressedImages1D} is also * @relativeref{SceneConverterFeature,AddCompressedImages1D} is also
* supported; with @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData2D>, Containers::StringView) * supported; with @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D>&, Containers::StringView)
* if @ref SceneConverterFeature::AddImages2D or * if @ref SceneConverterFeature::AddImages2D or
* @relativeref{SceneConverterFeature,AddCompressedImages2D} is also * @relativeref{SceneConverterFeature,AddCompressedImages2D} is also
* supported; or with @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData1D>, Containers::StringView) * supported; or with @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D>&, Containers::StringView)
* if @ref SceneConverterFeature::AddImages3D or * if @ref SceneConverterFeature::AddImages3D or
* @relativeref{SceneConverterFeature,AddCompressedImages3D} is also * @relativeref{SceneConverterFeature,AddCompressedImages3D} is also
* supported. * supported.
@ -429,7 +429,7 @@ enum class SceneContent: UnsignedInt {
/** /**
* Multiple mesh levels. For every mesh gathers @ref MeshData from all * Multiple mesh levels. For every mesh gathers @ref MeshData from all
* @ref AbstractImporter::meshLevelCount() and passes them to * @ref AbstractImporter::meshLevelCount() and passes them to
* @ref AbstractSceneConverter::add(Containers::Iterable<const MeshData>, Containers::StringView) * @ref AbstractSceneConverter::add(const Containers::Iterable<const MeshData>&, Containers::StringView)
* instead of passing just the first level to * instead of passing just the first level to
* @ref AbstractSceneConverter::add(const MeshData&, Containers::StringView). * @ref AbstractSceneConverter::add(const MeshData&, Containers::StringView).
* @see @ref SceneContent::Meshes * @see @ref SceneContent::Meshes
@ -442,9 +442,9 @@ enum class SceneContent: UnsignedInt {
* @ref AbstractImporter::image1DLevelCount() / * @ref AbstractImporter::image1DLevelCount() /
* @relativeref{AbstractImporter,image2DLevelCount()} / * @relativeref{AbstractImporter,image2DLevelCount()} /
* @relativeref{AbstractImporter,image3DLevelCount()} and passes them to * @relativeref{AbstractImporter,image3DLevelCount()} and passes them to
* @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData1D>, Containers::StringView) / * @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData1D>&, Containers::StringView) /
* @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData2D>, Containers::StringView) "add(Containers::Iterable<const ImageData2D>, Containers::StringView)" / * @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData2D>&, Containers::StringView) "add(const Containers::Iterable<const ImageData2D>&, Containers::StringView)" /
* @ref AbstractSceneConverter::add(Containers::Iterable<const ImageData3D>, Containers::StringView) "add(Containers::Iterable<const ImageData3D>, Containers::StringView)" * @ref AbstractSceneConverter::add(const Containers::Iterable<const ImageData3D>&, Containers::StringView) "add(const Containers::Iterable<const ImageData3D>&, Containers::StringView)"
* instead of just passing the first level to * instead of just passing the first level to
* *
* @ref AbstractSceneConverter::add(const ImageData1D&, Containers::StringView) / * @ref AbstractSceneConverter::add(const ImageData1D&, Containers::StringView) /
@ -744,7 +744,7 @@ checked by the implementation:
(if any) was aborted with @ref doAbort(). (if any) was aborted with @ref doAbort().
- The @ref doAdd() and various `doSet*()` functions are called only if a - The @ref doAdd() and various `doSet*()` functions are called only if a
corresponding @ref SceneConverterFeature is supported. corresponding @ref SceneConverterFeature is supported.
- The @ref doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) - The @ref doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView)
function is called only if the list has at least one mesh function is called only if the list has at least one mesh
- All @ref doAdd() functions taking a single image are called only if the - All @ref doAdd() functions taking a single image are called only if the
image has a non-zero size in all dimensions and the data is not image has a non-zero size in all dimensions and the data is not
@ -1389,7 +1389,7 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* *
* Count of meshes successfully added with * Count of meshes successfully added with
* @ref add(const MeshData&, Containers::StringView) or * @ref add(const MeshData&, Containers::StringView) or
* @ref add(Containers::Iterable<const MeshData>, Containers::StringView) * @ref add(const Containers::Iterable<const MeshData>&, Containers::StringView)
* since the initial @ref begin(), @ref beginData() or @ref beginFile() * since the initial @ref begin(), @ref beginData() or @ref beginFile()
* call. Expects that a conversion is currently in progress. If * call. Expects that a conversion is currently in progress. If
* @ref SceneConverterFeature::AddMeshes is not supported and only the * @ref SceneConverterFeature::AddMeshes is not supported and only the
@ -1460,10 +1460,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @ref setMeshAttributeName() * @ref setMeshAttributeName()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const MeshData> meshLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const MeshData> meshLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const MeshData> meshLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const MeshData>& meshLevels);
#endif #endif
/** /**
@ -1577,7 +1577,7 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* *
* Count of images successfully added with * Count of images successfully added with
* @ref add(const ImageData1D&, Containers::StringView) or * @ref add(const ImageData1D&, Containers::StringView) or
* @ref add(Containers::Iterable<const ImageData1D>, Containers::StringView) * @ref add(const Containers::Iterable<const ImageData1D>&, Containers::StringView)
* and overloads since the initial @ref begin(), @ref beginData() or * and overloads since the initial @ref begin(), @ref beginData() or
* @ref beginFile() call. Expects that a conversion is currently in * @ref beginFile() call. Expects that a conversion is currently in
* progress. If neither @ref SceneConverterFeature::AddImages1D nor * progress. If neither @ref SceneConverterFeature::AddImages1D nor
@ -1663,10 +1663,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @ref ImageData::isCompressed() * @ref ImageData::isCompressed()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData1D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData1D>& imageLevels);
#endif #endif
/** /**
@ -1680,10 +1680,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView1D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView1D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView1D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView1D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView1D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView1D>& imageLevels);
#endif #endif
/** /**
@ -1697,10 +1697,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView1D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView1D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView1D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView1D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView1D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView1D>& imageLevels);
#endif #endif
/** /**
@ -1709,7 +1709,7 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* *
* Count of images successfully added with * Count of images successfully added with
* @ref add(const ImageData2D&, Containers::StringView) or * @ref add(const ImageData2D&, Containers::StringView) or
* @ref add(Containers::Iterable<const ImageData2D>, Containers::StringView) * @ref add(const Containers::Iterable<const ImageData2D>&, Containers::StringView)
* and overloads since the initial @ref begin(), @ref beginData() or * and overloads since the initial @ref begin(), @ref beginData() or
* @ref beginFile() call. Expects that a conversion is currently in * @ref beginFile() call. Expects that a conversion is currently in
* progress. If neither @ref SceneConverterFeature::AddImages2D nor * progress. If neither @ref SceneConverterFeature::AddImages2D nor
@ -1794,10 +1794,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @see @ref isConverting(), @ref features() * @see @ref isConverting(), @ref features()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData2D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData2D>& imageLevels);
#endif #endif
/** /**
@ -1811,10 +1811,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView2D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView2D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView2D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView2D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView2D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView2D>& imageLevels);
#endif #endif
/** /**
@ -1828,10 +1828,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView2D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView2D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView2D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView2D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView2D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView2D>& imageLevels);
#endif #endif
/** /**
@ -1840,7 +1840,7 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* *
* Count of images successfully added with * Count of images successfully added with
* @ref add(const ImageData3D&, Containers::StringView) or * @ref add(const ImageData3D&, Containers::StringView) or
* @ref add(Containers::Iterable<const ImageData3D>, Containers::StringView) * @ref add(const Containers::Iterable<const ImageData3D>&, Containers::StringView)
* and overloads since the initial @ref begin(), @ref beginData() or * and overloads since the initial @ref begin(), @ref beginData() or
* @ref beginFile() call. Expects that a conversion is currently in * @ref beginFile() call. Expects that a conversion is currently in
* progress. If neither @ref SceneConverterFeature::AddImages3D nor * progress. If neither @ref SceneConverterFeature::AddImages3D nor
@ -1925,10 +1925,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @see @ref isConverting(), @ref features() * @see @ref isConverting(), @ref features()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageData3D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageData3D>& imageLevels);
#endif #endif
/** /**
@ -1942,10 +1942,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView3D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView3D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView3D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView3D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const ImageView3D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const ImageView3D>& imageLevels);
#endif #endif
/** /**
@ -1959,10 +1959,10 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
allow passing an array of Reference<ImageData>, fixes the allow passing an array of Reference<ImageData>, fixes the
ambiguity. */ ambiguity. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView3D> imageLevels, Containers::StringView name = {}); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView3D>& imageLevels, Containers::StringView name = {});
#else #else
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView3D> imageLevels, Containers::StringView name); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView3D>& imageLevels, Containers::StringView name);
Containers::Optional<UnsignedInt> add(Containers::Iterable<const CompressedImageView3D> imageLevels); Containers::Optional<UnsignedInt> add(const Containers::Iterable<const CompressedImageView3D>& imageLevels);
#endif #endif
/** /**
@ -2260,7 +2260,7 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* *
* If @ref SceneConverterFeature::AddMeshes together with * If @ref SceneConverterFeature::AddMeshes together with
* @relativeref{SceneConverterFeature,MeshLevels} is supported, default * @relativeref{SceneConverterFeature,MeshLevels} is supported, default
* implementation calls @ref doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) * implementation calls @ref doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView)
* with just the single @p mesh. * with just the single @p mesh.
* *
* Otherwise, if @ref SceneConverterFeature::ConvertMesh, * Otherwise, if @ref SceneConverterFeature::ConvertMesh,
@ -2283,13 +2283,13 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
virtual bool doAdd(UnsignedInt id, const MeshData& mesh, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const MeshData& mesh, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(Containers::Iterable<const MeshData>, Containers::StringView) * @brief Implementation for @ref add(const Containers::Iterable<const MeshData>&, Containers::StringView)
* @m_since_latest * @m_since_latest
* *
* The @p id is equal to @ref meshCount() at the time this function * The @p id is equal to @ref meshCount() at the time this function
* is called. * is called.
*/ */
virtual bool doAdd(UnsignedInt id, Containers::Iterable<const MeshData> meshLevels, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name);
/** /**
* @brief Implementation for @ref setMeshAttributeName() * @brief Implementation for @ref setMeshAttributeName()
@ -2330,22 +2330,22 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @ref ImageData1D instance. * @ref ImageData1D instance.
* *
* If @ref SceneConverterFeature::ImageLevels is supported, default * If @ref SceneConverterFeature::ImageLevels is supported, default
* implementation calls @ref doAdd(UnsignedInt, Containers::Iterable<const ImageData1D>, Containers::StringView) * implementation calls @ref doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>&, Containers::StringView)
* with just the single @p image. * with just the single @p image.
*/ */
virtual bool doAdd(UnsignedInt id, const ImageData1D& image, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const ImageData1D& image, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(Containers::Iterable<const ImageData1D>, Containers::StringView) * @brief Implementation for @ref add(const Containers::Iterable<const ImageData1D>&, Containers::StringView)
* @m_since_latest * @m_since_latest
* *
* The @p id is equal to @ref image1DCount() at the time this function * The @p id is equal to @ref image1DCount() at the time this function
* is called. If @ref add(Containers::Iterable<const ImageView1D>, Containers::StringView) * is called. If @ref add(const Containers::Iterable<const ImageView1D>&, Containers::StringView)
* or @ref add(Containers::Iterable<const CompressedImageView1D>, Containers::StringView) * or @ref add(const Containers::Iterable<const CompressedImageView1D>&, Containers::StringView)
* was called, receives the views wrapped in non-owning * was called, receives the views wrapped in non-owning
* @ref ImageData1D instances. * @ref ImageData1D instances.
*/ */
virtual bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(const ImageData2D&, Containers::StringView) * @brief Implementation for @ref add(const ImageData2D&, Containers::StringView)
@ -2358,22 +2358,22 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @ref ImageData2D instance. * @ref ImageData2D instance.
* *
* If @ref SceneConverterFeature::ImageLevels is supported, default * If @ref SceneConverterFeature::ImageLevels is supported, default
* implementation calls @ref doAdd(UnsignedInt, Containers::Iterable<const ImageData2D>, Containers::StringView) * implementation calls @ref doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>&, Containers::StringView)
* with just the single @p image. * with just the single @p image.
*/ */
virtual bool doAdd(UnsignedInt id, const ImageData2D& image, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const ImageData2D& image, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(Containers::Iterable<const ImageData2D>, Containers::StringView) * @brief Implementation for @ref add(const Containers::Iterable<const ImageData2D>&, Containers::StringView)
* @m_since_latest * @m_since_latest
* *
* The @p id is equal to @ref image2DCount() at the time this function * The @p id is equal to @ref image2DCount() at the time this function
* is called. If @ref add(Containers::Iterable<const ImageView2D>, Containers::StringView) * is called. If @ref add(const Containers::Iterable<const ImageView2D>&, Containers::StringView)
* or @ref add(Containers::Iterable<const CompressedImageView2D>, Containers::StringView) * or @ref add(const Containers::Iterable<const CompressedImageView2D>&, Containers::StringView)
* was called, receives the views wrapped in non-owning * was called, receives the views wrapped in non-owning
* @ref ImageData2D instances. * @ref ImageData2D instances.
*/ */
virtual bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(const ImageData3D&, Containers::StringView) * @brief Implementation for @ref add(const ImageData3D&, Containers::StringView)
@ -2386,22 +2386,22 @@ class MAGNUM_TRADE_EXPORT AbstractSceneConverter: public PluginManager::Abstract
* @ref ImageData3D instance. * @ref ImageData3D instance.
* *
* If @ref SceneConverterFeature::ImageLevels is supported, default * If @ref SceneConverterFeature::ImageLevels is supported, default
* implementation calls @ref doAdd(UnsignedInt, Containers::Iterable<const ImageData3D>, Containers::StringView) * implementation calls @ref doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>&, Containers::StringView)
* with just the single @p image. * with just the single @p image.
*/ */
virtual bool doAdd(UnsignedInt id, const ImageData3D& image, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const ImageData3D& image, Containers::StringView name);
/** /**
* @brief Implementation for @ref add(Containers::Iterable<const ImageData3D>, Containers::StringView) * @brief Implementation for @ref add(const Containers::Iterable<const ImageData3D>&, Containers::StringView)
* @m_since_latest * @m_since_latest
* *
* The @p id is equal to @ref image3DCount() at the time this function * The @p id is equal to @ref image3DCount() at the time this function
* is called. If @ref add(Containers::Iterable<const ImageView3D>, Containers::StringView) * is called. If @ref add(const Containers::Iterable<const ImageView3D>&, Containers::StringView)
* or @ref add(Containers::Iterable<const CompressedImageView3D>, Containers::StringView) * or @ref add(const Containers::Iterable<const CompressedImageView3D>&, Containers::StringView)
* was called, receives the views wrapped in non-owning * was called, receives the views wrapped in non-owning
* @ref ImageData3D instances. * @ref ImageData3D instances.
*/ */
virtual bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name); virtual bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name);
/* Called from addImporterContents() and addSupportedImporterContents() */ /* Called from addImporterContents() and addSupportedImporterContents() */
MAGNUM_TRADE_LOCAL bool addImporterContentsInternal(AbstractImporter& importer, SceneContents contents, bool noLevelsIfUnsupported); MAGNUM_TRADE_LOCAL bool addImporterContentsInternal(AbstractImporter& importer, SceneContents contents, bool noLevelsIfUnsupported);

82
src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp

@ -3869,7 +3869,7 @@ void AbstractSceneConverterTest::addMeshLevels() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt id, Containers::Iterable<const MeshData> meshLevels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name) override {
/* Camera count should not be increased before the function /* Camera count should not be increased before the function
returns */ returns */
CORRADE_COMPARE(id, meshCount()); CORRADE_COMPARE(id, meshCount());
@ -3912,7 +3912,7 @@ void AbstractSceneConverterTest::addMeshLevelsFailed() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView) override {
return false; return false;
} }
} converter; } converter;
@ -3991,7 +3991,7 @@ void AbstractSceneConverterTest::addMeshThroughLevels() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const MeshData> meshLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(meshLevels.size(), 1); CORRADE_COMPARE(meshLevels.size(), 1);
CORRADE_COMPARE(meshLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef)); CORRADE_COMPARE(meshLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef));
@ -4830,7 +4830,7 @@ void AbstractSceneConverterTest::addImageLevels1D() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name) override {
/* Camera count should not be increased before the function /* Camera count should not be increased before the function
returns */ returns */
CORRADE_COMPARE(id, image1DCount()); CORRADE_COMPARE(id, image1DCount());
@ -4876,7 +4876,7 @@ void AbstractSceneConverterTest::addImageLevels1DView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(!imageLevels[1].isCompressed()); CORRADE_VERIFY(!imageLevels[1].isCompressed());
@ -4915,7 +4915,7 @@ void AbstractSceneConverterTest::addImageLevels1DCompressedView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(imageLevels[1].isCompressed()); CORRADE_VERIFY(imageLevels[1].isCompressed());
@ -4955,7 +4955,7 @@ void AbstractSceneConverterTest::addImageLevels1DFailed() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>&, Containers::StringView) override {
return false; return false;
} }
} converter; } converter;
@ -5048,7 +5048,7 @@ void AbstractSceneConverterTest::addImageLevels2D() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name) override {
/* Camera count should not be increased before the function /* Camera count should not be increased before the function
returns */ returns */
CORRADE_COMPARE(id, image2DCount()); CORRADE_COMPARE(id, image2DCount());
@ -5094,7 +5094,7 @@ void AbstractSceneConverterTest::addImageLevels2DView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(!imageLevels[1].isCompressed()); CORRADE_VERIFY(!imageLevels[1].isCompressed());
@ -5133,7 +5133,7 @@ void AbstractSceneConverterTest::addImageLevels2DCompressedView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(imageLevels[1].isCompressed()); CORRADE_VERIFY(imageLevels[1].isCompressed());
@ -5173,7 +5173,7 @@ void AbstractSceneConverterTest::addImageLevels2DFailed() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>&, Containers::StringView) override {
return false; return false;
} }
} converter; } converter;
@ -5455,7 +5455,7 @@ void AbstractSceneConverterTest::addImageLevels3D() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name) override {
/* Camera count should not be increased before the function /* Camera count should not be increased before the function
returns */ returns */
CORRADE_COMPARE(id, image3DCount()); CORRADE_COMPARE(id, image3DCount());
@ -5501,7 +5501,7 @@ void AbstractSceneConverterTest::addImageLevels3DView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(!imageLevels[1].isCompressed()); CORRADE_VERIFY(!imageLevels[1].isCompressed());
@ -5540,7 +5540,7 @@ void AbstractSceneConverterTest::addImageLevels3DCompressedView() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 2); CORRADE_COMPARE(imageLevels.size(), 2);
CORRADE_VERIFY(imageLevels[1].isCompressed()); CORRADE_VERIFY(imageLevels[1].isCompressed());
@ -5580,7 +5580,7 @@ void AbstractSceneConverterTest::addImageLevels3DFailed() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>&, Containers::StringView) override {
return false; return false;
} }
} converter; } converter;
@ -5673,7 +5673,7 @@ void AbstractSceneConverterTest::addImage1DThroughLevels() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 1); CORRADE_COMPARE(imageLevels.size(), 1);
CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef)); CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef));
@ -5703,7 +5703,7 @@ void AbstractSceneConverterTest::addImage2DThroughLevels() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 1); CORRADE_COMPARE(imageLevels.size(), 1);
CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef)); CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef));
@ -5733,7 +5733,7 @@ void AbstractSceneConverterTest::addImage3DThroughLevels() {
bool doBegin() override { return true; } bool doBegin() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name) override {
CORRADE_COMPARE(name, "hello"); CORRADE_COMPARE(name, "hello");
CORRADE_COMPARE(imageLevels.size(), 1); CORRADE_COMPARE(imageLevels.size(), 1);
CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef)); CORRADE_COMPARE(imageLevels[0].importerState(), reinterpret_cast<const void*>(0xdeadbeef));
@ -6037,7 +6037,7 @@ void AbstractSceneConverterTest::addImporterContents() {
Debug{} << "Adding mesh" << id << "named" << name << "with" << data.importerState(); Debug{} << "Adding mesh" << id << "named" << name << "with" << data.importerState();
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const MeshData> levels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const MeshData>& levels, Containers::StringView name) override {
for(std::size_t i = 0; i != levels.size(); ++i) for(std::size_t i = 0; i != levels.size(); ++i)
Debug{} << "Adding mesh" << id << "level" << i << "named" << name << "with" << levels[i].importerState(); Debug{} << "Adding mesh" << id << "level" << i << "named" << name << "with" << levels[i].importerState();
return true; return true;
@ -6056,7 +6056,7 @@ void AbstractSceneConverterTest::addImporterContents() {
Debug{} << "Adding 1D image" << id << "named" << name << "with" << data.importerState(); Debug{} << "Adding 1D image" << id << "named" << name << "with" << data.importerState();
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData1D> levels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData1D>& levels, Containers::StringView name) override {
for(std::size_t i = 0; i != levels.size(); ++i) for(std::size_t i = 0; i != levels.size(); ++i)
Debug{} << "Adding 1D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState(); Debug{} << "Adding 1D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState();
return true; return true;
@ -6066,7 +6066,7 @@ void AbstractSceneConverterTest::addImporterContents() {
Debug{} << "Adding 2D image" << id << "named" << name << "with" << data.importerState(); Debug{} << "Adding 2D image" << id << "named" << name << "with" << data.importerState();
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData2D> levels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData2D>& levels, Containers::StringView name) override {
for(std::size_t i = 0; i != levels.size(); ++i) for(std::size_t i = 0; i != levels.size(); ++i)
Debug{} << "Adding 2D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState(); Debug{} << "Adding 2D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState();
return true; return true;
@ -6076,7 +6076,7 @@ void AbstractSceneConverterTest::addImporterContents() {
Debug{} << "Adding 3D image" << id << "named" << name << "with" << data.importerState(); Debug{} << "Adding 3D image" << id << "named" << name << "with" << data.importerState();
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData3D> levels, Containers::StringView name) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData3D>& levels, Containers::StringView name) override {
for(std::size_t i = 0; i != levels.size(); ++i) for(std::size_t i = 0; i != levels.size(); ++i)
Debug{} << "Adding 3D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState(); Debug{} << "Adding 3D image" << id << "level" << i << "named" << name << "with" << levels[i].importerState();
return true; return true;
@ -6193,7 +6193,7 @@ void AbstractSceneConverterTest::addImporterContentsCustomMeshAttributes() {
bool doBeginData() override { return true; } bool doBeginData() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView) override {
Debug{} << "Adding mesh levels"; Debug{} << "Adding mesh levels";
return true; return true;
} }
@ -6412,7 +6412,7 @@ void AbstractSceneConverterTest::addImporterContentsImportFail() {
Debug{} << "Adding mesh"; Debug{} << "Adding mesh";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView) override {
Debug{} << "Adding mesh levels"; Debug{} << "Adding mesh levels";
return true; return true;
} }
@ -6430,7 +6430,7 @@ void AbstractSceneConverterTest::addImporterContentsImportFail() {
Debug{} << "Adding 1D image"; Debug{} << "Adding 1D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>&, Containers::StringView) override {
Debug{} << "Adding 1D image levels"; Debug{} << "Adding 1D image levels";
return true; return true;
} }
@ -6439,7 +6439,7 @@ void AbstractSceneConverterTest::addImporterContentsImportFail() {
Debug{} << "Adding 2D image"; Debug{} << "Adding 2D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>&, Containers::StringView) override {
Debug{} << "Adding 2D image levels"; Debug{} << "Adding 2D image levels";
return true; return true;
} }
@ -6447,7 +6447,7 @@ void AbstractSceneConverterTest::addImporterContentsImportFail() {
Debug{} << "Adding 3D image"; Debug{} << "Adding 3D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>&, Containers::StringView) override {
Debug{} << "Adding 3D image levels"; Debug{} << "Adding 3D image levels";
return true; return true;
} }
@ -6637,7 +6637,7 @@ void AbstractSceneConverterTest::addImporterContentsConversionFail() {
Debug{} << "Adding mesh"; Debug{} << "Adding mesh";
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const MeshData>, Containers::StringView) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const MeshData>&, Containers::StringView) override {
if(id == 2) return false; if(id == 2) return false;
Debug{} << "Adding mesh levels"; Debug{} << "Adding mesh levels";
@ -6663,7 +6663,7 @@ void AbstractSceneConverterTest::addImporterContentsConversionFail() {
Debug{} << "Adding 1D image"; Debug{} << "Adding 1D image";
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData1D>&, Containers::StringView) override {
if(id == 2) return false; if(id == 2) return false;
Debug{} << "Adding 1D image levels"; Debug{} << "Adding 1D image levels";
@ -6676,7 +6676,7 @@ void AbstractSceneConverterTest::addImporterContentsConversionFail() {
Debug{} << "Adding 2D image"; Debug{} << "Adding 2D image";
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData2D>&, Containers::StringView) override {
if(id == 2) return false; if(id == 2) return false;
Debug{} << "Adding 2D image levels"; Debug{} << "Adding 2D image levels";
@ -6688,7 +6688,7 @@ void AbstractSceneConverterTest::addImporterContentsConversionFail() {
Debug{} << "Adding 3D image"; Debug{} << "Adding 3D image";
return true; return true;
} }
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData3D>&, Containers::StringView) override {
if(id == 2) return false; if(id == 2) return false;
Debug{} << "Adding 3D image levels"; Debug{} << "Adding 3D image levels";
@ -6919,15 +6919,15 @@ void AbstractSceneConverterTest::addImporterContentsNotSupportedUncompressedImag
} }
bool doBeginData() override { return true; } bool doBeginData() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData1D>&, Containers::StringView) override {
Debug{} << "Added 1D image"; Debug{} << "Added 1D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData2D>&, Containers::StringView) override {
Debug{} << "Added 2D image"; Debug{} << "Added 2D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData3D>&, Containers::StringView) override {
Debug{} << "Added 3D image"; Debug{} << "Added 3D image";
return true; return true;
} }
@ -6997,15 +6997,15 @@ void AbstractSceneConverterTest::addImporterContentsNotSupportedCompressedImage(
} }
bool doBeginData() override { return true; } bool doBeginData() override { return true; }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData1D>&, Containers::StringView) override {
Debug{} << "Added 1D image"; Debug{} << "Added 1D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData2D>&, Containers::StringView) override {
Debug{} << "Added 2D image"; Debug{} << "Added 2D image";
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const Trade::ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const Trade::ImageData3D>&, Containers::StringView) override {
Debug{} << "Added 3D image"; Debug{} << "Added 3D image";
return true; return true;
} }
@ -7159,7 +7159,7 @@ void AbstractSceneConverterTest::addSupportedImporterContents() {
bool doAdd(UnsignedInt, const SkinData3D&, Containers::StringView) override { bool doAdd(UnsignedInt, const SkinData3D&, Containers::StringView) override {
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const MeshData>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const MeshData>&, Containers::StringView) override {
return true; return true;
} }
bool doAdd(UnsignedInt, const MaterialData&, Containers::StringView) override { bool doAdd(UnsignedInt, const MaterialData&, Containers::StringView) override {
@ -7168,13 +7168,13 @@ void AbstractSceneConverterTest::addSupportedImporterContents() {
bool doAdd(UnsignedInt, const TextureData&, Containers::StringView) override { bool doAdd(UnsignedInt, const TextureData&, Containers::StringView) override {
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData1D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData1D>&, Containers::StringView) override {
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData2D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData2D>&, Containers::StringView) override {
return true; return true;
} }
bool doAdd(UnsignedInt, Containers::Iterable<const ImageData3D>, Containers::StringView) override { bool doAdd(UnsignedInt, const Containers::Iterable<const ImageData3D>&, Containers::StringView) override {
return true; return true;
} }

2
src/Magnum/Vk/DescriptorSetLayout.cpp

@ -91,7 +91,7 @@ DescriptorSetLayoutBinding& DescriptorSetLayoutBinding::operator=(DescriptorSetL
return *this; return *this;
} }
DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo(const Containers::Iterable<const DescriptorSetLayoutBinding> bindings, const Flags flags): _info{} { DescriptorSetLayoutCreateInfo::DescriptorSetLayoutCreateInfo(const Containers::Iterable<const DescriptorSetLayoutBinding>& bindings, const Flags flags): _info{} {
/* Check the total count of immutable samplers to allocate them all in a /* Check the total count of immutable samplers to allocate them all in a
contiguous memory location. Also check if we have any binding flags. If contiguous memory location. Also check if we have any binding flags. If
yes, we have to create an additional array and put a structure into the yes, we have to create an additional array and put a structure into the

2
src/Magnum/Vk/DescriptorSetLayoutCreateInfo.h

@ -323,7 +323,7 @@ class MAGNUM_VK_EXPORT DescriptorSetLayoutCreateInfo {
* - `pBindingFlags` to a list of all * - `pBindingFlags` to a list of all
* @ref DescriptorSetLayoutBinding::flags() from @p bindings * @ref DescriptorSetLayoutBinding::flags() from @p bindings
*/ */
explicit DescriptorSetLayoutCreateInfo(Containers::Iterable<const DescriptorSetLayoutBinding> bindings, Flags flags = {}); explicit DescriptorSetLayoutCreateInfo(const Containers::Iterable<const DescriptorSetLayoutBinding>& bindings, Flags flags = {});
/** @overload */ /** @overload */
/* Iterable takes std::initializer_list itself but having it also here /* Iterable takes std::initializer_list itself but having it also here

10
src/MagnumPlugins/AnySceneConverter/AnySceneConverter.cpp

@ -233,7 +233,7 @@ bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const MeshDat
return !!_converter->add(mesh, name); return !!_converter->add(mesh, name);
} }
bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const MeshData> meshLevels, const Containers::StringView name) { bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const MeshData>& meshLevels, const Containers::StringView name) {
CORRADE_INTERNAL_ASSERT(id == _converter->meshCount()); CORRADE_INTERNAL_ASSERT(id == _converter->meshCount());
return !!_converter->add(meshLevels, name); return !!_converter->add(meshLevels, name);
} }
@ -257,7 +257,7 @@ bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const ImageDa
return !!_converter->add(image, name); return !!_converter->add(image, name);
} }
bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData1D> imageLevels, const Containers::StringView name) { bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData1D>& imageLevels, const Containers::StringView name) {
CORRADE_INTERNAL_ASSERT(id == _converter->image1DCount()); CORRADE_INTERNAL_ASSERT(id == _converter->image1DCount());
return !!_converter->add(imageLevels, name); return !!_converter->add(imageLevels, name);
} }
@ -267,7 +267,7 @@ bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const ImageDa
return !!_converter->add(image, name); return !!_converter->add(image, name);
} }
bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData2D> imageLevels, const Containers::StringView name) { bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData2D>& imageLevels, const Containers::StringView name) {
CORRADE_INTERNAL_ASSERT(id == _converter->image2DCount()); CORRADE_INTERNAL_ASSERT(id == _converter->image2DCount());
return !!_converter->add(imageLevels, name); return !!_converter->add(imageLevels, name);
} }
@ -277,7 +277,7 @@ bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const ImageDa
return !!_converter->add(image, name); return !!_converter->add(image, name);
} }
bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData3D> imageLevels, const Containers::StringView name) { bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Containers::Iterable<const ImageData3D>& imageLevels, const Containers::StringView name) {
CORRADE_INTERNAL_ASSERT(id == _converter->image3DCount()); CORRADE_INTERNAL_ASSERT(id == _converter->image3DCount());
return !!_converter->add(imageLevels, name); return !!_converter->add(imageLevels, name);
} }
@ -285,4 +285,4 @@ bool AnySceneConverter::doAdd(CORRADE_UNUSED const UnsignedInt id, const Contain
}} }}
CORRADE_PLUGIN_REGISTER(AnySceneConverter, Magnum::Trade::AnySceneConverter, CORRADE_PLUGIN_REGISTER(AnySceneConverter, Magnum::Trade::AnySceneConverter,
"cz.mosra.magnum.Trade.AbstractSceneConverter/0.2") "cz.mosra.magnum.Trade.AbstractSceneConverter/0.2.1")

8
src/MagnumPlugins/AnySceneConverter/AnySceneConverter.h

@ -145,20 +145,20 @@ class MAGNUM_ANYSCENECONVERTER_EXPORT AnySceneConverter: public AbstractSceneCon
bool doAdd(UnsignedInt id, const SkinData3D& skin, Containers::StringView name) override; bool doAdd(UnsignedInt id, const SkinData3D& skin, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const MeshData& mesh, Containers::StringView name) override; bool doAdd(UnsignedInt id, const MeshData& mesh, Containers::StringView name) override;
bool doAdd(UnsignedInt id, Containers::Iterable<const MeshData> meshLevels, Containers::StringView name) override; bool doAdd(UnsignedInt id, const Containers::Iterable<const MeshData>& meshLevels, Containers::StringView name) override;
void doSetMeshAttributeName(UnsignedShort attribute, Containers::StringView name) override; void doSetMeshAttributeName(UnsignedShort attribute, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const MaterialData& material, Containers::StringView name) override; bool doAdd(UnsignedInt id, const MaterialData& material, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const TextureData& texture, Containers::StringView name) override; bool doAdd(UnsignedInt id, const TextureData& texture, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const ImageData1D& image, Containers::StringView name) override; bool doAdd(UnsignedInt id, const ImageData1D& image, Containers::StringView name) override;
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData1D> imageLevels, Containers::StringView name) override; bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData1D>& imageLevels, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const ImageData2D& image, Containers::StringView name) override; bool doAdd(UnsignedInt id, const ImageData2D& image, Containers::StringView name) override;
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData2D> imageLevels, Containers::StringView name) override; bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData2D>& imageLevels, Containers::StringView name) override;
bool doAdd(UnsignedInt id, const ImageData3D& image, Containers::StringView name) override; bool doAdd(UnsignedInt id, const ImageData3D& image, Containers::StringView name) override;
bool doAdd(UnsignedInt id, Containers::Iterable<const ImageData3D> imageLevels, Containers::StringView name) override; bool doAdd(UnsignedInt id, const Containers::Iterable<const ImageData3D>& imageLevels, Containers::StringView name) override;
Containers::Pointer<AbstractSceneConverter> _converter; Containers::Pointer<AbstractSceneConverter> _converter;
}; };

Loading…
Cancel
Save