Loading [MathJax]/jax/input/TeX/config.js
Radium Engine  1.5.28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Ra::Dataflow::Rendering::Renderer::DataflowRenderer Class Reference

#include <Dataflow/Rendering/Renderer/DataflowRenderer.hpp>

+ Inheritance diagram for Ra::Dataflow::Rendering::Renderer::DataflowRenderer:
+ Collaboration diagram for Ra::Dataflow::Rendering::Renderer::DataflowRenderer:

Classes

struct  RenderGraphController
 

Public Member Functions

 DataflowRenderer (RenderGraphController &controller)
 Construct a renderer configured and managed through the controller.
 
 ~DataflowRenderer () override
 The destructor is used to destroy the render graph.
 
std::string getRendererName () const override
 Get the name of the renderer, e.g to be displayed in the UI.
 
bool buildRenderTechnique (Ra::Engine::Rendering::RenderObject *ro) const override
 
Ra::Engine::Scene::LightManagergetLightManager ()
 Access the default light manager.
 
RenderGraphControllergetController ()
 Access the controller.
 
std::map< std::string, std::shared_ptr< Ra::Engine::Data::Texture > > & sharedTextures ()
 
globjects::Framebuffer * postprocessFbo ()
 
std::vector< RenderObjectPtr > * allRenderObjects ()
 
std::vector< const Ra::Engine::Scene::Light * > * getLights ()
 
- Public Member Functions inherited from Ra::Engine::Rendering::Renderer
 Renderer ()
 
const TimerDatagetTimerData () const
 
Data::TexturegetDisplayTexture () 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 :
 
void initialize (uint width, uint height)
 Initialize renderer.
 
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)
 
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::ColorgetBackgroundColor () 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.
 
virtual std::vector< std::stringgetAvailableTextures () const
 Return the names of renderer available textures.
 
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 Member Functions

void initializeInternal () override
 Sets the display sink node.
 
void resizeInternal () override
 
void updateStepInternal (const Ra::Engine::Data::ViewingParameters &renderData) override
 
void renderInternal (const Ra::Engine::Data::ViewingParameters &renderData) override
 All the scene rendering magics basically happens here.
 
void postProcessInternal (const Ra::Engine::Data::ViewingParameters &renderData) override
 Do all post processing stuff. If you override this method, be careful to fill.
 
void debugInternal (const Ra::Engine::Data::ViewingParameters &renderData) override
 Add the debug layer with useful informations.
 
void uiInternal (const Ra::Engine::Data::ViewingParameters &renderData) override
 Draw the UI data.
 
virtual void initResources ()
 
- Protected Member Functions inherited from Ra::Engine::Rendering::Renderer

Additional Inherited Members

- Public Types inherited from Ra::Engine::Rendering::Renderer
enum  PickingMode {
  RO = 0 , VERTEX , EDGE , TRIANGLE ,
  C_VERTEX , C_EDGE , C_TRIANGLE , NONE
}
 
enum  PickingPurpose { SELECTION = 0 , MANIPULATION }
 
- Protected Types inherited from Ra::Engine::Rendering::Renderer
using RenderObjectPtr = std::shared_ptr<RenderObject>
 
- Protected Attributes inherited from Ra::Engine::Rendering::Renderer
uint m_width { 0 }
 
uint m_height { 0 }
 
Data::ShaderProgramManagerm_shaderProgramManager { nullptr }
 
RenderObjectManager * m_renderObjectManager { nullptr }
 
Data::Texturem_displayedTexture { nullptr }
 The texture that will be displayed on screen. If no call to.
 
std::vector< Ra::Engine::Scene::LightManager * > m_lightmanagers
 
bool m_renderQueuesUpToDate { false }
 
std::vector< RenderObjectPtrm_fancyRenderObjects
 
std::vector< RenderObjectPtrm_debugRenderObjects
 
std::vector< RenderObjectPtrm_xrayRenderObjects
 
std::vector< RenderObjectPtrm_uiRenderObjects
 
std::unique_ptr< Data::Displayablem_quadMesh
 
bool m_drawDebug { true }
 
bool m_wireframe { false }
 
bool m_postProcessEnabled { true }
 
std::unique_ptr< Data::Texturem_depthTexture
 Depth texture : might be attached to the main framebuffer.
 
std::unique_ptr< Data::Texturem_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.
 

Detailed Description

Dataflow renderer for the Radium Engine This Renderer is fully configurable, either dynamically or programmatically. It implements the Ra::Engine::Rendering/Renderer interface.

A NodeBasedRenderer is configured by using the RenderControlFunctor given at construction. A RenderControlFunctor offers the following services :

  • configure() : add to the renderer as many RadiumNBR::RenderPass as needed. This method is called once when initializing the renderer. This method could also initialize internal resources into the controller that could be used to control the rendering.
  • resize() : called each time the renderer output is resized. This will allow modify controller resources that depends on the size of the output (e.g. internal textures ...)
  • update() : Called once before each frame to update the internal state of the renderer.

A NodeBasedRenderer defines two textures that might be shared between passes :

  • a depth buffer attachable texture, stored with the key "Depth (RadiumNBR)" into the shared textures collection
  • a Linear space RGBA color texture, stored with the key "Linear RGB (RadiumNBR)" into the shared textures collection

