Magnum::Trade::AstcImporter class new in Git master

ASTC importer plugin.

Imports 2D and 3D ASTC (*.astc) files produced by ARM ASTC encoder and other texture compression tools.

Usage

This plugin depends on the Trade library and is built if MAGNUM_WITH_ASTCIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load "AstcImporter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following:

set(MAGNUM_WITH_ASTCIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL)

# So the dynamically loaded plugin gets built implicitly
add_dependencies(your-app MagnumPlugins::AstcImporter)

To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/ directory, request the AstcImporter component of the MagnumPlugins package in CMake and link to the MagnumPlugins::AstcImporter target:

find_package(MagnumPlugins REQUIRED AstcImporter)

# ...
target_link_libraries(your-app PRIVATE MagnumPlugins::AstcImporter)

See Downloading and building plugins, Plugin usage with CMake, Loading and using plugins and File format support for more information.

Behavior and limitations

By default, images are imported with CompressedPixelFormat::Astc4x4RGBAUnorm to Astc12x12RGBAUnorm for 2D ASTC compression and Astc3x3x3RGBAUnorm to Astc6x6x6RGBAUnorm for 3D ASTC compression. The file format contains only information about block size but not about the actual type of data, thus to get *RGBASrgb and *RGBAF formats instead of *RGBAUnorm you have to explicitly set the format configuration option.

Files with 3D ASTC blocks are always exposed as 3D images instead of 2D. Additionally, if a file has 2D ASTC blocks but the Z size is not 1 (a 2D array texture), the image is also exposed as 3D, with ImageFlag3D::Array set. The ARM ASTC encoder doesn't seem to support such scenario (the -array option enforces use of a 3D ASTC format), but other tools might.

The plugin recognizes ImporterFlag::Quiet, which will cause all import warnings to be suppressed.

Plugin-specific configuration

It's possible to tune various import options through configuration(). See below for all options and their default values:

[configuration]
# Set to srgb or float to return the imported image in *RGBASrgb or *RGBAF
# pixel format instead of *RGBAUnorm.
format=linear

# As the ASTC file format doesn't contain any orientation metadata, it's
# assumed to follow the D3D/Vulkan coordinate system with Y down and (for 3D
# textures) Z forward. A warning is then printed on import, because the
# compressed ASTC blocks can't be easily flipped. Enable this option to
# assume the OpenGL coordinate system instead and silence the warning.
assumeYUpZBackward=false

See Editing plugin-specific configuration for more information and an example showing how to edit the configuration values.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

AstcImporter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.