Magnum::Trade::OpenGexImporter class

OpenGEX importer.

Imports the OpenDDL-based OpenGEX format.

Supports importing of scene, object, camera, mesh, texture and image data.

This plugin depends on the Trade library and the AnyImageImporter plugin. It is built if WITH_OPENGEXIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, you need to load the "OpenGexImporter" 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 OpenGexImporter component of the MagnumPlugins package and link to the MagnumPlugins::OpenGexImporter target. See Downloading and building plugins, Plugin usage with CMake and Loading and using plugins for more information.

Behavior and limitations

  • half data type results in parsing error.
  • On OpenGL ES, usage of double type and on WebGL additionally also usage of 64bit integer types results in parsing error.

Scene hierarchy import

  • Object-only transformations are not supported.
  • Additional material references after the first one for given geometry node are ignored.
  • Geometry node visibility, shadow and motion blur properties are ignored.

Light import

  • Light attenuation properties are not yet supported.
  • Light textures are not yet supported.

Mesh import

  • 64bit indices are not supported.
  • Quads are not supported.
  • Additional mesh LoDs after the first one are ignored.
  • w coordinate for vertex positions and normals is ignored if present.

Material import

  • Two-sided property is ignored.
  • All materials are imported as Trade::PhongMaterialData with ambient color always set to {0.0f, 0.0f, 0.0f}.
  • Alpha channel of colors is ignored.
  • emission, opacity and transparency attributes are not supported.
  • normal textures are not supported.

Texture import

Access to internal importer state

Generic importer for OpenDDL files is implemented in the OpenDdl::Document class available as part of this plugin and access to it is provided through importer-specific data accessors:

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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

Public functions

auto importerState() const -> const OpenDdl::Document*
Importer state.

Private functions

auto doFeatures() const override -> Features virtual
Implementation for features()
auto doIsOpened() const override -> bool virtual
Implementation for isOpened()
void doOpenData(Containers::ArrayView<const char> data) override virtual
Implementation for openData()
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 doScene(UnsignedInt id) override -> Containers::Optional<SceneData> virtual
Implementation for scene()
auto doCameraCount() const override -> UnsignedInt virtual
Implementation for cameraCount()
auto doCamera(UnsignedInt id) override -> Containers::Optional<CameraData> virtual
Implementation for camera()
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 doLightCount() const override -> UnsignedInt virtual
Implementation for lightCount()
auto doLight(UnsignedInt id) override -> Containers::Optional<LightData> virtual
Implementation for light()
auto doMesh3DCount() const override -> UnsignedInt virtual
Implementation for mesh3DCount()
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 doTexture(UnsignedInt id) override -> Containers::Optional<TextureData> virtual
Implementation for texture()
auto doImage2DCount() const override -> UnsignedInt virtual
Implementation for image2DCount()
auto doImage2D(UnsignedInt id) override -> Containers::Optional<ImageData2D> virtual
Implementation for image2D()
auto doImporterState() const override -> const void* virtual
Implementation for importerState()

Function documentation

Magnum::Trade::OpenGexImporter::OpenGexImporter() explicit

Default constructor.

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

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

Constructor.

The plugin needs access to plugin manager for importing images.

const OpenDdl::Document* Magnum::Trade::OpenGexImporter::importerState() const

Importer state.

Provides access to the parsed OpenDDL document. See class documentation for more information.

void Magnum::Trade::OpenGexImporter::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.

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

Implementation for defaultScene()

Default implementation returns -1.

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

Implementation for sceneCount()

Default implementation returns 0.

UnsignedInt Magnum::Trade::OpenGexImporter::doCameraCount() const override virtual private

Implementation for cameraCount()

Default implementation returns 0.

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

Implementation for object3DCount()

Default implementation returns 0.

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

Implementation for object3DForName()

Default implementation returns -1.

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

Implementation for object3DName()

Default implementation returns empty string.

UnsignedInt Magnum::Trade::OpenGexImporter::doLightCount() const override virtual private

Implementation for lightCount()

Default implementation returns 0.

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

Implementation for mesh3DCount()

Default implementation returns 0.

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

Implementation for materialCount()

Default implementation returns 0.

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

Implementation for materialForName()

Default implementation returns -1.

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

Implementation for materialName()

Default implementation returns empty string.

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

Implementation for textureCount()

Default implementation returns 0.

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

Implementation for image2DCount()

Default implementation returns 0.