#include <OSDLRenderer.h>
Inheritance diagram for OSDL::Rendering::Renderer:
Note that renderers and views are not dedicated to the graphical output, since they have to take in charge all multimedia fields, including sounds and, possibly, other media.
The privilegied way of organizing the rendering is to have renderers taking care of all its aspects (video, but also audio, etc.).
Renderers are not necessarily singletons, but having only one centralized instance for all views might be simpler. In this case it is called a root renderer. A root renderer may delegate part of its task to specialized sub-renderers.
More precisely, the scheduler will call only one of them, the root renderer, which may delegate a part of its charge to any number of specialized renderers, for example if multiple viewports are used in the same window, or for the sound, or to take advantage of multicore processors.
A renderer knows all the views (as defined by the MVC framework) it is in charge of, but only them (not their model for instance).
However no data structure is provided with this generic renderer, $ since it may vary a lot depending on the need, from simple list to BSP trees, etc.
Ceylan::View
Definition at line 84 of file OSDLRenderer.h.
Public Member Functions | |
Renderer (bool registerToScheduler=true) throw ( RenderingException ) | |
Constructs a new renderer. | |
virtual | ~Renderer () throw () |
Virtual destructor, no view is destroyed. | |
virtual void | render (Events::RenderingTick currentRenderingTick=0) throw () |
Triggers the actual rendering of all views, for specified rendering tick, if any. | |
virtual void | onRenderingSkipped (Events::RenderingTick skippedRenderingTick) throw () |
Allows the renderer to be aware that a rendering step has to be skipped. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static bool | HasExistingRootRenderer () throw () |
Tells whether a root renderer is available. | |
static Renderer & | GetExistingRootRenderer () throw ( RenderingException ) |
Returns the one and only one root renderer instance that may be already available. | |
static void | DeleteExistingRootRenderer () throw ( RenderingException ) |
Deletes the existing root renderer. | |
static void | DeleteRootRenderer () throw () |
Deletes the root renderer, if any. | |
Protected Attributes | |
RenderCount | _renderingDone |
Counts the number of renderings achieved. | |
RenderCount | _renderingSkipped |
Counts the number of renderings skipped. | |
Events::RenderingTick | _lastRender |
Records the last rendering tick. | |
Private Member Functions | |
Renderer (const Renderer &source) throw () | |
Copy constructor made private to ensure that it will never be called. | |
Renderer & | operator= (const Renderer &source) throw () |
Assignment operator made private to ensure that it will never be called. | |
Static Private Attributes | |
static Renderer * | _internalRootRenderer |
The internal single instance of renderer, at the top of the renderer hierarchy, if any. |
Renderer::Renderer | ( | bool | registerToScheduler = true |
) | throw ( RenderingException ) [explicit] |
Constructs a new renderer.
registerToScheduler | iff true, then a scheduler is supposed to exist already, and this renderer is automatically registered to this scheduler so that it gets called at each rendering tick. |
RenderingException | if registerToScheduler is true and no scheduler is available. |
Definition at line 48 of file OSDLRenderer.cc.
Renderer::~Renderer | ( | ) | throw () [virtual] |
OSDL::Rendering::Renderer::Renderer | ( | const Renderer & | source | ) | throw () [explicit, private] |
Copy constructor made private to ensure that it will never be called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
void Renderer::render | ( | Events::RenderingTick | currentRenderingTick = 0 |
) | throw () [virtual] |
Triggers the actual rendering of all views, for specified rendering tick, if any.
currentRenderingTick | the rendering tick corresponding to this render step. If the renderer is called from a basic event loop (no scheduler is used), then the rendering tick is meaningless and is always zero. |
Reimplemented in OSDL::Rendering::AudioRenderer, OSDL::Rendering::MultimediaRenderer, and OSDL::Rendering::VideoRenderer.
Definition at line 80 of file OSDLRenderer.cc.
References OSDL_RENDER_LOG.
void Renderer::onRenderingSkipped | ( | Events::RenderingTick | skippedRenderingTick | ) | throw () [virtual] |
Allows the renderer to be aware that a rendering step has to be skipped.
It may be a chance for it to trigger counter-measures, such as decreasing the level of detail in order not to slow down the whole process.
skippedRenderingTick | the rendering tick that had to be skipped. |
Reimplemented in OSDL::Rendering::AudioRenderer, OSDL::Rendering::MultimediaRenderer, and OSDL::Rendering::VideoRenderer.
Definition at line 95 of file OSDLRenderer.cc.
References OSDL_RENDER_LOG.
const string Renderer::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented in OSDL::Rendering::AudioRenderer, OSDL::Rendering::MultimediaRenderer, and OSDL::Rendering::VideoRenderer.
Definition at line 104 of file OSDLRenderer.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Engine::Scheduler::schedule().
bool Renderer::HasExistingRootRenderer | ( | ) | throw () [static] |
Tells whether a root renderer is available.
Definition at line 123 of file OSDLRenderer.cc.
References _internalRootRenderer.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop().
Renderer & Renderer::GetExistingRootRenderer | ( | ) | throw ( RenderingException ) [static] |
Returns the one and only one root renderer instance that may be already available.
RenderingException | if there is no root renderer already available. |
Definition at line 131 of file OSDLRenderer.cc.
References _internalRootRenderer.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop().
void Renderer::DeleteExistingRootRenderer | ( | ) | throw ( RenderingException ) [static] |
Deletes the existing root renderer.
RenderingException | if not renderer was available. |
Definition at line 142 of file OSDLRenderer.cc.
References _internalRootRenderer.
void Renderer::DeleteRootRenderer | ( | ) | throw () [static] |
Deletes the root renderer, if any.
Definition at line 157 of file OSDLRenderer.cc.
References _internalRootRenderer.
Assignment operator made private to ensure that it will never be called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
RenderCount OSDL::Rendering::Renderer::_renderingDone [protected] |
Records the last rendering tick.
Useful to check whether no rendering tick was missed.
Definition at line 237 of file OSDLRenderer.h.
Renderer * Renderer::_internalRootRenderer [static, private] |
The internal single instance of renderer, at the top of the renderer hierarchy, if any.
Definition at line 279 of file OSDLRenderer.h.
Referenced by DeleteExistingRootRenderer(), DeleteRootRenderer(), GetExistingRootRenderer(), and HasExistingRootRenderer().