Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::scene::loader::GltfWithExtensions< ExtensionManager > Class Template Reference

Load a glTF asset with custom extensions registered. More...

#include <OxygenEngine/scene/loader/gltf.h>

+ Inheritance diagram for oe::scene::loader::GltfWithExtensions< ExtensionManager >:
+ Collaboration diagram for oe::scene::loader::GltfWithExtensions< ExtensionManager >:

Public Member Functions

 GltfWithExtensions (const ExtensionManager &extension_manager)
 Init the glTF loader with a custom list of extensions.
 
void load (const std::string &filename)
 Load a glTF asset from a file.
 
- Public Member Functions inherited from oe::scene::loader::Gltf
 Gltf (const std::string &filename)
 Load a glTF asset from a file.
 
GltfSceneData convertSceneData (oe::scene::NodePtr root_node, uint16_t id_scene=0) const
 Convert the glTF asset into scene data under the specified node.
 
GltfTextureList convertTextures (render::TextureManager &texture_manager, std::string_view prefix) const
 Load model textures.
 
void setMaterialFiller (std::function< void(const GltfPbrMaterial &gltf_material, Material &oe_material)> material_filler)
 Apply application specific properties on the materials.
 
std::vector< MaterialconvertMaterials (GltfTextureList textures) const
 Convert and return materials.
 
Material generateDefaultMaterial () const
 Generate a default material suitable for glTF rendering.
 

Public Attributes

ExtensionManager extensions
 

Additional Inherited Members

- Public Types inherited from oe::scene::loader::Gltf
using MeshFlags = uint8_t
 
- Protected Member Functions inherited from oe::scene::loader::Gltf
void _custom_load (const std::string &filename)
 
- Protected Attributes inherited from oe::scene::loader::Gltf
std::function< void(const GltfPbrMaterial &, Material &)> _material_filler = {}
 std::list<std::pair<oe::scene::Mesh, int32_t>> _primitives;
 
tinygltf::TinyGLTF * _loader
 
tinygltf::Model * _model
 
std::function< void(const std::string &extension, NodePtr root_node, const nlohmann::json &extension_data, const bool pre_load)> _custom_asset_extension_handler = {}
 
std::function< void(const std::string &extension, NodePtr node, const nlohmann::json &extension_data)> _custom_node_extension_handler = {}
 
std::function< void(const std::string &extension, Material &material, const nlohmann::json &extension_data)> _custom_material_extension_handler = {}
 

Detailed Description

template<typename ExtensionManager = gltf::ExtensionManager<gltf::Extension>>
class oe::scene::loader::GltfWithExtensions< ExtensionManager >

Load a glTF asset with custom extensions registered.

To use, you should first inherit from gltf::Extension to provide your implementation then generate an gltf::ExtensionManager that bind your extensions to their names

For example:

class ExampleExtension : public oe::scene::gltf::Extension
{
// ...
};
// Then before loading the asset
MyExtensionsManager my_gltf_extensions;
my_gltf_extensions.addExtension<ExampleExtension>("EXAMPLE_extension_name");
MyGltfLoader gltf_loader(my_gltf_extensions);
// Then you can use the loader as the original Gltf loader
gltf_loader.load(filename);
glTF custom extension manager
Definition gltf_extensions.h:116
Base class to handle glTF extensions.
Definition gltf_extensions.h:19
Load a glTF asset with custom extensions registered.
Definition gltf.h:333

Constructor & Destructor Documentation

◆ GltfWithExtensions()

template<typename ExtensionManager = gltf::ExtensionManager<gltf::Extension>>
oe::scene::loader::GltfWithExtensions< ExtensionManager >::GltfWithExtensions ( const ExtensionManager &  extension_manager)
inline

Init the glTF loader with a custom list of extensions.

Parameters
extensionsExtension manager to use

Member Function Documentation

◆ load()

template<typename ExtensionManager = gltf::ExtensionManager<gltf::Extension>>
void oe::scene::loader::GltfWithExtensions< ExtensionManager >::load ( const std::string &  filename)
inline

Load a glTF asset from a file.

Parameters
filenamepath to the glTF asset

The documentation for this class was generated from the following file: