Castor3D
..
|
Frame buffer class. More...
Public Member Functions | |
DECLARE_VECTOR (FrameBufferAttachmentSPtr, Attach) | |
C3D_API | FrameBuffer (Engine &p_engine) |
Constructor. More... | |
virtual C3D_API | ~FrameBuffer () |
Destructor. More... | |
C3D_API bool | Initialise (Castor::Size const &p_size) |
Initialises color and depth cache buffers. More... | |
C3D_API void | Cleanup () |
Cleans up cache buffers. More... | |
C3D_API void | SetClearColour (Castor::Colour const &p_colour) |
Defines the colour used when Clear is called on the color buffer. More... | |
C3D_API void | Clear () |
Clears the buffers. More... | |
C3D_API bool | Bind (eFRAMEBUFFER_MODE p_mode=eFRAMEBUFFER_MODE_AUTOMATIC, eFRAMEBUFFER_TARGET p_target=eFRAMEBUFFER_TARGET_BOTH) |
Activation function, to tell the GPU it is active. More... | |
C3D_API void | Unbind () |
Deactivation function, to tell the GPU it is inactive. More... | |
C3D_API bool | BlitInto (FrameBufferSPtr p_buffer, Castor::Rectangle const &p_rect, uint32_t p_components) |
Blit this frame buffer into the given one. More... | |
C3D_API bool | StretchInto (FrameBufferSPtr p_buffer, Castor::Rectangle const &p_rectSrc, Castor::Rectangle const &p_rectDst, uint32_t p_components, eINTERPOLATION_MODE p_interpolation) |
Stretches this frame buffer into the given one. More... | |
C3D_API void | SetDrawBuffers () |
Specifies the buffers to be drawn into. More... | |
C3D_API void | SetDrawBuffer (TextureAttachmentSPtr p_attach) |
Specifies the color buffer to be drawn into. More... | |
C3D_API void | SetDrawBuffer (RenderBufferAttachmentSPtr p_attach) |
Specifies the color buffer to be drawn into. More... | |
C3D_API bool | Attach (eATTACHMENT_POINT p_point, uint8_t p_index, TextureAttachmentSPtr p_texture, eTEXTURE_TARGET p_target, int p_layer=0) |
Attaches a texture to this frame buffer, at given attachment point. More... | |
C3D_API bool | Attach (eATTACHMENT_POINT p_point, TextureAttachmentSPtr p_texture, eTEXTURE_TARGET p_target, int p_layer=0) |
Attaches a texture to this frame buffer, at given attachment point. More... | |
C3D_API bool | Attach (eATTACHMENT_POINT p_point, uint8_t p_index, RenderBufferAttachmentSPtr p_renderBuffer) |
Attaches a render buffer to this frame buffer, at given attachment point. More... | |
C3D_API bool | Attach (eATTACHMENT_POINT p_point, RenderBufferAttachmentSPtr p_renderBuffer) |
Attaches a render buffer to this frame buffer, at given attachment point. More... | |
C3D_API FrameBufferAttachmentSPtr | GetAttachment (eATTACHMENT_POINT p_point, uint8_t p_index) |
Retrieves a buffer attached at given attachment point and index. More... | |
C3D_API void | DetachAll () |
Detaches all attached objects. More... | |
C3D_API void | Resize (Castor::Size const &p_size) |
Resizes each attached buffer. More... | |
virtual C3D_API bool | Create ()=0 |
Creation function. More... | |
virtual C3D_API void | Destroy ()=0 |
Destruction function. More... | |
virtual C3D_API void | SetDrawBuffers (AttachArray const &p_attaches)=0 |
Uses given attachments to this framebuffer for next draw call. More... | |
virtual C3D_API void | SetReadBuffer (eATTACHMENT_POINT p_point, uint8_t p_index)=0 |
Specifies the color buffer source for pixels. More... | |
virtual C3D_API ColourRenderBufferSPtr | CreateColourRenderBuffer (Castor::ePIXEL_FORMAT p_format)=0 |
Creates a colour render buffer. More... | |
virtual C3D_API DepthStencilRenderBufferSPtr | CreateDepthStencilRenderBuffer (Castor::ePIXEL_FORMAT p_format)=0 |
Creates a depth/stencil render buffer. More... | |
virtual C3D_API RenderBufferAttachmentSPtr | CreateAttachment (RenderBufferSPtr p_renderBuffer)=0 |
Creates an attachment to a render buffer. More... | |
virtual C3D_API TextureAttachmentSPtr | CreateAttachment (DynamicTextureSPtr p_texture)=0 |
Creates an attachment to a texture. More... | |
virtual C3D_API bool | IsComplete () const =0 |
Checks if the FBO is complete. More... | |
virtual C3D_API bool | DownloadBuffer (Castor3D::eATTACHMENT_POINT p_point, uint8_t p_index, Castor::PxBufferBaseSPtr p_buffer)=0 |
Downloads the render buffer data. More... | |
Castor::Colour | GetClearColour () const |
Retrieves the background colour. More... | |
Protected Member Functions | |
C3D_API uint32_t | DoGetSamplesCount (eATTACHMENT_POINT p_point, uint8_t p_index) |
C3D_API Castor::ePIXEL_FORMAT | DoGetPixelFormat (eATTACHMENT_POINT p_point, uint8_t p_index) |
virtual C3D_API void | DoClear (uint32_t p_targets)=0 |
Clears the given buffers components. More... | |
virtual C3D_API bool | DoBind (eFRAMEBUFFER_TARGET p_target)=0 |
Activation function, to tell the GPU it is active. More... | |
virtual C3D_API void | DoUnbind ()=0 |
Deactivation function, to tell the GPU it is inactive. More... | |
virtual C3D_API bool | DoBlitInto (FrameBufferSPtr p_buffer, Castor::Rectangle const &p_rect, uint32_t p_components)=0 |
Blit this frame buffer into the given one. More... | |
virtual C3D_API bool | DoStretchInto (FrameBufferSPtr p_buffer, Castor::Rectangle const &p_rectSrc, Castor::Rectangle const &p_rectDst, uint32_t p_components, eINTERPOLATION_MODE p_interpolation)=0 |
Blit this frame buffer into the given one. More... | |
Protected Attributes | |
AttachArray | m_attaches |
All attachments. More... | |
Castor::Colour | m_clearColour |
The background colour. More... | |
Frame buffer class.
C3D_API Castor3D::FrameBuffer::FrameBuffer | ( | Engine & | p_engine | ) |
Constructor.
[in] | p_engine | The core engine |
|
virtual |
Destructor.
C3D_API bool Castor3D::FrameBuffer::Attach | ( | eATTACHMENT_POINT | p_point, |
uint8_t | p_index, | ||
TextureAttachmentSPtr | p_texture, | ||
eTEXTURE_TARGET | p_target, | ||
int | p_layer = 0 |
||
) |
Attaches a texture to this frame buffer, at given attachment point.
[in] | p_point | The attachment point |
[in] | p_index | The attachment index |
[in] | p_texture | The texture |
[in] | p_target | The dimension to which the texture must be attached |
[in] | p_layer | The associated layer, if p_dimension equal eTEXTURE_TARGET_3D or eTEXTURE_TARGET_LAYER |
true
if OK C3D_API bool Castor3D::FrameBuffer::Attach | ( | eATTACHMENT_POINT | p_point, |
TextureAttachmentSPtr | p_texture, | ||
eTEXTURE_TARGET | p_target, | ||
int | p_layer = 0 |
||
) |
Attaches a texture to this frame buffer, at given attachment point.
[in] | p_point | The attachment point |
[in] | p_texture | The texture |
[in] | p_target | The dimension to which the texture must be attached |
[in] | p_layer | The associated layer, if p_dimension equal eTEXTURE_TARGET_3D or eTEXTURE_TARGET_LAYER |
true
if OK C3D_API bool Castor3D::FrameBuffer::Attach | ( | eATTACHMENT_POINT | p_point, |
uint8_t | p_index, | ||
RenderBufferAttachmentSPtr | p_renderBuffer | ||
) |
Attaches a render buffer to this frame buffer, at given attachment point.
[in] | p_point | The attachment point |
[in] | p_index | The attachment index |
[in] | p_renderBuffer | The render buffer |
true
if OK C3D_API bool Castor3D::FrameBuffer::Attach | ( | eATTACHMENT_POINT | p_point, |
RenderBufferAttachmentSPtr | p_renderBuffer | ||
) |
Attaches a render buffer to this frame buffer, at given attachment point.
[in] | p_point | The attachment point |
[in] | p_renderBuffer | The render buffer |
true
if OK C3D_API bool Castor3D::FrameBuffer::Bind | ( | eFRAMEBUFFER_MODE | p_mode = eFRAMEBUFFER_MODE_AUTOMATIC , |
eFRAMEBUFFER_TARGET | p_target = eFRAMEBUFFER_TARGET_BOTH |
||
) |
Activation function, to tell the GPU it is active.
[in] | p_target | The frame buffer binding target |
[in] | p_mode | The frame buffer binding mode |
true
if successful C3D_API bool Castor3D::FrameBuffer::BlitInto | ( | FrameBufferSPtr | p_buffer, |
Castor::Rectangle const & | p_rect, | ||
uint32_t | p_components | ||
) |
Blit this frame buffer into the given one.
[in] | p_buffer | The buffer receiving this one |
[in] | p_rect | The rectangle |
[in] | p_components | Bitwise OR of eBUFFER_COMPONENT indicating which buffers are to be copied |
true
if successful C3D_API void Castor3D::FrameBuffer::Cleanup | ( | ) |
Cleans up cache buffers.
C3D_API void Castor3D::FrameBuffer::Clear | ( | ) |
Clears the buffers.
|
pure virtual |
Creation function.
true
if OK
|
pure virtual |
Creates an attachment to a render buffer.
[in] | p_renderBuffer | The render buffer |
Implemented in Castor3D::BackBuffers.
|
pure virtual |
Creates an attachment to a texture.
[in] | p_texture | The texture |
Implemented in Castor3D::BackBuffers.
|
pure virtual |
Creates a colour render buffer.
[in] | p_format | The buffer's pixel format |
|
pure virtual |
Creates a depth/stencil render buffer.
[in] | p_format | The buffer's pixel format |
Castor3D::FrameBuffer::DECLARE_VECTOR | ( | FrameBufferAttachmentSPtr | , |
Attach | |||
) |
|
pure virtual |
Destruction function.
C3D_API void Castor3D::FrameBuffer::DetachAll | ( | ) |
Detaches all attached objects.
|
protectedpure virtual |
Activation function, to tell the GPU it is active.
[in] | p_target | The frame buffer binding target |
true
if successful
|
protectedpure virtual |
Blit this frame buffer into the given one.
[in] | p_buffer | The buffer receiving this one |
[in] | p_rect | The destination rectangle |
[in] | p_components | Bitwise OR of eBUFFER_COMPONENT indicating which buffers are to be copied |
true
if successful
|
protectedpure virtual |
Clears the given buffers components.
[in] | p_targets | The buffer components, combination of eBUFFER_COMPONENT. |
|
protected |
[in] | p_point | The attachment point. |
[in] | p_index | The attachment index. |
|
protected |
[in] | p_point | The attachment point. |
[in] | p_index | The attachment index. |
|
protectedpure virtual |
Blit this frame buffer into the given one.
[in] | p_buffer | The buffer receiving this one. |
[in] | p_rectSrc | The source rectangle. |
[in] | p_rectDst | The destination rectangle. |
[in] | p_components | Bitwise OR of eBUFFER_COMPONENT indicating which buffers are to be copied. |
[in] | p_interpolation | The interpolation to apply if the image is stretched. |
true
if successful.
|
protectedpure virtual |
Deactivation function, to tell the GPU it is inactive.
|
pure virtual |
Downloads the render buffer data.
[in] | p_point | The attachment point. |
[in] | p_index | The attachment index. |
[in] | p_buffer | Receives the data. |
C3D_API FrameBufferAttachmentSPtr Castor3D::FrameBuffer::GetAttachment | ( | eATTACHMENT_POINT | p_point, |
uint8_t | p_index | ||
) |
Retrieves a buffer attached at given attachment point and index.
[in] | p_point | The attachment point. |
[in] | p_index | The attachment index. |
nullptr
if not found.
|
inline |
Retrieves the background colour.
References m_clearColour.
C3D_API bool Castor3D::FrameBuffer::Initialise | ( | Castor::Size const & | p_size | ) |
Initialises color and depth cache buffers.
[in] | p_size | The frame buffer size. |
true
if OK.
|
pure virtual |
Checks if the FBO is complete.
false
if the buffer is in error if there is an attachment missing Implemented in Castor3D::BackBuffers.
C3D_API void Castor3D::FrameBuffer::Resize | ( | Castor::Size const & | p_size | ) |
Resizes each attached buffer.
[in] | p_size | The new dimensions |
C3D_API void Castor3D::FrameBuffer::SetClearColour | ( | Castor::Colour const & | p_colour | ) |
Defines the colour used when Clear is called on the color buffer.
[in] | p_colour | The colour. |
C3D_API void Castor3D::FrameBuffer::SetDrawBuffer | ( | TextureAttachmentSPtr | p_attach | ) |
Specifies the color buffer to be drawn into.
[in] | p_attach | The color buffer |
C3D_API void Castor3D::FrameBuffer::SetDrawBuffer | ( | RenderBufferAttachmentSPtr | p_attach | ) |
Specifies the color buffer to be drawn into.
[in] | p_attach | The color buffer |
C3D_API void Castor3D::FrameBuffer::SetDrawBuffers | ( | ) |
Specifies the buffers to be drawn into.
|
pure virtual |
Uses given attachments to this framebuffer for next draw call.
[in] | p_attaches | The attachments. |
|
pure virtual |
Specifies the color buffer source for pixels.
[in] | p_point | The color buffer |
[in] | p_index | The attachment index |
C3D_API bool Castor3D::FrameBuffer::StretchInto | ( | FrameBufferSPtr | p_buffer, |
Castor::Rectangle const & | p_rectSrc, | ||
Castor::Rectangle const & | p_rectDst, | ||
uint32_t | p_components, | ||
eINTERPOLATION_MODE | p_interpolation | ||
) |
Stretches this frame buffer into the given one.
[in] | p_buffer | The buffer receiving this one. |
[in] | p_rectSrc | The source rectangle. |
[in] | p_rectDst | The destination rectangle. |
[in] | p_components | Bitwise OR of eBUFFER_COMPONENT indicating which buffers are to be copied. |
[in] | p_interpolation | The interpolation to apply if the image is stretched. |
true
if successful. C3D_API void Castor3D::FrameBuffer::Unbind | ( | ) |
Deactivation function, to tell the GPU it is inactive.
|
protected |
All attachments.
|
protected |
The background colour.
Referenced by GetClearColour().