Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
castor3d::RenderLoop Class Referenceabstract

#include <RenderLoop.hpp>

Inheritance diagram for castor3d::RenderLoop:
Inheritance graph
[legend]
Collaboration diagram for castor3d::RenderLoop:
Collaboration graph
[legend]

Public Member Functions

C3D_API RenderLoop (Engine &engine, uint32_t wantedFPS)
 Constructor.
 
virtual C3D_API ~RenderLoop () noexcept
 Destructor.
 
C3D_API void cleanup ()
 Cleans up the render loop.
 
C3D_API void showDebugOverlays (bool show)
 Show or hide debug overlays.
 
virtual C3D_API void enableVSync (bool enable)
 Updates the V-Sync status.
 
C3D_API void flushEvents () const
 Flushs all events of all frame listeners.
 
C3D_API void registerTimer (castor::String const &category, FramePassTimer &timer)
 Registers a render pass timer.
 
C3D_API void unregisterTimer (castor::String const &category, FramePassTimer &timer)
 Unregisters a render pass timer.
 
C3D_API void registerBuffer (ShaderBuffer const &buffer)
 Registers a ShaderBuffer.
 
C3D_API void unregisterBuffer (ShaderBuffer const &buffer)
 Unregisters a ShaderBuffer.
 
C3D_API bool hasDebugOverlays () const
 
C3D_API void dumpFrameTimes (Parameters &params) const
 The average frame time, in nanoseconds.
 
C3D_API castor::Nanoseconds getAvgFrameTime () const
 
virtual C3D_API void beginRendering ()=0
 Starts threaded render loop.
 
virtual C3D_API void renderSyncFrame (castor::Milliseconds tslf=0_ms)=0
 Renders one frame, only if not in render loop.
 
virtual C3D_API void pause ()=0
 Pauses the render loop.
 
virtual C3D_API void resume ()=0
 Resumes the render loop.
 
virtual C3D_API void endRendering ()=0
 Ends the render, cleans upĀ engine.
 

Getters.

castor::Milliseconds getFrameTime () const noexcept
 
uint32_t getWantedFps () const noexcept
 
castor::Microseconds getLastFrameTime () const noexcept
 
UploadDatagetUploadData () const noexcept
 
- Public Member Functions inherited from castor::OwnedBy< Engine >
Engine * getOwner () const
 

Static Public Attributes

static constexpr uint32_t UnlimitedFPS = 0xFFFFFFFFu
 

Protected Member Functions

C3D_API void doRenderFrame (castor::Milliseconds tslf=0_ms)
 Starts threaded render loop.
 
- Protected Member Functions inherited from castor::OwnedBy< Engine >
 OwnedBy (Engine &owner)
 Constructor.
 

Protected Attributes

RenderSystemm_renderSystem
 
uint32_t m_wantedFPS
 
castor::Milliseconds m_frameTime
 
std::atomic< castor::Microsecondsm_lastFrameTime
 
castor::RawUniquePtr< DebugOverlaysm_debugOverlays
 
castor::Mutex m_debugOverlaysMtx
 

Constructor & Destructor Documentation

◆ RenderLoop()

C3D_API castor3d::RenderLoop::RenderLoop ( Engine & engine,
uint32_t wantedFPS )

Constructor.

Parameters
[in]engineThe engine.
[in]wantedFPSThe wanted FPS count.

◆ ~RenderLoop()

virtual C3D_API castor3d::RenderLoop::~RenderLoop ( )
virtualnoexcept

Destructor.

Member Function Documentation

◆ beginRendering()

virtual C3D_API void castor3d::RenderLoop::beginRendering ( )
pure virtual

Starts threaded render loop.

Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.

◆ cleanup()

C3D_API void castor3d::RenderLoop::cleanup ( )

Cleans up the render loop.

◆ doRenderFrame()

C3D_API void castor3d::RenderLoop::doRenderFrame ( castor::Milliseconds tslf = 0_ms)
protected

Starts threaded render loop.

Parameters
[in]tslfThe time elapsed since last frame.

◆ dumpFrameTimes()

C3D_API void castor3d::RenderLoop::dumpFrameTimes ( Parameters & params) const

