Browse Source

AnyImageConverter: Basis now supports also 3D (2D array) image export.

pull/539/head
Vladimír Vondruš 4 years ago
parent
commit
4d14d91d5d
  1. 3
      doc/changelog.dox
  2. 8
      src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp
  3. 4
      src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h
  4. 2
      src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp

3
doc/changelog.dox

@ -473,7 +473,8 @@ See also:
plugins also warn if the user specifies and option that is not present in plugins also warn if the user specifies and option that is not present in
the target implementation. the target implementation.
- @relativeref{Trade,AnyImageConverter} now implements also conversion of 3D - @relativeref{Trade,AnyImageConverter} now implements also conversion of 3D
and multi-level 2D/3D images for formats that support it (such as OpenEXR) and multi-level 2D/3D images for formats that support it (such as Basis
Universal or OpenEXR)
- Added @ref Trade::PhongMaterialData::hasCommonTextureTransformation(), - Added @ref Trade::PhongMaterialData::hasCommonTextureTransformation(),
@ref Trade::PhongMaterialData::ambientTextureMatrix(), @ref Trade::PhongMaterialData::ambientTextureMatrix(),
@ref Trade::PhongMaterialData::diffuseTextureMatrix(), @ref Trade::PhongMaterialData::diffuseTextureMatrix(),

8
src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp

@ -176,7 +176,9 @@ bool AnyImageConverter::doConvertToFile(const ImageView3D& image, const Containe
/* Detect the plugin from extension */ /* Detect the plugin from extension */
Containers::StringView plugin; Containers::StringView plugin;
if(normalized.hasSuffix(".exr"_s)) if(normalized.hasSuffix(".basis"_s))
plugin = "BasisImageConverter"_s;
else if(normalized.hasSuffix(".exr"_s))
plugin = "OpenExrImageConverter"_s; plugin = "OpenExrImageConverter"_s;
else if(normalized.hasSuffix(".ktx2"_s)) else if(normalized.hasSuffix(".ktx2"_s))
plugin = "KtxImageConverter"_s; plugin = "KtxImageConverter"_s;
@ -440,7 +442,9 @@ bool AnyImageConverter::doConvertToFile(const Containers::ArrayView<const ImageV
/* Detect the plugin from extension */ /* Detect the plugin from extension */
Containers::StringView plugin; Containers::StringView plugin;
if(normalized.hasSuffix(".exr"_s)) if(normalized.hasSuffix(".basis"_s))
plugin = "BasisImageConverter"_s;
else if(normalized.hasSuffix(".exr"_s))
plugin = "OpenExrImageConverter"_s; plugin = "OpenExrImageConverter"_s;
else if(normalized.hasSuffix(".ktx2"_s)) else if(normalized.hasSuffix(".ktx2"_s))
plugin = "KtxImageConverter"_s; plugin = "KtxImageConverter"_s;

4
src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h

@ -57,8 +57,8 @@ Detects file type based on file extension, loads corresponding plugin and then
tries to convert the file with it. Supported formats for uncompressed data: tries to convert the file with it. Supported formats for uncompressed data:
- Basis Universal (`*.basis`), converted with @ref BasisImageConverter or any - Basis Universal (`*.basis`), converted with @ref BasisImageConverter or any
other plugin that provides it. Only uncompressed 2D and multi-level 2D other plugin that provides it. Only uncompressed 2D/3D and multi-level
images. 2D/3D images.
- Windows Bitmap (`*.bmp`), converted with any plugin that provides - Windows Bitmap (`*.bmp`), converted with any plugin that provides
`BmpImageConverter`. Only uncompressed 2D images. `BmpImageConverter`. Only uncompressed 2D images.
- OpenEXR (`*.exr`), converted with any plugin that provides - OpenEXR (`*.exr`), converted with any plugin that provides

2
src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp

@ -167,6 +167,7 @@ constexpr struct {
const char* filename; const char* filename;
const char* plugin; const char* plugin;
} Detect3DData[]{ } Detect3DData[]{
{"Basis Universal", "file.basis", "BasisImageConverter"},
{"EXR", "file.exr", "OpenExrImageConverter"}, {"EXR", "file.exr", "OpenExrImageConverter"},
{"KTX2", "file.ktx2", "KtxImageConverter"}, {"KTX2", "file.ktx2", "KtxImageConverter"},
/* Have at least one test case with uppercase */ /* Have at least one test case with uppercase */
@ -200,6 +201,7 @@ constexpr struct {
const char* filename; const char* filename;
const char* plugin; const char* plugin;
} DetectLevels3DData[]{ } DetectLevels3DData[]{
{"Basis Universal", "file.basis", "BasisImageConverter"},
{"EXR", "file.exr", "OpenExrImageConverter"}, {"EXR", "file.exr", "OpenExrImageConverter"},
{"KTX2", "file.ktx2", "KtxImageConverter"}, {"KTX2", "file.ktx2", "KtxImageConverter"},
/* Have at least one test case with uppercase */ /* Have at least one test case with uppercase */

Loading…
Cancel
Save