|
lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
|
Manages the rendering of scenes. More...
#include <renderer.hpp>
Public Member Functions | |
| Renderer () | |
| Constructor for the Renderer class. | |
| ~Renderer ()=default | |
| Destructor for the Renderer class. | |
| void | render (std::shared_ptr< scene::Scene > scene, std::shared_ptr< scene::Camera > camera) |
| Render a scene from the perspective of a camera. | |
| void | set_render_mode (RenderMode mode) |
| Set the rendering mode. | |
| void | set_culling (bool enabled) |
| Enable or disable face culling. | |
| void | set_depth_test (bool enabled) |
| Enable or disable depth testing. | |
| void | set_blending (bool enabled) |
| Enable or disable blending. | |
| RenderMode | get_render_mode () const |
| Get the current rendering mode. | |
| unsigned int | get_draw_calls () const |
| Get the number of draw calls made in the last render. | |
| unsigned int | get_triangles_count () const |
| Get the number of triangles rendered in the last render. | |
| void | resize (int width, int height) |
| Resizes the framebuffer to specific width and height. | |
| void | set_tone_map_mode (int mode) |
| Sets the tone map mode. | |
| void | set_exposure (float exposure) |
| Sets the exposure of the tone map. | |
| void | set_gamma (float gamma) |
| Sets the gamma of the tone map. | |
| void | enable_post_processing (bool enabled) |
| Enables post processing effects based on tone map mode and exposure/gamma. | |
| void | set_bloom_enabled (bool enabled) |
| Enable or disable bloom effect. | |
| void | set_bloom_threshold (float threshold) |
| Sets the bloom brightness threshold. | |
| void | set_bloom_intensity (float intensity) |
| Sets the bloom intensity/strength. | |
Manages the rendering of scenes.
This class is responsible for rendering 3D scenes using OpenGL. It handles the rendering pipeline, including setting up the camera, managing render modes, and optimizing draw calls.
| lmgl::renderer::Renderer::Renderer | ( | ) |
Constructor for the Renderer class.
Initializes the renderer with default settings.
|
default |
Destructor for the Renderer class.
Cleans up any resources used by the renderer.
| void lmgl::renderer::Renderer::enable_post_processing | ( | bool | enabled | ) |
Enables post processing effects based on tone map mode and exposure/gamma.
| enabled | Whether the postprocessing effects are enabled. |
|
inline |
Get the number of draw calls made in the last render.
This method returns the number of draw calls that were made during the last rendering operation.
|
inline |
Get the current rendering mode.
This method returns the current rendering mode of the renderer.
|
inline |
Get the number of triangles rendered in the last render.
This method returns the total number of triangles that were rendered during the last rendering operation.
| void lmgl::renderer::Renderer::render | ( | std::shared_ptr< scene::Scene > | scene, |
| std::shared_ptr< scene::Camera > | camera ) |
Render a scene from the perspective of a camera.
This method takes a scene and a camera as input and renders the scene using the specified camera's view and projection matrices. It also applies the current render mode and handles depth testing and blending based on the renderer's settings.
| scene | Shared pointer to the scene to be rendered. |
| camera | Shared pointer to the camera used for rendering. |
| void lmgl::renderer::Renderer::resize | ( | int | width, |
| int | height ) |
Resizes the framebuffer to specific width and height.
| width | The width to resize to. |
| height | The height to resize to. |
| void lmgl::renderer::Renderer::set_blending | ( | bool | enabled | ) |
Enable or disable blending.
This method allows toggling blending, which is used for rendering transparent objects.
| enabled | True to enable blending, false to disable. |
|
inline |
Enable or disable bloom effect.
| enabled | True to enable bloom, false otherwise. |
|
inline |
Sets the bloom intensity/strength.
| intensity | Bloom intensity (default 0.5f). |
|
inline |
Sets the bloom brightness threshold.
Only pixels brighter than this value will bloom.
| threshold | Brightness threshold (default 1.0f). |
| void lmgl::renderer::Renderer::set_culling | ( | bool | enabled | ) |
Enable or disable face culling.
This method allows toggling face culling, which can improve performance by not rendering faces of geometry that are not visible to the camera.
| enabled | True to enable culling, false to disable. |
| void lmgl::renderer::Renderer::set_depth_test | ( | bool | enabled | ) |
Enable or disable depth testing.
This method allows toggling depth testing, which ensures that closer objects are rendered in front of farther ones.
| enabled | True to enable depth testing, false to disable. |
|
inline |
Sets the exposure of the tone map.
| exposure | The exposure float value. |
|
inline |
Sets the gamma of the tone map.
| gamma | The gamma float value. |
| void lmgl::renderer::Renderer::set_render_mode | ( | RenderMode | mode | ) |
Set the rendering mode.
This method allows changing the rendering mode of the renderer. The mode can be set to solid, wireframe, or points, affecting how the geometry is displayed.
| mode | The desired rendering mode. |
|
inline |
Sets the tone map mode.
The tone map modes are:
| mode | The tone map mode. |