Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::Structure3DRenderPipeline Class Reference

Manages background 3D offscreen rendering worker thread, LOD evaluation, and Slint image dispatch. More...

#include <Structure3DRenderPipeline.hpp>

Collaboration diagram for correlation::app::Structure3DRenderPipeline:

Public Types

using FrameDispatchedCallback = std::function<void(const slint::Image &)>

Public Member Functions

 Structure3DRenderPipeline (FrameDispatchedCallback callback, std::shared_ptr< std::atomic< bool > > alive=nullptr, std::unique_ptr< render3d::IRenderEngine > engine=nullptr)
 Constructs pipeline and starts background rendering worker thread.
 ~Structure3DRenderPipeline ()
 Destructor. Signals stop condition and joins worker thread safely.
 Structure3DRenderPipeline (const Structure3DRenderPipeline &)=delete
Structure3DRenderPipeline & operator= (const Structure3DRenderPipeline &)=delete
 Structure3DRenderPipeline (Structure3DRenderPipeline &&)=delete
Structure3DRenderPipeline & operator= (Structure3DRenderPipeline &&)=delete
void initialize (const render3d::ViewportDimensions &dimensions)
 Initializes the rendering engine and framebuffer with dimensions.
void resize (const render3d::ViewportDimensions &dimensions)
 Resizes the underlying framebuffer and viewport.
void updateSnapshot (const RenderPipelineSnapshot &snapshot, bool immediate=false)
 Updates active render parameters and triggers an asynchronous frame redraw.
void requestRender (bool immediate=false)
 Schedules an asynchronous 3D frame redraw with currently stored parameters.
render3d::ViewportDimensions dimensions () const noexcept
 Current viewport pixel dimensions.
bool isActive () const noexcept
 Checks if the pipeline viewport is currently active.
void setActive (bool active) noexcept
 Sets viewport active status.
std::string backendName () const
 Human-readable name of the active rendering backend.
std::string deviceName () const
 Human-readable name of the active rendering device (GPU or CPU).
bool isHardwareAccelerated () const noexcept
 Checks whether the active rendering backend is GPU-accelerated.

Static Public Member Functions

static std::vector< std::uint8_t > renderSnapshotOffscreen (const RenderPipelineSnapshot &snapshot, const render3d::ViewportDimensions &dims, const render3d::RgbaColor &bg_color)
 Renders a high-resolution offscreen snapshot without disturbing the live viewport.

Private Member Functions

void renderLoop ()
void dispatchFrame (const std::uint8_t *pixel_data, std::uint32_t width, std::uint32_t height)

Private Attributes

FrameDispatchedCallback callback_
std::shared_ptr< std::atomic< bool > > alive_
render3d::ViewportDimensions viewport_dims_ {.width = 800, .height = 600}
render3d::LodController lod_controller_
std::unique_ptr< render3d::IRenderEngine > engine_
std::mutex mutex_
std::condition_variable cv_
RenderPipelineSnapshot current_snapshot_
bool render_pending_ {false}
bool reinit_pending_ {false}
std::atomic< bool > stop_worker_ {false}
std::jthread render_worker_

Detailed Description

Manages background 3D offscreen rendering worker thread, LOD evaluation, and Slint image dispatch.

Member Typedef Documentation

◆ FrameDispatchedCallback

using correlation::app::Structure3DRenderPipeline::FrameDispatchedCallback = std::function<void(const slint::Image &)>

Constructor & Destructor Documentation

◆ Structure3DRenderPipeline() [1/3]

correlation::app::Structure3DRenderPipeline::Structure3DRenderPipeline ( FrameDispatchedCallback callback,
std::shared_ptr< std::atomic< bool > > alive = nullptr,
std::unique_ptr< render3d::IRenderEngine > engine = nullptr )
explicit

Constructs pipeline and starts background rendering worker thread.

Parameters
[in]callbackCallback invoked with rendered Slint image on Slint event loop.
[in]aliveLiveness flag to avoid dispatching after parent controller destruction.
[in]engineOptional custom IRenderEngine instance (defaults to auto backend).
Here is the caller graph for this function:

◆ ~Structure3DRenderPipeline()

correlation::app::Structure3DRenderPipeline::~Structure3DRenderPipeline ( )

Destructor. Signals stop condition and joins worker thread safely.

◆ Structure3DRenderPipeline() [2/3]

correlation::app::Structure3DRenderPipeline::Structure3DRenderPipeline ( const Structure3DRenderPipeline & )
delete
Here is the call graph for this function:

◆ Structure3DRenderPipeline() [3/3]

correlation::app::Structure3DRenderPipeline::Structure3DRenderPipeline ( Structure3DRenderPipeline && )
delete
Here is the call graph for this function:

Member Function Documentation

◆ backendName()

std::string correlation::app::Structure3DRenderPipeline::backendName ( ) const
nodiscard

Human-readable name of the active rendering backend.

Returns
Backend name string, or "None" if uninitialized.
Here is the caller graph for this function:

◆ deviceName()

std::string correlation::app::Structure3DRenderPipeline::deviceName ( ) const
nodiscard

Human-readable name of the active rendering device (GPU or CPU).

