class new in 2020.06StlImporter
STL importer plugin.
Imports normal and vertex information from binary Stereolitography STL (
This plugin depends on the Trade library and is built if
MAGNUM_WITH_STLIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load
"StlImporter" via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following:
set(MAGNUM_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
find_package(MagnumPlugins REQUIRED StlImporter) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::StlImporter)
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::
perFaceToPerVertex configuration option it's possible to import per-face normals separately without duplicating them for each vertex — useful for example when you want to deduplicate the positions and generate smooth normals from these.
It's possible to tune various import options through configuration(). See below for all options and their default values:
[configuration] # Turn per-face normals into per-vertex. If enabled, normals from the file # are duplicated to each vertex, expanding the data size roughly by 50%, # possibly complicating duplicate vertex removal or smooth normal generation. # If disabled, the mesh is imported just with positions and per-face normals # are available in a separate mesh level. perFaceToPerVertex=true
See Editing plugin-specific configuration for more information and an example showing how to edit the configuration values.
- class AbstractImporter
- Base for importer plugins.