Castor3D  ..
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Castor3D::OverlayRenderer Class Reference

The overlay renderer. More...

+ Inheritance diagram for Castor3D::OverlayRenderer:
+ Collaboration diagram for Castor3D::OverlayRenderer:

Classes

struct  OverlayGeometryBuffers
 Holds the two geometry buffers used to render overlays. More...
 

Public Member Functions

C3D_API OverlayRenderer (RenderSystem &p_renderSystem)
 Constructor. More...
 
C3D_API ~OverlayRenderer ()
 Destructor. More...
 
C3D_API void Initialise ()
 Initialises the buffers. More...
 
C3D_API void Cleanup ()
 Flushes the renderer. More...
 
C3D_API void DrawPanel (PanelOverlay &p_pPanelOverlay)
 Function to draw a PanelOverlay. More...
 
C3D_API void DrawBorderPanel (BorderPanelOverlay &p_pBorderPanelOverlay)
 Function to draw a BorderPanelOverlay. More...
 
C3D_API void DrawText (TextOverlay &p_pTextPanelOverlay)
 Function to draw a TextOverlay. More...
 
C3D_API void BeginRender (Castor::Size const &p_size)
 Begins the overlays rendering. More...
 
C3D_API void EndRender ()
 Ends the overlays rendering. More...
 
Castor::Size const & GetSize () const
 Retrieves the current render target size. More...
 
bool IsSizeChanged () const
 

Protected Member Functions

C3D_API RenderNodeDoGetPanelProgram (Pass &p_pass)
 Retrieves a panel program compiled using given pass. More...
 
C3D_API RenderNodeDoGetTextProgram (Pass &p_pass)
 Retrieves a text program compiled using given pass. More...
 
C3D_API ShaderProgramSPtr DoGetPanelProgram (uint32_t p_flags)
 Retrieves a panel program compiled using given texture flags. More...
 
C3D_API ShaderProgramSPtr DoGetTextProgram (uint32_t p_flags)
 Retrieves a text program compiled using given texture flags. More...
 
C3D_API ShaderProgramSPtr DoGetProgram (uint32_t p_flags)
 Retrieves a program compiled using given flags. More...
 
C3D_API OverlayGeometryBuffers DoCreateTextGeometryBuffers ()
 Creates a GeometryBuffers that can contain 1000 characters. More...
 
C3D_API void DoDrawItem (Material &p_material, OverlayGeometryBuffers const &p_geometryBuffers, uint32_t p_count)
 Function to draw an overlay. More...
 
C3D_API void DoDrawItem (Pass &p_pass, GeometryBuffers const &p_geometryBuffers, uint32_t p_count)
 Function to draw an overlay. More...
 
C3D_API void DoDrawItem (Pass &p_pass, GeometryBuffers const &p_geometryBuffers, Texture const &p_texture, Sampler const &p_sampler, uint32_t p_count)
 Function to draw a text overlay. More...
 
C3D_API OverlayGeometryBuffers DoFillTextPart (int32_t p_count, TextOverlay::VertexArray::const_iterator &p_it, uint32_t &p_index)
 Fills a GeometryBuffers from a part of a text vertex array. More...
 
C3D_API ShaderProgramSPtr DoCreateOverlayProgram (uint32_t p_flags)
 Creates a shader program for overlays rendering use. More...
 

Protected Attributes

VertexBufferUPtr m_panelVertexBuffer
 Vertex buffers for panels. More...
 
VertexBufferUPtr m_borderVertexBuffer
 Vertex buffers for borders. More...
 
std::vector< VertexBufferUPtr > m_textsVertexBuffers
 The Vertex buffers used to render texts. More...
 
OverlayGeometryBuffers m_panelGeometryBuffers
 Geometry buffers for panels. More...
 
OverlayGeometryBuffers m_borderGeometryBuffers
 Geometry buffers for borders. More...
 
