class new in 2020.06
StanfordSceneConverterStanford PLY converter plugin.
Exports meshes to either Little- or Big-Endian binary *.ply
files with triangle faces. You can use StanfordImporter to import files in this format.
Usage
This plugin depends on the Trade library and is built if MAGNUM_WITH_STANFORDSCENECONVERTER
is enabled when building Magnum Plugins. To use as a dynamic plugin, load "StanfordSceneConverter"
via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following:
set(MAGNUM_WITH_STANFORDSCENECONVERTER ON CACHE BOOL "" FORCE) add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app MagnumPlugins::StanfordSceneConverter)
To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/
directory, request the StanfordSceneConverter
component of the MagnumPlugins
package and link to the MagnumPlugins::StanfordSceneConverter
target:
find_package(MagnumPlugins REQUIRED StanfordSceneConverter) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::StanfordSceneConverter)
See Downloading and building plugins, Plugin usage with CMake, Loading and using plugins and File format support for more information.
Behavior and limitations
Produces binary files, ASCII export is not implemented. The data are by default exported in machine endian, use the endianness
configuration option to perform an endian swap on the output data.
Exports the following attributes, custom attributes and attributes not listed below are skipped with a warning:
- MeshAttribute::
Position, written as x
/y
/z
. The position attribute has to be always present, 2D positions are not supported. - MeshAttribute::
Normal as nx
/ny
/nz
, if present - MeshAttribute::
TextureCoordinates as u
/v
, if present - MeshAttribute::
Color as red
/green
/blue
, if present, and optionalalpha
, if the input is four-channel - MeshAttribute::
ObjectId by default as object_id
, if present, use theobjectIdAttribute
configuration option to change the identifier that's being written.
Supported component formats — attributes of other formats and implementation-specific formats are skipped with a warning:
- VertexFormat::
Float, written as float
- VertexFormat::
Double as double
- VertexFormat::
UnsignedByte / VertexFormat:: UnsignedByteNormalized as uchar
- VertexFormat::
Byte / VertexFormat:: ByteNormalized as char
- VertexFormat::
UnsignedShort / VertexFormat:: UnsignedShortNormalized as ushort
- VertexFormat::
Short / VertexFormat:: ShortNormalized as short
- VertexFormat::
UnsignedInt as uint
- VertexFormat::
Int as int
Index type of the input mesh is preserved, written as uchar
/ ushort
/ uint
. Face size is always 3
, written as uchar
. if the mesh is not indexed, a trivial index buffer of type MeshIndexType::
The plugin recognizes SceneConverterFlag::
Plugin-specific configuration
It's possible to tune various output options through configuration(). See below for all options and their default values:
[configuration] # Endianness of the output. Valid values are little, big and native (which # will choose either big or little depending on the platform) endianness=native # The non-standard MeshAttribute::ObjectId is by default written under this # name. Change if you want to use a different identifier. objectIdAttribute=object_id
See Editing plugin-specific configuration for more information and an example showing how to edit the configuration values.
Base classes
- class AbstractSceneConverter new in 2020.06
- Base for scene converter plugins.
Constructors, destructors, conversion operators
-
StanfordSceneConverter(PluginManager::
AbstractManager& manager, const Containers:: StringView& plugin) explicit - Plugin manager constructor.