class
TinyGltfImporterTinyGltf importer plugin.
Contents
Imports glTF and binary glTF using the TinyGLTF library.
This plugin depends on the Trade library and is built if WITH_TINYGLTFIMPORTER
is enabled when building Magnum Plugins. To use as a dynamic plugin, you need to load the "TinyGltfImporter"
plugin from MAGNUM_PLUGINS_IMPORTER_DIR
. To use as a static plugin or as a dependency of another plugin with CMake, you need to request the TinyGltfImporter
component of the MagnumPlugins
package and link to the MagnumPlugins::TinyGltfImporter
target. See Downloading and building plugins, Plugin usage with CMake and Loading and using plugins for more information.
This plugin provides GltfImporter
and GlbImporter
plugins.
Behavior and limitations
- Importer requires no specific JSON node in glTF file (like
accessors
) so it can be used to import only lights.
Light import
- Light intensity is not yet supported due to glTF extension draft state.
Mesh import
- Texture coordinate attributes are not yet supported.
- Multi-material meshes are not supported.
Material import
- All materials are imported as Trade::
PhongMaterialData with ambient color always set to {0.0f, 0.0f, 0.0f}
- Alpha channel of colors is ignored.
Texture import
- Texture type is always Trade::
TextureData:: Type:: Texture2D, as glTF doesn't support anything else - Z coordinate of Trade::
TextureData:: wrapping() is always SamplerWrapping:: Repeat
Access to internal importer state
Access to the underlying TinyGLTF structures it is provided through importer-specific data accessors:
- AbstractMaterialData::
importerState() returns tinygltf::Material
structure - CameraData::
importerState() returns tinygltf::Camera
structure - TextureData::
importerState() returns tinygltf::Texture
structure - MeshData3D::
importerState() returns tinygltf::Mesh
structure - ObjectData3D::
importerState() returns tinygltf::Node
structure
Base classes
- class AbstractImporter
- Base for importer plugins.
Constructors, destructors, conversion operators
- TinyGltfImporter() explicit
- Default constructor.
-
TinyGltfImporter(PluginManager::
AbstractManager& manager, const std:: string& plugin) explicit - Plugin manager constructor.
Private functions
- auto doFeatures() const override -> Features virtual
- Implementation for features()
- auto doIsOpened() const override -> bool virtual
- Implementation for isOpened()
-
void doOpenData(Containers::
ArrayView<const char> data) override virtual - Implementation for openData()
-
void doOpenFile(const std::
string& filename) override virtual - Implementation for openFile()
-
auto doCamera(UnsignedInt id) override -> Containers::
Optional<CameraData> virtual - Implementation for camera()
- auto doCameraCount() const override -> UnsignedInt virtual
- Implementation for cameraCount()
-
auto doLight(UnsignedInt id) override -> Containers::
Optional<LightData> virtual - Implementation for light()
- auto doLightCount() const override -> UnsignedInt virtual
- Implementation for lightCount()
- auto doDefaultScene() override -> Int virtual
- Implementation for defaultScene()
-
auto doScene(UnsignedInt id) override -> Containers::
Optional<SceneData> virtual - Implementation for scene()
- auto doSceneCount() const override -> UnsignedInt virtual
- Implementation for sceneCount()
- auto doObject3DCount() const override -> UnsignedInt virtual
- Implementation for object3DCount()
-
auto doObject3DName(UnsignedInt id) override -> std::
string virtual - Implementation for object3DName()
-
auto doObject3DForName(const std::
string& name) override -> Int virtual - Implementation for object3DForName()
-
auto doObject3D(UnsignedInt id) override -> std::
unique_ptr<ObjectData3D> virtual - Implementation for object3D()
- auto doMesh3DCount() const override -> UnsignedInt virtual
- Implementation for mesh3DCount()
-
auto doMesh3D(const UnsignedInt id) override -> Containers::
Optional<MeshData3D> virtual - Implementation for mesh3D()
- auto doMaterialCount() const override -> UnsignedInt virtual
- Implementation for materialCount()
-
auto doMaterialForName(const std::
string& name) override -> Int virtual - Implementation for materialForName()
-
auto doMaterialName(const UnsignedInt id) override -> std::
string virtual - Implementation for materialName()
-
auto doMaterial(const UnsignedInt id) override -> std::
unique_ptr<AbstractMaterialData> virtual - Implementation for material()
- auto doTextureCount() const override -> UnsignedInt virtual
- Implementation for textureCount()
-
auto doTexture(const UnsignedInt id) override -> Containers::
Optional<TextureData> virtual - Implementation for texture()
- auto doImage2DCount() const override -> UnsignedInt virtual
- Implementation for image2DCount()
-
auto doImage2D(const UnsignedInt id) override -> Containers::
Optional<ImageData2D> virtual - Implementation for image2D()
- void doClose() override virtual
- Implementation for close()
Function documentation
void Magnum:: Trade:: TinyGltfImporter:: doOpenFile(const std:: string& filename) override virtual private
Implementation for openFile()
If Feature::
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doCameraCount() const override virtual private
Implementation for cameraCount()
Default implementation returns 0
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doLightCount() const override virtual private
Implementation for lightCount()
Default implementation returns 0
.
Int Magnum:: Trade:: TinyGltfImporter:: doDefaultScene() override virtual private
Implementation for defaultScene()
Default implementation returns -1
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doSceneCount() const override virtual private
Implementation for sceneCount()
Default implementation returns 0
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doObject3DCount() const override virtual private
Implementation for object3DCount()
Default implementation returns 0
.
std:: string Magnum:: Trade:: TinyGltfImporter:: doObject3DName(UnsignedInt id) override virtual private
Implementation for object3DName()
Default implementation returns empty string.
Int Magnum:: Trade:: TinyGltfImporter:: doObject3DForName(const std:: string& name) override virtual private
Implementation for object3DForName()
Default implementation returns -1
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doMesh3DCount() const override virtual private
Implementation for mesh3DCount()
Default implementation returns 0
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doMaterialCount() const override virtual private
Implementation for materialCount()
Default implementation returns 0
.
Int Magnum:: Trade:: TinyGltfImporter:: doMaterialForName(const std:: string& name) override virtual private
Implementation for materialForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: TinyGltfImporter:: doMaterialName(const UnsignedInt id) override virtual private
Implementation for materialName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doTextureCount() const override virtual private
Implementation for textureCount()
Default implementation returns 0
.
UnsignedInt Magnum:: Trade:: TinyGltfImporter:: doImage2DCount() const override virtual private
Implementation for image2DCount()
Default implementation returns 0
.