Magnum::Trade namespace

Data format exchange.

Contains plugin interfaces for importing data of various formats and classes for direct access to the data.

This library is built if WITH_TRADE is enabled when building Magnum. To use this library with CMake, you need to request the Trade component of the Magnum package and link to the Magnum::Trade target:

find_package(Magnum REQUIRED Trade)

# ...
target_link_libraries(your-app Magnum::Trade)

Additional plugins and utilities are built separately. See particular Trade::*Importer and *ImageConverter class documentation, the magnum-imageconverter utility documentation, Downloading and building, Downloading and building plugins, Usage with CMake, Plugin usage with CMake and Loading and using plugins for more information.

Namespaces

namespace OpenGex
OpenGEX structure and property names.

Classes

class AbstractImageConverter
Base for image converter plugins.
class AbstractImporter
Base for importer plugins.
class AbstractMaterialData
Base for material data.
class AnimationData
Animation clip data.
class AnimationTrackData
Animation track data.
class AnyImageConverter
Any image converter plugin.
class AnyImageImporter
Any image importer plugin.
class AnySceneImporter
Any scene importer plugin.
class AssimpImporter
Assimp importer.
class CameraData
Camera data.
class ColladaImporter deprecated
Collada importer plugin.
class DdsImporter
DDS image importer plugin.
class DevIlImageImporter
DevIL Image importer plugin.
template<UnsignedInt dimensions>
class ImageData
Image data.
class JpegImageConverter
JPEG image converter plugin.
class JpegImporter
JPEG importer plugin.
class LightData
Light data.
class MeshData2D
Two-dimensional mesh data.
class MeshData3D
Three-dimensional mesh data.
class MeshObjectData2D
Two-dimensional mesh object data.
class MeshObjectData3D
Three-dimensional mesh object data.
class MiniExrImageConverter
OpenEXR image converter plugin using miniexr.
class ObjectData2D
Two-dimensional object data.
class ObjectData3D
Three-dimensional object data.
class ObjImporter
OBJ importer plugin.
class OpenGexImporter
OpenGEX importer.
class PhongMaterialData
Phong material data.
class PngImageConverter
PNG image converter plugin.
class PngImporter
PNG importer plugin.
class SceneData
Scene data.
class StanfordImporter
Stanford PLY importer plugin.
class StbImageConverter
Image converter plugin using stb_image_write.
class StbImageImporter
Image importer plugin using stb_image.
class TextureData
Texture data.
class TgaImageConverter
TGA image converter plugin.
class TgaImporter
TGA importer plugin.
class TinyGltfImporter
TinyGltf importer plugin.

Enums

enum class ImporterFileCallbackPolicy: UnsignedByte { LoadTemporary, LoadPernament, Close }
Importer file loading callback policy.
enum class MaterialType: UnsignedByte { Phong }
Material type.
enum class MaterialAlphaMode: UnsignedByte { Opaque, Mask, Blend }
Material alpha mode.
enum class AnimationTrackType: UnsignedByte { Bool, Float, UnsignedInt, Int, BoolVector2, BoolVector3, BoolVector4, Vector2, Vector2ui, Vector2i, Vector3, Vector3ui, Vector3i, Vector4, Vector4ui, Vector4i, Complex, Quaternion, DualQuaternion, CubicHermite1D, CubicHermite2D, CubicHermite3D, CubicHermiteComplex, CubicHermiteQuaternion }
Type of animation track data.
enum class AnimationTrackTargetType: UnsignedByte { Translation2D, Translation3D, Rotation2D, Rotation3D, Scaling2D, Scaling3D, Custom = 128 }
Target of an animation track.
enum class CameraType: UnsignedByte { Orthographic2D, Orthographic3D, Perspective3D }
Camera type.
enum class ObjectInstanceType2D: UnsignedByte { Camera, Mesh, Empty }
Type of instance held by given 2D object.
enum class ObjectFlag2D: UnsignedByte { HasTranslationRotationScaling = 1 << 0 }
2D object flag
enum class ObjectInstanceType3D: UnsignedByte { Camera, Light, Mesh, Empty }
Type of instance held by given 3D object.
enum class ObjectFlag3D: UnsignedByte { HasTranslationRotationScaling = 1 << 0 }
3D object flag

Typedefs

