Magnum::Trade::AbstractImporter class

Base for importer plugins.

Provides interface for importing 2D/3D scene, camera, light, animation, mesh, material, texture and image data.

Usage

Importers are most commonly implemented as plugins. For example, loading an image from the filesystem using the AnyImageImporter plugin can be done like this, completely with all error handling:

PluginManager::Manager<Trade::AbstractImporter> manager;
std::unique_ptr<Trade::AbstractImporter> importer =
    manager.loadAndInstantiate("AnyImageImporter");
if(!importer || !importer->openFile("image.png"))
    Fatal{} << "Can't open image.png with AnyImageImporter";

Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
if(!image) Fatal{} << "Importing the image failed";

// use the image ...

See Loading and using plugins for more information about general plugin usage and *Importer classes in the Trade namespace for available importer plugins.

Loading data from memory

Besides loading data directly from the filesystem using openFile() like shown above, it's possible to use openData() to import data from memory. Note that the particular importer implementation must support Feature::OpenData for this method to work.

Complex scene files often reference other files such as images and in that case you may want to intercept those references and load them in a custom way as well. For importers that advertise support for this with Feature::FileCallback this is done by specifying a file loading callback using setFileCallback(). The callback gets a filename, ImporterFileCallbackPolicy and an user pointer as parameters; returns a non-owning view on the loaded data or a Containers::NullOpt to indicate the file loading failed. For example, loading a scene from memory-mapped files could look like below. Note that the file loading callback affects openFile() as well — you don't have to load the top-level file manually and pass it to openData(), any importer supporting the callback feature handles that correctly.

struct Data {
    std::unordered_map<std::string,
        Containers::Array<const char, Utility::Directory::MapDeleter>> files;
} data;

importer->setFileCallback([](const std::string& filename,
    Trade::ImporterFileCallbackPolicy policy, Data& data)
        -> Containers::Optional<Containers::ArrayView<const char>>
    {
        auto found = data.files.find(filename);

        /* Discard the memory mapping, if not needed anymore */
        if(policy == Trade::ImporterFileCallbackPolicy::Close) {
            if(found != data.files.end()) data.files.erase(found);
            return {};
        }

        /* Load if not there yet */
        if(found == data.files.end()) found = data.files.emplace(
            filename, Utility::Directory::mapRead(filename)).first;

        return Containers::arrayView(found->second);
    }, data);

importer->openFile("scene.gltf"); // memory-maps all files

For importers that don't support Feature::FileCallback directly, the base openFile() implementation will use the file callback to pass the loaded data through to openData(), in case the importer supports at least Feature::OpenData. If the importer supports neither Feature::FileCallback nor Feature::OpenData, setFileCallback() doesn't allow the callbacks to be set.

Internal importer state

Some importers, especially ones that make use of well-known external libraries, expose internal state through various accessors:

Besides exposing internal state, importers that support the Feature::OpenState feature can also attach to existing importer state using openState(). See documentation of a particular importer for details about concrete types returned and accepted by these functions.

Polymorphic imported data types

Some data access functions return std::unique_ptr instead of Corrade::Containers::Optional because the result might be a particular subclass of given type. Those functions are material(), object2D() and object3D(). You can cast the abstract base to a concrete type depending on its reported type, for example:

std::unique_ptr<Trade::AbstractMaterialData> data = importer->material(12);
if(data && data->type() == Trade::MaterialType::Phong) {
    auto& phong = static_cast<Trade::PhongMaterialData&>(*data);

    shininess = phong.shininess();
    // ...
}

Another option is making use of the std::static_pointer_cast() family of utilities, but note that in that case your std::unique_ptr will be moved into a std::shared_ptr instance and that might not be desirable.

Subclassing

The plugin needs to implement the doFeatures(), doIsOpened() functions, at least one of doOpenData() / doOpenFile() / doOpenState() functions, function doClose() and one or more tuples of data access functions, based on what features are supported in given format.

In order to support Feature::FileCallback, the importer needs to properly use the callbacks to both load the top-level file in doOpenFile() and also load any external files when needed. The doOpenFile() can delegate back into the base implementation, but it should remember at least the base file path to pass correct paths to subsequent file callbacks. The doSetFileCallback() can be overriden in case it's desired to respond to file loading callback setup, but doesn't have to be.

