Magnum::Trade::OpenGexImporter class

OpenGEX importer.

Imports the OpenDDL-based OpenGEX format.

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

Usage

This plugin depends on the Trade and OpenDdl libraries and the AnyImageImporter plugin. It is built if WITH_OPENGEXIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load "OpenGexImporter" via Corrade::PluginManager::Manager.

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

set(WITH_ANYIMAGEIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

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

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

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

find_package(MagnumPlugins REQUIRED OpenGexImporter)

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

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

Behavior and limitations

The plugin supports ImporterFeature::OpenData and ImporterFeature::FileCallback features. The importer fully loads the top-level file during initial import, meaning there is at most one InputFileCallbackPolicy::LoadTemporary callback followed by InputFileCallbackPolicy::Close and the data can freed right after the openData() / openFile() function exits. In case of images, the files are loaded on-demand inside image2D() calls with InputFileCallbackPolicy::LoadTemporary and InputFileCallbackPolicy::Close is emitted right after the file is fully read.

  • Import of animation data is not supported at the moment.
  • 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.

Camera import

  • Camera type is always CameraType::Perspective3D
  • Default FoV for cameras that don't have it specified is 35.0_degf
  • Default near and far plane for cameras that don't have it specified is 0.01f and 100.0f
  • Aspect ratio is ignored and hardcoded to 1.0f

Light import

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

Mesh import

The imported mesh always has at least one vertex attribute, but positions are not required to be present. Indices are optional as well.

Material import

  • Alpha mode is always MaterialAlphaMode::Opaque and alpha mask always 0.5f
  • Two-sided property is ignored, always set to false
  • All materials are imported as Trade::PhongMaterialData with ambient color always set to 0x000000ff_rgbaf.
  • 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.

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.