using ImageData1D = ImageData<1>
One-dimensional image.
using ImageData2D = ImageData<2>
Two-dimensional image.
using ImageData3D = ImageData<3>
Three-dimensional image.
using ObjectFlags2D = Containers::EnumSet<ObjectFlag2D>
2D object flags
using ObjectFlags3D = Containers::EnumSet<ObjectFlag3D>
3D object flags

Functions

auto operator<<(Debug& debug, AbstractImageConverter::Feature value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, AbstractImageConverter::Features value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, AbstractImporter::Feature value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ImporterFileCallbackPolicy value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, MaterialType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, AbstractMaterialData::Flag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, AbstractMaterialData::Flags value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, MaterialAlphaMode value) -> Debug&
Debug output operator.
template<class V, class R>
auto animationInterpolatorFor(Animation::Interpolation interpolation) -> auto
Animation interpolator function for given interpolation behavior.
auto operator<<(Debug& debug, AnimationTrackType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, AnimationTrackTargetType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, CameraType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, LightData::Type value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectInstanceType2D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectFlag2D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectFlags2D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectInstanceType3D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectFlag3D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ObjectFlags3D value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, PhongMaterialData::Flag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, TextureData::Type value) -> Debug&
Debug output operator.

Enum documentation

enum class Magnum::Trade::ImporterFileCallbackPolicy: UnsignedByte

Importer file loading callback policy.

Enumerators
LoadTemporary

The requested file is used only during a call of given function and the memory view is not referenced anymore once the function exits.

This can be the case for example when importing image data using AbstractImporter::image2D() — imported data are copied into the returned ImageData2D object and the original file is not needed anymore. Note, however, that this might not be the case for all importers — see documentation of a particular plugin for concrete info.

LoadPernament

The requested file may be used for loading most or all data in the next steps, so the importer expects the memory view to be valid for as long as data import functions are called on it, but at most until the importer is destroyed, AbstractImporter::close() is called or another file is opened.

This can be the case for example when importing mesh data using AbstractImporter::mesh3D() — all vertex data might be combined in a single binary file and each mesh occupies only a portion of it. Note, however, that this might not be the case for all importers — see documentation of a particular plugin for concrete info.

Close

A file that has been previously loaded by this callback can be closed now (and its memory freed). This is just a hint, it's not required for the callback to close it. This policy is also only ever called with a file that was previously opened with the same callback, so it's possible to completely ignore it and just return the cached value.

This can be the case for example when an importer is done parsing a text file into an internal representation and the original data are no longer needed (and, for example, other files need to be loaded and they could repurpose the unused memory).

enum class Magnum::Trade::MaterialType: UnsignedByte

Material type.

Enumerators
Phong

Phong shading (see PhongMaterialData)

enum class Magnum::Trade::MaterialAlphaMode: UnsignedByte

Material alpha mode.

Enumerators
Opaque

Alpha value is ignored and the rendered output is fully opaque.

Mask

The rendered output is either fully transparent or fully opaque, depending on the alpha value and specified AbstractMaterialData::alphaMask() value.

Blend

The alpha value is used to combine source and destination colors using additive blending.

enum class Magnum::Trade::AnimationTrackType: UnsignedByte

Type of animation track data.

Enumerators
Bool

bool

Float

Float

UnsignedInt

UnsignedInt

Int

Int

BoolVector2

Math::BoolVector<2>

BoolVector3

Math::BoolVector<3>

BoolVector4

Math::BoolVector<4>

Vector2

Vector2. Usually used for AnimationTrackTargetType::Translation2D and AnimationTrackTargetType::Scaling2D.

Vector2ui

Vector2ui

Vector2i

Vector2i

Vector3

Vector3. Usually used for AnimationTrackTarget::Translation3D and AnimationTrackTarget::Scaling3D.

Vector3ui

Vector3ui

Vector3i

Vector3i

Vector4

Vector4

Vector4ui

Vector4ui

Vector4i

Vector4i

Complex

Complex. Usually used for AnimationTrackTargetType::Rotation2D.

Quaternion

Quaternion. Usually used for AnimationTrackTargetType::Rotation3D.

DualQuaternion

DualQuaternion

CubicHermite1D

CubicHermite1D

CubicHermite2D

CubicHermite2D. Usually used for spline-interpolated AnimationTrackTargetType::Translation2D and AnimationTrackTargetType::Scaling2D.

CubicHermite3D

CubicHermite3D. Usually used for spline-interpolated AnimationTrackTargetType::Translation3D and AnimationTrackTargetType::Scaling3D.