If requested on the base Ra::Engine::Rendering::Renderer, a NodeBasedRenderer apply a post-process step on the "Linear RGB (RadiumNBR)" that convert colors from linearRGB to sRGB color space before displaying the image.

See also
rendering.md for description of the renderer

Definition at line 56 of file DataflowRenderer.hpp.

Constructor & Destructor Documentation

◆ DataflowRenderer()

Ra::Dataflow::Rendering::Renderer::DataflowRenderer::DataflowRenderer ( RenderGraphController & controller)
explicit

Construct a renderer configured and managed through the controller.

Definition at line 90 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ allRenderObjects()

std::vector< RenderObjectPtr > * Ra::Dataflow::Rendering::Renderer::DataflowRenderer::allRenderObjects ( )
inline

Definition at line 167 of file DataflowRenderer.hpp.

◆ buildRenderTechnique()

bool Ra::Dataflow::Rendering::Renderer::DataflowRenderer::buildRenderTechnique ( Ra::Engine::Rendering::RenderObject * ro) const
overridevirtual

Define, for the given render object, the render technique cooresponding to the renderer.

Parameters
rothe render object to modofy
Returns
True if the renderTechnique was defined.

Implements Ra::Engine::Rendering::Renderer.

Definition at line 101 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ debugInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::debugInternal ( const Ra::Engine::Data::ViewingParameters & renderData)
overrideprotectedvirtual

Add the debug layer with useful informations.

Implements Ra::Engine::Rendering::Renderer.

Definition at line 231 of file DataflowRenderer.cpp.

◆ getController()

RenderGraphController & Ra::Dataflow::Rendering::Renderer::DataflowRenderer::getController ( )
inline

Access the controller.

Definition at line 117 of file DataflowRenderer.hpp.

◆ getLightManager()

Ra::Engine::Scene::LightManager * Ra::Dataflow::Rendering::Renderer::DataflowRenderer::getLightManager ( )
inline

Access the default light manager.

Definition at line 114 of file DataflowRenderer.hpp.

◆ getLights()

std::vector< const Ra::Engine::Scene::Light * > * Ra::Dataflow::Rendering::Renderer::DataflowRenderer::getLights ( )
inline

Definition at line 169 of file DataflowRenderer.hpp.

◆ getRendererName()

std::string Ra::Dataflow::Rendering::Renderer::DataflowRenderer::getRendererName ( ) const
inlinenodiscardoverridevirtual

Get the name of the renderer, e.g to be displayed in the UI.

Returns

Implements Ra::Engine::Rendering::Renderer.

Definition at line 109 of file DataflowRenderer.hpp.

◆ initializeInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::initializeInternal ( )
overrideprotectedvirtual

Sets the display sink node.

Loads the render graph from a Json file. Gets the Json file path Sets the Json file path Reloads the render graph Reloads the render graph according to the current Json file Raises the flag to reload the Json

Implements Ra::Engine::Rendering::Renderer.

Definition at line 125 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ initResources()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::initResources ( )
protectedvirtual

Initialize internal resources for the renderer. The base function creates the depth and final color texture to be shared by the rendering passes that need them.

Definition at line 113 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ postprocessFbo()

globjects::Framebuffer * Ra::Dataflow::Rendering::Renderer::DataflowRenderer::postprocessFbo ( )
inline

Definition at line 165 of file DataflowRenderer.hpp.

◆ postProcessInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::postProcessInternal ( const Ra::Engine::Data::ViewingParameters & renderData)
overrideprotectedvirtual

Do all post processing stuff. If you override this method, be careful to fill.

See also
m_fancyTexture since it is the texture that will be displayed at the very end of the
render method.
Parameters
renderDataThe basic data needed for the rendering : Time elapsed since last frame, camera view matrix, camera projection matrix.

Implements Ra::Engine::Rendering::Renderer.

Definition at line 208 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ renderInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::renderInternal ( const Ra::Engine::Data::ViewingParameters & renderData)
overrideprotectedvirtual

All the scene rendering magics basically happens here.

Parameters
renderDataThe basic data needed for the rendering : Time elapsed since last frame, camera view matrix, camera projection matrix.

Implements Ra::Engine::Rendering::Renderer.

Definition at line 189 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ resizeInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::resizeInternal ( )
overrideprotectedvirtual

resize the renderer dependent resources

Implements Ra::Engine::Rendering::Renderer.

Definition at line 150 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

◆ sharedTextures()

std::map< std::string, std::shared_ptr< Ra::Engine::Data::Texture > > & Ra::Dataflow::Rendering::Renderer::DataflowRenderer::sharedTextures ( )
inline

Definition at line 161 of file DataflowRenderer.hpp.

◆ uiInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::uiInternal ( const Ra::Engine::Data::ViewingParameters & renderData)
overrideprotectedvirtual

Draw the UI data.

Implements Ra::Engine::Rendering::Renderer.

Definition at line 233 of file DataflowRenderer.cpp.

◆ updateStepInternal()

void Ra::Dataflow::Rendering::Renderer::DataflowRenderer::updateStepInternal ( const Ra::Engine::Data::ViewingParameters & renderData)
overrideprotectedvirtual

Update the renderer dependent resources for the next frame

Parameters
renderData

Implements Ra::Engine::Rendering::Renderer.

Definition at line 167 of file DataflowRenderer.cpp.

+ Here is the call graph for this function:

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