std::vector< OverlayGeometryBuffersm_textsGeometryBuffers
 The GeometryBuffers used to render texts. More...
 
BufferDeclaration m_declaration
 The buffer elements declaration. More...
 
BufferDeclaration m_textDeclaration
 The text overlay buffer elements declaration. More...
 
Castor::Size m_size
 The current render target size. More...
 
std::map< Pass *, RenderNodem_mapPanelPrograms
 The shader programs used to render a panel (used for borders too) More...
 
std::map< Pass *, RenderNodem_mapTextPrograms
 The shader programs used to render texts. More...
 
std::map< uint32_t, ShaderProgramSPtr > m_programs
 The shader programs. More...
 
OneIntFrameVariableSPtr m_mapText
 Text texture sampler. More...
 
int m_previousBorderZIndex
 The previously rendered BorderPanelOverlay z-index. More...
 
int m_previousPanelZIndex
 The previously rendered PanelOverlay z-index. More...
 
int m_previousTextZIndex
 The previously rendered TextOverlay z-index. More...
 
Castor::String m_previousCaption
 The previously rendered text. More...
 
std::array< Castor3D::BufferElementGroupSPtr, 6 > m_panelVertex
 Panel overlays vertex array (quad definition) More...
 
std::array< Castor3D::BufferElementGroupSPtr, 8 *6 > m_borderVertex
 Border panel overlays vertex array (quad definition) More...
 
bool m_sizeChanged
 Tells if the render size has changed. More...
 
BlendStateWPtr m_wpBlendState
 The overlays blend state. More...
 
DepthStencilStateWPtr m_wpDepthStencilState
 The overlays depth stencil state. More...
 
RasteriserStateWPtr m_wpRasteriserState
 The overlays rasteriser state. More...
 

Detailed Description

The overlay renderer.

Author
Sylvain DOREMUS
Date
09/02/2010

Constructor & Destructor Documentation

◆ OverlayRenderer()

C3D_API Castor3D::OverlayRenderer::OverlayRenderer ( RenderSystem p_renderSystem)

Constructor.

◆ ~OverlayRenderer()

C3D_API Castor3D::OverlayRenderer::~OverlayRenderer ( )

Destructor.

Member Function Documentation

◆ BeginRender()

C3D_API void Castor3D::OverlayRenderer::BeginRender ( Castor::Size const &  p_size)

Begins the overlays rendering.

Parameters
[in]p_sizeThe render window size

◆ Cleanup()

C3D_API void Castor3D::OverlayRenderer::Cleanup ( )

Flushes the renderer.

◆ DoCreateOverlayProgram()

C3D_API ShaderProgramSPtr Castor3D::OverlayRenderer::DoCreateOverlayProgram ( uint32_t  p_flags)
protected

Creates a shader program for overlays rendering use.

Returns
The created program.

◆ DoCreateTextGeometryBuffers()

C3D_API OverlayGeometryBuffers Castor3D::OverlayRenderer::DoCreateTextGeometryBuffers ( )
protected

Creates a GeometryBuffers that can contain 1000 characters.

Remarks
Adds this GeometryBuffers to the text GeometryBuffers array.
Returns
The created GeometryBuffers.

◆ DoDrawItem() [1/3]

C3D_API void Castor3D::OverlayRenderer::DoDrawItem ( Material p_material,
OverlayGeometryBuffers const &  p_geometryBuffers,
uint32_t  p_count 
)
protected

Function to draw an overlay.

Parameters
[in]p_materialThe material.
[in]p_geometryBuffersThe overlay geometry buffers.
[in]p_countThe vertex count.

◆ DoDrawItem() [2/3]

C3D_API void Castor3D::OverlayRenderer::DoDrawItem ( Pass p_pass,
GeometryBuffers const &  p_geometryBuffers,
uint32_t  p_count 
)
protected

Function to draw an overlay.

Parameters
[in]p_passThe pass.
[in]p_geometryBuffersThe overlay geometry buffers.
[in]p_countThe vertex count.

