Blue Brain BioExplorer
core::FrameBuffer Class Referenceabstract

This class represents a frame buffer for an engine specific code. It provides an API for utilizing and manipulating the frame buffer in various ways. More...

#include <FrameBuffer.h>

Inheritance diagram for core::FrameBuffer:
Collaboration diagram for core::FrameBuffer:

Public Member Functions

PLATFORM_API FrameBuffer (const std::string &name, const Vector2ui &frameSize, FrameBufferFormat frameBufferFormat)
 FrameBuffer constructor. More...
 
virtual PLATFORM_API void map ()=0
 Map the buffer for reading with get*Buffer(). More...
 
virtual PLATFORM_API void unmap ()=0
 Unmap the buffer for reading with get*Buffer(). More...
 
virtual PLATFORM_API const uint8_t * getColorBuffer () const =0
 Get the Color Buffer object. More...
 
virtual PLATFORM_API const float * getFloatBuffer () const =0
 Get the Float Buffer object. More...
 
virtual PLATFORM_API void resize (const Vector2ui &frameSize)=0
 Resize the framebuffer to the new size. More...
 
virtual PLATFORM_API void clear ()
 Clear the framebuffer. More...
 
virtual PLATFORM_API Vector2ui getSize () const
 Get the Size object. More...
 
virtual PLATFORM_API void setAccumulation (const bool accumulation)
 Enable/disable accumulation state on the framebuffer. More...
 
virtual PLATFORM_API void setFormat (FrameBufferFormat frameBufferFormat)
 Set a new framebuffer format. More...
 
virtual PLATFORM_API void setSubsampling (const size_t)
 Set a new subsampling with a factor from 1 to x of the current size. More...
 
virtual PLATFORM_API void createPixelOp (const std::string &)
 Create and set a pixelop (pre/post filter) on the framebuffer. More...
 
virtual PLATFORM_API void updatePixelOp (const PropertyMap &)
 Update the current pixelop with the given properties. More...
 
PLATFORM_API size_t getColorDepth () const
 Get the Color Depth object. More...
 
PLATFORM_API const Vector2uigetFrameSize () const
 Get the Frame Size object. More...
 
PLATFORM_API bool getAccumulation () const
 Get the Accumulation object. More...
 
PLATFORM_API FrameBufferFormat getFrameBufferFormat () const
 Get the Frame Buffer Format object. More...
 
PLATFORM_API const std::string & getName () const
 Get the Name object. More...
 
PLATFORM_API void incrementAccumFrames ()
 Increment the accumulation frames. More...
 
PLATFORM_API size_t numAccumFrames () const
 Get the number of accumulation frames. More...
 
PLATFORM_API freeimage::ImagePtr getImage ()
 Get the Image object. More...
 
PLATFORM_API void setAccumulationType (const AccumulationType accumulationType)
 Set the Accumulation Type object. More...
 
PLATFORM_API AccumulationType getAccumulationType () const
 Get the Accumulation Type object. More...
 
- Public Member Functions inherited from core::BaseObject
 BaseObject ()=default
 
virtual ~BaseObject ()=default
 
 BaseObject (const BaseObject &)
 
BaseObjectoperator= (const BaseObject &rhs)
 
bool isModified () const
 
void resetModified ()
 
void markModified (const bool triggerCallback=true)
 
void onModified (const ModifiedCallback &callback)
 
void clearModifiedCallback ()
 

Protected Attributes

const std::string _name
 
Vector2ui _frameSize
 
FrameBufferFormat _frameBufferFormat
 
bool _accumulation {true}
 
AccumulationType _accumulationType {AccumulationType::linear}
 
std::atomic_size_t _accumFrames {0}
 

Additional Inherited Members

- Public Types inherited from core::BaseObject
using ModifiedCallback = std::function< void(const BaseObject &)>
 
