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

Render loop base class. More...

+ Inheritance diagram for Castor3D::RenderLoop:
+ Collaboration diagram for Castor3D::RenderLoop:

Public Member Functions

C3D_API RenderLoop (Engine &p_engine, RenderSystem *p_renderSystem, uint32_t p_wantedFPS)
 Constructor. More...
 
virtual C3D_API ~RenderLoop ()
 Destructor. More...
 
C3D_API void Cleanup ()
 Cleans up the render loop. More...
 
C3D_API void StartRendering ()
 Starts render loop. More...
 
C3D_API void RenderSyncFrame ()
 Renders one frame. More...
 
C3D_API void Pause ()
 Pauses the render loop. More...
 
C3D_API void Resume ()
 Resumes the render loop. More...
 
C3D_API void EndRendering ()
 Ends the render. More...
 
C3D_API uint32_t GetFrameTime ()
 Retrieves the wanted frame time. More...
 
C3D_API uint32_t GetWantedFps ()
 
C3D_API void CreateContext (RenderWindow &p_window)
 Creates a render context. More...
 
C3D_API void ShowDebugOverlays (bool p_show)
 Show or hide debug overlays. More...
 
virtual C3D_API void UpdateVSync (bool p_enable)
 Updates the V-Sync status. More...
 

Protected Member Functions

C3D_API ContextSPtr DoCreateContext (RenderWindow &p_window)
 Asks for render context creation. More...
 
C3D_API void DoRenderFrame ()
 Starts threaded render loop. More...
 
virtual C3D_API void DoStartRendering ()=0
 Starts threaded render loop. More...
 
virtual C3D_API void DoRenderSyncFrame ()=0
 Renders one frame, only if not in render loop. More...
 
virtual C3D_API void DoPause ()=0
 Pauses the render loop. More...
 
virtual C3D_API void DoResume ()=0
 Resumes the render loop. More...
 
virtual C3D_API void DoEndRendering ()=0
 Ends the render, cleans upĀ engine. More...
 
virtual C3D_API ContextSPtr DoCreateMainContext (RenderWindow &p_window)=0
 Asks for main render context creation. More...
 

Protected Attributes

RenderSystemm_renderSystem
 The current RenderSystem. More...
 
uint32_t m_wantedFPS
 The wanted FPS, used in threaded render mode. More...
 
uint32_t m_frameTime
 The wanted time for a frame. More...
 
std::unique_ptr< DebugOverlaysm_debugOverlays
 The debug overlays. More...
 

Detailed Description

Render loop base class.

Author
Sylvain DOREMUS
Date
14/10/2015
Version
0.8.0

Constructor & Destructor Documentation

◆ RenderLoop()

C3D_API Castor3D::RenderLoop::RenderLoop ( Engine p_engine,
RenderSystem p_renderSystem,
uint32_t  p_wantedFPS 
)

Constructor.

Parameters
[in]p_engineThe engine.
[in]p_renderSystemThe render system.
[in]p_wantedFPSThe wanted FPS count.

◆ ~RenderLoop()

virtual C3D_API Castor3D::RenderLoop::~RenderLoop ( )
virtual

Destructor.

Member Function Documentation

◆ Cleanup()

C3D_API void Castor3D::RenderLoop::Cleanup ( )

Cleans up the render loop.

◆ CreateContext()

C3D_API void Castor3D::RenderLoop::CreateContext ( RenderWindow p_window)

Creates a render context.

Remarks
If the main context has not been created yet, the first created context will become the main context. For asynchronous render loop, this means that the calling thread won't have associated context, preventing calls to RenderSyncFrame
Parameters
[in]p_windowThe render window used to initialise the render context, receives the context.

◆ DoCreateContext()

C3D_API ContextSPtr Castor3D::RenderLoop::DoCreateContext ( RenderWindow p_window)
protected

Asks for render context creation.

Parameters
[in]p_windowThe render window used to initialise the render context, receives the context.
Returns
The created context, or the existing one.

◆ DoCreateMainContext()

virtual C3D_API ContextSPtr Castor3D::RenderLoop::DoCreateMainContext ( RenderWindow p_window)
protectedpure virtual

Asks for main render context creation.

Parameters
[in]p_windowThe render window used to initialise the render context, receives the context.

◆ DoEndRendering()

virtual C3D_API void Castor3D::RenderLoop::DoEndRendering ( )
protectedpure virtual

Ends the render, cleans upĀ engine.

Remarks
Ends the threaded render loop, if any.

◆ DoPause()

virtual C3D_API void Castor3D::RenderLoop::DoPause ( )
protectedpure virtual

Pauses the render loop.

◆ DoRenderFrame()

C3D_API void Castor3D::RenderLoop::DoRenderFrame ( )
protected

Starts threaded render loop.

◆ DoRenderSyncFrame()

virtual C3D_API void Castor3D::RenderLoop::DoRenderSyncFrame ( )
protectedpure virtual

Renders one frame, only if not in render loop.

◆ DoResume()

virtual C3D_API void Castor3D::RenderLoop::DoResume ( )
protectedpure virtual

Resumes the render loop.

◆ DoStartRendering()

virtual C3D_API void Castor3D::RenderLoop::DoStartRendering ( )
protectedpure virtual

Starts threaded render loop.

◆ EndRendering()

C3D_API void Castor3D::RenderLoop::EndRendering ( )

Ends the render.

Remarks
Use only with an asynchronous render loop.

◆ GetFrameTime()

C3D_API uint32_t Castor3D::RenderLoop::GetFrameTime ( )

Retrieves the wanted frame time.

Returns
The time, in milliseconds.

◆ GetWantedFps()

C3D_API uint32_t Castor3D::RenderLoop::GetWantedFps ( )
Returns
The wanted refresh rate.

◆ Pause()

C3D_API void Castor3D::RenderLoop::Pause ( )

Pauses the render loop.

Remarks
Use only with a synchronous render loop.

◆ RenderSyncFrame()

C3D_API void Castor3D::RenderLoop::RenderSyncFrame ( )

Renders one frame.

Remarks
Use only with a synchronous render loop, or when the render loop is paused.

◆ Resume()

C3D_API void Castor3D::RenderLoop::Resume ( )

Resumes the render loop.

Remarks
Use only with a synchronous render loop.

◆ ShowDebugOverlays()

C3D_API void Castor3D::RenderLoop::ShowDebugOverlays ( bool  p_show)

Show or hide debug overlays.

Parameters
[in]p_showThe status.

◆ StartRendering()

C3D_API void Castor3D::RenderLoop::StartRendering ( )

Starts render loop.

Remarks
Use only with an asynchronous render loop.

◆ UpdateVSync()

virtual C3D_API void Castor3D::RenderLoop::UpdateVSync ( bool  p_enable)
virtual

Updates the V-Sync status.

Parameters
[in]p_enableThe status.

Reimplemented in Castor3D::RenderLoopAsync.

Member Data Documentation

◆ m_debugOverlays

std::unique_ptr< DebugOverlays > Castor3D::RenderLoop::m_debugOverlays
protected

The debug overlays.

◆ m_frameTime

uint32_t Castor3D::RenderLoop::m_frameTime
protected

The wanted time for a frame.

◆ m_renderSystem

RenderSystem* Castor3D::RenderLoop::m_renderSystem
protected

The current RenderSystem.

◆ m_wantedFPS

uint32_t Castor3D::RenderLoop::m_wantedFPS
protected

The wanted FPS, used in threaded render mode.


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