Class engine#

Nested Relationships#

Nested Types#

Class Documentation#

class engine#

Class used to create instance of other classes.

The main class of the libf3d to create all other instances. Configured on creation using an enum, then all objects can be accessed through their getter.

Example usage for adding some files in the scene

f3d::engine eng = f3d::engine::create();
f3d::scene& sce = eng.getscene();
sce.add({"path/to/file", "path/to/another/file"});
f3d::interactor& inter = eng.getInteractor();
inter.start();

Public Functions

~engine()#

Engine destructor, delete all object instances as well.

engine(const engine &other) = delete#

Engine copy is not possible but move is allowed.

engine(engine &&other) noexcept#
engine &operator=(const engine &other) = delete#
engine &operator=(engine &&other) noexcept#
engine &setCachePath(const std::filesystem::path &cachePath)#

Set the cache path. The provided path is used as is. Currently, it’s only used to store HDRI baked textures. By default, the cache path is:

  • Windows: LOCALAPPDATA%\f3d

  • Linux: ~/.cache/f3d

  • macOS: ~/Library/Caches/f3d Throw a cache_exception if the provided cachePath cannot be used.

engine &setOptions(const options &opt)#

Engine provide a default options that you can use using engine::getOptions(). But you can use this setter to use other options directly. It will copy options into engine.

engine &setOptions(options &&opt)#

Engine provide a default options that you can use using engine::getOptions(). But you can use this setter to use other options directly. It will move options into engine.

options &getOptions()#

Get the default options provided by the engine.

window &getWindow()#

Get the window provided by the engine, if any. If not, will throw a engine::no_window_exception.

scene &getScene()#

Get the loaded provided by the engine.

interactor &getInteractor()#

Get the interactor provided by the engine, if any. If not, will throw a engine::no_interactor_exception.

Public Static Functions

static engine create(bool offscreen = false)#

Create an engine with an automatic window. Optionally, the window can be hidden by setting offscreen to true. For VTK < 9.3, the window type will depend on the VTK build options For VTK >= 9.4: Linux: Try GLX, then EGL, then OSMesa Windows: Try Win32, then EGL, then OSMesa macOS: Always use Cocoa Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createNone()#

Create an engine with no window. Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createGLX(bool offscreen = false)#

Create an engine with a GLX window. Works on Linux only. VTK >= 9.4 required. Optionally, the window can be hidden by setting offscreen to true. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createWGL(bool offscreen = false)#

Create an engine with a WGL window. Works on Windows only. VTK >= 9.4 required. Optionally, the window can be hidden by setting offscreen to true. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createEGL()#

Create an engine with an offscreen EGL window. VTK >= 9.4 required. If several GPU are available, the environment variable VTK_DEFAULT_EGL_DEVICE_INDEX allows its selection. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createOSMesa()#

Create an engine with an offscreen OSMesa window. VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternal(const context::function &getProcAddress)#

Create an engine with an external window. A context to retrieve OpenGL symbols is required. The context can be nullptr for an external Cocoa window. Here’s an example if a GLFW window is used:

f3d::engine eng = f3d::engine::createExternal(glfwGetProcAddress);
Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternalGLX()#

Create an engine with an external GLX context. Equivalent to createExternal(f3d::context::glx()); VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternalWGL()#

Create an engine with an external WGL context. Equivalent to createExternal(f3d::context::wgl()); VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternalCOCOA()#

Create an engine with an external COCOA context. Equivalent to createExternal(f3d::context::cocoa()); VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternalEGL()#

Create an engine with an external EGL context. Equivalent to createExternal(f3d::context::egl()); VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static engine createExternalOSMesa()#

Create an engine with an external OSMesa context. Equivalent to createExternal(f3d::context::osmesa()); VTK >= 9.4 required. Throws a context::loading_exception if a needed graphic library cannot be loaded Throws a context::symbol_exception if a needed symbol cannot be found in graphic library Throws a engine::no_window_exception if the window cannot be created for another reason Throws a engine::cache_exception if the default cache directory cannot be used

static std::map<std::string, bool> getRenderingBackendList()#

List rendering backends supported by libf3d. All backends have an associated boolean flag indicating if it can be used.

static void loadPlugin(const std::string &pathOrName, const std::vector<std::filesystem::path> &pluginSearchPaths = {})#

Load a plugin. The provided pathOrName can be a full path, relative path, or plugin name. First try to load the plugin by name from the static plugins. Then try to load the path provided as if it is a full path to a plugin. Then try to load a plugin by its name looking into the provided plugin search paths (used as is). Then try to load a plugin by its name relying on internal system (eg: LD_LIBRARY_PATH). The plugin “native” is always available and includes native VTK readers. If built and available in your build, F3D is providing 5 additional plugins: “alembic”, “assimp”, “draco”, “exodus”, “occt”, “usd”. Custom plugins can also be available that F3D is not supporting officially. Throw a plugin_exception if the plugin can’t be loaded for some reason.

static void autoloadPlugins()#

Automatically load all the static plugins. The plugin “native” is guaranteed to be static.

static std::vector<std::string> getPluginsList(const std::filesystem::path &pluginPath)#

List plugins based on associated json files located in the given directory, used as is. Listed plugins can be loaded using engine::loadPlugin function. Note that the listed plugins may fail to load if the library is not found or incompatible. Return available plugins if any, or an empty vector if there are none or the provided path does not exist.

static libInformation getLibInfo()#

Get a struct containing info about the libf3d.

static std::vector<readerInformation> getReadersInfo()#

Get a vector of struct containing info about the supported readers.

struct cache_exception : public f3d::exception#

An exception that can be thrown by the engine when the cache cannot be used

Public Functions

explicit cache_exception(const std::string &what = "")#
struct libInformation#

A structure providing information about the libf3d. Returned by getLibInfo().

Public Members

std::string Version#
std::string VersionFull#
std::string BuildDate#
std::string BuildSystem#
std::string Compiler#
std::map<std::string, bool> Modules#
std::string VTKVersion#
std::vector<std::string> Copyrights#
std::string License#
struct no_interactor_exception : public f3d::exception#

An exception that can be thrown by the engine when no interactor is available .

Public Functions

explicit no_interactor_exception(const std::string &what = "")#
struct no_window_exception : public f3d::exception#

An exception that can be thrown by the engine when no window is available.

Public Functions

explicit no_window_exception(const std::string &what = "")#
struct plugin_exception : public f3d::exception#

An exception that can be thrown by the engine when a plugin cannot be loaded.

Public Functions

explicit plugin_exception(const std::string &what = "")#
struct readerInformation#

A structure providing information about a reader. Returned in a vector by getReadersInfo().

Public Members

std::string Name#
std::string Description#
std::vector<std::string> Extensions#
std::vector<std::string> MimeTypes#
std::string PluginName#
bool HasSceneReader#
bool HasGeometryReader#