Magnum::Trade::StlImporter class new in 2020.06

STL importer plugin.

Imports normal and vertex information from binary Stereolitography STL files.

Usage

This plugin depends on the Trade library and is built if WITH_STLIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load "StlImporter" 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_STLIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL)

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

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

find_package(MagnumPlugins REQUIRED StlImporter)

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

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

Behavior and limitations

The file is always imported as a non-indexed triangle mesh with per-face normals (i.e., same normal for all vertices in the triangle). Both positions and normals are imported as VertexFormat::Vector3.

Similarly to StanfordImporter, ASCII files are not supported, only binary. The non-standard extensions for vertex colors are also not supported due to a lack of generally available files for testing.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

StlImporter() explicit
Default constructor.
StlImporter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.