This basic renderer manages the rendering of all registered views. More...
#include <OSDLRenderer.h>
Public Member Functions | |
Renderer (bool registerToScheduler=true) | |
Constructs a new renderer. | |
virtual | ~Renderer () throw () |
Virtual destructor, no view is destroyed. | |
virtual void | render (Events::RenderingTick currentRenderingTick=0) |
Triggers the actual rendering of all views, for specified rendering tick, if any. | |
virtual void | onRenderingSkipped (Events::RenderingTick skippedRenderingTick) |
Allows the renderer to be aware that a rendering step had to be skipped. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static bool | HasExistingRootRenderer () |
Tells whether a root renderer is available. | |
static Renderer & | GetExistingRootRenderer () |
Returns the one and only one root renderer instance that may be already available. | |
static void | DeleteExistingRootRenderer () |
Deletes the existing root renderer. | |
static void | DeleteRootRenderer () |
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) | |
Copy constructor made private to ensure that it will never be called. | |
Renderer & | operator= (const Renderer &source) |
Assignment operator made private to ensure that it will never be called. | |
Static Private Attributes | |
static Renderer * | _internalRootRenderer = 0 |
The internal single instance of renderer, at the top of the renderer hierarchy, if any. |
This basic renderer manages the rendering of all registered views.
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 privileged way of organizing the rendering is to have renderers taking care of all multimedia 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.
Views are not owned by the renderer.
Definition at line 117 of file OSDLRenderer.h.
Renderer::Renderer | ( | bool | registerToScheduler = true |
) | [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 81 of file OSDLRenderer.cc.
Renderer::~Renderer | ( | ) | throw () [virtual] |
Virtual destructor, no view is destroyed.
Definition at line 109 of file OSDLRenderer.cc.
OSDL::Rendering::Renderer::Renderer | ( | const Renderer & | source | ) | [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::DeleteExistingRootRenderer | ( | ) | [static] |
Deletes the existing root renderer.
RenderingException | if not renderer was available. |
Definition at line 185 of file OSDLRenderer.cc.
void Renderer::DeleteRootRenderer | ( | ) | [static] |
Deletes the root renderer, if any.
Definition at line 201 of file OSDLRenderer.cc.
Renderer & Renderer::GetExistingRootRenderer | ( | ) | [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 173 of file OSDLRenderer.cc.
Referenced by OSDL::Rendering::AudioRenderer::AudioRenderer(), OSDL::Events::EventsModule::enterBasicMainLoop(), and OSDL::Rendering::VideoRenderer::VideoRenderer().
bool Renderer::HasExistingRootRenderer | ( | ) | [static] |
Tells whether a root renderer is available.
Definition at line 164 of file OSDLRenderer.cc.
References _internalRootRenderer.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop().
virtual void OSDL::Rendering::Renderer::onRenderingSkipped | ( | Events::RenderingTick | skippedRenderingTick | ) | [virtual] |
Allows the renderer to be aware that a rendering step had 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, or simply notifying the views of the skip.
skippedRenderingTick | the rendering tick that had to be skipped. |
Reimplemented in OSDL::Rendering::AudioRenderer, OSDL::Rendering::MultimediaRenderer, OSDL::Rendering::StandardRenderer, and OSDL::Rendering::VideoRenderer.
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.
virtual void OSDL::Rendering::Renderer::render | ( | Events::RenderingTick | currentRenderingTick = 0 |
) | [virtual] |
Triggers the actual rendering of all views, for specified rendering tick, if any.
This default implementation does nothing except some logging and accounting of rendereding ticks.
currentRenderingTick | the rendering tick corresponding to this render step. |
Reimplemented in OSDL::Rendering::AudioRenderer, OSDL::Rendering::MultimediaRenderer, OSDL::Rendering::StandardRenderer, and OSDL::Rendering::VideoRenderer.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop().
const string Renderer::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [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, OSDL::Rendering::StandardRenderer, and OSDL::Rendering::VideoRenderer.
Definition at line 144 of file OSDLRenderer.cc.
References _lastRender, _renderingDone, and _renderingSkipped.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop(), OSDL::Engine::Scheduler::schedule(), and OSDL::Engine::Scheduler::toString().
Renderer * Renderer::_internalRootRenderer = 0 [static, private] |
The internal single instance of renderer, at the top of the renderer hierarchy, if any.
Reimplemented in OSDL::Rendering::StandardRenderer.
Definition at line 328 of file OSDLRenderer.h.
Referenced by HasExistingRootRenderer().
Records the last rendering tick.
Useful to check whether no rendering tick was missed.
Definition at line 287 of file OSDLRenderer.h.
Referenced by OSDL::Rendering::VideoRenderer::toString(), OSDL::Rendering::StandardRenderer::toString(), toString(), OSDL::Rendering::MultimediaRenderer::toString(), and OSDL::Rendering::AudioRenderer::toString().
RenderCount OSDL::Rendering::Renderer::_renderingDone [protected] |
Counts the number of renderings achieved.
Definition at line 269 of file OSDLRenderer.h.
Referenced by OSDL::Rendering::VideoRenderer::toString(), OSDL::Rendering::StandardRenderer::toString(), toString(), OSDL::Rendering::MultimediaRenderer::toString(), and OSDL::Rendering::AudioRenderer::toString().
Counts the number of renderings skipped.
Definition at line 277 of file OSDLRenderer.h.
Referenced by OSDL::Rendering::VideoRenderer::toString(), OSDL::Rendering::StandardRenderer::toString(), toString(), OSDL::Rendering::MultimediaRenderer::toString(), and OSDL::Rendering::AudioRenderer::toString().