class hiro::draw::RenderSystem
Overview
Class responsible for rendering loop implementation and its optimization. More…
#include <RenderSystem.h> class RenderSystem { public: // enums enum Mode; // structs struct SceneData; // construction RenderSystem(const glm::uvec2& size, Mode mode = Mode::visualizer); RenderSystem(const glm::uvec2& size, const glw::PProgramList& programlist_ptr, Mode mode); // methods void SetFramebufferSize(const glm::uvec2& size); void SetShaderBuildDirectory(const std::string& directory); void SetBackgroundColor(const cogs::Color3f& color); hiro::draw::TextRenderer* GetTextRenderer(); uint32_t AddScene(const hiro::draw::PScene& scene); void RemoveScene(const hiro::draw::PScene& scene); hiro::draw::PScene GetScene(const uint32_t scene_id); uint32_t AddLight(const hiro::shader::Light& light); void SetLight(uint32_t light_id, const hiro::shader::Light& light); void LoadShaders(); void ReloadShaders(); void Render(); void SetAntiAliasingMethod(AntiAliasing method); AntiAliasing GetAntiAliasingMethod(); glm::uvec2 GetFrameBufferSize(); void EnableShadowing(const glm::uvec2& shadowmap_buffer_resolution, bool light_areas_outside_shadowmap = true); void DisableShadowing(); bool IsShadowingEnabled() const; uint8_t GetAxisLayer() const; void SetAxisLayer(uint8_t layer); uint8_t GetGroundLayer() const; void SetGroundLayer(uint8_t layer); glw::PTexture2D GetPositionsAndShininessTex() const; glw::PTexture2D GetNormalsAndSpecularTex() const; glw::PTexture2D GetColorsAndLightingTex() const; glw::PTexture2D GetShadowMaskTex() const; glw::PTexture2D GetShadowmapTex() const; glw::PTexture2D GetLabelTex() const; };
Detailed Documentation
Class responsible for rendering loop implementation and its optimization.
Construction
RenderSystem(const glm::uvec2& size, const glw::PProgramList& programlist_ptr, Mode mode)
Creates instance with shared shader program list.
Methods
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.
Stored data is of type float32. First 3 channels are position x, y, z. The last channels is material shininess parameter.
glw::PTexture2D 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.
glw::PTexture2D 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.
glw::PTexture2D GetShadowMaskTex() const
Returns 1-channel texture of shadow mask.
Stored data is of type uint8_norm.
glw::PTexture2D GetShadowmapTex() const
When shadowmapping is enabled, returns shadow depth map.
This method will return nullptr until EnableShadowing is called.
glw::PTexture2D GetLabelTex() const
Returns 1-channel texture representing segmentation labels.
Stored data is of type uint32.