Magnum::Trade::ColladaImporter class

Collada importer plugin.

Imports the XML-based COLLADA format. Supports triangle and quad meshes, images (delegated to AnyImageImporter), Phong material data, texture properties and scene hierarchy.

This plugin depends on the Trade, MeshTools and Qt 4 libraries and the AnyImageImporter plugin. It is built if WITH_COLLADAIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, you need to load the "ColladaImporter" plugin from MAGNUM_PLUGINS_IMPORTER_DIR. To use as a static plugin or as a dependency of another plugin with CMake, you need to request the ColladaImporter component of the MagnumPlugins package in CMake and link to the MagnumPlugins::ColladaImporter target. See Downloading and building plugins, Plugin usage with CMake and Loading and using plugins for more information.

Behavior and limitations

Mesh import

  • Only quad and triangle meshes are supported
  • More than one polygon list in a single mesh is not supported
  • Only vertex positions, normals and 2D texture coordinates are supported

Material import

  • Only the COMMON effect profile is supported

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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

Private functions

auto doFeatures() const override -> Features virtual
Implementation for features()
auto doIsOpened() const override -> bool virtual
Implementation for isOpened()
void doOpenFile(const std::string& filename) override virtual
Implementation for openFile()
void doClose() override virtual
Implementation for close()
auto doDefaultScene() override -> Int virtual
Implementation for defaultScene()
auto doSceneCount() const override -> UnsignedInt virtual
Implementation for sceneCount()
auto doSceneForName(const std::string& name) override -> Int virtual
Implementation for sceneForName()
auto doSceneName(UnsignedInt id) override -> std::string virtual
Implementation for sceneName()
auto doScene(UnsignedInt id) override -> Containers::Optional<SceneData> virtual
Implementation for scene()
auto doObject3DCount() const override -> UnsignedInt virtual
Implementation for object3DCount()
auto doObject3DForName(const std::string& name) override -> Int virtual
Implementation for object3DForName()
auto doObject3DName(UnsignedInt id) override -> std::string virtual
Implementation for object3DName()
auto doObject3D(UnsignedInt id) override -> std::unique_ptr<ObjectData3D> virtual
Implementation for object3D()
auto doMesh3DCount() const override -> UnsignedInt virtual
Implementation for mesh3DCount()
auto doMesh3DForName(const std::string& name) override -> Int virtual
Implementation for mesh3DForName()
auto doMesh3DName(UnsignedInt id) override -> std::string virtual
Implementation for mesh3DName()
auto doMesh3D(UnsignedInt id) override -> Containers::Optional<MeshData3D> virtual
Implementation for mesh3D()
auto doMaterialCount() const override -> UnsignedInt virtual
Implementation for materialCount()
auto doMaterialForName(const std::string& name) override -> Int virtual
Implementation for materialForName()
auto doMaterialName(UnsignedInt id) override -> std::string virtual
Implementation for materialName()
auto doMaterial(UnsignedInt id) override -> std::unique_ptr<AbstractMaterialData> virtual
Implementation for material()
auto doTextureCount() const override -> UnsignedInt virtual
Implementation for textureCount()
auto doTextureForName(const std::string& name) override -> Int virtual
Implementation for textureForName()
auto doTextureName(UnsignedInt id) override -> std::string virtual
Implementation for textureName()
auto doTexture(UnsignedInt id) override -> Containers::Optional<TextureData> virtual
Implementation for texture()
auto doImage2DCount() const override -> UnsignedInt virtual
Implementation for image2DCount()
auto doImage2DForName(const std::string& name) override -> Int virtual
Implementation for image2DForName()
auto doImage2DName(UnsignedInt id) override -> std::string virtual
Implementation for image2DName()
auto doImage2D(UnsignedInt id) override -> Containers::Optional<ImageData2D> virtual
Implementation for image2D()

Function documentation

Magnum::Trade::ColladaImporter::ColladaImporter() explicit

Default constructor.

In case you want to open images, use ColladaImporter(PluginManager::Manager<AbstractImporter>&) instead.

Magnum::Trade::ColladaImporter::ColladaImporter(PluginManager::Manager<AbstractImporter>& manager) explicit

Constructor.

The plugin needs access to plugin manager for importing images.

void Magnum::Trade::ColladaImporter::doOpenFile(const std::string& filename) override virtual private

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().

Int Magnum::Trade::ColladaImporter::doDefaultScene() override virtual private

Implementation for defaultScene()

Default implementation returns -1.

UnsignedInt Magnum::Trade::ColladaImporter::doSceneCount() const override virtual private

Implementation for sceneCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doSceneForName(const std::string& name) override virtual private

Implementation for sceneForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doSceneName(UnsignedInt id) override virtual private

Implementation for sceneName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::ColladaImporter::doObject3DCount() const override virtual private

Implementation for object3DCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doObject3DForName(const std::string& name) override virtual private

Implementation for object3DForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doObject3DName(UnsignedInt id) override virtual private

Implementation for object3DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::ColladaImporter::doMesh3DCount() const override virtual private

Implementation for mesh3DCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doMesh3DForName(const std::string& name) override virtual private

Implementation for mesh3DForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doMesh3DName(UnsignedInt id) override virtual private

Implementation for mesh3DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::ColladaImporter::doMaterialCount() const override virtual private

Implementation for materialCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doMaterialForName(const std::string& name) override virtual private

Implementation for materialForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doMaterialName(UnsignedInt id) override virtual private

Implementation for materialName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::ColladaImporter::doTextureCount() const override virtual private

Implementation for textureCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doTextureForName(const std::string& name) override virtual private

Implementation for textureForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doTextureName(UnsignedInt id) override virtual private

Implementation for textureName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::ColladaImporter::doImage2DCount() const override virtual private

Implementation for image2DCount()

Default implementation returns 0.

Int Magnum::Trade::ColladaImporter::doImage2DForName(const std::string& name) override virtual private

Implementation for image2DForName()

Default implementation returns -1.

std::string Magnum::Trade::ColladaImporter::doImage2DName(UnsignedInt id) override virtual private

Implementation for image2DName()

Default implementation returns empty string.