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 >:
[legend]
Collaboration diagram for oe::scene::loader::GltfWithExtensions< ExtensionManager >:
[legend]

Public Member Functions

 GltfWithExtensions (const ExtensionManager &extensions)
 Init the glTF loader with a custom list of extensions.
 
void load (const std::string &filename, const bool is_binary)
 Load a glTF asset from a file.
 
- Public Member Functions inherited from oe::scene::loader::Gltf
 Gltf (const std::string &filename, const bool is_binary)
 Load a glTF asset from a file.
 
oe::scene::NodeaddIntoSceneManager (oe::scene::Manager &scene_manager, uint16_t id_scene=0)
 Load the glTF asset into a scene (under a new root node)
 
oe::scene::NodeaddIntoSceneManager (oe::scene::Manager &scene_manager, oe::scene::Node &root_node, uint16_t id_scene=0)
 Load the glTF asset into a scene (using a specified node as root node)
 
void convertTextures (render::TextureManager &)
 Load model textures.
 
void setMaterialFiller (std::function< void(const PbrMaterial &gltf_material, Material &oe_material)>)
 Apply application specific properties on the materials.
 
void setNodeMaterialModifier (std::function< void(Node &node, Material &node_material)>)
 Apply application specific properties on the material that will be applied to a node.
 
std::vector< MaterialgetMaterials ()
 Convert and return materials.
 

Additional Inherited Members

- Protected Member Functions inherited from oe::scene::loader::Gltf
void _custom_load (const std::string &filename, const bool is_binary)
 
- Protected Attributes inherited from oe::scene::loader::Gltf
std::vector< std::shared_ptr< oe::scene::Node > > _scenes
 
std::unordered_map< uint32_t, std::list< std::pair< std::shared_ptr< oe::scene::Mesh >, int32_t > > > _meshes
 std::list<std::pair<oe::scene::Mesh, int32_t>> _primitives;
 
std::unordered_map< uint32_t, std::list< std::pair< std::shared_ptr< oe::scene::SkinnedMesh >, int32_t > > > _skinned_meshes
 
std::unordered_map< oe::scene::SkinnedMeshNode *, uint32_t > _skinned_nodes_skins
 
std::vector< std::shared_ptr< oe::render::Texture > > _textures
 
std::function< void(const PbrMaterial &, Material &)> _material_filler = {}
 
std::function< void(Node &node, Material &node_material)> _node_material_modifier = {}
 
oe::scene::Material _default_material
 
std::unique_ptr< tinygltf::TinyGLTF > _loader
 
std::unique_ptr< tinygltf::Model > _model
 
std::function< void(const std::string &extension, Node &root_node, const nlohmann::json &extension_data, const bool pre_load)> _custom_asset_extension_handler = {}
 
std::function< void(const std::string &extension, Node &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, is_binary);
glTF custom extension manager
Definition gltf_extensions.h:114
Base class to handle glTF extensions.
Definition gltf_extensions.h:17
Load a glTF asset with custom extensions registered.
Definition gltf.h:211

Constructor & Destructor Documentation

◆ GltfWithExtensions()

template<typename ExtensionManager = gltf::ExtensionManager<gltf::Extension>>
oe::scene::loader::GltfWithExtensions< ExtensionManager >::GltfWithExtensions ( const ExtensionManager &  extensions)
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,
const bool  is_binary 
)
inline

Load a glTF asset from a file.

Parameters
filenamepath to the glTF asset
is_binarydoes the file should be loaded as a binary file ot text file (ie. true for a .glb, false for a .gltf)

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