For multi-data formats the file opening shouldn't take long and all parsing should be done in the data parsing functions instead, because the user might want to import only some data. This is obviously not the case for single-data formats like images, as the file contains all the data the user wants to import.

You don't need to do most of the redundant sanity checks, these things are checked by the implementation:

Derived classes

class AnyImageImporter
Any image importer plugin.
class AnySceneImporter
Any scene importer plugin.
class AssimpImporter
Assimp importer.
class ColladaImporter deprecated
Collada importer plugin.
class DdsImporter
DDS image importer plugin.
class DevIlImageImporter
DevIL Image importer plugin.
class JpegImporter
JPEG importer plugin.
class ObjImporter
OBJ importer plugin.
class OpenGexImporter
OpenGEX importer.
class PngImporter
PNG importer plugin.
class StanfordImporter
Stanford PLY importer plugin.
class StbImageImporter
Image importer plugin using stb_image.
class TgaImporter
TGA importer plugin.
class TinyGltfImporter
TinyGltf importer plugin.

Public types

enum class Feature: UnsignedByte { OpenData = 1 << 0, OpenState = 1 << 1, FileCallback = 1 << 2 }
Features supported by this importer.
using Features = Containers::EnumSet<Feature>
Set of features supported by this importer.

Public static functions

static auto pluginInterface() -> std::string
Plugin interface.
static auto pluginSearchPaths() -> std::vector<std::string>
Plugin search paths.

Constructors, destructors, conversion operators

AbstractImporter() explicit
Default constructor.
AbstractImporter(PluginManager::Manager<AbstractImporter>& manager) explicit
Constructor with access to plugin manager.
AbstractImporter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.

Public functions

auto features() const -> Features
Features supported by this importer.
auto fileCallback() -> auto
File opening callback function.
auto fileCallbackUserData() const -> void*
File opening callback user data.
void setFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, void*) callback, void* userData = nullptr)
Set file opening callback.
template<class T>
void setFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, T&) callback, T& userData)
Set file opening callback.
auto isOpened() const -> bool
Whether any file is opened.
auto openData(Containers::ArrayView<const char> data) -> bool
Open raw data.
auto openState(const void* state, const std::string& filePath = {}) -> bool
Open already loaded state.
auto openFile(const std::string& filename) -> bool
Open file.
void close()
Close file.
auto importerState() const -> const void*
Plugin-specific access to internal importer state.

Protected functions

