Radium Engine
1.5.0
|
#include <Engine/Rendering/Renderer.hpp>
Classes | |
struct | PickingQuery |
class | PickingResult |
Result of a PickingQuery. More... | |
struct | TimerData |
Public Types | |
enum | PickingMode { RO = 0 , VERTEX , EDGE , TRIANGLE , C_VERTEX , C_EDGE , C_TRIANGLE , NONE } |
enum | PickingPurpose { SELECTION = 0 , MANIPULATION } |
Public Member Functions | |
Renderer () | |
const TimerData & | getTimerData () const |
Data::Texture * | getDisplayTexture () const |
void | lockRendering () |
void | unlockRendering () |
void | toggleWireframe () |
void | enableWireframe (bool enabled) |
void | toggleDrawDebug () |
void | enableDebugDraw (bool enabled) |
void | enablePostProcess (bool enabled) |
void | render (const Data::ViewingParameters &renderData) |
Tell the renderer it needs to render. This method does the following steps : More... | |
void | initialize (uint width, uint height) |
Initialize renderer. More... | |
void | resize (uint width, uint height) |
Resize the viewport and all the screen textures, fbos. This function must be overrided as soon as some FBO or screensized texture is used (since the default implementation just resizes its own fbos / textures) More... | |
void | addPickingRequest (const PickingQuery &query) |
const std::vector< PickingResult > & | getPickingResults () const |
const std::vector< PickingQuery > & | getPickingQueries () const |
void | setMousePosition (const Core::Vector2 &pos) |
void | setBrushRadius (Scalar brushRadius) |
bool | hasLight () const |
Tell if the renderer has an usable light. | |
void | setBackgroundColor (const Core::Utils::Color &color) |
Update the background color (does not trigger a redraw) | |
const Core::Utils::Color & | getBackgroundColor () const |
virtual void | addLight (const Scene::Light *light) |
virtual void | reloadShaders () |
virtual void | displayTexture (const std::string &texName) |
Change the texture that is displayed on screen. Set m_displayedIsDepth to true if depth linearization is wanted. More... | |
virtual std::vector< std::string > | getAvailableTextures () const |
Return the names of renderer available textures. More... | |
virtual std::string | getRendererName () const =0 |
Get the name of the renderer, e.g to be displayed in the UI. More... | |
virtual bool | buildRenderTechnique (RenderObject *ro) const =0 |
int | buildAllRenderTechniques () const |
virtual std::unique_ptr< uchar[]> | grabFrame (size_t &w, size_t &h) const |
PickingResult | doPickingNow (const PickingQuery &query, const Data::ViewingParameters &renderData) |
Protected Types | |
using | RenderObjectPtr = std::shared_ptr< RenderObject > |
Protected Member Functions | |
virtual void | initializeInternal ()=0 |
initializeInternal Initialize the renderer dependant resources. | |
virtual void | resizeInternal ()=0 |
virtual void | updateStepInternal (const Data::ViewingParameters &renderData)=0 |
virtual void | renderInternal (const Data::ViewingParameters &renderData)=0 |
All the scene rendering magics basically happens here. More... | |
virtual void | postProcessInternal (const Data::ViewingParameters &renderData)=0 |
Do all post processing stuff. If you override this method, be careful to fill. More... | |
virtual void | debugInternal (const Data::ViewingParameters &renderData)=0 |
Add the debug layer with useful informations. | |
virtual void | uiInternal (const Data::ViewingParameters &renderData)=0 |
Draw the UI data. | |
Protected Attributes | |
uint | m_width { 0 } |
uint | m_height { 0 } |
Data::ShaderProgramManager * | m_shaderProgramManager { nullptr } |
RenderObjectManager * | m_renderObjectManager { nullptr } |
Data::Texture * | m_displayedTexture { nullptr } |
The texture that will be displayed on screen. If no call to. More... | |
std::vector< Ra::Engine::Scene::LightManager * > | m_lightmanagers |
bool | m_renderQueuesUpToDate { false } |
std::vector< RenderObjectPtr > | m_fancyRenderObjects |
std::vector< RenderObjectPtr > | m_debugRenderObjects |
std::vector< RenderObjectPtr > | m_xrayRenderObjects |
std::vector< RenderObjectPtr > | m_uiRenderObjects |
std::unique_ptr< Data::Displayable > | m_quadMesh |
bool | m_drawDebug { true } |
bool | m_wireframe { false } |
bool | m_postProcessEnabled { true } |
std::unique_ptr< Data::Texture > | m_depthTexture |
Depth texture : might be attached to the main framebuffer. | |
std::unique_ptr< Data::Texture > | m_fancyTexture |
Final color texture : might be attached to the main framebuffer. | |
std::map< std::string, Data::Texture * > | m_secondaryTextures |
Textures exposed in the texture section box to be displayed. | |
Abstract renderer for the engine.
Definition at line 44 of file Renderer.hpp.
Picking mode
Definition at line 65 of file Renderer.hpp.
Picking purpose Used to identify what picking operation is realized
Definition at line 80 of file Renderer.hpp.
Ra::Engine::Rendering::Renderer::Renderer | ( | ) |
Abstract rendere constructor
could be called without openGL context. Call initialize once the openGL rendering context is available before using the renderer
Definition at line 47 of file Renderer.cpp.
|
virtual |
Add a light to the renderer. may be overridden to filter the light or to specialize the way ligths are added to the renderer ...
light |
Definition at line 750 of file Renderer.cpp.
|
inline |
Add a new picking query for the next rendering
query |
Definition at line 591 of file Renderer.hpp.
int Ra::Engine::Rendering::Renderer::buildAllRenderTechniques | ( | ) | const |
Loops over all available renderobjects and, build the associated render technique using buildRenderTechnique(RenderObject *ro)
Definition at line 762 of file Renderer.cpp.
|
pure virtual |
Define, for the given render object, the render technique cooresponding to the renderer.
ro | the render object to modofy |
Implemented in Ra::Engine::Rendering::ForwardRenderer.
|
virtual |
Change the texture that is displayed on screen. Set m_displayedIsDepth to true if depth linearization is wanted.
texName | The texture to display. |
Definition at line 696 of file Renderer.cpp.
Renderer::PickingResult Ra::Engine::Rendering::Renderer::doPickingNow | ( | const PickingQuery & | query, |
const Data::ViewingParameters & | renderData | ||
) |
Read the depth value from m_pickingFbo depth buffer. Need to be overridden to take rendering fbo into account in your own renderer.
Definition at line 191 of file Renderer.cpp.
|
inline |
Set the debug rendering mode
enabled | true if rendering mode must include debug objects, false else |
Definition at line 583 of file Renderer.hpp.
|
inline |
set the post-process mode
enabled | true if post processing must bve applied before display. |
Definition at line 587 of file Renderer.hpp.
|
inline |
set the fill/wireframe rendering mode
enabled | true if rendering mode must be wireframe, false for fill render mode |
Definition at line 575 of file Renderer.hpp.
|
virtual |
Return the names of renderer available textures.
Definition at line 703 of file Renderer.cpp.
|
inline |
Get the currently displayed texture
Definition at line 559 of file Renderer.hpp.
|
inline |
Get the vector of picking queries. Queries in the returned vector correspond to results in the return vector by the function getPickingResults().
Definition at line 599 of file Renderer.hpp.
|
inline |
Get the vector of picking results. Results in the returned vector correspond to queries in the return vector by the function getPickingQueries().
Definition at line 595 of file Renderer.hpp.
|
pure virtual |
Get the name of the renderer, e.g to be displayed in the UI.
Implemented in Ra::Engine::Rendering::ForwardRenderer.
|
inline |
Extract the timings from las render
Definition at line 555 of file Renderer.hpp.
|
virtual |
get the content of the current frame
w | width of the region to grab |
h | heigth oif the region to grab |
Definition at line 717 of file Renderer.cpp.
void Ra::Engine::Rendering::Renderer::initialize | ( | uint | width, |
uint | height | ||
) |
Initialize renderer.
For internal resources management in a filesystem
Definition at line 56 of file Renderer.cpp.
|
inline |
Lock rendering. Usefull if there is multithread update of the rendering data
Definition at line 563 of file Renderer.hpp.
|
protectedpure virtual |
Do all post processing stuff. If you override this method, be careful to fill.
renderData | The basic data needed for the rendering : Time elapsed since last frame, camera view matrix, camera projection matrix. |
Implemented in Ra::Engine::Rendering::ForwardRenderer.
|
virtual |
Reload, recompile and relink all shaders and programmed internally used by the renderer.
Definition at line 713 of file Renderer.cpp.
void Ra::Engine::Rendering::Renderer::render | ( | const Data::ViewingParameters & | renderData | ) |
Tell the renderer it needs to render. This method does the following steps :
renderData | The basic data needed for the rendering : Time elapsed since last frame, camera view matrix, camera projection matrix. |
Definition at line 315 of file Renderer.cpp.
|
protectedpure virtual |
All the scene rendering magics basically happens here.
renderData | The basic data needed for the rendering : Time elapsed since last frame, camera view matrix, camera projection matrix. |
Implemented in Ra::Engine::Rendering::ForwardRenderer.
void Ra::Engine::Rendering::Renderer::resize | ( | uint | width, |
uint | height | ||
) |
Resize the viewport and all the screen textures, fbos. This function must be overrided as soon as some FBO or screensized texture is used (since the default implementation just resizes its own fbos / textures)
width | The new viewport width |
height | The new viewport height |
Definition at line 671 of file Renderer.cpp.
|
protectedpure virtual |
resize the renderer dependent resources
Implemented in Ra::Engine::Rendering::ForwardRenderer.
|
inline |
Toggle debug rendering
Definition at line 579 of file Renderer.hpp.
|
inline |
Toggle the fill/wireframe rendering mode
Definition at line 571 of file Renderer.hpp.
|
inline |
Unlock the rendering.
Definition at line 567 of file Renderer.hpp.
|
protectedpure virtual |
Update the renderer dependent resources for the next frame
renderData |
Implemented in Ra::Engine::Rendering::ForwardRenderer.
|
protected |
The texture that will be displayed on screen. If no call to.
Definition at line 451 of file Renderer.hpp.
|
protected |
A renderer could define several LightManager (for instance, one for point light, one other for infinite light ...)
Definition at line 455 of file Renderer.hpp.
|
protected |
This raw pointer is used as an alias to a std::unique_ptr own by the engine. It is guaranteed that the lifetime of the engine is longer than the lifetime of a Renderer.
Definition at line 442 of file Renderer.hpp.
|
protected |
This raw pointer is used as an alias to a std::unique_ptr own by the engine. It is guaranteed that the lifetime of the engine is longer than the lifetime of a Renderer.
Definition at line 436 of file Renderer.hpp.