◆ DoDrawItem() [3/3]

C3D_API void Castor3D::OverlayRenderer::DoDrawItem ( Pass p_pass,
GeometryBuffers const &  p_geometryBuffers,
Texture const &  p_texture,
Sampler const &  p_sampler,
uint32_t  p_count 
)
protected

Function to draw a text overlay.

Parameters
[in]p_passThe pass.
[in]p_geometryBuffersThe overlay geometry buffers.
[in]p_textureThe font texture.
[in]p_samplerThe texture sampler.
[in]p_countThe vertex count.

◆ DoFillTextPart()

C3D_API OverlayGeometryBuffers Castor3D::OverlayRenderer::DoFillTextPart ( int32_t  p_count,
TextOverlay::VertexArray::const_iterator &  p_it,
uint32_t &  p_index 
)
protected

Fills a GeometryBuffers from a part of a text vertex array.

Parameters
[in]p_countThe number of vertex to copy in the GeometryBuffers
[in]p_itThe beginning of the vertex array
[in]p_indexThe current index in the text GeometryBuffers array
Returns
The used GeometryBuffers.

◆ DoGetPanelProgram() [1/2]

C3D_API RenderNode& Castor3D::OverlayRenderer::DoGetPanelProgram ( Pass p_pass)
protected

Retrieves a panel program compiled using given pass.

Parameters
[in]p_passThe pass.
Returns
The program.

◆ DoGetPanelProgram() [2/2]

C3D_API ShaderProgramSPtr Castor3D::OverlayRenderer::DoGetPanelProgram ( uint32_t  p_flags)
protected

Retrieves a panel program compiled using given texture flags.

Parameters
[in]p_flagsBitwise ORed eTEXTURE_CHANNEL.
Returns
The program.

◆ DoGetProgram()

C3D_API ShaderProgramSPtr Castor3D::OverlayRenderer::DoGetProgram ( uint32_t  p_flags)
protected

Retrieves a program compiled using given flags.

Parameters
[in]p_flagsBitwise ORed eTEXTURE_CHANNEL.
Returns
The program

◆ DoGetTextProgram() [1/2]

C3D_API RenderNode& Castor3D::OverlayRenderer::DoGetTextProgram ( Pass p_pass)
protected

Retrieves a text program compiled using given pass.

Parameters
[in]p_passBitwise ORed eTEXTURE_CHANNEL.
Returns
The program.

◆ DoGetTextProgram() [2/2]

C3D_API ShaderProgramSPtr Castor3D::OverlayRenderer::DoGetTextProgram ( uint32_t  p_flags)
protected

Retrieves a text program compiled using given texture flags.

Parameters
[in]p_flagsBitwise ORed eTEXTURE_CHANNEL.
Returns
The program.

◆ DrawBorderPanel()

C3D_API void Castor3D::OverlayRenderer::DrawBorderPanel ( BorderPanelOverlay p_pBorderPanelOverlay)

Function to draw a BorderPanelOverlay.

◆ DrawPanel()

C3D_API void Castor3D::OverlayRenderer::DrawPanel ( PanelOverlay p_pPanelOverlay)

Function to draw a PanelOverlay.

◆ DrawText()

C3D_API void Castor3D::OverlayRenderer::DrawText ( TextOverlay p_pTextPanelOverlay)

Function to draw a TextOverlay.

◆ EndRender()

C3D_API void Castor3D::OverlayRenderer::EndRender ( )

Ends the overlays rendering.

◆ GetSize()

Castor::Size const& Castor3D::OverlayRenderer::GetSize ( ) const
inline

Retrieves the current render target size.

References m_size.

◆ Initialise()

C3D_API void Castor3D::OverlayRenderer::Initialise ( )

Initialises the buffers.

◆ IsSizeChanged()

bool Castor3D::OverlayRenderer::IsSizeChanged ( ) const
inline
Returns
true if the render size has changed.

References m_sizeChanged.

Member Data Documentation

◆ m_borderGeometryBuffers

OverlayGeometryBuffers Castor3D::OverlayRenderer::m_borderGeometryBuffers
protected

Geometry buffers for borders.

◆ m_borderVertex

std::array< Castor3D::BufferElementGroupSPtr, 8 * 6 > Castor3D::OverlayRenderer::m_borderVertex
protected

Border panel overlays vertex array (quad definition)

◆ m_borderVertexBuffer

VertexBufferUPtr Castor3D::OverlayRenderer::m_borderVertexBuffer
protected

Vertex buffers for borders.

◆ m_declaration

BufferDeclaration Castor3D::OverlayRenderer::m_declaration
protected

The buffer elements declaration.

◆ m_mapPanelPrograms

std::map< Pass *, RenderNode > Castor3D::OverlayRenderer::m_mapPanelPrograms
protected

The shader programs used to render a panel (used for borders too)

◆ m_mapText

OneIntFrameVariableSPtr Castor3D::OverlayRenderer::m_mapText
protected

Text texture sampler.

◆ m_mapTextPrograms

std::map< Pass *, RenderNode > Castor3D::OverlayRenderer::m_mapTextPrograms
protected

The shader programs used to render texts.

◆ m_panelGeometryBuffers

OverlayGeometryBuffers Castor3D::OverlayRenderer::m_panelGeometryBuffers
protected

Geometry buffers for panels.

◆ m_panelVertex

std::array< Castor3D::BufferElementGroupSPtr, 6 > Castor3D::OverlayRenderer::m_panelVertex
protected

Panel overlays vertex array (quad definition)

◆ m_panelVertexBuffer

VertexBufferUPtr Castor3D::OverlayRenderer::m_panelVertexBuffer
protected

Vertex buffers for panels.

◆ m_previousBorderZIndex

int Castor3D::OverlayRenderer::m_previousBorderZIndex
protected

The previously rendered BorderPanelOverlay z-index.

◆ m_previousCaption

Castor::String Castor3D::OverlayRenderer::m_previousCaption
protected

The previously rendered text.

◆ m_previousPanelZIndex

int Castor3D::OverlayRenderer::m_previousPanelZIndex
protected

The previously rendered PanelOverlay z-index.

◆ m_previousTextZIndex

int Castor3D::OverlayRenderer::m_previousTextZIndex
protected

The previously rendered TextOverlay z-index.

◆ m_programs

std::map< uint32_t, ShaderProgramSPtr > Castor3D::OverlayRenderer::m_programs
protected

The shader programs.

◆ m_size

Castor::Size Castor3D::OverlayRenderer::m_size
protected

The current render target size.

Referenced by GetSize().

◆ m_sizeChanged

bool Castor3D::OverlayRenderer::m_sizeChanged
protected

Tells if the render size has changed.

Referenced by IsSizeChanged().

◆ m_textDeclaration

BufferDeclaration Castor3D::OverlayRenderer::m_textDeclaration
protected

The text overlay buffer elements declaration.

◆ m_textsGeometryBuffers

std::vector< OverlayGeometryBuffers > Castor3D::OverlayRenderer::m_textsGeometryBuffers
protected

The GeometryBuffers used to render texts.

◆ m_textsVertexBuffers

std::vector< VertexBufferUPtr > Castor3D::OverlayRenderer::m_textsVertexBuffers
protected

The Vertex buffers used to render texts.

◆ m_wpBlendState

BlendStateWPtr Castor3D::OverlayRenderer::m_wpBlendState
protected

The overlays blend state.

◆ m_wpDepthStencilState

DepthStencilStateWPtr Castor3D::OverlayRenderer::m_wpDepthStencilState
protected

The overlays depth stencil state.

◆ m_wpRasteriserState

RasteriserStateWPtr Castor3D::OverlayRenderer::m_wpRasteriserState
protected

The overlays rasteriser state.


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