- Protected Member Functions inherited from core::BaseObject
template<typename T >
void _updateValue (T &member, const T &newValue, const bool triggerCallback=true)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if<!std::is_floating_point< T >::value >::type *=0)
 

Detailed Description

This class represents a frame buffer for an engine specific code. It provides an API for utilizing and manipulating the frame buffer in various ways.

Definition at line 38 of file FrameBuffer.h.

Constructor & Destructor Documentation

◆ FrameBuffer()

core::FrameBuffer::FrameBuffer ( const std::string &  name,
const Vector2ui frameSize,
FrameBufferFormat  frameBufferFormat 
)

FrameBuffer constructor.

Construct a new FrameBuffer object

Parameters
nameThe name of the frame buffer.
frameSizeThe initial size of the frame buffer.
frameBufferFormatThe format of the frame buffer.

Definition at line 27 of file FrameBuffer.cpp.

Member Function Documentation

◆ clear()

virtual PLATFORM_API void core::FrameBuffer::clear ( )
inlinevirtual

Clear the framebuffer.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 90 of file FrameBuffer.h.

◆ createPixelOp()

virtual PLATFORM_API void core::FrameBuffer::createPixelOp ( const std::string &  )
inlinevirtual

Create and set a pixelop (pre/post filter) on the framebuffer.

Parameters
nameThe name of the pixelOp.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 125 of file FrameBuffer.h.

◆ getAccumulation()

PLATFORM_API bool core::FrameBuffer::getAccumulation ( ) const
inline

Get the Accumulation object.

Returns
bool The current accumulation state.

Definition at line 153 of file FrameBuffer.h.

◆ getAccumulationType()

PLATFORM_API AccumulationType core::FrameBuffer::getAccumulationType ( ) const
inline

Get the Accumulation Type object.

Returns
AccumulationType The current accumulation type.

Definition at line 204 of file FrameBuffer.h.

◆ getColorBuffer()

virtual PLATFORM_API const uint8_t* core::FrameBuffer::getColorBuffer ( ) const
pure virtual

Get the Color Buffer object.

Returns
const uint8_t* The color buffer.

Implemented in core::engine::ospray::OSPRayFrameBuffer, and core::engine::optix::OptiXFrameBuffer.

◆ getColorDepth()

size_t core::FrameBuffer::getColorDepth ( ) const

Get the Color Depth object.

Returns
size_t The color depth.

Definition at line 34 of file FrameBuffer.cpp.

◆ getFloatBuffer()

virtual PLATFORM_API const float* core::FrameBuffer::getFloatBuffer ( ) const
pure virtual

Get the Float Buffer object.

Returns
const float* The depth buffer.

Implemented in core::engine::ospray::OSPRayFrameBuffer, and core::engine::optix::OptiXFrameBuffer.

◆ getFrameBufferFormat()

PLATFORM_API FrameBufferFormat core::FrameBuffer::getFrameBufferFormat ( ) const
inline

Get the Frame Buffer Format object.

Returns
FrameBufferFormat The current frame buffer format.

Definition at line 160 of file FrameBuffer.h.

◆ getFrameSize()

PLATFORM_API const Vector2ui& core::FrameBuffer::getFrameSize ( ) const
inline

Get the Frame Size object.

Returns
const Vector2ui& The current frame size.

Definition at line 146 of file FrameBuffer.h.

◆ getImage()

freeimage::ImagePtr core::FrameBuffer::getImage ( )

Get the Image object.

Returns
freeimage::ImagePtr The freeimage object.

Definition at line 49 of file FrameBuffer.cpp.

◆ getName()

PLATFORM_API const std::string& core::FrameBuffer::getName ( ) const
inline

Get the Name object.

Returns
const std::string& The name of the frame buffer.

Definition at line 167 of file FrameBuffer.h.

◆ getSize()

virtual PLATFORM_API Vector2ui core::FrameBuffer::getSize ( ) const
inlinevirtual

Get the Size object.

Returns
Vector2ui The current framebuffer size.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 97 of file FrameBuffer.h.

