HIRO_DRAW
Computer Graphics Structures library
hiro::draw::RenderSystem Class Reference

Class responsible for rendering loop implementation and its optimization. More...

Public Types

enum  Mode { Mode::visualizer, Mode::deferred_only }
 

Public Member Functions

 RenderSystem (const glm::uvec2 &size, Mode mode=Mode::visualizer)
 
 RenderSystem (const glm::uvec2 &size, const glw::PProgramList &programlist_ptr, Mode mode)
 Creates instance with shared shader program list.
 
void SetFramebufferSize (const glm::uvec2 &size)
 Set up size of output buffer, targeted for render.
 
void SetShaderBuildDirectory (const std::string &directory)
 Set up directory from where render objects load their shaders.
 
void SetBackgroundColor (const cogs::Color3f &color)
 Set up initial buffer color. Only used if enabled in Render method.
 
hiro::draw::TextRenderer * GetTextRenderer ()
 Returns handle to the TextRenderer class.
 
uint32_t AddScene (const hiro::draw::PScene &scene)
 Add a scene to the list of scenes to be rendered. Returns scene index.
 
void RemoveScene (const hiro::draw::PScene &scene)
 Removes the scene from the list of scenes to be rendered.
 
hiro::draw::PScene GetScene (const uint32_t scene_id)
 Returns scene from the list of scenes to be rendered, by scene index.
 
uint32_t AddLight (const hiro::shader::Light &light)
 Add light to the renderer, returns index of the added light.
 
void SetLight (uint32_t light_id, const hiro::shader::Light &light)
 Chenge light with the specified id in the renderer.
 
void LoadShaders ()
 Loads all not-loaded shaders required by renderer and all objects from added scenes.
 
void ReloadShaders ()
 Forces reload of all shaders required by renderer and all objects from added scenes.
 
void Render ()
 Render all objects from all added scenes.
 
void SetAntiAliasingMethod (AntiAliasing method)
 Set whether The renderer should use MSAA. Disabled by default.
 
AntiAliasing GetAntiAliasingMethod ()
 Checks whether is MSAA currently in use.
 
glm::uvec2 GetFrameBufferSize ()
 Returns current resolution of render frame buffer.
 
void EnableShadowing (const glm::uvec2 &shadowmap_buffer_resolution, bool light_areas_outside_shadowmap=true)
 Enables shadow mapping and initializes shadow map buffer with specified resolution.
 
void DisableShadowing ()
 Disables shadow mapping.
 
bool IsShadowingEnabled () const
 Check if shadow mapping is enabled.
 
uint8_t GetAxisLayer () const
 Returns the layer on which is axis overlay feature rendered.
 
void SetAxisLayer (uint8_t layer)
 Changes the layer on which is axis overlay feature rendered. Default is equal to hiro::draw::DEFAULT_GROUND_OVERLAY_LAYER.
 
uint8_t GetGroundLayer () const
 Returns the layer on which is ground grid overlay feature rendered.
 
void SetGroundLayer (uint8_t layer)
 Changes the layer on which is ground grid overlay feature rendered. Default is equal to hiro::draw::DEFAULT_AXIS_OVERLAY_LAYER.
 
glw::PTexture2D GetPositionsAndShininessTex () const
 Returns 4-channel texture of position and shininess parameters. More...
 
glw::PTexture2D GetNormalsAndSpecularTex () const
 Returns 4-channel texture of normal and intensity parameters. More...
 
glw::PTexture2D GetColorsAndLightingTex () const
 Returns 4-channel texture of color and lighting parameters. More...
 
glw::PTexture2D GetShadowMaskTex () const
 Returns 1-channel texture of shadow mask. More...
 
glw::PTexture2D GetShadowmapTex () const
 When shadowmapping is enabled, returns shadow depth map. More...
 
glw::PTexture2D GetLabelTex () const
 Returns 1-channel texture representing segmentation labels. More...
 

Detailed Description

Class responsible for rendering loop implementation and its optimization.

Member Enumeration Documentation

◆ Mode

Enumerator
visualizer 

System renders scenes and calculates lighting and other effects. Final imagery is rendered to the currently bound frame buffer.

deferred_only 

System renders scenes and write them to the G-buffer that can be downloaded. No multi sample buffers are used in this mode, and no visual feedback is provided.

Member Function Documentation

◆ GetColorsAndLightingTex()

glw::PTexture2D hiro::draw::RenderSystem::GetColorsAndLightingTex ( ) const

Returns 4-channel texture of color and lighting parameters.

Stored data is of type uint8. First 3 channels are albedo color r,g,b. The last channels is boolean parameter telling whether lighting is use for the pixel.

◆ GetLabelTex()

glw::PTexture2D hiro::draw::RenderSystem::GetLabelTex ( ) const

Returns 1-channel texture representing segmentation labels.

Stored data is of type uint32.

◆ GetNormalsAndSpecularTex()

glw::PTexture2D hiro::draw::RenderSystem::GetNormalsAndSpecularTex ( ) const

Returns 4-channel texture of normal and intensity parameters.

Stored data is of type float32. First 3 channels are normal vector x, y, z. The last channels is material specular intensity parameter.

◆ GetPositionsAndShininessTex()

glw::PTexture2D hiro::draw::RenderSystem::GetPositionsAndShininessTex ( ) const

Returns 4-channel texture of position and shininess parameters.

Stored data is of type float32. First 3 channels are position x, y, z. The last channels is material shininess parameter.

◆ GetShadowmapTex()

glw::PTexture2D hiro::draw::RenderSystem::GetShadowmapTex ( ) const

When shadowmapping is enabled, returns shadow depth map.

This method will return nullptr until EnableShadowing is called.

◆ GetShadowMaskTex()

glw::PTexture2D hiro::draw::RenderSystem::GetShadowMaskTex ( ) const

Returns 1-channel texture of shadow mask.

Stored data is of type uint8_norm.