Skip to main content
Version: 🚧 Nightly

Class f3d::scene

Definition: scene.h (line 45)

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 loadAnimationTime​

virtual scene & f3d::scene::loadAnimationTime(double timeValue)=0

Load added files at provided time value if they contain any animation Providing a time value outside of the current animation time range will clamp to the closest value in the range. Does not do anything if there is no animations.

Parameters:

  • double timeValue

Return type: scene &

Function animationTimeRange​

virtual std::pair< double, double > f3d::scene::animationTimeRange()=0

Get animation time range of currently added files. Returns [0, 0] if there is no animations.

Return type: std::pair< double, double >

Function getAnimationKeyFrames​

virtual std::vector< double > f3d::scene::getAnimationKeyFrames()=0

Get animation keyframe's time of currently added files. Can be used in loadAnimationTime to request a specific keyframe. Returns empty vector if there is no animations.

Return type: std::vector< double >

Function availableAnimations​

virtual unsigned int f3d::scene::availableAnimations() const =0

Return the number of animations available in the currently loaded files.

Return type: unsigned int

Function getAnimationName​

virtual std::string f3d::scene::getAnimationName(int index=-1)=0

Return the animation name of a given animation index, if any.

Specific animation (0..availableAnimations): Returns the name of the animation at that index Current animation (-1):

  • Returns the name of the current animation

  • Returns "Multi animations" if more than one animation is current

  • Returns "All animations" if all animations are current

  • Returns "No animations" if no animations are current Fallback: Returns "No animation" for out-of-bounds requests.

Can be called before initialization safely

Parameters:

  • int index = -1

Return type: std::string

Function getAnimationNames​

virtual std::vector< std::string > f3d::scene::getAnimationNames()=0

Return all of the animation names, if any. Returns a vector of length 0 if none. Can be called before initialization safely

Return type: std::vector< std::string >