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 MAGNUM_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(MAGNUM_WITH_ANYIMAGEIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

set(MAGNUM_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, Loading and using plugins and File format support 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.

While the importer doesn't recognize any ImporterFlag itself, all ImporterFlags are propagated to image importer plugins the importer delegates to.

Scene import

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

  • Texture coordinate transformation is ignored.
  • Textures using other than the first coordinate set are not supported.
  • Texture type is always Trade::TextureType::Texture2D, wrapping is always SamplerWrapping::ClampToEdge, minification and magnification is SamplerFilter::Linear and mipmap selection is SamplerMipmap::Linear.
  • If multiple textures have the same image filename string, given image is present in the image list only once. Note that only a simple string comparison is used without any path normalization.

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() deprecated in Git master explicit
Default constructor.
OpenGexImporter(PluginManager::Manager<AbstractImporter>& manager) deprecated in Git master explicit
Constructor.
OpenGexImporter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.

Public functions

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

Function documentation

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

Default constructor.

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

Constructor.

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

Importer state.

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