The average frame time, in nanoseconds.

◆ enableVSync()

virtual C3D_API void castor3d::RenderLoop::enableVSync ( bool enable)
virtual

Updates the V-Sync status.

Parameters
[in]enableThe status.

Reimplemented in castor3d::RenderLoopAsync.

◆ endRendering()

virtual C3D_API void castor3d::RenderLoop::endRendering ( )
pure virtual

Ends the render, cleans upĀ engine.

Remarks
Ends the threaded render loop, if any.

Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.

◆ flushEvents()

C3D_API void castor3d::RenderLoop::flushEvents ( ) const

Flushs all events of all frame listeners.

◆ getAvgFrameTime()

C3D_API castor::Nanoseconds castor3d::RenderLoop::getAvgFrameTime ( ) const
Returns
The average frame time, in nanoseconds.

◆ getFrameTime()

castor::Milliseconds castor3d::RenderLoop::getFrameTime ( ) const
inlinenoexcept

References m_frameTime.

◆ getLastFrameTime()

castor::Microseconds castor3d::RenderLoop::getLastFrameTime ( ) const
inlinenoexcept

References m_lastFrameTime.

◆ getUploadData()

UploadData & castor3d::RenderLoop::getUploadData ( ) const
inlinenoexcept

◆ getWantedFps()

uint32_t castor3d::RenderLoop::getWantedFps ( ) const
inlinenoexcept

References m_wantedFPS.

◆ hasDebugOverlays()

C3D_API bool castor3d::RenderLoop::hasDebugOverlays ( ) const
Returns
The debug overlays shown status.

◆ pause()

virtual C3D_API void castor3d::RenderLoop::pause ( )
pure virtual

Pauses the render loop.

Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.

◆ registerBuffer()

C3D_API void castor3d::RenderLoop::registerBuffer ( ShaderBuffer const & buffer)

Registers a ShaderBuffer.

Parameters
[in]bufferThe ShaderBuffer.

◆ registerTimer()

C3D_API void castor3d::RenderLoop::registerTimer ( castor::String const & category,
FramePassTimer & timer )

Registers a render pass timer.

Parameters
[in]categoryThe timer category name.
[in]timerThe timer to register.

◆ renderSyncFrame()

virtual C3D_API void castor3d::RenderLoop::renderSyncFrame ( castor::Milliseconds tslf = 0_ms)
pure virtual

Renders one frame, only if not in render loop.

Parameters
[in]tslfThe time elapsed since last frame.

Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.

◆ resume()

virtual C3D_API void castor3d::RenderLoop::resume ( )
pure virtual

Resumes the render loop.

Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.

◆ showDebugOverlays()

C3D_API void castor3d::RenderLoop::showDebugOverlays ( bool show)

Show or hide debug overlays.

Parameters
[in]showThe status.

◆ unregisterBuffer()

C3D_API void castor3d::RenderLoop::unregisterBuffer ( ShaderBuffer const & buffer)

Unregisters a ShaderBuffer.

Parameters
[in]bufferThe ShaderBuffer.

◆ unregisterTimer()

C3D_API void castor3d::RenderLoop::unregisterTimer ( castor::String const & category,
FramePassTimer & timer )

Unregisters a render pass timer.

Parameters
[in]categoryThe timer category name.
[in]timerThe timer to unregister.

Member Data Documentation

◆ m_debugOverlays

castor::RawUniquePtr< DebugOverlays > castor3d::RenderLoop::m_debugOverlays
protected

The debug overlays.

◆ m_debugOverlaysMtx

castor::Mutex castor3d::RenderLoop::m_debugOverlaysMtx
protected

◆ m_frameTime

castor::Milliseconds castor3d::RenderLoop::m_frameTime
protected

The wanted time for a frame.

Referenced by getFrameTime().

◆ m_lastFrameTime

std::atomic< castor::Microseconds > castor3d::RenderLoop::m_lastFrameTime
protected

The elapsed time for the last frame.

Referenced by getLastFrameTime().

◆ 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.

Referenced by getWantedFps().

◆ UnlimitedFPS

constexpr uint32_t castor3d::RenderLoop::UnlimitedFPS = 0xFFFFFFFFu
staticconstexpr

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