Skip to main content
Version: 4.0

Class f3d::scene

Definition: scene.h (line 46)

Class to load files into.

The scene where files and meshes can be added and loaded into.

Example usage:

std::string path = ...
f3d::engine eng(f3d::window::Type::NATIVE);
f3d::scene& load = eng.getScene();

if (load.supports(path) == file_availability::SUPPORTED)
{
load.add(path);
}

Inner classes​

Members​

undefined​

Function add​

virtual scene & f3d::scene::add(const std::filesystem::path &filePath)=0

Add and load provided files into the scene Already added file will NOT be reloaded If it fails to loads a file, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

  • const std::filesystem::path & filePath

Return type: scene &

Function add​

virtual scene & f3d::scene::add(const std::vector< std::filesystem::path > &filePath)=0

Add and load provided files into the scene Already added file will NOT be reloaded If it fails to loads a file, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

  • const std::vector< std::filesystem::path > & filePath

Return type: scene &

Function add​

virtual scene & f3d::scene::add(const std::vector< std::string > &filePathStrings)=0

Add and load provided files into the scene Already added file will NOT be reloaded If it fails to loads a file, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

  • const std::vector< std::string > & filePathStrings

Return type: scene &

undefined​

Function add​

scene & f3d::scene::add(std::initializer_list< std::string > list)

Convenience initializer list signature for add method

Parameters:

  • std::initializer_list< std::string > list

Return type: scene &

Function add​

scene & f3d::scene::add(std::initializer_list< std::filesystem::path > list)

Convenience initializer list signature for add method

Parameters:

  • std::initializer_list< std::filesystem::path > list

Return type: scene &

Public functions​

Function add​

virtual scene & f3d::scene::add(const mesh_t &mesh)=0

Add and load provided mesh into the scene If it fails to load the mesh, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

Return type: scene &

Function add​

virtual scene & f3d::scene::add(std::shared_ptr< mesh_view > mesh)=0

Add and load provided mesh view into the scene Requires VTK >= 9.6 If it fails to load the mesh, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

Return type: scene &

Function add​

virtual scene & f3d::scene::add(const std::byte *buffer, std::size_t size)=0

Add and load provided buffer into the scene as it was file. Automatically picks the right reader to use, unless you use VTK < 9.6.20260128, then it requires the use of scene.force_reader. If it fails to loads the buffer, it clears the scene and throw a load_failure_exception. On other failures, throw a load_failure_exception.

Parameters:

  • const std::byte * buffer
  • std::size_t size

Return type: scene &

Function clear​

virtual scene & f3d::scene::clear()=0

Clear the scene of all added files

Return type: scene &

Function getAddedFiles​

virtual std::vector< std::filesystem::path > f3d::scene::getAddedFiles() const =0

Return the list of files added to the scene through the path-based add methods, in the order they were provided. Meshes added through the mesh, mesh view or buffer based add methods are not listed.

Return type: std::vector< std::filesystem::path >

Function addLight​

virtual int f3d::scene::addLight(const light_state_t &lightState) const =0

Add a light based on a light state, returns the index of the added light.

Parameters:

Return type: int

Function getLightCount​

virtual int f3d::scene::getLightCount() const =0

Get the number of lights.

Return type: int

Function getLight​

virtual light_state_t f3d::scene::getLight(int index) const =0

Get the light state at provided index. light_exception is thrown if the index is invalid.

Parameters:

  • int index

Return type: light_state_t

Function updateLight​

virtual scene & f3d::scene::updateLight(int index, const light_state_t &lightState)=0

Update a light at provided index with the provided light state. light_exception is thrown if the index is invalid.

Parameters:

Return type: scene &

Function removeLight​

virtual scene & f3d::scene::removeLight(int index)=0

Remove a light at provided index. light_exception is thrown if the index is invalid.

Parameters:

  • int index

Return type: scene &

Function removeAllLights​

virtual scene & f3d::scene::removeAllLights()=0

Remove all lights from the scene.

Return type: scene &

Function getSceneHierarchy​

virtual std::vector< node_state_t > f3d::scene::getSceneHierarchy() const =0

Return the scene hierarchy of all added files as a flat vector, in depth-first pre-order, so that a parent node always precedes its children. Returns an empty vector if the scene is empty.

Return type: std::vector< node_state_t >

Function setNodeVisibility​

virtual scene & f3d::scene::setNodeVisibility(int nodeId, bool visible)=0

Set the visibility of the node at provided index and of all the nodes in its subtree. See types::node_state_t documentation for more information. node_exception is thrown if the index is invalid.

Parameters:

  • int nodeId
  • bool visible

Return type: scene &

Function getSceneInfo​

virtual scene_info_t f3d::scene::getSceneInfo() const =0

Return information about the contents of the scene, eg. its number of points and cells. See types::scene_info_t documentation for more information. Returns zeroed counters if the scene is empty.

Return type: scene_info_t

Function supports​

virtual file_availability f3d::scene::supports(const std::filesystem::path &filePath)=0

Return enum file_availability which indicates if the file at the specified path has supported extension, unsupported extension or unsupported content. content validation is only performed with VTK >= 9.6.20260228. Setting scene.skip_content_check to true disables content validation. scene.force_reader is taken into account and plugin should be loaded for their readers to be found.

Parameters:

  • const std::filesystem::path & filePath

Return type: file_availability

Function getAnimation​

virtual animation & f3d::scene::getAnimation()=0

Get the animation available on the scene.

Return type: animation &