CubicHermiteComplex

CubicHermiteComplex. Usually used for spline-interpolated AnimationTrackTargetType::Rotation2D.

CubicHermiteQuaternion

CubicHermiteQuaternion. Usually used for spline-interpolated AnimationTrackTargetType::Rotation3D.

enum class Magnum::Trade::AnimationTrackTargetType: UnsignedByte

Target of an animation track.

Enumerators
Translation2D

Modifies 2D object translation. Type is usually Vector2 or CubicHermite2D for spline-interpolated data.

Translation3D

Modifies 3D object translation. Type is usually Vector3 or CubicHermite3D for spline-interpolated data.

Rotation2D

Modifies 2D object rotation. Type is usually Complex or CubicHermiteComplex for spline-interpolated data.

Rotation3D

Modifies 3D object rotation. Type is usually Quaternion or CubicHermiteQuaternion for spline-interpolated data.

Scaling2D

Modifies 2D object scaling. Type is usually Vector2 or CubicHermite2D for spline-interpolated data.

Scaling3D

Modifies 3D object scaling. Type is usually Vector3 or CubicHermite3D for spline-interpolated data.

Custom

This and all higher values are for importer-specific targets. Can be of any type, AnimationData::trackTarget() might or might not point to an existing object. See documentation of particular importer for details.

enum class Magnum::Trade::CameraType: UnsignedByte

Camera type.

Enumerators
Orthographic2D

2D orthographic camera

Orthographic3D

3D orthographic camera

Perspective3D

3D perspective camera

enum class Magnum::Trade::ObjectInstanceType2D: UnsignedByte

Type of instance held by given 2D object.

Enumerators
Camera

Camera instance (see CameraData)

Mesh

Mesh instance. The data can be cast to MeshObjectData2D to provide more information.

Empty

Empty

enum class Magnum::Trade::ObjectFlag2D: UnsignedByte

2D object flag

Enumerators
HasTranslationRotationScaling

The object provides separate translation / rotation / scaling properties. The ObjectData2D::transformation() matrix returns them combined, but it's possible to access particular parts of the transformation using ObjectData2D::translation(), ObjectData2D::rotation() and ObjectData2D::scaling().

enum class Magnum::Trade::ObjectInstanceType3D: UnsignedByte

Type of instance held by given 3D object.

Enumerators
Camera

Camera instance (see CameraData)

Light

Light instance (see LightData)

Mesh

Mesh instance. The data can be cast to MeshObjectData3D to provide more information.

Empty

Empty

enum class Magnum::Trade::ObjectFlag3D: UnsignedByte

3D object flag

Enumerators
HasTranslationRotationScaling

The object provides separate translation / rotation / scaling properties. The ObjectData3D::transformation() matrix returns them combined, but it's possible to access particular parts of the transformation using ObjectData3D::translation(), ObjectData3D::rotation() and ObjectData3D::scaling().

Typedef documentation

typedef Containers::EnumSet<ObjectFlag2D> Magnum::Trade::ObjectFlags2D

2D object flags

typedef Containers::EnumSet<ObjectFlag3D> Magnum::Trade::ObjectFlags3D

3D object flags

Function documentation

Debug& Magnum::Trade::operator<<(Debug& debug, AbstractImageConverter::Feature value)

Debug output operator.

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

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ImporterFileCallbackPolicy value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, MaterialType value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, AbstractMaterialData::Flag value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, AbstractMaterialData::Flags value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, MaterialAlphaMode value)

Debug output operator.

template<class V, class R>
auto Magnum::Trade::animationInterpolatorFor(Animation::Interpolation interpolation)

Animation interpolator function for given interpolation behavior.

To be used from importer plugins — wrapper around Animation::interpolatorFor(), guaranteeing that the returned function pointer is not instantiated inside the plugin binary to avoid dangling function pointers on plugin unload.

Debug& Magnum::Trade::operator<<(Debug& debug, AnimationTrackType value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, AnimationTrackTargetType value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, CameraType value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, LightData::Type value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectInstanceType2D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectFlag2D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectFlags2D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectInstanceType3D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectFlag3D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, ObjectFlags3D value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, PhongMaterialData::Flag value)

Debug output operator.

Debug& Magnum::Trade::operator<<(Debug& debug, TextureData::Type value)

Debug output operator.