void doOpenFile(const std::string& filename) virtual
Implementation for openFile()
auto doFeatures() const -> Features pure virtual
Implementation for features()
void doSetFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, void*) callback, void* userData) virtual
Implementation for setFileCallback()
auto doIsOpened() const -> bool pure virtual
Implementation for isOpened()
void doOpenData(Containers::ArrayView<const char> data) virtual
Implementation for openData()
void doOpenState(const void* state, const std::string& filePath) virtual
Implementation for openState()
void doClose() pure virtual
Implementation for close()
auto doDefaultScene() -> Int virtual
Implementation for defaultScene()
auto doSceneCount() const -> UnsignedInt virtual
Implementation for sceneCount()
auto doSceneForName(const std::string& name) -> Int virtual
Implementation for sceneForName()
auto doSceneName(UnsignedInt id) -> std::string virtual
Implementation for sceneName()
auto doScene(UnsignedInt id) -> Containers::Optional<SceneData> virtual
Implementation for scene()
auto doAnimationCount() const -> UnsignedInt virtual
Implementation for animationCount()
auto doAnimationForName(const std::string& name) -> Int virtual
Implementation for animationForName()
auto doAnimationName(UnsignedInt id) -> std::string virtual
Implementation for animationName()
auto doAnimation(UnsignedInt id) -> Containers::Optional<AnimationData> virtual
Implementation for animation()
auto doLightCount() const -> UnsignedInt virtual
Implementation for lightCount()
auto doLightForName(const std::string& name) -> Int virtual
Implementation for lightForName()
auto doLightName(UnsignedInt id) -> std::string virtual
Implementation for lightName()
auto doLight(UnsignedInt id) -> Containers::Optional<LightData> virtual
Implementation for light()
auto doCameraCount() const -> UnsignedInt virtual
Implementation for cameraCount()
auto doCameraForName(const std::string& name) -> Int virtual
Implementation for cameraForName()
auto doCameraName(UnsignedInt id) -> std::string virtual
Implementation for cameraName()
auto doCamera(UnsignedInt id) -> Containers::Optional<CameraData> virtual
Implementation for camera()
auto doObject2DCount() const -> UnsignedInt virtual
Implementation for object2DCount()
auto doObject2DForName(const std::string& name) -> Int virtual
Implementation for object2DForName()
auto doObject2DName(UnsignedInt id) -> std::string virtual
Implementation for object2DName()
auto doObject2D(UnsignedInt id) -> std::unique_ptr<ObjectData2D> virtual
Implementation for object2D()
auto doObject3DCount() const -> UnsignedInt virtual
Implementation for object3DCount()
auto doObject3DForName(const std::string& name) -> Int virtual
Implementation for object3DForName()
auto doObject3DName(UnsignedInt id) -> std::string virtual
Implementation for object3DName()
auto doObject3D(UnsignedInt id) -> std::unique_ptr<ObjectData3D> virtual
Implementation for object3D()
auto doMesh2DCount() const -> UnsignedInt virtual
Implementation for mesh2DCount()
auto doMesh2DForName(const std::string& name) -> Int virtual
Implementation for mesh2DForName()
auto doMesh2DName(UnsignedInt id) -> std::string virtual
Implementation for mesh2DName()
auto doMesh2D(UnsignedInt id) -> Containers::Optional<MeshData2D> virtual
Implementation for mesh2D()
auto doMesh3DCount() const -> UnsignedInt virtual
Implementation for mesh3DCount()
auto doMesh3DForName(const std::string& name) -> Int virtual
Implementation for mesh3DForName()
auto doMesh3DName(UnsignedInt id) -> std::string virtual
Implementation for mesh3DName()
auto doMesh3D(UnsignedInt id) -> Containers::Optional<MeshData3D> virtual
Implementation for mesh3D()
auto doMaterialCount() const -> UnsignedInt virtual
Implementation for materialCount()
auto doMaterialForName(const std::string& name) -> Int virtual
Implementation for materialForName()
auto doMaterialName(UnsignedInt id) -> std::string virtual
Implementation for materialName()
auto doMaterial(UnsignedInt id) -> std::unique_ptr<AbstractMaterialData> virtual
Implementation for material()
auto doTextureCount() const -> UnsignedInt virtual
Implementation for textureCount()
auto doTextureForName(const std::string& name) -> Int virtual
Implementation for textureForName()
auto doTextureName(UnsignedInt id) -> std::string virtual
Implementation for textureName()
auto doTexture(UnsignedInt id) -> Containers::Optional<TextureData> virtual
Implementation for texture()
auto doImage1DCount() const -> UnsignedInt virtual
Implementation for image1DCount()
auto doImage1DForName(const std::string& name) -> Int virtual
Implementation for image1DForName()
auto doImage1DName(UnsignedInt id) -> std::string virtual
Implementation for image1DName()
auto doImage1D(UnsignedInt id) -> Containers::Optional<ImageData1D> virtual
Implementation for image1D()
auto doImage2DCount() const -> UnsignedInt virtual
Implementation for image2DCount()
auto doImage2DForName(const std::string& name) -> Int virtual
Implementation for image2DForName()
auto doImage2DName(UnsignedInt id) -> std::string virtual
Implementation for image2DName()
auto doImage2D(UnsignedInt id) -> Containers::Optional<ImageData2D> virtual
Implementation for image2D()
auto doImage3DCount() const -> UnsignedInt virtual
Implementation for image3DCount()
auto doImage3DForName(const std::string& name) -> Int virtual
Implementation for image3DForName()
auto doImage3DName(UnsignedInt id) -> std::string virtual
Implementation for image3DName()
auto doImage3D(UnsignedInt id) -> Containers::Optional<ImageData3D> virtual
Implementation for image3D()
auto doImporterState() const -> const void* virtual
Implementation for importerState()