Returns
Device name string, or "None" if uninitialized.
Here is the caller graph for this function:

◆ dimensions()

render3d::ViewportDimensions correlation::app::Structure3DRenderPipeline::dimensions ( ) const
nodiscardnoexcept

Current viewport pixel dimensions.

Returns
Viewport dimensions.
Here is the caller graph for this function:

◆ dispatchFrame()

void correlation::app::Structure3DRenderPipeline::dispatchFrame ( const std::uint8_t * pixel_data,
std::uint32_t width,
std::uint32_t height )
private
Here is the caller graph for this function:

◆ initialize()

void correlation::app::Structure3DRenderPipeline::initialize ( const render3d::ViewportDimensions & dimensions)

Initializes the rendering engine and framebuffer with dimensions.

Parameters
[in]dimensionsViewport dimensions in pixels.
Here is the call graph for this function:

◆ isActive()

bool correlation::app::Structure3DRenderPipeline::isActive ( ) const
nodiscardnoexcept

Checks if the pipeline viewport is currently active.

Returns
True if active.
Here is the caller graph for this function:

◆ isHardwareAccelerated()

bool correlation::app::Structure3DRenderPipeline::isHardwareAccelerated ( ) const
nodiscardnoexcept

Checks whether the active rendering backend is GPU-accelerated.

Returns
True if hardware-accelerated (e.g. Vulkan GPU), false otherwise.
Here is the caller graph for this function:

◆ operator=() [1/2]

Structure3DRenderPipeline & correlation::app::Structure3DRenderPipeline::operator= ( const Structure3DRenderPipeline & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

Structure3DRenderPipeline & correlation::app::Structure3DRenderPipeline::operator= ( Structure3DRenderPipeline && )
delete
Here is the call graph for this function:

◆ renderLoop()

void correlation::app::Structure3DRenderPipeline::renderLoop ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderSnapshotOffscreen()

std::vector< std::uint8_t > correlation::app::Structure3DRenderPipeline::renderSnapshotOffscreen ( const RenderPipelineSnapshot & snapshot,
const render3d::ViewportDimensions & dims,
const render3d::RgbaColor & bg_color )
staticnodiscard

Renders a high-resolution offscreen snapshot without disturbing the live viewport.

Parameters
[in]snapshotRender configuration and scene snapshot.
[in]dimsTarget snapshot pixel dimensions.
[in]bg_colorClear/background color (use a=0 for transparent).
Returns
Contiguous RGBA8 pixel buffer (empty on failure).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestRender()

void correlation::app::Structure3DRenderPipeline::requestRender ( bool immediate = false)

Schedules an asynchronous 3D frame redraw with currently stored parameters.

Parameters
[in]immediateIf true, signals worker without debounce delay.

◆ resize()

void correlation::app::Structure3DRenderPipeline::resize ( const render3d::ViewportDimensions & dimensions)

Resizes the underlying framebuffer and viewport.

Parameters
[in]dimensionsNew viewport dimensions.
Here is the call graph for this function:

◆ setActive()

void correlation::app::Structure3DRenderPipeline::setActive ( bool active)
noexcept

Sets viewport active status.

Parameters
[in]activeTrue if viewport is visible and receiving updates.
Here is the caller graph for this function:

◆ updateSnapshot()

void correlation::app::Structure3DRenderPipeline::updateSnapshot ( const RenderPipelineSnapshot & snapshot,
bool immediate = false )

Updates active render parameters and triggers an asynchronous frame redraw.

Parameters
[in]snapshotSnapshot bundle containing camera, scene, and feature toggles.
[in]immediateIf true, signals worker without debounce delay.

Member Data Documentation

◆ alive_

std::shared_ptr<std::atomic<bool> > correlation::app::Structure3DRenderPipeline::alive_
private

◆ callback_

FrameDispatchedCallback correlation::app::Structure3DRenderPipeline::callback_
private

◆ current_snapshot_

RenderPipelineSnapshot correlation::app::Structure3DRenderPipeline::current_snapshot_
private

◆ cv_

std::condition_variable correlation::app::Structure3DRenderPipeline::cv_
private

◆ engine_

std::unique_ptr<render3d::IRenderEngine> correlation::app::Structure3DRenderPipeline::engine_
private

◆ lod_controller_

render3d::LodController correlation::app::Structure3DRenderPipeline::lod_controller_
private

◆ mutex_

std::mutex correlation::app::Structure3DRenderPipeline::mutex_
mutableprivate

◆ reinit_pending_

bool correlation::app::Structure3DRenderPipeline::reinit_pending_ {false}
private

◆ render_pending_

bool correlation::app::Structure3DRenderPipeline::render_pending_ {false}
private

◆ render_worker_

std::jthread correlation::app::Structure3DRenderPipeline::render_worker_
private

◆ stop_worker_

std::atomic<bool> correlation::app::Structure3DRenderPipeline::stop_worker_ {false}
private

◆ viewport_dims_

render3d::ViewportDimensions correlation::app::Structure3DRenderPipeline::viewport_dims_ {.width = 800, .height = 600}
private

The documentation for this class was generated from the following files: