Castor3D  ..
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Castor3D::Context Class Referenceabstract

Class which holds the rendering context. More...

+ Inheritance diagram for Castor3D::Context:
+ Collaboration diagram for Castor3D::Context:

Public Member Functions

C3D_API Context (RenderSystem &p_renderSystem, bool p_invertFinal)
 Constructor. More...
 
virtual C3D_API ~Context ()
 Destructor. More...
 
C3D_API bool Initialise (RenderWindow *p_window)
 Initialises this context. More...
 
C3D_API void Cleanup ()
 Cleans this context up. More...
 
C3D_API void SetCurrent ()
 Defines this context to be the current rendering context. More...
 
C3D_API void EndCurrent ()
 Defines this context not to be the current rendering context. More...
 
C3D_API void SwapBuffers ()
 Swaps render buffers. More...
 
C3D_API void RenderTexture (Castor::Size const &p_size, Texture const &p_texture)
 Renders the given texture to the currently draw-bound frame buffer. More...
 
C3D_API void RenderTexture (Castor::Size const &p_size, Texture const &p_texture, ShaderProgramSPtr p_program)
 Renders the given texture. More...
 
virtual C3D_API void UpdateFullScreen (bool val)=0
 Changes fullscreen status. More...
 
bool IsInitialised () const
 Tells the context is initialised. More...
 
bool IsMultiSampling () const
 Tells the context is using multisampling. More...
 
void SetMultiSampling (bool p_value)
 Defines the multisampling status. More...
 
DepthStencilStateSPtr GetNoDepthState () const
 Retrieve the DepthStencilState with no depth write and test. More...
 
DepthStencilStateSPtr GetNoDepthWriteState () const
 Retrieve the DepthStencilState without depth write. More...
 
RenderWindow const & GetWindow () const
 
RenderWindowGetWindow ()
 

Protected Member Functions

virtual C3D_API bool DoInitialise ()=0
 Initialises this context. More...
 
virtual C3D_API void DoCleanup ()=0
 Cleans this context up. More...
 
virtual C3D_API void DoDestroy ()=0
 Destroys the context on GPU. More...
 
virtual C3D_API void DoSetCurrent ()=0
 Defines this context to be the current rendering context. More...
 
virtual C3D_API void DoEndCurrent ()=0
 Defines this context not to be the current rendering context. More...
 
virtual C3D_API void DoSwapBuffers ()=0
 Swaps render buffers. More...
 
C3D_API void DoRenderTexture (Castor::Size const &p_size, Texture const &p_texture, GeometryBuffersSPtr p_geometryBuffers, ShaderProgramSPtr p_program)
 Renders the given texture. More...
 

Protected Attributes

RenderWindowm_window
 RenderWindow associated to this context. More...
 
bool m_initialised
 Tells if the context is initialised. More...
 
bool m_bMultiSampling
 Tells the context is currently set to use multisampling. More...
 
ShaderProgramWPtr m_renderTextureProgram
 The ShaderProgram used when rendering from a buffer to another one. More...
 
OneIntFrameVariableSPtr m_mapDiffuse
 The diffuse map frame variable, in the buffer-to-buffer shader program. More...
 
GeometryBuffersSPtr m_geometryBuffers
 The GeometryBuffers used when rendering a texture to the current frame buffer. More...
 
Viewport m_viewport
 The Viewport used when rendering a texture into to a frame buffer. More...
 
Castor3D::BufferDeclaration m_declaration
 Buffer elements declaration. More...
 
std::array< Castor3D::BufferElementGroupSPtr, 6 > m_arrayVertex
 Vertex array (quad definition) More...
 
Castor::real m_pBuffer [24]
 6 * [2(vertex position) 2(texture coordinates)] More...
 
DepthStencilStateSPtr m_pDsStateNoDepth
 The DepthStencilState without depth write and test. More...
 
DepthStencilStateSPtr m_pDsStateNoDepthWrite
 The DepthStencilState without depth write. More...
 
VertexBufferUPtr m_vertexBuffer
 The vertex buffer. More...
 
std::array< GpuQuerySPtr, 2 > m_timerQuery
 The GPU time elapsed queries. More...
 
uint32_t m_queryIndex = 0
 The active query index. More...
 

Detailed Description

Class which holds the rendering context.

Author
Sylvain DOREMUS
Date
03/01/2011
Version
0.6.1.1

Constructor & Destructor Documentation

◆ Context()

C3D_API Castor3D::Context::Context ( RenderSystem p_renderSystem,
bool  p_invertFinal 
)

Constructor.

Parameters
[in]p_renderSystemThe RenderSystem.
[in]p_invertFinalTells if the final render is to be inverted.

◆ ~Context()

virtual C3D_API Castor3D::Context::~Context ( )
virtual

Destructor.

Member Function Documentation

◆ Cleanup()

C3D_API void Castor3D::Context::Cleanup ( )

Cleans this context up.

◆ DoCleanup()

virtual C3D_API void Castor3D::Context::DoCleanup ( )
protectedpure virtual

Cleans this context up.

◆ DoDestroy()

virtual C3D_API void Castor3D::Context::DoDestroy ( )
protectedpure virtual

Destroys the context on GPU.

◆ DoEndCurrent()

virtual C3D_API void Castor3D::Context::DoEndCurrent ( )
protectedpure virtual

Defines this context not to be the current rendering context.

◆ DoInitialise()

virtual C3D_API bool Castor3D::Context::DoInitialise ( )
protectedpure virtual

Initialises this context.

Returns
true if initialised, false if not

◆ DoRenderTexture()

C3D_API void Castor3D::Context::DoRenderTexture ( Castor::Size const &  p_size,
Texture const &  p_texture,
GeometryBuffersSPtr  p_geometryBuffers,
ShaderProgramSPtr  p_program 
)
protected

Renders the given texture.

Parameters
[in]p_sizeThe render viewport size.
[in]p_textureThe texture.
[in]p_geometryBuffersThe geometry buffers used to render the texture.
[in]p_programThe program used to render the texture.

◆ DoSetCurrent()

virtual C3D_API void Castor3D::Context::DoSetCurrent ( )
protectedpure virtual

Defines this context to be the current rendering context.

◆ DoSwapBuffers()

virtual C3D_API void Castor3D::Context::DoSwapBuffers ( )
protectedpure virtual

Swaps render buffers.

◆ EndCurrent()

C3D_API void Castor3D::Context::EndCurrent ( )

Defines this context not to be the current rendering context.

◆ GetNoDepthState()

DepthStencilStateSPtr Castor3D::Context::GetNoDepthState ( ) const
inline

Retrieve the DepthStencilState with no depth write and test.

References m_pDsStateNoDepth.

◆ GetNoDepthWriteState()

DepthStencilStateSPtr Castor3D::Context::GetNoDepthWriteState ( ) const
inline

Retrieve the DepthStencilState without depth write.

References m_pDsStateNoDepthWrite.

◆ GetWindow() [1/2]

RenderWindow const& Castor3D::Context::GetWindow ( ) const
inline
Returns
The render window.

References m_window.

◆ GetWindow() [2/2]

RenderWindow& Castor3D::Context::GetWindow ( )
inline
Returns
The render window.

References m_window.

◆ Initialise()

C3D_API bool Castor3D::Context::Initialise ( RenderWindow p_window)

Initialises this context.

Parameters
[in]p_windowThe RenderWindow
Returns
true if initialised, false if not

◆ IsInitialised()

bool Castor3D::Context::IsInitialised ( ) const
inline

Tells the context is initialised.

References m_initialised.

◆ IsMultiSampling()

bool Castor3D::Context::IsMultiSampling ( ) const
inline

Tells the context is using multisampling.

References m_bMultiSampling.

◆ RenderTexture() [1/2]

C3D_API void Castor3D::Context::RenderTexture ( Castor::Size const &  p_size,
Texture const &  p_texture 
)

Renders the given texture to the currently draw-bound frame buffer.

Parameters
[in]p_sizeThe render viewport size.
[in]p_textureThe texture.

◆ RenderTexture() [2/2]

C3D_API void Castor3D::Context::RenderTexture ( Castor::Size const &  p_size,
Texture const &  p_texture,
ShaderProgramSPtr  p_program 
)

Renders the given texture.

Parameters
[in]p_sizeThe render viewport size.
[in]p_textureThe texture.
[in]p_programThe program used to render the texture.

◆ SetCurrent()

C3D_API void Castor3D::Context::SetCurrent ( )

Defines this context to be the current rendering context.

◆ SetMultiSampling()

void Castor3D::Context::SetMultiSampling ( bool  p_value)
inline

Defines the multisampling status.

Parameters
[in]p_valueThe status

References m_bMultiSampling.

◆ SwapBuffers()

C3D_API void Castor3D::Context::SwapBuffers ( )

Swaps render buffers.

◆ UpdateFullScreen()

virtual C3D_API void Castor3D::Context::UpdateFullScreen ( bool  val)
pure virtual

Changes fullscreen status.

Parameters
[in]valThe new fullscreen status

Member Data Documentation

◆ m_arrayVertex

std::array< Castor3D::BufferElementGroupSPtr, 6 > Castor3D::Context::m_arrayVertex
protected

Vertex array (quad definition)

◆ m_bMultiSampling

bool Castor3D::Context::m_bMultiSampling
protected

Tells the context is currently set to use multisampling.

Referenced by IsMultiSampling(), and SetMultiSampling().

◆ m_declaration

Castor3D::BufferDeclaration Castor3D::Context::m_declaration
protected

Buffer elements declaration.

◆ m_geometryBuffers

GeometryBuffersSPtr Castor3D::Context::m_geometryBuffers
protected

The GeometryBuffers used when rendering a texture to the current frame buffer.

◆ m_initialised

bool Castor3D::Context::m_initialised
protected

Tells if the context is initialised.

Referenced by IsInitialised().

◆ m_mapDiffuse

OneIntFrameVariableSPtr Castor3D::Context::m_mapDiffuse
protected

The diffuse map frame variable, in the buffer-to-buffer shader program.

◆ m_pBuffer

Castor::real Castor3D::Context::m_pBuffer[24]
protected

6 * [2(vertex position) 2(texture coordinates)]

◆ m_pDsStateNoDepth

DepthStencilStateSPtr Castor3D::Context::m_pDsStateNoDepth
protected

The DepthStencilState without depth write and test.

Referenced by GetNoDepthState().

◆ m_pDsStateNoDepthWrite

DepthStencilStateSPtr Castor3D::Context::m_pDsStateNoDepthWrite
protected

The DepthStencilState without depth write.

Referenced by GetNoDepthWriteState().

◆ m_queryIndex

uint32_t Castor3D::Context::m_queryIndex = 0
protected

The active query index.

◆ m_renderTextureProgram

ShaderProgramWPtr Castor3D::Context::m_renderTextureProgram
protected

The ShaderProgram used when rendering from a buffer to another one.

◆ m_timerQuery

std::array< GpuQuerySPtr, 2 > Castor3D::Context::m_timerQuery
protected

The GPU time elapsed queries.

◆ m_vertexBuffer

VertexBufferUPtr Castor3D::Context::m_vertexBuffer
protected

The vertex buffer.

◆ m_viewport

Viewport Castor3D::Context::m_viewport
protected

The Viewport used when rendering a texture into to a frame buffer.

◆ m_window

RenderWindow* Castor3D::Context::m_window
protected

RenderWindow associated to this context.

Referenced by GetWindow().


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