Data accessors

Each function tuple provides access to given data.

auto defaultScene() -> Int
Default scene.
auto sceneCount() const -> UnsignedInt
Scene count.
auto sceneForName(const std::string& name) -> Int
Scene ID for given name.
auto sceneName(UnsignedInt id) -> std::string
Scene name.
auto scene(UnsignedInt id) -> Containers::Optional<SceneData>
Scene.
auto animationCount() const -> UnsignedInt
Animation count.
auto animationForName(const std::string& name) -> Int
Animation ID for given name.
auto animationName(UnsignedInt id) -> std::string
Animation name.
auto animation(UnsignedInt id) -> Containers::Optional<AnimationData>
Animation.
auto lightCount() const -> UnsignedInt
Light count.
auto lightForName(const std::string& name) -> Int
Light ID for given name.
auto lightName(UnsignedInt id) -> std::string
Light name.
auto light(UnsignedInt id) -> Containers::Optional<LightData>
Light.
auto cameraCount() const -> UnsignedInt
Camera count.
auto cameraForName(const std::string& name) -> Int
Camera ID for given name.
auto cameraName(UnsignedInt id) -> std::string
Camera name.
auto camera(UnsignedInt id) -> Containers::Optional<CameraData>
Camera.
auto object2DCount() const -> UnsignedInt
Two-dimensional object count.
auto object2DForName(const std::string& name) -> Int
Two-dimensional object ID for given name.
auto object2DName(UnsignedInt id) -> std::string
Two-dimensional object name.
auto object2D(UnsignedInt id) -> std::unique_ptr<ObjectData2D>
Two-dimensional object.
auto object3DCount() const -> UnsignedInt
Three-dimensional object count.
auto object3DForName(const std::string& name) -> Int
Three-dimensional object ID for given name.
auto object3DName(UnsignedInt id) -> std::string
Three-dimensional object name.
auto object3D(UnsignedInt id) -> std::unique_ptr<ObjectData3D>
Three-dimensional object.
auto mesh2DCount() const -> UnsignedInt
Two-dimensional mesh count.
auto mesh2DForName(const std::string& name) -> Int
Two-dimensional mesh ID for given name.
auto mesh2DName(UnsignedInt id) -> std::string
Two-dimensional mesh name.
auto mesh2D(UnsignedInt id) -> Containers::Optional<MeshData2D>
Two-dimensional mesh.
auto mesh3DCount() const -> UnsignedInt
Three-dimensional mesh count.
auto mesh3DForName(const std::string& name) -> Int
Three-dimensional mesh ID for given name.
auto mesh3DName(UnsignedInt id) -> std::string
Three-dimensional mesh name.
auto mesh3D(UnsignedInt id) -> Containers::Optional<MeshData3D>
Three-dimensional mesh.
auto materialCount() const -> UnsignedInt
Material count.
auto materialForName(const std::string& name) -> Int
Material ID for given name.
auto materialName(UnsignedInt id) -> std::string
Material name.
auto material(UnsignedInt id) -> std::unique_ptr<AbstractMaterialData>
Material.
auto textureCount() const -> UnsignedInt
Texture count.
auto textureForName(const std::string& name) -> Int
Texture ID for given name.
auto textureName(UnsignedInt id) -> std::string
Texture name.
auto texture(UnsignedInt id) -> Containers::Optional<TextureData>
Texture.
auto image1DCount() const -> UnsignedInt
One-dimensional image count.
auto image1DForName(const std::string& name) -> Int
One-dimensional image ID for given name.
auto image1DName(UnsignedInt id) -> std::string
One-dimensional image name.
auto image1D(UnsignedInt id) -> Containers::Optional<ImageData1D>
One-dimensional image.
auto image2DCount() const -> UnsignedInt
Two-dimensional image count.
auto image2DForName(const std::string& name) -> Int
Two-dimensional image ID for given name.
auto image2DName(UnsignedInt id) -> std::string
Two-dimensional image name.
auto image2D(UnsignedInt id) -> Containers::Optional<ImageData2D>
Two-dimensional image.
auto image3DCount() const -> UnsignedInt
Three-dimensional image count.
auto image3DForName(const std::string& name) -> Int
Three-dimensional image ID for given name.
auto image3DName(UnsignedInt id) -> std::string
Three-dimensional image name.
auto image3D(UnsignedInt id) -> Containers::Optional<ImageData3D>
Three-dimensional image.

