![]() |
Blue Brain BioExplorer
|
Provides an abstract implementation of a ray-tracing engine. More...
#include <Engine.h>
Public Member Functions | |
virtual PLATFORM_API void | commit () |
Commits changes to the engine. This includes scene modifications, camera modifications and renderer modifications. More... | |
virtual PLATFORM_API void | preRender () |
Executes engine-specific pre-render operations. More... | |
virtual PLATFORM_API void | postRender () |
Executes engine-specific post-render operations. More... | |
virtual PLATFORM_API Vector2ui | getMinimumFrameSize () const =0 |
Returns the minimum frame size in pixels supported by this engine. More... | |
virtual PLATFORM_API FrameBufferPtr | createFrameBuffer (const std::string &name, const Vector2ui &frameSize, FrameBufferFormat frameBufferFormat) const =0 |
Factory method to create an engine-specific framebuffer. More... | |
virtual PLATFORM_API ScenePtr | createScene (AnimationParameters &animationParameters, GeometryParameters &geometryParameters, VolumeParameters &volumeParameters, FieldParameters &fieldParameters) const =0 |
Factory method to create an engine-specific scene. More... | |
virtual PLATFORM_API CameraPtr | createCamera () const =0 |
Factory method to create an engine-specific camera. More... | |
virtual PLATFORM_API RendererPtr | createRenderer (const AnimationParameters &animationParameters, const RenderingParameters &renderingParameters) const =0 |
Factory method to create an engine-specific renderer. More... | |
PLATFORM_API | Engine (ParametersManager ¶metersManager) |
Engine Constructor. More... | |
virtual PLATFORM_API | ~Engine ()=default |
PLATFORM_API void | render () |
Renders the current scene and populates the frame buffer accordingly. More... | |
PLATFORM_API Scene & | getScene () |
Returns the scene. More... | |
PLATFORM_API FrameBuffer & | getFrameBuffer () |
Returns the frame buffer. More... | |
PLATFORM_API const Camera & | getCamera () const |
Returns the camera. More... | |
PLATFORM_API Camera & | getCamera () |
PLATFORM_API Renderer & | getRenderer () |
Returns the renderer. More... | |
PLATFORM_API void | setKeepRunning (bool keepRunning) |
Sets a flag to continue or stop rendering. More... | |
PLATFORM_API bool | getKeepRunning () const |
Returns a boolean indicating whether the user wants to continue rendering. More... | |
PLATFORM_API Statistics & | getStatistics () |
Returns statistics information. More... | |
PLATFORM_API bool | continueRendering () const |
Returns a boolean indicating whether render calls shall be continued based on current accumulation settings. More... | |
PLATFORM_API const auto & | getParametersManager () const |
Returns the parameter manager. More... | |
PLATFORM_API void | addFrameBuffer (FrameBufferPtr frameBuffer) |
Adds a frame buffer to the list to be filled during rendering. More... | |
PLATFORM_API void | removeFrameBuffer (FrameBufferPtr frameBuffer) |
Removes a frame buffer from the list of buffers that are filled during rendering. More... | |
PLATFORM_API const std::vector< FrameBufferPtr > & | getFrameBuffers () const |
Returns all registered frame buffers that are used during rendering. More... | |
PLATFORM_API void | clearFrameBuffers () |
Clears all frame buffers. More... | |
PLATFORM_API void | resetFrameBuffers () |
Resets all frame buffers. More... | |
PLATFORM_API void | setRendererType (const std::string &name) |
Adds a new renderer type with optional properties. More... | |
PLATFORM_API void | addRendererType (const std::string &name, const PropertyMap &properties={}) |
Adds a new renderer type with optional properties. More... | |
PLATFORM_API const strings & | getRendererTypes () const |
Returns all renderer types. More... | |
PLATFORM_API void | addCameraType (const std::string &name, const PropertyMap &properties={}) |
Adds a new camera type with optional properties. More... | |
Public Attributes | |
PLATFORM_API std::function< void()> | triggerRender {[] {}} |
Callback when a new frame shall be triggered. Currently called by event plugins Deflect and Rockets. More... | |
Protected Attributes | |
std::string | _rendererType {RENDERER_PROPERTY_TYPE_BASIC} |
ParametersManager & | _parametersManager |
ScenePtr | _scene |
CameraPtr | _camera |
RendererPtr | _renderer |
std::vector< FrameBufferPtr > | _frameBuffers |
Statistics | _statistics |
strings | _rendererTypes |
bool | _keepRunning {true} |
Provides an abstract implementation of a ray-tracing engine.
The above code is a C++ class called "Engine", which provides an abstract implementation of a ray-tracing engine that uses a 3rd party acceleration library. The engine holds a native implementation of a scene, a camera, a frame buffer and one or several renderers according to the capabilities of the acceleration library.
The class provides several API for engine-specific code, such as committing changes to the engine, executing engine specific pre-render operations, executing engine specific post-render operations, getting the minimum frame size in pixels supported by the engine, creating an engine-specific framebuffer, creating an engine-specific scene, creating an engine-specific camera, and creating an engine-specific renderer.
The constructor takes in a parameters manager that holds all engine parameters, such as geometry and rendering parameters, and the class provides functions to retrieve the scene, frame buffer, camera, and renderer. The class also provides a render function that renders the current scene and populates the frame buffer accordingly.
In addition, there are several callback functions, such as triggerRender, which is called when a new frame shall be triggered, and setKeepRunning and getKeepRunning functions, which allow the user to set and get a flag to continue or stop rendering. The class also provides statistics and various functions to manage the frame buffers.
Overall, the "Engine" class provides a flexible and extensible framework for implementing a ray-tracing engine using a 3rd party acceleration library.
|
explicit |
Engine Constructor.
parametersManager | The parameter manager that holds all engine parameters. |
Definition at line 36 of file Engine.cpp.
|
virtualdefault |
void core::Engine::addCameraType | ( | const std::string & | name, |
const PropertyMap & | properties = {} |
||
) |
Adds a new camera type with optional properties.
name | The camera type name. |
properties | The properties. |
Definition at line 113 of file Engine.cpp.
void core::Engine::addFrameBuffer | ( | FrameBufferPtr | frameBuffer | ) |
Adds a frame buffer to the list to be filled during rendering.
frameBuffer | The frame buffer to add. |
Definition at line 84 of file Engine.cpp.
void core::Engine::addRendererType | ( | const std::string & | name, |
const PropertyMap & | properties = {} |
||
) |
Adds a new renderer type with optional properties.
name | The renderer type name. |
properties | The properties. |
Definition at line 106 of file Engine.cpp.
void core::Engine::clearFrameBuffers | ( | ) |
Clears all frame buffers.
Definition at line 94 of file Engine.cpp.
|
virtual |
Commits changes to the engine. This includes scene modifications, camera modifications and renderer modifications.
Reimplemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
Definition at line 41 of file Engine.cpp.
bool core::Engine::continueRendering | ( | ) | const |
Returns a boolean indicating whether render calls shall be continued based on current accumulation settings.
Definition at line 77 of file Engine.cpp.
|
pure virtual |
Factory method to create an engine-specific camera.
Implemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
|
pure virtual |
Factory method to create an engine-specific framebuffer.
name | The name of the frame buffer. |
frameSize | The size of the frame buffer. |
frameBufferFormat | The frame buffer format. |
Implemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
|
pure virtual |
Factory method to create an engine-specific renderer.
animationParameters | The animation parameters. |
renderingParameters | The rendering parameters. |
Implemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
|
pure virtual |
Factory method to create an engine-specific scene.
animationParameters | The animation parameters. |
geometryParameters | The geometry parameters. |
volumeParameters | The volume parameters. |
Implemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
|
inline |
|
inline |
|
inline |
Returns the frame buffer.
|
inline |
|
inline |
|
pure virtual |
Returns the minimum frame size in pixels supported by this engine.
Implemented in core::engine::ospray::OSPRayEngine, and core::engine::optix::OptiXEngine.
|
inline |
Renderer & core::Engine::getRenderer | ( | ) |
|
inline |
|
inline |
|
inline |
Returns statistics information.
|
virtual |
Executes engine-specific post-render operations.
Definition at line 66 of file Engine.cpp.
|
virtual |
Executes engine-specific pre-render operations.
Definition at line 46 of file Engine.cpp.
void core::Engine::removeFrameBuffer | ( | FrameBufferPtr | frameBuffer | ) |
Removes a frame buffer from the list of buffers that are filled during rendering.
frameBuffer | The frame buffer to remove. |
Definition at line 89 of file Engine.cpp.
void core::Engine::render | ( | ) |
Renders the current scene and populates the frame buffer accordingly.
Definition at line 55 of file Engine.cpp.
void core::Engine::resetFrameBuffers | ( | ) |
Resets all frame buffers.
Definition at line 100 of file Engine.cpp.
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
PLATFORM_API std::function<void()> core::Engine::triggerRender {[] {}} |