Class f3d::scene
Definition: scene.h (line 36)
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)
{
load.add(path);
}
Inner classes
Members
- add
- add
- add
- add
- add
- add
- add
- addLight
- animationTimeRange
- availableAnimations
- clear
- getAnimationName
- getAnimationNames
- getLight
- getLightCount
- loadAnimationTime
- removeAllLights
- removeLight
- supports
- updateLight
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 failure, 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 failure, 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 failure, 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 failure, throw a load_failure_exception.
Parameters:
- const mesh_t & mesh
Return type: scene &
Function add
virtual scene & f3d::scene::add(std::byte *buffer, std::size_t size)=0
Add and load provided buffer into the scene as it was file Require the use of scene.force_reader to be able to pick the right reader If it fails to loads the buffer, it clears the scene and throw a load_failure_exception. On other failure, throw a load_failure_exception.
Parameters:
- 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 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:
- const light_state_t & lightState
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:
- int index
- const light_state_t & lightState
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 supports
virtual bool f3d::scene::supports(const std::filesystem::path &filePath)=0
Return true if provided file path is supported, false otherwise.
Parameters:
- const std::filesystem::path & filePath
Return type: bool
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 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 indices=-1)=0
Return the animation name of a given animation indices, 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 indices = -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 >