Enum documentation

enum class Magnum::Trade::AbstractImporter::Feature: UnsignedByte

Features supported by this importer.

Enumerators
OpenData

Opening files from raw data using openData()

OpenState

Opening already loaded state using openState()

FileCallback

Specifying callbacks for loading additional files referenced from the main file using setFileCallback(). If the importer doesn't expose this feature, the format is either single-file or loading via callbacks is not supported.

See Loading data from memory and particular importer documentation for more information.

Typedef documentation

typedef Containers::EnumSet<Feature> Magnum::Trade::AbstractImporter::Features

Set of features supported by this importer.

Function documentation

static std::string Magnum::Trade::AbstractImporter::pluginInterface()

Plugin interface.

"cz.mosra.magnum.Trade.AbstractImporter/0.3"

static std::vector<std::string> Magnum::Trade::AbstractImporter::pluginSearchPaths()

Plugin search paths.

First looks in magnum/importers/ or magnum-d/importers/ next to the executable and as a fallback in magnum/importers/ or magnum-d/importers/ in the runtime install location (lib[64]/ on Unix-like systems, bin/ on Windows). The system-wide plugin search directory is configurable using the MAGNUM_PLUGINS_DIR CMake variables, see Downloading and building for more information.

Not defined on platforms without dynamic plugin support.

auto Magnum::Trade::AbstractImporter::fileCallback()

File opening callback function.

void* Magnum::Trade::AbstractImporter::fileCallbackUserData() const

File opening callback user data.

void Magnum::Trade::AbstractImporter::setFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, void*) callback, void* userData = nullptr)

Set file opening callback.

In case the importer supports Feature::FileCallback, files opened through openFile() will be loaded through the provided callback. Besides that, all external files referenced by the top-level file will be loaded through the callback function as well, usually on demand. The callback function gets a filename, ImporterFileCallbackPolicy and the userData pointer as input and returns a non-owning view on the loaded data as output or a Corrade::Containers::NullOpt if loading failed — because empty files might also be valid in some circumstances, nullptr can't be used to indicate a failure.

In case the importer doesn't support Feature::FileCallback but supports at least Feature::OpenData, a file opened through openFile() will be internally loaded through the provided callback and then passed to openData(). First the file is loaded with ImporterFileCallbackPolicy::LoadTemporary passed to the callback, then the returned memory view is passed to openData() (sidestepping the potential openFile() implementation of that particular importer) and after that the callback is called again with ImporterFileCallbackPolicy::Close because the semantics of openData() don't require the data to be alive after. In case you need a different behavior, use openData() directly.

In case callback is nullptr, the current callback (if any) is reset. This function expects that the importer supports either Feature::FileCallback or Feature::OpenData. If an importer supports neither, callbacks can't be used.

It's expected that this function is called before a file is opened. It's also expected that the loaded data are kept in scope for as long as the importer needs them, based on the value of ImporterFileCallbackPolicy. Documentation of particular importers provides more information about the expected callback behavior.

Following is an example of setting up a file loading callback for fetching compiled-in resources from Corrade::Utility::Resource. See the overload below for a more convenient type-safe way to pass the user data pointer.

importer->setFileCallback([](const std::string& filename,
    Trade::ImporterFileCallbackPolicy, void*) {
        Utility::Resource rs("data");
        return Containers::optional(rs.getRaw(filename));
    });

template<class T>
void Magnum::Trade::AbstractImporter::setFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, T&) callback, T& userData)

Set file opening callback.

Equivalent to calling the above with a lambda wrapper that casts void* back to T* and dereferences it in order to pass it to callback. Example usage:

struct Data {
    std::unordered_map<std::string, Containers::Array<char>> files;
} data;

