Class Importer

Synopsis

#include <Source/Falcor/Scene/Importer.h>

class dlldecl Importer

Description

This class is a global registry for asset importers. Importers are bound to a set of file extensions. This allows the right importer to be called when importing an asset file.

Structures

DescDescription of an importer.

Methods

getFileExtensionFiltersReturns a list of file extensions filters for all supported file formats.
importImport an asset.
registerImporterRegisters an importer.

Source

Lines 37-69 in Source/Falcor/Scene/Importer.h.

class dlldecl Importer
{
public:
    using ExtensionList = std::vector<std::string>;
    using ImportFunction = std::function<bool(const std::string& filename, SceneBuilder& builder, const SceneBuilder::InstanceMatrices& instances, const Dictionary& dict)>;
    /** Description of an importer.
    */
    struct Desc
    {
        std::string name;
        ExtensionList extensions;
        ImportFunction import;
    };
    /** Returns a list of file extensions filters for all supported file formats.
    */
    static const FileDialogFilterVec& getFileExtensionFilters();
    /** Import an asset.
        \param[in] filename Filename.
        \param[in] builder Scene builder.
        \param[in] instances Optional list of instance transforms.
        \param[in] dict Optional dictionary.
        \return True if asset was successfully imported, false otherwise.
    */
    static bool import(const std::string& filename, SceneBuilder& builder, const SceneBuilder::InstanceMatrices& instances, const Dictionary& dict);
    /** Registers an importer.
        \param[in] desc Importer description.
    */
    static void registerImporter(const Desc& desc);
};





Add Discussion as Guest

Log in