Oxygen Engine
Modern C++ 3D Engine using OpenGL
|
Loader to load Khronos glTF assets. More...
#include <OxygenEngine/scene/loader/gltf.h>
Public Member Functions | |
Gltf (const std::string &filename, const bool is_binary) | |
Load a glTF asset from a file. | |
oe::scene::Node & | addIntoSceneManager (oe::scene::Manager &scene_manager, uint16_t id_scene=0) |
Load the glTF asset into a scene (under a new root node) | |
oe::scene::Node & | addIntoSceneManager (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< Material > | getMaterials () |
Convert and return materials. | |
Protected Member Functions | |
void | _custom_load (const std::string &filename, const bool is_binary) |
Protected Attributes | |
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 = {} |
Loader to load Khronos glTF assets.
Example
The loader will automatically handle the following glTF extensions:
oe::scene::loader::Gltf::Gltf | ( | const std::string & | filename, |
const bool | is_binary | ||
) |
Load a glTF asset from a file.
filename | path to the glTF asset |
is_binary | does the file should be loaded as a binary file ot text file (ie. true for a .glb , false for a .gltf ) |
oe::scene::Node & oe::scene::loader::Gltf::addIntoSceneManager | ( | 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)
scene_manager | The scene manager |
root_node | Asset's root nodes will be imported as children of this node |
id_scene | glTF scene to load |
oe::scene::Node & oe::scene::loader::Gltf::addIntoSceneManager | ( | oe::scene::Manager & | scene_manager, |
uint16_t | id_scene = 0 |
||
) |
Load the glTF asset into a scene (under a new root node)
scene_manager | The scene manager |
id_scene | glTF scene to load |
std::vector< Material > oe::scene::loader::Gltf::getMaterials | ( | ) |
Convert and return materials.