importer->setFileCallback([](const std::string& filename,
    Trade::ImporterFileCallbackPolicy, Data& data)
        -> Containers::Optional<Containers::ArrayView<const char>>
    {
        auto found = data.files.find(filename);
        if(found == data.files.end()) {
            if(!Utility::Directory::fileExists(filename))
                return Containers::NullOpt;
            found = data.files.emplace(filename, Utility::Directory::read(filename)).first;
        }
        return Containers::ArrayView<const char>{found->second};
    }, data);

bool Magnum::Trade::AbstractImporter::openData(Containers::ArrayView<const char> data)

Open raw data.

Closes previous file, if it was opened, and tries to open given raw data. Available only if Feature::OpenData is supported. Returns true on success, false otherwise.

bool Magnum::Trade::AbstractImporter::openState(const void* state, const std::string& filePath = {})

Open already loaded state.

Parameters
state Pointer to importer-specific state
filePath Base file directory for opening external data like textures and materials.

Closes previous file, if it was opened, and tries to open given state. Available only if Feature::OpenState is supported. Returns true on success, false otherwise.

See documentation of a particular plugin for more information about type and contents of the state parameter.

bool Magnum::Trade::AbstractImporter::openFile(const std::string& filename)

Open file.

Closes previous file, if it was opened, and tries to open given file. Returns true on success, false otherwise. If file loading callbacks are set via setFileCallback() and Feature::OpenData is supported, this function uses the callback to load the file and passes the memory view to openData() instead. See setFileCallback() for more information.

const void* Magnum::Trade::AbstractImporter::importerState() const

Plugin-specific access to internal importer state.

The importer might provide access to its internal data structures for currently opened document through this function. See documentation of a particular plugin for more information about returned type and contents. Returns nullptr by default.

void Magnum::Trade::AbstractImporter::doOpenFile(const std::string& filename) virtual protected

Implementation for openFile()

If Feature::OpenData is supported, default implementation opens the file and calls doOpenData() with its contents. It is allowed to call this function from your doOpenFile() implementation — in particular, this implementation will also correctly handle callbacks set through setFileCallback().

This function is not called when file callbacks are set through setFileCallback() and Feature::FileCallback is not supported — instead, file is loaded though the callback and data passed through to doOpenData().

void Magnum::Trade::AbstractImporter::doSetFileCallback(Containers::Optional<Containers::ArrayView<const char>>(*)(const std::string&, ImporterFileCallbackPolicy, void*) callback, void* userData) virtual protected

Implementation for setFileCallback()

Useful when the importer needs to modify some internal state on callback setup. Default implementation does nothing and this function doesn't need to be implemented — the callback function and user data pointer are available through fileCallback() and fileCallbackUserData().

Int Magnum::Trade::AbstractImporter::doDefaultScene() virtual protected

Implementation for defaultScene()

Default implementation returns -1.

UnsignedInt Magnum::Trade::AbstractImporter::doSceneCount() const virtual protected

Implementation for sceneCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doSceneForName(const std::string& name) virtual protected

Implementation for sceneForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doSceneName(UnsignedInt id) virtual protected

Implementation for sceneName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doAnimationCount() const virtual protected

Implementation for animationCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doAnimationForName(const std::string& name) virtual protected

Implementation for animationForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doAnimationName(UnsignedInt id) virtual protected

Implementation for animationName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doLightCount() const virtual protected

Implementation for lightCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doLightForName(const std::string& name) virtual protected

Implementation for lightForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doLightName(UnsignedInt id) virtual protected

Implementation for lightName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doCameraCount() const virtual protected

Implementation for cameraCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doCameraForName(const std::string& name) virtual protected

Implementation for cameraForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doCameraName(UnsignedInt id) virtual protected

Implementation for cameraName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doObject2DCount() const virtual protected

Implementation for object2DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doObject2DForName(const std::string& name) virtual protected

Implementation for object2DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doObject2DName(UnsignedInt id) virtual protected

Implementation for object2DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doObject3DCount() const virtual protected

Implementation for object3DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doObject3DForName(const std::string& name) virtual protected