◆ incrementAccumFrames()

PLATFORM_API void core::FrameBuffer::incrementAccumFrames ( )
inline

Increment the accumulation frames.

Definition at line 173 of file FrameBuffer.h.

◆ map()

virtual PLATFORM_API void core::FrameBuffer::map ( )
pure virtual

Map the buffer for reading with get*Buffer().

Implemented in core::engine::ospray::OSPRayFrameBuffer, and core::engine::optix::OptiXFrameBuffer.

◆ numAccumFrames()

PLATFORM_API size_t core::FrameBuffer::numAccumFrames ( ) const
inline

Get the number of accumulation frames.

Returns
size_t The number of accumulated frames.

Definition at line 180 of file FrameBuffer.h.

◆ resize()

virtual PLATFORM_API void core::FrameBuffer::resize ( const Vector2ui frameSize)
pure virtual

Resize the framebuffer to the new size.

Parameters
frameSizeThe frame buffer size to be set.

Implemented in core::engine::optix::OptiXFrameBuffer, and core::engine::ospray::OSPRayFrameBuffer.

◆ setAccumulation()

virtual PLATFORM_API void core::FrameBuffer::setAccumulation ( const bool  accumulation)
inlinevirtual

Enable/disable accumulation state on the framebuffer.

Parameters
accumulationThe accumulation state to be set.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer, and core::engine::optix::OptiXFrameBuffer.

Definition at line 104 of file FrameBuffer.h.

◆ setAccumulationType()

PLATFORM_API void core::FrameBuffer::setAccumulationType ( const AccumulationType  accumulationType)
inline

Set the Accumulation Type object.

Parameters
accumulationTypeThe accumulation type to be set.

Definition at line 194 of file FrameBuffer.h.

◆ setFormat()

virtual PLATFORM_API void core::FrameBuffer::setFormat ( FrameBufferFormat  frameBufferFormat)
inlinevirtual

Set a new framebuffer format.

Parameters
frameBufferFormatThe new frame buffer format to be set.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 111 of file FrameBuffer.h.

◆ setSubsampling()

virtual PLATFORM_API void core::FrameBuffer::setSubsampling ( const  size_t)
inlinevirtual

Set a new subsampling with a factor from 1 to x of the current size.

Parameters
size_tThe size to be set.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 118 of file FrameBuffer.h.

◆ unmap()

virtual PLATFORM_API void core::FrameBuffer::unmap ( )
pure virtual

Unmap the buffer for reading with get*Buffer().

Implemented in core::engine::ospray::OSPRayFrameBuffer, and core::engine::optix::OptiXFrameBuffer.

◆ updatePixelOp()

virtual PLATFORM_API void core::FrameBuffer::updatePixelOp ( const PropertyMap )
inlinevirtual

Update the current pixelop with the given properties.

Parameters
propertiesThe properties to be updated.

Reimplemented in core::engine::ospray::OSPRayFrameBuffer.

Definition at line 132 of file FrameBuffer.h.

Member Data Documentation

◆ _accumFrames

std::atomic_size_t core::FrameBuffer::_accumFrames {0}
protected

Definition at line 212 of file FrameBuffer.h.

◆ _accumulation

bool core::FrameBuffer::_accumulation {true}
protected

Definition at line 210 of file FrameBuffer.h.

◆ _accumulationType

AccumulationType core::FrameBuffer::_accumulationType {AccumulationType::linear}
protected

Definition at line 211 of file FrameBuffer.h.

◆ _frameBufferFormat

FrameBufferFormat core::FrameBuffer::_frameBufferFormat
protected

Definition at line 209 of file FrameBuffer.h.

◆ _frameSize

Vector2ui core::FrameBuffer::_frameSize
protected

Definition at line 208 of file FrameBuffer.h.

◆ _name

const std::string core::FrameBuffer::_name
protected

Definition at line 207 of file FrameBuffer.h.


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