Castor3D 0.16.0
Multiplatform 3D engine
|
#include <RenderLoop.hpp>
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 ¶ms) 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 |
UploadData & | getUploadData () 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 | |
RenderSystem & | m_renderSystem |
uint32_t | m_wantedFPS |
castor::Milliseconds | m_frameTime |
std::atomic< castor::Microseconds > | m_lastFrameTime |
castor::RawUniquePtr< DebugOverlays > | m_debugOverlays |
castor::Mutex | m_debugOverlaysMtx |
Constructor.
[in] | engine | The engine. |
[in] | wantedFPS | The wanted FPS count. |
|
virtualnoexcept |
Destructor.
|
pure virtual |
Starts threaded render loop.
Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.
C3D_API void castor3d::RenderLoop::cleanup | ( | ) |
Cleans up the render loop.
|
protected |
Starts threaded render loop.
[in] | tslf | The time elapsed since last frame. |
C3D_API void castor3d::RenderLoop::dumpFrameTimes | ( | Parameters & | params | ) | const |
The average frame time, in nanoseconds.
|
virtual |
Updates the V-Sync status.
[in] | enable | The status. |
Reimplemented in castor3d::RenderLoopAsync.
|
pure virtual |
Ends the render, cleans upĀ engine.
Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.
C3D_API void castor3d::RenderLoop::flushEvents | ( | ) | const |
Flushs all events of all frame listeners.
C3D_API castor::Nanoseconds castor3d::RenderLoop::getAvgFrameTime | ( | ) | const |
|
inlinenoexcept |
References m_frameTime.
|
inlinenoexcept |
References m_lastFrameTime.
|
inlinenoexcept |
|
inlinenoexcept |
References m_wantedFPS.
C3D_API bool castor3d::RenderLoop::hasDebugOverlays | ( | ) | const |
|
pure virtual |
Pauses the render loop.
Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.
C3D_API void castor3d::RenderLoop::registerBuffer | ( | ShaderBuffer const & | buffer | ) |
Registers a ShaderBuffer.
[in] | buffer | The ShaderBuffer. |
C3D_API void castor3d::RenderLoop::registerTimer | ( | castor::String const & | category, |
FramePassTimer & | timer ) |
Registers a render pass timer.
[in] | category | The timer category name. |
[in] | timer | The timer to register. |
|
pure virtual |
Renders one frame, only if not in render loop.
[in] | tslf | The time elapsed since last frame. |
Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.
|
pure virtual |
Resumes the render loop.
Implemented in castor3d::RenderLoopAsync, and castor3d::RenderLoopSync.
C3D_API void castor3d::RenderLoop::showDebugOverlays | ( | bool | show | ) |
Show or hide debug overlays.
[in] | show | The status. |
C3D_API void castor3d::RenderLoop::unregisterBuffer | ( | ShaderBuffer const & | buffer | ) |
Unregisters a ShaderBuffer.
[in] | buffer | The ShaderBuffer. |
C3D_API void castor3d::RenderLoop::unregisterTimer | ( | castor::String const & | category, |
FramePassTimer & | timer ) |
Unregisters a render pass timer.
[in] | category | The timer category name. |
[in] | timer | The timer to unregister. |
|
protected |
The debug overlays.
|
protected |
|
protected |
The wanted time for a frame.
Referenced by getFrameTime().
|
protected |
The elapsed time for the last frame.
Referenced by getLastFrameTime().
|
protected |
The current RenderSystem.
|
protected |
The wanted FPS, used in threaded render mode.
Referenced by getWantedFps().
|
staticconstexpr |