Implementation for object3DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doObject3DName(UnsignedInt id) virtual protected

Implementation for object3DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doMesh2DCount() const virtual protected

Implementation for mesh2DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doMesh2DForName(const std::string& name) virtual protected

Implementation for mesh2DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doMesh2DName(UnsignedInt id) virtual protected

Implementation for mesh2DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doMesh3DCount() const virtual protected

Implementation for mesh3DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doMesh3DForName(const std::string& name) virtual protected

Implementation for mesh3DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doMesh3DName(UnsignedInt id) virtual protected

Implementation for mesh3DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doMaterialCount() const virtual protected

Implementation for materialCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doMaterialForName(const std::string& name) virtual protected

Implementation for materialForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doMaterialName(UnsignedInt id) virtual protected

Implementation for materialName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doTextureCount() const virtual protected

Implementation for textureCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doTextureForName(const std::string& name) virtual protected

Implementation for textureForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doTextureName(UnsignedInt id) virtual protected

Implementation for textureName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doImage1DCount() const virtual protected

Implementation for image1DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doImage1DForName(const std::string& name) virtual protected

Implementation for image1DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doImage1DName(UnsignedInt id) virtual protected

Implementation for image1DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doImage2DCount() const virtual protected

Implementation for image2DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doImage2DForName(const std::string& name) virtual protected

Implementation for image2DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doImage2DName(UnsignedInt id) virtual protected

Implementation for image2DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::AbstractImporter::doImage3DCount() const virtual protected

Implementation for image3DCount()

Default implementation returns 0.

Int Magnum::Trade::AbstractImporter::doImage3DForName(const std::string& name) virtual protected

Implementation for image3DForName()

Default implementation returns -1.

std::string Magnum::Trade::AbstractImporter::doImage3DName(UnsignedInt id) virtual protected

Implementation for image3DName()

Default implementation returns empty string.

Int Magnum::Trade::AbstractImporter::defaultScene()

Default scene.

When there is more than one scene, returns ID of the default one. If there is no default scene, returns -1.

Int Magnum::Trade::AbstractImporter::sceneForName(const std::string& name)

Scene ID for given name.

If no scene for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::sceneName(UnsignedInt id)

Scene name.

Parameters
id Scene ID, from range [0, sceneCount()).

Containers::Optional<SceneData> Magnum::Trade::AbstractImporter::scene(UnsignedInt id)

Scene.

Parameters
id Scene ID, from range [0, sceneCount()).

Returns given scene or Containers::NullOpt if import failed.

Int Magnum::Trade::AbstractImporter::animationForName(const std::string& name)

Animation ID for given name.

If no animation for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::animationName(UnsignedInt id)

Animation name.

Parameters
id Animation ID, from range [0, animationCount()).

Containers::Optional<AnimationData> Magnum::Trade::AbstractImporter::animation(UnsignedInt id)

Animation.

Parameters
id Animation ID, from range [0, animationCount()).

Returns given animation or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::lightForName(const std::string& name)

Light ID for given name.

If no light for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::lightName(UnsignedInt id)

Light name.

Parameters
id Light ID, from range [0, lightCount()).

Containers::Optional<LightData> Magnum::Trade::AbstractImporter::light(UnsignedInt id)

Light.

Parameters
id Light ID, from range [0, lightCount()).

Returns given light or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::cameraForName(const std::string& name)

Camera ID for given name.

If no camera for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::cameraName(UnsignedInt id)

Camera name.

Parameters
id Camera ID, from range [0, cameraCount()).

Containers::Optional<CameraData> Magnum::Trade::AbstractImporter::camera(UnsignedInt id)

Camera.

Parameters
id Camera ID, from range [0, cameraCount()).

Returns given camera or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::object2DForName(const std::string& name)

Two-dimensional object ID for given name.

If no scene for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::object2DName(UnsignedInt id)

Two-dimensional object name.

Parameters
id Object ID, from range [0, object2DCount()).

std::unique_ptr<ObjectData2D> Magnum::Trade::AbstractImporter::object2D(UnsignedInt id)

Two-dimensional object.

Parameters
id Object ID, from range [0, object2DCount()).

Returns given object or nullptr if importing failed.

Int Magnum::Trade::AbstractImporter::object3DForName(const std::string& name)

Three-dimensional object ID for given name.

If no scene for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::object3DName(UnsignedInt id)

Three-dimensional object name.

Parameters
id Object ID, from range [0, object3DCount()).

std::unique_ptr<ObjectData3D> Magnum::Trade::AbstractImporter::object3D(UnsignedInt id)

Three-dimensional object.

Parameters
id Object ID, from range [0, object3DCount()).

Returns given object or nullptr if importing failed.

Int Magnum::Trade::AbstractImporter::mesh2DForName(const std::string& name)

Two-dimensional mesh ID for given name.

If no mesh for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::mesh2DName(UnsignedInt id)

Two-dimensional mesh name.

Parameters
id Mesh ID, from range [0, mesh2DCount()).

Containers::Optional<MeshData2D> Magnum::Trade::AbstractImporter::mesh2D(UnsignedInt id)

Two-dimensional mesh.

Parameters
id Mesh ID, from range [0, mesh2DCount()).

Returns given mesh or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::mesh3DForName(const std::string& name)

Three-dimensional mesh ID for given name.

If no mesh for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::mesh3DName(UnsignedInt id)

Three-dimensional mesh name.

Parameters
id Mesh ID, from range [0, mesh3DCount()).

Containers::Optional<MeshData3D> Magnum::Trade::AbstractImporter::mesh3D(UnsignedInt id)

Three-dimensional mesh.

Parameters
id Mesh ID, from range [0, mesh3DCount()).

Returns given mesh or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::materialForName(const std::string& name)

Material ID for given name.

If no material for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::materialName(UnsignedInt id)

Material name.

Parameters
id Material ID, from range [0, materialCount()).

std::unique_ptr<AbstractMaterialData> Magnum::Trade::AbstractImporter::material(UnsignedInt id)

Material.

Parameters
id Material ID, from range [0, materialCount()).

Returns given material or nullptr if importing failed.

Int Magnum::Trade::AbstractImporter::textureForName(const std::string& name)

Texture ID for given name.

If no texture for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::textureName(UnsignedInt id)

Texture name.

Parameters
id Texture ID, from range [0, textureCount()).

Containers::Optional<TextureData> Magnum::Trade::AbstractImporter::texture(UnsignedInt id)

Texture.

Parameters
id Texture ID, from range [0, textureCount()).

Returns given texture or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::image1DForName(const std::string& name)

One-dimensional image ID for given name.

If no image for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::image1DName(UnsignedInt id)

One-dimensional image name.

Parameters
id Image ID, from range [0, image1DCount()).

Containers::Optional<ImageData1D> Magnum::Trade::AbstractImporter::image1D(UnsignedInt id)

One-dimensional image.

Parameters
id Image ID, from range [0, image1DCount()).

Returns given image or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::image2DForName(const std::string& name)

Two-dimensional image ID for given name.

If no image for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::image2DName(UnsignedInt id)

Two-dimensional image name.

Parameters
id Image ID, from range [0, image2DCount()).

Containers::Optional<ImageData2D> Magnum::Trade::AbstractImporter::image2D(UnsignedInt id)

Two-dimensional image.

Parameters
id Image ID, from range [0, image2DCount()).

Returns given image or Containers::NullOpt if importing failed.

Int Magnum::Trade::AbstractImporter::image3DForName(const std::string& name)

Three-dimensional image ID for given name.

If no image for given name exists, returns -1.

std::string Magnum::Trade::AbstractImporter::image3DName(UnsignedInt id)

Three-dimensional image name.

Parameters
id Image ID, from range [0, image3DCount()).

Containers::Optional<ImageData3D> Magnum::Trade::AbstractImporter::image3D(UnsignedInt id)

Three-dimensional image.

Parameters
id Image ID, from range [0, image3DCount()).

Returns given image or Containers::NullOpt if importing failed.

Debug& operator<<(Debug& debug, AbstractImporter::Feature value)

Debug output operator.

Debug& operator<<(Debug& debug, AbstractImporter::Features value)

Debug output operator.